@uns-kit/assistant-workflow 2.0.78 → 2.0.80
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/README.md +18 -0
- package/dist/decision.d.ts +1 -0
- package/dist/decision.d.ts.map +1 -1
- package/dist/decision.js +5 -0
- package/dist/decision.js.map +1 -1
- package/dist/definition-diagnostics.js +14 -5
- package/dist/definition-diagnostics.js.map +1 -1
- package/dist/definition.d.ts +2 -0
- package/dist/definition.d.ts.map +1 -1
- package/dist/definition.js +12 -3
- package/dist/definition.js.map +1 -1
- package/dist/tool-selection-evaluation.d.ts +13 -3
- package/dist/tool-selection-evaluation.d.ts.map +1 -1
- package/dist/tool-selection-evaluation.js +128 -27
- package/dist/tool-selection-evaluation.js.map +1 -1
- package/dist/tool-selection-json.js +1 -0
- package/dist/tool-selection-json.js.map +1 -1
- package/dist/tool-selection-policy.d.ts +4 -2
- package/dist/tool-selection-policy.d.ts.map +1 -1
- package/dist/tool-selection-policy.js +15 -0
- package/dist/tool-selection-policy.js.map +1 -1
- package/dist/tool-selection-trace-export.js +3 -0
- package/dist/tool-selection-trace-export.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-selection-evaluation.js","sourceRoot":"","sources":["../src/tool-selection-evaluation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,6CAA6C,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,EACL,2BAA2B,IAAI,UAAU,EACzC,2BAA2B,IAAI,UAAU,EACzC,gCAAgC,GACjC,MAAM,oBAAoB,CAAC;AAmP5B,MAAM,UAAU,8CAA8C,CAC5D,QAA0D;IAE1D,MAAM,OAAO,GAAG,sDAAsD,CAAC,QAAQ,CAAC,CAAC;IACjF,MAAM,mCAAmC,GAAG,eAAe,CACzD,QAAQ,CAAC,iBAAiB,EAAE,CAAC,iCAAiC,CAAC,CAChE,CAAC;IACF,MAAM,iCAAiC,GAAG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AAK,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,eAAe,CAAC,KAA6C;IACpE,OAAO,gCAAgC,CAAC,KAAK,EAAE;QAC7C,IAAI,EAAE,KAAK;QACX,UAAU,EAAE,IAAI;QAChB,MAAM,EAAE,KAAK;QACb,iBAAiB,EAAE,IAAI;KACxB,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { AssistantWorkflowJsonValue } from \"./run-report-json.js\";\nimport type { AssistantWorkflowSerializedToolSelectionDecision } from \"./tool-selection-json.js\";\nimport { buildAssistantWorkflowToolSelectionSegmentKey } from \"./tool-selection-policy.js\";\nimport {\n readAssistantWorkflowNumber as readNumber,\n readAssistantWorkflowString as readString,\n readAssistantWorkflowStringArray,\n} from \"./value-readers.js\";\n\nexport type AssistantWorkflowToolSelectionEvaluationSeverity = \"info\" | \"warning\";\n\nexport type AssistantWorkflowToolSelectionEvaluationSignalName =\n | \"legacy_authority\"\n | \"workflow_unavailable\"\n | \"workflow_authority_not_enabled\"\n | \"workflow_blocked\"\n | \"workflow_differs\"\n | \"workflow_candidate_not_selected\"\n | \"selected_outside_workflow_candidate\"\n | \"selected_outside_workflow_suggestions\"\n | \"selected_policy_excluded_optional_tool\";\n\nexport type AssistantWorkflowToolSelectionEvaluationSignal = {\n name: AssistantWorkflowToolSelectionEvaluationSignalName;\n severity: AssistantWorkflowToolSelectionEvaluationSeverity;\n detail: string | null;\n};\n\nexport type AssistantWorkflowToolSelectionEvaluation = {\n intentId: string | null;\n hop: number | null;\n selectedReason: string | null;\n authoritySource: string;\n authorityReason: string;\n workflowStatus: string | null;\n workflowAuthorityEnabled: boolean | null;\n workflowAuthoritySegmentKey: string;\n workflowAuthoritySegmentEnabled: boolean | null;\n effectiveReason: string | null;\n selectedToolCount: number;\n effectiveToolCount: number;\n workflowSuggestedToolCount: number;\n workflowSelectionCandidateToolCount: number;\n workflowSelectionActiveProfileIds: string[];\n workflowSelectionProfileToolNames: string[];\n workflowSelectionProfileToolCount: number;\n signalCount: number;\n warningCount: number;\n signals: AssistantWorkflowToolSelectionEvaluationSignal[];\n};\n\nexport type AssistantWorkflowToolSelectionEvaluationBatchOptions = {\n onlyInteresting?: boolean;\n};\n\nexport type AssistantWorkflowToolSelectionEvaluationBatchCount = {\n key: string;\n count: number;\n};\n\nexport type AssistantWorkflowToolSelectionEvaluationBatchSignalCount = {\n name: AssistantWorkflowToolSelectionEvaluationSignalName;\n severity: AssistantWorkflowToolSelectionEvaluationSeverity;\n count: number;\n};\n\nexport type AssistantWorkflowToolSelectionEvaluationIntentReadiness = {\n intentId: string;\n decisionCount: number;\n workflowAuthorityCount: number;\n shadowEquivalentCount: number;\n workflowDiffersCount: number;\n workflowBlockedCount: number;\n workflowUnavailableCount: number;\n warningCount: number;\n workflowAuthorityConfirmed: boolean;\n readyForWorkflowAuthority: boolean;\n};\n\nexport type AssistantWorkflowToolSelectionEvaluationSegmentReadiness =\n AssistantWorkflowToolSelectionEvaluationIntentReadiness & {\n segmentKey: string;\n hop: number | null;\n selectedReason: string | null;\n };\n\nexport type AssistantWorkflowToolSelectionEvaluationReadinessSummary = {\n readyIntentCount: number;\n confirmedIntentCount: number;\n readySegmentCount: number;\n confirmedSegmentCount: number;\n warningIntentCount: number;\n warningSegmentCount: number;\n};\n\nexport type AssistantWorkflowToolSelectionMigrationCandidateKind = \"intent\" | \"segment\";\n\nexport type AssistantWorkflowToolSelectionMigrationCandidateStatus =\n | \"ready_for_workflow_authority\"\n | \"workflow_authority_confirmed\"\n | \"needs_review\";\n\nexport type AssistantWorkflowToolSelectionMigrationRecommendedAction =\n | \"add_intent_to_authority_allow_list\"\n | \"keep_runtime_authority\"\n | \"review_segment_before_authority_change\"\n | \"review_blockers_before_migration\";\n\nexport type AssistantWorkflowToolSelectionMigrationCandidate = {\n kind: AssistantWorkflowToolSelectionMigrationCandidateKind;\n key: string;\n intentId: string;\n segmentKey: string | null;\n hop: number | null;\n selectedReason: string | null;\n decisionCount: number;\n workflowAuthorityCount: number;\n shadowEquivalentCount: number;\n workflowDiffersCount: number;\n workflowBlockedCount: number;\n workflowUnavailableCount: number;\n warningCount: number;\n status: AssistantWorkflowToolSelectionMigrationCandidateStatus;\n recommendedAction: AssistantWorkflowToolSelectionMigrationRecommendedAction;\n blockingReasons: string[];\n rationale: string;\n};\n\nexport type AssistantWorkflowToolSelectionMigrationReportOptions = {\n minDecisionCount?: number | null;\n};\n\nexport type AssistantWorkflowToolSelectionMigrationReport = {\n generatedAt: string;\n minDecisionCount: number;\n sourceDecisionCount: number;\n rowCount: number;\n suggestedAuthorityIntentIds: string[];\n suggestedAuthoritySegmentKeys: string[];\n candidateCount: number;\n readyIntentCandidates: AssistantWorkflowToolSelectionMigrationCandidate[];\n readySegmentCandidates: AssistantWorkflowToolSelectionMigrationCandidate[];\n confirmedIntentCandidates: AssistantWorkflowToolSelectionMigrationCandidate[];\n confirmedSegmentCandidates: AssistantWorkflowToolSelectionMigrationCandidate[];\n reviewCandidates: AssistantWorkflowToolSelectionMigrationCandidate[];\n};\n\nexport type AssistantWorkflowToolSelectionAuthorityAllowListProposalOptions = {\n currentAuthorityIntentIds?: readonly string[] | null;\n currentAuthoritySegmentKeys?: readonly string[] | null;\n};\n\nexport type AssistantWorkflowToolSelectionAuthorityAllowListProposal = {\n generatedAt: string;\n minDecisionCount: number;\n sourceDecisionCount: number;\n rowCount: number;\n currentAuthorityIntentIds: string[];\n currentAuthoritySegmentKeys: string[];\n suggestedAuthorityIntentIds: string[];\n suggestedAuthoritySegmentKeys: string[];\n addIntentIds: string[];\n addSegmentKeys: string[];\n keepIntentIds: string[];\n keepSegmentKeys: string[];\n proposedAuthorityIntentIds: string[];\n proposedAuthoritySegmentKeys: string[];\n readyIntentCandidateCount: number;\n readySegmentCandidateCount: number;\n confirmedIntentCandidateCount: number;\n confirmedSegmentCandidateCount: number;\n reviewIntentCandidateCount: number;\n reviewSegmentCandidateCount: number;\n reviewIntentIds: string[];\n reviewSegmentKeys: string[];\n currentIntentIdsWithReviewEvidence: string[];\n currentSegmentKeysWithReviewEvidence: string[];\n canApplyAdditions: boolean;\n rationale: string[];\n};\n\nexport type AssistantWorkflowToolSelectionMigrationReviewArtifactStatus =\n | \"ready_for_runtime_change\"\n | \"no_runtime_change\";\n\nexport type AssistantWorkflowToolSelectionMigrationReviewArtifactRecommendedAction =\n | \"apply_authority_allow_list_update\"\n | \"keep_current_authority\";\n\nexport type AssistantWorkflowToolSelectionMigrationReviewArtifactOptions = {\n title?: string | null;\n patchTargets?: readonly string[] | null;\n requiredTestIds?: readonly string[] | null;\n};\n\nexport type AssistantWorkflowToolSelectionMigrationReviewArtifact = {\n generatedAt: string;\n title: string;\n status: AssistantWorkflowToolSelectionMigrationReviewArtifactStatus;\n recommendedAction: AssistantWorkflowToolSelectionMigrationReviewArtifactRecommendedAction;\n minDecisionCount: number;\n sourceDecisionCount: number;\n rowCount: number;\n patchTargets: string[];\n requiredTestIds: string[];\n runtimeChange: {\n addIntentIds: string[];\n addSegmentKeys: string[];\n keepIntentIds: string[];\n keepSegmentKeys: string[];\n proposedAuthorityIntentIds: string[];\n proposedAuthoritySegmentKeys: string[];\n };\n evidence: {\n readyIntentCandidateKeys: string[];\n readySegmentCandidateKeys: string[];\n confirmedIntentCandidateKeys: string[];\n confirmedSegmentCandidateKeys: string[];\n };\n review: {\n reviewIntentIds: string[];\n reviewSegmentKeys: string[];\n currentIntentIdsWithReviewEvidence: string[];\n currentSegmentKeysWithReviewEvidence: string[];\n blockerCount: number;\n blockers: AssistantWorkflowToolSelectionMigrationCandidate[];\n };\n rationale: string[];\n};\n\nexport type AssistantWorkflowToolSelectionEvaluationBatch = {\n generatedAt: string;\n sourceDecisionCount: number;\n rowCount: number;\n interestingRowCount: number;\n warningRowCount: number;\n intentCounts: AssistantWorkflowToolSelectionEvaluationBatchCount[];\n intentReadiness: AssistantWorkflowToolSelectionEvaluationIntentReadiness[];\n segmentReadiness: AssistantWorkflowToolSelectionEvaluationSegmentReadiness[];\n readinessSummary: AssistantWorkflowToolSelectionEvaluationReadinessSummary;\n authoritySourceCounts: AssistantWorkflowToolSelectionEvaluationBatchCount[];\n authorityReasonCounts: AssistantWorkflowToolSelectionEvaluationBatchCount[];\n workflowStatusCounts: AssistantWorkflowToolSelectionEvaluationBatchCount[];\n effectiveReasonCounts: AssistantWorkflowToolSelectionEvaluationBatchCount[];\n workflowSelectionProfileCounts: AssistantWorkflowToolSelectionEvaluationBatchCount[];\n workflowSelectionProfileToolCounts: AssistantWorkflowToolSelectionEvaluationBatchCount[];\n signalCounts: AssistantWorkflowToolSelectionEvaluationBatchSignalCount[];\n rows: AssistantWorkflowToolSelectionEvaluation[];\n};\n\nexport function evaluateAssistantWorkflowToolSelectionDecision(\n decision: AssistantWorkflowSerializedToolSelectionDecision,\n): AssistantWorkflowToolSelectionEvaluation {\n const signals = collectAssistantWorkflowToolSelectionEvaluationSignals(decision);\n const workflowSelectionCandidateToolNames = readStringArray(\n decision.comparisonPayload?.[\"workflowSelectionCandidateTools\"],\n );\n const workflowSelectionActiveProfileIds = readStringArray(\n decision.comparisonPayload?.[\"workflowSelectionActiveProfileIds\"],\n );\n const workflowSelectionProfileToolNames = readStringArray(\n decision.comparisonPayload?.[\"workflowSelectionProfileTools\"],\n );\n const intentId = readString(decision.comparisonPayload?.[\"intent\"]);\n const workflowAuthorityIntentIds = readStringArray(\n decision.comparisonPayload?.[\"workflowAuthorityIntentIds\"],\n );\n const workflowAuthoritySegmentKeys = readStringArray(\n decision.comparisonPayload?.[\"workflowAuthoritySegmentKeys\"],\n );\n const workflowAuthoritySegmentKey = readString(decision.comparisonPayload?.[\"workflowAuthoritySegmentKey\"]) ??\n buildAssistantWorkflowToolSelectionSegmentKey({\n intentId,\n hop: readNumber(decision.comparisonPayload?.[\"hop\"]),\n selectedReason: readString(decision.comparisonPayload?.[\"selectedReason\"]),\n });\n\n return {\n intentId,\n hop: readNumber(decision.comparisonPayload?.[\"hop\"]),\n selectedReason: readString(decision.comparisonPayload?.[\"selectedReason\"]),\n authoritySource: decision.authority.source,\n authorityReason: decision.authority.reason,\n workflowStatus: decision.authority.workflowStatus,\n workflowAuthorityEnabled: intentId && workflowAuthorityIntentIds.length > 0\n ? workflowAuthorityIntentIds.includes(intentId)\n : null,\n workflowAuthoritySegmentKey,\n workflowAuthoritySegmentEnabled: workflowAuthoritySegmentKeys.length > 0\n ? workflowAuthoritySegmentKeys.includes(workflowAuthoritySegmentKey)\n : null,\n effectiveReason: decision.effectiveReason,\n selectedToolCount: decision.authority.selectedToolNames.length,\n effectiveToolCount: decision.effectiveToolNames.length,\n workflowSuggestedToolCount: decision.authority.workflowSuggestedToolNames.length,\n workflowSelectionCandidateToolCount: workflowSelectionCandidateToolNames.length,\n workflowSelectionActiveProfileIds,\n workflowSelectionProfileToolNames: workflowSelectionProfileToolNames,\n workflowSelectionProfileToolCount: workflowSelectionProfileToolNames.length,\n signalCount: signals.length,\n warningCount: signals.filter((signal) => signal.severity === \"warning\").length,\n signals,\n };\n}\n\nexport function collectAssistantWorkflowToolSelectionEvaluationSignals(\n decision: AssistantWorkflowSerializedToolSelectionDecision,\n): AssistantWorkflowToolSelectionEvaluationSignal[] {\n const signals: AssistantWorkflowToolSelectionEvaluationSignal[] = [];\n const missingCandidateTools = readStringArray(\n decision.comparisonPayload?.[\"missingWorkflowSelectionCandidateTools\"],\n );\n const selectedOutsideCandidate = readStringArray(\n decision.comparisonPayload?.[\"selectedOutsideWorkflowSelectionCandidate\"],\n );\n const selectedOutsideSuggestions = readStringArray(\n decision.comparisonPayload?.[\"selectedOutsideWorkflowSuggestions\"],\n );\n const excludedOptionalTools = readStringArray(\n decision.comparisonPayload?.[\"workflowSelectionExcludedOptionalTools\"],\n );\n const selectedPolicyExcludedOptionalTools = selectedOutsideCandidate.filter((toolName) =>\n excludedOptionalTools.includes(toolName)\n );\n\n if (decision.authority.source === \"legacy-pruner\") {\n signals.push({\n name: \"legacy_authority\",\n severity: \"info\",\n detail: decision.authority.reason,\n });\n }\n\n if (decision.authority.reason === \"workflow_unavailable\") {\n signals.push({\n name: \"workflow_unavailable\",\n severity: \"warning\",\n detail: \"tool selection ran without a workflow comparison payload\",\n });\n }\n\n if (decision.authority.reason === \"workflow_authority_not_enabled\") {\n signals.push({\n name: \"workflow_authority_not_enabled\",\n severity: \"info\",\n detail: readString(decision.comparisonPayload?.[\"intent\"]),\n });\n }\n\n if (decision.authority.reason === \"workflow_blocked\") {\n signals.push({\n name: \"workflow_blocked\",\n severity: \"warning\",\n detail: decision.authority.workflowStatus,\n });\n }\n\n if (decision.authority.reason === \"workflow_differs\") {\n signals.push({\n name: \"workflow_differs\",\n severity: \"info\",\n detail: summarizeDifference(missingCandidateTools, selectedOutsideCandidate),\n });\n }\n\n if (missingCandidateTools.length > 0) {\n signals.push({\n name: \"workflow_candidate_not_selected\",\n severity: \"warning\",\n detail: missingCandidateTools.join(\", \"),\n });\n }\n\n if (selectedOutsideCandidate.length > 0) {\n signals.push({\n name: \"selected_outside_workflow_candidate\",\n severity: \"info\",\n detail: selectedOutsideCandidate.join(\", \"),\n });\n }\n\n if (selectedOutsideSuggestions.length > 0) {\n signals.push({\n name: \"selected_outside_workflow_suggestions\",\n severity: \"info\",\n detail: selectedOutsideSuggestions.join(\", \"),\n });\n }\n\n if (selectedPolicyExcludedOptionalTools.length > 0) {\n signals.push({\n name: \"selected_policy_excluded_optional_tool\",\n severity: \"info\",\n detail: selectedPolicyExcludedOptionalTools.join(\", \"),\n });\n }\n\n return signals;\n}\n\nexport function buildAssistantWorkflowToolSelectionEvaluationBatch(\n decisions: readonly AssistantWorkflowSerializedToolSelectionDecision[],\n options: AssistantWorkflowToolSelectionEvaluationBatchOptions = {},\n): AssistantWorkflowToolSelectionEvaluationBatch {\n const allRows = decisions.map(evaluateAssistantWorkflowToolSelectionDecision);\n const rows = options.onlyInteresting === true ? allRows.filter(isInterestingRow) : allRows;\n const intentReadiness = buildIntentReadiness(rows);\n const segmentReadiness = buildSegmentReadiness(rows);\n\n return {\n generatedAt: new Date().toISOString(),\n sourceDecisionCount: decisions.length,\n rowCount: rows.length,\n interestingRowCount: rows.filter(isInterestingRow).length,\n warningRowCount: rows.filter((row) => row.warningCount > 0).length,\n intentCounts: buildStringCounts(rows.map((row) => row.intentId ?? \"unknown\")),\n intentReadiness,\n segmentReadiness,\n readinessSummary: buildReadinessSummary(intentReadiness, segmentReadiness),\n authoritySourceCounts: buildStringCounts(rows.map((row) => row.authoritySource)),\n authorityReasonCounts: buildStringCounts(rows.map((row) => row.authorityReason)),\n workflowStatusCounts: buildStringCounts(rows.map((row) => row.workflowStatus ?? \"none\")),\n effectiveReasonCounts: buildStringCounts(rows.map((row) => row.effectiveReason ?? \"none\")),\n workflowSelectionProfileCounts: buildStringCounts(rows.flatMap((row) => row.workflowSelectionActiveProfileIds)),\n workflowSelectionProfileToolCounts: buildStringCounts(rows.flatMap((row) => row.workflowSelectionProfileToolNames)),\n signalCounts: buildSignalCounts(rows.flatMap((row) => row.signals)),\n rows,\n };\n}\n\nexport function buildAssistantWorkflowToolSelectionEvaluationTracePayload(\n evaluation: AssistantWorkflowToolSelectionEvaluation,\n): Record<string, AssistantWorkflowJsonValue> {\n return {\n authoritySource: evaluation.authoritySource,\n authorityReason: evaluation.authorityReason,\n workflowStatus: evaluation.workflowStatus,\n intentId: evaluation.intentId,\n hop: evaluation.hop,\n selectedReason: evaluation.selectedReason,\n workflowAuthorityEnabled: evaluation.workflowAuthorityEnabled,\n workflowAuthoritySegmentKey: evaluation.workflowAuthoritySegmentKey,\n workflowAuthoritySegmentEnabled: evaluation.workflowAuthoritySegmentEnabled,\n effectiveReason: evaluation.effectiveReason,\n selectedToolCount: evaluation.selectedToolCount,\n effectiveToolCount: evaluation.effectiveToolCount,\n workflowSuggestedToolCount: evaluation.workflowSuggestedToolCount,\n workflowSelectionCandidateToolCount: evaluation.workflowSelectionCandidateToolCount,\n workflowSelectionActiveProfileIds: evaluation.workflowSelectionActiveProfileIds,\n workflowSelectionProfileToolNames: evaluation.workflowSelectionProfileToolNames,\n workflowSelectionProfileToolCount: evaluation.workflowSelectionProfileToolCount,\n signalCount: evaluation.signalCount,\n warningCount: evaluation.warningCount,\n signals: evaluation.signals.map((signal) => ({\n name: signal.name,\n severity: signal.severity,\n detail: signal.detail,\n })),\n };\n}\n\nexport function buildAssistantWorkflowToolSelectionEvaluationBatchTracePayload(\n batch: AssistantWorkflowToolSelectionEvaluationBatch,\n): Record<string, AssistantWorkflowJsonValue> {\n return {\n generatedAt: batch.generatedAt,\n sourceDecisionCount: batch.sourceDecisionCount,\n rowCount: batch.rowCount,\n interestingRowCount: batch.interestingRowCount,\n warningRowCount: batch.warningRowCount,\n intentCounts: batch.intentCounts,\n readinessSummary: {\n readyIntentCount: batch.readinessSummary.readyIntentCount,\n confirmedIntentCount: batch.readinessSummary.confirmedIntentCount,\n readySegmentCount: batch.readinessSummary.readySegmentCount,\n confirmedSegmentCount: batch.readinessSummary.confirmedSegmentCount,\n warningIntentCount: batch.readinessSummary.warningIntentCount,\n warningSegmentCount: batch.readinessSummary.warningSegmentCount,\n },\n intentReadiness: batch.intentReadiness.map((intent) => ({\n intentId: intent.intentId,\n decisionCount: intent.decisionCount,\n workflowAuthorityCount: intent.workflowAuthorityCount,\n shadowEquivalentCount: intent.shadowEquivalentCount,\n workflowDiffersCount: intent.workflowDiffersCount,\n workflowBlockedCount: intent.workflowBlockedCount,\n workflowUnavailableCount: intent.workflowUnavailableCount,\n warningCount: intent.warningCount,\n workflowAuthorityConfirmed: intent.workflowAuthorityConfirmed,\n readyForWorkflowAuthority: intent.readyForWorkflowAuthority,\n })),\n segmentReadiness: batch.segmentReadiness.map((segment) => ({\n segmentKey: segment.segmentKey,\n intentId: segment.intentId,\n hop: segment.hop,\n selectedReason: segment.selectedReason,\n decisionCount: segment.decisionCount,\n workflowAuthorityCount: segment.workflowAuthorityCount,\n shadowEquivalentCount: segment.shadowEquivalentCount,\n workflowDiffersCount: segment.workflowDiffersCount,\n workflowBlockedCount: segment.workflowBlockedCount,\n workflowUnavailableCount: segment.workflowUnavailableCount,\n warningCount: segment.warningCount,\n workflowAuthorityConfirmed: segment.workflowAuthorityConfirmed,\n readyForWorkflowAuthority: segment.readyForWorkflowAuthority,\n })),\n authoritySourceCounts: batch.authoritySourceCounts,\n authorityReasonCounts: batch.authorityReasonCounts,\n workflowStatusCounts: batch.workflowStatusCounts,\n effectiveReasonCounts: batch.effectiveReasonCounts,\n workflowSelectionProfileCounts: batch.workflowSelectionProfileCounts,\n workflowSelectionProfileToolCounts: batch.workflowSelectionProfileToolCounts,\n signalCounts: batch.signalCounts,\n };\n}\n\nexport function buildAssistantWorkflowToolSelectionMigrationReport(\n batch: AssistantWorkflowToolSelectionEvaluationBatch,\n options: AssistantWorkflowToolSelectionMigrationReportOptions = {},\n): AssistantWorkflowToolSelectionMigrationReport {\n const minDecisionCount = normalizeMinDecisionCount(options.minDecisionCount);\n const intentCandidates = batch.intentReadiness.map((readiness) =>\n buildMigrationCandidate(\"intent\", readiness, minDecisionCount)\n );\n const segmentCandidates = batch.segmentReadiness.map((readiness) =>\n buildMigrationCandidate(\"segment\", readiness, minDecisionCount)\n );\n const readyIntentCandidates = intentCandidates.filter((candidate) =>\n candidate.status === \"ready_for_workflow_authority\"\n );\n const readySegmentCandidates = segmentCandidates.filter((candidate) =>\n candidate.status === \"ready_for_workflow_authority\"\n );\n const confirmedIntentCandidates = intentCandidates.filter((candidate) =>\n candidate.status === \"workflow_authority_confirmed\"\n );\n const confirmedSegmentCandidates = segmentCandidates.filter((candidate) =>\n candidate.status === \"workflow_authority_confirmed\"\n );\n const reviewCandidates = [...intentCandidates, ...segmentCandidates].filter((candidate) =>\n candidate.status === \"needs_review\"\n );\n\n return {\n generatedAt: batch.generatedAt,\n minDecisionCount,\n sourceDecisionCount: batch.sourceDecisionCount,\n rowCount: batch.rowCount,\n suggestedAuthorityIntentIds: uniqueStrings(readyIntentCandidates.map((candidate) => candidate.intentId)),\n suggestedAuthoritySegmentKeys: uniqueStrings(readySegmentCandidates.map((candidate) => candidate.segmentKey ?? \"\")),\n candidateCount: intentCandidates.length + segmentCandidates.length,\n readyIntentCandidates,\n readySegmentCandidates,\n confirmedIntentCandidates,\n confirmedSegmentCandidates,\n reviewCandidates,\n };\n}\n\nexport function buildAssistantWorkflowToolSelectionMigrationReportTracePayload(\n report: AssistantWorkflowToolSelectionMigrationReport,\n): Record<string, AssistantWorkflowJsonValue> {\n return {\n generatedAt: report.generatedAt,\n minDecisionCount: report.minDecisionCount,\n sourceDecisionCount: report.sourceDecisionCount,\n rowCount: report.rowCount,\n suggestedAuthorityIntentIds: report.suggestedAuthorityIntentIds,\n suggestedAuthoritySegmentKeys: report.suggestedAuthoritySegmentKeys,\n candidateCount: report.candidateCount,\n readyIntentCandidates: report.readyIntentCandidates.map(toMigrationCandidateTracePayload),\n readySegmentCandidates: report.readySegmentCandidates.map(toMigrationCandidateTracePayload),\n confirmedIntentCandidates: report.confirmedIntentCandidates.map(toMigrationCandidateTracePayload),\n confirmedSegmentCandidates: report.confirmedSegmentCandidates.map(toMigrationCandidateTracePayload),\n reviewCandidates: report.reviewCandidates.map(toMigrationCandidateTracePayload),\n };\n}\n\nexport function buildAssistantWorkflowToolSelectionAuthorityAllowListProposal(\n report: AssistantWorkflowToolSelectionMigrationReport,\n options: AssistantWorkflowToolSelectionAuthorityAllowListProposalOptions = {},\n): AssistantWorkflowToolSelectionAuthorityAllowListProposal {\n const currentAuthorityIntentIds = uniqueStrings(options.currentAuthorityIntentIds ?? []);\n const currentAuthoritySegmentKeys = uniqueStrings(options.currentAuthoritySegmentKeys ?? []);\n const suggestedAuthorityIntentIds = uniqueStrings(report.suggestedAuthorityIntentIds);\n const suggestedAuthoritySegmentKeys = uniqueStrings(report.suggestedAuthoritySegmentKeys);\n const addIntentIds = suggestedAuthorityIntentIds.filter((intentId) =>\n !currentAuthorityIntentIds.includes(intentId)\n );\n const addSegmentKeys = suggestedAuthoritySegmentKeys.filter((segmentKey) =>\n !currentAuthoritySegmentKeys.includes(segmentKey)\n );\n const keepIntentIds = currentAuthorityIntentIds;\n const keepSegmentKeys = currentAuthoritySegmentKeys;\n const proposedAuthorityIntentIds = uniqueStrings([...keepIntentIds, ...addIntentIds]);\n const proposedAuthoritySegmentKeys = uniqueStrings([...keepSegmentKeys, ...addSegmentKeys]);\n const reviewIntentIds = uniqueStrings(\n report.reviewCandidates\n .filter((candidate) => candidate.kind === \"intent\")\n .map((candidate) => candidate.intentId),\n );\n const reviewSegmentKeys = uniqueStrings(\n report.reviewCandidates\n .filter((candidate) => candidate.kind === \"segment\")\n .map((candidate) => candidate.segmentKey ?? \"\"),\n );\n const currentIntentIdsWithReviewEvidence = currentAuthorityIntentIds.filter((intentId) =>\n reviewIntentIds.includes(intentId)\n );\n const currentSegmentKeysWithReviewEvidence = currentAuthoritySegmentKeys.filter((segmentKey) =>\n reviewSegmentKeys.includes(segmentKey)\n );\n\n return {\n generatedAt: report.generatedAt,\n minDecisionCount: report.minDecisionCount,\n sourceDecisionCount: report.sourceDecisionCount,\n rowCount: report.rowCount,\n currentAuthorityIntentIds,\n currentAuthoritySegmentKeys,\n suggestedAuthorityIntentIds,\n suggestedAuthoritySegmentKeys,\n addIntentIds,\n addSegmentKeys,\n keepIntentIds,\n keepSegmentKeys,\n proposedAuthorityIntentIds,\n proposedAuthoritySegmentKeys,\n readyIntentCandidateCount: report.readyIntentCandidates.length,\n readySegmentCandidateCount: report.readySegmentCandidates.length,\n confirmedIntentCandidateCount: report.confirmedIntentCandidates.length,\n confirmedSegmentCandidateCount: report.confirmedSegmentCandidates.length,\n reviewIntentCandidateCount: report.reviewCandidates.filter((candidate) =>\n candidate.kind === \"intent\"\n ).length,\n reviewSegmentCandidateCount: report.reviewCandidates.filter((candidate) =>\n candidate.kind === \"segment\"\n ).length,\n reviewIntentIds,\n reviewSegmentKeys,\n currentIntentIdsWithReviewEvidence,\n currentSegmentKeysWithReviewEvidence,\n canApplyAdditions: addIntentIds.length > 0 || addSegmentKeys.length > 0,\n rationale: buildAuthorityAllowListProposalRationale({\n addIntentIds,\n addSegmentKeys,\n currentAuthorityIntentIds,\n currentAuthoritySegmentKeys,\n currentIntentIdsWithReviewEvidence,\n currentSegmentKeysWithReviewEvidence,\n report,\n reviewIntentIds,\n reviewSegmentKeys,\n }),\n };\n}\n\nexport function buildAssistantWorkflowToolSelectionAuthorityAllowListProposalTracePayload(\n proposal: AssistantWorkflowToolSelectionAuthorityAllowListProposal,\n): Record<string, AssistantWorkflowJsonValue> {\n return {\n generatedAt: proposal.generatedAt,\n minDecisionCount: proposal.minDecisionCount,\n sourceDecisionCount: proposal.sourceDecisionCount,\n rowCount: proposal.rowCount,\n currentAuthorityIntentIds: proposal.currentAuthorityIntentIds,\n currentAuthoritySegmentKeys: proposal.currentAuthoritySegmentKeys,\n suggestedAuthorityIntentIds: proposal.suggestedAuthorityIntentIds,\n suggestedAuthoritySegmentKeys: proposal.suggestedAuthoritySegmentKeys,\n addIntentIds: proposal.addIntentIds,\n addSegmentKeys: proposal.addSegmentKeys,\n keepIntentIds: proposal.keepIntentIds,\n keepSegmentKeys: proposal.keepSegmentKeys,\n proposedAuthorityIntentIds: proposal.proposedAuthorityIntentIds,\n proposedAuthoritySegmentKeys: proposal.proposedAuthoritySegmentKeys,\n readyIntentCandidateCount: proposal.readyIntentCandidateCount,\n readySegmentCandidateCount: proposal.readySegmentCandidateCount,\n confirmedIntentCandidateCount: proposal.confirmedIntentCandidateCount,\n confirmedSegmentCandidateCount: proposal.confirmedSegmentCandidateCount,\n reviewIntentCandidateCount: proposal.reviewIntentCandidateCount,\n reviewSegmentCandidateCount: proposal.reviewSegmentCandidateCount,\n reviewIntentIds: proposal.reviewIntentIds,\n reviewSegmentKeys: proposal.reviewSegmentKeys,\n currentIntentIdsWithReviewEvidence: proposal.currentIntentIdsWithReviewEvidence,\n currentSegmentKeysWithReviewEvidence: proposal.currentSegmentKeysWithReviewEvidence,\n canApplyAdditions: proposal.canApplyAdditions,\n rationale: proposal.rationale,\n };\n}\n\nexport function buildAssistantWorkflowToolSelectionMigrationReviewArtifact(\n input: {\n report: AssistantWorkflowToolSelectionMigrationReport;\n proposal: AssistantWorkflowToolSelectionAuthorityAllowListProposal;\n },\n options: AssistantWorkflowToolSelectionMigrationReviewArtifactOptions = {},\n): AssistantWorkflowToolSelectionMigrationReviewArtifact {\n const patchTargets = uniqueStrings(options.patchTargets ?? []);\n const requiredTestIds = uniqueStrings(options.requiredTestIds ?? []);\n const status: AssistantWorkflowToolSelectionMigrationReviewArtifactStatus = input.proposal.canApplyAdditions\n ? \"ready_for_runtime_change\"\n : \"no_runtime_change\";\n\n return {\n generatedAt: input.proposal.generatedAt,\n title: readString(options.title) ?? \"Assistant workflow tool-selection migration review\",\n status,\n recommendedAction: status === \"ready_for_runtime_change\"\n ? \"apply_authority_allow_list_update\"\n : \"keep_current_authority\",\n minDecisionCount: input.proposal.minDecisionCount,\n sourceDecisionCount: input.proposal.sourceDecisionCount,\n rowCount: input.proposal.rowCount,\n patchTargets,\n requiredTestIds,\n runtimeChange: {\n addIntentIds: input.proposal.addIntentIds,\n addSegmentKeys: input.proposal.addSegmentKeys,\n keepIntentIds: input.proposal.keepIntentIds,\n keepSegmentKeys: input.proposal.keepSegmentKeys,\n proposedAuthorityIntentIds: input.proposal.proposedAuthorityIntentIds,\n proposedAuthoritySegmentKeys: input.proposal.proposedAuthoritySegmentKeys,\n },\n evidence: {\n readyIntentCandidateKeys: input.report.readyIntentCandidates.map((candidate) => candidate.key),\n readySegmentCandidateKeys: input.report.readySegmentCandidates.map((candidate) => candidate.key),\n confirmedIntentCandidateKeys: input.report.confirmedIntentCandidates.map((candidate) => candidate.key),\n confirmedSegmentCandidateKeys: input.report.confirmedSegmentCandidates.map((candidate) => candidate.key),\n },\n review: {\n reviewIntentIds: input.proposal.reviewIntentIds,\n reviewSegmentKeys: input.proposal.reviewSegmentKeys,\n currentIntentIdsWithReviewEvidence: input.proposal.currentIntentIdsWithReviewEvidence,\n currentSegmentKeysWithReviewEvidence: input.proposal.currentSegmentKeysWithReviewEvidence,\n blockerCount: input.report.reviewCandidates.length,\n blockers: input.report.reviewCandidates,\n },\n rationale: buildMigrationReviewArtifactRationale(input.proposal, status),\n };\n}\n\nexport function buildAssistantWorkflowToolSelectionMigrationReviewArtifactTracePayload(\n artifact: AssistantWorkflowToolSelectionMigrationReviewArtifact,\n): Record<string, AssistantWorkflowJsonValue> {\n return {\n generatedAt: artifact.generatedAt,\n title: artifact.title,\n status: artifact.status,\n recommendedAction: artifact.recommendedAction,\n minDecisionCount: artifact.minDecisionCount,\n sourceDecisionCount: artifact.sourceDecisionCount,\n rowCount: artifact.rowCount,\n patchTargets: artifact.patchTargets,\n requiredTestIds: artifact.requiredTestIds,\n runtimeChange: {\n addIntentIds: artifact.runtimeChange.addIntentIds,\n addSegmentKeys: artifact.runtimeChange.addSegmentKeys,\n keepIntentIds: artifact.runtimeChange.keepIntentIds,\n keepSegmentKeys: artifact.runtimeChange.keepSegmentKeys,\n proposedAuthorityIntentIds: artifact.runtimeChange.proposedAuthorityIntentIds,\n proposedAuthoritySegmentKeys: artifact.runtimeChange.proposedAuthoritySegmentKeys,\n },\n evidence: {\n readyIntentCandidateKeys: artifact.evidence.readyIntentCandidateKeys,\n readySegmentCandidateKeys: artifact.evidence.readySegmentCandidateKeys,\n confirmedIntentCandidateKeys: artifact.evidence.confirmedIntentCandidateKeys,\n confirmedSegmentCandidateKeys: artifact.evidence.confirmedSegmentCandidateKeys,\n },\n review: {\n reviewIntentIds: artifact.review.reviewIntentIds,\n reviewSegmentKeys: artifact.review.reviewSegmentKeys,\n currentIntentIdsWithReviewEvidence: artifact.review.currentIntentIdsWithReviewEvidence,\n currentSegmentKeysWithReviewEvidence: artifact.review.currentSegmentKeysWithReviewEvidence,\n blockerCount: artifact.review.blockerCount,\n blockers: artifact.review.blockers.map(toMigrationCandidateTracePayload),\n },\n rationale: artifact.rationale,\n };\n}\n\nfunction buildReadinessSummary(\n intentReadiness: readonly AssistantWorkflowToolSelectionEvaluationIntentReadiness[],\n segmentReadiness: readonly AssistantWorkflowToolSelectionEvaluationSegmentReadiness[],\n): AssistantWorkflowToolSelectionEvaluationReadinessSummary {\n return {\n readyIntentCount: intentReadiness.filter((intent) => intent.readyForWorkflowAuthority).length,\n confirmedIntentCount: intentReadiness.filter((intent) => intent.workflowAuthorityConfirmed).length,\n readySegmentCount: segmentReadiness.filter((segment) => segment.readyForWorkflowAuthority).length,\n confirmedSegmentCount: segmentReadiness.filter((segment) => segment.workflowAuthorityConfirmed).length,\n warningIntentCount: intentReadiness.filter((intent) => intent.warningCount > 0).length,\n warningSegmentCount: segmentReadiness.filter((segment) => segment.warningCount > 0).length,\n };\n}\n\nfunction buildMigrationCandidate(\n kind: AssistantWorkflowToolSelectionMigrationCandidateKind,\n readiness: AssistantWorkflowToolSelectionEvaluationIntentReadiness | AssistantWorkflowToolSelectionEvaluationSegmentReadiness,\n minDecisionCount: number,\n): AssistantWorkflowToolSelectionMigrationCandidate {\n const isSegment = isSegmentReadiness(readiness);\n const key = isSegment ? readiness.segmentKey : readiness.intentId;\n const blockingReasons = collectMigrationBlockingReasons(readiness, minDecisionCount);\n const status: AssistantWorkflowToolSelectionMigrationCandidateStatus = blockingReasons.length > 0\n ? \"needs_review\"\n : readiness.workflowAuthorityConfirmed\n ? \"workflow_authority_confirmed\"\n : readiness.readyForWorkflowAuthority\n ? \"ready_for_workflow_authority\"\n : \"needs_review\";\n const recommendedAction = buildMigrationRecommendedAction(kind, status);\n\n return {\n kind,\n key,\n intentId: readiness.intentId,\n segmentKey: isSegment ? readiness.segmentKey : null,\n hop: isSegment ? readiness.hop : null,\n selectedReason: isSegment ? readiness.selectedReason : null,\n decisionCount: readiness.decisionCount,\n workflowAuthorityCount: readiness.workflowAuthorityCount,\n shadowEquivalentCount: readiness.shadowEquivalentCount,\n workflowDiffersCount: readiness.workflowDiffersCount,\n workflowBlockedCount: readiness.workflowBlockedCount,\n workflowUnavailableCount: readiness.workflowUnavailableCount,\n warningCount: readiness.warningCount,\n status,\n recommendedAction,\n blockingReasons,\n rationale: buildMigrationRationale(kind, status, readiness, blockingReasons, minDecisionCount),\n };\n}\n\nfunction collectMigrationBlockingReasons(\n readiness: AssistantWorkflowToolSelectionEvaluationIntentReadiness,\n minDecisionCount: number,\n): string[] {\n const reasons: string[] = [];\n if (readiness.intentId === \"unknown\") reasons.push(\"unknown_intent\");\n if (readiness.decisionCount < minDecisionCount) reasons.push(\"insufficient_decisions\");\n if (readiness.warningCount > 0) reasons.push(\"warnings_present\");\n if (readiness.workflowDiffersCount > 0) reasons.push(\"workflow_differs\");\n if (readiness.workflowBlockedCount > 0) reasons.push(\"workflow_blocked\");\n if (readiness.workflowUnavailableCount > 0) reasons.push(\"workflow_unavailable\");\n if (\n readiness.workflowAuthorityCount > 0 &&\n readiness.shadowEquivalentCount > 0 &&\n readiness.workflowDiffersCount === 0 &&\n readiness.workflowBlockedCount === 0 &&\n readiness.workflowUnavailableCount === 0\n ) {\n reasons.push(\"mixed_authority_evidence\");\n }\n if (\n readiness.workflowAuthorityCount === 0 &&\n readiness.shadowEquivalentCount === 0 &&\n readiness.workflowDiffersCount === 0 &&\n readiness.workflowBlockedCount === 0 &&\n readiness.workflowUnavailableCount === 0\n ) {\n reasons.push(\"no_workflow_equivalence_evidence\");\n }\n return reasons;\n}\n\nfunction buildMigrationRecommendedAction(\n kind: AssistantWorkflowToolSelectionMigrationCandidateKind,\n status: AssistantWorkflowToolSelectionMigrationCandidateStatus,\n): AssistantWorkflowToolSelectionMigrationRecommendedAction {\n if (status === \"workflow_authority_confirmed\") return \"keep_runtime_authority\";\n if (status === \"ready_for_workflow_authority\") {\n return kind === \"intent\"\n ? \"add_intent_to_authority_allow_list\"\n : \"review_segment_before_authority_change\";\n }\n return \"review_blockers_before_migration\";\n}\n\nfunction buildMigrationRationale(\n kind: AssistantWorkflowToolSelectionMigrationCandidateKind,\n status: AssistantWorkflowToolSelectionMigrationCandidateStatus,\n readiness: AssistantWorkflowToolSelectionEvaluationIntentReadiness,\n blockingReasons: readonly string[],\n minDecisionCount: number,\n): string {\n const scope = kind === \"intent\" ? `intent ${readiness.intentId}` : `segment ${getReadinessKey(readiness)}`;\n if (status === \"workflow_authority_confirmed\") {\n return `${scope} is already workflow-owned across ${readiness.decisionCount} decision(s) without warnings.`;\n }\n if (status === \"ready_for_workflow_authority\") {\n return `${scope} has ${readiness.shadowEquivalentCount} shadow-equivalent decision(s), no warnings, and meets minDecisionCount=${minDecisionCount}.`;\n }\n return `${scope} is not ready for runtime migration: ${blockingReasons.join(\", \") || \"unknown_reason\"}.`;\n}\n\nfunction getReadinessKey(\n readiness: AssistantWorkflowToolSelectionEvaluationIntentReadiness,\n): string {\n return isSegmentReadiness(readiness) ? readiness.segmentKey : readiness.intentId;\n}\n\nfunction isSegmentReadiness(\n readiness: AssistantWorkflowToolSelectionEvaluationIntentReadiness | AssistantWorkflowToolSelectionEvaluationSegmentReadiness,\n): readiness is AssistantWorkflowToolSelectionEvaluationSegmentReadiness {\n return \"segmentKey\" in readiness;\n}\n\nfunction toMigrationCandidateTracePayload(\n candidate: AssistantWorkflowToolSelectionMigrationCandidate,\n): Record<string, AssistantWorkflowJsonValue> {\n return {\n kind: candidate.kind,\n key: candidate.key,\n intentId: candidate.intentId,\n segmentKey: candidate.segmentKey,\n hop: candidate.hop,\n selectedReason: candidate.selectedReason,\n decisionCount: candidate.decisionCount,\n workflowAuthorityCount: candidate.workflowAuthorityCount,\n shadowEquivalentCount: candidate.shadowEquivalentCount,\n workflowDiffersCount: candidate.workflowDiffersCount,\n workflowBlockedCount: candidate.workflowBlockedCount,\n workflowUnavailableCount: candidate.workflowUnavailableCount,\n warningCount: candidate.warningCount,\n status: candidate.status,\n recommendedAction: candidate.recommendedAction,\n blockingReasons: candidate.blockingReasons,\n rationale: candidate.rationale,\n };\n}\n\nfunction buildAuthorityAllowListProposalRationale(input: {\n addIntentIds: readonly string[];\n addSegmentKeys: readonly string[];\n currentAuthorityIntentIds: readonly string[];\n currentAuthoritySegmentKeys: readonly string[];\n currentIntentIdsWithReviewEvidence: readonly string[];\n currentSegmentKeysWithReviewEvidence: readonly string[];\n report: AssistantWorkflowToolSelectionMigrationReport;\n reviewIntentIds: readonly string[];\n reviewSegmentKeys: readonly string[];\n}): string[] {\n const rationale: string[] = [];\n if (input.addIntentIds.length > 0) {\n rationale.push(\n `Add ${input.addIntentIds.join(\", \")} to workflow authority after ${input.report.minDecisionCount} matching decision(s) with no blockers.`,\n );\n } else {\n rationale.push(\"No new intent-level workflow authority additions are ready.\");\n }\n if (input.addSegmentKeys.length > 0) {\n rationale.push(\n `Add segment authority for ${input.addSegmentKeys.join(\", \")} after ${input.report.minDecisionCount} matching decision(s) with no blockers.`,\n );\n } else {\n rationale.push(\"No new segment-level workflow authority additions are ready.\");\n }\n if (input.currentAuthorityIntentIds.length > 0) {\n rationale.push(`Keep existing workflow authority intents: ${input.currentAuthorityIntentIds.join(\", \")}.`);\n }\n if (input.currentAuthoritySegmentKeys.length > 0) {\n rationale.push(`Keep existing workflow authority segments: ${input.currentAuthoritySegmentKeys.join(\", \")}.`);\n }\n if (input.currentIntentIdsWithReviewEvidence.length > 0) {\n rationale.push(\n `Review existing authority evidence for: ${input.currentIntentIdsWithReviewEvidence.join(\", \")}.`,\n );\n }\n if (input.currentSegmentKeysWithReviewEvidence.length > 0) {\n rationale.push(\n `Review existing segment authority evidence for: ${input.currentSegmentKeysWithReviewEvidence.join(\", \")}.`,\n );\n }\n if (input.reviewIntentIds.length > 0) {\n rationale.push(`Review blocked intent candidates before migration: ${input.reviewIntentIds.join(\", \")}.`);\n }\n if (input.reviewSegmentKeys.length > 0) {\n rationale.push(`Review blocked segment candidates before migration: ${input.reviewSegmentKeys.join(\", \")}.`);\n }\n return rationale;\n}\n\nfunction buildMigrationReviewArtifactRationale(\n proposal: AssistantWorkflowToolSelectionAuthorityAllowListProposal,\n status: AssistantWorkflowToolSelectionMigrationReviewArtifactStatus,\n): string[] {\n if (status === \"ready_for_runtime_change\") {\n return [\n \"Migration proposal has ready allow-list additions.\",\n ...proposal.rationale,\n ];\n }\n return [\n \"Migration proposal does not require a runtime allow-list change.\",\n ...proposal.rationale,\n ];\n}\n\nfunction normalizeMinDecisionCount(value: number | null | undefined): number {\n return typeof value === \"number\" && Number.isFinite(value) && value > 0 ? Math.floor(value) : 1;\n}\n\nfunction isInterestingRow(row: AssistantWorkflowToolSelectionEvaluation): boolean {\n return row.authoritySource !== \"workflow\";\n}\n\nfunction summarizeDifference(\n missingCandidateTools: readonly string[],\n selectedOutsideCandidate: readonly string[],\n): string | null {\n const parts = [\n missingCandidateTools.length > 0 ? `missing=${missingCandidateTools.join(\",\")}` : \"\",\n selectedOutsideCandidate.length > 0 ? `outside=${selectedOutsideCandidate.join(\",\")}` : \"\",\n ].filter((part) => part.length > 0);\n return parts.length ? parts.join(\"; \") : null;\n}\n\nfunction buildIntentReadiness(\n rows: readonly AssistantWorkflowToolSelectionEvaluation[],\n): AssistantWorkflowToolSelectionEvaluationIntentReadiness[] {\n const byIntent = new Map<string, AssistantWorkflowToolSelectionEvaluation[]>();\n for (const row of rows) {\n const intentId = row.intentId ?? \"unknown\";\n const current = byIntent.get(intentId) ?? [];\n current.push(row);\n byIntent.set(intentId, current);\n }\n\n return [...byIntent.entries()]\n .map(([intentId, intentRows]) => {\n const workflowAuthorityCount = intentRows.filter((row) => row.authoritySource === \"workflow\").length;\n const shadowEquivalentCount = intentRows.filter((row) =>\n row.authorityReason === \"workflow_authority_not_enabled\"\n ).length;\n const workflowDiffersCount = intentRows.filter((row) =>\n row.authorityReason === \"workflow_differs\"\n ).length;\n const workflowBlockedCount = intentRows.filter((row) =>\n row.authorityReason === \"workflow_blocked\"\n ).length;\n const workflowUnavailableCount = intentRows.filter((row) =>\n row.authorityReason === \"workflow_unavailable\"\n ).length;\n const warningCount = intentRows.reduce((total, row) => total + row.warningCount, 0);\n\n return {\n intentId,\n decisionCount: intentRows.length,\n workflowAuthorityCount,\n shadowEquivalentCount,\n workflowDiffersCount,\n workflowBlockedCount,\n workflowUnavailableCount,\n warningCount,\n workflowAuthorityConfirmed: (\n intentId !== \"unknown\" &&\n workflowAuthorityCount > 0 &&\n shadowEquivalentCount === 0 &&\n workflowDiffersCount === 0 &&\n workflowBlockedCount === 0 &&\n workflowUnavailableCount === 0 &&\n warningCount === 0\n ),\n readyForWorkflowAuthority: (\n intentId !== \"unknown\" &&\n workflowAuthorityCount === 0 &&\n shadowEquivalentCount > 0 &&\n workflowDiffersCount === 0 &&\n workflowBlockedCount === 0 &&\n workflowUnavailableCount === 0 &&\n warningCount === 0\n ),\n };\n })\n .sort((left, right) => {\n if (left.readyForWorkflowAuthority !== right.readyForWorkflowAuthority) {\n return left.readyForWorkflowAuthority ? -1 : 1;\n }\n if (left.workflowAuthorityConfirmed !== right.workflowAuthorityConfirmed) {\n return left.workflowAuthorityConfirmed ? -1 : 1;\n }\n if (right.shadowEquivalentCount !== left.shadowEquivalentCount) {\n return right.shadowEquivalentCount - left.shadowEquivalentCount;\n }\n if (right.decisionCount !== left.decisionCount) return right.decisionCount - left.decisionCount;\n return left.intentId.localeCompare(right.intentId);\n });\n}\n\nfunction buildSegmentReadiness(\n rows: readonly AssistantWorkflowToolSelectionEvaluation[],\n): AssistantWorkflowToolSelectionEvaluationSegmentReadiness[] {\n const bySegment = new Map<string, AssistantWorkflowToolSelectionEvaluation[]>();\n for (const row of rows) {\n const segmentKey = buildSegmentKey(row);\n const current = bySegment.get(segmentKey) ?? [];\n current.push(row);\n bySegment.set(segmentKey, current);\n }\n\n return [...bySegment.entries()]\n .map(([segmentKey, segmentRows]) => {\n const [base] = segmentRows;\n const intentReadiness = buildIntentReadiness(segmentRows)[0] ?? {\n intentId: base?.intentId ?? \"unknown\",\n decisionCount: 0,\n workflowAuthorityCount: 0,\n shadowEquivalentCount: 0,\n workflowDiffersCount: 0,\n workflowBlockedCount: 0,\n workflowUnavailableCount: 0,\n warningCount: 0,\n workflowAuthorityConfirmed: false,\n readyForWorkflowAuthority: false,\n };\n\n return {\n ...intentReadiness,\n segmentKey,\n hop: base?.hop ?? null,\n selectedReason: base?.selectedReason ?? null,\n };\n })\n .sort((left, right) => {\n if (left.readyForWorkflowAuthority !== right.readyForWorkflowAuthority) {\n return left.readyForWorkflowAuthority ? -1 : 1;\n }\n if (left.workflowAuthorityConfirmed !== right.workflowAuthorityConfirmed) {\n return left.workflowAuthorityConfirmed ? -1 : 1;\n }\n if (right.shadowEquivalentCount !== left.shadowEquivalentCount) {\n return right.shadowEquivalentCount - left.shadowEquivalentCount;\n }\n if (right.decisionCount !== left.decisionCount) return right.decisionCount - left.decisionCount;\n return left.segmentKey.localeCompare(right.segmentKey);\n });\n}\n\nfunction buildSegmentKey(row: AssistantWorkflowToolSelectionEvaluation): string {\n return buildAssistantWorkflowToolSelectionSegmentKey({\n intentId: row.intentId,\n hop: row.hop,\n selectedReason: row.selectedReason,\n });\n}\n\nfunction buildStringCounts(values: readonly string[]): AssistantWorkflowToolSelectionEvaluationBatchCount[] {\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 uniqueStrings(values: readonly string[]): string[] {\n const out: string[] = [];\n const seen = new Set<string>();\n for (const value of values) {\n const trimmed = value.trim();\n if (!trimmed.length || seen.has(trimmed)) continue;\n seen.add(trimmed);\n out.push(trimmed);\n }\n return out;\n}\n\nfunction buildSignalCounts(\n signals: readonly AssistantWorkflowToolSelectionEvaluationSignal[],\n): AssistantWorkflowToolSelectionEvaluationBatchSignalCount[] {\n const counts = new Map<string, AssistantWorkflowToolSelectionEvaluationBatchSignalCount>();\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 readStringArray(value: AssistantWorkflowJsonValue | undefined): string[] {\n return readAssistantWorkflowStringArray(value, {\n trim: false,\n allowEmpty: true,\n unique: false,\n requireAllStrings: true,\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tool-selection-evaluation.js","sourceRoot":"","sources":["../src/tool-selection-evaluation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,6CAA6C,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,EACL,2BAA2B,IAAI,UAAU,EACzC,2BAA2B,IAAI,UAAU,EACzC,gCAAgC,GACjC,MAAM,oBAAoB,CAAC;AAmQ5B,MAAM,UAAU,8CAA8C,CAC5D,QAA0D;IAE1D,MAAM,OAAO,GAAG,sDAAsD,CAAC,QAAQ,CAAC,CAAC;IACjF,MAAM,mCAAmC,GAAG,eAAe,CACzD,QAAQ,CAAC,iBAAiB,EAAE,CAAC,iCAAiC,CAAC,CAChE,CAAC;IACF,MAAM,iCAAiC,GAAG,eAAe,CACvD,QAAQ,CAAC,iBAAiB,EAAE,CAAC,mCAAmC,CAAC,CAClE,CAAC;IACF,MAAM,iCAAiC,GAAG,eAAe,CACvD,QAAQ,CAAC,iBAAiB,EAAE,CAAC,+BAA+B,CAAC,CAC9D,CAAC;IACF,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC,iBAAiB,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IACpE,MAAM,0BAA0B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json.js\";\nimport type { AssistantWorkflowSerializedToolSelectionDecision } from \"./tool-selection-json.js\";\nimport { buildAssistantWorkflowToolSelectionSegmentKey } from \"./tool-selection-policy.js\";\nimport {\n readAssistantWorkflowNumber as readNumber,\n readAssistantWorkflowString as readString,\n readAssistantWorkflowStringArray,\n} from \"./value-readers.js\";\n\nexport type AssistantWorkflowToolSelectionEvaluationSeverity = \"info\" | \"warning\";\n\nexport type AssistantWorkflowToolSelectionEvaluationSignalName =\n | \"legacy_authority\"\n | \"workflow_unavailable\"\n | \"workflow_authority_not_enabled\"\n | \"workflow_blocked\"\n | \"workflow_expected_clarification\"\n | \"workflow_selection_not_exercised\"\n | \"workflow_differs\"\n | \"workflow_candidate_not_selected\"\n | \"selected_outside_workflow_candidate\"\n | \"selected_outside_workflow_suggestions\"\n | \"selected_policy_excluded_optional_tool\";\n\nexport type AssistantWorkflowToolSelectionEvaluationSignal = {\n name: AssistantWorkflowToolSelectionEvaluationSignalName;\n severity: AssistantWorkflowToolSelectionEvaluationSeverity;\n detail: string | null;\n};\n\nexport type AssistantWorkflowToolSelectionEvaluation = {\n intentId: string | null;\n hop: number | null;\n selectedReason: string | null;\n authoritySource: string;\n authorityReason: string;\n workflowStatus: string | null;\n workflowAuthorityEnabled: boolean | null;\n workflowAuthoritySegmentKey: string;\n workflowAuthoritySegmentEnabled: boolean | null;\n effectiveReason: string | null;\n selectedToolCount: number;\n effectiveToolCount: number;\n workflowSuggestedToolCount: number;\n workflowSelectionCandidateToolCount: number;\n workflowSelectionActiveProfileIds: string[];\n workflowSelectionProfileToolNames: string[];\n workflowSelectionProfileToolCount: number;\n expectedClarificationBlock: boolean;\n selectionNotExercised: boolean;\n signalCount: number;\n warningCount: number;\n signals: AssistantWorkflowToolSelectionEvaluationSignal[];\n};\n\nexport type AssistantWorkflowToolSelectionEvaluationBatchOptions = {\n onlyInteresting?: boolean;\n};\n\nexport type AssistantWorkflowToolSelectionEvaluationBatchCount = {\n key: string;\n count: number;\n};\n\nexport type AssistantWorkflowToolSelectionEvaluationBatchSignalCount = {\n name: AssistantWorkflowToolSelectionEvaluationSignalName;\n severity: AssistantWorkflowToolSelectionEvaluationSeverity;\n count: number;\n};\n\nexport type AssistantWorkflowToolSelectionEvaluationIntentReadiness = {\n intentId: string;\n decisionCount: number;\n workflowAuthorityCount: number;\n shadowEquivalentCount: number;\n workflowDiffersCount: number;\n workflowBlockedCount: number;\n expectedClarificationBlockCount: number;\n selectionNotExercisedCount: number;\n workflowUnavailableCount: number;\n warningCount: number;\n workflowAuthorityConfirmed: boolean;\n readyForWorkflowAuthority: boolean;\n};\n\nexport type AssistantWorkflowToolSelectionEvaluationSegmentReadiness =\n AssistantWorkflowToolSelectionEvaluationIntentReadiness & {\n segmentKey: string;\n hop: number | null;\n selectedReason: string | null;\n };\n\nexport type AssistantWorkflowToolSelectionEvaluationReadinessSummary = {\n readyIntentCount: number;\n confirmedIntentCount: number;\n readySegmentCount: number;\n confirmedSegmentCount: number;\n warningIntentCount: number;\n warningSegmentCount: number;\n};\n\nexport type AssistantWorkflowToolSelectionMigrationCandidateKind = \"intent\" | \"segment\";\n\nexport type AssistantWorkflowToolSelectionMigrationCandidateStatus =\n | \"ready_for_workflow_authority\"\n | \"workflow_authority_confirmed\"\n | \"expected_clarification_only\"\n | \"selection_not_exercised_only\"\n | \"needs_review\";\n\nexport type AssistantWorkflowToolSelectionMigrationRecommendedAction =\n | \"add_intent_to_authority_allow_list\"\n | \"keep_runtime_authority\"\n | \"keep_controller_clarification\"\n | \"exercise_pruned_selection\"\n | \"review_segment_before_authority_change\"\n | \"review_blockers_before_migration\";\n\nexport type AssistantWorkflowToolSelectionMigrationCandidate = {\n kind: AssistantWorkflowToolSelectionMigrationCandidateKind;\n key: string;\n intentId: string;\n segmentKey: string | null;\n hop: number | null;\n selectedReason: string | null;\n decisionCount: number;\n workflowAuthorityCount: number;\n shadowEquivalentCount: number;\n workflowDiffersCount: number;\n workflowBlockedCount: number;\n expectedClarificationBlockCount: number;\n selectionNotExercisedCount: number;\n workflowUnavailableCount: number;\n warningCount: number;\n status: AssistantWorkflowToolSelectionMigrationCandidateStatus;\n recommendedAction: AssistantWorkflowToolSelectionMigrationRecommendedAction;\n blockingReasons: string[];\n rationale: string;\n};\n\nexport type AssistantWorkflowToolSelectionMigrationReportOptions = {\n minDecisionCount?: number | null;\n};\n\nexport type AssistantWorkflowToolSelectionMigrationReport = {\n generatedAt: string;\n minDecisionCount: number;\n sourceDecisionCount: number;\n rowCount: number;\n suggestedAuthorityIntentIds: string[];\n suggestedAuthoritySegmentKeys: string[];\n candidateCount: number;\n readyIntentCandidates: AssistantWorkflowToolSelectionMigrationCandidate[];\n readySegmentCandidates: AssistantWorkflowToolSelectionMigrationCandidate[];\n confirmedIntentCandidates: AssistantWorkflowToolSelectionMigrationCandidate[];\n confirmedSegmentCandidates: AssistantWorkflowToolSelectionMigrationCandidate[];\n expectedClarificationCandidates: AssistantWorkflowToolSelectionMigrationCandidate[];\n selectionNotExercisedCandidates: AssistantWorkflowToolSelectionMigrationCandidate[];\n reviewCandidates: AssistantWorkflowToolSelectionMigrationCandidate[];\n};\n\nexport type AssistantWorkflowToolSelectionAuthorityAllowListProposalOptions = {\n currentAuthorityIntentIds?: readonly string[] | null;\n currentAuthoritySegmentKeys?: readonly string[] | null;\n};\n\nexport type AssistantWorkflowToolSelectionAuthorityAllowListProposal = {\n generatedAt: string;\n minDecisionCount: number;\n sourceDecisionCount: number;\n rowCount: number;\n currentAuthorityIntentIds: string[];\n currentAuthoritySegmentKeys: string[];\n suggestedAuthorityIntentIds: string[];\n suggestedAuthoritySegmentKeys: string[];\n addIntentIds: string[];\n addSegmentKeys: string[];\n keepIntentIds: string[];\n keepSegmentKeys: string[];\n proposedAuthorityIntentIds: string[];\n proposedAuthoritySegmentKeys: string[];\n readyIntentCandidateCount: number;\n readySegmentCandidateCount: number;\n confirmedIntentCandidateCount: number;\n confirmedSegmentCandidateCount: number;\n reviewIntentCandidateCount: number;\n reviewSegmentCandidateCount: number;\n reviewIntentIds: string[];\n reviewSegmentKeys: string[];\n currentIntentIdsWithReviewEvidence: string[];\n currentSegmentKeysWithReviewEvidence: string[];\n canApplyAdditions: boolean;\n rationale: string[];\n};\n\nexport type AssistantWorkflowToolSelectionMigrationReviewArtifactStatus =\n | \"ready_for_runtime_change\"\n | \"no_runtime_change\";\n\nexport type AssistantWorkflowToolSelectionMigrationReviewArtifactRecommendedAction =\n | \"apply_authority_allow_list_update\"\n | \"keep_current_authority\";\n\nexport type AssistantWorkflowToolSelectionMigrationReviewArtifactOptions = {\n title?: string | null;\n patchTargets?: readonly string[] | null;\n requiredTestIds?: readonly string[] | null;\n};\n\nexport type AssistantWorkflowToolSelectionMigrationReviewArtifact = {\n generatedAt: string;\n title: string;\n status: AssistantWorkflowToolSelectionMigrationReviewArtifactStatus;\n recommendedAction: AssistantWorkflowToolSelectionMigrationReviewArtifactRecommendedAction;\n minDecisionCount: number;\n sourceDecisionCount: number;\n rowCount: number;\n patchTargets: string[];\n requiredTestIds: string[];\n runtimeChange: {\n addIntentIds: string[];\n addSegmentKeys: string[];\n keepIntentIds: string[];\n keepSegmentKeys: string[];\n proposedAuthorityIntentIds: string[];\n proposedAuthoritySegmentKeys: string[];\n };\n evidence: {\n readyIntentCandidateKeys: string[];\n readySegmentCandidateKeys: string[];\n confirmedIntentCandidateKeys: string[];\n confirmedSegmentCandidateKeys: string[];\n expectedClarificationCandidateKeys: string[];\n selectionNotExercisedCandidateKeys: string[];\n };\n review: {\n reviewIntentIds: string[];\n reviewSegmentKeys: string[];\n currentIntentIdsWithReviewEvidence: string[];\n currentSegmentKeysWithReviewEvidence: string[];\n blockerCount: number;\n blockers: AssistantWorkflowToolSelectionMigrationCandidate[];\n };\n rationale: string[];\n};\n\nexport type AssistantWorkflowToolSelectionEvaluationBatch = {\n generatedAt: string;\n sourceDecisionCount: number;\n rowCount: number;\n interestingRowCount: number;\n warningRowCount: number;\n intentCounts: AssistantWorkflowToolSelectionEvaluationBatchCount[];\n intentReadiness: AssistantWorkflowToolSelectionEvaluationIntentReadiness[];\n segmentReadiness: AssistantWorkflowToolSelectionEvaluationSegmentReadiness[];\n readinessSummary: AssistantWorkflowToolSelectionEvaluationReadinessSummary;\n authoritySourceCounts: AssistantWorkflowToolSelectionEvaluationBatchCount[];\n authorityReasonCounts: AssistantWorkflowToolSelectionEvaluationBatchCount[];\n workflowStatusCounts: AssistantWorkflowToolSelectionEvaluationBatchCount[];\n effectiveReasonCounts: AssistantWorkflowToolSelectionEvaluationBatchCount[];\n workflowSelectionProfileCounts: AssistantWorkflowToolSelectionEvaluationBatchCount[];\n workflowSelectionProfileToolCounts: AssistantWorkflowToolSelectionEvaluationBatchCount[];\n signalCounts: AssistantWorkflowToolSelectionEvaluationBatchSignalCount[];\n rows: AssistantWorkflowToolSelectionEvaluation[];\n};\n\nexport function evaluateAssistantWorkflowToolSelectionDecision(\n decision: AssistantWorkflowSerializedToolSelectionDecision,\n): AssistantWorkflowToolSelectionEvaluation {\n const signals = collectAssistantWorkflowToolSelectionEvaluationSignals(decision);\n const workflowSelectionCandidateToolNames = readStringArray(\n decision.comparisonPayload?.[\"workflowSelectionCandidateTools\"],\n );\n const workflowSelectionActiveProfileIds = readStringArray(\n decision.comparisonPayload?.[\"workflowSelectionActiveProfileIds\"],\n );\n const workflowSelectionProfileToolNames = readStringArray(\n decision.comparisonPayload?.[\"workflowSelectionProfileTools\"],\n );\n const intentId = readString(decision.comparisonPayload?.[\"intent\"]);\n const workflowAuthorityIntentIds = readStringArray(\n decision.comparisonPayload?.[\"workflowAuthorityIntentIds\"],\n );\n const workflowAuthoritySegmentKeys = readStringArray(\n decision.comparisonPayload?.[\"workflowAuthoritySegmentKeys\"],\n );\n const workflowAuthoritySegmentKey = readString(decision.comparisonPayload?.[\"workflowAuthoritySegmentKey\"]) ??\n buildAssistantWorkflowToolSelectionSegmentKey({\n intentId,\n hop: readNumber(decision.comparisonPayload?.[\"hop\"]),\n selectedReason: readString(decision.comparisonPayload?.[\"selectedReason\"]),\n });\n const expectedClarificationBlock = isExpectedClarificationBlock(decision);\n const selectionNotExercised = isWorkflowSelectionNotExercised(decision);\n\n return {\n intentId,\n hop: readNumber(decision.comparisonPayload?.[\"hop\"]),\n selectedReason: readString(decision.comparisonPayload?.[\"selectedReason\"]),\n authoritySource: decision.authority.source,\n authorityReason: getEvaluationAuthorityReason(decision),\n workflowStatus: decision.authority.workflowStatus,\n workflowAuthorityEnabled: intentId && workflowAuthorityIntentIds.length > 0\n ? workflowAuthorityIntentIds.includes(intentId)\n : null,\n workflowAuthoritySegmentKey,\n workflowAuthoritySegmentEnabled: workflowAuthoritySegmentKeys.length > 0\n ? workflowAuthoritySegmentKeys.includes(workflowAuthoritySegmentKey)\n : null,\n effectiveReason: decision.effectiveReason,\n selectedToolCount: decision.authority.selectedToolNames.length,\n effectiveToolCount: decision.effectiveToolNames.length,\n workflowSuggestedToolCount: decision.authority.workflowSuggestedToolNames.length,\n workflowSelectionCandidateToolCount: workflowSelectionCandidateToolNames.length,\n workflowSelectionActiveProfileIds,\n workflowSelectionProfileToolNames: workflowSelectionProfileToolNames,\n workflowSelectionProfileToolCount: workflowSelectionProfileToolNames.length,\n expectedClarificationBlock,\n selectionNotExercised,\n signalCount: signals.length,\n warningCount: signals.filter((signal) => signal.severity === \"warning\").length,\n signals,\n };\n}\n\nexport function collectAssistantWorkflowToolSelectionEvaluationSignals(\n decision: AssistantWorkflowSerializedToolSelectionDecision,\n): AssistantWorkflowToolSelectionEvaluationSignal[] {\n const signals: AssistantWorkflowToolSelectionEvaluationSignal[] = [];\n const expectedClarificationBlock = isExpectedClarificationBlock(decision);\n const selectionNotExercised = isWorkflowSelectionNotExercised(decision);\n const authorityReason = getEvaluationAuthorityReason(decision);\n const missingCandidateTools = readStringArray(\n decision.comparisonPayload?.[\"missingWorkflowSelectionCandidateTools\"],\n );\n const selectedOutsideCandidate = readStringArray(\n decision.comparisonPayload?.[\"selectedOutsideWorkflowSelectionCandidate\"],\n );\n const selectedOutsideSuggestions = readStringArray(\n decision.comparisonPayload?.[\"selectedOutsideWorkflowSuggestions\"],\n );\n const excludedOptionalTools = readStringArray(\n decision.comparisonPayload?.[\"workflowSelectionExcludedOptionalTools\"],\n );\n const selectedPolicyExcludedOptionalTools = selectedOutsideCandidate.filter((toolName) =>\n excludedOptionalTools.includes(toolName)\n );\n\n if (decision.authority.source === \"legacy-pruner\") {\n signals.push({\n name: \"legacy_authority\",\n severity: \"info\",\n detail: authorityReason,\n });\n }\n\n if (authorityReason === \"workflow_unavailable\") {\n signals.push({\n name: \"workflow_unavailable\",\n severity: \"warning\",\n detail: \"tool selection ran without a workflow comparison payload\",\n });\n }\n\n if (authorityReason === \"workflow_authority_not_enabled\") {\n signals.push({\n name: \"workflow_authority_not_enabled\",\n severity: \"info\",\n detail: readString(decision.comparisonPayload?.[\"intent\"]),\n });\n }\n\n if (authorityReason === \"workflow_blocked\") {\n signals.push({\n name: expectedClarificationBlock\n ? \"workflow_expected_clarification\"\n : \"workflow_blocked\",\n severity: expectedClarificationBlock ? \"info\" : \"warning\",\n detail: decision.authority.workflowStatus,\n });\n }\n\n if (authorityReason === \"workflow_selection_not_exercised\") {\n signals.push({\n name: \"workflow_selection_not_exercised\",\n severity: \"info\",\n detail: \"pruning_disabled\",\n });\n }\n\n if (authorityReason === \"workflow_differs\") {\n signals.push({\n name: \"workflow_differs\",\n severity: \"info\",\n detail: summarizeDifference(missingCandidateTools, selectedOutsideCandidate),\n });\n }\n\n if (missingCandidateTools.length > 0 && !expectedClarificationBlock && !selectionNotExercised) {\n signals.push({\n name: \"workflow_candidate_not_selected\",\n severity: \"warning\",\n detail: missingCandidateTools.join(\", \"),\n });\n }\n\n if (selectedOutsideCandidate.length > 0 && !selectionNotExercised) {\n signals.push({\n name: \"selected_outside_workflow_candidate\",\n severity: \"info\",\n detail: selectedOutsideCandidate.join(\", \"),\n });\n }\n\n if (selectedOutsideSuggestions.length > 0 && !selectionNotExercised) {\n signals.push({\n name: \"selected_outside_workflow_suggestions\",\n severity: \"info\",\n detail: selectedOutsideSuggestions.join(\", \"),\n });\n }\n\n if (selectedPolicyExcludedOptionalTools.length > 0 && !selectionNotExercised) {\n signals.push({\n name: \"selected_policy_excluded_optional_tool\",\n severity: \"info\",\n detail: selectedPolicyExcludedOptionalTools.join(\", \"),\n });\n }\n\n return signals;\n}\n\nexport function buildAssistantWorkflowToolSelectionEvaluationBatch(\n decisions: readonly AssistantWorkflowSerializedToolSelectionDecision[],\n options: AssistantWorkflowToolSelectionEvaluationBatchOptions = {},\n): AssistantWorkflowToolSelectionEvaluationBatch {\n const allRows = decisions.map(evaluateAssistantWorkflowToolSelectionDecision);\n const rows = options.onlyInteresting === true ? allRows.filter(isInterestingRow) : allRows;\n const intentReadiness = buildIntentReadiness(rows);\n const segmentReadiness = buildSegmentReadiness(rows);\n\n return {\n generatedAt: new Date().toISOString(),\n sourceDecisionCount: decisions.length,\n rowCount: rows.length,\n interestingRowCount: rows.filter(isInterestingRow).length,\n warningRowCount: rows.filter((row) => row.warningCount > 0).length,\n intentCounts: buildStringCounts(rows.map((row) => row.intentId ?? \"unknown\")),\n intentReadiness,\n segmentReadiness,\n readinessSummary: buildReadinessSummary(intentReadiness, segmentReadiness),\n authoritySourceCounts: buildStringCounts(rows.map((row) => row.authoritySource)),\n authorityReasonCounts: buildStringCounts(rows.map((row) => row.authorityReason)),\n workflowStatusCounts: buildStringCounts(rows.map((row) => row.workflowStatus ?? \"none\")),\n effectiveReasonCounts: buildStringCounts(rows.map((row) => row.effectiveReason ?? \"none\")),\n workflowSelectionProfileCounts: buildStringCounts(rows.flatMap((row) => row.workflowSelectionActiveProfileIds)),\n workflowSelectionProfileToolCounts: buildStringCounts(rows.flatMap((row) => row.workflowSelectionProfileToolNames)),\n signalCounts: buildSignalCounts(rows.flatMap((row) => row.signals)),\n rows,\n };\n}\n\nexport function buildAssistantWorkflowToolSelectionEvaluationTracePayload(\n evaluation: AssistantWorkflowToolSelectionEvaluation,\n): Record<string, AssistantWorkflowJsonValue> {\n return {\n authoritySource: evaluation.authoritySource,\n authorityReason: evaluation.authorityReason,\n workflowStatus: evaluation.workflowStatus,\n intentId: evaluation.intentId,\n hop: evaluation.hop,\n selectedReason: evaluation.selectedReason,\n workflowAuthorityEnabled: evaluation.workflowAuthorityEnabled,\n workflowAuthoritySegmentKey: evaluation.workflowAuthoritySegmentKey,\n workflowAuthoritySegmentEnabled: evaluation.workflowAuthoritySegmentEnabled,\n effectiveReason: evaluation.effectiveReason,\n selectedToolCount: evaluation.selectedToolCount,\n effectiveToolCount: evaluation.effectiveToolCount,\n workflowSuggestedToolCount: evaluation.workflowSuggestedToolCount,\n workflowSelectionCandidateToolCount: evaluation.workflowSelectionCandidateToolCount,\n workflowSelectionActiveProfileIds: evaluation.workflowSelectionActiveProfileIds,\n workflowSelectionProfileToolNames: evaluation.workflowSelectionProfileToolNames,\n workflowSelectionProfileToolCount: evaluation.workflowSelectionProfileToolCount,\n expectedClarificationBlock: evaluation.expectedClarificationBlock,\n selectionNotExercised: evaluation.selectionNotExercised,\n signalCount: evaluation.signalCount,\n warningCount: evaluation.warningCount,\n signals: evaluation.signals.map((signal) => ({\n name: signal.name,\n severity: signal.severity,\n detail: signal.detail,\n })),\n };\n}\n\nexport function buildAssistantWorkflowToolSelectionEvaluationBatchTracePayload(\n batch: AssistantWorkflowToolSelectionEvaluationBatch,\n): Record<string, AssistantWorkflowJsonValue> {\n return {\n generatedAt: batch.generatedAt,\n sourceDecisionCount: batch.sourceDecisionCount,\n rowCount: batch.rowCount,\n interestingRowCount: batch.interestingRowCount,\n warningRowCount: batch.warningRowCount,\n intentCounts: batch.intentCounts,\n readinessSummary: {\n readyIntentCount: batch.readinessSummary.readyIntentCount,\n confirmedIntentCount: batch.readinessSummary.confirmedIntentCount,\n readySegmentCount: batch.readinessSummary.readySegmentCount,\n confirmedSegmentCount: batch.readinessSummary.confirmedSegmentCount,\n warningIntentCount: batch.readinessSummary.warningIntentCount,\n warningSegmentCount: batch.readinessSummary.warningSegmentCount,\n },\n intentReadiness: batch.intentReadiness.map((intent) => ({\n intentId: intent.intentId,\n decisionCount: intent.decisionCount,\n workflowAuthorityCount: intent.workflowAuthorityCount,\n shadowEquivalentCount: intent.shadowEquivalentCount,\n workflowDiffersCount: intent.workflowDiffersCount,\n workflowBlockedCount: intent.workflowBlockedCount,\n expectedClarificationBlockCount: intent.expectedClarificationBlockCount,\n selectionNotExercisedCount: intent.selectionNotExercisedCount,\n workflowUnavailableCount: intent.workflowUnavailableCount,\n warningCount: intent.warningCount,\n workflowAuthorityConfirmed: intent.workflowAuthorityConfirmed,\n readyForWorkflowAuthority: intent.readyForWorkflowAuthority,\n })),\n segmentReadiness: batch.segmentReadiness.map((segment) => ({\n segmentKey: segment.segmentKey,\n intentId: segment.intentId,\n hop: segment.hop,\n selectedReason: segment.selectedReason,\n decisionCount: segment.decisionCount,\n workflowAuthorityCount: segment.workflowAuthorityCount,\n shadowEquivalentCount: segment.shadowEquivalentCount,\n workflowDiffersCount: segment.workflowDiffersCount,\n workflowBlockedCount: segment.workflowBlockedCount,\n expectedClarificationBlockCount: segment.expectedClarificationBlockCount,\n selectionNotExercisedCount: segment.selectionNotExercisedCount,\n workflowUnavailableCount: segment.workflowUnavailableCount,\n warningCount: segment.warningCount,\n workflowAuthorityConfirmed: segment.workflowAuthorityConfirmed,\n readyForWorkflowAuthority: segment.readyForWorkflowAuthority,\n })),\n authoritySourceCounts: batch.authoritySourceCounts,\n authorityReasonCounts: batch.authorityReasonCounts,\n workflowStatusCounts: batch.workflowStatusCounts,\n effectiveReasonCounts: batch.effectiveReasonCounts,\n workflowSelectionProfileCounts: batch.workflowSelectionProfileCounts,\n workflowSelectionProfileToolCounts: batch.workflowSelectionProfileToolCounts,\n signalCounts: batch.signalCounts,\n };\n}\n\nexport function buildAssistantWorkflowToolSelectionMigrationReport(\n batch: AssistantWorkflowToolSelectionEvaluationBatch,\n options: AssistantWorkflowToolSelectionMigrationReportOptions = {},\n): AssistantWorkflowToolSelectionMigrationReport {\n const minDecisionCount = normalizeMinDecisionCount(options.minDecisionCount);\n const intentCandidates = batch.intentReadiness.map((readiness) =>\n buildMigrationCandidate(\"intent\", readiness, minDecisionCount)\n );\n const segmentCandidates = batch.segmentReadiness.map((readiness) =>\n buildMigrationCandidate(\"segment\", readiness, minDecisionCount)\n );\n const readyIntentCandidates = intentCandidates.filter((candidate) =>\n candidate.status === \"ready_for_workflow_authority\"\n );\n const readySegmentCandidates = segmentCandidates.filter((candidate) =>\n candidate.status === \"ready_for_workflow_authority\"\n );\n const confirmedIntentCandidates = intentCandidates.filter((candidate) =>\n candidate.status === \"workflow_authority_confirmed\"\n );\n const confirmedSegmentCandidates = segmentCandidates.filter((candidate) =>\n candidate.status === \"workflow_authority_confirmed\"\n );\n const expectedClarificationCandidates = [...intentCandidates, ...segmentCandidates].filter((candidate) =>\n candidate.status === \"expected_clarification_only\"\n );\n const selectionNotExercisedCandidates = [...intentCandidates, ...segmentCandidates].filter((candidate) =>\n candidate.status === \"selection_not_exercised_only\"\n );\n const reviewCandidates = [...intentCandidates, ...segmentCandidates].filter((candidate) =>\n candidate.status === \"needs_review\"\n );\n\n return {\n generatedAt: batch.generatedAt,\n minDecisionCount,\n sourceDecisionCount: batch.sourceDecisionCount,\n rowCount: batch.rowCount,\n suggestedAuthorityIntentIds: uniqueStrings(readyIntentCandidates.map((candidate) => candidate.intentId)),\n suggestedAuthoritySegmentKeys: uniqueStrings(readySegmentCandidates.map((candidate) => candidate.segmentKey ?? \"\")),\n candidateCount: intentCandidates.length + segmentCandidates.length,\n readyIntentCandidates,\n readySegmentCandidates,\n confirmedIntentCandidates,\n confirmedSegmentCandidates,\n expectedClarificationCandidates,\n selectionNotExercisedCandidates,\n reviewCandidates,\n };\n}\n\nexport function buildAssistantWorkflowToolSelectionMigrationReportTracePayload(\n report: AssistantWorkflowToolSelectionMigrationReport,\n): Record<string, AssistantWorkflowJsonValue> {\n return {\n generatedAt: report.generatedAt,\n minDecisionCount: report.minDecisionCount,\n sourceDecisionCount: report.sourceDecisionCount,\n rowCount: report.rowCount,\n suggestedAuthorityIntentIds: report.suggestedAuthorityIntentIds,\n suggestedAuthoritySegmentKeys: report.suggestedAuthoritySegmentKeys,\n candidateCount: report.candidateCount,\n readyIntentCandidates: report.readyIntentCandidates.map(toMigrationCandidateTracePayload),\n readySegmentCandidates: report.readySegmentCandidates.map(toMigrationCandidateTracePayload),\n confirmedIntentCandidates: report.confirmedIntentCandidates.map(toMigrationCandidateTracePayload),\n confirmedSegmentCandidates: report.confirmedSegmentCandidates.map(toMigrationCandidateTracePayload),\n expectedClarificationCandidates: report.expectedClarificationCandidates.map(toMigrationCandidateTracePayload),\n selectionNotExercisedCandidates: report.selectionNotExercisedCandidates.map(toMigrationCandidateTracePayload),\n reviewCandidates: report.reviewCandidates.map(toMigrationCandidateTracePayload),\n };\n}\n\nexport function buildAssistantWorkflowToolSelectionAuthorityAllowListProposal(\n report: AssistantWorkflowToolSelectionMigrationReport,\n options: AssistantWorkflowToolSelectionAuthorityAllowListProposalOptions = {},\n): AssistantWorkflowToolSelectionAuthorityAllowListProposal {\n const currentAuthorityIntentIds = uniqueStrings(options.currentAuthorityIntentIds ?? []);\n const currentAuthoritySegmentKeys = uniqueStrings(options.currentAuthoritySegmentKeys ?? []);\n const suggestedAuthorityIntentIds = uniqueStrings(report.suggestedAuthorityIntentIds);\n const suggestedAuthoritySegmentKeys = uniqueStrings(report.suggestedAuthoritySegmentKeys);\n const addIntentIds = suggestedAuthorityIntentIds.filter((intentId) =>\n !currentAuthorityIntentIds.includes(intentId)\n );\n const addSegmentKeys = suggestedAuthoritySegmentKeys.filter((segmentKey) =>\n !currentAuthoritySegmentKeys.includes(segmentKey)\n );\n const keepIntentIds = currentAuthorityIntentIds;\n const keepSegmentKeys = currentAuthoritySegmentKeys;\n const proposedAuthorityIntentIds = uniqueStrings([...keepIntentIds, ...addIntentIds]);\n const proposedAuthoritySegmentKeys = uniqueStrings([...keepSegmentKeys, ...addSegmentKeys]);\n const reviewIntentIds = uniqueStrings(\n report.reviewCandidates\n .filter((candidate) => candidate.kind === \"intent\")\n .map((candidate) => candidate.intentId),\n );\n const reviewSegmentKeys = uniqueStrings(\n report.reviewCandidates\n .filter((candidate) => candidate.kind === \"segment\")\n .map((candidate) => candidate.segmentKey ?? \"\"),\n );\n const currentIntentIdsWithReviewEvidence = currentAuthorityIntentIds.filter((intentId) =>\n reviewIntentIds.includes(intentId)\n );\n const currentSegmentKeysWithReviewEvidence = currentAuthoritySegmentKeys.filter((segmentKey) =>\n reviewSegmentKeys.includes(segmentKey)\n );\n\n return {\n generatedAt: report.generatedAt,\n minDecisionCount: report.minDecisionCount,\n sourceDecisionCount: report.sourceDecisionCount,\n rowCount: report.rowCount,\n currentAuthorityIntentIds,\n currentAuthoritySegmentKeys,\n suggestedAuthorityIntentIds,\n suggestedAuthoritySegmentKeys,\n addIntentIds,\n addSegmentKeys,\n keepIntentIds,\n keepSegmentKeys,\n proposedAuthorityIntentIds,\n proposedAuthoritySegmentKeys,\n readyIntentCandidateCount: report.readyIntentCandidates.length,\n readySegmentCandidateCount: report.readySegmentCandidates.length,\n confirmedIntentCandidateCount: report.confirmedIntentCandidates.length,\n confirmedSegmentCandidateCount: report.confirmedSegmentCandidates.length,\n reviewIntentCandidateCount: report.reviewCandidates.filter((candidate) =>\n candidate.kind === \"intent\"\n ).length,\n reviewSegmentCandidateCount: report.reviewCandidates.filter((candidate) =>\n candidate.kind === \"segment\"\n ).length,\n reviewIntentIds,\n reviewSegmentKeys,\n currentIntentIdsWithReviewEvidence,\n currentSegmentKeysWithReviewEvidence,\n canApplyAdditions: addIntentIds.length > 0 || addSegmentKeys.length > 0,\n rationale: buildAuthorityAllowListProposalRationale({\n addIntentIds,\n addSegmentKeys,\n currentAuthorityIntentIds,\n currentAuthoritySegmentKeys,\n currentIntentIdsWithReviewEvidence,\n currentSegmentKeysWithReviewEvidence,\n report,\n reviewIntentIds,\n reviewSegmentKeys,\n }),\n };\n}\n\nexport function buildAssistantWorkflowToolSelectionAuthorityAllowListProposalTracePayload(\n proposal: AssistantWorkflowToolSelectionAuthorityAllowListProposal,\n): Record<string, AssistantWorkflowJsonValue> {\n return {\n generatedAt: proposal.generatedAt,\n minDecisionCount: proposal.minDecisionCount,\n sourceDecisionCount: proposal.sourceDecisionCount,\n rowCount: proposal.rowCount,\n currentAuthorityIntentIds: proposal.currentAuthorityIntentIds,\n currentAuthoritySegmentKeys: proposal.currentAuthoritySegmentKeys,\n suggestedAuthorityIntentIds: proposal.suggestedAuthorityIntentIds,\n suggestedAuthoritySegmentKeys: proposal.suggestedAuthoritySegmentKeys,\n addIntentIds: proposal.addIntentIds,\n addSegmentKeys: proposal.addSegmentKeys,\n keepIntentIds: proposal.keepIntentIds,\n keepSegmentKeys: proposal.keepSegmentKeys,\n proposedAuthorityIntentIds: proposal.proposedAuthorityIntentIds,\n proposedAuthoritySegmentKeys: proposal.proposedAuthoritySegmentKeys,\n readyIntentCandidateCount: proposal.readyIntentCandidateCount,\n readySegmentCandidateCount: proposal.readySegmentCandidateCount,\n confirmedIntentCandidateCount: proposal.confirmedIntentCandidateCount,\n confirmedSegmentCandidateCount: proposal.confirmedSegmentCandidateCount,\n reviewIntentCandidateCount: proposal.reviewIntentCandidateCount,\n reviewSegmentCandidateCount: proposal.reviewSegmentCandidateCount,\n reviewIntentIds: proposal.reviewIntentIds,\n reviewSegmentKeys: proposal.reviewSegmentKeys,\n currentIntentIdsWithReviewEvidence: proposal.currentIntentIdsWithReviewEvidence,\n currentSegmentKeysWithReviewEvidence: proposal.currentSegmentKeysWithReviewEvidence,\n canApplyAdditions: proposal.canApplyAdditions,\n rationale: proposal.rationale,\n };\n}\n\nexport function buildAssistantWorkflowToolSelectionMigrationReviewArtifact(\n input: {\n report: AssistantWorkflowToolSelectionMigrationReport;\n proposal: AssistantWorkflowToolSelectionAuthorityAllowListProposal;\n },\n options: AssistantWorkflowToolSelectionMigrationReviewArtifactOptions = {},\n): AssistantWorkflowToolSelectionMigrationReviewArtifact {\n const patchTargets = uniqueStrings(options.patchTargets ?? []);\n const requiredTestIds = uniqueStrings(options.requiredTestIds ?? []);\n const status: AssistantWorkflowToolSelectionMigrationReviewArtifactStatus = input.proposal.canApplyAdditions\n ? \"ready_for_runtime_change\"\n : \"no_runtime_change\";\n\n return {\n generatedAt: input.proposal.generatedAt,\n title: readString(options.title) ?? \"Assistant workflow tool-selection migration review\",\n status,\n recommendedAction: status === \"ready_for_runtime_change\"\n ? \"apply_authority_allow_list_update\"\n : \"keep_current_authority\",\n minDecisionCount: input.proposal.minDecisionCount,\n sourceDecisionCount: input.proposal.sourceDecisionCount,\n rowCount: input.proposal.rowCount,\n patchTargets,\n requiredTestIds,\n runtimeChange: {\n addIntentIds: input.proposal.addIntentIds,\n addSegmentKeys: input.proposal.addSegmentKeys,\n keepIntentIds: input.proposal.keepIntentIds,\n keepSegmentKeys: input.proposal.keepSegmentKeys,\n proposedAuthorityIntentIds: input.proposal.proposedAuthorityIntentIds,\n proposedAuthoritySegmentKeys: input.proposal.proposedAuthoritySegmentKeys,\n },\n evidence: {\n readyIntentCandidateKeys: input.report.readyIntentCandidates.map((candidate) => candidate.key),\n readySegmentCandidateKeys: input.report.readySegmentCandidates.map((candidate) => candidate.key),\n confirmedIntentCandidateKeys: input.report.confirmedIntentCandidates.map((candidate) => candidate.key),\n confirmedSegmentCandidateKeys: input.report.confirmedSegmentCandidates.map((candidate) => candidate.key),\n expectedClarificationCandidateKeys: input.report.expectedClarificationCandidates.map((candidate) => candidate.key),\n selectionNotExercisedCandidateKeys: input.report.selectionNotExercisedCandidates.map((candidate) => candidate.key),\n },\n review: {\n reviewIntentIds: input.proposal.reviewIntentIds,\n reviewSegmentKeys: input.proposal.reviewSegmentKeys,\n currentIntentIdsWithReviewEvidence: input.proposal.currentIntentIdsWithReviewEvidence,\n currentSegmentKeysWithReviewEvidence: input.proposal.currentSegmentKeysWithReviewEvidence,\n blockerCount: input.report.reviewCandidates.length,\n blockers: input.report.reviewCandidates,\n },\n rationale: buildMigrationReviewArtifactRationale(input.proposal, status),\n };\n}\n\nexport function buildAssistantWorkflowToolSelectionMigrationReviewArtifactTracePayload(\n artifact: AssistantWorkflowToolSelectionMigrationReviewArtifact,\n): Record<string, AssistantWorkflowJsonValue> {\n return {\n generatedAt: artifact.generatedAt,\n title: artifact.title,\n status: artifact.status,\n recommendedAction: artifact.recommendedAction,\n minDecisionCount: artifact.minDecisionCount,\n sourceDecisionCount: artifact.sourceDecisionCount,\n rowCount: artifact.rowCount,\n patchTargets: artifact.patchTargets,\n requiredTestIds: artifact.requiredTestIds,\n runtimeChange: {\n addIntentIds: artifact.runtimeChange.addIntentIds,\n addSegmentKeys: artifact.runtimeChange.addSegmentKeys,\n keepIntentIds: artifact.runtimeChange.keepIntentIds,\n keepSegmentKeys: artifact.runtimeChange.keepSegmentKeys,\n proposedAuthorityIntentIds: artifact.runtimeChange.proposedAuthorityIntentIds,\n proposedAuthoritySegmentKeys: artifact.runtimeChange.proposedAuthoritySegmentKeys,\n },\n evidence: {\n readyIntentCandidateKeys: artifact.evidence.readyIntentCandidateKeys,\n readySegmentCandidateKeys: artifact.evidence.readySegmentCandidateKeys,\n confirmedIntentCandidateKeys: artifact.evidence.confirmedIntentCandidateKeys,\n confirmedSegmentCandidateKeys: artifact.evidence.confirmedSegmentCandidateKeys,\n expectedClarificationCandidateKeys: artifact.evidence.expectedClarificationCandidateKeys,\n selectionNotExercisedCandidateKeys: artifact.evidence.selectionNotExercisedCandidateKeys,\n },\n review: {\n reviewIntentIds: artifact.review.reviewIntentIds,\n reviewSegmentKeys: artifact.review.reviewSegmentKeys,\n currentIntentIdsWithReviewEvidence: artifact.review.currentIntentIdsWithReviewEvidence,\n currentSegmentKeysWithReviewEvidence: artifact.review.currentSegmentKeysWithReviewEvidence,\n blockerCount: artifact.review.blockerCount,\n blockers: artifact.review.blockers.map(toMigrationCandidateTracePayload),\n },\n rationale: artifact.rationale,\n };\n}\n\nfunction buildReadinessSummary(\n intentReadiness: readonly AssistantWorkflowToolSelectionEvaluationIntentReadiness[],\n segmentReadiness: readonly AssistantWorkflowToolSelectionEvaluationSegmentReadiness[],\n): AssistantWorkflowToolSelectionEvaluationReadinessSummary {\n return {\n readyIntentCount: intentReadiness.filter((intent) => intent.readyForWorkflowAuthority).length,\n confirmedIntentCount: intentReadiness.filter((intent) => intent.workflowAuthorityConfirmed).length,\n readySegmentCount: segmentReadiness.filter((segment) => segment.readyForWorkflowAuthority).length,\n confirmedSegmentCount: segmentReadiness.filter((segment) => segment.workflowAuthorityConfirmed).length,\n warningIntentCount: intentReadiness.filter((intent) => intent.warningCount > 0).length,\n warningSegmentCount: segmentReadiness.filter((segment) => segment.warningCount > 0).length,\n };\n}\n\nfunction buildMigrationCandidate(\n kind: AssistantWorkflowToolSelectionMigrationCandidateKind,\n readiness: AssistantWorkflowToolSelectionEvaluationIntentReadiness | AssistantWorkflowToolSelectionEvaluationSegmentReadiness,\n minDecisionCount: number,\n): AssistantWorkflowToolSelectionMigrationCandidate {\n const isSegment = isSegmentReadiness(readiness);\n const key = isSegment ? readiness.segmentKey : readiness.intentId;\n const expectedClarificationOnly = isExpectedClarificationOnly(readiness);\n const selectionNotExercisedOnly = isSelectionNotExercisedOnly(readiness);\n const blockingReasons = expectedClarificationOnly || selectionNotExercisedOnly\n ? []\n : collectMigrationBlockingReasons(readiness, minDecisionCount);\n const status: AssistantWorkflowToolSelectionMigrationCandidateStatus = expectedClarificationOnly\n ? \"expected_clarification_only\"\n : selectionNotExercisedOnly\n ? \"selection_not_exercised_only\"\n : blockingReasons.length > 0\n ? \"needs_review\"\n : readiness.workflowAuthorityConfirmed\n ? \"workflow_authority_confirmed\"\n : readiness.readyForWorkflowAuthority\n ? \"ready_for_workflow_authority\"\n : \"needs_review\";\n const recommendedAction = buildMigrationRecommendedAction(kind, status);\n\n return {\n kind,\n key,\n intentId: readiness.intentId,\n segmentKey: isSegment ? readiness.segmentKey : null,\n hop: isSegment ? readiness.hop : null,\n selectedReason: isSegment ? readiness.selectedReason : null,\n decisionCount: readiness.decisionCount,\n workflowAuthorityCount: readiness.workflowAuthorityCount,\n shadowEquivalentCount: readiness.shadowEquivalentCount,\n workflowDiffersCount: readiness.workflowDiffersCount,\n workflowBlockedCount: readiness.workflowBlockedCount,\n expectedClarificationBlockCount: readiness.expectedClarificationBlockCount,\n selectionNotExercisedCount: readiness.selectionNotExercisedCount,\n workflowUnavailableCount: readiness.workflowUnavailableCount,\n warningCount: readiness.warningCount,\n status,\n recommendedAction,\n blockingReasons,\n rationale: buildMigrationRationale(kind, status, readiness, blockingReasons, minDecisionCount),\n };\n}\n\nfunction isExpectedClarificationOnly(\n readiness: AssistantWorkflowToolSelectionEvaluationIntentReadiness,\n): boolean {\n return readiness.expectedClarificationBlockCount > 0 &&\n readiness.workflowAuthorityCount === 0 &&\n readiness.shadowEquivalentCount === 0 &&\n readiness.workflowDiffersCount === 0 &&\n unexpectedWorkflowBlockedCount(readiness) === 0 &&\n readiness.workflowUnavailableCount === 0 &&\n readiness.warningCount === 0;\n}\n\nfunction isSelectionNotExercisedOnly(\n readiness: AssistantWorkflowToolSelectionEvaluationIntentReadiness,\n): boolean {\n return readiness.selectionNotExercisedCount > 0 &&\n readiness.workflowAuthorityCount === 0 &&\n readiness.shadowEquivalentCount === 0 &&\n readiness.workflowDiffersCount === 0 &&\n unexpectedWorkflowBlockedCount(readiness) === 0 &&\n readiness.workflowUnavailableCount === 0 &&\n readiness.warningCount === 0;\n}\n\nfunction unexpectedWorkflowBlockedCount(\n readiness: Pick<\n AssistantWorkflowToolSelectionEvaluationIntentReadiness,\n \"workflowBlockedCount\" | \"expectedClarificationBlockCount\"\n >,\n): number {\n return Math.max(0, readiness.workflowBlockedCount - readiness.expectedClarificationBlockCount);\n}\n\nfunction collectMigrationBlockingReasons(\n readiness: AssistantWorkflowToolSelectionEvaluationIntentReadiness,\n minDecisionCount: number,\n): string[] {\n const reasons: string[] = [];\n if (readiness.intentId === \"unknown\") reasons.push(\"unknown_intent\");\n if (readiness.decisionCount < minDecisionCount) reasons.push(\"insufficient_decisions\");\n if (readiness.warningCount > 0) reasons.push(\"warnings_present\");\n if (readiness.workflowDiffersCount > 0) reasons.push(\"workflow_differs\");\n if (unexpectedWorkflowBlockedCount(readiness) > 0) reasons.push(\"workflow_blocked\");\n if (readiness.workflowUnavailableCount > 0) reasons.push(\"workflow_unavailable\");\n if (\n readiness.workflowAuthorityCount > 0 &&\n readiness.shadowEquivalentCount > 0 &&\n readiness.workflowDiffersCount === 0 &&\n unexpectedWorkflowBlockedCount(readiness) === 0 &&\n readiness.workflowUnavailableCount === 0\n ) {\n reasons.push(\"mixed_authority_evidence\");\n }\n if (\n readiness.workflowAuthorityCount === 0 &&\n readiness.shadowEquivalentCount === 0 &&\n readiness.workflowDiffersCount === 0 &&\n unexpectedWorkflowBlockedCount(readiness) === 0 &&\n readiness.workflowUnavailableCount === 0\n ) {\n reasons.push(\"no_workflow_equivalence_evidence\");\n }\n return reasons;\n}\n\nfunction buildMigrationRecommendedAction(\n kind: AssistantWorkflowToolSelectionMigrationCandidateKind,\n status: AssistantWorkflowToolSelectionMigrationCandidateStatus,\n): AssistantWorkflowToolSelectionMigrationRecommendedAction {\n if (status === \"workflow_authority_confirmed\") return \"keep_runtime_authority\";\n if (status === \"expected_clarification_only\") return \"keep_controller_clarification\";\n if (status === \"selection_not_exercised_only\") return \"exercise_pruned_selection\";\n if (status === \"ready_for_workflow_authority\") {\n return kind === \"intent\"\n ? \"add_intent_to_authority_allow_list\"\n : \"review_segment_before_authority_change\";\n }\n return \"review_blockers_before_migration\";\n}\n\nfunction buildMigrationRationale(\n kind: AssistantWorkflowToolSelectionMigrationCandidateKind,\n status: AssistantWorkflowToolSelectionMigrationCandidateStatus,\n readiness: AssistantWorkflowToolSelectionEvaluationIntentReadiness,\n blockingReasons: readonly string[],\n minDecisionCount: number,\n): string {\n const scope = kind === \"intent\" ? `intent ${readiness.intentId}` : `segment ${getReadinessKey(readiness)}`;\n const clarificationSuffix = readiness.expectedClarificationBlockCount > 0\n ? ` with ${readiness.expectedClarificationBlockCount} expected clarification block(s)`\n : \"\";\n const selectionNotExercisedSuffix = readiness.selectionNotExercisedCount > 0\n ? ` with ${readiness.selectionNotExercisedCount} selection-not-exercised decision(s)`\n : \"\";\n if (status === \"workflow_authority_confirmed\") {\n return `${scope} is already workflow-owned across ${readiness.workflowAuthorityCount} decision(s)${clarificationSuffix} and without warnings.`;\n }\n if (status === \"expected_clarification_only\") {\n return `${scope} has ${readiness.expectedClarificationBlockCount} expected clarification block(s) and does not require an authority change.`;\n }\n if (status === \"selection_not_exercised_only\") {\n return `${scope} was observed with pruning disabled and needs a pruned shadow selection before an authority change.`;\n }\n if (status === \"ready_for_workflow_authority\") {\n return `${scope} has ${readiness.shadowEquivalentCount} shadow-equivalent decision(s)${clarificationSuffix}${selectionNotExercisedSuffix}, no warnings, and meets minDecisionCount=${minDecisionCount}.`;\n }\n return `${scope} is not ready for runtime migration: ${blockingReasons.join(\", \") || \"unknown_reason\"}.`;\n}\n\nfunction getReadinessKey(\n readiness: AssistantWorkflowToolSelectionEvaluationIntentReadiness,\n): string {\n return isSegmentReadiness(readiness) ? readiness.segmentKey : readiness.intentId;\n}\n\nfunction isSegmentReadiness(\n readiness: AssistantWorkflowToolSelectionEvaluationIntentReadiness | AssistantWorkflowToolSelectionEvaluationSegmentReadiness,\n): readiness is AssistantWorkflowToolSelectionEvaluationSegmentReadiness {\n return \"segmentKey\" in readiness;\n}\n\nfunction toMigrationCandidateTracePayload(\n candidate: AssistantWorkflowToolSelectionMigrationCandidate,\n): Record<string, AssistantWorkflowJsonValue> {\n return {\n kind: candidate.kind,\n key: candidate.key,\n intentId: candidate.intentId,\n segmentKey: candidate.segmentKey,\n hop: candidate.hop,\n selectedReason: candidate.selectedReason,\n decisionCount: candidate.decisionCount,\n workflowAuthorityCount: candidate.workflowAuthorityCount,\n shadowEquivalentCount: candidate.shadowEquivalentCount,\n workflowDiffersCount: candidate.workflowDiffersCount,\n workflowBlockedCount: candidate.workflowBlockedCount,\n expectedClarificationBlockCount: candidate.expectedClarificationBlockCount,\n selectionNotExercisedCount: candidate.selectionNotExercisedCount,\n workflowUnavailableCount: candidate.workflowUnavailableCount,\n warningCount: candidate.warningCount,\n status: candidate.status,\n recommendedAction: candidate.recommendedAction,\n blockingReasons: candidate.blockingReasons,\n rationale: candidate.rationale,\n };\n}\n\nfunction buildAuthorityAllowListProposalRationale(input: {\n addIntentIds: readonly string[];\n addSegmentKeys: readonly string[];\n currentAuthorityIntentIds: readonly string[];\n currentAuthoritySegmentKeys: readonly string[];\n currentIntentIdsWithReviewEvidence: readonly string[];\n currentSegmentKeysWithReviewEvidence: readonly string[];\n report: AssistantWorkflowToolSelectionMigrationReport;\n reviewIntentIds: readonly string[];\n reviewSegmentKeys: readonly string[];\n}): string[] {\n const rationale: string[] = [];\n if (input.addIntentIds.length > 0) {\n rationale.push(\n `Add ${input.addIntentIds.join(\", \")} to workflow authority after ${input.report.minDecisionCount} matching decision(s) with no blockers.`,\n );\n } else {\n rationale.push(\"No new intent-level workflow authority additions are ready.\");\n }\n if (input.addSegmentKeys.length > 0) {\n rationale.push(\n `Add segment authority for ${input.addSegmentKeys.join(\", \")} after ${input.report.minDecisionCount} matching decision(s) with no blockers.`,\n );\n } else {\n rationale.push(\"No new segment-level workflow authority additions are ready.\");\n }\n if (input.currentAuthorityIntentIds.length > 0) {\n rationale.push(`Keep existing workflow authority intents: ${input.currentAuthorityIntentIds.join(\", \")}.`);\n }\n if (input.currentAuthoritySegmentKeys.length > 0) {\n rationale.push(`Keep existing workflow authority segments: ${input.currentAuthoritySegmentKeys.join(\", \")}.`);\n }\n if (input.currentIntentIdsWithReviewEvidence.length > 0) {\n rationale.push(\n `Review existing authority evidence for: ${input.currentIntentIdsWithReviewEvidence.join(\", \")}.`,\n );\n }\n if (input.currentSegmentKeysWithReviewEvidence.length > 0) {\n rationale.push(\n `Review existing segment authority evidence for: ${input.currentSegmentKeysWithReviewEvidence.join(\", \")}.`,\n );\n }\n if (input.reviewIntentIds.length > 0) {\n rationale.push(`Review blocked intent candidates before migration: ${input.reviewIntentIds.join(\", \")}.`);\n }\n if (input.reviewSegmentKeys.length > 0) {\n rationale.push(`Review blocked segment candidates before migration: ${input.reviewSegmentKeys.join(\", \")}.`);\n }\n return rationale;\n}\n\nfunction buildMigrationReviewArtifactRationale(\n proposal: AssistantWorkflowToolSelectionAuthorityAllowListProposal,\n status: AssistantWorkflowToolSelectionMigrationReviewArtifactStatus,\n): string[] {\n if (status === \"ready_for_runtime_change\") {\n return [\n \"Migration proposal has ready allow-list additions.\",\n ...proposal.rationale,\n ];\n }\n return [\n \"Migration proposal does not require a runtime allow-list change.\",\n ...proposal.rationale,\n ];\n}\n\nfunction normalizeMinDecisionCount(value: number | null | undefined): number {\n return typeof value === \"number\" && Number.isFinite(value) && value > 0 ? Math.floor(value) : 1;\n}\n\nfunction isInterestingRow(row: AssistantWorkflowToolSelectionEvaluation): boolean {\n return row.authoritySource !== \"workflow\";\n}\n\nfunction isExpectedClarificationBlock(\n decision: AssistantWorkflowSerializedToolSelectionDecision,\n): boolean {\n return decision.authority.reason === \"workflow_blocked\" &&\n decision.authority.workflowStatus === \"needs-clarification\";\n}\n\nfunction isWorkflowSelectionNotExercised(\n decision: AssistantWorkflowSerializedToolSelectionDecision,\n): boolean {\n return decision.authority.source === \"legacy-pruner\" && (\n decision.authority.reason === \"workflow_selection_not_exercised\" ||\n (\n decision.authority.reason === \"workflow_differs\" &&\n decision.comparisonPayload?.[\"pruningEnabled\"] === false\n )\n );\n}\n\nfunction getEvaluationAuthorityReason(\n decision: AssistantWorkflowSerializedToolSelectionDecision,\n): string {\n return isWorkflowSelectionNotExercised(decision)\n ? \"workflow_selection_not_exercised\"\n : decision.authority.reason;\n}\n\nfunction summarizeDifference(\n missingCandidateTools: readonly string[],\n selectedOutsideCandidate: readonly string[],\n): string | null {\n const parts = [\n missingCandidateTools.length > 0 ? `missing=${missingCandidateTools.join(\",\")}` : \"\",\n selectedOutsideCandidate.length > 0 ? `outside=${selectedOutsideCandidate.join(\",\")}` : \"\",\n ].filter((part) => part.length > 0);\n return parts.length ? parts.join(\"; \") : null;\n}\n\nfunction buildIntentReadiness(\n rows: readonly AssistantWorkflowToolSelectionEvaluation[],\n): AssistantWorkflowToolSelectionEvaluationIntentReadiness[] {\n const byIntent = new Map<string, AssistantWorkflowToolSelectionEvaluation[]>();\n for (const row of rows) {\n const intentId = row.intentId ?? \"unknown\";\n const current = byIntent.get(intentId) ?? [];\n current.push(row);\n byIntent.set(intentId, current);\n }\n\n return [...byIntent.entries()]\n .map(([intentId, intentRows]) => {\n const workflowAuthorityCount = intentRows.filter((row) => row.authoritySource === \"workflow\").length;\n const shadowEquivalentCount = intentRows.filter((row) =>\n row.authorityReason === \"workflow_authority_not_enabled\"\n ).length;\n const workflowDiffersCount = intentRows.filter((row) =>\n row.authorityReason === \"workflow_differs\"\n ).length;\n const workflowBlockedCount = intentRows.filter((row) =>\n row.authorityReason === \"workflow_blocked\"\n ).length;\n const expectedClarificationBlockCount = intentRows.filter((row) =>\n row.expectedClarificationBlock\n ).length;\n const selectionNotExercisedCount = intentRows.filter((row) =>\n row.selectionNotExercised\n ).length;\n const workflowUnavailableCount = intentRows.filter((row) =>\n row.authorityReason === \"workflow_unavailable\"\n ).length;\n const warningCount = intentRows.reduce((total, row) => total + row.warningCount, 0);\n\n return {\n intentId,\n decisionCount: intentRows.length,\n workflowAuthorityCount,\n shadowEquivalentCount,\n workflowDiffersCount,\n workflowBlockedCount,\n expectedClarificationBlockCount,\n selectionNotExercisedCount,\n workflowUnavailableCount,\n warningCount,\n workflowAuthorityConfirmed: (\n intentId !== \"unknown\" &&\n workflowAuthorityCount > 0 &&\n shadowEquivalentCount === 0 &&\n workflowDiffersCount === 0 &&\n unexpectedWorkflowBlockedCount({ workflowBlockedCount, expectedClarificationBlockCount }) === 0 &&\n workflowUnavailableCount === 0 &&\n warningCount === 0\n ),\n readyForWorkflowAuthority: (\n intentId !== \"unknown\" &&\n workflowAuthorityCount === 0 &&\n shadowEquivalentCount > 0 &&\n workflowDiffersCount === 0 &&\n unexpectedWorkflowBlockedCount({ workflowBlockedCount, expectedClarificationBlockCount }) === 0 &&\n workflowUnavailableCount === 0 &&\n warningCount === 0\n ),\n };\n })\n .sort((left, right) => {\n if (left.readyForWorkflowAuthority !== right.readyForWorkflowAuthority) {\n return left.readyForWorkflowAuthority ? -1 : 1;\n }\n if (left.workflowAuthorityConfirmed !== right.workflowAuthorityConfirmed) {\n return left.workflowAuthorityConfirmed ? -1 : 1;\n }\n if (right.shadowEquivalentCount !== left.shadowEquivalentCount) {\n return right.shadowEquivalentCount - left.shadowEquivalentCount;\n }\n if (right.decisionCount !== left.decisionCount) return right.decisionCount - left.decisionCount;\n return left.intentId.localeCompare(right.intentId);\n });\n}\n\nfunction buildSegmentReadiness(\n rows: readonly AssistantWorkflowToolSelectionEvaluation[],\n): AssistantWorkflowToolSelectionEvaluationSegmentReadiness[] {\n const bySegment = new Map<string, AssistantWorkflowToolSelectionEvaluation[]>();\n for (const row of rows) {\n const segmentKey = buildSegmentKey(row);\n const current = bySegment.get(segmentKey) ?? [];\n current.push(row);\n bySegment.set(segmentKey, current);\n }\n\n return [...bySegment.entries()]\n .map(([segmentKey, segmentRows]) => {\n const [base] = segmentRows;\n const intentReadiness = buildIntentReadiness(segmentRows)[0] ?? {\n intentId: base?.intentId ?? \"unknown\",\n decisionCount: 0,\n workflowAuthorityCount: 0,\n shadowEquivalentCount: 0,\n workflowDiffersCount: 0,\n workflowBlockedCount: 0,\n expectedClarificationBlockCount: 0,\n selectionNotExercisedCount: 0,\n workflowUnavailableCount: 0,\n warningCount: 0,\n workflowAuthorityConfirmed: false,\n readyForWorkflowAuthority: false,\n };\n\n return {\n ...intentReadiness,\n segmentKey,\n hop: base?.hop ?? null,\n selectedReason: base?.selectedReason ?? null,\n };\n })\n .sort((left, right) => {\n if (left.readyForWorkflowAuthority !== right.readyForWorkflowAuthority) {\n return left.readyForWorkflowAuthority ? -1 : 1;\n }\n if (left.workflowAuthorityConfirmed !== right.workflowAuthorityConfirmed) {\n return left.workflowAuthorityConfirmed ? -1 : 1;\n }\n if (right.shadowEquivalentCount !== left.shadowEquivalentCount) {\n return right.shadowEquivalentCount - left.shadowEquivalentCount;\n }\n if (right.decisionCount !== left.decisionCount) return right.decisionCount - left.decisionCount;\n return left.segmentKey.localeCompare(right.segmentKey);\n });\n}\n\nfunction buildSegmentKey(row: AssistantWorkflowToolSelectionEvaluation): string {\n return buildAssistantWorkflowToolSelectionSegmentKey({\n intentId: row.intentId,\n hop: row.hop,\n selectedReason: row.selectedReason,\n });\n}\n\nfunction buildStringCounts(values: readonly string[]): AssistantWorkflowToolSelectionEvaluationBatchCount[] {\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 uniqueStrings(values: readonly string[]): string[] {\n const out: string[] = [];\n const seen = new Set<string>();\n for (const value of values) {\n const trimmed = value.trim();\n if (!trimmed.length || seen.has(trimmed)) continue;\n seen.add(trimmed);\n out.push(trimmed);\n }\n return out;\n}\n\nfunction buildSignalCounts(\n signals: readonly AssistantWorkflowToolSelectionEvaluationSignal[],\n): AssistantWorkflowToolSelectionEvaluationBatchSignalCount[] {\n const counts = new Map<string, AssistantWorkflowToolSelectionEvaluationBatchSignalCount>();\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 readStringArray(value: AssistantWorkflowJsonValue | undefined): string[] {\n return readAssistantWorkflowStringArray(value, {\n trim: false,\n allowEmpty: true,\n unique: false,\n requireAllStrings: true,\n });\n}\n"]}
|
|
@@ -242,6 +242,7 @@ function isAuthorityReason(value) {
|
|
|
242
242
|
value === "workflow_unavailable" ||
|
|
243
243
|
value === "workflow_authority_not_enabled" ||
|
|
244
244
|
value === "workflow_blocked" ||
|
|
245
|
+
value === "workflow_selection_not_exercised" ||
|
|
245
246
|
value === "workflow_differs");
|
|
246
247
|
}
|
|
247
248
|
function isStringArray(value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-selection-json.js","sourceRoot":"","sources":["../src/tool-selection-json.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,qDAAqD,GAAG,CAAC,CAAC;AAsEvE,MAAM,UAAU,+CAA+C,CAC7D,QAAgD;IAEhD,OAAO;QACL,aAAa,EAAE,qDAAqD;QACpE,SAAS,EAAE;YACT,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC,MAAM;YACjC,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC,MAAM;YACjC,iBAAiB,EAAE,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,iBAAiB,CAAC;YAC5D,0BAA0B,EAAE,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,0BAA0B,CAAC;YAC9E,cAAc,EAAE,QAAQ,CAAC,SAAS,CAAC,cAAc;SAClD;QACD,kBAAkB,EAAE,CAAC,GAAG,QAAQ,CAAC,kBAAkB,CAAC;QACpD,eAAe,EAAE,QAAQ,CAAC,eAAe;QACzC,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,iBAAiB,CAAC;KACzG,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,+CAA+C,CAC7D,QAA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C7B,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC","sourcesContent":["import type { AssistantWorkflowJsonValue } from \"./run-report-json.js\";\nimport type {\n AssistantWorkflowToolSelectionAuthority,\n AssistantWorkflowToolSelectionAuthorityReason,\n AssistantWorkflowToolSelectionAuthoritySource,\n AssistantWorkflowToolSelectionDecision,\n} from \"./tool-selection-policy.js\";\n\nexport const ASSISTANT_WORKFLOW_TOOL_SELECTION_JSON_SCHEMA_VERSION = 1;\n\nexport type AssistantWorkflowSerializedToolSelectionDecision = {\n schemaVersion: typeof ASSISTANT_WORKFLOW_TOOL_SELECTION_JSON_SCHEMA_VERSION;\n authority: AssistantWorkflowToolSelectionAuthority;\n effectiveToolNames: string[];\n effectiveReason: string | null;\n comparisonPayload: Record<string, AssistantWorkflowJsonValue> | null;\n};\n\nexport type AssistantWorkflowSerializedToolSelectionDecisionLineErrorReason =\n | \"invalid_json\"\n | \"invalid_tool_selection\";\n\nexport type AssistantWorkflowSerializedToolSelectionDecisionLineError = {\n lineNumber: number;\n reason: AssistantWorkflowSerializedToolSelectionDecisionLineErrorReason;\n preview: string;\n};\n\nexport type AssistantWorkflowSerializedToolSelectionDecisionLinesParseResult = {\n lineCount: number;\n decisionCount: number;\n errorCount: number;\n decisions: AssistantWorkflowSerializedToolSelectionDecision[];\n errors: AssistantWorkflowSerializedToolSelectionDecisionLineError[];\n};\n\nexport type AssistantWorkflowSerializedToolSelectionDecisionLinesOptions = {\n trailingNewline?: boolean;\n};\n\nexport type AssistantWorkflowSerializedToolSelectionDecisionBatchOptions = {\n generatedAt?: string;\n onlyInteresting?: boolean;\n};\n\nexport type AssistantWorkflowSerializedToolSelectionDecisionBatchCount = {\n key: string;\n count: number;\n};\n\nexport type AssistantWorkflowSerializedToolSelectionDecisionBatchSummary = {\n generatedAt: string;\n sourceDecisionCount: number;\n decisionCount: number;\n interestingDecisionCount: number;\n workflowAuthorityCount: number;\n legacyAuthorityCount: number;\n authoritySourceCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];\n authorityReasonCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];\n workflowStatusCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];\n effectiveReasonCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];\n optionalToolModeCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];\n workflowSelectionProfileCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];\n workflowSelectionProfileToolCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];\n effectiveToolCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];\n workflowSuggestedToolCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];\n workflowSelectionCandidateToolCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];\n};\n\nexport type AssistantWorkflowSerializedToolSelectionDecisionBatch = {\n schemaVersion: typeof ASSISTANT_WORKFLOW_TOOL_SELECTION_JSON_SCHEMA_VERSION;\n generatedAt: string;\n sourceDecisionCount: number;\n decisionCount: number;\n summary: AssistantWorkflowSerializedToolSelectionDecisionBatchSummary;\n decisions: AssistantWorkflowSerializedToolSelectionDecision[];\n};\n\nexport function serializeAssistantWorkflowToolSelectionDecision(\n decision: AssistantWorkflowToolSelectionDecision,\n): AssistantWorkflowSerializedToolSelectionDecision {\n return {\n schemaVersion: ASSISTANT_WORKFLOW_TOOL_SELECTION_JSON_SCHEMA_VERSION,\n authority: {\n source: decision.authority.source,\n reason: decision.authority.reason,\n selectedToolNames: [...decision.authority.selectedToolNames],\n workflowSuggestedToolNames: [...decision.authority.workflowSuggestedToolNames],\n workflowStatus: decision.authority.workflowStatus,\n },\n effectiveToolNames: [...decision.effectiveToolNames],\n effectiveReason: decision.effectiveReason,\n comparisonPayload: decision.comparisonPayload === null ? null : toJsonRecord(decision.comparisonPayload),\n };\n}\n\nexport function stringifyAssistantWorkflowToolSelectionDecision(\n decision: AssistantWorkflowToolSelectionDecision,\n space?: number,\n): string {\n return JSON.stringify(serializeAssistantWorkflowToolSelectionDecision(decision), null, space);\n}\n\nexport function stringifyAssistantWorkflowToolSelectionDecisionLines(\n decisions: readonly AssistantWorkflowToolSelectionDecision[],\n options: AssistantWorkflowSerializedToolSelectionDecisionLinesOptions = {},\n): string {\n return stringifyAssistantWorkflowSerializedToolSelectionDecisionLines(\n decisions.map(serializeAssistantWorkflowToolSelectionDecision),\n options,\n );\n}\n\nexport function stringifyAssistantWorkflowSerializedToolSelectionDecisionLines(\n decisions: readonly AssistantWorkflowSerializedToolSelectionDecision[],\n options: AssistantWorkflowSerializedToolSelectionDecisionLinesOptions = {},\n): string {\n const lines = decisions.map((decision) => JSON.stringify(decision));\n if (!lines.length) return \"\";\n return options.trailingNewline === true ? `${lines.join(\"\\n\")}\\n` : lines.join(\"\\n\");\n}\n\nexport function serializeAssistantWorkflowToolSelectionDecisions(\n decisions: readonly AssistantWorkflowToolSelectionDecision[],\n options: AssistantWorkflowSerializedToolSelectionDecisionBatchOptions = {},\n): AssistantWorkflowSerializedToolSelectionDecisionBatch {\n const allDecisions = decisions.map(serializeAssistantWorkflowToolSelectionDecision);\n return buildAssistantWorkflowSerializedToolSelectionDecisionBatch(allDecisions, options);\n}\n\nexport function buildAssistantWorkflowSerializedToolSelectionDecisionBatch(\n allDecisions: readonly AssistantWorkflowSerializedToolSelectionDecision[],\n options: AssistantWorkflowSerializedToolSelectionDecisionBatchOptions = {},\n): AssistantWorkflowSerializedToolSelectionDecisionBatch {\n const decisions = options.onlyInteresting === true\n ? allDecisions.filter(isInterestingDecision)\n : [...allDecisions];\n const generatedAt = normalizeGeneratedAt(options.generatedAt) ?? new Date().toISOString();\n const summary = buildSerializedDecisionBatchSummary(allDecisions, decisions, generatedAt);\n\n return {\n schemaVersion: ASSISTANT_WORKFLOW_TOOL_SELECTION_JSON_SCHEMA_VERSION,\n generatedAt,\n sourceDecisionCount: allDecisions.length,\n decisionCount: decisions.length,\n summary,\n decisions,\n };\n}\n\nexport function stringifyAssistantWorkflowToolSelectionDecisions(\n decisions: readonly AssistantWorkflowToolSelectionDecision[],\n options: AssistantWorkflowSerializedToolSelectionDecisionBatchOptions = {},\n space?: number,\n): string {\n return JSON.stringify(serializeAssistantWorkflowToolSelectionDecisions(decisions, options), null, space);\n}\n\nexport function parseAssistantWorkflowSerializedToolSelectionDecision(\n value: unknown,\n): AssistantWorkflowSerializedToolSelectionDecision | null {\n if (!isRecord(value)) return null;\n if (value[\"schemaVersion\"] !== ASSISTANT_WORKFLOW_TOOL_SELECTION_JSON_SCHEMA_VERSION) return null;\n const authority = parseToolSelectionAuthority(value[\"authority\"]);\n if (!authority) return null;\n if (!isStringArray(value[\"effectiveToolNames\"])) return null;\n if (value[\"effectiveReason\"] !== null && typeof value[\"effectiveReason\"] !== \"string\") return null;\n if (value[\"comparisonPayload\"] !== null && !isJsonRecord(value[\"comparisonPayload\"])) return null;\n\n return {\n schemaVersion: ASSISTANT_WORKFLOW_TOOL_SELECTION_JSON_SCHEMA_VERSION,\n authority,\n effectiveToolNames: value[\"effectiveToolNames\"],\n effectiveReason: value[\"effectiveReason\"],\n comparisonPayload: value[\"comparisonPayload\"],\n };\n}\n\nexport function parseAssistantWorkflowSerializedToolSelectionDecisionLines(\n input: string,\n): AssistantWorkflowSerializedToolSelectionDecisionLinesParseResult {\n const decisions: AssistantWorkflowSerializedToolSelectionDecision[] = [];\n const errors: AssistantWorkflowSerializedToolSelectionDecisionLineError[] = [];\n let lineCount = 0;\n\n for (const [index, line] of input.split(/\\r?\\n/).entries()) {\n const trimmed = line.trim();\n if (!trimmed.length) continue;\n const lineNumber = index + 1;\n lineCount += 1;\n\n let parsed: unknown;\n try {\n parsed = JSON.parse(trimmed);\n } catch {\n errors.push({\n lineNumber,\n reason: \"invalid_json\",\n preview: previewLine(trimmed),\n });\n continue;\n }\n\n const decision = parseAssistantWorkflowSerializedToolSelectionDecision(parsed);\n if (!decision) {\n errors.push({\n lineNumber,\n reason: \"invalid_tool_selection\",\n preview: previewLine(trimmed),\n });\n continue;\n }\n decisions.push(decision);\n }\n\n return {\n lineCount,\n decisionCount: decisions.length,\n errorCount: errors.length,\n decisions,\n errors,\n };\n}\n\nexport function parseAssistantWorkflowSerializedToolSelectionDecisionBatch(\n value: unknown,\n): AssistantWorkflowSerializedToolSelectionDecisionBatch | null {\n if (!isRecord(value)) return null;\n if (value[\"schemaVersion\"] !== ASSISTANT_WORKFLOW_TOOL_SELECTION_JSON_SCHEMA_VERSION) return null;\n if (typeof value[\"generatedAt\"] !== \"string\" || !value[\"generatedAt\"].trim().length) return null;\n if (!isNonNegativeFiniteNumber(value[\"sourceDecisionCount\"])) return null;\n if (!isNonNegativeFiniteNumber(value[\"decisionCount\"])) return null;\n if (!isDecisionBatchSummary(value[\"summary\"])) return null;\n if (!Array.isArray(value[\"decisions\"])) return null;\n\n const decisions = value[\"decisions\"].map(parseAssistantWorkflowSerializedToolSelectionDecision);\n if (decisions.some((decision) => decision === null)) return null;\n if (decisions.length !== value[\"decisionCount\"]) return null;\n\n return {\n schemaVersion: ASSISTANT_WORKFLOW_TOOL_SELECTION_JSON_SCHEMA_VERSION,\n generatedAt: value[\"generatedAt\"],\n sourceDecisionCount: value[\"sourceDecisionCount\"],\n decisionCount: value[\"decisionCount\"],\n summary: value[\"summary\"],\n decisions: decisions.filter((decision): decision is AssistantWorkflowSerializedToolSelectionDecision => decision !== null),\n };\n}\n\nfunction buildSerializedDecisionBatchSummary(\n allDecisions: readonly AssistantWorkflowSerializedToolSelectionDecision[],\n decisions: readonly AssistantWorkflowSerializedToolSelectionDecision[],\n generatedAt: string,\n): AssistantWorkflowSerializedToolSelectionDecisionBatchSummary {\n return {\n generatedAt,\n sourceDecisionCount: allDecisions.length,\n decisionCount: decisions.length,\n interestingDecisionCount: decisions.filter(isInterestingDecision).length,\n workflowAuthorityCount: decisions.filter((decision) => decision.authority.source === \"workflow\").length,\n legacyAuthorityCount: decisions.filter((decision) => decision.authority.source === \"legacy-pruner\").length,\n authoritySourceCounts: buildStringCounts(decisions.map((decision) => decision.authority.source)),\n authorityReasonCounts: buildStringCounts(decisions.map((decision) => decision.authority.reason)),\n workflowStatusCounts: buildStringCounts(decisions.map((decision) => decision.authority.workflowStatus ?? \"none\")),\n effectiveReasonCounts: buildStringCounts(decisions.map((decision) => decision.effectiveReason ?? \"none\")),\n optionalToolModeCounts: buildStringCounts(decisions.map((decision) =>\n readJsonString(decision.comparisonPayload?.[\"workflowSelectionOptionalToolMode\"]) ?? \"none\"\n )),\n workflowSelectionProfileCounts: buildStringCounts(decisions.flatMap((decision) =>\n readJsonStringArray(decision.comparisonPayload?.[\"workflowSelectionActiveProfileIds\"])\n )),\n workflowSelectionProfileToolCounts: buildStringCounts(decisions.flatMap((decision) =>\n readJsonStringArray(decision.comparisonPayload?.[\"workflowSelectionProfileTools\"])\n )),\n effectiveToolCounts: buildStringCounts(decisions.flatMap((decision) => decision.effectiveToolNames)),\n workflowSuggestedToolCounts: buildStringCounts(decisions.flatMap((decision) =>\n decision.authority.workflowSuggestedToolNames\n )),\n workflowSelectionCandidateToolCounts: buildStringCounts(decisions.flatMap((decision) =>\n readJsonStringArray(decision.comparisonPayload?.[\"workflowSelectionCandidateTools\"])\n )),\n };\n}\n\nfunction isInterestingDecision(decision: AssistantWorkflowSerializedToolSelectionDecision): boolean {\n return decision.authority.source !== \"workflow\";\n}\n\nfunction buildStringCounts(values: readonly string[]): AssistantWorkflowSerializedToolSelectionDecisionBatchCount[] {\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 isDecisionBatchSummary(value: unknown): value is AssistantWorkflowSerializedToolSelectionDecisionBatchSummary {\n if (!isRecord(value)) return false;\n return (\n typeof value[\"generatedAt\"] === \"string\" &&\n isNonNegativeFiniteNumber(value[\"sourceDecisionCount\"]) &&\n isNonNegativeFiniteNumber(value[\"decisionCount\"]) &&\n isNonNegativeFiniteNumber(value[\"interestingDecisionCount\"]) &&\n isNonNegativeFiniteNumber(value[\"workflowAuthorityCount\"]) &&\n isNonNegativeFiniteNumber(value[\"legacyAuthorityCount\"]) &&\n isCountArray(value[\"authoritySourceCounts\"]) &&\n isCountArray(value[\"authorityReasonCounts\"]) &&\n isCountArray(value[\"workflowStatusCounts\"]) &&\n isCountArray(value[\"effectiveReasonCounts\"]) &&\n isCountArray(value[\"optionalToolModeCounts\"]) &&\n isCountArray(value[\"workflowSelectionProfileCounts\"]) &&\n isCountArray(value[\"workflowSelectionProfileToolCounts\"]) &&\n isCountArray(value[\"effectiveToolCounts\"]) &&\n isCountArray(value[\"workflowSuggestedToolCounts\"]) &&\n isCountArray(value[\"workflowSelectionCandidateToolCounts\"])\n );\n}\n\nfunction isCountArray(value: unknown): value is AssistantWorkflowSerializedToolSelectionDecisionBatchCount[] {\n return Array.isArray(value) && value.every((item) =>\n isRecord(item) &&\n typeof item[\"key\"] === \"string\" &&\n isNonNegativeFiniteNumber(item[\"count\"])\n );\n}\n\nfunction normalizeGeneratedAt(value: string | undefined): string | null {\n if (value === undefined) return null;\n const trimmed = value.trim();\n return trimmed.length ? trimmed : null;\n}\n\nfunction isNonNegativeFiniteNumber(value: unknown): value is number {\n return typeof value === \"number\" && Number.isFinite(value) && value >= 0;\n}\n\nfunction parseToolSelectionAuthority(value: unknown): AssistantWorkflowToolSelectionAuthority | null {\n if (!isRecord(value)) return null;\n if (!isAuthoritySource(value[\"source\"])) return null;\n if (!isAuthorityReason(value[\"reason\"])) return null;\n if (!isStringArray(value[\"selectedToolNames\"])) return null;\n if (!isStringArray(value[\"workflowSuggestedToolNames\"])) return null;\n if (value[\"workflowStatus\"] !== null && typeof value[\"workflowStatus\"] !== \"string\") return null;\n\n return {\n source: value[\"source\"],\n reason: value[\"reason\"],\n selectedToolNames: value[\"selectedToolNames\"],\n workflowSuggestedToolNames: value[\"workflowSuggestedToolNames\"],\n workflowStatus: value[\"workflowStatus\"],\n };\n}\n\nfunction isAuthoritySource(value: unknown): value is AssistantWorkflowToolSelectionAuthoritySource {\n return value === \"workflow\" || value === \"legacy-pruner\";\n}\n\nfunction isAuthorityReason(value: unknown): value is AssistantWorkflowToolSelectionAuthorityReason {\n return (\n value === \"workflow_equivalent\" ||\n value === \"workflow_authority_enabled\" ||\n value === \"workflow_unavailable\" ||\n value === \"workflow_authority_not_enabled\" ||\n value === \"workflow_blocked\" ||\n value === \"workflow_differs\"\n );\n}\n\nfunction isStringArray(value: unknown): value is string[] {\n return Array.isArray(value) && value.every((item) => typeof item === \"string\");\n}\n\nfunction previewLine(line: string): string {\n return line.length <= 160 ? line : `${line.slice(0, 157)}...`;\n}\n\nfunction readJsonString(value: AssistantWorkflowJsonValue | undefined): string | null {\n return typeof value === \"string\" ? value : null;\n}\n\nfunction readJsonStringArray(value: AssistantWorkflowJsonValue | undefined): string[] {\n return Array.isArray(value) && value.every((item) => typeof item === \"string\") ? value : [];\n}\n\nfunction toJsonRecord(value: unknown): Record<string, AssistantWorkflowJsonValue> {\n if (!isJsonRecord(value)) {\n throw new Error(\"Assistant workflow tool-selection payload must be a JSON object.\");\n }\n return value;\n}\n\nfunction isJsonRecord(value: unknown): value is Record<string, AssistantWorkflowJsonValue> {\n if (!isRecord(value)) return false;\n return Object.values(value).every(isJsonValue);\n}\n\nfunction isJsonValue(value: unknown): value is AssistantWorkflowJsonValue {\n if (value === null) return true;\n if (typeof value === \"string\" || typeof value === \"boolean\") return true;\n if (typeof value === \"number\") return Number.isFinite(value);\n if (Array.isArray(value)) return value.every(isJsonValue);\n return isJsonRecord(value);\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tool-selection-json.js","sourceRoot":"","sources":["../src/tool-selection-json.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,qDAAqD,GAAG,CAAC,CAAC;AAsEvE,MAAM,UAAU,+CAA+C,CAC7D,QAAgD;IAEhD,OAAO;QACL,aAAa,EAAE,qDAAqD;QACpE,SAAS,EAAE;YACT,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC,MAAM;YACjC,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC,MAAM;YACjC,iBAAiB,EAAE,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,iBAAiB,CAAC;YAC5D,0BAA0B,EAAE,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,0BAA0B,CAAC;YAC9E,cAAc,EAAE,QAAQ,CAAC,SAAS,CAAC,cAAc;SAClD;QACD,kBAAkB,EAAE,CAAC,GAAG,QAAQ,CAAC,kBAAkB,CAAC;QACpD,eAAe,EAAE,QAAQ,CAAC,eAAe;QACzC,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,iBAAiB,CAAC;KACzG,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,+CAA+C,CAC7D,QAAgD,EAChD,KAAc;IAEd,OAAO,IAAI,CAAC,SAAS,CAAC,+CAA+C,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AAChG,CAAC;AAED,MAAM,UAAU,oDAAoD,CAClE,SAA4D,EAC5D,UAAwE,EAAE;IAE1E,OAAO,8DAA8D,CACnE,SAAS,CAAC,GAAG,CAAC,+CAA+C,CAAC,EAC9D,OAAO,CACR,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,8DAA8D,CAC5E,SAAsE,EACtE,UAAwE,EAAE;IAE1E,MAAM,KAAK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,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAC9F,CAAC;AAED,SAAS,YAAY,CAAC,KAAc;IAClC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;IACtF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,YAAY,CAAC,KAAc;IAClC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACnC,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;AACjD,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IACjC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACzE,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC7D,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC1D,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC","sourcesContent":["import type { AssistantWorkflowJsonValue } from \"./run-report-json.js\";\nimport type {\n AssistantWorkflowToolSelectionAuthority,\n AssistantWorkflowToolSelectionAuthorityReason,\n AssistantWorkflowToolSelectionAuthoritySource,\n AssistantWorkflowToolSelectionDecision,\n} from \"./tool-selection-policy.js\";\n\nexport const ASSISTANT_WORKFLOW_TOOL_SELECTION_JSON_SCHEMA_VERSION = 1;\n\nexport type AssistantWorkflowSerializedToolSelectionDecision = {\n schemaVersion: typeof ASSISTANT_WORKFLOW_TOOL_SELECTION_JSON_SCHEMA_VERSION;\n authority: AssistantWorkflowToolSelectionAuthority;\n effectiveToolNames: string[];\n effectiveReason: string | null;\n comparisonPayload: Record<string, AssistantWorkflowJsonValue> | null;\n};\n\nexport type AssistantWorkflowSerializedToolSelectionDecisionLineErrorReason =\n | \"invalid_json\"\n | \"invalid_tool_selection\";\n\nexport type AssistantWorkflowSerializedToolSelectionDecisionLineError = {\n lineNumber: number;\n reason: AssistantWorkflowSerializedToolSelectionDecisionLineErrorReason;\n preview: string;\n};\n\nexport type AssistantWorkflowSerializedToolSelectionDecisionLinesParseResult = {\n lineCount: number;\n decisionCount: number;\n errorCount: number;\n decisions: AssistantWorkflowSerializedToolSelectionDecision[];\n errors: AssistantWorkflowSerializedToolSelectionDecisionLineError[];\n};\n\nexport type AssistantWorkflowSerializedToolSelectionDecisionLinesOptions = {\n trailingNewline?: boolean;\n};\n\nexport type AssistantWorkflowSerializedToolSelectionDecisionBatchOptions = {\n generatedAt?: string;\n onlyInteresting?: boolean;\n};\n\nexport type AssistantWorkflowSerializedToolSelectionDecisionBatchCount = {\n key: string;\n count: number;\n};\n\nexport type AssistantWorkflowSerializedToolSelectionDecisionBatchSummary = {\n generatedAt: string;\n sourceDecisionCount: number;\n decisionCount: number;\n interestingDecisionCount: number;\n workflowAuthorityCount: number;\n legacyAuthorityCount: number;\n authoritySourceCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];\n authorityReasonCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];\n workflowStatusCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];\n effectiveReasonCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];\n optionalToolModeCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];\n workflowSelectionProfileCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];\n workflowSelectionProfileToolCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];\n effectiveToolCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];\n workflowSuggestedToolCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];\n workflowSelectionCandidateToolCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];\n};\n\nexport type AssistantWorkflowSerializedToolSelectionDecisionBatch = {\n schemaVersion: typeof ASSISTANT_WORKFLOW_TOOL_SELECTION_JSON_SCHEMA_VERSION;\n generatedAt: string;\n sourceDecisionCount: number;\n decisionCount: number;\n summary: AssistantWorkflowSerializedToolSelectionDecisionBatchSummary;\n decisions: AssistantWorkflowSerializedToolSelectionDecision[];\n};\n\nexport function serializeAssistantWorkflowToolSelectionDecision(\n decision: AssistantWorkflowToolSelectionDecision,\n): AssistantWorkflowSerializedToolSelectionDecision {\n return {\n schemaVersion: ASSISTANT_WORKFLOW_TOOL_SELECTION_JSON_SCHEMA_VERSION,\n authority: {\n source: decision.authority.source,\n reason: decision.authority.reason,\n selectedToolNames: [...decision.authority.selectedToolNames],\n workflowSuggestedToolNames: [...decision.authority.workflowSuggestedToolNames],\n workflowStatus: decision.authority.workflowStatus,\n },\n effectiveToolNames: [...decision.effectiveToolNames],\n effectiveReason: decision.effectiveReason,\n comparisonPayload: decision.comparisonPayload === null ? null : toJsonRecord(decision.comparisonPayload),\n };\n}\n\nexport function stringifyAssistantWorkflowToolSelectionDecision(\n decision: AssistantWorkflowToolSelectionDecision,\n space?: number,\n): string {\n return JSON.stringify(serializeAssistantWorkflowToolSelectionDecision(decision), null, space);\n}\n\nexport function stringifyAssistantWorkflowToolSelectionDecisionLines(\n decisions: readonly AssistantWorkflowToolSelectionDecision[],\n options: AssistantWorkflowSerializedToolSelectionDecisionLinesOptions = {},\n): string {\n return stringifyAssistantWorkflowSerializedToolSelectionDecisionLines(\n decisions.map(serializeAssistantWorkflowToolSelectionDecision),\n options,\n );\n}\n\nexport function stringifyAssistantWorkflowSerializedToolSelectionDecisionLines(\n decisions: readonly AssistantWorkflowSerializedToolSelectionDecision[],\n options: AssistantWorkflowSerializedToolSelectionDecisionLinesOptions = {},\n): string {\n const lines = decisions.map((decision) => JSON.stringify(decision));\n if (!lines.length) return \"\";\n return options.trailingNewline === true ? `${lines.join(\"\\n\")}\\n` : lines.join(\"\\n\");\n}\n\nexport function serializeAssistantWorkflowToolSelectionDecisions(\n decisions: readonly AssistantWorkflowToolSelectionDecision[],\n options: AssistantWorkflowSerializedToolSelectionDecisionBatchOptions = {},\n): AssistantWorkflowSerializedToolSelectionDecisionBatch {\n const allDecisions = decisions.map(serializeAssistantWorkflowToolSelectionDecision);\n return buildAssistantWorkflowSerializedToolSelectionDecisionBatch(allDecisions, options);\n}\n\nexport function buildAssistantWorkflowSerializedToolSelectionDecisionBatch(\n allDecisions: readonly AssistantWorkflowSerializedToolSelectionDecision[],\n options: AssistantWorkflowSerializedToolSelectionDecisionBatchOptions = {},\n): AssistantWorkflowSerializedToolSelectionDecisionBatch {\n const decisions = options.onlyInteresting === true\n ? allDecisions.filter(isInterestingDecision)\n : [...allDecisions];\n const generatedAt = normalizeGeneratedAt(options.generatedAt) ?? new Date().toISOString();\n const summary = buildSerializedDecisionBatchSummary(allDecisions, decisions, generatedAt);\n\n return {\n schemaVersion: ASSISTANT_WORKFLOW_TOOL_SELECTION_JSON_SCHEMA_VERSION,\n generatedAt,\n sourceDecisionCount: allDecisions.length,\n decisionCount: decisions.length,\n summary,\n decisions,\n };\n}\n\nexport function stringifyAssistantWorkflowToolSelectionDecisions(\n decisions: readonly AssistantWorkflowToolSelectionDecision[],\n options: AssistantWorkflowSerializedToolSelectionDecisionBatchOptions = {},\n space?: number,\n): string {\n return JSON.stringify(serializeAssistantWorkflowToolSelectionDecisions(decisions, options), null, space);\n}\n\nexport function parseAssistantWorkflowSerializedToolSelectionDecision(\n value: unknown,\n): AssistantWorkflowSerializedToolSelectionDecision | null {\n if (!isRecord(value)) return null;\n if (value[\"schemaVersion\"] !== ASSISTANT_WORKFLOW_TOOL_SELECTION_JSON_SCHEMA_VERSION) return null;\n const authority = parseToolSelectionAuthority(value[\"authority\"]);\n if (!authority) return null;\n if (!isStringArray(value[\"effectiveToolNames\"])) return null;\n if (value[\"effectiveReason\"] !== null && typeof value[\"effectiveReason\"] !== \"string\") return null;\n if (value[\"comparisonPayload\"] !== null && !isJsonRecord(value[\"comparisonPayload\"])) return null;\n\n return {\n schemaVersion: ASSISTANT_WORKFLOW_TOOL_SELECTION_JSON_SCHEMA_VERSION,\n authority,\n effectiveToolNames: value[\"effectiveToolNames\"],\n effectiveReason: value[\"effectiveReason\"],\n comparisonPayload: value[\"comparisonPayload\"],\n };\n}\n\nexport function parseAssistantWorkflowSerializedToolSelectionDecisionLines(\n input: string,\n): AssistantWorkflowSerializedToolSelectionDecisionLinesParseResult {\n const decisions: AssistantWorkflowSerializedToolSelectionDecision[] = [];\n const errors: AssistantWorkflowSerializedToolSelectionDecisionLineError[] = [];\n let lineCount = 0;\n\n for (const [index, line] of input.split(/\\r?\\n/).entries()) {\n const trimmed = line.trim();\n if (!trimmed.length) continue;\n const lineNumber = index + 1;\n lineCount += 1;\n\n let parsed: unknown;\n try {\n parsed = JSON.parse(trimmed);\n } catch {\n errors.push({\n lineNumber,\n reason: \"invalid_json\",\n preview: previewLine(trimmed),\n });\n continue;\n }\n\n const decision = parseAssistantWorkflowSerializedToolSelectionDecision(parsed);\n if (!decision) {\n errors.push({\n lineNumber,\n reason: \"invalid_tool_selection\",\n preview: previewLine(trimmed),\n });\n continue;\n }\n decisions.push(decision);\n }\n\n return {\n lineCount,\n decisionCount: decisions.length,\n errorCount: errors.length,\n decisions,\n errors,\n };\n}\n\nexport function parseAssistantWorkflowSerializedToolSelectionDecisionBatch(\n value: unknown,\n): AssistantWorkflowSerializedToolSelectionDecisionBatch | null {\n if (!isRecord(value)) return null;\n if (value[\"schemaVersion\"] !== ASSISTANT_WORKFLOW_TOOL_SELECTION_JSON_SCHEMA_VERSION) return null;\n if (typeof value[\"generatedAt\"] !== \"string\" || !value[\"generatedAt\"].trim().length) return null;\n if (!isNonNegativeFiniteNumber(value[\"sourceDecisionCount\"])) return null;\n if (!isNonNegativeFiniteNumber(value[\"decisionCount\"])) return null;\n if (!isDecisionBatchSummary(value[\"summary\"])) return null;\n if (!Array.isArray(value[\"decisions\"])) return null;\n\n const decisions = value[\"decisions\"].map(parseAssistantWorkflowSerializedToolSelectionDecision);\n if (decisions.some((decision) => decision === null)) return null;\n if (decisions.length !== value[\"decisionCount\"]) return null;\n\n return {\n schemaVersion: ASSISTANT_WORKFLOW_TOOL_SELECTION_JSON_SCHEMA_VERSION,\n generatedAt: value[\"generatedAt\"],\n sourceDecisionCount: value[\"sourceDecisionCount\"],\n decisionCount: value[\"decisionCount\"],\n summary: value[\"summary\"],\n decisions: decisions.filter((decision): decision is AssistantWorkflowSerializedToolSelectionDecision => decision !== null),\n };\n}\n\nfunction buildSerializedDecisionBatchSummary(\n allDecisions: readonly AssistantWorkflowSerializedToolSelectionDecision[],\n decisions: readonly AssistantWorkflowSerializedToolSelectionDecision[],\n generatedAt: string,\n): AssistantWorkflowSerializedToolSelectionDecisionBatchSummary {\n return {\n generatedAt,\n sourceDecisionCount: allDecisions.length,\n decisionCount: decisions.length,\n interestingDecisionCount: decisions.filter(isInterestingDecision).length,\n workflowAuthorityCount: decisions.filter((decision) => decision.authority.source === \"workflow\").length,\n legacyAuthorityCount: decisions.filter((decision) => decision.authority.source === \"legacy-pruner\").length,\n authoritySourceCounts: buildStringCounts(decisions.map((decision) => decision.authority.source)),\n authorityReasonCounts: buildStringCounts(decisions.map((decision) => decision.authority.reason)),\n workflowStatusCounts: buildStringCounts(decisions.map((decision) => decision.authority.workflowStatus ?? \"none\")),\n effectiveReasonCounts: buildStringCounts(decisions.map((decision) => decision.effectiveReason ?? \"none\")),\n optionalToolModeCounts: buildStringCounts(decisions.map((decision) =>\n readJsonString(decision.comparisonPayload?.[\"workflowSelectionOptionalToolMode\"]) ?? \"none\"\n )),\n workflowSelectionProfileCounts: buildStringCounts(decisions.flatMap((decision) =>\n readJsonStringArray(decision.comparisonPayload?.[\"workflowSelectionActiveProfileIds\"])\n )),\n workflowSelectionProfileToolCounts: buildStringCounts(decisions.flatMap((decision) =>\n readJsonStringArray(decision.comparisonPayload?.[\"workflowSelectionProfileTools\"])\n )),\n effectiveToolCounts: buildStringCounts(decisions.flatMap((decision) => decision.effectiveToolNames)),\n workflowSuggestedToolCounts: buildStringCounts(decisions.flatMap((decision) =>\n decision.authority.workflowSuggestedToolNames\n )),\n workflowSelectionCandidateToolCounts: buildStringCounts(decisions.flatMap((decision) =>\n readJsonStringArray(decision.comparisonPayload?.[\"workflowSelectionCandidateTools\"])\n )),\n };\n}\n\nfunction isInterestingDecision(decision: AssistantWorkflowSerializedToolSelectionDecision): boolean {\n return decision.authority.source !== \"workflow\";\n}\n\nfunction buildStringCounts(values: readonly string[]): AssistantWorkflowSerializedToolSelectionDecisionBatchCount[] {\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 isDecisionBatchSummary(value: unknown): value is AssistantWorkflowSerializedToolSelectionDecisionBatchSummary {\n if (!isRecord(value)) return false;\n return (\n typeof value[\"generatedAt\"] === \"string\" &&\n isNonNegativeFiniteNumber(value[\"sourceDecisionCount\"]) &&\n isNonNegativeFiniteNumber(value[\"decisionCount\"]) &&\n isNonNegativeFiniteNumber(value[\"interestingDecisionCount\"]) &&\n isNonNegativeFiniteNumber(value[\"workflowAuthorityCount\"]) &&\n isNonNegativeFiniteNumber(value[\"legacyAuthorityCount\"]) &&\n isCountArray(value[\"authoritySourceCounts\"]) &&\n isCountArray(value[\"authorityReasonCounts\"]) &&\n isCountArray(value[\"workflowStatusCounts\"]) &&\n isCountArray(value[\"effectiveReasonCounts\"]) &&\n isCountArray(value[\"optionalToolModeCounts\"]) &&\n isCountArray(value[\"workflowSelectionProfileCounts\"]) &&\n isCountArray(value[\"workflowSelectionProfileToolCounts\"]) &&\n isCountArray(value[\"effectiveToolCounts\"]) &&\n isCountArray(value[\"workflowSuggestedToolCounts\"]) &&\n isCountArray(value[\"workflowSelectionCandidateToolCounts\"])\n );\n}\n\nfunction isCountArray(value: unknown): value is AssistantWorkflowSerializedToolSelectionDecisionBatchCount[] {\n return Array.isArray(value) && value.every((item) =>\n isRecord(item) &&\n typeof item[\"key\"] === \"string\" &&\n isNonNegativeFiniteNumber(item[\"count\"])\n );\n}\n\nfunction normalizeGeneratedAt(value: string | undefined): string | null {\n if (value === undefined) return null;\n const trimmed = value.trim();\n return trimmed.length ? trimmed : null;\n}\n\nfunction isNonNegativeFiniteNumber(value: unknown): value is number {\n return typeof value === \"number\" && Number.isFinite(value) && value >= 0;\n}\n\nfunction parseToolSelectionAuthority(value: unknown): AssistantWorkflowToolSelectionAuthority | null {\n if (!isRecord(value)) return null;\n if (!isAuthoritySource(value[\"source\"])) return null;\n if (!isAuthorityReason(value[\"reason\"])) return null;\n if (!isStringArray(value[\"selectedToolNames\"])) return null;\n if (!isStringArray(value[\"workflowSuggestedToolNames\"])) return null;\n if (value[\"workflowStatus\"] !== null && typeof value[\"workflowStatus\"] !== \"string\") return null;\n\n return {\n source: value[\"source\"],\n reason: value[\"reason\"],\n selectedToolNames: value[\"selectedToolNames\"],\n workflowSuggestedToolNames: value[\"workflowSuggestedToolNames\"],\n workflowStatus: value[\"workflowStatus\"],\n };\n}\n\nfunction isAuthoritySource(value: unknown): value is AssistantWorkflowToolSelectionAuthoritySource {\n return value === \"workflow\" || value === \"legacy-pruner\";\n}\n\nfunction isAuthorityReason(value: unknown): value is AssistantWorkflowToolSelectionAuthorityReason {\n return (\n value === \"workflow_equivalent\" ||\n value === \"workflow_authority_enabled\" ||\n value === \"workflow_unavailable\" ||\n value === \"workflow_authority_not_enabled\" ||\n value === \"workflow_blocked\" ||\n value === \"workflow_selection_not_exercised\" ||\n value === \"workflow_differs\"\n );\n}\n\nfunction isStringArray(value: unknown): value is string[] {\n return Array.isArray(value) && value.every((item) => typeof item === \"string\");\n}\n\nfunction previewLine(line: string): string {\n return line.length <= 160 ? line : `${line.slice(0, 157)}...`;\n}\n\nfunction readJsonString(value: AssistantWorkflowJsonValue | undefined): string | null {\n return typeof value === \"string\" ? value : null;\n}\n\nfunction readJsonStringArray(value: AssistantWorkflowJsonValue | undefined): string[] {\n return Array.isArray(value) && value.every((item) => typeof item === \"string\") ? value : [];\n}\n\nfunction toJsonRecord(value: unknown): Record<string, AssistantWorkflowJsonValue> {\n if (!isJsonRecord(value)) {\n throw new Error(\"Assistant workflow tool-selection payload must be a JSON object.\");\n }\n return value;\n}\n\nfunction isJsonRecord(value: unknown): value is Record<string, AssistantWorkflowJsonValue> {\n if (!isRecord(value)) return false;\n return Object.values(value).every(isJsonValue);\n}\n\nfunction isJsonValue(value: unknown): value is AssistantWorkflowJsonValue {\n if (value === null) return true;\n if (typeof value === \"string\" || typeof value === \"boolean\") return true;\n if (typeof value === \"number\") return Number.isFinite(value);\n if (Array.isArray(value)) return value.every(isJsonValue);\n return isJsonRecord(value);\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n"]}
|
|
@@ -14,7 +14,7 @@ export type AssistantWorkflowToolSelectionCandidate = {
|
|
|
14
14
|
};
|
|
15
15
|
export type AssistantWorkflowToolSelectionCandidateInput = {
|
|
16
16
|
workflow: AssistantWorkflowDefinition<string, string, string, string>;
|
|
17
|
-
decision: Pick<AssistantWorkflowDecision, "intent" | "classifierTools" | "requiredToolHints" | "toolHints" | "workflowSuggestedTools">;
|
|
17
|
+
decision: Pick<AssistantWorkflowDecision, "intent" | "subintent" | "classifierTools" | "requiredToolHints" | "toolHints" | "workflowSuggestedTools">;
|
|
18
18
|
availableToolNames?: readonly string[] | null;
|
|
19
19
|
hop?: number | null;
|
|
20
20
|
selectedReason?: string | null;
|
|
@@ -22,7 +22,7 @@ export type AssistantWorkflowToolSelectionCandidateInput = {
|
|
|
22
22
|
attributeCount?: number | null;
|
|
23
23
|
};
|
|
24
24
|
export type AssistantWorkflowToolSelectionAuthoritySource = "workflow" | "legacy-pruner";
|
|
25
|
-
export type AssistantWorkflowToolSelectionAuthorityReason = "workflow_equivalent" | "workflow_authority_enabled" | "workflow_unavailable" | "workflow_authority_not_enabled" | "workflow_blocked" | "workflow_differs";
|
|
25
|
+
export type AssistantWorkflowToolSelectionAuthorityReason = "workflow_equivalent" | "workflow_authority_enabled" | "workflow_unavailable" | "workflow_authority_not_enabled" | "workflow_blocked" | "workflow_selection_not_exercised" | "workflow_differs";
|
|
26
26
|
export type AssistantWorkflowToolSelectionAuthority = {
|
|
27
27
|
source: AssistantWorkflowToolSelectionAuthoritySource;
|
|
28
28
|
reason: AssistantWorkflowToolSelectionAuthorityReason;
|
|
@@ -33,6 +33,8 @@ export type AssistantWorkflowToolSelectionAuthority = {
|
|
|
33
33
|
export type AssistantWorkflowToolSelectionAuthorityInput = {
|
|
34
34
|
selectedToolNames: readonly string[];
|
|
35
35
|
workflowAvailable: boolean;
|
|
36
|
+
/** False when the caller deliberately exposed the complete legacy tool set. */
|
|
37
|
+
selectionExercised?: boolean | null;
|
|
36
38
|
workflowSuggestedToolNames?: readonly string[] | null;
|
|
37
39
|
workflowSelectionCandidateToolNames?: readonly string[] | null;
|
|
38
40
|
workflowStatus?: string | null;
|