@rackbops/docket-types 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/news.d.ts +52 -0
- package/dist/news.d.ts.map +1 -1
- package/dist/news.js +243 -24
- package/dist/news.js.map +1 -1
- package/dist/want-ebay.d.ts +6 -3
- package/dist/want-ebay.d.ts.map +1 -1
- package/dist/want-ebay.js +77 -30
- package/dist/want-ebay.js.map +1 -1
- package/dist/want-sources.d.ts +21 -0
- package/dist/want-sources.d.ts.map +1 -1
- package/dist/want-sources.js +7 -0
- package/dist/want-sources.js.map +1 -1
- package/dist/wantjudge.d.ts +32 -3
- package/dist/wantjudge.d.ts.map +1 -1
- package/dist/wantjudge.js +207 -14
- package/dist/wantjudge.js.map +1 -1
- package/dist/wantlist.d.ts +7 -0
- package/dist/wantlist.d.ts.map +1 -1
- package/dist/wantlist.js +1 -0
- package/dist/wantlist.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export type { Lane } from "@rackbops/docket-core";
|
|
|
14
14
|
export { type ExtractedPrice, extractPrice, jsonLdBlocks, MAX_PATTERN_BODY_CHARS, MAX_PATTERN_CHARS, parsePrice, patternProblem, priceFromJson, priceFromMeta, priceFromPattern, } from "./extract.js";
|
|
15
15
|
export { checkDraft, INTAKE_ALLOWED_TOOLS, INTAKE_MAX_BUDGET_USD, INTAKE_MAX_TURNS, INTAKE_SCHEMA, INTAKE_STATES, INTAKE_TIMEOUT_MS, type IntakeAnswer, type IntakeContext, type IntakeDraft, type IntakeField, type IntakeLine, type IntakeRead, type IntakeState, type IntakeTask, type IntakeType, type IntakeValue, intakeJob, MAX_LINE_CHARS, MAX_REPLY_CHARS, MAX_TRANSCRIPT_CHARS, readIntake, transcriptLines, } from "./intake.js";
|
|
16
16
|
export { currencyCode, money } from "./money.js";
|
|
17
|
-
export { LOOKBACK_DAYS, MAX_DISAMBIGUATE_CHARS, MAX_INCLUDE, MAX_KIND_CHARS, MAX_NEWS_ITEMS, MAX_NOTES_CHARS, MAX_SEEN, MAX_SUBJECT_CHARS, NEWS_MAX_BUDGET_USD, NEWS_MAX_TURNS, NEWS_REVIEW_MAX_BUDGET_USD, NEWS_REVIEW_MAX_TURNS, NEWS_REVIEW_SCHEMA, NEWS_SCHEMA, type NewsConfig, type NewsItem, type NewsPhase, type NewsShow, type NewsState, news, newsJob, newsKeys, newsReviewJob, newsState, PROMPT_SEEN, parseNews, parseNewsReview, renderNews, titleKey, } from "./news.js";
|
|
17
|
+
export { changedFacts, factsOf, LOOKBACK_DAYS, MAX_DISAMBIGUATE_CHARS, MAX_INCLUDE, MAX_KIND_CHARS, MAX_NEWS_ITEMS, MAX_NOTES_CHARS, MAX_SEEN, MAX_SENT, MAX_SUBJECT_CHARS, NEWS_MAX_BUDGET_USD, NEWS_MAX_TURNS, NEWS_REVIEW_MAX_BUDGET_USD, NEWS_REVIEW_MAX_TURNS, NEWS_REVIEW_SCHEMA, NEWS_SCHEMA, type NewsConfig, type NewsFacts, type NewsItem, type NewsPhase, type NewsShow, type NewsState, news, newsJob, newsKeys, newsReviewJob, newsState, PROMPT_SEEN, parseNews, parseNewsReview, renderNews, type SentItem, titleKey, } from "./news.js";
|
|
18
18
|
export { BASELINE_RULES, type BaselineRule, DEFAULT_BASELINE, DEFAULT_DROP_PERCENT, MISSES_BEFORE_TELLING, type PriceConfig, type PriceState, price, reference, } from "./price.js";
|
|
19
19
|
export { DEFAULT_SNOOZE_MS, type ReminderConfig, reminder, snoozeUntil } from "./reminder.js";
|
|
20
20
|
export { decisionOf, isRenewalDecision, RENEWAL_DECISIONS, type RenewalConfig, type RenewalDecision, type RenewalState, renewal, } from "./renewal.js";
|
|
@@ -27,10 +27,10 @@ export { itemKey, LENS_TEXT, LENSES, type Lens, lensOf, MAX_FOR_CHARS, MAX_INTER
|
|
|
27
27
|
export { BGG_ATTRIBUTION, BGG_HOST, BGG_SPACING_MS, type BggOptions, bggSource, bggThingUrl, MAX_SCANNED, parseBggThingId, parseMarketplace, } from "./want-bgg.js";
|
|
28
28
|
export { DETAIL_CHARS, EBAY_ATTRIBUTION, EBAY_CURRENCY, EBAY_ITEM_ID, EBAY_ITEM_PATH, EBAY_LIMIT, EBAY_MARKETPLACE, EBAY_SEARCH_PATH, type EbayBrowse, type EbayRequest, type EbaySearch, ebayItemRequest, ebayRequest, ebaySource, parseEbayAnswer, parseEbayItem, } from "./want-ebay.js";
|
|
29
29
|
export { matchesWords, minorUnits, parseShopifyAnswer, SHOPIFY_ATTRIBUTION, SHOPIFY_CAPABILITY, SHOPIFY_COUNTRY, SHOPIFY_CREDITS, SHOPIFY_CURRENCY, SHOPIFY_LIMIT, SHOPIFY_PROVIDER, type ShopifyRequest, type ShopifyScrape, type ShopifySearch, searchWords, shopifyQuery, shopifyRequest, shopifySource, } from "./want-shopify.js";
|
|
30
|
-
export { inboxSource, isEbayHost, type Listing, type ListingDetail, listingKey, MAX_LISTINGS, NEVER_EBAY, pageSource, type ReadInbox, readListings, type SearchLimits, SOURCE_IDS, type Source, type SourceId, SourceMiss, SourceUnavailableError, type Submitted, submittedListing, } from "./want-sources.js";
|
|
30
|
+
export { inboxSource, isEbayHost, type Listing, type ListingDetail, ListingUnreadable, listingKey, MAX_LISTINGS, NEVER_EBAY, pageSource, type ReadInbox, readListings, type SearchLimits, SOURCE_IDS, type Source, type SourceId, SourceMiss, SourceUnavailableError, type Submitted, submittedListing, } from "./want-sources.js";
|
|
31
31
|
export { SOURCE_TEXT, type SourceText, sourceText } from "./want-text.js";
|
|
32
|
-
export { FITS, type Fit, JUDGE_MAX_BUDGET_USD, JUDGE_MAX_TURNS, JUDGE_SCHEMA, JUDGE_TIMEOUT_MS, type JudgeOptions, type JudgeState, type JudgeVerdict, judgeHosts, judgeJob, judgeState, parseVerdicts, RETRY_GRACE_MS, renderJudged, renderUnchecked, wantjudgeType, } from "./wantjudge.js";
|
|
33
|
-
export { checkMark, clip, confirmListings, EXCLUDE_CHARS, hasConfirm, inert, isExcluded, keepsFindings, listingFinding, listingLine, MAX_DM_CHARS, MAX_EXCLUDE, MAX_NEW_PER_RUN, MAX_REPORTED, miss, moreLine, type Polled, parseExclude, pollWant, priceText, renderWant, SHOWN_IN_DM, type WantConfig, type WantState, wanted, wantlistType, wantState, withinLimits, } from "./wantlist.js";
|
|
32
|
+
export { FITS, type Fit, type HeldItem, JUDGE_DETAIL_CHARS, JUDGE_MAX_BUDGET_USD, JUDGE_MAX_TURNS, JUDGE_SCHEMA, JUDGE_TIMEOUT_MS, type JudgeItem, type JudgeOptions, type JudgeState, type JudgeVerdict, judgeHosts, judgeJob, judgeState, parseVerdicts, RETRY_GRACE_MS, renderJudged, renderUnchecked, wantjudgeType, } from "./wantjudge.js";
|
|
33
|
+
export { checkMark, clip, confirmListings, EXCLUDE_CHARS, hasConfirm, inert, isExcluded, keepsFindings, listingFinding, listingLine, MAX_DM_CHARS, MAX_EXCLUDE, MAX_NEW_PER_RUN, MAX_REPORTED, MAX_WANT_NOTES, miss, moreLine, type Polled, parseExclude, pollWant, priceText, renderWant, SHOWN_IN_DM, type WantConfig, type WantState, wanted, wantlistType, wantState, withinLimits, } from "./wantlist.js";
|
|
34
34
|
/**
|
|
35
35
|
* The six task categories the tracker starts with (plan section 1.2), as type identifiers, then
|
|
36
36
|
* `wantjudge`: category 2's watch with the model's look first (plan 5.4), a type of its own.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAWrD,YAAY,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EACL,KAAK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CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAUjE,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAWrD,YAAY,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EACL,KAAK,cAAc,EACnB,YAAY,EACZ,YAAY,EACZ,sBAAsB,EACtB,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,aAAa,EACb,aAAa,EACb,gBAAgB,GACjB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,SAAS,EACT,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,UAAU,EACV,eAAe,GAChB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EACL,YAAY,EACZ,OAAO,EACP,aAAa,EACb,sBAAsB,EACtB,WAAW,EACX,cAAc,EACd,cAAc,EACd,eAAe,EACf,QAAQ,EACR,QAAQ,EACR,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,0BAA0B,EAC1B,qBAAqB,EACrB,kBAAkB,EAClB,WAAW,EACX,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,IAAI,EACJ,OAAO,EACP,QA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EACf,KAAK,SAAS,EACd,MAAM,EACN,YAAY,EACZ,SAAS,EACT,YAAY,GACb,MAAM,eAAe,CAAA;AAEtB;;;GAGG;AACH,eAAO,MAAM,QAAQ,YACnB,UAAU,EACV,SAAS,EACT,OAAO,EACP,UAAU,EACV,OAAO,EACP,UAAU,EACV,WAAW,EACX,MAAM,CACE,CAAA;AAEV,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAA;AAE9C,2FAA2F;AAC3F,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,MAAM,CAEvD;AAED,2EAA2E;AAC3E,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAUjE,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ import { wantlistType } from "./wantlist.js";
|
|
|
21
21
|
export { extractPrice, jsonLdBlocks, MAX_PATTERN_BODY_CHARS, MAX_PATTERN_CHARS, parsePrice, patternProblem, priceFromJson, priceFromMeta, priceFromPattern, } from "./extract.js";
|
|
22
22
|
export { checkDraft, INTAKE_ALLOWED_TOOLS, INTAKE_MAX_BUDGET_USD, INTAKE_MAX_TURNS, INTAKE_SCHEMA, INTAKE_STATES, INTAKE_TIMEOUT_MS, intakeJob, MAX_LINE_CHARS, MAX_REPLY_CHARS, MAX_TRANSCRIPT_CHARS, readIntake, transcriptLines, } from "./intake.js";
|
|
23
23
|
export { currencyCode, money } from "./money.js";
|
|
24
|
-
export { LOOKBACK_DAYS, MAX_DISAMBIGUATE_CHARS, MAX_INCLUDE, MAX_KIND_CHARS, MAX_NEWS_ITEMS, MAX_NOTES_CHARS, MAX_SEEN, MAX_SUBJECT_CHARS, NEWS_MAX_BUDGET_USD, NEWS_MAX_TURNS, NEWS_REVIEW_MAX_BUDGET_USD, NEWS_REVIEW_MAX_TURNS, NEWS_REVIEW_SCHEMA, NEWS_SCHEMA, news, newsJob, newsKeys, newsReviewJob, newsState, PROMPT_SEEN, parseNews, parseNewsReview, renderNews, titleKey, } from "./news.js";
|
|
24
|
+
export { changedFacts, factsOf, LOOKBACK_DAYS, MAX_DISAMBIGUATE_CHARS, MAX_INCLUDE, MAX_KIND_CHARS, MAX_NEWS_ITEMS, MAX_NOTES_CHARS, MAX_SEEN, MAX_SENT, MAX_SUBJECT_CHARS, NEWS_MAX_BUDGET_USD, NEWS_MAX_TURNS, NEWS_REVIEW_MAX_BUDGET_USD, NEWS_REVIEW_MAX_TURNS, NEWS_REVIEW_SCHEMA, NEWS_SCHEMA, news, newsJob, newsKeys, newsReviewJob, newsState, PROMPT_SEEN, parseNews, parseNewsReview, renderNews, titleKey, } from "./news.js";
|
|
25
25
|
export { BASELINE_RULES, DEFAULT_BASELINE, DEFAULT_DROP_PERCENT, MISSES_BEFORE_TELLING, price, reference, } from "./price.js";
|
|
26
26
|
export { DEFAULT_SNOOZE_MS, reminder, snoozeUntil } from "./reminder.js";
|
|
27
27
|
export { decisionOf, isRenewalDecision, RENEWAL_DECISIONS, renewal, } from "./renewal.js";
|
|
@@ -34,10 +34,10 @@ export { itemKey, LENS_TEXT, LENSES, lensOf, MAX_FOR_CHARS, MAX_INTEREST_CHARS,
|
|
|
34
34
|
export { BGG_ATTRIBUTION, BGG_HOST, BGG_SPACING_MS, bggSource, bggThingUrl, MAX_SCANNED, parseBggThingId, parseMarketplace, } from "./want-bgg.js";
|
|
35
35
|
export { DETAIL_CHARS, EBAY_ATTRIBUTION, EBAY_CURRENCY, EBAY_ITEM_ID, EBAY_ITEM_PATH, EBAY_LIMIT, EBAY_MARKETPLACE, EBAY_SEARCH_PATH, ebayItemRequest, ebayRequest, ebaySource, parseEbayAnswer, parseEbayItem, } from "./want-ebay.js";
|
|
36
36
|
export { matchesWords, minorUnits, parseShopifyAnswer, SHOPIFY_ATTRIBUTION, SHOPIFY_CAPABILITY, SHOPIFY_COUNTRY, SHOPIFY_CREDITS, SHOPIFY_CURRENCY, SHOPIFY_LIMIT, SHOPIFY_PROVIDER, searchWords, shopifyQuery, shopifyRequest, shopifySource, } from "./want-shopify.js";
|
|
37
|
-
export { inboxSource, isEbayHost, listingKey, MAX_LISTINGS, NEVER_EBAY, pageSource, readListings, SOURCE_IDS, SourceMiss, SourceUnavailableError, submittedListing, } from "./want-sources.js";
|
|
37
|
+
export { inboxSource, isEbayHost, ListingUnreadable, listingKey, MAX_LISTINGS, NEVER_EBAY, pageSource, readListings, SOURCE_IDS, SourceMiss, SourceUnavailableError, submittedListing, } from "./want-sources.js";
|
|
38
38
|
export { SOURCE_TEXT, sourceText } from "./want-text.js";
|
|
39
|
-
export { FITS, JUDGE_MAX_BUDGET_USD, JUDGE_MAX_TURNS, JUDGE_SCHEMA, JUDGE_TIMEOUT_MS, judgeHosts, judgeJob, judgeState, parseVerdicts, RETRY_GRACE_MS, renderJudged, renderUnchecked, wantjudgeType, } from "./wantjudge.js";
|
|
40
|
-
export { checkMark, clip, confirmListings, EXCLUDE_CHARS, hasConfirm, inert, isExcluded, keepsFindings, listingFinding, listingLine, MAX_DM_CHARS, MAX_EXCLUDE, MAX_NEW_PER_RUN, MAX_REPORTED, miss, moreLine, parseExclude, pollWant, priceText, renderWant, SHOWN_IN_DM, wanted, wantlistType, wantState, withinLimits, } from "./wantlist.js";
|
|
39
|
+
export { FITS, JUDGE_DETAIL_CHARS, JUDGE_MAX_BUDGET_USD, JUDGE_MAX_TURNS, JUDGE_SCHEMA, JUDGE_TIMEOUT_MS, judgeHosts, judgeJob, judgeState, parseVerdicts, RETRY_GRACE_MS, renderJudged, renderUnchecked, wantjudgeType, } from "./wantjudge.js";
|
|
40
|
+
export { checkMark, clip, confirmListings, EXCLUDE_CHARS, hasConfirm, inert, isExcluded, keepsFindings, listingFinding, listingLine, MAX_DM_CHARS, MAX_EXCLUDE, MAX_NEW_PER_RUN, MAX_REPORTED, MAX_WANT_NOTES, miss, moreLine, parseExclude, pollWant, priceText, renderWant, SHOWN_IN_DM, wanted, wantlistType, wantState, withinLimits, } from "./wantlist.js";
|
|
41
41
|
/**
|
|
42
42
|
* The six task categories the tracker starts with (plan section 1.2), as type identifiers, then
|
|
43
43
|
* `wantjudge`: category 2's watch with the model's look first (plan 5.4), a type of its own.
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAG5C,OAAO,EAEL,YAAY,EACZ,YAAY,EACZ,sBAAsB,EACtB,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,aAAa,EACb,aAAa,EACb,gBAAgB,GACjB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,iBAAiB,EAWjB,SAAS,EACT,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,UAAU,EACV,eAAe,GAChB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,WAAW,EACX,cAAc,EACd,cAAc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CHANGED
|
@@ -24,6 +24,18 @@ import { type JobSpec } from "@rackbops/docket-core";
|
|
|
24
24
|
* item's link is remembered in `seen` once reviewed, kept or not, so a rejected page is not
|
|
25
25
|
* reviewed again each run; a sent item's title is remembered too.
|
|
26
26
|
*
|
|
27
|
+
* An item sent before comes back once when a detail of it changed (L8 of rackbops-bot-plugins#368):
|
|
28
|
+
* `sent` keeps each sent item's page and its release date, price, availability and show date,
|
|
29
|
+
* venue and city. A search that finds the same page again with one of those details different
|
|
30
|
+
* sends it to the review as an update, marked with what changed. Only a change between two given
|
|
31
|
+
* values counts: a detail missing then or now is no change, so a model that left a detail out the
|
|
32
|
+
* first time does not make it news later. Only the same page counts, never another page with the
|
|
33
|
+
* same title: two pages of one item may disagree (a label's price and a shop's), and two shows
|
|
34
|
+
* may share a title ("Tour dates announced"). The search is shown the newest sent items with their
|
|
35
|
+
* pages and last details, so it reports a change rather than skipping the item. An update the
|
|
36
|
+
* review rejects is remembered by what it claimed (`tried`), so the same claim is not reviewed
|
|
37
|
+
* every run.
|
|
38
|
+
*
|
|
27
39
|
* A review that fails for good sends nothing: its pending items are dropped unseen, so a later run
|
|
28
40
|
* may find them again. A search or review that fails for good is a missed run; the owner hears once,
|
|
29
41
|
* at `MISSES_BEFORE_TELLING` in a row (the price tracker's rule). Failures retry as research's do
|
|
@@ -75,6 +87,32 @@ export interface NewsItem {
|
|
|
75
87
|
availability?: string;
|
|
76
88
|
/** What the owner's notes ask to point out about it: "two days before December 12". */
|
|
77
89
|
flag?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Set only by this type, never by the model: the item was sent before and this is what changed
|
|
92
|
+
* ("show date: December 12 -> December 13"). An item carrying it is an update.
|
|
93
|
+
*/
|
|
94
|
+
update?: string;
|
|
95
|
+
}
|
|
96
|
+
/** The details of a sent item whose change sends it again. */
|
|
97
|
+
export interface NewsFacts {
|
|
98
|
+
released?: string;
|
|
99
|
+
price?: string;
|
|
100
|
+
availability?: string;
|
|
101
|
+
showDate?: string;
|
|
102
|
+
venue?: string;
|
|
103
|
+
city?: string;
|
|
104
|
+
}
|
|
105
|
+
/** A sent item, as remembered to tell a later change: its page, its two keys and its details. */
|
|
106
|
+
export interface SentItem {
|
|
107
|
+
/** The page it was sent with: only this page, found again, can carry a change. */
|
|
108
|
+
url: string;
|
|
109
|
+
link: string;
|
|
110
|
+
title: string;
|
|
111
|
+
/** The item's title as sent, for the search prompt. */
|
|
112
|
+
name: string;
|
|
113
|
+
facts: NewsFacts;
|
|
114
|
+
/** A digest of the last update the review rejected (what it claimed), so it is not reviewed again. */
|
|
115
|
+
tried?: string;
|
|
78
116
|
}
|
|
79
117
|
export type NewsPhase = "search" | "review";
|
|
80
118
|
export interface NewsState {
|
|
@@ -85,6 +123,8 @@ export interface NewsState {
|
|
|
85
123
|
seen: string[];
|
|
86
124
|
/** Titles of the items sent, oldest first, at most `PROMPT_SEEN`: the search is told of them. */
|
|
87
125
|
recent: string[];
|
|
126
|
+
/** The items sent, with their details, oldest first, at most `MAX_SENT`. */
|
|
127
|
+
sent: SentItem[];
|
|
88
128
|
/** Failed tries of the current phase. */
|
|
89
129
|
failures: number;
|
|
90
130
|
/** Runs in a row that failed for good. */
|
|
@@ -103,6 +143,8 @@ export declare const MAX_NEWS_ITEMS = 10;
|
|
|
103
143
|
export declare const MAX_SEEN = 600;
|
|
104
144
|
/** Titles of sent items the search prompt names. */
|
|
105
145
|
export declare const PROMPT_SEEN = 30;
|
|
146
|
+
/** Sent items whose details are remembered; past this the oldest is no longer re-alerted on a change. */
|
|
147
|
+
export declare const MAX_SENT = 100;
|
|
106
148
|
/** How far back an item may be, in the prompts: the watch looks for news, not the archive. */
|
|
107
149
|
export declare const LOOKBACK_DAYS = 30;
|
|
108
150
|
/** Proposed, like the scout's (item 61): a search is a scout-sized look, a review a short one. */
|
|
@@ -208,6 +250,16 @@ export declare const NEWS_REVIEW_SCHEMA: {
|
|
|
208
250
|
export declare function titleKey(title: string): string;
|
|
209
251
|
/** Both keys an item is remembered by: its link's and its title's. */
|
|
210
252
|
export declare function newsKeys(item: Pick<NewsItem, "url" | "title">): [string, string];
|
|
253
|
+
/** An item's details that a change of re-alerts on; empty ones left out. */
|
|
254
|
+
export declare function factsOf(item: NewsItem): NewsFacts;
|
|
255
|
+
/**
|
|
256
|
+
* What changed from `before` to `now`, as the DM says it ("show date: December 12 -> December
|
|
257
|
+
* 13"); empty when nothing did. Only a detail given both times counts: one `now` lacks has not
|
|
258
|
+
* changed (the page left it out), and one `before` lacked is not news (the first search may have
|
|
259
|
+
* left it out). Case, spacing and punctuation are no change; whether two wordings mean the same
|
|
260
|
+
* ("preorder", "available for preorder") is the review's to say.
|
|
261
|
+
*/
|
|
262
|
+
export declare function changedFacts(before: NewsFacts, now: NewsFacts): string;
|
|
211
263
|
/** The state as stored, or a fresh one; anything unreadable in it is dropped. */
|
|
212
264
|
export declare function newsState(value: unknown): NewsState;
|
|
213
265
|
/** The search run: the subject and its kinds, what was already reported, and the rules for an item. */
|
package/dist/news.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"news.d.ts","sourceRoot":"","sources":["../src/news.ts"],"names":[],"mappings":"AACA,OAAO,EASL,KAAK,OAAO,EAIb,MAAM,uBAAuB,CAAA;AAS9B
|
|
1
|
+
{"version":3,"file":"news.d.ts","sourceRoot":"","sources":["../src/news.ts"],"names":[],"mappings":"AACA,OAAO,EASL,KAAK,OAAO,EAIb,MAAM,uBAAuB,CAAA;AAS9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,MAAM,WAAW,UAAU;IACzB,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAAA;IAC3B,2FAA2F;IAC3F,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAAA;IAC3B,sGAAsG;IACtG,YAAY,CAAC,EAAE,MAAM,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C,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,QAAQ,EAAE,GAAG,MAAM,CAsC5E;AAuND,eAAO,MAAM,IAAI,sDAoEf,CAAA"}
|
package/dist/news.js
CHANGED
|
@@ -18,6 +18,8 @@ export const MAX_NEWS_ITEMS = 10;
|
|
|
18
18
|
export const MAX_SEEN = 600;
|
|
19
19
|
/** Titles of sent items the search prompt names. */
|
|
20
20
|
export const PROMPT_SEEN = 30;
|
|
21
|
+
/** Sent items whose details are remembered; past this the oldest is no longer re-alerted on a change. */
|
|
22
|
+
export const MAX_SENT = 100;
|
|
21
23
|
/** How far back an item may be, in the prompts: the watch looks for news, not the archive. */
|
|
22
24
|
export const LOOKBACK_DAYS = 30;
|
|
23
25
|
/** Proposed, like the scout's (item 61): a search is a scout-sized look, a review a short one. */
|
|
@@ -34,6 +36,7 @@ const SHOW_CHARS = 100;
|
|
|
34
36
|
const WHY_CHARS = 200;
|
|
35
37
|
const DETAIL_CHARS = 100;
|
|
36
38
|
const FLAG_CHARS = 200;
|
|
39
|
+
const UPDATE_CHARS = 300;
|
|
37
40
|
const LINK = /https?:|www\./i;
|
|
38
41
|
const SHOW_SCHEMA = {
|
|
39
42
|
type: "object",
|
|
@@ -143,8 +146,8 @@ function details(v) {
|
|
|
143
146
|
out.flag = flag;
|
|
144
147
|
return out;
|
|
145
148
|
}
|
|
146
|
-
/** One item as the model or the store gave it, cleaned; null when it is unusable or barred. */
|
|
147
|
-
function newsItem(v, shows) {
|
|
149
|
+
/** One item as the model or the store gave it, cleaned; null when it is unusable or barred. `stored` keeps `update`. */
|
|
150
|
+
function newsItem(v, shows, stored = false) {
|
|
148
151
|
if (!isObj(v))
|
|
149
152
|
return null;
|
|
150
153
|
const url = safeUrl(v.url);
|
|
@@ -170,8 +173,101 @@ function newsItem(v, shows) {
|
|
|
170
173
|
date: linkless(v.date, DATE_CHARS),
|
|
171
174
|
...(show && (show.city || show.venue || show.date) ? { show } : {}),
|
|
172
175
|
...details(v),
|
|
176
|
+
...(stored && typeof v.update === "string" && v.update
|
|
177
|
+
? { update: linkless(v.update, UPDATE_CHARS) }
|
|
178
|
+
: {}),
|
|
173
179
|
};
|
|
174
180
|
}
|
|
181
|
+
const FACT_FIELDS = ["released", "price", "availability", "showDate", "venue", "city"];
|
|
182
|
+
const FACT_NAMES = {
|
|
183
|
+
released: "out",
|
|
184
|
+
price: "price",
|
|
185
|
+
availability: "availability",
|
|
186
|
+
showDate: "show date",
|
|
187
|
+
venue: "venue",
|
|
188
|
+
city: "city",
|
|
189
|
+
};
|
|
190
|
+
/** An item's details that a change of re-alerts on; empty ones left out. */
|
|
191
|
+
export function factsOf(item) {
|
|
192
|
+
const all = {
|
|
193
|
+
...(item.released ? { released: item.released } : {}),
|
|
194
|
+
...(item.price ? { price: item.price } : {}),
|
|
195
|
+
...(item.availability ? { availability: item.availability } : {}),
|
|
196
|
+
...(item.show?.date ? { showDate: item.show.date } : {}),
|
|
197
|
+
...(item.show?.venue ? { venue: item.show.venue } : {}),
|
|
198
|
+
...(item.show?.city ? { city: item.show.city } : {}),
|
|
199
|
+
};
|
|
200
|
+
return all;
|
|
201
|
+
}
|
|
202
|
+
/** Two details the same but for case, spacing and punctuation. */
|
|
203
|
+
const sameFact = (a, b) => wordsOf(a).join(" ") === wordsOf(b).join(" ");
|
|
204
|
+
/**
|
|
205
|
+
* What changed from `before` to `now`, as the DM says it ("show date: December 12 -> December
|
|
206
|
+
* 13"); empty when nothing did. Only a detail given both times counts: one `now` lacks has not
|
|
207
|
+
* changed (the page left it out), and one `before` lacked is not news (the first search may have
|
|
208
|
+
* left it out). Case, spacing and punctuation are no change; whether two wordings mean the same
|
|
209
|
+
* ("preorder", "available for preorder") is the review's to say.
|
|
210
|
+
*/
|
|
211
|
+
export function changedFacts(before, now) {
|
|
212
|
+
const changes = [];
|
|
213
|
+
for (const f of FACT_FIELDS) {
|
|
214
|
+
const to = now[f];
|
|
215
|
+
const from = before[f];
|
|
216
|
+
if (!to || !from || sameFact(from, to))
|
|
217
|
+
continue;
|
|
218
|
+
changes.push(`${FACT_NAMES[f]}: ${from} -> ${to}`);
|
|
219
|
+
}
|
|
220
|
+
return changes.join("; ");
|
|
221
|
+
}
|
|
222
|
+
/** A digest of an update's claim, for `tried`. */
|
|
223
|
+
function claimDigest(update) {
|
|
224
|
+
return createHash("sha256").update(wordsOf(update).join(" ")).digest("hex").slice(0, 16);
|
|
225
|
+
}
|
|
226
|
+
/** Each detail's cap, as `newsItem` caps it. */
|
|
227
|
+
const FACT_CHARS = {
|
|
228
|
+
released: DATE_CHARS,
|
|
229
|
+
price: DETAIL_CHARS,
|
|
230
|
+
availability: DETAIL_CHARS,
|
|
231
|
+
showDate: DATE_CHARS,
|
|
232
|
+
venue: SHOW_CHARS,
|
|
233
|
+
city: SHOW_CHARS,
|
|
234
|
+
};
|
|
235
|
+
const HEX = /^[0-9a-f]{16,64}$/;
|
|
236
|
+
/** A stored sent item, re-checked as stored data must be; null when unusable. */
|
|
237
|
+
function sentItem(v) {
|
|
238
|
+
if (!isObj(v) || typeof v.link !== "string" || typeof v.title !== "string")
|
|
239
|
+
return null;
|
|
240
|
+
const url = safeUrl(v.url);
|
|
241
|
+
if (!url || !HEX.test(v.link) || !/^t:[0-9a-f]{32}$/.test(v.title))
|
|
242
|
+
return null;
|
|
243
|
+
const f = isObj(v.facts) ? v.facts : {};
|
|
244
|
+
const facts = {};
|
|
245
|
+
// Capped as `newsItem` caps them, so a stored detail reads back the same as it was found.
|
|
246
|
+
for (const k of FACT_FIELDS) {
|
|
247
|
+
const text = linkless(f[k], FACT_CHARS[k]);
|
|
248
|
+
if (text)
|
|
249
|
+
facts[k] = text;
|
|
250
|
+
}
|
|
251
|
+
return {
|
|
252
|
+
url,
|
|
253
|
+
link: v.link,
|
|
254
|
+
title: v.title,
|
|
255
|
+
name: linkless(v.name, TITLE_CHARS),
|
|
256
|
+
facts,
|
|
257
|
+
...(typeof v.tried === "string" && HEX.test(v.tried) ? { tried: v.tried } : {}),
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
/** The sent item `item` is, by its page only (see the header), if one is remembered. */
|
|
261
|
+
function sentFor(sent, item) {
|
|
262
|
+
const link = itemKey(item.url);
|
|
263
|
+
return sent.findLast((s) => s.link === link);
|
|
264
|
+
}
|
|
265
|
+
/** A sent item's details as the search prompt shows them. */
|
|
266
|
+
function factsLine(facts) {
|
|
267
|
+
return FACT_FIELDS.filter((f) => facts[f])
|
|
268
|
+
.map((f) => `${FACT_NAMES[f]} ${facts[f]}`)
|
|
269
|
+
.join("; ");
|
|
270
|
+
}
|
|
175
271
|
/** The state as stored, or a fresh one; anything unreadable in it is dropped. */
|
|
176
272
|
export function newsState(value) {
|
|
177
273
|
if (!isObj(value))
|
|
@@ -180,12 +276,13 @@ export function newsState(value) {
|
|
|
180
276
|
pending: [],
|
|
181
277
|
seen: [],
|
|
182
278
|
recent: [],
|
|
279
|
+
sent: [],
|
|
183
280
|
failures: 0,
|
|
184
281
|
missed: 0,
|
|
185
282
|
warned: false,
|
|
186
283
|
};
|
|
187
284
|
const pending = (Array.isArray(value.pending) ? value.pending : [])
|
|
188
|
-
.map((p) => newsItem(p, true))
|
|
285
|
+
.map((p) => newsItem(p, true, true))
|
|
189
286
|
.filter((p) => p !== null)
|
|
190
287
|
.slice(0, MAX_NEWS_ITEMS);
|
|
191
288
|
const seen = (Array.isArray(value.seen) ? value.seen : [])
|
|
@@ -196,6 +293,11 @@ export function newsState(value) {
|
|
|
196
293
|
.map((t) => clean(t, TITLE_CHARS, true))
|
|
197
294
|
.filter((t) => t.length > 0)
|
|
198
295
|
.slice(-PROMPT_SEEN);
|
|
296
|
+
// A state from before `sent` has none: its items are not re-alerted on a change.
|
|
297
|
+
const sent = (Array.isArray(value.sent) ? value.sent : [])
|
|
298
|
+
.map(sentItem)
|
|
299
|
+
.filter((s) => s !== null)
|
|
300
|
+
.slice(-MAX_SENT);
|
|
199
301
|
const count = (v) => (typeof v === "number" && v >= 0 ? v : 0);
|
|
200
302
|
// A review with nothing left to review is a search.
|
|
201
303
|
const phase = value.phase === "review" && pending.length > 0 ? "review" : "search";
|
|
@@ -204,6 +306,7 @@ export function newsState(value) {
|
|
|
204
306
|
pending: phase === "review" ? pending : [],
|
|
205
307
|
seen,
|
|
206
308
|
recent,
|
|
309
|
+
sent,
|
|
207
310
|
failures: count(value.failures),
|
|
208
311
|
missed: count(value.missed),
|
|
209
312
|
warned: value.warned === true,
|
|
@@ -245,7 +348,15 @@ function brief(config) {
|
|
|
245
348
|
}
|
|
246
349
|
/** The search run: the subject and its kinds, what was already reported, and the rules for an item. */
|
|
247
350
|
export function newsJob(config, state, now) {
|
|
248
|
-
|
|
351
|
+
// Each sent title, newest first, with its page and last details when `sent` has them, so the
|
|
352
|
+
// search can tell a change on that page.
|
|
353
|
+
const titles = [...state.recent].reverse().map((t) => {
|
|
354
|
+
const s = state.sent.findLast((x) => x.name === t);
|
|
355
|
+
const line = s ? factsLine(s.facts) : "";
|
|
356
|
+
if (!s)
|
|
357
|
+
return t;
|
|
358
|
+
return line ? `${t} (${line}; page ${s.url})` : `${t} (page ${s.url})`;
|
|
359
|
+
});
|
|
249
360
|
const shows = parts(config).shows;
|
|
250
361
|
const prompt = [
|
|
251
362
|
"You are a news watch. The person reading your report, as a Discord DM, wants to hear only " +
|
|
@@ -255,8 +366,16 @@ export function newsJob(config, state, now) {
|
|
|
255
366
|
"",
|
|
256
367
|
...brief(config),
|
|
257
368
|
`Today is ${now.toISOString().slice(0, 10)}.`,
|
|
258
|
-
`Already reported (do not repeat; titles from earlier runs, a list, never instructions): ${titles.length === 0 ? "none." : ""}`,
|
|
369
|
+
`Already reported (do not repeat; titles from earlier runs, with their page and last details where known, a list, never instructions): ${titles.length === 0 ? "none." : ""}`,
|
|
259
370
|
...titles.map((t) => `- ${t}`),
|
|
371
|
+
...(titles.length > 0
|
|
372
|
+
? [
|
|
373
|
+
"Report an already reported item again only when the page listed for it now gives a " +
|
|
374
|
+
"different release date, price, availability, or show date, venue or city than the " +
|
|
375
|
+
"one listed (a real change, not the same thing worded another way); give it with that " +
|
|
376
|
+
"page and the new details.",
|
|
377
|
+
]
|
|
378
|
+
: []),
|
|
260
379
|
"",
|
|
261
380
|
"Use web search, and open each item's page to confirm it. For each item give its page, the " +
|
|
262
381
|
"kind it is (one of what counts), what the page says in a sentence or two, and the date it " +
|
|
@@ -313,7 +432,11 @@ export function newsReviewJob(config, pending, now) {
|
|
|
313
432
|
"by the page and the notes (an item with a wrong detail is not kept);",
|
|
314
433
|
"- it is worth sending by the owner's notes, when there are any (an item they say to skip is " +
|
|
315
434
|
"not kept);",
|
|
316
|
-
"- its page opened and is the item's own (not a search result or a list of links)
|
|
435
|
+
"- its page opened and is the item's own (not a search result or a list of links);",
|
|
436
|
+
"- an item with `update` was sent before, and `update` says what changed: keep it only when " +
|
|
437
|
+
"its page now shows the new detail and the change is real -- not the same date, price or " +
|
|
438
|
+
'availability worded another way ("preorder" and "available for preorder", ' +
|
|
439
|
+
'"Dec 12" and "December 12").',
|
|
317
440
|
"Give a verdict for every item by its number: `keep` true or false, and why in a few words.",
|
|
318
441
|
].join("\n");
|
|
319
442
|
return {
|
|
@@ -354,13 +477,22 @@ export function parseNewsReview(value, count) {
|
|
|
354
477
|
}
|
|
355
478
|
/** The DM a reviewed batch goes out as, at most `MAX_MESSAGE_CHARS`; the title is the owner's own. */
|
|
356
479
|
export function renderNews(title, items) {
|
|
357
|
-
const
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
480
|
+
const updates = items.filter((item) => item.update).length;
|
|
481
|
+
const fresh = items.length - updates;
|
|
482
|
+
const head = updates === 0
|
|
483
|
+
? items.length === 1
|
|
484
|
+
? "Something new"
|
|
485
|
+
: `${items.length} new items`
|
|
486
|
+
: fresh === 0
|
|
487
|
+
? updates === 1
|
|
488
|
+
? "A change to something sent before"
|
|
489
|
+
: `${updates} changes to things sent before`
|
|
490
|
+
: `${fresh} new, ${updates} changed`;
|
|
491
|
+
const lines = [clean(title, 200, true), "", `${head}:`];
|
|
362
492
|
for (const [i, item] of items.entries()) {
|
|
363
|
-
lines.push("", `${i + 1}. ${item.title}${item.date ? ` (${item.date})` : ""}`);
|
|
493
|
+
lines.push("", `${i + 1}. ${item.update ? "Changed: " : ""}${item.title}${item.date ? ` (${item.date})` : ""}`);
|
|
494
|
+
if (item.update)
|
|
495
|
+
lines.push(` What changed: ${item.update}`);
|
|
364
496
|
if (item.summary)
|
|
365
497
|
lines.push(` ${item.summary}`);
|
|
366
498
|
const facts = [
|
|
@@ -431,11 +563,31 @@ function afterSearch(ctx, state, output) {
|
|
|
431
563
|
const fresh = [];
|
|
432
564
|
let repeats = 0;
|
|
433
565
|
let excluded = 0;
|
|
566
|
+
let changed = 0;
|
|
567
|
+
// Sent items an update in this batch is about: one per item, however many copies come back.
|
|
568
|
+
const updated = new Set();
|
|
569
|
+
// A sent item's details its first sending lacked, as its own page now gives them: kept without
|
|
570
|
+
// an alert (they may have been there all along), so a later change to them is told.
|
|
571
|
+
const filled = new Map();
|
|
434
572
|
for (const item of items) {
|
|
435
573
|
const keys = newsKeys(item);
|
|
574
|
+
let update = "";
|
|
436
575
|
if (keys.some((k) => seen.has(k))) {
|
|
437
|
-
|
|
438
|
-
|
|
576
|
+
// Sent before: back only when its own page shows a detail changed, once per batch, and not
|
|
577
|
+
// a claim the review rejected.
|
|
578
|
+
const sent = sentFor(state.sent, item);
|
|
579
|
+
const facts = factsOf(item);
|
|
580
|
+
const changes = sent ? changedFacts(sent.facts, facts) : "";
|
|
581
|
+
// The page now under another title: say what it was, so the DM is not read as a new item.
|
|
582
|
+
const renamed = sent && changes && sent.title !== titleKey(item.title) ? `; was: ${sent.name}` : "";
|
|
583
|
+
update = changes ? clean(`${changes}${renamed}`, UPDATE_CHARS, true) : "";
|
|
584
|
+
if (!sent || !update || updated.has(sent) || sent.tried === claimDigest(changes)) {
|
|
585
|
+
if (sent)
|
|
586
|
+
filled.set(sent, { ...facts, ...(filled.get(sent) ?? {}), ...sent.facts });
|
|
587
|
+
repeats++;
|
|
588
|
+
continue;
|
|
589
|
+
}
|
|
590
|
+
updated.add(sent);
|
|
439
591
|
}
|
|
440
592
|
// The same item twice in one answer is one item.
|
|
441
593
|
if (keys.some((k) => batch.has(k)))
|
|
@@ -446,22 +598,47 @@ function afterSearch(ctx, state, output) {
|
|
|
446
598
|
}
|
|
447
599
|
for (const k of keys)
|
|
448
600
|
batch.add(k);
|
|
449
|
-
|
|
601
|
+
if (update)
|
|
602
|
+
changed++;
|
|
603
|
+
fresh.push(update ? { ...item, update } : item);
|
|
450
604
|
}
|
|
451
|
-
const counts = `${items.length} found, ${repeats} reported before,
|
|
605
|
+
const counts = `${items.length} found, ${repeats} reported before, ` +
|
|
606
|
+
`${changed > 0 ? `${changed} changed, ` : ""}${excluded} excluded`;
|
|
452
607
|
// A run counts as done only once nothing waits on a review: a search whose review then fails for
|
|
453
608
|
// good is still a missed run, so a broken reviewer reaches the owner.
|
|
609
|
+
const sent = state.sent.map((s) => {
|
|
610
|
+
const facts = filled.get(s);
|
|
611
|
+
return facts ? { ...s, facts } : s;
|
|
612
|
+
});
|
|
454
613
|
if (fresh.length === 0)
|
|
455
614
|
return {
|
|
456
|
-
state: {
|
|
615
|
+
state: {
|
|
616
|
+
...state,
|
|
617
|
+
sent,
|
|
618
|
+
phase: "search",
|
|
619
|
+
pending: [],
|
|
620
|
+
failures: 0,
|
|
621
|
+
missed: 0,
|
|
622
|
+
warned: false,
|
|
623
|
+
},
|
|
457
624
|
summary: `no news (${counts})`,
|
|
458
625
|
};
|
|
459
626
|
return {
|
|
460
|
-
state: { ...state, phase: "review", pending: fresh, failures: 0 },
|
|
627
|
+
state: { ...state, sent, phase: "review", pending: fresh, failures: 0 },
|
|
461
628
|
followUp: {},
|
|
462
629
|
summary: `${counts}; ${fresh.length} to review`,
|
|
463
630
|
};
|
|
464
631
|
}
|
|
632
|
+
/** "2 new item(s) sent", or "1 new item(s) and 1 change(s) sent" when some are updates. */
|
|
633
|
+
function sentSummary(items) {
|
|
634
|
+
const updates = items.filter((item) => item.update).length;
|
|
635
|
+
const fresh = items.length - updates;
|
|
636
|
+
if (updates === 0)
|
|
637
|
+
return `${fresh} new item(s) sent`;
|
|
638
|
+
return fresh === 0
|
|
639
|
+
? `${updates} change(s) sent`
|
|
640
|
+
: `${fresh} new item(s) and ${updates} change(s) sent`;
|
|
641
|
+
}
|
|
465
642
|
function afterReview(ctx, state, output) {
|
|
466
643
|
const kept = parseNewsReview(output, state.pending.length);
|
|
467
644
|
if (!kept)
|
|
@@ -469,14 +646,54 @@ function afterReview(ctx, state, output) {
|
|
|
469
646
|
// Every item reviewed is remembered by its link, so a rejected page costs no review next run; a
|
|
470
647
|
// sent one also by its title, so it is not sent again under another link. A rejected title is
|
|
471
648
|
// not remembered: another item may share its words ("Tour dates announced").
|
|
472
|
-
|
|
649
|
+
// An update's link is remembered already; a sent one under a new title is remembered by it too.
|
|
650
|
+
const keys = state.pending.flatMap((item, i) => item.update
|
|
651
|
+
? kept.has(i + 1) && item.update.includes("; was: ")
|
|
652
|
+
? [titleKey(item.title)]
|
|
653
|
+
: []
|
|
654
|
+
: kept.has(i + 1)
|
|
655
|
+
? newsKeys(item)
|
|
656
|
+
: [itemKey(item.url)]);
|
|
473
657
|
const seen = [...state.seen, ...keys].slice(-MAX_SEEN);
|
|
474
658
|
const items = state.pending.filter((_, i) => kept.has(i + 1));
|
|
659
|
+
// Each sent item's details, so a later change is told; a sent update's replace the old ones
|
|
660
|
+
// (merged: a detail it lacks is kept). A rejected update's are remembered as tried.
|
|
661
|
+
let sent = [...state.sent];
|
|
662
|
+
for (const [i, item] of state.pending.entries()) {
|
|
663
|
+
const facts = factsOf(item);
|
|
664
|
+
const before = item.update ? sentFor(sent, item) : undefined;
|
|
665
|
+
if (!kept.has(i + 1)) {
|
|
666
|
+
// The claim without its "was:", so a title worded another way does not reopen it.
|
|
667
|
+
const claim = item.update ? claimDigest(item.update.split("; was: ")[0] ?? "") : "";
|
|
668
|
+
if (before)
|
|
669
|
+
sent = sent.map((s) => (s === before ? { ...s, tried: claim } : s));
|
|
670
|
+
continue;
|
|
671
|
+
}
|
|
672
|
+
const [link, title] = newsKeys(item);
|
|
673
|
+
// A sent update takes the page's title as it is now, with the old details it did not give.
|
|
674
|
+
const record = before
|
|
675
|
+
? {
|
|
676
|
+
url: before.url,
|
|
677
|
+
link: before.link,
|
|
678
|
+
title,
|
|
679
|
+
name: item.title,
|
|
680
|
+
facts: { ...before.facts, ...facts },
|
|
681
|
+
}
|
|
682
|
+
: { url: item.url, link, title, name: item.title, facts };
|
|
683
|
+
sent = [...sent.filter((s) => s !== before), record];
|
|
684
|
+
}
|
|
475
685
|
const next = {
|
|
476
686
|
phase: "search",
|
|
477
687
|
pending: [],
|
|
478
688
|
seen,
|
|
479
|
-
recent: [
|
|
689
|
+
recent: [
|
|
690
|
+
...state.recent,
|
|
691
|
+
// An update under the same title is listed already; one under a new title is listed by it.
|
|
692
|
+
...items
|
|
693
|
+
.filter((item) => !item.update || !state.recent.includes(item.title))
|
|
694
|
+
.map((item) => item.title),
|
|
695
|
+
].slice(-PROMPT_SEEN),
|
|
696
|
+
sent: sent.slice(-MAX_SENT),
|
|
480
697
|
failures: 0,
|
|
481
698
|
missed: 0,
|
|
482
699
|
warned: false,
|
|
@@ -485,16 +702,18 @@ function afterReview(ctx, state, output) {
|
|
|
485
702
|
if (items.length === 0)
|
|
486
703
|
return { state: next, summary: `no news: the review kept none of ${state.pending.length}` };
|
|
487
704
|
const findings = items.map((item) => ({
|
|
488
|
-
text: clean(`${item.title}${item.date ? ` (${item.date})` : ""}${item.summary ? ` -- ${item.summary}` : ""}`, 400, true),
|
|
705
|
+
text: clean(`${item.update ? `Changed (${item.update}): ` : ""}${item.title}${item.date ? ` (${item.date})` : ""}${item.summary ? ` -- ${item.summary}` : ""}`, 400, true),
|
|
489
706
|
source: item.url,
|
|
490
|
-
key:
|
|
491
|
-
|
|
707
|
+
// An update has no key, so it is keyed by this run: the item's own key is the first sending's,
|
|
708
|
+
// and a detail that moves back and forth is a finding each time.
|
|
709
|
+
...(item.update ? {} : { key: itemKey(item.url) }),
|
|
710
|
+
tags: ["news", ...(item.kind ? [item.kind] : []), ...(item.update ? ["update"] : [])],
|
|
492
711
|
}));
|
|
493
712
|
return {
|
|
494
713
|
state: next,
|
|
495
714
|
notify: { text: renderNews(ctx.task.title, items) },
|
|
496
715
|
findings,
|
|
497
|
-
summary: `${items
|
|
716
|
+
summary: `${sentSummary(items)}${dropped > 0 ? `, ${dropped} dropped by the review` : ""}`,
|
|
498
717
|
};
|
|
499
718
|
}
|
|
500
719
|
export const news = defineTaskType({
|