pullfrog 0.0.203 → 0.0.205

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.
@@ -0,0 +1,146 @@
1
+ /**
2
+ * Single source of truth for reading, updating, deleting, and creating "progress comments" —
3
+ * the GitHub comments Pullfrog uses to surface a run's status.
4
+ *
5
+ * A progress comment can be one of two distinct GitHub entities with non-overlapping IDs and
6
+ * distinct REST endpoints:
7
+ * - "issue": a top-level issue/PR timeline comment (octokit.rest.issues.*Comment)
8
+ * - "review": an inline PR review-thread comment (octokit.rest.pulls.*ReviewComment)
9
+ *
10
+ * Callers carry a `ProgressComment` (id + type) value end-to-end so the right endpoint is always
11
+ * picked. Adding a third comment type later means one new branch in this file, not six.
12
+ */
13
+ export type ProgressCommentType = "issue" | "review";
14
+ export type ProgressComment = {
15
+ id: number;
16
+ type: ProgressCommentType;
17
+ };
18
+ /**
19
+ * Parse the on-the-wire `{ id: string; type }` shape (the form carried in `JsonPayload`)
20
+ * into the in-memory `ProgressComment` shape. Returns undefined when the id isn't a
21
+ * positive integer so callers can short-circuit cleanly. Callers handle logging.
22
+ */
23
+ export declare function parseProgressComment(raw: {
24
+ id: string;
25
+ type: ProgressCommentType;
26
+ } | null | undefined): ProgressComment | undefined;
27
+ interface CommentResponse {
28
+ data: {
29
+ id: number;
30
+ body?: string | null | undefined;
31
+ html_url: string;
32
+ node_id?: string;
33
+ };
34
+ }
35
+ export interface ProgressCommentOctokit {
36
+ rest: {
37
+ issues: {
38
+ createComment: (params: {
39
+ owner: string;
40
+ repo: string;
41
+ issue_number: number;
42
+ body: string;
43
+ }) => Promise<CommentResponse>;
44
+ getComment: (params: {
45
+ owner: string;
46
+ repo: string;
47
+ comment_id: number;
48
+ }) => Promise<CommentResponse>;
49
+ updateComment: (params: {
50
+ owner: string;
51
+ repo: string;
52
+ comment_id: number;
53
+ body: string;
54
+ }) => Promise<CommentResponse>;
55
+ deleteComment: (params: {
56
+ owner: string;
57
+ repo: string;
58
+ comment_id: number;
59
+ }) => Promise<unknown>;
60
+ };
61
+ pulls: {
62
+ createReplyForReviewComment: (params: {
63
+ owner: string;
64
+ repo: string;
65
+ pull_number: number;
66
+ comment_id: number;
67
+ body: string;
68
+ }) => Promise<CommentResponse>;
69
+ getReviewComment: (params: {
70
+ owner: string;
71
+ repo: string;
72
+ comment_id: number;
73
+ }) => Promise<CommentResponse>;
74
+ updateReviewComment: (params: {
75
+ owner: string;
76
+ repo: string;
77
+ comment_id: number;
78
+ body: string;
79
+ }) => Promise<CommentResponse>;
80
+ deleteReviewComment: (params: {
81
+ owner: string;
82
+ repo: string;
83
+ comment_id: number;
84
+ }) => Promise<unknown>;
85
+ };
86
+ };
87
+ }
88
+ interface ApiCtx {
89
+ octokit: ProgressCommentOctokit;
90
+ owner: string;
91
+ repo: string;
92
+ }
93
+ /**
94
+ * Fetch a progress comment via the appropriate REST endpoint for its type.
95
+ * Returns the common subset of fields callers actually use.
96
+ */
97
+ export declare function getProgressComment(ctx: ApiCtx, comment: ProgressComment): Promise<{
98
+ id: number;
99
+ body: string | undefined;
100
+ html_url: string;
101
+ }>;
102
+ /**
103
+ * Update a progress comment in place via the appropriate REST endpoint.
104
+ * Returns the common subset of fields callers actually use.
105
+ */
106
+ export declare function updateProgressComment(ctx: ApiCtx, comment: ProgressComment, body: string): Promise<{
107
+ id: number;
108
+ body: string | undefined;
109
+ html_url: string;
110
+ node_id: string | undefined;
111
+ }>;
112
+ /**
113
+ * Delete a progress comment via the appropriate REST endpoint.
114
+ * Lower-level than `deleteProgressComment` in mcp/comment.ts — that one also clears
115
+ * tool state. Callers that don't have a ToolContext (post cleanup, error handlers)
116
+ * should use this directly; the higher-level wrapper delegates here.
117
+ */
118
+ export declare function deleteProgressCommentApi(ctx: ApiCtx, comment: ProgressComment): Promise<void>;
119
+ /**
120
+ * Discriminated target for `createLeapingProgressComment`. The two variants map to the two
121
+ * distinct GitHub create endpoints; review-reply additionally needs the parent comment ID.
122
+ */
123
+ export type CreateProgressCommentTarget = {
124
+ kind: "issue";
125
+ issueNumber: number;
126
+ } | {
127
+ kind: "reviewReply";
128
+ pullNumber: number;
129
+ replyToCommentId: number;
130
+ };
131
+ export interface CreatedProgressComment {
132
+ comment: ProgressComment;
133
+ body: string | undefined;
134
+ html_url: string;
135
+ }
136
+ /**
137
+ * Create the initial "Leaping into action..." progress comment.
138
+ *
139
+ * Reliability: when `kind: "reviewReply"` fails (e.g. the parent comment was deleted or the
140
+ * thread is otherwise unreachable), falls back to a top-level issue comment on the same PR
141
+ * rather than leaving the run with no progress surface. The fallback is logged.
142
+ *
143
+ * (PR # === issue # in GitHub's number space, so `pullNumber` doubles as the fallback target.)
144
+ */
145
+ export declare function createLeapingProgressComment(ctx: ApiCtx, target: CreateProgressCommentTarget, body: string): Promise<CreatedProgressComment>;
146
+ export {};
@@ -20,10 +20,26 @@ export interface RepoSettings {
20
20
  learnings: string | null;
21
21
  envAllowlist: string | null;
22
22
  }
23
+ /**
24
+ * Account-level billing plan. Orthogonal to repo-level OSS status. Mirrors
25
+ * the server's `AccountPlan` in `utils/billing.ts`. `"none"` = free tier,
26
+ * `"payg"` = card on file / pay-as-you-go.
27
+ */
28
+ export type AccountPlan = "none" | "payg";
29
+ /**
30
+ * "Is Pullfrog absorbing marginal infra cost for this repo?" — composite
31
+ * predicate over the two orthogonal dimensions (repo-level OSS, account-level
32
+ * plan). Mirrors `isInfraCovered` in the server's `utils/billing.ts`.
33
+ */
34
+ export declare function isInfraCovered(params: {
35
+ isOss: boolean;
36
+ plan: AccountPlan;
37
+ }): boolean;
23
38
  export interface RunContext {
24
39
  settings: RepoSettings;
25
40
  apiToken: string;
26
41
  oss: boolean;
42
+ plan: AccountPlan;
27
43
  proxyModel?: string | undefined;
28
44
  dbSecrets?: Record<string, string> | undefined;
29
45
  }
@@ -1,6 +1,6 @@
1
1
  import type { Octokit } from "@octokit/rest";
2
2
  import { type OctokitWithPlugins } from "./github.ts";
3
- import { type RepoSettings } from "./runContext.ts";
3
+ import { type AccountPlan, type RepoSettings } from "./runContext.ts";
4
4
  export interface RunContextData {
5
5
  repo: {
6
6
  owner: string;
@@ -10,6 +10,7 @@ export interface RunContextData {
10
10
  repoSettings: RepoSettings;
11
11
  apiToken: string;
12
12
  oss: boolean;
13
+ plan: AccountPlan;
13
14
  proxyModel?: string | undefined;
14
15
  dbSecrets?: Record<string, string> | undefined;
15
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pullfrog",
3
- "version": "0.0.203",
3
+ "version": "0.0.205",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "pullfrog": "dist/cli.mjs",