@agenticprimitives/agent-resolution 0.0.0-alpha.1
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/LICENSE +21 -0
- package/README.md +319 -0
- package/dist/admission.d.ts +14 -0
- package/dist/admission.d.ts.map +1 -0
- package/dist/admission.js +137 -0
- package/dist/admission.js.map +1 -0
- package/dist/authority-ref.d.ts +38 -0
- package/dist/authority-ref.d.ts.map +1 -0
- package/dist/authority-ref.js +69 -0
- package/dist/authority-ref.js.map +1 -0
- package/dist/canonicalization.d.ts +16 -0
- package/dist/canonicalization.d.ts.map +1 -0
- package/dist/canonicalization.js +39 -0
- package/dist/canonicalization.js.map +1 -0
- package/dist/codec.d.ts +15 -0
- package/dist/codec.d.ts.map +1 -0
- package/dist/codec.js +34 -0
- package/dist/codec.js.map +1 -0
- package/dist/compose.d.ts +79 -0
- package/dist/compose.d.ts.map +1 -0
- package/dist/compose.js +235 -0
- package/dist/compose.js.map +1 -0
- package/dist/endpoint-control.d.ts +87 -0
- package/dist/endpoint-control.d.ts.map +1 -0
- package/dist/endpoint-control.js +174 -0
- package/dist/endpoint-control.js.map +1 -0
- package/dist/errors.d.ts +33 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +71 -0
- package/dist/errors.js.map +1 -0
- package/dist/freshness.d.ts +43 -0
- package/dist/freshness.d.ts.map +1 -0
- package/dist/freshness.js +100 -0
- package/dist/freshness.js.map +1 -0
- package/dist/grant-index.d.ts +21 -0
- package/dist/grant-index.d.ts.map +1 -0
- package/dist/grant-index.js +0 -0
- package/dist/grant-index.js.map +1 -0
- package/dist/grants.d.ts +100 -0
- package/dist/grants.d.ts.map +1 -0
- package/dist/grants.js +99 -0
- package/dist/grants.js.map +1 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +63 -0
- package/dist/index.js.map +1 -0
- package/dist/invitation.d.ts +43 -0
- package/dist/invitation.d.ts.map +1 -0
- package/dist/invitation.js +76 -0
- package/dist/invitation.js.map +1 -0
- package/dist/peer-attestation.d.ts +61 -0
- package/dist/peer-attestation.d.ts.map +1 -0
- package/dist/peer-attestation.js +128 -0
- package/dist/peer-attestation.js.map +1 -0
- package/dist/peer-gate.d.ts +73 -0
- package/dist/peer-gate.d.ts.map +1 -0
- package/dist/peer-gate.js +108 -0
- package/dist/peer-gate.js.map +1 -0
- package/dist/policy.d.ts +53 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +73 -0
- package/dist/policy.js.map +1 -0
- package/dist/ports.d.ts +59 -0
- package/dist/ports.d.ts.map +1 -0
- package/dist/ports.js +10 -0
- package/dist/ports.js.map +1 -0
- package/dist/projection.d.ts +74 -0
- package/dist/projection.d.ts.map +1 -0
- package/dist/projection.js +134 -0
- package/dist/projection.js.map +1 -0
- package/dist/proof.d.ts +76 -0
- package/dist/proof.d.ts.map +1 -0
- package/dist/proof.js +207 -0
- package/dist/proof.js.map +1 -0
- package/dist/publication.d.ts +123 -0
- package/dist/publication.d.ts.map +1 -0
- package/dist/publication.js +32 -0
- package/dist/publication.js.map +1 -0
- package/dist/records.d.ts +168 -0
- package/dist/records.d.ts.map +1 -0
- package/dist/records.js +83 -0
- package/dist/records.js.map +1 -0
- package/dist/references.d.ts +61 -0
- package/dist/references.d.ts.map +1 -0
- package/dist/references.js +7 -0
- package/dist/references.js.map +1 -0
- package/dist/results.d.ts +89 -0
- package/dist/results.d.ts.map +1 -0
- package/dist/results.js +37 -0
- package/dist/results.js.map +1 -0
- package/package.json +57 -0
- package/spec.md +78 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { CanonicalAgentId, VerifiedPeerContextV1 } from '@agenticprimitives/types';
|
|
2
|
+
/** Why a resolved peer was refused. Local diagnostics — a caller decides what to surface. */
|
|
3
|
+
export type PeerGateCode =
|
|
4
|
+
/** No peer context at all. Not "assume fine" — the transport told us nothing. */
|
|
5
|
+
'peer_absent'
|
|
6
|
+
/** A context exists but proves less than agent identity (host- or workload-strength). */
|
|
7
|
+
| 'peer_below_agent_strength'
|
|
8
|
+
/** The peer proved it is an agent — a DIFFERENT one than we resolved. */
|
|
9
|
+
| 'peer_agent_mismatch'
|
|
10
|
+
/** Agent-authenticated but relay-vulnerable, and this deployment requires otherwise. */
|
|
11
|
+
| 'peer_not_channel_bound'
|
|
12
|
+
/** The context is stale; a long-lived connection must be re-evaluated. */
|
|
13
|
+
| 'peer_context_expired';
|
|
14
|
+
export interface PeerGateFailure {
|
|
15
|
+
code: PeerGateCode;
|
|
16
|
+
detail: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ResolvedPeerPolicy {
|
|
19
|
+
/**
|
|
20
|
+
* Refuse a peer that is not channel-bound. **Defaults to `true`** — fail-closed.
|
|
21
|
+
*
|
|
22
|
+
* Set `false` only with `acceptedResidual` naming what you are accepting. On a baseline HTTPS
|
|
23
|
+
* deployment the honest residual is: "an active relay holding a valid certificate for this host can
|
|
24
|
+
* impersonate the agent; we accept that because our transport cannot emit a channel binding."
|
|
25
|
+
*/
|
|
26
|
+
requireChannelBinding?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* REQUIRED when `requireChannelBinding` is false. Free text, recorded in the refusal reasoning.
|
|
29
|
+
*
|
|
30
|
+
* Exists so opting down is a sentence somebody had to write, rather than a boolean somebody flipped.
|
|
31
|
+
* A missing residual is itself a refusal — the gate will not let a deployment weaken silently.
|
|
32
|
+
*/
|
|
33
|
+
acceptedResidual?: string;
|
|
34
|
+
/** Injected clock. */
|
|
35
|
+
now?: Date;
|
|
36
|
+
}
|
|
37
|
+
export type PeerGateResult = {
|
|
38
|
+
ok: true;
|
|
39
|
+
/** True only when the peer is agent-authenticated AND channel-bound. Drives assurance. */
|
|
40
|
+
channelBound: boolean;
|
|
41
|
+
} | {
|
|
42
|
+
ok: false;
|
|
43
|
+
failures: readonly PeerGateFailure[];
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Decide whether a resolved endpoint's peer may be sent work.
|
|
47
|
+
*
|
|
48
|
+
* Call this AFTER `verifyPublication`/`createComposedResolver` and AFTER establishing the connection,
|
|
49
|
+
* BEFORE the first task. Resolution says where to go; this says whether whoever answered is who you
|
|
50
|
+
* were going to.
|
|
51
|
+
*
|
|
52
|
+
* Fail-closed at every branch: no context, weak context, wrong agent, unbound channel, or an expired
|
|
53
|
+
* context all refuse. Passing means "not disqualified" — the delegation and entitlement gates are
|
|
54
|
+
* still ahead of it, because being who you claim is not the same as being allowed (ADR-0056).
|
|
55
|
+
*/
|
|
56
|
+
export declare function checkResolvedPeer(input: {
|
|
57
|
+
/** The agent resolution told us we were reaching. */
|
|
58
|
+
expectedAgentId: CanonicalAgentId;
|
|
59
|
+
/** What the transport proved about whoever actually answered. */
|
|
60
|
+
peer: VerifiedPeerContextV1 | undefined;
|
|
61
|
+
policy?: ResolvedPeerPolicy;
|
|
62
|
+
}): PeerGateResult;
|
|
63
|
+
/**
|
|
64
|
+
* The peer-gate outcome as an assurance input.
|
|
65
|
+
*
|
|
66
|
+
* `assuranceOf` takes `peerAuthenticated`, and nothing in the repo ever set it — which made
|
|
67
|
+
* `'peer-authenticated'` an unreachable rung (AR-L7). Deriving it HERE is what makes it producible,
|
|
68
|
+
* and it is deliberately gated on `channelBound`: an agent-authenticated but relay-vulnerable peer is
|
|
69
|
+
* real evidence, but it is not the top of the ladder, and reporting it as such would restate the
|
|
70
|
+
* relay exposure as a strength.
|
|
71
|
+
*/
|
|
72
|
+
export declare function peerAuthenticatedFrom(result: PeerGateResult): boolean;
|
|
73
|
+
//# sourceMappingURL=peer-gate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peer-gate.d.ts","sourceRoot":"","sources":["../src/peer-gate.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAGxF,6FAA6F;AAC7F,MAAM,MAAM,YAAY;AACtB,iFAAiF;AAC/E,aAAa;AACf,yFAAyF;GACvF,2BAA2B;AAC7B,yEAAyE;GACvE,qBAAqB;AACvB,wFAAwF;GACtF,wBAAwB;AAC1B,0EAA0E;GACxE,sBAAsB,CAAC;AAE3B,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;;;OAMG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,sBAAsB;IACtB,GAAG,CAAC,EAAE,IAAI,CAAC;CACZ;AAED,MAAM,MAAM,cAAc,GACtB;IACE,EAAE,EAAE,IAAI,CAAC;IACT,0FAA0F;IAC1F,YAAY,EAAE,OAAO,CAAC;CACvB,GACD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,CAAA;CAAE,CAAC;AAExD;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,qDAAqD;IACrD,eAAe,EAAE,gBAAgB,CAAC;IAClC,iEAAiE;IACjE,IAAI,EAAE,qBAAqB,GAAG,SAAS,CAAC;IACxC,MAAM,CAAC,EAAE,kBAAkB,CAAC;CAC7B,GAAG,cAAc,CAkEjB;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAErE"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// The post-resolve peer gate (spec 338 §6; closes the product half of AR-L7).
|
|
2
|
+
//
|
|
3
|
+
// THE RULE THIS IMPLEMENTS, which the repo previously had only as parts:
|
|
4
|
+
//
|
|
5
|
+
// resolve → dial → require a peer context proving the peer IS the resolved agent
|
|
6
|
+
// → (optionally) require that context to be channel-bound
|
|
7
|
+
// → otherwise DO NOT SEND THE TASK
|
|
8
|
+
//
|
|
9
|
+
// Before this, the repo had `VerifiedPeerContextV1`, `isAgentAuthenticatedPeer`, `isChannelBoundPeer`,
|
|
10
|
+
// `createPeerAuthenticator`, and a `peer-authenticated` assurance rung — and NOTHING that refused work
|
|
11
|
+
// when any of them said no. `isChannelBoundPeer` had zero product consumers; the assurance rung was
|
|
12
|
+
// never produced. Typed and described is not enforced, and this file is the difference.
|
|
13
|
+
//
|
|
14
|
+
// WHAT RESOLUTION ALREADY GIVES YOU, AND WHAT IT DOES NOT. A verified publication proves the target
|
|
15
|
+
// agent signed "my endpoint is this URI". It does NOT prove that whoever answers at that URI today is
|
|
16
|
+
// that agent. Between those two facts sit DNS, BGP, a CDN, a terminating proxy, and anyone who has
|
|
17
|
+
// obtained a certificate for the host. This gate is the only place that gap is closed, and it is
|
|
18
|
+
// closed by making the PEER prove who it is — not by trusting that the address still points where the
|
|
19
|
+
// publication said.
|
|
20
|
+
//
|
|
21
|
+
// HONEST LIMIT, STATED HERE RATHER THAN IN A FOOTNOTE: on Cloudflare Workers there is no TLS exporter
|
|
22
|
+
// (RFC 9266), so `channelBinding` cannot be produced on the baseline A2A-over-HTTPS path at all.
|
|
23
|
+
// `requireChannelBinding: true` on such a deployment therefore refuses everything — which is CORRECT,
|
|
24
|
+
// not a bug. It means the deployment is asking for a property its transport cannot supply. Opting down
|
|
25
|
+
// is allowed, deliberate, and must be named (`acceptedResidual`).
|
|
26
|
+
import { isAgentAuthenticatedPeer, isChannelBoundPeer } from '@agenticprimitives/types';
|
|
27
|
+
/**
|
|
28
|
+
* Decide whether a resolved endpoint's peer may be sent work.
|
|
29
|
+
*
|
|
30
|
+
* Call this AFTER `verifyPublication`/`createComposedResolver` and AFTER establishing the connection,
|
|
31
|
+
* BEFORE the first task. Resolution says where to go; this says whether whoever answered is who you
|
|
32
|
+
* were going to.
|
|
33
|
+
*
|
|
34
|
+
* Fail-closed at every branch: no context, weak context, wrong agent, unbound channel, or an expired
|
|
35
|
+
* context all refuse. Passing means "not disqualified" — the delegation and entitlement gates are
|
|
36
|
+
* still ahead of it, because being who you claim is not the same as being allowed (ADR-0056).
|
|
37
|
+
*/
|
|
38
|
+
export function checkResolvedPeer(input) {
|
|
39
|
+
const policy = input.policy ?? {};
|
|
40
|
+
const requireBinding = policy.requireChannelBinding ?? true; // fail-closed default
|
|
41
|
+
const now = policy.now ?? new Date();
|
|
42
|
+
const failures = [];
|
|
43
|
+
// Weakening must be deliberate and written down. A `false` with no stated residual is a config
|
|
44
|
+
// slip, and the gate refuses rather than honouring it.
|
|
45
|
+
if (!requireBinding && !policy.acceptedResidual?.trim()) {
|
|
46
|
+
failures.push({
|
|
47
|
+
code: 'peer_not_channel_bound',
|
|
48
|
+
detail: 'requireChannelBinding is false with no acceptedResidual — opting down must be a stated decision',
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if (!input.peer) {
|
|
52
|
+
// Absence is not permission. A path that produced no context did not verify the peer; it simply
|
|
53
|
+
// did not look, and those must not be the same answer (ADR-0013).
|
|
54
|
+
failures.push({
|
|
55
|
+
code: 'peer_absent',
|
|
56
|
+
detail: 'no verified peer context — the transport proved nothing about who answered',
|
|
57
|
+
});
|
|
58
|
+
return { ok: false, failures };
|
|
59
|
+
}
|
|
60
|
+
if (input.peer.expiresAt) {
|
|
61
|
+
const exp = Date.parse(input.peer.expiresAt);
|
|
62
|
+
if (Number.isNaN(exp) || exp <= now.getTime()) {
|
|
63
|
+
failures.push({
|
|
64
|
+
code: 'peer_context_expired',
|
|
65
|
+
detail: 'peer context is expired — a long-lived connection must be re-evaluated',
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// Strength first. A host- or workload-strength context may carry a plausible-looking identifier;
|
|
70
|
+
// `isAgentAuthenticatedPeer` is what refuses to read a hostname as a Smart Agent.
|
|
71
|
+
if (!isAgentAuthenticatedPeer(input.peer)) {
|
|
72
|
+
failures.push({
|
|
73
|
+
code: 'peer_below_agent_strength',
|
|
74
|
+
detail: `peer proved ${input.peer.strength}-level identity — a hostname or workload is not a Smart Agent`,
|
|
75
|
+
});
|
|
76
|
+
return { ok: false, failures };
|
|
77
|
+
}
|
|
78
|
+
// THE CHECK THIS GATE EXISTS FOR. We resolved agent B; something answered and proved it is agent C.
|
|
79
|
+
// A verified publication cannot catch this — it proves B signed the URI, not that B still answers there.
|
|
80
|
+
const claimed = input.peer.canonicalAgentId;
|
|
81
|
+
if (!claimed || claimed.toLowerCase() !== input.expectedAgentId.toLowerCase()) {
|
|
82
|
+
failures.push({
|
|
83
|
+
code: 'peer_agent_mismatch',
|
|
84
|
+
detail: `resolved ${input.expectedAgentId} but the peer proved ${claimed ?? 'no agent'}`,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
const channelBound = isChannelBoundPeer(input.peer);
|
|
88
|
+
if (requireBinding && !channelBound) {
|
|
89
|
+
failures.push({
|
|
90
|
+
code: 'peer_not_channel_bound',
|
|
91
|
+
detail: 'peer is agent-authenticated but not channel-bound — an active relay could sit between us',
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return failures.length > 0 ? { ok: false, failures } : { ok: true, channelBound };
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The peer-gate outcome as an assurance input.
|
|
98
|
+
*
|
|
99
|
+
* `assuranceOf` takes `peerAuthenticated`, and nothing in the repo ever set it — which made
|
|
100
|
+
* `'peer-authenticated'` an unreachable rung (AR-L7). Deriving it HERE is what makes it producible,
|
|
101
|
+
* and it is deliberately gated on `channelBound`: an agent-authenticated but relay-vulnerable peer is
|
|
102
|
+
* real evidence, but it is not the top of the ladder, and reporting it as such would restate the
|
|
103
|
+
* relay exposure as a strength.
|
|
104
|
+
*/
|
|
105
|
+
export function peerAuthenticatedFrom(result) {
|
|
106
|
+
return result.ok && result.channelBound;
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=peer-gate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peer-gate.js","source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wB;YAC9B,MAAM,EACJ,0FAA0F;SAC7F,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;AACpF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAsB;IAC1D,OAAO,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,YAAY,CAAC;AAC1C,CAAC"}
|
package/dist/policy.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/** Does the agent carry a human-readable label, and is that label public? */
|
|
2
|
+
export type AgentNamingPosture =
|
|
3
|
+
/** A public ANS name resolves to this agent. */
|
|
4
|
+
'public'
|
|
5
|
+
/** A label exists but is disclosed only to invited parties (possibly per-counterparty). */
|
|
6
|
+
| 'private-label'
|
|
7
|
+
/** No human-readable label at all. Canonical id only. */
|
|
8
|
+
| 'none';
|
|
9
|
+
/** May the agent appear in a searchable directory? */
|
|
10
|
+
export type AgentListingPosture = 'public'
|
|
11
|
+
/** Appears in search ONLY under an explicit, revocable consent record (spec 338 §2). */
|
|
12
|
+
| 'consented-projection' | 'none';
|
|
13
|
+
/** How may a party obtain the agent's current service publication? */
|
|
14
|
+
export type AgentResolutionPosture =
|
|
15
|
+
/** Anyone may resolve. */
|
|
16
|
+
'public'
|
|
17
|
+
/** Resolvable, but only by an authenticated caller. */
|
|
18
|
+
| 'authenticated'
|
|
19
|
+
/** Resolvable only by holders of a private resolution grant delivered in a signed invitation. */
|
|
20
|
+
| 'invitation'
|
|
21
|
+
/** As `invitation`, but every relationship gets its own grant, projection, and optional label. */
|
|
22
|
+
| 'pairwise'
|
|
23
|
+
/** No resolver; the publication travels in the invitation only. No refresh path. */
|
|
24
|
+
| 'direct'
|
|
25
|
+
/** No inbound resolution surface at all. */
|
|
26
|
+
| 'none';
|
|
27
|
+
/** Who may open an inbound connection? Orthogonal to resolution — resolving is not connecting. */
|
|
28
|
+
export type AgentInboundPosture = 'open' | 'known-peer' | 'delegation-required' | 'outbound-only';
|
|
29
|
+
export interface AgentDiscoveryPolicyV1 {
|
|
30
|
+
specVersion: 'ap.agent-discovery-policy/1';
|
|
31
|
+
naming: AgentNamingPosture;
|
|
32
|
+
listing: AgentListingPosture;
|
|
33
|
+
resolution: AgentResolutionPosture;
|
|
34
|
+
inbound: AgentInboundPosture;
|
|
35
|
+
}
|
|
36
|
+
/** A named posture preset for UX. The protocol always stores the four dimensions. */
|
|
37
|
+
export type AgentDiscoveryPreset = 'public-commercial' | 'public-protected' | 'private-partner' | 'pairwise' | 'internal-worker' | 'temporary-direct' | 'outbound-only';
|
|
38
|
+
export declare function discoveryPolicyFromPreset(preset: AgentDiscoveryPreset): AgentDiscoveryPolicyV1;
|
|
39
|
+
/** A coherence problem in a policy — a combination that cannot be enforced as written. */
|
|
40
|
+
export interface DiscoveryPolicyViolation {
|
|
41
|
+
dimension: 'naming' | 'listing' | 'resolution' | 'inbound';
|
|
42
|
+
message: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Validate the combination. These are not style rules — each one is a combination where the
|
|
46
|
+
* agent's stated posture and its enforceable behaviour disagree, which is how private state leaks.
|
|
47
|
+
*/
|
|
48
|
+
export declare function validateDiscoveryPolicy(p: AgentDiscoveryPolicyV1): DiscoveryPolicyViolation[];
|
|
49
|
+
/** True when the policy permits a party WITHOUT a grant or invitation to obtain a publication. */
|
|
50
|
+
export declare function allowsUnauthenticatedResolution(p: AgentDiscoveryPolicyV1): boolean;
|
|
51
|
+
/** True when the policy permits this agent to appear in directory/search results. */
|
|
52
|
+
export declare function allowsDirectorySearch(p: AgentDiscoveryPolicyV1): boolean;
|
|
53
|
+
//# sourceMappingURL=policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy.d.ts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,kGAAkG;AAClG,wBAAgB,+BAA+B,CAAC,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAElF;AAED,qFAAqF;AACrF,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAExE"}
|
package/dist/policy.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// AgentDiscoveryPolicy — the four INDEPENDENT dimensions (spec 338 §2, ADR-0056 §2).
|
|
2
|
+
//
|
|
3
|
+
// Naming, listing, resolution, and inbound reachability are separate properties. The word "nameless"
|
|
4
|
+
// describes only the absence of a public human-readable label; it says nothing about whether an
|
|
5
|
+
// authorized party can resolve the agent. Collapsing these into one enum is exactly the modelling
|
|
6
|
+
// error this package exists to fix — UX may present presets, the protocol keeps the dimensions.
|
|
7
|
+
const PRESETS = {
|
|
8
|
+
'public-commercial': { naming: 'public', listing: 'public', resolution: 'public', inbound: 'delegation-required' },
|
|
9
|
+
'public-protected': { naming: 'public', listing: 'public', resolution: 'authenticated', inbound: 'delegation-required' },
|
|
10
|
+
'private-partner': { naming: 'private-label', listing: 'none', resolution: 'invitation', inbound: 'known-peer' },
|
|
11
|
+
pairwise: { naming: 'private-label', listing: 'none', resolution: 'pairwise', inbound: 'delegation-required' },
|
|
12
|
+
'internal-worker': { naming: 'none', listing: 'none', resolution: 'invitation', inbound: 'known-peer' },
|
|
13
|
+
'temporary-direct': { naming: 'none', listing: 'none', resolution: 'direct', inbound: 'delegation-required' },
|
|
14
|
+
'outbound-only': { naming: 'none', listing: 'none', resolution: 'none', inbound: 'outbound-only' },
|
|
15
|
+
};
|
|
16
|
+
export function discoveryPolicyFromPreset(preset) {
|
|
17
|
+
return { specVersion: 'ap.agent-discovery-policy/1', ...PRESETS[preset] };
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Validate the combination. These are not style rules — each one is a combination where the
|
|
21
|
+
* agent's stated posture and its enforceable behaviour disagree, which is how private state leaks.
|
|
22
|
+
*/
|
|
23
|
+
export function validateDiscoveryPolicy(p) {
|
|
24
|
+
const out = [];
|
|
25
|
+
// Public listing means a searchable public row, which requires a public resolution answer to be
|
|
26
|
+
// useful and a public label to be found by. Listing publicly while resolving privately publishes
|
|
27
|
+
// the agent's existence without any way to reach it — leak with no benefit.
|
|
28
|
+
if (p.listing === 'public' && p.resolution !== 'public' && p.resolution !== 'authenticated') {
|
|
29
|
+
out.push({
|
|
30
|
+
dimension: 'listing',
|
|
31
|
+
message: 'listing "public" requires resolution "public" or "authenticated"; a publicly listed agent that cannot be resolved leaks its existence for no benefit',
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
if (p.listing === 'public' && p.naming === 'none') {
|
|
35
|
+
out.push({
|
|
36
|
+
dimension: 'listing',
|
|
37
|
+
message: 'listing "public" requires a naming posture other than "none" — there is nothing to list',
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
// Outbound-only means no inbound connection is ever accepted, so publishing an inbound endpoint
|
|
41
|
+
// is a contradiction that would still be dialled by a partner.
|
|
42
|
+
if (p.inbound === 'outbound-only' && p.resolution !== 'none') {
|
|
43
|
+
out.push({
|
|
44
|
+
dimension: 'inbound',
|
|
45
|
+
message: 'inbound "outbound-only" requires resolution "none" — publishing an inbound endpoint that is never accepted misleads callers',
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
// A private label only means something if some party can be told it. With no resolution path and
|
|
49
|
+
// no invitation, the label is unreachable state.
|
|
50
|
+
if (p.naming === 'private-label' && p.resolution === 'none') {
|
|
51
|
+
out.push({
|
|
52
|
+
dimension: 'naming',
|
|
53
|
+
message: 'naming "private-label" with resolution "none" is unreachable — no party can ever be told the label',
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
// Pairwise is defined by per-relationship grants; it cannot be served by a single shared answer.
|
|
57
|
+
if (p.resolution === 'pairwise' && p.listing === 'public') {
|
|
58
|
+
out.push({
|
|
59
|
+
dimension: 'resolution',
|
|
60
|
+
message: 'resolution "pairwise" cannot be publicly listed — a public row is a common identifier that defeats pairwise unlinkability',
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return out;
|
|
64
|
+
}
|
|
65
|
+
/** True when the policy permits a party WITHOUT a grant or invitation to obtain a publication. */
|
|
66
|
+
export function allowsUnauthenticatedResolution(p) {
|
|
67
|
+
return p.resolution === 'public';
|
|
68
|
+
}
|
|
69
|
+
/** True when the policy permits this agent to appear in directory/search results. */
|
|
70
|
+
export function allowsDirectorySearch(p) {
|
|
71
|
+
return p.listing === 'public' || p.listing === 'consented-projection';
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../src/policy.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,EAAE;AACF,qGAAqG;AACrG,gGAAgG;AAChG,kGAAkG;AAClG,gGAAgG;AA0DhG,MAAM,OAAO,GAA8E;IACzF,mBAAmB,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,qBAAqB,EAAE;IAClH,kBAAkB,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,eAAe,EAAE,OAAO,EAAE,qBAAqB,EAAE;IACxH,iBAAiB,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE;IAChH,QAAQ,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,qBAAqB,EAAE;IAC9G,iBAAiB,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE;IACvG,kBAA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CAAC,CAAC,MAAM,KAAK,eAAe,IAAI,CAAC,CAAC,UAAU,KAAK,MAAM,EAAE,CAAC;QAC5D,GAAG,CAAC,IAAI,CAAC;YACP,SAAS,EAAE,QAAQ;YACnB,OAAO,EAAE,oGAAoG;SAC9G,CAAC,CAAC;IACL,CAAC;IAED,iGAAiG;IACjG,IAAI,CAAC,CAAC,UAAU,KAAK,UAAU,IAAI,CAAC,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC1D,GAAG,CAAC,IAAI,CAAC;YACP,SAAS,EAAE,YAAY;YACvB,OAAO,EAAE,2HAA2H;SACrI,CAAC,CAAC;IACL,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED,kGAAkG;AAClG,MAAM,UAAU,+BAA+B,CAAC,CAAyB;IACvE,OAAO,CAAC,CAAC,UAAU,KAAK,QAAQ,CAAC;AACnC,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,qBAAqB,CAAC,CAAyB;IAC7D,OAAO,CAAC,CAAC,OAAO,KAAK,QAAQ,IAAI,CAAC,CAAC,OAAO,KAAK,sBAAsB,CAAC;AACxE,CAAC"}
|
package/dist/ports.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { CanonicalAgentId } from '@agenticprimitives/types';
|
|
2
|
+
import type { AgentResolutionMethod, AgentResolutionReference, ResolutionContextV1, UnverifiedResolutionBundleV1 } from './references.js';
|
|
3
|
+
import type { PrivateResolutionGrantV1, ResolutionGrantPresentationV1 } from './grants.js';
|
|
4
|
+
import type { ResolutionFailure } from './errors.js';
|
|
5
|
+
export interface AgentResolutionProvider {
|
|
6
|
+
readonly method: AgentResolutionMethod;
|
|
7
|
+
supports(reference: AgentResolutionReference): boolean;
|
|
8
|
+
resolve(reference: AgentResolutionReference, context: ResolutionContextV1): Promise<UnverifiedResolutionBundleV1>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The runtime-state checks a resolver must perform on a presented grant. Separate from
|
|
12
|
+
* `validateGrantShape` (static) because these need storage: revocation status, use budgets, and
|
|
13
|
+
* nonce replay all live in the resolver's vault.
|
|
14
|
+
*/
|
|
15
|
+
export interface ResolutionGrantStore {
|
|
16
|
+
/** Look up by grant id. MUST use a keyed digest index — no raw bearer secret at rest (spec 338 §4). */
|
|
17
|
+
findByGrantId(grantId: string): Promise<PrivateResolutionGrantV1 | null>;
|
|
18
|
+
/** Current revocation status, authoritative in the ISSUER's vault (spec 338 §9). */
|
|
19
|
+
isRevoked(grantId: string): Promise<boolean>;
|
|
20
|
+
/**
|
|
21
|
+
* Atomically consume one resolution against `maximumResolutions`.
|
|
22
|
+
* MUST be durable across worker instances — an in-isolate counter is bypassable by isolate churn
|
|
23
|
+
* (spec 338 §16, abuse tests).
|
|
24
|
+
*/
|
|
25
|
+
consumeResolution(grantId: string): Promise<{
|
|
26
|
+
allowed: boolean;
|
|
27
|
+
remaining?: number;
|
|
28
|
+
}>;
|
|
29
|
+
/** Single-use nonce check. Returns false if this nonce was already spent (replay). */
|
|
30
|
+
consumeChallengeNonce(nonce: string, audience: string): Promise<boolean>;
|
|
31
|
+
}
|
|
32
|
+
/** Verifies a presenter's proof of possession of the subject Smart Agent. */
|
|
33
|
+
export type SubjectProofVerifier = (args: {
|
|
34
|
+
subject: CanonicalAgentId;
|
|
35
|
+
presentation: ResolutionGrantPresentationV1;
|
|
36
|
+
targetAgent: CanonicalAgentId;
|
|
37
|
+
}) => Promise<boolean>;
|
|
38
|
+
/**
|
|
39
|
+
* The result of admitting a presented grant. Deliberately NOT a token: it names what may be
|
|
40
|
+
* DISCLOSED, never what may be invoked. A consumer that treats this as authorization has made the
|
|
41
|
+
* exact error ADR-0056 exists to prevent.
|
|
42
|
+
*/
|
|
43
|
+
export interface GrantAdmissionResult {
|
|
44
|
+
admitted: boolean;
|
|
45
|
+
/** Present only when `admitted`. */
|
|
46
|
+
grant?: PrivateResolutionGrantV1;
|
|
47
|
+
/** Present only when `admitted` — the projection profile the resolver must apply. */
|
|
48
|
+
projectionProfile?: string;
|
|
49
|
+
/** Precise, LOCAL-only failures. Resolvers put `wireCode` on the wire, never these messages. */
|
|
50
|
+
failures: readonly ResolutionFailure[];
|
|
51
|
+
}
|
|
52
|
+
/** Everything a rendezvous resolver needs, injected. */
|
|
53
|
+
export interface ResolverDependencies {
|
|
54
|
+
store: ResolutionGrantStore;
|
|
55
|
+
verifySubjectProof: SubjectProofVerifier;
|
|
56
|
+
/** ISO-8601 clock, injected so admission is testable and deterministic. */
|
|
57
|
+
now: () => string;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=ports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ports.d.ts","sourceRoot":"","sources":["../src/ports.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EACV,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,EACnB,4BAA4B,EAC7B,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,wBAAwB,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,QAAQ,CAAC,SAAS,EAAE,wBAAwB,GAAG,OAAO,CAAC;IACvD,OAAO,CACL,SAAS,EAAE,wBAAwB,EACnC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,4BAA4B,CAAC,CAAC;CAC1C;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,uGAAuG;IACvG,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC,CAAC;IACzE,oFAAoF;IACpF,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7C;;;;OAIG;IACH,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACtF,sFAAsF;IACtF,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1E;AAED,6EAA6E;AAC7E,MAAM,MAAM,oBAAoB,GAAG,CAAC,IAAI,EAAE;IACxC,OAAO,EAAE,gBAAgB,CAAC;IAC1B,YAAY,EAAE,6BAA6B,CAAC;IAC5C,WAAW,EAAE,gBAAgB,CAAC;CAC/B,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEvB;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB,oCAAoC;IACpC,KAAK,CAAC,EAAE,wBAAwB,CAAC;IACjC,qFAAqF;IACrF,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gGAAgG;IAChG,QAAQ,EAAE,SAAS,iBAAiB,EAAE,CAAC;CACxC;AAED,wDAAwD;AACxD,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,oBAAoB,CAAC;IAC5B,kBAAkB,EAAE,oBAAoB,CAAC;IACzC,2EAA2E;IAC3E,GAAG,EAAE,MAAM,MAAM,CAAC;CACnB"}
|
package/dist/ports.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Provider-neutral ports (spec 338 §12, ADR-0037).
|
|
2
|
+
//
|
|
3
|
+
// Ring 0 owns the SHAPES and the VERIFICATION. Every concrete provider — an ANS reader, a rendezvous
|
|
4
|
+
// Worker, a DNTLS adapter, a DID service-facet reader, an org directory — is a Ring-1 adapter that
|
|
5
|
+
// implements `AgentResolutionProvider`. Nothing in this file performs I/O.
|
|
6
|
+
//
|
|
7
|
+
// The critical contract: a provider returns an UNVERIFIED bundle. It cannot mark its own answer
|
|
8
|
+
// verified, which is what makes a compromised resolver unable to substitute an endpoint (spec 338 §6).
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=ports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ports.js","sourceRoot":"","sources":["../src/ports.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,EAAE;AACF,qGAAqG;AACrG,mGAAmG;AACnG,2EAA2E;AAC3E,EAAE;AACF,gGAAgG;AAChG,uGAAuG"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { CanonicalAgentId } from '@agenticprimitives/types';
|
|
2
|
+
import type { ResolutionProjectionPolicy } from './grants.js';
|
|
3
|
+
import type { ServiceSurfacePublicationV1 } from './publication.js';
|
|
4
|
+
/** Named projection profiles. `internal` and `pairwise` are never public-facing. */
|
|
5
|
+
export type ProjectionProfile = 'public' | 'authenticated' | 'partner' | 'internal' | 'pairwise';
|
|
6
|
+
export interface SurfaceProjectionContext {
|
|
7
|
+
requester?: CanonicalAgentId;
|
|
8
|
+
relationshipRefs?: readonly string[];
|
|
9
|
+
entitlements?: readonly string[];
|
|
10
|
+
purpose?: string;
|
|
11
|
+
projectionProfile: ProjectionProfile;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* NORMATIVE ORDERING — project BEFORE signing, never after (spec 338 §3, §7).
|
|
15
|
+
*
|
|
16
|
+
* `projectSurfaces` is a PUBLISHER-side operation. The publisher selects an audience's surfaces,
|
|
17
|
+
* then signs that exact set as its own publication on its own channel. A resolver then SELECTS the
|
|
18
|
+
* matching pre-signed publication and serves it byte-for-byte.
|
|
19
|
+
*
|
|
20
|
+
* A resolver that projects a signed publication — dropping surfaces before serving — invalidates the
|
|
21
|
+
* digest and fails verification at the client. That failure is correct and load-bearing (it is what
|
|
22
|
+
* catches a compromised resolver), so filtering-after-signing must never be the intended path.
|
|
23
|
+
*
|
|
24
|
+
* Use `selectPresignedPublication` on the resolver side.
|
|
25
|
+
*/
|
|
26
|
+
export declare const PROJECTION_PRECEDES_SIGNING: true;
|
|
27
|
+
export interface SurfaceProjectionResult {
|
|
28
|
+
surfaces: readonly ServiceSurfacePublicationV1[];
|
|
29
|
+
/** Surface ids dropped, with the reason. Useful for the publisher's own review; never sent on the wire. */
|
|
30
|
+
dropped: readonly {
|
|
31
|
+
surfaceId: string;
|
|
32
|
+
reason: string;
|
|
33
|
+
}[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Project the canonical surface set for one audience.
|
|
37
|
+
*
|
|
38
|
+
* The grant's `projection` policy NARROWS; it can never widen past the profile's exposure ceiling.
|
|
39
|
+
* That ordering is the reason a compromised grant issuer still cannot leak a `service-only` surface
|
|
40
|
+
* into a partner projection.
|
|
41
|
+
*/
|
|
42
|
+
export declare function projectSurfaces(canonicalSurfaces: readonly ServiceSurfacePublicationV1[], context: SurfaceProjectionContext, policy?: ResolutionProjectionPolicy): SurfaceProjectionResult;
|
|
43
|
+
/**
|
|
44
|
+
* The RESOLVER-side operation: pick the pre-signed publication for a grant's channel and serve it
|
|
45
|
+
* unmodified.
|
|
46
|
+
*
|
|
47
|
+
* This is deliberately a *selection*, not a transformation. A resolver has no signing authority for
|
|
48
|
+
* the target, so the only publication it can serve intact is one the target already signed for this
|
|
49
|
+
* audience. Returning `null` (no channel matches) is a correct, uneventful outcome — it means the
|
|
50
|
+
* publisher has not published for this audience, and the resolver must deny rather than improvise a
|
|
51
|
+
* projection.
|
|
52
|
+
*/
|
|
53
|
+
export declare function selectPresignedPublication<T extends {
|
|
54
|
+
channelId: string;
|
|
55
|
+
agentId: unknown;
|
|
56
|
+
status: string;
|
|
57
|
+
}>(publications: readonly T[], channelId: string): T | null;
|
|
58
|
+
/**
|
|
59
|
+
* The channel id for an (agent, audience) pair. Pairwise postures get a per-counterparty channel so
|
|
60
|
+
* two counterparties cannot correlate sequence numbers.
|
|
61
|
+
*/
|
|
62
|
+
export declare function channelIdFor(agentId: string, projectionProfile: string, counterparty?: string): string;
|
|
63
|
+
/**
|
|
64
|
+
* Verify that a SERVED projection did not over-disclose relative to what the grant permitted.
|
|
65
|
+
*
|
|
66
|
+
* A client runs this against what a resolver actually returned. It is how a compromised resolver
|
|
67
|
+
* that adds a surface is caught even when the target's own signature covers the whole publication —
|
|
68
|
+
* the client checks the shape it was entitled to, not just the shape it received.
|
|
69
|
+
*/
|
|
70
|
+
export declare function findOverDisclosure(served: readonly ServiceSurfacePublicationV1[], context: SurfaceProjectionContext, policy?: ResolutionProjectionPolicy): readonly {
|
|
71
|
+
surfaceId: string;
|
|
72
|
+
reason: string;
|
|
73
|
+
}[];
|
|
74
|
+
//# sourceMappingURL=projection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../src/projection.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,KAAK,EAAE,2BAA2B,EAAmB,MAAM,kBAAkB,CAAC;AAErF,oFAAoF;AACpF,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,eAAe,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAEjG,MAAM,WAAW,wBAAwB;IACvC,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,iBAAiB,CAAC;CACtC;AAkBD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,2BAA2B,EAAG,IAAa,CAAC;AAEzD,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,SAAS,2BAA2B,EAAE,CAAC;IACjD,2GAA2G;IAC3G,OAAO,EAAE,SAAS;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC3D;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,iBAAiB,EAAE,SAAS,2BAA2B,EAAE,EACzD,OAAO,EAAE,wBAAwB,EACjC,MAAM,CAAC,EAAE,0BAA0B,GAClC,uBAAuB,CAoCzB;AAOD;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACxC,CAAC,SAAS;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EACjE,YAAY,EAAE,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CAOzD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAItG;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,SAAS,2BAA2B,EAAE,EAC9C,OAAO,EAAE,wBAAwB,EACjC,MAAM,CAAC,EAAE,0BAA0B,GAClC,SAAS;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAAE,CAoBlD"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// Projection — turning the canonical surface set into an audience-specific publication input
|
|
2
|
+
// (spec 338 §8, ADR-0056 §6).
|
|
3
|
+
//
|
|
4
|
+
// PURE and POLICY-INPUT DRIVEN. No databases, no network, no clock. That is what makes the same
|
|
5
|
+
// function usable by the publisher (when signing) and by a verifier (when checking that a served
|
|
6
|
+
// projection did not over-disclose).
|
|
7
|
+
//
|
|
8
|
+
// Fail-closed everywhere: a surface is included only when it AFFIRMATIVELY passes. Anything
|
|
9
|
+
// ambiguous — private with no audience, a protocol not on the allowlist — is dropped, not included.
|
|
10
|
+
/** The maximum exposure each profile may disclose. A `public` projection can never emit a private surface. */
|
|
11
|
+
const PROFILE_EXPOSURE_CEILING = {
|
|
12
|
+
public: 'public',
|
|
13
|
+
authenticated: 'authenticated',
|
|
14
|
+
partner: 'private',
|
|
15
|
+
pairwise: 'private',
|
|
16
|
+
internal: 'service-only',
|
|
17
|
+
};
|
|
18
|
+
const EXPOSURE_RANK = {
|
|
19
|
+
public: 0,
|
|
20
|
+
authenticated: 1,
|
|
21
|
+
private: 2,
|
|
22
|
+
'service-only': 3,
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* NORMATIVE ORDERING — project BEFORE signing, never after (spec 338 §3, §7).
|
|
26
|
+
*
|
|
27
|
+
* `projectSurfaces` is a PUBLISHER-side operation. The publisher selects an audience's surfaces,
|
|
28
|
+
* then signs that exact set as its own publication on its own channel. A resolver then SELECTS the
|
|
29
|
+
* matching pre-signed publication and serves it byte-for-byte.
|
|
30
|
+
*
|
|
31
|
+
* A resolver that projects a signed publication — dropping surfaces before serving — invalidates the
|
|
32
|
+
* digest and fails verification at the client. That failure is correct and load-bearing (it is what
|
|
33
|
+
* catches a compromised resolver), so filtering-after-signing must never be the intended path.
|
|
34
|
+
*
|
|
35
|
+
* Use `selectPresignedPublication` on the resolver side.
|
|
36
|
+
*/
|
|
37
|
+
export const PROJECTION_PRECEDES_SIGNING = true;
|
|
38
|
+
/**
|
|
39
|
+
* Project the canonical surface set for one audience.
|
|
40
|
+
*
|
|
41
|
+
* The grant's `projection` policy NARROWS; it can never widen past the profile's exposure ceiling.
|
|
42
|
+
* That ordering is the reason a compromised grant issuer still cannot leak a `service-only` surface
|
|
43
|
+
* into a partner projection.
|
|
44
|
+
*/
|
|
45
|
+
export function projectSurfaces(canonicalSurfaces, context, policy) {
|
|
46
|
+
const ceiling = EXPOSURE_RANK[PROFILE_EXPOSURE_CEILING[context.projectionProfile]];
|
|
47
|
+
const surfaces = [];
|
|
48
|
+
const dropped = [];
|
|
49
|
+
for (const s of canonicalSurfaces) {
|
|
50
|
+
if (EXPOSURE_RANK[s.exposure] > ceiling) {
|
|
51
|
+
dropped.push({ surfaceId: s.surfaceId, reason: `exposure "${s.exposure}" exceeds the "${context.projectionProfile}" ceiling` });
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
// A private surface must name who may see it. An empty/absent audience is visible to NOBODY —
|
|
55
|
+
// the fail-closed reading. Treating "no audience" as "everyone" is how private endpoints leak.
|
|
56
|
+
if (s.exposure === 'private') {
|
|
57
|
+
const named = s.audience?.includes(context.requester) ?? false;
|
|
58
|
+
const classified = s.audienceClassifications?.some((c) => context.entitlements?.includes(c) || context.relationshipRefs?.includes(c)) ?? false;
|
|
59
|
+
if (!named && !classified) {
|
|
60
|
+
dropped.push({ surfaceId: s.surfaceId, reason: 'private surface: requester is not in the audience' });
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (policy?.allowedSurfaceIds && !policy.allowedSurfaceIds.includes(s.surfaceId)) {
|
|
65
|
+
dropped.push({ surfaceId: s.surfaceId, reason: 'not in the grant allowedSurfaceIds' });
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (policy?.allowedProtocols && !policy.allowedProtocols.includes(s.protocol)) {
|
|
69
|
+
dropped.push({ surfaceId: s.surfaceId, reason: 'protocol not in the grant allowedProtocols' });
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
surfaces.push(policy?.includeTransportKeys === false ? stripTransportKey(s) : s);
|
|
73
|
+
}
|
|
74
|
+
return { surfaces, dropped };
|
|
75
|
+
}
|
|
76
|
+
function stripTransportKey(s) {
|
|
77
|
+
const { transportKeyBinding: _omit, ...rest } = s;
|
|
78
|
+
return rest;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The RESOLVER-side operation: pick the pre-signed publication for a grant's channel and serve it
|
|
82
|
+
* unmodified.
|
|
83
|
+
*
|
|
84
|
+
* This is deliberately a *selection*, not a transformation. A resolver has no signing authority for
|
|
85
|
+
* the target, so the only publication it can serve intact is one the target already signed for this
|
|
86
|
+
* audience. Returning `null` (no channel matches) is a correct, uneventful outcome — it means the
|
|
87
|
+
* publisher has not published for this audience, and the resolver must deny rather than improvise a
|
|
88
|
+
* projection.
|
|
89
|
+
*/
|
|
90
|
+
export function selectPresignedPublication(publications, channelId) {
|
|
91
|
+
const candidates = publications.filter((p) => p.channelId === channelId && p.status === 'active');
|
|
92
|
+
if (candidates.length === 0)
|
|
93
|
+
return null;
|
|
94
|
+
// If a publisher has several active publications on one channel, that is an equivocation the
|
|
95
|
+
// client's sequence check will surface. Serve the one the caller ordered first and let
|
|
96
|
+
// verification decide — never silently pick "the newest" using an unverified field.
|
|
97
|
+
return candidates[0] ?? null;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The channel id for an (agent, audience) pair. Pairwise postures get a per-counterparty channel so
|
|
101
|
+
* two counterparties cannot correlate sequence numbers.
|
|
102
|
+
*/
|
|
103
|
+
export function channelIdFor(agentId, projectionProfile, counterparty) {
|
|
104
|
+
return counterparty
|
|
105
|
+
? `${agentId}:${projectionProfile}:${counterparty}`
|
|
106
|
+
: `${agentId}:${projectionProfile}`;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Verify that a SERVED projection did not over-disclose relative to what the grant permitted.
|
|
110
|
+
*
|
|
111
|
+
* A client runs this against what a resolver actually returned. It is how a compromised resolver
|
|
112
|
+
* that adds a surface is caught even when the target's own signature covers the whole publication —
|
|
113
|
+
* the client checks the shape it was entitled to, not just the shape it received.
|
|
114
|
+
*/
|
|
115
|
+
export function findOverDisclosure(served, context, policy) {
|
|
116
|
+
const ceiling = EXPOSURE_RANK[PROFILE_EXPOSURE_CEILING[context.projectionProfile]];
|
|
117
|
+
const problems = [];
|
|
118
|
+
for (const s of served) {
|
|
119
|
+
if (EXPOSURE_RANK[s.exposure] > ceiling) {
|
|
120
|
+
problems.push({ surfaceId: s.surfaceId, reason: `exposure "${s.exposure}" exceeds the "${context.projectionProfile}" ceiling` });
|
|
121
|
+
}
|
|
122
|
+
if (policy?.allowedSurfaceIds && !policy.allowedSurfaceIds.includes(s.surfaceId)) {
|
|
123
|
+
problems.push({ surfaceId: s.surfaceId, reason: 'surface was not permitted by the grant' });
|
|
124
|
+
}
|
|
125
|
+
if (policy?.allowedProtocols && !policy.allowedProtocols.includes(s.protocol)) {
|
|
126
|
+
problems.push({ surfaceId: s.surfaceId, reason: 'protocol was not permitted by the grant' });
|
|
127
|
+
}
|
|
128
|
+
if (policy?.includeTransportKeys === false && s.transportKeyBinding) {
|
|
129
|
+
problems.push({ surfaceId: s.surfaceId, reason: 'transport key disclosed but not permitted by the grant' });
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return problems;
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=projection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection.js","sourceRoot":"","sources":["../src/projection.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,8BAA8B;AAC9B,EAAE;AACF,gGAAgG;AAChG,iGAAiG;AACjG,qCAAqC;AACrC,EAAE;AACF,4FAA4F;AAC5F,oGAAoG;AAiBpG,8GAA8G;AAC9G,MAAM,wBAAwB,GAA+C;IAC3E,MAAM,EAAE,QAAQ;IAChB,aAAa,EAAE,eAAe;IAC9B,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,cAAc;CACzB,CAAC;AAEF,MAAM,aAAa,GAAoC;IACrD,MAAM,EAAE,CAAC;IACT,aAAa,EAAE,CAAC;IAChB,OAAO,EAAE,CAAC;IACV,cAAc,EAAE,CAAC;CAClB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAa,CAAC;AAQzD;;;;;;GAMG;AACH,MAAM,U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