@metamask-previews/ai-controllers 0.0.0-preview-a00157037 → 0.1.0-preview-9848b08
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 +5 -1
- package/dist/AiDigestService.cjs +13 -4
- 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 +13 -4
- package/dist/AiDigestService.mjs.map +1 -1
- package/dist/ai-digest-types.cjs.map +1 -1
- package/dist/ai-digest-types.d.cts +1 -1
- package/dist/ai-digest-types.d.cts.map +1 -1
- package/dist/ai-digest-types.d.mts +1 -1
- package/dist/ai-digest-types.d.mts.map +1 -1
- package/dist/ai-digest-types.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.1.0]
|
|
11
|
+
|
|
10
12
|
### Added
|
|
11
13
|
|
|
12
14
|
- Initial release ([#7693](https://github.com/MetaMask/core/pull/7693))
|
|
@@ -17,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
17
19
|
### Changed
|
|
18
20
|
|
|
19
21
|
- Validate `searchDigest` API responses and throw when the payload does not match the expected `MarketInsightsReport` shape.
|
|
22
|
+
- Normalize `searchDigest` responses from either direct report payloads or `digest` envelope payloads.
|
|
20
23
|
|
|
21
24
|
### Removed
|
|
22
25
|
|
|
@@ -24,4 +27,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
24
27
|
- Removes `fetchDigest`, `clearDigest`, and `clearAllDigests` actions from the controller action surface.
|
|
25
28
|
- Removes `DigestData`/`DigestEntry` types and the `digests` state branch.
|
|
26
29
|
|
|
27
|
-
[Unreleased]: https://github.com/MetaMask/core/
|
|
30
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/ai-controllers@0.1.0...HEAD
|
|
31
|
+
[0.1.0]: https://github.com/MetaMask/core/releases/tag/@metamask/ai-controllers@0.1.0
|
package/dist/AiDigestService.cjs
CHANGED
|
@@ -19,7 +19,7 @@ const isMarketInsightsReport = (value) => {
|
|
|
19
19
|
if (!isObject(value)) {
|
|
20
20
|
return false;
|
|
21
21
|
}
|
|
22
|
-
return (typeof value.version === 'string' &&
|
|
22
|
+
return ((value.version === undefined || typeof value.version === 'string') &&
|
|
23
23
|
typeof value.asset === 'string' &&
|
|
24
24
|
typeof value.generatedAt === 'string' &&
|
|
25
25
|
typeof value.headline === 'string' &&
|
|
@@ -27,6 +27,15 @@ const isMarketInsightsReport = (value) => {
|
|
|
27
27
|
Array.isArray(value.trends) &&
|
|
28
28
|
Array.isArray(value.sources));
|
|
29
29
|
};
|
|
30
|
+
const getNormalizedMarketInsightsReport = (value) => {
|
|
31
|
+
if (isMarketInsightsReport(value)) {
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
if (isObject(value) && isMarketInsightsReport(value.digest)) {
|
|
35
|
+
return value.digest;
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
};
|
|
30
39
|
class AiDigestService {
|
|
31
40
|
constructor(config) {
|
|
32
41
|
_AiDigestService_baseUrl.set(this, void 0);
|
|
@@ -48,11 +57,11 @@ class AiDigestService {
|
|
|
48
57
|
if (!response.ok) {
|
|
49
58
|
throw new Error(`${ai_digest_constants_1.AiDigestControllerErrorMessage.API_REQUEST_FAILED}: ${response.status}`);
|
|
50
59
|
}
|
|
51
|
-
const
|
|
52
|
-
if (!
|
|
60
|
+
const report = getNormalizedMarketInsightsReport(await response.json());
|
|
61
|
+
if (!report) {
|
|
53
62
|
throw new Error(ai_digest_constants_1.AiDigestControllerErrorMessage.API_INVALID_RESPONSE);
|
|
54
63
|
}
|
|
55
|
-
return
|
|
64
|
+
return report;
|
|
56
65
|
}
|
|
57
66
|
}
|
|
58
67
|
exports.AiDigestService = AiDigestService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiDigestService.cjs","sourceRoot":"","sources":["../src/AiDigestService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,mEAAuE;AAOvE,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CACpE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AAE9C,MAAM,sBAAsB,GAAG,CAC7B,KAAc,EACiB,EAAE;IACjC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CACL,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ;
|
|
1
|
+
{"version":3,"file":"AiDigestService.cjs","sourceRoot":"","sources":["../src/AiDigestService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,mEAAuE;AAOvE,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CACpE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AAE9C,MAAM,sBAAsB,GAAG,CAC7B,KAAc,EACiB,EAAE;IACjC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CACL,CAAC,KAAK,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,CAAC;QAClE,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ;QAC/B,OAAO,KAAK,CAAC,WAAW,KAAK,QAAQ;QACrC,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ;QAClC,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ;QACjC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC;QAC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'@metamask/utils';\n\nimport { AiDigestControllerErrorMessage } from './ai-digest-constants';\nimport type { DigestService, MarketInsightsReport } from './ai-digest-types';\n\nexport type AiDigestServiceConfig = {\n baseUrl: string;\n};\n\nconst isObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null;\n\nconst isMarketInsightsReport = (\n value: unknown,\n): value is MarketInsightsReport => {\n if (!isObject(value)) {\n return false;\n }\n\n return (\n (value.version === undefined || typeof value.version === 'string') &&\n typeof value.asset === 'string' &&\n typeof value.generatedAt === 'string' &&\n typeof value.headline === 'string' &&\n typeof value.summary === 'string' &&\n Array.isArray(value.trends) &&\n Array.isArray(value.sources)\n );\n};\n\nconst getNormalizedMarketInsightsReport = (\n value: unknown,\n): MarketInsightsReport | null => {\n if (isMarketInsightsReport(value)) {\n return value;\n }\n\n if (isObject(value) && isMarketInsightsReport(value.digest)) {\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 * Search for market insights by CAIP-19 asset identifier.\n *\n * Calls `GET ${this.#baseUrl}/digests?caipAssetType=${encodeURIComponent(caip19Id)}`.\n *\n * @param caip19Id - The CAIP-19 identifier of the asset.\n * @returns The market insights report, or `null` if none exists (404).\n */\n async searchDigest(\n caip19Id: CaipAssetType,\n ): Promise<MarketInsightsReport | null> {\n const response = await fetch(\n `${this.#baseUrl}/digests?caipAssetType=${encodeURIComponent(caip19Id)}`,\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":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,wBAAwB;AAGrD,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,8BAA0B;AAE7E,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":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,wBAAwB;AAGrD,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,8BAA0B;AAE7E,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAqCF,qBAAa,eAAgB,YAAW,aAAa;;gBAGvC,MAAM,EAAE,qBAAqB;IAIzC;;;;;;;OAOG;IACG,YAAY,CAChB,QAAQ,EAAE,aAAa,GACtB,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;CAuBxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiDigestService.d.mts","sourceRoot":"","sources":["../src/AiDigestService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,wBAAwB;AAGrD,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,8BAA0B;AAE7E,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":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,wBAAwB;AAGrD,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,8BAA0B;AAE7E,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAqCF,qBAAa,eAAgB,YAAW,aAAa;;gBAGvC,MAAM,EAAE,qBAAqB;IAIzC;;;;;;;OAOG;IACG,YAAY,CAChB,QAAQ,EAAE,aAAa,GACtB,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;CAuBxC"}
|
package/dist/AiDigestService.mjs
CHANGED
|
@@ -16,7 +16,7 @@ const isMarketInsightsReport = (value) => {
|
|
|
16
16
|
if (!isObject(value)) {
|
|
17
17
|
return false;
|
|
18
18
|
}
|
|
19
|
-
return (typeof value.version === 'string' &&
|
|
19
|
+
return ((value.version === undefined || typeof value.version === 'string') &&
|
|
20
20
|
typeof value.asset === 'string' &&
|
|
21
21
|
typeof value.generatedAt === 'string' &&
|
|
22
22
|
typeof value.headline === 'string' &&
|
|
@@ -24,6 +24,15 @@ const isMarketInsightsReport = (value) => {
|
|
|
24
24
|
Array.isArray(value.trends) &&
|
|
25
25
|
Array.isArray(value.sources));
|
|
26
26
|
};
|
|
27
|
+
const getNormalizedMarketInsightsReport = (value) => {
|
|
28
|
+
if (isMarketInsightsReport(value)) {
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
if (isObject(value) && isMarketInsightsReport(value.digest)) {
|
|
32
|
+
return value.digest;
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
};
|
|
27
36
|
export class AiDigestService {
|
|
28
37
|
constructor(config) {
|
|
29
38
|
_AiDigestService_baseUrl.set(this, void 0);
|
|
@@ -45,11 +54,11 @@ export class AiDigestService {
|
|
|
45
54
|
if (!response.ok) {
|
|
46
55
|
throw new Error(`${AiDigestControllerErrorMessage.API_REQUEST_FAILED}: ${response.status}`);
|
|
47
56
|
}
|
|
48
|
-
const
|
|
49
|
-
if (!
|
|
57
|
+
const report = getNormalizedMarketInsightsReport(await response.json());
|
|
58
|
+
if (!report) {
|
|
50
59
|
throw new Error(AiDigestControllerErrorMessage.API_INVALID_RESPONSE);
|
|
51
60
|
}
|
|
52
|
-
return
|
|
61
|
+
return report;
|
|
53
62
|
}
|
|
54
63
|
}
|
|
55
64
|
_AiDigestService_baseUrl = new WeakMap();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiDigestService.mjs","sourceRoot":"","sources":["../src/AiDigestService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,OAAO,EAAE,8BAA8B,EAAE,kCAA8B;AAOvE,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CACpE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AAE9C,MAAM,sBAAsB,GAAG,CAC7B,KAAc,EACiB,EAAE;IACjC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CACL,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ;
|
|
1
|
+
{"version":3,"file":"AiDigestService.mjs","sourceRoot":"","sources":["../src/AiDigestService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,OAAO,EAAE,8BAA8B,EAAE,kCAA8B;AAOvE,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CACpE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AAE9C,MAAM,sBAAsB,GAAG,CAC7B,KAAc,EACiB,EAAE;IACjC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CACL,CAAC,KAAK,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,CAAC;QAClE,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ;QAC/B,OAAO,KAAK,CAAC,WAAW,KAAK,QAAQ;QACrC,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ;QAClC,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ;QACjC,KAAK,CAAC,OAAO,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sourcesContent":["import type { CaipAssetType } from '@metamask/utils';\n\nimport { AiDigestControllerErrorMessage } from './ai-digest-constants';\nimport type { DigestService, MarketInsightsReport } from './ai-digest-types';\n\nexport type AiDigestServiceConfig = {\n baseUrl: string;\n};\n\nconst isObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null;\n\nconst isMarketInsightsReport = (\n value: unknown,\n): value is MarketInsightsReport => {\n if (!isObject(value)) {\n return false;\n }\n\n return (\n (value.version === undefined || typeof value.version === 'string') &&\n typeof value.asset === 'string' &&\n typeof value.generatedAt === 'string' &&\n typeof value.headline === 'string' &&\n typeof value.summary === 'string' &&\n Array.isArray(value.trends) &&\n Array.isArray(value.sources)\n );\n};\n\nconst getNormalizedMarketInsightsReport = (\n value: unknown,\n): MarketInsightsReport | null => {\n if (isMarketInsightsReport(value)) {\n return value;\n }\n\n if (isObject(value) && isMarketInsightsReport(value.digest)) {\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 * Search for market insights by CAIP-19 asset identifier.\n *\n * Calls `GET ${this.#baseUrl}/digests?caipAssetType=${encodeURIComponent(caip19Id)}`.\n *\n * @param caip19Id - The CAIP-19 identifier of the asset.\n * @returns The market insights report, or `null` if none exists (404).\n */\n async searchDigest(\n caip19Id: CaipAssetType,\n ): Promise<MarketInsightsReport | null> {\n const response = await fetch(\n `${this.#baseUrl}/digests?caipAssetType=${encodeURIComponent(caip19Id)}`,\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":"","sourcesContent":["import type { CaipAssetType } from '@metamask/utils';\n\n// ---------------------------------------------------------------------------\n// Market Insights types\n// ---------------------------------------------------------------------------\n\n/**\n * A news article referenced by a market insight trend.\n */\nexport type MarketInsightsArticle = {\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 market insight trend.\n */\nexport type MarketInsightsTweet = {\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 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: 'macro' | 'technical' | 'social' | string;\n /** Impact direction */\n impact: 'positive' | 'negative' | 'neutral' | string;\n /** Related news articles */\n articles: MarketInsightsArticle[];\n /** Related social media posts */\n tweets: MarketInsightsTweet[];\n};\n\n/**\n * A data source used to generate the market insights report.\n */\nexport type MarketInsightsSource = {\n /** Source name (e.g. \"CoinDesk\") */\n name: string;\n /** Source URL */\n url: string;\n /** Source type */\n type: 'news' | 'data' | 'social' | string;\n};\n\n/**\n * AI-generated market insights report for a crypto asset.\n * Returned by `GET /digests?caipAssetType=<caip19Id>`.\n */\nexport type MarketInsightsReport = {\n /** API version */\n version
|
|
1
|
+
{"version":3,"file":"ai-digest-types.cjs","sourceRoot":"","sources":["../src/ai-digest-types.ts"],"names":[],"mappings":"","sourcesContent":["import type { CaipAssetType } from '@metamask/utils';\n\n// ---------------------------------------------------------------------------\n// Market Insights types\n// ---------------------------------------------------------------------------\n\n/**\n * A news article referenced by a market insight trend.\n */\nexport type MarketInsightsArticle = {\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 market insight trend.\n */\nexport type MarketInsightsTweet = {\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 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: 'macro' | 'technical' | 'social' | string;\n /** Impact direction */\n impact: 'positive' | 'negative' | 'neutral' | string;\n /** Related news articles */\n articles: MarketInsightsArticle[];\n /** Related social media posts */\n tweets: MarketInsightsTweet[];\n};\n\n/**\n * A data source used to generate the market insights report.\n */\nexport type MarketInsightsSource = {\n /** Source name (e.g. \"CoinDesk\") */\n name: string;\n /** Source URL */\n url: string;\n /** Source type */\n type: 'news' | 'data' | 'social' | string;\n};\n\n/**\n * AI-generated market insights report for a crypto asset.\n * Returned by `GET /digests?caipAssetType=<caip19Id>`.\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 /** Data sources used to generate the report */\n sources: MarketInsightsSource[];\n};\n\n/**\n * A cached market insights entry.\n */\nexport type MarketInsightsEntry = {\n /** CAIP-19 asset identifier */\n caip19Id: CaipAssetType;\n /** Timestamp when the entry was fetched */\n fetchedAt: number;\n /** The market insights report data */\n data: MarketInsightsReport;\n};\n\n// ---------------------------------------------------------------------------\n// Controller state\n// ---------------------------------------------------------------------------\n\nexport type AiDigestControllerState = {\n marketInsights: Record<string, MarketInsightsEntry>;\n};\n\n// ---------------------------------------------------------------------------\n// Service interface\n// ---------------------------------------------------------------------------\n\nexport type DigestService = {\n /**\n * Search for market insights by CAIP-19 asset identifier.\n * Calls `GET /digests?caipAssetType=<caip19Id>`.\n *\n * @param caip19Id - The CAIP-19 identifier of the asset.\n * @returns The market insights report, or `null` if no insights exist (404).\n */\n searchDigest(caip19Id: CaipAssetType): Promise<MarketInsightsReport | null>;\n};\n"]}
|
|
@@ -59,7 +59,7 @@ export type MarketInsightsSource = {
|
|
|
59
59
|
*/
|
|
60
60
|
export type MarketInsightsReport = {
|
|
61
61
|
/** API version */
|
|
62
|
-
version
|
|
62
|
+
version?: string;
|
|
63
63
|
/** Asset symbol (lowercase, e.g. "btc") */
|
|
64
64
|
asset: string;
|
|
65
65
|
/** ISO date string when the report was generated */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-digest-types.d.cts","sourceRoot":"","sources":["../src/ai-digest-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,wBAAwB;AAMrD;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,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,mBAAmB,GAAG;IAChC,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,mBAAmB,GAAG;IAChC,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,WAAW,EAAE,M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M,MAAM,uBAAuB,GAAG;IACpC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;CACrD,CAAC;AAMF,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;;;OAMG;IACH,YAAY,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;CAC7E,CAAC"}
|
|
@@ -59,7 +59,7 @@ export type MarketInsightsSource = {
|
|
|
59
59
|
*/
|
|
60
60
|
export type MarketInsightsReport = {
|
|
61
61
|
/** API version */
|
|
62
|
-
version
|
|
62
|
+
version?: string;
|
|
63
63
|
/** Asset symbol (lowercase, e.g. "btc") */
|
|
64
64
|
asset: string;
|
|
65
65
|
/** ISO date string when the report was generated */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-digest-types.d.mts","sourceRoot":"","sources":["../src/ai-digest-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,wBAAwB;AAMrD;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,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,mBAAmB,GAAG;IAChC,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,mBAAmB,GAAG;IAChC,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAC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BAAuB,GAAG;IACpC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;CACrD,CAAC;AAMF,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;;;OAMG;IACH,YAAY,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;CAC7E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-digest-types.mjs","sourceRoot":"","sources":["../src/ai-digest-types.ts"],"names":[],"mappings":"","sourcesContent":["import type { CaipAssetType } from '@metamask/utils';\n\n// ---------------------------------------------------------------------------\n// Market Insights types\n// ---------------------------------------------------------------------------\n\n/**\n * A news article referenced by a market insight trend.\n */\nexport type MarketInsightsArticle = {\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 market insight trend.\n */\nexport type MarketInsightsTweet = {\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 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: 'macro' | 'technical' | 'social' | string;\n /** Impact direction */\n impact: 'positive' | 'negative' | 'neutral' | string;\n /** Related news articles */\n articles: MarketInsightsArticle[];\n /** Related social media posts */\n tweets: MarketInsightsTweet[];\n};\n\n/**\n * A data source used to generate the market insights report.\n */\nexport type MarketInsightsSource = {\n /** Source name (e.g. \"CoinDesk\") */\n name: string;\n /** Source URL */\n url: string;\n /** Source type */\n type: 'news' | 'data' | 'social' | string;\n};\n\n/**\n * AI-generated market insights report for a crypto asset.\n * Returned by `GET /digests?caipAssetType=<caip19Id>`.\n */\nexport type MarketInsightsReport = {\n /** API version */\n version
|
|
1
|
+
{"version":3,"file":"ai-digest-types.mjs","sourceRoot":"","sources":["../src/ai-digest-types.ts"],"names":[],"mappings":"","sourcesContent":["import type { CaipAssetType } from '@metamask/utils';\n\n// ---------------------------------------------------------------------------\n// Market Insights types\n// ---------------------------------------------------------------------------\n\n/**\n * A news article referenced by a market insight trend.\n */\nexport type MarketInsightsArticle = {\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 market insight trend.\n */\nexport type MarketInsightsTweet = {\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 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: 'macro' | 'technical' | 'social' | string;\n /** Impact direction */\n impact: 'positive' | 'negative' | 'neutral' | string;\n /** Related news articles */\n articles: MarketInsightsArticle[];\n /** Related social media posts */\n tweets: MarketInsightsTweet[];\n};\n\n/**\n * A data source used to generate the market insights report.\n */\nexport type MarketInsightsSource = {\n /** Source name (e.g. \"CoinDesk\") */\n name: string;\n /** Source URL */\n url: string;\n /** Source type */\n type: 'news' | 'data' | 'social' | string;\n};\n\n/**\n * AI-generated market insights report for a crypto asset.\n * Returned by `GET /digests?caipAssetType=<caip19Id>`.\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 /** Data sources used to generate the report */\n sources: MarketInsightsSource[];\n};\n\n/**\n * A cached market insights entry.\n */\nexport type MarketInsightsEntry = {\n /** CAIP-19 asset identifier */\n caip19Id: CaipAssetType;\n /** Timestamp when the entry was fetched */\n fetchedAt: number;\n /** The market insights report data */\n data: MarketInsightsReport;\n};\n\n// ---------------------------------------------------------------------------\n// Controller state\n// ---------------------------------------------------------------------------\n\nexport type AiDigestControllerState = {\n marketInsights: Record<string, MarketInsightsEntry>;\n};\n\n// ---------------------------------------------------------------------------\n// Service interface\n// ---------------------------------------------------------------------------\n\nexport type DigestService = {\n /**\n * Search for market insights by CAIP-19 asset identifier.\n * Calls `GET /digests?caipAssetType=<caip19Id>`.\n *\n * @param caip19Id - The CAIP-19 identifier of the asset.\n * @returns The market insights report, or `null` if no insights exist (404).\n */\n searchDigest(caip19Id: CaipAssetType): Promise<MarketInsightsReport | null>;\n};\n"]}
|