@vercel/factory 0.0.8 → 0.0.10
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-qkxww0wJ.d.mts → approval-CDiBco2V.d.mts} +22 -14
- package/dist/approval-DdvEKLiE.mjs +132 -0
- package/dist/approval-DdvEKLiE.mjs.map +1 -0
- 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/{task-BxTU3MJb.mjs → change-BPYhWKuL.mjs} +113 -220
- package/dist/change-BPYhWKuL.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 +99 -29
- package/dist/eve/index.mjs +84 -3
- 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-wThBfbm-.d.mts} +100 -3
- package/dist/github.d.mts +2 -2
- package/dist/github.mjs +195 -1
- package/dist/github.mjs.map +1 -1
- package/dist/{index-DUb-U5cy.d.mts → index-Cy4jfXh5.d.mts} +9 -9
- package/dist/index.d.mts +72 -47
- package/dist/index.mjs +203 -59
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -1
- package/dist/task-BxTU3MJb.mjs.map +0 -1
|
@@ -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>;
|
|
@@ -87,11 +87,11 @@ type Change = z.infer<typeof changeSchema>;
|
|
|
87
87
|
//#endregion
|
|
88
88
|
//#region src/schema/receipt.d.ts
|
|
89
89
|
/** States the engine writes on transitions. Any vocabulary value is valid. */
|
|
90
|
-
declare const standardReceiptStates: readonly ["approved", "rejected", "dispatched", "succeeded", "failed", "needs_human", "cancelled", "settled", "merged", "deployed", "rolled_out", "rolled_back"];
|
|
90
|
+
declare const standardReceiptStates: readonly ["approved", "rejected", "dispatched", "succeeded", "failed", "needs_human", "cancelled", "settled", "ready", "merged", "deployed", "rolled_out", "rolled_back"];
|
|
91
91
|
/** Phases the standard loop uses. Any vocabulary value is valid. */
|
|
92
92
|
declare const standardReceiptPhases: readonly ["approval", "budget", "dispatch", "implementation", "verification", "pull_request", "cleanup"];
|
|
93
93
|
/** Kinds the standard loop writes: the standard task kinds plus "change". */
|
|
94
|
-
declare const standardReceiptKinds: readonly ["code_change", "verification", "investigation", "question", "change"];
|
|
94
|
+
declare const standardReceiptKinds: readonly ["coordination", "code_change", "verification", "investigation", "question", "change"];
|
|
95
95
|
declare const receiptStateSchema: z.ZodString;
|
|
96
96
|
declare const receiptPhaseSchema: z.ZodString;
|
|
97
97
|
declare const receiptKindSchema: z.ZodString;
|
|
@@ -145,15 +145,15 @@ type Repository = z.infer<typeof repositorySchema>;
|
|
|
145
145
|
* Kinds the standard loop understands. Any vocabulary value is valid; the
|
|
146
146
|
* kind-scoped rules below apply only to these standard kinds.
|
|
147
147
|
*/
|
|
148
|
-
declare const standardTaskKinds: readonly ["code_change", "verification", "investigation", "question"];
|
|
148
|
+
declare const standardTaskKinds: readonly ["coordination", "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<{
|
|
@@ -161,6 +161,8 @@ declare const taskApprovalSchema: z.ZodEnum<{
|
|
|
161
161
|
granted: "granted";
|
|
162
162
|
denied: "denied";
|
|
163
163
|
}>;
|
|
164
|
+
declare const taskExecutionRepositoryIdsSchema: z.ZodTuple<[z.ZodString], null>;
|
|
165
|
+
declare const coordinationRepositoryIdsSchema: z.ZodTuple<[z.ZodString, z.ZodString], z.ZodString>;
|
|
164
166
|
declare const harnessSchema: z.ZodString;
|
|
165
167
|
declare const taskOriginSchema: z.ZodObject<{
|
|
166
168
|
signalId: z.ZodOptional<z.ZodString>;
|
|
@@ -181,16 +183,16 @@ declare const taskQuestionSchema: z.ZodObject<{
|
|
|
181
183
|
declare const taskSchema: z.ZodObject<{
|
|
182
184
|
schemaVersion: z.ZodLiteral<1>;
|
|
183
185
|
id: z.ZodString;
|
|
184
|
-
repositoryIds: z.
|
|
186
|
+
repositoryIds: z.ZodArray<z.ZodString>;
|
|
185
187
|
kind: z.ZodString;
|
|
186
188
|
area: z.ZodOptional<z.ZodString>;
|
|
187
189
|
state: z.ZodEnum<{
|
|
188
|
-
succeeded: "succeeded";
|
|
189
|
-
failed: "failed";
|
|
190
|
-
needs_human: "needs_human";
|
|
191
190
|
queued: "queued";
|
|
192
191
|
running: "running";
|
|
193
192
|
verifying: "verifying";
|
|
193
|
+
succeeded: "succeeded";
|
|
194
|
+
failed: "failed";
|
|
195
|
+
needs_human: "needs_human";
|
|
194
196
|
cancelled: "cancelled";
|
|
195
197
|
}>;
|
|
196
198
|
approval: z.ZodOptional<z.ZodEnum<{
|
|
@@ -239,6 +241,12 @@ declare class ApprovalError extends Error {
|
|
|
239
241
|
readonly reason: string;
|
|
240
242
|
constructor(taskId: TaskId, reason: string);
|
|
241
243
|
}
|
|
244
|
+
declare class ChangeAssociationError extends Error {
|
|
245
|
+
readonly taskId: TaskId;
|
|
246
|
+
readonly repositoryId: RepositoryId;
|
|
247
|
+
readonly reason: string;
|
|
248
|
+
constructor(taskId: TaskId, repositoryId: RepositoryId, reason: string);
|
|
249
|
+
}
|
|
242
250
|
interface CreateSignalInput {
|
|
243
251
|
repositoryId: RepositoryId;
|
|
244
252
|
source: SignalSource;
|
|
@@ -507,5 +515,5 @@ interface ApprovalSubject {
|
|
|
507
515
|
*/
|
|
508
516
|
declare function requiresApproval(policy: ApprovalPolicy, subject: ApprovalSubject): boolean;
|
|
509
517
|
//#endregion
|
|
510
|
-
export {
|
|
511
|
-
//# sourceMappingURL=approval-
|
|
518
|
+
export { Cost as $, FactoryStores as A, repositoryIdsSchema as At, standardTaskKinds as B, ChangePatch as C, RepositoryId as Ct, CreateStoresOptions as D, factoryIdSchema as Dt, CreateSignalInput as E, changeIdSchema as Et, TaskApproval as F, taskOriginSchema as G, taskDevboxSchema as H, TaskKind as I, taskStateSchema as J, taskQuestionSchema as K, TaskState as L, TaskTransitionOptions as M, taskIdSchema as Mt, createStores as N, CreateTaskInput as O, receiptIdSchema as Ot, Task as P, repositorySlugSchema as Q, coordinationRepositoryIdsSchema as R, ChangeAssociationError as S, ReceiptId as St, CreateChangeInput as T, TaskId as Tt, taskExecutionRepositoryIdsSchema as U, taskApprovalSchema as V, taskKindSchema as W, RepositorySlug as X, Repository as Y, repositorySchema as Z, findingVerificationMethodSchema as _, changeSchema as _t, approvalRuleSchema as a, receiptKindSchema as at, ApprovalDecision as b, ChangeId as bt, Finding as c, receiptStateSchema as ct, FindingVerification as d, standardReceiptStates as dt, Receipt as et, findingCategorySchema as f, Change as ft, findingVerificationLevelSchema as g, changeEvidenceSchema as gt, findingSchema as h, Level as ht, approvalPolicySchema as i, costSchema as it, TaskPatch as j, signalIdSchema as jt, DecideSignalOptions as k, repositoryIdSchema as kt, FindingCategory as l, standardReceiptKinds as lt, findingPrioritySchema as m, ChangeState as mt, ApprovalRule as n, ReceiptPhase as nt, defaultApprovalPolicy as o, receiptPhaseSchema as ot, findingFingerprint as p, ChangeEvidence as pt, taskSchema as q, ApprovalSubject as r, ReceiptState as rt, requiresApproval as s, receiptSchema as st, ApprovalPolicy as t, ReceiptKind as tt, FindingPriority as u, standardReceiptPhases as ut, findingVerificationSchema as v, changeStateSchema as vt, ChangeTransitionOptions as w, SignalId as wt, ApprovalError as x, FactoryId as xt, AppendReceiptInput as y, levelSchema as yt, harnessSchema as z };
|
|
519
|
+
//# sourceMappingURL=approval-CDiBco2V.d.mts.map
|
|
@@ -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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"}
|
|
@@ -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"}
|