@sage-protocol/sdk 0.2.6 → 0.2.9
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 +2 -0
- package/dist/browser/index.mjs +36 -25
- package/dist/index.cjs +251 -751
- package/dist/index.mjs +251 -751
- package/dist/node/index.cjs +251 -751
- package/dist/node/index.mjs +251 -751
- package/package.json +1 -2
- package/types/index.d.ts +194 -30
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sage-protocol/sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"description": "Backend-agnostic SDK for interacting with the Sage Protocol (governance, SubDAOs, tokens).",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -58,7 +58,6 @@
|
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@merit-systems/echo-typescript-sdk": "^1.0.17",
|
|
61
|
-
"@whetstone-research/doppler-sdk": "^0.0.1-alpha.40",
|
|
62
61
|
"ai": "^5.0.52",
|
|
63
62
|
"axios": "^1.11.0",
|
|
64
63
|
"ethers": "^6.15.0",
|
package/types/index.d.ts
CHANGED
|
@@ -147,6 +147,11 @@ export type ProposalAccess = 'council-only' | 'community-threshold';
|
|
|
147
147
|
export type ExecutionAccess = 'council-only' | 'anyone';
|
|
148
148
|
export type GovernancePlaybook = 'council-closed' | 'council-drafts' | 'community' | 'legacy' | 'custom';
|
|
149
149
|
|
|
150
|
+
// UX-facing labels (webapp/cli alignment)
|
|
151
|
+
export type GovernanceMode = 'COMMUNITY_MANAGED' | 'TEAM_MANAGED' | 'INDIVIDUAL_MANAGED';
|
|
152
|
+
export type ManagedScope = 'INDIVIDUAL' | 'TEAM' | 'UNKNOWN';
|
|
153
|
+
export type QueueWiring = 'GOVERNOR_ONLY' | 'OPERATORS_ONLY' | 'BOTH' | 'NEITHER';
|
|
154
|
+
|
|
150
155
|
export interface GovernanceProfile {
|
|
151
156
|
/** Profile version: 1=legacy (detected via heuristics), 2=explicit 3-axis profile */
|
|
152
157
|
version: 1 | 2;
|
|
@@ -558,6 +563,85 @@ export interface ManifestValidator {
|
|
|
558
563
|
bestPracticeCheckFile(manifestPath: string): Array<Record<string, any>>;
|
|
559
564
|
}
|
|
560
565
|
|
|
566
|
+
// ============================================================================
|
|
567
|
+
// Manifest + Skill Versioning Types (Phase 6)
|
|
568
|
+
// ============================================================================
|
|
569
|
+
|
|
570
|
+
export interface Provenance {
|
|
571
|
+
source: 'github' | 'local' | 'sage';
|
|
572
|
+
repo?: string;
|
|
573
|
+
path?: string;
|
|
574
|
+
ref?: string;
|
|
575
|
+
commit?: string;
|
|
576
|
+
importedAt?: string;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
export interface PromptEntry {
|
|
580
|
+
key: string;
|
|
581
|
+
name?: string;
|
|
582
|
+
type?: 'prompt' | 'skill' | 'agent' | 'command' | 'template' | 'workflow';
|
|
583
|
+
cid?: string;
|
|
584
|
+
description?: string;
|
|
585
|
+
tags?: string[];
|
|
586
|
+
provenance?: Provenance;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
export type UpstreamRef =
|
|
590
|
+
| { type: 'cid'; value: string }
|
|
591
|
+
| { type: 'github_commit'; value: { repo: string; commit: string } };
|
|
592
|
+
|
|
593
|
+
export interface SkillIndex {
|
|
594
|
+
key: string;
|
|
595
|
+
activeVersion: string;
|
|
596
|
+
previousVersion?: string;
|
|
597
|
+
pendingVersion?: string;
|
|
598
|
+
installedAt: string;
|
|
599
|
+
|
|
600
|
+
origin?: Origin;
|
|
601
|
+
|
|
602
|
+
lastChecked?: string;
|
|
603
|
+
latestUpstream?: UpstreamRef;
|
|
604
|
+
updateStatus?: 'up_to_date' | 'available' | 'removed' | 'check_failed';
|
|
605
|
+
|
|
606
|
+
versions: Record<string, {
|
|
607
|
+
upstream: UpstreamRef;
|
|
608
|
+
downloadedAt: string;
|
|
609
|
+
pinned?: boolean;
|
|
610
|
+
}>;
|
|
611
|
+
|
|
612
|
+
provenance?: Provenance;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
export type Origin = OriginSage | OriginGithub;
|
|
616
|
+
|
|
617
|
+
export type OriginSage =
|
|
618
|
+
| {
|
|
619
|
+
type: 'sage';
|
|
620
|
+
tier: 'dao' | 'personal' | 'shared';
|
|
621
|
+
originKind: 'entry';
|
|
622
|
+
chainId: number;
|
|
623
|
+
owner: string;
|
|
624
|
+
libraryId: string;
|
|
625
|
+
manifestCid: string;
|
|
626
|
+
entryKey: string;
|
|
627
|
+
}
|
|
628
|
+
| {
|
|
629
|
+
type: 'sage';
|
|
630
|
+
tier: 'dao' | 'personal' | 'shared';
|
|
631
|
+
originKind: 'library';
|
|
632
|
+
chainId: number;
|
|
633
|
+
owner: string;
|
|
634
|
+
libraryId: string;
|
|
635
|
+
manifestCid: string;
|
|
636
|
+
};
|
|
637
|
+
|
|
638
|
+
export interface OriginGithub {
|
|
639
|
+
type: 'github';
|
|
640
|
+
repo: string;
|
|
641
|
+
path: string;
|
|
642
|
+
ref?: string;
|
|
643
|
+
}
|
|
644
|
+
|
|
561
645
|
export interface LibrarySearchResult {
|
|
562
646
|
type: 'library' | 'prompt';
|
|
563
647
|
name: string;
|
|
@@ -740,33 +824,93 @@ export interface TreasuryModule {
|
|
|
740
824
|
getLPContribution(args: { provider: ProviderLike; treasury: AddressLike; subdao: AddressLike; token: AddressLike }): Promise<bigint>;
|
|
741
825
|
}
|
|
742
826
|
|
|
827
|
+
export interface MerkleBoost {
|
|
828
|
+
manager: AddressLike;
|
|
829
|
+
proposalId: number;
|
|
830
|
+
totalPool: bigint;
|
|
831
|
+
totalClaimed: bigint;
|
|
832
|
+
merkleRoot: HashLike;
|
|
833
|
+
expiresAt: bigint;
|
|
834
|
+
active: boolean;
|
|
835
|
+
finalized: boolean;
|
|
836
|
+
creator: AddressLike;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
export interface DirectBoost {
|
|
840
|
+
manager: AddressLike;
|
|
841
|
+
proposalId: number;
|
|
842
|
+
creator: AddressLike;
|
|
843
|
+
governor: AddressLike | null;
|
|
844
|
+
snapshot: bigint;
|
|
845
|
+
perVoter: bigint;
|
|
846
|
+
maxVoters: bigint;
|
|
847
|
+
votersPaid: bigint;
|
|
848
|
+
minVotes: bigint;
|
|
849
|
+
payoutMode: number;
|
|
850
|
+
support: number;
|
|
851
|
+
startAt: number;
|
|
852
|
+
expiresAt: number;
|
|
853
|
+
totalPool: bigint;
|
|
854
|
+
totalPaid: bigint;
|
|
855
|
+
kind: number;
|
|
856
|
+
policy: AddressLike | null;
|
|
857
|
+
active: boolean;
|
|
858
|
+
paused: boolean;
|
|
859
|
+
}
|
|
860
|
+
|
|
743
861
|
export interface BoostModule {
|
|
744
|
-
|
|
862
|
+
// Merkle manager (GovernanceBoostManagerMerkle)
|
|
863
|
+
getMerkleBoost(args: { provider: ProviderLike; manager: AddressLike; proposalId: number | bigint }): Promise<MerkleBoost | null>;
|
|
864
|
+
buildMerkleCreateTx(args: {
|
|
745
865
|
manager: AddressLike;
|
|
746
|
-
proposalId: number;
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
866
|
+
proposalId: number | bigint;
|
|
867
|
+
totalPool?: BigNumberish;
|
|
868
|
+
amount?: BigNumberish;
|
|
869
|
+
}): TransactionPayload;
|
|
870
|
+
buildMerkleSetMerkleRootTx(args: {
|
|
871
|
+
manager: AddressLike;
|
|
872
|
+
proposalId: number | bigint;
|
|
873
|
+
root?: HashLike;
|
|
874
|
+
merkleRoot?: HashLike;
|
|
875
|
+
}): TransactionPayload;
|
|
876
|
+
buildMerkleFinalizeTx(args: { manager: AddressLike; proposalId: number | bigint }): TransactionPayload;
|
|
877
|
+
buildMerkleClaimTx(args: {
|
|
878
|
+
manager: AddressLike;
|
|
879
|
+
proposalId: number | bigint;
|
|
880
|
+
account: AddressLike;
|
|
881
|
+
amount: BigNumberish;
|
|
882
|
+
proof: HashLike[];
|
|
883
|
+
}): TransactionPayload;
|
|
884
|
+
|
|
885
|
+
// Legacy names (back-compat)
|
|
886
|
+
getMerkleConfig(args: { provider: ProviderLike; manager: AddressLike; proposalId: number | bigint }): Promise<MerkleBoost | null>;
|
|
753
887
|
buildMerkleFundTx(args: { manager: AddressLike; proposalId: number | bigint; amount: BigNumberish }): TransactionPayload;
|
|
754
|
-
buildMerkleSetRootTx(args: { manager: AddressLike; proposalId: number | bigint; merkleRoot:
|
|
755
|
-
|
|
888
|
+
buildMerkleSetRootTx(args: { manager: AddressLike; proposalId: number | bigint; merkleRoot: HashLike }): TransactionPayload;
|
|
889
|
+
|
|
890
|
+
// Direct manager (GovernanceBoostManager)
|
|
891
|
+
getDirectBoost(args: { provider: ProviderLike; manager: AddressLike; proposalId: number | bigint }): Promise<DirectBoost | null>;
|
|
892
|
+
buildDirectCreateTx(args: {
|
|
756
893
|
manager: AddressLike;
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
perVoter:
|
|
760
|
-
maxVoters:
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
894
|
+
governor: AddressLike;
|
|
895
|
+
proposalId: number | bigint;
|
|
896
|
+
perVoter: BigNumberish;
|
|
897
|
+
maxVoters: BigNumberish;
|
|
898
|
+
kind?: number;
|
|
899
|
+
policy?: AddressLike;
|
|
900
|
+
minVotes?: BigNumberish;
|
|
901
|
+
payoutMode?: number;
|
|
902
|
+
support?: number;
|
|
903
|
+
startAt?: BigNumberish;
|
|
904
|
+
expiresAt?: BigNumberish;
|
|
905
|
+
}): TransactionPayload;
|
|
906
|
+
buildDirectClaimTx(args: { manager: AddressLike; proposalId: number | bigint; data?: HashLike }): TransactionPayload;
|
|
907
|
+
buildDirectFinalizeTx(args: { manager: AddressLike; proposalId: number | bigint }): TransactionPayload;
|
|
908
|
+
|
|
909
|
+
// Legacy name (back-compat)
|
|
910
|
+
getDirectConfig(args: { provider: ProviderLike; manager: AddressLike; proposalId: number | bigint }): Promise<DirectBoost | null>;
|
|
766
911
|
}
|
|
767
912
|
|
|
768
913
|
export interface PersonalModule {
|
|
769
|
-
buildCreatePersonalRegistryTx(args: { factory: AddressLike; policy: number }): TransactionPayload;
|
|
770
914
|
buildSetPriceTx(args: { marketplace: AddressLike; key: string; price: BigNumberish }): TransactionPayload;
|
|
771
915
|
buildBuyTx(args: {
|
|
772
916
|
marketplace: AddressLike;
|
|
@@ -864,7 +1008,7 @@ export interface AuctionConfig {
|
|
|
864
1008
|
weth: AddressLike;
|
|
865
1009
|
timeBuffer: bigint;
|
|
866
1010
|
reservePrice: bigint;
|
|
867
|
-
|
|
1011
|
+
minBidIncrementBps: bigint;
|
|
868
1012
|
duration: bigint;
|
|
869
1013
|
mintTierId: bigint;
|
|
870
1014
|
defaultTokenURI: string;
|
|
@@ -887,7 +1031,7 @@ export interface AuctionModule {
|
|
|
887
1031
|
buildUnpauseTx(args: { auctionHouse: AddressLike }): TransactionPayload;
|
|
888
1032
|
buildSetTimeBufferTx(args: { auctionHouse: AddressLike; timeBuffer: BigNumberish }): TransactionPayload;
|
|
889
1033
|
buildSetReservePriceTx(args: { auctionHouse: AddressLike; reservePrice: BigNumberish }): TransactionPayload;
|
|
890
|
-
buildSetMinBidIncrementTx(args: { auctionHouse: AddressLike;
|
|
1034
|
+
buildSetMinBidIncrementTx(args: { auctionHouse: AddressLike; bps: BigNumberish }): TransactionPayload;
|
|
891
1035
|
buildSetDurationTx(args: { auctionHouse: AddressLike; duration: BigNumberish }): TransactionPayload;
|
|
892
1036
|
buildSetMintTierIdTx(args: { auctionHouse: AddressLike; tierId: BigNumberish }): TransactionPayload;
|
|
893
1037
|
buildSetDefaultTokenURITx(args: { auctionHouse: AddressLike; uri: string }): TransactionPayload;
|
|
@@ -895,7 +1039,7 @@ export interface AuctionModule {
|
|
|
895
1039
|
|
|
896
1040
|
// ============ Bounty System Types ============
|
|
897
1041
|
|
|
898
|
-
export type BountyMode = '
|
|
1042
|
+
export type BountyMode = 'DIRECT' | 'COMPETITIVE';
|
|
899
1043
|
export type BountyStatus = 'ACTIVE' | 'CLAIMED' | 'UNDER_REVIEW' | 'VOTING' | 'COMPLETED' | 'CANCELLED' | 'EXPIRED';
|
|
900
1044
|
export type LibraryAction = 'PAYMENT_ONLY' | 'ADD_TO_LIBRARY' | 'PAYMENT_AND_ADD';
|
|
901
1045
|
|
|
@@ -1083,19 +1227,13 @@ export interface BountyModule {
|
|
|
1083
1227
|
assignee: AddressLike;
|
|
1084
1228
|
libraryKey: string;
|
|
1085
1229
|
}): TransactionPayload;
|
|
1086
|
-
//
|
|
1087
|
-
buildClaimBountyTx(args: { bountySystem: AddressLike; bountyId: BigNumberish }): TransactionPayload;
|
|
1230
|
+
// Submission
|
|
1088
1231
|
buildSubmitEntryTx(args: {
|
|
1089
1232
|
bountySystem: AddressLike;
|
|
1090
1233
|
bountyId: BigNumberish;
|
|
1091
1234
|
promptIPFS: string;
|
|
1092
1235
|
deliverableIPFS: string;
|
|
1093
1236
|
}): TransactionPayload;
|
|
1094
|
-
buildCompleteBountyTx(args: {
|
|
1095
|
-
bountySystem: AddressLike;
|
|
1096
|
-
bountyId: BigNumberish;
|
|
1097
|
-
deliverableIPFS: string;
|
|
1098
|
-
}): TransactionPayload;
|
|
1099
1237
|
// Voting (COMPETITIVE mode)
|
|
1100
1238
|
buildStartVotingTx(args: { bountySystem: AddressLike; bountyId: BigNumberish }): TransactionPayload;
|
|
1101
1239
|
buildVoteTx(args: { bountySystem: AddressLike; bountyId: BigNumberish; submissionId: BigNumberish }): TransactionPayload;
|
|
@@ -1332,6 +1470,32 @@ export interface GitStorageClientConstructor {
|
|
|
1332
1470
|
|
|
1333
1471
|
export declare const GitStorageClient: GitStorageClientConstructor;
|
|
1334
1472
|
|
|
1473
|
+
// ============ Library Visibility & Credit Types ============
|
|
1474
|
+
|
|
1475
|
+
export type LibraryVisibility = 'public' | 'private' | 'shared';
|
|
1476
|
+
export type LibraryTier = 'personal' | 'shared' | 'dao';
|
|
1477
|
+
|
|
1478
|
+
export interface LibraryLimitError {
|
|
1479
|
+
error: string;
|
|
1480
|
+
code: string;
|
|
1481
|
+
costCredits: number;
|
|
1482
|
+
currentCount: number;
|
|
1483
|
+
freeLimit: number;
|
|
1484
|
+
message: string;
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
export interface InsufficientCreditsError {
|
|
1488
|
+
error: string;
|
|
1489
|
+
needed: number;
|
|
1490
|
+
balance: number;
|
|
1491
|
+
message: string;
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
export interface CreditBalanceResponse {
|
|
1495
|
+
balance: number;
|
|
1496
|
+
wallet: string;
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1335
1499
|
export interface SageSDK {
|
|
1336
1500
|
version: string;
|
|
1337
1501
|
getProvider: (rpcUrl: string) => any;
|