pullfrog 0.1.29 → 0.1.31

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.
Files changed (60) hide show
  1. package/dist/agents/claudePretoolGate.d.ts +5 -1
  2. package/dist/agents/opencodePlugin.d.ts +2 -2
  3. package/dist/agents/postRun.d.ts +8 -31
  4. package/dist/agents/shared.d.ts +6 -0
  5. package/dist/agents/subagentToolGates.d.ts +22 -40
  6. package/dist/cli.mjs +63989 -59666
  7. package/dist/external.d.ts +45 -2
  8. package/dist/index.js +62509 -58186
  9. package/dist/internal/index.d.ts +2 -2
  10. package/dist/internal.js +99 -33
  11. package/dist/mcp/checkSuite.d.ts +3 -1
  12. package/dist/mcp/checkout.d.ts +4 -2
  13. package/dist/mcp/comment.d.ts +12 -4
  14. package/dist/mcp/commitInfo.d.ts +3 -1
  15. package/dist/mcp/dependencies.d.ts +6 -2
  16. package/dist/mcp/git.d.ts +32 -6
  17. package/dist/mcp/issue.d.ts +26 -1
  18. package/dist/mcp/issueComments.d.ts +3 -1
  19. package/dist/mcp/issueEvents.d.ts +3 -1
  20. package/dist/mcp/issueInfo.d.ts +3 -1
  21. package/dist/mcp/labels.d.ts +16 -1
  22. package/dist/mcp/output.d.ts +6 -2
  23. package/dist/mcp/pr.d.ts +19 -2
  24. package/dist/mcp/prInfo.d.ts +3 -1
  25. package/dist/mcp/resolveRepoCtx.d.ts +34 -0
  26. package/dist/mcp/review.d.ts +9 -3
  27. package/dist/mcp/reviewComments.d.ts +9 -3
  28. package/dist/mcp/selectMode.d.ts +3 -1
  29. package/dist/mcp/server.d.ts +7 -1
  30. package/dist/mcp/shared.d.ts +18 -1
  31. package/dist/mcp/shell.d.ts +6 -2
  32. package/dist/mcp/upload.d.ts +3 -1
  33. package/dist/mcp/xrepo.d.ts +15 -0
  34. package/dist/models.d.ts +58 -5
  35. package/dist/modes.d.ts +1 -1
  36. package/dist/toolState.d.ts +66 -16
  37. package/dist/utils/apiCommit.d.ts +40 -0
  38. package/dist/utils/apiKeys.d.ts +19 -0
  39. package/dist/utils/buildPullfrogFooter.d.ts +27 -0
  40. package/dist/utils/claudeSubscription.d.ts +30 -0
  41. package/dist/utils/errorReport.d.ts +2 -2
  42. package/dist/utils/github.d.ts +28 -2
  43. package/dist/utils/instructions.d.ts +11 -0
  44. package/dist/utils/isTransientNetworkError.d.ts +10 -0
  45. package/dist/utils/learnings.d.ts +14 -0
  46. package/dist/utils/modelAccess.d.ts +64 -0
  47. package/dist/utils/openCodeModels.d.ts +2 -2
  48. package/dist/utils/payload.d.ts +16 -0
  49. package/dist/utils/proxy.d.ts +3 -5
  50. package/dist/utils/runContext.d.ts +4 -0
  51. package/dist/utils/runContextData.d.ts +10 -0
  52. package/dist/utils/runErrorRenderer.d.ts +2 -2
  53. package/dist/utils/setup.d.ts +18 -3
  54. package/dist/utils/token.d.ts +22 -3
  55. package/dist/yes/index.d.ts +32 -0
  56. package/dist/yes/standard-schema.d.ts +117 -0
  57. package/dist/yes.js +1244 -0
  58. package/package.json +19 -10
  59. package/dist/utils/byokFallback.d.ts +0 -44
  60. package/dist/utils/retry.d.ts +0 -13
@@ -39,7 +39,11 @@
39
39
  * `#!/usr/bin/env node` shebang and the executable bit set by the harness.
40
40
  */
41
41
  export declare const CLAUDE_PRETOOL_GATE_FILENAME: "pullfrog-pretool-gate.mjs";
42
- export declare const CLAUDE_PRETOOL_GATE_SOURCE: string;
42
+ /**
43
+ * Build the gate script source, embedding the run's derived denied-tool set
44
+ * (see `subagentDeniedToolNames` in action/agents/subagentToolGates.ts).
45
+ */
46
+ export declare function buildClaudePretoolGateSource(deniedTools: readonly string[]): string;
43
47
  /**
44
48
  * Settings JSON shape registered via `claude --settings <path>`. The
45
49
  * matcher `^mcp__pullfrog__` is treated as a regex by claude-code's
@@ -31,7 +31,7 @@
31
31
  *
32
32
  * The subagent gate (the `tool.execute.before` hook that hard-blocks
33
33
  * state-mutating MCP tool calls from a subagent session) lives in a SEPARATE
34
- * plugin — `PULLFROG_OPENCODE_GATE_PLUGIN_SOURCE` below — because it's the
34
+ * plugin — `buildOpencodeSubagentGateSource` below — because it's the
35
35
  * load-bearing security fence and must ship into both opencode harnesses,
36
36
  * whereas this events re-emitter is only needed by the legacy `opencode.ts`
37
37
  * CLI-parsing path (the active `opencode_v2.ts` reads subagent events directly
@@ -82,4 +82,4 @@ export declare const PULLFROG_OPENCODE_PLUGIN_SOURCE: string;
82
82
  * PR #796 (action/mcp/checkout.ts, action/mcp/git.ts). Deny-list source of
83
83
  * truth: `action/agents/subagentToolGates.ts`.
84
84
  */
85
- export declare const PULLFROG_OPENCODE_GATE_PLUGIN_SOURCE: string;
85
+ export declare function buildOpencodeSubagentGateSource(deniedTools: readonly string[]): string;
@@ -67,39 +67,16 @@ export declare function finalizeAgentResult<R extends AgentResult>(params: {
67
67
  ctx: AgentRunContext;
68
68
  result: R;
69
69
  }): Promise<R>;
70
- export declare function shouldRunReflection(mode: string | undefined): boolean;
71
70
  /**
72
- * prompt for a dedicated post-run reflection turn nudging the agent to edit
73
- * the rolling learnings file if it discovered anything worth persisting.
74
- *
75
- * this exists because passive "if you learned something, write it down"
76
- * instructions baked into mode checklists are frequently ignored the agent
77
- * stays focused on the task and the meta-ask falls through. delivering it
78
- * as its own resume turn, with nothing competing for attention, raises the
79
- * fire rate substantially.
80
- *
81
- * the file is the single source of truth — there is no separate MCP tool
82
- * call. the server reads the file at end-of-run and persists any edits to
83
- * `Repo.learnings`.
84
- *
85
- * the prompt copy is shaped by repo-wide audits of the actual content the
86
- * agent has been writing (issue #619 in pullfrog/app). recurring failure
87
- * modes the framing pushes back on:
88
- * - massive multi-paragraph "bullets" that are really mini-articles
89
- * - facts anchored to moving repo state (PR / review / commit / branch
90
- * refs, dates, version pins, line numbers) that decay within weeks
91
- * - sections growing into giant flat lists with no internal structure,
92
- * forcing future runs to read kilobytes to find one fact
93
- *
94
- * single litmus delivered in the prompt: "would a future run on this repo
95
- * do its work better because this bullet exists?". tool-quirk workarounds
96
- * are explicitly allowed when the agent burned calls discovering the
97
- * quirk this run — recording the workaround prevents next run from
98
- * repeating the waste. tradeoff: the same quirk gets duplicated across
99
- * repos, so when a quirk is fixed upstream in tool descriptions the
100
- * per-repo bullets go stale and we have no batch-invalidation path.
71
+ * the combined post-run reflection nudge for a run: the repo-level learnings
72
+ * reflection, plus the org-level cross-repo reflection when this is an --xrepo
73
+ * run. each half is gated on its own seeded file — the two seeds are
74
+ * independent best-effort steps in main.ts, so a failed repo-learnings seed
75
+ * must not also suppress an org-level cross-repo reflection that did seed.
76
+ * returns undefined when reflection should be skipped (neither file seeded, or
77
+ * a reflection-skip mode like IncrementalReview).
101
78
  */
102
- export declare function buildLearningsReflectionPrompt(filePath: string): string;
79
+ export declare function buildReflectionPrompt(toolState: ToolState): string | undefined;
103
80
  /**
104
81
  * shared post-run retry loop used by every agent harness.
105
82
  *
@@ -92,6 +92,12 @@ export interface AgentRunContext {
92
92
  tmpdir: string;
93
93
  /** harness-owned secret paths that agent filesystem tools must never read. */
94
94
  secretDenyPaths?: string[] | undefined;
95
+ /**
96
+ * canonical bare names of state-mutating MCP tools the subagent gate must
97
+ * deny (derived from each tool's `mutates` flag). embedded into the per-run
98
+ * gate scripts. see action/agents/subagentToolGates.ts.
99
+ */
100
+ subagentDeniedTools: readonly string[];
95
101
  instructions: ResolvedInstructions;
96
102
  todoTracker?: TodoTracker | undefined;
97
103
  /**
@@ -1,5 +1,6 @@
1
1
  /**
2
- * Single source of truth for MCP tools subagents are forbidden from calling.
2
+ * Single source of truth for which MCP tools subagents are forbidden from
3
+ * calling — derived from each tool's `mutates` flag, not a hand-maintained list.
3
4
  *
4
5
  * Subagents share the orchestrator's in-process git working tree, `toolState`,
5
6
  * progress comment, and run-scoped pr/branch context. A subagent that calls
@@ -8,48 +9,29 @@
8
9
  * `zed-industries/cloud` incident hit exactly this: a `reviewfrog` lens
9
10
  * dispatched `checkout_pr({2582})` mid-review, the orchestrator's next push
10
11
  * clobbered an unrelated engineer's branch. PR #796 added runtime backstops
11
- * inside `checkout_pr`/`push_branch`; this list is the upstream gate that
12
- * stops the call from ever reaching MCP when it originates from a subagent.
12
+ * inside `checkout_pr`/`push_branch`; this gate stops the call from ever
13
+ * reaching MCP when it originates from a subagent.
13
14
  *
14
- * The gate is enforced at two pre-tool hooks:
15
+ * The denied set is whatever the run actually registers with `mutates: true`
16
+ * (see `action/mcp/shared.ts`). To deny a new state-changing MCP tool to
17
+ * subagents, mark it `mutates: true` at its definition — nothing to add here.
18
+ * Read-only tools (`get_*`, `list_*`, `git_fetch`, …) and the general-purpose
19
+ * `git`/`shell` execution tools are intentionally unmarked: denying them would
20
+ * make review impossible, and their mutations are gated by command-arg
21
+ * validation plus the reviewer system prompt (`action/agents/reviewer.ts`).
22
+ *
23
+ * The gate is enforced at two pre-tool hooks, each fed this derived list:
15
24
  * - opencode: `tool.execute.before` (action/agents/opencodePlugin.ts)
16
25
  * - claude: `PreToolUse` settings hook (action/agents/claudePretoolGate.ts)
17
- *
18
- * Names are stored in their canonical bare form (the FastMCP tool `name`
19
- * field). Each runtime presents them with a different prefix:
20
- * - claude: `mcp__pullfrog__<name>`
21
- * - opencode: `pullfrog_<name>`
22
- * The hooks strip those prefixes before comparing.
23
- *
24
- * Read-only MCP tools (`get_*`, `list_*`, `git_fetch`, `get_check_suite_logs`,
25
- * `await_dependency_installation`, etc.) and the `git`/`shell` tools stay off
26
- * this list — denying them would make review work impossible. The reviewer system prompt
27
- * (`action/agents/reviewer.ts`) already forbids state-changing shell/git
28
- * subcommands as a prose constraint; this list is the belt-and-suspenders
29
- * machine fence for the high-stakes mutations we can identify by name alone.
30
- *
31
- * When adding a state-changing MCP tool to `action/mcp/server.ts`, add its
32
- * canonical name here too. Inclusions justified inline.
33
- */
34
- export declare const SUBAGENT_DENIED_TOOLS: readonly ["checkout_pr", "push_branch", "push_tags", "delete_branch", "create_pull_request", "update_pull_request_body", "create_issue", "create_issue_comment", "edit_issue_comment", "reply_to_review_comment", "create_pull_request_review", "resolve_review_thread", "add_labels", "set_output", "report_progress", "select_mode", "start_dependency_installation", "kill_background", "upload_file"];
35
- export type SubagentDeniedTool = (typeof SUBAGENT_DENIED_TOOLS)[number];
36
- /**
37
- * Strip the runtime-specific MCP prefix from a tool name and return the
38
- * canonical bare name (matching FastMCP's `name:` field). Returns the input
39
- * unchanged if it doesn't carry a known prefix — keeping comparison simple
40
- * for native (non-MCP) tools, which never appear on the deny list anyway.
41
- */
42
- export declare function stripMcpPrefix(toolName: string): string;
43
- /**
44
- * Whether `toolName` (in any runtime's prefix style) names a tool that
45
- * subagents must not call.
26
+ * Names are the canonical bare form (the FastMCP tool `name`). Each runtime
27
+ * presents them with a different prefix (`mcp__pullfrog__<name>` for claude,
28
+ * `pullfrog_<name>` for opencode); the hooks strip the prefix before comparing.
46
29
  */
47
- export declare function isSubagentDeniedTool(toolName: string): boolean;
30
+ import { type ToolContext } from "../mcp/server.ts";
48
31
  /**
49
- * Human-readable refusal surfaced to the model when a denied tool is gated.
50
- * Phrased so a halfway-attentive subagent realises (a) the tool is denied to
51
- * it specifically, (b) why (shared in-process state with the orchestrator),
52
- * and (c) what to do instead (report findings; the orchestrator can call the
53
- * tool directly).
32
+ * Canonical bare names of every state-mutating MCP tool registered for this
33
+ * run the set subagents are denied. Derived from the `mutates` flag so it can
34
+ * never silently drift from the registered tool set. Throws if it derives empty
35
+ * (a sign the flag plumbing broke) rather than starting with the gate disabled.
54
36
  */
55
- export declare function buildSubagentDenyMessage(toolName: string): string;
37
+ export declare function subagentDeniedToolNames(ctx: ToolContext, outputSchema?: Record<string, unknown>): string[];