@exellix/ai-tasks 9.1.0 → 9.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -4
- package/README.md +2 -2
- package/RUNTASK_REQUEST.md +17 -15
- package/dist/compile/compileTaskConfiguration.d.ts.map +1 -1
- package/dist/compile/compileTaskConfiguration.js +3 -0
- package/dist/compile/compileTaskConfiguration.js.map +1 -1
- package/dist/core/task-sdk.d.ts.map +1 -1
- package/dist/core/task-sdk.js +112 -166
- package/dist/core/task-sdk.js.map +1 -1
- package/dist/invocation/types.d.ts +1 -1
- package/dist/narrix/narrixUnitExecution.js +2 -2
- package/dist/narrix/narrixUnitExecution.js.map +1 -1
- package/dist/node-execution/buildRequestFromNodePlan.d.ts +4 -0
- package/dist/node-execution/buildRequestFromNodePlan.d.ts.map +1 -1
- package/dist/node-execution/buildRequestFromNodePlan.js +4 -13
- package/dist/node-execution/buildRequestFromNodePlan.js.map +1 -1
- package/dist/node-execution/compileProfessionalAnswerRequest.d.ts +2 -0
- package/dist/node-execution/compileProfessionalAnswerRequest.d.ts.map +1 -0
- package/dist/node-execution/compileProfessionalAnswerRequest.js +4 -0
- package/dist/node-execution/compileProfessionalAnswerRequest.js.map +1 -0
- package/dist/node-execution/rejectForbiddenWireFields.d.ts +2 -0
- package/dist/node-execution/rejectForbiddenWireFields.d.ts.map +1 -1
- package/dist/node-execution/rejectForbiddenWireFields.js +42 -7
- package/dist/node-execution/rejectForbiddenWireFields.js.map +1 -1
- package/dist/post-steps/audit/auditChecklistFuncxEnvelope.d.ts +19 -3
- package/dist/post-steps/audit/auditChecklistFuncxEnvelope.d.ts.map +1 -1
- package/dist/post-steps/audit/auditChecklistFuncxEnvelope.js +7 -1
- package/dist/post-steps/audit/auditChecklistFuncxEnvelope.js.map +1 -1
- package/dist/post-steps/audit/loadAuditTemplates.d.ts +2 -55
- package/dist/post-steps/audit/loadAuditTemplates.d.ts.map +1 -1
- package/dist/post-steps/audit/loadAuditTemplates.js +3 -38
- package/dist/post-steps/audit/loadAuditTemplates.js.map +1 -1
- package/dist/post-steps/audit/parseAuditFuncxOutput.d.ts +8 -0
- package/dist/post-steps/audit/parseAuditFuncxOutput.d.ts.map +1 -0
- package/dist/post-steps/audit/parseAuditFuncxOutput.js +62 -0
- package/dist/post-steps/audit/parseAuditFuncxOutput.js.map +1 -0
- package/dist/post-steps/audit/parseAuditOutput.d.ts +2 -0
- package/dist/post-steps/audit/parseAuditOutput.d.ts.map +1 -1
- package/dist/post-steps/audit/parseAuditOutput.js +56 -0
- package/dist/post-steps/audit/parseAuditOutput.js.map +1 -1
- package/dist/post-steps/audit/runAudit.d.ts.map +1 -1
- package/dist/post-steps/audit/runAudit.js +53 -113
- package/dist/post-steps/audit/runAudit.js.map +1 -1
- package/dist/post-steps/audit/runAuditFuncxCall.d.ts +18 -0
- package/dist/post-steps/audit/runAuditFuncxCall.d.ts.map +1 -0
- package/dist/post-steps/audit/runAuditFuncxCall.js +59 -0
- package/dist/post-steps/audit/runAuditFuncxCall.js.map +1 -0
- package/dist/synthesis/resolveSourceMaterial.d.ts.map +1 -1
- package/dist/synthesis/resolveSourceMaterial.js +14 -0
- package/dist/synthesis/resolveSourceMaterial.js.map +1 -1
- package/dist/types/task-types.d.ts +4 -3
- package/dist/types/task-types.d.ts.map +1 -1
- package/dist/utils/bridgeRunSkillGatewayMemory.d.ts.map +1 -1
- package/dist/utils/bridgeRunSkillGatewayMemory.js +1 -0
- package/dist/utils/bridgeRunSkillGatewayMemory.js.map +1 -1
- package/dist/utils/executionMemoryInputRecord.d.ts +12 -0
- package/dist/utils/executionMemoryInputRecord.d.ts.map +1 -0
- package/dist/utils/executionMemoryInputRecord.js +28 -0
- package/dist/utils/executionMemoryInputRecord.js.map +1 -0
- package/dist/utils/resolveAiProfileModel.d.ts +1 -1
- package/dist/utils/resolveAiProfileModel.d.ts.map +1 -1
- package/dist/utils/skillTemplateVariables.d.ts +3 -2
- package/dist/utils/skillTemplateVariables.d.ts.map +1 -1
- package/dist/utils/skillTemplateVariables.js +3 -2
- package/dist/utils/skillTemplateVariables.js.map +1 -1
- package/dist/validation/validateProfessionalAnswerContract.d.ts +8 -0
- package/dist/validation/validateProfessionalAnswerContract.d.ts.map +1 -0
- package/dist/validation/validateProfessionalAnswerContract.js +45 -0
- package/dist/validation/validateProfessionalAnswerContract.js.map +1 -0
- package/dist/validation/validateRunTaskConfig.d.ts.map +1 -1
- package/dist/validation/validateRunTaskConfig.js +2 -0
- package/dist/validation/validateRunTaskConfig.js.map +1 -1
- package/documenations/record-and-template-variables.md +21 -13
- package/documenations/run-task-execution-flow.md +1 -1
- package/documenations/upstream-feature-requests/README.md +9 -5
- package/documenations/upstream-feature-requests/ai-skills-orchestrator-invoke-contract-5.9.md +1 -1
- package/documenations/upstream-feature-requests/funcx-4.9.13-open-items.md +62 -0
- package/documenations/upstream-feature-requests/funcx-gap-analysis-cr-fr.md +401 -0
- package/documenations/upstream-feature-requests/funcx-pre-post-sidekick-actions.md +1 -0
- package/documenations/upstream-feature-requests/graph-engine-runtask-contract-alignment-investigation.md +370 -0
- package/documenations/upstream-feature-requests/xynthesis-ai-profiles-2.1-import-break.md +2 -2
- package/documenations/upstream-feature-requests/xynthesis-openrouter-wire-model-double-prefix-bug.md +1 -1
- package/documenations/upstream-feature-requests/xynthesis-orchestrator-invoke-contract-4.2.md +1 -1
- package/package.json +10 -9
- package/.docs/DOWNSTREAM_ENV.md +0 -42
- package/.docs/FEEDBACK_TO_CLIENT_DOWNSTREAM_FIXES.md +0 -64
- package/.docs/INTERMEDIATE_STEPS.md +0 -82
- package/.docs/activity-structure.md +0 -31
- package/.docs/ai-task-ai-scoping-spec.md +0 -338
- package/.docs/ai-tasks-model-profile-aliases-7x.md +0 -96
- package/.docs/blockers-and-issues.md +0 -346
- package/.docs/building-runTask-sdk.md +0 -659
- package/.docs/building-skill-execution-orchestrator.md +0 -968
- package/.docs/code-used-before/run-task.txt +0 -39
- package/.docs/code-used-before/task-executor.ts.old +0 -57
- package/.docs/code-used-before/test-run-task.ts.old +0 -42
- package/.docs/code-used-before/types.txt +0 -23
- package/.docs/env-ready-policy.md +0 -40
- package/.docs/flow-io/flow-README.md +0 -76
- package/.docs/flow-io/narrix.md +0 -124
- package/.docs/flow-io/web-scoping.md +0 -135
- package/.docs/flow-io/xynthesis-post.md +0 -154
- package/.docs/flow-io/xynthesis-pre.md +0 -181
- package/.docs/gap-analysis.md +0 -201
- package/.docs/integration-facts-ai-tasks.md +0 -109
- package/.docs/investigation/ai-skills.md +0 -170
- package/.docs/investigation/external-packages-assignments.md +0 -66
- package/.docs/investigation/integration-summary.md +0 -20
- package/.docs/investigation/narrix-catalox.md +0 -29
- package/.docs/investigation/workplan-close-graph-engine-gaps.md +0 -101
- package/.docs/logging-stack.md +0 -30
- package/.docs/memory-narrix-adapter-developer-guide.md +0 -402
- package/.docs/memory-narrix-adapter-requirements.md +0 -112
- package/.docs/narrix-context-consumption-gap.md +0 -184
- package/.docs/narrix-context-downstream-report.md +0 -30
- package/.docs/narrix-ingest-and-packs-library-spec.md +0 -240
- package/.docs/narrix-record-input-current-design.md +0 -48
- package/.docs/pacakge.md +0 -48
- package/.docs/possible-components/README.md +0 -11
- package/.docs/possible-components/integration/README.md +0 -10
- package/.docs/possible-components/integration/gaps-when-merging.md +0 -16
- package/.docs/possible-components/integration/platform.md +0 -54
- package/.docs/possible-components/integration/reintegrate-into-ai-tasks.md +0 -26
- package/.docs/possible-components/integration/roadmap-and-checklists.md +0 -54
- package/.docs/possible-components/post-component/README.md +0 -18
- package/.docs/possible-components/post-component/builder-guide.md +0 -175
- package/.docs/possible-components/post-component/gaps-and-artifacts.md +0 -52
- package/.docs/possible-components/post-component/handler-audit.md +0 -47
- package/.docs/possible-components/post-component/handler-polish.md +0 -41
- package/.docs/possible-components/post-component/unified-protocol.md +0 -59
- package/.docs/possible-components/pre-component/README.md +0 -22
- package/.docs/possible-components/pre-component/builder-guide.md +0 -127
- package/.docs/possible-components/pre-component/gaps-and-artifacts.md +0 -35
- package/.docs/possible-components/pre-component/handler-ai-scoping.md +0 -45
- package/.docs/possible-components/pre-component/handler-narrix-preprocessor.md +0 -49
- package/.docs/possible-components/pre-component/handler-narrix-system2.md +0 -35
- package/.docs/possible-components/pre-component/handler-synthesized-context.md +0 -65
- package/.docs/possible-components/pre-component/handler-web-scope.md +0 -29
- package/.docs/possible-components/pre-component/unified-protocol.md +0 -89
- package/.docs/prefer-openrouter-routing-policy.md +0 -114
- package/.docs/questions-for-ai-skills.md +0 -123
- package/.docs/realtime-narrixing-gap-analysis.md +0 -40
- package/.docs/realtime-narrixing.md +0 -433
- package/.docs/run-context-object.md +0 -32
- package/.docs/session-id-usage.md +0 -26
- package/.docs/skill-library-spec.md +0 -249
- package/.docs/synthesized-context-strategy-spec.md +0 -906
- package/.docs/upstream-issue/2026-03-21_woroces-ai-tasks_ISSUE-006_web-scope-question-from-cni-entity.md +0 -46
- package/.docs/web-scopper-embed.md +0 -93
- package/.docs/xynthesis-wiring-and-io.md +0 -12
- package/documenations/activix-feature-request-identity.md +0 -123
- package/documenations/bug-report-xynthesis-and-synthesis-call.md +0 -217
- package/documenations/feature-request-ai-skills-raw-template-access.md +0 -82
- package/documenations/feature-request-athenix-core-directive.md +0 -145
- package/documenations/feature-request-athenix-token-extraction.md +0 -124
- package/documenations/funcx-upstream-github-issues-draft.md +0 -153
- package/documenations/identity-metadata-contract.md +0 -165
- package/documenations/run-task-single-run-checklist.md +0 -109
- package/documenations/sessions/2026-06-08-subnets-model-resolution/CR-1-no-concrete-wire-in-graph-plans.md +0 -93
- package/documenations/sessions/2026-06-08-subnets-model-resolution/CR-2-skillModel-profile-only-at-storage.md +0 -88
- package/documenations/sessions/2026-06-08-subnets-model-resolution/CR-3-reject-concrete-models-in-catalog-rows.md +0 -76
- package/documenations/sessions/2026-06-08-subnets-model-resolution/FR-1-suggested-profile-in-catalogs.md +0 -96
- package/documenations/sessions/2026-06-08-subnets-model-resolution/FR-2-graph-engine-failure-phase-attribution.md +0 -92
- package/documenations/sessions/2026-06-08-subnets-model-resolution/INVESTIGATION-original-bug.md +0 -182
- package/documenations/sessions/2026-06-08-subnets-model-resolution/PROBLEM.md +0 -236
- package/documenations/sessions/2026-06-08-subnets-model-resolution/README.md +0 -11
- package/documenations/sessions/2026-06-08-subnets-model-resolution/funcx-test-resolveModel.cheapDefaultWireSlug.test.ts +0 -117
- package/documenations/upstream-feature-requests/ai-tasks-wrap-up-after-upstream.md +0 -129
- package/documenations/upstream-feedback-request-shape-clarification.md +0 -101
- package/documenations/web-context-precedence.md +0 -33
- package/documenations/xynthesis-activix-telemetry.md +0 -28
|
@@ -1,31 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Load audit POST step
|
|
2
|
+
* Load audit POST step feedback-injection template from disk.
|
|
3
|
+
* Base path = AUDIT_TEMPLATES_PATH or cwd/templates/post-steps/audit.
|
|
3
4
|
*/
|
|
4
5
|
export type AuditTemplates = {
|
|
5
|
-
system: string;
|
|
6
|
-
user: string;
|
|
7
6
|
feedbackInjection: string;
|
|
8
|
-
synthesis: string;
|
|
9
7
|
};
|
|
10
8
|
export declare function loadAuditTemplates(): Promise<AuditTemplates>;
|
|
11
|
-
export declare function renderAuditSystem(template: string, data: {
|
|
12
|
-
customGuidelines?: string;
|
|
13
|
-
}): string;
|
|
14
|
-
export declare function renderAuditUser(template: string, data: {
|
|
15
|
-
originalInput: string;
|
|
16
|
-
promptContext: string;
|
|
17
|
-
candidateOutput: string;
|
|
18
|
-
mustChecks: {
|
|
19
|
-
check: string;
|
|
20
|
-
weight: number;
|
|
21
|
-
}[];
|
|
22
|
-
shouldChecks: {
|
|
23
|
-
check: string;
|
|
24
|
-
weight: number;
|
|
25
|
-
}[];
|
|
26
|
-
previousFeedback?: string;
|
|
27
|
-
previousCycle?: number;
|
|
28
|
-
}): string;
|
|
29
9
|
export declare function renderFeedbackInjection(template: string, data: {
|
|
30
10
|
cycle: number;
|
|
31
11
|
maxCycles: number;
|
|
@@ -36,37 +16,4 @@ export declare function renderFeedbackInjection(template: string, data: {
|
|
|
36
16
|
}[];
|
|
37
17
|
overallFeedback: string;
|
|
38
18
|
}): string;
|
|
39
|
-
export declare function renderSynthesis(template: string, data: {
|
|
40
|
-
originalInput: string;
|
|
41
|
-
promptContext: string;
|
|
42
|
-
candidateA: {
|
|
43
|
-
cycle: number;
|
|
44
|
-
score: number;
|
|
45
|
-
output: string;
|
|
46
|
-
failedChecks: {
|
|
47
|
-
kind: string;
|
|
48
|
-
check: string;
|
|
49
|
-
feedback: string;
|
|
50
|
-
}[];
|
|
51
|
-
passedChecks: {
|
|
52
|
-
kind: string;
|
|
53
|
-
check: string;
|
|
54
|
-
}[];
|
|
55
|
-
};
|
|
56
|
-
candidateB: {
|
|
57
|
-
cycle: number;
|
|
58
|
-
score: number;
|
|
59
|
-
output: string;
|
|
60
|
-
failedChecks: {
|
|
61
|
-
kind: string;
|
|
62
|
-
check: string;
|
|
63
|
-
feedback: string;
|
|
64
|
-
}[];
|
|
65
|
-
passedChecks: {
|
|
66
|
-
kind: string;
|
|
67
|
-
check: string;
|
|
68
|
-
}[];
|
|
69
|
-
};
|
|
70
|
-
customSynthesisGuidelines?: string;
|
|
71
|
-
}): string;
|
|
72
19
|
//# sourceMappingURL=loadAuditTemplates.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadAuditTemplates.d.ts","sourceRoot":"","sources":["../../../src/post-steps/audit/loadAuditTemplates.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"loadAuditTemplates.d.ts","sourceRoot":"","sources":["../../../src/post-steps/audit/loadAuditTemplates.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,MAAM,MAAM,cAAc,GAAG;IAC3B,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAMF,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,cAAc,CAAC,CASlE;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAClE,eAAe,EAAE,MAAM,CAAC;CACzB,GAAG,MAAM,CAGT"}
|
|
@@ -1,62 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Load audit POST step
|
|
2
|
+
* Load audit POST step feedback-injection template from disk.
|
|
3
|
+
* Base path = AUDIT_TEMPLATES_PATH or cwd/templates/post-steps/audit.
|
|
3
4
|
*/
|
|
4
5
|
import { readFile } from "fs/promises";
|
|
5
6
|
import { join } from "path";
|
|
6
7
|
import Handlebars from "handlebars";
|
|
7
|
-
const DEFAULT_SYSTEM = `You are a strict quality auditor. Evaluate every check, output structured markdown with "### Checks" and "### Overall feedback" sections.`;
|
|
8
|
-
const DEFAULT_USER = `Original input: {{originalInput}}\n\nContext: {{promptContext}}\n\nCandidate: {{candidateOutput}}\n\nMust: {{mustChecks}}\nShould: {{shouldChecks}}`;
|
|
9
8
|
const DEFAULT_FEEDBACK = `## Audit Feedback (cycle {{cycle}} of {{maxCycles}})\n\n{{overallFeedback}}\n\nFailed: {{failedChecks}}`;
|
|
10
|
-
const DEFAULT_SYNTHESIS = `Merge the best of two candidates. Output only the merged task output.`;
|
|
11
9
|
function getBasePath() {
|
|
12
10
|
return process.env.AUDIT_TEMPLATES_PATH ?? process.cwd();
|
|
13
11
|
}
|
|
14
12
|
export async function loadAuditTemplates() {
|
|
15
13
|
const base = join(getBasePath(), "templates", "post-steps", "audit");
|
|
16
|
-
let system = DEFAULT_SYSTEM;
|
|
17
|
-
let user = DEFAULT_USER;
|
|
18
14
|
let feedbackInjection = DEFAULT_FEEDBACK;
|
|
19
|
-
let synthesis = DEFAULT_SYNTHESIS;
|
|
20
|
-
try {
|
|
21
|
-
system = await readFile(join(base, "system.md"), "utf-8");
|
|
22
|
-
}
|
|
23
|
-
catch {
|
|
24
|
-
/* use default */
|
|
25
|
-
}
|
|
26
|
-
try {
|
|
27
|
-
user = await readFile(join(base, "user.txt"), "utf-8");
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
/* use default */
|
|
31
|
-
}
|
|
32
15
|
try {
|
|
33
16
|
feedbackInjection = await readFile(join(base, "feedback-injection.md"), "utf-8");
|
|
34
17
|
}
|
|
35
18
|
catch {
|
|
36
19
|
/* use default */
|
|
37
20
|
}
|
|
38
|
-
|
|
39
|
-
synthesis = await readFile(join(base, "synthesis.md"), "utf-8");
|
|
40
|
-
}
|
|
41
|
-
catch {
|
|
42
|
-
/* use default */
|
|
43
|
-
}
|
|
44
|
-
return { system, user, feedbackInjection, synthesis };
|
|
45
|
-
}
|
|
46
|
-
export function renderAuditSystem(template, data) {
|
|
47
|
-
const t = Handlebars.compile(template);
|
|
48
|
-
return t(data);
|
|
49
|
-
}
|
|
50
|
-
export function renderAuditUser(template, data) {
|
|
51
|
-
const t = Handlebars.compile(template);
|
|
52
|
-
return t(data);
|
|
21
|
+
return { feedbackInjection };
|
|
53
22
|
}
|
|
54
23
|
export function renderFeedbackInjection(template, data) {
|
|
55
24
|
const t = Handlebars.compile(template);
|
|
56
25
|
return t(data);
|
|
57
26
|
}
|
|
58
|
-
export function renderSynthesis(template, data) {
|
|
59
|
-
const t = Handlebars.compile(template);
|
|
60
|
-
return t(data);
|
|
61
|
-
}
|
|
62
27
|
//# sourceMappingURL=loadAuditTemplates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadAuditTemplates.js","sourceRoot":"","sources":["../../../src/post-steps/audit/loadAuditTemplates.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"loadAuditTemplates.js","sourceRoot":"","sources":["../../../src/post-steps/audit/loadAuditTemplates.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,MAAM,gBAAgB,GAAG,yGAAyG,CAAC;AAMnI,SAAS,WAAW;IAClB,OAAO,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;AAC3D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB;IACtC,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;IACrE,IAAI,iBAAiB,GAAG,gBAAgB,CAAC;IACzC,IAAI,CAAC;QACH,iBAAiB,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,uBAAuB,CAAC,EAAE,OAAO,CAAC,CAAC;IACnF,CAAC;IAAC,MAAM,CAAC;QACP,iBAAiB;IACnB,CAAC;IACD,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,QAAgB,EAAE,IAKzD;IACC,MAAM,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACvC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalize FuncX `post/audit-checklist` run() output to {@link AuditLLMOutput}.
|
|
3
|
+
* Accepts markdown (preferred) or JSON `{ checks, overall_feedback }` from schema validation.
|
|
4
|
+
*/
|
|
5
|
+
import type { AuditLLMOutput } from "../../types/task-types.js";
|
|
6
|
+
/** Parse audit checklist output from FuncX `run()` value or markdown text. */
|
|
7
|
+
export declare function parseAuditFuncxOutput(value: unknown): AuditLLMOutput;
|
|
8
|
+
//# sourceMappingURL=parseAuditFuncxOutput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseAuditFuncxOutput.d.ts","sourceRoot":"","sources":["../../../src/post-steps/audit/parseAuditFuncxOutput.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAoB,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAgClF,8EAA8E;AAC9E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,CAwBpE"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalize FuncX `post/audit-checklist` run() output to {@link AuditLLMOutput}.
|
|
3
|
+
* Accepts markdown (preferred) or JSON `{ checks, overall_feedback }` from schema validation.
|
|
4
|
+
*/
|
|
5
|
+
import { parseAuditOutputFromMarkdown } from "./parseAuditOutput.js";
|
|
6
|
+
function isRecord(v) {
|
|
7
|
+
return v !== null && typeof v === "object" && !Array.isArray(v);
|
|
8
|
+
}
|
|
9
|
+
function normalizePassed(v) {
|
|
10
|
+
if (typeof v === "boolean")
|
|
11
|
+
return v;
|
|
12
|
+
if (typeof v === "string")
|
|
13
|
+
return v.toLowerCase() === "yes" || v.toLowerCase() === "true";
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
function parseChecksFromJson(checks) {
|
|
17
|
+
if (!Array.isArray(checks))
|
|
18
|
+
return [];
|
|
19
|
+
const out = [];
|
|
20
|
+
for (const item of checks) {
|
|
21
|
+
if (!isRecord(item))
|
|
22
|
+
continue;
|
|
23
|
+
const check = typeof item.check === "string" ? item.check.trim() : "";
|
|
24
|
+
const kindRaw = typeof item.kind === "string" ? item.kind.toLowerCase() : "should";
|
|
25
|
+
const kind = kindRaw === "must" ? "must" : "should";
|
|
26
|
+
if (!check)
|
|
27
|
+
continue;
|
|
28
|
+
out.push({
|
|
29
|
+
check,
|
|
30
|
+
kind,
|
|
31
|
+
passed: normalizePassed(item.passed),
|
|
32
|
+
feedback: typeof item.feedback === "string" ? item.feedback.trim() : "",
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
37
|
+
/** Parse audit checklist output from FuncX `run()` value or markdown text. */
|
|
38
|
+
export function parseAuditFuncxOutput(value) {
|
|
39
|
+
if (typeof value === "string") {
|
|
40
|
+
return parseAuditOutputFromMarkdown(value);
|
|
41
|
+
}
|
|
42
|
+
if (!isRecord(value)) {
|
|
43
|
+
return { checks: [], overallFeedback: "" };
|
|
44
|
+
}
|
|
45
|
+
if (typeof value.markdown === "string") {
|
|
46
|
+
return parseAuditOutputFromMarkdown(value.markdown);
|
|
47
|
+
}
|
|
48
|
+
if (typeof value.text === "string") {
|
|
49
|
+
return parseAuditOutputFromMarkdown(value.text);
|
|
50
|
+
}
|
|
51
|
+
const checks = parseChecksFromJson(value.checks);
|
|
52
|
+
const overallFeedback = typeof value.overall_feedback === "string"
|
|
53
|
+
? value.overall_feedback.trim()
|
|
54
|
+
: typeof value.overallFeedback === "string"
|
|
55
|
+
? value.overallFeedback.trim()
|
|
56
|
+
: "";
|
|
57
|
+
if (checks.length > 0 || overallFeedback) {
|
|
58
|
+
return { checks, overallFeedback };
|
|
59
|
+
}
|
|
60
|
+
return parseAuditOutputFromMarkdown(JSON.stringify(value, null, 2));
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=parseAuditFuncxOutput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseAuditFuncxOutput.js","sourceRoot":"","sources":["../../../src/post-steps/audit/parseAuditFuncxOutput.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAErE,SAAS,QAAQ,CAAC,CAAU;IAC1B,OAAO,CAAC,KAAK,IAAI,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC;AA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Kind/Passed/Feedback, then "### Overall feedback".
|
|
9
9
|
*/
|
|
10
10
|
export declare function parseAuditOutputFromMarkdown(text: string): AuditLLMOutput;
|
|
11
|
+
/** Parse FuncX `post/audit-checklist` run() output (markdown or JSON) into {@link AuditLLMOutput}. */
|
|
12
|
+
export declare function parseAuditChecklistOutput(value: unknown): AuditLLMOutput;
|
|
11
13
|
//# sourceMappingURL=parseAuditOutput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseAuditOutput.d.ts","sourceRoot":"","sources":["../../../src/post-steps/audit/parseAuditOutput.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAoB,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAElF;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CA2CzE"}
|
|
1
|
+
{"version":3,"file":"parseAuditOutput.d.ts","sourceRoot":"","sources":["../../../src/post-steps/audit/parseAuditOutput.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAoB,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAElF;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CA2CzE;AA+BD,sGAAsG;AACtG,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,CAwBxE"}
|
|
@@ -47,4 +47,60 @@ export function parseAuditOutputFromMarkdown(text) {
|
|
|
47
47
|
}
|
|
48
48
|
return { checks, overallFeedback };
|
|
49
49
|
}
|
|
50
|
+
function isRecord(v) {
|
|
51
|
+
return v !== null && typeof v === "object" && !Array.isArray(v);
|
|
52
|
+
}
|
|
53
|
+
function normalizePassed(v) {
|
|
54
|
+
if (typeof v === "boolean")
|
|
55
|
+
return v;
|
|
56
|
+
if (typeof v === "string")
|
|
57
|
+
return v.toLowerCase() === "yes" || v.toLowerCase() === "true";
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
function parseChecksFromJson(checks) {
|
|
61
|
+
if (!Array.isArray(checks))
|
|
62
|
+
return [];
|
|
63
|
+
const out = [];
|
|
64
|
+
for (const item of checks) {
|
|
65
|
+
if (!isRecord(item))
|
|
66
|
+
continue;
|
|
67
|
+
const check = typeof item.check === "string" ? item.check.trim() : "";
|
|
68
|
+
const kindRaw = typeof item.kind === "string" ? item.kind.toLowerCase() : "should";
|
|
69
|
+
const kind = kindRaw === "must" ? "must" : "should";
|
|
70
|
+
if (!check)
|
|
71
|
+
continue;
|
|
72
|
+
out.push({
|
|
73
|
+
check,
|
|
74
|
+
kind,
|
|
75
|
+
passed: normalizePassed(item.passed),
|
|
76
|
+
feedback: typeof item.feedback === "string" ? item.feedback.trim() : "",
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return out;
|
|
80
|
+
}
|
|
81
|
+
/** Parse FuncX `post/audit-checklist` run() output (markdown or JSON) into {@link AuditLLMOutput}. */
|
|
82
|
+
export function parseAuditChecklistOutput(value) {
|
|
83
|
+
if (typeof value === "string") {
|
|
84
|
+
return parseAuditOutputFromMarkdown(value);
|
|
85
|
+
}
|
|
86
|
+
if (!isRecord(value)) {
|
|
87
|
+
return { checks: [], overallFeedback: "" };
|
|
88
|
+
}
|
|
89
|
+
if (typeof value.markdown === "string") {
|
|
90
|
+
return parseAuditOutputFromMarkdown(value.markdown);
|
|
91
|
+
}
|
|
92
|
+
if (typeof value.text === "string") {
|
|
93
|
+
return parseAuditOutputFromMarkdown(value.text);
|
|
94
|
+
}
|
|
95
|
+
const checks = parseChecksFromJson(value.checks);
|
|
96
|
+
const overallFeedback = typeof value.overall_feedback === "string"
|
|
97
|
+
? value.overall_feedback.trim()
|
|
98
|
+
: typeof value.overallFeedback === "string"
|
|
99
|
+
? value.overallFeedback.trim()
|
|
100
|
+
: "";
|
|
101
|
+
if (checks.length > 0 || overallFeedback) {
|
|
102
|
+
return { checks, overallFeedback };
|
|
103
|
+
}
|
|
104
|
+
return parseAuditOutputFromMarkdown(JSON.stringify(value, null, 2));
|
|
105
|
+
}
|
|
50
106
|
//# sourceMappingURL=parseAuditOutput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseAuditOutput.js","sourceRoot":"","sources":["../../../src/post-steps/audit/parseAuditOutput.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;GAGG;AACH,MAAM,UAAU,4BAA4B,CAAC,IAAY;IACvD,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAuB,EAAE,CAAC;IACtC,IAAI,eAAe,GAAG,EAAE,CAAC;IAEzB,MAAM,YAAY,GAAG,qDAAqD,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACzF,IAAI,YAAY,EAAE,CAAC;QACjB,eAAe,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC3C,CAAC;IAED,MAAM,aAAa,GAAG,2CAA2C,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChF,IAAI,aAAa,EAAE,CAAC;QAClB,MAAM,KAAK,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;QAC/B,MAAM,UAAU,GAAG,4KAA4K,CAAC;QAChM,IAAI,CAAyB,CAAC;QAC9B,OAAO,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YAC7C,MAAM,CAAC,IAAI,CAAC;gBACV,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;gBAClB,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAuB;gBAC7C,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,KAAK;gBACpC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;aACtB,CAAC,CAAC;QACL,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C,QAAQ,CAAC,CAAC;IACtD,CAAC;IACD,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACnC,OAAO,4BAA4B,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClD,CAAC;IACD,MAAM,MAAM,GAAG,mBAAmB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACjD,MAAM,eAAe,GACnB,OAAO,KAAK,CAAC,gBAAgB,KAAK,QAAQ;QACxC,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAI,EAAE;QAC/B,CAAC,CAAC,OAAO,KAAK,CAAC,eAAe,KAAK,QAAQ;YACzC,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,EAAE;YAC9B,CAAC,CAAC,EAAE,CAAC;IACX,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,eAAe,EAAE,CAAC;QACzC,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;IACrC,CAAC;IACD,OAAO,4BAA4B,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runAudit.d.ts","sourceRoot":"","sources":["../../../src/post-steps/audit/runAudit.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,KAAK,EACV,WAAW,EAEX,qBAAqB,EAErB,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"runAudit.d.ts","sourceRoot":"","sources":["../../../src/post-steps/audit/runAudit.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,KAAK,EACV,WAAW,EAEX,qBAAqB,EAErB,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAe7E,MAAM,MAAM,uBAAuB,CAAC,OAAO,GAAG,GAAG,IAAI;IACnD,OAAO,EAAE,cAAc,CAAC;IACxB,UAAU,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;IACrC,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,WAAW,CAAC;IACpB,SAAS,EAAE,CAAC,eAAe,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1E,iEAAiE;IACjE,cAAc,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,qBAAqB,CAAC;IAChC,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;CACvC,CAAC;AA2CF,wBAAsB,gBAAgB,CAAC,OAAO,GAAG,GAAG,EAClD,GAAG,EAAE,uBAAuB,CAAC,OAAO,CAAC,GACpC,OAAO,CAAC,sBAAsB,CAAC,CAmXjC"}
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
* Audit POST step: quality-gate loop with re-runs and optional synthesis.
|
|
3
3
|
*/
|
|
4
4
|
import { llmCallEnvPrefix, resolveLlmCall, } from "../resolvePostStepConfig.js";
|
|
5
|
-
import { loadAuditTemplates,
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { runPostStepLlmCall } from "../../internal/runPostStepLlmCall.js";
|
|
9
|
-
import { buildXynthesisWorkScopeIdentity } from "../../internal/buildXynthesisWorkScopeIdentity.js";
|
|
5
|
+
import { loadAuditTemplates, renderFeedbackInjection } from "./loadAuditTemplates.js";
|
|
6
|
+
import { parseAuditChecklistOutput } from "./parseAuditOutput.js";
|
|
7
|
+
import { runAuditChecklistFuncxCall, runAuditMergeFuncxCall } from "./runAuditFuncxCall.js";
|
|
10
8
|
import { createNxCache } from "nx-cache";
|
|
11
9
|
import { createHash } from "crypto";
|
|
12
10
|
import { getPostActionModelFromSlots } from "../../utils/routeModelConfigSlots.js";
|
|
@@ -81,65 +79,28 @@ export async function runAuditPostStep(ctx) {
|
|
|
81
79
|
// pushed here. Surfaced on `metadata.llmCalls` (see end of function). Outside trace mode the array
|
|
82
80
|
// remains empty and is omitted from metadata.
|
|
83
81
|
const llmCalls = [];
|
|
84
|
-
const observationSink = traceCollector
|
|
85
|
-
? (obs) => {
|
|
86
|
-
llmCalls.push(obs);
|
|
87
|
-
}
|
|
88
|
-
: undefined;
|
|
89
82
|
let currentOutput = typeof mainResult.rawText === "string"
|
|
90
83
|
? mainResult.rawText
|
|
91
84
|
: JSON.stringify(mainResult.parsed ?? mainResult.rawText ?? "", null, 2);
|
|
92
85
|
const originalInputStr = typeof request.input === "string" ? request.input : JSON.stringify(request.input ?? {}, null, 2);
|
|
93
|
-
const baseTraceMeta = () => ({
|
|
94
|
-
jobId: request.jobId,
|
|
95
|
-
taskId: request.taskId,
|
|
96
|
-
skillKey: request.skillKey,
|
|
97
|
-
phase: "audit",
|
|
98
|
-
postStepType: "audit",
|
|
99
|
-
});
|
|
100
|
-
const workScopeIdentity = buildXynthesisWorkScopeIdentity({
|
|
101
|
-
jobId: request.jobId,
|
|
102
|
-
taskId: request.taskId,
|
|
103
|
-
agentId: request.agentId,
|
|
104
|
-
graphId: request.graphId,
|
|
105
|
-
nodeId: request.nodeId,
|
|
106
|
-
prevNodeId: request.prevNodeId,
|
|
107
|
-
coreSkillId: request.coreSkillId,
|
|
108
|
-
masterSkillId: request.masterSkillId,
|
|
109
|
-
identity: request.identity,
|
|
110
|
-
});
|
|
111
|
-
const makeTraceTask = (opts) => ({
|
|
112
|
-
taskType: "post-execution",
|
|
113
|
-
details: opts.details,
|
|
114
|
-
modelUsed: opts.modelUsed,
|
|
115
|
-
metadata: {
|
|
116
|
-
...baseTraceMeta(),
|
|
117
|
-
step: { phase: "post", type: "audit", stepId: opts.stepId },
|
|
118
|
-
},
|
|
119
|
-
});
|
|
120
86
|
const callAudit = async (params) => {
|
|
121
|
-
const {
|
|
87
|
+
const { funcxChecklistInput, llmCallOverride, stepId } = params;
|
|
122
88
|
const effective = { ...auditLlmCall, ...(llmCallOverride ?? {}) };
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
89
|
+
const { text } = await runAuditChecklistFuncxCall({
|
|
90
|
+
originalInput: funcxChecklistInput.originalInput,
|
|
91
|
+
promptContext: funcxChecklistInput.promptContext,
|
|
92
|
+
candidateOutput: funcxChecklistInput.candidateOutput,
|
|
93
|
+
mustChecks,
|
|
94
|
+
shouldChecks,
|
|
95
|
+
previousFeedback: funcxChecklistInput.previousFeedback,
|
|
96
|
+
previousCycle: funcxChecklistInput.previousCycle,
|
|
97
|
+
customAuditGuidelines: config.customAuditGuidelines,
|
|
127
98
|
jobId: postStepJobId,
|
|
128
99
|
taskId: request.taskId,
|
|
129
100
|
agentId: "audit-evaluator",
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
stepId,
|
|
134
|
-
details: "audit evaluator call",
|
|
135
|
-
modelUsed: effective.model ?? null,
|
|
136
|
-
})
|
|
137
|
-
: undefined,
|
|
138
|
-
observationSink,
|
|
139
|
-
stage: stage ?? "post-audit",
|
|
140
|
-
stepId,
|
|
141
|
-
workScopeIdentity,
|
|
142
|
-
});
|
|
101
|
+
}, effective);
|
|
102
|
+
void stepId;
|
|
103
|
+
return text;
|
|
143
104
|
};
|
|
144
105
|
let auditCallFailures = 0;
|
|
145
106
|
/** Prompt context MAIN used for `currentOutput` on this audit cycle (matches `reRunMain` override after prior failures). */
|
|
@@ -163,18 +124,13 @@ export async function runAuditPostStep(ctx) {
|
|
|
163
124
|
else {
|
|
164
125
|
rawAuditText = await callAudit({
|
|
165
126
|
stepId: `audit-evaluator-cycle-${cycle}`,
|
|
166
|
-
|
|
167
|
-
customGuidelines: config.customAuditGuidelines,
|
|
168
|
-
}),
|
|
169
|
-
userPrompt: renderAuditUser(templates.user, {
|
|
127
|
+
funcxChecklistInput: {
|
|
170
128
|
originalInput: originalInputStr,
|
|
171
129
|
promptContext: mainContextForEvaluator,
|
|
172
130
|
candidateOutput: currentOutput,
|
|
173
|
-
mustChecks,
|
|
174
|
-
shouldChecks,
|
|
175
131
|
previousFeedback: cycle > 1 ? auditResults[auditResults.length - 1]?.overallFeedback : undefined,
|
|
176
132
|
previousCycle: cycle > 1 ? cycle - 1 : undefined,
|
|
177
|
-
}
|
|
133
|
+
},
|
|
178
134
|
});
|
|
179
135
|
auditCache.write(cacheKey, rawAuditText, { ttlMs: 300_000 });
|
|
180
136
|
}
|
|
@@ -182,18 +138,13 @@ export async function runAuditPostStep(ctx) {
|
|
|
182
138
|
else {
|
|
183
139
|
rawAuditText = await callAudit({
|
|
184
140
|
stepId: `audit-evaluator-cycle-${cycle}`,
|
|
185
|
-
|
|
186
|
-
customGuidelines: config.customAuditGuidelines,
|
|
187
|
-
}),
|
|
188
|
-
userPrompt: renderAuditUser(templates.user, {
|
|
141
|
+
funcxChecklistInput: {
|
|
189
142
|
originalInput: originalInputStr,
|
|
190
143
|
promptContext: mainContextForEvaluator,
|
|
191
144
|
candidateOutput: currentOutput,
|
|
192
|
-
mustChecks,
|
|
193
|
-
shouldChecks,
|
|
194
145
|
previousFeedback: cycle > 1 ? auditResults[auditResults.length - 1]?.overallFeedback : undefined,
|
|
195
146
|
previousCycle: cycle > 1 ? cycle - 1 : undefined,
|
|
196
|
-
}
|
|
147
|
+
},
|
|
197
148
|
});
|
|
198
149
|
}
|
|
199
150
|
}
|
|
@@ -227,7 +178,7 @@ export async function runAuditPostStep(ctx) {
|
|
|
227
178
|
}
|
|
228
179
|
let parsed;
|
|
229
180
|
try {
|
|
230
|
-
parsed =
|
|
181
|
+
parsed = parseAuditChecklistOutput(rawAuditText);
|
|
231
182
|
}
|
|
232
183
|
catch {
|
|
233
184
|
parsed = { checks: [], overallFeedback: "Parse failed." };
|
|
@@ -278,50 +229,42 @@ export async function runAuditPostStep(ctx) {
|
|
|
278
229
|
if (selectionStrategy === "synthesis" && candidates.length >= 2) {
|
|
279
230
|
const sorted = [...candidates].sort((a, b) => b.weightedScore - a.weightedScore);
|
|
280
231
|
const [a, b] = sorted.slice(0, 2);
|
|
281
|
-
const
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
232
|
+
const candidateAEnvelope = {
|
|
233
|
+
cycle: a.cycle,
|
|
234
|
+
score: a.weightedScore,
|
|
235
|
+
output: a.output,
|
|
236
|
+
failedChecks: a.auditResult.checks
|
|
237
|
+
.filter((c) => !c.passed)
|
|
238
|
+
.map((c) => ({ kind: c.kind, check: c.check, feedback: c.feedback })),
|
|
239
|
+
passedChecks: a.auditResult.checks
|
|
240
|
+
.filter((c) => c.passed)
|
|
241
|
+
.map((c) => ({ kind: c.kind, check: c.check })),
|
|
242
|
+
};
|
|
243
|
+
const candidateBEnvelope = {
|
|
244
|
+
cycle: b.cycle,
|
|
245
|
+
score: b.weightedScore,
|
|
246
|
+
output: b.output,
|
|
247
|
+
failedChecks: b.auditResult.checks
|
|
248
|
+
.filter((c) => !c.passed)
|
|
249
|
+
.map((c) => ({ kind: c.kind, check: c.check, feedback: c.feedback })),
|
|
250
|
+
passedChecks: b.auditResult.checks
|
|
251
|
+
.filter((c) => c.passed)
|
|
252
|
+
.map((c) => ({ kind: c.kind, check: c.check })),
|
|
253
|
+
};
|
|
300
254
|
let synthesizedOutput;
|
|
301
255
|
let mergeFailed = false;
|
|
302
256
|
let mergeError = null;
|
|
303
257
|
try {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
258
|
+
synthesizedOutput = await runAuditMergeFuncxCall({
|
|
259
|
+
originalInput: originalInputStr,
|
|
260
|
+
promptContext: contextMarkdown,
|
|
261
|
+
candidateA: candidateAEnvelope,
|
|
262
|
+
candidateB: candidateBEnvelope,
|
|
263
|
+
customSynthesisGuidelines: config.customSynthesisGuidelines,
|
|
310
264
|
jobId: postStepJobId,
|
|
311
265
|
taskId: request.taskId,
|
|
312
266
|
agentId: "audit-synthesis-merge",
|
|
313
|
-
|
|
314
|
-
traceCollector,
|
|
315
|
-
traceTask: traceCollector
|
|
316
|
-
? makeTraceTask({
|
|
317
|
-
stepId: "audit-synthesis-merge",
|
|
318
|
-
details: "audit synthesis merge",
|
|
319
|
-
modelUsed: synthLlmCall.model ?? null,
|
|
320
|
-
})
|
|
321
|
-
: undefined,
|
|
322
|
-
observationSink,
|
|
323
|
-
});
|
|
324
|
-
synthesizedOutput = text.trim();
|
|
267
|
+
}, synthLlmCall);
|
|
325
268
|
}
|
|
326
269
|
catch (err) {
|
|
327
270
|
// Previously the merge failure was silently swallowed; now we still fall back to the best
|
|
@@ -343,16 +286,13 @@ export async function runAuditPostStep(ctx) {
|
|
|
343
286
|
}
|
|
344
287
|
const synthAuditText = await callAudit({
|
|
345
288
|
stepId: "audit-evaluator-synth-candidate",
|
|
346
|
-
|
|
347
|
-
userPrompt: renderAuditUser(templates.user, {
|
|
289
|
+
funcxChecklistInput: {
|
|
348
290
|
originalInput: originalInputStr,
|
|
349
291
|
promptContext: contextMarkdown,
|
|
350
292
|
candidateOutput: synthesizedOutput,
|
|
351
|
-
|
|
352
|
-
shouldChecks,
|
|
353
|
-
}),
|
|
293
|
+
},
|
|
354
294
|
});
|
|
355
|
-
const synthParsed =
|
|
295
|
+
const synthParsed = parseAuditChecklistOutput(synthAuditText);
|
|
356
296
|
const synthScore = computeWeightedScore(synthParsed.checks, gateway);
|
|
357
297
|
const synthResult = { ...synthParsed, weightedScore: synthScore };
|
|
358
298
|
auditResults.push(synthResult);
|