@maintainabilityai/research-runner 0.1.1 → 0.1.3

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.
@@ -23,8 +23,10 @@ async function callAnthropic(opts) {
23
23
  throw new Error('ANTHROPIC_API_KEY missing — set the env var or pass apiKey directly');
24
24
  }
25
25
  const fetchImpl = opts.fetchImpl ?? globalThis.fetch;
26
+ // Match github-models default — 8K-token synth responses can run 60–90s.
27
+ const timeoutMs = opts.timeoutMs ?? 120_000;
26
28
  const controller = new AbortController();
27
- const timer = setTimeout(() => controller.abort(), opts.timeoutMs ?? 60_000);
29
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
28
30
  let response;
29
31
  try {
30
32
  response = await fetchImpl('https://api.anthropic.com/v1/messages', {
@@ -44,6 +46,12 @@ async function callAnthropic(opts) {
44
46
  signal: controller.signal,
45
47
  });
46
48
  }
49
+ catch (err) {
50
+ if (err instanceof Error && err.name === 'AbortError') {
51
+ throw new Error(`Anthropic request timed out after ${timeoutMs}ms (model=${opts.model}, max_tokens=${opts.maxTokens})`);
52
+ }
53
+ throw new Error(`Anthropic fetch failed (model=${opts.model}): ${err instanceof Error ? err.message : String(err)}`);
54
+ }
47
55
  finally {
48
56
  clearTimeout(timer);
49
57
  }
@@ -11,12 +11,16 @@
11
11
  * their result types.
12
12
  *
13
13
  * Model names use GitHub Models namespacing — e.g. `openai/gpt-4o`,
14
- * `openai/gpt-4o-mini`, `anthropic/claude-3-5-sonnet`. The router (in
14
+ * `openai/gpt-4o-mini`, `openai/gpt-4.1`. The router (in
15
15
  * llm-router.ts) maps internal logical model tiers (`plan` / `synth`) to
16
16
  * the concrete provider-specific id.
17
17
  */
18
- /** Subset of GitHub Models model ids we use. Extend as new tiers land. */
19
- export type GitHubModelsModel = 'openai/gpt-4o' | 'openai/gpt-4o-mini' | 'anthropic/claude-3-5-sonnet' | 'anthropic/claude-3-5-haiku';
18
+ /**
19
+ * Subset of GitHub Models model ids we use. Extend as new tiers land.
20
+ * GitHub Models does not currently host Anthropic Claude — synth tier
21
+ * uses `openai/gpt-4.1` (the "outperforms gpt-4o across the board" tier).
22
+ */
23
+ export type GitHubModelsModel = 'openai/gpt-4o' | 'openai/gpt-4o-mini' | 'openai/gpt-4.1' | 'openai/gpt-4.1-mini';
20
24
  export interface CallGitHubModelsOpts {
21
25
  /** Workflow GITHUB_TOKEN. The model server checks the `models:read` permission scope. */
22
26
  token: string;
@@ -12,7 +12,7 @@
12
12
  * their result types.
13
13
  *
14
14
  * Model names use GitHub Models namespacing — e.g. `openai/gpt-4o`,
15
- * `openai/gpt-4o-mini`, `anthropic/claude-3-5-sonnet`. The router (in
15
+ * `openai/gpt-4o-mini`, `openai/gpt-4.1`. The router (in
16
16
  * llm-router.ts) maps internal logical model tiers (`plan` / `synth`) to
17
17
  * the concrete provider-specific id.
18
18
  */
@@ -25,8 +25,11 @@ async function callGitHubModels(opts) {
25
25
  }
26
26
  const fetchImpl = opts.fetchImpl ?? globalThis.fetch;
27
27
  const endpoint = opts.endpoint ?? DEFAULT_ENDPOINT;
28
+ // Synthesis prompts can produce 8K-token responses on gpt-4.1, which
29
+ // routinely take 60–90s. Default to 120s so we don't abort mid-stream.
30
+ const timeoutMs = opts.timeoutMs ?? 120_000;
28
31
  const controller = new AbortController();
29
- const timer = setTimeout(() => controller.abort(), opts.timeoutMs ?? 60_000);
32
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
30
33
  const messages = [];
31
34
  if (opts.system) {
32
35
  messages.push({ role: 'system', content: opts.system });
@@ -50,6 +53,12 @@ async function callGitHubModels(opts) {
50
53
  signal: controller.signal,
51
54
  });
52
55
  }
56
+ catch (err) {
57
+ if (err instanceof Error && err.name === 'AbortError') {
58
+ throw new Error(`GitHub Models request timed out after ${timeoutMs}ms (model=${opts.model}, max_tokens=${opts.maxTokens})`);
59
+ }
60
+ throw new Error(`GitHub Models fetch failed (model=${opts.model}): ${err instanceof Error ? err.message : String(err)}`);
61
+ }
53
62
  finally {
54
63
  clearTimeout(timer);
55
64
  }
@@ -6,7 +6,7 @@ const github_models_client_1 = require("./github-models-client");
6
6
  /** Per-tier per-provider model id lookup. */
7
7
  const MODEL_BY_TIER = {
8
8
  plan: { anthropic: 'claude-haiku-4-5', githubModels: 'openai/gpt-4o-mini' },
9
- synth: { anthropic: 'claude-sonnet-4-6', githubModels: 'anthropic/claude-3-5-sonnet' },
9
+ synth: { anthropic: 'claude-sonnet-4-6', githubModels: 'openai/gpt-4.1' },
10
10
  };
11
11
  async function callLlm(opts) {
12
12
  const tierModels = MODEL_BY_TIER[opts.tier];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maintainabilityai/research-runner",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
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",