pullfrog 0.1.6 → 0.1.8
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/agents/postRun.d.ts +21 -0
- package/dist/agents/subagentModels.d.ts +19 -0
- package/dist/cli.mjs +753 -395
- package/dist/index.js +748 -392
- package/dist/internal.js +150 -60
- package/dist/mcp/shell.d.ts +5 -0
- package/dist/models.d.ts +63 -3
- package/dist/toolState.d.ts +2 -0
- package/dist/utils/agent.d.ts +5 -2
- package/dist/utils/agentHangReport.d.ts +38 -0
- package/dist/utils/apiKeys.d.ts +18 -0
- package/dist/utils/gitAuth.d.ts +27 -0
- package/dist/utils/instructions.d.ts +19 -0
- package/dist/utils/learnings.d.ts +20 -9
- package/dist/utils/providerErrors.d.ts +11 -0
- package/dist/utils/runContext.d.ts +16 -0
- package/package.json +1 -1
package/dist/utils/apiKeys.d.ts
CHANGED
|
@@ -8,3 +8,21 @@ export declare function validateAgentApiKey(params: {
|
|
|
8
8
|
owner: string;
|
|
9
9
|
name: string;
|
|
10
10
|
}): void;
|
|
11
|
+
/**
|
|
12
|
+
* Detect agent-runtime auth failures that should be reformatted as an actionable
|
|
13
|
+
* key-fix CTA before being shown to the user. Covers the two shapes we see:
|
|
14
|
+
* - missing key (validateAgentApiKey throw): contains MISSING_KEY_MARKER
|
|
15
|
+
* - revoked / invalid key (Claude CLI 401 surfaced via api_error_status):
|
|
16
|
+
* "Invalid API key · Fix external API key" + similar provider variants
|
|
17
|
+
*/
|
|
18
|
+
export declare function isApiKeyAuthError(text: string): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Friendly Markdown summary for both the missing-key and invalid-key cases.
|
|
21
|
+
* Used in the catch / result-failure paths in `main.ts` to overwrite the raw
|
|
22
|
+
* agent error before it's posted to the PR progress comment.
|
|
23
|
+
*/
|
|
24
|
+
export declare function formatApiKeyErrorSummary(params: {
|
|
25
|
+
owner: string;
|
|
26
|
+
name: string;
|
|
27
|
+
raw: string;
|
|
28
|
+
}): string;
|
package/dist/utils/gitAuth.d.ts
CHANGED
|
@@ -44,4 +44,31 @@ export declare function setGitAuthServer(server: GitAuthServer): void;
|
|
|
44
44
|
* await $git("push", ["-u", "origin", "feature"], { token });
|
|
45
45
|
*/
|
|
46
46
|
export declare function $git(subcommand: SafeGitSubcommand, args: string[], options: GitAuthOptions): Promise<GitResult>;
|
|
47
|
+
/**
|
|
48
|
+
* shallow-clone unreachable: when an existing local depth is too shallow for
|
|
49
|
+
* git to traverse to the requested ref's ancestry, the remote walk fails with
|
|
50
|
+
* one of these wordings (git emits the full OID via oid_to_hex, so the bound
|
|
51
|
+
* is 40 for SHA-1 or 64 for SHA-256). detecting both lets a single deepen
|
|
52
|
+
* retry recover before the error reaches the agent — see issue #564 for the
|
|
53
|
+
* original `git_fetch` precedent and #656 for the `checkout_pr` follow-up.
|
|
54
|
+
*/
|
|
55
|
+
export declare const SHALLOW_UNREACHABLE_PATTERNS: RegExp[];
|
|
56
|
+
/**
|
|
57
|
+
* large enough to clear the merge base on most real-world PRs without
|
|
58
|
+
* downloading the full history; matches the fallback used by
|
|
59
|
+
* `checkoutPrBranch` when the GitHub compare API is unavailable.
|
|
60
|
+
*/
|
|
61
|
+
export declare const DEEPEN_RETRY_DEPTH = 1000;
|
|
62
|
+
/**
|
|
63
|
+
* authenticated `git fetch` that recovers from shallow-unreachable errors
|
|
64
|
+
* by retrying once with `--deepen=1000`. callers pass the same args they
|
|
65
|
+
* would to `$git("fetch", ...)`; on shallow-unreachable failures in a
|
|
66
|
+
* shallow repo, the second attempt prepends `--deepen=N` and strips any
|
|
67
|
+
* caller-supplied `--depth=` (the two flags are mutually exclusive, and
|
|
68
|
+
* the caller's depth is what got us into this mess).
|
|
69
|
+
*
|
|
70
|
+
* non-shallow-unreachable errors and non-shallow repos rethrow unchanged,
|
|
71
|
+
* so this is safe to wrap any fetch without changing fast-path behavior.
|
|
72
|
+
*/
|
|
73
|
+
export declare function $gitFetchWithDeepen(args: string[], options: GitAuthOptions, label?: string): Promise<GitResult>;
|
|
47
74
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type AgentId } from "../external.ts";
|
|
2
2
|
import type { Mode } from "../modes.ts";
|
|
3
3
|
import type { ResolvedPayload } from "./payload.ts";
|
|
4
|
+
import type { LearningsHeading } from "./runContext.ts";
|
|
4
5
|
import type { RunContextData } from "./runContextData.ts";
|
|
5
6
|
interface InstructionsContext {
|
|
6
7
|
payload: ResolvedPayload;
|
|
@@ -12,6 +13,10 @@ interface InstructionsContext {
|
|
|
12
13
|
* couldn't be seeded for some reason. main.ts always seeds, so in
|
|
13
14
|
* practice this is always set; the null case keeps the type honest. */
|
|
14
15
|
learningsFilePath: string | null;
|
|
16
|
+
/** server-parsed TOC for the body of the learnings tmpfile. rendered
|
|
17
|
+
* inline into the LEARNINGS prompt section so the agent can `read_file`
|
|
18
|
+
* targeted line ranges instead of pulling the whole file into context. */
|
|
19
|
+
learningsHeadings: LearningsHeading[];
|
|
15
20
|
}
|
|
16
21
|
export interface ResolvedInstructions {
|
|
17
22
|
full: string;
|
|
@@ -21,5 +26,19 @@ export interface ResolvedInstructions {
|
|
|
21
26
|
event: string;
|
|
22
27
|
runtime: string;
|
|
23
28
|
}
|
|
29
|
+
/** render the heading list as an indented bullet TOC. ranges shown in
|
|
30
|
+
* parentheses (`(L3-L18)`); the start line is always the heading line
|
|
31
|
+
* itself, so reading the listed range gives the agent the heading +
|
|
32
|
+
* body together. shallowest heading depth in the body sits at the root
|
|
33
|
+
* column; deeper levels indent by `(depth - rootDepth) * 2` spaces. */
|
|
34
|
+
export declare function renderLearningsToc(headings: LearningsHeading[]): string;
|
|
35
|
+
/** assemble the LEARNINGS prompt section: file path + intro + either
|
|
36
|
+
* the rendered heading TOC (when the body has structure) or a no-headings
|
|
37
|
+
* affordance pointing the agent at the reflection turn for restructuring.
|
|
38
|
+
* empty string when the seed step failed and there's no path to surface. */
|
|
39
|
+
export declare function buildLearningsSection(ctx: {
|
|
40
|
+
filePath: string | null;
|
|
41
|
+
headings: LearningsHeading[];
|
|
42
|
+
}): string;
|
|
24
43
|
export declare function resolveInstructions(ctx: InstructionsContext): ResolvedInstructions;
|
|
25
44
|
export {};
|
|
@@ -4,23 +4,34 @@
|
|
|
4
4
|
* back into future runs as durable context. Modeled on the PR-summary tmpfile
|
|
5
5
|
* pattern (see action/utils/prSummary.ts):
|
|
6
6
|
*
|
|
7
|
-
* 1. server seeds `pullfrog-learnings.md`
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
7
|
+
* 1. server seeds `pullfrog-learnings.md` with the verbatim body of
|
|
8
|
+
* `Repo.learnings` (or empty for fresh repos), and parses headings
|
|
9
|
+
* server-side (`utils/learningsToc.ts`) — the parsed TOC is rendered
|
|
10
|
+
* into the LEARNINGS prompt section, not into the file
|
|
11
|
+
* 2. the agent reads the TOC in the prompt and uses listed line ranges
|
|
12
|
+
* to read just the sections relevant to the current task — file can
|
|
13
|
+
* grow large, but only targeted ranges hit the agent's context
|
|
14
|
+
* 3. agent edits the file in place at end-of-run during the reflection
|
|
15
|
+
* turn (see action/agents/postRun.ts buildLearningsReflectionPrompt)
|
|
16
|
+
* 4. main.ts reads the file back at end-of-run and PATCHes
|
|
17
|
+
* `/api/repo/[owner]/[repo]/learnings` if the body changed
|
|
14
18
|
*
|
|
15
19
|
* Edit-in-place avoids stuffing the entire learnings list into both the
|
|
16
20
|
* prompt context and an `update_learnings` MCP tool call (which previously
|
|
17
21
|
* required passing the FULL merged list as a string parameter — an
|
|
18
22
|
* output-token tax that grew linearly with the learnings size).
|
|
23
|
+
*
|
|
24
|
+
* Section structure is agent-curated. The reflection prompt teaches
|
|
25
|
+
* hierarchy + a soft 300-line-per-section cap to keep TOC ranges
|
|
26
|
+
* agent-targetable on long-lived repos; there is no fixed taxonomy.
|
|
19
27
|
*/
|
|
20
28
|
export declare const LEARNINGS_FILE_NAME = "pullfrog-learnings.md";
|
|
21
29
|
export declare function learningsFilePath(tmpdir: string): string;
|
|
22
|
-
/** seed the learnings
|
|
23
|
-
*
|
|
30
|
+
/** seed the rolling learnings tmpfile with the verbatim DB body (or empty
|
|
31
|
+
* string for fresh repos). returns the absolute path. the parsed TOC is
|
|
32
|
+
* carried separately via `RepoSettings.learningsHeadings` and rendered
|
|
33
|
+
* into the prompt by `resolveInstructions`, so the file on disk is just
|
|
34
|
+
* the body — no markers, no scaffold, no in-file TOC. */
|
|
24
35
|
export declare function seedLearningsFile(params: {
|
|
25
36
|
tmpdir: string;
|
|
26
37
|
current: string | null;
|
|
@@ -1,2 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result of a provider-error scan: the classification label plus a
|
|
3
|
+
* human-readable excerpt centered on the matched line. The excerpt is what
|
|
4
|
+
* gets surfaced in `» provider error detected (...)` log lines — see
|
|
5
|
+
* `extractExcerpt` for the windowing/byte-cap policy.
|
|
6
|
+
*/
|
|
7
|
+
export type ProviderErrorMatch = {
|
|
8
|
+
label: string;
|
|
9
|
+
excerpt: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function findProviderErrorMatch(text: string): ProviderErrorMatch | null;
|
|
1
12
|
export declare function detectProviderError(text: string): string | null;
|
|
2
13
|
export declare function isRouterKeylimitExhaustedError(text: string): boolean;
|
|
@@ -6,6 +6,21 @@ export interface Mode {
|
|
|
6
6
|
description: string;
|
|
7
7
|
prompt: string;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* server-parsed TOC entry for `Repo.learnings`. depth is 1-6 (h1-h6),
|
|
11
|
+
* line numbers are 1-indexed against the raw body. computed by
|
|
12
|
+
* `parseLearningsHeadings` in `utils/learningsToc.ts` (server side) and
|
|
13
|
+
* shipped over the run-context JSON boundary; the canonical declaration
|
|
14
|
+
* lives there. duplicated here because the action runtime can't reach
|
|
15
|
+
* across into the proprietary root-level codebase, and the JSON wire
|
|
16
|
+
* means typecheck can't enforce shape equality across both sides.
|
|
17
|
+
*/
|
|
18
|
+
export interface LearningsHeading {
|
|
19
|
+
depth: 1 | 2 | 3 | 4 | 5 | 6;
|
|
20
|
+
title: string;
|
|
21
|
+
startLine: number;
|
|
22
|
+
endLine: number;
|
|
23
|
+
}
|
|
9
24
|
export interface RepoSettings {
|
|
10
25
|
model: string | null;
|
|
11
26
|
modes: Mode[];
|
|
@@ -18,6 +33,7 @@ export interface RepoSettings {
|
|
|
18
33
|
prApproveEnabled: boolean;
|
|
19
34
|
modeInstructions: Record<string, string>;
|
|
20
35
|
learnings: string | null;
|
|
36
|
+
learningsHeadings: LearningsHeading[];
|
|
21
37
|
envAllowlist: string | null;
|
|
22
38
|
}
|
|
23
39
|
/**
|