@uns-kit/assistant-workflow 2.0.72
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/LICENSE +21 -0
- package/README.md +37 -0
- package/dist/clarification-policy.d.ts +64 -0
- package/dist/clarification-policy.d.ts.map +1 -0
- package/dist/clarification-policy.js +174 -0
- package/dist/clarification-policy.js.map +1 -0
- package/dist/decision.d.ts +37 -0
- package/dist/decision.d.ts.map +1 -0
- package/dist/decision.js +100 -0
- package/dist/decision.js.map +1 -0
- package/dist/definition-catalog-replay.d.ts +25 -0
- package/dist/definition-catalog-replay.d.ts.map +1 -0
- package/dist/definition-catalog-replay.js +54 -0
- package/dist/definition-catalog-replay.js.map +1 -0
- package/dist/definition-catalog.d.ts +45 -0
- package/dist/definition-catalog.d.ts.map +1 -0
- package/dist/definition-catalog.js +97 -0
- package/dist/definition-catalog.js.map +1 -0
- package/dist/definition-diagnostics.d.ts +17 -0
- package/dist/definition-diagnostics.d.ts.map +1 -0
- package/dist/definition-diagnostics.js +353 -0
- package/dist/definition-diagnostics.js.map +1 -0
- package/dist/definition-diff.d.ts +51 -0
- package/dist/definition-diff.d.ts.map +1 -0
- package/dist/definition-diff.js +172 -0
- package/dist/definition-diff.js.map +1 -0
- package/dist/definition-json.d.ts +53 -0
- package/dist/definition-json.d.ts.map +1 -0
- package/dist/definition-json.js +186 -0
- package/dist/definition-json.js.map +1 -0
- package/dist/definition-manifest.d.ts +41 -0
- package/dist/definition-manifest.d.ts.map +1 -0
- package/dist/definition-manifest.js +119 -0
- package/dist/definition-manifest.js.map +1 -0
- package/dist/definition-package-execution-json.d.ts +64 -0
- package/dist/definition-package-execution-json.d.ts.map +1 -0
- package/dist/definition-package-execution-json.js +245 -0
- package/dist/definition-package-execution-json.js.map +1 -0
- package/dist/definition-package-execution-replay.d.ts +14 -0
- package/dist/definition-package-execution-replay.d.ts.map +1 -0
- package/dist/definition-package-execution-replay.js +47 -0
- package/dist/definition-package-execution-replay.js.map +1 -0
- package/dist/definition-package-executor.d.ts +52 -0
- package/dist/definition-package-executor.d.ts.map +1 -0
- package/dist/definition-package-executor.js +70 -0
- package/dist/definition-package-executor.js.map +1 -0
- package/dist/definition-package-loader.d.ts +36 -0
- package/dist/definition-package-loader.d.ts.map +1 -0
- package/dist/definition-package-loader.js +56 -0
- package/dist/definition-package-loader.js.map +1 -0
- package/dist/definition-package-replay.d.ts +28 -0
- package/dist/definition-package-replay.d.ts.map +1 -0
- package/dist/definition-package-replay.js +74 -0
- package/dist/definition-package-replay.js.map +1 -0
- package/dist/definition-package-resolver.d.ts +31 -0
- package/dist/definition-package-resolver.d.ts.map +1 -0
- package/dist/definition-package-resolver.js +60 -0
- package/dist/definition-package-resolver.js.map +1 -0
- package/dist/definition-package-review.d.ts +29 -0
- package/dist/definition-package-review.d.ts.map +1 -0
- package/dist/definition-package-review.js +74 -0
- package/dist/definition-package-review.js.map +1 -0
- package/dist/definition-package-run-report.d.ts +25 -0
- package/dist/definition-package-run-report.d.ts.map +1 -0
- package/dist/definition-package-run-report.js +37 -0
- package/dist/definition-package-run-report.js.map +1 -0
- package/dist/definition-package-run.d.ts +20 -0
- package/dist/definition-package-run.d.ts.map +1 -0
- package/dist/definition-package-run.js +41 -0
- package/dist/definition-package-run.js.map +1 -0
- package/dist/definition-package-selection.d.ts +29 -0
- package/dist/definition-package-selection.d.ts.map +1 -0
- package/dist/definition-package-selection.js +68 -0
- package/dist/definition-package-selection.js.map +1 -0
- package/dist/definition-package-smoke.d.ts +74 -0
- package/dist/definition-package-smoke.d.ts.map +1 -0
- package/dist/definition-package-smoke.js +184 -0
- package/dist/definition-package-smoke.js.map +1 -0
- package/dist/definition-package.d.ts +36 -0
- package/dist/definition-package.d.ts.map +1 -0
- package/dist/definition-package.js +114 -0
- package/dist/definition-package.js.map +1 -0
- package/dist/definition-tuning-approval.d.ts +39 -0
- package/dist/definition-tuning-approval.d.ts.map +1 -0
- package/dist/definition-tuning-approval.js +207 -0
- package/dist/definition-tuning-approval.js.map +1 -0
- package/dist/definition-tuning-json.d.ts +58 -0
- package/dist/definition-tuning-json.d.ts.map +1 -0
- package/dist/definition-tuning-json.js +276 -0
- package/dist/definition-tuning-json.js.map +1 -0
- package/dist/definition-tuning-promotion.d.ts +120 -0
- package/dist/definition-tuning-promotion.d.ts.map +1 -0
- package/dist/definition-tuning-promotion.js +460 -0
- package/dist/definition-tuning-promotion.js.map +1 -0
- package/dist/definition-tuning-replay.d.ts +14 -0
- package/dist/definition-tuning-replay.d.ts.map +1 -0
- package/dist/definition-tuning-replay.js +50 -0
- package/dist/definition-tuning-replay.js.map +1 -0
- package/dist/definition-tuning-review-artifact.d.ts +56 -0
- package/dist/definition-tuning-review-artifact.d.ts.map +1 -0
- package/dist/definition-tuning-review-artifact.js +302 -0
- package/dist/definition-tuning-review-artifact.js.map +1 -0
- package/dist/definition-tuning-review.d.ts +59 -0
- package/dist/definition-tuning-review.d.ts.map +1 -0
- package/dist/definition-tuning-review.js +213 -0
- package/dist/definition-tuning-review.js.map +1 -0
- package/dist/definition-tuning-source-patch.d.ts +43 -0
- package/dist/definition-tuning-source-patch.d.ts.map +1 -0
- package/dist/definition-tuning-source-patch.js +214 -0
- package/dist/definition-tuning-source-patch.js.map +1 -0
- package/dist/definition-tuning.d.ts +73 -0
- package/dist/definition-tuning.d.ts.map +1 -0
- package/dist/definition-tuning.js +426 -0
- package/dist/definition-tuning.js.map +1 -0
- package/dist/definition.d.ts +189 -0
- package/dist/definition.d.ts.map +1 -0
- package/dist/definition.js +494 -0
- package/dist/definition.js.map +1 -0
- package/dist/direct-route-invocation.d.ts +132 -0
- package/dist/direct-route-invocation.d.ts.map +1 -0
- package/dist/direct-route-invocation.js +325 -0
- package/dist/direct-route-invocation.js.map +1 -0
- package/dist/direct-route-policy.d.ts +25 -0
- package/dist/direct-route-policy.d.ts.map +1 -0
- package/dist/direct-route-policy.js +106 -0
- package/dist/direct-route-policy.js.map +1 -0
- package/dist/eval-case.d.ts +85 -0
- package/dist/eval-case.d.ts.map +1 -0
- package/dist/eval-case.js +366 -0
- package/dist/eval-case.js.map +1 -0
- package/dist/eval-replay.d.ts +18 -0
- package/dist/eval-replay.d.ts.map +1 -0
- package/dist/eval-replay.js +41 -0
- package/dist/eval-replay.js.map +1 -0
- package/dist/eval-result.d.ts +46 -0
- package/dist/eval-result.d.ts.map +1 -0
- package/dist/eval-result.js +183 -0
- package/dist/eval-result.js.map +1 -0
- package/dist/eval-runner.d.ts +30 -0
- package/dist/eval-runner.d.ts.map +1 -0
- package/dist/eval-runner.js +57 -0
- package/dist/eval-runner.js.map +1 -0
- package/dist/eval-suite.d.ts +43 -0
- package/dist/eval-suite.d.ts.map +1 -0
- package/dist/eval-suite.js +101 -0
- package/dist/eval-suite.js.map +1 -0
- package/dist/execution-plan.d.ts +43 -0
- package/dist/execution-plan.d.ts.map +1 -0
- package/dist/execution-plan.js +187 -0
- package/dist/execution-plan.js.map +1 -0
- package/dist/hosted-tool-policy.d.ts +70 -0
- package/dist/hosted-tool-policy.d.ts.map +1 -0
- package/dist/hosted-tool-policy.js +228 -0
- package/dist/hosted-tool-policy.js.map +1 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +73 -0
- package/dist/index.js.map +1 -0
- package/dist/memory-policy.d.ts +55 -0
- package/dist/memory-policy.d.ts.map +1 -0
- package/dist/memory-policy.js +187 -0
- package/dist/memory-policy.js.map +1 -0
- package/dist/memory-updates.d.ts +39 -0
- package/dist/memory-updates.d.ts.map +1 -0
- package/dist/memory-updates.js +110 -0
- package/dist/memory-updates.js.map +1 -0
- package/dist/outcome-trace.d.ts +79 -0
- package/dist/outcome-trace.d.ts.map +1 -0
- package/dist/outcome-trace.js +117 -0
- package/dist/outcome-trace.js.map +1 -0
- package/dist/outcome.d.ts +97 -0
- package/dist/outcome.d.ts.map +1 -0
- package/dist/outcome.js +160 -0
- package/dist/outcome.js.map +1 -0
- package/dist/planner-compiler.d.ts +14 -0
- package/dist/planner-compiler.d.ts.map +1 -0
- package/dist/planner-compiler.js +26 -0
- package/dist/planner-compiler.js.map +1 -0
- package/dist/planning.d.ts +36 -0
- package/dist/planning.d.ts.map +1 -0
- package/dist/planning.js +141 -0
- package/dist/planning.js.map +1 -0
- package/dist/policy-resolution.d.ts +10 -0
- package/dist/policy-resolution.d.ts.map +1 -0
- package/dist/policy-resolution.js +30 -0
- package/dist/policy-resolution.js.map +1 -0
- package/dist/run-evaluation.d.ts +29 -0
- package/dist/run-evaluation.d.ts.map +1 -0
- package/dist/run-evaluation.js +128 -0
- package/dist/run-evaluation.js.map +1 -0
- package/dist/run-parity.d.ts +24 -0
- package/dist/run-parity.d.ts.map +1 -0
- package/dist/run-parity.js +36 -0
- package/dist/run-parity.js.map +1 -0
- package/dist/run-report-batch.d.ts +150 -0
- package/dist/run-report-batch.d.ts.map +1 -0
- package/dist/run-report-batch.js +391 -0
- package/dist/run-report-batch.js.map +1 -0
- package/dist/run-report-json.d.ts +76 -0
- package/dist/run-report-json.d.ts.map +1 -0
- package/dist/run-report-json.js +451 -0
- package/dist/run-report-json.js.map +1 -0
- package/dist/run-report.d.ts +22 -0
- package/dist/run-report.d.ts.map +1 -0
- package/dist/run-report.js +46 -0
- package/dist/run-report.js.map +1 -0
- package/dist/run.d.ts +20 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +36 -0
- package/dist/run.js.map +1 -0
- package/dist/tool-bindings.d.ts +42 -0
- package/dist/tool-bindings.d.ts.map +1 -0
- package/dist/tool-bindings.js +124 -0
- package/dist/tool-bindings.js.map +1 -0
- package/dist/tool-capabilities.d.ts +37 -0
- package/dist/tool-capabilities.d.ts.map +1 -0
- package/dist/tool-capabilities.js +91 -0
- package/dist/tool-capabilities.js.map +1 -0
- package/dist/tool-executor.d.ts +63 -0
- package/dist/tool-executor.d.ts.map +1 -0
- package/dist/tool-executor.js +176 -0
- package/dist/tool-executor.js.map +1 -0
- package/dist/tool-fixtures.d.ts +18 -0
- package/dist/tool-fixtures.d.ts.map +1 -0
- package/dist/tool-fixtures.js +52 -0
- package/dist/tool-fixtures.js.map +1 -0
- package/dist/tool-invocations.d.ts +31 -0
- package/dist/tool-invocations.d.ts.map +1 -0
- package/dist/tool-invocations.js +79 -0
- package/dist/tool-invocations.js.map +1 -0
- package/dist/tool-provider-executors.d.ts +43 -0
- package/dist/tool-provider-executors.d.ts.map +1 -0
- package/dist/tool-provider-executors.js +59 -0
- package/dist/tool-provider-executors.js.map +1 -0
- package/dist/tool-result-cache.d.ts +37 -0
- package/dist/tool-result-cache.d.ts.map +1 -0
- package/dist/tool-result-cache.js +173 -0
- package/dist/tool-result-cache.js.map +1 -0
- package/dist/tool-results.d.ts +41 -0
- package/dist/tool-results.d.ts.map +1 -0
- package/dist/tool-results.js +137 -0
- package/dist/tool-results.js.map +1 -0
- package/dist/tool-runtime.d.ts +46 -0
- package/dist/tool-runtime.d.ts.map +1 -0
- package/dist/tool-runtime.js +163 -0
- package/dist/tool-runtime.js.map +1 -0
- package/dist/tool-selection-evaluation.d.ts +214 -0
- package/dist/tool-selection-evaluation.d.ts.map +1 -0
- package/dist/tool-selection-evaluation.js +773 -0
- package/dist/tool-selection-evaluation.js.map +1 -0
- package/dist/tool-selection-json.d.ts +71 -0
- package/dist/tool-selection-json.d.ts.map +1 -0
- package/dist/tool-selection-json.js +284 -0
- package/dist/tool-selection-json.js.map +1 -0
- package/dist/tool-selection-policy.d.ts +81 -0
- package/dist/tool-selection-policy.d.ts.map +1 -0
- package/dist/tool-selection-policy.js +376 -0
- package/dist/tool-selection-policy.js.map +1 -0
- package/dist/tool-selection-replay.d.ts +26 -0
- package/dist/tool-selection-replay.d.ts.map +1 -0
- package/dist/tool-selection-replay.js +88 -0
- package/dist/tool-selection-replay.js.map +1 -0
- package/dist/tool-selection-rules.d.ts +46 -0
- package/dist/tool-selection-rules.d.ts.map +1 -0
- package/dist/tool-selection-rules.js +183 -0
- package/dist/tool-selection-rules.js.map +1 -0
- package/dist/tool-selection-trace-export.d.ts +37 -0
- package/dist/tool-selection-trace-export.d.ts.map +1 -0
- package/dist/tool-selection-trace-export.js +324 -0
- package/dist/tool-selection-trace-export.js.map +1 -0
- package/dist/trace-events.d.ts +14 -0
- package/dist/trace-events.d.ts.map +1 -0
- package/dist/trace-events.js +65 -0
- package/dist/trace-events.js.map +1 -0
- package/dist/trace-payload.d.ts +24 -0
- package/dist/trace-payload.d.ts.map +1 -0
- package/dist/trace-payload.js +113 -0
- package/dist/trace-payload.js.map +1 -0
- package/dist/trace-replay.d.ts +276 -0
- package/dist/trace-replay.d.ts.map +1 -0
- package/dist/trace-replay.js +685 -0
- package/dist/trace-replay.js.map +1 -0
- package/dist/trace-report.d.ts +320 -0
- package/dist/trace-report.d.ts.map +1 -0
- package/dist/trace-report.js +1394 -0
- package/dist/trace-report.js.map +1 -0
- package/dist/trace-stages.d.ts +70 -0
- package/dist/trace-stages.d.ts.map +1 -0
- package/dist/trace-stages.js +103 -0
- package/dist/trace-stages.js.map +1 -0
- package/dist/value-readers.d.ts +20 -0
- package/dist/value-readers.d.ts.map +1 -0
- package/dist/value-readers.js +82 -0
- package/dist/value-readers.js.map +1 -0
- package/package.json +341 -0
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
export function buildAssistantWorkflowRunReportBatch(reports, options = {}) {
|
|
2
|
+
const allRows = reports.map(toBatchRow);
|
|
3
|
+
const rows = options.onlyInteresting === true ? allRows.filter(isInterestingRow) : allRows;
|
|
4
|
+
return {
|
|
5
|
+
generatedAt: new Date().toISOString(),
|
|
6
|
+
sourceReportCount: reports.length,
|
|
7
|
+
rowCount: rows.length,
|
|
8
|
+
interestingRowCount: rows.filter(isInterestingRow).length,
|
|
9
|
+
warningRowCount: rows.filter((row) => row.warningCount > 0).length,
|
|
10
|
+
statusCounts: buildStringCounts(rows.map((row) => row.status)),
|
|
11
|
+
intentCounts: buildStringCounts(rows.map((row) => row.intent ?? "unknown")),
|
|
12
|
+
outcomeCounts: buildStringCounts(rows.map((row) => row.outcomeKind)),
|
|
13
|
+
toolResultStatusCounts: buildStringCounts(rows.map((row) => row.toolResultStatus ?? "none")),
|
|
14
|
+
toolProviderResultCounts: buildStringCounts(rows.flatMap((row) => row.toolResultProviders)),
|
|
15
|
+
activePlanningStepProfileCounts: buildStringCounts(rows.flatMap((row) => row.activePlanningStepProfileIds)),
|
|
16
|
+
profileStepCounts: buildStringCounts(rows.flatMap((row) => row.profileStepIds)),
|
|
17
|
+
directRouteDoneCounts: buildStringCounts(rows.flatMap((row) => row.directRouteDoneRoutes)),
|
|
18
|
+
directRouteRecoveredCounts: buildStringCounts(rows.flatMap((row) => row.directRouteRecoveredRoutes)),
|
|
19
|
+
directRouteErrorCounts: buildStringCounts(rows.flatMap((row) => row.directRouteErrorRoutes)),
|
|
20
|
+
directRouteSkipReasonCounts: buildStringCounts(rows.flatMap((row) => row.directRouteSkipReasons).filter(isActionableDirectRouteSkipReason)),
|
|
21
|
+
directRouteGapReasonCounts: buildStringCounts(rows.flatMap((row) => row.directRouteGapReasons)),
|
|
22
|
+
directRouteObservedStrategyCounts: buildStringCounts(rows.flatMap((row) => row.directRouteObservedStrategies)),
|
|
23
|
+
directRouteUndeclaredStrategyCounts: buildStringCounts(rows.flatMap((row) => row.directRouteUndeclaredStrategies)),
|
|
24
|
+
memoryChangedSlotCounts: buildStringCounts(rows.flatMap((row) => row.memoryChangedSlots)),
|
|
25
|
+
memoryChangedProfileFieldCounts: buildStringCounts(rows.flatMap((row) => row.memoryChangedProfileFields)),
|
|
26
|
+
memorySkippedPatchReasonCounts: buildStringCounts(rows.flatMap((row) => row.memorySkippedPatchReasons)),
|
|
27
|
+
threadProfileWriteSourceCounts: buildStringCounts(rows.flatMap((row) => row.threadProfileWriteSources)),
|
|
28
|
+
threadProfileWriteReasonCounts: buildStringCounts(rows.flatMap((row) => row.threadProfileWriteReasons)),
|
|
29
|
+
threadProfileWriteChangedFieldCounts: buildStringCounts(rows.flatMap((row) => row.threadProfileWriteChangedFields)),
|
|
30
|
+
signalCounts: buildSignalCounts(rows.flatMap((row) => row.signals)),
|
|
31
|
+
rows,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export function buildAssistantWorkflowPlanningProfileMigrationReport(batch, options = {}) {
|
|
35
|
+
const minRunCount = normalizeMinRunCount(options.minRunCount);
|
|
36
|
+
const currentRuntimeProfileIds = uniqueNonEmptyStrings(options.currentRuntimeProfileIds ?? []);
|
|
37
|
+
const currentRuntimeProfileIdSet = new Set(currentRuntimeProfileIds);
|
|
38
|
+
const candidates = buildPlanningProfileMigrationCandidates(batch.rows, minRunCount);
|
|
39
|
+
const readyCandidates = candidates.filter((candidate) => candidate.status === "ready_for_runtime_change");
|
|
40
|
+
const reviewCandidates = candidates.filter((candidate) => candidate.status === "needs_review");
|
|
41
|
+
const readyProfileIds = readyCandidates.map((candidate) => candidate.profileId);
|
|
42
|
+
const reviewProfileIds = reviewCandidates.map((candidate) => candidate.profileId);
|
|
43
|
+
const addProfileIds = readyProfileIds.filter((profileId) => !currentRuntimeProfileIdSet.has(profileId));
|
|
44
|
+
const keepProfileIds = currentRuntimeProfileIds;
|
|
45
|
+
return {
|
|
46
|
+
generatedAt: options.generatedAt ?? new Date().toISOString(),
|
|
47
|
+
minRunCount,
|
|
48
|
+
sourceReportCount: batch.sourceReportCount,
|
|
49
|
+
rowCount: batch.rowCount,
|
|
50
|
+
observedProfileCount: candidates.length,
|
|
51
|
+
currentRuntimeProfileIds,
|
|
52
|
+
readyProfileIds,
|
|
53
|
+
reviewProfileIds,
|
|
54
|
+
addProfileIds,
|
|
55
|
+
keepProfileIds,
|
|
56
|
+
proposedRuntimeProfileIds: uniqueNonEmptyStrings([...currentRuntimeProfileIds, ...addProfileIds]),
|
|
57
|
+
candidates,
|
|
58
|
+
readyCandidates,
|
|
59
|
+
reviewCandidates,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export function buildAssistantWorkflowPlanningProfileMigrationReportTracePayload(report) {
|
|
63
|
+
return {
|
|
64
|
+
generatedAt: report.generatedAt,
|
|
65
|
+
minRunCount: report.minRunCount,
|
|
66
|
+
sourceReportCount: report.sourceReportCount,
|
|
67
|
+
rowCount: report.rowCount,
|
|
68
|
+
observedProfileCount: report.observedProfileCount,
|
|
69
|
+
currentRuntimeProfileIds: report.currentRuntimeProfileIds,
|
|
70
|
+
readyProfileIds: report.readyProfileIds,
|
|
71
|
+
reviewProfileIds: report.reviewProfileIds,
|
|
72
|
+
addProfileIds: report.addProfileIds,
|
|
73
|
+
keepProfileIds: report.keepProfileIds,
|
|
74
|
+
proposedRuntimeProfileIds: report.proposedRuntimeProfileIds,
|
|
75
|
+
candidates: report.candidates.map((candidate) => ({
|
|
76
|
+
profileId: candidate.profileId,
|
|
77
|
+
runCount: candidate.runCount,
|
|
78
|
+
completedCount: candidate.completedCount,
|
|
79
|
+
handledCount: candidate.handledCount,
|
|
80
|
+
warningRowCount: candidate.warningRowCount,
|
|
81
|
+
failedCount: candidate.failedCount,
|
|
82
|
+
degradedCount: candidate.degradedCount,
|
|
83
|
+
clarificationCount: candidate.clarificationCount,
|
|
84
|
+
notHandledCount: candidate.notHandledCount,
|
|
85
|
+
profileStepIds: candidate.profileStepIds,
|
|
86
|
+
signalCounts: candidate.signalCounts,
|
|
87
|
+
signalDetails: candidate.signalDetails,
|
|
88
|
+
status: candidate.status,
|
|
89
|
+
blockingReasons: candidate.blockingReasons,
|
|
90
|
+
})),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
export function buildAssistantWorkflowPlanningProfileMigrationReviewArtifact(report, options = {}) {
|
|
94
|
+
const status = report.addProfileIds.length > 0 ? "ready_for_runtime_change" : "no_runtime_change";
|
|
95
|
+
const recommendedAction = status === "ready_for_runtime_change"
|
|
96
|
+
? "apply_planning_profile_runtime_update"
|
|
97
|
+
: "keep_current_runtime";
|
|
98
|
+
return {
|
|
99
|
+
generatedAt: report.generatedAt,
|
|
100
|
+
title: normalizeOptionalText(options.title) ?? "Assistant workflow planning-profile migration review",
|
|
101
|
+
status,
|
|
102
|
+
recommendedAction,
|
|
103
|
+
rationale: buildPlanningProfileMigrationReviewRationale(report),
|
|
104
|
+
patchTargets: uniqueNonEmptyStrings(options.patchTargets ?? []),
|
|
105
|
+
requiredTestIds: uniqueNonEmptyStrings(options.requiredTestIds ?? []),
|
|
106
|
+
runtimeChange: {
|
|
107
|
+
currentRuntimeProfileIds: report.currentRuntimeProfileIds,
|
|
108
|
+
addProfileIds: report.addProfileIds,
|
|
109
|
+
keepProfileIds: report.keepProfileIds,
|
|
110
|
+
proposedRuntimeProfileIds: report.proposedRuntimeProfileIds,
|
|
111
|
+
},
|
|
112
|
+
evidence: {
|
|
113
|
+
minRunCount: report.minRunCount,
|
|
114
|
+
sourceReportCount: report.sourceReportCount,
|
|
115
|
+
rowCount: report.rowCount,
|
|
116
|
+
readyProfileIds: report.readyProfileIds,
|
|
117
|
+
readyCandidates: report.readyCandidates,
|
|
118
|
+
},
|
|
119
|
+
review: {
|
|
120
|
+
reviewProfileIds: report.reviewProfileIds,
|
|
121
|
+
reviewCandidates: report.reviewCandidates,
|
|
122
|
+
blockerCount: report.reviewCandidates.reduce((count, candidate) => count + candidate.blockingReasons.length, 0),
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
export function buildAssistantWorkflowPlanningProfileMigrationReviewArtifactTracePayload(artifact) {
|
|
127
|
+
return {
|
|
128
|
+
generatedAt: artifact.generatedAt,
|
|
129
|
+
title: artifact.title,
|
|
130
|
+
status: artifact.status,
|
|
131
|
+
recommendedAction: artifact.recommendedAction,
|
|
132
|
+
rationale: artifact.rationale,
|
|
133
|
+
patchTargets: artifact.patchTargets,
|
|
134
|
+
requiredTestIds: artifact.requiredTestIds,
|
|
135
|
+
runtimeChange: artifact.runtimeChange,
|
|
136
|
+
evidence: {
|
|
137
|
+
minRunCount: artifact.evidence.minRunCount,
|
|
138
|
+
sourceReportCount: artifact.evidence.sourceReportCount,
|
|
139
|
+
rowCount: artifact.evidence.rowCount,
|
|
140
|
+
readyProfileIds: artifact.evidence.readyProfileIds,
|
|
141
|
+
readyCandidates: artifact.evidence.readyCandidates,
|
|
142
|
+
},
|
|
143
|
+
review: artifact.review,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
export function buildAssistantWorkflowRunReportBatchTracePayload(batch) {
|
|
147
|
+
return {
|
|
148
|
+
generatedAt: batch.generatedAt,
|
|
149
|
+
sourceReportCount: batch.sourceReportCount,
|
|
150
|
+
rowCount: batch.rowCount,
|
|
151
|
+
interestingRowCount: batch.interestingRowCount,
|
|
152
|
+
warningRowCount: batch.warningRowCount,
|
|
153
|
+
statusCounts: batch.statusCounts,
|
|
154
|
+
intentCounts: batch.intentCounts,
|
|
155
|
+
outcomeCounts: batch.outcomeCounts,
|
|
156
|
+
toolResultStatusCounts: batch.toolResultStatusCounts,
|
|
157
|
+
toolProviderResultCounts: batch.toolProviderResultCounts,
|
|
158
|
+
activePlanningStepProfileCounts: batch.activePlanningStepProfileCounts,
|
|
159
|
+
profileStepCounts: batch.profileStepCounts,
|
|
160
|
+
directRouteDoneCounts: batch.directRouteDoneCounts,
|
|
161
|
+
directRouteRecoveredCounts: batch.directRouteRecoveredCounts,
|
|
162
|
+
directRouteErrorCounts: batch.directRouteErrorCounts,
|
|
163
|
+
directRouteSkipReasonCounts: batch.directRouteSkipReasonCounts,
|
|
164
|
+
directRouteGapReasonCounts: batch.directRouteGapReasonCounts,
|
|
165
|
+
directRouteObservedStrategyCounts: batch.directRouteObservedStrategyCounts,
|
|
166
|
+
directRouteUndeclaredStrategyCounts: batch.directRouteUndeclaredStrategyCounts,
|
|
167
|
+
memoryChangedSlotCounts: batch.memoryChangedSlotCounts,
|
|
168
|
+
memoryChangedProfileFieldCounts: batch.memoryChangedProfileFieldCounts,
|
|
169
|
+
memorySkippedPatchReasonCounts: batch.memorySkippedPatchReasonCounts,
|
|
170
|
+
threadProfileWriteSourceCounts: batch.threadProfileWriteSourceCounts,
|
|
171
|
+
threadProfileWriteReasonCounts: batch.threadProfileWriteReasonCounts,
|
|
172
|
+
threadProfileWriteChangedFieldCounts: batch.threadProfileWriteChangedFieldCounts,
|
|
173
|
+
signalCounts: batch.signalCounts,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
function buildPlanningProfileMigrationCandidates(rows, minRunCount) {
|
|
177
|
+
const candidatesByProfileId = new Map();
|
|
178
|
+
for (const row of rows) {
|
|
179
|
+
for (const profileId of uniqueNonEmptyStrings(row.activePlanningStepProfileIds)) {
|
|
180
|
+
const candidate = candidatesByProfileId.get(profileId) ?? {
|
|
181
|
+
profileId,
|
|
182
|
+
runCount: 0,
|
|
183
|
+
completedCount: 0,
|
|
184
|
+
handledCount: 0,
|
|
185
|
+
warningRowCount: 0,
|
|
186
|
+
failedCount: 0,
|
|
187
|
+
degradedCount: 0,
|
|
188
|
+
clarificationCount: 0,
|
|
189
|
+
notHandledCount: 0,
|
|
190
|
+
profileStepIds: [],
|
|
191
|
+
signalCounts: [],
|
|
192
|
+
signalDetails: [],
|
|
193
|
+
status: "needs_review",
|
|
194
|
+
blockingReasons: [],
|
|
195
|
+
};
|
|
196
|
+
candidate.runCount += 1;
|
|
197
|
+
if (row.status === "completed")
|
|
198
|
+
candidate.completedCount += 1;
|
|
199
|
+
if (row.status === "failed")
|
|
200
|
+
candidate.failedCount += 1;
|
|
201
|
+
if (row.status === "degraded")
|
|
202
|
+
candidate.degradedCount += 1;
|
|
203
|
+
if (row.status === "clarification")
|
|
204
|
+
candidate.clarificationCount += 1;
|
|
205
|
+
if (row.status === "not_handled")
|
|
206
|
+
candidate.notHandledCount += 1;
|
|
207
|
+
if (row.handled)
|
|
208
|
+
candidate.handledCount += 1;
|
|
209
|
+
if (row.warningCount > 0)
|
|
210
|
+
candidate.warningRowCount += 1;
|
|
211
|
+
candidate.profileStepIds = uniqueNonEmptyStrings([...candidate.profileStepIds, ...row.profileStepIds]);
|
|
212
|
+
candidate.signalCounts = mergeSignalCounts(candidate.signalCounts, row.signals);
|
|
213
|
+
candidate.signalDetails = uniqueNonEmptyStrings([
|
|
214
|
+
...candidate.signalDetails,
|
|
215
|
+
...row.signals
|
|
216
|
+
.map((signal) => signal.detail ?? signal.name)
|
|
217
|
+
.filter((detail) => detail.length > 0),
|
|
218
|
+
]);
|
|
219
|
+
candidatesByProfileId.set(profileId, candidate);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return [...candidatesByProfileId.values()]
|
|
223
|
+
.map((candidate) => finalizePlanningProfileMigrationCandidate(candidate, minRunCount))
|
|
224
|
+
.sort((left, right) => {
|
|
225
|
+
if (left.status !== right.status) {
|
|
226
|
+
return left.status === "ready_for_runtime_change" ? -1 : 1;
|
|
227
|
+
}
|
|
228
|
+
if (right.runCount !== left.runCount)
|
|
229
|
+
return right.runCount - left.runCount;
|
|
230
|
+
return left.profileId.localeCompare(right.profileId);
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
function finalizePlanningProfileMigrationCandidate(candidate, minRunCount) {
|
|
234
|
+
const blockingReasons = [];
|
|
235
|
+
if (candidate.runCount < minRunCount) {
|
|
236
|
+
blockingReasons.push(`run_count_below_minimum:${candidate.runCount}/${minRunCount}`);
|
|
237
|
+
}
|
|
238
|
+
if (candidate.completedCount !== candidate.runCount) {
|
|
239
|
+
blockingReasons.push(`non_completed_runs:${candidate.runCount - candidate.completedCount}`);
|
|
240
|
+
}
|
|
241
|
+
if (candidate.handledCount !== candidate.runCount) {
|
|
242
|
+
blockingReasons.push(`unhandled_runs:${candidate.runCount - candidate.handledCount}`);
|
|
243
|
+
}
|
|
244
|
+
if (candidate.warningRowCount > 0) {
|
|
245
|
+
blockingReasons.push(`warning_rows:${candidate.warningRowCount}`);
|
|
246
|
+
}
|
|
247
|
+
if (candidate.profileStepIds.length === 0) {
|
|
248
|
+
blockingReasons.push("missing_profile_steps");
|
|
249
|
+
}
|
|
250
|
+
return {
|
|
251
|
+
...candidate,
|
|
252
|
+
status: blockingReasons.length === 0 ? "ready_for_runtime_change" : "needs_review",
|
|
253
|
+
blockingReasons,
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
function buildPlanningProfileMigrationReviewRationale(report) {
|
|
257
|
+
if (report.addProfileIds.length > 0) {
|
|
258
|
+
return [
|
|
259
|
+
`Ready planning profiles: ${report.addProfileIds.join(", ")}.`,
|
|
260
|
+
`Minimum evidence threshold: ${report.minRunCount} run(s).`,
|
|
261
|
+
report.reviewProfileIds.length > 0
|
|
262
|
+
? `Profiles still needing review: ${report.reviewProfileIds.join(", ")}.`
|
|
263
|
+
: "No observed planning profiles need review.",
|
|
264
|
+
].join(" ");
|
|
265
|
+
}
|
|
266
|
+
if (report.readyProfileIds.length > 0) {
|
|
267
|
+
return [
|
|
268
|
+
"Observed ready planning profiles are already in the current runtime set.",
|
|
269
|
+
`Ready profiles: ${report.readyProfileIds.join(", ")}.`,
|
|
270
|
+
].join(" ");
|
|
271
|
+
}
|
|
272
|
+
if (report.reviewProfileIds.length > 0) {
|
|
273
|
+
return [
|
|
274
|
+
"No planning-profile runtime change is recommended.",
|
|
275
|
+
`Profiles still need review: ${report.reviewProfileIds.join(", ")}.`,
|
|
276
|
+
].join(" ");
|
|
277
|
+
}
|
|
278
|
+
return "No active planning-step profiles were observed in the supplied run-report batch.";
|
|
279
|
+
}
|
|
280
|
+
function toBatchRow(report) {
|
|
281
|
+
return {
|
|
282
|
+
workflowId: report.workflowId,
|
|
283
|
+
workflowVersion: report.workflowVersion,
|
|
284
|
+
status: report.status,
|
|
285
|
+
intent: report.evaluation.intent,
|
|
286
|
+
outcomeKind: report.evaluation.outcomeKind,
|
|
287
|
+
handled: report.evaluation.handled,
|
|
288
|
+
toolResultStatus: report.evaluation.toolResultStatus,
|
|
289
|
+
toolResultProviders: report.toolExecution?.results.map((result) => result.provider) ?? [],
|
|
290
|
+
activePlanningStepProfileIds: report.evaluation.activePlanningStepProfileIds,
|
|
291
|
+
profileStepIds: report.evaluation.profileStepIds,
|
|
292
|
+
directRouteDoneRoutes: [],
|
|
293
|
+
directRouteRecoveredRoutes: [],
|
|
294
|
+
directRouteErrorRoutes: [],
|
|
295
|
+
directRouteSkipReasons: [],
|
|
296
|
+
directRouteGapReasons: [],
|
|
297
|
+
directRouteObservedStrategies: [],
|
|
298
|
+
directRouteUndeclaredStrategies: [],
|
|
299
|
+
memoryChangedSlots: [],
|
|
300
|
+
memoryChangedProfileFields: [],
|
|
301
|
+
memorySkippedPatchReasons: [],
|
|
302
|
+
threadProfileWriteSources: [],
|
|
303
|
+
threadProfileWriteReasons: [],
|
|
304
|
+
threadProfileWriteChangedFields: [],
|
|
305
|
+
signalCount: report.evaluation.signalCount,
|
|
306
|
+
warningCount: report.evaluation.warningCount,
|
|
307
|
+
signals: report.evaluation.signals,
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
function isInterestingRow(row) {
|
|
311
|
+
return row.status !== "completed" || row.warningCount > 0 || row.handled === false;
|
|
312
|
+
}
|
|
313
|
+
function isActionableDirectRouteSkipReason(value) {
|
|
314
|
+
return !value.endsWith(":runtime_policy_disabled") && !value.endsWith(":runtime_disabled");
|
|
315
|
+
}
|
|
316
|
+
function normalizeMinRunCount(value) {
|
|
317
|
+
if (value === null || value === undefined)
|
|
318
|
+
return 3;
|
|
319
|
+
if (!Number.isFinite(value))
|
|
320
|
+
return 3;
|
|
321
|
+
return Math.max(1, Math.floor(value));
|
|
322
|
+
}
|
|
323
|
+
function normalizeOptionalText(value) {
|
|
324
|
+
const normalized = value?.trim();
|
|
325
|
+
return normalized?.length ? normalized : null;
|
|
326
|
+
}
|
|
327
|
+
function uniqueNonEmptyStrings(values) {
|
|
328
|
+
const result = [];
|
|
329
|
+
const seen = new Set();
|
|
330
|
+
for (const value of values) {
|
|
331
|
+
const normalized = value.trim();
|
|
332
|
+
if (!normalized.length || seen.has(normalized))
|
|
333
|
+
continue;
|
|
334
|
+
seen.add(normalized);
|
|
335
|
+
result.push(normalized);
|
|
336
|
+
}
|
|
337
|
+
return result;
|
|
338
|
+
}
|
|
339
|
+
function buildStringCounts(values) {
|
|
340
|
+
const counts = new Map();
|
|
341
|
+
for (const value of values) {
|
|
342
|
+
if (!value.length)
|
|
343
|
+
continue;
|
|
344
|
+
counts.set(value, (counts.get(value) ?? 0) + 1);
|
|
345
|
+
}
|
|
346
|
+
return [...counts.entries()]
|
|
347
|
+
.map(([key, count]) => ({ key, count }))
|
|
348
|
+
.sort((left, right) => {
|
|
349
|
+
if (right.count !== left.count)
|
|
350
|
+
return right.count - left.count;
|
|
351
|
+
return left.key.localeCompare(right.key);
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
function buildSignalCounts(signals) {
|
|
355
|
+
const counts = new Map();
|
|
356
|
+
for (const signal of signals) {
|
|
357
|
+
const current = counts.get(signal.name);
|
|
358
|
+
if (current) {
|
|
359
|
+
current.count += 1;
|
|
360
|
+
if (signal.severity === "warning")
|
|
361
|
+
current.severity = "warning";
|
|
362
|
+
continue;
|
|
363
|
+
}
|
|
364
|
+
counts.set(signal.name, {
|
|
365
|
+
name: signal.name,
|
|
366
|
+
severity: signal.severity,
|
|
367
|
+
count: 1,
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
return [...counts.values()].sort((left, right) => {
|
|
371
|
+
if (right.count !== left.count)
|
|
372
|
+
return right.count - left.count;
|
|
373
|
+
if (left.severity !== right.severity)
|
|
374
|
+
return left.severity === "warning" ? -1 : 1;
|
|
375
|
+
return left.name.localeCompare(right.name);
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
function mergeSignalCounts(currentCounts, signals) {
|
|
379
|
+
const expanded = [];
|
|
380
|
+
for (const count of currentCounts) {
|
|
381
|
+
for (let index = 0; index < count.count; index += 1) {
|
|
382
|
+
expanded.push({
|
|
383
|
+
name: count.name,
|
|
384
|
+
severity: count.severity,
|
|
385
|
+
detail: null,
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
return buildSignalCounts([...expanded, ...signals]);
|
|
390
|
+
}
|
|
391
|
+
//# sourceMappingURL=run-report-batch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-report-batch.js","sourceRoot":"","sources":["../src/run-report-batch.ts"],"names":[],"mappings":"AAoKA,MAAM,UAAU,oCAAoC,CAClD,OAA8C,EAC9C,UAAkD,EAAE;IAEpD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACxC,MAAM,IAAI,GAAG,OAAO,CAAC,eAAe,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAE3F,OAAO;QACL,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACrC,iBAAiB,EAAE,OAAO,CAAC,MAAM;QACjC,QAAQ,EAAE,IAAI,CAAC,MAAM;QACrB,mBAAmB,EAAE,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,MAAM;QACzD,eAAe,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC,MAAM;QAClE,YAAY,EAAE,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC9D,YAAY,EAAE,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,IAAI,SAAS,CAAC,CAAC;QAC3E,aAAa,EAAE,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACpE,sBAAsB,EAAE,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,G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CAAC,CAAC;IACL,CAAC;IACD,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QAC/C,IAAI,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK;YAAE,OAAO,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAChE,IAAI,IAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ;YAAE,OAAO,IAAI,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClF,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,iBAAiB,CACxB,aAAoE,EACpE,OAAwD;IAExD,MAAM,QAAQ,GAA2C,EAAE,CAAC;IAC5D,KAAK,MAAM,KAAK,IAAI,aAAa,EAAE,CAAC;QAClC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,KAAK,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;YACpD,QAAQ,CAAC,IAAI,CAAC;gBACZ,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,MAAM,EAAE,IAAI;aACb,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,iBAAiB,CAAC,CAAC,GAAG,QAAQ,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC;AACtD,CAAC","sourcesContent":["import type { AssistantWorkflowRunReport } from \"./run-report.js\";\nimport type {\n AssistantWorkflowRunEvaluationSignal,\n AssistantWorkflowRunEvaluationSignalName,\n} from \"./run-evaluation.js\";\n\nexport type AssistantWorkflowRunReportBatchOptions = {\n onlyInteresting?: boolean;\n};\n\nexport type AssistantWorkflowRunReportBatchCount = {\n key: string;\n count: number;\n};\n\nexport type AssistantWorkflowRunReportBatchSignalCount = {\n name: AssistantWorkflowRunEvaluationSignalName;\n severity: \"info\" | \"warning\";\n count: number;\n};\n\nexport type AssistantWorkflowRunReportBatchRow = {\n workflowId: string;\n workflowVersion: number;\n status: AssistantWorkflowRunReport[\"status\"];\n intent: string | null;\n outcomeKind: string;\n handled: boolean;\n toolResultStatus: string | null;\n toolResultProviders: string[];\n activePlanningStepProfileIds: string[];\n profileStepIds: string[];\n directRouteDoneRoutes: string[];\n directRouteRecoveredRoutes: string[];\n directRouteErrorRoutes: string[];\n directRouteSkipReasons: string[];\n directRouteGapReasons: string[];\n directRouteObservedStrategies: string[];\n directRouteUndeclaredStrategies: string[];\n memoryChangedSlots: string[];\n memoryChangedProfileFields: string[];\n memorySkippedPatchReasons: string[];\n threadProfileWriteSources: string[];\n threadProfileWriteReasons: string[];\n threadProfileWriteChangedFields: string[];\n signalCount: number;\n warningCount: number;\n signals: AssistantWorkflowRunEvaluationSignal[];\n};\n\nexport type AssistantWorkflowRunReportBatch = {\n generatedAt: string;\n sourceReportCount: number;\n rowCount: number;\n interestingRowCount: number;\n warningRowCount: number;\n statusCounts: AssistantWorkflowRunReportBatchCount[];\n intentCounts: AssistantWorkflowRunReportBatchCount[];\n outcomeCounts: AssistantWorkflowRunReportBatchCount[];\n toolResultStatusCounts: AssistantWorkflowRunReportBatchCount[];\n toolProviderResultCounts: AssistantWorkflowRunReportBatchCount[];\n activePlanningStepProfileCounts: AssistantWorkflowRunReportBatchCount[];\n profileStepCounts: AssistantWorkflowRunReportBatchCount[];\n directRouteDoneCounts: AssistantWorkflowRunReportBatchCount[];\n directRouteRecoveredCounts: AssistantWorkflowRunReportBatchCount[];\n directRouteErrorCounts: AssistantWorkflowRunReportBatchCount[];\n directRouteSkipReasonCounts: AssistantWorkflowRunReportBatchCount[];\n directRouteGapReasonCounts: AssistantWorkflowRunReportBatchCount[];\n directRouteObservedStrategyCounts: AssistantWorkflowRunReportBatchCount[];\n directRouteUndeclaredStrategyCounts: AssistantWorkflowRunReportBatchCount[];\n memoryChangedSlotCounts: AssistantWorkflowRunReportBatchCount[];\n memoryChangedProfileFieldCounts: AssistantWorkflowRunReportBatchCount[];\n memorySkippedPatchReasonCounts: AssistantWorkflowRunReportBatchCount[];\n threadProfileWriteSourceCounts: AssistantWorkflowRunReportBatchCount[];\n threadProfileWriteReasonCounts: AssistantWorkflowRunReportBatchCount[];\n threadProfileWriteChangedFieldCounts: AssistantWorkflowRunReportBatchCount[];\n signalCounts: AssistantWorkflowRunReportBatchSignalCount[];\n rows: AssistantWorkflowRunReportBatchRow[];\n};\n\nexport type AssistantWorkflowPlanningProfileMigrationCandidateStatus = \"ready_for_runtime_change\" | \"needs_review\";\n\nexport type AssistantWorkflowPlanningProfileMigrationCandidate = {\n profileId: string;\n runCount: number;\n completedCount: number;\n handledCount: number;\n warningRowCount: number;\n failedCount: number;\n degradedCount: number;\n clarificationCount: number;\n notHandledCount: number;\n profileStepIds: string[];\n signalCounts: AssistantWorkflowRunReportBatchSignalCount[];\n signalDetails: string[];\n status: AssistantWorkflowPlanningProfileMigrationCandidateStatus;\n blockingReasons: string[];\n};\n\nexport type AssistantWorkflowPlanningProfileMigrationReportOptions = {\n currentRuntimeProfileIds?: readonly string[] | null;\n minRunCount?: number | null;\n generatedAt?: string | null;\n};\n\nexport type AssistantWorkflowPlanningProfileMigrationReport = {\n generatedAt: string;\n minRunCount: number;\n sourceReportCount: number;\n rowCount: number;\n observedProfileCount: number;\n currentRuntimeProfileIds: string[];\n readyProfileIds: string[];\n reviewProfileIds: string[];\n addProfileIds: string[];\n keepProfileIds: string[];\n proposedRuntimeProfileIds: string[];\n candidates: AssistantWorkflowPlanningProfileMigrationCandidate[];\n readyCandidates: AssistantWorkflowPlanningProfileMigrationCandidate[];\n reviewCandidates: AssistantWorkflowPlanningProfileMigrationCandidate[];\n};\n\nexport type AssistantWorkflowPlanningProfileMigrationReviewArtifactStatus =\n | \"ready_for_runtime_change\"\n | \"no_runtime_change\";\n\nexport type AssistantWorkflowPlanningProfileMigrationReviewArtifactRecommendedAction =\n | \"apply_planning_profile_runtime_update\"\n | \"keep_current_runtime\";\n\nexport type AssistantWorkflowPlanningProfileMigrationReviewArtifactOptions = {\n title?: string | null;\n patchTargets?: readonly string[] | null;\n requiredTestIds?: readonly string[] | null;\n};\n\nexport type AssistantWorkflowPlanningProfileMigrationReviewArtifact = {\n generatedAt: string;\n title: string;\n status: AssistantWorkflowPlanningProfileMigrationReviewArtifactStatus;\n recommendedAction: AssistantWorkflowPlanningProfileMigrationReviewArtifactRecommendedAction;\n rationale: string;\n patchTargets: string[];\n requiredTestIds: string[];\n runtimeChange: {\n currentRuntimeProfileIds: string[];\n addProfileIds: string[];\n keepProfileIds: string[];\n proposedRuntimeProfileIds: string[];\n };\n evidence: {\n minRunCount: number;\n sourceReportCount: number;\n rowCount: number;\n readyProfileIds: string[];\n readyCandidates: AssistantWorkflowPlanningProfileMigrationCandidate[];\n };\n review: {\n reviewProfileIds: string[];\n reviewCandidates: AssistantWorkflowPlanningProfileMigrationCandidate[];\n blockerCount: number;\n };\n};\n\nexport function buildAssistantWorkflowRunReportBatch(\n reports: readonly AssistantWorkflowRunReport[],\n options: AssistantWorkflowRunReportBatchOptions = {},\n): AssistantWorkflowRunReportBatch {\n const allRows = reports.map(toBatchRow);\n const rows = options.onlyInteresting === true ? allRows.filter(isInterestingRow) : allRows;\n\n return {\n generatedAt: new Date().toISOString(),\n sourceReportCount: reports.length,\n rowCount: rows.length,\n interestingRowCount: rows.filter(isInterestingRow).length,\n warningRowCount: rows.filter((row) => row.warningCount > 0).length,\n statusCounts: buildStringCounts(rows.map((row) => row.status)),\n intentCounts: buildStringCounts(rows.map((row) => row.intent ?? \"unknown\")),\n outcomeCounts: buildStringCounts(rows.map((row) => row.outcomeKind)),\n toolResultStatusCounts: buildStringCounts(rows.map((row) => row.toolResultStatus ?? \"none\")),\n toolProviderResultCounts: buildStringCounts(rows.flatMap((row) => row.toolResultProviders)),\n activePlanningStepProfileCounts: buildStringCounts(rows.flatMap((row) => row.activePlanningStepProfileIds)),\n profileStepCounts: buildStringCounts(rows.flatMap((row) => row.profileStepIds)),\n directRouteDoneCounts: buildStringCounts(rows.flatMap((row) => row.directRouteDoneRoutes)),\n directRouteRecoveredCounts: buildStringCounts(rows.flatMap((row) => row.directRouteRecoveredRoutes)),\n directRouteErrorCounts: buildStringCounts(rows.flatMap((row) => row.directRouteErrorRoutes)),\n directRouteSkipReasonCounts: buildStringCounts(\n rows.flatMap((row) => row.directRouteSkipReasons).filter(isActionableDirectRouteSkipReason),\n ),\n directRouteGapReasonCounts: buildStringCounts(rows.flatMap((row) => row.directRouteGapReasons)),\n directRouteObservedStrategyCounts: buildStringCounts(rows.flatMap((row) => row.directRouteObservedStrategies)),\n directRouteUndeclaredStrategyCounts: buildStringCounts(rows.flatMap((row) => row.directRouteUndeclaredStrategies)),\n memoryChangedSlotCounts: buildStringCounts(rows.flatMap((row) => row.memoryChangedSlots)),\n memoryChangedProfileFieldCounts: buildStringCounts(rows.flatMap((row) => row.memoryChangedProfileFields)),\n memorySkippedPatchReasonCounts: buildStringCounts(rows.flatMap((row) => row.memorySkippedPatchReasons)),\n threadProfileWriteSourceCounts: buildStringCounts(rows.flatMap((row) => row.threadProfileWriteSources)),\n threadProfileWriteReasonCounts: buildStringCounts(rows.flatMap((row) => row.threadProfileWriteReasons)),\n threadProfileWriteChangedFieldCounts: buildStringCounts(rows.flatMap((row) => row.threadProfileWriteChangedFields)),\n signalCounts: buildSignalCounts(rows.flatMap((row) => row.signals)),\n rows,\n };\n}\n\nexport function buildAssistantWorkflowPlanningProfileMigrationReport(\n batch: AssistantWorkflowRunReportBatch,\n options: AssistantWorkflowPlanningProfileMigrationReportOptions = {},\n): AssistantWorkflowPlanningProfileMigrationReport {\n const minRunCount = normalizeMinRunCount(options.minRunCount);\n const currentRuntimeProfileIds = uniqueNonEmptyStrings(options.currentRuntimeProfileIds ?? []);\n const currentRuntimeProfileIdSet = new Set(currentRuntimeProfileIds);\n const candidates = buildPlanningProfileMigrationCandidates(batch.rows, minRunCount);\n const readyCandidates = candidates.filter((candidate) => candidate.status === \"ready_for_runtime_change\");\n const reviewCandidates = candidates.filter((candidate) => candidate.status === \"needs_review\");\n const readyProfileIds = readyCandidates.map((candidate) => candidate.profileId);\n const reviewProfileIds = reviewCandidates.map((candidate) => candidate.profileId);\n const addProfileIds = readyProfileIds.filter((profileId) => !currentRuntimeProfileIdSet.has(profileId));\n const keepProfileIds = currentRuntimeProfileIds;\n\n return {\n generatedAt: options.generatedAt ?? new Date().toISOString(),\n minRunCount,\n sourceReportCount: batch.sourceReportCount,\n rowCount: batch.rowCount,\n observedProfileCount: candidates.length,\n currentRuntimeProfileIds,\n readyProfileIds,\n reviewProfileIds,\n addProfileIds,\n keepProfileIds,\n proposedRuntimeProfileIds: uniqueNonEmptyStrings([...currentRuntimeProfileIds, ...addProfileIds]),\n candidates,\n readyCandidates,\n reviewCandidates,\n };\n}\n\nexport function buildAssistantWorkflowPlanningProfileMigrationReportTracePayload(\n report: AssistantWorkflowPlanningProfileMigrationReport,\n): Record<string, unknown> {\n return {\n generatedAt: report.generatedAt,\n minRunCount: report.minRunCount,\n sourceReportCount: report.sourceReportCount,\n rowCount: report.rowCount,\n observedProfileCount: report.observedProfileCount,\n currentRuntimeProfileIds: report.currentRuntimeProfileIds,\n readyProfileIds: report.readyProfileIds,\n reviewProfileIds: report.reviewProfileIds,\n addProfileIds: report.addProfileIds,\n keepProfileIds: report.keepProfileIds,\n proposedRuntimeProfileIds: report.proposedRuntimeProfileIds,\n candidates: report.candidates.map((candidate) => ({\n profileId: candidate.profileId,\n runCount: candidate.runCount,\n completedCount: candidate.completedCount,\n handledCount: candidate.handledCount,\n warningRowCount: candidate.warningRowCount,\n failedCount: candidate.failedCount,\n degradedCount: candidate.degradedCount,\n clarificationCount: candidate.clarificationCount,\n notHandledCount: candidate.notHandledCount,\n profileStepIds: candidate.profileStepIds,\n signalCounts: candidate.signalCounts,\n signalDetails: candidate.signalDetails,\n status: candidate.status,\n blockingReasons: candidate.blockingReasons,\n })),\n };\n}\n\nexport function buildAssistantWorkflowPlanningProfileMigrationReviewArtifact(\n report: AssistantWorkflowPlanningProfileMigrationReport,\n options: AssistantWorkflowPlanningProfileMigrationReviewArtifactOptions = {},\n): AssistantWorkflowPlanningProfileMigrationReviewArtifact {\n const status = report.addProfileIds.length > 0 ? \"ready_for_runtime_change\" : \"no_runtime_change\";\n const recommendedAction =\n status === \"ready_for_runtime_change\"\n ? \"apply_planning_profile_runtime_update\"\n : \"keep_current_runtime\";\n\n return {\n generatedAt: report.generatedAt,\n title: normalizeOptionalText(options.title) ?? \"Assistant workflow planning-profile migration review\",\n status,\n recommendedAction,\n rationale: buildPlanningProfileMigrationReviewRationale(report),\n patchTargets: uniqueNonEmptyStrings(options.patchTargets ?? []),\n requiredTestIds: uniqueNonEmptyStrings(options.requiredTestIds ?? []),\n runtimeChange: {\n currentRuntimeProfileIds: report.currentRuntimeProfileIds,\n addProfileIds: report.addProfileIds,\n keepProfileIds: report.keepProfileIds,\n proposedRuntimeProfileIds: report.proposedRuntimeProfileIds,\n },\n evidence: {\n minRunCount: report.minRunCount,\n sourceReportCount: report.sourceReportCount,\n rowCount: report.rowCount,\n readyProfileIds: report.readyProfileIds,\n readyCandidates: report.readyCandidates,\n },\n review: {\n reviewProfileIds: report.reviewProfileIds,\n reviewCandidates: report.reviewCandidates,\n blockerCount: report.reviewCandidates.reduce(\n (count, candidate) => count + candidate.blockingReasons.length,\n 0,\n ),\n },\n };\n}\n\nexport function buildAssistantWorkflowPlanningProfileMigrationReviewArtifactTracePayload(\n artifact: AssistantWorkflowPlanningProfileMigrationReviewArtifact,\n): Record<string, unknown> {\n return {\n generatedAt: artifact.generatedAt,\n title: artifact.title,\n status: artifact.status,\n recommendedAction: artifact.recommendedAction,\n rationale: artifact.rationale,\n patchTargets: artifact.patchTargets,\n requiredTestIds: artifact.requiredTestIds,\n runtimeChange: artifact.runtimeChange,\n evidence: {\n minRunCount: artifact.evidence.minRunCount,\n sourceReportCount: artifact.evidence.sourceReportCount,\n rowCount: artifact.evidence.rowCount,\n readyProfileIds: artifact.evidence.readyProfileIds,\n readyCandidates: artifact.evidence.readyCandidates,\n },\n review: artifact.review,\n };\n}\n\nexport function buildAssistantWorkflowRunReportBatchTracePayload(\n batch: AssistantWorkflowRunReportBatch,\n): Record<string, unknown> {\n return {\n generatedAt: batch.generatedAt,\n sourceReportCount: batch.sourceReportCount,\n rowCount: batch.rowCount,\n interestingRowCount: batch.interestingRowCount,\n warningRowCount: batch.warningRowCount,\n statusCounts: batch.statusCounts,\n intentCounts: batch.intentCounts,\n outcomeCounts: batch.outcomeCounts,\n toolResultStatusCounts: batch.toolResultStatusCounts,\n toolProviderResultCounts: batch.toolProviderResultCounts,\n activePlanningStepProfileCounts: batch.activePlanningStepProfileCounts,\n profileStepCounts: batch.profileStepCounts,\n directRouteDoneCounts: batch.directRouteDoneCounts,\n directRouteRecoveredCounts: batch.directRouteRecoveredCounts,\n directRouteErrorCounts: batch.directRouteErrorCounts,\n directRouteSkipReasonCounts: batch.directRouteSkipReasonCounts,\n directRouteGapReasonCounts: batch.directRouteGapReasonCounts,\n directRouteObservedStrategyCounts: batch.directRouteObservedStrategyCounts,\n directRouteUndeclaredStrategyCounts: batch.directRouteUndeclaredStrategyCounts,\n memoryChangedSlotCounts: batch.memoryChangedSlotCounts,\n memoryChangedProfileFieldCounts: batch.memoryChangedProfileFieldCounts,\n memorySkippedPatchReasonCounts: batch.memorySkippedPatchReasonCounts,\n threadProfileWriteSourceCounts: batch.threadProfileWriteSourceCounts,\n threadProfileWriteReasonCounts: batch.threadProfileWriteReasonCounts,\n threadProfileWriteChangedFieldCounts: batch.threadProfileWriteChangedFieldCounts,\n signalCounts: batch.signalCounts,\n };\n}\n\nfunction buildPlanningProfileMigrationCandidates(\n rows: readonly AssistantWorkflowRunReportBatchRow[],\n minRunCount: number,\n): AssistantWorkflowPlanningProfileMigrationCandidate[] {\n const candidatesByProfileId = new Map<string, AssistantWorkflowPlanningProfileMigrationCandidate>();\n\n for (const row of rows) {\n for (const profileId of uniqueNonEmptyStrings(row.activePlanningStepProfileIds)) {\n const candidate = candidatesByProfileId.get(profileId) ?? {\n profileId,\n runCount: 0,\n completedCount: 0,\n handledCount: 0,\n warningRowCount: 0,\n failedCount: 0,\n degradedCount: 0,\n clarificationCount: 0,\n notHandledCount: 0,\n profileStepIds: [],\n signalCounts: [],\n signalDetails: [],\n status: \"needs_review\",\n blockingReasons: [],\n };\n candidate.runCount += 1;\n if (row.status === \"completed\") candidate.completedCount += 1;\n if (row.status === \"failed\") candidate.failedCount += 1;\n if (row.status === \"degraded\") candidate.degradedCount += 1;\n if (row.status === \"clarification\") candidate.clarificationCount += 1;\n if (row.status === \"not_handled\") candidate.notHandledCount += 1;\n if (row.handled) candidate.handledCount += 1;\n if (row.warningCount > 0) candidate.warningRowCount += 1;\n candidate.profileStepIds = uniqueNonEmptyStrings([...candidate.profileStepIds, ...row.profileStepIds]);\n candidate.signalCounts = mergeSignalCounts(candidate.signalCounts, row.signals);\n candidate.signalDetails = uniqueNonEmptyStrings([\n ...candidate.signalDetails,\n ...row.signals\n .map((signal) => signal.detail ?? signal.name)\n .filter((detail) => detail.length > 0),\n ]);\n candidatesByProfileId.set(profileId, candidate);\n }\n }\n\n return [...candidatesByProfileId.values()]\n .map((candidate) => finalizePlanningProfileMigrationCandidate(candidate, minRunCount))\n .sort((left, right) => {\n if (left.status !== right.status) {\n return left.status === \"ready_for_runtime_change\" ? -1 : 1;\n }\n if (right.runCount !== left.runCount) return right.runCount - left.runCount;\n return left.profileId.localeCompare(right.profileId);\n });\n}\n\nfunction finalizePlanningProfileMigrationCandidate(\n candidate: AssistantWorkflowPlanningProfileMigrationCandidate,\n minRunCount: number,\n): AssistantWorkflowPlanningProfileMigrationCandidate {\n const blockingReasons: string[] = [];\n if (candidate.runCount < minRunCount) {\n blockingReasons.push(`run_count_below_minimum:${candidate.runCount}/${minRunCount}`);\n }\n if (candidate.completedCount !== candidate.runCount) {\n blockingReasons.push(`non_completed_runs:${candidate.runCount - candidate.completedCount}`);\n }\n if (candidate.handledCount !== candidate.runCount) {\n blockingReasons.push(`unhandled_runs:${candidate.runCount - candidate.handledCount}`);\n }\n if (candidate.warningRowCount > 0) {\n blockingReasons.push(`warning_rows:${candidate.warningRowCount}`);\n }\n if (candidate.profileStepIds.length === 0) {\n blockingReasons.push(\"missing_profile_steps\");\n }\n\n return {\n ...candidate,\n status: blockingReasons.length === 0 ? \"ready_for_runtime_change\" : \"needs_review\",\n blockingReasons,\n };\n}\n\nfunction buildPlanningProfileMigrationReviewRationale(\n report: AssistantWorkflowPlanningProfileMigrationReport,\n): string {\n if (report.addProfileIds.length > 0) {\n return [\n `Ready planning profiles: ${report.addProfileIds.join(\", \")}.`,\n `Minimum evidence threshold: ${report.minRunCount} run(s).`,\n report.reviewProfileIds.length > 0\n ? `Profiles still needing review: ${report.reviewProfileIds.join(\", \")}.`\n : \"No observed planning profiles need review.\",\n ].join(\" \");\n }\n if (report.readyProfileIds.length > 0) {\n return [\n \"Observed ready planning profiles are already in the current runtime set.\",\n `Ready profiles: ${report.readyProfileIds.join(\", \")}.`,\n ].join(\" \");\n }\n if (report.reviewProfileIds.length > 0) {\n return [\n \"No planning-profile runtime change is recommended.\",\n `Profiles still need review: ${report.reviewProfileIds.join(\", \")}.`,\n ].join(\" \");\n }\n return \"No active planning-step profiles were observed in the supplied run-report batch.\";\n}\n\nfunction toBatchRow(report: AssistantWorkflowRunReport): AssistantWorkflowRunReportBatchRow {\n return {\n workflowId: report.workflowId,\n workflowVersion: report.workflowVersion,\n status: report.status,\n intent: report.evaluation.intent,\n outcomeKind: report.evaluation.outcomeKind,\n handled: report.evaluation.handled,\n toolResultStatus: report.evaluation.toolResultStatus,\n toolResultProviders: report.toolExecution?.results.map((result) => result.provider) ?? [],\n activePlanningStepProfileIds: report.evaluation.activePlanningStepProfileIds,\n profileStepIds: report.evaluation.profileStepIds,\n directRouteDoneRoutes: [],\n directRouteRecoveredRoutes: [],\n directRouteErrorRoutes: [],\n directRouteSkipReasons: [],\n directRouteGapReasons: [],\n directRouteObservedStrategies: [],\n directRouteUndeclaredStrategies: [],\n memoryChangedSlots: [],\n memoryChangedProfileFields: [],\n memorySkippedPatchReasons: [],\n threadProfileWriteSources: [],\n threadProfileWriteReasons: [],\n threadProfileWriteChangedFields: [],\n signalCount: report.evaluation.signalCount,\n warningCount: report.evaluation.warningCount,\n signals: report.evaluation.signals,\n };\n}\n\nfunction isInterestingRow(row: AssistantWorkflowRunReportBatchRow): boolean {\n return row.status !== \"completed\" || row.warningCount > 0 || row.handled === false;\n}\n\nfunction isActionableDirectRouteSkipReason(value: string): boolean {\n return !value.endsWith(\":runtime_policy_disabled\") && !value.endsWith(\":runtime_disabled\");\n}\n\nfunction normalizeMinRunCount(value: number | null | undefined): number {\n if (value === null || value === undefined) return 3;\n if (!Number.isFinite(value)) return 3;\n return Math.max(1, Math.floor(value));\n}\n\nfunction normalizeOptionalText(value: string | null | undefined): string | null {\n const normalized = value?.trim();\n return normalized?.length ? normalized : null;\n}\n\nfunction uniqueNonEmptyStrings(values: readonly string[]): string[] {\n const result: string[] = [];\n const seen = new Set<string>();\n for (const value of values) {\n const normalized = value.trim();\n if (!normalized.length || seen.has(normalized)) continue;\n seen.add(normalized);\n result.push(normalized);\n }\n return result;\n}\n\nfunction buildStringCounts(values: readonly string[]): AssistantWorkflowRunReportBatchCount[] {\n const counts = new Map<string, number>();\n for (const value of values) {\n if (!value.length) continue;\n counts.set(value, (counts.get(value) ?? 0) + 1);\n }\n return [...counts.entries()]\n .map(([key, count]) => ({ key, count }))\n .sort((left, right) => {\n if (right.count !== left.count) return right.count - left.count;\n return left.key.localeCompare(right.key);\n });\n}\n\nfunction buildSignalCounts(\n signals: readonly AssistantWorkflowRunEvaluationSignal[],\n): AssistantWorkflowRunReportBatchSignalCount[] {\n const counts = new Map<string, AssistantWorkflowRunReportBatchSignalCount>();\n for (const signal of signals) {\n const current = counts.get(signal.name);\n if (current) {\n current.count += 1;\n if (signal.severity === \"warning\") current.severity = \"warning\";\n continue;\n }\n counts.set(signal.name, {\n name: signal.name,\n severity: signal.severity,\n count: 1,\n });\n }\n return [...counts.values()].sort((left, right) => {\n if (right.count !== left.count) return right.count - left.count;\n if (left.severity !== right.severity) return left.severity === \"warning\" ? -1 : 1;\n return left.name.localeCompare(right.name);\n });\n}\n\nfunction mergeSignalCounts(\n currentCounts: readonly AssistantWorkflowRunReportBatchSignalCount[],\n signals: readonly AssistantWorkflowRunEvaluationSignal[],\n): AssistantWorkflowRunReportBatchSignalCount[] {\n const expanded: AssistantWorkflowRunEvaluationSignal[] = [];\n for (const count of currentCounts) {\n for (let index = 0; index < count.count; index += 1) {\n expanded.push({\n name: count.name,\n severity: count.severity,\n detail: null,\n });\n }\n }\n return buildSignalCounts([...expanded, ...signals]);\n}\n"]}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type AssistantWorkflowPlanningProfileMigrationReport, type AssistantWorkflowPlanningProfileMigrationReviewArtifact, type AssistantWorkflowRunReportBatch, type AssistantWorkflowRunReportBatchOptions } from "./run-report-batch.js";
|
|
2
|
+
import { type AssistantWorkflowRunReport, type AssistantWorkflowRunReportStatus } from "./run-report.js";
|
|
3
|
+
export declare const ASSISTANT_WORKFLOW_RUN_REPORT_JSON_SCHEMA_VERSION = 1;
|
|
4
|
+
export type AssistantWorkflowJsonPrimitive = string | number | boolean | null;
|
|
5
|
+
export type AssistantWorkflowJsonValue = AssistantWorkflowJsonPrimitive | AssistantWorkflowJsonValue[] | {
|
|
6
|
+
[key: string]: AssistantWorkflowJsonValue;
|
|
7
|
+
};
|
|
8
|
+
export type AssistantWorkflowSerializedRunReport = {
|
|
9
|
+
schemaVersion: typeof ASSISTANT_WORKFLOW_RUN_REPORT_JSON_SCHEMA_VERSION;
|
|
10
|
+
workflowId: string;
|
|
11
|
+
workflowVersion: number;
|
|
12
|
+
status: AssistantWorkflowRunReportStatus;
|
|
13
|
+
run: Record<string, AssistantWorkflowJsonValue>;
|
|
14
|
+
toolExecution: Record<string, AssistantWorkflowJsonValue> | null;
|
|
15
|
+
outcome: Record<string, AssistantWorkflowJsonValue>;
|
|
16
|
+
evaluation: Record<string, AssistantWorkflowJsonValue>;
|
|
17
|
+
};
|
|
18
|
+
export type AssistantWorkflowSerializedRunReportBatchOptions = AssistantWorkflowRunReportBatchOptions & {
|
|
19
|
+
generatedAt?: string;
|
|
20
|
+
};
|
|
21
|
+
export type AssistantWorkflowSerializedRunReportBatch = {
|
|
22
|
+
schemaVersion: typeof ASSISTANT_WORKFLOW_RUN_REPORT_JSON_SCHEMA_VERSION;
|
|
23
|
+
generatedAt: string;
|
|
24
|
+
sourceReportCount: number;
|
|
25
|
+
reportCount: number;
|
|
26
|
+
summary: Record<string, AssistantWorkflowJsonValue>;
|
|
27
|
+
reports: AssistantWorkflowSerializedRunReport[];
|
|
28
|
+
};
|
|
29
|
+
export type AssistantWorkflowSerializedRunReportLinesOptions = AssistantWorkflowRunReportBatchOptions & {
|
|
30
|
+
trailingNewline?: boolean;
|
|
31
|
+
};
|
|
32
|
+
export type AssistantWorkflowSerializedRunReportLineErrorReason = "invalid_json" | "invalid_report";
|
|
33
|
+
export type AssistantWorkflowSerializedRunReportLineError = {
|
|
34
|
+
lineNumber: number;
|
|
35
|
+
reason: AssistantWorkflowSerializedRunReportLineErrorReason;
|
|
36
|
+
preview: string;
|
|
37
|
+
};
|
|
38
|
+
export type AssistantWorkflowSerializedRunReportLinesParseResult = {
|
|
39
|
+
lineCount: number;
|
|
40
|
+
reportCount: number;
|
|
41
|
+
errorCount: number;
|
|
42
|
+
reports: AssistantWorkflowSerializedRunReport[];
|
|
43
|
+
errors: AssistantWorkflowSerializedRunReportLineError[];
|
|
44
|
+
};
|
|
45
|
+
export type AssistantWorkflowRunReportReplayLinesOptions = AssistantWorkflowSerializedRunReportBatchOptions & {
|
|
46
|
+
minPlanningProfileRunCount?: number | null;
|
|
47
|
+
currentRuntimePlanningProfileIds?: readonly string[] | null;
|
|
48
|
+
migrationReviewPatchTargets?: readonly string[] | null;
|
|
49
|
+
migrationReviewRequiredTestIds?: readonly string[] | null;
|
|
50
|
+
migrationReviewTitle?: string | null;
|
|
51
|
+
};
|
|
52
|
+
export type AssistantWorkflowRunReportReplayLinesInput = {
|
|
53
|
+
reportLines: string;
|
|
54
|
+
};
|
|
55
|
+
export type AssistantWorkflowRunReportReplayLinesResult = {
|
|
56
|
+
reportParse: AssistantWorkflowSerializedRunReportLinesParseResult;
|
|
57
|
+
parseErrorCount: number;
|
|
58
|
+
batch: AssistantWorkflowSerializedRunReportBatch;
|
|
59
|
+
runReportBatch: AssistantWorkflowRunReportBatch;
|
|
60
|
+
planningProfileMigration: AssistantWorkflowPlanningProfileMigrationReport;
|
|
61
|
+
planningProfileMigrationReviewArtifact: AssistantWorkflowPlanningProfileMigrationReviewArtifact;
|
|
62
|
+
};
|
|
63
|
+
export declare function serializeAssistantWorkflowRunReport(report: AssistantWorkflowRunReport): AssistantWorkflowSerializedRunReport;
|
|
64
|
+
export declare function stringifyAssistantWorkflowRunReport(report: AssistantWorkflowRunReport, space?: number): string;
|
|
65
|
+
export declare function serializeAssistantWorkflowRunReports(reports: readonly AssistantWorkflowRunReport[], options?: AssistantWorkflowSerializedRunReportBatchOptions): AssistantWorkflowSerializedRunReportBatch;
|
|
66
|
+
export declare function buildAssistantWorkflowRunReportBatchFromSerializedReports(reports: readonly AssistantWorkflowSerializedRunReport[], options?: AssistantWorkflowSerializedRunReportBatchOptions): AssistantWorkflowRunReportBatch;
|
|
67
|
+
export declare function serializeAssistantWorkflowSerializedRunReports(reports: readonly AssistantWorkflowSerializedRunReport[], options?: AssistantWorkflowSerializedRunReportBatchOptions): AssistantWorkflowSerializedRunReportBatch;
|
|
68
|
+
export declare function stringifyAssistantWorkflowRunReports(reports: readonly AssistantWorkflowRunReport[], options?: AssistantWorkflowSerializedRunReportBatchOptions, space?: number): string;
|
|
69
|
+
export declare function stringifyAssistantWorkflowRunReportLines(reports: readonly AssistantWorkflowRunReport[], options?: AssistantWorkflowSerializedRunReportLinesOptions): string;
|
|
70
|
+
export declare function stringifyAssistantWorkflowSerializedRunReportLines(reports: readonly AssistantWorkflowSerializedRunReport[], options?: AssistantWorkflowSerializedRunReportLinesOptions): string;
|
|
71
|
+
export declare function parseAssistantWorkflowSerializedRunReport(value: unknown): AssistantWorkflowSerializedRunReport | null;
|
|
72
|
+
export declare function parseAssistantWorkflowSerializedRunReportLines(input: string): AssistantWorkflowSerializedRunReportLinesParseResult;
|
|
73
|
+
export declare function parseAssistantWorkflowSerializedRunReportBatch(value: unknown): AssistantWorkflowSerializedRunReportBatch | null;
|
|
74
|
+
export declare function runAssistantWorkflowRunReportReplayLines(input: AssistantWorkflowRunReportReplayLinesInput, options?: AssistantWorkflowRunReportReplayLinesOptions): AssistantWorkflowRunReportReplayLinesResult;
|
|
75
|
+
export declare function buildAssistantWorkflowRunReportReplayLinesTracePayload(result: AssistantWorkflowRunReportReplayLinesResult): Record<string, AssistantWorkflowJsonValue>;
|
|
76
|
+
//# sourceMappingURL=run-report-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-report-json.d.ts","sourceRoot":"","sources":["../src/run-report-json.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,+CAA+C,EACpD,KAAK,uDAAuD,EAC5D,KAAK,+BAA+B,EAEpC,KAAK,sCAAsC,EAE5C,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEL,KAAK,0BAA0B,EAC/B,KAAK,gCAAgC,EACtC,MAAM,iBAAiB,CAAC;AAazB,eAAO,MAAM,iDAAiD,IAAI,CAAC;AAEnE,MAAM,MAAM,8BAA8B,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAE9E,MAAM,MAAM,0BAA0B,GAClC,8BAA8B,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