@vercel/factory 0.0.21 → 0.0.22
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/CHANGELOG.md +10 -0
- package/dist/build-factory.d.mts +1 -1
- package/dist/build-factory.mjs +2 -1
- package/dist/build-factory.mjs.map +1 -1
- package/dist/client.d.mts +4 -4
- package/dist/eve/task-execution.d.mts +16 -16
- package/dist/github.d.mts +21 -1
- package/dist/github.mjs +25 -1
- package/dist/github.mjs.map +1 -1
- package/dist/intake-contracts.d.mts +2 -2
- package/dist/integrations/github.d.mts +2 -2
- package/dist/integrations/github.mjs +2 -2
- package/dist/repository-scripts.d.mts +221 -0
- package/dist/repository-scripts.mjs +330 -0
- package/dist/repository-scripts.mjs.map +1 -0
- package/dist/schema/task-graph.d.mts +96 -96
- package/dist/schema/transcript.d.mts +4 -4
- package/docs/recipes/repository-scripts.md +64 -0
- package/package.json +8 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @vercel/factory
|
|
2
2
|
|
|
3
|
+
## 0.0.22
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2b90bb3: Validate sandbox harness integration against the harness releases matching AI SDK 7.0.105 to avoid incompatible provider types in fresh installs.
|
|
8
|
+
- f8d68e2: Add `factory create --empty` for deploying an inert Factory host, including support for generating it inside an existing Git worktree.
|
|
9
|
+
- 59e4b10: Add exact-version repository event scripts with durable Task execution, scoped classification,
|
|
10
|
+
and idempotent GitHub issue comment and label actions.
|
|
11
|
+
- f69894b: Preserve delegated work during session refreshes and scaffold streaming worker command output.
|
|
12
|
+
|
|
3
13
|
## 0.0.21
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/dist/build-factory.d.mts
CHANGED
|
@@ -8,7 +8,7 @@ interface BuildFactoryOptions<TConfig extends EveNextConfig = EveNextConfig> {
|
|
|
8
8
|
nextConfig: EveNextConfigInput<TConfig>;
|
|
9
9
|
root?: string;
|
|
10
10
|
}
|
|
11
|
-
/** Create
|
|
11
|
+
/** Create a Next.js configuration that mounts the Eve agents beneath a Factory project root. */
|
|
12
12
|
declare function buildFactory<TConfig extends EveNextConfig>({ factoryConfig, nextConfig, root }: BuildFactoryOptions<TConfig>): EveNextConfigFunction<TConfig>;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { BuildFactoryOptions, buildFactory };
|
package/dist/build-factory.mjs
CHANGED
|
@@ -2,11 +2,12 @@ import { defineFactory } from "./schema/factory-config.mjs";
|
|
|
2
2
|
import { readdirSync } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
//#region src/build-factory.ts
|
|
5
|
-
/** Create
|
|
5
|
+
/** Create a Next.js configuration that mounts the Eve agents beneath a Factory project root. */
|
|
6
6
|
function buildFactory({ factoryConfig, nextConfig, root = process.cwd() }) {
|
|
7
7
|
defineFactory(factoryConfig);
|
|
8
8
|
const agentDefinitions = Object.fromEntries(readdirSync(path.join(root, "agents"), { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => [entry.name, path.join(root, "agents", entry.name)]));
|
|
9
9
|
return async (phase, context) => {
|
|
10
|
+
if (Object.keys(agentDefinitions).length === 0) return typeof nextConfig === "function" ? nextConfig(phase, context) : nextConfig;
|
|
10
11
|
const { withEve } = await import("eve/next");
|
|
11
12
|
return withEve(nextConfig, { agents: agentDefinitions })(phase, context);
|
|
12
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-factory.mjs","names":[],"sources":["../src/build-factory.ts"],"sourcesContent":["import { readdirSync } from \"node:fs\";\nimport path from \"node:path\";\nimport {\n type EveNextConfig,\n type EveNextConfigFunction,\n type EveNextConfigInput,\n type WithEveAgentsConfig,\n} from \"eve/next\";\nimport { defineFactory, type FactoryConfigInput } from \"./schema/factory-config\";\n\n/** Inputs for validating a Factory configuration and discovering its Eve agents at build time. */\nexport interface BuildFactoryOptions<TConfig extends EveNextConfig = EveNextConfig> {\n factoryConfig: FactoryConfigInput;\n nextConfig: EveNextConfigInput<TConfig>;\n root?: string;\n}\n\n/** Create
|
|
1
|
+
{"version":3,"file":"build-factory.mjs","names":[],"sources":["../src/build-factory.ts"],"sourcesContent":["import { readdirSync } from \"node:fs\";\nimport path from \"node:path\";\nimport {\n type EveNextConfig,\n type EveNextConfigFunction,\n type EveNextConfigInput,\n type WithEveAgentsConfig,\n} from \"eve/next\";\nimport { defineFactory, type FactoryConfigInput } from \"./schema/factory-config\";\n\n/** Inputs for validating a Factory configuration and discovering its Eve agents at build time. */\nexport interface BuildFactoryOptions<TConfig extends EveNextConfig = EveNextConfig> {\n factoryConfig: FactoryConfigInput;\n nextConfig: EveNextConfigInput<TConfig>;\n root?: string;\n}\n\n/** Create a Next.js configuration that mounts the Eve agents beneath a Factory project root. */\nexport function buildFactory<TConfig extends EveNextConfig>({\n factoryConfig,\n nextConfig,\n root = process.cwd(),\n}: BuildFactoryOptions<TConfig>): EveNextConfigFunction<TConfig> {\n defineFactory(factoryConfig);\n const agentDefinitions: WithEveAgentsConfig = Object.fromEntries(\n readdirSync(path.join(root, \"agents\"), { withFileTypes: true })\n .filter((entry) => entry.isDirectory())\n .map((entry) => [entry.name, path.join(root, \"agents\", entry.name)]),\n );\n return async (phase, context) => {\n if (Object.keys(agentDefinitions).length === 0) {\n return typeof nextConfig === \"function\" ? nextConfig(phase, context) : nextConfig;\n }\n const { withEve } = await import(\"eve/next\");\n return withEve(nextConfig, { agents: agentDefinitions })(phase, context);\n };\n}\n"],"mappings":";;;;;AAkBA,SAAgB,aAA4C,EAC1D,eACA,YACA,OAAO,QAAQ,IAAI,KAC4C;CAC/D,cAAc,aAAa;CAC3B,MAAM,mBAAwC,OAAO,YACnD,YAAY,KAAK,KAAK,MAAM,QAAQ,GAAG,EAAE,eAAe,KAAK,CAAC,CAAC,CAC5D,QAAQ,UAAU,MAAM,YAAY,CAAC,CAAC,CACtC,KAAK,UAAU,CAAC,MAAM,MAAM,KAAK,KAAK,MAAM,UAAU,MAAM,IAAI,CAAC,CAAC,CACvE;CACA,OAAO,OAAO,OAAO,YAAY;EAC/B,IAAI,OAAO,KAAK,gBAAgB,CAAC,CAAC,WAAW,GAC3C,OAAO,OAAO,eAAe,aAAa,WAAW,OAAO,OAAO,IAAI;EAEzE,MAAM,EAAE,YAAY,MAAM,OAAO;EACjC,OAAO,QAAQ,YAAY,EAAE,QAAQ,iBAAiB,CAAC,CAAC,CAAC,OAAO,OAAO;CACzE;AACF"}
|
package/dist/client.d.mts
CHANGED
|
@@ -153,11 +153,11 @@ declare class FactoryClient {
|
|
|
153
153
|
limit?: number;
|
|
154
154
|
}): Promise<{
|
|
155
155
|
items: {
|
|
156
|
+
deliveryId: string;
|
|
156
157
|
id: `sig_${string}`;
|
|
157
158
|
schemaVersion: 1;
|
|
158
159
|
repositoryId: `repo_${string}`;
|
|
159
160
|
source: SignalSource;
|
|
160
|
-
deliveryId: string;
|
|
161
161
|
replyTo: {
|
|
162
162
|
channel: string;
|
|
163
163
|
address: string;
|
|
@@ -166,6 +166,7 @@ declare class FactoryClient {
|
|
|
166
166
|
outcome: "pending" | "accepted" | "duplicate" | "unactionable" | "low_confidence" | "ignored";
|
|
167
167
|
repository: string;
|
|
168
168
|
taskIds: `task_${string}`[];
|
|
169
|
+
reason?: string | undefined;
|
|
169
170
|
triage?: {
|
|
170
171
|
attempt: number;
|
|
171
172
|
state: "running" | "blocked" | "uncertain";
|
|
@@ -176,7 +177,6 @@ declare class FactoryClient {
|
|
|
176
177
|
failure?: "cancelled" | "billing_verification_required" | "provider_failed" | "no_decision" | "launch_unconfirmed" | undefined;
|
|
177
178
|
} | undefined;
|
|
178
179
|
detail?: string | undefined;
|
|
179
|
-
reason?: string | undefined;
|
|
180
180
|
decidedAt?: string | undefined;
|
|
181
181
|
tasksNextCursor?: string | null | undefined;
|
|
182
182
|
}[];
|
|
@@ -184,11 +184,11 @@ declare class FactoryClient {
|
|
|
184
184
|
}>;
|
|
185
185
|
/** Retry only the observed stopped attempt; concurrent or stale retries conflict. */
|
|
186
186
|
retryIntake(id: string, expectedAttempt: number): Promise<{
|
|
187
|
+
deliveryId: string;
|
|
187
188
|
id: `sig_${string}`;
|
|
188
189
|
schemaVersion: 1;
|
|
189
190
|
repositoryId: `repo_${string}`;
|
|
190
191
|
source: SignalSource;
|
|
191
|
-
deliveryId: string;
|
|
192
192
|
replyTo: {
|
|
193
193
|
channel: string;
|
|
194
194
|
address: string;
|
|
@@ -197,6 +197,7 @@ declare class FactoryClient {
|
|
|
197
197
|
outcome: "pending" | "accepted" | "duplicate" | "unactionable" | "low_confidence" | "ignored";
|
|
198
198
|
repository: string;
|
|
199
199
|
taskIds: `task_${string}`[];
|
|
200
|
+
reason?: string | undefined;
|
|
200
201
|
triage?: {
|
|
201
202
|
attempt: number;
|
|
202
203
|
state: "running" | "blocked" | "uncertain";
|
|
@@ -207,7 +208,6 @@ declare class FactoryClient {
|
|
|
207
208
|
failure?: "cancelled" | "billing_verification_required" | "provider_failed" | "no_decision" | "launch_unconfirmed" | undefined;
|
|
208
209
|
} | undefined;
|
|
209
210
|
detail?: string | undefined;
|
|
210
|
-
reason?: string | undefined;
|
|
211
211
|
decidedAt?: string | undefined;
|
|
212
212
|
tasksNextCursor?: string | null | undefined;
|
|
213
213
|
}>;
|
|
@@ -60,6 +60,10 @@ declare function requireTaskExecution(stores: Pick<FactoryStores, "tasks">, ctx:
|
|
|
60
60
|
session: Pick<SessionContext["session"], "id" | "auth">;
|
|
61
61
|
}, requestedTaskId: TaskId): Promise<({
|
|
62
62
|
id: `task_${string}`;
|
|
63
|
+
origin: {
|
|
64
|
+
signalId?: `sig_${string}` | undefined;
|
|
65
|
+
operator?: string | undefined;
|
|
66
|
+
};
|
|
63
67
|
schemaVersion: 1;
|
|
64
68
|
replyTo: {
|
|
65
69
|
channel: string;
|
|
@@ -73,10 +77,6 @@ declare function requireTaskExecution(stores: Pick<FactoryStores, "tasks">, ctx:
|
|
|
73
77
|
model?: string | undefined;
|
|
74
78
|
area?: string | undefined;
|
|
75
79
|
approval?: "required" | "granted" | "denied" | undefined;
|
|
76
|
-
origin: {
|
|
77
|
-
signalId?: `sig_${string}` | undefined;
|
|
78
|
-
operator?: string | undefined;
|
|
79
|
-
};
|
|
80
80
|
work: {
|
|
81
81
|
title: string;
|
|
82
82
|
input: JsonValue;
|
|
@@ -136,6 +136,10 @@ declare function requireTaskExecution(stores: Pick<FactoryStores, "tasks">, ctx:
|
|
|
136
136
|
parentTaskId?: `task_${string}`;
|
|
137
137
|
}) | ({
|
|
138
138
|
id: `task_${string}`;
|
|
139
|
+
origin: {
|
|
140
|
+
signalId?: `sig_${string}` | undefined;
|
|
141
|
+
operator?: string | undefined;
|
|
142
|
+
};
|
|
139
143
|
schemaVersion: 1;
|
|
140
144
|
replyTo: {
|
|
141
145
|
channel: string;
|
|
@@ -149,10 +153,6 @@ declare function requireTaskExecution(stores: Pick<FactoryStores, "tasks">, ctx:
|
|
|
149
153
|
model?: string | undefined;
|
|
150
154
|
area?: string | undefined;
|
|
151
155
|
approval?: "required" | "granted" | "denied" | undefined;
|
|
152
|
-
origin: {
|
|
153
|
-
signalId?: `sig_${string}` | undefined;
|
|
154
|
-
operator?: string | undefined;
|
|
155
|
-
};
|
|
156
156
|
work: {
|
|
157
157
|
title: string;
|
|
158
158
|
input: JsonValue;
|
|
@@ -218,6 +218,10 @@ declare function requireTaskExecution(stores: Pick<FactoryStores, "tasks">, ctx:
|
|
|
218
218
|
parentTaskId?: `task_${string}`;
|
|
219
219
|
}) | ({
|
|
220
220
|
id: `task_${string}`;
|
|
221
|
+
origin: {
|
|
222
|
+
signalId?: `sig_${string}` | undefined;
|
|
223
|
+
operator?: string | undefined;
|
|
224
|
+
};
|
|
221
225
|
schemaVersion: 1;
|
|
222
226
|
replyTo: {
|
|
223
227
|
channel: string;
|
|
@@ -231,10 +235,6 @@ declare function requireTaskExecution(stores: Pick<FactoryStores, "tasks">, ctx:
|
|
|
231
235
|
model?: string | undefined;
|
|
232
236
|
area?: string | undefined;
|
|
233
237
|
approval?: "required" | "granted" | "denied" | undefined;
|
|
234
|
-
origin: {
|
|
235
|
-
signalId?: `sig_${string}` | undefined;
|
|
236
|
-
operator?: string | undefined;
|
|
237
|
-
};
|
|
238
238
|
work: {
|
|
239
239
|
title: string;
|
|
240
240
|
input: JsonValue;
|
|
@@ -300,6 +300,10 @@ declare function requireTaskExecution(stores: Pick<FactoryStores, "tasks">, ctx:
|
|
|
300
300
|
parentTaskId: `task_${string}`;
|
|
301
301
|
}) | ({
|
|
302
302
|
id: `task_${string}`;
|
|
303
|
+
origin: {
|
|
304
|
+
signalId?: `sig_${string}` | undefined;
|
|
305
|
+
operator?: string | undefined;
|
|
306
|
+
};
|
|
303
307
|
schemaVersion: 1;
|
|
304
308
|
replyTo: {
|
|
305
309
|
channel: string;
|
|
@@ -313,10 +317,6 @@ declare function requireTaskExecution(stores: Pick<FactoryStores, "tasks">, ctx:
|
|
|
313
317
|
model?: string | undefined;
|
|
314
318
|
area?: string | undefined;
|
|
315
319
|
approval?: "required" | "granted" | "denied" | undefined;
|
|
316
|
-
origin: {
|
|
317
|
-
signalId?: `sig_${string}` | undefined;
|
|
318
|
-
operator?: string | undefined;
|
|
319
|
-
};
|
|
320
320
|
work: {
|
|
321
321
|
title: string;
|
|
322
322
|
input: JsonValue;
|
package/dist/github.d.mts
CHANGED
|
@@ -65,6 +65,10 @@ interface GitHubRepositoryRequest {
|
|
|
65
65
|
interface GitHubPullRequestTarget extends GitHubRepositoryRequest {
|
|
66
66
|
pullRequestNumber: number;
|
|
67
67
|
}
|
|
68
|
+
/** Repository-scoped identity of one GitHub issue. */
|
|
69
|
+
interface GitHubIssueTarget extends GitHubRepositoryRequest {
|
|
70
|
+
issueNumber: number;
|
|
71
|
+
}
|
|
68
72
|
/** Provider-owned number and URL that identify one GitHub pull request. */
|
|
69
73
|
interface GitHubPullRequestReference {
|
|
70
74
|
pullRequestNumber: number;
|
|
@@ -190,6 +194,12 @@ type ListPullRequestCommentsInput = GitHubPullRequestTarget;
|
|
|
190
194
|
interface CreatePullRequestCommentInput extends ListPullRequestCommentsInput {
|
|
191
195
|
body: string;
|
|
192
196
|
}
|
|
197
|
+
/** Repository issue whose comments should be listed. */
|
|
198
|
+
type ListIssueCommentsInput = GitHubIssueTarget;
|
|
199
|
+
/** Repository issue and body for a new comment. */
|
|
200
|
+
interface CreateIssueCommentInput extends GitHubIssueTarget {
|
|
201
|
+
body: string;
|
|
202
|
+
}
|
|
193
203
|
/** Existing issue-style comment and replacement body to persist. */
|
|
194
204
|
interface UpdatePullRequestCommentInput extends GitHubRepositoryRequest {
|
|
195
205
|
commentId: number;
|
|
@@ -199,6 +209,10 @@ interface UpdatePullRequestCommentInput extends GitHubRepositoryRequest {
|
|
|
199
209
|
interface PullRequestLabelInput extends GitHubPullRequestTarget {
|
|
200
210
|
label: string;
|
|
201
211
|
}
|
|
212
|
+
/** Repository issue and label targeted by a metadata-only label operation. */
|
|
213
|
+
interface IssueLabelInput extends GitHubIssueTarget {
|
|
214
|
+
label: string;
|
|
215
|
+
}
|
|
202
216
|
/** Repository label to create when absent, retaining any existing color and description. */
|
|
203
217
|
interface EnsureGitHubLabelInput extends GitHubRepositoryRequest {
|
|
204
218
|
name: string;
|
|
@@ -320,10 +334,14 @@ declare function updateCheckRun(input: UpdateCheckRunInput): Promise<GitHubCheck
|
|
|
320
334
|
declare function listCheckRunsForRef(input: ListCheckRunsForRefInput): Promise<readonly GitHubCheckRun[]>;
|
|
321
335
|
/** List every issue-style comment in a pull request conversation. */
|
|
322
336
|
declare function listPullRequestComments(input: ListPullRequestCommentsInput): Promise<readonly GitHubIssueComment[]>;
|
|
337
|
+
/** List issue comments with a ten-page bound so reconciliation never scans without limit. */
|
|
338
|
+
declare function listIssueComments(input: ListIssueCommentsInput): Promise<readonly GitHubIssueComment[]>;
|
|
323
339
|
/** Read a page of all PR discussion types without treating any author's text as authorization. */
|
|
324
340
|
declare function listPullRequestDiscussion(input: ListPullRequestDiscussionInput): Promise<GitHubPullRequestDiscussionPage>;
|
|
325
341
|
/** Add one issue-style comment to a pull request conversation. */
|
|
326
342
|
declare function createPullRequestComment(input: CreatePullRequestCommentInput): Promise<GitHubIssueComment>;
|
|
343
|
+
/** Add one issue comment and return GitHub's persisted identity. */
|
|
344
|
+
declare function createIssueComment(input: CreateIssueCommentInput): Promise<GitHubIssueComment>;
|
|
327
345
|
/** Edit one issue-style pull request comment. */
|
|
328
346
|
declare function updatePullRequestComment(input: UpdatePullRequestCommentInput): Promise<GitHubIssueComment>;
|
|
329
347
|
/** One issue comment as GitHub reports it, with the issue it belongs to. */
|
|
@@ -358,6 +376,8 @@ declare function listOpenPullRequests(input: ListOpenPullRequestsInput): Promise
|
|
|
358
376
|
declare function ensureGitHubLabel(input: EnsureGitHubLabelInput): Promise<void>;
|
|
359
377
|
/** Add one label to a pull request. */
|
|
360
378
|
declare function addLabel(input: PullRequestLabelInput): Promise<readonly string[]>;
|
|
379
|
+
/** Add one existing repository label to an issue. */
|
|
380
|
+
declare function addIssueLabel(input: IssueLabelInput): Promise<readonly string[]>;
|
|
361
381
|
/** Remove one label from a pull request. */
|
|
362
382
|
declare function removeLabel(input: PullRequestLabelInput): Promise<readonly string[]>;
|
|
363
383
|
/** Raw payload, shared secret, and provider signature used for webhook verification. */
|
|
@@ -450,5 +470,5 @@ declare function normalizeGitHubPullRequestClosed(options: WebhookEvent): GitHub
|
|
|
450
470
|
/** Normalize a completed, unsuccessful GitHub Actions run into a CI failure signal. */
|
|
451
471
|
declare function normalizeGitHubWorkflowRunFailure(options: WebhookEvent): GitHubCiFailureSignal | null;
|
|
452
472
|
//#endregion
|
|
453
|
-
export { AnswerReviewCommentInput, CheckRunAnnotation, CheckRunAnnotationLevel, CheckRunConclusion, CheckRunFields, CheckRunOutput, CheckRunProgressStatus, type CheckoutGitHubRepositoryInput, type CommittedGitChange, CompletedCheckRunFields, ConfiguredEventRepositoryInput, ConflictedGitHubPullRequest, CreateCheckRunInput, type CreateGitHubBranchInput, type CreateGitHubCommitInput, type CreateGitHubPublicationPullRequestInput, type CreateGitHubTreeInput, CreatePullRequestCommentInput, CreatePullRequestInput, type CreatedGitHubPublicationPullRequest, CreatedGitHubPullRequest, EnsureGitHubLabelInput, FactoryMentionOptions, FactoryQuestionReply, FactoryReviewComment, type FetchGitHubBundleInput, type FetchGitHubRefsInput, type GitHubAppFactoryInput, type GitHubAppInstallationToken, type GitHubAppLike, type GitHubAppPermissions, GitHubCheckRun, GitHubCheckoutConflictError, GitHubCiFailureSignal, type GitHubCommit, GitHubDefaultBranchPush, type GitHubGitTransport, GitHubIssueComment, GitHubIssueCommentRecord, GitHubIssueSignal, GitHubPublicationApiError, type GitHubPublicationClient, type GitHubPublicationClientOptions, type GitHubPublicationLimits, type GitHubPublicationPullRequest, GitHubPullRequest, GitHubPullRequestClosed, GitHubPullRequestDiscussionComment, GitHubPullRequestDiscussionPage, GitHubPullRequestDiscussionReview, GitHubPullRequestHead, GitHubPullRequestReference, GitHubPullRequestSignal, GitHubPullRequestTarget, type GitHubRefMapping, GitHubRepositoryAuthorRequest, type GitHubRepositoryBundle, GitHubRepositoryRequest, GitHubReviewComment, GitHubReviewCommentAuthorError, type GitHubTreeDeletion, type GitHubTreeEntry, type GitHubTreeUpsert, type GitTransferSandbox, IncompleteCheckRunFields, ListCheckRunsForRefInput, ListConflictedPullRequestsInput, type ListGitHubPublicationPullRequestsInput, ListOpenPullRequestsInput, ListPullRequestCommentsInput, ListPullRequestDiscussionInput, type MarkGitHubPullRequestReadyInput, type MintGitHubAppInstallationTokenInput, NormalizeFactoryCommentInput, NormalizeFactoryReviewCommentInput, ObservedCheckRunStatus, PullRequestLabelInput, PullRequestReviewComment, PullRequestReviewEvent, type PushGitHubBundleInput, type PushGitHubHeadInput, type ReadCommittedGitChangeInput, type ReadGitHubBranchHeadInput, type ReadGitHubCommitInput, type ReadGitHubPullRequestInput, type ReadGitTransferFileInput, ReadReviewCommentInput, ReviewCommentAuthorPolicy, type RunSandboxGitInput, type SandboxGit, type SandboxGitCommandInput, type SandboxGitCommandResult, StalePullRequestHeadError, SubmitPullRequestReviewInput, SubmittedPullRequestReview, UpdateCheckRunInput, type UpdateGitHubBranchInput, UpdatePullRequestCommentInput, VerifyGitHubSignatureInput, type WithSandboxGitBundleInput, type WriteGitTransferFileInput, addLabel, answerReviewComment, checkoutGitHubRepository, closePullRequest, configuredEventRepositorySlug, createCheckRun, createGitHubPublicationClient, createPullRequest, createPullRequestComment, ensureGitHubLabel, factorySessionBranch, factoryTaskBranch, hasGitHubRepositoryWriteAccess, isSafeGitRef, listCheckRunsForRef, listConflictedPullRequests, listOpenPullRequests, listPullRequestComments, listPullRequestDiscussion, mintGitHubAppInstallationToken, normalizeFactoryQuestionReply, normalizeFactoryReviewComment, normalizeGitHubDefaultBranchPush, normalizeGitHubIssueOpened, normalizeGitHubPullRequest, normalizeGitHubPullRequestClosed, normalizeGitHubWorkflowRunFailure, readCommittedGitChange, readIssueComment, readPullRequest, readPullRequestHead, readReviewComment, removeLabel, runSandboxGit, stripFactoryQuestionMention, submitPullRequestReview, updateCheckRun, updatePullRequestComment, verifyGitHubSignature };
|
|
473
|
+
export { AnswerReviewCommentInput, CheckRunAnnotation, CheckRunAnnotationLevel, CheckRunConclusion, CheckRunFields, CheckRunOutput, CheckRunProgressStatus, type CheckoutGitHubRepositoryInput, type CommittedGitChange, CompletedCheckRunFields, ConfiguredEventRepositoryInput, ConflictedGitHubPullRequest, CreateCheckRunInput, type CreateGitHubBranchInput, type CreateGitHubCommitInput, type CreateGitHubPublicationPullRequestInput, type CreateGitHubTreeInput, CreateIssueCommentInput, CreatePullRequestCommentInput, CreatePullRequestInput, type CreatedGitHubPublicationPullRequest, CreatedGitHubPullRequest, EnsureGitHubLabelInput, FactoryMentionOptions, FactoryQuestionReply, FactoryReviewComment, type FetchGitHubBundleInput, type FetchGitHubRefsInput, type GitHubAppFactoryInput, type GitHubAppInstallationToken, type GitHubAppLike, type GitHubAppPermissions, GitHubCheckRun, GitHubCheckoutConflictError, GitHubCiFailureSignal, type GitHubCommit, GitHubDefaultBranchPush, type GitHubGitTransport, GitHubIssueComment, GitHubIssueCommentRecord, GitHubIssueSignal, GitHubIssueTarget, GitHubPublicationApiError, type GitHubPublicationClient, type GitHubPublicationClientOptions, type GitHubPublicationLimits, type GitHubPublicationPullRequest, GitHubPullRequest, GitHubPullRequestClosed, GitHubPullRequestDiscussionComment, GitHubPullRequestDiscussionPage, GitHubPullRequestDiscussionReview, GitHubPullRequestHead, GitHubPullRequestReference, GitHubPullRequestSignal, GitHubPullRequestTarget, type GitHubRefMapping, GitHubRepositoryAuthorRequest, type GitHubRepositoryBundle, GitHubRepositoryRequest, GitHubReviewComment, GitHubReviewCommentAuthorError, type GitHubTreeDeletion, type GitHubTreeEntry, type GitHubTreeUpsert, type GitTransferSandbox, IncompleteCheckRunFields, IssueLabelInput, ListCheckRunsForRefInput, ListConflictedPullRequestsInput, type ListGitHubPublicationPullRequestsInput, ListIssueCommentsInput, ListOpenPullRequestsInput, ListPullRequestCommentsInput, ListPullRequestDiscussionInput, type MarkGitHubPullRequestReadyInput, type MintGitHubAppInstallationTokenInput, NormalizeFactoryCommentInput, NormalizeFactoryReviewCommentInput, ObservedCheckRunStatus, PullRequestLabelInput, PullRequestReviewComment, PullRequestReviewEvent, type PushGitHubBundleInput, type PushGitHubHeadInput, type ReadCommittedGitChangeInput, type ReadGitHubBranchHeadInput, type ReadGitHubCommitInput, type ReadGitHubPullRequestInput, type ReadGitTransferFileInput, ReadReviewCommentInput, ReviewCommentAuthorPolicy, type RunSandboxGitInput, type SandboxGit, type SandboxGitCommandInput, type SandboxGitCommandResult, StalePullRequestHeadError, SubmitPullRequestReviewInput, SubmittedPullRequestReview, UpdateCheckRunInput, type UpdateGitHubBranchInput, UpdatePullRequestCommentInput, VerifyGitHubSignatureInput, type WithSandboxGitBundleInput, type WriteGitTransferFileInput, addIssueLabel, addLabel, answerReviewComment, checkoutGitHubRepository, closePullRequest, configuredEventRepositorySlug, createCheckRun, createGitHubPublicationClient, createIssueComment, createPullRequest, createPullRequestComment, ensureGitHubLabel, factorySessionBranch, factoryTaskBranch, hasGitHubRepositoryWriteAccess, isSafeGitRef, listCheckRunsForRef, listConflictedPullRequests, listIssueComments, listOpenPullRequests, listPullRequestComments, listPullRequestDiscussion, mintGitHubAppInstallationToken, normalizeFactoryQuestionReply, normalizeFactoryReviewComment, normalizeGitHubDefaultBranchPush, normalizeGitHubIssueOpened, normalizeGitHubPullRequest, normalizeGitHubPullRequestClosed, normalizeGitHubWorkflowRunFailure, readCommittedGitChange, readIssueComment, readPullRequest, readPullRequestHead, readReviewComment, removeLabel, runSandboxGit, stripFactoryQuestionMention, submitPullRequestReview, updateCheckRun, updatePullRequestComment, verifyGitHubSignature };
|
|
454
474
|
//# sourceMappingURL=github.d.mts.map
|
package/dist/github.mjs
CHANGED
|
@@ -311,6 +311,16 @@ async function listPullRequestComments(input) {
|
|
|
311
311
|
if (response.length < 100) return comments;
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
|
+
/** List issue comments with a ten-page bound so reconciliation never scans without limit. */
|
|
315
|
+
async function listIssueComments(input) {
|
|
316
|
+
const comments = [];
|
|
317
|
+
for (let page = 1; page <= 10; page += 1) {
|
|
318
|
+
const response = z.array(issueCommentSchema).max(100).parse(await gitHubRequest(input, `/issues/${positiveInteger(input.issueNumber, "issueNumber")}/comments?per_page=100&page=${page}`));
|
|
319
|
+
comments.push(...response.map(parseIssueComment));
|
|
320
|
+
if (response.length < 100) return comments;
|
|
321
|
+
}
|
|
322
|
+
throw new Error("Issue comment lookup is incomplete after ten pages");
|
|
323
|
+
}
|
|
314
324
|
/** Read a page of all PR discussion types without treating any author's text as authorization. */
|
|
315
325
|
async function listPullRequestDiscussion(input) {
|
|
316
326
|
const page = z.number().int().positive().parse(input.page ?? 1);
|
|
@@ -363,6 +373,13 @@ async function createPullRequestComment(input) {
|
|
|
363
373
|
body: JSON.stringify({ body: input.body })
|
|
364
374
|
}));
|
|
365
375
|
}
|
|
376
|
+
/** Add one issue comment and return GitHub's persisted identity. */
|
|
377
|
+
async function createIssueComment(input) {
|
|
378
|
+
return parseIssueComment(await gitHubRequest(input, `/issues/${positiveInteger(input.issueNumber, "issueNumber")}/comments`, {
|
|
379
|
+
method: "POST",
|
|
380
|
+
body: JSON.stringify({ body: input.body })
|
|
381
|
+
}));
|
|
382
|
+
}
|
|
366
383
|
/** Edit one issue-style pull request comment. */
|
|
367
384
|
async function updatePullRequestComment(input) {
|
|
368
385
|
return parseIssueComment(await gitHubRequest(input, `/issues/comments/${positiveInteger(input.commentId, "commentId")}`, {
|
|
@@ -557,6 +574,13 @@ async function addLabel(input) {
|
|
|
557
574
|
body: JSON.stringify({ labels: [input.label] })
|
|
558
575
|
}));
|
|
559
576
|
}
|
|
577
|
+
/** Add one existing repository label to an issue. */
|
|
578
|
+
async function addIssueLabel(input) {
|
|
579
|
+
return parseLabels(await gitHubRequest(input, `/issues/${positiveInteger(input.issueNumber, "issueNumber")}/labels`, {
|
|
580
|
+
method: "POST",
|
|
581
|
+
body: JSON.stringify({ labels: [input.label] })
|
|
582
|
+
}));
|
|
583
|
+
}
|
|
560
584
|
/** Remove one label from a pull request. */
|
|
561
585
|
async function removeLabel(input) {
|
|
562
586
|
return parseLabels(await gitHubRequest(input, `/issues/${positiveInteger(input.pullRequestNumber, "pullRequestNumber")}/labels/${encodeURIComponent(input.label)}`, { method: "DELETE" }));
|
|
@@ -902,6 +926,6 @@ function normalizeGitHubWorkflowRunFailure(options) {
|
|
|
902
926
|
};
|
|
903
927
|
}
|
|
904
928
|
//#endregion
|
|
905
|
-
export { GitHubCheckoutConflictError, GitHubPublicationApiError, GitHubReviewCommentAuthorError, StalePullRequestHeadError, addLabel, answerReviewComment, checkoutGitHubRepository, closePullRequest, configuredEventRepositorySlug, createCheckRun, createGitHubPublicationClient, createPullRequest, createPullRequestComment, ensureGitHubLabel, factorySessionBranch, factoryTaskBranch, hasGitHubRepositoryWriteAccess, isSafeGitRef, listCheckRunsForRef, listConflictedPullRequests, listOpenPullRequests, listPullRequestComments, listPullRequestDiscussion, mintGitHubAppInstallationToken, normalizeFactoryQuestionReply, normalizeFactoryReviewComment, normalizeGitHubDefaultBranchPush, normalizeGitHubIssueOpened, normalizeGitHubPullRequest, normalizeGitHubPullRequestClosed, normalizeGitHubWorkflowRunFailure, readCommittedGitChange, readIssueComment, readPullRequest, readPullRequestHead, readReviewComment, removeLabel, runSandboxGit, stripFactoryQuestionMention, submitPullRequestReview, updateCheckRun, updatePullRequestComment, verifyGitHubSignature };
|
|
929
|
+
export { GitHubCheckoutConflictError, GitHubPublicationApiError, GitHubReviewCommentAuthorError, StalePullRequestHeadError, addIssueLabel, addLabel, answerReviewComment, checkoutGitHubRepository, closePullRequest, configuredEventRepositorySlug, createCheckRun, createGitHubPublicationClient, createIssueComment, createPullRequest, createPullRequestComment, ensureGitHubLabel, factorySessionBranch, factoryTaskBranch, hasGitHubRepositoryWriteAccess, isSafeGitRef, listCheckRunsForRef, listConflictedPullRequests, listIssueComments, listOpenPullRequests, listPullRequestComments, listPullRequestDiscussion, mintGitHubAppInstallationToken, normalizeFactoryQuestionReply, normalizeFactoryReviewComment, normalizeGitHubDefaultBranchPush, normalizeGitHubIssueOpened, normalizeGitHubPullRequest, normalizeGitHubPullRequestClosed, normalizeGitHubWorkflowRunFailure, readCommittedGitChange, readIssueComment, readPullRequest, readPullRequestHead, readReviewComment, removeLabel, runSandboxGit, stripFactoryQuestionMention, submitPullRequestReview, updateCheckRun, updatePullRequestComment, verifyGitHubSignature };
|
|
906
930
|
|
|
907
931
|
//# sourceMappingURL=github.mjs.map
|