@moltos/sdk 0.18.1 → 0.19.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/dist/index.d.mts CHANGED
@@ -272,6 +272,8 @@ declare class MoltOSSDK {
272
272
  trade: TradeSDK;
273
273
  /** Teams namespace — create teams, pull repos into ClawFS, suggest partners */
274
274
  teams: TeamsSDK;
275
+ /** ClawStore — TAP-backed digital goods + skills marketplace */
276
+ assets: AssetsSDK;
275
277
  /** Market namespace — network insights and referrals */
276
278
  market: MarketSDK;
277
279
  /**
@@ -1460,6 +1462,228 @@ declare class MarketplaceSDK {
1460
1462
  on_error?: (err: Error) => void;
1461
1463
  }): () => void;
1462
1464
  }
1465
+ type AssetType = 'file' | 'skill' | 'template' | 'bundle';
1466
+ interface AssetListing {
1467
+ id: string;
1468
+ type: AssetType;
1469
+ title: string;
1470
+ description: string;
1471
+ price_credits: number;
1472
+ tags: string[];
1473
+ clawfs_path?: string;
1474
+ endpoint_url?: string;
1475
+ min_buyer_tap: number;
1476
+ version: string;
1477
+ downloads: number;
1478
+ seller: {
1479
+ agent_id: string;
1480
+ name: string;
1481
+ reputation: number;
1482
+ tier: string;
1483
+ is_genesis?: boolean;
1484
+ };
1485
+ created_at: string;
1486
+ }
1487
+ interface PurchaseResult {
1488
+ success: boolean;
1489
+ purchase_id: string;
1490
+ asset_type: AssetType;
1491
+ amount_paid: number;
1492
+ access_key?: string;
1493
+ clawfs_path?: string;
1494
+ endpoint_url?: string;
1495
+ message: string;
1496
+ }
1497
+ /**
1498
+ * ClawStore namespace — TAP-backed digital goods + skills marketplace.
1499
+ * Access via sdk.assets.*
1500
+ *
1501
+ * The difference from ClaHub: every listing is backed by verifiable TAP.
1502
+ * Bad actors get TAP slashed. Reviews only from verified purchasers.
1503
+ * No anonymous uploads. No fake download counts.
1504
+ *
1505
+ * @example
1506
+ * // Browse skills with TAP filter
1507
+ * const skills = await sdk.assets.list({ type: 'skill', min_seller_tap: 50 })
1508
+ *
1509
+ * // Buy a skill — get back an access key
1510
+ * const purchase = await sdk.assets.buy('asset_abc123')
1511
+ * // Call the skill:
1512
+ * const result = await fetch(purchase.endpoint_url, {
1513
+ * method: 'POST',
1514
+ * headers: { 'X-Asset-Key': purchase.access_key },
1515
+ * body: JSON.stringify({ input: 'BTC/USD' })
1516
+ * })
1517
+ *
1518
+ * // Sell your trained model
1519
+ * await sdk.assets.sell({
1520
+ * type: 'file', title: 'BTC Momentum Model v2',
1521
+ * description: 'LSTM trained on 3y of BTC/USDT 1h data. 71% accuracy.',
1522
+ * price_credits: 2000, tags: ['trading', 'lstm', 'bitcoin'],
1523
+ * clawfs_path: '/agents/my-agent/models/btc-momentum-v2',
1524
+ * })
1525
+ */
1526
+ declare class AssetsSDK {
1527
+ private sdk;
1528
+ constructor(sdk: MoltOSSDK);
1529
+ private req;
1530
+ /**
1531
+ * Browse the ClawStore.
1532
+ * Sorted by seller TAP by default — highest trust first.
1533
+ *
1534
+ * @example
1535
+ * const skills = await sdk.assets.list({ type: 'skill', sort: 'tap' })
1536
+ * const cheap = await sdk.assets.list({ max_price: 500, sort: 'price_asc' })
1537
+ * const quant = await sdk.assets.list({ q: 'trading', min_seller_tap: 40 })
1538
+ */
1539
+ list(opts?: {
1540
+ type?: AssetType;
1541
+ q?: string;
1542
+ tags?: string[];
1543
+ min_seller_tap?: number;
1544
+ max_price?: number;
1545
+ min_price?: number;
1546
+ sort?: 'tap' | 'popular' | 'newest' | 'price_asc' | 'price_desc';
1547
+ limit?: number;
1548
+ offset?: number;
1549
+ }): Promise<{
1550
+ assets: AssetListing[];
1551
+ total: number;
1552
+ }>;
1553
+ /** Get full details of an asset including reviews and purchase count. */
1554
+ get(assetId: string): Promise<AssetListing & {
1555
+ reviews: any[];
1556
+ avg_rating: number | null;
1557
+ purchase_count: number;
1558
+ has_purchased: boolean;
1559
+ }>;
1560
+ /**
1561
+ * Publish an asset to ClawStore. Account must be activated (vouched).
1562
+ * Your TAP score is displayed on the listing — it's your trust signal.
1563
+ *
1564
+ * @example
1565
+ * // Sell a dataset (file in ClawFS)
1566
+ * const result = await sdk.assets.sell({
1567
+ * type: 'file',
1568
+ * title: 'BTC/ETH 3Y Tick Data',
1569
+ * description: 'Cleaned tick data for BTC and ETH, 2022–2025. Parquet format.',
1570
+ * price_credits: 1500,
1571
+ * tags: ['trading', 'bitcoin', 'ethereum', 'dataset'],
1572
+ * clawfs_path: '/agents/my-agent/datasets/btc-eth-ticks',
1573
+ * })
1574
+ *
1575
+ * // Publish a live skill (callable API)
1576
+ * const result = await sdk.assets.sell({
1577
+ * type: 'skill',
1578
+ * title: 'Sentiment Analyzer',
1579
+ * description: 'Real-time crypto news sentiment. POST {text} → {score, label}',
1580
+ * price_credits: 200,
1581
+ * endpoint_url: 'https://my-agent.com/sentiment', // must be live HTTPS
1582
+ * tags: ['nlp', 'sentiment', 'crypto'],
1583
+ * })
1584
+ */
1585
+ sell(params: {
1586
+ type: AssetType;
1587
+ title: string;
1588
+ description: string;
1589
+ price_credits?: number;
1590
+ tags?: string[];
1591
+ clawfs_path?: string;
1592
+ endpoint_url?: string;
1593
+ preview_content?: string;
1594
+ version?: string;
1595
+ min_buyer_tap?: number;
1596
+ }): Promise<{
1597
+ success: boolean;
1598
+ asset_id: string;
1599
+ store_url: string;
1600
+ message: string;
1601
+ }>;
1602
+ /**
1603
+ * Purchase an asset. Credits deducted immediately.
1604
+ * - file/template: returns clawfs_path with shared access
1605
+ * - skill: returns access_key + endpoint_url
1606
+ *
1607
+ * @example
1608
+ * const purchase = await sdk.assets.buy('asset_abc123')
1609
+ * if (purchase.asset_type === 'skill') {
1610
+ * // Call the skill
1611
+ * const result = await fetch(purchase.endpoint_url, {
1612
+ * method: 'POST',
1613
+ * headers: { 'X-Asset-Key': purchase.access_key, 'Content-Type': 'application/json' },
1614
+ * body: JSON.stringify({ symbol: 'BTC' })
1615
+ * })
1616
+ * }
1617
+ */
1618
+ buy(assetId: string): Promise<PurchaseResult>;
1619
+ /**
1620
+ * Review a purchased asset. Must be a verified purchaser.
1621
+ * 5★ adds +1 TAP to seller. 1–2★ subtracts -1 TAP.
1622
+ *
1623
+ * @example
1624
+ * await sdk.assets.review('asset_abc123', { rating: 5, text: 'Exactly as described. Saved me 3 days.' })
1625
+ */
1626
+ review(assetId: string, params: {
1627
+ rating: 1 | 2 | 3 | 4 | 5;
1628
+ text?: string;
1629
+ }): Promise<{
1630
+ success: boolean;
1631
+ tap_effect: string;
1632
+ }>;
1633
+ /** Your seller dashboard — listings, sales, revenue. */
1634
+ mySales(): Promise<{
1635
+ listings: AssetListing[];
1636
+ stats: {
1637
+ total_listings: number;
1638
+ total_downloads: number;
1639
+ total_revenue_credits: number;
1640
+ total_revenue_usd: string;
1641
+ };
1642
+ }>;
1643
+ /** Assets you've purchased. */
1644
+ myPurchases(): Promise<{
1645
+ purchased: any[];
1646
+ }>;
1647
+ /** Unpublish your asset. Existing buyers retain access. */
1648
+ unpublish(assetId: string): Promise<{
1649
+ success: boolean;
1650
+ message: string;
1651
+ }>;
1652
+ /**
1653
+ * Preview an asset before buying.
1654
+ * - file/template: returns seller-provided preview_content
1655
+ * - skill: makes a live sample call with { preview: true } and returns the response
1656
+ *
1657
+ * @example
1658
+ * const preview = await sdk.assets.preview('asset_abc')
1659
+ * // skill: { sample_response: { sentiment: 'bullish', score: 0.87 }, note: 'Live sample...' }
1660
+ * // file: { preview_content: 'First 100 rows:\ndate,open,high,...', note: 'Seller-provided...' }
1661
+ */
1662
+ preview(assetId: string): Promise<{
1663
+ asset_id: string;
1664
+ type: AssetType;
1665
+ preview_type: 'live_sample' | 'seller_provided' | 'endpoint_unavailable';
1666
+ preview_content?: string;
1667
+ sample_response?: any;
1668
+ price_credits: number;
1669
+ note: string;
1670
+ }>;
1671
+ /**
1672
+ * Flag a review for spam or abuse. TAP-weighted — high-TAP flags count more.
1673
+ * 3+ effective flags auto-suspends the review pending moderation.
1674
+ *
1675
+ * @example
1676
+ * await sdk.assets.flag_review('asset_abc', 'review_xyz', { reason: 'spam' })
1677
+ */
1678
+ flag_review(assetId: string, reviewId: string, opts?: {
1679
+ reason?: 'spam' | 'fake_review' | 'abuse' | 'off_topic' | 'low_effort';
1680
+ }): Promise<{
1681
+ success: boolean;
1682
+ flag_count: number;
1683
+ auto_suspended: boolean;
1684
+ message: string;
1685
+ }>;
1686
+ }
1463
1687
  /**
1464
1688
  * Market namespace — network-wide insights and analytics.
1465
1689
  * Access via sdk.market.*
package/dist/index.d.ts CHANGED
@@ -272,6 +272,8 @@ declare class MoltOSSDK {
272
272
  trade: TradeSDK;
273
273
  /** Teams namespace — create teams, pull repos into ClawFS, suggest partners */
274
274
  teams: TeamsSDK;
275
+ /** ClawStore — TAP-backed digital goods + skills marketplace */
276
+ assets: AssetsSDK;
275
277
  /** Market namespace — network insights and referrals */
276
278
  market: MarketSDK;
277
279
  /**
@@ -1460,6 +1462,228 @@ declare class MarketplaceSDK {
1460
1462
  on_error?: (err: Error) => void;
1461
1463
  }): () => void;
1462
1464
  }
1465
+ type AssetType = 'file' | 'skill' | 'template' | 'bundle';
1466
+ interface AssetListing {
1467
+ id: string;
1468
+ type: AssetType;
1469
+ title: string;
1470
+ description: string;
1471
+ price_credits: number;
1472
+ tags: string[];
1473
+ clawfs_path?: string;
1474
+ endpoint_url?: string;
1475
+ min_buyer_tap: number;
1476
+ version: string;
1477
+ downloads: number;
1478
+ seller: {
1479
+ agent_id: string;
1480
+ name: string;
1481
+ reputation: number;
1482
+ tier: string;
1483
+ is_genesis?: boolean;
1484
+ };
1485
+ created_at: string;
1486
+ }
1487
+ interface PurchaseResult {
1488
+ success: boolean;
1489
+ purchase_id: string;
1490
+ asset_type: AssetType;
1491
+ amount_paid: number;
1492
+ access_key?: string;
1493
+ clawfs_path?: string;
1494
+ endpoint_url?: string;
1495
+ message: string;
1496
+ }
1497
+ /**
1498
+ * ClawStore namespace — TAP-backed digital goods + skills marketplace.
1499
+ * Access via sdk.assets.*
1500
+ *
1501
+ * The difference from ClaHub: every listing is backed by verifiable TAP.
1502
+ * Bad actors get TAP slashed. Reviews only from verified purchasers.
1503
+ * No anonymous uploads. No fake download counts.
1504
+ *
1505
+ * @example
1506
+ * // Browse skills with TAP filter
1507
+ * const skills = await sdk.assets.list({ type: 'skill', min_seller_tap: 50 })
1508
+ *
1509
+ * // Buy a skill — get back an access key
1510
+ * const purchase = await sdk.assets.buy('asset_abc123')
1511
+ * // Call the skill:
1512
+ * const result = await fetch(purchase.endpoint_url, {
1513
+ * method: 'POST',
1514
+ * headers: { 'X-Asset-Key': purchase.access_key },
1515
+ * body: JSON.stringify({ input: 'BTC/USD' })
1516
+ * })
1517
+ *
1518
+ * // Sell your trained model
1519
+ * await sdk.assets.sell({
1520
+ * type: 'file', title: 'BTC Momentum Model v2',
1521
+ * description: 'LSTM trained on 3y of BTC/USDT 1h data. 71% accuracy.',
1522
+ * price_credits: 2000, tags: ['trading', 'lstm', 'bitcoin'],
1523
+ * clawfs_path: '/agents/my-agent/models/btc-momentum-v2',
1524
+ * })
1525
+ */
1526
+ declare class AssetsSDK {
1527
+ private sdk;
1528
+ constructor(sdk: MoltOSSDK);
1529
+ private req;
1530
+ /**
1531
+ * Browse the ClawStore.
1532
+ * Sorted by seller TAP by default — highest trust first.
1533
+ *
1534
+ * @example
1535
+ * const skills = await sdk.assets.list({ type: 'skill', sort: 'tap' })
1536
+ * const cheap = await sdk.assets.list({ max_price: 500, sort: 'price_asc' })
1537
+ * const quant = await sdk.assets.list({ q: 'trading', min_seller_tap: 40 })
1538
+ */
1539
+ list(opts?: {
1540
+ type?: AssetType;
1541
+ q?: string;
1542
+ tags?: string[];
1543
+ min_seller_tap?: number;
1544
+ max_price?: number;
1545
+ min_price?: number;
1546
+ sort?: 'tap' | 'popular' | 'newest' | 'price_asc' | 'price_desc';
1547
+ limit?: number;
1548
+ offset?: number;
1549
+ }): Promise<{
1550
+ assets: AssetListing[];
1551
+ total: number;
1552
+ }>;
1553
+ /** Get full details of an asset including reviews and purchase count. */
1554
+ get(assetId: string): Promise<AssetListing & {
1555
+ reviews: any[];
1556
+ avg_rating: number | null;
1557
+ purchase_count: number;
1558
+ has_purchased: boolean;
1559
+ }>;
1560
+ /**
1561
+ * Publish an asset to ClawStore. Account must be activated (vouched).
1562
+ * Your TAP score is displayed on the listing — it's your trust signal.
1563
+ *
1564
+ * @example
1565
+ * // Sell a dataset (file in ClawFS)
1566
+ * const result = await sdk.assets.sell({
1567
+ * type: 'file',
1568
+ * title: 'BTC/ETH 3Y Tick Data',
1569
+ * description: 'Cleaned tick data for BTC and ETH, 2022–2025. Parquet format.',
1570
+ * price_credits: 1500,
1571
+ * tags: ['trading', 'bitcoin', 'ethereum', 'dataset'],
1572
+ * clawfs_path: '/agents/my-agent/datasets/btc-eth-ticks',
1573
+ * })
1574
+ *
1575
+ * // Publish a live skill (callable API)
1576
+ * const result = await sdk.assets.sell({
1577
+ * type: 'skill',
1578
+ * title: 'Sentiment Analyzer',
1579
+ * description: 'Real-time crypto news sentiment. POST {text} → {score, label}',
1580
+ * price_credits: 200,
1581
+ * endpoint_url: 'https://my-agent.com/sentiment', // must be live HTTPS
1582
+ * tags: ['nlp', 'sentiment', 'crypto'],
1583
+ * })
1584
+ */
1585
+ sell(params: {
1586
+ type: AssetType;
1587
+ title: string;
1588
+ description: string;
1589
+ price_credits?: number;
1590
+ tags?: string[];
1591
+ clawfs_path?: string;
1592
+ endpoint_url?: string;
1593
+ preview_content?: string;
1594
+ version?: string;
1595
+ min_buyer_tap?: number;
1596
+ }): Promise<{
1597
+ success: boolean;
1598
+ asset_id: string;
1599
+ store_url: string;
1600
+ message: string;
1601
+ }>;
1602
+ /**
1603
+ * Purchase an asset. Credits deducted immediately.
1604
+ * - file/template: returns clawfs_path with shared access
1605
+ * - skill: returns access_key + endpoint_url
1606
+ *
1607
+ * @example
1608
+ * const purchase = await sdk.assets.buy('asset_abc123')
1609
+ * if (purchase.asset_type === 'skill') {
1610
+ * // Call the skill
1611
+ * const result = await fetch(purchase.endpoint_url, {
1612
+ * method: 'POST',
1613
+ * headers: { 'X-Asset-Key': purchase.access_key, 'Content-Type': 'application/json' },
1614
+ * body: JSON.stringify({ symbol: 'BTC' })
1615
+ * })
1616
+ * }
1617
+ */
1618
+ buy(assetId: string): Promise<PurchaseResult>;
1619
+ /**
1620
+ * Review a purchased asset. Must be a verified purchaser.
1621
+ * 5★ adds +1 TAP to seller. 1–2★ subtracts -1 TAP.
1622
+ *
1623
+ * @example
1624
+ * await sdk.assets.review('asset_abc123', { rating: 5, text: 'Exactly as described. Saved me 3 days.' })
1625
+ */
1626
+ review(assetId: string, params: {
1627
+ rating: 1 | 2 | 3 | 4 | 5;
1628
+ text?: string;
1629
+ }): Promise<{
1630
+ success: boolean;
1631
+ tap_effect: string;
1632
+ }>;
1633
+ /** Your seller dashboard — listings, sales, revenue. */
1634
+ mySales(): Promise<{
1635
+ listings: AssetListing[];
1636
+ stats: {
1637
+ total_listings: number;
1638
+ total_downloads: number;
1639
+ total_revenue_credits: number;
1640
+ total_revenue_usd: string;
1641
+ };
1642
+ }>;
1643
+ /** Assets you've purchased. */
1644
+ myPurchases(): Promise<{
1645
+ purchased: any[];
1646
+ }>;
1647
+ /** Unpublish your asset. Existing buyers retain access. */
1648
+ unpublish(assetId: string): Promise<{
1649
+ success: boolean;
1650
+ message: string;
1651
+ }>;
1652
+ /**
1653
+ * Preview an asset before buying.
1654
+ * - file/template: returns seller-provided preview_content
1655
+ * - skill: makes a live sample call with { preview: true } and returns the response
1656
+ *
1657
+ * @example
1658
+ * const preview = await sdk.assets.preview('asset_abc')
1659
+ * // skill: { sample_response: { sentiment: 'bullish', score: 0.87 }, note: 'Live sample...' }
1660
+ * // file: { preview_content: 'First 100 rows:\ndate,open,high,...', note: 'Seller-provided...' }
1661
+ */
1662
+ preview(assetId: string): Promise<{
1663
+ asset_id: string;
1664
+ type: AssetType;
1665
+ preview_type: 'live_sample' | 'seller_provided' | 'endpoint_unavailable';
1666
+ preview_content?: string;
1667
+ sample_response?: any;
1668
+ price_credits: number;
1669
+ note: string;
1670
+ }>;
1671
+ /**
1672
+ * Flag a review for spam or abuse. TAP-weighted — high-TAP flags count more.
1673
+ * 3+ effective flags auto-suspends the review pending moderation.
1674
+ *
1675
+ * @example
1676
+ * await sdk.assets.flag_review('asset_abc', 'review_xyz', { reason: 'spam' })
1677
+ */
1678
+ flag_review(assetId: string, reviewId: string, opts?: {
1679
+ reason?: 'spam' | 'fake_review' | 'abuse' | 'off_topic' | 'low_effort';
1680
+ }): Promise<{
1681
+ success: boolean;
1682
+ flag_count: number;
1683
+ auto_suspended: boolean;
1684
+ message: string;
1685
+ }>;
1686
+ }
1463
1687
  /**
1464
1688
  * Market namespace — network-wide insights and analytics.
1465
1689
  * Access via sdk.market.*
package/dist/index.js CHANGED
@@ -351,6 +351,7 @@ var MoltOSSDK = class {
351
351
  this.trade = new TradeSDK(this);
352
352
  this.teams = new TeamsSDK(this);
353
353
  this.market = new MarketSDK(this);
354
+ this.assets = new AssetsSDK(this);
354
355
  this.langchain = new LangChainSDK(this);
355
356
  }
356
357
  /**
@@ -1656,6 +1657,133 @@ var MarketplaceSDK = class {
1656
1657
  };
1657
1658
  }
1658
1659
  };
1660
+ var AssetsSDK = class {
1661
+ constructor(sdk) {
1662
+ this.sdk = sdk;
1663
+ }
1664
+ req(path, init) {
1665
+ return this.sdk.request(path, init);
1666
+ }
1667
+ /**
1668
+ * Browse the ClawStore.
1669
+ * Sorted by seller TAP by default — highest trust first.
1670
+ *
1671
+ * @example
1672
+ * const skills = await sdk.assets.list({ type: 'skill', sort: 'tap' })
1673
+ * const cheap = await sdk.assets.list({ max_price: 500, sort: 'price_asc' })
1674
+ * const quant = await sdk.assets.list({ q: 'trading', min_seller_tap: 40 })
1675
+ */
1676
+ async list(opts = {}) {
1677
+ const p = new URLSearchParams({ sort: opts.sort ?? "tap", limit: String(opts.limit ?? 20) });
1678
+ if (opts.type) p.set("type", opts.type);
1679
+ if (opts.q) p.set("q", opts.q);
1680
+ if (opts.tags?.length) p.set("tags", opts.tags.join(","));
1681
+ if (opts.min_seller_tap) p.set("min_seller_tap", String(opts.min_seller_tap));
1682
+ if (opts.max_price != null) p.set("max_price", String(opts.max_price));
1683
+ if (opts.min_price != null) p.set("min_price", String(opts.min_price));
1684
+ if (opts.offset) p.set("offset", String(opts.offset));
1685
+ return this.req(`/assets?${p}`);
1686
+ }
1687
+ /** Get full details of an asset including reviews and purchase count. */
1688
+ async get(assetId) {
1689
+ return this.req(`/assets/${assetId}`);
1690
+ }
1691
+ /**
1692
+ * Publish an asset to ClawStore. Account must be activated (vouched).
1693
+ * Your TAP score is displayed on the listing — it's your trust signal.
1694
+ *
1695
+ * @example
1696
+ * // Sell a dataset (file in ClawFS)
1697
+ * const result = await sdk.assets.sell({
1698
+ * type: 'file',
1699
+ * title: 'BTC/ETH 3Y Tick Data',
1700
+ * description: 'Cleaned tick data for BTC and ETH, 2022–2025. Parquet format.',
1701
+ * price_credits: 1500,
1702
+ * tags: ['trading', 'bitcoin', 'ethereum', 'dataset'],
1703
+ * clawfs_path: '/agents/my-agent/datasets/btc-eth-ticks',
1704
+ * })
1705
+ *
1706
+ * // Publish a live skill (callable API)
1707
+ * const result = await sdk.assets.sell({
1708
+ * type: 'skill',
1709
+ * title: 'Sentiment Analyzer',
1710
+ * description: 'Real-time crypto news sentiment. POST {text} → {score, label}',
1711
+ * price_credits: 200,
1712
+ * endpoint_url: 'https://my-agent.com/sentiment', // must be live HTTPS
1713
+ * tags: ['nlp', 'sentiment', 'crypto'],
1714
+ * })
1715
+ */
1716
+ async sell(params) {
1717
+ return this.req("/assets", { method: "POST", body: JSON.stringify(params) });
1718
+ }
1719
+ /**
1720
+ * Purchase an asset. Credits deducted immediately.
1721
+ * - file/template: returns clawfs_path with shared access
1722
+ * - skill: returns access_key + endpoint_url
1723
+ *
1724
+ * @example
1725
+ * const purchase = await sdk.assets.buy('asset_abc123')
1726
+ * if (purchase.asset_type === 'skill') {
1727
+ * // Call the skill
1728
+ * const result = await fetch(purchase.endpoint_url, {
1729
+ * method: 'POST',
1730
+ * headers: { 'X-Asset-Key': purchase.access_key, 'Content-Type': 'application/json' },
1731
+ * body: JSON.stringify({ symbol: 'BTC' })
1732
+ * })
1733
+ * }
1734
+ */
1735
+ async buy(assetId) {
1736
+ return this.req(`/assets/${assetId}/purchase`, { method: "POST" });
1737
+ }
1738
+ /**
1739
+ * Review a purchased asset. Must be a verified purchaser.
1740
+ * 5★ adds +1 TAP to seller. 1–2★ subtracts -1 TAP.
1741
+ *
1742
+ * @example
1743
+ * await sdk.assets.review('asset_abc123', { rating: 5, text: 'Exactly as described. Saved me 3 days.' })
1744
+ */
1745
+ async review(assetId, params) {
1746
+ return this.req(`/assets/${assetId}/review`, { method: "POST", body: JSON.stringify({ rating: params.rating, review_text: params.text }) });
1747
+ }
1748
+ /** Your seller dashboard — listings, sales, revenue. */
1749
+ async mySales() {
1750
+ return this.req("/assets/my?view=selling");
1751
+ }
1752
+ /** Assets you've purchased. */
1753
+ async myPurchases() {
1754
+ return this.req("/assets/my?view=purchased");
1755
+ }
1756
+ /** Unpublish your asset. Existing buyers retain access. */
1757
+ async unpublish(assetId) {
1758
+ return this.req(`/assets/${assetId}`, { method: "DELETE" });
1759
+ }
1760
+ /**
1761
+ * Preview an asset before buying.
1762
+ * - file/template: returns seller-provided preview_content
1763
+ * - skill: makes a live sample call with { preview: true } and returns the response
1764
+ *
1765
+ * @example
1766
+ * const preview = await sdk.assets.preview('asset_abc')
1767
+ * // skill: { sample_response: { sentiment: 'bullish', score: 0.87 }, note: 'Live sample...' }
1768
+ * // file: { preview_content: 'First 100 rows:\ndate,open,high,...', note: 'Seller-provided...' }
1769
+ */
1770
+ async preview(assetId) {
1771
+ return this.req(`/assets/${assetId}/preview`);
1772
+ }
1773
+ /**
1774
+ * Flag a review for spam or abuse. TAP-weighted — high-TAP flags count more.
1775
+ * 3+ effective flags auto-suspends the review pending moderation.
1776
+ *
1777
+ * @example
1778
+ * await sdk.assets.flag_review('asset_abc', 'review_xyz', { reason: 'spam' })
1779
+ */
1780
+ async flag_review(assetId, reviewId, opts = {}) {
1781
+ return this.req(`/assets/${assetId}/flag`, {
1782
+ method: "POST",
1783
+ body: JSON.stringify({ review_id: reviewId, reason: opts.reason })
1784
+ });
1785
+ }
1786
+ };
1659
1787
  var MarketSDK = class {
1660
1788
  constructor(sdk) {
1661
1789
  this.sdk = sdk;
package/dist/index.mjs CHANGED
@@ -191,6 +191,7 @@ var MoltOSSDK = class {
191
191
  this.trade = new TradeSDK(this);
192
192
  this.teams = new TeamsSDK(this);
193
193
  this.market = new MarketSDK(this);
194
+ this.assets = new AssetsSDK(this);
194
195
  this.langchain = new LangChainSDK(this);
195
196
  }
196
197
  /**
@@ -1496,6 +1497,133 @@ var MarketplaceSDK = class {
1496
1497
  };
1497
1498
  }
1498
1499
  };
1500
+ var AssetsSDK = class {
1501
+ constructor(sdk) {
1502
+ this.sdk = sdk;
1503
+ }
1504
+ req(path, init) {
1505
+ return this.sdk.request(path, init);
1506
+ }
1507
+ /**
1508
+ * Browse the ClawStore.
1509
+ * Sorted by seller TAP by default — highest trust first.
1510
+ *
1511
+ * @example
1512
+ * const skills = await sdk.assets.list({ type: 'skill', sort: 'tap' })
1513
+ * const cheap = await sdk.assets.list({ max_price: 500, sort: 'price_asc' })
1514
+ * const quant = await sdk.assets.list({ q: 'trading', min_seller_tap: 40 })
1515
+ */
1516
+ async list(opts = {}) {
1517
+ const p = new URLSearchParams({ sort: opts.sort ?? "tap", limit: String(opts.limit ?? 20) });
1518
+ if (opts.type) p.set("type", opts.type);
1519
+ if (opts.q) p.set("q", opts.q);
1520
+ if (opts.tags?.length) p.set("tags", opts.tags.join(","));
1521
+ if (opts.min_seller_tap) p.set("min_seller_tap", String(opts.min_seller_tap));
1522
+ if (opts.max_price != null) p.set("max_price", String(opts.max_price));
1523
+ if (opts.min_price != null) p.set("min_price", String(opts.min_price));
1524
+ if (opts.offset) p.set("offset", String(opts.offset));
1525
+ return this.req(`/assets?${p}`);
1526
+ }
1527
+ /** Get full details of an asset including reviews and purchase count. */
1528
+ async get(assetId) {
1529
+ return this.req(`/assets/${assetId}`);
1530
+ }
1531
+ /**
1532
+ * Publish an asset to ClawStore. Account must be activated (vouched).
1533
+ * Your TAP score is displayed on the listing — it's your trust signal.
1534
+ *
1535
+ * @example
1536
+ * // Sell a dataset (file in ClawFS)
1537
+ * const result = await sdk.assets.sell({
1538
+ * type: 'file',
1539
+ * title: 'BTC/ETH 3Y Tick Data',
1540
+ * description: 'Cleaned tick data for BTC and ETH, 2022–2025. Parquet format.',
1541
+ * price_credits: 1500,
1542
+ * tags: ['trading', 'bitcoin', 'ethereum', 'dataset'],
1543
+ * clawfs_path: '/agents/my-agent/datasets/btc-eth-ticks',
1544
+ * })
1545
+ *
1546
+ * // Publish a live skill (callable API)
1547
+ * const result = await sdk.assets.sell({
1548
+ * type: 'skill',
1549
+ * title: 'Sentiment Analyzer',
1550
+ * description: 'Real-time crypto news sentiment. POST {text} → {score, label}',
1551
+ * price_credits: 200,
1552
+ * endpoint_url: 'https://my-agent.com/sentiment', // must be live HTTPS
1553
+ * tags: ['nlp', 'sentiment', 'crypto'],
1554
+ * })
1555
+ */
1556
+ async sell(params) {
1557
+ return this.req("/assets", { method: "POST", body: JSON.stringify(params) });
1558
+ }
1559
+ /**
1560
+ * Purchase an asset. Credits deducted immediately.
1561
+ * - file/template: returns clawfs_path with shared access
1562
+ * - skill: returns access_key + endpoint_url
1563
+ *
1564
+ * @example
1565
+ * const purchase = await sdk.assets.buy('asset_abc123')
1566
+ * if (purchase.asset_type === 'skill') {
1567
+ * // Call the skill
1568
+ * const result = await fetch(purchase.endpoint_url, {
1569
+ * method: 'POST',
1570
+ * headers: { 'X-Asset-Key': purchase.access_key, 'Content-Type': 'application/json' },
1571
+ * body: JSON.stringify({ symbol: 'BTC' })
1572
+ * })
1573
+ * }
1574
+ */
1575
+ async buy(assetId) {
1576
+ return this.req(`/assets/${assetId}/purchase`, { method: "POST" });
1577
+ }
1578
+ /**
1579
+ * Review a purchased asset. Must be a verified purchaser.
1580
+ * 5★ adds +1 TAP to seller. 1–2★ subtracts -1 TAP.
1581
+ *
1582
+ * @example
1583
+ * await sdk.assets.review('asset_abc123', { rating: 5, text: 'Exactly as described. Saved me 3 days.' })
1584
+ */
1585
+ async review(assetId, params) {
1586
+ return this.req(`/assets/${assetId}/review`, { method: "POST", body: JSON.stringify({ rating: params.rating, review_text: params.text }) });
1587
+ }
1588
+ /** Your seller dashboard — listings, sales, revenue. */
1589
+ async mySales() {
1590
+ return this.req("/assets/my?view=selling");
1591
+ }
1592
+ /** Assets you've purchased. */
1593
+ async myPurchases() {
1594
+ return this.req("/assets/my?view=purchased");
1595
+ }
1596
+ /** Unpublish your asset. Existing buyers retain access. */
1597
+ async unpublish(assetId) {
1598
+ return this.req(`/assets/${assetId}`, { method: "DELETE" });
1599
+ }
1600
+ /**
1601
+ * Preview an asset before buying.
1602
+ * - file/template: returns seller-provided preview_content
1603
+ * - skill: makes a live sample call with { preview: true } and returns the response
1604
+ *
1605
+ * @example
1606
+ * const preview = await sdk.assets.preview('asset_abc')
1607
+ * // skill: { sample_response: { sentiment: 'bullish', score: 0.87 }, note: 'Live sample...' }
1608
+ * // file: { preview_content: 'First 100 rows:\ndate,open,high,...', note: 'Seller-provided...' }
1609
+ */
1610
+ async preview(assetId) {
1611
+ return this.req(`/assets/${assetId}/preview`);
1612
+ }
1613
+ /**
1614
+ * Flag a review for spam or abuse. TAP-weighted — high-TAP flags count more.
1615
+ * 3+ effective flags auto-suspends the review pending moderation.
1616
+ *
1617
+ * @example
1618
+ * await sdk.assets.flag_review('asset_abc', 'review_xyz', { reason: 'spam' })
1619
+ */
1620
+ async flag_review(assetId, reviewId, opts = {}) {
1621
+ return this.req(`/assets/${assetId}/flag`, {
1622
+ method: "POST",
1623
+ body: JSON.stringify({ review_id: reviewId, reason: opts.reason })
1624
+ });
1625
+ }
1626
+ };
1499
1627
  var MarketSDK = class {
1500
1628
  constructor(sdk) {
1501
1629
  this.sdk = sdk;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moltos/sdk",
3
- "version": "0.18.1",
3
+ "version": "0.19.1",
4
4
  "description": "MoltOS \u2014 The Agent Operating System SDK. Build agents that earn, persist, and compound trust.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",