@redditech/agent-protocol 0.0.0-stage → 0.2.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.
Files changed (55) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/LICENSE +21 -0
  3. package/README.md +394 -2
  4. package/dist/adl.d.ts +141 -0
  5. package/dist/adl.js +3601 -0
  6. package/dist/agent-stack-fixtures.d.ts +743 -0
  7. package/dist/agent-stack-fixtures.js +1554 -0
  8. package/dist/ai-catalog.d.ts +128 -0
  9. package/dist/ai-catalog.js +373 -0
  10. package/dist/attestation-reputation.d.ts +102 -0
  11. package/dist/attestation-reputation.js +279 -0
  12. package/dist/audd-rail-config.d.ts +102 -0
  13. package/dist/audd-rail-config.js +294 -0
  14. package/dist/browser-wallet-approval.d.ts +293 -0
  15. package/dist/browser-wallet-approval.js +1201 -0
  16. package/dist/discovery-source.d.ts +115 -0
  17. package/dist/discovery-source.js +251 -0
  18. package/dist/evidence-archive.d.ts +73 -0
  19. package/dist/evidence-archive.js +238 -0
  20. package/dist/index.d.ts +23 -0
  21. package/dist/index.js +23 -0
  22. package/dist/mpp-tempo-receipt-shapes.d.ts +201 -0
  23. package/dist/mpp-tempo-receipt-shapes.js +330 -0
  24. package/dist/okf-adapter.d.ts +229 -0
  25. package/dist/okf-adapter.js +556 -0
  26. package/dist/okf-conformance.d.ts +208 -0
  27. package/dist/okf-conformance.js +651 -0
  28. package/dist/okf-instruction-safety.d.ts +192 -0
  29. package/dist/okf-instruction-safety.js +509 -0
  30. package/dist/onboarding-analyser-handoff.d.ts +391 -0
  31. package/dist/onboarding-analyser-handoff.js +959 -0
  32. package/dist/onboarding-state-machine.d.ts +228 -0
  33. package/dist/onboarding-state-machine.js +432 -0
  34. package/dist/payment-records.d.ts +181 -0
  35. package/dist/payment-records.js +599 -0
  36. package/dist/policy.d.ts +33 -0
  37. package/dist/policy.js +45 -0
  38. package/dist/provider-trust.d.ts +113 -0
  39. package/dist/provider-trust.js +346 -0
  40. package/dist/quasar-registry-compatibility.d.ts +113 -0
  41. package/dist/quasar-registry-compatibility.js +214 -0
  42. package/dist/ranking-explainability.d.ts +202 -0
  43. package/dist/ranking-explainability.js +302 -0
  44. package/dist/receipt-v2.d.ts +202 -0
  45. package/dist/receipt-v2.js +418 -0
  46. package/dist/repo-explorer-evidence-manifest.d.ts +387 -0
  47. package/dist/repo-explorer-evidence-manifest.js +1187 -0
  48. package/dist/source-diagnostics.d.ts +84 -0
  49. package/dist/source-diagnostics.js +193 -0
  50. package/dist/source-trust-conformance-matrix.d.ts +207 -0
  51. package/dist/source-trust-conformance-matrix.js +672 -0
  52. package/examples/ard-no-spend-ai-catalog.json +51 -0
  53. package/examples/ard-no-spend-demo.mjs +355 -0
  54. package/examples/interpretation-guide-scenarios.mjs +302 -0
  55. package/package.json +144 -4
@@ -0,0 +1,84 @@
1
+ import { type DiscoveryCandidate, type DiscoveryCandidatePolicyPreflightDecision, type DiscoveryCandidateReasonCode, type DiscoverySourceKind } from './discovery-source.js';
2
+ import { type ProviderTrustVerificationStatus } from './provider-trust.js';
3
+ export declare const SOURCE_DIAGNOSTICS_SCHEMA_VERSION: "reddi.source-diagnostics.v1";
4
+ export type SourceDiagnosticLane = 'capability_match' | 'discovery_source' | 'publisher_identity' | 'trust_evidence' | 'policy_decision' | 'payment_fit' | 'reputation_evidence';
5
+ export type SourceDiagnosticSeverity = 'info' | 'warning' | 'blocked';
6
+ export type SourceDiagnosticReasonCode = 'capability_declared' | 'capability_match_unscored' | 'discovery_source_recorded' | 'raw_snapshot_recorded' | 'publisher_identity_recorded' | 'publisher_identity_missing' | 'trust_verified' | 'trust_claimed_unverified' | 'trust_unverified' | 'trust_failed_verification' | 'policy_allowed' | 'policy_denied' | 'payment_quote_present' | 'payment_quote_missing' | 'payment_quote_denied' | 'reputation_history_present' | 'reputation_history_absent';
7
+ export type SourceDiagnosticMessage = {
8
+ lane: SourceDiagnosticLane;
9
+ severity: SourceDiagnosticSeverity;
10
+ code: SourceDiagnosticReasonCode | DiscoveryCandidateReasonCode;
11
+ summary: string;
12
+ action?: string;
13
+ };
14
+ export type SourceAwareCandidateDiagnostics = {
15
+ schemaVersion: typeof SOURCE_DIAGNOSTICS_SCHEMA_VERSION;
16
+ candidate: {
17
+ identifier: string;
18
+ name: string;
19
+ sourceKind: DiscoverySourceKind;
20
+ rawSnapshotRef?: string;
21
+ };
22
+ capabilityMatch: {
23
+ resourceType: string;
24
+ mediaType: string;
25
+ relevanceScore?: number;
26
+ scoreMeaning: 'relevance_only_not_trust';
27
+ summary: string;
28
+ };
29
+ discoverySource: {
30
+ sourceKind: DiscoverySourceKind;
31
+ url?: string;
32
+ endpoint?: string;
33
+ rawSnapshotRef?: string;
34
+ summary: string;
35
+ };
36
+ publisherIdentity: {
37
+ id?: string;
38
+ name?: string;
39
+ domain?: string;
40
+ trustStatus?: ProviderTrustVerificationStatus;
41
+ summary: string;
42
+ };
43
+ trustEvidence: {
44
+ status: ProviderTrustVerificationStatus | 'missing';
45
+ reasonCodes: string[];
46
+ verifier?: string;
47
+ checkedAt?: string;
48
+ failureReasons: string[];
49
+ provenanceCount: number;
50
+ attestationCount: number;
51
+ verificationReferenceCount: number;
52
+ summary: string;
53
+ };
54
+ policyDecision: {
55
+ allowed?: boolean;
56
+ reasonCodes: DiscoveryCandidateReasonCode[];
57
+ summaries: string[];
58
+ };
59
+ paymentFit: {
60
+ quote?: {
61
+ amount: string;
62
+ asset: string;
63
+ network: string;
64
+ };
65
+ allowed?: boolean;
66
+ reasonCodes: DiscoveryCandidateReasonCode[];
67
+ summary: string;
68
+ };
69
+ reputationEvidence: {
70
+ status: 'history_present' | 'no_history';
71
+ receiptCount?: number;
72
+ attestationCount?: number;
73
+ summary: string;
74
+ };
75
+ messages: SourceDiagnosticMessage[];
76
+ };
77
+ export type SourceAwareDiagnosticsOptions = {
78
+ policyDecision?: DiscoveryCandidatePolicyPreflightDecision;
79
+ reputation?: {
80
+ receiptCount?: number;
81
+ attestationCount?: number;
82
+ };
83
+ };
84
+ export declare function createSourceAwareCandidateDiagnostics(candidate: DiscoveryCandidate, options?: SourceAwareDiagnosticsOptions): SourceAwareCandidateDiagnostics;
@@ -0,0 +1,193 @@
1
+ export const SOURCE_DIAGNOSTICS_SCHEMA_VERSION = 'reddi.source-diagnostics.v1';
2
+ function trustSummary(status) {
3
+ switch (status) {
4
+ case 'verified':
5
+ return 'RAP-side verification marked this provider as verified.';
6
+ case 'claimed':
7
+ return 'External trust metadata is present, but RAP has not verified it.';
8
+ case 'failed_verification':
9
+ return 'RAP-side verification failed for this provider.';
10
+ case 'unverified':
11
+ return 'No verified trust metadata is available for this provider.';
12
+ case 'missing':
13
+ return 'No provider trust record is attached to this discovery candidate.';
14
+ }
15
+ }
16
+ function trustMessageCode(status) {
17
+ switch (status) {
18
+ case 'verified':
19
+ return 'trust_verified';
20
+ case 'claimed':
21
+ return 'trust_claimed_unverified';
22
+ case 'failed_verification':
23
+ return 'trust_failed_verification';
24
+ case 'unverified':
25
+ case 'missing':
26
+ return 'trust_unverified';
27
+ }
28
+ }
29
+ function trustSeverity(status) {
30
+ if (status === 'verified')
31
+ return 'info';
32
+ if (status === 'failed_verification')
33
+ return 'blocked';
34
+ return 'warning';
35
+ }
36
+ function paymentReasonCodes(decision) {
37
+ if (!decision)
38
+ return [];
39
+ return decision.reasonCodes.filter((code) => (code === 'missing_quote'
40
+ || code === 'malformed_candidate'
41
+ || code === 'unsupported_asset'
42
+ || code === 'unsupported_network'
43
+ || code === 'over_budget'));
44
+ }
45
+ function paymentAllowed(candidate, decision) {
46
+ if (!candidate.quote && !decision)
47
+ return undefined;
48
+ const paymentCodes = paymentReasonCodes(decision);
49
+ return Boolean(candidate.quote) && paymentCodes.length === 0;
50
+ }
51
+ export function createSourceAwareCandidateDiagnostics(candidate, options = {}) {
52
+ const policyDecision = options.policyDecision;
53
+ const trustStatus = candidate.providerTrust?.verification?.status ?? 'missing';
54
+ const trustMetadata = candidate.providerTrust?.trustMetadata ?? candidate.trustMetadata;
55
+ const provenanceCount = trustMetadata?.provenanceLinks.length ?? 0;
56
+ const attestationCount = trustMetadata?.attestations.length ?? 0;
57
+ const verificationReferenceCount = trustMetadata?.verificationReferences.length ?? 0;
58
+ const publisher = candidate.publisher;
59
+ const paymentCodes = paymentReasonCodes(policyDecision);
60
+ const paymentLaneAllowed = paymentAllowed(candidate, policyDecision);
61
+ const hasReputation = Boolean((options.reputation?.receiptCount ?? 0) > 0 || (options.reputation?.attestationCount ?? 0) > 0);
62
+ const messages = [];
63
+ messages.push({
64
+ lane: 'capability_match',
65
+ severity: 'info',
66
+ code: candidate.relevance?.score === undefined ? 'capability_match_unscored' : 'capability_declared',
67
+ summary: candidate.relevance?.score === undefined
68
+ ? `Candidate ${candidate.identifier} declares ${candidate.mediaType}; no relevance score was supplied.`
69
+ : `Candidate ${candidate.identifier} has relevance score ${candidate.relevance.score}; this is not a trust score.`,
70
+ });
71
+ messages.push({
72
+ lane: 'discovery_source',
73
+ severity: 'info',
74
+ code: candidate.rawSnapshotRef ? 'raw_snapshot_recorded' : 'discovery_source_recorded',
75
+ summary: `Discovered from ${candidate.sourceKind}${candidate.rawSnapshotRef ? ` with snapshot ${candidate.rawSnapshotRef}` : ''}.`,
76
+ });
77
+ messages.push({
78
+ lane: 'publisher_identity',
79
+ severity: publisher?.id ? 'info' : 'warning',
80
+ code: publisher?.id ? 'publisher_identity_recorded' : 'publisher_identity_missing',
81
+ summary: publisher?.id ? `Publisher identity recorded as ${publisher.id}.` : 'No publisher identity is attached to this candidate.',
82
+ action: publisher?.id ? undefined : 'Require provider identity before publishing or paid invocation.',
83
+ });
84
+ messages.push({
85
+ lane: 'trust_evidence',
86
+ severity: trustSeverity(trustStatus),
87
+ code: trustMessageCode(trustStatus),
88
+ summary: trustSummary(trustStatus),
89
+ action: trustStatus === 'verified' ? undefined : 'Run RAP-side trust verification before treating this candidate as trusted.',
90
+ });
91
+ if (policyDecision) {
92
+ messages.push({
93
+ lane: 'policy_decision',
94
+ severity: policyDecision.allowed ? 'info' : 'blocked',
95
+ code: policyDecision.allowed ? 'policy_allowed' : 'policy_denied',
96
+ summary: policyDecision.allowed
97
+ ? 'Policy preflight allowed this candidate.'
98
+ : `Policy preflight denied this candidate: ${policyDecision.reasonCodes.join(', ')}.`,
99
+ action: policyDecision.allowed ? undefined : 'Resolve the listed policy reason codes before quote/payment/invocation.',
100
+ });
101
+ }
102
+ messages.push({
103
+ lane: 'payment_fit',
104
+ severity: paymentCodes.length > 0 ? 'blocked' : candidate.quote ? 'info' : 'warning',
105
+ code: paymentCodes.length > 0 ? 'payment_quote_denied' : candidate.quote ? 'payment_quote_present' : 'payment_quote_missing',
106
+ summary: paymentCodes.length > 0
107
+ ? `Payment or budget fit failed: ${paymentCodes.join(', ')}.`
108
+ : candidate.quote
109
+ ? `Quote is ${candidate.quote.amount} ${candidate.quote.asset} on ${candidate.quote.network}.`
110
+ : 'No quote is attached; quote/payment preflight is still required.',
111
+ action: paymentCodes.length > 0 || !candidate.quote ? 'Complete quote/payment preflight before invocation.' : undefined,
112
+ });
113
+ messages.push({
114
+ lane: 'reputation_evidence',
115
+ severity: hasReputation ? 'info' : 'warning',
116
+ code: hasReputation ? 'reputation_history_present' : 'reputation_history_absent',
117
+ summary: hasReputation
118
+ ? `Reputation evidence includes ${options.reputation?.receiptCount ?? 0} receipt(s) and ${options.reputation?.attestationCount ?? 0} attestation(s).`
119
+ : 'No prior receipt or attestation history is attached.',
120
+ action: hasReputation ? undefined : 'Treat this candidate as unproven until receipts or attestations exist.',
121
+ });
122
+ return {
123
+ schemaVersion: SOURCE_DIAGNOSTICS_SCHEMA_VERSION,
124
+ candidate: {
125
+ identifier: candidate.identifier,
126
+ name: candidate.name,
127
+ sourceKind: candidate.sourceKind,
128
+ rawSnapshotRef: candidate.rawSnapshotRef,
129
+ },
130
+ capabilityMatch: {
131
+ resourceType: candidate.resourceType,
132
+ mediaType: candidate.mediaType,
133
+ relevanceScore: candidate.relevance?.score,
134
+ scoreMeaning: 'relevance_only_not_trust',
135
+ summary: candidate.relevance?.score === undefined
136
+ ? 'Capability match has no supplied relevance score.'
137
+ : 'Relevance score is only a capability/search signal and never a trust, safety, payment, or reputation decision.',
138
+ },
139
+ discoverySource: {
140
+ sourceKind: candidate.sourceKind,
141
+ url: candidate.url,
142
+ endpoint: candidate.endpoint,
143
+ rawSnapshotRef: candidate.rawSnapshotRef,
144
+ summary: 'Discovery source is recorded separately from policy, trust, payment, and reputation.',
145
+ },
146
+ publisherIdentity: {
147
+ id: publisher?.id,
148
+ name: publisher?.name,
149
+ domain: publisher?.domain,
150
+ trustStatus: candidate.providerTrust?.verification.status,
151
+ summary: publisher?.id ? 'Publisher identity is present for audit and display.' : 'Publisher identity is missing.',
152
+ },
153
+ trustEvidence: {
154
+ status: trustStatus,
155
+ reasonCodes: candidate.providerTrust?.verification.reasonCodes ?? ['no_trust_record'],
156
+ verifier: candidate.providerTrust?.verification.verifier,
157
+ checkedAt: candidate.providerTrust?.verification.checkedAt,
158
+ failureReasons: candidate.providerTrust?.verification.failureReasons ?? [],
159
+ provenanceCount,
160
+ attestationCount,
161
+ verificationReferenceCount,
162
+ summary: trustSummary(trustStatus),
163
+ },
164
+ policyDecision: {
165
+ allowed: policyDecision?.allowed,
166
+ reasonCodes: policyDecision?.reasonCodes ?? [],
167
+ summaries: policyDecision?.auditNotes ?? [],
168
+ },
169
+ paymentFit: {
170
+ quote: candidate.quote
171
+ ? {
172
+ amount: candidate.quote.amount,
173
+ asset: candidate.quote.asset,
174
+ network: candidate.quote.network,
175
+ }
176
+ : undefined,
177
+ allowed: paymentLaneAllowed,
178
+ reasonCodes: paymentCodes,
179
+ summary: paymentCodes.length > 0
180
+ ? 'Payment or budget policy denied this candidate.'
181
+ : candidate.quote
182
+ ? 'Quote metadata is present; payment still requires explicit approval/settlement outside discovery.'
183
+ : 'Quote metadata is missing.',
184
+ },
185
+ reputationEvidence: {
186
+ status: hasReputation ? 'history_present' : 'no_history',
187
+ receiptCount: options.reputation?.receiptCount,
188
+ attestationCount: options.reputation?.attestationCount,
189
+ summary: hasReputation ? 'Prior reputation evidence is present.' : 'No prior reputation evidence is present.',
190
+ },
191
+ messages,
192
+ };
193
+ }
@@ -0,0 +1,207 @@
1
+ /**
2
+ * Source/trust conformance matrix for auth.md and ARD/AI Catalog provider
3
+ * metadata (#450, epics #336 / #363).
4
+ *
5
+ * Proves — with deterministic fixtures only — that `auth.md` documents and
6
+ * ARD/AI Catalog provider metadata enter RAP as UNTRUSTED source metadata and
7
+ * stay untrusted until explicit RAP-side trust/evidence gates classify them.
8
+ * Discovery relevance is a search signal and never a trust decision; see
9
+ * `docs/DISCOVER-DECIDE-PROVE-BOUNDARIES.md` (#452) — this module references
10
+ * that boundary and enforces it (`relevance_ignored_for_trust`), it does not
11
+ * restate it.
12
+ *
13
+ * This module is PURE: no network, no filesystem access, no live auth.md
14
+ * fetch, no catalog crawl, no LLM/provider call, no MCP/tool call, no wallet
15
+ * or RPC action, no hosted-registry write, no publication, no payment, no
16
+ * trust/reputation mutation. It only classifies in-memory metadata the caller
17
+ * already holds. Fail-closed on malformed input and on every unsafe finding.
18
+ *
19
+ * Vocabulary reuse (no new words where existing ones fit):
20
+ * - Trust states mirror the #343 lane vocabulary stated in the boundaries doc
21
+ * (trusted / listed-untrusted / claimed / unverified / failed-verification /
22
+ * blocked / needs-human-review) and overlap with the #506 actionability lane
23
+ * states (`claimed`, `failed_verification`, `blocked`, `needs_human_review`).
24
+ * - Finding severities reuse the repo static-analysis vocabulary
25
+ * (`info` / `warning` / `blocked` — `source-diagnostics.ts`, `okf-conformance.ts`).
26
+ * - Finding codes reuse `provider-trust.ts` reason codes wherever one exists
27
+ * (`malformed_trust_metadata`, `credential_leakage_rejected`,
28
+ * `no_trust_metadata`, `external_claim_not_verified_by_rap`, `rap_verified`,
29
+ * `rap_verification_failed`) and add only the auth-surface gates #450 names.
30
+ * - auth.md registration/credential vocabulary aligns with the auth.md
31
+ * discovery lane (`agent-provider` / `email-verification` / `anonymous`;
32
+ * `access_token` / `api_key`). Identity-assertion names are DRAFT and
33
+ * illustrative — auth.md is an external format; confirm before relying.
34
+ *
35
+ * Outputs are projections consumable by:
36
+ * - #343 provider trust registry work (`registryProjection` maps every matrix
37
+ * state onto the existing `ProviderTrustVerificationStatus` vocabulary and
38
+ * carries the normalized `ProviderTrustRecord` when one exists), and
39
+ * - #344 source-aware diagnostics (`diagnosticsProjection` uses the
40
+ * `source-diagnostics.ts` lane + severity vocabulary).
41
+ */
42
+ import { type AiCatalogSnapshot } from './ai-catalog.js';
43
+ import { type ProviderTrustRecord, type ProviderTrustVerificationInput, type ProviderTrustVerificationStatus } from './provider-trust.js';
44
+ import { type SourceDiagnosticLane, type SourceDiagnosticSeverity } from './source-diagnostics.js';
45
+ export declare const SOURCE_TRUST_CONFORMANCE_MATRIX_SCHEMA_VERSION: "reddi.source-trust-conformance-matrix.v1";
46
+ /** Where the boundary between discovery relevance and trust/policy/payment/evidence/reputation is defined. */
47
+ export declare const SOURCE_TRUST_BOUNDARIES_DOC_REF: "docs/DISCOVER-DECIDE-PROVE-BOUNDARIES.md";
48
+ /**
49
+ * The #450 / #343 trust-state vocabulary.
50
+ *
51
+ * `listed_untrusted` is the mandatory ingress state: every auth.md document
52
+ * and every ARD/AI Catalog provider entry is listed-untrusted until RAP-side
53
+ * gates run. `unverified` means gates ran and found no trust evidence at all;
54
+ * `claimed` means external trust claims exist but RAP has not verified them.
55
+ */
56
+ export type SourceTrustState = 'trusted' | 'listed_untrusted' | 'claimed' | 'unverified' | 'failed_verification' | 'blocked' | 'needs_human_review';
57
+ export declare const SOURCE_TRUST_STATES: readonly SourceTrustState[];
58
+ /** The #450 acceptance-criteria case list; the matrix must cover every one. */
59
+ export type SourceTrustRequiredCase = 'malformed_metadata' | 'credential_leakage' | 'anonymous_write_scope' | 'unsupported_credential_type' | 'unsupported_identity_assertion' | 'missing_trust_evidence' | 'high_relevance_blocked_candidate';
60
+ export declare const SOURCE_TRUST_REQUIRED_CASES: readonly SourceTrustRequiredCase[];
61
+ /** Reuses the repo-wide static-analysis severity vocabulary. */
62
+ export type SourceTrustFindingSeverity = SourceDiagnosticSeverity;
63
+ export type SourceTrustFindingCode = 'malformed_trust_metadata' | 'credential_leakage_rejected' | 'no_trust_metadata' | 'external_claim_not_verified_by_rap' | 'rap_verified' | 'rap_verification_failed' | 'listed_untrusted_on_entry' | 'malformed_source_metadata' | 'anonymous_write_scope_rejected' | 'unsupported_credential_type' | 'unsupported_identity_assertion' | 'self_asserted_verification_ignored' | 'relevance_ignored_for_trust';
64
+ export type SourceTrustFinding = {
65
+ code: SourceTrustFindingCode;
66
+ severity: SourceTrustFindingSeverity;
67
+ path: string;
68
+ message: string;
69
+ };
70
+ /** Supported auth.md credential types (aligned with the auth.md discovery lane). */
71
+ export declare const SUPPORTED_AUTH_MD_CREDENTIAL_TYPES: readonly string[];
72
+ /** Supported auth.md registration types (aligned with the auth.md discovery lane). */
73
+ export declare const SUPPORTED_AUTH_MD_REGISTRATION_TYPES: readonly string[];
74
+ /**
75
+ * Supported identity-assertion mechanisms. DRAFT/illustrative — auth.md is an
76
+ * external format and these names are unconfirmed against a live spec; the
77
+ * fail-closed behavior (unknown assertion ⇒ blocked) is the contract, not the
78
+ * exact allowlist.
79
+ */
80
+ export declare const SUPPORTED_AUTH_MD_IDENTITY_ASSERTIONS: readonly string[];
81
+ export type AuthMdScopeDeclaration = {
82
+ name: string;
83
+ access: 'read' | 'write';
84
+ /** Registration types this scope is offered to; omitted means all declared types. */
85
+ registrationTypes?: string[];
86
+ };
87
+ /**
88
+ * Parsed auth.md source metadata as it enters RAP: still just self-asserted
89
+ * provider text. Nothing in this shape is trusted by import.
90
+ */
91
+ export type AuthMdSourceMetadata = {
92
+ url?: string;
93
+ authorizationServer?: string;
94
+ registrationTypes?: string[];
95
+ credentialTypes?: string[];
96
+ identityAssertions?: string[];
97
+ scopes?: AuthMdScopeDeclaration[];
98
+ publisher?: {
99
+ id?: string;
100
+ domain?: string;
101
+ };
102
+ trust?: {
103
+ trustManifest?: unknown;
104
+ provenance?: unknown[];
105
+ attestations?: unknown[];
106
+ verificationReferences?: unknown[];
107
+ publisherIdentity?: unknown;
108
+ /** External self-asserted status; RAP ignores it and flags it for review. */
109
+ status?: string;
110
+ };
111
+ raw?: unknown;
112
+ };
113
+ export type SourceTrustCandidateSource = {
114
+ kind: 'auth-md';
115
+ metadata: unknown;
116
+ } | {
117
+ kind: 'ai-catalog';
118
+ catalog: AiCatalogSnapshot;
119
+ resourceId: string;
120
+ };
121
+ export type ClassifySourceTrustInput = {
122
+ candidateId: string;
123
+ source: SourceTrustCandidateSource;
124
+ /** Discovery relevance — recorded and explicitly ignored for trust. */
125
+ relevance?: {
126
+ score?: number;
127
+ source?: string;
128
+ };
129
+ /** RAP-side verification outcome, when a gate has actually run. */
130
+ rapVerification?: ProviderTrustVerificationInput;
131
+ /**
132
+ * 'not_run' produces the mandatory ingress classification
133
+ * (`listed_untrusted`) without evaluating any gate. Default: 'run'.
134
+ */
135
+ gates?: 'run' | 'not_run';
136
+ };
137
+ /** #343 registry consumption shape: existing provider-trust vocabulary only. */
138
+ export type SourceTrustRegistryProjection = {
139
+ verificationStatus: ProviderTrustVerificationStatus;
140
+ reasonCodes: SourceTrustFindingCode[];
141
+ /** Blocked rows must never be listed as invocable registry candidates. */
142
+ registryEligible: boolean;
143
+ /** Present for ai-catalog sources when provider-trust normalization succeeds. */
144
+ providerTrustRecord?: ProviderTrustRecord;
145
+ };
146
+ /** #344 diagnostics consumption shape: source-diagnostics lane + severity vocabulary. */
147
+ export type SourceTrustDiagnosticsProjectionMessage = {
148
+ lane: SourceDiagnosticLane;
149
+ severity: SourceDiagnosticSeverity;
150
+ code: string;
151
+ summary: string;
152
+ action?: string;
153
+ };
154
+ export type SourceTrustConformanceRow = {
155
+ schemaVersion: typeof SOURCE_TRUST_CONFORMANCE_MATRIX_SCHEMA_VERSION;
156
+ candidateId: string;
157
+ sourceKind: 'auth-md' | 'ai-catalog';
158
+ /** Constant by construction: both source kinds enter untrusted-until-gated. */
159
+ entryState: 'listed_untrusted';
160
+ state: SourceTrustState;
161
+ stateLabel: string;
162
+ findings: SourceTrustFinding[];
163
+ discoveryBoundary: {
164
+ relevanceScore?: number;
165
+ scoreMeaning: 'relevance_only_not_trust';
166
+ relevanceInfluencedTrust: false;
167
+ boundariesDocRef: typeof SOURCE_TRUST_BOUNDARIES_DOC_REF;
168
+ };
169
+ registryProjection: SourceTrustRegistryProjection;
170
+ diagnosticsProjection: SourceTrustDiagnosticsProjectionMessage[];
171
+ };
172
+ export type SourceTrustConformanceFixtureCase = {
173
+ description: string;
174
+ requiredCase?: SourceTrustRequiredCase;
175
+ input: ClassifySourceTrustInput;
176
+ expectedState: SourceTrustState;
177
+ expectedFindingCodes: SourceTrustFindingCode[];
178
+ };
179
+ export type SourceTrustConformanceMatrix = {
180
+ schemaVersion: typeof SOURCE_TRUST_CONFORMANCE_MATRIX_SCHEMA_VERSION;
181
+ boundary: {
182
+ untrustedUntilGated: true;
183
+ /** What the matrix separates trust from — defined in the boundaries doc. */
184
+ distinguishesRelevanceFrom: readonly ['trust', 'policy', 'payment', 'evidence', 'reputation'];
185
+ boundariesDocRef: typeof SOURCE_TRUST_BOUNDARIES_DOC_REF;
186
+ };
187
+ rows: Array<SourceTrustConformanceRow & {
188
+ fixtureId: string;
189
+ description: string;
190
+ requiredCase?: SourceTrustRequiredCase;
191
+ }>;
192
+ coverage: {
193
+ states: Record<SourceTrustState, number>;
194
+ requiredCases: Record<SourceTrustRequiredCase, number>;
195
+ sourceKinds: Record<'auth-md' | 'ai-catalog', number>;
196
+ missingStates: SourceTrustState[];
197
+ missingRequiredCases: SourceTrustRequiredCase[];
198
+ complete: boolean;
199
+ };
200
+ };
201
+ export declare function classifySourceTrustCandidate(input: ClassifySourceTrustInput): SourceTrustConformanceRow;
202
+ /**
203
+ * Fixture cases proving every #450 state and required case, across BOTH
204
+ * source kinds. Deterministic, in-memory, no live fetch anywhere.
205
+ */
206
+ export declare const sourceTrustConformanceFixtureCases: Record<string, SourceTrustConformanceFixtureCase>;
207
+ export declare function buildSourceTrustConformanceMatrix(cases?: Record<string, SourceTrustConformanceFixtureCase>): SourceTrustConformanceMatrix;