@truealter/sdk 0.4.1 → 0.5.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/dist/index.d.cts CHANGED
@@ -130,6 +130,7 @@ interface ProvenanceEnvelope {
130
130
  }
131
131
  interface ProvenancePayload {
132
132
  iss: string;
133
+ aud?: string | string[];
133
134
  iat: number;
134
135
  exp: number;
135
136
  purpose: string;
@@ -188,6 +189,21 @@ interface VerifyProvenanceOptions {
188
189
  verifyAtAllowlist?: readonly string[];
189
190
  fetch?: typeof fetch;
190
191
  now?: number;
192
+ /**
193
+ * Expected `iss` claim. Defaults to {@link ALTER_PLATFORM_ISS}
194
+ * (`"did:alter:platform"`). Pass an explicit value only when verifying
195
+ * tokens minted by a non-platform issuer (e.g. a test fixture or a
196
+ * whitelabelled deployment). An empty string disables the check — not
197
+ * recommended for production use.
198
+ */
199
+ expectedIss?: string;
200
+ /**
201
+ * Expected `aud` claim. When provided and non-empty, the token's `aud`
202
+ * claim must contain this value (RFC 7519 §4.1.3). Pass an empty string
203
+ * to disable the check. Defaults to no check (undefined) for backward
204
+ * compatibility — callers SHOULD supply this in production environments.
205
+ */
206
+ expectedAud?: string;
191
207
  }
192
208
  /**
193
209
  * Verify a provenance JWS token against ALTER's published JWKS.
@@ -208,7 +224,15 @@ declare function verifyProvenance(envelope: ProvenanceEnvelope | string, opts?:
208
224
  *
209
225
  * ALTER signs each tool's input schema at startup and exposes the
210
226
  * signatures via the MCP `tools/list` `_meta.signatures` map. This helper
211
- * checks that each tool's schema hash matches the signed value.
227
+ * checks that each tool's schema hash matches the signed value, AND
228
+ * cryptographically verifies the ES256 JWS signature carried in
229
+ * `sig.signature` / `sig.kid` against the JWKS published at `jwksUrl`.
230
+ *
231
+ * H-9 remediation: previously only the schema hash was verified; the
232
+ * `sig.signature` and `sig.kid` fields were carried but never checked,
233
+ * allowing a hostile MCP server to substitute a fake tool schema whose
234
+ * hash matched a maliciously crafted `schema_hash` without needing the
235
+ * signing key.
212
236
  */
213
237
  interface SignedToolDefinition {
214
238
  name: string;
@@ -222,10 +246,22 @@ interface ToolSignatureMap {
222
246
  kid?: string | null;
223
247
  };
224
248
  }
225
- declare function verifyToolSignatures(tools: SignedToolDefinition[], signatures: ToolSignatureMap): Promise<{
249
+ interface VerifyToolSignaturesOptions {
250
+ /**
251
+ * JWKS URL to verify ES256 signatures against. Must be https.
252
+ * Defaults to `https://api.truealter.com/.well-known/alter-keys.json`.
253
+ * When a tool's `signature` field is null/absent, the tool is marked
254
+ * valid-on-hash (legacy path) and a `warn_no_signature: true` flag is
255
+ * included in the result.
256
+ */
257
+ jwksUrl?: string;
258
+ fetch?: typeof fetch;
259
+ }
260
+ declare function verifyToolSignatures(tools: SignedToolDefinition[], signatures: ToolSignatureMap, opts?: VerifyToolSignaturesOptions): Promise<{
226
261
  tool: string;
227
262
  valid: boolean;
228
263
  reason?: string;
264
+ warn_no_signature?: boolean;
229
265
  }[]>;
230
266
  /**
231
267
  * Fetch the ALTER public key set. Cached in-process for five minutes.
@@ -361,12 +397,21 @@ interface X402ClientOptions {
361
397
  networks?: string[];
362
398
  /** Permitted assets. Defaults to `['USDC']`. */
363
399
  assets?: string[];
400
+ /**
401
+ * Known recipient addresses. Defaults to {@link DEFAULT_RECIPIENT_ALLOWLIST}.
402
+ * Passing a list here *replaces* the default — include the ALTER canonical
403
+ * address if you still want it accepted.
404
+ *
405
+ * An empty array disables the check entirely (not recommended for production).
406
+ */
407
+ recipientAllowlist?: string[];
364
408
  }
365
409
  declare class X402Client {
366
410
  private readonly signer?;
367
411
  private readonly maxPerQuery?;
368
412
  private readonly networks;
369
413
  private readonly assets;
414
+ private readonly recipientAllowlist;
370
415
  constructor(opts?: X402ClientOptions);
371
416
  /**
372
417
  * Validate the envelope against this client's policy and, if a signer
@@ -407,7 +452,7 @@ interface MCPClientOptions {
407
452
  /** Optional x402 client for automatic premium tool payment. */
408
453
  x402?: X402Client;
409
454
  /**
410
- * Q5c per-invocation signing. When present, every `tools/call` is
455
+ * ES256 per-invocation signing. When present, every `tools/call` is
411
456
  * ES256-signed and submitted with the `Mcp-Invocation-Signature`
412
457
  * header. The public half of `privateKey` MUST have been
413
458
  * registered via `POST /api/v1/agents/keys` against the same API
@@ -416,6 +461,16 @@ interface MCPClientOptions {
416
461
  * 2026-04-20).
417
462
  */
418
463
  signing?: MCPSigningOptions;
464
+ /**
465
+ * Extra HTTP headers added to every request. Useful when the endpoint
466
+ * sits behind an edge gate that requires its own credentials —
467
+ * e.g. Cloudflare Access service tokens (`CF-Access-Client-Id` +
468
+ * `CF-Access-Client-Secret`). Protocol-level headers (`Content-Type`,
469
+ * `Accept`) and ALTER-internal headers (`X-ALTER-API-Key`,
470
+ * `Mcp-Session-Id`, `Mcp-Invocation-Signature`) always win over
471
+ * collisions here.
472
+ */
473
+ extraHeaders?: Record<string, string>;
419
474
  }
420
475
  interface MCPSigningOptions {
421
476
  /** The signing-key id pre-registered with the server. */
@@ -473,6 +528,7 @@ declare class MCPClient {
473
528
  private readonly clientInfo;
474
529
  private readonly x402?;
475
530
  private readonly signing?;
531
+ private readonly extraHeaders?;
476
532
  private requestCounter;
477
533
  private initialised;
478
534
  constructor(opts?: MCPClientOptions);
@@ -605,7 +661,7 @@ interface ListArchetypesOutput {
605
661
  }
606
662
  /** (free) verify_identity — Verify a person is registered with ALTER and validate optional claims */
607
663
  interface VerifyIdentityInput {
608
- candidate_id: string;
664
+ member_id: string;
609
665
  email?: string;
610
666
  claims?: {
611
667
  archetype?: string;
@@ -620,7 +676,7 @@ interface VerifyIdentityInput {
620
676
  interface VerifyIdentityOutput {
621
677
  ok: boolean;
622
678
  verified: boolean;
623
- candidate_id?: string;
679
+ member_id?: string;
624
680
  engagement_level?: EngagementLevel;
625
681
  archetype?: Archetype;
626
682
  claims_valid?: boolean;
@@ -640,7 +696,7 @@ interface InitiateAssessmentOutput {
640
696
  }
641
697
  /** (free) get_engagement_level — Get a person's identity depth and available query tiers */
642
698
  interface GetEngagementLevelInput {
643
- candidate_id: string;
699
+ member_id: string;
644
700
  }
645
701
  /** (free) get_engagement_level — output */
646
702
  interface GetEngagementLevelOutput {
@@ -657,12 +713,12 @@ interface GetEngagementLevelOutput {
657
713
  }
658
714
  /** (free) get_profile — Get a person's profile summary */
659
715
  interface GetProfileInput {
660
- candidate_id: string;
716
+ member_id: string;
661
717
  }
662
718
  /** (free) get_profile — output */
663
719
  interface GetProfileOutput {
664
720
  ok: boolean;
665
- candidate_id: string;
721
+ member_id: string;
666
722
  assessment_phase?: string;
667
723
  archetype?: Archetype;
668
724
  engagement_level?: EngagementLevel;
@@ -670,7 +726,7 @@ interface GetProfileOutput {
670
726
  }
671
727
  /** (free) query_matches — Query matches for a person (tier labels only) */
672
728
  interface QueryMatchesInput {
673
- candidate_id: string;
729
+ member_id: string;
674
730
  quality_filter?: MatchTier;
675
731
  limit?: number;
676
732
  }
@@ -687,7 +743,7 @@ interface QueryMatchesOutput {
687
743
  }
688
744
  /** (free) get_competencies — Get a person's competency portfolio */
689
745
  interface GetCompetenciesInput {
690
- candidate_id: string;
746
+ member_id: string;
691
747
  }
692
748
  /** (free) get_competencies — output */
693
749
  interface GetCompetenciesOutput {
@@ -714,7 +770,7 @@ interface SearchIdentitiesInput {
714
770
  interface SearchIdentitiesOutput {
715
771
  ok: boolean;
716
772
  identities: Array<{
717
- candidate_id: string;
773
+ member_id: string;
718
774
  trait_summary: Record<string, number>;
719
775
  engagement_level?: EngagementLevel;
720
776
  }>;
@@ -722,7 +778,7 @@ interface SearchIdentitiesOutput {
722
778
  }
723
779
  /** (free) get_identity_earnings — Get accrued Identity Income earnings for a person */
724
780
  interface GetIdentityEarningsInput {
725
- candidate_id: string;
781
+ member_id: string;
726
782
  }
727
783
  /** (free) get_identity_earnings — output */
728
784
  interface GetIdentityEarningsOutput {
@@ -730,7 +786,7 @@ interface GetIdentityEarningsOutput {
730
786
  total_earned_usd: number;
731
787
  pending_usd: number;
732
788
  transaction_count: number;
733
- unique_employers: number;
789
+ unique_orgs: number;
734
790
  }
735
791
  /** (free) get_network_stats — Get aggregate ALTER network statistics */
736
792
  interface GetNetworkStatsInput {
@@ -756,7 +812,7 @@ interface RecommendToolOutput {
756
812
  }
757
813
  /** (free) get_identity_trust_score — Get the trust score for an identity based on query diversity */
758
814
  interface GetIdentityTrustScoreInput {
759
- candidate_id: string;
815
+ member_id: string;
760
816
  }
761
817
  /** (free) get_identity_trust_score — output */
762
818
  interface GetIdentityTrustScoreOutput {
@@ -779,7 +835,7 @@ interface CheckAssessmentStatusOutput {
779
835
  }
780
836
  /** (free) get_earning_summary — Get an aggregated x402 earning summary for a person */
781
837
  interface GetEarningSummaryInput {
782
- candidate_id: string;
838
+ member_id: string;
783
839
  }
784
840
  /** (free) get_earning_summary — output */
785
841
  interface GetEarningSummaryOutput {
@@ -819,7 +875,7 @@ interface GetAgentPortfolioOutput {
819
875
  }
820
876
  /** (free) get_privacy_budget — Check privacy budget status for a person (24h rolling window) */
821
877
  interface GetPrivacyBudgetInput {
822
- candidate_id: string;
878
+ member_id: string;
823
879
  }
824
880
  /** (free) get_privacy_budget — output */
825
881
  interface GetPrivacyBudgetOutput {
@@ -922,13 +978,13 @@ interface AssessTraitsOutput {
922
978
  }
923
979
  /** (premium L1) get_trait_snapshot — Get the top 5 traits for a person ($0.005) */
924
980
  interface GetTraitSnapshotInput {
925
- candidate_id: string;
981
+ member_id: string;
926
982
  _payment?: ProvenanceToken;
927
983
  }
928
984
  /** (premium L1) get_trait_snapshot — output */
929
985
  interface GetTraitSnapshotOutput {
930
986
  ok: boolean;
931
- candidate_id: string;
987
+ member_id: string;
932
988
  archetype: Archetype;
933
989
  top_traits: Array<{
934
990
  name: string;
@@ -938,13 +994,13 @@ interface GetTraitSnapshotOutput {
938
994
  }
939
995
  /** (premium L2) get_full_trait_vector — Get the complete trait vector (all 33 traits: 29 continuous + 4 categorical) ($0.01) */
940
996
  interface GetFullTraitVectorInput {
941
- candidate_id: string;
997
+ member_id: string;
942
998
  _payment?: ProvenanceToken;
943
999
  }
944
1000
  /** (premium L2) get_full_trait_vector — output */
945
1001
  interface GetFullTraitVectorOutput {
946
1002
  ok: boolean;
947
- candidate_id: string;
1003
+ member_id: string;
948
1004
  traits: Array<{
949
1005
  name: string;
950
1006
  category: string;
@@ -954,7 +1010,7 @@ interface GetFullTraitVectorOutput {
954
1010
  }
955
1011
  /** (premium L4) compute_belonging — Compute belonging probability for a person-job pairing ($0.05) */
956
1012
  interface ComputeBelongingInput {
957
- candidate_id: string;
1013
+ member_id: string;
958
1014
  job_id: string;
959
1015
  _payment?: ProvenanceToken;
960
1016
  }
@@ -971,7 +1027,7 @@ interface ComputeBelongingOutput {
971
1027
  }
972
1028
  /** (premium L5) get_match_recommendations — Get top N match recommendations for a person ($0.50) */
973
1029
  interface GetMatchRecommendationsInput {
974
- candidate_id: string;
1030
+ member_id: string;
975
1031
  limit?: number;
976
1032
  _payment?: ProvenanceToken;
977
1033
  }
@@ -1004,7 +1060,7 @@ interface GenerateMatchNarrativeOutput {
1004
1060
  }
1005
1061
  /** (premium L2) get_side_quest_graph — Get a person's Side Quest Graph (DP noise ε=1.0) ($0.01) */
1006
1062
  interface GetSideQuestGraphInput {
1007
- candidate_id: string;
1063
+ member_id: string;
1008
1064
  include_edges?: boolean;
1009
1065
  min_confidence?: number;
1010
1066
  _payment?: ProvenanceToken;
@@ -1012,7 +1068,7 @@ interface GetSideQuestGraphInput {
1012
1068
  /** (premium L2) get_side_quest_graph — output */
1013
1069
  interface GetSideQuestGraphOutput {
1014
1070
  ok: boolean;
1015
- candidate_id: string;
1071
+ member_id: string;
1016
1072
  domains: Array<{
1017
1073
  label: string;
1018
1074
  confidence: number;
@@ -1027,15 +1083,15 @@ interface GetSideQuestGraphOutput {
1027
1083
  }
1028
1084
  /** (premium L3) query_graph_similarity — Compare two Side Quest Graphs (DP noise ε=0.5) ($0.025) */
1029
1085
  interface QueryGraphSimilarityInput {
1030
- candidate_a_id: string;
1031
- candidate_b_id: string;
1086
+ member_a_id: string;
1087
+ member_b_id: string;
1032
1088
  _payment?: ProvenanceToken;
1033
1089
  }
1034
1090
  /** (premium L3) query_graph_similarity — output */
1035
1091
  interface QueryGraphSimilarityOutput {
1036
1092
  ok: boolean;
1037
- candidate_a_id: string;
1038
- candidate_b_id: string;
1093
+ member_a_id: string;
1094
+ member_b_id: string;
1039
1095
  domain_overlap: number;
1040
1096
  edge_similarity: number;
1041
1097
  complementarity: number;
@@ -1359,7 +1415,7 @@ interface SignInvocationOptions {
1359
1415
  * Usage:
1360
1416
  *
1361
1417
  * ```ts
1362
- * const header = signInvocation("get_profile", { candidate_id: "abc" }, {
1418
+ * const header = signInvocation("get_profile", { member_id: "abc" }, {
1363
1419
  * kid, privateKey, handle: "~tester",
1364
1420
  * });
1365
1421
  * fetch(url, { headers: { "Mcp-Invocation-Signature": header } });
@@ -1576,11 +1632,17 @@ declare function sha256(bytes: string | Buffer): string;
1576
1632
  * deterministic ordering is worth the tiny blocking cost.
1577
1633
  */
1578
1634
 
1635
+ interface CfAccessCredentials {
1636
+ clientId: string;
1637
+ clientSecret: string;
1638
+ }
1579
1639
  interface WireOptions {
1580
1640
  /** Override the endpoint written into every client config. Defaults to DEFAULT_ENDPOINT. */
1581
1641
  endpoint?: string;
1582
1642
  /** Optional API key written into `headers['X-ALTER-API-Key']` for each target. */
1583
1643
  apiKey?: string;
1644
+ /** CF Access service token credentials. Auto-read from ~/.config/alter/cf-access.env when absent. */
1645
+ cfAccess?: CfAccessCredentials;
1584
1646
  /** Restrict to a subset of client ids. Default: every detected client. */
1585
1647
  only?: readonly ClientId[];
1586
1648
  /** Skip any client whose probe said "not installed" even if the caller passed it via `only`. */
@@ -1601,6 +1663,345 @@ interface UnwireReport {
1601
1663
  }
1602
1664
  declare function unwire(): UnwireReport;
1603
1665
 
1666
+ /**
1667
+ * @truealter/sdk — alter_homepage MCP tool types
1668
+ *
1669
+ * Wire-format types for the user-authored, externally-queryable identity
1670
+ * homepage surface.
1671
+ *
1672
+ * Tool name note: the wire-format and server-side tool name are
1673
+ * `alter_homepage`. The name `alter_portfolio` is reserved by the
1674
+ * verified-attestations tool in `mcp-alter` (a different concept), so
1675
+ * homepage types ship under `homepage`.
1676
+ *
1677
+ * Wire-format rule: every field name matches the JSON Schema property
1678
+ * name exactly (snake_case). These are passed straight into JSON-RPC
1679
+ * `arguments` and rendered straight from JSON-RPC `result`.
1680
+ */
1681
+ /**
1682
+ * Provenance class for a HomepageManifest field. Determines how a
1683
+ * conforming MCP consumer renders the value:
1684
+ *
1685
+ * - `declared`: user wrote the literal value. Render verbatim.
1686
+ * - `derived`: computed from active + consented signals. Render with
1687
+ * provenance class surfaced to the viewer (e.g. an italic gloss).
1688
+ * - `attested`: verified by a recognised entity (Org Alter, ceremony,
1689
+ * external attester). Render with provenance + attester surfaced.
1690
+ */
1691
+ type HomepageFieldProvenance = "declared" | "derived" | "attested";
1692
+ /**
1693
+ * One field of a HomepageManifest. Every field carries its provenance
1694
+ * class so MCP consumers can render appropriately. The `value` shape is
1695
+ * field-specific — this is a discriminated parent; consumers should
1696
+ * narrow on the manifest's field name, not on `value`'s runtime shape.
1697
+ */
1698
+ interface HomepageField<T = unknown> {
1699
+ /** The user-facing value. Type depends on which field this is. */
1700
+ value: T;
1701
+ /** Where this value comes from. */
1702
+ provenance: HomepageFieldProvenance;
1703
+ /**
1704
+ * For `attested` fields, the entity that attested. Optional on the
1705
+ * other provenance classes (where it would be redundant).
1706
+ */
1707
+ attester?: string;
1708
+ }
1709
+ /**
1710
+ * The wire-format manifest returned by `alter_homepage(handle)`.
1711
+ *
1712
+ * Fields are individually optional — a HomepageManifest with only a
1713
+ * handle and an opener is valid. MCP consumers MUST NOT assume any
1714
+ * field other than `handle` is present.
1715
+ */
1716
+ interface HomepageManifest {
1717
+ /** The ~handle being queried. Always present. */
1718
+ handle: string;
1719
+ /**
1720
+ * Single-line user-authored self-description. Maximum 240 chars
1721
+ * after NFC normalisation, after the install-time ANSI sanitiser
1722
+ * pass. Always declared-provenance.
1723
+ */
1724
+ whoami?: HomepageField<string>;
1725
+ /**
1726
+ * Rotating or static user-authored line. Maximum 280 chars after
1727
+ * NFC normalisation, after the install-time ANSI sanitiser pass.
1728
+ * The literal `~` substitutes the active handle at render time.
1729
+ * Always declared-provenance.
1730
+ */
1731
+ opener?: HomepageField<string>;
1732
+ /**
1733
+ * Composed-glyph string (from typed primitives). The
1734
+ * sigil is a string of renderer-recognised primitive references —
1735
+ * not raw glyph codes — so different consumers can render the same
1736
+ * sigil distinctly. Provenance is `declared` for user-composed,
1737
+ * `derived` for sigil-from-thread-graph crystallisation.
1738
+ */
1739
+ sigil?: HomepageField<string>;
1740
+ /** User's pronouns (already-shipped surface). Always declared. */
1741
+ pronouns?: HomepageField<string>;
1742
+ /**
1743
+ * List of recognised Seat glyphs the holder is bound to. Provenance
1744
+ * is always `attested` (ceremony-attested, server-side resolved);
1745
+ * `attester` will be `~alter` for protocol-observed Seats.
1746
+ */
1747
+ seats?: HomepageField<readonly string[]>;
1748
+ /**
1749
+ * Glyph from the user's attunement-grade library. Provenance is
1750
+ * `derived` (from the user's identity vector); the underlying
1751
+ * computation is L3-local and the chosen glyph is declared-from-
1752
+ * derived-measure (user picks within a library gated by their
1753
+ * attunement grade).
1754
+ */
1755
+ attunement_glyph?: HomepageField<string>;
1756
+ /**
1757
+ * Optional, opt-in per query context. Coarse Golden-Thread summary;
1758
+ * provenance is `derived`. MCP consumers MUST NOT request this field
1759
+ * by default — only on explicit per-call consent. Consumers in the
1760
+ * workplace/education vertical MUST NOT request this field at all
1761
+ * (clause-4 caller-context gate).
1762
+ */
1763
+ thread_strand?: HomepageField<string>;
1764
+ /**
1765
+ * TOML block of MCP-consumer rendering hints (order, density, etc).
1766
+ * Consumers are free to ignore. Provenance is always `declared`.
1767
+ */
1768
+ render_hints?: HomepageField<Record<string, unknown>>;
1769
+ }
1770
+ /**
1771
+ * Input arguments for the `alter_homepage` MCP tool.
1772
+ *
1773
+ * The `fields` argument lets a consumer request a subset; omitting it
1774
+ * returns all fields the caller is permitted to read under the consent
1775
+ * + caller-context gates.
1776
+ */
1777
+ interface HomepageInput {
1778
+ /** The ~handle to query. */
1779
+ handle: string;
1780
+ /**
1781
+ * Optional whitelist of field names. If omitted, the server returns
1782
+ * all fields the caller is permitted to read. Unknown field names
1783
+ * are silently ignored (forward-compatible — adding a new field does
1784
+ * not break old consumers).
1785
+ */
1786
+ fields?: readonly (keyof HomepageManifest)[];
1787
+ }
1788
+ /**
1789
+ * Output of the `alter_homepage` MCP tool. The `manifest` field is
1790
+ * always present on `ok: true`; on error, the `error` field carries a
1791
+ * structured reason the user can act on.
1792
+ */
1793
+ interface HomepageOutput {
1794
+ ok: boolean;
1795
+ manifest?: HomepageManifest;
1796
+ error?: {
1797
+ code: string;
1798
+ message: string;
1799
+ data?: Record<string, unknown>;
1800
+ };
1801
+ }
1802
+ /**
1803
+ * Caller-context gate: which categories of caller may read which
1804
+ * provenance classes. Enforced server-side; documented here for SDK
1805
+ * consumers building higher-level wrappers.
1806
+ *
1807
+ * - `workplace` / `education` callers MUST NOT receive `derived` or
1808
+ * `attested` provenance fields without explicit per-field consent
1809
+ * (EU AI Act Art 5(1)(d) categorical).
1810
+ * - All other callers may read `declared` and `attested` fields by
1811
+ * default; `derived` fields require stream-specific consent per
1812
+ * IaI clause 5.
1813
+ */
1814
+ type HomepageCallerVertical = "workplace" | "education" | "personal" | "civic" | "agent" | "unknown";
1815
+ /** Maximum sizes from the spec. SDK consumers can use these to validate
1816
+ * input before sending. Mirrored from
1817
+ * `docs/technical/alter-portfolio-manifest-v1.md` (forthcoming). */
1818
+ declare const HOMEPAGE_LIMITS: {
1819
+ readonly whoami_max_chars: 240;
1820
+ readonly opener_max_chars: 280;
1821
+ readonly pronouns_max_chars: 32;
1822
+ readonly attunement_glyph_max_chars: 16;
1823
+ };
1824
+
1825
+ /**
1826
+ * @truealter/sdk — theme pack types
1827
+ *
1828
+ * Wire-format types for ALTER theme packs and `themes.lock` composition
1829
+ * manifests. The full specification lives in
1830
+ * `docs/technical/alter-theme-pack-spec-v1.md`.
1831
+ *
1832
+ * These types describe the on-the-wire shape of theme manifests as they
1833
+ * are produced by `alter theme install`, persisted to `themes.lock`,
1834
+ * and shared via the `theme_share` MCP tool. They do NOT describe the
1835
+ * runtime renderer's internal state.
1836
+ *
1837
+ * No runtime side effects, no external imports, ESM-compatible.
1838
+ */
1839
+ /** The single allowed `palette.floor` value in v1. New floors require schema bump. */
1840
+ type PaletteFloorV1 = "muted-gold";
1841
+ /** Enumerated text-style values. Free strings are rejected by the loader. */
1842
+ type PaletteText = "default" | "high-contrast" | "warm";
1843
+ /** Enumerated status-line slot names. Packs MAY use a permutation of any subset. */
1844
+ type StatusLineSlot = "handle" | "attunement" | "seat" | "thread_strand" | "pronouns" | "org";
1845
+ /** Enumerated status-line density. */
1846
+ type StatusLineDensity = "compact" | "roomy";
1847
+ /** Enumerated greeting-register values. Passes to the Mirror voice register selector. */
1848
+ type GreetingRegister = "intimate" | "formal" | "playful" | "spare";
1849
+ /** Enumerated panel-density values for `alter room`. */
1850
+ type PanelDensity = "compact" | "roomy";
1851
+ /** `[meta]` section. */
1852
+ interface ThemeMeta {
1853
+ name: string;
1854
+ /** SemVer-shaped recommended; informational only. Resolution uses pack_id. */
1855
+ version: string;
1856
+ /** MUST be a ~handle whose D-ID8 public key signs the pack. */
1857
+ author: string;
1858
+ /** ≤ 240 characters after NFC. */
1859
+ description: string;
1860
+ /** OPTIONAL — surfaced by curated resolvers; not rendered by ALTER. */
1861
+ repo?: string;
1862
+ /** OPTIONAL — surfaced by curated resolvers; not rendered by ALTER. */
1863
+ docs_url?: string;
1864
+ }
1865
+ /** `[palette]` section. Renderer enforces gamut; out-of-gamut packs are rejected. */
1866
+ interface ThemePalette {
1867
+ floor: PaletteFloorV1;
1868
+ /** Hex colour clamped to the published accent-slot gamut. */
1869
+ accent: string;
1870
+ text: PaletteText;
1871
+ }
1872
+ /** `[opener]` section. */
1873
+ interface ThemeOpener {
1874
+ /** ≤ 32 entries, each ≤ 240 chars after sanitisation. `~` substitutes the active handle. */
1875
+ library: readonly string[];
1876
+ }
1877
+ /** `[sigil]` section. All values MUST refer to renderer-shipped typed primitives. */
1878
+ interface ThemeSigil {
1879
+ glyph_set: string;
1880
+ trill: string;
1881
+ accent_glyph: string;
1882
+ }
1883
+ /** `[status_line]` section. */
1884
+ interface ThemeStatusLine {
1885
+ /** Permutation of any subset of StatusLineSlot. */
1886
+ order: readonly StatusLineSlot[];
1887
+ density: StatusLineDensity;
1888
+ }
1889
+ /** `[render_hints]` section. */
1890
+ interface ThemeRenderHints {
1891
+ greeting_register: GreetingRegister;
1892
+ panel_density: PanelDensity;
1893
+ }
1894
+ /** `[assets]` section. Paths MUST be repo-relative without `..` segments. */
1895
+ interface ThemeAssets {
1896
+ /** Optional — if omitted, no assets are loaded. */
1897
+ glyphs?: readonly string[];
1898
+ }
1899
+ /**
1900
+ * Complete pack manifest (the parsed-TOML shape of `theme.toml` v1).
1901
+ *
1902
+ * Closed-world: any unknown top-level key MUST cause the loader to
1903
+ * reject the pack. Parsers consuming an arbitrary TOML file should
1904
+ * narrow against this type rather than infer.
1905
+ */
1906
+ interface ThemeManifestV1 {
1907
+ schema_version: 1;
1908
+ meta: ThemeMeta;
1909
+ palette: ThemePalette;
1910
+ opener?: ThemeOpener;
1911
+ sigil?: ThemeSigil;
1912
+ status_line?: ThemeStatusLine;
1913
+ render_hints?: ThemeRenderHints;
1914
+ assets?: ThemeAssets;
1915
+ }
1916
+ /**
1917
+ * The `.sig` file accompanying every pack. Verification logic lives in
1918
+ * `alter-cli/src/theme/sign.ts`; this is the wire-format type only.
1919
+ */
1920
+ interface ThemeSignatureManifest {
1921
+ /** SHA-256 multihash of the canonical-form pack. */
1922
+ pack_id: string;
1923
+ /** ~handle of the signer; MUST equal manifest.meta.author. */
1924
+ signer: string;
1925
+ /** RFC 3339 UTC timestamp at signing time. */
1926
+ signed_at: string;
1927
+ /** `ed25519:<base64url-encoded-signature>`. */
1928
+ sig: string;
1929
+ }
1930
+ /** One pack entry in the user-side composition lockfile. */
1931
+ interface ThemeLockEntry {
1932
+ /**
1933
+ * Where the pack was resolved from. One of:
1934
+ * - `git+<url>#<ref>` git-URL pin
1935
+ * - `@<author>/<name>` curated-resolver tuple
1936
+ * - `path:<rel-path>` local-path pin (for development)
1937
+ */
1938
+ source: string;
1939
+ pack_id: string;
1940
+ signer: string;
1941
+ /** Higher wins on slot conflict; equal priority breaks lex by pack_id. */
1942
+ priority: number;
1943
+ }
1944
+ /**
1945
+ * The user-side composition manifest. This is the publishable artefact
1946
+ * — what someone shares when they say "here is my ALTER".
1947
+ *
1948
+ * Re-applying the same lockfile against the same renderer version MUST
1949
+ * produce a bit-identical render, modulo the `attunement_glyph` field
1950
+ * which is derived per-render from the user's identity vector.
1951
+ */
1952
+ interface ThemesLockV1 {
1953
+ schema_version: 1;
1954
+ /** e.g. "alter-cli/0.5.0" — informational, not load-bearing. */
1955
+ generated_by: string;
1956
+ /** RFC 3339 UTC timestamp at lockfile-write time. */
1957
+ generated_at: string;
1958
+ pack: readonly ThemeLockEntry[];
1959
+ /**
1960
+ * User-side per-slot overrides applied AFTER pack composition. Keys
1961
+ * are dotted slot names (e.g. `palette.accent`, `sigil.trill`).
1962
+ * Values must match the slot's enumerated set or gamut.
1963
+ */
1964
+ overrides?: Readonly<Record<string, string | number | boolean>>;
1965
+ }
1966
+ /**
1967
+ * Input arguments for the `theme_share` MCP tool. Sharing emits a 5:1
1968
+ * return event to the sharer (recognition credit + pack citation) and
1969
+ * to the recipient (discovery signal). Implementation lives in
1970
+ * `mcp-alter`.
1971
+ */
1972
+ interface ThemeShareInput {
1973
+ /** Recipient ~handle. */
1974
+ to: string;
1975
+ /** Pack source the recipient should resolve. Same shape as ThemeLockEntry.source. */
1976
+ source: string;
1977
+ /** Expected pack_id for verification. Sharer asserts they have verified this. */
1978
+ pack_id: string;
1979
+ /** Expected signer ~handle. Sharer asserts the signature checks against this signer. */
1980
+ signer: string;
1981
+ /** Optional one-line note shown to the recipient on receipt. ≤ 280 chars. */
1982
+ note?: string;
1983
+ }
1984
+ /** Output of the `theme_share` MCP tool. */
1985
+ interface ThemeShareOutput {
1986
+ ok: boolean;
1987
+ share_id?: string;
1988
+ error?: {
1989
+ code: string;
1990
+ message: string;
1991
+ };
1992
+ }
1993
+ /** v1 schema constants. Mirror the spec at docs/technical/alter-theme-pack-spec-v1.md. */
1994
+ declare const THEME_LIMITS: {
1995
+ readonly meta_name_pattern: RegExp;
1996
+ readonly meta_description_max_chars: 240;
1997
+ readonly opener_library_max_entries: 32;
1998
+ readonly opener_entry_max_chars: 240;
1999
+ readonly share_note_max_chars: 280;
2000
+ };
2001
+ /** Allowed OSC-8 hyperlink schemes. Mirrors §6.2 of the spec. */
2002
+ declare const OSC8_ALLOWED_SCHEMES: readonly ["https:", "mailto:"];
2003
+ type Osc8AllowedScheme = (typeof OSC8_ALLOWED_SCHEMES)[number];
2004
+
1604
2005
  /**
1605
2006
  * Package metadata — kept in a standalone module so deep imports from
1606
2007
  * `src/wire/` can reference version constants without creating a
@@ -1609,4 +2010,4 @@ declare function unwire(): UnwireReport;
1609
2010
  declare const SDK_NAME = "@truealter/sdk";
1610
2011
  declare const SDK_VERSION = "0.3.0";
1611
2012
 
1612
- export { ALL_CLIENTS, AlterAuthError, AlterClient, type AlterClientOptions, AlterDiscoveryError, AlterError, type AlterErrorCode, AlterInvalidResponse, AlterNetworkError, AlterPaymentRequired, AlterProvenanceError, AlterRateLimited, type AlterResolveHandleInput, type AlterResolveHandleOutput, AlterTimeoutError, AlterToolError, type ApiKeyConfig, type Archetype, type AssessTraitsInput, type AssessTraitsOutput, type BeginGoldenThreadInput, type BeginGoldenThreadOutput, CLAUDE_CODE, CLAUDE_DESKTOP, CURSOR, type CheckAssessmentStatusInput, type CheckAssessmentStatusOutput, type CheckGoldenThreadInput, type CheckGoldenThreadOutput, type ClaudeDesktopConfig, type ClaudeDesktopServerConfig, type ClientId, type ClientPaths, type CompleteKnotInput, type CompleteKnotOutput, type ComputeBelongingInput, type ComputeBelongingOutput, DEFAULT_DOMAIN, DEFAULT_ENDPOINT, DEFAULT_VERIFY_AT_ALLOWLIST, type DiscoveryOptions, type DiscoveryResult, type Ed25519Keypair, type EngagementLevel, FREE_TOOL_NAMES, type GenerateClaudeDesktopOptions, type GenerateMatchNarrativeInput, type GenerateMatchNarrativeOutput, type GetAgentPortfolioInput, type GetAgentPortfolioOutput, type GetAgentTrustTierInput, type GetAgentTrustTierOutput, type GetCompetenciesInput, type GetCompetenciesOutput, type GetEarningSummaryInput, type GetEarningSummaryOutput, type GetEngagementLevelInput, type GetEngagementLevelOutput, type GetFullTraitVectorInput, type GetFullTraitVectorOutput, type GetIdentityEarningsInput, type GetIdentityEarningsOutput, type GetIdentityTrustScoreInput, type GetIdentityTrustScoreOutput, type GetMatchRecommendationsInput, type GetMatchRecommendationsOutput, type GetNetworkStatsInput, type GetNetworkStatsOutput, type GetPrivacyBudgetInput, type GetPrivacyBudgetOutput, type GetProfileInput, type GetProfileOutput, type GetSideQuestGraphInput, type GetSideQuestGraphOutput, type GetTraitSnapshotInput, type GetTraitSnapshotOutput, type GoldenThreadStatusInput, type GoldenThreadStatusOutput, type HelloAgentInput, type HelloAgentOutput, type InitiateAssessmentInput, type InitiateAssessmentOutput, type InvocationClaims, type JsonWebKey, type JwksDocument, type ListArchetypesInput, type ListArchetypesOutput, type MCPCallOptions, type MCPCallToolResult, MCPClient, type MCPClientInfo, type MCPClientOptions, type MCPContentBlock, type MCPListToolsResult, type MCPMeta, type MCPResponse, type MCPSigningOptions, type MCPToolDefinition, MCP_PROTOCOL_VERSION, type MatchTier, type McpServerConfig, PREMIUM_TOOL_NAMES, type PaymentEnvelope, type ProbeResult, type ProvenanceEnvelope, type ProvenancePayload, type ProvenanceToken, type ProvenanceVerification, type QueryGraphSimilarityInput, type QueryGraphSimilarityOutput, type QueryMatchesInput, type QueryMatchesOutput, type RecommendToolInput, type RecommendToolOutput, SDK_NAME, SDK_VERSION, type SearchIdentitiesInput, type SearchIdentitiesOutput, type SignInvocationOptions, type SignedToolDefinition, TOOL_BLAST_RADIUS, TOOL_COSTS, TOOL_TIERS, type ThreadCensusInput, type ThreadCensusOutput, type ToolInputs, type ToolName, type ToolOutputs, type ToolSignatureMap, type UnwireReport, VSCODE, type VerifyIdentityInput, type VerifyIdentityOutput, type VerifyProvenanceOptions, type WireOptions, type WireReport, type WireState, type WireTarget, type WireTargetCli, type WireTargetFile, X402Client, type X402ClientOptions, type X402Settlement, type X402Signer, base64urlDecode, base64urlEncode, canonicalArgsSha256, canonicalStringify, clearDiscoveryCache, decodeDid, detectSyncedVolume, discover, encodeDid, fetchPublicKeys, generateClaudeConfig, generateClaudeDesktopConfig, generateCursorConfig, generateGenericMcpConfig, generateKeypair, keypairFromPrivateKey, loadPrivateKey, parsePaymentHeader, probeAll, probeByDir, probeClaudeCode, readWireState, resolveVerifyAt, sha256, sign, signInvocation, unwire, verify, verifyProvenance, verifyToolSignatures, wire, writeWireState };
2013
+ export { ALL_CLIENTS, AlterAuthError, AlterClient, type AlterClientOptions, AlterDiscoveryError, AlterError, type AlterErrorCode, AlterInvalidResponse, AlterNetworkError, AlterPaymentRequired, AlterProvenanceError, AlterRateLimited, type AlterResolveHandleInput, type AlterResolveHandleOutput, AlterTimeoutError, AlterToolError, type ApiKeyConfig, type Archetype, type AssessTraitsInput, type AssessTraitsOutput, type BeginGoldenThreadInput, type BeginGoldenThreadOutput, CLAUDE_CODE, CLAUDE_DESKTOP, CURSOR, type CheckAssessmentStatusInput, type CheckAssessmentStatusOutput, type CheckGoldenThreadInput, type CheckGoldenThreadOutput, type ClaudeDesktopConfig, type ClaudeDesktopServerConfig, type ClientId, type ClientPaths, type CompleteKnotInput, type CompleteKnotOutput, type ComputeBelongingInput, type ComputeBelongingOutput, DEFAULT_DOMAIN, DEFAULT_ENDPOINT, DEFAULT_VERIFY_AT_ALLOWLIST, type DiscoveryOptions, type DiscoveryResult, type Ed25519Keypair, type EngagementLevel, FREE_TOOL_NAMES, type GenerateClaudeDesktopOptions, type GenerateMatchNarrativeInput, type GenerateMatchNarrativeOutput, type GetAgentPortfolioInput, type GetAgentPortfolioOutput, type GetAgentTrustTierInput, type GetAgentTrustTierOutput, type GetCompetenciesInput, type GetCompetenciesOutput, type GetEarningSummaryInput, type GetEarningSummaryOutput, type GetEngagementLevelInput, type GetEngagementLevelOutput, type GetFullTraitVectorInput, type GetFullTraitVectorOutput, type GetIdentityEarningsInput, type GetIdentityEarningsOutput, type GetIdentityTrustScoreInput, type GetIdentityTrustScoreOutput, type GetMatchRecommendationsInput, type GetMatchRecommendationsOutput, type GetNetworkStatsInput, type GetNetworkStatsOutput, type GetPrivacyBudgetInput, type GetPrivacyBudgetOutput, type GetProfileInput, type GetProfileOutput, type GetSideQuestGraphInput, type GetSideQuestGraphOutput, type GetTraitSnapshotInput, type GetTraitSnapshotOutput, type GoldenThreadStatusInput, type GoldenThreadStatusOutput, type GreetingRegister, HOMEPAGE_LIMITS, type HelloAgentInput, type HelloAgentOutput, type HomepageCallerVertical, type HomepageField, type HomepageFieldProvenance, type HomepageInput, type HomepageManifest, type HomepageOutput, type InitiateAssessmentInput, type InitiateAssessmentOutput, type InvocationClaims, type JsonWebKey, type JwksDocument, type ListArchetypesInput, type ListArchetypesOutput, type MCPCallOptions, type MCPCallToolResult, MCPClient, type MCPClientInfo, type MCPClientOptions, type MCPContentBlock, type MCPListToolsResult, type MCPMeta, type MCPResponse, type MCPSigningOptions, type MCPToolDefinition, MCP_PROTOCOL_VERSION, type MatchTier, type McpServerConfig, OSC8_ALLOWED_SCHEMES, type Osc8AllowedScheme, PREMIUM_TOOL_NAMES, type PaletteFloorV1, type PaletteText, type PanelDensity, type PaymentEnvelope, type ProbeResult, type ProvenanceEnvelope, type ProvenancePayload, type ProvenanceToken, type ProvenanceVerification, type QueryGraphSimilarityInput, type QueryGraphSimilarityOutput, type QueryMatchesInput, type QueryMatchesOutput, type RecommendToolInput, type RecommendToolOutput, SDK_NAME, SDK_VERSION, type SearchIdentitiesInput, type SearchIdentitiesOutput, type SignInvocationOptions, type SignedToolDefinition, type StatusLineDensity, type StatusLineSlot, THEME_LIMITS, TOOL_BLAST_RADIUS, TOOL_COSTS, TOOL_TIERS, type ThemeAssets, type ThemeLockEntry, type ThemeManifestV1, type ThemeMeta, type ThemeOpener, type ThemePalette, type ThemeRenderHints, type ThemeShareInput, type ThemeShareOutput, type ThemeSigil, type ThemeSignatureManifest, type ThemeStatusLine, type ThemesLockV1, type ThreadCensusInput, type ThreadCensusOutput, type ToolInputs, type ToolName, type ToolOutputs, type ToolSignatureMap, type UnwireReport, VSCODE, type VerifyIdentityInput, type VerifyIdentityOutput, type VerifyProvenanceOptions, type WireOptions, type WireReport, type WireState, type WireTarget, type WireTargetCli, type WireTargetFile, X402Client, type X402ClientOptions, type X402Settlement, type X402Signer, base64urlDecode, base64urlEncode, canonicalArgsSha256, canonicalStringify, clearDiscoveryCache, decodeDid, detectSyncedVolume, discover, encodeDid, fetchPublicKeys, generateClaudeConfig, generateClaudeDesktopConfig, generateCursorConfig, generateGenericMcpConfig, generateKeypair, keypairFromPrivateKey, loadPrivateKey, parsePaymentHeader, probeAll, probeByDir, probeClaudeCode, readWireState, resolveVerifyAt, sha256, sign, signInvocation, unwire, verify, verifyProvenance, verifyToolSignatures, wire, writeWireState };