@truealter/sdk 0.2.2 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -25
- package/dist/bin/alter-identity.js +881 -53
- package/dist/bin/mcp-bridge.js +179 -10
- package/dist/index.cjs +815 -81
- package/dist/index.d.cts +333 -143
- package/dist/index.d.ts +333 -143
- package/dist/index.js +747 -85
- package/package.json +11 -5
- package/dist/bin/alter-identity.js.map +0 -1
- package/dist/bin/mcp-bridge.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -406,6 +406,24 @@ interface MCPClientOptions {
|
|
|
406
406
|
clientInfo?: MCPClientInfo;
|
|
407
407
|
/** Optional x402 client for automatic premium tool payment. */
|
|
408
408
|
x402?: X402Client;
|
|
409
|
+
/**
|
|
410
|
+
* Q5c per-invocation signing. When present, every `tools/call` is
|
|
411
|
+
* ES256-signed and submitted with the `Mcp-Invocation-Signature`
|
|
412
|
+
* header. The public half of `privateKey` MUST have been
|
|
413
|
+
* registered via `POST /api/v1/agents/keys` against the same API
|
|
414
|
+
* key configured here. Required whenever `apiKey` is set and the
|
|
415
|
+
* server is in production / staging (hard-required from
|
|
416
|
+
* 2026-04-20).
|
|
417
|
+
*/
|
|
418
|
+
signing?: MCPSigningOptions;
|
|
419
|
+
}
|
|
420
|
+
interface MCPSigningOptions {
|
|
421
|
+
/** The signing-key id pre-registered with the server. */
|
|
422
|
+
kid: string;
|
|
423
|
+
/** ES256 P-256 private key: 32-byte scalar or PEM. */
|
|
424
|
+
privateKey: Uint8Array | string;
|
|
425
|
+
/** The caller's bound ~handle. */
|
|
426
|
+
handle: string;
|
|
409
427
|
}
|
|
410
428
|
interface MCPCallOptions {
|
|
411
429
|
/** Override the configured x402 client for this single call. */
|
|
@@ -454,6 +472,7 @@ declare class MCPClient {
|
|
|
454
472
|
private readonly maxRetries;
|
|
455
473
|
private readonly clientInfo;
|
|
456
474
|
private readonly x402?;
|
|
475
|
+
private readonly signing?;
|
|
457
476
|
private requestCounter;
|
|
458
477
|
private initialised;
|
|
459
478
|
constructor(opts?: MCPClientOptions);
|
|
@@ -476,6 +495,12 @@ declare class MCPClient {
|
|
|
476
495
|
*/
|
|
477
496
|
rpc(method: string, params: Record<string, unknown> | unknown[] | undefined): Promise<unknown>;
|
|
478
497
|
private buildHeaders;
|
|
498
|
+
/**
|
|
499
|
+
* Produce the `Mcp-Invocation-Signature` header for a `tools/call`
|
|
500
|
+
* payload, when signing is configured. Returns `undefined` when no
|
|
501
|
+
* signing key is attached or the method is not `tools/call`.
|
|
502
|
+
*/
|
|
503
|
+
private buildSignatureHeader;
|
|
479
504
|
private extractPaymentEnvelope;
|
|
480
505
|
private guessToolName;
|
|
481
506
|
private backoff;
|
|
@@ -536,6 +561,36 @@ interface MCPResponse<T> {
|
|
|
536
561
|
};
|
|
537
562
|
_meta?: MCPMeta;
|
|
538
563
|
}
|
|
564
|
+
/** (free) hello_agent — First handshake: returns server version, auth status, trust tier, tool counts */
|
|
565
|
+
interface HelloAgentInput {
|
|
566
|
+
}
|
|
567
|
+
/** (free) hello_agent — output */
|
|
568
|
+
interface HelloAgentOutput {
|
|
569
|
+
ok: boolean;
|
|
570
|
+
server?: string;
|
|
571
|
+
version?: string;
|
|
572
|
+
authenticated?: boolean;
|
|
573
|
+
tier?: string;
|
|
574
|
+
tools?: {
|
|
575
|
+
free?: number;
|
|
576
|
+
premium?: number;
|
|
577
|
+
messaging?: number;
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
/** (free) alter_resolve_handle — Resolve a ~handle (e.g. ~drew) to canonical form and kind */
|
|
581
|
+
interface AlterResolveHandleInput {
|
|
582
|
+
query: string;
|
|
583
|
+
}
|
|
584
|
+
/** (free) alter_resolve_handle — output */
|
|
585
|
+
interface AlterResolveHandleOutput {
|
|
586
|
+
ok: boolean;
|
|
587
|
+
handle: string | null;
|
|
588
|
+
kind?: "system" | "personal" | "role_alias" | string;
|
|
589
|
+
status: "found" | "not_found" | "invalid_format";
|
|
590
|
+
addressable: boolean;
|
|
591
|
+
default_visibility?: string;
|
|
592
|
+
query?: string;
|
|
593
|
+
}
|
|
539
594
|
/** (free) list_archetypes — List all 12 ALTER identity archetypes */
|
|
540
595
|
interface ListArchetypesInput {
|
|
541
596
|
}
|
|
@@ -647,31 +702,6 @@ interface GetCompetenciesOutput {
|
|
|
647
702
|
awarded_at: string;
|
|
648
703
|
}>;
|
|
649
704
|
}
|
|
650
|
-
/** (free) create_identity_stub — Create an anonymous identity stub for a human (consent required) */
|
|
651
|
-
interface CreateIdentityStubInput {
|
|
652
|
-
source: string;
|
|
653
|
-
consent_acknowledged: boolean;
|
|
654
|
-
erc8004_agent_id?: string;
|
|
655
|
-
}
|
|
656
|
-
/** (free) create_identity_stub — output */
|
|
657
|
-
interface CreateIdentityStubOutput {
|
|
658
|
-
ok: boolean;
|
|
659
|
-
stub_id: string;
|
|
660
|
-
claim_code: string;
|
|
661
|
-
expires_at: string;
|
|
662
|
-
}
|
|
663
|
-
/** (free) submit_context — Submit text context for an identity stub (PII redacted, raw text never stored) */
|
|
664
|
-
interface SubmitContextInput {
|
|
665
|
-
stub_id: string;
|
|
666
|
-
text: string;
|
|
667
|
-
source_type?: "resume" | "work_sample" | "conversation" | "cover_letter" | "linkedin" | "portfolio" | "reference" | "interview_notes" | "performance_review" | "project_summary" | "general";
|
|
668
|
-
}
|
|
669
|
-
/** (free) submit_context — output */
|
|
670
|
-
interface SubmitContextOutput {
|
|
671
|
-
ok: boolean;
|
|
672
|
-
traits_extracted: number;
|
|
673
|
-
confidence_cap: number;
|
|
674
|
-
}
|
|
675
705
|
/** (free) search_identities — Search identity stubs and profiles by trait criteria (max 5 results, no PII) */
|
|
676
706
|
interface SearchIdentitiesInput {
|
|
677
707
|
trait_criteria: Record<string, {
|
|
@@ -800,18 +830,6 @@ interface GetPrivacyBudgetOutput {
|
|
|
800
830
|
query_count: number;
|
|
801
831
|
window_hours: number;
|
|
802
832
|
}
|
|
803
|
-
/** (free) dispute_attestation — Dispute an attestation on a person's identity */
|
|
804
|
-
interface DisputeAttestationInput {
|
|
805
|
-
attestation_id: string;
|
|
806
|
-
reason: string;
|
|
807
|
-
}
|
|
808
|
-
/** (free) dispute_attestation — output */
|
|
809
|
-
interface DisputeAttestationOutput {
|
|
810
|
-
ok: boolean;
|
|
811
|
-
dispute_id: string;
|
|
812
|
-
attestation_id: string;
|
|
813
|
-
flagged_for_review: boolean;
|
|
814
|
-
}
|
|
815
833
|
/** (free) golden_thread_status — Check the Golden Thread program status */
|
|
816
834
|
interface GoldenThreadStatusInput {
|
|
817
835
|
}
|
|
@@ -984,71 +1002,6 @@ interface GenerateMatchNarrativeOutput {
|
|
|
984
1002
|
strengths: string[];
|
|
985
1003
|
growth_areas: string[];
|
|
986
1004
|
}
|
|
987
|
-
/** (premium L2) submit_batch_context — Submit multiple context items in a single call (max 10) ($0.01) */
|
|
988
|
-
interface SubmitBatchContextInput {
|
|
989
|
-
stub_id: string;
|
|
990
|
-
items: Array<{
|
|
991
|
-
text: string;
|
|
992
|
-
source_type?: string;
|
|
993
|
-
}>;
|
|
994
|
-
consent_acknowledged: boolean;
|
|
995
|
-
_payment?: ProvenanceToken;
|
|
996
|
-
}
|
|
997
|
-
/** (premium L2) submit_batch_context — output */
|
|
998
|
-
interface SubmitBatchContextOutput {
|
|
999
|
-
ok: boolean;
|
|
1000
|
-
items_processed: number;
|
|
1001
|
-
traits_extracted: number;
|
|
1002
|
-
}
|
|
1003
|
-
/** (premium L1) submit_structured_profile — Submit structured profile data (name, skills, experience) ($0.005) */
|
|
1004
|
-
interface SubmitStructuredProfileInput {
|
|
1005
|
-
stub_id: string;
|
|
1006
|
-
name?: string;
|
|
1007
|
-
skills?: string[];
|
|
1008
|
-
experience?: string;
|
|
1009
|
-
education?: string;
|
|
1010
|
-
certifications?: string[];
|
|
1011
|
-
consent_acknowledged: boolean;
|
|
1012
|
-
_payment?: ProvenanceToken;
|
|
1013
|
-
}
|
|
1014
|
-
/** (premium L1) submit_structured_profile — output */
|
|
1015
|
-
interface SubmitStructuredProfileOutput {
|
|
1016
|
-
ok: boolean;
|
|
1017
|
-
stub_id: string;
|
|
1018
|
-
traits_extracted: number;
|
|
1019
|
-
}
|
|
1020
|
-
/** (premium L1) submit_social_links — Submit social profile URLs (max 5) ($0.005) */
|
|
1021
|
-
interface SubmitSocialLinksInput {
|
|
1022
|
-
stub_id: string;
|
|
1023
|
-
urls: string[];
|
|
1024
|
-
consent_acknowledged: boolean;
|
|
1025
|
-
_payment?: ProvenanceToken;
|
|
1026
|
-
}
|
|
1027
|
-
/** (premium L1) submit_social_links — output */
|
|
1028
|
-
interface SubmitSocialLinksOutput {
|
|
1029
|
-
ok: boolean;
|
|
1030
|
-
stub_id: string;
|
|
1031
|
-
urls_fetched: number;
|
|
1032
|
-
urls_blocked: number;
|
|
1033
|
-
traits_extracted: number;
|
|
1034
|
-
}
|
|
1035
|
-
/** (premium L1) attest_domain — Attest that a human has competence in a specific domain ($0.005) */
|
|
1036
|
-
interface AttestDomainInput {
|
|
1037
|
-
candidate_id: string;
|
|
1038
|
-
domain_label: string;
|
|
1039
|
-
confidence: number;
|
|
1040
|
-
evidence_type: "OBSERVED" | "INFERRED" | "REPORTED";
|
|
1041
|
-
evidence_summary?: string;
|
|
1042
|
-
_payment?: ProvenanceToken;
|
|
1043
|
-
}
|
|
1044
|
-
/** (premium L1) attest_domain — output */
|
|
1045
|
-
interface AttestDomainOutput {
|
|
1046
|
-
ok: boolean;
|
|
1047
|
-
attestation_id: string;
|
|
1048
|
-
candidate_id: string;
|
|
1049
|
-
domain_label: string;
|
|
1050
|
-
weighted_confidence: number;
|
|
1051
|
-
}
|
|
1052
1005
|
/** (premium L2) get_side_quest_graph — Get a person's Side Quest Graph (DP noise ε=1.0) ($0.01) */
|
|
1053
1006
|
interface GetSideQuestGraphInput {
|
|
1054
1007
|
candidate_id: string;
|
|
@@ -1088,13 +1041,15 @@ interface QueryGraphSimilarityOutput {
|
|
|
1088
1041
|
complementarity: number;
|
|
1089
1042
|
privacy_epsilon: number;
|
|
1090
1043
|
}
|
|
1091
|
-
/** Free (L0
|
|
1092
|
-
declare const FREE_TOOL_NAMES: readonly ["
|
|
1093
|
-
/** Premium (x402-gated) tool names — readonly tuple */
|
|
1094
|
-
declare const PREMIUM_TOOL_NAMES: readonly ["assess_traits", "get_trait_snapshot", "get_full_trait_vector", "compute_belonging", "get_match_recommendations", "generate_match_narrative", "
|
|
1095
|
-
/** Union of all
|
|
1044
|
+
/** Free (L0) tool names — readonly tuple. Mirrors the live server's `tools/list` free set. */
|
|
1045
|
+
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"];
|
|
1046
|
+
/** Premium (x402-gated, L1-L5) tool names — readonly tuple. Mirrors the live server's `tools/list` premium set. */
|
|
1047
|
+
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"];
|
|
1048
|
+
/** Union of all 32 tool names */
|
|
1096
1049
|
type ToolName = (typeof FREE_TOOL_NAMES)[number] | (typeof PREMIUM_TOOL_NAMES)[number];
|
|
1097
1050
|
interface ToolInputs {
|
|
1051
|
+
hello_agent: HelloAgentInput;
|
|
1052
|
+
alter_resolve_handle: AlterResolveHandleInput;
|
|
1098
1053
|
list_archetypes: ListArchetypesInput;
|
|
1099
1054
|
verify_identity: VerifyIdentityInput;
|
|
1100
1055
|
initiate_assessment: InitiateAssessmentInput;
|
|
@@ -1102,8 +1057,6 @@ interface ToolInputs {
|
|
|
1102
1057
|
get_profile: GetProfileInput;
|
|
1103
1058
|
query_matches: QueryMatchesInput;
|
|
1104
1059
|
get_competencies: GetCompetenciesInput;
|
|
1105
|
-
create_identity_stub: CreateIdentityStubInput;
|
|
1106
|
-
submit_context: SubmitContextInput;
|
|
1107
1060
|
search_identities: SearchIdentitiesInput;
|
|
1108
1061
|
get_identity_earnings: GetIdentityEarningsInput;
|
|
1109
1062
|
get_network_stats: GetNetworkStatsInput;
|
|
@@ -1114,7 +1067,6 @@ interface ToolInputs {
|
|
|
1114
1067
|
get_agent_trust_tier: GetAgentTrustTierInput;
|
|
1115
1068
|
get_agent_portfolio: GetAgentPortfolioInput;
|
|
1116
1069
|
get_privacy_budget: GetPrivacyBudgetInput;
|
|
1117
|
-
dispute_attestation: DisputeAttestationInput;
|
|
1118
1070
|
golden_thread_status: GoldenThreadStatusInput;
|
|
1119
1071
|
begin_golden_thread: BeginGoldenThreadInput;
|
|
1120
1072
|
complete_knot: CompleteKnotInput;
|
|
@@ -1126,14 +1078,12 @@ interface ToolInputs {
|
|
|
1126
1078
|
compute_belonging: ComputeBelongingInput;
|
|
1127
1079
|
get_match_recommendations: GetMatchRecommendationsInput;
|
|
1128
1080
|
generate_match_narrative: GenerateMatchNarrativeInput;
|
|
1129
|
-
submit_batch_context: SubmitBatchContextInput;
|
|
1130
|
-
submit_structured_profile: SubmitStructuredProfileInput;
|
|
1131
|
-
submit_social_links: SubmitSocialLinksInput;
|
|
1132
|
-
attest_domain: AttestDomainInput;
|
|
1133
1081
|
get_side_quest_graph: GetSideQuestGraphInput;
|
|
1134
1082
|
query_graph_similarity: QueryGraphSimilarityInput;
|
|
1135
1083
|
}
|
|
1136
1084
|
interface ToolOutputs {
|
|
1085
|
+
hello_agent: HelloAgentOutput;
|
|
1086
|
+
alter_resolve_handle: AlterResolveHandleOutput;
|
|
1137
1087
|
list_archetypes: ListArchetypesOutput;
|
|
1138
1088
|
verify_identity: VerifyIdentityOutput;
|
|
1139
1089
|
initiate_assessment: InitiateAssessmentOutput;
|
|
@@ -1141,8 +1091,6 @@ interface ToolOutputs {
|
|
|
1141
1091
|
get_profile: GetProfileOutput;
|
|
1142
1092
|
query_matches: QueryMatchesOutput;
|
|
1143
1093
|
get_competencies: GetCompetenciesOutput;
|
|
1144
|
-
create_identity_stub: CreateIdentityStubOutput;
|
|
1145
|
-
submit_context: SubmitContextOutput;
|
|
1146
1094
|
search_identities: SearchIdentitiesOutput;
|
|
1147
1095
|
get_identity_earnings: GetIdentityEarningsOutput;
|
|
1148
1096
|
get_network_stats: GetNetworkStatsOutput;
|
|
@@ -1153,7 +1101,6 @@ interface ToolOutputs {
|
|
|
1153
1101
|
get_agent_trust_tier: GetAgentTrustTierOutput;
|
|
1154
1102
|
get_agent_portfolio: GetAgentPortfolioOutput;
|
|
1155
1103
|
get_privacy_budget: GetPrivacyBudgetOutput;
|
|
1156
|
-
dispute_attestation: DisputeAttestationOutput;
|
|
1157
1104
|
golden_thread_status: GoldenThreadStatusOutput;
|
|
1158
1105
|
begin_golden_thread: BeginGoldenThreadOutput;
|
|
1159
1106
|
complete_knot: CompleteKnotOutput;
|
|
@@ -1165,10 +1112,6 @@ interface ToolOutputs {
|
|
|
1165
1112
|
compute_belonging: ComputeBelongingOutput;
|
|
1166
1113
|
get_match_recommendations: GetMatchRecommendationsOutput;
|
|
1167
1114
|
generate_match_narrative: GenerateMatchNarrativeOutput;
|
|
1168
|
-
submit_batch_context: SubmitBatchContextOutput;
|
|
1169
|
-
submit_structured_profile: SubmitStructuredProfileOutput;
|
|
1170
|
-
submit_social_links: SubmitSocialLinksOutput;
|
|
1171
|
-
attest_domain: AttestDomainOutput;
|
|
1172
1115
|
get_side_quest_graph: GetSideQuestGraphOutput;
|
|
1173
1116
|
query_graph_similarity: QueryGraphSimilarityOutput;
|
|
1174
1117
|
}
|
|
@@ -1194,8 +1137,8 @@ declare const TOOL_BLAST_RADIUS: Record<ToolName, "low" | "medium" | "high">;
|
|
|
1194
1137
|
*
|
|
1195
1138
|
* This is the entry point most consumers will use. It bundles
|
|
1196
1139
|
* {@link MCPClient}, {@link X402Client}, discovery, and provenance
|
|
1197
|
-
* verification into a single ergonomic surface that mirrors the
|
|
1198
|
-
* tools exposed at https://mcp.truealter.com.
|
|
1140
|
+
* verification into a single ergonomic surface that mirrors the 32
|
|
1141
|
+
* tools exposed at https://mcp.truealter.com/api/v1/mcp.
|
|
1199
1142
|
*
|
|
1200
1143
|
* Free tier methods require no authentication. Premium methods accept
|
|
1201
1144
|
* an `X402Client` (or fall back to throwing {@link AlterPaymentRequired}
|
|
@@ -1259,6 +1202,10 @@ declare class AlterClient {
|
|
|
1259
1202
|
* you want fail-fast behaviour.
|
|
1260
1203
|
*/
|
|
1261
1204
|
initialize(): Promise<void>;
|
|
1205
|
+
/** First handshake — confirms the connection, returns trust tier and tool counts. */
|
|
1206
|
+
helloAgent(): Promise<MCPCallToolResult>;
|
|
1207
|
+
/** Resolve a ~handle (e.g. ~drew) to its canonical form and kind. No auth required. */
|
|
1208
|
+
resolveHandle(args: AlterResolveHandleInput | string): Promise<MCPCallToolResult>;
|
|
1262
1209
|
/** Verify a person is registered with ALTER (handle or id). */
|
|
1263
1210
|
verify(handleOrId: string, claims?: VerifyIdentityInput['claims']): Promise<MCPCallToolResult>;
|
|
1264
1211
|
/** List the 12 ALTER identity archetypes. */
|
|
@@ -1272,8 +1219,6 @@ declare class AlterClient {
|
|
|
1272
1219
|
getProfile(args: GetProfileInput): Promise<MCPCallToolResult>;
|
|
1273
1220
|
queryMatches(args: QueryMatchesInput): Promise<MCPCallToolResult>;
|
|
1274
1221
|
getCompetencies(args: GetCompetenciesInput): Promise<MCPCallToolResult>;
|
|
1275
|
-
createIdentityStub(args: CreateIdentityStubInput): Promise<MCPCallToolResult>;
|
|
1276
|
-
submitContext(args: SubmitContextInput): Promise<MCPCallToolResult>;
|
|
1277
1222
|
searchIdentities(args: SearchIdentitiesInput): Promise<MCPCallToolResult>;
|
|
1278
1223
|
getIdentityEarnings(args: GetIdentityEarningsInput): Promise<MCPCallToolResult>;
|
|
1279
1224
|
getIdentityTrustScore(args: GetIdentityTrustScoreInput): Promise<MCPCallToolResult>;
|
|
@@ -1282,7 +1227,6 @@ declare class AlterClient {
|
|
|
1282
1227
|
getAgentTrustTier(): Promise<MCPCallToolResult>;
|
|
1283
1228
|
getAgentPortfolio(): Promise<MCPCallToolResult>;
|
|
1284
1229
|
getPrivacyBudget(args: GetPrivacyBudgetInput): Promise<MCPCallToolResult>;
|
|
1285
|
-
disputeAttestation(args: DisputeAttestationInput): Promise<MCPCallToolResult>;
|
|
1286
1230
|
goldenThreadStatus(): Promise<MCPCallToolResult>;
|
|
1287
1231
|
beginGoldenThread(args?: BeginGoldenThreadInput): Promise<MCPCallToolResult>;
|
|
1288
1232
|
completeKnot(args: CompleteKnotInput): Promise<MCPCallToolResult>;
|
|
@@ -1294,10 +1238,6 @@ declare class AlterClient {
|
|
|
1294
1238
|
computeBelonging(args: ComputeBelongingInput, opts?: MCPCallOptions): Promise<MCPCallToolResult>;
|
|
1295
1239
|
getMatchRecommendations(args: GetMatchRecommendationsInput, opts?: MCPCallOptions): Promise<MCPCallToolResult>;
|
|
1296
1240
|
generateMatchNarrative(args: GenerateMatchNarrativeInput, opts?: MCPCallOptions): Promise<MCPCallToolResult>;
|
|
1297
|
-
submitBatchContext(args: SubmitBatchContextInput, opts?: MCPCallOptions): Promise<MCPCallToolResult>;
|
|
1298
|
-
submitStructuredProfile(args: SubmitStructuredProfileInput, opts?: MCPCallOptions): Promise<MCPCallToolResult>;
|
|
1299
|
-
submitSocialLinks(args: SubmitSocialLinksInput, opts?: MCPCallOptions): Promise<MCPCallToolResult>;
|
|
1300
|
-
attestDomain(args: AttestDomainInput, opts?: MCPCallOptions): Promise<MCPCallToolResult>;
|
|
1301
1241
|
getSideQuestGraph(args: GetSideQuestGraphInput, opts?: MCPCallOptions): Promise<MCPCallToolResult>;
|
|
1302
1242
|
queryGraphSimilarity(args: QueryGraphSimilarityInput, opts?: MCPCallOptions): Promise<MCPCallToolResult>;
|
|
1303
1243
|
/** Send a direct message to another tilde handle. */
|
|
@@ -1357,6 +1297,76 @@ declare class AlterClient {
|
|
|
1357
1297
|
fetchPublicKeys(): Promise<unknown>;
|
|
1358
1298
|
}
|
|
1359
1299
|
|
|
1300
|
+
/**
|
|
1301
|
+
* Stable stringify mirroring Python's
|
|
1302
|
+
* `json.dumps(obj, sort_keys=True, separators=(",", ":"), ensure_ascii=False)`.
|
|
1303
|
+
*
|
|
1304
|
+
* Rules:
|
|
1305
|
+
* - object keys are sorted ascending by codepoint
|
|
1306
|
+
* - no whitespace
|
|
1307
|
+
* - `ensure_ascii=False` — non-ASCII characters pass through verbatim
|
|
1308
|
+
* (not re-encoded as \\uXXXX). UTF-8 encoding happens at the byte
|
|
1309
|
+
* layer before hashing.
|
|
1310
|
+
*
|
|
1311
|
+
* This is RFC-8785 adjacent; it is NOT a full JCS implementation
|
|
1312
|
+
* (numeric canonicalisation is delegated to the caller).
|
|
1313
|
+
*/
|
|
1314
|
+
declare function canonicalStringify(value: unknown): string;
|
|
1315
|
+
/**
|
|
1316
|
+
* Hex SHA-256 of the canonical JSON encoding of `toolArgs`. Matches
|
|
1317
|
+
* `canonical_args_sha256` in the server-side verifier.
|
|
1318
|
+
*/
|
|
1319
|
+
declare function canonicalArgsSha256(toolArgs: Record<string, unknown>): string;
|
|
1320
|
+
/**
|
|
1321
|
+
* Load an ES256 P-256 private key.
|
|
1322
|
+
*
|
|
1323
|
+
* Accepts:
|
|
1324
|
+
* - a 32-byte `Uint8Array` containing the raw d-scalar
|
|
1325
|
+
* - a PEM string (PKCS#8 or SEC1). Node's `crypto.createPrivateKey`
|
|
1326
|
+
* is used when available to parse the PEM; on non-Node runtimes
|
|
1327
|
+
* only the raw-bytes form is supported.
|
|
1328
|
+
*/
|
|
1329
|
+
declare function loadPrivateKey(key: Uint8Array | string): Uint8Array;
|
|
1330
|
+
interface InvocationClaims {
|
|
1331
|
+
/** Tool name — must equal the `tools/call` `params.name`. */
|
|
1332
|
+
tool: string;
|
|
1333
|
+
/** Hex SHA-256 of canonical-JSON `tool_args`. */
|
|
1334
|
+
args_sha256: string;
|
|
1335
|
+
/** Random string, at least ~16 bytes of entropy (base64url). */
|
|
1336
|
+
nonce: string;
|
|
1337
|
+
/** Epoch seconds. Server accepts ±60s skew. */
|
|
1338
|
+
iat: number;
|
|
1339
|
+
/** The caller's bound ~handle. */
|
|
1340
|
+
iss: string;
|
|
1341
|
+
}
|
|
1342
|
+
interface SignInvocationOptions {
|
|
1343
|
+
/** The signing-key id pre-registered on the server. */
|
|
1344
|
+
kid: string;
|
|
1345
|
+
/** P-256 private key (32-byte Uint8Array or PEM string). */
|
|
1346
|
+
privateKey: Uint8Array | string;
|
|
1347
|
+
/** The caller's bound ~handle. */
|
|
1348
|
+
handle: string;
|
|
1349
|
+
/** Override nonce (tests). Defaults to 24 random bytes base64url. */
|
|
1350
|
+
nonce?: string;
|
|
1351
|
+
/** Override iat (tests). Defaults to now. */
|
|
1352
|
+
iatSeconds?: number;
|
|
1353
|
+
}
|
|
1354
|
+
/**
|
|
1355
|
+
* Produce the `Mcp-Invocation-Signature` header value for a single
|
|
1356
|
+
* `tools/call`. The returned string is a compact JWS:
|
|
1357
|
+
* `base64url(header) . base64url(payload) . base64url(signature)`
|
|
1358
|
+
*
|
|
1359
|
+
* Usage:
|
|
1360
|
+
*
|
|
1361
|
+
* ```ts
|
|
1362
|
+
* const header = signInvocation("get_profile", { candidate_id: "abc" }, {
|
|
1363
|
+
* kid, privateKey, handle: "~tester",
|
|
1364
|
+
* });
|
|
1365
|
+
* fetch(url, { headers: { "Mcp-Invocation-Signature": header } });
|
|
1366
|
+
* ```
|
|
1367
|
+
*/
|
|
1368
|
+
declare function signInvocation(toolName: string, toolArgs: Record<string, unknown>, options: SignInvocationOptions): string;
|
|
1369
|
+
|
|
1360
1370
|
interface McpServerConfig {
|
|
1361
1371
|
url: string;
|
|
1362
1372
|
transport: 'streamable-http';
|
|
@@ -1401,22 +1411,202 @@ declare function generateClaudeConfig(opts?: GenerateMcpConfigOptions): GenericM
|
|
|
1401
1411
|
declare function generateCursorConfig(opts?: GenerateMcpConfigOptions): GenericMcpConfig;
|
|
1402
1412
|
|
|
1403
1413
|
/**
|
|
1404
|
-
*
|
|
1414
|
+
* Claude Desktop MCP config helper.
|
|
1415
|
+
*
|
|
1416
|
+
* Claude Desktop speaks stdio only — it does not currently dial
|
|
1417
|
+
* Streamable-HTTP MCP servers directly. The canonical bridge is our
|
|
1418
|
+
* own `alter-mcp-bridge` binary, which is published alongside this CLI
|
|
1419
|
+
* in the same npm package. Desktop hosts then spawn the bridge as a
|
|
1420
|
+
* child process and read JSON-RPC over stdin/stdout.
|
|
1421
|
+
*
|
|
1422
|
+
* Config file path varies by platform and is resolved in
|
|
1423
|
+
* `src/wire/paths.ts`. This adapter only produces the config *shape*.
|
|
1424
|
+
*/
|
|
1425
|
+
interface ClaudeDesktopServerConfig {
|
|
1426
|
+
command: string;
|
|
1427
|
+
args?: string[];
|
|
1428
|
+
env?: Record<string, string>;
|
|
1429
|
+
description?: string;
|
|
1430
|
+
}
|
|
1431
|
+
interface ClaudeDesktopConfig {
|
|
1432
|
+
mcpServers: Record<string, ClaudeDesktopServerConfig>;
|
|
1433
|
+
}
|
|
1434
|
+
interface GenerateClaudeDesktopOptions {
|
|
1435
|
+
/** Override the MCP endpoint the bridge dials. Defaults to DEFAULT_ENDPOINT. */
|
|
1436
|
+
endpoint?: string;
|
|
1437
|
+
/** Optional API key passed via `ALTER_API_KEY` env so it never lands in argv. */
|
|
1438
|
+
apiKey?: string;
|
|
1439
|
+
/** Identifier used by Claude Desktop for this server. Default: `alter`. */
|
|
1440
|
+
serverName?: string;
|
|
1441
|
+
/** Override the bridge command (e.g. `npx alter-mcp-bridge`). Default: bare `alter-mcp-bridge`. */
|
|
1442
|
+
bridgeCommand?: string;
|
|
1443
|
+
/** Extra args appended after the default bridge args. */
|
|
1444
|
+
extraArgs?: string[];
|
|
1445
|
+
}
|
|
1446
|
+
declare function generateClaudeDesktopConfig(opts?: GenerateClaudeDesktopOptions): ClaudeDesktopConfig;
|
|
1447
|
+
|
|
1448
|
+
type ClientId = 'claude-code' | 'cursor' | 'claude-desktop' | 'vscode';
|
|
1449
|
+
interface ClientPaths {
|
|
1450
|
+
id: ClientId;
|
|
1451
|
+
/** Human-readable label. */
|
|
1452
|
+
label: string;
|
|
1453
|
+
/** The config file the wire step will mutate (or null if the client uses a CLI-only handoff). */
|
|
1454
|
+
configPath: string | null;
|
|
1455
|
+
/** A sibling directory whose presence counts as "the client is installed on this box". */
|
|
1456
|
+
probeDir: string;
|
|
1457
|
+
/** The `mcpServers`-shaped root key under which our entry is written. Defaults to `mcpServers`. */
|
|
1458
|
+
rootKey: string;
|
|
1459
|
+
}
|
|
1460
|
+
declare const CLAUDE_CODE: ClientPaths;
|
|
1461
|
+
declare const CURSOR: ClientPaths;
|
|
1462
|
+
declare const CLAUDE_DESKTOP: ClientPaths;
|
|
1463
|
+
declare const VSCODE: ClientPaths;
|
|
1464
|
+
declare const ALL_CLIENTS: readonly ClientPaths[];
|
|
1465
|
+
|
|
1466
|
+
/**
|
|
1467
|
+
* Detect which MCP-aware clients are installed on this machine.
|
|
1468
|
+
*
|
|
1469
|
+
* Probe signals, per client:
|
|
1470
|
+
* - claude-code : `claude` binary resolvable on PATH (spawn `--version`)
|
|
1471
|
+
* - cursor : `~/.cursor/` directory exists
|
|
1472
|
+
* - claude-desktop: platform config directory exists
|
|
1473
|
+
* - vscode : VS Code user data directory exists
|
|
1474
|
+
*
|
|
1475
|
+
* The probe is deliberately permissive — "the config directory exists"
|
|
1476
|
+
* means either the app is installed or was recently installed. Wire
|
|
1477
|
+
* will still refuse if the config file ends up on a synced volume.
|
|
1478
|
+
*/
|
|
1479
|
+
|
|
1480
|
+
interface ProbeResult {
|
|
1481
|
+
client: ClientPaths;
|
|
1482
|
+
installed: boolean;
|
|
1483
|
+
/** Only present for claude-code — records `claude --version` output when resolvable. */
|
|
1484
|
+
version?: string;
|
|
1485
|
+
/** Diagnostic trail — why we said installed/not. */
|
|
1486
|
+
reason: string;
|
|
1487
|
+
}
|
|
1488
|
+
declare function probeClaudeCode(): ProbeResult;
|
|
1489
|
+
declare function probeByDir(id: ClientId): ProbeResult;
|
|
1490
|
+
declare function probeAll(): ProbeResult[];
|
|
1491
|
+
|
|
1492
|
+
/**
|
|
1493
|
+
* `wire-state.json` provenance artefact.
|
|
1494
|
+
*
|
|
1495
|
+
* Written to `$XDG_CONFIG_HOME/alter/wire-state.json` after every wire
|
|
1496
|
+
* run. Holds everything `unwire` needs to reverse the operation without
|
|
1497
|
+
* guessing, plus enough metadata (SDK version, timestamps, SHAs pre and
|
|
1498
|
+
* post) to make the operation auditable.
|
|
1499
|
+
*
|
|
1500
|
+
* Append-only semantics: a new wire run rewrites this file in full.
|
|
1501
|
+
* Prior state is not retained — the backup siblings on disk are the
|
|
1502
|
+
* canonical rollback surface, not this file.
|
|
1503
|
+
*/
|
|
1504
|
+
|
|
1505
|
+
declare const WIRE_STATE_VERSION = 1;
|
|
1506
|
+
type WireTargetStatus = 'written' | 'already-wired' | 'skipped' | 'failed';
|
|
1507
|
+
interface WireTargetFile {
|
|
1508
|
+
client: ClientId;
|
|
1509
|
+
method: 'file';
|
|
1510
|
+
status: WireTargetStatus;
|
|
1511
|
+
path: string;
|
|
1512
|
+
backupPath: string | null;
|
|
1513
|
+
rootKey: string;
|
|
1514
|
+
serverName: string;
|
|
1515
|
+
preSha256: string | null;
|
|
1516
|
+
postSha256: string;
|
|
1517
|
+
reason?: string;
|
|
1518
|
+
}
|
|
1519
|
+
interface WireTargetCli {
|
|
1520
|
+
client: ClientId;
|
|
1521
|
+
method: 'cli';
|
|
1522
|
+
status: WireTargetStatus;
|
|
1523
|
+
command: string;
|
|
1524
|
+
stdout?: string;
|
|
1525
|
+
stderr?: string;
|
|
1526
|
+
reason?: string;
|
|
1527
|
+
}
|
|
1528
|
+
type WireTarget = WireTargetFile | WireTargetCli;
|
|
1529
|
+
interface WireState {
|
|
1530
|
+
version: typeof WIRE_STATE_VERSION;
|
|
1531
|
+
sdkVersion: string;
|
|
1532
|
+
writtenAt: string;
|
|
1533
|
+
endpoint: string;
|
|
1534
|
+
targets: WireTarget[];
|
|
1535
|
+
}
|
|
1536
|
+
declare function readWireState(): WireState | null;
|
|
1537
|
+
declare function writeWireState(state: WireState): void;
|
|
1538
|
+
|
|
1539
|
+
/**
|
|
1540
|
+
* Refuse to wire any client whose config sits on a synced volume.
|
|
1405
1541
|
*
|
|
1406
|
-
*
|
|
1407
|
-
*
|
|
1408
|
-
*
|
|
1409
|
-
*
|
|
1410
|
-
* advertised to public callers — they re-enable as the consent
|
|
1411
|
-
* architecture and per-peer grant model land. First-class TypeScript
|
|
1412
|
-
* types, x402 micropayment support, and ES256 provenance verification.
|
|
1542
|
+
* Writing MCP config under iCloud / OneDrive / Dropbox / Google Drive
|
|
1543
|
+
* silently propagates the same `mcpServers.alter` entry (and API key
|
|
1544
|
+
* headers) to every other device the user syncs. That is a consent
|
|
1545
|
+
* violation — wire consent is per-device.
|
|
1413
1546
|
*
|
|
1414
|
-
* The
|
|
1415
|
-
*
|
|
1416
|
-
*
|
|
1547
|
+
* The check is a prefix match against the resolved absolute path; it
|
|
1548
|
+
* is deliberately broader than strictly necessary so that users who
|
|
1549
|
+
* symlink their home directory into a synced volume (a known Mac
|
|
1550
|
+
* pattern) are also caught.
|
|
1417
1551
|
*/
|
|
1552
|
+
interface SyncedVolumeHit {
|
|
1553
|
+
refused: true;
|
|
1554
|
+
matchedPrefix: string;
|
|
1555
|
+
resolvedPath: string;
|
|
1556
|
+
}
|
|
1557
|
+
/**
|
|
1558
|
+
* Returns a hit record if the resolved path lives under a known synced
|
|
1559
|
+
* volume, null otherwise. Normalises path separators so the check is
|
|
1560
|
+
* Windows-safe without hardcoding `\`.
|
|
1561
|
+
*/
|
|
1562
|
+
declare function detectSyncedVolume(path: string): SyncedVolumeHit | null;
|
|
1563
|
+
|
|
1564
|
+
declare function sha256(bytes: string | Buffer): string;
|
|
1418
1565
|
|
|
1566
|
+
/**
|
|
1567
|
+
* Public `wire` / `unwire` entry points.
|
|
1568
|
+
*
|
|
1569
|
+
* `wire()` probes for installed MCP clients, merges the ALTER entry
|
|
1570
|
+
* into each client's config (via atomic JSON merge or CLI handoff),
|
|
1571
|
+
* writes a `wire-state.json` provenance artefact, and returns a
|
|
1572
|
+
* structured report. `unwire()` reads that artefact and reverses
|
|
1573
|
+
* every target.
|
|
1574
|
+
*
|
|
1575
|
+
* Synchronous throughout — the CLI path is sequential and the
|
|
1576
|
+
* deterministic ordering is worth the tiny blocking cost.
|
|
1577
|
+
*/
|
|
1578
|
+
|
|
1579
|
+
interface WireOptions {
|
|
1580
|
+
/** Override the endpoint written into every client config. Defaults to DEFAULT_ENDPOINT. */
|
|
1581
|
+
endpoint?: string;
|
|
1582
|
+
/** Optional API key written into `headers['X-ALTER-API-Key']` for each target. */
|
|
1583
|
+
apiKey?: string;
|
|
1584
|
+
/** Restrict to a subset of client ids. Default: every detected client. */
|
|
1585
|
+
only?: readonly ClientId[];
|
|
1586
|
+
/** Skip any client whose probe said "not installed" even if the caller passed it via `only`. */
|
|
1587
|
+
skipMissing?: boolean;
|
|
1588
|
+
}
|
|
1589
|
+
interface WireReport {
|
|
1590
|
+
state: WireState;
|
|
1591
|
+
probes: ProbeResult[];
|
|
1592
|
+
}
|
|
1593
|
+
declare function wire(opts?: WireOptions): WireReport;
|
|
1594
|
+
interface UnwireReport {
|
|
1595
|
+
state: WireState | null;
|
|
1596
|
+
undone: Array<{
|
|
1597
|
+
client: ClientId;
|
|
1598
|
+
action: 'restored' | 'removed' | 'cli-removed' | 'skipped' | 'failed';
|
|
1599
|
+
reason?: string;
|
|
1600
|
+
}>;
|
|
1601
|
+
}
|
|
1602
|
+
declare function unwire(): UnwireReport;
|
|
1603
|
+
|
|
1604
|
+
/**
|
|
1605
|
+
* Package metadata — kept in a standalone module so deep imports from
|
|
1606
|
+
* `src/wire/` can reference version constants without creating a
|
|
1607
|
+
* circular dependency through `src/index.ts`.
|
|
1608
|
+
*/
|
|
1419
1609
|
declare const SDK_NAME = "@truealter/sdk";
|
|
1420
|
-
declare const SDK_VERSION = "0.
|
|
1610
|
+
declare const SDK_VERSION = "0.3.0";
|
|
1421
1611
|
|
|
1422
|
-
export { AlterAuthError, AlterClient, type AlterClientOptions, AlterDiscoveryError, AlterError, type AlterErrorCode, AlterInvalidResponse, AlterNetworkError, AlterPaymentRequired, AlterProvenanceError, AlterRateLimited, AlterTimeoutError, AlterToolError, type ApiKeyConfig, type Archetype, type AssessTraitsInput, type AssessTraitsOutput, type
|
|
1612
|
+
export { ALL_CLIENTS, AlterAuthError, AlterClient, type AlterClientOptions, AlterDiscoveryError, AlterError, type AlterErrorCode, AlterInvalidResponse, AlterNetworkError, AlterPaymentRequired, AlterProvenanceError, AlterRateLimited, type AlterResolveHandleInput, type AlterResolveHandleOutput, AlterTimeoutError, AlterToolError, type ApiKeyConfig, type Archetype, type AssessTraitsInput, type AssessTraitsOutput, type BeginGoldenThreadInput, type BeginGoldenThreadOutput, CLAUDE_CODE, CLAUDE_DESKTOP, CURSOR, type CheckAssessmentStatusInput, type CheckAssessmentStatusOutput, type CheckGoldenThreadInput, type CheckGoldenThreadOutput, type ClaudeDesktopConfig, type ClaudeDesktopServerConfig, type ClientId, type ClientPaths, type CompleteKnotInput, type CompleteKnotOutput, type ComputeBelongingInput, type ComputeBelongingOutput, DEFAULT_DOMAIN, DEFAULT_ENDPOINT, DEFAULT_VERIFY_AT_ALLOWLIST, type DiscoveryOptions, type DiscoveryResult, type Ed25519Keypair, type EngagementLevel, FREE_TOOL_NAMES, type GenerateClaudeDesktopOptions, type GenerateMatchNarrativeInput, type GenerateMatchNarrativeOutput, type GetAgentPortfolioInput, type GetAgentPortfolioOutput, type GetAgentTrustTierInput, type GetAgentTrustTierOutput, type GetCompetenciesInput, type GetCompetenciesOutput, type GetEarningSummaryInput, type GetEarningSummaryOutput, type GetEngagementLevelInput, type GetEngagementLevelOutput, type GetFullTraitVectorInput, type GetFullTraitVectorOutput, type GetIdentityEarningsInput, type GetIdentityEarningsOutput, type GetIdentityTrustScoreInput, type GetIdentityTrustScoreOutput, type GetMatchRecommendationsInput, type GetMatchRecommendationsOutput, type GetNetworkStatsInput, type GetNetworkStatsOutput, type GetPrivacyBudgetInput, type GetPrivacyBudgetOutput, type GetProfileInput, type GetProfileOutput, type GetSideQuestGraphInput, type GetSideQuestGraphOutput, type GetTraitSnapshotInput, type GetTraitSnapshotOutput, type GoldenThreadStatusInput, type GoldenThreadStatusOutput, type HelloAgentInput, type HelloAgentOutput, type InitiateAssessmentInput, type InitiateAssessmentOutput, type InvocationClaims, type JsonWebKey, type JwksDocument, type ListArchetypesInput, type ListArchetypesOutput, type MCPCallOptions, type MCPCallToolResult, MCPClient, type MCPClientInfo, type MCPClientOptions, type MCPContentBlock, type MCPListToolsResult, type MCPMeta, type MCPResponse, type MCPSigningOptions, type MCPToolDefinition, MCP_PROTOCOL_VERSION, type MatchTier, type McpServerConfig, PREMIUM_TOOL_NAMES, type PaymentEnvelope, type ProbeResult, type ProvenanceEnvelope, type ProvenancePayload, type ProvenanceToken, type ProvenanceVerification, type QueryGraphSimilarityInput, type QueryGraphSimilarityOutput, type QueryMatchesInput, type QueryMatchesOutput, type RecommendToolInput, type RecommendToolOutput, SDK_NAME, SDK_VERSION, type SearchIdentitiesInput, type SearchIdentitiesOutput, type SignInvocationOptions, type SignedToolDefinition, TOOL_BLAST_RADIUS, TOOL_COSTS, TOOL_TIERS, type ThreadCensusInput, type ThreadCensusOutput, type ToolInputs, type ToolName, type ToolOutputs, type ToolSignatureMap, type UnwireReport, VSCODE, type VerifyIdentityInput, type VerifyIdentityOutput, type VerifyProvenanceOptions, type WireOptions, type WireReport, type WireState, type WireTarget, type WireTargetCli, type WireTargetFile, X402Client, type X402ClientOptions, type X402Settlement, type X402Signer, base64urlDecode, base64urlEncode, canonicalArgsSha256, canonicalStringify, clearDiscoveryCache, decodeDid, detectSyncedVolume, discover, encodeDid, fetchPublicKeys, generateClaudeConfig, generateClaudeDesktopConfig, generateCursorConfig, generateGenericMcpConfig, generateKeypair, keypairFromPrivateKey, loadPrivateKey, parsePaymentHeader, probeAll, probeByDir, probeClaudeCode, readWireState, resolveVerifyAt, sha256, sign, signInvocation, unwire, verify, verifyProvenance, verifyToolSignatures, wire, writeWireState };
|