@uns-kit/assistant-workflow 2.0.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +37 -0
- package/dist/clarification-policy.d.ts +64 -0
- package/dist/clarification-policy.d.ts.map +1 -0
- package/dist/clarification-policy.js +174 -0
- package/dist/clarification-policy.js.map +1 -0
- package/dist/decision.d.ts +37 -0
- package/dist/decision.d.ts.map +1 -0
- package/dist/decision.js +100 -0
- package/dist/decision.js.map +1 -0
- package/dist/definition-catalog-replay.d.ts +25 -0
- package/dist/definition-catalog-replay.d.ts.map +1 -0
- package/dist/definition-catalog-replay.js +54 -0
- package/dist/definition-catalog-replay.js.map +1 -0
- package/dist/definition-catalog.d.ts +45 -0
- package/dist/definition-catalog.d.ts.map +1 -0
- package/dist/definition-catalog.js +97 -0
- package/dist/definition-catalog.js.map +1 -0
- package/dist/definition-diagnostics.d.ts +17 -0
- package/dist/definition-diagnostics.d.ts.map +1 -0
- package/dist/definition-diagnostics.js +353 -0
- package/dist/definition-diagnostics.js.map +1 -0
- package/dist/definition-diff.d.ts +51 -0
- package/dist/definition-diff.d.ts.map +1 -0
- package/dist/definition-diff.js +172 -0
- package/dist/definition-diff.js.map +1 -0
- package/dist/definition-json.d.ts +53 -0
- package/dist/definition-json.d.ts.map +1 -0
- package/dist/definition-json.js +186 -0
- package/dist/definition-json.js.map +1 -0
- package/dist/definition-manifest.d.ts +41 -0
- package/dist/definition-manifest.d.ts.map +1 -0
- package/dist/definition-manifest.js +119 -0
- package/dist/definition-manifest.js.map +1 -0
- package/dist/definition-package-execution-json.d.ts +64 -0
- package/dist/definition-package-execution-json.d.ts.map +1 -0
- package/dist/definition-package-execution-json.js +245 -0
- package/dist/definition-package-execution-json.js.map +1 -0
- package/dist/definition-package-execution-replay.d.ts +14 -0
- package/dist/definition-package-execution-replay.d.ts.map +1 -0
- package/dist/definition-package-execution-replay.js +47 -0
- package/dist/definition-package-execution-replay.js.map +1 -0
- package/dist/definition-package-executor.d.ts +52 -0
- package/dist/definition-package-executor.d.ts.map +1 -0
- package/dist/definition-package-executor.js +70 -0
- package/dist/definition-package-executor.js.map +1 -0
- package/dist/definition-package-loader.d.ts +36 -0
- package/dist/definition-package-loader.d.ts.map +1 -0
- package/dist/definition-package-loader.js +56 -0
- package/dist/definition-package-loader.js.map +1 -0
- package/dist/definition-package-replay.d.ts +28 -0
- package/dist/definition-package-replay.d.ts.map +1 -0
- package/dist/definition-package-replay.js +74 -0
- package/dist/definition-package-replay.js.map +1 -0
- package/dist/definition-package-resolver.d.ts +31 -0
- package/dist/definition-package-resolver.d.ts.map +1 -0
- package/dist/definition-package-resolver.js +60 -0
- package/dist/definition-package-resolver.js.map +1 -0
- package/dist/definition-package-review.d.ts +29 -0
- package/dist/definition-package-review.d.ts.map +1 -0
- package/dist/definition-package-review.js +74 -0
- package/dist/definition-package-review.js.map +1 -0
- package/dist/definition-package-run-report.d.ts +25 -0
- package/dist/definition-package-run-report.d.ts.map +1 -0
- package/dist/definition-package-run-report.js +37 -0
- package/dist/definition-package-run-report.js.map +1 -0
- package/dist/definition-package-run.d.ts +20 -0
- package/dist/definition-package-run.d.ts.map +1 -0
- package/dist/definition-package-run.js +41 -0
- package/dist/definition-package-run.js.map +1 -0
- package/dist/definition-package-selection.d.ts +29 -0
- package/dist/definition-package-selection.d.ts.map +1 -0
- package/dist/definition-package-selection.js +68 -0
- package/dist/definition-package-selection.js.map +1 -0
- package/dist/definition-package-smoke.d.ts +74 -0
- package/dist/definition-package-smoke.d.ts.map +1 -0
- package/dist/definition-package-smoke.js +184 -0
- package/dist/definition-package-smoke.js.map +1 -0
- package/dist/definition-package.d.ts +36 -0
- package/dist/definition-package.d.ts.map +1 -0
- package/dist/definition-package.js +114 -0
- package/dist/definition-package.js.map +1 -0
- package/dist/definition-tuning-approval.d.ts +39 -0
- package/dist/definition-tuning-approval.d.ts.map +1 -0
- package/dist/definition-tuning-approval.js +207 -0
- package/dist/definition-tuning-approval.js.map +1 -0
- package/dist/definition-tuning-json.d.ts +58 -0
- package/dist/definition-tuning-json.d.ts.map +1 -0
- package/dist/definition-tuning-json.js +276 -0
- package/dist/definition-tuning-json.js.map +1 -0
- package/dist/definition-tuning-promotion.d.ts +120 -0
- package/dist/definition-tuning-promotion.d.ts.map +1 -0
- package/dist/definition-tuning-promotion.js +460 -0
- package/dist/definition-tuning-promotion.js.map +1 -0
- package/dist/definition-tuning-replay.d.ts +14 -0
- package/dist/definition-tuning-replay.d.ts.map +1 -0
- package/dist/definition-tuning-replay.js +50 -0
- package/dist/definition-tuning-replay.js.map +1 -0
- package/dist/definition-tuning-review-artifact.d.ts +56 -0
- package/dist/definition-tuning-review-artifact.d.ts.map +1 -0
- package/dist/definition-tuning-review-artifact.js +302 -0
- package/dist/definition-tuning-review-artifact.js.map +1 -0
- package/dist/definition-tuning-review.d.ts +59 -0
- package/dist/definition-tuning-review.d.ts.map +1 -0
- package/dist/definition-tuning-review.js +213 -0
- package/dist/definition-tuning-review.js.map +1 -0
- package/dist/definition-tuning-source-patch.d.ts +43 -0
- package/dist/definition-tuning-source-patch.d.ts.map +1 -0
- package/dist/definition-tuning-source-patch.js +214 -0
- package/dist/definition-tuning-source-patch.js.map +1 -0
- package/dist/definition-tuning.d.ts +73 -0
- package/dist/definition-tuning.d.ts.map +1 -0
- package/dist/definition-tuning.js +426 -0
- package/dist/definition-tuning.js.map +1 -0
- package/dist/definition.d.ts +189 -0
- package/dist/definition.d.ts.map +1 -0
- package/dist/definition.js +494 -0
- package/dist/definition.js.map +1 -0
- package/dist/direct-route-invocation.d.ts +132 -0
- package/dist/direct-route-invocation.d.ts.map +1 -0
- package/dist/direct-route-invocation.js +325 -0
- package/dist/direct-route-invocation.js.map +1 -0
- package/dist/direct-route-policy.d.ts +25 -0
- package/dist/direct-route-policy.d.ts.map +1 -0
- package/dist/direct-route-policy.js +106 -0
- package/dist/direct-route-policy.js.map +1 -0
- package/dist/eval-case.d.ts +85 -0
- package/dist/eval-case.d.ts.map +1 -0
- package/dist/eval-case.js +366 -0
- package/dist/eval-case.js.map +1 -0
- package/dist/eval-replay.d.ts +18 -0
- package/dist/eval-replay.d.ts.map +1 -0
- package/dist/eval-replay.js +41 -0
- package/dist/eval-replay.js.map +1 -0
- package/dist/eval-result.d.ts +46 -0
- package/dist/eval-result.d.ts.map +1 -0
- package/dist/eval-result.js +183 -0
- package/dist/eval-result.js.map +1 -0
- package/dist/eval-runner.d.ts +30 -0
- package/dist/eval-runner.d.ts.map +1 -0
- package/dist/eval-runner.js +57 -0
- package/dist/eval-runner.js.map +1 -0
- package/dist/eval-suite.d.ts +43 -0
- package/dist/eval-suite.d.ts.map +1 -0
- package/dist/eval-suite.js +101 -0
- package/dist/eval-suite.js.map +1 -0
- package/dist/execution-plan.d.ts +43 -0
- package/dist/execution-plan.d.ts.map +1 -0
- package/dist/execution-plan.js +187 -0
- package/dist/execution-plan.js.map +1 -0
- package/dist/hosted-tool-policy.d.ts +70 -0
- package/dist/hosted-tool-policy.d.ts.map +1 -0
- package/dist/hosted-tool-policy.js +228 -0
- package/dist/hosted-tool-policy.js.map +1 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +73 -0
- package/dist/index.js.map +1 -0
- package/dist/memory-policy.d.ts +55 -0
- package/dist/memory-policy.d.ts.map +1 -0
- package/dist/memory-policy.js +187 -0
- package/dist/memory-policy.js.map +1 -0
- package/dist/memory-updates.d.ts +39 -0
- package/dist/memory-updates.d.ts.map +1 -0
- package/dist/memory-updates.js +110 -0
- package/dist/memory-updates.js.map +1 -0
- package/dist/outcome-trace.d.ts +79 -0
- package/dist/outcome-trace.d.ts.map +1 -0
- package/dist/outcome-trace.js +117 -0
- package/dist/outcome-trace.js.map +1 -0
- package/dist/outcome.d.ts +97 -0
- package/dist/outcome.d.ts.map +1 -0
- package/dist/outcome.js +160 -0
- package/dist/outcome.js.map +1 -0
- package/dist/planner-compiler.d.ts +14 -0
- package/dist/planner-compiler.d.ts.map +1 -0
- package/dist/planner-compiler.js +26 -0
- package/dist/planner-compiler.js.map +1 -0
- package/dist/planning.d.ts +36 -0
- package/dist/planning.d.ts.map +1 -0
- package/dist/planning.js +141 -0
- package/dist/planning.js.map +1 -0
- package/dist/policy-resolution.d.ts +10 -0
- package/dist/policy-resolution.d.ts.map +1 -0
- package/dist/policy-resolution.js +30 -0
- package/dist/policy-resolution.js.map +1 -0
- package/dist/run-evaluation.d.ts +29 -0
- package/dist/run-evaluation.d.ts.map +1 -0
- package/dist/run-evaluation.js +128 -0
- package/dist/run-evaluation.js.map +1 -0
- package/dist/run-parity.d.ts +24 -0
- package/dist/run-parity.d.ts.map +1 -0
- package/dist/run-parity.js +36 -0
- package/dist/run-parity.js.map +1 -0
- package/dist/run-report-batch.d.ts +150 -0
- package/dist/run-report-batch.d.ts.map +1 -0
- package/dist/run-report-batch.js +391 -0
- package/dist/run-report-batch.js.map +1 -0
- package/dist/run-report-json.d.ts +76 -0
- package/dist/run-report-json.d.ts.map +1 -0
- package/dist/run-report-json.js +451 -0
- package/dist/run-report-json.js.map +1 -0
- package/dist/run-report.d.ts +22 -0
- package/dist/run-report.d.ts.map +1 -0
- package/dist/run-report.js +46 -0
- package/dist/run-report.js.map +1 -0
- package/dist/run.d.ts +20 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +36 -0
- package/dist/run.js.map +1 -0
- package/dist/tool-bindings.d.ts +42 -0
- package/dist/tool-bindings.d.ts.map +1 -0
- package/dist/tool-bindings.js +124 -0
- package/dist/tool-bindings.js.map +1 -0
- package/dist/tool-capabilities.d.ts +37 -0
- package/dist/tool-capabilities.d.ts.map +1 -0
- package/dist/tool-capabilities.js +91 -0
- package/dist/tool-capabilities.js.map +1 -0
- package/dist/tool-executor.d.ts +63 -0
- package/dist/tool-executor.d.ts.map +1 -0
- package/dist/tool-executor.js +176 -0
- package/dist/tool-executor.js.map +1 -0
- package/dist/tool-fixtures.d.ts +18 -0
- package/dist/tool-fixtures.d.ts.map +1 -0
- package/dist/tool-fixtures.js +52 -0
- package/dist/tool-fixtures.js.map +1 -0
- package/dist/tool-invocations.d.ts +31 -0
- package/dist/tool-invocations.d.ts.map +1 -0
- package/dist/tool-invocations.js +79 -0
- package/dist/tool-invocations.js.map +1 -0
- package/dist/tool-provider-executors.d.ts +43 -0
- package/dist/tool-provider-executors.d.ts.map +1 -0
- package/dist/tool-provider-executors.js +59 -0
- package/dist/tool-provider-executors.js.map +1 -0
- package/dist/tool-result-cache.d.ts +37 -0
- package/dist/tool-result-cache.d.ts.map +1 -0
- package/dist/tool-result-cache.js +173 -0
- package/dist/tool-result-cache.js.map +1 -0
- package/dist/tool-results.d.ts +41 -0
- package/dist/tool-results.d.ts.map +1 -0
- package/dist/tool-results.js +137 -0
- package/dist/tool-results.js.map +1 -0
- package/dist/tool-runtime.d.ts +46 -0
- package/dist/tool-runtime.d.ts.map +1 -0
- package/dist/tool-runtime.js +163 -0
- package/dist/tool-runtime.js.map +1 -0
- package/dist/tool-selection-evaluation.d.ts +214 -0
- package/dist/tool-selection-evaluation.d.ts.map +1 -0
- package/dist/tool-selection-evaluation.js +773 -0
- package/dist/tool-selection-evaluation.js.map +1 -0
- package/dist/tool-selection-json.d.ts +71 -0
- package/dist/tool-selection-json.d.ts.map +1 -0
- package/dist/tool-selection-json.js +284 -0
- package/dist/tool-selection-json.js.map +1 -0
- package/dist/tool-selection-policy.d.ts +81 -0
- package/dist/tool-selection-policy.d.ts.map +1 -0
- package/dist/tool-selection-policy.js +376 -0
- package/dist/tool-selection-policy.js.map +1 -0
- package/dist/tool-selection-replay.d.ts +26 -0
- package/dist/tool-selection-replay.d.ts.map +1 -0
- package/dist/tool-selection-replay.js +88 -0
- package/dist/tool-selection-replay.js.map +1 -0
- package/dist/tool-selection-rules.d.ts +46 -0
- package/dist/tool-selection-rules.d.ts.map +1 -0
- package/dist/tool-selection-rules.js +183 -0
- package/dist/tool-selection-rules.js.map +1 -0
- package/dist/tool-selection-trace-export.d.ts +37 -0
- package/dist/tool-selection-trace-export.d.ts.map +1 -0
- package/dist/tool-selection-trace-export.js +324 -0
- package/dist/tool-selection-trace-export.js.map +1 -0
- package/dist/trace-events.d.ts +14 -0
- package/dist/trace-events.d.ts.map +1 -0
- package/dist/trace-events.js +65 -0
- package/dist/trace-events.js.map +1 -0
- package/dist/trace-payload.d.ts +24 -0
- package/dist/trace-payload.d.ts.map +1 -0
- package/dist/trace-payload.js +113 -0
- package/dist/trace-payload.js.map +1 -0
- package/dist/trace-replay.d.ts +276 -0
- package/dist/trace-replay.d.ts.map +1 -0
- package/dist/trace-replay.js +685 -0
- package/dist/trace-replay.js.map +1 -0
- package/dist/trace-report.d.ts +320 -0
- package/dist/trace-report.d.ts.map +1 -0
- package/dist/trace-report.js +1394 -0
- package/dist/trace-report.js.map +1 -0
- package/dist/trace-stages.d.ts +70 -0
- package/dist/trace-stages.d.ts.map +1 -0
- package/dist/trace-stages.js +103 -0
- package/dist/trace-stages.js.map +1 -0
- package/dist/value-readers.d.ts +20 -0
- package/dist/value-readers.d.ts.map +1 -0
- package/dist/value-readers.js +82 -0
- package/dist/value-readers.js.map +1 -0
- package/package.json +341 -0
|
@@ -0,0 +1 @@
|
|
|
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,G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,KAAK,KAAK,CAAC,QAAQ;YAAE,OAAO,IAAI,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClF,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,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"]}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { AssistantWorkflowJsonValue } from "./run-report-json.js";
|
|
2
|
+
import type { AssistantWorkflowToolSelectionAuthority, AssistantWorkflowToolSelectionDecision } from "./tool-selection-policy.js";
|
|
3
|
+
export declare const ASSISTANT_WORKFLOW_TOOL_SELECTION_JSON_SCHEMA_VERSION = 1;
|
|
4
|
+
export type AssistantWorkflowSerializedToolSelectionDecision = {
|
|
5
|
+
schemaVersion: typeof ASSISTANT_WORKFLOW_TOOL_SELECTION_JSON_SCHEMA_VERSION;
|
|
6
|
+
authority: AssistantWorkflowToolSelectionAuthority;
|
|
7
|
+
effectiveToolNames: string[];
|
|
8
|
+
effectiveReason: string | null;
|
|
9
|
+
comparisonPayload: Record<string, AssistantWorkflowJsonValue> | null;
|
|
10
|
+
};
|
|
11
|
+
export type AssistantWorkflowSerializedToolSelectionDecisionLineErrorReason = "invalid_json" | "invalid_tool_selection";
|
|
12
|
+
export type AssistantWorkflowSerializedToolSelectionDecisionLineError = {
|
|
13
|
+
lineNumber: number;
|
|
14
|
+
reason: AssistantWorkflowSerializedToolSelectionDecisionLineErrorReason;
|
|
15
|
+
preview: string;
|
|
16
|
+
};
|
|
17
|
+
export type AssistantWorkflowSerializedToolSelectionDecisionLinesParseResult = {
|
|
18
|
+
lineCount: number;
|
|
19
|
+
decisionCount: number;
|
|
20
|
+
errorCount: number;
|
|
21
|
+
decisions: AssistantWorkflowSerializedToolSelectionDecision[];
|
|
22
|
+
errors: AssistantWorkflowSerializedToolSelectionDecisionLineError[];
|
|
23
|
+
};
|
|
24
|
+
export type AssistantWorkflowSerializedToolSelectionDecisionLinesOptions = {
|
|
25
|
+
trailingNewline?: boolean;
|
|
26
|
+
};
|
|
27
|
+
export type AssistantWorkflowSerializedToolSelectionDecisionBatchOptions = {
|
|
28
|
+
generatedAt?: string;
|
|
29
|
+
onlyInteresting?: boolean;
|
|
30
|
+
};
|
|
31
|
+
export type AssistantWorkflowSerializedToolSelectionDecisionBatchCount = {
|
|
32
|
+
key: string;
|
|
33
|
+
count: number;
|
|
34
|
+
};
|
|
35
|
+
export type AssistantWorkflowSerializedToolSelectionDecisionBatchSummary = {
|
|
36
|
+
generatedAt: string;
|
|
37
|
+
sourceDecisionCount: number;
|
|
38
|
+
decisionCount: number;
|
|
39
|
+
interestingDecisionCount: number;
|
|
40
|
+
workflowAuthorityCount: number;
|
|
41
|
+
legacyAuthorityCount: number;
|
|
42
|
+
authoritySourceCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];
|
|
43
|
+
authorityReasonCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];
|
|
44
|
+
workflowStatusCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];
|
|
45
|
+
effectiveReasonCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];
|
|
46
|
+
optionalToolModeCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];
|
|
47
|
+
workflowSelectionProfileCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];
|
|
48
|
+
workflowSelectionProfileToolCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];
|
|
49
|
+
effectiveToolCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];
|
|
50
|
+
workflowSuggestedToolCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];
|
|
51
|
+
workflowSelectionCandidateToolCounts: AssistantWorkflowSerializedToolSelectionDecisionBatchCount[];
|
|
52
|
+
};
|
|
53
|
+
export type AssistantWorkflowSerializedToolSelectionDecisionBatch = {
|
|
54
|
+
schemaVersion: typeof ASSISTANT_WORKFLOW_TOOL_SELECTION_JSON_SCHEMA_VERSION;
|
|
55
|
+
generatedAt: string;
|
|
56
|
+
sourceDecisionCount: number;
|
|
57
|
+
decisionCount: number;
|
|
58
|
+
summary: AssistantWorkflowSerializedToolSelectionDecisionBatchSummary;
|
|
59
|
+
decisions: AssistantWorkflowSerializedToolSelectionDecision[];
|
|
60
|
+
};
|
|
61
|
+
export declare function serializeAssistantWorkflowToolSelectionDecision(decision: AssistantWorkflowToolSelectionDecision): AssistantWorkflowSerializedToolSelectionDecision;
|
|
62
|
+
export declare function stringifyAssistantWorkflowToolSelectionDecision(decision: AssistantWorkflowToolSelectionDecision, space?: number): string;
|
|
63
|
+
export declare function stringifyAssistantWorkflowToolSelectionDecisionLines(decisions: readonly AssistantWorkflowToolSelectionDecision[], options?: AssistantWorkflowSerializedToolSelectionDecisionLinesOptions): string;
|
|
64
|
+
export declare function stringifyAssistantWorkflowSerializedToolSelectionDecisionLines(decisions: readonly AssistantWorkflowSerializedToolSelectionDecision[], options?: AssistantWorkflowSerializedToolSelectionDecisionLinesOptions): string;
|
|
65
|
+
export declare function serializeAssistantWorkflowToolSelectionDecisions(decisions: readonly AssistantWorkflowToolSelectionDecision[], options?: AssistantWorkflowSerializedToolSelectionDecisionBatchOptions): AssistantWorkflowSerializedToolSelectionDecisionBatch;
|
|
66
|
+
export declare function buildAssistantWorkflowSerializedToolSelectionDecisionBatch(allDecisions: readonly AssistantWorkflowSerializedToolSelectionDecision[], options?: AssistantWorkflowSerializedToolSelectionDecisionBatchOptions): AssistantWorkflowSerializedToolSelectionDecisionBatch;
|
|
67
|
+
export declare function stringifyAssistantWorkflowToolSelectionDecisions(decisions: readonly AssistantWorkflowToolSelectionDecision[], options?: AssistantWorkflowSerializedToolSelectionDecisionBatchOptions, space?: number): string;
|
|
68
|
+
export declare function parseAssistantWorkflowSerializedToolSelectionDecision(value: unknown): AssistantWorkflowSerializedToolSelectionDecision | null;
|
|
69
|
+
export declare function parseAssistantWorkflowSerializedToolSelectionDecisionLines(input: string): AssistantWorkflowSerializedToolSelectionDecisionLinesParseResult;
|
|
70
|
+
export declare function parseAssistantWorkflowSerializedToolSelectionDecisionBatch(value: unknown): AssistantWorkflowSerializedToolSelectionDecisionBatch | null;
|
|
71
|
+
//# sourceMappingURL=tool-selection-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-selection-json.d.ts","sourceRoot":"","sources":["../src/tool-selection-json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EACV,uCAAuC,EAGvC,sCAAsC,EACvC,MAAM,4BAA4B,CAAC;AAEpC,eAAO,MAAM,qDAAqD,IAAI,CAAC;AAEvE,MAAM,MAAM,gDAAgD,GAAG;IAC7D,aAAa,EAAE,OAAO,qDAAqD,CAAC;IAC5E,SAAS,EAAE,uCAAuC,CAAC;IACnD,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,GAAG,IAAI,CAAC;CACtE,CAAC;AAEF,MAAM,MAAM,+DAA+D,GACvE,cAAc,GACd,wBAAwB,CAAC;AAE7B,MAAM,MAAM,yDAAyD,GAAG;IACtE,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,+DAA+D,CAAC;IACxE,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gEA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
|
+
export function serializeAssistantWorkflowToolSelectionDecision(decision) {
|
|
3
|
+
return {
|
|
4
|
+
schemaVersion: ASSISTANT_WORKFLOW_TOOL_SELECTION_JSON_SCHEMA_VERSION,
|
|
5
|
+
authority: {
|
|
6
|
+
source: decision.authority.source,
|
|
7
|
+
reason: decision.authority.reason,
|
|
8
|
+
selectedToolNames: [...decision.authority.selectedToolNames],
|
|
9
|
+
workflowSuggestedToolNames: [...decision.authority.workflowSuggestedToolNames],
|
|
10
|
+
workflowStatus: decision.authority.workflowStatus,
|
|
11
|
+
},
|
|
12
|
+
effectiveToolNames: [...decision.effectiveToolNames],
|
|
13
|
+
effectiveReason: decision.effectiveReason,
|
|
14
|
+
comparisonPayload: decision.comparisonPayload === null ? null : toJsonRecord(decision.comparisonPayload),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function stringifyAssistantWorkflowToolSelectionDecision(decision, space) {
|
|
18
|
+
return JSON.stringify(serializeAssistantWorkflowToolSelectionDecision(decision), null, space);
|
|
19
|
+
}
|
|
20
|
+
export function stringifyAssistantWorkflowToolSelectionDecisionLines(decisions, options = {}) {
|
|
21
|
+
return stringifyAssistantWorkflowSerializedToolSelectionDecisionLines(decisions.map(serializeAssistantWorkflowToolSelectionDecision), options);
|
|
22
|
+
}
|
|
23
|
+
export function stringifyAssistantWorkflowSerializedToolSelectionDecisionLines(decisions, options = {}) {
|
|
24
|
+
const lines = decisions.map((decision) => JSON.stringify(decision));
|
|
25
|
+
if (!lines.length)
|
|
26
|
+
return "";
|
|
27
|
+
return options.trailingNewline === true ? `${lines.join("\n")}\n` : lines.join("\n");
|
|
28
|
+
}
|
|
29
|
+
export function serializeAssistantWorkflowToolSelectionDecisions(decisions, options = {}) {
|
|
30
|
+
const allDecisions = decisions.map(serializeAssistantWorkflowToolSelectionDecision);
|
|
31
|
+
return buildAssistantWorkflowSerializedToolSelectionDecisionBatch(allDecisions, options);
|
|
32
|
+
}
|
|
33
|
+
export function buildAssistantWorkflowSerializedToolSelectionDecisionBatch(allDecisions, options = {}) {
|
|
34
|
+
const decisions = options.onlyInteresting === true
|
|
35
|
+
? allDecisions.filter(isInterestingDecision)
|
|
36
|
+
: [...allDecisions];
|
|
37
|
+
const generatedAt = normalizeGeneratedAt(options.generatedAt) ?? new Date().toISOString();
|
|
38
|
+
const summary = buildSerializedDecisionBatchSummary(allDecisions, decisions, generatedAt);
|
|
39
|
+
return {
|
|
40
|
+
schemaVersion: ASSISTANT_WORKFLOW_TOOL_SELECTION_JSON_SCHEMA_VERSION,
|
|
41
|
+
generatedAt,
|
|
42
|
+
sourceDecisionCount: allDecisions.length,
|
|
43
|
+
decisionCount: decisions.length,
|
|
44
|
+
summary,
|
|
45
|
+
decisions,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export function stringifyAssistantWorkflowToolSelectionDecisions(decisions, options = {}, space) {
|
|
49
|
+
return JSON.stringify(serializeAssistantWorkflowToolSelectionDecisions(decisions, options), null, space);
|
|
50
|
+
}
|
|
51
|
+
export function parseAssistantWorkflowSerializedToolSelectionDecision(value) {
|
|
52
|
+
if (!isRecord(value))
|
|
53
|
+
return null;
|
|
54
|
+
if (value["schemaVersion"] !== ASSISTANT_WORKFLOW_TOOL_SELECTION_JSON_SCHEMA_VERSION)
|
|
55
|
+
return null;
|
|
56
|
+
const authority = parseToolSelectionAuthority(value["authority"]);
|
|
57
|
+
if (!authority)
|
|
58
|
+
return null;
|
|
59
|
+
if (!isStringArray(value["effectiveToolNames"]))
|
|
60
|
+
return null;
|
|
61
|
+
if (value["effectiveReason"] !== null && typeof value["effectiveReason"] !== "string")
|
|
62
|
+
return null;
|
|
63
|
+
if (value["comparisonPayload"] !== null && !isJsonRecord(value["comparisonPayload"]))
|
|
64
|
+
return null;
|
|
65
|
+
return {
|
|
66
|
+
schemaVersion: ASSISTANT_WORKFLOW_TOOL_SELECTION_JSON_SCHEMA_VERSION,
|
|
67
|
+
authority,
|
|
68
|
+
effectiveToolNames: value["effectiveToolNames"],
|
|
69
|
+
effectiveReason: value["effectiveReason"],
|
|
70
|
+
comparisonPayload: value["comparisonPayload"],
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export function parseAssistantWorkflowSerializedToolSelectionDecisionLines(input) {
|
|
74
|
+
const decisions = [];
|
|
75
|
+
const errors = [];
|
|
76
|
+
let lineCount = 0;
|
|
77
|
+
for (const [index, line] of input.split(/\r?\n/).entries()) {
|
|
78
|
+
const trimmed = line.trim();
|
|
79
|
+
if (!trimmed.length)
|
|
80
|
+
continue;
|
|
81
|
+
const lineNumber = index + 1;
|
|
82
|
+
lineCount += 1;
|
|
83
|
+
let parsed;
|
|
84
|
+
try {
|
|
85
|
+
parsed = JSON.parse(trimmed);
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
errors.push({
|
|
89
|
+
lineNumber,
|
|
90
|
+
reason: "invalid_json",
|
|
91
|
+
preview: previewLine(trimmed),
|
|
92
|
+
});
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
const decision = parseAssistantWorkflowSerializedToolSelectionDecision(parsed);
|
|
96
|
+
if (!decision) {
|
|
97
|
+
errors.push({
|
|
98
|
+
lineNumber,
|
|
99
|
+
reason: "invalid_tool_selection",
|
|
100
|
+
preview: previewLine(trimmed),
|
|
101
|
+
});
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
decisions.push(decision);
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
lineCount,
|
|
108
|
+
decisionCount: decisions.length,
|
|
109
|
+
errorCount: errors.length,
|
|
110
|
+
decisions,
|
|
111
|
+
errors,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
export function parseAssistantWorkflowSerializedToolSelectionDecisionBatch(value) {
|
|
115
|
+
if (!isRecord(value))
|
|
116
|
+
return null;
|
|
117
|
+
if (value["schemaVersion"] !== ASSISTANT_WORKFLOW_TOOL_SELECTION_JSON_SCHEMA_VERSION)
|
|
118
|
+
return null;
|
|
119
|
+
if (typeof value["generatedAt"] !== "string" || !value["generatedAt"].trim().length)
|
|
120
|
+
return null;
|
|
121
|
+
if (!isNonNegativeFiniteNumber(value["sourceDecisionCount"]))
|
|
122
|
+
return null;
|
|
123
|
+
if (!isNonNegativeFiniteNumber(value["decisionCount"]))
|
|
124
|
+
return null;
|
|
125
|
+
if (!isDecisionBatchSummary(value["summary"]))
|
|
126
|
+
return null;
|
|
127
|
+
if (!Array.isArray(value["decisions"]))
|
|
128
|
+
return null;
|
|
129
|
+
const decisions = value["decisions"].map(parseAssistantWorkflowSerializedToolSelectionDecision);
|
|
130
|
+
if (decisions.some((decision) => decision === null))
|
|
131
|
+
return null;
|
|
132
|
+
if (decisions.length !== value["decisionCount"])
|
|
133
|
+
return null;
|
|
134
|
+
return {
|
|
135
|
+
schemaVersion: ASSISTANT_WORKFLOW_TOOL_SELECTION_JSON_SCHEMA_VERSION,
|
|
136
|
+
generatedAt: value["generatedAt"],
|
|
137
|
+
sourceDecisionCount: value["sourceDecisionCount"],
|
|
138
|
+
decisionCount: value["decisionCount"],
|
|
139
|
+
summary: value["summary"],
|
|
140
|
+
decisions: decisions.filter((decision) => decision !== null),
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function buildSerializedDecisionBatchSummary(allDecisions, decisions, generatedAt) {
|
|
144
|
+
return {
|
|
145
|
+
generatedAt,
|
|
146
|
+
sourceDecisionCount: allDecisions.length,
|
|
147
|
+
decisionCount: decisions.length,
|
|
148
|
+
interestingDecisionCount: decisions.filter(isInterestingDecision).length,
|
|
149
|
+
workflowAuthorityCount: decisions.filter((decision) => decision.authority.source === "workflow").length,
|
|
150
|
+
legacyAuthorityCount: decisions.filter((decision) => decision.authority.source === "legacy-pruner").length,
|
|
151
|
+
authoritySourceCounts: buildStringCounts(decisions.map((decision) => decision.authority.source)),
|
|
152
|
+
authorityReasonCounts: buildStringCounts(decisions.map((decision) => decision.authority.reason)),
|
|
153
|
+
workflowStatusCounts: buildStringCounts(decisions.map((decision) => decision.authority.workflowStatus ?? "none")),
|
|
154
|
+
effectiveReasonCounts: buildStringCounts(decisions.map((decision) => decision.effectiveReason ?? "none")),
|
|
155
|
+
optionalToolModeCounts: buildStringCounts(decisions.map((decision) => readJsonString(decision.comparisonPayload?.["workflowSelectionOptionalToolMode"]) ?? "none")),
|
|
156
|
+
workflowSelectionProfileCounts: buildStringCounts(decisions.flatMap((decision) => readJsonStringArray(decision.comparisonPayload?.["workflowSelectionActiveProfileIds"]))),
|
|
157
|
+
workflowSelectionProfileToolCounts: buildStringCounts(decisions.flatMap((decision) => readJsonStringArray(decision.comparisonPayload?.["workflowSelectionProfileTools"]))),
|
|
158
|
+
effectiveToolCounts: buildStringCounts(decisions.flatMap((decision) => decision.effectiveToolNames)),
|
|
159
|
+
workflowSuggestedToolCounts: buildStringCounts(decisions.flatMap((decision) => decision.authority.workflowSuggestedToolNames)),
|
|
160
|
+
workflowSelectionCandidateToolCounts: buildStringCounts(decisions.flatMap((decision) => readJsonStringArray(decision.comparisonPayload?.["workflowSelectionCandidateTools"]))),
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
function isInterestingDecision(decision) {
|
|
164
|
+
return decision.authority.source !== "workflow";
|
|
165
|
+
}
|
|
166
|
+
function buildStringCounts(values) {
|
|
167
|
+
const counts = new Map();
|
|
168
|
+
for (const value of values) {
|
|
169
|
+
if (!value.length)
|
|
170
|
+
continue;
|
|
171
|
+
counts.set(value, (counts.get(value) ?? 0) + 1);
|
|
172
|
+
}
|
|
173
|
+
return [...counts.entries()]
|
|
174
|
+
.map(([key, count]) => ({ key, count }))
|
|
175
|
+
.sort((left, right) => {
|
|
176
|
+
if (right.count !== left.count)
|
|
177
|
+
return right.count - left.count;
|
|
178
|
+
return left.key.localeCompare(right.key);
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
function isDecisionBatchSummary(value) {
|
|
182
|
+
if (!isRecord(value))
|
|
183
|
+
return false;
|
|
184
|
+
return (typeof value["generatedAt"] === "string" &&
|
|
185
|
+
isNonNegativeFiniteNumber(value["sourceDecisionCount"]) &&
|
|
186
|
+
isNonNegativeFiniteNumber(value["decisionCount"]) &&
|
|
187
|
+
isNonNegativeFiniteNumber(value["interestingDecisionCount"]) &&
|
|
188
|
+
isNonNegativeFiniteNumber(value["workflowAuthorityCount"]) &&
|
|
189
|
+
isNonNegativeFiniteNumber(value["legacyAuthorityCount"]) &&
|
|
190
|
+
isCountArray(value["authoritySourceCounts"]) &&
|
|
191
|
+
isCountArray(value["authorityReasonCounts"]) &&
|
|
192
|
+
isCountArray(value["workflowStatusCounts"]) &&
|
|
193
|
+
isCountArray(value["effectiveReasonCounts"]) &&
|
|
194
|
+
isCountArray(value["optionalToolModeCounts"]) &&
|
|
195
|
+
isCountArray(value["workflowSelectionProfileCounts"]) &&
|
|
196
|
+
isCountArray(value["workflowSelectionProfileToolCounts"]) &&
|
|
197
|
+
isCountArray(value["effectiveToolCounts"]) &&
|
|
198
|
+
isCountArray(value["workflowSuggestedToolCounts"]) &&
|
|
199
|
+
isCountArray(value["workflowSelectionCandidateToolCounts"]));
|
|
200
|
+
}
|
|
201
|
+
function isCountArray(value) {
|
|
202
|
+
return Array.isArray(value) && value.every((item) => isRecord(item) &&
|
|
203
|
+
typeof item["key"] === "string" &&
|
|
204
|
+
isNonNegativeFiniteNumber(item["count"]));
|
|
205
|
+
}
|
|
206
|
+
function normalizeGeneratedAt(value) {
|
|
207
|
+
if (value === undefined)
|
|
208
|
+
return null;
|
|
209
|
+
const trimmed = value.trim();
|
|
210
|
+
return trimmed.length ? trimmed : null;
|
|
211
|
+
}
|
|
212
|
+
function isNonNegativeFiniteNumber(value) {
|
|
213
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
214
|
+
}
|
|
215
|
+
function parseToolSelectionAuthority(value) {
|
|
216
|
+
if (!isRecord(value))
|
|
217
|
+
return null;
|
|
218
|
+
if (!isAuthoritySource(value["source"]))
|
|
219
|
+
return null;
|
|
220
|
+
if (!isAuthorityReason(value["reason"]))
|
|
221
|
+
return null;
|
|
222
|
+
if (!isStringArray(value["selectedToolNames"]))
|
|
223
|
+
return null;
|
|
224
|
+
if (!isStringArray(value["workflowSuggestedToolNames"]))
|
|
225
|
+
return null;
|
|
226
|
+
if (value["workflowStatus"] !== null && typeof value["workflowStatus"] !== "string")
|
|
227
|
+
return null;
|
|
228
|
+
return {
|
|
229
|
+
source: value["source"],
|
|
230
|
+
reason: value["reason"],
|
|
231
|
+
selectedToolNames: value["selectedToolNames"],
|
|
232
|
+
workflowSuggestedToolNames: value["workflowSuggestedToolNames"],
|
|
233
|
+
workflowStatus: value["workflowStatus"],
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
function isAuthoritySource(value) {
|
|
237
|
+
return value === "workflow" || value === "legacy-pruner";
|
|
238
|
+
}
|
|
239
|
+
function isAuthorityReason(value) {
|
|
240
|
+
return (value === "workflow_equivalent" ||
|
|
241
|
+
value === "workflow_authority_enabled" ||
|
|
242
|
+
value === "workflow_unavailable" ||
|
|
243
|
+
value === "workflow_authority_not_enabled" ||
|
|
244
|
+
value === "workflow_blocked" ||
|
|
245
|
+
value === "workflow_differs");
|
|
246
|
+
}
|
|
247
|
+
function isStringArray(value) {
|
|
248
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
249
|
+
}
|
|
250
|
+
function previewLine(line) {
|
|
251
|
+
return line.length <= 160 ? line : `${line.slice(0, 157)}...`;
|
|
252
|
+
}
|
|
253
|
+
function readJsonString(value) {
|
|
254
|
+
return typeof value === "string" ? value : null;
|
|
255
|
+
}
|
|
256
|
+
function readJsonStringArray(value) {
|
|
257
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string") ? value : [];
|
|
258
|
+
}
|
|
259
|
+
function toJsonRecord(value) {
|
|
260
|
+
if (!isJsonRecord(value)) {
|
|
261
|
+
throw new Error("Assistant workflow tool-selection payload must be a JSON object.");
|
|
262
|
+
}
|
|
263
|
+
return value;
|
|
264
|
+
}
|
|
265
|
+
function isJsonRecord(value) {
|
|
266
|
+
if (!isRecord(value))
|
|
267
|
+
return false;
|
|
268
|
+
return Object.values(value).every(isJsonValue);
|
|
269
|
+
}
|
|
270
|
+
function isJsonValue(value) {
|
|
271
|
+
if (value === null)
|
|
272
|
+
return true;
|
|
273
|
+
if (typeof value === "string" || typeof value === "boolean")
|
|
274
|
+
return true;
|
|
275
|
+
if (typeof value === "number")
|
|
276
|
+
return Number.isFinite(value);
|
|
277
|
+
if (Array.isArray(value))
|
|
278
|
+
return value.every(isJsonValue);
|
|
279
|
+
return isJsonRecord(value);
|
|
280
|
+
}
|
|
281
|
+
function isRecord(value) {
|
|
282
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
283
|
+
}
|
|
284
|
+
//# sourceMappingURL=tool-selection-json.js.map
|
|
@@ -0,0 +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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,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_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"]}
|