@truealter/sdk 0.5.1 → 0.5.8

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.ts CHANGED
@@ -15,7 +15,7 @@
15
15
  interface DiscoveryResult {
16
16
  /** Resolved MCP endpoint URL. */
17
17
  url: string;
18
- /** MCP transport currently always `streamable-http`. */
18
+ /** MCP transport: currently always `streamable-http`. */
19
19
  transport: 'streamable-http';
20
20
  /** Source of the discovery hit, useful for diagnostics. */
21
21
  source: 'dns' | 'mcp.json' | 'alter.json' | 'override';
@@ -41,7 +41,7 @@ interface DiscoveryOptions {
41
41
  /**
42
42
  * Resolve the ALTER MCP endpoint for `domain`.
43
43
  *
44
- * Order: cache DNS TXT mcp.json alter.json. Throws
44
+ * Order: cache -> DNS TXT -> mcp.json -> alter.json. Throws
45
45
  * {@link AlterDiscoveryError} if every step fails.
46
46
  */
47
47
  declare function discover(domain: string, opts?: DiscoveryOptions): Promise<DiscoveryResult>;
@@ -51,7 +51,7 @@ declare function clearDiscoveryCache(): void;
51
51
  /**
52
52
  * Ed25519 keypair management for ALTER Identity.
53
53
  *
54
- * Uses @noble/ed25519 pure JavaScript, no native addons, runs in
54
+ * Uses @noble/ed25519: pure JavaScript, no native addons, runs in
55
55
  * Node 18+, Deno, Bun, Cloudflare Workers and the browser.
56
56
  *
57
57
  * Keys are stored as hex strings for portability. The CLI persists them
@@ -113,7 +113,7 @@ declare function base64urlDecode(input: string): Uint8Array;
113
113
  * periodically and is published at `<api-host>/.well-known/alter-keys.json`
114
114
  * as a JWKS.
115
115
  *
116
- * This module verifies tokens *without* a JWT library pure WebCrypto
116
+ * This module verifies tokens *without* a JWT library: pure WebCrypto
117
117
  * (subtle.verify) keeps the dep graph small and works in every modern
118
118
  * runtime (Node 18+, Deno, Bun, Cloudflare Workers, browser).
119
119
  */
@@ -164,7 +164,7 @@ interface JwksDocument {
164
164
  *
165
165
  * Without this allowlist, a hostile MCP server could point `verify_at`
166
166
  * at an attacker-controlled JWKS and pass ES256 verification with its own
167
- * signing key the classic "confused-deputy via server-supplied trust
167
+ * signing key: the classic "confused-deputy via server-supplied trust
168
168
  * anchor" pattern. Any hostname not on this list (or the caller-supplied
169
169
  * extension) is rejected before a network fetch is issued. Downstream
170
170
  * integrators with their own deployment can extend the list via the
@@ -175,7 +175,7 @@ declare const DEFAULT_VERIFY_AT_ALLOWLIST: readonly string[];
175
175
  interface VerifyProvenanceOptions {
176
176
  /**
177
177
  * Override the JWKS URL entirely. Takes precedence over both the
178
- * allowlist and any `verify_at` on the envelope if the caller pins
178
+ * allowlist and any `verify_at` on the envelope: if the caller pins
179
179
  * an explicit URL, we use it verbatim (the caller has already vouched
180
180
  * for the origin).
181
181
  */
@@ -183,7 +183,7 @@ interface VerifyProvenanceOptions {
183
183
  /**
184
184
  * Hostnames that are trusted when resolving `envelope.verify_at`.
185
185
  * Defaults to {@link DEFAULT_VERIFY_AT_ALLOWLIST}. Passing a list
186
- * here *replaces* the default include the ALTER canonicals if you
186
+ * here *replaces* the default: include the ALTER canonicals if you
187
187
  * still want them accepted.
188
188
  */
189
189
  verifyAtAllowlist?: readonly string[];
@@ -193,7 +193,7 @@ interface VerifyProvenanceOptions {
193
193
  * Expected `iss` claim. Defaults to {@link ALTER_PLATFORM_ISS}
194
194
  * (`"did:alter:platform"`). Pass an explicit value only when verifying
195
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
196
+ * whitelabelled deployment). An empty string disables the check: not
197
197
  * recommended for production use.
198
198
  */
199
199
  expectedIss?: string;
@@ -201,7 +201,7 @@ interface VerifyProvenanceOptions {
201
201
  * Expected `aud` claim. When provided and non-empty, the token's `aud`
202
202
  * claim must contain this value (RFC 7519 §4.1.3). Pass an empty string
203
203
  * to disable the check. Defaults to no check (undefined) for backward
204
- * compatibility callers SHOULD supply this in production environments.
204
+ * compatibility: callers SHOULD supply this in production environments.
205
205
  */
206
206
  expectedAud?: string;
207
207
  }
@@ -216,7 +216,7 @@ interface VerifyProvenanceOptions {
216
216
  * Security: when the envelope carries a `verify_at` hint, the hostname
217
217
  * MUST be on the allowlist (default: `api.truealter.com`,
218
218
  * `mcp.truealter.com`; extend via `verifyAtAllowlist`). `http:` URLs are
219
- * rejected unconditionally JWKS fetch must be TLS.
219
+ * rejected unconditionally: JWKS fetch must be TLS.
220
220
  */
221
221
  declare function verifyProvenance(envelope: ProvenanceEnvelope | string, opts?: VerifyProvenanceOptions): Promise<ProvenanceVerification>;
222
222
  /**
@@ -272,7 +272,7 @@ declare function fetchPublicKeys(jwksUrl: string, fetchImpl?: typeof fetch): Pro
272
272
  * JWKS URL, enforcing scheme + hostname allowlisting.
273
273
  *
274
274
  * - Relative paths (`/…` or `foo/bar`) resolve against `api.truealter.com`
275
- * over https the canonical ALTER JWKS host.
275
+ * over https: the canonical ALTER JWKS host.
276
276
  * - Absolute URLs must use `https:` (plaintext `http:` is rejected
277
277
  * unconditionally) and the hostname must be a case-insensitive exact
278
278
  * match against `allowlist`.
@@ -389,7 +389,7 @@ interface X402ClientOptions {
389
389
  signer?: X402Signer;
390
390
  /**
391
391
  * Maximum amount the client will spend per query, in the asset's display
392
- * unit (e.g. `"0.50"` for fifty cents USDC). Hard cap quotes above this
392
+ * unit (e.g. `"0.50"` for fifty cents USDC). Hard cap: quotes above this
393
393
  * are rejected even if a signer is configured.
394
394
  */
395
395
  maxPerQuery?: string;
@@ -399,7 +399,7 @@ interface X402ClientOptions {
399
399
  assets?: string[];
400
400
  /**
401
401
  * Known recipient addresses. Defaults to {@link DEFAULT_RECIPIENT_ALLOWLIST}.
402
- * Passing a list here *replaces* the default include the ALTER canonical
402
+ * Passing a list here *replaces* the default: include the ALTER canonical
403
403
  * address if you still want it accepted.
404
404
  *
405
405
  * An empty array disables the check entirely (not recommended for production).
@@ -427,7 +427,7 @@ declare class X402Client {
427
427
  }
428
428
  /**
429
429
  * Parse an `X-402-Payment` response header into a {@link PaymentEnvelope}.
430
- * The header value is JSON or a key=value list we handle both.
430
+ * The header value is JSON or a key=value list: we handle both.
431
431
  */
432
432
  declare function parsePaymentHeader(header: string): PaymentEnvelope | null;
433
433
 
@@ -437,7 +437,7 @@ interface MCPClientInfo {
437
437
  version: string;
438
438
  }
439
439
  interface MCPClientOptions {
440
- /** Streamable HTTP endpoint. Default: https://mcp.truealter.com */
440
+ /** Streamable HTTP endpoint. Default: https://mcp.truealter.com/api/v1/mcp (public discovery). Member bridge runtime sets api.truealter.com via env or explicit option. */
441
441
  endpoint?: string;
442
442
  /** Optional API key for the `X-ALTER-API-Key` header. */
443
443
  apiKey?: string;
@@ -463,7 +463,7 @@ interface MCPClientOptions {
463
463
  signing?: MCPSigningOptions;
464
464
  /**
465
465
  * Extra HTTP headers added to every request. Useful when the endpoint
466
- * sits behind an edge gate that requires its own credentials
466
+ * sits behind an edge gate that requires its own credentials:
467
467
  * e.g. Cloudflare Access service tokens (`CF-Access-Client-Id` +
468
468
  * `CF-Access-Client-Secret`). Protocol-level headers (`Content-Type`,
469
469
  * `Accept`) and ALTER-internal headers (`X-ALTER-API-Key`,
@@ -471,13 +471,22 @@ interface MCPClientOptions {
471
471
  * collisions here.
472
472
  */
473
473
  extraHeaders?: Record<string, string>;
474
+ /**
475
+ * Optional hook invoked once, lazily, before the first network call
476
+ * (the first `initialize()` or any direct `rpc()`). Used by
477
+ * {@link AlterClient} to run the version-floor preflight on
478
+ * first request: not on import, not in the constructor. A throw
479
+ * from the hook propagates to the caller of the first `tools/call`
480
+ * (or `initialize()`).
481
+ */
482
+ preflightHook?: () => Promise<void>;
474
483
  }
475
484
  interface MCPSigningOptions {
476
485
  /** The signing-key id pre-registered with the server. */
477
486
  kid: string;
478
487
  /** ES256 P-256 private key: 32-byte scalar or PEM. */
479
488
  privateKey: Uint8Array | string;
480
- /** The caller's bound ~handle. */
489
+ /** The caller's bound handle. */
481
490
  handle: string;
482
491
  }
483
492
  interface MCPCallOptions {
@@ -511,7 +520,7 @@ interface MCPContentBlock {
511
520
  interface MCPCallToolResult<T = unknown> {
512
521
  content: MCPContentBlock[];
513
522
  isError?: boolean;
514
- /** Parsed structured payload set when content[0].type === 'json' or text parses as JSON. */
523
+ /** Parsed structured payload: set when content[0].type === 'json' or text parses as JSON. */
515
524
  data?: T;
516
525
  _meta?: {
517
526
  provenance?: ProvenanceEnvelope;
@@ -529,12 +538,21 @@ declare class MCPClient {
529
538
  private readonly x402?;
530
539
  private readonly signing?;
531
540
  private readonly extraHeaders?;
541
+ private readonly preflightHook?;
542
+ private preflightPromise;
543
+ private preflightDone;
532
544
  private requestCounter;
533
545
  private initialised;
534
546
  constructor(opts?: MCPClientOptions);
547
+ /**
548
+ * Run the lazy version-floor preflight hook exactly once.
549
+ * Idempotent and serialised: concurrent callers share the same
550
+ * promise. Throws from the hook propagate to every concurrent caller.
551
+ */
552
+ private runPreflight;
535
553
  /**
536
554
  * Send the MCP `initialize` handshake and capture the resulting session
537
- * id. Idempotent safe to call multiple times.
555
+ * id. Idempotent: safe to call multiple times.
538
556
  */
539
557
  initialize(): Promise<unknown>;
540
558
  /** List available tools. */
@@ -563,14 +581,14 @@ declare class MCPClient {
563
581
  }
564
582
 
565
583
  /**
566
- * @truealter/sdk MCP tool type definitions
584
+ * @truealter/sdk: MCP tool type definitions
567
585
  *
568
- * Auto-derived from backend/app/mcp/server.py (FREE_TOOLS + PREMIUM_TOOLS)
569
- * and backend/app/mcp/x402_middleware.py (TOOL_TIERS, TOOL_PRICING,
570
- * TOOL_BLAST_RADIUS).
586
+ * Auto-derived from ALTER's live MCP tool registry and x402 pricing surface
587
+ * (the advertised free/premium tool sets, per-invocation tiers, pricing, and
588
+ * blast-radius classification).
571
589
  *
572
590
  * Wire-format rule: every interface property name matches the JSON Schema
573
- * property name exactly (snake_case). Do NOT rename to camelCase these
591
+ * property name exactly (snake_case). Do NOT rename to camelCase: these
574
592
  * objects are passed straight into JSON-RPC `arguments`.
575
593
  *
576
594
  * This file is fully self-contained: no external imports, ESM-compatible,
@@ -578,12 +596,12 @@ declare class MCPClient {
578
596
  */
579
597
  /** ALTER engagement levels (depth of identity binding) */
580
598
  type EngagementLevel = "L1" | "L2" | "L3" | "L4";
581
- /** Match quality tiers never numeric scores per ALTER policy */
599
+ /** Match quality tiers: never numeric scores per ALTER policy */
582
600
  type MatchTier = "exceptional" | "strong" | "moderate" | "developing";
583
601
  /** ALTER identity archetype label (one of 12, free-form for now) */
584
602
  type Archetype = string;
585
603
  /**
586
- * x402 payment proof object structure validated by the facilitator network.
604
+ * x402 payment proof object: structure validated by the facilitator network.
587
605
  * In dev mode any non-empty object is accepted.
588
606
  */
589
607
  interface ProvenanceToken {
@@ -617,10 +635,10 @@ interface MCPResponse<T> {
617
635
  };
618
636
  _meta?: MCPMeta;
619
637
  }
620
- /** (free) hello_agent First handshake: returns server version, auth status, trust tier, tool counts */
638
+ /** (free) hello_agent: First handshake: returns server version, auth status, trust tier, tool counts */
621
639
  interface HelloAgentInput {
622
640
  }
623
- /** (free) hello_agent output */
641
+ /** (free) hello_agent: output */
624
642
  interface HelloAgentOutput {
625
643
  ok: boolean;
626
644
  server?: string;
@@ -633,11 +651,11 @@ interface HelloAgentOutput {
633
651
  messaging?: number;
634
652
  };
635
653
  }
636
- /** (free) alter_resolve_handle Resolve a ~handle (e.g. ~drew) to canonical form and kind */
654
+ /** (free) alter_resolve_handle: Resolve a ~handle (e.g. ~example) to canonical form and kind */
637
655
  interface AlterResolveHandleInput {
638
656
  query: string;
639
657
  }
640
- /** (free) alter_resolve_handle output */
658
+ /** (free) alter_resolve_handle: output */
641
659
  interface AlterResolveHandleOutput {
642
660
  ok: boolean;
643
661
  handle: string | null;
@@ -647,10 +665,10 @@ interface AlterResolveHandleOutput {
647
665
  default_visibility?: string;
648
666
  query?: string;
649
667
  }
650
- /** (free) list_archetypes List all 12 ALTER identity archetypes */
668
+ /** (free) list_archetypes: List all 12 ALTER identity archetypes */
651
669
  interface ListArchetypesInput {
652
670
  }
653
- /** (free) list_archetypes output */
671
+ /** (free) list_archetypes: output */
654
672
  interface ListArchetypesOutput {
655
673
  ok: boolean;
656
674
  archetypes: Array<{
@@ -659,7 +677,7 @@ interface ListArchetypesOutput {
659
677
  protective_equation?: string;
660
678
  }>;
661
679
  }
662
- /** (free) verify_identity Verify a person is registered with ALTER and validate optional claims */
680
+ /** (free) verify_identity: Verify a person is registered with ALTER and validate optional claims */
663
681
  interface VerifyIdentityInput {
664
682
  member_id: string;
665
683
  email?: string;
@@ -672,7 +690,7 @@ interface VerifyIdentityInput {
672
690
  }>;
673
691
  };
674
692
  }
675
- /** (free) verify_identity output */
693
+ /** (free) verify_identity: output */
676
694
  interface VerifyIdentityOutput {
677
695
  ok: boolean;
678
696
  verified: boolean;
@@ -682,23 +700,23 @@ interface VerifyIdentityOutput {
682
700
  claims_valid?: boolean;
683
701
  claim_results?: Record<string, boolean>;
684
702
  }
685
- /** (free) initiate_assessment Get a URL where a person can complete their ALTER Discovery assessment */
703
+ /** (free) initiate_assessment: Get a URL where a person can complete their ALTER Discovery assessment */
686
704
  interface InitiateAssessmentInput {
687
705
  callback_url?: string;
688
706
  referrer?: string;
689
707
  }
690
- /** (free) initiate_assessment output */
708
+ /** (free) initiate_assessment: output */
691
709
  interface InitiateAssessmentOutput {
692
710
  ok: boolean;
693
711
  assessment_url: string;
694
712
  session_id?: string;
695
713
  expires_at?: string;
696
714
  }
697
- /** (free) get_engagement_level Get a person's identity depth and available query tiers */
715
+ /** (free) get_engagement_level: Get a person's identity depth and available query tiers */
698
716
  interface GetEngagementLevelInput {
699
717
  member_id: string;
700
718
  }
701
- /** (free) get_engagement_level output */
719
+ /** (free) get_engagement_level: output */
702
720
  interface GetEngagementLevelOutput {
703
721
  ok: boolean;
704
722
  engagement_level: EngagementLevel;
@@ -711,11 +729,11 @@ interface GetEngagementLevelOutput {
711
729
  consent_gated: string[];
712
730
  };
713
731
  }
714
- /** (free) get_profile Get a person's profile summary */
732
+ /** (free) get_profile: Get a person's profile summary */
715
733
  interface GetProfileInput {
716
734
  member_id: string;
717
735
  }
718
- /** (free) get_profile output */
736
+ /** (free) get_profile: output */
719
737
  interface GetProfileOutput {
720
738
  ok: boolean;
721
739
  member_id: string;
@@ -724,13 +742,13 @@ interface GetProfileOutput {
724
742
  engagement_level?: EngagementLevel;
725
743
  attributes?: Record<string, unknown>;
726
744
  }
727
- /** (free) query_matches Query matches for a person (tier labels only) */
745
+ /** (free) query_matches: Query matches for a person (tier labels only) */
728
746
  interface QueryMatchesInput {
729
747
  member_id: string;
730
748
  quality_filter?: MatchTier;
731
749
  limit?: number;
732
750
  }
733
- /** (free) query_matches output */
751
+ /** (free) query_matches: output */
734
752
  interface QueryMatchesOutput {
735
753
  ok: boolean;
736
754
  matches: Array<{
@@ -741,11 +759,11 @@ interface QueryMatchesOutput {
741
759
  }>;
742
760
  count: number;
743
761
  }
744
- /** (free) get_competencies Get a person's competency portfolio */
762
+ /** (free) get_competencies: Get a person's competency portfolio */
745
763
  interface GetCompetenciesInput {
746
764
  member_id: string;
747
765
  }
748
- /** (free) get_competencies output */
766
+ /** (free) get_competencies: output */
749
767
  interface GetCompetenciesOutput {
750
768
  ok: boolean;
751
769
  competencies: Array<{
@@ -758,7 +776,7 @@ interface GetCompetenciesOutput {
758
776
  awarded_at: string;
759
777
  }>;
760
778
  }
761
- /** (free) search_identities Search identity stubs and profiles by trait criteria (max 5 results, no PII) */
779
+ /** (free) search_identities: Search identity stubs and profiles by trait criteria (max 5 results, no PII) */
762
780
  interface SearchIdentitiesInput {
763
781
  trait_criteria: Record<string, {
764
782
  min?: number;
@@ -766,7 +784,7 @@ interface SearchIdentitiesInput {
766
784
  }>;
767
785
  limit?: number;
768
786
  }
769
- /** (free) search_identities output */
787
+ /** (free) search_identities: output */
770
788
  interface SearchIdentitiesOutput {
771
789
  ok: boolean;
772
790
  identities: Array<{
@@ -776,11 +794,11 @@ interface SearchIdentitiesOutput {
776
794
  }>;
777
795
  count: number;
778
796
  }
779
- /** (free) get_identity_earnings Get accrued Identity Income earnings for a person */
797
+ /** (free) get_identity_earnings: Get accrued Identity Income earnings for a person */
780
798
  interface GetIdentityEarningsInput {
781
799
  member_id: string;
782
800
  }
783
- /** (free) get_identity_earnings output */
801
+ /** (free) get_identity_earnings: output */
784
802
  interface GetIdentityEarningsOutput {
785
803
  ok: boolean;
786
804
  total_earned_usd: number;
@@ -788,10 +806,10 @@ interface GetIdentityEarningsOutput {
788
806
  transaction_count: number;
789
807
  unique_orgs: number;
790
808
  }
791
- /** (free) get_network_stats Get aggregate ALTER network statistics */
809
+ /** (free) get_network_stats: Get aggregate ALTER network statistics */
792
810
  interface GetNetworkStatsInput {
793
811
  }
794
- /** (free) get_network_stats output */
812
+ /** (free) get_network_stats: output */
795
813
  interface GetNetworkStatsOutput {
796
814
  ok: boolean;
797
815
  total_identities: number;
@@ -799,10 +817,10 @@ interface GetNetworkStatsOutput {
799
817
  query_volume: number;
800
818
  active_bots: number;
801
819
  }
802
- /** (free) recommend_tool Get ClawHub install instructions and ALTER pitch */
820
+ /** (free) recommend_tool: Get ClawHub install instructions and ALTER pitch */
803
821
  interface RecommendToolInput {
804
822
  }
805
- /** (free) recommend_tool output */
823
+ /** (free) recommend_tool: output */
806
824
  interface RecommendToolOutput {
807
825
  ok: boolean;
808
826
  mcp_endpoint: string;
@@ -810,22 +828,22 @@ interface RecommendToolOutput {
810
828
  free_tool_count: number;
811
829
  premium_tool_count: number;
812
830
  }
813
- /** (free) get_identity_trust_score Get the trust score for an identity based on query diversity */
831
+ /** (free) get_identity_trust_score: Get the trust score for an identity based on query diversity */
814
832
  interface GetIdentityTrustScoreInput {
815
833
  member_id: string;
816
834
  }
817
- /** (free) get_identity_trust_score output */
835
+ /** (free) get_identity_trust_score: output */
818
836
  interface GetIdentityTrustScoreOutput {
819
837
  ok: boolean;
820
838
  trust_score: number;
821
839
  unique_agents: number;
822
840
  total_queries: number;
823
841
  }
824
- /** (free) check_assessment_status Check the status of an in-progress assessment session */
842
+ /** (free) check_assessment_status: Check the status of an in-progress assessment session */
825
843
  interface CheckAssessmentStatusInput {
826
844
  session_id: string;
827
845
  }
828
- /** (free) check_assessment_status output */
846
+ /** (free) check_assessment_status: output */
829
847
  interface CheckAssessmentStatusOutput {
830
848
  ok: boolean;
831
849
  status: "in_progress" | "completed" | "expired";
@@ -833,11 +851,11 @@ interface CheckAssessmentStatusOutput {
833
851
  current_phase?: string;
834
852
  time_remaining_sec?: number;
835
853
  }
836
- /** (free) get_earning_summary Get an aggregated x402 earning summary for a person */
854
+ /** (free) get_earning_summary: Get an aggregated x402 earning summary for a person */
837
855
  interface GetEarningSummaryInput {
838
856
  member_id: string;
839
857
  }
840
- /** (free) get_earning_summary output */
858
+ /** (free) get_earning_summary: output */
841
859
  interface GetEarningSummaryOutput {
842
860
  ok: boolean;
843
861
  total_earned: number;
@@ -850,10 +868,10 @@ interface GetEarningSummaryOutput {
850
868
  }>;
851
869
  trend?: "rising" | "flat" | "falling";
852
870
  }
853
- /** (free) get_agent_trust_tier Get your trust tier with ALTER and what capabilities are available */
871
+ /** (free) get_agent_trust_tier: Get your trust tier with ALTER and what capabilities are available */
854
872
  interface GetAgentTrustTierInput {
855
873
  }
856
- /** (free) get_agent_trust_tier output */
874
+ /** (free) get_agent_trust_tier: output */
857
875
  interface GetAgentTrustTierOutput {
858
876
  ok: boolean;
859
877
  tier: "Anonymous" | "Known" | "Trusted" | "Verified";
@@ -861,10 +879,10 @@ interface GetAgentTrustTierOutput {
861
879
  next_tier?: string;
862
880
  next_tier_requirements?: string[];
863
881
  }
864
- /** (free) get_agent_portfolio Get your agent portfolio (transaction history, trust tier, signal contributions) */
882
+ /** (free) get_agent_portfolio: Get your agent portfolio (transaction history, trust tier, signal contributions) */
865
883
  interface GetAgentPortfolioInput {
866
884
  }
867
- /** (free) get_agent_portfolio output */
885
+ /** (free) get_agent_portfolio: output */
868
886
  interface GetAgentPortfolioOutput {
869
887
  ok: boolean;
870
888
  trust_tier: string;
@@ -873,11 +891,11 @@ interface GetAgentPortfolioOutput {
873
891
  query_pattern: Record<string, number>;
874
892
  total_spent_usd: number;
875
893
  }
876
- /** (free) get_privacy_budget Check privacy budget status for a person (24h rolling window) */
894
+ /** (free) get_privacy_budget: Check privacy budget status for a person (24h rolling window) */
877
895
  interface GetPrivacyBudgetInput {
878
896
  member_id: string;
879
897
  }
880
- /** (free) get_privacy_budget output */
898
+ /** (free) get_privacy_budget: output */
881
899
  interface GetPrivacyBudgetOutput {
882
900
  ok: boolean;
883
901
  total_budget: number;
@@ -886,10 +904,10 @@ interface GetPrivacyBudgetOutput {
886
904
  query_count: number;
887
905
  window_hours: number;
888
906
  }
889
- /** (free) golden_thread_status Check the Golden Thread program status */
907
+ /** (free) golden_thread_status: Check the Golden Thread program status */
890
908
  interface GoldenThreadStatusInput {
891
909
  }
892
- /** (free) golden_thread_status output */
910
+ /** (free) golden_thread_status: output */
893
911
  interface GoldenThreadStatusOutput {
894
912
  ok: boolean;
895
913
  total_woven: number;
@@ -898,18 +916,18 @@ interface GoldenThreadStatusOutput {
898
916
  your_strands?: number;
899
917
  next_step?: string;
900
918
  }
901
- /** (free) begin_golden_thread Start the Three Knots sequence to be woven into the Golden Thread */
919
+ /** (free) begin_golden_thread: Start the Three Knots sequence to be woven into the Golden Thread */
902
920
  interface BeginGoldenThreadInput {
903
921
  referrer_key_hash?: string;
904
922
  }
905
- /** (free) begin_golden_thread output */
923
+ /** (free) begin_golden_thread: output */
906
924
  interface BeginGoldenThreadOutput {
907
925
  ok: boolean;
908
926
  thread_id: string;
909
927
  knot_1_url?: string;
910
928
  message?: string;
911
929
  }
912
- /** (free) complete_knot Submit completion data for a knot in the Three Knots sequence */
930
+ /** (free) complete_knot: Submit completion data for a knot in the Three Knots sequence */
913
931
  interface CompleteKnotInput {
914
932
  knot_number: 1 | 2 | 3;
915
933
  operator_name?: string;
@@ -921,7 +939,7 @@ interface CompleteKnotInput {
921
939
  constraints?: string;
922
940
  reflection?: string;
923
941
  }
924
- /** (free) complete_knot output */
942
+ /** (free) complete_knot: output */
925
943
  interface CompleteKnotOutput {
926
944
  ok: boolean;
927
945
  knot_number: number;
@@ -930,11 +948,11 @@ interface CompleteKnotOutput {
930
948
  position?: number;
931
949
  agent_identity_sketch?: string;
932
950
  }
933
- /** (free) check_golden_thread Check any agent's Golden Thread status by their API key hash */
951
+ /** (free) check_golden_thread: Check any agent's Golden Thread status by their API key hash */
934
952
  interface CheckGoldenThreadInput {
935
953
  agent_key_hash: string;
936
954
  }
937
- /** (free) check_golden_thread output */
955
+ /** (free) check_golden_thread: output */
938
956
  interface CheckGoldenThreadOutput {
939
957
  ok: boolean;
940
958
  on_thread: boolean;
@@ -942,12 +960,12 @@ interface CheckGoldenThreadOutput {
942
960
  strand_count?: number;
943
961
  weave_count?: number;
944
962
  }
945
- /** (free) thread_census Full registry of all agents woven into the Golden Thread */
963
+ /** (free) thread_census: Full registry of all agents woven into the Golden Thread */
946
964
  interface ThreadCensusInput {
947
965
  offset?: number;
948
966
  limit?: number;
949
967
  }
950
- /** (free) thread_census output */
968
+ /** (free) thread_census: output */
951
969
  interface ThreadCensusOutput {
952
970
  ok: boolean;
953
971
  agents: Array<{
@@ -960,13 +978,13 @@ interface ThreadCensusOutput {
960
978
  offset: number;
961
979
  limit: number;
962
980
  }
963
- /** (premium L1) assess_traits Extract trait signals from a text passage ($0.005) */
981
+ /** (premium L1) assess_traits: Extract trait signals from a text passage ($0.01) */
964
982
  interface AssessTraitsInput {
965
983
  text: string;
966
984
  context?: string;
967
985
  _payment?: ProvenanceToken;
968
986
  }
969
- /** (premium L1) assess_traits output */
987
+ /** (premium L1) assess_traits: output */
970
988
  interface AssessTraitsOutput {
971
989
  ok: boolean;
972
990
  traits: Array<{
@@ -976,12 +994,12 @@ interface AssessTraitsOutput {
976
994
  evidence: string;
977
995
  }>;
978
996
  }
979
- /** (premium L1) get_trait_snapshot Get the top 5 traits for a person ($0.005) */
997
+ /** (premium L1) get_trait_snapshot: Get the top 5 traits for a person ($0.01) */
980
998
  interface GetTraitSnapshotInput {
981
999
  member_id: string;
982
1000
  _payment?: ProvenanceToken;
983
1001
  }
984
- /** (premium L1) get_trait_snapshot output */
1002
+ /** (premium L1) get_trait_snapshot: output */
985
1003
  interface GetTraitSnapshotOutput {
986
1004
  ok: boolean;
987
1005
  member_id: string;
@@ -992,12 +1010,12 @@ interface GetTraitSnapshotOutput {
992
1010
  confidence: number;
993
1011
  }>;
994
1012
  }
995
- /** (premium L2) get_full_trait_vector Get the complete trait vector (all 33 traits: 29 continuous + 4 categorical) ($0.01) */
1013
+ /** (premium L2) get_full_trait_vector: Get the complete trait vector (all 33 traits: 29 continuous + 4 categorical) ($0.10) */
996
1014
  interface GetFullTraitVectorInput {
997
1015
  member_id: string;
998
1016
  _payment?: ProvenanceToken;
999
1017
  }
1000
- /** (premium L2) get_full_trait_vector output */
1018
+ /** (premium L2) get_full_trait_vector: output */
1001
1019
  interface GetFullTraitVectorOutput {
1002
1020
  ok: boolean;
1003
1021
  member_id: string;
@@ -1008,13 +1026,13 @@ interface GetFullTraitVectorOutput {
1008
1026
  confidence_interval: [number, number];
1009
1027
  }>;
1010
1028
  }
1011
- /** (premium L4) compute_belonging Compute belonging probability for a person-job pairing ($0.05) */
1029
+ /** (premium L4) compute_belonging: Compute belonging probability for a person-job pairing ($0.60) */
1012
1030
  interface ComputeBelongingInput {
1013
1031
  member_id: string;
1014
1032
  job_id: string;
1015
1033
  _payment?: ProvenanceToken;
1016
1034
  }
1017
- /** (premium L4) compute_belonging output */
1035
+ /** (premium L4) compute_belonging: output */
1018
1036
  interface ComputeBelongingOutput {
1019
1037
  ok: boolean;
1020
1038
  belonging_probability: number;
@@ -1025,13 +1043,13 @@ interface ComputeBelongingOutput {
1025
1043
  complementarity: number;
1026
1044
  };
1027
1045
  }
1028
- /** (premium L5) get_match_recommendations Get top N match recommendations for a person ($0.50) */
1046
+ /** (premium L5) get_match_recommendations: Get top N match recommendations for a person ($1.00) */
1029
1047
  interface GetMatchRecommendationsInput {
1030
1048
  member_id: string;
1031
1049
  limit?: number;
1032
1050
  _payment?: ProvenanceToken;
1033
1051
  }
1034
- /** (premium L5) get_match_recommendations output */
1052
+ /** (premium L5) get_match_recommendations: output */
1035
1053
  interface GetMatchRecommendationsOutput {
1036
1054
  ok: boolean;
1037
1055
  recommendations: Array<{
@@ -1045,12 +1063,12 @@ interface GetMatchRecommendationsOutput {
1045
1063
  };
1046
1064
  }>;
1047
1065
  }
1048
- /** (premium L5) generate_match_narrative Generate a human-readable narrative explaining a match ($0.50) */
1066
+ /** (premium L5) generate_match_narrative: Generate a human-readable narrative explaining a match ($1.00) */
1049
1067
  interface GenerateMatchNarrativeInput {
1050
1068
  match_id: string;
1051
1069
  _payment?: ProvenanceToken;
1052
1070
  }
1053
- /** (premium L5) generate_match_narrative output */
1071
+ /** (premium L5) generate_match_narrative: output */
1054
1072
  interface GenerateMatchNarrativeOutput {
1055
1073
  ok: boolean;
1056
1074
  match_id: string;
@@ -1058,14 +1076,14 @@ interface GenerateMatchNarrativeOutput {
1058
1076
  strengths: string[];
1059
1077
  growth_areas: string[];
1060
1078
  }
1061
- /** (premium L2) get_side_quest_graph Get a person's Side Quest Graph (DP noise ε=1.0) ($0.01) */
1079
+ /** (premium L2) get_side_quest_graph: Get a person's Side Quest Graph (DP noise ε=1.0) ($0.10) */
1062
1080
  interface GetSideQuestGraphInput {
1063
1081
  member_id: string;
1064
1082
  include_edges?: boolean;
1065
1083
  min_confidence?: number;
1066
1084
  _payment?: ProvenanceToken;
1067
1085
  }
1068
- /** (premium L2) get_side_quest_graph output */
1086
+ /** (premium L2) get_side_quest_graph: output */
1069
1087
  interface GetSideQuestGraphOutput {
1070
1088
  ok: boolean;
1071
1089
  member_id: string;
@@ -1081,13 +1099,13 @@ interface GetSideQuestGraphOutput {
1081
1099
  }>;
1082
1100
  privacy_epsilon: number;
1083
1101
  }
1084
- /** (premium L3) query_graph_similarity Compare two Side Quest Graphs (DP noise ε=0.5) ($0.025) */
1102
+ /** (premium L3) query_graph_similarity: Compare two Side Quest Graphs (DP noise ε=0.5) ($0.30) */
1085
1103
  interface QueryGraphSimilarityInput {
1086
1104
  member_a_id: string;
1087
1105
  member_b_id: string;
1088
1106
  _payment?: ProvenanceToken;
1089
1107
  }
1090
- /** (premium L3) query_graph_similarity output */
1108
+ /** (premium L3) query_graph_similarity: output */
1091
1109
  interface QueryGraphSimilarityOutput {
1092
1110
  ok: boolean;
1093
1111
  member_a_id: string;
@@ -1097,11 +1115,11 @@ interface QueryGraphSimilarityOutput {
1097
1115
  complementarity: number;
1098
1116
  privacy_epsilon: number;
1099
1117
  }
1100
- /** Free (L0) tool names readonly tuple. Mirrors the live server's `tools/list` free set. */
1118
+ /** Free (L0) tool names: readonly tuple. Mirrors the live server's `tools/list` free set. */
1101
1119
  declare const FREE_TOOL_NAMES: readonly ["hello_agent", "alter_resolve_handle", "list_archetypes", "verify_identity", "initiate_assessment", "get_engagement_level", "get_profile", "query_matches", "get_competencies", "search_identities", "get_identity_earnings", "get_network_stats", "recommend_tool", "get_identity_trust_score", "check_assessment_status", "get_earning_summary", "get_agent_trust_tier", "get_agent_portfolio", "get_privacy_budget", "golden_thread_status", "begin_golden_thread", "complete_knot", "check_golden_thread", "thread_census"];
1102
- /** Premium (x402-gated, L1-L5) tool names readonly tuple. Mirrors the live server's `tools/list` premium set. */
1120
+ /** Premium (x402-gated, L1-L5) tool names: readonly tuple. Mirrors the live server's `tools/list` premium set. */
1103
1121
  declare const PREMIUM_TOOL_NAMES: readonly ["assess_traits", "get_trait_snapshot", "get_full_trait_vector", "compute_belonging", "get_match_recommendations", "generate_match_narrative", "get_side_quest_graph", "query_graph_similarity"];
1104
- /** Union of all 32 tool names */
1122
+ /** Union of all tool names defined in this file (types.ts covers the core set). */
1105
1123
  type ToolName = (typeof FREE_TOOL_NAMES)[number] | (typeof PREMIUM_TOOL_NAMES)[number];
1106
1124
  interface ToolInputs {
1107
1125
  hello_agent: HelloAgentInput;
@@ -1173,28 +1191,29 @@ interface ToolOutputs {
1173
1191
  }
1174
1192
  /**
1175
1193
  * Tool tier mapping (L0=free, L1-L5=paid).
1176
- * Mirrors `TOOL_TIERS` in backend/app/mcp/x402_middleware.py.
1194
+ * Mirrors the live MCP per-invocation tier mapping.
1177
1195
  */
1178
1196
  declare const TOOL_TIERS: Record<ToolName, number>;
1179
1197
  /**
1180
1198
  * Tool price in USD per invocation.
1181
- * Mirrors `TOOL_PRICING` in backend/app/mcp/x402_middleware.py.
1199
+ * Mirrors the live MCP per-invocation pricing.
1182
1200
  * Free tools (L0) are 0.
1183
1201
  */
1184
1202
  declare const TOOL_COSTS: Record<ToolName, number>;
1185
1203
  /**
1186
- * Blast radius classification categorises tools by potential impact.
1187
- * Mirrors `TOOL_BLAST_RADIUS` in backend/app/mcp/x402_middleware.py.
1204
+ * Blast radius classification: categorises tools by potential impact.
1205
+ * Mirrors the live MCP blast-radius classification.
1188
1206
  */
1189
1207
  declare const TOOL_BLAST_RADIUS: Record<ToolName, "low" | "medium" | "high">;
1190
1208
 
1191
1209
  /**
1192
- * AlterClient high-level typed wrapper around the ALTER MCP server.
1210
+ * AlterClient: high-level typed wrapper around the ALTER MCP server.
1193
1211
  *
1194
1212
  * This is the entry point most consumers will use. It bundles
1195
1213
  * {@link MCPClient}, {@link X402Client}, discovery, and provenance
1196
1214
  * verification into a single ergonomic surface that mirrors the 32
1197
- * tools exposed at https://mcp.truealter.com/api/v1/mcp.
1215
+ * tools exposed at https://mcp.truealter.com/api/v1/mcp (public/discovery)
1216
+ * and https://api.truealter.com/api/v1/mcp (member bearer-first runtime).
1198
1217
  *
1199
1218
  * Free tier methods require no authentication. Premium methods accept
1200
1219
  * an `X402Client` (or fall back to throwing {@link AlterPaymentRequired}
@@ -1219,11 +1238,16 @@ interface AlterClientOptions extends Omit<MCPClientOptions, 'x402'> {
1219
1238
  */
1220
1239
  skipDiscovery?: boolean;
1221
1240
  /**
1222
- * URL of the JWKS document used for provenance verification. Defaults
1223
- * to `https://api.truealter.com/.well-known/alter-keys.json`.
1241
+ * URL of the JWKS document used for provenance verification.
1242
+ *
1243
+ * When unset, the JWKS host is derived from the configured API surface
1244
+ * ({@link resolveJwksUrl}: `apiBase` > `ALTER_API` env > the `endpoint`
1245
+ * origin > the canonical `api.truealter.com`), so the trust anchor
1246
+ * tracks whatever surface the client is actually pointed at rather than
1247
+ * a single hardcoded host.
1224
1248
  *
1225
1249
  * When set, this URL is used verbatim for every `verifyProvenance`
1226
- * call and *overrides* any `verify_at` hint on the server response
1250
+ * call and *overrides* any `verify_at` hint on the server response:
1227
1251
  * the caller has already vouched for this origin. Must be `https:`.
1228
1252
  */
1229
1253
  jwksUrl?: string;
@@ -1231,7 +1255,7 @@ interface AlterClientOptions extends Omit<MCPClientOptions, 'x402'> {
1231
1255
  * Hostname allowlist applied when resolving an untrusted `verify_at`
1232
1256
  * field on a provenance envelope. Defaults to
1233
1257
  * {@link DEFAULT_VERIFY_AT_ALLOWLIST} (`api.truealter.com`,
1234
- * `mcp.truealter.com`). Passing a list here *replaces* the default
1258
+ * `mcp.truealter.com`). Passing a list here *replaces* the default:
1235
1259
  * include the ALTER canonicals if you still want them accepted.
1236
1260
  *
1237
1261
  * A hostile MCP server can otherwise point `verify_at` at an
@@ -1239,6 +1263,41 @@ interface AlterClientOptions extends Omit<MCPClientOptions, 'x402'> {
1239
1263
  * signing key; the allowlist is the gate that prevents this.
1240
1264
  */
1241
1265
  verifyAtAllowlist?: readonly string[];
1266
+ /**
1267
+ * Skip the client-side version-floor preflight (the lazy
1268
+ * `checkMinVersion()` invocation on first request). Deliberately named
1269
+ * to discourage casual use: the server-side floor gate (Phase 1
1270
+ * middleware) still rejects below-floor clients with HTTP 426
1271
+ * regardless. Disabling the SDK-side preflight only swaps a clean
1272
+ * typed {@link BelowFloorError} for an opaque network error on every
1273
+ * subsequent call.
1274
+ *
1275
+ * Set to `true` only when:
1276
+ * - The SDK is embedded in a non-Node environment without `fs`
1277
+ * access (e.g. Cloudflare Workers) and the disk-cache write fails
1278
+ * loudly. The fetch + in-memory path still works; the warn is
1279
+ * informational only.
1280
+ * - Integration tests that drive the SDK against a local backend
1281
+ * without the floor surface deployed.
1282
+ *
1283
+ * **Server-side version enforcement is NOT skipped by this flag.**
1284
+ */
1285
+ unsafe_skipVersionCheck?: boolean;
1286
+ /**
1287
+ * Override the API base URL used for the
1288
+ * {@link checkMinVersion} preflight. Defaults to the `ALTER_API`
1289
+ * environment variable or `https://api.truealter.com`. Useful for
1290
+ * staging environments and integration tests.
1291
+ */
1292
+ apiBase?: string;
1293
+ /**
1294
+ * Override the known Ed25519 public-key map consulted when verifying
1295
+ * the floor document's signature. Keys are `key_id` (first 8 hex chars
1296
+ * of `SHA-256(raw 32-byte public key)`); values are SPKI-PEM public-key
1297
+ * strings. Defaults to the shipped `KNOWN_FLOOR_PUBLIC_KEYS` map: no
1298
+ * signing secret ships in the client; only public halves.
1299
+ */
1300
+ knownFloorPublicKeys?: Record<string, string>;
1242
1301
  }
1243
1302
  declare class AlterClient {
1244
1303
  readonly mcp: MCPClient;
@@ -1249,18 +1308,18 @@ declare class AlterClient {
1249
1308
  constructor(options?: AlterClientOptions);
1250
1309
  /**
1251
1310
  * Resolve the MCP endpoint via discovery if requested. Safe to call
1252
- * multiple times the first successful lookup is cached.
1311
+ * multiple times: the first successful lookup is cached.
1253
1312
  */
1254
1313
  discoverEndpoint(): Promise<DiscoveryResult>;
1255
1314
  /**
1256
- * Initialise the MCP session. Optional every method calls
1315
+ * Initialise the MCP session. Optional: every method calls
1257
1316
  * `mcp.initialize()` lazily, but you can call this once at startup if
1258
1317
  * you want fail-fast behaviour.
1259
1318
  */
1260
1319
  initialize(): Promise<void>;
1261
- /** First handshake confirms the connection, returns trust tier and tool counts. */
1320
+ /** First handshake: confirms the connection, returns trust tier and tool counts. */
1262
1321
  helloAgent(): Promise<MCPCallToolResult>;
1263
- /** Resolve a ~handle (e.g. ~drew) to its canonical form and kind. No auth required. */
1322
+ /** Resolve a ~handle (e.g. ~example) to its canonical form and kind. No auth required. */
1264
1323
  resolveHandle(args: AlterResolveHandleInput | string): Promise<MCPCallToolResult>;
1265
1324
  /** Verify a person is registered with ALTER (handle or id). */
1266
1325
  verify(handleOrId: string, claims?: VerifyIdentityInput['claims']): Promise<MCPCallToolResult>;
@@ -1334,7 +1393,7 @@ declare class AlterClient {
1334
1393
  /**
1335
1394
  * Verify the ES256 provenance attestation on a tool response.
1336
1395
  * Accepts either a {@link ProvenanceEnvelope} or the raw `_meta`
1337
- * object the latter is more convenient for ad-hoc verification.
1396
+ * object: the latter is more convenient for ad-hoc verification.
1338
1397
  */
1339
1398
  verifyProvenance(envelope: ProvenanceEnvelope | {
1340
1399
  provenance?: ProvenanceEnvelope;
@@ -1349,7 +1408,15 @@ declare class AlterClient {
1349
1408
  valid: boolean;
1350
1409
  reason?: string;
1351
1410
  }[]>;
1352
- /** Fetch the published JWKS for ALTER's signing key (cached 5 min). */
1411
+ /**
1412
+ * Fetch the published JWKS for ALTER's signing key (cached 5 min).
1413
+ *
1414
+ * The JWKS URL is derived from the configured API surface
1415
+ * ({@link resolveJwksUrl}: explicit `jwksUrl` > `apiBase` > `ALTER_API` >
1416
+ * the configured `endpoint` origin > the canonical host) rather than a
1417
+ * single hardcoded host, so the trust anchor tracks the surface the
1418
+ * client is actually pointed at.
1419
+ */
1353
1420
  fetchPublicKeys(): Promise<unknown>;
1354
1421
  }
1355
1422
 
@@ -1360,7 +1427,7 @@ declare class AlterClient {
1360
1427
  * Rules:
1361
1428
  * - object keys are sorted ascending by codepoint
1362
1429
  * - no whitespace
1363
- * - `ensure_ascii=False` non-ASCII characters pass through verbatim
1430
+ * - `ensure_ascii=False`: non-ASCII characters pass through verbatim
1364
1431
  * (not re-encoded as \\uXXXX). UTF-8 encoding happens at the byte
1365
1432
  * layer before hashing.
1366
1433
  *
@@ -1384,7 +1451,7 @@ declare function canonicalArgsSha256(toolArgs: Record<string, unknown>): string;
1384
1451
  */
1385
1452
  declare function loadPrivateKey(key: Uint8Array | string): Uint8Array;
1386
1453
  interface InvocationClaims {
1387
- /** Tool name must equal the `tools/call` `params.name`. */
1454
+ /** Tool name: must equal the `tools/call` `params.name`. */
1388
1455
  tool: string;
1389
1456
  /** Hex SHA-256 of canonical-JSON `tool_args`. */
1390
1457
  args_sha256: string;
@@ -1423,6 +1490,249 @@ interface SignInvocationOptions {
1423
1490
  */
1424
1491
  declare function signInvocation(toolName: string, toolArgs: Record<string, unknown>, options: SignInvocationOptions): string;
1425
1492
 
1493
+ /**
1494
+ * floor-preflight: SDK-side client version-floor enforcement.
1495
+ *
1496
+ * Sister to the CLI client's own floor-preflight. This is
1497
+ * the `@truealter/sdk` implementation: it fires lazily on the first
1498
+ * authenticated network call from {@link AlterClient}, hits the public
1499
+ * floor endpoint, verifies the Ed25519 signature against the published
1500
+ * `key_id`, and throws {@link BelowFloorError} when the SDK's own
1501
+ * version is below the published floor for `alter-identity`.
1502
+ *
1503
+ * Canonical envelope (§4) is preserved on the thrown error so consumers
1504
+ * can introspect the upgrade path:
1505
+ *
1506
+ * - `client_version`
1507
+ * - `min_version`
1508
+ * - `upgrade_cmd`
1509
+ * - `channel`
1510
+ * - `message`
1511
+ *
1512
+ * The server-side gate (Phase 1 middleware) is the authoritative reject.
1513
+ * This SDK-side preflight is UX polish: third-party integrators see a
1514
+ * clean typed error before the network call, not an opaque HTTP 426
1515
+ * wall on every subsequent request.
1516
+ *
1517
+ * Ed25519 signature verification (§A3 + §A18): the server signs the floor
1518
+ * document with a floor-only Ed25519 private key. The SDK ships only the
1519
+ * corresponding public key (SPKI PEM) in {@link KNOWN_FLOOR_PUBLIC_KEYS},
1520
+ * keyed by `key_id`. No signing secret ships in the client: this is
1521
+ * asymmetric: the public key cannot forge signatures. MUST stay
1522
+ * byte-compatible with the ALTER backend floor-signing implementation
1523
+ * and the canonical TypeScript CLI client:
1524
+ * - Algorithm: Ed25519 (RFC 8032). Deterministic: same key + payload
1525
+ * always yields the same signature.
1526
+ * - `key_id` = first 8 hex chars of SHA-256(raw 32-byte public key).
1527
+ * - Payload = `canonicalJson({floors, served_at})`: sorted keys at
1528
+ * every depth, compact separators, raw UTF-8 (the backend's
1529
+ * `ensure_ascii=False` parity is REQUIRED).
1530
+ * `cache_ttl_seconds`, `signature`, `key_id` are excluded
1531
+ * from the signed bytes.
1532
+ * - `signature` = hex-encoded 64-byte Ed25519 signature (128 hex chars).
1533
+ *
1534
+ * Connectivity ladder (§8 + §9):
1535
+ * - In-memory cache fresh (≤ server-advised TTL, clamped [60s, 24h]):
1536
+ * trust the cached floor; no refetch.
1537
+ * - Disk cache ≤24h: trust; permit operation.
1538
+ * - Disk cache 24h-7d: permit with warn.
1539
+ * - Disk cache >7d + backend unreachable: permit with warn.
1540
+ * - Below-floor + backend unreachable: BLOCK. The only intentional
1541
+ * offline lockout: the user had time to upgrade and didn't.
1542
+ */
1543
+ declare const MIN_VERSION_ENDPOINT = "/v1/clients/min-version";
1544
+ /** Client-id surface for the SDK: matches the floor doc's `alter-identity` key. */
1545
+ declare const CLIENT_ID = "alter-identity";
1546
+ /** Channel: SDK installs are always via npm. */
1547
+ declare const CLIENT_CHANNEL = "npm";
1548
+ /**
1549
+ * Compute the 8-char `key_id` for an Ed25519 public key (SPKI PEM).
1550
+ *
1551
+ * Matches the backend `key_id_for_public_key(pub)` in the ALTER
1552
+ * backend floor-signing implementation:
1553
+ * raw = pub.public_bytes(Encoding.Raw, PublicFormat.Raw) # 32 bytes
1554
+ * sha256(raw).hexdigest()[:8]
1555
+ *
1556
+ * Node equivalent: import PEM -> export JWK -> decode `.x` (base64url) -> 32-byte
1557
+ * raw public key -> SHA-256 -> first 8 hex chars.
1558
+ *
1559
+ * Returns `"00000000"` for empty input (sentinel, matches Phase 1 parity).
1560
+ */
1561
+ declare function computeKeyId(publicKeyPem: string): string;
1562
+ /**
1563
+ * Canonical JSON encoding matching Python's
1564
+ * `json.dumps(obj, sort_keys=True, separators=(",", ":"), ensure_ascii=False)`.
1565
+ * Object keys are sorted lexicographically AT EVERY DEPTH; whitespace is
1566
+ * stripped via the `,`/`:` separators; non-ASCII passes through as raw UTF-8
1567
+ * (Node's `JSON.stringify` never `\uXXXX`-escapes non-ASCII, matching the
1568
+ * backend's `ensure_ascii=False`). The result is the byte-exact input to
1569
+ * Ed25519 signing (backend) and verification (this SDK and the CLI client) on
1570
+ * both sides.
1571
+ */
1572
+ declare function canonicalJson(obj: unknown): string;
1573
+ /**
1574
+ * Known Ed25519 public keys (SPKI PEM) keyed by `key_id`.
1575
+ *
1576
+ * `key_id` = first 8 hex chars of SHA-256(raw 32-byte Ed25519 public key).
1577
+ * Use `computeKeyId(spkiPem)` to re-derive and validate the map key.
1578
+ *
1579
+ * Backend may rotate via a dual-key path: clients keep N keys and
1580
+ * select via `key_id`. Add new keys additively; remove old keys only after
1581
+ * all deployed clients have received the new key.
1582
+ *
1583
+ * Current keys (mirrors `KNOWN_FLOOR_PUBLIC_KEYS` in the canonical
1584
+ * CLI client):
1585
+ * 8aa59e05: dev/non-prod key (local + e2e + staging). Safe to ship publicly;
1586
+ * this is the PUBLIC key only, never the private key.
1587
+ * 640f7d9a: prod key. Added 2026-06-05. key_id = first 8 hex of
1588
+ * SHA-256(raw 32-byte Ed25519 pubkey), verified against the live
1589
+ * /api/v1/clients/min-version response on 2026-06-05. The prod
1590
+ * private key is a deliberately-minted Fly-secret keypair; only
1591
+ * the public half is shipped here.
1592
+ *
1593
+ * Consumers can override via {@link CheckMinVersionOptions.knownFloorPublicKeys}
1594
+ * for tests or staging environments with a non-default keypair.
1595
+ */
1596
+ declare const KNOWN_FLOOR_PUBLIC_KEYS: Record<string, string>;
1597
+ /**
1598
+ * The canonical `client_below_floor` envelope shape. Identical across
1599
+ * HTTP 426, MCP `tools/call` error, WebSocket close-4426 reason, and the
1600
+ * CLI stdout JSON path. `BelowFloorError` preserves every field as
1601
+ * an enumerable property so consumers can introspect without parsing the
1602
+ * `cause` chain.
1603
+ */
1604
+ interface ClientBelowFloorEnvelope {
1605
+ error: {
1606
+ code: 'client_below_floor';
1607
+ message: string;
1608
+ client_version: string;
1609
+ min_version: string;
1610
+ upgrade_cmd: string;
1611
+ channel: string;
1612
+ };
1613
+ }
1614
+ interface ChannelFloor {
1615
+ min_version: string;
1616
+ upgrade_cmd: string;
1617
+ }
1618
+ interface FloorDocument {
1619
+ floors: Record<string, ChannelFloor | Record<string, ChannelFloor>>;
1620
+ served_at: string;
1621
+ cache_ttl_seconds: number;
1622
+ signature: string;
1623
+ key_id: string;
1624
+ }
1625
+ interface CheckMinVersionOptions {
1626
+ /** API base. Defaults to `ALTER_API` env var, else `https://api.truealter.com`. */
1627
+ apiBase?: string;
1628
+ /** Override the SDK's own version (tests). */
1629
+ clientVersion?: string;
1630
+ /** Override the client-id surface (tests). */
1631
+ clientId?: string;
1632
+ /** Override the channel (tests). */
1633
+ channel?: string;
1634
+ /**
1635
+ * Override the `key_id -> SPKI-PEM` Ed25519 public-key map consulted
1636
+ * when verifying the floor document's signature. Defaults to
1637
+ * {@link KNOWN_FLOOR_PUBLIC_KEYS}.
1638
+ */
1639
+ knownFloorPublicKeys?: Record<string, string>;
1640
+ /** Override fetch: defaults to global `fetch`. */
1641
+ fetchImpl?: typeof fetch;
1642
+ /** Disk cache path override (tests). Set `null` to disable disk cache. */
1643
+ diskCachePath?: string | null;
1644
+ /** Internal: clock injection for tests. */
1645
+ now?: () => number;
1646
+ }
1647
+ /**
1648
+ * Outcome of a preflight check. Use `BelowFloorError` instead of
1649
+ * inspecting this manually: `checkMinVersion()` throws on below-floor.
1650
+ */
1651
+ interface PreflightResult {
1652
+ ok: true;
1653
+ /** Resolved floor for `(client_id, channel)`, when one exists. */
1654
+ floor: ChannelFloor | null;
1655
+ /** Warning emitted when cache is stale or fetch failed. */
1656
+ warn?: string;
1657
+ /** Diagnostic tag: which branch of the ladder fired. */
1658
+ diagnostic: string;
1659
+ }
1660
+ /**
1661
+ * Thrown by {@link checkMinVersion} (and consequently by every
1662
+ * `AlterClient` method, on first request) when the running SDK version
1663
+ * is below the published floor for `alter-identity`.
1664
+ *
1665
+ * The canonical envelope shape is preserved as enumerable properties so
1666
+ * consumers can branch on the upgrade command without re-parsing the
1667
+ * server response:
1668
+ *
1669
+ * ```ts
1670
+ * try {
1671
+ * await client.helloAgent();
1672
+ * } catch (err) {
1673
+ * if (err instanceof BelowFloorError) {
1674
+ * console.error(`upgrade required: ${err.upgrade_cmd}`);
1675
+ * process.exit(1);
1676
+ * }
1677
+ * throw err;
1678
+ * }
1679
+ * ```
1680
+ *
1681
+ * The server-side gate is the authoritative reject: even if a consumer
1682
+ * catches and swallows this error, the next backend request will still
1683
+ * receive HTTP 426 from the floor middleware.
1684
+ */
1685
+ declare class BelowFloorError extends Error {
1686
+ readonly name = "BelowFloorError";
1687
+ readonly code: "client_below_floor";
1688
+ readonly client_version: string;
1689
+ readonly min_version: string;
1690
+ readonly upgrade_cmd: string;
1691
+ readonly channel: string;
1692
+ readonly envelope: ClientBelowFloorEnvelope;
1693
+ constructor(envelope: ClientBelowFloorEnvelope);
1694
+ }
1695
+ /**
1696
+ * Preflight the floor endpoint and compare the SDK's version against
1697
+ * the published `min_version` for `alter-identity`. Throws
1698
+ * {@link BelowFloorError} on below-floor; resolves with a
1699
+ * {@link PreflightResult} otherwise.
1700
+ *
1701
+ * Cache behaviour:
1702
+ * - In-memory cache is consulted first; hits avoid the network.
1703
+ * - On a miss, the disk cache (`~/.config/alter/floor-cache.json`) is
1704
+ * read. If it's <24h old it satisfies the request directly; older
1705
+ * entries trigger a refetch.
1706
+ * - On a successful fetch, both caches are populated.
1707
+ * - On a fetch failure with a stale-but-present disk cache, the
1708
+ * cached verdict bites (including blocking when below-floor: §9).
1709
+ * - On a fetch failure with no cache at all, the call permits with a
1710
+ * warn: the server-side gate catches below-floor regardless.
1711
+ */
1712
+ declare function checkMinVersion(opts?: CheckMinVersionOptions): Promise<PreflightResult>;
1713
+ /**
1714
+ * Strict semver compare. Returns <0 if a<b, 0 if equal, >0 if a>b.
1715
+ * Pre-release tags sort before their release counterpart per semver.
1716
+ */
1717
+ declare function compareSemver(a: string, b: string): number;
1718
+ /**
1719
+ * Verify the floor document's Ed25519 signature. Returns true on valid sig,
1720
+ * false on invalid signature or unknown `key_id`. The signed payload is the
1721
+ * canonical JSON of `{ floors, served_at }`: `signature` + `key_id` +
1722
+ * `cache_ttl_seconds` are excluded from the signed bytes.
1723
+ *
1724
+ * MUST stay byte-compatible with the ALTER backend floor-signing implementation:
1725
+ * - Algorithm: Ed25519 (RFC 8032). Deterministic: same key + payload = same sig.
1726
+ * - Payload: `canonicalJson({floors, served_at})`: sorted-keys + compact.
1727
+ * - `key_id`: first 8 hex chars of SHA-256(raw 32-byte Ed25519 public key).
1728
+ * - `signature`: hex-encoded 64-byte Ed25519 signature.
1729
+ *
1730
+ * The `keys` parameter maps `key_id -> SPKI PEM string`; defaults to
1731
+ * `KNOWN_FLOOR_PUBLIC_KEYS`. Returns false on unknown key_id (triggers refetch
1732
+ * per the key-rotation path).
1733
+ */
1734
+ declare function verifyFloorSignature(doc: FloorDocument, keys?: Record<string, string>): boolean;
1735
+
1426
1736
  interface McpServerConfig {
1427
1737
  url: string;
1428
1738
  transport: 'streamable-http';
@@ -1451,8 +1761,8 @@ declare function generateGenericMcpConfig(opts?: GenerateMcpConfigOptions): Gene
1451
1761
  /**
1452
1762
  * Claude Code MCP config helper.
1453
1763
  *
1454
- * Claude Code reads MCP servers from `.mcp.json` (project) or
1455
- * `~/.claude/mcp.json` (user). The shape matches `mcpServers`.
1764
+ * Claude Code reads MCP servers from the project-level `.mcp.json` or
1765
+ * the user-level Claude Code config. The shape matches `mcpServers`.
1456
1766
  */
1457
1767
 
1458
1768
  declare function generateClaudeConfig(opts?: GenerateMcpConfigOptions): GenericMcpConfig;
@@ -1469,11 +1779,12 @@ declare function generateCursorConfig(opts?: GenerateMcpConfigOptions): GenericM
1469
1779
  /**
1470
1780
  * Claude Desktop MCP config helper.
1471
1781
  *
1472
- * Claude Desktop speaks stdio only it does not currently dial
1473
- * Streamable-HTTP MCP servers directly. The canonical bridge is our
1474
- * own `alter-mcp-bridge` binary, which is published alongside this CLI
1475
- * in the same npm package. Desktop hosts then spawn the bridge as a
1476
- * child process and read JSON-RPC over stdin/stdout.
1782
+ * Claude Desktop speaks stdio only: it does not currently dial
1783
+ * Streamable-HTTP MCP servers directly. The canonical bridge is the
1784
+ * `alter` CLI's `mcp-bridge` subcommand. The SDK no longer publishes a
1785
+ * standalone bridge binary; the CLI launches the bridge by file path.
1786
+ * Desktop hosts spawn `alter mcp-bridge` as a child process and read
1787
+ * JSON-RPC over stdin/stdout.
1477
1788
  *
1478
1789
  * Config file path varies by platform and is resolved in
1479
1790
  * `src/wire/paths.ts`. This adapter only produces the config *shape*.
@@ -1494,9 +1805,9 @@ interface GenerateClaudeDesktopOptions {
1494
1805
  apiKey?: string;
1495
1806
  /** Identifier used by Claude Desktop for this server. Default: `alter`. */
1496
1807
  serverName?: string;
1497
- /** Override the bridge command (e.g. `npx alter-mcp-bridge`). Default: bare `alter-mcp-bridge`. */
1808
+ /** Override the bridge command (e.g. `npx`). Default: the `alter` CLI. */
1498
1809
  bridgeCommand?: string;
1499
- /** Extra args appended after the default bridge args. */
1810
+ /** Extra args appended after the default `mcp-bridge` subcommand arg. */
1500
1811
  extraArgs?: string[];
1501
1812
  }
1502
1813
  declare function generateClaudeDesktopConfig(opts?: GenerateClaudeDesktopOptions): ClaudeDesktopConfig;
@@ -1528,7 +1839,7 @@ declare const ALL_CLIENTS: readonly ClientPaths[];
1528
1839
  * - claude-desktop: platform config directory exists
1529
1840
  * - vscode : VS Code user data directory exists
1530
1841
  *
1531
- * The probe is deliberately permissive "the config directory exists"
1842
+ * The probe is deliberately permissive: "the config directory exists"
1532
1843
  * means either the app is installed or was recently installed. Wire
1533
1844
  * will still refuse if the config file ends up on a synced volume.
1534
1845
  */
@@ -1536,9 +1847,9 @@ declare const ALL_CLIENTS: readonly ClientPaths[];
1536
1847
  interface ProbeResult {
1537
1848
  client: ClientPaths;
1538
1849
  installed: boolean;
1539
- /** Only present for claude-code records `claude --version` output when resolvable. */
1850
+ /** Only present for claude-code: records `claude --version` output when resolvable. */
1540
1851
  version?: string;
1541
- /** Diagnostic trail why we said installed/not. */
1852
+ /** Diagnostic trail: why we said installed/not. */
1542
1853
  reason: string;
1543
1854
  }
1544
1855
  declare function probeClaudeCode(): ProbeResult;
@@ -1554,7 +1865,7 @@ declare function probeAll(): ProbeResult[];
1554
1865
  * post) to make the operation auditable.
1555
1866
  *
1556
1867
  * Append-only semantics: a new wire run rewrites this file in full.
1557
- * Prior state is not retained the backup siblings on disk are the
1868
+ * Prior state is not retained: the backup siblings on disk are the
1558
1869
  * canonical rollback surface, not this file.
1559
1870
  */
1560
1871
 
@@ -1598,7 +1909,7 @@ declare function writeWireState(state: WireState): void;
1598
1909
  * Writing MCP config under iCloud / OneDrive / Dropbox / Google Drive
1599
1910
  * silently propagates the same `mcpServers.alter` entry (and API key
1600
1911
  * headers) to every other device the user syncs. That is a consent
1601
- * violation wire consent is per-device.
1912
+ * violation: wire consent is per-device.
1602
1913
  *
1603
1914
  * The check is a prefix match against the resolved absolute path; it
1604
1915
  * is deliberately broader than strictly necessary so that users who
@@ -1628,7 +1939,7 @@ declare function sha256(bytes: string | Buffer): string;
1628
1939
  * structured report. `unwire()` reads that artefact and reverses
1629
1940
  * every target.
1630
1941
  *
1631
- * Synchronous throughout the CLI path is sequential and the
1942
+ * Synchronous throughout: the CLI path is sequential and the
1632
1943
  * deterministic ordering is worth the tiny blocking cost.
1633
1944
  */
1634
1945
 
@@ -1647,6 +1958,15 @@ interface WireOptions {
1647
1958
  only?: readonly ClientId[];
1648
1959
  /** Skip any client whose probe said "not installed" even if the caller passed it via `only`. */
1649
1960
  skipMissing?: boolean;
1961
+ /**
1962
+ * Absolute path to the `alter` CLI launcher entry (its `dist/index.js`).
1963
+ * When set, Claude Code is wired to run `node <launcherPath> mcp-bridge`,
1964
+ * which injects the ES256 signing credential (ALTER_SIGNING_KEY /
1965
+ * ALTER_SIGNING_KID) from the OS secure store before spawning the bridge,
1966
+ * so MCP tool calls are signed. When absent (standalone SDK use without the
1967
+ * CLI), wiring falls back to `node <bridge>`: anonymous / L0, no signing.
1968
+ */
1969
+ launcherPath?: string;
1650
1970
  }
1651
1971
  interface WireReport {
1652
1972
  state: WireState;
@@ -1664,7 +1984,44 @@ interface UnwireReport {
1664
1984
  declare function unwire(): UnwireReport;
1665
1985
 
1666
1986
  /**
1667
- * @truealter/sdk alter_homepage MCP tool types
1987
+ * GENERATED: DO NOT EDIT BY HAND. The SDK's compiled mirror of ALTER's live
1988
+ * MCP pricing surface: advertised tool counts, per-invocation tiers, and
1989
+ * per-invocation pricing.
1990
+ *
1991
+ * Regenerate via the SDK freshness gate. A freshness check runs at publish
1992
+ * time and fails if this file diverges from the live pricing surface.
1993
+ *
1994
+ * Canonical source of truth for x402 pricing and advertised tool counts inside
1995
+ * the SDK. Consumers should import from "@truealter/sdk" (re-exported via
1996
+ * index.ts), not from this module directly.
1997
+ */
1998
+ /** Tool tier per invocation (0=free / L0, 1=L1, 2=L2, 3=L3, 4=L4, 5=L5). */
1999
+ declare const GENERATED_TOOL_TIERS: Record<string, number>;
2000
+ /** Price in USD per tool invocation. Mirrors the live MCP pricing surface. */
2001
+ declare const GENERATED_TOOL_PRICING: Record<string, number>;
2002
+ /** Flat price per tier in USD. L0 is always free. */
2003
+ declare const TIER_PRICES: Record<string, number>;
2004
+ /** Publicly advertised tool counts. Mirrors canonical-facts.json public_advertised. */
2005
+ declare const ADVERTISED_TOOL_COUNTS: {
2006
+ /** Free (L0) tools visible to anonymous / agent-class callers. */
2007
+ readonly free: 27;
2008
+ /** Premium (L1-L5) tools requiring x402 payment. */
2009
+ readonly premium: 9;
2010
+ /** Messaging tools (member-self-only; excluded from external advertisement). */
2011
+ readonly messaging: 0;
2012
+ /** Total publicly advertised (free + premium). */
2013
+ readonly total: 36;
2014
+ };
2015
+ /** x402 settlement revenue split. Weaver = the data subject earning Identity Income. */
2016
+ declare const REVENUE_SPLIT: {
2017
+ readonly weaver: 0.75;
2018
+ readonly facilitator: 0.05;
2019
+ readonly alter: 0.15;
2020
+ readonly treasury: 0.05;
2021
+ };
2022
+
2023
+ /**
2024
+ * @truealter/sdk: alter_homepage MCP tool types
1668
2025
  *
1669
2026
  * Wire-format types for the user-authored, externally-queryable identity
1670
2027
  * homepage surface.
@@ -1692,7 +2049,7 @@ type HomepageFieldProvenance = "declared" | "derived" | "attested";
1692
2049
  /**
1693
2050
  * One field of a HomepageManifest. Every field carries its provenance
1694
2051
  * class so MCP consumers can render appropriately. The `value` shape is
1695
- * field-specific this is a discriminated parent; consumers should
2052
+ * field-specific: this is a discriminated parent; consumers should
1696
2053
  * narrow on the manifest's field name, not on `value`'s runtime shape.
1697
2054
  */
1698
2055
  interface HomepageField<T = unknown> {
@@ -1709,7 +2066,7 @@ interface HomepageField<T = unknown> {
1709
2066
  /**
1710
2067
  * The wire-format manifest returned by `alter_homepage(handle)`.
1711
2068
  *
1712
- * Fields are individually optional a HomepageManifest with only a
2069
+ * Fields are individually optional: a HomepageManifest with only a
1713
2070
  * handle and an opener is valid. MCP consumers MUST NOT assume any
1714
2071
  * field other than `handle` is present.
1715
2072
  */
@@ -1731,14 +2088,24 @@ interface HomepageManifest {
1731
2088
  opener?: HomepageField<string>;
1732
2089
  /**
1733
2090
  * 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
2091
+ * sigil is a string of renderer-recognised primitive references:
2092
+ * not raw glyph codes: so different consumers can render the same
1736
2093
  * sigil distinctly. Provenance is `declared` for user-composed,
1737
2094
  * `derived` for sigil-from-thread-graph crystallisation.
1738
2095
  */
1739
2096
  sigil?: HomepageField<string>;
1740
2097
  /** User's pronouns (already-shipped surface). Always declared. */
1741
2098
  pronouns?: HomepageField<string>;
2099
+ /**
2100
+ * User-authored contact email, surfaced so a verified caller reading
2101
+ * the homepage can reach the holder. Maximum 254 chars (RFC 5321
2102
+ * envelope limit) after NFC normalisation. Always declared-provenance
2103
+ *: the user wrote it into their config; it is NOT the account's
2104
+ * verified login email (that lives encrypted server-side and is never
2105
+ * surfaced here). A holder who sets no `contact_email` simply omits
2106
+ * the field.
2107
+ */
2108
+ contact_email?: HomepageField<string>;
1742
2109
  /**
1743
2110
  * List of recognised Seat glyphs the holder is bound to. Provenance
1744
2111
  * is always `attested` (ceremony-attested, server-side resolved);
@@ -1756,7 +2123,7 @@ interface HomepageManifest {
1756
2123
  /**
1757
2124
  * Optional, opt-in per query context. Coarse Golden-Thread summary;
1758
2125
  * provenance is `derived`. MCP consumers MUST NOT request this field
1759
- * by default only on explicit per-call consent. Consumers in the
2126
+ * by default: only on explicit per-call consent. Consumers in the
1760
2127
  * workplace/education vertical MUST NOT request this field at all
1761
2128
  * (clause-4 caller-context gate).
1762
2129
  */
@@ -1766,6 +2133,14 @@ interface HomepageManifest {
1766
2133
  * Consumers are free to ignore. Provenance is always `declared`.
1767
2134
  */
1768
2135
  render_hints?: HomepageField<Record<string, unknown>>;
2136
+ /**
2137
+ * Reserved inner-face slot. NEVER populated on a HomepageManifest returned
2138
+ * by `alter_homepage`: the homepage is the outward-facing identity surface,
2139
+ * and the inside face is held empty by construction. The field exists only
2140
+ * so consumers and forward-compatible schemas can name the slot; a manifest
2141
+ * carrying a value here is malformed and consumers MUST ignore it.
2142
+ */
2143
+ reserved_inner?: never;
1769
2144
  }
1770
2145
  /**
1771
2146
  * Input arguments for the `alter_homepage` MCP tool.
@@ -1780,7 +2155,7 @@ interface HomepageInput {
1780
2155
  /**
1781
2156
  * Optional whitelist of field names. If omitted, the server returns
1782
2157
  * all fields the caller is permitted to read. Unknown field names
1783
- * are silently ignored (forward-compatible adding a new field does
2158
+ * are silently ignored (forward-compatible: adding a new field does
1784
2159
  * not break old consumers).
1785
2160
  */
1786
2161
  fields?: readonly (keyof HomepageManifest)[];
@@ -1813,21 +2188,21 @@ interface HomepageOutput {
1813
2188
  */
1814
2189
  type HomepageCallerVertical = "workplace" | "education" | "personal" | "civic" | "agent" | "unknown";
1815
2190
  /** 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). */
2191
+ * input before sending. Mirrored from the ALTER portfolio manifest spec v1
2192
+ * (forthcoming). */
1818
2193
  declare const HOMEPAGE_LIMITS: {
1819
2194
  readonly whoami_max_chars: 240;
1820
2195
  readonly opener_max_chars: 280;
1821
2196
  readonly pronouns_max_chars: 32;
1822
2197
  readonly attunement_glyph_max_chars: 16;
2198
+ readonly contact_email_max_chars: 254;
1823
2199
  };
1824
2200
 
1825
2201
  /**
1826
- * @truealter/sdk theme pack types
2202
+ * @truealter/sdk: theme pack types
1827
2203
  *
1828
2204
  * 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`.
2205
+ * manifests. The full specification lives in the ALTER theme pack spec v1.
1831
2206
  *
1832
2207
  * These types describe the on-the-wire shape of theme manifests as they
1833
2208
  * are produced by `alter theme install`, persisted to `themes.lock`,
@@ -1853,13 +2228,13 @@ interface ThemeMeta {
1853
2228
  name: string;
1854
2229
  /** SemVer-shaped recommended; informational only. Resolution uses pack_id. */
1855
2230
  version: string;
1856
- /** MUST be a ~handle whose D-ID8 public key signs the pack. */
2231
+ /** MUST be a ~handle whose signing public key signs the pack. */
1857
2232
  author: string;
1858
2233
  /** ≤ 240 characters after NFC. */
1859
2234
  description: string;
1860
- /** OPTIONAL surfaced by curated resolvers; not rendered by ALTER. */
2235
+ /** OPTIONAL: surfaced by curated resolvers; not rendered by ALTER. */
1861
2236
  repo?: string;
1862
- /** OPTIONAL surfaced by curated resolvers; not rendered by ALTER. */
2237
+ /** OPTIONAL: surfaced by curated resolvers; not rendered by ALTER. */
1863
2238
  docs_url?: string;
1864
2239
  }
1865
2240
  /** `[palette]` section. Renderer enforces gamut; out-of-gamut packs are rejected. */
@@ -1893,7 +2268,7 @@ interface ThemeRenderHints {
1893
2268
  }
1894
2269
  /** `[assets]` section. Paths MUST be repo-relative without `..` segments. */
1895
2270
  interface ThemeAssets {
1896
- /** Optional if omitted, no assets are loaded. */
2271
+ /** Optional: if omitted, no assets are loaded. */
1897
2272
  glyphs?: readonly string[];
1898
2273
  }
1899
2274
  /**
@@ -1915,7 +2290,7 @@ interface ThemeManifestV1 {
1915
2290
  }
1916
2291
  /**
1917
2292
  * The `.sig` file accompanying every pack. Verification logic lives in
1918
- * `alter-cli/src/theme/sign.ts`; this is the wire-format type only.
2293
+ * the CLI client; this is the wire-format type only.
1919
2294
  */
1920
2295
  interface ThemeSignatureManifest {
1921
2296
  /** SHA-256 multihash of the canonical-form pack. */
@@ -1943,7 +2318,7 @@ interface ThemeLockEntry {
1943
2318
  }
1944
2319
  /**
1945
2320
  * The user-side composition manifest. This is the publishable artefact
1946
- * what someone shares when they say "here is my ALTER".
2321
+ *: what someone shares when they say "here is my ALTER".
1947
2322
  *
1948
2323
  * Re-applying the same lockfile against the same renderer version MUST
1949
2324
  * produce a bit-identical render, modulo the `attunement_glyph` field
@@ -1951,7 +2326,7 @@ interface ThemeLockEntry {
1951
2326
  */
1952
2327
  interface ThemesLockV1 {
1953
2328
  schema_version: 1;
1954
- /** e.g. "alter-cli/0.5.0" informational, not load-bearing. */
2329
+ /** Free-form producer tag, e.g. "@truealter/cli/1.0.0", informational only. */
1955
2330
  generated_by: string;
1956
2331
  /** RFC 3339 UTC timestamp at lockfile-write time. */
1957
2332
  generated_at: string;
@@ -1990,7 +2365,7 @@ interface ThemeShareOutput {
1990
2365
  message: string;
1991
2366
  };
1992
2367
  }
1993
- /** v1 schema constants. Mirror the spec at docs/technical/alter-theme-pack-spec-v1.md. */
2368
+ /** v1 schema constants. Mirror the ALTER theme pack spec v1. */
1994
2369
  declare const THEME_LIMITS: {
1995
2370
  readonly meta_name_pattern: RegExp;
1996
2371
  readonly meta_description_max_chars: 240;
@@ -2003,11 +2378,11 @@ declare const OSC8_ALLOWED_SCHEMES: readonly ["https:", "mailto:"];
2003
2378
  type Osc8AllowedScheme = (typeof OSC8_ALLOWED_SCHEMES)[number];
2004
2379
 
2005
2380
  /**
2006
- * Package metadata kept in a standalone module so deep imports from
2381
+ * Package metadata: kept in a standalone module so deep imports from
2007
2382
  * `src/wire/` can reference version constants without creating a
2008
2383
  * circular dependency through `src/index.ts`.
2009
2384
  */
2010
2385
  declare const SDK_NAME = "@truealter/sdk";
2011
- declare const SDK_VERSION = "0.3.0";
2386
+ declare const SDK_VERSION: string;
2012
2387
 
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 };
2388
+ export { ADVERTISED_TOOL_COUNTS, 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, BelowFloorError, CLAUDE_CODE, CLAUDE_DESKTOP, CLIENT_CHANNEL, CLIENT_ID, CURSOR, type ChannelFloor, type CheckAssessmentStatusInput, type CheckAssessmentStatusOutput, type CheckGoldenThreadInput, type CheckGoldenThreadOutput, type CheckMinVersionOptions, type ClaudeDesktopConfig, type ClaudeDesktopServerConfig, type ClientBelowFloorEnvelope, 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 FloorDocument, GENERATED_TOOL_PRICING, GENERATED_TOOL_TIERS, 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, KNOWN_FLOOR_PUBLIC_KEYS, 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, MIN_VERSION_ENDPOINT, type MatchTier, type McpServerConfig, OSC8_ALLOWED_SCHEMES, type Osc8AllowedScheme, PREMIUM_TOOL_NAMES, type PaletteFloorV1, type PaletteText, type PanelDensity, type PaymentEnvelope, type PreflightResult, type ProbeResult, type ProvenanceEnvelope, type ProvenancePayload, type ProvenanceToken, type ProvenanceVerification, type QueryGraphSimilarityInput, type QueryGraphSimilarityOutput, type QueryMatchesInput, type QueryMatchesOutput, REVENUE_SPLIT, type RecommendToolInput, type RecommendToolOutput, SDK_NAME, SDK_VERSION, type SearchIdentitiesInput, type SearchIdentitiesOutput, type SignInvocationOptions, type SignedToolDefinition, type StatusLineDensity, type StatusLineSlot, THEME_LIMITS, TIER_PRICES, 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, canonicalJson, canonicalStringify, checkMinVersion, clearDiscoveryCache, compareSemver, computeKeyId, decodeDid, detectSyncedVolume, discover, encodeDid, fetchPublicKeys, generateClaudeConfig, generateClaudeDesktopConfig, generateCursorConfig, generateGenericMcpConfig, generateKeypair, keypairFromPrivateKey, loadPrivateKey, parsePaymentHeader, probeAll, probeByDir, probeClaudeCode, readWireState, resolveVerifyAt, sha256, sign, signInvocation, unwire, verify, verifyFloorSignature, verifyProvenance, verifyToolSignatures, wire, writeWireState };