@metamask-previews/ai-controllers 0.3.0-preview-6cb7e4bcf → 0.4.0-preview-a12b37cc3
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/CHANGELOG.md +15 -1
- package/dist/AiDigestService.cjs +25 -9
- package/dist/AiDigestService.cjs.map +1 -1
- package/dist/AiDigestService.d.cts.map +1 -1
- package/dist/AiDigestService.d.mts.map +1 -1
- package/dist/AiDigestService.mjs +25 -9
- package/dist/AiDigestService.mjs.map +1 -1
- package/dist/ai-digest-types.cjs.map +1 -1
- package/dist/ai-digest-types.d.cts +19 -6
- package/dist/ai-digest-types.d.cts.map +1 -1
- package/dist/ai-digest-types.d.mts +19 -6
- package/dist/ai-digest-types.d.mts.map +1 -1
- package/dist/ai-digest-types.mjs.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.4.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Export new `RelatedAsset` type representing a rich asset object returned in `MarketOverviewTrend.relatedAssets` ([#8218](https://github.com/MetaMask/core/pull/8218)).
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- `MarketOverviewTrend.relatedAssets` is now `RelatedAsset[]` instead of `string[]`. Each entry includes `name`, `symbol`, `caip19`, `sourceAssetId`, and optional `hlPerpsMarket` fields ([#8218](https://github.com/MetaMask/core/pull/8218)).
|
|
19
|
+
- `MarketOverview.headline`, `summary`, and `sources` have been removed; they are not part of the `/market-overview` API response ([#8218](https://github.com/MetaMask/core/pull/8218)).
|
|
20
|
+
- `MarketOverviewTrend.category` and `impact` are now optional to match the live API response shape ([#8218](https://github.com/MetaMask/core/pull/8218)).
|
|
21
|
+
- `AiDigestService.fetchMarketOverview` now accepts both flat `MarketOverview` and `{ report: MarketOverview }` enveloped responses, matching the live API shape ([#8218](https://github.com/MetaMask/core/pull/8218)).
|
|
22
|
+
|
|
10
23
|
## [0.3.0]
|
|
11
24
|
|
|
12
25
|
### Changed
|
|
@@ -50,7 +63,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
50
63
|
- Removes `fetchDigest`, `clearDigest`, and `clearAllDigests` actions from the controller action surface.
|
|
51
64
|
- Removes `DigestData`/`DigestEntry` types and the `digests` state branch.
|
|
52
65
|
|
|
53
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/ai-controllers@0.
|
|
66
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/ai-controllers@0.4.0...HEAD
|
|
67
|
+
[0.4.0]: https://github.com/MetaMask/core/compare/@metamask/ai-controllers@0.3.0...@metamask/ai-controllers@0.4.0
|
|
54
68
|
[0.3.0]: https://github.com/MetaMask/core/compare/@metamask/ai-controllers@0.2.0...@metamask/ai-controllers@0.3.0
|
|
55
69
|
[0.2.0]: https://github.com/MetaMask/core/compare/@metamask/ai-controllers@0.1.0...@metamask/ai-controllers@0.2.0
|
|
56
70
|
[0.1.0]: https://github.com/MetaMask/core/releases/tag/@metamask/ai-controllers@0.1.0
|
package/dist/AiDigestService.cjs
CHANGED
|
@@ -70,23 +70,39 @@ const MarketInsightsDigestEnvelopeStruct = (0, superstruct_1.type)({
|
|
|
70
70
|
digest: MarketInsightsReportStruct,
|
|
71
71
|
});
|
|
72
72
|
// Market Overview structs
|
|
73
|
+
const RelatedAssetStruct = (0, superstruct_1.type)({
|
|
74
|
+
name: (0, superstruct_1.string)(),
|
|
75
|
+
symbol: (0, superstruct_1.string)(),
|
|
76
|
+
caip19: (0, superstruct_1.array)((0, superstruct_1.string)()),
|
|
77
|
+
sourceAssetId: (0, superstruct_1.string)(),
|
|
78
|
+
hlPerpsMarket: (0, superstruct_1.optional)((0, superstruct_1.string)()),
|
|
79
|
+
});
|
|
73
80
|
const MarketOverviewTrendStruct = (0, superstruct_1.type)({
|
|
74
81
|
title: (0, superstruct_1.string)(),
|
|
75
82
|
description: (0, superstruct_1.string)(),
|
|
76
|
-
category: (0, superstruct_1.enums)(trendCategoryValues),
|
|
77
|
-
impact: (0, superstruct_1.enums)(trendImpactValues),
|
|
83
|
+
category: (0, superstruct_1.optional)((0, superstruct_1.enums)(trendCategoryValues)),
|
|
84
|
+
impact: (0, superstruct_1.optional)((0, superstruct_1.enums)(trendImpactValues)),
|
|
78
85
|
articles: (0, superstruct_1.array)(ArticleStruct),
|
|
79
|
-
relatedAssets: (0, superstruct_1.array)(
|
|
86
|
+
relatedAssets: (0, superstruct_1.array)(RelatedAssetStruct),
|
|
80
87
|
});
|
|
81
88
|
const MarketOverviewStruct = (0, superstruct_1.type)({
|
|
82
89
|
version: (0, superstruct_1.optional)((0, superstruct_1.string)()),
|
|
83
90
|
generatedAt: (0, superstruct_1.string)(),
|
|
84
|
-
headline: (0, superstruct_1.string)(),
|
|
85
|
-
summary: (0, superstruct_1.string)(),
|
|
86
91
|
trends: (0, superstruct_1.array)(MarketOverviewTrendStruct),
|
|
87
|
-
sources: (0, superstruct_1.array)(SourceStruct),
|
|
88
92
|
metadata: (0, superstruct_1.optional)((0, superstruct_1.array)(AIResponseMetadataStruct)),
|
|
89
93
|
});
|
|
94
|
+
const MarketOverviewReportEnvelopeStruct = (0, superstruct_1.type)({
|
|
95
|
+
report: MarketOverviewStruct,
|
|
96
|
+
});
|
|
97
|
+
const getNormalizedMarketOverview = (value) => {
|
|
98
|
+
if ((0, superstruct_1.is)(value, MarketOverviewStruct)) {
|
|
99
|
+
return value;
|
|
100
|
+
}
|
|
101
|
+
if ((0, superstruct_1.is)(value, MarketOverviewReportEnvelopeStruct)) {
|
|
102
|
+
return value.report;
|
|
103
|
+
}
|
|
104
|
+
return null;
|
|
105
|
+
};
|
|
90
106
|
const getNormalizedMarketInsightsReport = (value) => {
|
|
91
107
|
if ((0, superstruct_1.is)(value, MarketInsightsReportStruct)) {
|
|
92
108
|
return value;
|
|
@@ -116,11 +132,11 @@ class AiDigestService {
|
|
|
116
132
|
if (!response.ok) {
|
|
117
133
|
throw new Error(`${ai_digest_constants_1.AiDigestControllerErrorMessage.API_REQUEST_FAILED}: ${response.status}`);
|
|
118
134
|
}
|
|
119
|
-
const
|
|
120
|
-
if (!
|
|
135
|
+
const overview = getNormalizedMarketOverview(await response.json());
|
|
136
|
+
if (!overview) {
|
|
121
137
|
throw new Error(ai_digest_constants_1.AiDigestControllerErrorMessage.API_INVALID_RESPONSE);
|
|
122
138
|
}
|
|
123
|
-
return
|
|
139
|
+
return overview;
|
|
124
140
|
}
|
|
125
141
|
/**
|
|
126
142
|
* Search for market insights by asset identifier.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiDigestService.cjs","sourceRoot":"","sources":["../src/AiDigestService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uDAO+B;AAC/B,2CAAkD;AAElD,mEAAuE;AAWvE,0BAA0B;AAE1B,MAAM,aAAa,GAAG,IAAA,kBAAU,EAAC;IAC/B,KAAK,EAAE,IAAA,oBAAM,GAAE;IACf,GAAG,EAAE,IAAA,oBAAM,GAAE;IACb,MAAM,EAAE,IAAA,oBAAM,GAAE;IAChB,IAAI,EAAE,IAAA,oBAAM,GAAE;CACf,CAAC,CAAC;AAEH,MAAM,WAAW,GAAG,IAAA,kBAAU,EAAC;IAC7B,cAAc,EAAE,IAAA,oBAAM,GAAE;IACxB,GAAG,EAAE,IAAA,oBAAM,GAAE;IACb,MAAM,EAAE,IAAA,oBAAM,GAAE;IAChB,IAAI,EAAE,IAAA,oBAAM,GAAE;CACf,CAAC,CAAC;AAEH,MAAM,YAAY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F,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CACb,GAAG,oDAA8B,CAAC,kBAAkB,KAAK,QAAQ,CAAC,MAAM,EAAE,CAC3E,CAAC;QACJ,CAAC;QAED,MAAM,MAAM,GAAG,iCAAiC,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;QAExE,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,oDAA8B,CAAC,oBAAoB,CAAC,CAAC;QACvE,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA5ED,0CA4EC","sourcesContent":["import {\n array,\n enums,\n is,\n optional,\n string,\n type as structType,\n} from '@metamask/superstruct';\nimport { isCaipAssetType } from '@metamask/utils';\n\nimport { AiDigestControllerErrorMessage } from './ai-digest-constants';\nimport type {\n DigestService,\n MarketInsightsReport,\n MarketOverview,\n} from './ai-digest-types';\n\nexport type AiDigestServiceConfig = {\n baseUrl: string;\n};\n\n// Shared sub-type structs\n\nconst ArticleStruct = structType({\n title: string(),\n url: string(),\n source: string(),\n date: string(),\n});\n\nconst TweetStruct = structType({\n contentSummary: string(),\n url: string(),\n author: string(),\n date: string(),\n});\n\nconst SourceStruct = structType({\n name: string(),\n url: string(),\n type: enums(['news', 'data', 'social'] as const),\n});\n\nconst AIResponseMetadataStruct = structType({\n provider: string(),\n});\n\nconst trendCategoryValues = [\n 'geopolitical',\n 'macro',\n 'regulatory',\n 'technical',\n 'social',\n 'other',\n] as const;\n\nconst trendImpactValues = ['positive', 'negative', 'neutral'] as const;\n\n// Market Insights structs\n\nconst MarketInsightsTrendStruct = structType({\n title: string(),\n description: string(),\n category: enums(trendCategoryValues),\n impact: enums(trendImpactValues),\n articles: array(ArticleStruct),\n tweets: array(TweetStruct),\n});\n\nconst MarketInsightsReportStruct = structType({\n version: optional(string()),\n asset: string(),\n generatedAt: string(),\n headline: string(),\n summary: string(),\n trends: array(MarketInsightsTrendStruct),\n social: optional(array(TweetStruct)),\n sources: array(SourceStruct),\n metadata: optional(array(AIResponseMetadataStruct)),\n});\n\nconst MarketInsightsDigestEnvelopeStruct = structType({\n digest: MarketInsightsReportStruct,\n});\n\n// Market Overview structs\n\nconst MarketOverviewTrendStruct = structType({\n title: string(),\n description: string(),\n category: enums(trendCategoryValues),\n impact: enums(trendImpactValues),\n articles: array(ArticleStruct),\n relatedAssets: array(string()),\n});\n\nconst MarketOverviewStruct = structType({\n version: optional(string()),\n generatedAt: string(),\n headline: string(),\n summary: string(),\n trends: array(MarketOverviewTrendStruct),\n sources: array(SourceStruct),\n metadata: optional(array(AIResponseMetadataStruct)),\n});\n\nconst getNormalizedMarketInsightsReport = (\n value: unknown,\n): MarketInsightsReport | null => {\n if (is(value, MarketInsightsReportStruct)) {\n return value;\n }\n\n if (is(value, MarketInsightsDigestEnvelopeStruct)) {\n return value.digest;\n }\n\n return null;\n};\n\nexport class AiDigestService implements DigestService {\n readonly #baseUrl: string;\n\n constructor(config: AiDigestServiceConfig) {\n this.#baseUrl = config.baseUrl;\n }\n\n /**\n * Fetch the market overview report.\n *\n * Calls `GET ${this.#baseUrl}/market-overview`.\n *\n * @returns The market overview report, or `null` if none exists (404).\n */\n async fetchMarketOverview(): Promise<MarketOverview | null> {\n const response = await fetch(`${this.#baseUrl}/market-overview`);\n\n if (response.status === 404) {\n return null;\n }\n\n if (!response.ok) {\n throw new Error(\n `${AiDigestControllerErrorMessage.API_REQUEST_FAILED}: ${response.status}`,\n );\n }\n\n const body: unknown = await response.json();\n\n if (!is(body, MarketOverviewStruct)) {\n throw new Error(AiDigestControllerErrorMessage.API_INVALID_RESPONSE);\n }\n\n return body;\n }\n\n /**\n * Search for market insights by asset identifier.\n *\n * Accepts either a CAIP-19 asset type (e.g. `eip155:1/slip44:60`) or a perps\n * market symbol (e.g. `ETH`). The query parameter is chosen automatically:\n * - CAIP-19 identifiers use `caipAssetType`\n * - Perps market symbols use `hlPerpsMarket`\n *\n * @param assetIdentifier - The asset identifier (CAIP-19 ID or perps market symbol).\n * @returns The market insights report, or `null` if none exists (404).\n */\n async searchDigest(\n assetIdentifier: string,\n ): Promise<MarketInsightsReport | null> {\n const queryParam = isCaipAssetType(assetIdentifier)\n ? `caipAssetType=${encodeURIComponent(assetIdentifier)}`\n : `hlPerpsMarket=${encodeURIComponent(assetIdentifier)}`;\n\n const response = await fetch(\n `${this.#baseUrl}/asset-summary?${queryParam}`,\n );\n\n if (response.status === 404) {\n return null;\n }\n\n if (!response.ok) {\n throw new Error(\n `${AiDigestControllerErrorMessage.API_REQUEST_FAILED}: ${response.status}`,\n );\n }\n\n const report = getNormalizedMarketInsightsReport(await response.json());\n\n if (!report) {\n throw new Error(AiDigestControllerErrorMessage.API_INVALID_RESPONSE);\n }\n\n return report;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"AiDigestService.cjs","sourceRoot":"","sources":["../src/AiDigestService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uDAO+B;AAC/B,2CAAkD;AAElD,mEAAuE;AAWvE,0BAA0B;AAE1B,MAAM,aAAa,GAAG,IAAA,kBAAU,EAAC;IAC/B,KAAK,EAAE,IAAA,oBAAM,GAAE;IACf,GAAG,EAAE,IAAA,oBAAM,GAAE;IACb,MAAM,EAAE,IAAA,oBAAM,GAAE;IAChB,IAAI,EAAE,IAAA,oBAAM,GAAE;CACf,CAAC,CAAC;AAEH,MAAM,WAAW,GAAG,IAAA,kBAAU,EAAC;IAC7B,cAAc,EAAE,IAAA,oBAAM,GAAE;IACxB,GAAG,EAAE,IAAA,oBAAM,GAAE;IACb,MAAM,EAAE,IAAA,oBAAM,GAAE;IAChB,IAAI,EAAE,IAAA,oBAAM,GAAE;CACf,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,IAAA,kBAAU,EAAC;IAC9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,MAAM,QAAQ,GAAG,2BAA2B,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;QAEpE,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,oDAA8B,CAAC,oBAAoB,CAAC,CAAC;QACvE,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,YAAY,CAChB,eAAuB;QAEvB,MAAM,UAAU,GAAG,IAAA,uBAAe,EAAC,eAAe,CAAC;YACjD,CAAC,CAAC,iBAAiB,kBAAkB,CAAC,eAAe,CAAC,EAAE;YACxD,CAAC,CAAC,iBAAiB,kBAAkB,CAAC,eAAe,CAAC,EAAE,CAAC;QAE3D,MAAM,QAAQ,GAAG,MAAM,KAAK,CAC1B,GAAG,uBAAA,IAAI,gCAAS,kBAAkB,UAAU,EAAE,CAC/C,CAAC;QAEF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CACb,GAAG,oDAA8B,CAAC,kBAAkB,KAAK,QAAQ,CAAC,MAAM,EAAE,CAC3E,CAAC;QACJ,CAAC;QAED,MAAM,MAAM,GAAG,iCAAiC,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;QAExE,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,oDAA8B,CAAC,oBAAoB,CAAC,CAAC;QACvE,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA5ED,0CA4EC","sourcesContent":["import {\n array,\n enums,\n is,\n optional,\n string,\n type as structType,\n} from '@metamask/superstruct';\nimport { isCaipAssetType } from '@metamask/utils';\n\nimport { AiDigestControllerErrorMessage } from './ai-digest-constants';\nimport type {\n DigestService,\n MarketInsightsReport,\n MarketOverview,\n} from './ai-digest-types';\n\nexport type AiDigestServiceConfig = {\n baseUrl: string;\n};\n\n// Shared sub-type structs\n\nconst ArticleStruct = structType({\n title: string(),\n url: string(),\n source: string(),\n date: string(),\n});\n\nconst TweetStruct = structType({\n contentSummary: string(),\n url: string(),\n author: string(),\n date: string(),\n});\n\nconst SourceStruct = structType({\n name: string(),\n url: string(),\n type: enums(['news', 'data', 'social'] as const),\n});\n\nconst AIResponseMetadataStruct = structType({\n provider: string(),\n});\n\nconst trendCategoryValues = [\n 'geopolitical',\n 'macro',\n 'regulatory',\n 'technical',\n 'social',\n 'other',\n] as const;\n\nconst trendImpactValues = ['positive', 'negative', 'neutral'] as const;\n\n// Market Insights structs\n\nconst MarketInsightsTrendStruct = structType({\n title: string(),\n description: string(),\n category: enums(trendCategoryValues),\n impact: enums(trendImpactValues),\n articles: array(ArticleStruct),\n tweets: array(TweetStruct),\n});\n\nconst MarketInsightsReportStruct = structType({\n version: optional(string()),\n asset: string(),\n generatedAt: string(),\n headline: string(),\n summary: string(),\n trends: array(MarketInsightsTrendStruct),\n social: optional(array(TweetStruct)),\n sources: array(SourceStruct),\n metadata: optional(array(AIResponseMetadataStruct)),\n});\n\nconst MarketInsightsDigestEnvelopeStruct = structType({\n digest: MarketInsightsReportStruct,\n});\n\n// Market Overview structs\n\nconst RelatedAssetStruct = structType({\n name: string(),\n symbol: string(),\n caip19: array(string()),\n sourceAssetId: string(),\n hlPerpsMarket: optional(string()),\n});\n\nconst MarketOverviewTrendStruct = structType({\n title: string(),\n description: string(),\n category: optional(enums(trendCategoryValues)),\n impact: optional(enums(trendImpactValues)),\n articles: array(ArticleStruct),\n relatedAssets: array(RelatedAssetStruct),\n});\n\nconst MarketOverviewStruct = structType({\n version: optional(string()),\n generatedAt: string(),\n trends: array(MarketOverviewTrendStruct),\n metadata: optional(array(AIResponseMetadataStruct)),\n});\n\nconst MarketOverviewReportEnvelopeStruct = structType({\n report: MarketOverviewStruct,\n});\n\nconst getNormalizedMarketOverview = (value: unknown): MarketOverview | null => {\n if (is(value, MarketOverviewStruct)) {\n return value;\n }\n\n if (is(value, MarketOverviewReportEnvelopeStruct)) {\n return value.report;\n }\n\n return null;\n};\n\nconst getNormalizedMarketInsightsReport = (\n value: unknown,\n): MarketInsightsReport | null => {\n if (is(value, MarketInsightsReportStruct)) {\n return value;\n }\n\n if (is(value, MarketInsightsDigestEnvelopeStruct)) {\n return value.digest;\n }\n\n return null;\n};\n\nexport class AiDigestService implements DigestService {\n readonly #baseUrl: string;\n\n constructor(config: AiDigestServiceConfig) {\n this.#baseUrl = config.baseUrl;\n }\n\n /**\n * Fetch the market overview report.\n *\n * Calls `GET ${this.#baseUrl}/market-overview`.\n *\n * @returns The market overview report, or `null` if none exists (404).\n */\n async fetchMarketOverview(): Promise<MarketOverview | null> {\n const response = await fetch(`${this.#baseUrl}/market-overview`);\n\n if (response.status === 404) {\n return null;\n }\n\n if (!response.ok) {\n throw new Error(\n `${AiDigestControllerErrorMessage.API_REQUEST_FAILED}: ${response.status}`,\n );\n }\n\n const overview = getNormalizedMarketOverview(await response.json());\n\n if (!overview) {\n throw new Error(AiDigestControllerErrorMessage.API_INVALID_RESPONSE);\n }\n\n return overview;\n }\n\n /**\n * Search for market insights by asset identifier.\n *\n * Accepts either a CAIP-19 asset type (e.g. `eip155:1/slip44:60`) or a perps\n * market symbol (e.g. `ETH`). The query parameter is chosen automatically:\n * - CAIP-19 identifiers use `caipAssetType`\n * - Perps market symbols use `hlPerpsMarket`\n *\n * @param assetIdentifier - The asset identifier (CAIP-19 ID or perps market symbol).\n * @returns The market insights report, or `null` if none exists (404).\n */\n async searchDigest(\n assetIdentifier: string,\n ): Promise<MarketInsightsReport | null> {\n const queryParam = isCaipAssetType(assetIdentifier)\n ? `caipAssetType=${encodeURIComponent(assetIdentifier)}`\n : `hlPerpsMarket=${encodeURIComponent(assetIdentifier)}`;\n\n const response = await fetch(\n `${this.#baseUrl}/asset-summary?${queryParam}`,\n );\n\n if (response.status === 404) {\n return null;\n }\n\n if (!response.ok) {\n throw new Error(\n `${AiDigestControllerErrorMessage.API_REQUEST_FAILED}: ${response.status}`,\n );\n }\n\n const report = getNormalizedMarketInsightsReport(await response.json());\n\n if (!report) {\n throw new Error(AiDigestControllerErrorMessage.API_INVALID_RESPONSE);\n }\n\n return report;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiDigestService.d.cts","sourceRoot":"","sources":["../src/AiDigestService.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACpB,cAAc,EACf,8BAA0B;AAE3B,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;
|
|
1
|
+
{"version":3,"file":"AiDigestService.d.cts","sourceRoot":"","sources":["../src/AiDigestService.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACpB,cAAc,EACf,8BAA0B;AAE3B,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AA0HF,qBAAa,eAAgB,YAAW,aAAa;;gBAGvC,MAAM,EAAE,qBAAqB;IAIzC;;;;;;OAMG;IACG,mBAAmB,IAAI,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAsB3D;;;;;;;;;;OAUG;IACG,YAAY,CAChB,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;CA2BxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiDigestService.d.mts","sourceRoot":"","sources":["../src/AiDigestService.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACpB,cAAc,EACf,8BAA0B;AAE3B,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;
|
|
1
|
+
{"version":3,"file":"AiDigestService.d.mts","sourceRoot":"","sources":["../src/AiDigestService.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACpB,cAAc,EACf,8BAA0B;AAE3B,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AA0HF,qBAAa,eAAgB,YAAW,aAAa;;gBAGvC,MAAM,EAAE,qBAAqB;IAIzC;;;;;;OAMG;IACG,mBAAmB,IAAI,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAsB3D;;;;;;;;;;OAUG;IACG,YAAY,CAChB,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;CA2BxC"}
|
package/dist/AiDigestService.mjs
CHANGED
|
@@ -67,23 +67,39 @@ const MarketInsightsDigestEnvelopeStruct = structType({
|
|
|
67
67
|
digest: MarketInsightsReportStruct,
|
|
68
68
|
});
|
|
69
69
|
// Market Overview structs
|
|
70
|
+
const RelatedAssetStruct = structType({
|
|
71
|
+
name: string(),
|
|
72
|
+
symbol: string(),
|
|
73
|
+
caip19: array(string()),
|
|
74
|
+
sourceAssetId: string(),
|
|
75
|
+
hlPerpsMarket: optional(string()),
|
|
76
|
+
});
|
|
70
77
|
const MarketOverviewTrendStruct = structType({
|
|
71
78
|
title: string(),
|
|
72
79
|
description: string(),
|
|
73
|
-
category: enums(trendCategoryValues),
|
|
74
|
-
impact: enums(trendImpactValues),
|
|
80
|
+
category: optional(enums(trendCategoryValues)),
|
|
81
|
+
impact: optional(enums(trendImpactValues)),
|
|
75
82
|
articles: array(ArticleStruct),
|
|
76
|
-
relatedAssets: array(
|
|
83
|
+
relatedAssets: array(RelatedAssetStruct),
|
|
77
84
|
});
|
|
78
85
|
const MarketOverviewStruct = structType({
|
|
79
86
|
version: optional(string()),
|
|
80
87
|
generatedAt: string(),
|
|
81
|
-
headline: string(),
|
|
82
|
-
summary: string(),
|
|
83
88
|
trends: array(MarketOverviewTrendStruct),
|
|
84
|
-
sources: array(SourceStruct),
|
|
85
89
|
metadata: optional(array(AIResponseMetadataStruct)),
|
|
86
90
|
});
|
|
91
|
+
const MarketOverviewReportEnvelopeStruct = structType({
|
|
92
|
+
report: MarketOverviewStruct,
|
|
93
|
+
});
|
|
94
|
+
const getNormalizedMarketOverview = (value) => {
|
|
95
|
+
if (is(value, MarketOverviewStruct)) {
|
|
96
|
+
return value;
|
|
97
|
+
}
|
|
98
|
+
if (is(value, MarketOverviewReportEnvelopeStruct)) {
|
|
99
|
+
return value.report;
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
};
|
|
87
103
|
const getNormalizedMarketInsightsReport = (value) => {
|
|
88
104
|
if (is(value, MarketInsightsReportStruct)) {
|
|
89
105
|
return value;
|
|
@@ -113,11 +129,11 @@ export class AiDigestService {
|
|
|
113
129
|
if (!response.ok) {
|
|
114
130
|
throw new Error(`${AiDigestControllerErrorMessage.API_REQUEST_FAILED}: ${response.status}`);
|
|
115
131
|
}
|
|
116
|
-
const
|
|
117
|
-
if (!
|
|
132
|
+
const overview = getNormalizedMarketOverview(await response.json());
|
|
133
|
+
if (!overview) {
|
|
118
134
|
throw new Error(AiDigestControllerErrorMessage.API_INVALID_RESPONSE);
|
|
119
135
|
}
|
|
120
|
-
return
|
|
136
|
+
return overview;
|
|
121
137
|
}
|
|
122
138
|
/**
|
|
123
139
|
* Search for market insights by asset identifier.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiDigestService.mjs","sourceRoot":"","sources":["../src/AiDigestService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EACL,KAAK,EACL,KAAK,EACL,EAAE,EACF,QAAQ,EACR,MAAM,EACN,IAAI,IAAI,UAAU,EACnB,8BAA8B;AAC/B,OAAO,EAAE,eAAe,EAAE,wBAAwB;AAElD,OAAO,EAAE,8BAA8B,EAAE,kCAA8B;AAWvE,0BAA0B;AAE1B,MAAM,aAAa,GAAG,UAAU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E;YACxD,CAAC,CAAC,iBAAiB,kBAAkB,CAAC,eAAe,CAAC,EAAE,CAAC;QAE3D,MAAM,QAAQ,GAAG,MAAM,KAAK,CAC1B,GAAG,uBAAA,IAAI,gCAAS,kBAAkB,UAAU,EAAE,CAC/C,CAAC;QAEF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CACb,GAAG,8BAA8B,CAAC,kBAAkB,KAAK,QAAQ,CAAC,MAAM,EAAE,CAC3E,CAAC;QACJ,CAAC;QAED,MAAM,MAAM,GAAG,iCAAiC,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;QAExE,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,oBAAoB,CAAC,CAAC;QACvE,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["import {\n array,\n enums,\n is,\n optional,\n string,\n type as structType,\n} from '@metamask/superstruct';\nimport { isCaipAssetType } from '@metamask/utils';\n\nimport { AiDigestControllerErrorMessage } from './ai-digest-constants';\nimport type {\n DigestService,\n MarketInsightsReport,\n MarketOverview,\n} from './ai-digest-types';\n\nexport type AiDigestServiceConfig = {\n baseUrl: string;\n};\n\n// Shared sub-type structs\n\nconst ArticleStruct = structType({\n title: string(),\n url: string(),\n source: string(),\n date: string(),\n});\n\nconst TweetStruct = structType({\n contentSummary: string(),\n url: string(),\n author: string(),\n date: string(),\n});\n\nconst SourceStruct = structType({\n name: string(),\n url: string(),\n type: enums(['news', 'data', 'social'] as const),\n});\n\nconst AIResponseMetadataStruct = structType({\n provider: string(),\n});\n\nconst trendCategoryValues = [\n 'geopolitical',\n 'macro',\n 'regulatory',\n 'technical',\n 'social',\n 'other',\n] as const;\n\nconst trendImpactValues = ['positive', 'negative', 'neutral'] as const;\n\n// Market Insights structs\n\nconst MarketInsightsTrendStruct = structType({\n title: string(),\n description: string(),\n category: enums(trendCategoryValues),\n impact: enums(trendImpactValues),\n articles: array(ArticleStruct),\n tweets: array(TweetStruct),\n});\n\nconst MarketInsightsReportStruct = structType({\n version: optional(string()),\n asset: string(),\n generatedAt: string(),\n headline: string(),\n summary: string(),\n trends: array(MarketInsightsTrendStruct),\n social: optional(array(TweetStruct)),\n sources: array(SourceStruct),\n metadata: optional(array(AIResponseMetadataStruct)),\n});\n\nconst MarketInsightsDigestEnvelopeStruct = structType({\n digest: MarketInsightsReportStruct,\n});\n\n// Market Overview structs\n\nconst RelatedAssetStruct = structType({\n name: string(),\n symbol: string(),\n caip19: array(string()),\n sourceAssetId: string(),\n hlPerpsMarket: optional(string()),\n});\n\nconst MarketOverviewTrendStruct = structType({\n title: string(),\n description: string(),\n category: optional(enums(trendCategoryValues)),\n impact: optional(enums(trendImpactValues)),\n articles: array(ArticleStruct),\n relatedAssets: array(RelatedAssetStruct),\n});\n\nconst MarketOverviewStruct = structType({\n version: optional(string()),\n generatedAt: string(),\n trends: array(MarketOverviewTrendStruct),\n metadata: optional(array(AIResponseMetadataStruct)),\n});\n\nconst MarketOverviewReportEnvelopeStruct = structType({\n report: MarketOverviewStruct,\n});\n\nconst getNormalizedMarketOverview = (value: unknown): MarketOverview | null => {\n if (is(value, MarketOverviewStruct)) {\n return value;\n }\n\n if (is(value, MarketOverviewReportEnvelopeStruct)) {\n return value.report;\n }\n\n return null;\n};\n\nconst getNormalizedMarketInsightsReport = (\n value: unknown,\n): MarketInsightsReport | null => {\n if (is(value, MarketInsightsReportStruct)) {\n return value;\n }\n\n if (is(value, MarketInsightsDigestEnvelopeStruct)) {\n return value.digest;\n }\n\n return null;\n};\n\nexport class AiDigestService implements DigestService {\n readonly #baseUrl: string;\n\n constructor(config: AiDigestServiceConfig) {\n this.#baseUrl = config.baseUrl;\n }\n\n /**\n * Fetch the market overview report.\n *\n * Calls `GET ${this.#baseUrl}/market-overview`.\n *\n * @returns The market overview report, or `null` if none exists (404).\n */\n async fetchMarketOverview(): Promise<MarketOverview | null> {\n const response = await fetch(`${this.#baseUrl}/market-overview`);\n\n if (response.status === 404) {\n return null;\n }\n\n if (!response.ok) {\n throw new Error(\n `${AiDigestControllerErrorMessage.API_REQUEST_FAILED}: ${response.status}`,\n );\n }\n\n const overview = getNormalizedMarketOverview(await response.json());\n\n if (!overview) {\n throw new Error(AiDigestControllerErrorMessage.API_INVALID_RESPONSE);\n }\n\n return overview;\n }\n\n /**\n * Search for market insights by asset identifier.\n *\n * Accepts either a CAIP-19 asset type (e.g. `eip155:1/slip44:60`) or a perps\n * market symbol (e.g. `ETH`). The query parameter is chosen automatically:\n * - CAIP-19 identifiers use `caipAssetType`\n * - Perps market symbols use `hlPerpsMarket`\n *\n * @param assetIdentifier - The asset identifier (CAIP-19 ID or perps market symbol).\n * @returns The market insights report, or `null` if none exists (404).\n */\n async searchDigest(\n assetIdentifier: string,\n ): Promise<MarketInsightsReport | null> {\n const queryParam = isCaipAssetType(assetIdentifier)\n ? `caipAssetType=${encodeURIComponent(assetIdentifier)}`\n : `hlPerpsMarket=${encodeURIComponent(assetIdentifier)}`;\n\n const response = await fetch(\n `${this.#baseUrl}/asset-summary?${queryParam}`,\n );\n\n if (response.status === 404) {\n return null;\n }\n\n if (!response.ok) {\n throw new Error(\n `${AiDigestControllerErrorMessage.API_REQUEST_FAILED}: ${response.status}`,\n );\n }\n\n const report = getNormalizedMarketInsightsReport(await response.json());\n\n if (!report) {\n throw new Error(AiDigestControllerErrorMessage.API_INVALID_RESPONSE);\n }\n\n return report;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-digest-types.cjs","sourceRoot":"","sources":["../src/ai-digest-types.ts"],"names":[],"mappings":";AAAA,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E","sourcesContent":["// ---------------------------------------------------------------------------\n// Shared sub-types\n// ---------------------------------------------------------------------------\n\n/**\n * A news article referenced by a trend.\n */\nexport type Article = {\n /** Article title */\n title: string;\n /** Full URL to the article */\n url: string;\n /** Source domain name (e.g. \"coindesk.com\") */\n source: string;\n /** ISO date string */\n date: string;\n};\n\n/**\n * A social media post referenced by a trend.\n */\nexport type Tweet = {\n /** Summary of the tweet content */\n contentSummary: string;\n /** Full URL to the tweet */\n url: string;\n /** Author handle (e.g. \"@saylordocs\") */\n author: string;\n /** ISO date string */\n date: string;\n};\n\n/**\n * A data source used to generate a report.\n */\nexport type Source = {\n /** Source name (e.g. \"CoinDesk\") */\n name: string;\n /** Source URL */\n url: string;\n /** Source type */\n type: 'news' | 'data' | 'social';\n};\n\nexport type MarketInsightsArticle = Article;\nexport type MarketInsightsTweet = Tweet;\nexport type MarketInsightsSource = Source;\n\n// ---------------------------------------------------------------------------\n// Market Insights types (asset-specific)\n// ---------------------------------------------------------------------------\n\n/**\n * A key market trend identified in the insights report.\n */\nexport type MarketInsightsTrend = {\n /** Trend title (e.g. \"Institutions Buying the Dip\") */\n title: string;\n /** Detailed description of the trend */\n description: string;\n /** Category of the trend */\n category:\n | 'geopolitical'\n | 'macro'\n | 'regulatory'\n | 'technical'\n | 'social'\n | 'other';\n /** Impact direction */\n impact: 'positive' | 'negative' | 'neutral';\n /** Related news articles */\n articles: Article[];\n /** Related social media posts */\n tweets: Tweet[];\n};\n\n/**\n * AI-generated market insights report for a crypto asset.\n * Returned by `GET /asset-summary?caipAssetType=<caip19Id>` or `GET /asset-summary?hlPerpsMarket=<symbol>`.\n */\nexport type MarketInsightsReport = {\n /** API version */\n version?: string;\n /** Asset symbol (lowercase, e.g. \"btc\") */\n asset: string;\n /** ISO date string when the report was generated */\n generatedAt: string;\n /** Main headline */\n headline: string;\n /** Summary paragraph */\n summary: string;\n /** Key market trends */\n trends: MarketInsightsTrend[];\n /** Optional top-level social posts included by the API */\n social?: Tweet[];\n /** Data sources used to generate the report */\n sources: Source[];\n /** Provider metadata */\n metadata?: AIResponseMetadata[];\n};\n\n/**\n * A cached market insights entry.\n */\nexport type MarketInsightsEntry = {\n /** Asset identifier — either a CAIP-19 ID (e.g. \"eip155:1/slip44:60\") or a perps market symbol (e.g. \"ETH\") */\n assetIdentifier: string;\n /** Timestamp when the entry was fetched */\n fetchedAt: number;\n /** The market insights report data */\n data: MarketInsightsReport;\n};\n\n/**\n * A cached market overview entry.\n */\nexport type MarketOverviewEntry = {\n /** Timestamp when the entry was fetched */\n fetchedAt: number;\n /** The market overview data */\n data: MarketOverview;\n};\n\n// ---------------------------------------------------------------------------\n// Market Overview types (non-asset-specific)\n// ---------------------------------------------------------------------------\n\nexport type MarketOverviewTrend = {\n title: string;\n description: string;\n category
|
|
1
|
+
{"version":3,"file":"ai-digest-types.cjs","sourceRoot":"","sources":["../src/ai-digest-types.ts"],"names":[],"mappings":";AAAA,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E","sourcesContent":["// ---------------------------------------------------------------------------\n// Shared sub-types\n// ---------------------------------------------------------------------------\n\n/**\n * A news article referenced by a trend.\n */\nexport type Article = {\n /** Article title */\n title: string;\n /** Full URL to the article */\n url: string;\n /** Source domain name (e.g. \"coindesk.com\") */\n source: string;\n /** ISO date string */\n date: string;\n};\n\n/**\n * A social media post referenced by a trend.\n */\nexport type Tweet = {\n /** Summary of the tweet content */\n contentSummary: string;\n /** Full URL to the tweet */\n url: string;\n /** Author handle (e.g. \"@saylordocs\") */\n author: string;\n /** ISO date string */\n date: string;\n};\n\n/**\n * A data source used to generate a report.\n */\nexport type Source = {\n /** Source name (e.g. \"CoinDesk\") */\n name: string;\n /** Source URL */\n url: string;\n /** Source type */\n type: 'news' | 'data' | 'social';\n};\n\nexport type MarketInsightsArticle = Article;\nexport type MarketInsightsTweet = Tweet;\nexport type MarketInsightsSource = Source;\n\n// ---------------------------------------------------------------------------\n// Market Insights types (asset-specific)\n// ---------------------------------------------------------------------------\n\n/**\n * A key market trend identified in the insights report.\n */\nexport type MarketInsightsTrend = {\n /** Trend title (e.g. \"Institutions Buying the Dip\") */\n title: string;\n /** Detailed description of the trend */\n description: string;\n /** Category of the trend */\n category:\n | 'geopolitical'\n | 'macro'\n | 'regulatory'\n | 'technical'\n | 'social'\n | 'other';\n /** Impact direction */\n impact: 'positive' | 'negative' | 'neutral';\n /** Related news articles */\n articles: Article[];\n /** Related social media posts */\n tweets: Tweet[];\n};\n\n/**\n * AI-generated market insights report for a crypto asset.\n * Returned by `GET /asset-summary?caipAssetType=<caip19Id>` or `GET /asset-summary?hlPerpsMarket=<symbol>`.\n */\nexport type MarketInsightsReport = {\n /** API version */\n version?: string;\n /** Asset symbol (lowercase, e.g. \"btc\") */\n asset: string;\n /** ISO date string when the report was generated */\n generatedAt: string;\n /** Main headline */\n headline: string;\n /** Summary paragraph */\n summary: string;\n /** Key market trends */\n trends: MarketInsightsTrend[];\n /** Optional top-level social posts included by the API */\n social?: Tweet[];\n /** Data sources used to generate the report */\n sources: Source[];\n /** Provider metadata */\n metadata?: AIResponseMetadata[];\n};\n\n/**\n * A cached market insights entry.\n */\nexport type MarketInsightsEntry = {\n /** Asset identifier — either a CAIP-19 ID (e.g. \"eip155:1/slip44:60\") or a perps market symbol (e.g. \"ETH\") */\n assetIdentifier: string;\n /** Timestamp when the entry was fetched */\n fetchedAt: number;\n /** The market insights report data */\n data: MarketInsightsReport;\n};\n\n/**\n * A cached market overview entry.\n */\nexport type MarketOverviewEntry = {\n /** Timestamp when the entry was fetched */\n fetchedAt: number;\n /** The market overview data */\n data: MarketOverview;\n};\n\n// ---------------------------------------------------------------------------\n// Market Overview types (non-asset-specific)\n// ---------------------------------------------------------------------------\n\n/**\n * A crypto asset related to a market overview trend.\n * Returned by the `/market-overview` API as a rich object.\n */\nexport type RelatedAsset = {\n /** Human-readable asset name (e.g. \"Bitcoin\") */\n name: string;\n /** Ticker symbol (e.g. \"BTC\") */\n symbol: string;\n /** CAIP-19 identifiers for this asset across chains */\n caip19: string[];\n /** Canonical source asset identifier (e.g. \"bitcoin\") */\n sourceAssetId: string;\n /** Optional Hyperliquid perps market symbol (e.g. \"BTC\") */\n hlPerpsMarket?: string;\n};\n\nexport type MarketOverviewTrend = {\n title: string;\n description: string;\n category?:\n | 'geopolitical'\n | 'macro'\n | 'regulatory'\n | 'technical'\n | 'social'\n | 'other';\n impact?: 'positive' | 'negative' | 'neutral';\n articles: Article[];\n relatedAssets: RelatedAsset[];\n};\n\n/**\n * Provider metadata included in AI API responses.\n */\nexport type AIResponseMetadata = {\n provider: string;\n};\n\nexport type MarketOverview = {\n version?: string;\n generatedAt: string;\n trends: MarketOverviewTrend[];\n metadata?: AIResponseMetadata[];\n};\n\n// ---------------------------------------------------------------------------\n// Controller state\n// ---------------------------------------------------------------------------\n\nexport type AiDigestControllerState = {\n marketInsights: Record<string, MarketInsightsEntry>;\n marketOverview: MarketOverviewEntry | null;\n};\n\n// ---------------------------------------------------------------------------\n// Service interface\n// ---------------------------------------------------------------------------\n\nexport type DigestService = {\n /**\n * Search for market insights by asset identifier.\n *\n * Accepts either a CAIP-19 asset type (e.g. `eip155:1/slip44:60`) or a perps\n * market symbol (e.g. `ETH`). The implementation is responsible for choosing\n * the correct query parameter (`caipAssetType` vs `hlPerpsMarket`).\n *\n * Calls `GET /asset-summary?caipAssetType=<assetIdentifier>` for CAIP-19 IDs,\n * or `GET /asset-summary?hlPerpsMarket=<assetIdentifier>` for perps symbols.\n *\n * @param assetIdentifier - The asset identifier (CAIP-19 ID or perps market symbol).\n * @returns The market insights report, or `null` if no insights exist (404).\n */\n searchDigest(assetIdentifier: string): Promise<MarketInsightsReport | null>;\n\n /**\n * Fetch the market overview report.\n * Calls `GET /market-overview`.\n *\n * @returns The market overview report, or `null` if none exists (404).\n */\n fetchMarketOverview(): Promise<MarketOverview | null>;\n};\n"]}
|
|
@@ -99,13 +99,29 @@ export type MarketOverviewEntry = {
|
|
|
99
99
|
/** The market overview data */
|
|
100
100
|
data: MarketOverview;
|
|
101
101
|
};
|
|
102
|
+
/**
|
|
103
|
+
* A crypto asset related to a market overview trend.
|
|
104
|
+
* Returned by the `/market-overview` API as a rich object.
|
|
105
|
+
*/
|
|
106
|
+
export type RelatedAsset = {
|
|
107
|
+
/** Human-readable asset name (e.g. "Bitcoin") */
|
|
108
|
+
name: string;
|
|
109
|
+
/** Ticker symbol (e.g. "BTC") */
|
|
110
|
+
symbol: string;
|
|
111
|
+
/** CAIP-19 identifiers for this asset across chains */
|
|
112
|
+
caip19: string[];
|
|
113
|
+
/** Canonical source asset identifier (e.g. "bitcoin") */
|
|
114
|
+
sourceAssetId: string;
|
|
115
|
+
/** Optional Hyperliquid perps market symbol (e.g. "BTC") */
|
|
116
|
+
hlPerpsMarket?: string;
|
|
117
|
+
};
|
|
102
118
|
export type MarketOverviewTrend = {
|
|
103
119
|
title: string;
|
|
104
120
|
description: string;
|
|
105
|
-
category
|
|
106
|
-
impact
|
|
121
|
+
category?: 'geopolitical' | 'macro' | 'regulatory' | 'technical' | 'social' | 'other';
|
|
122
|
+
impact?: 'positive' | 'negative' | 'neutral';
|
|
107
123
|
articles: Article[];
|
|
108
|
-
relatedAssets:
|
|
124
|
+
relatedAssets: RelatedAsset[];
|
|
109
125
|
};
|
|
110
126
|
/**
|
|
111
127
|
* Provider metadata included in AI API responses.
|
|
@@ -116,10 +132,7 @@ export type AIResponseMetadata = {
|
|
|
116
132
|
export type MarketOverview = {
|
|
117
133
|
version?: string;
|
|
118
134
|
generatedAt: string;
|
|
119
|
-
headline: string;
|
|
120
|
-
summary: string;
|
|
121
135
|
trends: MarketOverviewTrend[];
|
|
122
|
-
sources: Source[];
|
|
123
136
|
metadata?: AIResponseMetadata[];
|
|
124
137
|
};
|
|
125
138
|
export type AiDigestControllerState = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-digest-types.d.cts","sourceRoot":"","sources":["../src/ai-digest-types.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB,oBAAoB;IACpB,KA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GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9B,QAAQ,CAAC,EAAE,kBAAkB,EAAE,CAAC;CACjC,CAAC;AAMF,MAAM,MAAM,uBAAuB,GAAG;IACpC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IACpD,cAAc,EAAE,mBAAmB,GAAG,IAAI,CAAC;CAC5C,CAAC;AAMF,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;;;;;;;;;OAYG;IACH,YAAY,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;IAE5E;;;;;OAKG;IACH,mBAAmB,IAAI,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;CACvD,CAAC"}
|
|
@@ -99,13 +99,29 @@ export type MarketOverviewEntry = {
|
|
|
99
99
|
/** The market overview data */
|
|
100
100
|
data: MarketOverview;
|
|
101
101
|
};
|
|
102
|
+
/**
|
|
103
|
+
* A crypto asset related to a market overview trend.
|
|
104
|
+
* Returned by the `/market-overview` API as a rich object.
|
|
105
|
+
*/
|
|
106
|
+
export type RelatedAsset = {
|
|
107
|
+
/** Human-readable asset name (e.g. "Bitcoin") */
|
|
108
|
+
name: string;
|
|
109
|
+
/** Ticker symbol (e.g. "BTC") */
|
|
110
|
+
symbol: string;
|
|
111
|
+
/** CAIP-19 identifiers for this asset across chains */
|
|
112
|
+
caip19: string[];
|
|
113
|
+
/** Canonical source asset identifier (e.g. "bitcoin") */
|
|
114
|
+
sourceAssetId: string;
|
|
115
|
+
/** Optional Hyperliquid perps market symbol (e.g. "BTC") */
|
|
116
|
+
hlPerpsMarket?: string;
|
|
117
|
+
};
|
|
102
118
|
export type MarketOverviewTrend = {
|
|
103
119
|
title: string;
|
|
104
120
|
description: string;
|
|
105
|
-
category
|
|
106
|
-
impact
|
|
121
|
+
category?: 'geopolitical' | 'macro' | 'regulatory' | 'technical' | 'social' | 'other';
|
|
122
|
+
impact?: 'positive' | 'negative' | 'neutral';
|
|
107
123
|
articles: Article[];
|
|
108
|
-
relatedAssets:
|
|
124
|
+
relatedAssets: RelatedAsset[];
|
|
109
125
|
};
|
|
110
126
|
/**
|
|
111
127
|
* Provider metadata included in AI API responses.
|
|
@@ -116,10 +132,7 @@ export type AIResponseMetadata = {
|
|
|
116
132
|
export type MarketOverview = {
|
|
117
133
|
version?: string;
|
|
118
134
|
generatedAt: string;
|
|
119
|
-
headline: string;
|
|
120
|
-
summary: string;
|
|
121
135
|
trends: MarketOverviewTrend[];
|
|
122
|
-
sources: Source[];
|
|
123
136
|
metadata?: AIResponseMetadata[];
|
|
124
137
|
};
|
|
125
138
|
export type AiDigestControllerState = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-digest-types.d.mts","sourceRoot":"","sources":["../src/ai-digest-types.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG;IAClB,mCAAmC;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,4BAA4B;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG;I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,MAAM,aAAa,GAAG;IAC1B;;;;;;;;;;;;OAYG;IACH,YAAY,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;IAE5E;;;;;OAKG;IACH,mBAAmB,IAAI,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;CACvD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-digest-types.mjs","sourceRoot":"","sources":["../src/ai-digest-types.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E","sourcesContent":["// ---------------------------------------------------------------------------\n// Shared sub-types\n// ---------------------------------------------------------------------------\n\n/**\n * A news article referenced by a trend.\n */\nexport type Article = {\n /** Article title */\n title: string;\n /** Full URL to the article */\n url: string;\n /** Source domain name (e.g. \"coindesk.com\") */\n source: string;\n /** ISO date string */\n date: string;\n};\n\n/**\n * A social media post referenced by a trend.\n */\nexport type Tweet = {\n /** Summary of the tweet content */\n contentSummary: string;\n /** Full URL to the tweet */\n url: string;\n /** Author handle (e.g. \"@saylordocs\") */\n author: string;\n /** ISO date string */\n date: string;\n};\n\n/**\n * A data source used to generate a report.\n */\nexport type Source = {\n /** Source name (e.g. \"CoinDesk\") */\n name: string;\n /** Source URL */\n url: string;\n /** Source type */\n type: 'news' | 'data' | 'social';\n};\n\nexport type MarketInsightsArticle = Article;\nexport type MarketInsightsTweet = Tweet;\nexport type MarketInsightsSource = Source;\n\n// ---------------------------------------------------------------------------\n// Market Insights types (asset-specific)\n// ---------------------------------------------------------------------------\n\n/**\n * A key market trend identified in the insights report.\n */\nexport type MarketInsightsTrend = {\n /** Trend title (e.g. \"Institutions Buying the Dip\") */\n title: string;\n /** Detailed description of the trend */\n description: string;\n /** Category of the trend */\n category:\n | 'geopolitical'\n | 'macro'\n | 'regulatory'\n | 'technical'\n | 'social'\n | 'other';\n /** Impact direction */\n impact: 'positive' | 'negative' | 'neutral';\n /** Related news articles */\n articles: Article[];\n /** Related social media posts */\n tweets: Tweet[];\n};\n\n/**\n * AI-generated market insights report for a crypto asset.\n * Returned by `GET /asset-summary?caipAssetType=<caip19Id>` or `GET /asset-summary?hlPerpsMarket=<symbol>`.\n */\nexport type MarketInsightsReport = {\n /** API version */\n version?: string;\n /** Asset symbol (lowercase, e.g. \"btc\") */\n asset: string;\n /** ISO date string when the report was generated */\n generatedAt: string;\n /** Main headline */\n headline: string;\n /** Summary paragraph */\n summary: string;\n /** Key market trends */\n trends: MarketInsightsTrend[];\n /** Optional top-level social posts included by the API */\n social?: Tweet[];\n /** Data sources used to generate the report */\n sources: Source[];\n /** Provider metadata */\n metadata?: AIResponseMetadata[];\n};\n\n/**\n * A cached market insights entry.\n */\nexport type MarketInsightsEntry = {\n /** Asset identifier — either a CAIP-19 ID (e.g. \"eip155:1/slip44:60\") or a perps market symbol (e.g. \"ETH\") */\n assetIdentifier: string;\n /** Timestamp when the entry was fetched */\n fetchedAt: number;\n /** The market insights report data */\n data: MarketInsightsReport;\n};\n\n/**\n * A cached market overview entry.\n */\nexport type MarketOverviewEntry = {\n /** Timestamp when the entry was fetched */\n fetchedAt: number;\n /** The market overview data */\n data: MarketOverview;\n};\n\n// ---------------------------------------------------------------------------\n// Market Overview types (non-asset-specific)\n// ---------------------------------------------------------------------------\n\nexport type MarketOverviewTrend = {\n title: string;\n description: string;\n category
|
|
1
|
+
{"version":3,"file":"ai-digest-types.mjs","sourceRoot":"","sources":["../src/ai-digest-types.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E","sourcesContent":["// ---------------------------------------------------------------------------\n// Shared sub-types\n// ---------------------------------------------------------------------------\n\n/**\n * A news article referenced by a trend.\n */\nexport type Article = {\n /** Article title */\n title: string;\n /** Full URL to the article */\n url: string;\n /** Source domain name (e.g. \"coindesk.com\") */\n source: string;\n /** ISO date string */\n date: string;\n};\n\n/**\n * A social media post referenced by a trend.\n */\nexport type Tweet = {\n /** Summary of the tweet content */\n contentSummary: string;\n /** Full URL to the tweet */\n url: string;\n /** Author handle (e.g. \"@saylordocs\") */\n author: string;\n /** ISO date string */\n date: string;\n};\n\n/**\n * A data source used to generate a report.\n */\nexport type Source = {\n /** Source name (e.g. \"CoinDesk\") */\n name: string;\n /** Source URL */\n url: string;\n /** Source type */\n type: 'news' | 'data' | 'social';\n};\n\nexport type MarketInsightsArticle = Article;\nexport type MarketInsightsTweet = Tweet;\nexport type MarketInsightsSource = Source;\n\n// ---------------------------------------------------------------------------\n// Market Insights types (asset-specific)\n// ---------------------------------------------------------------------------\n\n/**\n * A key market trend identified in the insights report.\n */\nexport type MarketInsightsTrend = {\n /** Trend title (e.g. \"Institutions Buying the Dip\") */\n title: string;\n /** Detailed description of the trend */\n description: string;\n /** Category of the trend */\n category:\n | 'geopolitical'\n | 'macro'\n | 'regulatory'\n | 'technical'\n | 'social'\n | 'other';\n /** Impact direction */\n impact: 'positive' | 'negative' | 'neutral';\n /** Related news articles */\n articles: Article[];\n /** Related social media posts */\n tweets: Tweet[];\n};\n\n/**\n * AI-generated market insights report for a crypto asset.\n * Returned by `GET /asset-summary?caipAssetType=<caip19Id>` or `GET /asset-summary?hlPerpsMarket=<symbol>`.\n */\nexport type MarketInsightsReport = {\n /** API version */\n version?: string;\n /** Asset symbol (lowercase, e.g. \"btc\") */\n asset: string;\n /** ISO date string when the report was generated */\n generatedAt: string;\n /** Main headline */\n headline: string;\n /** Summary paragraph */\n summary: string;\n /** Key market trends */\n trends: MarketInsightsTrend[];\n /** Optional top-level social posts included by the API */\n social?: Tweet[];\n /** Data sources used to generate the report */\n sources: Source[];\n /** Provider metadata */\n metadata?: AIResponseMetadata[];\n};\n\n/**\n * A cached market insights entry.\n */\nexport type MarketInsightsEntry = {\n /** Asset identifier — either a CAIP-19 ID (e.g. \"eip155:1/slip44:60\") or a perps market symbol (e.g. \"ETH\") */\n assetIdentifier: string;\n /** Timestamp when the entry was fetched */\n fetchedAt: number;\n /** The market insights report data */\n data: MarketInsightsReport;\n};\n\n/**\n * A cached market overview entry.\n */\nexport type MarketOverviewEntry = {\n /** Timestamp when the entry was fetched */\n fetchedAt: number;\n /** The market overview data */\n data: MarketOverview;\n};\n\n// ---------------------------------------------------------------------------\n// Market Overview types (non-asset-specific)\n// ---------------------------------------------------------------------------\n\n/**\n * A crypto asset related to a market overview trend.\n * Returned by the `/market-overview` API as a rich object.\n */\nexport type RelatedAsset = {\n /** Human-readable asset name (e.g. \"Bitcoin\") */\n name: string;\n /** Ticker symbol (e.g. \"BTC\") */\n symbol: string;\n /** CAIP-19 identifiers for this asset across chains */\n caip19: string[];\n /** Canonical source asset identifier (e.g. \"bitcoin\") */\n sourceAssetId: string;\n /** Optional Hyperliquid perps market symbol (e.g. \"BTC\") */\n hlPerpsMarket?: string;\n};\n\nexport type MarketOverviewTrend = {\n title: string;\n description: string;\n category?:\n | 'geopolitical'\n | 'macro'\n | 'regulatory'\n | 'technical'\n | 'social'\n | 'other';\n impact?: 'positive' | 'negative' | 'neutral';\n articles: Article[];\n relatedAssets: RelatedAsset[];\n};\n\n/**\n * Provider metadata included in AI API responses.\n */\nexport type AIResponseMetadata = {\n provider: string;\n};\n\nexport type MarketOverview = {\n version?: string;\n generatedAt: string;\n trends: MarketOverviewTrend[];\n metadata?: AIResponseMetadata[];\n};\n\n// ---------------------------------------------------------------------------\n// Controller state\n// ---------------------------------------------------------------------------\n\nexport type AiDigestControllerState = {\n marketInsights: Record<string, MarketInsightsEntry>;\n marketOverview: MarketOverviewEntry | null;\n};\n\n// ---------------------------------------------------------------------------\n// Service interface\n// ---------------------------------------------------------------------------\n\nexport type DigestService = {\n /**\n * Search for market insights by asset identifier.\n *\n * Accepts either a CAIP-19 asset type (e.g. `eip155:1/slip44:60`) or a perps\n * market symbol (e.g. `ETH`). The implementation is responsible for choosing\n * the correct query parameter (`caipAssetType` vs `hlPerpsMarket`).\n *\n * Calls `GET /asset-summary?caipAssetType=<assetIdentifier>` for CAIP-19 IDs,\n * or `GET /asset-summary?hlPerpsMarket=<assetIdentifier>` for perps symbols.\n *\n * @param assetIdentifier - The asset identifier (CAIP-19 ID or perps market symbol).\n * @returns The market insights report, or `null` if no insights exist (404).\n */\n searchDigest(assetIdentifier: string): Promise<MarketInsightsReport | null>;\n\n /**\n * Fetch the market overview report.\n * Calls `GET /market-overview`.\n *\n * @returns The market overview report, or `null` if none exists (404).\n */\n fetchMarketOverview(): Promise<MarketOverview | null>;\n};\n"]}
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAUA,+DAG8B;AAF5B,wHAAA,kBAAkB,OAAA;AAClB,uIAAA,iCAAiC,OAAA;AAInC,yDAAoD;AAA3C,kHAAA,eAAe,OAAA;
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAUA,+DAG8B;AAF5B,wHAAA,kBAAkB,OAAA;AAClB,uIAAA,iCAAiC,OAAA;AAInC,yDAAoD;AAA3C,kHAAA,eAAe,OAAA;AAqBxB,iEAK+B;AAJ7B,6HAAA,cAAc,OAA0B;AACxC,wHAAA,iBAAiB,OAAA;AACjB,wHAAA,iBAAiB,OAAA;AACjB,qIAAA,8BAA8B,OAAA","sourcesContent":["export type {\n AiDigestControllerActions,\n AiDigestControllerEvents,\n AiDigestControllerFetchMarketInsightsAction,\n AiDigestControllerFetchMarketOverviewAction,\n AiDigestControllerGetStateAction,\n AiDigestControllerMessenger,\n AiDigestControllerOptions,\n AiDigestControllerStateChangeEvent,\n} from './AiDigestController';\nexport {\n AiDigestController,\n getDefaultAiDigestControllerState,\n} from './AiDigestController';\n\nexport type { AiDigestServiceConfig } from './AiDigestService';\nexport { AiDigestService } from './AiDigestService';\n\nexport type {\n AiDigestControllerState,\n AIResponseMetadata,\n Article,\n DigestService,\n MarketInsightsArticle,\n MarketInsightsEntry,\n MarketInsightsReport,\n MarketInsightsSource,\n MarketInsightsTrend,\n MarketInsightsTweet,\n MarketOverview,\n MarketOverviewEntry,\n MarketOverviewTrend,\n RelatedAsset,\n Source,\n Tweet,\n} from './ai-digest-types';\n\nexport {\n controllerName as aiDigestControllerName,\n CACHE_DURATION_MS,\n MAX_CACHE_ENTRIES,\n AiDigestControllerErrorMessage,\n} from './ai-digest-constants';\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -2,6 +2,6 @@ export type { AiDigestControllerActions, AiDigestControllerEvents, AiDigestContr
|
|
|
2
2
|
export { AiDigestController, getDefaultAiDigestControllerState, } from "./AiDigestController.cjs";
|
|
3
3
|
export type { AiDigestServiceConfig } from "./AiDigestService.cjs";
|
|
4
4
|
export { AiDigestService } from "./AiDigestService.cjs";
|
|
5
|
-
export type { AiDigestControllerState, AIResponseMetadata, Article, DigestService, MarketInsightsArticle, MarketInsightsEntry, MarketInsightsReport, MarketInsightsSource, MarketInsightsTrend, MarketInsightsTweet, MarketOverview, MarketOverviewEntry, MarketOverviewTrend, Source, Tweet, } from "./ai-digest-types.cjs";
|
|
5
|
+
export type { AiDigestControllerState, AIResponseMetadata, Article, DigestService, MarketInsightsArticle, MarketInsightsEntry, MarketInsightsReport, MarketInsightsSource, MarketInsightsTrend, MarketInsightsTweet, MarketOverview, MarketOverviewEntry, MarketOverviewTrend, RelatedAsset, Source, Tweet, } from "./ai-digest-types.cjs";
|
|
6
6
|
export { controllerName as aiDigestControllerName, CACHE_DURATION_MS, MAX_CACHE_ENTRIES, AiDigestControllerErrorMessage, } from "./ai-digest-constants.cjs";
|
|
7
7
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,yBAAyB,EACzB,wBAAwB,EACxB,2CAA2C,EAC3C,2CAA2C,EAC3C,gCAAgC,EAChC,2BAA2B,EAC3B,yBAAyB,EACzB,kCAAkC,GACnC,iCAA6B;AAC9B,OAAO,EACL,kBAAkB,EAClB,iCAAiC,GAClC,iCAA6B;AAE9B,YAAY,EAAE,qBAAqB,EAAE,8BAA0B;AAC/D,OAAO,EAAE,eAAe,EAAE,8BAA0B;AAEpD,YAAY,EACV,uBAAuB,EACvB,kBAAkB,EAClB,OAAO,EACP,aAAa,EACb,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,MAAM,EACN,KAAK,GACN,8BAA0B;AAE3B,OAAO,EACL,cAAc,IAAI,sBAAsB,EACxC,iBAAiB,EACjB,iBAAiB,EACjB,8BAA8B,GAC/B,kCAA8B"}
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,yBAAyB,EACzB,wBAAwB,EACxB,2CAA2C,EAC3C,2CAA2C,EAC3C,gCAAgC,EAChC,2BAA2B,EAC3B,yBAAyB,EACzB,kCAAkC,GACnC,iCAA6B;AAC9B,OAAO,EACL,kBAAkB,EAClB,iCAAiC,GAClC,iCAA6B;AAE9B,YAAY,EAAE,qBAAqB,EAAE,8BAA0B;AAC/D,OAAO,EAAE,eAAe,EAAE,8BAA0B;AAEpD,YAAY,EACV,uBAAuB,EACvB,kBAAkB,EAClB,OAAO,EACP,aAAa,EACb,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,MAAM,EACN,KAAK,GACN,8BAA0B;AAE3B,OAAO,EACL,cAAc,IAAI,sBAAsB,EACxC,iBAAiB,EACjB,iBAAiB,EACjB,8BAA8B,GAC/B,kCAA8B"}
|
package/dist/index.d.mts
CHANGED
|
@@ -2,6 +2,6 @@ export type { AiDigestControllerActions, AiDigestControllerEvents, AiDigestContr
|
|
|
2
2
|
export { AiDigestController, getDefaultAiDigestControllerState, } from "./AiDigestController.mjs";
|
|
3
3
|
export type { AiDigestServiceConfig } from "./AiDigestService.mjs";
|
|
4
4
|
export { AiDigestService } from "./AiDigestService.mjs";
|
|
5
|
-
export type { AiDigestControllerState, AIResponseMetadata, Article, DigestService, MarketInsightsArticle, MarketInsightsEntry, MarketInsightsReport, MarketInsightsSource, MarketInsightsTrend, MarketInsightsTweet, MarketOverview, MarketOverviewEntry, MarketOverviewTrend, Source, Tweet, } from "./ai-digest-types.mjs";
|
|
5
|
+
export type { AiDigestControllerState, AIResponseMetadata, Article, DigestService, MarketInsightsArticle, MarketInsightsEntry, MarketInsightsReport, MarketInsightsSource, MarketInsightsTrend, MarketInsightsTweet, MarketOverview, MarketOverviewEntry, MarketOverviewTrend, RelatedAsset, Source, Tweet, } from "./ai-digest-types.mjs";
|
|
6
6
|
export { controllerName as aiDigestControllerName, CACHE_DURATION_MS, MAX_CACHE_ENTRIES, AiDigestControllerErrorMessage, } from "./ai-digest-constants.mjs";
|
|
7
7
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,yBAAyB,EACzB,wBAAwB,EACxB,2CAA2C,EAC3C,2CAA2C,EAC3C,gCAAgC,EAChC,2BAA2B,EAC3B,yBAAyB,EACzB,kCAAkC,GACnC,iCAA6B;AAC9B,OAAO,EACL,kBAAkB,EAClB,iCAAiC,GAClC,iCAA6B;AAE9B,YAAY,EAAE,qBAAqB,EAAE,8BAA0B;AAC/D,OAAO,EAAE,eAAe,EAAE,8BAA0B;AAEpD,YAAY,EACV,uBAAuB,EACvB,kBAAkB,EAClB,OAAO,EACP,aAAa,EACb,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,MAAM,EACN,KAAK,GACN,8BAA0B;AAE3B,OAAO,EACL,cAAc,IAAI,sBAAsB,EACxC,iBAAiB,EACjB,iBAAiB,EACjB,8BAA8B,GAC/B,kCAA8B"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,yBAAyB,EACzB,wBAAwB,EACxB,2CAA2C,EAC3C,2CAA2C,EAC3C,gCAAgC,EAChC,2BAA2B,EAC3B,yBAAyB,EACzB,kCAAkC,GACnC,iCAA6B;AAC9B,OAAO,EACL,kBAAkB,EAClB,iCAAiC,GAClC,iCAA6B;AAE9B,YAAY,EAAE,qBAAqB,EAAE,8BAA0B;AAC/D,OAAO,EAAE,eAAe,EAAE,8BAA0B;AAEpD,YAAY,EACV,uBAAuB,EACvB,kBAAkB,EAClB,OAAO,EACP,aAAa,EACb,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,MAAM,EACN,KAAK,GACN,8BAA0B;AAE3B,OAAO,EACL,cAAc,IAAI,sBAAsB,EACxC,iBAAiB,EACjB,iBAAiB,EACjB,8BAA8B,GAC/B,kCAA8B"}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,kBAAkB,EAClB,iCAAiC,EAClC,iCAA6B;AAG9B,OAAO,EAAE,eAAe,EAAE,8BAA0B;
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,kBAAkB,EAClB,iCAAiC,EAClC,iCAA6B;AAG9B,OAAO,EAAE,eAAe,EAAE,8BAA0B;AAqBpD,OAAO,EACL,cAAc,IAAI,sBAAsB,EACxC,iBAAiB,EACjB,iBAAiB,EACjB,8BAA8B,EAC/B,kCAA8B","sourcesContent":["export type {\n AiDigestControllerActions,\n AiDigestControllerEvents,\n AiDigestControllerFetchMarketInsightsAction,\n AiDigestControllerFetchMarketOverviewAction,\n AiDigestControllerGetStateAction,\n AiDigestControllerMessenger,\n AiDigestControllerOptions,\n AiDigestControllerStateChangeEvent,\n} from './AiDigestController';\nexport {\n AiDigestController,\n getDefaultAiDigestControllerState,\n} from './AiDigestController';\n\nexport type { AiDigestServiceConfig } from './AiDigestService';\nexport { AiDigestService } from './AiDigestService';\n\nexport type {\n AiDigestControllerState,\n AIResponseMetadata,\n Article,\n DigestService,\n MarketInsightsArticle,\n MarketInsightsEntry,\n MarketInsightsReport,\n MarketInsightsSource,\n MarketInsightsTrend,\n MarketInsightsTweet,\n MarketOverview,\n MarketOverviewEntry,\n MarketOverviewTrend,\n RelatedAsset,\n Source,\n Tweet,\n} from './ai-digest-types';\n\nexport {\n controllerName as aiDigestControllerName,\n CACHE_DURATION_MS,\n MAX_CACHE_ENTRIES,\n AiDigestControllerErrorMessage,\n} from './ai-digest-constants';\n"]}
|