@vercel/factory 0.0.8 → 0.0.9
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/approval-DdvEKLiE.mjs +132 -0
- package/dist/approval-DdvEKLiE.mjs.map +1 -0
- package/dist/{approval-qkxww0wJ.d.mts → approval-MoiwGpkh.d.mts} +9 -9
- package/dist/build-factory.d.mts +12 -0
- package/dist/build-factory.mjs +16 -0
- package/dist/build-factory.mjs.map +1 -0
- package/dist/connectors/index.d.mts +1 -1
- package/dist/connectors/slack.d.mts +1 -1
- package/dist/eve/index.d.mts +20 -20
- package/dist/eve/index.mjs +2 -1
- package/dist/eve/index.mjs.map +1 -1
- package/dist/factory-config-Bu4mklm9.d.mts +39 -0
- package/dist/factory-config-ifd3JxiU.mjs +49 -0
- package/dist/factory-config-ifd3JxiU.mjs.map +1 -0
- package/dist/{github-BdWWueJP.d.mts → github-DMOypeIu.d.mts} +2 -2
- package/dist/github.d.mts +1 -1
- package/dist/{index-DUb-U5cy.d.mts → index-Cy4jfXh5.d.mts} +9 -9
- package/dist/index.d.mts +3 -47
- package/dist/index.mjs +4 -57
- package/dist/index.mjs.map +1 -1
- package/dist/{task-BxTU3MJb.mjs → task-DMHuvBI0.mjs} +2 -129
- package/dist/task-DMHuvBI0.mjs.map +1 -0
- package/package.json +6 -1
- package/dist/task-BxTU3MJb.mjs.map +0 -1
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { p as vocabularySchema } from "./id-DwCihQr4.mjs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
4
|
+
//#region src/schema/finding.ts
|
|
5
|
+
const findingPrioritySchema = z.enum([
|
|
6
|
+
"P0",
|
|
7
|
+
"P1",
|
|
8
|
+
"P2",
|
|
9
|
+
"P3"
|
|
10
|
+
]).describe("Urgency of a finding: P0 is drop-everything, P3 is nice-to-have.");
|
|
11
|
+
const findingCategorySchema = z.enum([
|
|
12
|
+
"security",
|
|
13
|
+
"correctness",
|
|
14
|
+
"reliability",
|
|
15
|
+
"performance",
|
|
16
|
+
"compatibility",
|
|
17
|
+
"accessibility",
|
|
18
|
+
"documentation",
|
|
19
|
+
"maintainability",
|
|
20
|
+
"testing",
|
|
21
|
+
"usability"
|
|
22
|
+
]);
|
|
23
|
+
const findingVerificationLevelSchema = z.enum([
|
|
24
|
+
"unverified",
|
|
25
|
+
"supported",
|
|
26
|
+
"confirmed"
|
|
27
|
+
]).describe("How sure the reporter is: unverified = suspected from reading; supported = evidence points to it; confirmed = demonstrated.");
|
|
28
|
+
const findingVerificationMethodSchema = z.enum([
|
|
29
|
+
"code_inspection",
|
|
30
|
+
"static_analysis",
|
|
31
|
+
"manual_reproduction",
|
|
32
|
+
"unit_test",
|
|
33
|
+
"integration_test",
|
|
34
|
+
"e2e_test",
|
|
35
|
+
"runtime_observation",
|
|
36
|
+
"documentation"
|
|
37
|
+
]);
|
|
38
|
+
/**
|
|
39
|
+
* What was done to check the finding. Forces a reporter to distinguish "I
|
|
40
|
+
* think this is a problem" from "I demonstrated it", which is the axis a human
|
|
41
|
+
* approving fixes cares about most.
|
|
42
|
+
*/
|
|
43
|
+
const findingVerificationSchema = z.strictObject({
|
|
44
|
+
level: findingVerificationLevelSchema,
|
|
45
|
+
method: findingVerificationMethodSchema,
|
|
46
|
+
summary: z.string().min(1).max(2e3).describe("What was checked and what it showed."),
|
|
47
|
+
limitations: z.string().min(1).max(2e3).optional().describe("What could not be checked.")
|
|
48
|
+
});
|
|
49
|
+
/** A single problem found in a repository, as a scanner or agent reports it. */
|
|
50
|
+
const findingSchema = z.strictObject({
|
|
51
|
+
title: z.string().min(1).max(200),
|
|
52
|
+
body: z.string().min(1).max(8e3).describe("The problem, its impact, and how to fix it. Markdown."),
|
|
53
|
+
path: z.string().min(1).max(500).optional().describe("Repository-relative file path."),
|
|
54
|
+
line: z.number().int().min(1).optional(),
|
|
55
|
+
endLine: z.number().int().min(1).optional(),
|
|
56
|
+
priority: findingPrioritySchema,
|
|
57
|
+
category: findingCategorySchema,
|
|
58
|
+
verification: findingVerificationSchema,
|
|
59
|
+
tool: z.string().min(1).max(100).optional().describe("Scanner that produced it, e.g. deepsec."),
|
|
60
|
+
ruleId: z.string().min(1).max(200).optional().describe("Scanner rule or check id, when there is one.")
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* Stable identity of a finding across scans, used as the signal's delivery id
|
|
64
|
+
* so re-reporting is a no-op instead of a second task. A scanner finding is
|
|
65
|
+
* the same problem when the same tool reports the same rule on the same file;
|
|
66
|
+
* its title is model-written prose and changes between runs, so it is left
|
|
67
|
+
* out. Without a rule id the title is all there is, normalised.
|
|
68
|
+
*/
|
|
69
|
+
function findingFingerprint(repositoryId, finding) {
|
|
70
|
+
const parts = finding.tool !== void 0 && finding.ruleId !== void 0 && finding.path !== void 0 ? [
|
|
71
|
+
repositoryId,
|
|
72
|
+
finding.tool,
|
|
73
|
+
finding.ruleId,
|
|
74
|
+
finding.path
|
|
75
|
+
] : [
|
|
76
|
+
repositoryId,
|
|
77
|
+
finding.tool ?? "",
|
|
78
|
+
finding.ruleId ?? "",
|
|
79
|
+
finding.path ?? "",
|
|
80
|
+
finding.title.trim().toLowerCase().replaceAll(/\s+/gu, " ")
|
|
81
|
+
];
|
|
82
|
+
return createHash("sha256").update(parts.join(" ")).digest("hex").slice(0, 32);
|
|
83
|
+
}
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/approval.ts
|
|
86
|
+
/**
|
|
87
|
+
* One approval rule. Every listed field must match for the rule to apply;
|
|
88
|
+
* absent fields match anything. Rules are evaluated first-match.
|
|
89
|
+
*/
|
|
90
|
+
const approvalRuleSchema = z.strictObject({
|
|
91
|
+
source: vocabularySchema.optional().describe("Signal source, e.g. security_scan or github_issue."),
|
|
92
|
+
kind: vocabularySchema.optional().describe("Task kind, e.g. code_change."),
|
|
93
|
+
priority: z.array(findingPrioritySchema).min(1).optional().describe("Finding priorities the rule applies to."),
|
|
94
|
+
require: z.boolean().describe("Whether matching tasks wait for a human before dispatch.")
|
|
95
|
+
});
|
|
96
|
+
const approvalPolicySchema = z.array(approvalRuleSchema).describe("First-match rules deciding which tasks need a human before they run.");
|
|
97
|
+
/**
|
|
98
|
+
* The default: fixes for security findings wait for a human; everything else
|
|
99
|
+
* runs as it always has. Handoffs between agents (verification) never wait,
|
|
100
|
+
* because a human already approved the work they continue.
|
|
101
|
+
*/
|
|
102
|
+
const defaultApprovalPolicy = [
|
|
103
|
+
{
|
|
104
|
+
kind: "verification",
|
|
105
|
+
require: false
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
source: "security_scan",
|
|
109
|
+
require: true
|
|
110
|
+
},
|
|
111
|
+
{ require: false }
|
|
112
|
+
];
|
|
113
|
+
/**
|
|
114
|
+
* Decide at task-creation time whether a task needs approval. Pure: the answer
|
|
115
|
+
* is stamped on the task and never re-evaluated, so a later policy change
|
|
116
|
+
* cannot silently release work a human was expecting to see.
|
|
117
|
+
*/
|
|
118
|
+
function requiresApproval(policy, subject) {
|
|
119
|
+
for (const rule of policy) {
|
|
120
|
+
if (rule.source !== void 0 && rule.source !== subject.source) continue;
|
|
121
|
+
if (rule.kind !== void 0 && rule.kind !== subject.kind) continue;
|
|
122
|
+
if (rule.priority !== void 0) {
|
|
123
|
+
if (subject.priority === void 0 || !rule.priority.includes(subject.priority)) continue;
|
|
124
|
+
}
|
|
125
|
+
return rule.require;
|
|
126
|
+
}
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
//#endregion
|
|
130
|
+
export { findingCategorySchema as a, findingSchema as c, findingVerificationSchema as d, requiresApproval as i, findingVerificationLevelSchema as l, approvalRuleSchema as n, findingFingerprint as o, defaultApprovalPolicy as r, findingPrioritySchema as s, approvalPolicySchema as t, findingVerificationMethodSchema as u };
|
|
131
|
+
|
|
132
|
+
//# sourceMappingURL=approval-DdvEKLiE.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approval-DdvEKLiE.mjs","names":[],"sources":["../src/schema/finding.ts","../src/approval.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { z } from \"zod\";\n\nexport const findingPrioritySchema = z\n .enum([\"P0\", \"P1\", \"P2\", \"P3\"])\n .describe(\"Urgency of a finding: P0 is drop-everything, P3 is nice-to-have.\");\n\nexport const findingCategorySchema = z.enum([\n \"security\",\n \"correctness\",\n \"reliability\",\n \"performance\",\n \"compatibility\",\n \"accessibility\",\n \"documentation\",\n \"maintainability\",\n \"testing\",\n \"usability\",\n]);\n\nexport const findingVerificationLevelSchema = z\n .enum([\"unverified\", \"supported\", \"confirmed\"])\n .describe(\n \"How sure the reporter is: unverified = suspected from reading; supported = evidence points to it; confirmed = demonstrated.\",\n );\n\nexport const findingVerificationMethodSchema = z.enum([\n \"code_inspection\",\n \"static_analysis\",\n \"manual_reproduction\",\n \"unit_test\",\n \"integration_test\",\n \"e2e_test\",\n \"runtime_observation\",\n \"documentation\",\n]);\n\n/**\n * What was done to check the finding. Forces a reporter to distinguish \"I\n * think this is a problem\" from \"I demonstrated it\", which is the axis a human\n * approving fixes cares about most.\n */\nexport const findingVerificationSchema = z.strictObject({\n level: findingVerificationLevelSchema,\n method: findingVerificationMethodSchema,\n summary: z.string().min(1).max(2000).describe(\"What was checked and what it showed.\"),\n limitations: z.string().min(1).max(2000).optional().describe(\"What could not be checked.\"),\n});\n\n/** A single problem found in a repository, as a scanner or agent reports it. */\nexport const findingSchema = z.strictObject({\n title: z.string().min(1).max(200),\n body: z.string().min(1).max(8000).describe(\"The problem, its impact, and how to fix it. Markdown.\"),\n path: z.string().min(1).max(500).optional().describe(\"Repository-relative file path.\"),\n line: z.number().int().min(1).optional(),\n endLine: z.number().int().min(1).optional(),\n priority: findingPrioritySchema,\n category: findingCategorySchema,\n verification: findingVerificationSchema,\n tool: z.string().min(1).max(100).optional().describe(\"Scanner that produced it, e.g. deepsec.\"),\n ruleId: z.string().min(1).max(200).optional().describe(\"Scanner rule or check id, when there is one.\"),\n});\n\nexport type FindingPriority = z.infer<typeof findingPrioritySchema>;\nexport type FindingCategory = z.infer<typeof findingCategorySchema>;\nexport type FindingVerification = z.infer<typeof findingVerificationSchema>;\nexport type Finding = z.infer<typeof findingSchema>;\n\n/**\n * Stable identity of a finding across scans, used as the signal's delivery id\n * so re-reporting is a no-op instead of a second task. A scanner finding is\n * the same problem when the same tool reports the same rule on the same file;\n * its title is model-written prose and changes between runs, so it is left\n * out. Without a rule id the title is all there is, normalised.\n */\nexport function findingFingerprint(repositoryId: string, finding: Finding): string {\n const parts =\n finding.tool !== undefined && finding.ruleId !== undefined && finding.path !== undefined\n ? [repositoryId, finding.tool, finding.ruleId, finding.path]\n : [\n repositoryId,\n finding.tool ?? \"\",\n finding.ruleId ?? \"\",\n finding.path ?? \"\",\n finding.title.trim().toLowerCase().replaceAll(/\\s+/gu, \" \"),\n ];\n return createHash(\"sha256\").update(parts.join(\" \")).digest(\"hex\").slice(0, 32);\n}\n","import { z } from \"zod\";\nimport { vocabularySchema } from \"./schema/common\";\nimport { findingPrioritySchema, type FindingPriority } from \"./schema/finding\";\n\n/**\n * One approval rule. Every listed field must match for the rule to apply;\n * absent fields match anything. Rules are evaluated first-match.\n */\nexport const approvalRuleSchema = z.strictObject({\n source: vocabularySchema.optional().describe(\"Signal source, e.g. security_scan or github_issue.\"),\n kind: vocabularySchema.optional().describe(\"Task kind, e.g. code_change.\"),\n priority: z\n .array(findingPrioritySchema)\n .min(1)\n .optional()\n .describe(\"Finding priorities the rule applies to.\"),\n require: z.boolean().describe(\"Whether matching tasks wait for a human before dispatch.\"),\n});\n\nexport const approvalPolicySchema = z\n .array(approvalRuleSchema)\n .describe(\"First-match rules deciding which tasks need a human before they run.\");\n\nexport type ApprovalRule = z.infer<typeof approvalRuleSchema>;\nexport type ApprovalPolicy = z.infer<typeof approvalPolicySchema>;\n\n/**\n * The default: fixes for security findings wait for a human; everything else\n * runs as it always has. Handoffs between agents (verification) never wait,\n * because a human already approved the work they continue.\n */\nexport const defaultApprovalPolicy: ApprovalPolicy = [\n { kind: \"verification\", require: false },\n { source: \"security_scan\", require: true },\n { require: false },\n];\n\nexport interface ApprovalSubject {\n source?: string;\n kind: string;\n priority?: FindingPriority;\n}\n\n/**\n * Decide at task-creation time whether a task needs approval. Pure: the answer\n * is stamped on the task and never re-evaluated, so a later policy change\n * cannot silently release work a human was expecting to see.\n */\nexport function requiresApproval(policy: ApprovalPolicy, subject: ApprovalSubject): boolean {\n for (const rule of policy) {\n if (rule.source !== undefined && rule.source !== subject.source) continue;\n if (rule.kind !== undefined && rule.kind !== subject.kind) continue;\n if (rule.priority !== undefined) {\n if (subject.priority === undefined || !rule.priority.includes(subject.priority)) continue;\n }\n return rule.require;\n }\n return false;\n}\n"],"mappings":"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"}
|
|
@@ -23,12 +23,12 @@ declare const levelSchema: z.ZodEnum<{
|
|
|
23
23
|
high: "high";
|
|
24
24
|
}>;
|
|
25
25
|
declare const changeStateSchema: z.ZodEnum<{
|
|
26
|
-
rolled_back: "rolled_back";
|
|
27
26
|
verifying: "verifying";
|
|
28
27
|
ready: "ready";
|
|
29
28
|
merged: "merged";
|
|
30
29
|
deployed: "deployed";
|
|
31
30
|
rolled_out: "rolled_out";
|
|
31
|
+
rolled_back: "rolled_back";
|
|
32
32
|
closed: "closed";
|
|
33
33
|
}>;
|
|
34
34
|
declare const changeEvidenceSchema: z.ZodObject<{
|
|
@@ -67,12 +67,12 @@ declare const changeSchema: z.ZodObject<{
|
|
|
67
67
|
previewUrl: z.ZodOptional<z.ZodURL>;
|
|
68
68
|
}, z.core.$strict>;
|
|
69
69
|
state: z.ZodEnum<{
|
|
70
|
-
rolled_back: "rolled_back";
|
|
71
70
|
verifying: "verifying";
|
|
72
71
|
ready: "ready";
|
|
73
72
|
merged: "merged";
|
|
74
73
|
deployed: "deployed";
|
|
75
74
|
rolled_out: "rolled_out";
|
|
75
|
+
rolled_back: "rolled_back";
|
|
76
76
|
closed: "closed";
|
|
77
77
|
}>;
|
|
78
78
|
mergeSha: z.ZodOptional<z.ZodString>;
|
|
@@ -148,12 +148,12 @@ type Repository = z.infer<typeof repositorySchema>;
|
|
|
148
148
|
declare const standardTaskKinds: readonly ["code_change", "verification", "investigation", "question"];
|
|
149
149
|
declare const taskKindSchema: z.ZodString;
|
|
150
150
|
declare const taskStateSchema: z.ZodEnum<{
|
|
151
|
-
succeeded: "succeeded";
|
|
152
|
-
failed: "failed";
|
|
153
|
-
needs_human: "needs_human";
|
|
154
151
|
queued: "queued";
|
|
155
152
|
running: "running";
|
|
156
153
|
verifying: "verifying";
|
|
154
|
+
succeeded: "succeeded";
|
|
155
|
+
failed: "failed";
|
|
156
|
+
needs_human: "needs_human";
|
|
157
157
|
cancelled: "cancelled";
|
|
158
158
|
}>;
|
|
159
159
|
declare const taskApprovalSchema: z.ZodEnum<{
|
|
@@ -185,12 +185,12 @@ declare const taskSchema: z.ZodObject<{
|
|
|
185
185
|
kind: z.ZodString;
|
|
186
186
|
area: z.ZodOptional<z.ZodString>;
|
|
187
187
|
state: z.ZodEnum<{
|
|
188
|
-
succeeded: "succeeded";
|
|
189
|
-
failed: "failed";
|
|
190
|
-
needs_human: "needs_human";
|
|
191
188
|
queued: "queued";
|
|
192
189
|
running: "running";
|
|
193
190
|
verifying: "verifying";
|
|
191
|
+
succeeded: "succeeded";
|
|
192
|
+
failed: "failed";
|
|
193
|
+
needs_human: "needs_human";
|
|
194
194
|
cancelled: "cancelled";
|
|
195
195
|
}>;
|
|
196
196
|
approval: z.ZodOptional<z.ZodEnum<{
|
|
@@ -508,4 +508,4 @@ interface ApprovalSubject {
|
|
|
508
508
|
declare function requiresApproval(policy: ApprovalPolicy, subject: ApprovalSubject): boolean;
|
|
509
509
|
//#endregion
|
|
510
510
|
export { ReceiptPhase as $, TaskPatch as A, taskDevboxSchema as B, ChangeTransitionOptions as C, changeIdSchema as Ct, CreateTaskInput as D, repositoryIdsSchema as Dt, CreateStoresOptions as E, repositoryIdSchema as Et, TaskKind as F, taskStateSchema as G, taskOriginSchema as H, TaskState as I, repositorySchema as J, Repository as K, harnessSchema as L, createStores as M, Task as N, DecideSignalOptions as O, signalIdSchema as Ot, TaskApproval as P, ReceiptKind as Q, standardTaskKinds as R, ChangePatch as S, TaskId as St, CreateSignalInput as T, receiptIdSchema as Tt, taskQuestionSchema as U, taskKindSchema as V, taskSchema as W, Cost as X, repositorySlugSchema as Y, Receipt as Z, findingVerificationMethodSchema as _, ChangeId as _t, approvalRuleSchema as a, receiptStateSchema as at, ApprovalDecision as b, RepositoryId as bt, Finding as c, standardReceiptStates as ct, FindingVerification as d, ChangeState as dt, ReceiptState as et, findingCategorySchema as f, Level as ft, findingVerificationLevelSchema as g, levelSchema as gt, findingSchema as h, changeStateSchema as ht, approvalPolicySchema as i, receiptSchema as it, TaskTransitionOptions as j, FactoryStores as k, taskIdSchema as kt, FindingCategory as l, Change as lt, findingPrioritySchema as m, changeSchema as mt, ApprovalRule as n, receiptKindSchema as nt, defaultApprovalPolicy as o, standardReceiptKinds as ot, findingFingerprint as p, changeEvidenceSchema as pt, RepositorySlug as q, ApprovalSubject as r, receiptPhaseSchema as rt, requiresApproval as s, standardReceiptPhases as st, ApprovalPolicy as t, costSchema as tt, FindingPriority as u, ChangeEvidence as ut, findingVerificationSchema as v, FactoryId as vt, CreateChangeInput as w, factoryIdSchema as wt, ApprovalError as x, SignalId as xt, AppendReceiptInput as y, ReceiptId as yt, taskApprovalSchema as z };
|
|
511
|
-
//# sourceMappingURL=approval-
|
|
511
|
+
//# sourceMappingURL=approval-MoiwGpkh.d.mts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { n as FactoryConfigInput } from "./factory-config-Bu4mklm9.mjs";
|
|
2
|
+
import { EveNextConfig, EveNextConfigFunction, EveNextConfigInput } from "eve/next";
|
|
3
|
+
//#region src/build-factory.d.ts
|
|
4
|
+
interface FactoryArgs<TConfig extends EveNextConfig = EveNextConfig> {
|
|
5
|
+
factoryConfig: FactoryConfigInput;
|
|
6
|
+
nextConfig: EveNextConfigInput<TConfig>;
|
|
7
|
+
root?: string;
|
|
8
|
+
}
|
|
9
|
+
declare function buildFactory<TConfig extends EveNextConfig>({ factoryConfig, nextConfig, root }: FactoryArgs<TConfig>): EveNextConfigFunction<TConfig>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { FactoryArgs, buildFactory };
|
|
12
|
+
//# sourceMappingURL=build-factory.d.mts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { t as defineFactory } from "./factory-config-ifd3JxiU.mjs";
|
|
2
|
+
import { readdirSync } from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
//#region src/build-factory.ts
|
|
5
|
+
function buildFactory({ factoryConfig, nextConfig, root = process.cwd() }) {
|
|
6
|
+
defineFactory(factoryConfig);
|
|
7
|
+
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)]));
|
|
8
|
+
return async (phase, context) => {
|
|
9
|
+
const { withEve } = await import("eve/next");
|
|
10
|
+
return withEve(nextConfig, { agents: agentDefinitions })(phase, context);
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { buildFactory };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=build-factory.mjs.map
|
|
@@ -0,0 +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\nexport interface FactoryArgs<TConfig extends EveNextConfig = EveNextConfig> {\n factoryConfig: FactoryConfigInput;\n nextConfig: EveNextConfigInput<TConfig>;\n root?: string;\n}\n\nexport function buildFactory<TConfig extends EveNextConfig>({\n factoryConfig,\n nextConfig,\n root = process.cwd(),\n}: FactoryArgs<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 const { withEve } = await import(\"eve/next\");\n return withEve(nextConfig, { agents: agentDefinitions })(phase, context);\n };\n}\n"],"mappings":";;;;AAgBA,SAAgB,aAA4C,EAC1D,eACA,YACA,OAAO,QAAQ,IAAI,KACoC;CACvD,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,MAAM,EAAE,YAAY,MAAM,OAAO;EACjC,OAAO,QAAQ,YAAY,EAAE,QAAQ,iBAAiB,CAAC,CAAC,CAAC,OAAO,OAAO;CACzE;AACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as NormalizedSignal, c as communicationEventSchema, d as createCommunicationRouter, i as CommunicationRouter, l as communicationOutcomeSchema, n as CommunicationEvent, o as SignalNormalizer, r as CommunicationOutcome, s as WebhookEvent, t as CommunicationAdapter, u as communicationOutcomes } from "../index-
|
|
1
|
+
import { a as NormalizedSignal, c as communicationEventSchema, d as createCommunicationRouter, i as CommunicationRouter, l as communicationOutcomeSchema, n as CommunicationEvent, o as SignalNormalizer, r as CommunicationOutcome, s as WebhookEvent, t as CommunicationAdapter, u as communicationOutcomes } from "../index-Cy4jfXh5.mjs";
|
|
2
2
|
export { CommunicationAdapter, CommunicationEvent, CommunicationOutcome, CommunicationRouter, NormalizedSignal, SignalNormalizer, WebhookEvent, communicationEventSchema, communicationOutcomeSchema, communicationOutcomes, createCommunicationRouter };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as NormalizedSignal, n as CommunicationEvent, t as CommunicationAdapter } from "../index-
|
|
1
|
+
import { a as NormalizedSignal, n as CommunicationEvent, t as CommunicationAdapter } from "../index-Cy4jfXh5.mjs";
|
|
2
2
|
//#region src/connectors/slack.d.ts
|
|
3
3
|
interface SlackCommunicationDelivery {
|
|
4
4
|
eventId: string;
|
package/dist/eve/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as Finding, k as FactoryStores, t as ApprovalPolicy } from "../approval-
|
|
2
|
-
import { d as GitHubReviewComment } from "../github-
|
|
1
|
+
import { c as Finding, k as FactoryStores, t as ApprovalPolicy } from "../approval-MoiwGpkh.mjs";
|
|
2
|
+
import { d as GitHubReviewComment } from "../github-DMOypeIu.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/eve/fetch.d.ts
|
|
5
5
|
/** The subset of the eve sandbox handle a credentialed git operation needs. */
|
|
@@ -362,7 +362,7 @@ declare function invokeAgentTool(stores: FactoryStores, options: InvokeAgentOpti
|
|
|
362
362
|
}, {
|
|
363
363
|
taskId: string;
|
|
364
364
|
kind: string;
|
|
365
|
-
state: "
|
|
365
|
+
state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
|
|
366
366
|
}> & {
|
|
367
367
|
execute(input: {
|
|
368
368
|
repositoryIds: string[];
|
|
@@ -374,7 +374,7 @@ declare function invokeAgentTool(stores: FactoryStores, options: InvokeAgentOpti
|
|
|
374
374
|
}, ctx: import("eve/tools").ToolContext): Promise<{
|
|
375
375
|
taskId: string;
|
|
376
376
|
kind: string;
|
|
377
|
-
state: "
|
|
377
|
+
state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
|
|
378
378
|
}>;
|
|
379
379
|
};
|
|
380
380
|
//#endregion
|
|
@@ -484,8 +484,8 @@ declare function recordVerificationTool(stores: FactoryStores): import("eve/tool
|
|
|
484
484
|
} | {
|
|
485
485
|
recorded: true;
|
|
486
486
|
verdict: "pass" | "fail";
|
|
487
|
-
changeState: "
|
|
488
|
-
taskState: "
|
|
487
|
+
changeState: "verifying" | "ready" | "merged" | "deployed" | "rolled_out" | "rolled_back" | "closed";
|
|
488
|
+
taskState: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
|
|
489
489
|
reason?: undefined;
|
|
490
490
|
}> & {
|
|
491
491
|
execute(input: {
|
|
@@ -511,8 +511,8 @@ declare function recordVerificationTool(stores: FactoryStores): import("eve/tool
|
|
|
511
511
|
} | {
|
|
512
512
|
recorded: true;
|
|
513
513
|
verdict: "pass" | "fail";
|
|
514
|
-
changeState: "
|
|
515
|
-
taskState: "
|
|
514
|
+
changeState: "verifying" | "ready" | "merged" | "deployed" | "rolled_out" | "rolled_back" | "closed";
|
|
515
|
+
taskState: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
|
|
516
516
|
reason?: undefined;
|
|
517
517
|
}>;
|
|
518
518
|
};
|
|
@@ -563,7 +563,7 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
563
563
|
schemaVersion: 1;
|
|
564
564
|
id: string;
|
|
565
565
|
kind: string;
|
|
566
|
-
state: "
|
|
566
|
+
state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
|
|
567
567
|
origin: {
|
|
568
568
|
signalId?: string | undefined;
|
|
569
569
|
parentTaskId?: string | undefined;
|
|
@@ -605,7 +605,7 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
605
605
|
schemaVersion: 1;
|
|
606
606
|
id: string;
|
|
607
607
|
kind: string;
|
|
608
|
-
state: "
|
|
608
|
+
state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
|
|
609
609
|
origin: {
|
|
610
610
|
signalId?: string | undefined;
|
|
611
611
|
parentTaskId?: string | undefined;
|
|
@@ -713,7 +713,7 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
713
713
|
scopeMatches: boolean;
|
|
714
714
|
previewUrl?: string | undefined;
|
|
715
715
|
};
|
|
716
|
-
state: "
|
|
716
|
+
state: "verifying" | "ready" | "merged" | "deployed" | "rolled_out" | "rolled_back" | "closed";
|
|
717
717
|
createdAt: string;
|
|
718
718
|
updatedAt: string;
|
|
719
719
|
taskId?: string | undefined;
|
|
@@ -725,7 +725,7 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
725
725
|
schemaVersion: 1;
|
|
726
726
|
id: string;
|
|
727
727
|
kind: string;
|
|
728
|
-
state: "
|
|
728
|
+
state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
|
|
729
729
|
origin: {
|
|
730
730
|
signalId?: string | undefined;
|
|
731
731
|
parentTaskId?: string | undefined;
|
|
@@ -785,7 +785,7 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
785
785
|
scopeMatches: boolean;
|
|
786
786
|
previewUrl?: string | undefined;
|
|
787
787
|
};
|
|
788
|
-
state: "
|
|
788
|
+
state: "verifying" | "ready" | "merged" | "deployed" | "rolled_out" | "rolled_back" | "closed";
|
|
789
789
|
createdAt: string;
|
|
790
790
|
updatedAt: string;
|
|
791
791
|
taskId?: string | undefined;
|
|
@@ -797,7 +797,7 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
797
797
|
schemaVersion: 1;
|
|
798
798
|
id: string;
|
|
799
799
|
kind: string;
|
|
800
|
-
state: "
|
|
800
|
+
state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
|
|
801
801
|
origin: {
|
|
802
802
|
signalId?: string | undefined;
|
|
803
803
|
parentTaskId?: string | undefined;
|
|
@@ -841,7 +841,7 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
841
841
|
taskState?: undefined;
|
|
842
842
|
} | {
|
|
843
843
|
finished: true;
|
|
844
|
-
taskState: "
|
|
844
|
+
taskState: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
|
|
845
845
|
reason?: undefined;
|
|
846
846
|
}> & {
|
|
847
847
|
execute(input: {
|
|
@@ -853,7 +853,7 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
853
853
|
taskState?: undefined;
|
|
854
854
|
} | {
|
|
855
855
|
finished: true;
|
|
856
|
-
taskState: "
|
|
856
|
+
taskState: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
|
|
857
857
|
reason?: undefined;
|
|
858
858
|
}>;
|
|
859
859
|
};
|
|
@@ -864,7 +864,7 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
864
864
|
schemaVersion: 1;
|
|
865
865
|
id: string;
|
|
866
866
|
kind: string;
|
|
867
|
-
state: "
|
|
867
|
+
state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
|
|
868
868
|
origin: {
|
|
869
869
|
signalId?: string | undefined;
|
|
870
870
|
parentTaskId?: string | undefined;
|
|
@@ -904,7 +904,7 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
904
904
|
schemaVersion: 1;
|
|
905
905
|
id: string;
|
|
906
906
|
kind: string;
|
|
907
|
-
state: "
|
|
907
|
+
state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
|
|
908
908
|
origin: {
|
|
909
909
|
signalId?: string | undefined;
|
|
910
910
|
parentTaskId?: string | undefined;
|
|
@@ -951,7 +951,7 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
951
951
|
schemaVersion: 1;
|
|
952
952
|
id: string;
|
|
953
953
|
kind: string;
|
|
954
|
-
state: "
|
|
954
|
+
state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
|
|
955
955
|
origin: {
|
|
956
956
|
signalId?: string | undefined;
|
|
957
957
|
parentTaskId?: string | undefined;
|
|
@@ -997,7 +997,7 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
997
997
|
schemaVersion: 1;
|
|
998
998
|
id: string;
|
|
999
999
|
kind: string;
|
|
1000
|
-
state: "
|
|
1000
|
+
state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
|
|
1001
1001
|
origin: {
|
|
1002
1002
|
signalId?: string | undefined;
|
|
1003
1003
|
parentTaskId?: string | undefined;
|
package/dist/eve/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { i as repositoryIdSchema, o as signalIdSchema, p as vocabularySchema, s as taskIdSchema, t as changeIdSchema } from "../id-DwCihQr4.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { c as findingSchema, i as requiresApproval, o as findingFingerprint, r as defaultApprovalPolicy } from "../approval-DdvEKLiE.mjs";
|
|
3
|
+
import { g as dispatchTask, p as levelSchema, s as taskQuestionSchema, u as changeEvidenceSchema } from "../task-DMHuvBI0.mjs";
|
|
3
4
|
import { answerReviewComment, readPullRequestHead, readReviewComment } from "../github.mjs";
|
|
4
5
|
import { z } from "zod";
|
|
5
6
|
import { defineHook } from "eve/hooks";
|