@evo-dev/core 0.0.1-alpha.1 → 0.0.1-alpha.11
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/assets/skills/coding/knowledge-distillation/SKILL.md +117 -114
- package/assets/skills/coding/knowledge-distillation/references/knowledge-distillation-methods.md +11 -7
- package/assets/team/agents/code-reviewer.md +48 -0
- package/assets/team/agents/docs-maintainer.md +51 -0
- package/assets/team/agents/implementation-engineer.md +51 -0
- package/assets/team/agents/product-scope-analyst.md +58 -0
- package/assets/team/agents/release-engineer.md +55 -0
- package/assets/team/agents/security-boundary-reviewer.md +50 -0
- package/assets/team/agents/solution-architect.md +51 -0
- package/assets/team/agents/verification-engineer.md +51 -0
- package/assets/team/team.md +102 -0
- package/dist/config/index.js +925 -97
- package/dist/index.js +13107 -5618
- package/package.json +5 -1
- package/src/agents/index.ts +56 -264
- package/src/code-agent-traces/index.ts +520 -0
- package/src/config/index.ts +5 -0
- package/src/config/paths.ts +1 -1
- package/src/config/settings.ts +149 -0
- package/src/config/store.ts +2 -0
- package/src/daemon/index.ts +99 -50
- package/src/evolution/candidates/index.ts +564 -0
- package/src/evolution/control/index.ts +20 -0
- package/src/evolution/evidence/analysis.ts +533 -0
- package/src/evolution/evidence/index.ts +3 -0
- package/src/evolution/evidence/session-memory/analysis.ts +281 -0
- package/src/evolution/evidence/session-memory/constants.ts +9 -0
- package/src/evolution/evidence/session-memory/index.ts +7 -0
- package/src/evolution/evidence/session-memory/paths.ts +29 -0
- package/src/evolution/evidence/session-memory/policy.ts +39 -0
- package/src/evolution/evidence/session-memory/segment.ts +202 -0
- package/src/evolution/evidence/session-memory/sensitivity.ts +335 -0
- package/src/evolution/evidence/session-memory/state-machine.ts +249 -0
- package/src/evolution/evidence/session-memory/storage.ts +379 -0
- package/src/evolution/evidence/session-memory/types.ts +221 -0
- package/src/evolution/evidence/session-memory/updater.ts +191 -0
- package/src/evolution/formatters.ts +169 -0
- package/src/evolution/index.ts +16 -2356
- package/src/evolution/knowledge/index.ts +5427 -0
- package/src/evolution/paths.ts +44 -0
- package/src/evolution/processor/distillation.ts +518 -0
- package/src/evolution/processor/index.ts +3 -0
- package/src/evolution/processor/process.ts +528 -0
- package/src/{learning → evolution/review}/index.ts +10 -14
- package/src/evolution/schema.ts +568 -0
- package/src/evolution/shared.ts +758 -0
- package/src/evolution/triggers/classification.ts +102 -0
- package/src/evolution/triggers/index.ts +295 -0
- package/src/hooks/index.ts +438 -179
- package/src/index.ts +12 -3
- package/src/projects/index.ts +453 -0
- package/src/runtime-logs/index.ts +490 -24
- package/src/team/index.ts +1429 -185
- package/src/team/mcp.ts +9 -5
- package/src/team/prompts.ts +141 -0
- package/src/utils/errors.ts +13 -0
- package/src/utils/fs.ts +40 -0
- package/src/utils/hash.ts +9 -0
- package/src/utils/ids.ts +12 -0
- package/src/utils/index.ts +7 -0
- package/src/utils/parsing.ts +11 -0
- package/src/utils/text.ts +18 -0
- package/src/utils/time.ts +5 -0
- package/src/workflow/index.ts +3 -21
- package/src/project/index.ts +0 -507
- package/src/task/index.ts +0 -840
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evo-dev/core",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -10,18 +10,22 @@
|
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"types": "./src/index.ts",
|
|
13
|
+
"bun": "./src/index.ts",
|
|
13
14
|
"import": "./dist/index.js"
|
|
14
15
|
},
|
|
15
16
|
"./assets": {
|
|
16
17
|
"types": "./src/assets/index.ts",
|
|
18
|
+
"bun": "./src/assets/index.ts",
|
|
17
19
|
"import": "./dist/assets/index.js"
|
|
18
20
|
},
|
|
19
21
|
"./config": {
|
|
20
22
|
"types": "./src/config/index.ts",
|
|
23
|
+
"bun": "./src/config/index.ts",
|
|
21
24
|
"import": "./dist/config/index.js"
|
|
22
25
|
},
|
|
23
26
|
"./plugins": {
|
|
24
27
|
"types": "./src/plugins/index.ts",
|
|
28
|
+
"bun": "./src/plugins/index.ts",
|
|
25
29
|
"import": "./dist/plugins/index.js"
|
|
26
30
|
}
|
|
27
31
|
},
|
package/src/agents/index.ts
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
|
+
type ScopedKnowledgeContextPack,
|
|
4
|
+
createScopedKnowledgeContextPack,
|
|
5
|
+
formatScopedKnowledgePromptBlock,
|
|
6
|
+
} from "../evolution/knowledge/index.ts";
|
|
3
7
|
|
|
4
8
|
export type AgentPersistence = "named" | "dynamic";
|
|
5
|
-
export type AgentLens =
|
|
6
|
-
| "review"
|
|
7
|
-
| "qa"
|
|
8
|
-
| "security"
|
|
9
|
-
| "release"
|
|
10
|
-
| "architecture"
|
|
11
|
-
| "migration"
|
|
12
|
-
| "test";
|
|
13
9
|
export type AgentOutputSchemaId =
|
|
14
10
|
| "review-findings-v1"
|
|
15
11
|
| "verification-summary-v1"
|
|
@@ -56,34 +52,6 @@ export interface AgentProfile {
|
|
|
56
52
|
};
|
|
57
53
|
}
|
|
58
54
|
|
|
59
|
-
export interface AgentPlannedInvocation {
|
|
60
|
-
profile: AgentProfile;
|
|
61
|
-
lens: AgentLens;
|
|
62
|
-
reason: string;
|
|
63
|
-
plannedOnly: true;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export interface AgentMergePlan {
|
|
67
|
-
strategy: "none" | "single-output" | "dedupe-preserve-conflicts";
|
|
68
|
-
outputSchema: AgentOutputSchemaId | null;
|
|
69
|
-
dedupeBy: string[];
|
|
70
|
-
conflictPolicy: string[];
|
|
71
|
-
advisoryCategories: string[];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export interface AgentComposeDryRunPlan {
|
|
75
|
-
ok: boolean;
|
|
76
|
-
taskId: string;
|
|
77
|
-
mode: TaskExecutionMode | null;
|
|
78
|
-
workflowId: string | null;
|
|
79
|
-
agents: AgentPlannedInvocation[];
|
|
80
|
-
permissions: AgentPermissions;
|
|
81
|
-
mergePlan: AgentMergePlan;
|
|
82
|
-
warnings: string[];
|
|
83
|
-
advisories: string[];
|
|
84
|
-
rationale: string;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
55
|
export interface AgentContextDryRunBundle {
|
|
88
56
|
profile: AgentProfile;
|
|
89
57
|
context: {
|
|
@@ -96,6 +64,15 @@ export interface AgentContextDryRunBundle {
|
|
|
96
64
|
advisories: string[];
|
|
97
65
|
}
|
|
98
66
|
|
|
67
|
+
export interface AgentLoadedContextBundle {
|
|
68
|
+
profile: AgentProfile;
|
|
69
|
+
contextPack: ScopedKnowledgeContextPack | null;
|
|
70
|
+
promptBlock: string | null;
|
|
71
|
+
warnings: string[];
|
|
72
|
+
advisories: string[];
|
|
73
|
+
rawContentStored: false;
|
|
74
|
+
}
|
|
75
|
+
|
|
99
76
|
export interface ReviewFindingOutput {
|
|
100
77
|
summary: string;
|
|
101
78
|
findings: Array<{
|
|
@@ -124,17 +101,6 @@ const DEFAULT_AGENT_PERMISSIONS: AgentPermissions = {
|
|
|
124
101
|
};
|
|
125
102
|
const FORBIDDEN_INPUTS = ["rawPrompts", "secrets", "rawCommandLogs", "sourceCorpus"];
|
|
126
103
|
const SAFE_AGENT_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/;
|
|
127
|
-
const PRIVACY_ADVISORY_PATTERN =
|
|
128
|
-
/raw prompt|rawprompt|source corpus|sourcecorpus|secret|\.env|raw command|raw log|internal url|private url|network|write files|run commands|spawn agents|write memory/i;
|
|
129
|
-
const LENS_TO_EXPERTISE: Record<AgentLens, string[]> = {
|
|
130
|
-
review: ["code-review"],
|
|
131
|
-
qa: ["qa", "verification"],
|
|
132
|
-
security: ["security", "privacy"],
|
|
133
|
-
release: ["release", "packaging"],
|
|
134
|
-
architecture: ["architecture"],
|
|
135
|
-
migration: ["migration", "impact-analysis"],
|
|
136
|
-
test: ["testing"],
|
|
137
|
-
};
|
|
138
104
|
|
|
139
105
|
export function createDefaultAgentPermissions(): AgentPermissions {
|
|
140
106
|
return { ...DEFAULT_AGENT_PERMISSIONS };
|
|
@@ -188,67 +154,6 @@ export async function readAgentProfile(path: string): Promise<AgentProfile> {
|
|
|
188
154
|
return parseAgentProfile(JSON.parse(await readFile(path, "utf8")));
|
|
189
155
|
}
|
|
190
156
|
|
|
191
|
-
export function composeAgentDryRun(input: {
|
|
192
|
-
contract: TaskContract;
|
|
193
|
-
workflowId?: string;
|
|
194
|
-
lenses?: AgentLens[];
|
|
195
|
-
}): AgentComposeDryRunPlan {
|
|
196
|
-
const mode = input.contract.route.mode;
|
|
197
|
-
const workflowId = input.workflowId ?? input.contract.route.workflowId;
|
|
198
|
-
const warnings: string[] = [];
|
|
199
|
-
const permissions = createDefaultAgentPermissions();
|
|
200
|
-
const requestedLenses = dedupeLenses(input.lenses ?? []);
|
|
201
|
-
const advisories = collectPrivacyBoundaryAdvisories(input.contract, requestedLenses, workflowId);
|
|
202
|
-
|
|
203
|
-
if (mode === "minimal") {
|
|
204
|
-
return {
|
|
205
|
-
ok: advisories.length === 0,
|
|
206
|
-
taskId: input.contract.taskId,
|
|
207
|
-
mode,
|
|
208
|
-
workflowId,
|
|
209
|
-
agents: [],
|
|
210
|
-
permissions,
|
|
211
|
-
mergePlan: createMergePlan([]),
|
|
212
|
-
warnings,
|
|
213
|
-
advisories,
|
|
214
|
-
rationale: "Minimal mode does not force dynamic agents by default.",
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
const selectedLenses = selectLenses(
|
|
219
|
-
mode,
|
|
220
|
-
requestedLenses,
|
|
221
|
-
workflowId,
|
|
222
|
-
input.contract.route.requiredReview,
|
|
223
|
-
);
|
|
224
|
-
const agents = selectedLenses.map((lens) => ({
|
|
225
|
-
profile: createDynamicProfile(lens, input.contract, permissions),
|
|
226
|
-
lens,
|
|
227
|
-
reason: createLensReason(lens, mode, workflowId),
|
|
228
|
-
plannedOnly: true as const,
|
|
229
|
-
}));
|
|
230
|
-
|
|
231
|
-
if (mode === "standard" && agents.length > 1) {
|
|
232
|
-
warnings.push("Standard mode advisory selected more than one reviewer/triager.");
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
return {
|
|
236
|
-
ok: advisories.length === 0,
|
|
237
|
-
taskId: input.contract.taskId,
|
|
238
|
-
mode,
|
|
239
|
-
workflowId,
|
|
240
|
-
agents,
|
|
241
|
-
permissions,
|
|
242
|
-
mergePlan: createMergePlan(agents),
|
|
243
|
-
warnings,
|
|
244
|
-
advisories,
|
|
245
|
-
rationale:
|
|
246
|
-
agents.length === 0
|
|
247
|
-
? "No dynamic agents selected; deterministic verification may be sufficient."
|
|
248
|
-
: `Selected ${agents.length} planned-only agent(s) based on mode/workflow/lenses.`,
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
|
|
252
157
|
export function loadAgentContextDryRun(profile: AgentProfile): AgentContextDryRunBundle {
|
|
253
158
|
const parsed = parseAgentProfile(profile);
|
|
254
159
|
return {
|
|
@@ -271,6 +176,48 @@ export function loadAgentContextDryRun(profile: AgentProfile): AgentContextDryRu
|
|
|
271
176
|
};
|
|
272
177
|
}
|
|
273
178
|
|
|
179
|
+
export async function loadAgentContext(input: {
|
|
180
|
+
homeDir: string;
|
|
181
|
+
profile: AgentProfile;
|
|
182
|
+
projectKey?: string;
|
|
183
|
+
roleId?: string;
|
|
184
|
+
workflowId?: string;
|
|
185
|
+
paths?: string[];
|
|
186
|
+
queryText?: string;
|
|
187
|
+
limit?: number;
|
|
188
|
+
}): Promise<AgentLoadedContextBundle> {
|
|
189
|
+
const parsed = parseAgentProfile(input.profile);
|
|
190
|
+
const pack = await createScopedKnowledgeContextPack({
|
|
191
|
+
homeDir: input.homeDir,
|
|
192
|
+
projectKey: input.projectKey,
|
|
193
|
+
roleId: input.roleId ?? parsed.id,
|
|
194
|
+
workflowId: input.workflowId,
|
|
195
|
+
paths: input.paths,
|
|
196
|
+
queryText: input.queryText,
|
|
197
|
+
limit: input.limit,
|
|
198
|
+
});
|
|
199
|
+
return {
|
|
200
|
+
profile: parsed,
|
|
201
|
+
contextPack: pack,
|
|
202
|
+
promptBlock: pack === null ? null : formatScopedKnowledgePromptBlock(pack),
|
|
203
|
+
warnings: pack?.warnings ?? [],
|
|
204
|
+
advisories: [],
|
|
205
|
+
rawContentStored: false,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export function formatAgentLoadedContextPromptBlock(bundle: AgentLoadedContextBundle): string {
|
|
210
|
+
if (bundle.promptBlock !== null) return bundle.promptBlock;
|
|
211
|
+
return [
|
|
212
|
+
"EvoDev Scoped Knowledge Context",
|
|
213
|
+
`Agent: ${bundle.profile.id}`,
|
|
214
|
+
"Raw content stored: false",
|
|
215
|
+
"",
|
|
216
|
+
"Applicable items:",
|
|
217
|
+
"- none",
|
|
218
|
+
].join("\n");
|
|
219
|
+
}
|
|
220
|
+
|
|
274
221
|
export function validateAgentOutput(
|
|
275
222
|
schema: AgentOutputSchemaId,
|
|
276
223
|
output: unknown,
|
|
@@ -320,47 +267,6 @@ export function mergeReviewFindings(outputs: ReviewFindingOutput[]): {
|
|
|
320
267
|
return { acceptedFindings: [...byKey.values()], unresolvedConflicts: conflicts };
|
|
321
268
|
}
|
|
322
269
|
|
|
323
|
-
export function formatAgentComposeDryRun(plan: AgentComposeDryRunPlan): string {
|
|
324
|
-
return [
|
|
325
|
-
"EvoDev agent compose dry-run",
|
|
326
|
-
"",
|
|
327
|
-
`Task: ${plan.taskId}`,
|
|
328
|
-
`Mode: ${plan.mode ?? "not routed"}`,
|
|
329
|
-
`Workflow: ${plan.workflowId ?? "none"}`,
|
|
330
|
-
`Rationale: ${plan.rationale}`,
|
|
331
|
-
"No-write/no-spawn: true",
|
|
332
|
-
"Privacy: local-private, metadata-only, raw prompts/source/secrets/logs forbidden",
|
|
333
|
-
"Agents:",
|
|
334
|
-
...(plan.agents.length === 0
|
|
335
|
-
? [" - none"]
|
|
336
|
-
: plan.agents.map(
|
|
337
|
-
(agent) =>
|
|
338
|
-
` - ${agent.profile.id} [${agent.lens}] traits=${agent.profile.traits.expertise.join(",")} schema=${agent.profile.output.schema} plannedOnly=${agent.plannedOnly}`,
|
|
339
|
-
)),
|
|
340
|
-
"Inputs:",
|
|
341
|
-
...(plan.agents.length === 0
|
|
342
|
-
? [" - none"]
|
|
343
|
-
: [
|
|
344
|
-
` - required: ${plan.agents[0].profile.inputs.required.join(",")}`,
|
|
345
|
-
` - optional: ${plan.agents[0].profile.inputs.optional.join(",")}`,
|
|
346
|
-
` - forbidden: ${plan.agents[0].profile.inputs.forbidden.join(",")}`,
|
|
347
|
-
]),
|
|
348
|
-
"Permissions:",
|
|
349
|
-
...Object.entries(plan.permissions).map(([key, value]) => ` - ${key}: ${value}`),
|
|
350
|
-
"Merge plan:",
|
|
351
|
-
` - strategy: ${plan.mergePlan.strategy}`,
|
|
352
|
-
` - outputSchema: ${plan.mergePlan.outputSchema ?? "none"}`,
|
|
353
|
-
"Warnings:",
|
|
354
|
-
...(plan.warnings.length === 0
|
|
355
|
-
? [" - none"]
|
|
356
|
-
: plan.warnings.map((warning) => ` - ${warning}`)),
|
|
357
|
-
"Advisories:",
|
|
358
|
-
...(plan.advisories.length === 0
|
|
359
|
-
? [" - none"]
|
|
360
|
-
: plan.advisories.map((advisory) => ` - ${advisory}`)),
|
|
361
|
-
].join("\n");
|
|
362
|
-
}
|
|
363
|
-
|
|
364
270
|
export function formatAgentContextDryRun(bundle: AgentContextDryRunBundle): string {
|
|
365
271
|
return [
|
|
366
272
|
"EvoDev agent load-context dry-run",
|
|
@@ -380,116 +286,6 @@ export function formatAgentContextDryRun(bundle: AgentContextDryRunBundle): stri
|
|
|
380
286
|
].join("\n");
|
|
381
287
|
}
|
|
382
288
|
|
|
383
|
-
function createDynamicProfile(
|
|
384
|
-
lens: AgentLens,
|
|
385
|
-
contract: TaskContract,
|
|
386
|
-
permissions: AgentPermissions,
|
|
387
|
-
): AgentProfile {
|
|
388
|
-
return {
|
|
389
|
-
version: 1,
|
|
390
|
-
id: `dynamic-${lens}-${contract.taskId}`.slice(0, 100),
|
|
391
|
-
name: `Dynamic ${lens} reviewer`,
|
|
392
|
-
persistence: "dynamic",
|
|
393
|
-
description: `Task-scoped ${lens} profile for metadata-only dry-run planning.`,
|
|
394
|
-
traits: {
|
|
395
|
-
expertise: LENS_TO_EXPERTISE[lens],
|
|
396
|
-
stance: ["skeptical-reviewer"],
|
|
397
|
-
approach: ["evidence-first", "advisory"],
|
|
398
|
-
domain: ["software-rd"],
|
|
399
|
-
},
|
|
400
|
-
inputs: {
|
|
401
|
-
required: ["taskContract", "scope", "evidenceSummary"],
|
|
402
|
-
optional: ["workflowPlan"],
|
|
403
|
-
forbidden: FORBIDDEN_INPUTS,
|
|
404
|
-
},
|
|
405
|
-
permissions,
|
|
406
|
-
output: {
|
|
407
|
-
schema: "review-findings-v1",
|
|
408
|
-
requiredFields: ["summary", "findings", "confidence", "evidenceRefs"],
|
|
409
|
-
},
|
|
410
|
-
privacy: {
|
|
411
|
-
classification: "local-private",
|
|
412
|
-
metadataOnly: true,
|
|
413
|
-
rawPromptStored: false,
|
|
414
|
-
sourceContentStored: false,
|
|
415
|
-
},
|
|
416
|
-
};
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
function selectLenses(
|
|
420
|
-
mode: TaskExecutionMode | null,
|
|
421
|
-
requested: AgentLens[],
|
|
422
|
-
workflowId: string | null,
|
|
423
|
-
requiredReview: string[],
|
|
424
|
-
): AgentLens[] {
|
|
425
|
-
if (requested.length > 0) return mode === "standard" ? requested.slice(0, 1) : requested;
|
|
426
|
-
if (mode === "standard") return requiredReview.length > 0 ? ["review"] : [];
|
|
427
|
-
if (mode === "rigorous") {
|
|
428
|
-
if (workflowId?.includes("security")) return ["security", "review"];
|
|
429
|
-
if (workflowId?.includes("release")) return ["release", "security"];
|
|
430
|
-
if (workflowId?.includes("migration")) return ["migration", "architecture"];
|
|
431
|
-
if (workflowId?.includes("architecture")) return ["architecture", "review"];
|
|
432
|
-
return requiredReview.length > 0 ? ["review", "qa"] : [];
|
|
433
|
-
}
|
|
434
|
-
return [];
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
function createMergePlan(agents: AgentPlannedInvocation[]): AgentMergePlan {
|
|
438
|
-
if (agents.length === 0)
|
|
439
|
-
return {
|
|
440
|
-
strategy: "none",
|
|
441
|
-
outputSchema: null,
|
|
442
|
-
dedupeBy: [],
|
|
443
|
-
conflictPolicy: [],
|
|
444
|
-
advisoryCategories: [],
|
|
445
|
-
};
|
|
446
|
-
if (agents.length === 1)
|
|
447
|
-
return {
|
|
448
|
-
strategy: "single-output",
|
|
449
|
-
outputSchema: agents[0].profile.output.schema,
|
|
450
|
-
dedupeBy: [],
|
|
451
|
-
conflictPolicy: [],
|
|
452
|
-
advisoryCategories: [],
|
|
453
|
-
};
|
|
454
|
-
return {
|
|
455
|
-
strategy: "dedupe-preserve-conflicts",
|
|
456
|
-
outputSchema: "review-findings-v1",
|
|
457
|
-
dedupeBy: ["category", "path", "line", "title"],
|
|
458
|
-
conflictPolicy: ["preserve dissent", "keep higher severity unless evidence refutes"],
|
|
459
|
-
advisoryCategories: ["security", "privacy", "release"],
|
|
460
|
-
};
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
function createLensReason(
|
|
464
|
-
lens: AgentLens,
|
|
465
|
-
mode: TaskExecutionMode | null,
|
|
466
|
-
workflowId: string | null,
|
|
467
|
-
): string {
|
|
468
|
-
return `${lens} lens selected for ${mode ?? "unrouted"} mode${workflowId ? ` and workflow ${workflowId}` : ""}.`;
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
function collectPrivacyBoundaryAdvisories(
|
|
472
|
-
contract: TaskContract,
|
|
473
|
-
lenses: AgentLens[],
|
|
474
|
-
workflowId: string | null,
|
|
475
|
-
): string[] {
|
|
476
|
-
const text = [
|
|
477
|
-
contract.source.summary,
|
|
478
|
-
contract.currentState.summary,
|
|
479
|
-
contract.targetState.summary,
|
|
480
|
-
contract.route.rationale,
|
|
481
|
-
workflowId ?? "",
|
|
482
|
-
...contract.scope.allowedOperations,
|
|
483
|
-
...contract.scope.requiresUserConfirmation,
|
|
484
|
-
...lenses,
|
|
485
|
-
].join(" ");
|
|
486
|
-
return PRIVACY_ADVISORY_PATTERN.test(text)
|
|
487
|
-
? [
|
|
488
|
-
"Agent planning detected privacy/risky context requiring raw data, writes, commands, network, spawning, or memory.",
|
|
489
|
-
]
|
|
490
|
-
: [];
|
|
491
|
-
}
|
|
492
|
-
|
|
493
289
|
function validateRequiredObject(
|
|
494
290
|
output: unknown,
|
|
495
291
|
fields: string[],
|
|
@@ -513,10 +309,6 @@ function isKnownOutputSchema(value: unknown): value is AgentOutputSchemaId {
|
|
|
513
309
|
);
|
|
514
310
|
}
|
|
515
311
|
|
|
516
|
-
function dedupeLenses(lenses: AgentLens[]): AgentLens[] {
|
|
517
|
-
return [...new Set(lenses)];
|
|
518
|
-
}
|
|
519
|
-
|
|
520
312
|
function severityRank(severity: AgentFindingSeverity): number {
|
|
521
313
|
return { info: 0, low: 1, medium: 2, high: 3, critical: 4 }[severity];
|
|
522
314
|
}
|