@maintainabilityai/research-runner 0.1.14 → 0.1.15

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.
@@ -40,7 +40,10 @@ async function runHackerNewsSearch(opts) {
40
40
  fromQuery: query,
41
41
  title: r.title,
42
42
  url,
43
- content: '', // HN search returns no abstract
43
+ // Show HN / Ask HN posts carry a self-post body. URL-only
44
+ // submissions have no body — leave empty; the synth agent
45
+ // can read the linked URL if it needs more context.
46
+ content: r.storyText,
44
47
  score: pointsToScore(r.points),
45
48
  publishedDate: r.createdAt || undefined,
46
49
  authors: r.author ? [r.author] : undefined,
@@ -15,6 +15,8 @@ export interface HackerNewsResult {
15
15
  points: number;
16
16
  numComments: number;
17
17
  createdAt: string;
18
+ /** Self-post body for Show HN / Ask HN; empty for URL submissions. */
19
+ storyText: string;
18
20
  }
19
21
  export interface HackerNewsSearchOpts {
20
22
  query: string;
@@ -39,6 +39,29 @@ async function hackerNewsSearch(opts) {
39
39
  points: h.points ?? 0,
40
40
  numComments: h.num_comments ?? 0,
41
41
  createdAt: h.created_at ?? '',
42
+ // Algolia returns the self-post body for Show HN / Ask HN. URL-only
43
+ // submissions have this empty. Strip basic HTML tags so the excerpt
44
+ // is readable in the issue comment.
45
+ storyText: stripBasicHtml(h.story_text ?? '').slice(0, 2000),
42
46
  })).filter(r => r.objectId && r.title);
43
47
  return { query: opts.query, results, responseBytes: Buffer.byteLength(rawText, 'utf8'), httpStatus };
44
48
  }
49
+ /**
50
+ * HN Algolia returns Show HN / Ask HN bodies with light HTML
51
+ * (`<p>`, `<i>`, etc.). Strip tags + decode the common entities so
52
+ * the excerpt blockquote in the issue body reads cleanly. No need for
53
+ * a full HTML parser — these posts are plain text with a sprinkle of
54
+ * inline tags.
55
+ */
56
+ function stripBasicHtml(s) {
57
+ return s
58
+ .replace(/<\/?(?:p|br|i|b|em|strong|code|pre|a|ul|ol|li)[^>]*>/gi, ' ')
59
+ .replace(/&nbsp;/g, ' ')
60
+ .replace(/&amp;/g, '&')
61
+ .replace(/&lt;/g, '<')
62
+ .replace(/&gt;/g, '>')
63
+ .replace(/&quot;/g, '"')
64
+ .replace(/&#x27;/g, "'")
65
+ .replace(/\s+/g, ' ')
66
+ .trim();
67
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maintainabilityai/research-runner",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "Research + PRD agent runner — orchestrates the Archeologist and PRD pipelines for the MaintainabilityAI governance mesh",
5
5
  "license": "MIT",
6
6
  "author": "MaintainabilityAI",