@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
package/dist/records.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// Vault record contracts (spec 338 §9).
|
|
2
|
+
//
|
|
3
|
+
// WHO OWNS WHAT: `vault` owns the read/write/list SEAM and treats `owner`/`resource` as opaque
|
|
4
|
+
// strings. This package owns the RECORD SHAPES and the canonical resource keys stored under them.
|
|
5
|
+
// That split is why `agent-resolution` does not import `@agenticprimitives/vault` — the
|
|
6
|
+
// classification names below MIRROR its taxonomy structurally, the same way `surface-catalog`
|
|
7
|
+
// mirrors `tool-policy`'s risk tiers without importing the decision engine.
|
|
8
|
+
//
|
|
9
|
+
// TWO VAULTS, DELIBERATELY (spec 338 §6): the target/owner vault is AUTHORITATIVE; the resolution
|
|
10
|
+
// service vault is OPERATIONAL. A resolver must never hold the only copy of a publication, grant,
|
|
11
|
+
// revocation, ownership evidence, publisher authority, or a critical receipt — that is what makes it
|
|
12
|
+
// replaceable and what stops a compromised resolver from being able to deny or forge anything.
|
|
13
|
+
// ─── Canonical resource keys ────────────────────────────────────────────────
|
|
14
|
+
/** Resource keys in the TARGET / OWNER vault — the authoritative side. */
|
|
15
|
+
export const OWNER_VAULT_RESOURCES = {
|
|
16
|
+
discoveryPolicy: 'agent-resolution:discovery-policy',
|
|
17
|
+
publications: 'agent-resolution:publications',
|
|
18
|
+
publicationAuthorities: 'agent-resolution:publication-authorities',
|
|
19
|
+
publicationContinuity: 'agent-resolution:publication-continuity',
|
|
20
|
+
grants: 'agent-resolution:grants',
|
|
21
|
+
grantStatus: 'agent-resolution:grant-status',
|
|
22
|
+
pairwiseAliases: 'agent-resolution:pairwise-aliases',
|
|
23
|
+
endpointControlEvidence: 'agent-resolution:endpoint-control-evidence',
|
|
24
|
+
invitations: 'agent-resolution:invitations',
|
|
25
|
+
invitationDeliveryReceipts: 'agent-resolution:invitation-delivery-receipts',
|
|
26
|
+
resolutionReceipts: 'agent-resolution:resolution-receipts',
|
|
27
|
+
};
|
|
28
|
+
/** Resource keys in the RESOLUTION SERVICE vault — the operational side. */
|
|
29
|
+
export const RESOLVER_VAULT_RESOURCES = {
|
|
30
|
+
grantIndex: 'agent-resolution:resolver:grant-index',
|
|
31
|
+
challengeNonces: 'agent-resolution:resolver:challenge-nonces',
|
|
32
|
+
useCounters: 'agent-resolution:resolver:use-counters',
|
|
33
|
+
rateBudgets: 'agent-resolution:resolver:rate-budgets',
|
|
34
|
+
projectionCache: 'agent-resolution:resolver:projection-cache',
|
|
35
|
+
abuseObservations: 'agent-resolution:resolver:abuse-observations',
|
|
36
|
+
};
|
|
37
|
+
// ─── Placement rules (enforced by review + spec 338 §9) ─────────────────────
|
|
38
|
+
/**
|
|
39
|
+
* Field names that MUST NOT appear in any public projection, discovery knowledge base row, search
|
|
40
|
+
* index, or global telemetry event (spec 338 §9, ADR-0040, ADR-0056 §9).
|
|
41
|
+
*
|
|
42
|
+
* Exported so a Ring-1 resolver, indexer, or logger can assert against it rather than re-deriving
|
|
43
|
+
* the list — the leak this guards is easy to reintroduce by accident when adding a debug log.
|
|
44
|
+
*/
|
|
45
|
+
export const NEVER_PUBLIC_FIELDS = [
|
|
46
|
+
'grantId',
|
|
47
|
+
'grantDigest',
|
|
48
|
+
'privateLabel',
|
|
49
|
+
'encryptedTargetBinding',
|
|
50
|
+
'subjectProof',
|
|
51
|
+
'challengeNonce',
|
|
52
|
+
'counterparty',
|
|
53
|
+
'audience',
|
|
54
|
+
'transportKeyBinding',
|
|
55
|
+
'ownerNote',
|
|
56
|
+
];
|
|
57
|
+
/**
|
|
58
|
+
* Shallow scan for never-public fields in an object bound for a public sink.
|
|
59
|
+
*
|
|
60
|
+
* Deliberately conservative and shallow-recursive: it is a guardrail for logging and projection call
|
|
61
|
+
* sites, not a security boundary. The boundary is that private records never reach a public sink in
|
|
62
|
+
* the first place.
|
|
63
|
+
*/
|
|
64
|
+
export function findNeverPublicFields(value, maxDepth = 4) {
|
|
65
|
+
const found = new Set();
|
|
66
|
+
const walk = (v, depth) => {
|
|
67
|
+
if (depth > maxDepth || v === null || typeof v !== 'object')
|
|
68
|
+
return;
|
|
69
|
+
if (Array.isArray(v)) {
|
|
70
|
+
for (const item of v)
|
|
71
|
+
walk(item, depth + 1);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
for (const [k, child] of Object.entries(v)) {
|
|
75
|
+
if (NEVER_PUBLIC_FIELDS.includes(k))
|
|
76
|
+
found.add(k);
|
|
77
|
+
walk(child, depth + 1);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
walk(value, 0);
|
|
81
|
+
return [...found];
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=records.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"records.js","sourceRoot":"","sources":["../src/records.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,EAAE;AACF,+FAA+F;AAC/F,kGAAkG;AAClG,wFAAwF;AACxF,8FAA8F;AAC9F,4EAA4E;AAC5E,EAAE;AACF,kGAAkG;AAClG,kGAAkG;AAClG,qGAAqG;AACrG,+FAA+F;AAiB/F,+EAA+E;AAE/E,0EAA0E;AAC1E,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,eAAe,EAAE,mCAAmC;IACpD,YAAY,EAAE,+BAA+B;IAC7C,sBAAsB,EAAE,0CAA0C;IAClE,qBAAqB,EAAE,yCAAyC;IAChE,MAAM,EAAE,yBAAyB;IACjC,WAAW,EAAE,+BAA+B;IAC5C,eAAe,EAAE,mCAAmC;IACpD,uBAAuB,EAAE,4CAA4C;IACrE,WAAW,EAAE,8BAA8B;IAC3C,0BAA0B,EAAE,+CAA+C;IAC3E,kBAAkB,EAAE,sCAAsC;CAClD,CAAC;AAEX,4EAA4E;AAC5E,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,UAAU,EAAE,uCAAuC;IACnD,eAAe,EAAE,4CAA4C;IAC7D,WAAW,EAAE,wCAAwC;IACrD,WAAW,EAAE,wCAAwC;IACrD,eAAe,EAAE,4CAA4C;IAC7D,iBAAiB,EAAE,8CAA8C;CACzD,CAAC;AAsIX,+EAA+E;AAE/E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,SAAS;IACT,aAAa;IACb,cAAc;IACd,wBAAwB;IACxB,cAAc;IACd,gBAAgB;IAChB,cAAc;IACd,UAAU;IACV,qBAAqB;IACrB,WAAW;CACH,CAAC;AAIX;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAc,EAAE,QAAQ,GAAG,CAAC;IAChE,MAAM,KAAK,GAAG,IAAI,GAAG,EAAoB,CAAC;IAE1C,MAAM,IAAI,GAAG,CAAC,CAAU,EAAE,KAAa,EAAQ,EAAE;QAC/C,IAAI,KAAK,GAAG,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,OAAO,CAAC,KAAK,QAAQ;YAAE,OAAO;QACpE,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;YACrB,KAAK,MAAM,IAAI,IAAI,CAAC;gBAAE,IAAI,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;YAC5C,OAAO;QACT,CAAC;QACD,KAAK,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3C,IAAK,mBAAyC,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAAE,KAAK,CAAC,GAAG,CAAC,CAAqB,CAAC,CAAC;YAC7F,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;QACzB,CAAC;IACH,CAAC,CAAC;IAEF,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACf,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { CanonicalAgentId } from '@agenticprimitives/types';
|
|
2
|
+
import type { ResolutionGrantPresentationV1 } from './grants.js';
|
|
3
|
+
import type { AgentConnectionInvitationV1 } from './invitation.js';
|
|
4
|
+
/**
|
|
5
|
+
* How an agent was looked up. Open-ended by design (ADR-0038, many registries) — a new external
|
|
6
|
+
* method is a Ring-1 adapter, never a change to this package's verification rules.
|
|
7
|
+
*/
|
|
8
|
+
export type AgentResolutionMethod = 'ans' | 'private-grant' | 'direct-invitation' | 'canonical-id' | 'dntls' | 'did' | 'local-directory' | (string & {});
|
|
9
|
+
export type AgentResolutionReference =
|
|
10
|
+
/** Direct canonical lookup — no name involved. */
|
|
11
|
+
{
|
|
12
|
+
kind: 'canonical-agent';
|
|
13
|
+
agentId: CanonicalAgentId;
|
|
14
|
+
}
|
|
15
|
+
/** Public ANS name. */
|
|
16
|
+
| {
|
|
17
|
+
kind: 'ans-name';
|
|
18
|
+
name: string;
|
|
19
|
+
}
|
|
20
|
+
/** Private resolution grant presented to a rendezvous resolver. */
|
|
21
|
+
| {
|
|
22
|
+
kind: 'private-grant';
|
|
23
|
+
grantId: string;
|
|
24
|
+
presentation: ResolutionGrantPresentationV1;
|
|
25
|
+
}
|
|
26
|
+
/** A signed invitation carrying its own initial publication. */
|
|
27
|
+
| {
|
|
28
|
+
kind: 'direct-invitation';
|
|
29
|
+
invitation: AgentConnectionInvitationV1;
|
|
30
|
+
}
|
|
31
|
+
/** Any external method (DNTLS, DID, an org directory) handled by a Ring-1 adapter. */
|
|
32
|
+
| {
|
|
33
|
+
kind: 'external';
|
|
34
|
+
method: string;
|
|
35
|
+
identifier: string;
|
|
36
|
+
proofMaterial?: unknown;
|
|
37
|
+
};
|
|
38
|
+
export type AgentResolutionReferenceKind = AgentResolutionReference['kind'];
|
|
39
|
+
/** Context a caller supplies to a provider. Never carries authority — see ADR-0056 §1. */
|
|
40
|
+
export interface ResolutionContextV1 {
|
|
41
|
+
/** The party asking. Absent for anonymous public resolution. */
|
|
42
|
+
requester?: CanonicalAgentId;
|
|
43
|
+
/** Which named projection the requester is asking for. The grant decides what is actually allowed. */
|
|
44
|
+
requestedProjection?: string;
|
|
45
|
+
purpose?: string;
|
|
46
|
+
/** ISO-8601. Injected rather than read from a clock so verification stays pure and testable. */
|
|
47
|
+
now: string;
|
|
48
|
+
}
|
|
49
|
+
/** What a provider returns BEFORE this package verifies anything. The name is the contract:
|
|
50
|
+
* a provider's word is not evidence, and a provider MUST NOT return a verified result. */
|
|
51
|
+
export interface UnverifiedResolutionBundleV1 {
|
|
52
|
+
method: AgentResolutionMethod;
|
|
53
|
+
referenceKind: AgentResolutionReferenceKind;
|
|
54
|
+
/** The publication as served. Signature, digest, sequence and status are all still unchecked. */
|
|
55
|
+
publication: unknown;
|
|
56
|
+
/** Opaque provider evidence (resolution receipt, status proof, transport metadata). */
|
|
57
|
+
providerEvidence?: readonly unknown[];
|
|
58
|
+
/** What the provider claims about freshness. Advisory; the client's own check is authoritative. */
|
|
59
|
+
servedAt?: string;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=references.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAEnE;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAC7B,KAAK,GACL,eAAe,GACf,mBAAmB,GACnB,cAAc,GACd,OAAO,GACP,KAAK,GACL,iBAAiB,GACjB,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB,MAAM,MAAM,wBAAwB;AAClC,kDAAkD;AAChD;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,OAAO,EAAE,gBAAgB,CAAA;CAAE;AACxD,uBAAuB;GACrB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AACpC,mEAAmE;GACjE;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,6BAA6B,CAAA;CAAE;AACzF,gEAAgE;GAC9D;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,UAAU,EAAE,2BAA2B,CAAA;CAAE;AACxE,sFAAsF;GACpF;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtF,MAAM,MAAM,4BAA4B,GAAG,wBAAwB,CAAC,MAAM,CAAC,CAAC;AAE5E,0FAA0F;AAC1F,MAAM,WAAW,mBAAmB;IAClC,gEAAgE;IAChE,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,sGAAsG;IACtG,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gGAAgG;IAChG,GAAG,EAAE,MAAM,CAAC;CACb;AAED;2FAC2F;AAC3F,MAAM,WAAW,4BAA4B;IAC3C,MAAM,EAAE,qBAAqB,CAAC;IAC9B,aAAa,EAAE,4BAA4B,CAAC;IAC5C,iGAAiG;IACjG,WAAW,EAAE,OAAO,CAAC;IACrB,uFAAuF;IACvF,gBAAgB,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IACtC,mGAAmG;IACnG,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// AgentResolutionReference — the portable "how do I look this agent up" value (spec 338 §12).
|
|
2
|
+
//
|
|
3
|
+
// The package is `agent-resolution`, not `private-discovery`, precisely because privacy is ONE
|
|
4
|
+
// method among several. A reference is method-tagged so a composed resolver can dispatch without
|
|
5
|
+
// any method leaking into the core verification rules.
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=references.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"references.js","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,EAAE;AACF,+FAA+F;AAC/F,iGAAiG;AACjG,uDAAuD"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { CanonicalAgentId } from '@agenticprimitives/types';
|
|
2
|
+
import type { Sha256 } from './canonicalization.js';
|
|
3
|
+
import type { ResolutionFreshnessV1 } from './freshness.js';
|
|
4
|
+
import type { AgentResolutionMethod, AgentResolutionReferenceKind } from './references.js';
|
|
5
|
+
import type { AgentServicePublicationV1 } from './publication.js';
|
|
6
|
+
/**
|
|
7
|
+
* How strongly the resolution is backed. Ordered weakest → strongest; a consumer's policy states a
|
|
8
|
+
* MINIMUM, and this package never silently accepts a weaker one (ADR-0013).
|
|
9
|
+
*/
|
|
10
|
+
export type ResolutionAssurance =
|
|
11
|
+
/** A provider said so. No proof. */
|
|
12
|
+
'unverified'
|
|
13
|
+
/** Signed by someone, but the publisher's authority for this agent was not checked. */
|
|
14
|
+
| 'asserted'
|
|
15
|
+
/** Digest + signature + freshness + publication authority all verified. */
|
|
16
|
+
| 'signed-publication'
|
|
17
|
+
/** As above, plus the endpoint proved control of its URI/key. */
|
|
18
|
+
| 'endpoint-control-verified'
|
|
19
|
+
/** As above, plus the live peer authenticated as the resolved agent on the connection. */
|
|
20
|
+
| 'peer-authenticated';
|
|
21
|
+
export declare function meetsAssurance(actual: ResolutionAssurance, minimum: ResolutionAssurance): boolean;
|
|
22
|
+
/** A single piece of evidence backing a resolution. Evidence is never authority (ADR-0038). */
|
|
23
|
+
export interface ResolutionEvidenceV1 {
|
|
24
|
+
kind: 'publication-signature' | 'publication-authority' | 'endpoint-control' | 'transport-key' | 'grant-presentation' | 'provider-receipt';
|
|
25
|
+
/** What produced it. */
|
|
26
|
+
source: string;
|
|
27
|
+
digest?: Sha256;
|
|
28
|
+
observedAt: string;
|
|
29
|
+
}
|
|
30
|
+
export interface VerifiedAgentResolutionV1 {
|
|
31
|
+
/** THE answer. Every method converges here (ADR-0010). */
|
|
32
|
+
canonicalAgentId: CanonicalAgentId;
|
|
33
|
+
method: AgentResolutionMethod;
|
|
34
|
+
referenceKind: AgentResolutionReferenceKind;
|
|
35
|
+
publication: AgentServicePublicationV1;
|
|
36
|
+
identityEvidence: readonly ResolutionEvidenceV1[];
|
|
37
|
+
endpointEvidence: readonly ResolutionEvidenceV1[];
|
|
38
|
+
assurance: ResolutionAssurance;
|
|
39
|
+
freshness: ResolutionFreshnessV1;
|
|
40
|
+
disclosure: {
|
|
41
|
+
projectionProfile: string;
|
|
42
|
+
/** Field CLASSES disclosed, not values — this object may be summarized into a receipt. */
|
|
43
|
+
disclosedFields: readonly string[];
|
|
44
|
+
/** True when the projection was restricted to a named audience. */
|
|
45
|
+
audienceBound: boolean;
|
|
46
|
+
};
|
|
47
|
+
verifiedAt: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Privacy-minimized resolution receipt (spec 338 §11).
|
|
51
|
+
*
|
|
52
|
+
* Successful resolutions are NOT fail-hard audit events. Recording every resolution with raw
|
|
53
|
+
* identifiers would turn the audit system into a relationship-surveillance database — so this
|
|
54
|
+
* carries digests, pseudonyms and field CLASSES only.
|
|
55
|
+
*
|
|
56
|
+
* MUST NOT carry: the raw grant, any bearer secret, the full endpoint outside the target vault, the
|
|
57
|
+
* full projection, unrelated requester facets, or a private label in global logs.
|
|
58
|
+
*/
|
|
59
|
+
export interface AgentResolutionReceiptV1 {
|
|
60
|
+
specVersion: 'ap.agent-resolution-receipt/1';
|
|
61
|
+
receiptId: string;
|
|
62
|
+
resolver: CanonicalAgentId;
|
|
63
|
+
targetAgent: CanonicalAgentId;
|
|
64
|
+
/** Present only where policy permits identifying the requester in this vault. */
|
|
65
|
+
requester?: CanonicalAgentId;
|
|
66
|
+
/** A stable per-relationship pseudonym for rate/abuse analysis without identifying the requester. */
|
|
67
|
+
requesterPseudonym?: string;
|
|
68
|
+
/** Keyed digest of the grant id. NEVER the grant id itself. */
|
|
69
|
+
grantIdDigest: Sha256;
|
|
70
|
+
publicationId?: string;
|
|
71
|
+
publicationDigest?: Sha256;
|
|
72
|
+
publicationSequence?: bigint;
|
|
73
|
+
projectionProfile: string;
|
|
74
|
+
/** Classes, not field names with values. */
|
|
75
|
+
disclosedFieldClasses: readonly string[];
|
|
76
|
+
decision: 'allowed' | 'denied';
|
|
77
|
+
/** The WIRE code, not the precise internal reason — receipts are relationship data too. */
|
|
78
|
+
reasonCode?: string;
|
|
79
|
+
observedAt: string;
|
|
80
|
+
proof: unknown;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Actions whose audit MUST be fail-hard (spec 338 §11). Everything else — successful resolution,
|
|
84
|
+
* rate-limit decisions, failed probes — is a privacy-minimized, vault-scoped receipt.
|
|
85
|
+
*/
|
|
86
|
+
export declare const FAIL_HARD_RESOLUTION_ACTIONS: readonly ["agent.discovery.grant.issue", "agent.discovery.grant.revoke", "agent.discovery.pairwise-alias.create", "agent.discovery.pairwise-alias.revoke", "agent.discovery.export", "agent.discovery.migrate", "agent.service-publication.publish", "agent.service-publication.supersede", "agent.service-publication.suspend", "agent.service-publication.revoke", "agent.endpoint.rotate", "agent.transport-key.rotate"];
|
|
87
|
+
export type FailHardResolutionAction = (typeof FAIL_HARD_RESOLUTION_ACTIONS)[number];
|
|
88
|
+
export declare function isFailHardResolutionAction(action: string): action is FailHardResolutionAction;
|
|
89
|
+
//# sourceMappingURL=results.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"results.d.ts","sourceRoot":"","sources":["../src/results.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,KAAK,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAC3F,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAElE;;;GAGG;AACH,MAAM,MAAM,mBAAmB;AAC7B,oCAAoC;AAClC,YAAY;AACd,uFAAuF;GACrF,UAAU;AACZ,2EAA2E;GACzE,oBAAoB;AACtB,iEAAiE;GAC/D,2BAA2B;AAC7B,0FAA0F;GACxF,oBAAoB,CAAC;AAUzB,wBAAgB,cAAc,CAAC,MAAM,EAAE,mBAAmB,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAEjG;AAED,+FAA+F;AAC/F,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,uBAAuB,GAAG,uBAAuB,GAAG,kBAAkB,GAAG,eAAe,GAAG,oBAAoB,GAAG,kBAAkB,CAAC;IAC3I,wBAAwB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,yBAAyB;IACxC,0DAA0D;IAC1D,gBAAgB,EAAE,gBAAgB,CAAC;IAEnC,MAAM,EAAE,qBAAqB,CAAC;IAC9B,aAAa,EAAE,4BAA4B,CAAC;IAE5C,WAAW,EAAE,yBAAyB,CAAC;IAEvC,gBAAgB,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAClD,gBAAgB,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAElD,SAAS,EAAE,mBAAmB,CAAC;IAC/B,SAAS,EAAE,qBAAqB,CAAC;IAEjC,UAAU,EAAE;QACV,iBAAiB,EAAE,MAAM,CAAC;QAC1B,0FAA0F;QAC1F,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;QACnC,mEAAmE;QACnE,aAAa,EAAE,OAAO,CAAC;KACxB,CAAC;IAEF,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,wBAAwB;IACvC,WAAW,EAAE,+BAA+B,CAAC;IAE7C,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,WAAW,EAAE,gBAAgB,CAAC;IAE9B,iFAAiF;IACjF,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,qGAAqG;IACrG,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,+DAA+D;IAC/D,aAAa,EAAE,MAAM,CAAC;IAEtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,4CAA4C;IAC5C,qBAAqB,EAAE,SAAS,MAAM,EAAE,CAAC;IAEzC,QAAQ,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC/B,2FAA2F;IAC3F,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;;GAGG;AACH,eAAO,MAAM,4BAA4B,6ZAa/B,CAAC;AAEX,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,4BAA4B,CAAC,CAAC,MAAM,CAAC,CAAC;AAErF,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,wBAAwB,CAE7F"}
|
package/dist/results.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// The verified resolution result + the privacy-aware receipt (spec 338 §11).
|
|
2
|
+
//
|
|
3
|
+
// `VerifiedAgentResolution` is deliberately shaped so that reading it CANNOT be mistaken for
|
|
4
|
+
// authorization. It carries a canonical id, a publication, evidence, and disclosure metadata — and
|
|
5
|
+
// nothing that resembles a token, scope, or grant to invoke. ADR-0056 §1.
|
|
6
|
+
const ASSURANCE_RANK = {
|
|
7
|
+
unverified: 0,
|
|
8
|
+
asserted: 1,
|
|
9
|
+
'signed-publication': 2,
|
|
10
|
+
'endpoint-control-verified': 3,
|
|
11
|
+
'peer-authenticated': 4,
|
|
12
|
+
};
|
|
13
|
+
export function meetsAssurance(actual, minimum) {
|
|
14
|
+
return ASSURANCE_RANK[actual] >= ASSURANCE_RANK[minimum];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Actions whose audit MUST be fail-hard (spec 338 §11). Everything else — successful resolution,
|
|
18
|
+
* rate-limit decisions, failed probes — is a privacy-minimized, vault-scoped receipt.
|
|
19
|
+
*/
|
|
20
|
+
export const FAIL_HARD_RESOLUTION_ACTIONS = [
|
|
21
|
+
'agent.discovery.grant.issue',
|
|
22
|
+
'agent.discovery.grant.revoke',
|
|
23
|
+
'agent.discovery.pairwise-alias.create',
|
|
24
|
+
'agent.discovery.pairwise-alias.revoke',
|
|
25
|
+
'agent.discovery.export',
|
|
26
|
+
'agent.discovery.migrate',
|
|
27
|
+
'agent.service-publication.publish',
|
|
28
|
+
'agent.service-publication.supersede',
|
|
29
|
+
'agent.service-publication.suspend',
|
|
30
|
+
'agent.service-publication.revoke',
|
|
31
|
+
'agent.endpoint.rotate',
|
|
32
|
+
'agent.transport-key.rotate',
|
|
33
|
+
];
|
|
34
|
+
export function isFailHardResolutionAction(action) {
|
|
35
|
+
return FAIL_HARD_RESOLUTION_ACTIONS.includes(action);
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=results.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"results.js","sourceRoot":"","sources":["../src/results.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,EAAE;AACF,6FAA6F;AAC7F,mGAAmG;AACnG,0EAA0E;AAwB1E,MAAM,cAAc,GAAwC;IAC1D,UAAU,EAAE,CAAC;IACb,QAAQ,EAAE,CAAC;IACX,oBAAoB,EAAE,CAAC;IACvB,2BAA2B,EAAE,CAAC;IAC9B,oBAAoB,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,UAAU,cAAc,CAAC,MAA2B,EAAE,OAA4B;IACtF,OAAO,cAAc,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;AAC3D,CAAC;AA8ED;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,6BAA6B;IAC7B,8BAA8B;IAC9B,uCAAuC;IACvC,uCAAuC;IACvC,wBAAwB;IACxB,yBAAyB;IACzB,mCAAmC;IACnC,qCAAqC;IACrC,mCAAmC;IACnC,kCAAkC;IAClC,uBAAuB;IACvB,4BAA4B;CACpB,CAAC;AAIX,MAAM,UAAU,0BAA0B,CAAC,MAAc;IACvD,OAAQ,4BAAkD,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC9E,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agenticprimitives/agent-resolution",
|
|
3
|
+
"version": "0.0.0-alpha.1",
|
|
4
|
+
"description": "Provider-neutral agent resolution primitives: agent discovery policy, signed sequenced AgentServicePublication with anti-rollback verification, private resolution grants, connection invitations, audience projection, and resolution provider ports. Resolution is never authority.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/agentictrustlabs/agenticprimitives.git",
|
|
9
|
+
"directory": "packages/agent-resolution"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/agentictrustlabs/agenticprimitives/tree/master/packages/agent-resolution",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/agentictrustlabs/agenticprimitives/issues"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"LICENSE",
|
|
26
|
+
"dist",
|
|
27
|
+
"spec.md",
|
|
28
|
+
"README.md"
|
|
29
|
+
],
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"@agenticprimitives/types": "1.0.0-alpha.20"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"vitest": "^4.1.8",
|
|
38
|
+
"@agenticprimitives/types": "1.0.0-alpha.20"
|
|
39
|
+
},
|
|
40
|
+
"keywords": [
|
|
41
|
+
"agentic",
|
|
42
|
+
"primitives",
|
|
43
|
+
"resolution",
|
|
44
|
+
"discovery",
|
|
45
|
+
"privacy",
|
|
46
|
+
"service-publication"
|
|
47
|
+
],
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "tsc -p tsconfig.build.json",
|
|
50
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
51
|
+
"test": "vitest run",
|
|
52
|
+
"test:unit": "vitest run test/unit --passWithNoTests",
|
|
53
|
+
"test:watch": "vitest",
|
|
54
|
+
"clean": "rm -rf dist",
|
|
55
|
+
"demo": "tsx demo/walkthrough.ts"
|
|
56
|
+
}
|
|
57
|
+
}
|
package/spec.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# @agenticprimitives/agent-resolution — package spec
|
|
2
|
+
|
|
3
|
+
**Architect-of-record:** [`specs/338-private-agent-resolution-and-service-publication.md`](https://github.com/agentictrustlabs/agenticprimitives/blob/master/specs/338-private-agent-resolution-and-service-publication.md)
|
|
4
|
+
**Doctrine:** [ADR-0056](https://github.com/agentictrustlabs/agenticprimitives/blob/master/docs/architecture/decisions/0056-resolution-is-not-authority-private-agent-resolution.md)
|
|
5
|
+
**Status:** W1 — shapes + verification + ports. Vault contracts (W2), rendezvous resolver (W3), card generation (W4), adapter composition (W5) pending.
|
|
6
|
+
|
|
7
|
+
## 1. Contract
|
|
8
|
+
|
|
9
|
+
This package answers exactly one question:
|
|
10
|
+
|
|
11
|
+
> May this party discover how to reach this agent, and where is it right now?
|
|
12
|
+
|
|
13
|
+
It never answers *"may this party use this agent?"* Service use requires
|
|
14
|
+
`delegation ∩ entitlement ∩ tool/action policy ∩ exact invocation proof ∩ revocation ∩ audit`,
|
|
15
|
+
re-run at the origin. Resolution is a fourth orthogonal concern beside custody, admission, and
|
|
16
|
+
authority.
|
|
17
|
+
|
|
18
|
+
## 2. Public surface
|
|
19
|
+
|
|
20
|
+
| Group | Exports |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| Policy | `AgentDiscoveryPolicyV1`, `discoveryPolicyFromPreset`, `validateDiscoveryPolicy`, `allowsDirectorySearch`, `allowsUnauthenticatedResolution` |
|
|
23
|
+
| Publication | `AgentServicePublicationV1`, `ServiceSurfacePublicationV1`, `TransportKeyBindingV1`, `EndpointControlProofV1`, `publicationBody` |
|
|
24
|
+
| Verification | `verifyPublication`, `Erc1271Verifier`, `PublicationAuthorityCheck` |
|
|
25
|
+
| Freshness | `checkFreshness`, `advanceContinuity`, `ChannelContinuityState` |
|
|
26
|
+
| Grants | `PrivateResolutionGrantV1`, `validateGrantShape`, `presentationBody`, `RESOLVE_ACTION`, `BEARER_BOOTSTRAP_MAX_LIFETIME_MS` |
|
|
27
|
+
| Invitation | `AgentConnectionInvitationV1`, `validateInvitationShape`, `invitationBody` |
|
|
28
|
+
| Admission | `admitGrantPresentation` |
|
|
29
|
+
| Projection | `projectSurfaces`, `findOverDisclosure` |
|
|
30
|
+
| Ports | `AgentResolutionProvider`, `ResolutionGrantStore`, `SubjectProofVerifier`, `ResolverDependencies` |
|
|
31
|
+
| Results | `VerifiedAgentResolutionV1`, `AgentResolutionReceiptV1`, `ResolutionAssurance`, `meetsAssurance`, `FAIL_HARD_RESOLUTION_ACTIONS` |
|
|
32
|
+
| Errors | `AgentResolutionError`, `toWireCode`, `ResolutionErrorCode`, `ResolutionWireCode` |
|
|
33
|
+
|
|
34
|
+
## 3. Invariants (normative)
|
|
35
|
+
|
|
36
|
+
1. **R-INV-01 — Resolution ≠ authority.** No export returns a token, scope, session, or capability
|
|
37
|
+
to invoke. `GrantAdmissionResult` yields a *projection profile* only.
|
|
38
|
+
2. **R-INV-02 — Digest ≠ currency.** A publication is accepted only with a valid signature over the
|
|
39
|
+
*recomputed* digest AND a passing freshness/sequence/status check.
|
|
40
|
+
3. **R-INV-03 — Monotonic sequence.** A lower sequence on a known channel is rejected as rollback.
|
|
41
|
+
4. **R-INV-04 — Equivocation is reported.** Same sequence + different digest sets
|
|
42
|
+
`freshness.conflict` and emits `publication_equivocation` (wire code `publication_conflict`).
|
|
43
|
+
5. **R-INV-05 — Uniform denial.** Every post-lookup grant failure maps to `resolution_denied`.
|
|
44
|
+
A distinguishable wire code after a successful lookup is a grant-existence oracle.
|
|
45
|
+
6. **R-INV-06 — Fail-closed projection.** A `private` surface with no matching audience is visible
|
|
46
|
+
to nobody. A grant may narrow a projection; it can never widen past the profile's exposure ceiling.
|
|
47
|
+
7. **R-INV-07 — Copied grants are inert.** `subject-bound` and `pairwise` grants MUST require proof
|
|
48
|
+
of possession; `validateGrantShape` rejects them otherwise.
|
|
49
|
+
8. **R-INV-08 — Bounded bearer.** `bearer-bootstrap` lifetime ≤ `BEARER_BOOTSTRAP_MAX_LIFETIME_MS`.
|
|
50
|
+
9. **R-INV-09 — No fallback.** A throwing verifier, authority check, or proof verifier is a failure,
|
|
51
|
+
never an escalation to a weaker check (ADR-0013).
|
|
52
|
+
10. **R-INV-10 — Purity.** No transport, storage, network, clock, or crypto dependency. Verifier,
|
|
53
|
+
authority check, store, and `now` are injected.
|
|
54
|
+
11. **R-INV-11 — Budget integrity.** A denied presentation never consumes the recipient's resolution
|
|
55
|
+
budget; a replayed nonce is rejected before signature verification.
|
|
56
|
+
|
|
57
|
+
## 4. Check order (admission)
|
|
58
|
+
|
|
59
|
+
Deliberate, and part of the contract — cheap checks before storage, storage before expensive
|
|
60
|
+
signature verification, budget last:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
audience → presentation timestamp → nonce (single-use) → lookup → stored-grant shape → action
|
|
64
|
+
→ validity window → grant audience → revocation → proof of possession → budget
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## 5. Out of scope
|
|
68
|
+
|
|
69
|
+
Name resolution (`agent-naming`), identifier→agent (`identity-directory`), candidate search,
|
|
70
|
+
descriptive profiles (`agent-profile`), design-time descriptors (`surface-catalog`), storage,
|
|
71
|
+
transport, and every concrete provider — including DNTLS, which is a future Ring-1
|
|
72
|
+
`AgentResolutionProvider` and never a dependency of this package (spec 338 §18).
|
|
73
|
+
|
|
74
|
+
## 6. Vocabulary
|
|
75
|
+
|
|
76
|
+
Uses `apar:` (`https://agenticprimitives.dev/ns/agent-resolution#`). **`apres:` / `Resolver` /
|
|
77
|
+
`ResolutionReceipt` belong to *intent* resolution** (`intent-resolver`, ERC-7683 pattern) and MUST
|
|
78
|
+
NOT be reused here. This package's receipt is `AgentResolutionReceiptV1` / `apar:AgentResolutionReceipt`.
|