@vercel/factory 0.0.2 → 0.0.3
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/chunk-2JFES6BA.js +41 -0
- package/dist/chunk-2JFES6BA.js.map +1 -0
- package/dist/chunk-D2XMABG4.js +311 -0
- package/dist/chunk-D2XMABG4.js.map +1 -0
- package/dist/{chunk-LBEYCOSR.js → chunk-EFL4PDDE.js} +68 -94
- package/dist/chunk-EFL4PDDE.js.map +1 -0
- package/dist/connectors/index.d.ts +53 -0
- package/dist/connectors/index.js +64 -0
- package/dist/connectors/index.js.map +1 -0
- package/dist/eve/index.d.ts +92 -1
- package/dist/eve/index.js +226 -75
- package/dist/eve/index.js.map +1 -1
- package/dist/github.d.ts +139 -0
- package/dist/github.js +27 -0
- package/dist/github.js.map +1 -0
- package/dist/index.js +15 -13
- package/dist/index.js.map +1 -1
- package/package.json +8 -4
- package/dist/chunk-LBEYCOSR.js.map +0 -1
- package/dist/connectors/github.d.ts +0 -62
- package/dist/connectors/github.js +0 -112
- package/dist/connectors/github.js.map +0 -1
package/dist/eve/index.js
CHANGED
|
@@ -1,32 +1,133 @@
|
|
|
1
|
+
import {
|
|
2
|
+
answerReviewComment,
|
|
3
|
+
readReviewComment
|
|
4
|
+
} from "../chunk-D2XMABG4.js";
|
|
1
5
|
import {
|
|
2
6
|
changeEvidenceSchema,
|
|
3
|
-
changeIdSchema,
|
|
4
7
|
defaultApprovalPolicy,
|
|
5
8
|
dispatchTask,
|
|
6
9
|
findingFingerprint,
|
|
7
10
|
findingSchema,
|
|
8
11
|
levelSchema,
|
|
9
|
-
repositoryIdSchema,
|
|
10
12
|
requiresApproval,
|
|
13
|
+
taskQuestionSchema
|
|
14
|
+
} from "../chunk-EFL4PDDE.js";
|
|
15
|
+
import {
|
|
16
|
+
changeIdSchema,
|
|
17
|
+
repositoryIdSchema,
|
|
11
18
|
signalIdSchema,
|
|
12
19
|
taskIdSchema,
|
|
13
|
-
taskQuestionSchema,
|
|
14
20
|
vocabularySchema
|
|
15
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-2JFES6BA.js";
|
|
16
22
|
import "../chunk-CEF6VJZC.js";
|
|
17
23
|
|
|
18
24
|
// src/eve/index.ts
|
|
19
25
|
import { defineHook } from "eve/hooks";
|
|
20
|
-
import { defineTool as
|
|
21
|
-
import { z as
|
|
26
|
+
import { defineTool as defineTool8 } from "eve/tools";
|
|
27
|
+
import { z as z8 } from "zod";
|
|
28
|
+
|
|
29
|
+
// src/eve/conflict.ts
|
|
30
|
+
import { z } from "zod";
|
|
31
|
+
import { defineTool } from "eve/tools";
|
|
32
|
+
var gitShaSchema = z.string().regex(/^[0-9a-f]{40}$/);
|
|
33
|
+
var gitBranchSchema = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._/-]*$/).refine((value) => !value.includes(".."));
|
|
34
|
+
var mergeConflictPayloadSchema = z.strictObject({
|
|
35
|
+
repository: z.string().regex(/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/),
|
|
36
|
+
prNumber: z.number().int().positive(),
|
|
37
|
+
prUrl: z.url(),
|
|
38
|
+
headBranch: gitBranchSchema.refine((value) => value.startsWith("factory/")),
|
|
39
|
+
headSha: gitShaSchema,
|
|
40
|
+
baseBranch: gitBranchSchema,
|
|
41
|
+
baseSha: gitShaSchema
|
|
42
|
+
});
|
|
43
|
+
function mergeConflictTools(stores, options) {
|
|
44
|
+
const repoPath = options.repoPath ?? "repo";
|
|
45
|
+
async function context(taskId) {
|
|
46
|
+
const task = await stores.tasks.get(taskId);
|
|
47
|
+
if (task === null) throw new Error(`task ${taskId} does not exist`);
|
|
48
|
+
if (task.kind !== "merge_conflict") throw new Error(`task ${taskId} is ${task.kind}, not merge_conflict`);
|
|
49
|
+
if (task.state !== "running") throw new Error(`task ${taskId} is ${task.state}, not running`);
|
|
50
|
+
if (task.origin.signalId === void 0) throw new Error(`task ${taskId} has no conflict signal`);
|
|
51
|
+
const signal = await stores.signals.get(task.origin.signalId);
|
|
52
|
+
if (signal === null || signal.source !== "github_merge_conflict") {
|
|
53
|
+
throw new Error(`task ${taskId} has no GitHub merge conflict signal`);
|
|
54
|
+
}
|
|
55
|
+
return { task, conflict: mergeConflictPayloadSchema.parse(signal.payload) };
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
fetch_merge_conflict: defineTool({
|
|
59
|
+
description: "Fetch the conflicted factory pull request and its current base, check out the PR head, and start the merge. Resolve every file returned in conflictedFiles, then test and commit the merge.",
|
|
60
|
+
inputSchema: z.object({ taskId: taskIdSchema }),
|
|
61
|
+
async execute({ taskId }, ctx) {
|
|
62
|
+
const { conflict } = await context(taskId);
|
|
63
|
+
const sandbox = await ctx.getSandbox();
|
|
64
|
+
const git = `git -C ${repoPath}`;
|
|
65
|
+
const headRef = `refs/remotes/origin/conflict-pr-${conflict.prNumber}`;
|
|
66
|
+
const baseRef = `refs/remotes/origin/conflict-base-${conflict.prNumber}`;
|
|
67
|
+
const fetch2 = await options.withCredential(
|
|
68
|
+
sandbox,
|
|
69
|
+
conflict.repository,
|
|
70
|
+
`${git} fetch --depth 100 origin +refs/pull/${conflict.prNumber}/head:${headRef} +refs/heads/${conflict.baseBranch}:${baseRef}`
|
|
71
|
+
);
|
|
72
|
+
if (typeof fetch2.exitCode === "number" && fetch2.exitCode !== 0) {
|
|
73
|
+
throw new Error(`could not fetch pull request: ${(fetch2.stderr ?? "").trim()}`);
|
|
74
|
+
}
|
|
75
|
+
const fetched = await sandbox.run({
|
|
76
|
+
command: `${git} rev-parse ${headRef} && ${git} rev-parse ${baseRef}`
|
|
77
|
+
});
|
|
78
|
+
const [headSha, baseSha] = fetched.stdout.trim().split("\n");
|
|
79
|
+
if (headSha !== conflict.headSha || baseSha !== conflict.baseSha) {
|
|
80
|
+
throw new Error("pull request or base changed while conflict resolution was starting; retry from a new task");
|
|
81
|
+
}
|
|
82
|
+
await sandbox.run({ command: `${git} checkout -B conflict-pr ${headRef}` });
|
|
83
|
+
const merge = await sandbox.run({ command: `${git} merge --no-commit --no-ff ${baseRef}` });
|
|
84
|
+
const conflicts = await sandbox.run({ command: `${git} diff --name-only --diff-filter=U` });
|
|
85
|
+
const conflictedFiles = conflicts.stdout.trim().split("\n").filter(Boolean);
|
|
86
|
+
if (conflictedFiles.length === 0) {
|
|
87
|
+
throw new Error(
|
|
88
|
+
typeof merge.exitCode === "number" && merge.exitCode !== 0 ? `merge failed without file conflicts: ${(merge.stderr ?? "").trim()}` : "pull request no longer has merge conflicts"
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
return { ...conflict, conflictedFiles };
|
|
92
|
+
}
|
|
93
|
+
}),
|
|
94
|
+
publish_merge_resolution: defineTool({
|
|
95
|
+
description: "Publish a tested, committed conflict resolution to the existing pull request branch. Fails if the remote branch changed since this task started.",
|
|
96
|
+
inputSchema: z.object({
|
|
97
|
+
taskId: taskIdSchema,
|
|
98
|
+
summary: z.string().min(1).max(2e3)
|
|
99
|
+
}),
|
|
100
|
+
async execute({ taskId, summary }, ctx) {
|
|
101
|
+
const { conflict } = await context(taskId);
|
|
102
|
+
const sandbox = await ctx.getSandbox();
|
|
103
|
+
const git = `git -C ${repoPath}`;
|
|
104
|
+
const clean = await sandbox.run({ command: `${git} status --porcelain` });
|
|
105
|
+
if (clean.stdout.trim() !== "") throw new Error("commit the conflict resolution before publishing");
|
|
106
|
+
const unresolved = await sandbox.run({ command: `${git} diff --name-only --diff-filter=U` });
|
|
107
|
+
if (unresolved.stdout.trim() !== "") throw new Error("merge conflicts remain unresolved");
|
|
108
|
+
const push = await options.withCredential(
|
|
109
|
+
sandbox,
|
|
110
|
+
conflict.repository,
|
|
111
|
+
`${git} push --force-with-lease=refs/heads/${conflict.headBranch}:${conflict.headSha} origin HEAD:refs/heads/${conflict.headBranch}`
|
|
112
|
+
);
|
|
113
|
+
if (typeof push.exitCode === "number" && push.exitCode !== 0) {
|
|
114
|
+
throw new Error(`could not update pull request branch: ${(push.stderr ?? "").trim()}`);
|
|
115
|
+
}
|
|
116
|
+
await stores.tasks.transition(taskId, "verifying", { reason: summary });
|
|
117
|
+
await stores.tasks.transition(taskId, "succeeded", { reason: summary });
|
|
118
|
+
return { updated: true, prNumber: conflict.prNumber, prUrl: conflict.prUrl };
|
|
119
|
+
}
|
|
120
|
+
})
|
|
121
|
+
};
|
|
122
|
+
}
|
|
22
123
|
|
|
23
124
|
// src/eve/deepsec.ts
|
|
24
|
-
import { defineTool as
|
|
25
|
-
import { z as
|
|
125
|
+
import { defineTool as defineTool3 } from "eve/tools";
|
|
126
|
+
import { z as z3 } from "zod";
|
|
26
127
|
|
|
27
128
|
// src/eve/finding.ts
|
|
28
|
-
import { defineTool } from "eve/tools";
|
|
29
|
-
import { z } from "zod";
|
|
129
|
+
import { defineTool as defineTool2 } from "eve/tools";
|
|
130
|
+
import { z as z2 } from "zod";
|
|
30
131
|
async function recordFinding(stores, repositoryId, finding, options = {}) {
|
|
31
132
|
const source = options.source ?? "security_scan";
|
|
32
133
|
const policy = options.approval ?? defaultApprovalPolicy;
|
|
@@ -60,9 +161,9 @@ async function recordFinding(stores, repositoryId, finding, options = {}) {
|
|
|
60
161
|
return { recorded: true, signalId: signal.id, taskId: task.id, approval: approval ? "required" : "not_required" };
|
|
61
162
|
}
|
|
62
163
|
function recordFindingTool(stores, options = {}) {
|
|
63
|
-
return
|
|
164
|
+
return defineTool2({
|
|
64
165
|
description: "Record one problem you found in the repository. Creates a fix task (which may wait for human approval) unless the same finding was already recorded. Report every finding separately; never batch.",
|
|
65
|
-
inputSchema:
|
|
166
|
+
inputSchema: z2.object({
|
|
66
167
|
repositoryId: repositoryIdSchema,
|
|
67
168
|
finding: findingSchema
|
|
68
169
|
}),
|
|
@@ -73,21 +174,21 @@ function recordFindingTool(stores, options = {}) {
|
|
|
73
174
|
}
|
|
74
175
|
|
|
75
176
|
// src/eve/deepsec.ts
|
|
76
|
-
var deepsecFindingSchema =
|
|
77
|
-
title:
|
|
78
|
-
description:
|
|
79
|
-
severity:
|
|
80
|
-
metadata:
|
|
81
|
-
filePath:
|
|
82
|
-
lineNumbers:
|
|
83
|
-
vulnSlug:
|
|
84
|
-
confidence:
|
|
85
|
-
runId:
|
|
177
|
+
var deepsecFindingSchema = z3.looseObject({
|
|
178
|
+
title: z3.string().min(1),
|
|
179
|
+
description: z3.string().min(1),
|
|
180
|
+
severity: z3.string().min(1),
|
|
181
|
+
metadata: z3.looseObject({
|
|
182
|
+
filePath: z3.string().min(1).optional(),
|
|
183
|
+
lineNumbers: z3.array(z3.number().int().min(1)).optional(),
|
|
184
|
+
vulnSlug: z3.string().min(1).optional(),
|
|
185
|
+
confidence: z3.string().optional(),
|
|
186
|
+
runId: z3.string().optional()
|
|
86
187
|
}).optional()
|
|
87
188
|
});
|
|
88
|
-
var deepsecExportSchema =
|
|
89
|
-
|
|
90
|
-
|
|
189
|
+
var deepsecExportSchema = z3.union([
|
|
190
|
+
z3.array(deepsecFindingSchema),
|
|
191
|
+
z3.looseObject({ findings: z3.array(deepsecFindingSchema) }).transform((value) => value.findings)
|
|
91
192
|
]);
|
|
92
193
|
var priorityBySeverity = {
|
|
93
194
|
CRITICAL: "P0",
|
|
@@ -140,11 +241,11 @@ function deepsecScanTool(stores, options) {
|
|
|
140
241
|
const concurrency = options.concurrency ?? 4;
|
|
141
242
|
const prefix = options.commandPrefix === void 0 ? [] : [options.commandPrefix];
|
|
142
243
|
const filesPerRun = options.filesPerRun ?? 40;
|
|
143
|
-
return
|
|
244
|
+
return defineTool3({
|
|
144
245
|
description: "Run deepsec, the AI-powered vulnerability scanner, over the repository checkout and record every finding it reports as a fix task. Takes minutes. Call once per scan; then summarize the result.",
|
|
145
|
-
inputSchema:
|
|
246
|
+
inputSchema: z3.object({
|
|
146
247
|
repositoryId: repositoryIdSchema,
|
|
147
|
-
limit:
|
|
248
|
+
limit: z3.number().int().min(1).max(500).optional().describe("Candidate files to investigate this run (default 40; deepsec resumes where it left off next time).")
|
|
148
249
|
}),
|
|
149
250
|
async execute({ repositoryId, limit }, ctx) {
|
|
150
251
|
const repository = await stores.repositories.get(repositoryId);
|
|
@@ -248,14 +349,14 @@ ${investigate.stderr ?? ""}`, 6)}`
|
|
|
248
349
|
}
|
|
249
350
|
|
|
250
351
|
// src/eve/fetch.ts
|
|
251
|
-
import { defineTool as
|
|
252
|
-
import { z as
|
|
352
|
+
import { defineTool as defineTool4 } from "eve/tools";
|
|
353
|
+
import { z as z4 } from "zod";
|
|
253
354
|
function fetchPullRequestTool(stores, options) {
|
|
254
355
|
const repoPath = options.repoPath ?? "repo";
|
|
255
356
|
const depth = options.depth ?? 50;
|
|
256
|
-
return
|
|
357
|
+
return defineTool4({
|
|
257
358
|
description: "Fetch the pull request under review into the checkout and check it out as the local branch `pr`. Call this after get_task, before inspecting or testing the change. Returns the PR number, URL, and the commit you are now on.",
|
|
258
|
-
inputSchema:
|
|
359
|
+
inputSchema: z4.object({
|
|
259
360
|
changeId: changeIdSchema.describe("The change under review, from your starting message.")
|
|
260
361
|
}),
|
|
261
362
|
async execute({ changeId }, ctx) {
|
|
@@ -297,19 +398,19 @@ function fetchPullRequestTool(stores, options) {
|
|
|
297
398
|
}
|
|
298
399
|
|
|
299
400
|
// src/eve/invoke.ts
|
|
300
|
-
import { defineTool as
|
|
301
|
-
import { z as
|
|
401
|
+
import { defineTool as defineTool5 } from "eve/tools";
|
|
402
|
+
import { z as z5 } from "zod";
|
|
302
403
|
function invokeAgentTool(stores, options) {
|
|
303
404
|
const doFetch = options.fetch ?? fetch;
|
|
304
|
-
return
|
|
405
|
+
return defineTool5({
|
|
305
406
|
description: `${options.description} Hands the work to a separate agent in a fresh session; you will not see its reasoning. Returns the handoff task id.`,
|
|
306
|
-
inputSchema:
|
|
307
|
-
repositoryIds:
|
|
407
|
+
inputSchema: z5.object({
|
|
408
|
+
repositoryIds: z5.array(repositoryIdSchema).min(1),
|
|
308
409
|
parentTaskId: taskIdSchema.optional().describe("Your own task, when this work continues it."),
|
|
309
410
|
changeId: changeIdSchema.optional().describe("The change the target agent should work on."),
|
|
310
|
-
channel:
|
|
311
|
-
address:
|
|
312
|
-
brief:
|
|
411
|
+
channel: z5.string().min(1).describe("Reply connector, e.g. github."),
|
|
412
|
+
address: z5.string().min(1).describe("Reply address, e.g. acme/web#41."),
|
|
413
|
+
brief: z5.string().min(1).max(4e3).describe("What the target agent needs to know. Facts and references only, not your reasoning.")
|
|
313
414
|
}),
|
|
314
415
|
async execute(input) {
|
|
315
416
|
const task = await stores.tasks.create({
|
|
@@ -352,19 +453,66 @@ function invokeAgentTool(stores, options) {
|
|
|
352
453
|
});
|
|
353
454
|
}
|
|
354
455
|
|
|
456
|
+
// src/eve/review.ts
|
|
457
|
+
import { defineTool as defineTool6 } from "eve/tools";
|
|
458
|
+
import { z as z6 } from "zod";
|
|
459
|
+
function reviewCommentTools(stores, options) {
|
|
460
|
+
const commentInputSchema = z6.object({
|
|
461
|
+
changeId: changeIdSchema.describe("The change under review, from your starting message."),
|
|
462
|
+
commentId: z6.number().int().positive().describe("The GitHub review comment id.")
|
|
463
|
+
});
|
|
464
|
+
async function context(changeId) {
|
|
465
|
+
const change = await stores.changes.get(changeId);
|
|
466
|
+
if (change === null) {
|
|
467
|
+
throw new Error(`change ${changeId} does not exist`);
|
|
468
|
+
}
|
|
469
|
+
if (change.state !== "verifying") {
|
|
470
|
+
throw new Error(`change is ${change.state}, not verifying`);
|
|
471
|
+
}
|
|
472
|
+
const repository = await stores.repositories.get(change.repositoryId);
|
|
473
|
+
if (repository === null) {
|
|
474
|
+
throw new Error(`repository ${change.repositoryId} does not exist`);
|
|
475
|
+
}
|
|
476
|
+
return {
|
|
477
|
+
repository: repository.slug,
|
|
478
|
+
token: await options.tokenForRepository(repository.slug),
|
|
479
|
+
fetch: options.fetch,
|
|
480
|
+
pullRequestNumber: change.prNumber
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
return {
|
|
484
|
+
read_review_comment: defineTool6({
|
|
485
|
+
description: "Read an inline review comment on the change under verification. By default this refuses to return comments from people without write access to the repository.",
|
|
486
|
+
inputSchema: commentInputSchema,
|
|
487
|
+
async execute({ changeId, commentId }) {
|
|
488
|
+
return readReviewComment({ ...await context(changeId), commentId });
|
|
489
|
+
}
|
|
490
|
+
}),
|
|
491
|
+
answer_review_comment: defineTool6({
|
|
492
|
+
description: "Reply to an inline review comment on the change under verification. The repository and pull request come from the ledger, and the comment author must have write access.",
|
|
493
|
+
inputSchema: commentInputSchema.extend({
|
|
494
|
+
body: z6.string().min(1).max(5e3).describe("The Markdown reply to post.")
|
|
495
|
+
}),
|
|
496
|
+
async execute({ changeId, commentId, body }) {
|
|
497
|
+
return answerReviewComment({ ...await context(changeId), commentId, body });
|
|
498
|
+
}
|
|
499
|
+
})
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
|
|
355
503
|
// src/eve/verification.ts
|
|
356
|
-
import { defineTool as
|
|
357
|
-
import { z as
|
|
504
|
+
import { defineTool as defineTool7 } from "eve/tools";
|
|
505
|
+
import { z as z7 } from "zod";
|
|
358
506
|
function recordVerificationTool(stores) {
|
|
359
|
-
return
|
|
507
|
+
return defineTool7({
|
|
360
508
|
description: "Record the outcome of a verification task: the evidence you gathered and whether the change passed. Pass moves the change to ready for human review; fail keeps it out of review.",
|
|
361
|
-
inputSchema:
|
|
509
|
+
inputSchema: z7.object({
|
|
362
510
|
taskId: taskIdSchema.describe("Your verification task."),
|
|
363
511
|
changeId: changeIdSchema.describe("The change you verified."),
|
|
364
|
-
verdict:
|
|
512
|
+
verdict: z7.enum(["pass", "fail"]),
|
|
365
513
|
evidence: changeEvidenceSchema,
|
|
366
514
|
confidence: levelSchema.describe("How certain you are in the verdict."),
|
|
367
|
-
summary:
|
|
515
|
+
summary: z7.string().min(1).max(2e3).describe("What you checked and what you found.")
|
|
368
516
|
}),
|
|
369
517
|
async execute({ taskId, changeId, verdict, evidence, confidence, summary }) {
|
|
370
518
|
const change = await stores.changes.get(changeId);
|
|
@@ -416,46 +564,46 @@ function recordVerificationTool(stores) {
|
|
|
416
564
|
}
|
|
417
565
|
|
|
418
566
|
// src/eve/index.ts
|
|
419
|
-
var decidedOutcomeSchema =
|
|
567
|
+
var decidedOutcomeSchema = z8.enum([
|
|
420
568
|
"accepted",
|
|
421
569
|
"duplicate",
|
|
422
570
|
"unactionable",
|
|
423
571
|
"low_confidence",
|
|
424
572
|
"ignored"
|
|
425
573
|
]);
|
|
426
|
-
var recordChangeInputSchema =
|
|
574
|
+
var recordChangeInputSchema = z8.object({
|
|
427
575
|
taskId: taskIdSchema,
|
|
428
576
|
repositoryId: repositoryIdSchema,
|
|
429
|
-
prNumber:
|
|
430
|
-
prUrl:
|
|
577
|
+
prNumber: z8.number().int().min(1),
|
|
578
|
+
prUrl: z8.url(),
|
|
431
579
|
risk: levelSchema.describe("Blast radius of the change if it is wrong."),
|
|
432
580
|
confidence: levelSchema.describe("How certain you are the change is correct."),
|
|
433
|
-
summary:
|
|
581
|
+
summary: z8.string().min(1).describe("One-sentence description of the change.")
|
|
434
582
|
});
|
|
435
583
|
function factoryTools(stores, options = {}) {
|
|
436
584
|
const recordChangeGate = options.recordChangeGate;
|
|
437
585
|
return {
|
|
438
|
-
get_task:
|
|
586
|
+
get_task: defineTool8({
|
|
439
587
|
description: "Read one factory task by id: its kind, state, repositories, origin, and results.",
|
|
440
|
-
inputSchema:
|
|
588
|
+
inputSchema: z8.object({ taskId: taskIdSchema }),
|
|
441
589
|
async execute({ taskId }) {
|
|
442
590
|
const task = await stores.tasks.get(taskId);
|
|
443
591
|
return task ?? { found: false, taskId };
|
|
444
592
|
}
|
|
445
593
|
}),
|
|
446
|
-
decide_signal:
|
|
594
|
+
decide_signal: defineTool8({
|
|
447
595
|
description: "Record the triage decision for a pending signal. A signal is decided exactly once.",
|
|
448
|
-
inputSchema:
|
|
596
|
+
inputSchema: z8.object({
|
|
449
597
|
signalId: signalIdSchema,
|
|
450
598
|
outcome: decidedOutcomeSchema,
|
|
451
|
-
reason:
|
|
452
|
-
detail:
|
|
599
|
+
reason: z8.string().min(1).describe("Why this outcome was chosen."),
|
|
600
|
+
detail: z8.string().min(1).optional().describe("Severity if accepted, or the duplicate-of signal id.")
|
|
453
601
|
}),
|
|
454
602
|
execute({ signalId, outcome, reason, detail }) {
|
|
455
603
|
return stores.signals.decide(signalId, outcome, { reason, detail });
|
|
456
604
|
}
|
|
457
605
|
}),
|
|
458
|
-
record_change:
|
|
606
|
+
record_change: defineTool8({
|
|
459
607
|
description: "Record the pull request produced for a code_change task. Creates the change, links it to the task, and moves the task to verifying.",
|
|
460
608
|
inputSchema: recordChangeInputSchema,
|
|
461
609
|
...recordChangeGate === void 0 ? {} : {
|
|
@@ -495,11 +643,11 @@ function factoryTools(stores, options = {}) {
|
|
|
495
643
|
return { change, task };
|
|
496
644
|
}
|
|
497
645
|
}),
|
|
498
|
-
finish_task:
|
|
646
|
+
finish_task: defineTool8({
|
|
499
647
|
description: "Mark your task finished with a summary, for task kinds that have no other outcome tool (for example a security_scan). Not for code_change or verification tasks: those end with record_change and record_verification.",
|
|
500
|
-
inputSchema:
|
|
648
|
+
inputSchema: z8.object({
|
|
501
649
|
taskId: taskIdSchema,
|
|
502
|
-
summary:
|
|
650
|
+
summary: z8.string().min(1).max(4e3).describe("What you did and found, for the ledger.")
|
|
503
651
|
}),
|
|
504
652
|
async execute({ taskId, summary }) {
|
|
505
653
|
const task = await stores.tasks.get(taskId);
|
|
@@ -517,23 +665,23 @@ function factoryTools(stores, options = {}) {
|
|
|
517
665
|
return { finished: true, taskState: finished.state };
|
|
518
666
|
}
|
|
519
667
|
}),
|
|
520
|
-
report_blocked:
|
|
668
|
+
report_blocked: defineTool8({
|
|
521
669
|
description: "Mark a running task as needing a human because the work cannot continue without help.",
|
|
522
|
-
inputSchema:
|
|
670
|
+
inputSchema: z8.object({
|
|
523
671
|
taskId: taskIdSchema,
|
|
524
|
-
reason:
|
|
672
|
+
reason: z8.string().min(1).describe("What is blocking, written for the human.")
|
|
525
673
|
}),
|
|
526
674
|
execute({ taskId, reason }) {
|
|
527
675
|
return stores.tasks.transition(taskId, "needs_human", { reason });
|
|
528
676
|
}
|
|
529
677
|
}),
|
|
530
|
-
ask_question:
|
|
678
|
+
ask_question: defineTool8({
|
|
531
679
|
description: "Raise a question a human operator must answer. Creates a question task that waits for the answer.",
|
|
532
|
-
inputSchema:
|
|
533
|
-
repositoryIds:
|
|
680
|
+
inputSchema: z8.object({
|
|
681
|
+
repositoryIds: z8.array(repositoryIdSchema).min(1),
|
|
534
682
|
parentTaskId: taskIdSchema.optional().describe("Task the answer unblocks, when there is one."),
|
|
535
|
-
channel:
|
|
536
|
-
address:
|
|
683
|
+
channel: z8.string().min(1).describe("Reply connector, e.g. github."),
|
|
684
|
+
address: z8.string().min(1).describe("Reply address, e.g. acme/web#41."),
|
|
537
685
|
question: taskQuestionSchema.omit({ answer: true, answeredBy: true })
|
|
538
686
|
}),
|
|
539
687
|
async execute({ repositoryIds, parentTaskId, channel, address, question }) {
|
|
@@ -547,16 +695,16 @@ function factoryTools(stores, options = {}) {
|
|
|
547
695
|
return stores.tasks.transition(task.id, "needs_human");
|
|
548
696
|
}
|
|
549
697
|
}),
|
|
550
|
-
append_receipt:
|
|
698
|
+
append_receipt: defineTool8({
|
|
551
699
|
description: "Append one immutable audit receipt for an event worth remembering. Receipts can never be edited or deleted.",
|
|
552
|
-
inputSchema:
|
|
553
|
-
repositoryIds:
|
|
700
|
+
inputSchema: z8.object({
|
|
701
|
+
repositoryIds: z8.array(repositoryIdSchema).min(1),
|
|
554
702
|
taskId: taskIdSchema.optional(),
|
|
555
703
|
changeId: changeIdSchema.optional(),
|
|
556
704
|
kind: vocabularySchema.describe("What the receipt is about, e.g. investigation."),
|
|
557
705
|
state: vocabularySchema.describe("What happened, e.g. flag_ramped."),
|
|
558
|
-
reason:
|
|
559
|
-
dedupeKey:
|
|
706
|
+
reason: z8.string().min(1).max(2e3).optional(),
|
|
707
|
+
dedupeKey: z8.string().min(1).optional().describe("Same key twice records one receipt instead of two.")
|
|
560
708
|
}),
|
|
561
709
|
execute(input) {
|
|
562
710
|
return stores.receipts.append(input);
|
|
@@ -594,8 +742,11 @@ export {
|
|
|
594
742
|
fetchPullRequestTool,
|
|
595
743
|
findingFromDeepsec,
|
|
596
744
|
invokeAgentTool,
|
|
745
|
+
mergeConflictPayloadSchema,
|
|
746
|
+
mergeConflictTools,
|
|
597
747
|
recordFinding,
|
|
598
748
|
recordFindingTool,
|
|
599
|
-
recordVerificationTool
|
|
749
|
+
recordVerificationTool,
|
|
750
|
+
reviewCommentTools
|
|
600
751
|
};
|
|
601
752
|
//# sourceMappingURL=index.js.map
|