pullfrog 0.1.53 → 0.1.55

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.
@@ -1,5 +1,10 @@
1
1
  /** Stable label for the BYOK provider-billing-exhausted classification. */
2
2
  export declare const PROVIDER_BILLING_EXHAUSTED_LABEL = "provider billing exhausted";
3
+ /** Stable label for "OpenRouter can route this model nowhere you permit". */
4
+ export declare const PROVIDER_NO_ENDPOINTS_LABEL = "provider no routable endpoints";
5
+ export declare function findAnthropicSpendCap(text: string): {
6
+ regainAt: string | null;
7
+ } | null;
3
8
  /**
4
9
  * Result of a provider-error scan: the classification label plus a
5
10
  * human-readable excerpt centered on the matched line. The excerpt is what
@@ -22,6 +27,44 @@ export declare function isRouterKeylimitExhaustedError(text: string): boolean;
22
27
  * is the user's own provider account.
23
28
  */
24
29
  export declare function isProviderBillingExhausted(text: string): boolean;
30
+ /**
31
+ * OpenRouter accepted the request and found nowhere to send it: the account's
32
+ * data policy or guardrail settings exclude every provider serving the picked
33
+ * model. Nothing is billed and no credential is at fault — the only fix is the
34
+ * privacy settings page or a different model. See #1164.
35
+ */
36
+ export declare function isProviderNoRoutableEndpoints(text: string): boolean;
37
+ /**
38
+ * OpenRouter's per-key ceiling, not an empty wallet. Topping up credits alone
39
+ * will not clear it, so it needs a different headline and a second lever than
40
+ * the generic billing-exhausted copy. Both shapes classify as
41
+ * `PROVIDER_BILLING_EXHAUSTED_LABEL`; this narrows within that class.
42
+ *
43
+ * TWO wire forms, and the obvious one is the rarer one. #1071's `Key limit
44
+ * exceeded (total limit)` names itself; #1164's is the `requires more credits,
45
+ * or fewer max_tokens` form, which is indistinguishable from a drained wallet
46
+ * except for the remedy the provider appends — a link to that key's own page.
47
+ * Anchor on the `/keys/<id>` URL rather than the "adjust the key's total limit"
48
+ * sentence, because the apostrophe in it arrives from provider JSON and may be
49
+ * typographic. A genuinely empty wallet (`Insufficient credits. Add more using
50
+ * …/settings/credits`) carries no `/keys/` path and correctly stays out.
51
+ */
52
+ export declare function isOpenRouterKeyLimitExceeded(text: string): boolean;
53
+ /**
54
+ * The upstream is having a moment: Anthropic's `API Error: 529 Overloaded`,
55
+ * OpenRouter's `provider_unavailable` / `timeout`, OpenCode Zen's `Streaming
56
+ * response failed: [5xx]`. Three transports, one condition — nothing the user
57
+ * configured is wrong and the next run will probably work, which is exactly
58
+ * what the contentless `Run failed.` comment failed to say across 28 runs that
59
+ * had already done up to 38 tool calls of real work (#1173).
60
+ *
61
+ * `error_type` is matched as the machine-readable FIELD it is rather than by
62
+ * substring-matching the human prose around it, which varies per upstream.
63
+ * Deliberately narrow on 5xx so it cannot reach a 401/402 that
64
+ * `isApiKeyAuthError` / `isProviderBillingExhausted` own — and `renderRunError`
65
+ * orders it after both regardless.
66
+ */
67
+ export declare function isTransientUpstreamError(text: string): boolean;
25
68
  /**
26
69
  * Extract `providerID=foo` from agent error logs (OpenCode emits this on
27
70
  * `provider error detected (...)` lines). Returns the lowercase provider
@@ -15,7 +15,7 @@
15
15
  * exist yet at this point in the pipeline.
16
16
  *
17
17
  * - 402 → `BillingError` (card declined, balance empty, 3DS, etc.)
18
- * - 503 → `TransientError` (transient sync issueretry next dispatch)
18
+ * - 5xx → `TransientError` (the mint is down retried in-run first)
19
19
  * - 404 → `TransientError` (stale repo↔account link — re-homes on next webhook)
20
20
  */
21
21
  import type { ToolState } from "../toolState.ts";
@@ -76,6 +76,16 @@ export interface RunContext {
76
76
  * distinction a transient failure renders as "you have no API key".
77
77
  */
78
78
  secretsUnavailable?: boolean | undefined;
79
+ /**
80
+ * the Router was this account's funding path and its wallet is empty, so the
81
+ * server declined the mint rather than 402ing — the run falls through to
82
+ * BYOK, which is the documented affordance for a router-mode account whose
83
+ * key lives in workflow `env:`. only meaningful when the key search then
84
+ * comes up dry, where it turns "go add an API key" into copy that also names
85
+ * topping up. defaults false: an unreachable server must not assert a
86
+ * funding state. see wiki/billing.md.
87
+ */
88
+ routerUnfunded?: boolean | undefined;
79
89
  }
80
90
  /**
81
91
  * fetch run context from Pullfrog API
@@ -17,6 +17,9 @@ export interface RunContextData {
17
17
  /** stored secrets couldn't be materialized for this run — not the same as
18
18
  * the user having none. see `RunContext.secretsUnavailable`. */
19
19
  secretsUnavailable?: boolean | undefined;
20
+ /** the Router was declined because the wallet is empty. see
21
+ * `RunContext.routerUnfunded`. */
22
+ routerUnfunded?: boolean | undefined;
20
23
  }
21
24
  interface ResolveRunContextDataParams {
22
25
  octokit: OctokitWithPlugins;
@@ -35,6 +35,12 @@
35
35
  * `maximum context length is N tokens`. Actionable, so it renders on
36
36
  * both surfaces rather than collapsing to the one-line comment.
37
37
  *
38
+ * 4c. Transient upstream failure (#1173) — Anthropic `529 Overloaded`,
39
+ * OpenRouter `provider_unavailable` / `timeout`, Zen `Streaming response
40
+ * failed: [5xx]`. Last of the classified branches so every more specific
41
+ * one wins first. Renders on both surfaces: the remedy is re-triggering,
42
+ * which the user can only know if we say so.
43
+ *
38
44
  * 5. Activity-timeout hang — `errorMessage` starts with
39
45
  * `"activity timeout"` or `"agent still pending"` AND none of the
40
46
  * above matched. The harness keeps structured diagnostic state on
@@ -52,8 +58,8 @@
52
58
  * the hang case, since the raw internal string helps nobody on the PR.
53
59
  *
54
60
  * Net: the actionable classifications (billing, API-key, model-not-found,
55
- * no-provider-available, context-overflow) render identical bodies on both
56
- * surfaces; the non-actionable ones (hang,
61
+ * no-provider-available, context-overflow, transient-upstream) render identical
62
+ * bodies on both surfaces; the non-actionable ones (hang,
57
63
  * generic) keep the forensics in the Actions job summary and show a calm
58
64
  * one-liner in the PR comment, whose footer already carries Pullfrog
59
65
  * branding + rerun links.
@@ -35,11 +35,18 @@ export declare const RUN_STATUS_CHECK_NAME = "pullfrog";
35
35
  /** the review-verdict check. opt-in, terminal-only, and deliberately separate from the above. */
36
36
  export declare const APPROVAL_CHECK_NAME = "pullfrog-approval";
37
37
  /**
38
- * The terminal states we report. Exactly GitHub's check-run `conclusion` enum, which
39
- * happens to be `WorkflowRunStatus` minus `running` — so the server can map a finished
40
- * run's status straight across (`checkConclusionFromStatus` in utils/workflowRunStatus.ts).
38
+ * The terminal states we report: exactly GitHub's check-run `conclusion` enum.
39
+ *
40
+ * NOT `WorkflowRunStatus`. `stale` is a valid `workflow_run.conclusion` and is
41
+ * NOT a member of the Checks API enum, which GitHub's own 422 enumerates as
42
+ * `["success", "failure", "neutral", "cancelled", "timed_out",
43
+ * "action_required", "skipped"]`. Admitting it here let
44
+ * `checkConclusionFromStatus` type-check while producing a value the wire
45
+ * always rejects, so 100% of reaper-expired rows failed close-out — and since
46
+ * the failure left `checkRunId` set, the hourly sweep re-sent the same illegal
47
+ * conclusion forever. See [#1178](https://github.com/pullfrog/app/issues/1178).
41
48
  */
42
- export type RunStatusCheckConclusion = "success" | "failure" | "cancelled" | "timed_out" | "action_required" | "neutral" | "skipped" | "stale";
49
+ export type RunStatusCheckConclusion = "success" | "failure" | "cancelled" | "timed_out" | "action_required" | "neutral" | "skipped";
43
50
  /**
44
51
  * Parse the on-the-wire `{ id: string }` shape (the form carried in `JsonPayload`) into
45
52
  * a check-run id. Mirrors `parseProgressComment` — returns undefined when the id isn't a
@@ -101,6 +108,9 @@ export interface RunStatusCheckOctokit {
101
108
  data: {
102
109
  check_runs: {
103
110
  id: number;
111
+ app?: {
112
+ slug?: string | null;
113
+ } | null;
104
114
  }[];
105
115
  };
106
116
  }>;