@hyperflow.fun/ghost 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +34 -18
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -124033,7 +124033,7 @@ function assertValidVersions(sorted) {
|
|
|
124033
124033
|
}
|
|
124034
124034
|
}
|
|
124035
124035
|
}
|
|
124036
|
-
var baselineDbMigration, proactiveCooldownsMigration, dropProactiveCooldownsMigration, alertsKindPayloadMigration, addSettingsKvMigration, addTweetsAiRelevantMigration, addObserverStateMigration, splitAlertsMigration, addXFollowsEnabledSourceMigration, addCronJobsMigration, reshapeArticlesMigration, DB_MIGRATIONS, CONFIG_MIGRATIONS;
|
|
124036
|
+
var baselineDbMigration, proactiveCooldownsMigration, dropProactiveCooldownsMigration, alertsKindPayloadMigration, addSettingsKvMigration, addTweetsAiRelevantMigration, addObserverStateMigration, splitAlertsMigration, addXFollowsEnabledSourceMigration, addCronJobsMigration, reshapeArticlesMigration, fixCoindeskRssUrlMigration, DB_MIGRATIONS, CONFIG_MIGRATIONS;
|
|
124037
124037
|
var init_registry = __esm(() => {
|
|
124038
124038
|
baselineDbMigration = {
|
|
124039
124039
|
version: 1,
|
|
@@ -124212,6 +124212,16 @@ var init_registry = __esm(() => {
|
|
|
124212
124212
|
db.run(`ALTER TABLE articles ADD COLUMN body TEXT`);
|
|
124213
124213
|
}
|
|
124214
124214
|
};
|
|
124215
|
+
fixCoindeskRssUrlMigration = {
|
|
124216
|
+
version: 12,
|
|
124217
|
+
label: "fix_coindesk_rss_url",
|
|
124218
|
+
up: (db) => {
|
|
124219
|
+
db.run(`UPDATE news_sources
|
|
124220
|
+
SET custom_url = 'https://www.coindesk.com/arc/outboundfeeds/rss'
|
|
124221
|
+
WHERE source_id = 'coindesk'
|
|
124222
|
+
AND custom_url = 'https://www.coindesk.com/arc/outboundfeeds/rss/'`);
|
|
124223
|
+
}
|
|
124224
|
+
};
|
|
124215
124225
|
DB_MIGRATIONS = [
|
|
124216
124226
|
baselineDbMigration,
|
|
124217
124227
|
proactiveCooldownsMigration,
|
|
@@ -124223,7 +124233,8 @@ var init_registry = __esm(() => {
|
|
|
124223
124233
|
splitAlertsMigration,
|
|
124224
124234
|
addXFollowsEnabledSourceMigration,
|
|
124225
124235
|
addCronJobsMigration,
|
|
124226
|
-
reshapeArticlesMigration
|
|
124236
|
+
reshapeArticlesMigration,
|
|
124237
|
+
fixCoindeskRssUrlMigration
|
|
124227
124238
|
];
|
|
124228
124239
|
CONFIG_MIGRATIONS = [];
|
|
124229
124240
|
});
|
|
@@ -160800,7 +160811,7 @@ var init_news_types = __esm(() => {
|
|
|
160800
160811
|
];
|
|
160801
160812
|
NEWS_SOURCE_PRESETS = [
|
|
160802
160813
|
{ sourceId: "cryptopanic", name: "CryptoPanic", type: "api", needsApiKey: true },
|
|
160803
|
-
{ sourceId: "coindesk", name: "CoinDesk", type: "rss", needsApiKey: false, defaultUrl: "https://www.coindesk.com/arc/outboundfeeds/rss
|
|
160814
|
+
{ sourceId: "coindesk", name: "CoinDesk", type: "rss", needsApiKey: false, defaultUrl: "https://www.coindesk.com/arc/outboundfeeds/rss" },
|
|
160804
160815
|
{ sourceId: "theblock", name: "The Block", type: "rss", needsApiKey: false, defaultUrl: "https://www.theblock.co/rss.xml" },
|
|
160805
160816
|
{ sourceId: "decrypt", name: "Decrypt", type: "rss", needsApiKey: false, defaultUrl: "https://decrypt.co/feed" },
|
|
160806
160817
|
{ sourceId: "cointelegraph", name: "CoinTelegraph", type: "rss", needsApiKey: false, defaultUrl: "https://cointelegraph.com/rss" },
|
|
@@ -160941,8 +160952,10 @@ class RssAdapter {
|
|
|
160941
160952
|
return [];
|
|
160942
160953
|
await validateUrlSafety(url2);
|
|
160943
160954
|
const res = await fetch(url2, { signal: AbortSignal.timeout(15000), redirect: "manual" });
|
|
160944
|
-
if (res.status >= 300 && res.status < 400)
|
|
160945
|
-
|
|
160955
|
+
if (res.status >= 300 && res.status < 400) {
|
|
160956
|
+
const location = res.headers.get("location") ?? "(no Location header)";
|
|
160957
|
+
throw new Error(`RSS ${this.sourceId}: HTTP ${res.status} redirect to ${location} \u2014 update source URL`);
|
|
160958
|
+
}
|
|
160946
160959
|
if (!res.ok)
|
|
160947
160960
|
throw new Error(`RSS ${this.sourceId}: HTTP ${res.status}`);
|
|
160948
160961
|
const xml = await res.text();
|
|
@@ -185230,7 +185243,7 @@ class NewsService {
|
|
|
185230
185243
|
for (let i = 0;i < results.length; i++) {
|
|
185231
185244
|
const result = results[i];
|
|
185232
185245
|
if (result.status === "rejected") {
|
|
185233
|
-
this.log.warn({ source: sources[i].sourceId,
|
|
185246
|
+
this.log.warn({ source: sources[i].sourceId, err: result.reason }, "source fetch failed");
|
|
185234
185247
|
continue;
|
|
185235
185248
|
}
|
|
185236
185249
|
for (const raw of result.value) {
|
|
@@ -185249,11 +185262,15 @@ class NewsService {
|
|
|
185249
185262
|
const ttl = importance === "urgent" ? URGENT_TTL : importance === "important" ? IMPORTANT_TTL : REFERENCE_TTL;
|
|
185250
185263
|
const id2 = crypto.randomUUID();
|
|
185251
185264
|
try {
|
|
185252
|
-
this.stmts.insertArticle.run(id2, source2.sourceId, raw.externalId, raw.url, raw.title, raw.description, raw.imageUrl ?? null, JSON.stringify(raw.coins), importance, raw.publishedAt, now, raw.publishedAt + ttl, raw.body ?? null);
|
|
185253
|
-
|
|
185254
|
-
|
|
185255
|
-
|
|
185256
|
-
|
|
185265
|
+
const res = this.stmts.insertArticle.run(id2, source2.sourceId, raw.externalId, raw.url, raw.title, raw.description, raw.imageUrl ?? null, JSON.stringify(raw.coins), importance, raw.publishedAt, now, raw.publishedAt + ttl, raw.body ?? null);
|
|
185266
|
+
if (res.changes > 0) {
|
|
185267
|
+
inserted++;
|
|
185268
|
+
if (raw.body)
|
|
185269
|
+
bodyOk++;
|
|
185270
|
+
}
|
|
185271
|
+
} catch (err2) {
|
|
185272
|
+
this.log.debug({ err: err2, url: raw.url }, "article insert failed");
|
|
185273
|
+
}
|
|
185257
185274
|
}
|
|
185258
185275
|
if (candidates2.length > 0) {
|
|
185259
185276
|
this.log.info({ candidates: candidates2.length, inserted, bodyOk, bodyMissing: inserted - bodyOk }, "news fetch complete");
|
|
@@ -226362,7 +226379,7 @@ var init_news4 = __esm(() => {
|
|
|
226362
226379
|
init_news_evaluation();
|
|
226363
226380
|
newsFetchJob = {
|
|
226364
226381
|
name: "news-fetch",
|
|
226365
|
-
schedule: { type: "interval", ms:
|
|
226382
|
+
schedule: { type: "interval", ms: 15 * 60 * 1000 },
|
|
226366
226383
|
kickAtStart: true,
|
|
226367
226384
|
async run({ runtime, logger }) {
|
|
226368
226385
|
try {
|
|
@@ -246087,10 +246104,10 @@ try {
|
|
|
246087
246104
|
break;
|
|
246088
246105
|
case "providers":
|
|
246089
246106
|
await runProviders(positionals.slice(1), values2);
|
|
246090
|
-
|
|
246107
|
+
process.exit(0);
|
|
246091
246108
|
case "skills":
|
|
246092
246109
|
await runSkills(positionals.slice(1), { config: stringOpt(values2.config) });
|
|
246093
|
-
|
|
246110
|
+
process.exit(0);
|
|
246094
246111
|
case "logs": {
|
|
246095
246112
|
const { runLogs: runLogs2 } = await Promise.resolve().then(() => (init_logs(), exports_logs));
|
|
246096
246113
|
await runLogs2({
|
|
@@ -246108,7 +246125,7 @@ try {
|
|
|
246108
246125
|
case "uninstall": {
|
|
246109
246126
|
const { runUninstallCli: runUninstallCli2 } = await Promise.resolve().then(() => (init_uninstall(), exports_uninstall));
|
|
246110
246127
|
await runUninstallCli2();
|
|
246111
|
-
|
|
246128
|
+
process.exit(0);
|
|
246112
246129
|
}
|
|
246113
246130
|
case "channel": {
|
|
246114
246131
|
const { runChannelCli: runChannelCli2 } = await Promise.resolve().then(() => (init_channel(), exports_channel));
|
|
@@ -246116,7 +246133,7 @@ try {
|
|
|
246116
246133
|
json: Boolean(values2.json),
|
|
246117
246134
|
token: stringOpt(values2.token)
|
|
246118
246135
|
});
|
|
246119
|
-
|
|
246136
|
+
process.exit(0);
|
|
246120
246137
|
}
|
|
246121
246138
|
case "proactive": {
|
|
246122
246139
|
const action3 = positionals[1];
|
|
@@ -246128,12 +246145,11 @@ try {
|
|
|
246128
246145
|
configPath: stringOpt(values2.config),
|
|
246129
246146
|
logger: rootLogger
|
|
246130
246147
|
});
|
|
246131
|
-
|
|
246148
|
+
process.exit(0);
|
|
246132
246149
|
}
|
|
246133
246150
|
default:
|
|
246134
246151
|
printUsage();
|
|
246135
246152
|
process.exit(command ? 1 : 0);
|
|
246136
|
-
break;
|
|
246137
246153
|
}
|
|
246138
246154
|
} catch (err2) {
|
|
246139
246155
|
if (err2 instanceof ConfigError) {
|
package/dist/package.json
CHANGED