@truealter/sdk 0.2.4 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -36
- package/dist/bin/alter-identity.js +841 -31
- package/dist/bin/mcp-bridge.js +201 -9
- package/dist/index.cjs +785 -24
- package/dist/index.d.cts +677 -41
- package/dist/index.d.ts +677 -41
- package/dist/index.js +712 -28
- package/package.json +4 -3
package/dist/index.d.cts
CHANGED
|
@@ -188,6 +188,14 @@ interface VerifyProvenanceOptions {
|
|
|
188
188
|
verifyAtAllowlist?: readonly string[];
|
|
189
189
|
fetch?: typeof fetch;
|
|
190
190
|
now?: number;
|
|
191
|
+
/**
|
|
192
|
+
* Expected `iss` claim. Defaults to {@link ALTER_PLATFORM_ISS}
|
|
193
|
+
* (`"did:alter:platform"`). Pass an explicit value only when verifying
|
|
194
|
+
* tokens minted by a non-platform issuer (e.g. a test fixture or a
|
|
195
|
+
* whitelabelled deployment). An empty string disables the check — not
|
|
196
|
+
* recommended for production use.
|
|
197
|
+
*/
|
|
198
|
+
expectedIss?: string;
|
|
191
199
|
}
|
|
192
200
|
/**
|
|
193
201
|
* Verify a provenance JWS token against ALTER's published JWKS.
|
|
@@ -406,6 +414,34 @@ interface MCPClientOptions {
|
|
|
406
414
|
clientInfo?: MCPClientInfo;
|
|
407
415
|
/** Optional x402 client for automatic premium tool payment. */
|
|
408
416
|
x402?: X402Client;
|
|
417
|
+
/**
|
|
418
|
+
* Q5c per-invocation signing. When present, every `tools/call` is
|
|
419
|
+
* ES256-signed and submitted with the `Mcp-Invocation-Signature`
|
|
420
|
+
* header. The public half of `privateKey` MUST have been
|
|
421
|
+
* registered via `POST /api/v1/agents/keys` against the same API
|
|
422
|
+
* key configured here. Required whenever `apiKey` is set and the
|
|
423
|
+
* server is in production / staging (hard-required from
|
|
424
|
+
* 2026-04-20).
|
|
425
|
+
*/
|
|
426
|
+
signing?: MCPSigningOptions;
|
|
427
|
+
/**
|
|
428
|
+
* Extra HTTP headers added to every request. Useful when the endpoint
|
|
429
|
+
* sits behind an edge gate that requires its own credentials —
|
|
430
|
+
* e.g. Cloudflare Access service tokens (`CF-Access-Client-Id` +
|
|
431
|
+
* `CF-Access-Client-Secret`). Protocol-level headers (`Content-Type`,
|
|
432
|
+
* `Accept`) and ALTER-internal headers (`X-ALTER-API-Key`,
|
|
433
|
+
* `Mcp-Session-Id`, `Mcp-Invocation-Signature`) always win over
|
|
434
|
+
* collisions here.
|
|
435
|
+
*/
|
|
436
|
+
extraHeaders?: Record<string, string>;
|
|
437
|
+
}
|
|
438
|
+
interface MCPSigningOptions {
|
|
439
|
+
/** The signing-key id pre-registered with the server. */
|
|
440
|
+
kid: string;
|
|
441
|
+
/** ES256 P-256 private key: 32-byte scalar or PEM. */
|
|
442
|
+
privateKey: Uint8Array | string;
|
|
443
|
+
/** The caller's bound ~handle. */
|
|
444
|
+
handle: string;
|
|
409
445
|
}
|
|
410
446
|
interface MCPCallOptions {
|
|
411
447
|
/** Override the configured x402 client for this single call. */
|
|
@@ -454,6 +490,8 @@ declare class MCPClient {
|
|
|
454
490
|
private readonly maxRetries;
|
|
455
491
|
private readonly clientInfo;
|
|
456
492
|
private readonly x402?;
|
|
493
|
+
private readonly signing?;
|
|
494
|
+
private readonly extraHeaders?;
|
|
457
495
|
private requestCounter;
|
|
458
496
|
private initialised;
|
|
459
497
|
constructor(opts?: MCPClientOptions);
|
|
@@ -476,6 +514,12 @@ declare class MCPClient {
|
|
|
476
514
|
*/
|
|
477
515
|
rpc(method: string, params: Record<string, unknown> | unknown[] | undefined): Promise<unknown>;
|
|
478
516
|
private buildHeaders;
|
|
517
|
+
/**
|
|
518
|
+
* Produce the `Mcp-Invocation-Signature` header for a `tools/call`
|
|
519
|
+
* payload, when signing is configured. Returns `undefined` when no
|
|
520
|
+
* signing key is attached or the method is not `tools/call`.
|
|
521
|
+
*/
|
|
522
|
+
private buildSignatureHeader;
|
|
479
523
|
private extractPaymentEnvelope;
|
|
480
524
|
private guessToolName;
|
|
481
525
|
private backoff;
|
|
@@ -580,7 +624,7 @@ interface ListArchetypesOutput {
|
|
|
580
624
|
}
|
|
581
625
|
/** (free) verify_identity — Verify a person is registered with ALTER and validate optional claims */
|
|
582
626
|
interface VerifyIdentityInput {
|
|
583
|
-
|
|
627
|
+
member_id: string;
|
|
584
628
|
email?: string;
|
|
585
629
|
claims?: {
|
|
586
630
|
archetype?: string;
|
|
@@ -595,7 +639,7 @@ interface VerifyIdentityInput {
|
|
|
595
639
|
interface VerifyIdentityOutput {
|
|
596
640
|
ok: boolean;
|
|
597
641
|
verified: boolean;
|
|
598
|
-
|
|
642
|
+
member_id?: string;
|
|
599
643
|
engagement_level?: EngagementLevel;
|
|
600
644
|
archetype?: Archetype;
|
|
601
645
|
claims_valid?: boolean;
|
|
@@ -615,7 +659,7 @@ interface InitiateAssessmentOutput {
|
|
|
615
659
|
}
|
|
616
660
|
/** (free) get_engagement_level — Get a person's identity depth and available query tiers */
|
|
617
661
|
interface GetEngagementLevelInput {
|
|
618
|
-
|
|
662
|
+
member_id: string;
|
|
619
663
|
}
|
|
620
664
|
/** (free) get_engagement_level — output */
|
|
621
665
|
interface GetEngagementLevelOutput {
|
|
@@ -632,12 +676,12 @@ interface GetEngagementLevelOutput {
|
|
|
632
676
|
}
|
|
633
677
|
/** (free) get_profile — Get a person's profile summary */
|
|
634
678
|
interface GetProfileInput {
|
|
635
|
-
|
|
679
|
+
member_id: string;
|
|
636
680
|
}
|
|
637
681
|
/** (free) get_profile — output */
|
|
638
682
|
interface GetProfileOutput {
|
|
639
683
|
ok: boolean;
|
|
640
|
-
|
|
684
|
+
member_id: string;
|
|
641
685
|
assessment_phase?: string;
|
|
642
686
|
archetype?: Archetype;
|
|
643
687
|
engagement_level?: EngagementLevel;
|
|
@@ -645,7 +689,7 @@ interface GetProfileOutput {
|
|
|
645
689
|
}
|
|
646
690
|
/** (free) query_matches — Query matches for a person (tier labels only) */
|
|
647
691
|
interface QueryMatchesInput {
|
|
648
|
-
|
|
692
|
+
member_id: string;
|
|
649
693
|
quality_filter?: MatchTier;
|
|
650
694
|
limit?: number;
|
|
651
695
|
}
|
|
@@ -662,7 +706,7 @@ interface QueryMatchesOutput {
|
|
|
662
706
|
}
|
|
663
707
|
/** (free) get_competencies — Get a person's competency portfolio */
|
|
664
708
|
interface GetCompetenciesInput {
|
|
665
|
-
|
|
709
|
+
member_id: string;
|
|
666
710
|
}
|
|
667
711
|
/** (free) get_competencies — output */
|
|
668
712
|
interface GetCompetenciesOutput {
|
|
@@ -689,7 +733,7 @@ interface SearchIdentitiesInput {
|
|
|
689
733
|
interface SearchIdentitiesOutput {
|
|
690
734
|
ok: boolean;
|
|
691
735
|
identities: Array<{
|
|
692
|
-
|
|
736
|
+
member_id: string;
|
|
693
737
|
trait_summary: Record<string, number>;
|
|
694
738
|
engagement_level?: EngagementLevel;
|
|
695
739
|
}>;
|
|
@@ -697,7 +741,7 @@ interface SearchIdentitiesOutput {
|
|
|
697
741
|
}
|
|
698
742
|
/** (free) get_identity_earnings — Get accrued Identity Income earnings for a person */
|
|
699
743
|
interface GetIdentityEarningsInput {
|
|
700
|
-
|
|
744
|
+
member_id: string;
|
|
701
745
|
}
|
|
702
746
|
/** (free) get_identity_earnings — output */
|
|
703
747
|
interface GetIdentityEarningsOutput {
|
|
@@ -705,7 +749,7 @@ interface GetIdentityEarningsOutput {
|
|
|
705
749
|
total_earned_usd: number;
|
|
706
750
|
pending_usd: number;
|
|
707
751
|
transaction_count: number;
|
|
708
|
-
|
|
752
|
+
unique_orgs: number;
|
|
709
753
|
}
|
|
710
754
|
/** (free) get_network_stats — Get aggregate ALTER network statistics */
|
|
711
755
|
interface GetNetworkStatsInput {
|
|
@@ -731,7 +775,7 @@ interface RecommendToolOutput {
|
|
|
731
775
|
}
|
|
732
776
|
/** (free) get_identity_trust_score — Get the trust score for an identity based on query diversity */
|
|
733
777
|
interface GetIdentityTrustScoreInput {
|
|
734
|
-
|
|
778
|
+
member_id: string;
|
|
735
779
|
}
|
|
736
780
|
/** (free) get_identity_trust_score — output */
|
|
737
781
|
interface GetIdentityTrustScoreOutput {
|
|
@@ -754,7 +798,7 @@ interface CheckAssessmentStatusOutput {
|
|
|
754
798
|
}
|
|
755
799
|
/** (free) get_earning_summary — Get an aggregated x402 earning summary for a person */
|
|
756
800
|
interface GetEarningSummaryInput {
|
|
757
|
-
|
|
801
|
+
member_id: string;
|
|
758
802
|
}
|
|
759
803
|
/** (free) get_earning_summary — output */
|
|
760
804
|
interface GetEarningSummaryOutput {
|
|
@@ -794,7 +838,7 @@ interface GetAgentPortfolioOutput {
|
|
|
794
838
|
}
|
|
795
839
|
/** (free) get_privacy_budget — Check privacy budget status for a person (24h rolling window) */
|
|
796
840
|
interface GetPrivacyBudgetInput {
|
|
797
|
-
|
|
841
|
+
member_id: string;
|
|
798
842
|
}
|
|
799
843
|
/** (free) get_privacy_budget — output */
|
|
800
844
|
interface GetPrivacyBudgetOutput {
|
|
@@ -897,13 +941,13 @@ interface AssessTraitsOutput {
|
|
|
897
941
|
}
|
|
898
942
|
/** (premium L1) get_trait_snapshot — Get the top 5 traits for a person ($0.005) */
|
|
899
943
|
interface GetTraitSnapshotInput {
|
|
900
|
-
|
|
944
|
+
member_id: string;
|
|
901
945
|
_payment?: ProvenanceToken;
|
|
902
946
|
}
|
|
903
947
|
/** (premium L1) get_trait_snapshot — output */
|
|
904
948
|
interface GetTraitSnapshotOutput {
|
|
905
949
|
ok: boolean;
|
|
906
|
-
|
|
950
|
+
member_id: string;
|
|
907
951
|
archetype: Archetype;
|
|
908
952
|
top_traits: Array<{
|
|
909
953
|
name: string;
|
|
@@ -913,13 +957,13 @@ interface GetTraitSnapshotOutput {
|
|
|
913
957
|
}
|
|
914
958
|
/** (premium L2) get_full_trait_vector — Get the complete trait vector (all 33 traits: 29 continuous + 4 categorical) ($0.01) */
|
|
915
959
|
interface GetFullTraitVectorInput {
|
|
916
|
-
|
|
960
|
+
member_id: string;
|
|
917
961
|
_payment?: ProvenanceToken;
|
|
918
962
|
}
|
|
919
963
|
/** (premium L2) get_full_trait_vector — output */
|
|
920
964
|
interface GetFullTraitVectorOutput {
|
|
921
965
|
ok: boolean;
|
|
922
|
-
|
|
966
|
+
member_id: string;
|
|
923
967
|
traits: Array<{
|
|
924
968
|
name: string;
|
|
925
969
|
category: string;
|
|
@@ -929,7 +973,7 @@ interface GetFullTraitVectorOutput {
|
|
|
929
973
|
}
|
|
930
974
|
/** (premium L4) compute_belonging — Compute belonging probability for a person-job pairing ($0.05) */
|
|
931
975
|
interface ComputeBelongingInput {
|
|
932
|
-
|
|
976
|
+
member_id: string;
|
|
933
977
|
job_id: string;
|
|
934
978
|
_payment?: ProvenanceToken;
|
|
935
979
|
}
|
|
@@ -946,7 +990,7 @@ interface ComputeBelongingOutput {
|
|
|
946
990
|
}
|
|
947
991
|
/** (premium L5) get_match_recommendations — Get top N match recommendations for a person ($0.50) */
|
|
948
992
|
interface GetMatchRecommendationsInput {
|
|
949
|
-
|
|
993
|
+
member_id: string;
|
|
950
994
|
limit?: number;
|
|
951
995
|
_payment?: ProvenanceToken;
|
|
952
996
|
}
|
|
@@ -979,7 +1023,7 @@ interface GenerateMatchNarrativeOutput {
|
|
|
979
1023
|
}
|
|
980
1024
|
/** (premium L2) get_side_quest_graph — Get a person's Side Quest Graph (DP noise ε=1.0) ($0.01) */
|
|
981
1025
|
interface GetSideQuestGraphInput {
|
|
982
|
-
|
|
1026
|
+
member_id: string;
|
|
983
1027
|
include_edges?: boolean;
|
|
984
1028
|
min_confidence?: number;
|
|
985
1029
|
_payment?: ProvenanceToken;
|
|
@@ -987,7 +1031,7 @@ interface GetSideQuestGraphInput {
|
|
|
987
1031
|
/** (premium L2) get_side_quest_graph — output */
|
|
988
1032
|
interface GetSideQuestGraphOutput {
|
|
989
1033
|
ok: boolean;
|
|
990
|
-
|
|
1034
|
+
member_id: string;
|
|
991
1035
|
domains: Array<{
|
|
992
1036
|
label: string;
|
|
993
1037
|
confidence: number;
|
|
@@ -1002,15 +1046,15 @@ interface GetSideQuestGraphOutput {
|
|
|
1002
1046
|
}
|
|
1003
1047
|
/** (premium L3) query_graph_similarity — Compare two Side Quest Graphs (DP noise ε=0.5) ($0.025) */
|
|
1004
1048
|
interface QueryGraphSimilarityInput {
|
|
1005
|
-
|
|
1006
|
-
|
|
1049
|
+
member_a_id: string;
|
|
1050
|
+
member_b_id: string;
|
|
1007
1051
|
_payment?: ProvenanceToken;
|
|
1008
1052
|
}
|
|
1009
1053
|
/** (premium L3) query_graph_similarity — output */
|
|
1010
1054
|
interface QueryGraphSimilarityOutput {
|
|
1011
1055
|
ok: boolean;
|
|
1012
|
-
|
|
1013
|
-
|
|
1056
|
+
member_a_id: string;
|
|
1057
|
+
member_b_id: string;
|
|
1014
1058
|
domain_overlap: number;
|
|
1015
1059
|
edge_similarity: number;
|
|
1016
1060
|
complementarity: number;
|
|
@@ -1272,6 +1316,76 @@ declare class AlterClient {
|
|
|
1272
1316
|
fetchPublicKeys(): Promise<unknown>;
|
|
1273
1317
|
}
|
|
1274
1318
|
|
|
1319
|
+
/**
|
|
1320
|
+
* Stable stringify mirroring Python's
|
|
1321
|
+
* `json.dumps(obj, sort_keys=True, separators=(",", ":"), ensure_ascii=False)`.
|
|
1322
|
+
*
|
|
1323
|
+
* Rules:
|
|
1324
|
+
* - object keys are sorted ascending by codepoint
|
|
1325
|
+
* - no whitespace
|
|
1326
|
+
* - `ensure_ascii=False` — non-ASCII characters pass through verbatim
|
|
1327
|
+
* (not re-encoded as \\uXXXX). UTF-8 encoding happens at the byte
|
|
1328
|
+
* layer before hashing.
|
|
1329
|
+
*
|
|
1330
|
+
* This is RFC-8785 adjacent; it is NOT a full JCS implementation
|
|
1331
|
+
* (numeric canonicalisation is delegated to the caller).
|
|
1332
|
+
*/
|
|
1333
|
+
declare function canonicalStringify(value: unknown): string;
|
|
1334
|
+
/**
|
|
1335
|
+
* Hex SHA-256 of the canonical JSON encoding of `toolArgs`. Matches
|
|
1336
|
+
* `canonical_args_sha256` in the server-side verifier.
|
|
1337
|
+
*/
|
|
1338
|
+
declare function canonicalArgsSha256(toolArgs: Record<string, unknown>): string;
|
|
1339
|
+
/**
|
|
1340
|
+
* Load an ES256 P-256 private key.
|
|
1341
|
+
*
|
|
1342
|
+
* Accepts:
|
|
1343
|
+
* - a 32-byte `Uint8Array` containing the raw d-scalar
|
|
1344
|
+
* - a PEM string (PKCS#8 or SEC1). Node's `crypto.createPrivateKey`
|
|
1345
|
+
* is used when available to parse the PEM; on non-Node runtimes
|
|
1346
|
+
* only the raw-bytes form is supported.
|
|
1347
|
+
*/
|
|
1348
|
+
declare function loadPrivateKey(key: Uint8Array | string): Uint8Array;
|
|
1349
|
+
interface InvocationClaims {
|
|
1350
|
+
/** Tool name — must equal the `tools/call` `params.name`. */
|
|
1351
|
+
tool: string;
|
|
1352
|
+
/** Hex SHA-256 of canonical-JSON `tool_args`. */
|
|
1353
|
+
args_sha256: string;
|
|
1354
|
+
/** Random string, at least ~16 bytes of entropy (base64url). */
|
|
1355
|
+
nonce: string;
|
|
1356
|
+
/** Epoch seconds. Server accepts ±60s skew. */
|
|
1357
|
+
iat: number;
|
|
1358
|
+
/** The caller's bound ~handle. */
|
|
1359
|
+
iss: string;
|
|
1360
|
+
}
|
|
1361
|
+
interface SignInvocationOptions {
|
|
1362
|
+
/** The signing-key id pre-registered on the server. */
|
|
1363
|
+
kid: string;
|
|
1364
|
+
/** P-256 private key (32-byte Uint8Array or PEM string). */
|
|
1365
|
+
privateKey: Uint8Array | string;
|
|
1366
|
+
/** The caller's bound ~handle. */
|
|
1367
|
+
handle: string;
|
|
1368
|
+
/** Override nonce (tests). Defaults to 24 random bytes base64url. */
|
|
1369
|
+
nonce?: string;
|
|
1370
|
+
/** Override iat (tests). Defaults to now. */
|
|
1371
|
+
iatSeconds?: number;
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1374
|
+
* Produce the `Mcp-Invocation-Signature` header value for a single
|
|
1375
|
+
* `tools/call`. The returned string is a compact JWS:
|
|
1376
|
+
* `base64url(header) . base64url(payload) . base64url(signature)`
|
|
1377
|
+
*
|
|
1378
|
+
* Usage:
|
|
1379
|
+
*
|
|
1380
|
+
* ```ts
|
|
1381
|
+
* const header = signInvocation("get_profile", { member_id: "abc" }, {
|
|
1382
|
+
* kid, privateKey, handle: "~tester",
|
|
1383
|
+
* });
|
|
1384
|
+
* fetch(url, { headers: { "Mcp-Invocation-Signature": header } });
|
|
1385
|
+
* ```
|
|
1386
|
+
*/
|
|
1387
|
+
declare function signInvocation(toolName: string, toolArgs: Record<string, unknown>, options: SignInvocationOptions): string;
|
|
1388
|
+
|
|
1275
1389
|
interface McpServerConfig {
|
|
1276
1390
|
url: string;
|
|
1277
1391
|
transport: 'streamable-http';
|
|
@@ -1316,25 +1430,547 @@ declare function generateClaudeConfig(opts?: GenerateMcpConfigOptions): GenericM
|
|
|
1316
1430
|
declare function generateCursorConfig(opts?: GenerateMcpConfigOptions): GenericMcpConfig;
|
|
1317
1431
|
|
|
1318
1432
|
/**
|
|
1319
|
-
*
|
|
1433
|
+
* Claude Desktop MCP config helper.
|
|
1320
1434
|
*
|
|
1321
|
-
*
|
|
1322
|
-
*
|
|
1323
|
-
* `
|
|
1324
|
-
*
|
|
1325
|
-
*
|
|
1326
|
-
* advertised to public callers — they re-enable as the consent
|
|
1327
|
-
* architecture and per-peer grant model land. First-class TypeScript
|
|
1328
|
-
* types, x402 micropayment support, and ES256 provenance verification.
|
|
1435
|
+
* Claude Desktop speaks stdio only — it does not currently dial
|
|
1436
|
+
* Streamable-HTTP MCP servers directly. The canonical bridge is our
|
|
1437
|
+
* own `alter-mcp-bridge` binary, which is published alongside this CLI
|
|
1438
|
+
* in the same npm package. Desktop hosts then spawn the bridge as a
|
|
1439
|
+
* child process and read JSON-RPC over stdin/stdout.
|
|
1329
1440
|
*
|
|
1330
|
-
*
|
|
1331
|
-
* `
|
|
1332
|
-
* `https://mcp.truealter.com/api/v1/mcp`; the bare host
|
|
1333
|
-
* `https://mcp.truealter.com` is the branded discovery surface and
|
|
1334
|
-
* returns `405 Method Not Allowed` for JSON-RPC POSTs.
|
|
1441
|
+
* Config file path varies by platform and is resolved in
|
|
1442
|
+
* `src/wire/paths.ts`. This adapter only produces the config *shape*.
|
|
1335
1443
|
*/
|
|
1444
|
+
interface ClaudeDesktopServerConfig {
|
|
1445
|
+
command: string;
|
|
1446
|
+
args?: string[];
|
|
1447
|
+
env?: Record<string, string>;
|
|
1448
|
+
description?: string;
|
|
1449
|
+
}
|
|
1450
|
+
interface ClaudeDesktopConfig {
|
|
1451
|
+
mcpServers: Record<string, ClaudeDesktopServerConfig>;
|
|
1452
|
+
}
|
|
1453
|
+
interface GenerateClaudeDesktopOptions {
|
|
1454
|
+
/** Override the MCP endpoint the bridge dials. Defaults to DEFAULT_ENDPOINT. */
|
|
1455
|
+
endpoint?: string;
|
|
1456
|
+
/** Optional API key passed via `ALTER_API_KEY` env so it never lands in argv. */
|
|
1457
|
+
apiKey?: string;
|
|
1458
|
+
/** Identifier used by Claude Desktop for this server. Default: `alter`. */
|
|
1459
|
+
serverName?: string;
|
|
1460
|
+
/** Override the bridge command (e.g. `npx alter-mcp-bridge`). Default: bare `alter-mcp-bridge`. */
|
|
1461
|
+
bridgeCommand?: string;
|
|
1462
|
+
/** Extra args appended after the default bridge args. */
|
|
1463
|
+
extraArgs?: string[];
|
|
1464
|
+
}
|
|
1465
|
+
declare function generateClaudeDesktopConfig(opts?: GenerateClaudeDesktopOptions): ClaudeDesktopConfig;
|
|
1466
|
+
|
|
1467
|
+
type ClientId = 'claude-code' | 'cursor' | 'claude-desktop' | 'vscode';
|
|
1468
|
+
interface ClientPaths {
|
|
1469
|
+
id: ClientId;
|
|
1470
|
+
/** Human-readable label. */
|
|
1471
|
+
label: string;
|
|
1472
|
+
/** The config file the wire step will mutate (or null if the client uses a CLI-only handoff). */
|
|
1473
|
+
configPath: string | null;
|
|
1474
|
+
/** A sibling directory whose presence counts as "the client is installed on this box". */
|
|
1475
|
+
probeDir: string;
|
|
1476
|
+
/** The `mcpServers`-shaped root key under which our entry is written. Defaults to `mcpServers`. */
|
|
1477
|
+
rootKey: string;
|
|
1478
|
+
}
|
|
1479
|
+
declare const CLAUDE_CODE: ClientPaths;
|
|
1480
|
+
declare const CURSOR: ClientPaths;
|
|
1481
|
+
declare const CLAUDE_DESKTOP: ClientPaths;
|
|
1482
|
+
declare const VSCODE: ClientPaths;
|
|
1483
|
+
declare const ALL_CLIENTS: readonly ClientPaths[];
|
|
1336
1484
|
|
|
1485
|
+
/**
|
|
1486
|
+
* Detect which MCP-aware clients are installed on this machine.
|
|
1487
|
+
*
|
|
1488
|
+
* Probe signals, per client:
|
|
1489
|
+
* - claude-code : `claude` binary resolvable on PATH (spawn `--version`)
|
|
1490
|
+
* - cursor : `~/.cursor/` directory exists
|
|
1491
|
+
* - claude-desktop: platform config directory exists
|
|
1492
|
+
* - vscode : VS Code user data directory exists
|
|
1493
|
+
*
|
|
1494
|
+
* The probe is deliberately permissive — "the config directory exists"
|
|
1495
|
+
* means either the app is installed or was recently installed. Wire
|
|
1496
|
+
* will still refuse if the config file ends up on a synced volume.
|
|
1497
|
+
*/
|
|
1498
|
+
|
|
1499
|
+
interface ProbeResult {
|
|
1500
|
+
client: ClientPaths;
|
|
1501
|
+
installed: boolean;
|
|
1502
|
+
/** Only present for claude-code — records `claude --version` output when resolvable. */
|
|
1503
|
+
version?: string;
|
|
1504
|
+
/** Diagnostic trail — why we said installed/not. */
|
|
1505
|
+
reason: string;
|
|
1506
|
+
}
|
|
1507
|
+
declare function probeClaudeCode(): ProbeResult;
|
|
1508
|
+
declare function probeByDir(id: ClientId): ProbeResult;
|
|
1509
|
+
declare function probeAll(): ProbeResult[];
|
|
1510
|
+
|
|
1511
|
+
/**
|
|
1512
|
+
* `wire-state.json` provenance artefact.
|
|
1513
|
+
*
|
|
1514
|
+
* Written to `$XDG_CONFIG_HOME/alter/wire-state.json` after every wire
|
|
1515
|
+
* run. Holds everything `unwire` needs to reverse the operation without
|
|
1516
|
+
* guessing, plus enough metadata (SDK version, timestamps, SHAs pre and
|
|
1517
|
+
* post) to make the operation auditable.
|
|
1518
|
+
*
|
|
1519
|
+
* Append-only semantics: a new wire run rewrites this file in full.
|
|
1520
|
+
* Prior state is not retained — the backup siblings on disk are the
|
|
1521
|
+
* canonical rollback surface, not this file.
|
|
1522
|
+
*/
|
|
1523
|
+
|
|
1524
|
+
declare const WIRE_STATE_VERSION = 1;
|
|
1525
|
+
type WireTargetStatus = 'written' | 'already-wired' | 'skipped' | 'failed';
|
|
1526
|
+
interface WireTargetFile {
|
|
1527
|
+
client: ClientId;
|
|
1528
|
+
method: 'file';
|
|
1529
|
+
status: WireTargetStatus;
|
|
1530
|
+
path: string;
|
|
1531
|
+
backupPath: string | null;
|
|
1532
|
+
rootKey: string;
|
|
1533
|
+
serverName: string;
|
|
1534
|
+
preSha256: string | null;
|
|
1535
|
+
postSha256: string;
|
|
1536
|
+
reason?: string;
|
|
1537
|
+
}
|
|
1538
|
+
interface WireTargetCli {
|
|
1539
|
+
client: ClientId;
|
|
1540
|
+
method: 'cli';
|
|
1541
|
+
status: WireTargetStatus;
|
|
1542
|
+
command: string;
|
|
1543
|
+
stdout?: string;
|
|
1544
|
+
stderr?: string;
|
|
1545
|
+
reason?: string;
|
|
1546
|
+
}
|
|
1547
|
+
type WireTarget = WireTargetFile | WireTargetCli;
|
|
1548
|
+
interface WireState {
|
|
1549
|
+
version: typeof WIRE_STATE_VERSION;
|
|
1550
|
+
sdkVersion: string;
|
|
1551
|
+
writtenAt: string;
|
|
1552
|
+
endpoint: string;
|
|
1553
|
+
targets: WireTarget[];
|
|
1554
|
+
}
|
|
1555
|
+
declare function readWireState(): WireState | null;
|
|
1556
|
+
declare function writeWireState(state: WireState): void;
|
|
1557
|
+
|
|
1558
|
+
/**
|
|
1559
|
+
* Refuse to wire any client whose config sits on a synced volume.
|
|
1560
|
+
*
|
|
1561
|
+
* Writing MCP config under iCloud / OneDrive / Dropbox / Google Drive
|
|
1562
|
+
* silently propagates the same `mcpServers.alter` entry (and API key
|
|
1563
|
+
* headers) to every other device the user syncs. That is a consent
|
|
1564
|
+
* violation — wire consent is per-device.
|
|
1565
|
+
*
|
|
1566
|
+
* The check is a prefix match against the resolved absolute path; it
|
|
1567
|
+
* is deliberately broader than strictly necessary so that users who
|
|
1568
|
+
* symlink their home directory into a synced volume (a known Mac
|
|
1569
|
+
* pattern) are also caught.
|
|
1570
|
+
*/
|
|
1571
|
+
interface SyncedVolumeHit {
|
|
1572
|
+
refused: true;
|
|
1573
|
+
matchedPrefix: string;
|
|
1574
|
+
resolvedPath: string;
|
|
1575
|
+
}
|
|
1576
|
+
/**
|
|
1577
|
+
* Returns a hit record if the resolved path lives under a known synced
|
|
1578
|
+
* volume, null otherwise. Normalises path separators so the check is
|
|
1579
|
+
* Windows-safe without hardcoding `\`.
|
|
1580
|
+
*/
|
|
1581
|
+
declare function detectSyncedVolume(path: string): SyncedVolumeHit | null;
|
|
1582
|
+
|
|
1583
|
+
declare function sha256(bytes: string | Buffer): string;
|
|
1584
|
+
|
|
1585
|
+
/**
|
|
1586
|
+
* Public `wire` / `unwire` entry points.
|
|
1587
|
+
*
|
|
1588
|
+
* `wire()` probes for installed MCP clients, merges the ALTER entry
|
|
1589
|
+
* into each client's config (via atomic JSON merge or CLI handoff),
|
|
1590
|
+
* writes a `wire-state.json` provenance artefact, and returns a
|
|
1591
|
+
* structured report. `unwire()` reads that artefact and reverses
|
|
1592
|
+
* every target.
|
|
1593
|
+
*
|
|
1594
|
+
* Synchronous throughout — the CLI path is sequential and the
|
|
1595
|
+
* deterministic ordering is worth the tiny blocking cost.
|
|
1596
|
+
*/
|
|
1597
|
+
|
|
1598
|
+
interface WireOptions {
|
|
1599
|
+
/** Override the endpoint written into every client config. Defaults to DEFAULT_ENDPOINT. */
|
|
1600
|
+
endpoint?: string;
|
|
1601
|
+
/** Optional API key written into `headers['X-ALTER-API-Key']` for each target. */
|
|
1602
|
+
apiKey?: string;
|
|
1603
|
+
/** Restrict to a subset of client ids. Default: every detected client. */
|
|
1604
|
+
only?: readonly ClientId[];
|
|
1605
|
+
/** Skip any client whose probe said "not installed" even if the caller passed it via `only`. */
|
|
1606
|
+
skipMissing?: boolean;
|
|
1607
|
+
}
|
|
1608
|
+
interface WireReport {
|
|
1609
|
+
state: WireState;
|
|
1610
|
+
probes: ProbeResult[];
|
|
1611
|
+
}
|
|
1612
|
+
declare function wire(opts?: WireOptions): WireReport;
|
|
1613
|
+
interface UnwireReport {
|
|
1614
|
+
state: WireState | null;
|
|
1615
|
+
undone: Array<{
|
|
1616
|
+
client: ClientId;
|
|
1617
|
+
action: 'restored' | 'removed' | 'cli-removed' | 'skipped' | 'failed';
|
|
1618
|
+
reason?: string;
|
|
1619
|
+
}>;
|
|
1620
|
+
}
|
|
1621
|
+
declare function unwire(): UnwireReport;
|
|
1622
|
+
|
|
1623
|
+
/**
|
|
1624
|
+
* @truealter/sdk — alter_homepage MCP tool types
|
|
1625
|
+
*
|
|
1626
|
+
* Wire-format types for the user-authored, externally-queryable identity
|
|
1627
|
+
* homepage surface ratified (proposed) as D-CUST-PORTFOLIO-1 in
|
|
1628
|
+
* alter-internal Session 54.
|
|
1629
|
+
*
|
|
1630
|
+
* Tool name note: ratified-as `alter_portfolio` in the proposed DR;
|
|
1631
|
+
* shipping as `alter_homepage` because `alter_portfolio` is already
|
|
1632
|
+
* taken by the verified-attestations tool in mcp-alter (different
|
|
1633
|
+
* concept). Per the handover's explicit fallback. The DR text and
|
|
1634
|
+
* companion docs may still say "portfolio" — the wire-format and
|
|
1635
|
+
* tool-name-on-server are `homepage`.
|
|
1636
|
+
*
|
|
1637
|
+
* Wire-format rule: every field name matches the JSON Schema property
|
|
1638
|
+
* name exactly (snake_case). These are passed straight into JSON-RPC
|
|
1639
|
+
* `arguments` and rendered straight from JSON-RPC `result`.
|
|
1640
|
+
*/
|
|
1641
|
+
/**
|
|
1642
|
+
* Provenance class for a HomepageManifest field. Determines how a
|
|
1643
|
+
* conforming MCP consumer renders the value:
|
|
1644
|
+
*
|
|
1645
|
+
* - `declared`: user wrote the literal value. Render verbatim.
|
|
1646
|
+
* - `derived`: computed from active + consented signals. Render with
|
|
1647
|
+
* provenance class surfaced to the viewer (e.g. an italic gloss).
|
|
1648
|
+
* - `attested`: verified by a recognised entity (Org Alter, ceremony,
|
|
1649
|
+
* external attester). Render with provenance + attester surfaced.
|
|
1650
|
+
*/
|
|
1651
|
+
type HomepageFieldProvenance = "declared" | "derived" | "attested";
|
|
1652
|
+
/**
|
|
1653
|
+
* One field of a HomepageManifest. Every field carries its provenance
|
|
1654
|
+
* class so MCP consumers can render appropriately. The `value` shape is
|
|
1655
|
+
* field-specific — this is a discriminated parent; consumers should
|
|
1656
|
+
* narrow on the manifest's field name, not on `value`'s runtime shape.
|
|
1657
|
+
*/
|
|
1658
|
+
interface HomepageField<T = unknown> {
|
|
1659
|
+
/** The user-facing value. Type depends on which field this is. */
|
|
1660
|
+
value: T;
|
|
1661
|
+
/** Where this value comes from. */
|
|
1662
|
+
provenance: HomepageFieldProvenance;
|
|
1663
|
+
/**
|
|
1664
|
+
* For `attested` fields, the entity that attested. Optional on the
|
|
1665
|
+
* other provenance classes (where it would be redundant).
|
|
1666
|
+
*/
|
|
1667
|
+
attester?: string;
|
|
1668
|
+
}
|
|
1669
|
+
/**
|
|
1670
|
+
* The wire-format manifest returned by `alter_homepage(handle)`.
|
|
1671
|
+
*
|
|
1672
|
+
* Fields are individually optional — a HomepageManifest with only a
|
|
1673
|
+
* handle and an opener is valid. MCP consumers MUST NOT assume any
|
|
1674
|
+
* field other than `handle` is present.
|
|
1675
|
+
*/
|
|
1676
|
+
interface HomepageManifest {
|
|
1677
|
+
/** The ~handle being queried. Always present. */
|
|
1678
|
+
handle: string;
|
|
1679
|
+
/**
|
|
1680
|
+
* Single-line user-authored self-description. Maximum 240 chars
|
|
1681
|
+
* after NFC normalisation, after the install-time ANSI sanitiser
|
|
1682
|
+
* pass. Always declared-provenance.
|
|
1683
|
+
*/
|
|
1684
|
+
whoami?: HomepageField<string>;
|
|
1685
|
+
/**
|
|
1686
|
+
* Rotating or static user-authored line. Maximum 280 chars after
|
|
1687
|
+
* NFC normalisation, after the install-time ANSI sanitiser pass.
|
|
1688
|
+
* The literal `~` substitutes the active handle at render time.
|
|
1689
|
+
* Always declared-provenance.
|
|
1690
|
+
*/
|
|
1691
|
+
opener?: HomepageField<string>;
|
|
1692
|
+
/**
|
|
1693
|
+
* Composed-glyph string (from typed primitives, D-CUST-1 M3). The
|
|
1694
|
+
* sigil is a string of renderer-recognised primitive references —
|
|
1695
|
+
* not raw glyph codes — so different consumers can render the same
|
|
1696
|
+
* sigil distinctly. Provenance is `declared` for user-composed,
|
|
1697
|
+
* `derived` for sigil-from-thread-graph crystallisation.
|
|
1698
|
+
*/
|
|
1699
|
+
sigil?: HomepageField<string>;
|
|
1700
|
+
/** User's pronouns (already-shipped surface). Always declared. */
|
|
1701
|
+
pronouns?: HomepageField<string>;
|
|
1702
|
+
/**
|
|
1703
|
+
* List of recognised Seat glyphs the holder is bound to. Provenance
|
|
1704
|
+
* is always `attested` (ceremony-attested, server-side resolved);
|
|
1705
|
+
* `attester` will be `~alter` for protocol-observed Seats.
|
|
1706
|
+
*/
|
|
1707
|
+
seats?: HomepageField<readonly string[]>;
|
|
1708
|
+
/**
|
|
1709
|
+
* Glyph from the user's attunement-grade library. Provenance is
|
|
1710
|
+
* `derived` (from the user's identity vector); the underlying
|
|
1711
|
+
* computation is L3-local and the chosen glyph is declared-from-
|
|
1712
|
+
* derived-measure (user picks within a library gated by their
|
|
1713
|
+
* attunement grade).
|
|
1714
|
+
*/
|
|
1715
|
+
attunement_glyph?: HomepageField<string>;
|
|
1716
|
+
/**
|
|
1717
|
+
* Optional, opt-in per query context. Coarse Golden-Thread summary;
|
|
1718
|
+
* provenance is `derived`. MCP consumers MUST NOT request this field
|
|
1719
|
+
* by default — only on explicit per-call consent. Consumers in the
|
|
1720
|
+
* workplace/education vertical MUST NOT request this field at all
|
|
1721
|
+
* (clause-4 caller-context gate).
|
|
1722
|
+
*/
|
|
1723
|
+
thread_strand?: HomepageField<string>;
|
|
1724
|
+
/**
|
|
1725
|
+
* TOML block of MCP-consumer rendering hints (order, density, etc).
|
|
1726
|
+
* Consumers are free to ignore. Provenance is always `declared`.
|
|
1727
|
+
*/
|
|
1728
|
+
render_hints?: HomepageField<Record<string, unknown>>;
|
|
1729
|
+
}
|
|
1730
|
+
/**
|
|
1731
|
+
* Input arguments for the `alter_homepage` MCP tool.
|
|
1732
|
+
*
|
|
1733
|
+
* The `fields` argument lets a consumer request a subset; omitting it
|
|
1734
|
+
* returns all fields the caller is permitted to read under the consent
|
|
1735
|
+
* + caller-context gates.
|
|
1736
|
+
*/
|
|
1737
|
+
interface HomepageInput {
|
|
1738
|
+
/** The ~handle to query. */
|
|
1739
|
+
handle: string;
|
|
1740
|
+
/**
|
|
1741
|
+
* Optional whitelist of field names. If omitted, the server returns
|
|
1742
|
+
* all fields the caller is permitted to read. Unknown field names
|
|
1743
|
+
* are silently ignored (forward-compatible — adding a new field does
|
|
1744
|
+
* not break old consumers).
|
|
1745
|
+
*/
|
|
1746
|
+
fields?: readonly (keyof HomepageManifest)[];
|
|
1747
|
+
}
|
|
1748
|
+
/**
|
|
1749
|
+
* Output of the `alter_homepage` MCP tool. The `manifest` field is
|
|
1750
|
+
* always present on `ok: true`; on error, the `error` field carries a
|
|
1751
|
+
* structured reason the user can act on.
|
|
1752
|
+
*/
|
|
1753
|
+
interface HomepageOutput {
|
|
1754
|
+
ok: boolean;
|
|
1755
|
+
manifest?: HomepageManifest;
|
|
1756
|
+
error?: {
|
|
1757
|
+
code: string;
|
|
1758
|
+
message: string;
|
|
1759
|
+
data?: Record<string, unknown>;
|
|
1760
|
+
};
|
|
1761
|
+
}
|
|
1762
|
+
/**
|
|
1763
|
+
* Caller-context gate: which categories of caller may read which
|
|
1764
|
+
* provenance classes. Enforced server-side; documented here for SDK
|
|
1765
|
+
* consumers building higher-level wrappers.
|
|
1766
|
+
*
|
|
1767
|
+
* - `workplace` / `education` callers MUST NOT receive `derived` or
|
|
1768
|
+
* `attested` provenance fields without explicit per-field consent
|
|
1769
|
+
* (EU AI Act Art 5(1)(d) categorical).
|
|
1770
|
+
* - All other callers may read `declared` and `attested` fields by
|
|
1771
|
+
* default; `derived` fields require stream-specific consent per
|
|
1772
|
+
* IaI clause 5.
|
|
1773
|
+
*/
|
|
1774
|
+
type HomepageCallerVertical = "workplace" | "education" | "personal" | "civic" | "agent" | "unknown";
|
|
1775
|
+
/** Maximum sizes from the spec. SDK consumers can use these to validate
|
|
1776
|
+
* input before sending. Mirrored from
|
|
1777
|
+
* `docs/technical/alter-portfolio-manifest-v1.md` (forthcoming) and
|
|
1778
|
+
* the proposed-D-CUST-PORTFOLIO-1 DR. */
|
|
1779
|
+
declare const HOMEPAGE_LIMITS: {
|
|
1780
|
+
readonly whoami_max_chars: 240;
|
|
1781
|
+
readonly opener_max_chars: 280;
|
|
1782
|
+
readonly pronouns_max_chars: 32;
|
|
1783
|
+
readonly attunement_glyph_max_chars: 16;
|
|
1784
|
+
};
|
|
1785
|
+
|
|
1786
|
+
/**
|
|
1787
|
+
* @truealter/sdk — theme pack types (D-CUST-1 substrate, Wave 2)
|
|
1788
|
+
*
|
|
1789
|
+
* Wire-format types for ALTER theme packs and `themes.lock` composition
|
|
1790
|
+
* manifests. The full specification lives in
|
|
1791
|
+
* `docs/technical/alter-theme-pack-spec-v1.md`; the architecture spike
|
|
1792
|
+
* (with threat model F1–F10) lives in
|
|
1793
|
+
* `.repos/internal/02-Technical-Strategy/alter-theme-packs-architecture-spike.md`.
|
|
1794
|
+
*
|
|
1795
|
+
* These types describe the on-the-wire shape of theme manifests as they
|
|
1796
|
+
* are produced by `alter theme install`, persisted to `themes.lock`,
|
|
1797
|
+
* and shared via the `theme_share` MCP tool. They do NOT describe the
|
|
1798
|
+
* runtime renderer's internal state.
|
|
1799
|
+
*
|
|
1800
|
+
* No runtime side effects, no external imports, ESM-compatible.
|
|
1801
|
+
*/
|
|
1802
|
+
/** The single allowed `palette.floor` value in v1. New floors require schema bump. */
|
|
1803
|
+
type PaletteFloorV1 = "muted-gold";
|
|
1804
|
+
/** Enumerated text-style values. Free strings are rejected by the loader. */
|
|
1805
|
+
type PaletteText = "default" | "high-contrast" | "warm";
|
|
1806
|
+
/** Enumerated status-line slot names. Packs MAY use a permutation of any subset. */
|
|
1807
|
+
type StatusLineSlot = "handle" | "attunement" | "seat" | "thread_strand" | "pronouns" | "org";
|
|
1808
|
+
/** Enumerated status-line density. */
|
|
1809
|
+
type StatusLineDensity = "compact" | "roomy";
|
|
1810
|
+
/** Enumerated greeting-register values. Passes to the Mirror voice register selector. */
|
|
1811
|
+
type GreetingRegister = "intimate" | "formal" | "playful" | "spare";
|
|
1812
|
+
/** Enumerated panel-density values for `alter room`. */
|
|
1813
|
+
type PanelDensity = "compact" | "roomy";
|
|
1814
|
+
/** `[meta]` section. */
|
|
1815
|
+
interface ThemeMeta {
|
|
1816
|
+
name: string;
|
|
1817
|
+
/** SemVer-shaped recommended; informational only. Resolution uses pack_id. */
|
|
1818
|
+
version: string;
|
|
1819
|
+
/** MUST be a ~handle whose D-ID8 public key signs the pack. */
|
|
1820
|
+
author: string;
|
|
1821
|
+
/** ≤ 240 characters after NFC. */
|
|
1822
|
+
description: string;
|
|
1823
|
+
/** OPTIONAL — surfaced by curated resolvers; not rendered by ALTER. */
|
|
1824
|
+
repo?: string;
|
|
1825
|
+
/** OPTIONAL — surfaced by curated resolvers; not rendered by ALTER. */
|
|
1826
|
+
docs_url?: string;
|
|
1827
|
+
}
|
|
1828
|
+
/** `[palette]` section. Renderer enforces gamut; out-of-gamut packs are rejected. */
|
|
1829
|
+
interface ThemePalette {
|
|
1830
|
+
floor: PaletteFloorV1;
|
|
1831
|
+
/** Hex colour clamped to the published accent-slot gamut. */
|
|
1832
|
+
accent: string;
|
|
1833
|
+
text: PaletteText;
|
|
1834
|
+
}
|
|
1835
|
+
/** `[opener]` section. */
|
|
1836
|
+
interface ThemeOpener {
|
|
1837
|
+
/** ≤ 32 entries, each ≤ 240 chars after sanitisation. `~` substitutes the active handle. */
|
|
1838
|
+
library: readonly string[];
|
|
1839
|
+
}
|
|
1840
|
+
/** `[sigil]` section. All values MUST refer to renderer-shipped typed primitives. */
|
|
1841
|
+
interface ThemeSigil {
|
|
1842
|
+
glyph_set: string;
|
|
1843
|
+
trill: string;
|
|
1844
|
+
accent_glyph: string;
|
|
1845
|
+
}
|
|
1846
|
+
/** `[status_line]` section. */
|
|
1847
|
+
interface ThemeStatusLine {
|
|
1848
|
+
/** Permutation of any subset of StatusLineSlot. */
|
|
1849
|
+
order: readonly StatusLineSlot[];
|
|
1850
|
+
density: StatusLineDensity;
|
|
1851
|
+
}
|
|
1852
|
+
/** `[render_hints]` section. */
|
|
1853
|
+
interface ThemeRenderHints {
|
|
1854
|
+
greeting_register: GreetingRegister;
|
|
1855
|
+
panel_density: PanelDensity;
|
|
1856
|
+
}
|
|
1857
|
+
/** `[assets]` section. Paths MUST be repo-relative without `..` segments. */
|
|
1858
|
+
interface ThemeAssets {
|
|
1859
|
+
/** Optional — if omitted, no assets are loaded. */
|
|
1860
|
+
glyphs?: readonly string[];
|
|
1861
|
+
}
|
|
1862
|
+
/**
|
|
1863
|
+
* Complete pack manifest (the parsed-TOML shape of `theme.toml` v1).
|
|
1864
|
+
*
|
|
1865
|
+
* Closed-world: any unknown top-level key MUST cause the loader to
|
|
1866
|
+
* reject the pack. Parsers consuming an arbitrary TOML file should
|
|
1867
|
+
* narrow against this type rather than infer.
|
|
1868
|
+
*/
|
|
1869
|
+
interface ThemeManifestV1 {
|
|
1870
|
+
schema_version: 1;
|
|
1871
|
+
meta: ThemeMeta;
|
|
1872
|
+
palette: ThemePalette;
|
|
1873
|
+
opener?: ThemeOpener;
|
|
1874
|
+
sigil?: ThemeSigil;
|
|
1875
|
+
status_line?: ThemeStatusLine;
|
|
1876
|
+
render_hints?: ThemeRenderHints;
|
|
1877
|
+
assets?: ThemeAssets;
|
|
1878
|
+
}
|
|
1879
|
+
/**
|
|
1880
|
+
* The `.sig` file accompanying every pack. Verification logic lives in
|
|
1881
|
+
* `alter-cli/src/theme/sign.ts`; this is the wire-format type only.
|
|
1882
|
+
*/
|
|
1883
|
+
interface ThemeSignatureManifest {
|
|
1884
|
+
/** SHA-256 multihash of the canonical-form pack. */
|
|
1885
|
+
pack_id: string;
|
|
1886
|
+
/** ~handle of the signer; MUST equal manifest.meta.author. */
|
|
1887
|
+
signer: string;
|
|
1888
|
+
/** RFC 3339 UTC timestamp at signing time. */
|
|
1889
|
+
signed_at: string;
|
|
1890
|
+
/** `ed25519:<base64url-encoded-signature>`. */
|
|
1891
|
+
sig: string;
|
|
1892
|
+
}
|
|
1893
|
+
/** One pack entry in the user-side composition lockfile. */
|
|
1894
|
+
interface ThemeLockEntry {
|
|
1895
|
+
/**
|
|
1896
|
+
* Where the pack was resolved from. One of:
|
|
1897
|
+
* - `git+<url>#<ref>` git-URL pin
|
|
1898
|
+
* - `@<author>/<name>` curated-resolver tuple
|
|
1899
|
+
* - `path:<rel-path>` local-path pin (for development)
|
|
1900
|
+
*/
|
|
1901
|
+
source: string;
|
|
1902
|
+
pack_id: string;
|
|
1903
|
+
signer: string;
|
|
1904
|
+
/** Higher wins on slot conflict; equal priority breaks lex by pack_id. */
|
|
1905
|
+
priority: number;
|
|
1906
|
+
}
|
|
1907
|
+
/**
|
|
1908
|
+
* The user-side composition manifest. This is the publishable artefact
|
|
1909
|
+
* — what someone shares when they say "here is my ALTER".
|
|
1910
|
+
*
|
|
1911
|
+
* Re-applying the same lockfile against the same renderer version MUST
|
|
1912
|
+
* produce a bit-identical render, modulo the `attunement_glyph` field
|
|
1913
|
+
* which is derived per-render from the user's identity vector.
|
|
1914
|
+
*/
|
|
1915
|
+
interface ThemesLockV1 {
|
|
1916
|
+
schema_version: 1;
|
|
1917
|
+
/** e.g. "alter-cli/0.5.0" — informational, not load-bearing. */
|
|
1918
|
+
generated_by: string;
|
|
1919
|
+
/** RFC 3339 UTC timestamp at lockfile-write time. */
|
|
1920
|
+
generated_at: string;
|
|
1921
|
+
pack: readonly ThemeLockEntry[];
|
|
1922
|
+
/**
|
|
1923
|
+
* User-side per-slot overrides applied AFTER pack composition. Keys
|
|
1924
|
+
* are dotted slot names (e.g. `palette.accent`, `sigil.trill`).
|
|
1925
|
+
* Values must match the slot's enumerated set or gamut.
|
|
1926
|
+
*/
|
|
1927
|
+
overrides?: Readonly<Record<string, string | number | boolean>>;
|
|
1928
|
+
}
|
|
1929
|
+
/**
|
|
1930
|
+
* Input arguments for the `theme_share` MCP tool. Sharing emits a 5:1
|
|
1931
|
+
* return event to the sharer (recognition credit + pack citation) and
|
|
1932
|
+
* to the recipient (discovery signal). Implementation lives in
|
|
1933
|
+
* `mcp-alter` per D-RS15.
|
|
1934
|
+
*/
|
|
1935
|
+
interface ThemeShareInput {
|
|
1936
|
+
/** Recipient ~handle. */
|
|
1937
|
+
to: string;
|
|
1938
|
+
/** Pack source the recipient should resolve. Same shape as ThemeLockEntry.source. */
|
|
1939
|
+
source: string;
|
|
1940
|
+
/** Expected pack_id for verification. Sharer asserts they have verified this. */
|
|
1941
|
+
pack_id: string;
|
|
1942
|
+
/** Expected signer ~handle. Sharer asserts the signature checks against this signer. */
|
|
1943
|
+
signer: string;
|
|
1944
|
+
/** Optional one-line note shown to the recipient on receipt. ≤ 280 chars. */
|
|
1945
|
+
note?: string;
|
|
1946
|
+
}
|
|
1947
|
+
/** Output of the `theme_share` MCP tool. */
|
|
1948
|
+
interface ThemeShareOutput {
|
|
1949
|
+
ok: boolean;
|
|
1950
|
+
share_id?: string;
|
|
1951
|
+
error?: {
|
|
1952
|
+
code: string;
|
|
1953
|
+
message: string;
|
|
1954
|
+
};
|
|
1955
|
+
}
|
|
1956
|
+
/** v1 schema constants. Mirror the spec at docs/technical/alter-theme-pack-spec-v1.md. */
|
|
1957
|
+
declare const THEME_LIMITS: {
|
|
1958
|
+
readonly meta_name_pattern: RegExp;
|
|
1959
|
+
readonly meta_description_max_chars: 240;
|
|
1960
|
+
readonly opener_library_max_entries: 32;
|
|
1961
|
+
readonly opener_entry_max_chars: 240;
|
|
1962
|
+
readonly share_note_max_chars: 280;
|
|
1963
|
+
};
|
|
1964
|
+
/** Allowed OSC-8 hyperlink schemes. Mirrors §6.2 of the spec. */
|
|
1965
|
+
declare const OSC8_ALLOWED_SCHEMES: readonly ["https:", "mailto:"];
|
|
1966
|
+
type Osc8AllowedScheme = (typeof OSC8_ALLOWED_SCHEMES)[number];
|
|
1967
|
+
|
|
1968
|
+
/**
|
|
1969
|
+
* Package metadata — kept in a standalone module so deep imports from
|
|
1970
|
+
* `src/wire/` can reference version constants without creating a
|
|
1971
|
+
* circular dependency through `src/index.ts`.
|
|
1972
|
+
*/
|
|
1337
1973
|
declare const SDK_NAME = "@truealter/sdk";
|
|
1338
|
-
declare const SDK_VERSION = "0.
|
|
1974
|
+
declare const SDK_VERSION = "0.3.0";
|
|
1339
1975
|
|
|
1340
|
-
export { 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, type CheckAssessmentStatusInput, type CheckAssessmentStatusOutput, type CheckGoldenThreadInput, type CheckGoldenThreadOutput, 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 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 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 MCPToolDefinition, MCP_PROTOCOL_VERSION, type MatchTier, type McpServerConfig, PREMIUM_TOOL_NAMES, type PaymentEnvelope, 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 SignedToolDefinition, TOOL_BLAST_RADIUS, TOOL_COSTS, TOOL_TIERS, type ThreadCensusInput, type ThreadCensusOutput, type ToolInputs, type ToolName, type ToolOutputs, type ToolSignatureMap, type VerifyIdentityInput, type VerifyIdentityOutput, type VerifyProvenanceOptions, X402Client, type X402ClientOptions, type X402Settlement, type X402Signer, base64urlDecode, base64urlEncode, clearDiscoveryCache, decodeDid, discover, encodeDid, fetchPublicKeys, generateClaudeConfig, generateCursorConfig, generateGenericMcpConfig, generateKeypair, keypairFromPrivateKey, parsePaymentHeader, resolveVerifyAt, sign, verify, verifyProvenance, verifyToolSignatures };
|
|
1976
|
+
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 };
|