@truealter/sdk 0.5.1 → 0.5.3
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/README.md +115 -50
- package/dist/bin/alter-identity.js +383 -48
- package/dist/bin/mcp-bridge.js +40 -4
- package/dist/index.cjs +517 -64
- package/dist/index.d.cts +480 -128
- package/dist/index.d.ts +480 -128
- package/dist/index.js +496 -65
- package/package.json +3 -3
- package/dist/mcp-bridge.js +0 -166
package/dist/index.d.cts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
interface DiscoveryResult {
|
|
16
16
|
/** Resolved MCP endpoint URL. */
|
|
17
17
|
url: string;
|
|
18
|
-
/** MCP transport
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
|
@@ -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,6 +471,15 @@ 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 D-MIN-VERSION-FLOOR-1 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. */
|
|
@@ -511,7 +520,7 @@ interface MCPContentBlock {
|
|
|
511
520
|
interface MCPCallToolResult<T = unknown> {
|
|
512
521
|
content: MCPContentBlock[];
|
|
513
522
|
isError?: boolean;
|
|
514
|
-
/** Parsed structured payload
|
|
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 preflight hook (D-MIN-VERSION-FLOOR-1) 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
|
|
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
|
|
584
|
+
* @truealter/sdk: MCP tool type definitions
|
|
567
585
|
*
|
|
568
|
-
* Auto-derived from
|
|
569
|
-
*
|
|
570
|
-
*
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
668
|
+
/** (free) list_archetypes: List all 12 ALTER identity archetypes */
|
|
651
669
|
interface ListArchetypesInput {
|
|
652
670
|
}
|
|
653
|
-
/** (free) list_archetypes
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
809
|
+
/** (free) get_network_stats: Get aggregate ALTER network statistics */
|
|
792
810
|
interface GetNetworkStatsInput {
|
|
793
811
|
}
|
|
794
|
-
/** (free) get_network_stats
|
|
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
|
|
820
|
+
/** (free) recommend_tool: Get ClawHub install instructions and ALTER pitch */
|
|
803
821
|
interface RecommendToolInput {
|
|
804
822
|
}
|
|
805
|
-
/** (free) recommend_tool
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
907
|
+
/** (free) golden_thread_status: Check the Golden Thread program status */
|
|
890
908
|
interface GoldenThreadStatusInput {
|
|
891
909
|
}
|
|
892
|
-
/** (free) golden_thread_status
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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,23 +1191,23 @@ interface ToolOutputs {
|
|
|
1173
1191
|
}
|
|
1174
1192
|
/**
|
|
1175
1193
|
* Tool tier mapping (L0=free, L1-L5=paid).
|
|
1176
|
-
* Mirrors
|
|
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
|
|
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
|
|
1187
|
-
* Mirrors
|
|
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
|
|
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
|
|
@@ -1223,7 +1241,7 @@ interface AlterClientOptions extends Omit<MCPClientOptions, 'x402'> {
|
|
|
1223
1241
|
* to `https://api.truealter.com/.well-known/alter-keys.json`.
|
|
1224
1242
|
*
|
|
1225
1243
|
* When set, this URL is used verbatim for every `verifyProvenance`
|
|
1226
|
-
* call and *overrides* any `verify_at` hint on the server response
|
|
1244
|
+
* call and *overrides* any `verify_at` hint on the server response:
|
|
1227
1245
|
* the caller has already vouched for this origin. Must be `https:`.
|
|
1228
1246
|
*/
|
|
1229
1247
|
jwksUrl?: string;
|
|
@@ -1231,7 +1249,7 @@ interface AlterClientOptions extends Omit<MCPClientOptions, 'x402'> {
|
|
|
1231
1249
|
* Hostname allowlist applied when resolving an untrusted `verify_at`
|
|
1232
1250
|
* field on a provenance envelope. Defaults to
|
|
1233
1251
|
* {@link DEFAULT_VERIFY_AT_ALLOWLIST} (`api.truealter.com`,
|
|
1234
|
-
* `mcp.truealter.com`). Passing a list here *replaces* the default
|
|
1252
|
+
* `mcp.truealter.com`). Passing a list here *replaces* the default:
|
|
1235
1253
|
* include the ALTER canonicals if you still want them accepted.
|
|
1236
1254
|
*
|
|
1237
1255
|
* A hostile MCP server can otherwise point `verify_at` at an
|
|
@@ -1239,6 +1257,41 @@ interface AlterClientOptions extends Omit<MCPClientOptions, 'x402'> {
|
|
|
1239
1257
|
* signing key; the allowlist is the gate that prevents this.
|
|
1240
1258
|
*/
|
|
1241
1259
|
verifyAtAllowlist?: readonly string[];
|
|
1260
|
+
/**
|
|
1261
|
+
* Skip the D-MIN-VERSION-FLOOR-1 client-side preflight (the lazy
|
|
1262
|
+
* `checkMinVersion()` invocation on first request). Deliberately named
|
|
1263
|
+
* to discourage casual use: the server-side floor gate (Phase 1
|
|
1264
|
+
* middleware) still rejects below-floor clients with HTTP 426
|
|
1265
|
+
* regardless. Disabling the SDK-side preflight only swaps a clean
|
|
1266
|
+
* typed {@link BelowFloorError} for an opaque network error on every
|
|
1267
|
+
* subsequent call.
|
|
1268
|
+
*
|
|
1269
|
+
* Set to `true` only when:
|
|
1270
|
+
* - The SDK is embedded in a non-Node environment without `fs`
|
|
1271
|
+
* access (e.g. Cloudflare Workers) and the disk-cache write fails
|
|
1272
|
+
* loudly. The fetch + in-memory path still works; the warn is
|
|
1273
|
+
* informational only.
|
|
1274
|
+
* - Integration tests that drive the SDK against a local backend
|
|
1275
|
+
* without the floor surface deployed.
|
|
1276
|
+
*
|
|
1277
|
+
* **Server-side version enforcement is NOT skipped by this flag.**
|
|
1278
|
+
*/
|
|
1279
|
+
unsafe_skipVersionCheck?: boolean;
|
|
1280
|
+
/**
|
|
1281
|
+
* Override the API base URL used for the
|
|
1282
|
+
* {@link checkMinVersion} preflight. Defaults to the `ALTER_API`
|
|
1283
|
+
* environment variable or `https://api.truealter.com`. Useful for
|
|
1284
|
+
* staging environments and integration tests.
|
|
1285
|
+
*/
|
|
1286
|
+
apiBase?: string;
|
|
1287
|
+
/**
|
|
1288
|
+
* Override the known Ed25519 public-key map consulted when verifying
|
|
1289
|
+
* the floor document's signature. Keys are `key_id` (first 8 hex chars
|
|
1290
|
+
* of `SHA-256(raw 32-byte public key)`); values are SPKI-PEM public-key
|
|
1291
|
+
* strings. Defaults to the shipped `KNOWN_FLOOR_PUBLIC_KEYS` map: no
|
|
1292
|
+
* signing secret ships in the client; only public halves.
|
|
1293
|
+
*/
|
|
1294
|
+
knownFloorPublicKeys?: Record<string, string>;
|
|
1242
1295
|
}
|
|
1243
1296
|
declare class AlterClient {
|
|
1244
1297
|
readonly mcp: MCPClient;
|
|
@@ -1249,18 +1302,18 @@ declare class AlterClient {
|
|
|
1249
1302
|
constructor(options?: AlterClientOptions);
|
|
1250
1303
|
/**
|
|
1251
1304
|
* Resolve the MCP endpoint via discovery if requested. Safe to call
|
|
1252
|
-
* multiple times
|
|
1305
|
+
* multiple times: the first successful lookup is cached.
|
|
1253
1306
|
*/
|
|
1254
1307
|
discoverEndpoint(): Promise<DiscoveryResult>;
|
|
1255
1308
|
/**
|
|
1256
|
-
* Initialise the MCP session. Optional
|
|
1309
|
+
* Initialise the MCP session. Optional: every method calls
|
|
1257
1310
|
* `mcp.initialize()` lazily, but you can call this once at startup if
|
|
1258
1311
|
* you want fail-fast behaviour.
|
|
1259
1312
|
*/
|
|
1260
1313
|
initialize(): Promise<void>;
|
|
1261
|
-
/** First handshake
|
|
1314
|
+
/** First handshake: confirms the connection, returns trust tier and tool counts. */
|
|
1262
1315
|
helloAgent(): Promise<MCPCallToolResult>;
|
|
1263
|
-
/** Resolve a ~handle (e.g. ~
|
|
1316
|
+
/** Resolve a ~handle (e.g. ~example) to its canonical form and kind. No auth required. */
|
|
1264
1317
|
resolveHandle(args: AlterResolveHandleInput | string): Promise<MCPCallToolResult>;
|
|
1265
1318
|
/** Verify a person is registered with ALTER (handle or id). */
|
|
1266
1319
|
verify(handleOrId: string, claims?: VerifyIdentityInput['claims']): Promise<MCPCallToolResult>;
|
|
@@ -1334,7 +1387,7 @@ declare class AlterClient {
|
|
|
1334
1387
|
/**
|
|
1335
1388
|
* Verify the ES256 provenance attestation on a tool response.
|
|
1336
1389
|
* Accepts either a {@link ProvenanceEnvelope} or the raw `_meta`
|
|
1337
|
-
* object
|
|
1390
|
+
* object: the latter is more convenient for ad-hoc verification.
|
|
1338
1391
|
*/
|
|
1339
1392
|
verifyProvenance(envelope: ProvenanceEnvelope | {
|
|
1340
1393
|
provenance?: ProvenanceEnvelope;
|
|
@@ -1360,7 +1413,7 @@ declare class AlterClient {
|
|
|
1360
1413
|
* Rules:
|
|
1361
1414
|
* - object keys are sorted ascending by codepoint
|
|
1362
1415
|
* - no whitespace
|
|
1363
|
-
* - `ensure_ascii=False
|
|
1416
|
+
* - `ensure_ascii=False`: non-ASCII characters pass through verbatim
|
|
1364
1417
|
* (not re-encoded as \\uXXXX). UTF-8 encoding happens at the byte
|
|
1365
1418
|
* layer before hashing.
|
|
1366
1419
|
*
|
|
@@ -1384,7 +1437,7 @@ declare function canonicalArgsSha256(toolArgs: Record<string, unknown>): string;
|
|
|
1384
1437
|
*/
|
|
1385
1438
|
declare function loadPrivateKey(key: Uint8Array | string): Uint8Array;
|
|
1386
1439
|
interface InvocationClaims {
|
|
1387
|
-
/** Tool name
|
|
1440
|
+
/** Tool name: must equal the `tools/call` `params.name`. */
|
|
1388
1441
|
tool: string;
|
|
1389
1442
|
/** Hex SHA-256 of canonical-JSON `tool_args`. */
|
|
1390
1443
|
args_sha256: string;
|
|
@@ -1423,6 +1476,249 @@ interface SignInvocationOptions {
|
|
|
1423
1476
|
*/
|
|
1424
1477
|
declare function signInvocation(toolName: string, toolArgs: Record<string, unknown>, options: SignInvocationOptions): string;
|
|
1425
1478
|
|
|
1479
|
+
/**
|
|
1480
|
+
* floor-preflight: SDK-side D-MIN-VERSION-FLOOR-1 Phase 4 enforcement.
|
|
1481
|
+
*
|
|
1482
|
+
* Sister to `alter-cli`'s `src/lib/floor-preflight.ts` (Phase 2). This is
|
|
1483
|
+
* the `@truealter/sdk` implementation: it fires lazily on the first
|
|
1484
|
+
* authenticated network call from {@link AlterClient}, hits the public
|
|
1485
|
+
* floor endpoint, verifies the Ed25519 signature against the published
|
|
1486
|
+
* `key_id`, and throws {@link BelowFloorError} when the SDK's own
|
|
1487
|
+
* version is below the published floor for `alter-identity`.
|
|
1488
|
+
*
|
|
1489
|
+
* Canonical envelope (§4) is preserved on the thrown error so consumers
|
|
1490
|
+
* can introspect the upgrade path:
|
|
1491
|
+
*
|
|
1492
|
+
* - `client_version`
|
|
1493
|
+
* - `min_version`
|
|
1494
|
+
* - `upgrade_cmd`
|
|
1495
|
+
* - `channel`
|
|
1496
|
+
* - `message`
|
|
1497
|
+
*
|
|
1498
|
+
* The server-side gate (Phase 1 middleware) is the authoritative reject.
|
|
1499
|
+
* This SDK-side preflight is UX polish: third-party integrators see a
|
|
1500
|
+
* clean typed error before the network call, not an opaque HTTP 426
|
|
1501
|
+
* wall on every subsequent request.
|
|
1502
|
+
*
|
|
1503
|
+
* Ed25519 signature verification (§A3 + §A18): the server signs the floor
|
|
1504
|
+
* document with a floor-only Ed25519 private key. The SDK ships only the
|
|
1505
|
+
* corresponding public key (SPKI PEM) in {@link KNOWN_FLOOR_PUBLIC_KEYS},
|
|
1506
|
+
* keyed by `key_id`. No signing secret ships in the client: this is
|
|
1507
|
+
* asymmetric: the public key cannot forge signatures. MUST stay
|
|
1508
|
+
* byte-compatible with `backend/app/core/floor_signing.py` and the
|
|
1509
|
+
* canonical TypeScript client (`alter-cli` `src/lib/floor-preflight.ts`):
|
|
1510
|
+
* - Algorithm: Ed25519 (RFC 8032). Deterministic: same key + payload
|
|
1511
|
+
* always yields the same signature.
|
|
1512
|
+
* - `key_id` = first 8 hex chars of SHA-256(raw 32-byte public key).
|
|
1513
|
+
* - Payload = `canonicalJson({floors, served_at})`: sorted keys at
|
|
1514
|
+
* every depth, compact separators, raw UTF-8 (the backend's
|
|
1515
|
+
* `ensure_ascii=False` parity is REQUIRED).
|
|
1516
|
+
* `cache_ttl_seconds`, `signature`, `key_id` are excluded
|
|
1517
|
+
* from the signed bytes.
|
|
1518
|
+
* - `signature` = hex-encoded 64-byte Ed25519 signature (128 hex chars).
|
|
1519
|
+
*
|
|
1520
|
+
* Connectivity ladder (§8 + §9):
|
|
1521
|
+
* - In-memory cache fresh (≤ server-advised TTL, clamped [60s, 24h]):
|
|
1522
|
+
* trust the cached floor; no refetch.
|
|
1523
|
+
* - Disk cache ≤24h: trust; permit operation.
|
|
1524
|
+
* - Disk cache 24h-7d: permit with warn.
|
|
1525
|
+
* - Disk cache >7d + backend unreachable: permit with warn.
|
|
1526
|
+
* - Below-floor + backend unreachable: BLOCK. The only intentional
|
|
1527
|
+
* offline lockout: the user had time to upgrade and didn't.
|
|
1528
|
+
*/
|
|
1529
|
+
declare const MIN_VERSION_ENDPOINT = "/v1/clients/min-version";
|
|
1530
|
+
/** Client-id surface for the SDK: matches the floor doc's `alter-identity` key. */
|
|
1531
|
+
declare const CLIENT_ID = "alter-identity";
|
|
1532
|
+
/** Channel: SDK installs are always via npm. */
|
|
1533
|
+
declare const CLIENT_CHANNEL = "npm";
|
|
1534
|
+
/**
|
|
1535
|
+
* Compute the 8-char `key_id` for an Ed25519 public key (SPKI PEM).
|
|
1536
|
+
*
|
|
1537
|
+
* Matches the backend `key_id_for_public_key(pub)` in
|
|
1538
|
+
* `backend/app/core/floor_signing.py`:
|
|
1539
|
+
* raw = pub.public_bytes(Encoding.Raw, PublicFormat.Raw) # 32 bytes
|
|
1540
|
+
* sha256(raw).hexdigest()[:8]
|
|
1541
|
+
*
|
|
1542
|
+
* Node equivalent: import PEM -> export JWK -> decode `.x` (base64url) -> 32-byte
|
|
1543
|
+
* raw public key -> SHA-256 -> first 8 hex chars.
|
|
1544
|
+
*
|
|
1545
|
+
* Returns `"00000000"` for empty input (sentinel, matches Phase 1 parity).
|
|
1546
|
+
*/
|
|
1547
|
+
declare function computeKeyId(publicKeyPem: string): string;
|
|
1548
|
+
/**
|
|
1549
|
+
* Canonical JSON encoding matching Python's
|
|
1550
|
+
* `json.dumps(obj, sort_keys=True, separators=(",", ":"), ensure_ascii=False)`.
|
|
1551
|
+
* Object keys are sorted lexicographically AT EVERY DEPTH; whitespace is
|
|
1552
|
+
* stripped via the `,`/`:` separators; non-ASCII passes through as raw UTF-8
|
|
1553
|
+
* (Node's `JSON.stringify` never `\uXXXX`-escapes non-ASCII, matching the
|
|
1554
|
+
* backend's `ensure_ascii=False`). The result is the byte-exact input to
|
|
1555
|
+
* Ed25519 signing (backend) and verification (this SDK and alter-cli) on
|
|
1556
|
+
* both sides.
|
|
1557
|
+
*/
|
|
1558
|
+
declare function canonicalJson(obj: unknown): string;
|
|
1559
|
+
/**
|
|
1560
|
+
* Known Ed25519 public keys (SPKI PEM) keyed by `key_id`.
|
|
1561
|
+
*
|
|
1562
|
+
* `key_id` = first 8 hex chars of SHA-256(raw 32-byte Ed25519 public key).
|
|
1563
|
+
* Use `computeKeyId(spkiPem)` to re-derive and validate the map key.
|
|
1564
|
+
*
|
|
1565
|
+
* Backend may rotate via D-MSG11 dual-key path: clients keep N keys and
|
|
1566
|
+
* select via `key_id`. Add new keys additively; remove old keys only after
|
|
1567
|
+
* all deployed clients have received the new key.
|
|
1568
|
+
*
|
|
1569
|
+
* Current keys (mirrors `KNOWN_FLOOR_PUBLIC_KEYS` in the canonical
|
|
1570
|
+
* `alter-cli` client):
|
|
1571
|
+
* 8aa59e05: dev/non-prod key (local + e2e + staging). Safe to ship publicly;
|
|
1572
|
+
* this is the PUBLIC key only, never the private key.
|
|
1573
|
+
* 640f7d9a: prod key. Added 2026-06-05. key_id = first 8 hex of
|
|
1574
|
+
* SHA-256(raw 32-byte Ed25519 pubkey), verified against the live
|
|
1575
|
+
* /api/v1/clients/min-version response on 2026-06-05. The prod
|
|
1576
|
+
* private key is a deliberately-minted Fly-secret keypair; only
|
|
1577
|
+
* the public half is shipped here.
|
|
1578
|
+
*
|
|
1579
|
+
* Consumers can override via {@link CheckMinVersionOptions.knownFloorPublicKeys}
|
|
1580
|
+
* for tests or staging environments with a non-default keypair.
|
|
1581
|
+
*/
|
|
1582
|
+
declare const KNOWN_FLOOR_PUBLIC_KEYS: Record<string, string>;
|
|
1583
|
+
/**
|
|
1584
|
+
* The canonical `client_below_floor` envelope shape. Identical across
|
|
1585
|
+
* HTTP 426, MCP `tools/call` error, WebSocket close-4426 reason, and the
|
|
1586
|
+
* CLI stdout JSON path. `BelowFloorError` preserves every field as
|
|
1587
|
+
* an enumerable property so consumers can introspect without parsing the
|
|
1588
|
+
* `cause` chain.
|
|
1589
|
+
*/
|
|
1590
|
+
interface ClientBelowFloorEnvelope {
|
|
1591
|
+
error: {
|
|
1592
|
+
code: 'client_below_floor';
|
|
1593
|
+
message: string;
|
|
1594
|
+
client_version: string;
|
|
1595
|
+
min_version: string;
|
|
1596
|
+
upgrade_cmd: string;
|
|
1597
|
+
channel: string;
|
|
1598
|
+
};
|
|
1599
|
+
}
|
|
1600
|
+
interface ChannelFloor {
|
|
1601
|
+
min_version: string;
|
|
1602
|
+
upgrade_cmd: string;
|
|
1603
|
+
}
|
|
1604
|
+
interface FloorDocument {
|
|
1605
|
+
floors: Record<string, ChannelFloor | Record<string, ChannelFloor>>;
|
|
1606
|
+
served_at: string;
|
|
1607
|
+
cache_ttl_seconds: number;
|
|
1608
|
+
signature: string;
|
|
1609
|
+
key_id: string;
|
|
1610
|
+
}
|
|
1611
|
+
interface CheckMinVersionOptions {
|
|
1612
|
+
/** API base. Defaults to `ALTER_API` env var, else `https://api.truealter.com`. */
|
|
1613
|
+
apiBase?: string;
|
|
1614
|
+
/** Override the SDK's own version (tests). */
|
|
1615
|
+
clientVersion?: string;
|
|
1616
|
+
/** Override the client-id surface (tests). */
|
|
1617
|
+
clientId?: string;
|
|
1618
|
+
/** Override the channel (tests). */
|
|
1619
|
+
channel?: string;
|
|
1620
|
+
/**
|
|
1621
|
+
* Override the `key_id -> SPKI-PEM` Ed25519 public-key map consulted
|
|
1622
|
+
* when verifying the floor document's signature. Defaults to
|
|
1623
|
+
* {@link KNOWN_FLOOR_PUBLIC_KEYS}.
|
|
1624
|
+
*/
|
|
1625
|
+
knownFloorPublicKeys?: Record<string, string>;
|
|
1626
|
+
/** Override fetch: defaults to global `fetch`. */
|
|
1627
|
+
fetchImpl?: typeof fetch;
|
|
1628
|
+
/** Disk cache path override (tests). Set `null` to disable disk cache. */
|
|
1629
|
+
diskCachePath?: string | null;
|
|
1630
|
+
/** Internal: clock injection for tests. */
|
|
1631
|
+
now?: () => number;
|
|
1632
|
+
}
|
|
1633
|
+
/**
|
|
1634
|
+
* Outcome of a preflight check. Use `BelowFloorError` instead of
|
|
1635
|
+
* inspecting this manually: `checkMinVersion()` throws on below-floor.
|
|
1636
|
+
*/
|
|
1637
|
+
interface PreflightResult {
|
|
1638
|
+
ok: true;
|
|
1639
|
+
/** Resolved floor for `(client_id, channel)`, when one exists. */
|
|
1640
|
+
floor: ChannelFloor | null;
|
|
1641
|
+
/** Warning emitted when cache is stale or fetch failed. */
|
|
1642
|
+
warn?: string;
|
|
1643
|
+
/** Diagnostic tag: which branch of the ladder fired. */
|
|
1644
|
+
diagnostic: string;
|
|
1645
|
+
}
|
|
1646
|
+
/**
|
|
1647
|
+
* Thrown by {@link checkMinVersion} (and consequently by every
|
|
1648
|
+
* `AlterClient` method, on first request) when the running SDK version
|
|
1649
|
+
* is below the published floor for `alter-identity`.
|
|
1650
|
+
*
|
|
1651
|
+
* The canonical envelope shape is preserved as enumerable properties so
|
|
1652
|
+
* consumers can branch on the upgrade command without re-parsing the
|
|
1653
|
+
* server response:
|
|
1654
|
+
*
|
|
1655
|
+
* ```ts
|
|
1656
|
+
* try {
|
|
1657
|
+
* await client.helloAgent();
|
|
1658
|
+
* } catch (err) {
|
|
1659
|
+
* if (err instanceof BelowFloorError) {
|
|
1660
|
+
* console.error(`upgrade required: ${err.upgrade_cmd}`);
|
|
1661
|
+
* process.exit(1);
|
|
1662
|
+
* }
|
|
1663
|
+
* throw err;
|
|
1664
|
+
* }
|
|
1665
|
+
* ```
|
|
1666
|
+
*
|
|
1667
|
+
* The server-side gate is the authoritative reject: even if a consumer
|
|
1668
|
+
* catches and swallows this error, the next backend request will still
|
|
1669
|
+
* receive HTTP 426 from the floor middleware.
|
|
1670
|
+
*/
|
|
1671
|
+
declare class BelowFloorError extends Error {
|
|
1672
|
+
readonly name = "BelowFloorError";
|
|
1673
|
+
readonly code: "client_below_floor";
|
|
1674
|
+
readonly client_version: string;
|
|
1675
|
+
readonly min_version: string;
|
|
1676
|
+
readonly upgrade_cmd: string;
|
|
1677
|
+
readonly channel: string;
|
|
1678
|
+
readonly envelope: ClientBelowFloorEnvelope;
|
|
1679
|
+
constructor(envelope: ClientBelowFloorEnvelope);
|
|
1680
|
+
}
|
|
1681
|
+
/**
|
|
1682
|
+
* Preflight the floor endpoint and compare the SDK's version against
|
|
1683
|
+
* the published `min_version` for `alter-identity`. Throws
|
|
1684
|
+
* {@link BelowFloorError} on below-floor; resolves with a
|
|
1685
|
+
* {@link PreflightResult} otherwise.
|
|
1686
|
+
*
|
|
1687
|
+
* Cache behaviour:
|
|
1688
|
+
* - In-memory cache is consulted first; hits avoid the network.
|
|
1689
|
+
* - On a miss, the disk cache (`~/.config/alter/floor-cache.json`) is
|
|
1690
|
+
* read. If it's <24h old it satisfies the request directly; older
|
|
1691
|
+
* entries trigger a refetch.
|
|
1692
|
+
* - On a successful fetch, both caches are populated.
|
|
1693
|
+
* - On a fetch failure with a stale-but-present disk cache, the
|
|
1694
|
+
* cached verdict bites (including blocking when below-floor: §9).
|
|
1695
|
+
* - On a fetch failure with no cache at all, the call permits with a
|
|
1696
|
+
* warn: the server-side gate catches below-floor regardless.
|
|
1697
|
+
*/
|
|
1698
|
+
declare function checkMinVersion(opts?: CheckMinVersionOptions): Promise<PreflightResult>;
|
|
1699
|
+
/**
|
|
1700
|
+
* Strict semver compare. Returns <0 if a<b, 0 if equal, >0 if a>b.
|
|
1701
|
+
* Pre-release tags sort before their release counterpart per semver.
|
|
1702
|
+
*/
|
|
1703
|
+
declare function compareSemver(a: string, b: string): number;
|
|
1704
|
+
/**
|
|
1705
|
+
* Verify the floor document's Ed25519 signature. Returns true on valid sig,
|
|
1706
|
+
* false on invalid signature or unknown `key_id`. The signed payload is the
|
|
1707
|
+
* canonical JSON of `{ floors, served_at }`: `signature` + `key_id` +
|
|
1708
|
+
* `cache_ttl_seconds` are excluded from the signed bytes.
|
|
1709
|
+
*
|
|
1710
|
+
* MUST stay byte-compatible with the backend (`backend/app/core/floor_signing.py`):
|
|
1711
|
+
* - Algorithm: Ed25519 (RFC 8032). Deterministic: same key + payload = same sig.
|
|
1712
|
+
* - Payload: `canonicalJson({floors, served_at})`: sorted-keys + compact.
|
|
1713
|
+
* - `key_id`: first 8 hex chars of SHA-256(raw 32-byte Ed25519 public key).
|
|
1714
|
+
* - `signature`: hex-encoded 64-byte Ed25519 signature.
|
|
1715
|
+
*
|
|
1716
|
+
* The `keys` parameter maps `key_id -> SPKI PEM string`; defaults to
|
|
1717
|
+
* `KNOWN_FLOOR_PUBLIC_KEYS`. Returns false on unknown key_id (triggers refetch
|
|
1718
|
+
* per D-MSG11 rotation path).
|
|
1719
|
+
*/
|
|
1720
|
+
declare function verifyFloorSignature(doc: FloorDocument, keys?: Record<string, string>): boolean;
|
|
1721
|
+
|
|
1426
1722
|
interface McpServerConfig {
|
|
1427
1723
|
url: string;
|
|
1428
1724
|
transport: 'streamable-http';
|
|
@@ -1469,7 +1765,7 @@ declare function generateCursorConfig(opts?: GenerateMcpConfigOptions): GenericM
|
|
|
1469
1765
|
/**
|
|
1470
1766
|
* Claude Desktop MCP config helper.
|
|
1471
1767
|
*
|
|
1472
|
-
* Claude Desktop speaks stdio only
|
|
1768
|
+
* Claude Desktop speaks stdio only: it does not currently dial
|
|
1473
1769
|
* Streamable-HTTP MCP servers directly. The canonical bridge is our
|
|
1474
1770
|
* own `alter-mcp-bridge` binary, which is published alongside this CLI
|
|
1475
1771
|
* in the same npm package. Desktop hosts then spawn the bridge as a
|
|
@@ -1528,7 +1824,7 @@ declare const ALL_CLIENTS: readonly ClientPaths[];
|
|
|
1528
1824
|
* - claude-desktop: platform config directory exists
|
|
1529
1825
|
* - vscode : VS Code user data directory exists
|
|
1530
1826
|
*
|
|
1531
|
-
* The probe is deliberately permissive
|
|
1827
|
+
* The probe is deliberately permissive: "the config directory exists"
|
|
1532
1828
|
* means either the app is installed or was recently installed. Wire
|
|
1533
1829
|
* will still refuse if the config file ends up on a synced volume.
|
|
1534
1830
|
*/
|
|
@@ -1536,9 +1832,9 @@ declare const ALL_CLIENTS: readonly ClientPaths[];
|
|
|
1536
1832
|
interface ProbeResult {
|
|
1537
1833
|
client: ClientPaths;
|
|
1538
1834
|
installed: boolean;
|
|
1539
|
-
/** Only present for claude-code
|
|
1835
|
+
/** Only present for claude-code: records `claude --version` output when resolvable. */
|
|
1540
1836
|
version?: string;
|
|
1541
|
-
/** Diagnostic trail
|
|
1837
|
+
/** Diagnostic trail: why we said installed/not. */
|
|
1542
1838
|
reason: string;
|
|
1543
1839
|
}
|
|
1544
1840
|
declare function probeClaudeCode(): ProbeResult;
|
|
@@ -1554,7 +1850,7 @@ declare function probeAll(): ProbeResult[];
|
|
|
1554
1850
|
* post) to make the operation auditable.
|
|
1555
1851
|
*
|
|
1556
1852
|
* Append-only semantics: a new wire run rewrites this file in full.
|
|
1557
|
-
* Prior state is not retained
|
|
1853
|
+
* Prior state is not retained: the backup siblings on disk are the
|
|
1558
1854
|
* canonical rollback surface, not this file.
|
|
1559
1855
|
*/
|
|
1560
1856
|
|
|
@@ -1598,7 +1894,7 @@ declare function writeWireState(state: WireState): void;
|
|
|
1598
1894
|
* Writing MCP config under iCloud / OneDrive / Dropbox / Google Drive
|
|
1599
1895
|
* silently propagates the same `mcpServers.alter` entry (and API key
|
|
1600
1896
|
* headers) to every other device the user syncs. That is a consent
|
|
1601
|
-
* violation
|
|
1897
|
+
* violation: wire consent is per-device.
|
|
1602
1898
|
*
|
|
1603
1899
|
* The check is a prefix match against the resolved absolute path; it
|
|
1604
1900
|
* is deliberately broader than strictly necessary so that users who
|
|
@@ -1628,7 +1924,7 @@ declare function sha256(bytes: string | Buffer): string;
|
|
|
1628
1924
|
* structured report. `unwire()` reads that artefact and reverses
|
|
1629
1925
|
* every target.
|
|
1630
1926
|
*
|
|
1631
|
-
* Synchronous throughout
|
|
1927
|
+
* Synchronous throughout: the CLI path is sequential and the
|
|
1632
1928
|
* deterministic ordering is worth the tiny blocking cost.
|
|
1633
1929
|
*/
|
|
1634
1930
|
|
|
@@ -1664,7 +1960,44 @@ interface UnwireReport {
|
|
|
1664
1960
|
declare function unwire(): UnwireReport;
|
|
1665
1961
|
|
|
1666
1962
|
/**
|
|
1667
|
-
*
|
|
1963
|
+
* GENERATED: DO NOT EDIT BY HAND. The SDK's compiled mirror of ALTER's live
|
|
1964
|
+
* MCP pricing surface: advertised tool counts, per-invocation tiers, and
|
|
1965
|
+
* per-invocation pricing.
|
|
1966
|
+
*
|
|
1967
|
+
* Regenerate via the SDK freshness gate. A freshness check runs at publish
|
|
1968
|
+
* time and fails if this file diverges from the live pricing surface.
|
|
1969
|
+
*
|
|
1970
|
+
* Canonical source of truth for x402 pricing and advertised tool counts inside
|
|
1971
|
+
* the SDK. Consumers should import from "@truealter/sdk" (re-exported via
|
|
1972
|
+
* index.ts), not from this module directly.
|
|
1973
|
+
*/
|
|
1974
|
+
/** Tool tier per invocation (0=free / L0, 1=L1, 2=L2, 3=L3, 4=L4, 5=L5). */
|
|
1975
|
+
declare const GENERATED_TOOL_TIERS: Record<string, number>;
|
|
1976
|
+
/** Price in USD per tool invocation. Mirrors the live MCP pricing surface. */
|
|
1977
|
+
declare const GENERATED_TOOL_PRICING: Record<string, number>;
|
|
1978
|
+
/** Flat price per tier in USD. L0 is always free. */
|
|
1979
|
+
declare const TIER_PRICES: Record<string, number>;
|
|
1980
|
+
/** Publicly advertised tool counts. Mirrors canonical-facts.json public_advertised. */
|
|
1981
|
+
declare const ADVERTISED_TOOL_COUNTS: {
|
|
1982
|
+
/** Free (L0) tools visible to anonymous / agent-class callers. */
|
|
1983
|
+
readonly free: 26;
|
|
1984
|
+
/** Premium (L1-L5) tools requiring x402 payment. */
|
|
1985
|
+
readonly premium: 8;
|
|
1986
|
+
/** Messaging tools (member-self-only; excluded from external advertisement). */
|
|
1987
|
+
readonly messaging: 0;
|
|
1988
|
+
/** Total publicly advertised (free + premium). */
|
|
1989
|
+
readonly total: 34;
|
|
1990
|
+
};
|
|
1991
|
+
/** x402 settlement revenue split. Weaver = the data subject earning Identity Income. */
|
|
1992
|
+
declare const REVENUE_SPLIT: {
|
|
1993
|
+
readonly weaver: 0.75;
|
|
1994
|
+
readonly facilitator: 0.05;
|
|
1995
|
+
readonly alter: 0.15;
|
|
1996
|
+
readonly treasury: 0.05;
|
|
1997
|
+
};
|
|
1998
|
+
|
|
1999
|
+
/**
|
|
2000
|
+
* @truealter/sdk: alter_homepage MCP tool types
|
|
1668
2001
|
*
|
|
1669
2002
|
* Wire-format types for the user-authored, externally-queryable identity
|
|
1670
2003
|
* homepage surface.
|
|
@@ -1692,7 +2025,7 @@ type HomepageFieldProvenance = "declared" | "derived" | "attested";
|
|
|
1692
2025
|
/**
|
|
1693
2026
|
* One field of a HomepageManifest. Every field carries its provenance
|
|
1694
2027
|
* class so MCP consumers can render appropriately. The `value` shape is
|
|
1695
|
-
* field-specific
|
|
2028
|
+
* field-specific: this is a discriminated parent; consumers should
|
|
1696
2029
|
* narrow on the manifest's field name, not on `value`'s runtime shape.
|
|
1697
2030
|
*/
|
|
1698
2031
|
interface HomepageField<T = unknown> {
|
|
@@ -1709,7 +2042,7 @@ interface HomepageField<T = unknown> {
|
|
|
1709
2042
|
/**
|
|
1710
2043
|
* The wire-format manifest returned by `alter_homepage(handle)`.
|
|
1711
2044
|
*
|
|
1712
|
-
* Fields are individually optional
|
|
2045
|
+
* Fields are individually optional: a HomepageManifest with only a
|
|
1713
2046
|
* handle and an opener is valid. MCP consumers MUST NOT assume any
|
|
1714
2047
|
* field other than `handle` is present.
|
|
1715
2048
|
*/
|
|
@@ -1731,14 +2064,24 @@ interface HomepageManifest {
|
|
|
1731
2064
|
opener?: HomepageField<string>;
|
|
1732
2065
|
/**
|
|
1733
2066
|
* Composed-glyph string (from typed primitives). The
|
|
1734
|
-
* sigil is a string of renderer-recognised primitive references
|
|
1735
|
-
* not raw glyph codes
|
|
2067
|
+
* sigil is a string of renderer-recognised primitive references:
|
|
2068
|
+
* not raw glyph codes: so different consumers can render the same
|
|
1736
2069
|
* sigil distinctly. Provenance is `declared` for user-composed,
|
|
1737
2070
|
* `derived` for sigil-from-thread-graph crystallisation.
|
|
1738
2071
|
*/
|
|
1739
2072
|
sigil?: HomepageField<string>;
|
|
1740
2073
|
/** User's pronouns (already-shipped surface). Always declared. */
|
|
1741
2074
|
pronouns?: HomepageField<string>;
|
|
2075
|
+
/**
|
|
2076
|
+
* User-authored contact email, surfaced so a verified caller reading
|
|
2077
|
+
* the homepage can reach the holder. Maximum 254 chars (RFC 5321
|
|
2078
|
+
* envelope limit) after NFC normalisation. Always declared-provenance
|
|
2079
|
+
*: the user wrote it into their config; it is NOT the account's
|
|
2080
|
+
* verified login email (that lives encrypted server-side and is never
|
|
2081
|
+
* surfaced here). A holder who sets no `contact_email` simply omits
|
|
2082
|
+
* the field.
|
|
2083
|
+
*/
|
|
2084
|
+
contact_email?: HomepageField<string>;
|
|
1742
2085
|
/**
|
|
1743
2086
|
* List of recognised Seat glyphs the holder is bound to. Provenance
|
|
1744
2087
|
* is always `attested` (ceremony-attested, server-side resolved);
|
|
@@ -1756,7 +2099,7 @@ interface HomepageManifest {
|
|
|
1756
2099
|
/**
|
|
1757
2100
|
* Optional, opt-in per query context. Coarse Golden-Thread summary;
|
|
1758
2101
|
* provenance is `derived`. MCP consumers MUST NOT request this field
|
|
1759
|
-
* by default
|
|
2102
|
+
* by default: only on explicit per-call consent. Consumers in the
|
|
1760
2103
|
* workplace/education vertical MUST NOT request this field at all
|
|
1761
2104
|
* (clause-4 caller-context gate).
|
|
1762
2105
|
*/
|
|
@@ -1766,6 +2109,14 @@ interface HomepageManifest {
|
|
|
1766
2109
|
* Consumers are free to ignore. Provenance is always `declared`.
|
|
1767
2110
|
*/
|
|
1768
2111
|
render_hints?: HomepageField<Record<string, unknown>>;
|
|
2112
|
+
/**
|
|
2113
|
+
* Reserved inner-face slot. NEVER populated on a HomepageManifest returned
|
|
2114
|
+
* by `alter_homepage`: the homepage is the outward-facing identity surface,
|
|
2115
|
+
* and the inside face is held empty by construction. The field exists only
|
|
2116
|
+
* so consumers and forward-compatible schemas can name the slot; a manifest
|
|
2117
|
+
* carrying a value here is malformed and consumers MUST ignore it.
|
|
2118
|
+
*/
|
|
2119
|
+
reserved_inner?: never;
|
|
1769
2120
|
}
|
|
1770
2121
|
/**
|
|
1771
2122
|
* Input arguments for the `alter_homepage` MCP tool.
|
|
@@ -1780,7 +2131,7 @@ interface HomepageInput {
|
|
|
1780
2131
|
/**
|
|
1781
2132
|
* Optional whitelist of field names. If omitted, the server returns
|
|
1782
2133
|
* all fields the caller is permitted to read. Unknown field names
|
|
1783
|
-
* are silently ignored (forward-compatible
|
|
2134
|
+
* are silently ignored (forward-compatible: adding a new field does
|
|
1784
2135
|
* not break old consumers).
|
|
1785
2136
|
*/
|
|
1786
2137
|
fields?: readonly (keyof HomepageManifest)[];
|
|
@@ -1820,10 +2171,11 @@ declare const HOMEPAGE_LIMITS: {
|
|
|
1820
2171
|
readonly opener_max_chars: 280;
|
|
1821
2172
|
readonly pronouns_max_chars: 32;
|
|
1822
2173
|
readonly attunement_glyph_max_chars: 16;
|
|
2174
|
+
readonly contact_email_max_chars: 254;
|
|
1823
2175
|
};
|
|
1824
2176
|
|
|
1825
2177
|
/**
|
|
1826
|
-
* @truealter/sdk
|
|
2178
|
+
* @truealter/sdk: theme pack types
|
|
1827
2179
|
*
|
|
1828
2180
|
* Wire-format types for ALTER theme packs and `themes.lock` composition
|
|
1829
2181
|
* manifests. The full specification lives in
|
|
@@ -1857,9 +2209,9 @@ interface ThemeMeta {
|
|
|
1857
2209
|
author: string;
|
|
1858
2210
|
/** ≤ 240 characters after NFC. */
|
|
1859
2211
|
description: string;
|
|
1860
|
-
/** OPTIONAL
|
|
2212
|
+
/** OPTIONAL: surfaced by curated resolvers; not rendered by ALTER. */
|
|
1861
2213
|
repo?: string;
|
|
1862
|
-
/** OPTIONAL
|
|
2214
|
+
/** OPTIONAL: surfaced by curated resolvers; not rendered by ALTER. */
|
|
1863
2215
|
docs_url?: string;
|
|
1864
2216
|
}
|
|
1865
2217
|
/** `[palette]` section. Renderer enforces gamut; out-of-gamut packs are rejected. */
|
|
@@ -1893,7 +2245,7 @@ interface ThemeRenderHints {
|
|
|
1893
2245
|
}
|
|
1894
2246
|
/** `[assets]` section. Paths MUST be repo-relative without `..` segments. */
|
|
1895
2247
|
interface ThemeAssets {
|
|
1896
|
-
/** Optional
|
|
2248
|
+
/** Optional: if omitted, no assets are loaded. */
|
|
1897
2249
|
glyphs?: readonly string[];
|
|
1898
2250
|
}
|
|
1899
2251
|
/**
|
|
@@ -1943,7 +2295,7 @@ interface ThemeLockEntry {
|
|
|
1943
2295
|
}
|
|
1944
2296
|
/**
|
|
1945
2297
|
* The user-side composition manifest. This is the publishable artefact
|
|
1946
|
-
|
|
2298
|
+
*: what someone shares when they say "here is my ALTER".
|
|
1947
2299
|
*
|
|
1948
2300
|
* Re-applying the same lockfile against the same renderer version MUST
|
|
1949
2301
|
* produce a bit-identical render, modulo the `attunement_glyph` field
|
|
@@ -1951,7 +2303,7 @@ interface ThemeLockEntry {
|
|
|
1951
2303
|
*/
|
|
1952
2304
|
interface ThemesLockV1 {
|
|
1953
2305
|
schema_version: 1;
|
|
1954
|
-
/** e.g. "alter-cli/0.5.0"
|
|
2306
|
+
/** e.g. "alter-cli/0.5.0", informational only. */
|
|
1955
2307
|
generated_by: string;
|
|
1956
2308
|
/** RFC 3339 UTC timestamp at lockfile-write time. */
|
|
1957
2309
|
generated_at: string;
|
|
@@ -2003,11 +2355,11 @@ declare const OSC8_ALLOWED_SCHEMES: readonly ["https:", "mailto:"];
|
|
|
2003
2355
|
type Osc8AllowedScheme = (typeof OSC8_ALLOWED_SCHEMES)[number];
|
|
2004
2356
|
|
|
2005
2357
|
/**
|
|
2006
|
-
* Package metadata
|
|
2358
|
+
* Package metadata: kept in a standalone module so deep imports from
|
|
2007
2359
|
* `src/wire/` can reference version constants without creating a
|
|
2008
2360
|
* circular dependency through `src/index.ts`.
|
|
2009
2361
|
*/
|
|
2010
2362
|
declare const SDK_NAME = "@truealter/sdk";
|
|
2011
|
-
declare const SDK_VERSION
|
|
2363
|
+
declare const SDK_VERSION: string;
|
|
2012
2364
|
|
|
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 };
|
|
2365
|
+
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 };
|