@atrib/sdk 0.1.0

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evidence-envelope.js","sourceRoot":"","sources":["../src/evidence-envelope.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAkCtC,IAAI,2BAA2B,GAAgD,IAAI,CAAA;AACnF,SAAS,wBAAwB;IAC/B,2BAA2B,KAAK,MAAM,CAAC,eAAe,CAAC,CAAC,IAAI,CAC1D,CAAC,GAAG,EAAE,EAAE,CAAC,GAAsC,EAC/C,GAAG,EAAE,CAAC,IAAI,CACX,CAAA;IACD,OAAO,2BAA2B,CAAA;AACpC,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,iCAAiC,CAC/C,MAAgE;IAEhE,2BAA2B,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AACxD,CAAC;AAED,MAAM,oBAAoB,GACxB,0FAA0F,CAAA;AA8C5F;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,KAAiC;IAEjC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAA;IAC7B,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QACjE,MAAM,IAAI,SAAS,CACjB,4GAA4G,CAC7G,CAAA;IACH,CAAC;IACD,IAAI,OAAO,CAAC,SAAS,KAAK,SAAS,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QACtE,MAAM,IAAI,SAAS,CACjB,yGAAyG,CAC1G,CAAA;IACH,CAAC;IACD,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QACjE,MAAM,IAAI,SAAS,CACjB,4EAA4E,CAC7E,CAAA;IACH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,IAAI,CAAC,iDAAiD,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QAC/E,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAA;IACvD,CAAC;AACH,CAAC;AAQD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,QAAiB;IAEjB,MAAM,GAAG,GAAG,MAAM,wBAAwB,EAAE,CAAA;IAC5C,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QACjB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,oBAAoB,CAAC,EAAE,CAAA;IAC/D,CAAC;IACD,IAAI,CAAC;QACH,OAAO,EAAE,UAAU,EAAE,GAAG,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAA;IACrE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,UAAU,EAAE,IAAI;YAChB,QAAQ,EAAE,CAAC,+CAA+C,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;SAC3E,CAAA;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Evidence envelope types (accepted as D137; normative schema at spec §5.5.7).
3
+ *
4
+ * The SDK models evidence attachments on the universal envelope schema so
5
+ * downstream shapes align before the ADR lands: one envelope, N profiles
6
+ * identified by type URI. The legacy `protocol` string set is frozen at
7
+ * the five values shipped in @atrib/verify; every NEW evidence kind is an
8
+ * envelope profile — the SDK never grows a protocol union.
9
+ *
10
+ * Envelopes live outside signed bytes (mirror sidecar, archive evidence
11
+ * projection, verifier results, host-owned packets). Types only in v0:
12
+ * the SDK does not yet produce or verify envelopes.
13
+ */
14
+ export type EvidenceTier = 'declared' | 'shape' | 'attested' | 'verified';
15
+ export type EvidencePayloadRefKind = 'inline' | 'mirror' | 'archive' | 'external' | 'withheld';
16
+ export interface EvidencePayloadRef {
17
+ kind: EvidencePayloadRefKind;
18
+ /** For 'archive' / 'external' payload locations. Wire form uses explicit
19
+ * null for absent (§5.5.7 example); both are accepted. */
20
+ uri?: string | null;
21
+ /**
22
+ * Set when the payload is itself a signed atrib record (may accompany
23
+ * any kind except 'inline'); payload.hash then commits to that record's
24
+ * canonical JCS bytes.
25
+ */
26
+ record_hash?: string | null;
27
+ }
28
+ export interface EvidencePayload {
29
+ /** "sha256:" + hex commitment to the raw evidence material (raw bytes
30
+ * for non-JSON media types, JCS bytes for JSON payloads). */
31
+ hash: string;
32
+ media_type?: string;
33
+ ref?: EvidencePayloadRef;
34
+ /** Raw payload; ONLY when ref.kind === 'inline'; never public. */
35
+ inline?: unknown;
36
+ }
37
+ export interface EvidenceConstraint {
38
+ /** Profile-defined constraint discriminator (accepted §5.5.7 shape). */
39
+ type: string;
40
+ status: 'passed' | 'failed' | 'unresolved' | 'not_checked';
41
+ expected?: unknown;
42
+ actual?: unknown;
43
+ }
44
+ export interface EvidenceEnvelope {
45
+ /** Envelope schema version; 1 today. */
46
+ envelope: 1;
47
+ /** Absolute HTTPS profile type URI, e.g. https://atrib.dev/v1/evidence/oauth2 */
48
+ profile: string;
49
+ /** Semver of the profile document (versions independently of the spec). */
50
+ profile_version: string;
51
+ /** What the verifier party actually did — instance property, not truth. */
52
+ tier: EvidenceTier;
53
+ payload: EvidencePayload;
54
+ /** Profile-defined verifier facts (flat JSON object). */
55
+ facts?: Record<string, unknown>;
56
+ result?: {
57
+ valid?: boolean;
58
+ constraints?: EvidenceConstraint[];
59
+ errors?: string[];
60
+ warnings?: string[];
61
+ };
62
+ verifier?: {
63
+ name?: string;
64
+ version?: string;
65
+ checked_at_ms?: number;
66
+ };
67
+ }
68
+ /**
69
+ * Dedup identity per the P042 tier rules: `(profile, payload.hash)`.
70
+ * Multiple instances per key are permitted; consumers order by tier
71
+ * descending, then checked_at_ms descending, then verifier name.
72
+ */
73
+ export declare function evidenceEnvelopeKey(envelope: EvidenceEnvelope): string;
74
+ /** Numeric rank of a tier (0 = declared … 3 = verified). */
75
+ export declare function evidenceTierRank(tier: EvidenceTier): number;
76
+ //# sourceMappingURL=evidence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evidence.d.ts","sourceRoot":"","sources":["../src/evidence.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,CAAA;AAEzE,MAAM,MAAM,sBAAsB,GAC9B,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,UAAU,GACV,UAAU,CAAA;AAEd,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,sBAAsB,CAAA;IAC5B;8DAC0D;IAC1D,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B;AAED,MAAM,WAAW,eAAe;IAC9B;iEAC6D;IAC7D,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,GAAG,CAAC,EAAE,kBAAkB,CAAA;IACxB,kEAAkE;IAClE,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,YAAY,GAAG,aAAa,CAAA;IAC1D,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,wCAAwC;IACxC,QAAQ,EAAE,CAAC,CAAA;IACX,iFAAiF;IACjF,OAAO,EAAE,MAAM,CAAA;IACf,2EAA2E;IAC3E,eAAe,EAAE,MAAM,CAAA;IACvB,2EAA2E;IAC3E,IAAI,EAAE,YAAY,CAAA;IAClB,OAAO,EAAE,eAAe,CAAA;IACxB,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,OAAO,CAAA;QACf,WAAW,CAAC,EAAE,kBAAkB,EAAE,CAAA;QAClC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;QACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;KACpB,CAAA;IACD,QAAQ,CAAC,EAAE;QACT,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,aAAa,CAAC,EAAE,MAAM,CAAA;KACvB,CAAA;CACF;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAEtE;AASD,4DAA4D;AAC5D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAE3D"}
@@ -0,0 +1,20 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ /**
3
+ * Dedup identity per the P042 tier rules: `(profile, payload.hash)`.
4
+ * Multiple instances per key are permitted; consumers order by tier
5
+ * descending, then checked_at_ms descending, then verifier name.
6
+ */
7
+ export function evidenceEnvelopeKey(envelope) {
8
+ return `${envelope.profile} ${envelope.payload.hash}`;
9
+ }
10
+ const TIER_ORDER = {
11
+ declared: 0,
12
+ shape: 1,
13
+ attested: 2,
14
+ verified: 3,
15
+ };
16
+ /** Numeric rank of a tier (0 = declared … 3 = verified). */
17
+ export function evidenceTierRank(tier) {
18
+ return TIER_ORDER[tier];
19
+ }
20
+ //# sourceMappingURL=evidence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evidence.js","sourceRoot":"","sources":["../src/evidence.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAiFtC;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAA0B;IAC5D,OAAO,GAAG,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,CAAA;AACvD,CAAC;AAED,MAAM,UAAU,GAAiC;IAC/C,QAAQ,EAAE,CAAC;IACX,KAAK,EAAE,CAAC;IACR,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,CAAC;CACZ,CAAA;AAED,4DAA4D;AAC5D,MAAM,UAAU,gBAAgB,CAAC,IAAkB;IACjD,OAAO,UAAU,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Record-hash and provenance-token helpers (§1.2.3, §1.2.6, §1.5.2).
3
+ *
4
+ * These are compositions of the existing `@atrib/mcp` primitives — no new
5
+ * canonicalization or signing implementation. The record-hash idiom
6
+ * `sha256:<hex(SHA-256(JCS(signed record)))>` is used verbatim across all
7
+ * atrib producers; do not diverge from it.
8
+ */
9
+ import { type AtribRecord } from '@atrib/mcp';
10
+ /**
11
+ * The record hash as bare 64-char lowercase hex (§1.2.3).
12
+ * SHA-256 over the JCS-canonical COMPLETE record, including `signature`.
13
+ */
14
+ export declare function recordHashHex(record: AtribRecord): string;
15
+ /**
16
+ * The record hash in `sha256:<64-hex>` reference form, as used by
17
+ * `chain_root`, `informed_by`, `annotates`, and `revises`.
18
+ */
19
+ export declare function recordHashRef(record: AtribRecord): string;
20
+ /**
21
+ * Derive the §1.2.6 provenance_token for a downstream genesis record from
22
+ * the complete signed upstream record: base64url (no padding) of the first
23
+ * 16 bytes of the upstream record hash. Always 22 characters.
24
+ */
25
+ export declare function deriveProvenanceToken(upstream: AtribRecord): string;
26
+ //# sourceMappingURL=hashes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hashes.d.ts","sourceRoot":"","sources":["../src/hashes.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EAKL,KAAK,WAAW,EACjB,MAAM,YAAY,CAAA;AAEnB;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAEzD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAEzD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,WAAW,GAAG,MAAM,CAEnE"}
package/dist/hashes.js ADDED
@@ -0,0 +1,33 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ /**
3
+ * Record-hash and provenance-token helpers (§1.2.3, §1.2.6, §1.5.2).
4
+ *
5
+ * These are compositions of the existing `@atrib/mcp` primitives — no new
6
+ * canonicalization or signing implementation. The record-hash idiom
7
+ * `sha256:<hex(SHA-256(JCS(signed record)))>` is used verbatim across all
8
+ * atrib producers; do not diverge from it.
9
+ */
10
+ import { base64urlEncode, canonicalRecord, hexEncode, sha256, } from '@atrib/mcp';
11
+ /**
12
+ * The record hash as bare 64-char lowercase hex (§1.2.3).
13
+ * SHA-256 over the JCS-canonical COMPLETE record, including `signature`.
14
+ */
15
+ export function recordHashHex(record) {
16
+ return hexEncode(sha256(canonicalRecord(record)));
17
+ }
18
+ /**
19
+ * The record hash in `sha256:<64-hex>` reference form, as used by
20
+ * `chain_root`, `informed_by`, `annotates`, and `revises`.
21
+ */
22
+ export function recordHashRef(record) {
23
+ return `sha256:${recordHashHex(record)}`;
24
+ }
25
+ /**
26
+ * Derive the §1.2.6 provenance_token for a downstream genesis record from
27
+ * the complete signed upstream record: base64url (no padding) of the first
28
+ * 16 bytes of the upstream record hash. Always 22 characters.
29
+ */
30
+ export function deriveProvenanceToken(upstream) {
31
+ return base64urlEncode(sha256(canonicalRecord(upstream)).slice(0, 16));
32
+ }
33
+ //# sourceMappingURL=hashes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hashes.js","sourceRoot":"","sources":["../src/hashes.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC;;;;;;;GAOG;AAEH,OAAO,EACL,eAAe,EACf,eAAe,EACf,SAAS,EACT,MAAM,GAEP,MAAM,YAAY,CAAA;AAEnB;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,MAAmB;IAC/C,OAAO,SAAS,CAAC,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;AACnD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,MAAmB;IAC/C,OAAO,UAAU,aAAa,CAAC,MAAM,CAAC,EAAE,CAAA;AAC1C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAAqB;IACzD,OAAO,eAAe,CAAC,MAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;AACxE,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @atrib/sdk — the consolidated atrib client SDK.
3
+ *
4
+ * Two verbs over the substrate: attest() (write) and recall() (read),
5
+ * daemon-first with in-process fallback, plus the complete §1 record
6
+ * layer re-exported from @atrib/mcp so application code needs exactly one
7
+ * import. This package adds NO new canonicalization, hashing, or signing
8
+ * implementation — every cryptographic path is the existing @atrib/mcp
9
+ * one, and every write terminates in @atrib/emit's handleEmit pipeline.
10
+ */
11
+ export { createAtribClient, type AtribClient } from './client.js';
12
+ export { buildEmitArgs, type AttestAnchorPosture, type AttestInput, type AttestRef, type AttestResult, } from './attest.js';
13
+ export { SHAPE_TO_TOOL, type AnnotationsQuery, type ByContentQuery, type BySignerQuery, type HistoryQuery, type OrphansQuery, type RecallOutcome, type RecallQuery, type RecallShape, type RevisionsQuery, type SessionChainQuery, type TraceQuery, type VerifyQuery, type WalkQuery, } from './recall.js';
14
+ export { DEFAULT_DAEMON_ENDPOINT, DEFAULT_PRODUCER, resolveAnchorSet, resolveDaemonEndpoint, type AnchorSpec, type AtribClientConfig, type DaemonConfig, type DaemonMode, type ResolvedAnchorSet, } from './config.js';
15
+ export { DaemonClient, type DaemonCallOutcome } from './daemon.js';
16
+ export { ANCHOR_TYPES, BUILT_IN_DEFAULT_ANCHOR_SET, createAnchorFanout, resolveAnchorPosture, resolveEffectiveAnchors, submitToAnchors, } from '@atrib/mcp';
17
+ export type { AnchorConfigSidecarMarker, AnchorDescriptor, AnchorFanout, AnchorFanoutTicket, AnchorPostureResolution, AnchorSetConfig, AnchorSubmissionOutcome, AnchorSubmissionStatus, AnchorType, } from '@atrib/mcp';
18
+ export { evidenceEnvelopeKey, evidenceTierRank, type EvidenceConstraint, type EvidenceEnvelope, type EvidencePayload, type EvidencePayloadRef, type EvidencePayloadRefKind, type EvidenceTier, } from './evidence.js';
19
+ export { buildEvidenceEnvelope, validateEvidenceEnvelope, type BuildEvidenceEnvelopeInput, type BuildEvidenceEnvelopePayloadInput, type BuildEvidenceEnvelopeResult, type ValidateEvidenceEnvelopeResult, } from './evidence-envelope.js';
20
+ export { ATTRIBUTION_EXTENSION_KEY, checkAttributionReceiptConsistency, parseAttributionReceiptBlock, type AttributionLogSubmissionStatus, type AttributionReceipt, type AttributionReceiptBlock, type AttributionReceiptConsistency, type VerifiedAttributionReceipt, } from './attribution.js';
21
+ export { ATTRIBUTION_EXTENSION_ID, ATTRIBUTION_LOG_SUBMISSION_STATUSES, verifyAttributionReceipt, } from '@atrib/mcp';
22
+ export type { AttributionReceiptVerification } from '@atrib/mcp';
23
+ export { deriveProvenanceToken, recordHashHex, recordHashRef } from './hashes.js';
24
+ export { EVENT_TYPE_ANNOTATION_URI, EVENT_TYPE_DIRECTORY_ANCHOR_URI, EVENT_TYPE_OBSERVATION_URI, EVENT_TYPE_REVISION_URI, EVENT_TYPE_TOOL_CALL_URI, EVENT_TYPE_TRANSACTION_URI, EVENT_TYPE_SHORT_NAMES, EVENT_TYPE_SHORT_TO_URI, isNormativeEventTypeUri, isValidEventTypeUri, normalizeEventType, canonicalCrossAttestationInput, canonicalRecord, canonicalSigningInput, getPublicKey, signRecord, signTransactionAttestation, signTransactionRecord, verifyRecord, base64urlDecode, base64urlEncode, hexDecode, hexEncode, sha256, chainRoot, genesisChainRoot, resolveChainRoot, decodeToken, encodeToken, extractTraceId, mergeBaggageAtribSession, mergeTracestate, parseBaggageAtribSession, parseTracestateAtrib, readInboundContext, writeOutboundContext, computeContentId, normalizeServerUrl, eventTypeUriToByte, serializeEntry, validateSubmission, inheritChainContext, readMirrorTail, recordHashExistsInMirror, resolveEnvContextId, createSubmissionQueue, } from '@atrib/mcp';
25
+ export type { AtribRecord, ChainContext, DecodedToken, EntryInput, ProofBundle, SignerEntry, SubmissionQueue, UnsignedAtribRecord, ValidationResult, } from '@atrib/mcp';
26
+ export { emitInProcess, resolveKey } from '@atrib/emit';
27
+ export type { EmitOutput, ResolvedKey } from '@atrib/emit';
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAGH,OAAO,EAAE,iBAAiB,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AACjE,OAAO,EACL,aAAa,EACb,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,YAAY,GAClB,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,aAAa,EACb,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,SAAS,GACf,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,EACrB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,iBAAiB,GACvB,MAAM,aAAa,CAAA;AACpB,O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kB,EAElB,8BAA8B,EAC9B,eAAe,EACf,qBAAqB,EAErB,YAAY,EACZ,UAAU,EACV,0BAA0B,EAC1B,qBAAqB,EACrB,YAAY,EAEZ,eAAe,EACf,eAAe,EACf,SAAS,EACT,SAAS,EACT,MAAM,EAEN,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAEhB,WAAW,EACX,WAAW,EACX,cAAc,EACd,wBAAwB,EACxB,eAAe,EACf,wBAAwB,EACxB,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EAEpB,gBAAgB,EAChB,kBAAkB,EAElB,kBAAkB,EAClB,cAAc,EAEd,kBAAkB,EAElB,mBAAmB,EACnB,cAAc,EACd,wBAAwB,EAExB,mBAAmB,EAEnB,qBAAqB,GACtB,MAAM,YAAY,CAAA;AACnB,YAAY,EACV,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,WAAW,EACX,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,YAAY,CAAA;AAGnB,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACvD,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,56 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ /**
3
+ * @atrib/sdk — the consolidated atrib client SDK.
4
+ *
5
+ * Two verbs over the substrate: attest() (write) and recall() (read),
6
+ * daemon-first with in-process fallback, plus the complete §1 record
7
+ * layer re-exported from @atrib/mcp so application code needs exactly one
8
+ * import. This package adds NO new canonicalization, hashing, or signing
9
+ * implementation — every cryptographic path is the existing @atrib/mcp
10
+ * one, and every write terminates in @atrib/emit's handleEmit pipeline.
11
+ */
12
+ // ── The two verbs ────────────────────────────────────────────────────────
13
+ export { createAtribClient } from './client.js';
14
+ export { buildEmitArgs, } from './attest.js';
15
+ export { SHAPE_TO_TOOL, } from './recall.js';
16
+ export { DEFAULT_DAEMON_ENDPOINT, DEFAULT_PRODUCER, resolveAnchorSet, resolveDaemonEndpoint, } from './config.js';
17
+ export { DaemonClient } from './daemon.js';
18
+ // ── Anchor plurality (D138, §2.11.7-§2.11.13), from @atrib/mcp ───────────
19
+ export { ANCHOR_TYPES, BUILT_IN_DEFAULT_ANCHOR_SET, createAnchorFanout, resolveAnchorPosture, resolveEffectiveAnchors, submitToAnchors, } from '@atrib/mcp';
20
+ // ── Evidence envelopes (D137, §5.5.7) ────────────────────────────────────
21
+ export { evidenceEnvelopeKey, evidenceTierRank, } from './evidence.js';
22
+ export { buildEvidenceEnvelope, validateEvidenceEnvelope, } from './evidence-envelope.js';
23
+ // ── Attribution receipts (D141, dev.atrib/attribution v0.1) ──────────────
24
+ export { ATTRIBUTION_EXTENSION_KEY, checkAttributionReceiptConsistency, parseAttributionReceiptBlock, } from './attribution.js';
25
+ export { ATTRIBUTION_EXTENSION_ID, ATTRIBUTION_LOG_SUBMISSION_STATUSES, verifyAttributionReceipt, } from '@atrib/mcp';
26
+ // ── SDK hash helpers (compositions of @atrib/mcp primitives) ────────────
27
+ export { deriveProvenanceToken, recordHashHex, recordHashRef } from './hashes.js';
28
+ // ── Record layer (§1), re-exported from @atrib/mcp ───────────────────────
29
+ export {
30
+ // types + event vocabulary
31
+ EVENT_TYPE_ANNOTATION_URI, EVENT_TYPE_DIRECTORY_ANCHOR_URI, EVENT_TYPE_OBSERVATION_URI, EVENT_TYPE_REVISION_URI, EVENT_TYPE_TOOL_CALL_URI, EVENT_TYPE_TRANSACTION_URI, EVENT_TYPE_SHORT_NAMES, EVENT_TYPE_SHORT_TO_URI, isNormativeEventTypeUri, isValidEventTypeUri, normalizeEventType,
32
+ // canonicalization (§1.3)
33
+ canonicalCrossAttestationInput, canonicalRecord, canonicalSigningInput,
34
+ // signing + verification (§1.4)
35
+ getPublicKey, signRecord, signTransactionAttestation, signTransactionRecord, verifyRecord,
36
+ // hashing + encoding
37
+ base64urlDecode, base64urlEncode, hexDecode, hexEncode, sha256,
38
+ // chain composition (§1.2.3 / §1.2.3.1)
39
+ chainRoot, genesisChainRoot, resolveChainRoot,
40
+ // propagation (§1.5)
41
+ decodeToken, encodeToken, extractTraceId, mergeBaggageAtribSession, mergeTracestate, parseBaggageAtribSession, parseTracestateAtrib, readInboundContext, writeOutboundContext,
42
+ // content identity (§1.2.2)
43
+ computeContentId, normalizeServerUrl,
44
+ // log entry serialization (§2.3.1)
45
+ eventTypeUriToByte, serializeEntry,
46
+ // submission-side validation (§2.6.1 client parity)
47
+ validateSubmission,
48
+ // mirror conventions (§5.9)
49
+ inheritChainContext, readMirrorTail, recordHashExistsInMirror,
50
+ // context identity (D078/D083)
51
+ resolveEnvContextId,
52
+ // submission queue (§5.3.5)
53
+ createSubmissionQueue, } from '@atrib/mcp';
54
+ // ── Key handling (§5.6), re-exported from @atrib/emit ────────────────────
55
+ export { emitInProcess, resolveKey } from '@atrib/emit';
56
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC;;;;;;;;;GASG;AAEH,4EAA4E;AAC5E,OAAO,EAAE,iBAAiB,EAAoB,MAAM,aAAa,CAAA;AACjE,OAAO,EACL,aAAa,GAKd,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,aAAa,GAcd,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,GAMtB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,YAAY,EAA0B,MAAM,aAAa,CAAA;AAElE,4EAA4E;AAC5E,OAAO,EACL,YAAY,EACZ,2BAA2B,EAC3B,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,eAAe,GAChB,MAAM,YAAY,CAAA;AAanB,4EAA4E;AAC5E,OAAO,EACL,mBAAmB,EACnB,gBAAgB,GAOjB,MAAM,eAAe,CAAA;AACtB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AE,MAAM,aAAa,CAAA"}
@@ -0,0 +1,122 @@
1
+ /**
2
+ * recall(): the SDK's single read verb.
3
+ *
4
+ * Collapses the read primitives under one query shape with a `shape`
5
+ * discriminator (redesign upgrade-path step 6). The daemon path maps each
6
+ * shape to the corresponding primitives-runtime tool; the in-process
7
+ * fallback covers the shapes whose engines are exported as libraries
8
+ * today ('history' via @atrib/recall's recall(), 'verify' via
9
+ * @atrib/verify-mcp's handleAtribVerify()). Shapes without an exported
10
+ * engine degrade to a warning outcome when no daemon is reachable —
11
+ * honestly, rather than via a divergent reimplementation.
12
+ *
13
+ * Summarize is deliberately NOT a shape: synthesis belongs to the calling
14
+ * harness/model. The SDK returns verified raw material.
15
+ */
16
+ export type RecallShape = 'history' | 'walk' | 'annotations' | 'revisions' | 'by_content' | 'session_chain' | 'orphans' | 'by_signer' | 'trace' | 'trace_forward' | 'verify';
17
+ export interface HistoryQuery {
18
+ shape?: 'history';
19
+ context_id?: string;
20
+ context_scope?: 'all' | 'env';
21
+ creator_key?: string;
22
+ event_type?: string;
23
+ content_id?: string;
24
+ tool_name?: string;
25
+ args_hash?: string;
26
+ min_importance?: 'critical' | 'high' | 'medium' | 'low' | 'noise';
27
+ topic_tags?: string[];
28
+ include_revised?: boolean;
29
+ min_signers?: number;
30
+ rank_by?: 'timestamp' | 'relevance' | 'causal_distance';
31
+ rank_anchor?: string;
32
+ toc?: boolean;
33
+ limit?: number;
34
+ offset?: number;
35
+ compact?: boolean;
36
+ include_unverified?: boolean;
37
+ }
38
+ export interface WalkQuery {
39
+ shape: 'walk';
40
+ from_record_hash: string;
41
+ edge_types?: Array<'CHAIN_PRECEDES' | 'INFORMED_BY' | 'ANNOTATES' | 'REVISES'>;
42
+ depth?: number;
43
+ }
44
+ export interface AnnotationsQuery {
45
+ shape: 'annotations';
46
+ record_hash: string;
47
+ }
48
+ export interface RevisionsQuery {
49
+ shape: 'revisions';
50
+ record_hash: string;
51
+ }
52
+ export interface ByContentQuery {
53
+ shape: 'by_content';
54
+ query: string;
55
+ k?: number;
56
+ max_records?: number;
57
+ evidence_mode?: 'bounded' | 'require_complete';
58
+ }
59
+ export interface SessionChainQuery {
60
+ shape: 'session_chain';
61
+ context_id?: string;
62
+ limit?: number;
63
+ include_content?: boolean;
64
+ }
65
+ export interface OrphansQuery {
66
+ shape: 'orphans';
67
+ context_id?: string;
68
+ event_type?: string;
69
+ creator_key?: string;
70
+ limit?: number;
71
+ }
72
+ export interface BySignerQuery {
73
+ shape: 'by_signer';
74
+ min_records?: number;
75
+ }
76
+ export interface TraceQuery {
77
+ shape: 'trace' | 'trace_forward';
78
+ record_hash: string;
79
+ context_id?: string;
80
+ depth?: number;
81
+ max_nodes?: number;
82
+ compact?: boolean;
83
+ include_content?: boolean;
84
+ }
85
+ /** Pattern 3 handoff-claim verification (D105/D106) via @atrib/verify-mcp. */
86
+ export interface VerifyQuery {
87
+ shape: 'verify';
88
+ packet?: unknown;
89
+ records?: unknown;
90
+ claims?: unknown;
91
+ required_record_hashes?: string[];
92
+ trusted_creator_keys?: string[];
93
+ allowed_context_ids?: string[];
94
+ require_body?: boolean;
95
+ require_body_commitment?: boolean;
96
+ require_log_inclusion?: boolean;
97
+ log_public_key_b64?: string;
98
+ now_ms?: number;
99
+ max_age_ms?: number;
100
+ }
101
+ export type RecallQuery = HistoryQuery | WalkQuery | AnnotationsQuery | RevisionsQuery | ByContentQuery | SessionChainQuery | OrphansQuery | BySignerQuery | TraceQuery | VerifyQuery;
102
+ export interface RecallOutcome<T = unknown> {
103
+ shape: RecallShape;
104
+ /** Which path served the read. 'none' = degraded, see warnings. */
105
+ via: 'daemon' | 'in-process' | 'none';
106
+ data: T | null;
107
+ warnings: string[];
108
+ /**
109
+ * `dev.atrib/attribution` receipt from the daemon result's `_meta`,
110
+ * present only when `attributionReceipts` is enabled and the daemon
111
+ * emitted one (D141): the parsed block plus its
112
+ * `verifyAttributionReceipt` outcome. Advisory; trust derives from
113
+ * verifying signed records.
114
+ */
115
+ attribution_receipt?: import('./attribution.js').VerifiedAttributionReceipt;
116
+ }
117
+ /** Physical tool name on the primitives runtime for each shape. */
118
+ export declare const SHAPE_TO_TOOL: Record<RecallShape, string>;
119
+ export declare function shapeOf(query: RecallQuery): RecallShape;
120
+ /** Strip the SDK-only `shape` discriminator; the rest passes through. */
121
+ export declare function toToolArgs(query: RecallQuery): Record<string, unknown>;
122
+ //# sourceMappingURL=recall.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recall.d.ts","sourceRoot":"","sources":["../src/recall.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,MAAM,WAAW,GACnB,SAAS,GACT,MAAM,GACN,aAAa,GACb,WAAW,GACX,YAAY,GACZ,eAAe,GACf,SAAS,GACT,WAAW,GACX,OAAO,GACP,eAAe,GACf,QAAQ,CAAA;AAEZ,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,KAAK,GAAG,KAAK,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,CAAA;IACjE,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,WAAW,GAAG,WAAW,GAAG,iBAAiB,CAAA;IACvD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAA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AAA;CAC5E;AAED,mEAAmE;AACnE,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAYrD,CAAA;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CAEvD;AAED,yEAAyE;AACzE,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAOtE"}
package/dist/recall.js ADDED
@@ -0,0 +1,29 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ /** Physical tool name on the primitives runtime for each shape. */
3
+ export const SHAPE_TO_TOOL = {
4
+ history: 'recall_my_attribution_history',
5
+ walk: 'recall_walk',
6
+ annotations: 'recall_annotations',
7
+ revisions: 'recall_revisions',
8
+ by_content: 'recall_by_content',
9
+ session_chain: 'recall_session_chain',
10
+ orphans: 'recall_orphans',
11
+ by_signer: 'recall_by_signer',
12
+ trace: 'trace',
13
+ trace_forward: 'trace_forward',
14
+ verify: 'atrib-verify',
15
+ };
16
+ export function shapeOf(query) {
17
+ return query.shape ?? 'history';
18
+ }
19
+ /** Strip the SDK-only `shape` discriminator; the rest passes through. */
20
+ export function toToolArgs(query) {
21
+ const { shape: _shape, ...args } = query;
22
+ const out = {};
23
+ for (const [key, value] of Object.entries(args)) {
24
+ if (value !== undefined)
25
+ out[key] = value;
26
+ }
27
+ return out;
28
+ }
29
+ //# sourceMappingURL=recall.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recall.js","sourceRoot":"","sources":["../src/recall.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAyJtC,mEAAmE;AACnE,MAAM,CAAC,MAAM,aAAa,GAAgC;IACxD,OAAO,EAAE,+BAA+B;IACxC,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,oBAAoB;IACjC,SAAS,EAAE,kBAAkB;IAC7B,UAAU,EAAE,mBAAmB;IAC/B,aAAa,EAAE,sBAAsB;IACrC,OAAO,EAAE,gBAAgB;IACzB,SAAS,EAAE,kBAAkB;IAC7B,KAAK,EAAE,OAAO;IACd,aAAa,EAAE,eAAe;IAC9B,MAAM,EAAE,cAAc;CACvB,CAAA;AAED,MAAM,UAAU,OAAO,CAAC,KAAkB;IACxC,OAAO,KAAK,CAAC,KAAK,IAAI,SAAS,CAAA;AACjC,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,UAAU,CAAC,KAAkB;IAC3C,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,KAA0D,CAAA;IAC7F,MAAM,GAAG,GAA4B,EAAE,CAAA;IACvC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAChD,IAAI,KAAK,KAAK,SAAS;YAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;IAC3C,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "@atrib/sdk",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./dist/index.js",
10
+ "types": "./dist/index.d.ts"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "description": "Consolidated client SDK for Atrib's verifiable action layer. Provides attest() and recall() verbs over a daemon-first runtime with in-process signing fallback, anchor-set submission, and the full record layer re-exported from @atrib/mcp.",
17
+ "author": "atrib <hello@atrib.dev>",
18
+ "license": "Apache-2.0",
19
+ "homepage": "https://atrib.dev",
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "keywords": [
24
+ "mcp",
25
+ "model-context-protocol",
26
+ "attribution",
27
+ "attest",
28
+ "recall",
29
+ "ed25519",
30
+ "merkle"
31
+ ],
32
+ "dependencies": {
33
+ "@modelcontextprotocol/sdk": "^1.29.0",
34
+ "@atrib/emit": "0.17.0",
35
+ "@atrib/mcp": "0.19.0"
36
+ },
37
+ "peerDependencies": {
38
+ "@atrib/recall": "0.14.4",
39
+ "@atrib/verify": "0.8.0",
40
+ "@atrib/verify-mcp": "0.2.18"
41
+ },
42
+ "peerDependenciesMeta": {
43
+ "@atrib/recall": {
44
+ "optional": true
45
+ },
46
+ "@atrib/verify": {
47
+ "optional": true
48
+ },
49
+ "@atrib/verify-mcp": {
50
+ "optional": true
51
+ }
52
+ },
53
+ "devDependencies": {
54
+ "@types/node": "^25.9.3",
55
+ "typescript": "^6.0.3",
56
+ "vitest": "^4.1.8",
57
+ "@atrib/recall": "0.14.4",
58
+ "@atrib/verify": "0.8.0",
59
+ "@atrib/verify-mcp": "0.2.18"
60
+ },
61
+ "repository": {
62
+ "type": "git",
63
+ "url": "git+https://github.com/creatornader/atrib.git",
64
+ "directory": "packages/sdk"
65
+ },
66
+ "scripts": {
67
+ "build": "tsc",
68
+ "test": "vitest run",
69
+ "typecheck": "tsc --noEmit",
70
+ "clean": "rm -rf dist"
71
+ }
72
+ }