@uns-kit/assistant-workflow 3.0.1 → 3.0.3
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/API_STABILITY.md +38 -0
- package/README.md +40 -0
- package/dist/definition-diagnostics.d.ts +1 -1
- package/dist/definition-diagnostics.d.ts.map +1 -1
- package/dist/definition-diagnostics.js +62 -0
- package/dist/definition-diagnostics.js.map +1 -1
- package/dist/definition-diff.d.ts +9 -0
- package/dist/definition-diff.d.ts.map +1 -1
- package/dist/definition-diff.js +39 -1
- package/dist/definition-diff.js.map +1 -1
- package/dist/definition.d.ts +5 -0
- package/dist/definition.d.ts.map +1 -1
- package/dist/definition.js +38 -0
- package/dist/definition.js.map +1 -1
- package/dist/execution-budget.d.ts +38 -0
- package/dist/execution-budget.d.ts.map +1 -0
- package/dist/execution-budget.js +65 -0
- package/dist/execution-budget.js.map +1 -0
- package/dist/execution-plan.d.ts +8 -0
- package/dist/execution-plan.d.ts.map +1 -1
- package/dist/execution-plan.js +47 -1
- package/dist/execution-plan.js.map +1 -1
- package/dist/execution-policy.d.ts +9 -0
- package/dist/execution-policy.d.ts.map +1 -0
- package/dist/execution-policy.js +21 -0
- package/dist/execution-policy.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/planning.d.ts +1 -0
- package/dist/planning.d.ts.map +1 -1
- package/dist/planning.js +1 -0
- package/dist/planning.js.map +1 -1
- package/dist/tool-executor.d.ts +7 -0
- package/dist/tool-executor.d.ts.map +1 -1
- package/dist/tool-executor.js +180 -55
- package/dist/tool-executor.js.map +1 -1
- package/dist/tool-invocations.d.ts +7 -0
- package/dist/tool-invocations.d.ts.map +1 -1
- package/dist/tool-invocations.js +43 -2
- package/dist/tool-invocations.js.map +1 -1
- package/package.json +11 -2
package/API_STABILITY.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# API Stability
|
|
2
|
+
|
|
3
|
+
`@uns-kit/assistant-workflow` treats the package root and every declared
|
|
4
|
+
`package.json` subpath as public API. Existing exports remain supported for the
|
|
5
|
+
current major version.
|
|
6
|
+
|
|
7
|
+
New source modules are internal by default. A module becomes public only when a
|
|
8
|
+
reviewed change adds it to both `src/index.ts` and the package `exports` map,
|
|
9
|
+
with consumer-oriented tests and documentation.
|
|
10
|
+
|
|
11
|
+
## Compatibility Rules
|
|
12
|
+
|
|
13
|
+
- Additive types, helpers, and optional fields may ship in a minor release.
|
|
14
|
+
- Behavior changes require replay coverage and a migration note.
|
|
15
|
+
- Deprecated exports remain available for the rest of the current major line.
|
|
16
|
+
- Removing or narrowing an export requires a major release.
|
|
17
|
+
- Experimental APIs use an explicit `experimental` subpath and make no silent
|
|
18
|
+
transition into the stable root API.
|
|
19
|
+
|
|
20
|
+
Before publishing, run `pnpm --filter @uns-kit/assistant-workflow run verify`.
|
|
21
|
+
Consumer repositories must also typecheck and test against the packed package
|
|
22
|
+
before a major-version rollout is considered complete.
|
|
23
|
+
|
|
24
|
+
## Execution Budgets
|
|
25
|
+
|
|
26
|
+
Workflow definitions may declare an optional `executionBudget`. The compiler
|
|
27
|
+
uses it to reject oversized plans before producing executable invocations, and
|
|
28
|
+
the tool executor checks it again before and between calls. Definitions without
|
|
29
|
+
the field preserve the existing unbounded behavior for backward compatibility.
|
|
30
|
+
|
|
31
|
+
`maxProviderCalls` and `maxEvidenceBytes` are host-level limits: generic budget
|
|
32
|
+
assessments represent them, while the integrating runtime supplies their live
|
|
33
|
+
usage. The generic tool executor directly enforces tool-call and duration
|
|
34
|
+
limits; it does not interrupt an already-started external call.
|
|
35
|
+
|
|
36
|
+
Definitions may also declare an `executionPolicy` and planning-step `dependsOn`
|
|
37
|
+
edges. Dependency cycles are invalid. The default remains one attempt with
|
|
38
|
+
fail-fast execution, preserving prior behavior when no policy is declared.
|
package/README.md
CHANGED
|
@@ -30,6 +30,42 @@ The package deliberately does not contain provider credentials, database access,
|
|
|
30
30
|
HTTP transport, UNS-specific tool implementations, or application-specific
|
|
31
31
|
workflow definitions.
|
|
32
32
|
|
|
33
|
+
## Bounded Execution
|
|
34
|
+
|
|
35
|
+
An application can make execution limits part of the versioned workflow
|
|
36
|
+
definition. Oversized plans are blocked before invocation queue construction,
|
|
37
|
+
and the generic executor checks tool-call and elapsed-time limits again.
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
const workflow = defineAssistantWorkflow({
|
|
41
|
+
id: "documentation-agent",
|
|
42
|
+
version: 1,
|
|
43
|
+
executionBudget: {
|
|
44
|
+
maxPlanningSteps: 6,
|
|
45
|
+
maxToolCalls: 4,
|
|
46
|
+
maxProviderCalls: 3,
|
|
47
|
+
maxDurationMs: 30_000,
|
|
48
|
+
maxEvidenceBytes: 250_000,
|
|
49
|
+
},
|
|
50
|
+
executionPolicy: {
|
|
51
|
+
failureMode: "continue-independent",
|
|
52
|
+
maxAttemptsPerTool: 2,
|
|
53
|
+
},
|
|
54
|
+
intents: [/* ... */],
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The host reports live LLM/provider-call and evidence-byte usage through
|
|
59
|
+
`buildAssistantWorkflowExecutionBudgetAssessment`. Tool execution does not
|
|
60
|
+
interrupt an external call already in progress; a consumed duration budget
|
|
61
|
+
prevents the next call from starting.
|
|
62
|
+
|
|
63
|
+
Planning steps may declare `dependsOn`. Definition validation rejects unknown,
|
|
64
|
+
self-referencing, and cyclic dependencies. `continue-independent` skips a
|
|
65
|
+
dependent step after its prerequisite fails while allowing unrelated steps to
|
|
66
|
+
finish. Retries are limited to capabilities whose `retryClass` is not `never`,
|
|
67
|
+
and their maximum attempts count against `maxToolCalls` before execution.
|
|
68
|
+
|
|
33
69
|
## Tool-Selection Evaluation
|
|
34
70
|
|
|
35
71
|
Tool-selection replay reports distinguish a workflow failure from an expected
|
|
@@ -119,5 +155,9 @@ pnpm --filter @uns-kit/assistant-workflow run verify
|
|
|
119
155
|
pnpm --filter @uns-kit/assistant-workflow run build
|
|
120
156
|
```
|
|
121
157
|
|
|
158
|
+
Public API and compatibility rules are documented in
|
|
159
|
+
[`API_STABILITY.md`](./API_STABILITY.md). New source modules are internal unless
|
|
160
|
+
they are deliberately exported from both the package root and `exports` map.
|
|
161
|
+
|
|
122
162
|
The package is versioned with the rest of `@uns-kit/*`. Publishing is a manual
|
|
123
163
|
maintainer action and is not performed by package verification commands.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type AssistantWorkflowDefinition } from "./definition.js";
|
|
2
2
|
export type AssistantWorkflowDefinitionDiagnosticSeverity = "error" | "warning";
|
|
3
|
-
export type AssistantWorkflowDefinitionDiagnosticCode = "missing_workflow_id" | "invalid_workflow_version" | "missing_intents" | "missing_id" | "unnormalized_id" | "duplicate_id" | "missing_description" | "missing_tool_hints" | "missing_tool_output_kinds" | "missing_binding_field" | "invalid_http_method" | "invalid_tool_selection_profile_condition" | "invalid_planning_step_profile_condition" | "missing_repl_target" | "unknown_tool_capability" | "tool_provider_mismatch" | "unknown_presentation" | "unknown_memory_slot" | "unknown_planning_step" | "unknown_clarification_rule" | "invalid_confidence_threshold" | "unbound_tool_capability" | "binding_without_capability";
|
|
3
|
+
export type AssistantWorkflowDefinitionDiagnosticCode = "missing_workflow_id" | "invalid_workflow_version" | "missing_intents" | "missing_id" | "unnormalized_id" | "duplicate_id" | "missing_description" | "missing_tool_hints" | "missing_tool_output_kinds" | "missing_binding_field" | "invalid_http_method" | "invalid_tool_selection_profile_condition" | "invalid_planning_step_profile_condition" | "missing_repl_target" | "unknown_tool_capability" | "tool_provider_mismatch" | "unknown_presentation" | "unknown_memory_slot" | "unknown_planning_step" | "invalid_planning_step_dependency" | "unknown_clarification_rule" | "invalid_confidence_threshold" | "invalid_execution_budget" | "invalid_execution_policy" | "unbound_tool_capability" | "binding_without_capability";
|
|
4
4
|
export type AssistantWorkflowDefinitionDiagnostic = {
|
|
5
5
|
severity: AssistantWorkflowDefinitionDiagnosticSeverity;
|
|
6
6
|
code: AssistantWorkflowDefinitionDiagnosticCode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition-diagnostics.d.ts","sourceRoot":"","sources":["../src/definition-diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,2BAA2B,EAOjC,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"definition-diagnostics.d.ts","sourceRoot":"","sources":["../src/definition-diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,2BAA2B,EAOjC,MAAM,iBAAiB,CAAC;AAIzB,MAAM,MAAM,6CAA6C,GAAG,OAAO,GAAG,SAAS,CAAC;AAEhF,MAAM,MAAM,yCAAyC,GACjD,qBAAqB,GACrB,0BAA0B,GAC1B,iBAAiB,GACjB,YAAY,GACZ,iBAAiB,GACjB,cAAc,GACd,qBAAqB,GACrB,oBAAoB,GACpB,2BAA2B,GAC3B,uBAAuB,GACvB,qBAAqB,GACrB,0CAA0C,GAC1C,yCAAyC,GACzC,qBAAqB,GACrB,yBAAyB,GACzB,wBAAwB,GACxB,sBAAsB,GACtB,qBAAqB,GACrB,uBAAuB,GACvB,kCAAkC,GAClC,4BAA4B,GAC5B,8BAA8B,GAC9B,0BAA0B,GAC1B,0BAA0B,GAC1B,yBAAyB,GACzB,4BAA4B,CAAC;AAEjC,MAAM,MAAM,qCAAqC,GAAG;IAClD,QAAQ,EAAE,6CAA6C,CAAC;IACxD,IAAI,EAAE,yCAAyC,CAAC;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,2CAA2C,GAAG;IACxD,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,qCAAqC,EAAE,CAAC;CACtD,CAAC;AAEF,wBAAgB,mCAAmC,CACjD,QAAQ,EAAE,2BAA2B,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GACpE,2CAA2C,CA0B7C"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { normalizeAssistantWorkflowId, } from "./definition.js";
|
|
2
|
+
import { assertAssistantWorkflowExecutionBudget } from "./execution-budget.js";
|
|
3
|
+
import { assertAssistantWorkflowExecutionPolicy } from "./execution-policy.js";
|
|
2
4
|
export function validateAssistantWorkflowDefinition(workflow) {
|
|
3
5
|
const diagnostics = [];
|
|
4
6
|
validateHeader(workflow, diagnostics);
|
|
7
|
+
validateExecutionBudget(workflow, diagnostics);
|
|
8
|
+
validateExecutionPolicy(workflow, diagnostics);
|
|
5
9
|
validateVocabulary("intent", "intents", workflow.intents, diagnostics);
|
|
6
10
|
validateVocabulary("subintent", "subintents", workflow.subintents ?? [], diagnostics);
|
|
7
11
|
validateVocabulary("presentation", "presentations", workflow.presentations ?? [], diagnostics);
|
|
@@ -22,6 +26,26 @@ export function validateAssistantWorkflowDefinition(workflow) {
|
|
|
22
26
|
diagnostics,
|
|
23
27
|
};
|
|
24
28
|
}
|
|
29
|
+
function validateExecutionPolicy(workflow, diagnostics) {
|
|
30
|
+
if (!workflow.executionPolicy)
|
|
31
|
+
return;
|
|
32
|
+
try {
|
|
33
|
+
assertAssistantWorkflowExecutionPolicy(workflow.executionPolicy);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
addDiagnostic(diagnostics, "error", "invalid_execution_policy", "executionPolicy", error instanceof Error ? error.message : "Assistant workflow execution policy is invalid.");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function validateExecutionBudget(workflow, diagnostics) {
|
|
40
|
+
if (!workflow.executionBudget)
|
|
41
|
+
return;
|
|
42
|
+
try {
|
|
43
|
+
assertAssistantWorkflowExecutionBudget(workflow.executionBudget);
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
addDiagnostic(diagnostics, "error", "invalid_execution_budget", "executionBudget", error instanceof Error ? error.message : "Assistant workflow execution budget is invalid.");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
25
49
|
function validateHeader(workflow, diagnostics) {
|
|
26
50
|
if (!workflow.id.trim().length) {
|
|
27
51
|
addDiagnostic(diagnostics, "error", "missing_workflow_id", "id", "Assistant workflow id is required.");
|
|
@@ -139,6 +163,44 @@ function validateMemorySlots(slots, diagnostics) {
|
|
|
139
163
|
}
|
|
140
164
|
function validatePlanningSteps(steps, diagnostics) {
|
|
141
165
|
validateVocabulary("planning step", "planningSteps", steps, diagnostics);
|
|
166
|
+
const stepsById = new Map(steps.map((step) => [step.id, step]));
|
|
167
|
+
for (const [index, step] of steps.entries()) {
|
|
168
|
+
for (const dependencyId of step.dependsOn ?? []) {
|
|
169
|
+
if (dependencyId === step.id) {
|
|
170
|
+
addDiagnostic(diagnostics, "error", "invalid_planning_step_dependency", `planningSteps[${index}].dependsOn`, `Assistant workflow planning step ${step.id} must not depend on itself.`);
|
|
171
|
+
}
|
|
172
|
+
else if (!stepsById.has(dependencyId)) {
|
|
173
|
+
addDiagnostic(diagnostics, "error", "invalid_planning_step_dependency", `planningSteps[${index}].dependsOn`, `Assistant workflow planning step ${step.id} references unknown dependency: ${dependencyId}.`);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
for (const cycleStepId of findPlanningStepDependencyCycles(stepsById)) {
|
|
178
|
+
const index = steps.findIndex((step) => step.id === cycleStepId);
|
|
179
|
+
addDiagnostic(diagnostics, "error", "invalid_planning_step_dependency", `planningSteps[${index}].dependsOn`, `Assistant workflow planning step dependencies contain a cycle at: ${cycleStepId}.`);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
function findPlanningStepDependencyCycles(stepsById) {
|
|
183
|
+
const visiting = new Set();
|
|
184
|
+
const visited = new Set();
|
|
185
|
+
const cycles = new Set();
|
|
186
|
+
const visit = (stepId) => {
|
|
187
|
+
if (visited.has(stepId))
|
|
188
|
+
return;
|
|
189
|
+
if (visiting.has(stepId)) {
|
|
190
|
+
cycles.add(stepId);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
visiting.add(stepId);
|
|
194
|
+
for (const dependencyId of stepsById.get(stepId)?.dependsOn ?? []) {
|
|
195
|
+
if (stepsById.has(dependencyId))
|
|
196
|
+
visit(dependencyId);
|
|
197
|
+
}
|
|
198
|
+
visiting.delete(stepId);
|
|
199
|
+
visited.add(stepId);
|
|
200
|
+
};
|
|
201
|
+
for (const stepId of stepsById.keys())
|
|
202
|
+
visit(stepId);
|
|
203
|
+
return [...cycles];
|
|
142
204
|
}
|
|
143
205
|
function validateClarificationRules(rules, diagnostics) {
|
|
144
206
|
validateVocabulary("clarification rule", "clarificationRules", rules, diagnostics);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition-diagnostics.js","sourceRoot":"","sources":["../src/definition-diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,GAS7B,MAAM,iBAAiB,CAAC;AA2CzB,MAAM,UAAU,mCAAmC,CACjD,QAAqE;IAErE,MAAM,WAAW,GAA4C,EAAE,CAAC;IAEhE,cAAc,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACtC,kBAAkB,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IACvE,kBAAkB,CAAC,WAAW,EAAE,YAAY,EAAE,QAAQ,CAAC,UAAU,IAAI,EAAE,EAAE,WAAW,CAAC,CAAC;IACtF,kBAAkB,CAAC,cAAc,EAAE,eAAe,EAAE,QAAQ,CAAC,aAAa,IAAI,EAAE,EAAE,WAAW,CAAC,CAAC;IAC/F,kBAAkB,CAAC,mBAAmB,EAAE,mBAAmB,EAAE,QAAQ,CAAC,iBAAiB,IAAI,EAAE,EAAE,WAAW,CAAC,CAAC;IAC5G,wBAAwB,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE,EAA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AAW,EAAE,OAAO,EAAE,0CAA0C,EAAE,GAAG,WAAW,2BAA2B,EAAE,6BAA6B,QAAQ,2BAA2B,OAAO,CAAC,EAAE,oCAAoC,CAAC,CAAC;IAC7O,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CACpB,WAAoD,EACpD,QAAuD,EACvD,IAA+C,EAC/C,IAAY,EACZ,OAAe;IAEf,WAAW,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;AACtD,CAAC","sourcesContent":["import {\n normalizeAssistantWorkflowId,\n type AssistantWorkflowClarificationRuleDefinition,\n type AssistantWorkflowDefinition,\n type AssistantWorkflowDirectRouteDefinition,\n type AssistantWorkflowMemorySlotDefinition,\n type AssistantWorkflowPlanningStepDefinition,\n type AssistantWorkflowToolBindingDefinition,\n type AssistantWorkflowToolCapabilityDefinition,\n type AssistantWorkflowVocabularyItem,\n} from \"./definition.js\";\n\nexport type AssistantWorkflowDefinitionDiagnosticSeverity = \"error\" | \"warning\";\n\nexport type AssistantWorkflowDefinitionDiagnosticCode =\n | \"missing_workflow_id\"\n | \"invalid_workflow_version\"\n | \"missing_intents\"\n | \"missing_id\"\n | \"unnormalized_id\"\n | \"duplicate_id\"\n | \"missing_description\"\n | \"missing_tool_hints\"\n | \"missing_tool_output_kinds\"\n | \"missing_binding_field\"\n | \"invalid_http_method\"\n | \"invalid_tool_selection_profile_condition\"\n | \"invalid_planning_step_profile_condition\"\n | \"missing_repl_target\"\n | \"unknown_tool_capability\"\n | \"tool_provider_mismatch\"\n | \"unknown_presentation\"\n | \"unknown_memory_slot\"\n | \"unknown_planning_step\"\n | \"unknown_clarification_rule\"\n | \"invalid_confidence_threshold\"\n | \"unbound_tool_capability\"\n | \"binding_without_capability\";\n\nexport type AssistantWorkflowDefinitionDiagnostic = {\n severity: AssistantWorkflowDefinitionDiagnosticSeverity;\n code: AssistantWorkflowDefinitionDiagnosticCode;\n path: string;\n message: string;\n};\n\nexport type AssistantWorkflowDefinitionValidationResult = {\n valid: boolean;\n errorCount: number;\n warningCount: number;\n diagnostics: AssistantWorkflowDefinitionDiagnostic[];\n};\n\nexport function validateAssistantWorkflowDefinition(\n workflow: AssistantWorkflowDefinition<string, string, string, string>,\n): AssistantWorkflowDefinitionValidationResult {\n const diagnostics: AssistantWorkflowDefinitionDiagnostic[] = [];\n\n validateHeader(workflow, diagnostics);\n validateVocabulary(\"intent\", \"intents\", workflow.intents, diagnostics);\n validateVocabulary(\"subintent\", \"subintents\", workflow.subintents ?? [], diagnostics);\n validateVocabulary(\"presentation\", \"presentations\", workflow.presentations ?? [], diagnostics);\n validateVocabulary(\"derived transform\", \"derivedTransforms\", workflow.derivedTransforms ?? [], diagnostics);\n validateToolCapabilities(workflow.tools ?? [], diagnostics);\n validateToolBindings(workflow.toolBindings ?? [], diagnostics);\n validateMemorySlots(workflow.memorySlots ?? [], diagnostics);\n validatePlanningSteps(workflow.planningSteps ?? [], diagnostics);\n validateClarificationRules(workflow.clarificationRules ?? [], diagnostics);\n validateDirectRoutes(workflow.directRoutes ?? [], diagnostics);\n validateReferences(workflow, diagnostics);\n\n const errorCount = diagnostics.filter((diagnostic) => diagnostic.severity === \"error\").length;\n const warningCount = diagnostics.filter((diagnostic) => diagnostic.severity === \"warning\").length;\n return {\n valid: errorCount === 0,\n errorCount,\n warningCount,\n diagnostics,\n };\n}\n\nfunction validateHeader(\n workflow: AssistantWorkflowDefinition<string, string, string, string>,\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n if (!workflow.id.trim().length) {\n addDiagnostic(diagnostics, \"error\", \"missing_workflow_id\", \"id\", \"Assistant workflow id is required.\");\n }\n if (!Number.isInteger(workflow.version) || workflow.version < 1) {\n addDiagnostic(diagnostics, \"error\", \"invalid_workflow_version\", \"version\", \"Assistant workflow version must be a positive integer.\");\n }\n if (!workflow.intents.length) {\n addDiagnostic(diagnostics, \"error\", \"missing_intents\", \"intents\", \"Assistant workflow must define at least one intent.\");\n }\n}\n\nfunction validateVocabulary(\n kind: string,\n path: string,\n items: readonly AssistantWorkflowVocabularyItem[],\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n const seen = new Map<string, number>();\n for (const [index, item] of items.entries()) {\n const itemPath = `${path}[${index}]`;\n const normalized = normalizeAssistantWorkflowId(item.id);\n if (!normalized) {\n addDiagnostic(diagnostics, \"error\", \"missing_id\", `${itemPath}.id`, `Assistant workflow ${kind} id is required.`);\n continue;\n }\n if (normalized !== item.id) {\n addDiagnostic(diagnostics, \"error\", \"unnormalized_id\", `${itemPath}.id`, `Assistant workflow ${kind} id must already be normalized: ${item.id}.`);\n }\n const firstIndex = seen.get(normalized);\n if (firstIndex !== undefined) {\n addDiagnostic(diagnostics, \"error\", \"duplicate_id\", `${itemPath}.id`, `Duplicate assistant workflow ${kind} id: ${normalized}; first seen at ${path}[${firstIndex}].`);\n } else {\n seen.set(normalized, index);\n }\n if (!item.description.trim().length) {\n addDiagnostic(diagnostics, \"error\", \"missing_description\", `${itemPath}.description`, `Assistant workflow ${kind} ${normalized} description is required.`);\n }\n }\n}\n\nfunction validateToolCapabilities(\n tools: readonly AssistantWorkflowToolCapabilityDefinition[],\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n const seen = new Map<string, number>();\n for (const [index, tool] of tools.entries()) {\n const path = `tools[${index}]`;\n const normalized = normalizeAssistantWorkflowId(tool.name);\n if (!normalized) {\n addDiagnostic(diagnostics, \"error\", \"missing_id\", `${path}.name`, \"Assistant workflow tool capability name is required.\");\n continue;\n }\n if (normalized !== tool.name) {\n addDiagnostic(diagnostics, \"error\", \"unnormalized_id\", `${path}.name`, `Assistant workflow tool capability name must already be normalized: ${tool.name}.`);\n }\n const firstIndex = seen.get(normalized);\n if (firstIndex !== undefined) {\n addDiagnostic(diagnostics, \"error\", \"duplicate_id\", `${path}.name`, `Duplicate assistant workflow tool capability: ${normalized}; first seen at tools[${firstIndex}].`);\n } else {\n seen.set(normalized, index);\n }\n if (!tool.outputKinds.length) {\n addDiagnostic(diagnostics, \"error\", \"missing_tool_output_kinds\", `${path}.outputKinds`, `Assistant workflow tool capability ${normalized} must define at least one output kind.`);\n }\n }\n}\n\nfunction validateToolBindings(\n bindings: readonly AssistantWorkflowToolBindingDefinition[],\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n const seen = new Map<string, number>();\n for (const [index, binding] of bindings.entries()) {\n const path = `toolBindings[${index}]`;\n const normalized = normalizeAssistantWorkflowId(binding.name);\n if (!normalized) {\n addDiagnostic(diagnostics, \"error\", \"missing_id\", `${path}.name`, \"Assistant workflow tool binding name is required.\");\n continue;\n }\n if (normalized !== binding.name) {\n addDiagnostic(diagnostics, \"error\", \"unnormalized_id\", `${path}.name`, `Assistant workflow tool binding name must already be normalized: ${binding.name}.`);\n }\n const firstIndex = seen.get(normalized);\n if (firstIndex !== undefined) {\n addDiagnostic(diagnostics, \"error\", \"duplicate_id\", `${path}.name`, `Duplicate assistant workflow tool binding: ${normalized}; first seen at toolBindings[${firstIndex}].`);\n } else {\n seen.set(normalized, index);\n }\n validateToolBindingTarget(binding, path, diagnostics);\n }\n}\n\nfunction validateToolBindingTarget(\n binding: AssistantWorkflowToolBindingDefinition,\n path: string,\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n switch (binding.provider) {\n case \"local-function\":\n validateRequiredField(binding.handlerId, `${path}.handlerId`, binding.name, \"handlerId\", diagnostics);\n return;\n case \"http\":\n validateRequiredField(binding.path, `${path}.path`, binding.name, \"path\", diagnostics);\n if (binding.method !== undefined && binding.method !== binding.method.toUpperCase()) {\n addDiagnostic(diagnostics, \"error\", \"invalid_http_method\", `${path}.method`, `Assistant workflow tool binding ${binding.name} HTTP method must be uppercase.`);\n }\n return;\n case \"openai-hosted\":\n validateRequiredField(binding.hostedToolType, `${path}.hostedToolType`, binding.name, \"hostedToolType\", diagnostics);\n return;\n case \"mcp\":\n validateRequiredField(binding.serverId, `${path}.serverId`, binding.name, \"serverId\", diagnostics);\n validateRequiredField(binding.toolName, `${path}.toolName`, binding.name, \"toolName\", diagnostics);\n return;\n case \"repl\":\n validateRequiredField(binding.runtimeId, `${path}.runtimeId`, binding.name, \"runtimeId\", diagnostics);\n if (!binding.functionName?.trim().length && !binding.commandTemplate?.trim().length) {\n addDiagnostic(diagnostics, \"error\", \"missing_repl_target\", path, `Assistant workflow tool binding ${binding.name} must define functionName or commandTemplate.`);\n }\n return;\n }\n}\n\nfunction validateRequiredField(\n value: string,\n path: string,\n toolName: string,\n fieldName: string,\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n if (!value.trim().length) {\n addDiagnostic(diagnostics, \"error\", \"missing_binding_field\", path, `Assistant workflow tool binding ${toolName} ${fieldName} is required.`);\n }\n}\n\nfunction validateMemorySlots(\n slots: readonly AssistantWorkflowMemorySlotDefinition[],\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n validateVocabulary(\"memory slot\", \"memorySlots\", slots, diagnostics);\n}\n\nfunction validatePlanningSteps(\n steps: readonly AssistantWorkflowPlanningStepDefinition[],\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n validateVocabulary(\"planning step\", \"planningSteps\", steps, diagnostics);\n}\n\nfunction validateClarificationRules(\n rules: readonly AssistantWorkflowClarificationRuleDefinition[],\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n validateVocabulary(\"clarification rule\", \"clarificationRules\", rules, diagnostics);\n for (const [index, rule] of rules.entries()) {\n if (\n rule.condition === \"low_confidence\" &&\n rule.confidenceBelow !== undefined &&\n (!Number.isFinite(rule.confidenceBelow) || rule.confidenceBelow < 0 || rule.confidenceBelow > 1)\n ) {\n addDiagnostic(diagnostics, \"error\", \"invalid_confidence_threshold\", `clarificationRules[${index}].confidenceBelow`, `Assistant workflow clarification rule ${rule.id} confidenceBelow must be between 0 and 1.`);\n }\n }\n}\n\nfunction validateDirectRoutes(\n routes: readonly AssistantWorkflowDirectRouteDefinition[],\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n validateVocabulary(\"direct route\", \"directRoutes\", routes, diagnostics);\n for (const [routeIndex, route] of routes.entries()) {\n validateVocabulary(\n `direct route ${route.id} strategy`,\n `directRoutes[${routeIndex}].strategies`,\n route.strategies ?? [],\n diagnostics,\n );\n }\n}\n\nfunction validateReferences(\n workflow: AssistantWorkflowDefinition<string, string, string, string>,\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n const toolCapabilities = new Map((workflow.tools ?? []).map((tool) => [tool.name, tool] as const));\n const toolBindings = new Map((workflow.toolBindings ?? []).map((binding) => [binding.name, binding] as const));\n const toolNames = new Set(toolCapabilities.keys());\n const presentationIds = new Set((workflow.presentations ?? []).map((presentation) => presentation.id));\n const subintentIds = new Set((workflow.subintents ?? []).map((subintent) => subintent.id));\n const memorySlotIds = new Set((workflow.memorySlots ?? []).map((slot) => slot.id));\n const planningStepIds = new Set((workflow.planningSteps ?? []).map((step) => step.id));\n const clarificationRuleIds = new Set((workflow.clarificationRules ?? []).map((rule) => rule.id));\n\n for (const [index, binding] of (workflow.toolBindings ?? []).entries()) {\n const capability = toolCapabilities.get(binding.name);\n if (toolCapabilities.size > 0 && !capability) {\n addDiagnostic(diagnostics, \"error\", \"binding_without_capability\", `toolBindings[${index}].name`, `Assistant workflow tool binding references unknown tool capability: ${binding.name}.`);\n }\n if (capability && capability.provider !== binding.provider) {\n addDiagnostic(diagnostics, \"error\", \"tool_provider_mismatch\", `toolBindings[${index}].provider`, `Assistant workflow tool binding ${binding.name} provider ${binding.provider} does not match capability provider ${capability.provider}.`);\n }\n }\n for (const [index, tool] of (workflow.tools ?? []).entries()) {\n if (!toolBindings.has(tool.name)) {\n addDiagnostic(diagnostics, \"warning\", \"unbound_tool_capability\", `tools[${index}].name`, `Assistant workflow tool capability ${tool.name} has no binding.`);\n }\n }\n\n for (const [index, step] of (workflow.planningSteps ?? []).entries()) {\n for (const toolName of [...(step.toolHints ?? []), ...(step.requiredToolHints ?? [])]) {\n if (toolNames.size > 0 && !toolNames.has(toolName)) {\n addDiagnostic(diagnostics, \"error\", \"unknown_tool_capability\", `planningSteps[${index}].toolHints`, `Assistant workflow planning step ${step.id} references unknown tool capability: ${toolName}.`);\n }\n }\n for (const slotId of [...(step.readsMemory ?? []), ...(step.writesMemory ?? [])]) {\n if (memorySlotIds.size > 0 && !memorySlotIds.has(slotId)) {\n addDiagnostic(diagnostics, \"error\", \"unknown_memory_slot\", `planningSteps[${index}].readsMemory`, `Assistant workflow planning step ${step.id} references unknown memory slot: ${slotId}.`);\n }\n }\n }\n\n for (const [index, rule] of (workflow.clarificationRules ?? []).entries()) {\n for (const slotId of [...(rule.readsMemory ?? []), ...(rule.writesMemory ?? [])]) {\n if (memorySlotIds.size > 0 && !memorySlotIds.has(slotId)) {\n addDiagnostic(diagnostics, \"error\", \"unknown_memory_slot\", `clarificationRules[${index}].readsMemory`, `Assistant workflow clarification rule ${rule.id} references unknown memory slot: ${slotId}.`);\n }\n }\n }\n\n for (const [index, intent] of workflow.intents.entries()) {\n validateIntentToolSelectionProfiles(intent, index, toolNames, subintentIds, diagnostics);\n validateIntentPlanningStepProfiles(intent, index, planningStepIds, toolNames, subintentIds, presentationIds, diagnostics);\n if (intent.defaultPresentation && !presentationIds.has(intent.defaultPresentation)) {\n addDiagnostic(diagnostics, \"error\", \"unknown_presentation\", `intents[${index}].defaultPresentation`, `Assistant workflow intent ${intent.id} references unknown presentation: ${intent.defaultPresentation}.`);\n }\n for (const toolName of [...(intent.toolHints ?? []), ...(intent.requiredToolHints ?? [])]) {\n if (toolNames.size > 0 && !toolNames.has(toolName)) {\n addDiagnostic(diagnostics, \"error\", \"unknown_tool_capability\", `intents[${index}].toolHints`, `Assistant workflow intent ${intent.id} references unknown tool capability: ${toolName}.`);\n }\n }\n for (const slotId of [\n ...(intent.memoryPolicy?.read ?? []),\n ...(intent.memoryPolicy?.write ?? []),\n ...(intent.memoryPolicy?.inject ?? []),\n ]) {\n if (memorySlotIds.size > 0 && !memorySlotIds.has(slotId)) {\n addDiagnostic(diagnostics, \"error\", \"unknown_memory_slot\", `intents[${index}].memoryPolicy`, `Assistant workflow intent ${intent.id} references unknown memory slot: ${slotId}.`);\n }\n }\n for (const stepId of intent.planningSteps ?? []) {\n if (planningStepIds.size > 0 && !planningStepIds.has(stepId)) {\n addDiagnostic(diagnostics, \"error\", \"unknown_planning_step\", `intents[${index}].planningSteps`, `Assistant workflow intent ${intent.id} references unknown planning step: ${stepId}.`);\n }\n }\n for (const ruleId of intent.clarificationRules ?? []) {\n if (clarificationRuleIds.size > 0 && !clarificationRuleIds.has(ruleId)) {\n addDiagnostic(diagnostics, \"error\", \"unknown_clarification_rule\", `intents[${index}].clarificationRules`, `Assistant workflow intent ${intent.id} references unknown clarification rule: ${ruleId}.`);\n }\n }\n }\n}\n\nfunction validateIntentPlanningStepProfiles(\n intent: AssistantWorkflowDefinition<string, string, string, string>[\"intents\"][number],\n intentIndex: number,\n planningStepIds: ReadonlySet<string>,\n toolNames: ReadonlySet<string>,\n subintentIds: ReadonlySet<string>,\n presentationIds: ReadonlySet<string>,\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n const seen = new Map<string, number>();\n for (const [profileIndex, profile] of (intent.planningStepProfiles ?? []).entries()) {\n const profilePath = `intents[${intentIndex}].planningStepProfiles[${profileIndex}]`;\n const normalized = normalizeAssistantWorkflowId(profile.id);\n if (!normalized) {\n addDiagnostic(diagnostics, \"error\", \"missing_id\", `${profilePath}.id`, `Assistant workflow intent ${intent.id} planning step profile id is required.`);\n continue;\n }\n if (normalized !== profile.id) {\n addDiagnostic(diagnostics, \"error\", \"unnormalized_id\", `${profilePath}.id`, `Assistant workflow intent ${intent.id} planning step profile id must already be normalized: ${profile.id}.`);\n }\n const firstIndex = seen.get(normalized);\n if (firstIndex !== undefined) {\n addDiagnostic(diagnostics, \"error\", \"duplicate_id\", `${profilePath}.id`, `Duplicate assistant workflow intent ${intent.id} planning step profile: ${normalized}; first seen at intents[${intentIndex}].planningStepProfiles[${firstIndex}].`);\n } else {\n seen.set(normalized, profileIndex);\n }\n if (!profile.description.trim().length) {\n addDiagnostic(diagnostics, \"error\", \"missing_description\", `${profilePath}.description`, `Assistant workflow intent ${intent.id} planning step profile ${normalized} description is required.`);\n }\n if (!profile.planningSteps.length) {\n addDiagnostic(diagnostics, \"error\", \"unknown_planning_step\", `${profilePath}.planningSteps`, `Assistant workflow intent ${intent.id} planning step profile ${normalized} must define at least one planning step.`);\n }\n for (const stepId of profile.planningSteps) {\n if (planningStepIds.size > 0 && !planningStepIds.has(stepId)) {\n addDiagnostic(diagnostics, \"error\", \"unknown_planning_step\", `${profilePath}.planningSteps`, `Assistant workflow intent ${intent.id} planning step profile ${normalized} references unknown planning step: ${stepId}.`);\n }\n }\n for (const toolName of profile.condition?.requiredTools ?? []) {\n if (toolNames.size > 0 && !toolNames.has(toolName)) {\n addDiagnostic(diagnostics, \"error\", \"unknown_tool_capability\", `${profilePath}.condition.requiredTools`, `Assistant workflow intent ${intent.id} planning step profile ${normalized} references unknown required tool: ${toolName}.`);\n }\n }\n const condition = profile.condition;\n if (condition?.subintent && subintentIds.size > 0 && !subintentIds.has(condition.subintent)) {\n addDiagnostic(diagnostics, \"error\", \"missing_id\", `${profilePath}.condition.subintent`, `Assistant workflow intent ${intent.id} planning step profile ${normalized} references unknown subintent: ${condition.subintent}.`);\n }\n if (condition?.presentation && presentationIds.size > 0 && !presentationIds.has(condition.presentation)) {\n addDiagnostic(diagnostics, \"error\", \"unknown_presentation\", `${profilePath}.condition.presentation`, `Assistant workflow intent ${intent.id} planning step profile ${normalized} references unknown presentation: ${condition.presentation}.`);\n }\n validatePlanningStepProfileCondition(intent.id, profile, profilePath, diagnostics);\n }\n}\n\nfunction validateIntentToolSelectionProfiles(\n intent: AssistantWorkflowDefinition<string, string, string, string>[\"intents\"][number],\n intentIndex: number,\n toolNames: ReadonlySet<string>,\n subintentIds: ReadonlySet<string>,\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n const seen = new Map<string, number>();\n for (const [profileIndex, profile] of (intent.toolSelectionProfiles ?? []).entries()) {\n const profilePath = `intents[${intentIndex}].toolSelectionProfiles[${profileIndex}]`;\n const normalized = normalizeAssistantWorkflowId(profile.id);\n if (!normalized) {\n addDiagnostic(diagnostics, \"error\", \"missing_id\", `${profilePath}.id`, `Assistant workflow intent ${intent.id} tool selection profile id is required.`);\n continue;\n }\n if (normalized !== profile.id) {\n addDiagnostic(diagnostics, \"error\", \"unnormalized_id\", `${profilePath}.id`, `Assistant workflow intent ${intent.id} tool selection profile id must already be normalized: ${profile.id}.`);\n }\n const firstIndex = seen.get(normalized);\n if (firstIndex !== undefined) {\n addDiagnostic(diagnostics, \"error\", \"duplicate_id\", `${profilePath}.id`, `Duplicate assistant workflow intent ${intent.id} tool selection profile: ${normalized}; first seen at intents[${intentIndex}].toolSelectionProfiles[${firstIndex}].`);\n } else {\n seen.set(normalized, profileIndex);\n }\n if (!profile.description.trim().length) {\n addDiagnostic(diagnostics, \"error\", \"missing_description\", `${profilePath}.description`, `Assistant workflow intent ${intent.id} tool selection profile ${normalized} description is required.`);\n }\n if (!profile.toolHints.length) {\n addDiagnostic(diagnostics, \"error\", \"missing_tool_hints\", `${profilePath}.toolHints`, `Assistant workflow intent ${intent.id} tool selection profile ${normalized} must define at least one tool hint.`);\n }\n for (const toolName of profile.toolHints) {\n if (toolNames.size > 0 && !toolNames.has(toolName)) {\n addDiagnostic(diagnostics, \"error\", \"unknown_tool_capability\", `${profilePath}.toolHints`, `Assistant workflow intent ${intent.id} tool selection profile ${normalized} references unknown tool capability: ${toolName}.`);\n }\n }\n validateToolSelectionProfileCondition(intent.id, profile, profilePath, subintentIds, diagnostics);\n }\n}\n\nfunction validatePlanningStepProfileCondition(\n intentId: string,\n profile: NonNullable<AssistantWorkflowDefinition<string, string, string, string>[\"intents\"][number][\"planningStepProfiles\"]>[number],\n profilePath: string,\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n const { minConfidence, maxConfidence, subintent, presentation, timeWindowHint, requiredTools } = profile.condition ?? {};\n if (minConfidence !== undefined && (!Number.isFinite(minConfidence) || minConfidence < 0 || minConfidence > 1)) {\n addDiagnostic(diagnostics, \"error\", \"invalid_planning_step_profile_condition\", `${profilePath}.condition.minConfidence`, `Assistant workflow intent ${intentId} planning step profile ${profile.id} minConfidence must be between 0 and 1.`);\n }\n if (maxConfidence !== undefined && (!Number.isFinite(maxConfidence) || maxConfidence < 0 || maxConfidence > 1)) {\n addDiagnostic(diagnostics, \"error\", \"invalid_planning_step_profile_condition\", `${profilePath}.condition.maxConfidence`, `Assistant workflow intent ${intentId} planning step profile ${profile.id} maxConfidence must be between 0 and 1.`);\n }\n if (minConfidence !== undefined && maxConfidence !== undefined && minConfidence > maxConfidence) {\n addDiagnostic(diagnostics, \"error\", \"invalid_planning_step_profile_condition\", `${profilePath}.condition`, `Assistant workflow intent ${intentId} planning step profile ${profile.id} minConfidence must not exceed maxConfidence.`);\n }\n if (subintent !== undefined && !subintent.trim().length) {\n addDiagnostic(diagnostics, \"error\", \"invalid_planning_step_profile_condition\", `${profilePath}.condition.subintent`, `Assistant workflow intent ${intentId} planning step profile ${profile.id} subintent must not be empty.`);\n }\n if (presentation !== undefined && !presentation.trim().length) {\n addDiagnostic(diagnostics, \"error\", \"invalid_planning_step_profile_condition\", `${profilePath}.condition.presentation`, `Assistant workflow intent ${intentId} planning step profile ${profile.id} presentation must not be empty.`);\n }\n if (timeWindowHint !== undefined && !timeWindowHint.trim().length) {\n addDiagnostic(diagnostics, \"error\", \"invalid_planning_step_profile_condition\", `${profilePath}.condition.timeWindowHint`, `Assistant workflow intent ${intentId} planning step profile ${profile.id} timeWindowHint must not be empty.`);\n }\n if (requiredTools !== undefined && requiredTools.length === 0) {\n addDiagnostic(diagnostics, \"error\", \"invalid_planning_step_profile_condition\", `${profilePath}.condition.requiredTools`, `Assistant workflow intent ${intentId} planning step profile ${profile.id} requiredTools must not be empty.`);\n }\n}\n\nfunction validateToolSelectionProfileCondition(\n intentId: string,\n profile: NonNullable<AssistantWorkflowDefinition<string, string, string, string>[\"intents\"][number][\"toolSelectionProfiles\"]>[number],\n profilePath: string,\n subintentIds: ReadonlySet<string>,\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n const { minHop, maxHop, selectedReason, subintent } = profile.condition ?? {};\n if (minHop !== undefined && (!Number.isInteger(minHop) || minHop < 0)) {\n addDiagnostic(diagnostics, \"error\", \"invalid_tool_selection_profile_condition\", `${profilePath}.condition.minHop`, `Assistant workflow intent ${intentId} tool selection profile ${profile.id} minHop must be a non-negative integer.`);\n }\n if (maxHop !== undefined && (!Number.isInteger(maxHop) || maxHop < 0)) {\n addDiagnostic(diagnostics, \"error\", \"invalid_tool_selection_profile_condition\", `${profilePath}.condition.maxHop`, `Assistant workflow intent ${intentId} tool selection profile ${profile.id} maxHop must be a non-negative integer.`);\n }\n if (minHop !== undefined && maxHop !== undefined && minHop > maxHop) {\n addDiagnostic(diagnostics, \"error\", \"invalid_tool_selection_profile_condition\", `${profilePath}.condition`, `Assistant workflow intent ${intentId} tool selection profile ${profile.id} minHop must not exceed maxHop.`);\n }\n if (subintent !== undefined && subintent !== null) {\n const normalizedSubintent = subintent.trim();\n if (!normalizedSubintent.length) {\n addDiagnostic(diagnostics, \"error\", \"invalid_tool_selection_profile_condition\", `${profilePath}.condition.subintent`, `Assistant workflow intent ${intentId} tool selection profile ${profile.id} subintent must not be empty.`);\n } else if (subintentIds.size > 0 && !subintentIds.has(normalizedSubintent)) {\n addDiagnostic(diagnostics, \"error\", \"missing_id\", `${profilePath}.condition.subintent`, `Assistant workflow intent ${intentId} tool selection profile ${profile.id} references unknown subintent: ${normalizedSubintent}.`);\n }\n }\n if (selectedReason !== undefined && !selectedReason.trim().length) {\n addDiagnostic(diagnostics, \"error\", \"invalid_tool_selection_profile_condition\", `${profilePath}.condition.selectedReason`, `Assistant workflow intent ${intentId} tool selection profile ${profile.id} selectedReason must not be empty.`);\n }\n}\n\nfunction addDiagnostic(\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n severity: AssistantWorkflowDefinitionDiagnosticSeverity,\n code: AssistantWorkflowDefinitionDiagnosticCode,\n path: string,\n message: string,\n): void {\n diagnostics.push({ severity, code, path, message });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"definition-diagnostics.js","sourceRoot":"","sources":["../src/definition-diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,GAS7B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,sCAAsC,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,sCAAsC,EAAE,MAAM,uBAAuB,CAAC;AA8C/E,MAAM,UAAU,mCAAmC,CACjD,QAAqE;IAErE,MAAM,WAAW,GAA4C,EAAE,CAAC;IAEhE,cAAc,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACtC,uBAAuB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IAC/C,uBAAuB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IAC/C,kBAAkB,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IACvE,kBAAkB,CAAC,WAAW,EAAE,YAAY,EAAE,QAAQ,CAAC,UAAU,IAAI,EAAE,EAAE,WAAW,CAAC,CAAC;IACtF,kBAAkB,CAAC,cAAc,EAAE,eAAe,EAAE,QAAQ,CAAC,aAAa,IAAI,EAAE,EAAE,WAAW,CAAC,CAAC;IAC/F,kBAAkB,CAAC,mBAAmB,EAAE,mBAAmB,EAAE,QAAQ,CAAC,iBAAiB,IAAI,EAAE,EAAE,WAAW,CAAC,CAAC;IAC5G,wBAAwB,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE,EAAE,WAAW,CAAC,CAAC;IAC5D,oBAAoB,CAAC,QAAQ,CAAC,YAAY,IA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OAAO,EAAE,YAAY,EAAE,GAAG,WAAW,sBAAsB,EAAE,6BAA6B,QAAQ,2BAA2B,OAAO,CAAC,EAAE,kCAAkC,mBAAmB,GAAG,CAAC,CAAC;QAC9N,CAAC;IACH,CAAC;IACD,IAAI,cAAc,KAAK,SAAS,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,CAAC;QAClE,aAAa,CAAC,WAAW,EAAE,OAAO,EAAE,0CAA0C,EAAE,GAAG,WAAW,2BAA2B,EAAE,6BAA6B,QAAQ,2BAA2B,OAAO,CAAC,EAAE,oCAAoC,CAAC,CAAC;IAC7O,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CACpB,WAAoD,EACpD,QAAuD,EACvD,IAA+C,EAC/C,IAAY,EACZ,OAAe;IAEf,WAAW,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;AACtD,CAAC","sourcesContent":["import {\n normalizeAssistantWorkflowId,\n type AssistantWorkflowClarificationRuleDefinition,\n type AssistantWorkflowDefinition,\n type AssistantWorkflowDirectRouteDefinition,\n type AssistantWorkflowMemorySlotDefinition,\n type AssistantWorkflowPlanningStepDefinition,\n type AssistantWorkflowToolBindingDefinition,\n type AssistantWorkflowToolCapabilityDefinition,\n type AssistantWorkflowVocabularyItem,\n} from \"./definition.js\";\nimport { assertAssistantWorkflowExecutionBudget } from \"./execution-budget.js\";\nimport { assertAssistantWorkflowExecutionPolicy } from \"./execution-policy.js\";\n\nexport type AssistantWorkflowDefinitionDiagnosticSeverity = \"error\" | \"warning\";\n\nexport type AssistantWorkflowDefinitionDiagnosticCode =\n | \"missing_workflow_id\"\n | \"invalid_workflow_version\"\n | \"missing_intents\"\n | \"missing_id\"\n | \"unnormalized_id\"\n | \"duplicate_id\"\n | \"missing_description\"\n | \"missing_tool_hints\"\n | \"missing_tool_output_kinds\"\n | \"missing_binding_field\"\n | \"invalid_http_method\"\n | \"invalid_tool_selection_profile_condition\"\n | \"invalid_planning_step_profile_condition\"\n | \"missing_repl_target\"\n | \"unknown_tool_capability\"\n | \"tool_provider_mismatch\"\n | \"unknown_presentation\"\n | \"unknown_memory_slot\"\n | \"unknown_planning_step\"\n | \"invalid_planning_step_dependency\"\n | \"unknown_clarification_rule\"\n | \"invalid_confidence_threshold\"\n | \"invalid_execution_budget\"\n | \"invalid_execution_policy\"\n | \"unbound_tool_capability\"\n | \"binding_without_capability\";\n\nexport type AssistantWorkflowDefinitionDiagnostic = {\n severity: AssistantWorkflowDefinitionDiagnosticSeverity;\n code: AssistantWorkflowDefinitionDiagnosticCode;\n path: string;\n message: string;\n};\n\nexport type AssistantWorkflowDefinitionValidationResult = {\n valid: boolean;\n errorCount: number;\n warningCount: number;\n diagnostics: AssistantWorkflowDefinitionDiagnostic[];\n};\n\nexport function validateAssistantWorkflowDefinition(\n workflow: AssistantWorkflowDefinition<string, string, string, string>,\n): AssistantWorkflowDefinitionValidationResult {\n const diagnostics: AssistantWorkflowDefinitionDiagnostic[] = [];\n\n validateHeader(workflow, diagnostics);\n validateExecutionBudget(workflow, diagnostics);\n validateExecutionPolicy(workflow, diagnostics);\n validateVocabulary(\"intent\", \"intents\", workflow.intents, diagnostics);\n validateVocabulary(\"subintent\", \"subintents\", workflow.subintents ?? [], diagnostics);\n validateVocabulary(\"presentation\", \"presentations\", workflow.presentations ?? [], diagnostics);\n validateVocabulary(\"derived transform\", \"derivedTransforms\", workflow.derivedTransforms ?? [], diagnostics);\n validateToolCapabilities(workflow.tools ?? [], diagnostics);\n validateToolBindings(workflow.toolBindings ?? [], diagnostics);\n validateMemorySlots(workflow.memorySlots ?? [], diagnostics);\n validatePlanningSteps(workflow.planningSteps ?? [], diagnostics);\n validateClarificationRules(workflow.clarificationRules ?? [], diagnostics);\n validateDirectRoutes(workflow.directRoutes ?? [], diagnostics);\n validateReferences(workflow, diagnostics);\n\n const errorCount = diagnostics.filter((diagnostic) => diagnostic.severity === \"error\").length;\n const warningCount = diagnostics.filter((diagnostic) => diagnostic.severity === \"warning\").length;\n return {\n valid: errorCount === 0,\n errorCount,\n warningCount,\n diagnostics,\n };\n}\n\nfunction validateExecutionPolicy(\n workflow: AssistantWorkflowDefinition<string, string, string, string>,\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n if (!workflow.executionPolicy) return;\n try {\n assertAssistantWorkflowExecutionPolicy(workflow.executionPolicy);\n } catch (error) {\n addDiagnostic(\n diagnostics,\n \"error\",\n \"invalid_execution_policy\",\n \"executionPolicy\",\n error instanceof Error ? error.message : \"Assistant workflow execution policy is invalid.\",\n );\n }\n}\n\nfunction validateExecutionBudget(\n workflow: AssistantWorkflowDefinition<string, string, string, string>,\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n if (!workflow.executionBudget) return;\n try {\n assertAssistantWorkflowExecutionBudget(workflow.executionBudget);\n } catch (error) {\n addDiagnostic(\n diagnostics,\n \"error\",\n \"invalid_execution_budget\",\n \"executionBudget\",\n error instanceof Error ? error.message : \"Assistant workflow execution budget is invalid.\",\n );\n }\n}\n\nfunction validateHeader(\n workflow: AssistantWorkflowDefinition<string, string, string, string>,\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n if (!workflow.id.trim().length) {\n addDiagnostic(diagnostics, \"error\", \"missing_workflow_id\", \"id\", \"Assistant workflow id is required.\");\n }\n if (!Number.isInteger(workflow.version) || workflow.version < 1) {\n addDiagnostic(diagnostics, \"error\", \"invalid_workflow_version\", \"version\", \"Assistant workflow version must be a positive integer.\");\n }\n if (!workflow.intents.length) {\n addDiagnostic(diagnostics, \"error\", \"missing_intents\", \"intents\", \"Assistant workflow must define at least one intent.\");\n }\n}\n\nfunction validateVocabulary(\n kind: string,\n path: string,\n items: readonly AssistantWorkflowVocabularyItem[],\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n const seen = new Map<string, number>();\n for (const [index, item] of items.entries()) {\n const itemPath = `${path}[${index}]`;\n const normalized = normalizeAssistantWorkflowId(item.id);\n if (!normalized) {\n addDiagnostic(diagnostics, \"error\", \"missing_id\", `${itemPath}.id`, `Assistant workflow ${kind} id is required.`);\n continue;\n }\n if (normalized !== item.id) {\n addDiagnostic(diagnostics, \"error\", \"unnormalized_id\", `${itemPath}.id`, `Assistant workflow ${kind} id must already be normalized: ${item.id}.`);\n }\n const firstIndex = seen.get(normalized);\n if (firstIndex !== undefined) {\n addDiagnostic(diagnostics, \"error\", \"duplicate_id\", `${itemPath}.id`, `Duplicate assistant workflow ${kind} id: ${normalized}; first seen at ${path}[${firstIndex}].`);\n } else {\n seen.set(normalized, index);\n }\n if (!item.description.trim().length) {\n addDiagnostic(diagnostics, \"error\", \"missing_description\", `${itemPath}.description`, `Assistant workflow ${kind} ${normalized} description is required.`);\n }\n }\n}\n\nfunction validateToolCapabilities(\n tools: readonly AssistantWorkflowToolCapabilityDefinition[],\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n const seen = new Map<string, number>();\n for (const [index, tool] of tools.entries()) {\n const path = `tools[${index}]`;\n const normalized = normalizeAssistantWorkflowId(tool.name);\n if (!normalized) {\n addDiagnostic(diagnostics, \"error\", \"missing_id\", `${path}.name`, \"Assistant workflow tool capability name is required.\");\n continue;\n }\n if (normalized !== tool.name) {\n addDiagnostic(diagnostics, \"error\", \"unnormalized_id\", `${path}.name`, `Assistant workflow tool capability name must already be normalized: ${tool.name}.`);\n }\n const firstIndex = seen.get(normalized);\n if (firstIndex !== undefined) {\n addDiagnostic(diagnostics, \"error\", \"duplicate_id\", `${path}.name`, `Duplicate assistant workflow tool capability: ${normalized}; first seen at tools[${firstIndex}].`);\n } else {\n seen.set(normalized, index);\n }\n if (!tool.outputKinds.length) {\n addDiagnostic(diagnostics, \"error\", \"missing_tool_output_kinds\", `${path}.outputKinds`, `Assistant workflow tool capability ${normalized} must define at least one output kind.`);\n }\n }\n}\n\nfunction validateToolBindings(\n bindings: readonly AssistantWorkflowToolBindingDefinition[],\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n const seen = new Map<string, number>();\n for (const [index, binding] of bindings.entries()) {\n const path = `toolBindings[${index}]`;\n const normalized = normalizeAssistantWorkflowId(binding.name);\n if (!normalized) {\n addDiagnostic(diagnostics, \"error\", \"missing_id\", `${path}.name`, \"Assistant workflow tool binding name is required.\");\n continue;\n }\n if (normalized !== binding.name) {\n addDiagnostic(diagnostics, \"error\", \"unnormalized_id\", `${path}.name`, `Assistant workflow tool binding name must already be normalized: ${binding.name}.`);\n }\n const firstIndex = seen.get(normalized);\n if (firstIndex !== undefined) {\n addDiagnostic(diagnostics, \"error\", \"duplicate_id\", `${path}.name`, `Duplicate assistant workflow tool binding: ${normalized}; first seen at toolBindings[${firstIndex}].`);\n } else {\n seen.set(normalized, index);\n }\n validateToolBindingTarget(binding, path, diagnostics);\n }\n}\n\nfunction validateToolBindingTarget(\n binding: AssistantWorkflowToolBindingDefinition,\n path: string,\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n switch (binding.provider) {\n case \"local-function\":\n validateRequiredField(binding.handlerId, `${path}.handlerId`, binding.name, \"handlerId\", diagnostics);\n return;\n case \"http\":\n validateRequiredField(binding.path, `${path}.path`, binding.name, \"path\", diagnostics);\n if (binding.method !== undefined && binding.method !== binding.method.toUpperCase()) {\n addDiagnostic(diagnostics, \"error\", \"invalid_http_method\", `${path}.method`, `Assistant workflow tool binding ${binding.name} HTTP method must be uppercase.`);\n }\n return;\n case \"openai-hosted\":\n validateRequiredField(binding.hostedToolType, `${path}.hostedToolType`, binding.name, \"hostedToolType\", diagnostics);\n return;\n case \"mcp\":\n validateRequiredField(binding.serverId, `${path}.serverId`, binding.name, \"serverId\", diagnostics);\n validateRequiredField(binding.toolName, `${path}.toolName`, binding.name, \"toolName\", diagnostics);\n return;\n case \"repl\":\n validateRequiredField(binding.runtimeId, `${path}.runtimeId`, binding.name, \"runtimeId\", diagnostics);\n if (!binding.functionName?.trim().length && !binding.commandTemplate?.trim().length) {\n addDiagnostic(diagnostics, \"error\", \"missing_repl_target\", path, `Assistant workflow tool binding ${binding.name} must define functionName or commandTemplate.`);\n }\n return;\n }\n}\n\nfunction validateRequiredField(\n value: string,\n path: string,\n toolName: string,\n fieldName: string,\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n if (!value.trim().length) {\n addDiagnostic(diagnostics, \"error\", \"missing_binding_field\", path, `Assistant workflow tool binding ${toolName} ${fieldName} is required.`);\n }\n}\n\nfunction validateMemorySlots(\n slots: readonly AssistantWorkflowMemorySlotDefinition[],\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n validateVocabulary(\"memory slot\", \"memorySlots\", slots, diagnostics);\n}\n\nfunction validatePlanningSteps(\n steps: readonly AssistantWorkflowPlanningStepDefinition[],\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n validateVocabulary(\"planning step\", \"planningSteps\", steps, diagnostics);\n const stepsById = new Map(steps.map((step) => [step.id, step] as const));\n for (const [index, step] of steps.entries()) {\n for (const dependencyId of step.dependsOn ?? []) {\n if (dependencyId === step.id) {\n addDiagnostic(diagnostics, \"error\", \"invalid_planning_step_dependency\", `planningSteps[${index}].dependsOn`, `Assistant workflow planning step ${step.id} must not depend on itself.`);\n } else if (!stepsById.has(dependencyId)) {\n addDiagnostic(diagnostics, \"error\", \"invalid_planning_step_dependency\", `planningSteps[${index}].dependsOn`, `Assistant workflow planning step ${step.id} references unknown dependency: ${dependencyId}.`);\n }\n }\n }\n for (const cycleStepId of findPlanningStepDependencyCycles(stepsById)) {\n const index = steps.findIndex((step) => step.id === cycleStepId);\n addDiagnostic(diagnostics, \"error\", \"invalid_planning_step_dependency\", `planningSteps[${index}].dependsOn`, `Assistant workflow planning step dependencies contain a cycle at: ${cycleStepId}.`);\n }\n}\n\nfunction findPlanningStepDependencyCycles(\n stepsById: ReadonlyMap<string, AssistantWorkflowPlanningStepDefinition>,\n): string[] {\n const visiting = new Set<string>();\n const visited = new Set<string>();\n const cycles = new Set<string>();\n const visit = (stepId: string): void => {\n if (visited.has(stepId)) return;\n if (visiting.has(stepId)) {\n cycles.add(stepId);\n return;\n }\n visiting.add(stepId);\n for (const dependencyId of stepsById.get(stepId)?.dependsOn ?? []) {\n if (stepsById.has(dependencyId)) visit(dependencyId);\n }\n visiting.delete(stepId);\n visited.add(stepId);\n };\n for (const stepId of stepsById.keys()) visit(stepId);\n return [...cycles];\n}\n\nfunction validateClarificationRules(\n rules: readonly AssistantWorkflowClarificationRuleDefinition[],\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n validateVocabulary(\"clarification rule\", \"clarificationRules\", rules, diagnostics);\n for (const [index, rule] of rules.entries()) {\n if (\n rule.condition === \"low_confidence\" &&\n rule.confidenceBelow !== undefined &&\n (!Number.isFinite(rule.confidenceBelow) || rule.confidenceBelow < 0 || rule.confidenceBelow > 1)\n ) {\n addDiagnostic(diagnostics, \"error\", \"invalid_confidence_threshold\", `clarificationRules[${index}].confidenceBelow`, `Assistant workflow clarification rule ${rule.id} confidenceBelow must be between 0 and 1.`);\n }\n }\n}\n\nfunction validateDirectRoutes(\n routes: readonly AssistantWorkflowDirectRouteDefinition[],\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n validateVocabulary(\"direct route\", \"directRoutes\", routes, diagnostics);\n for (const [routeIndex, route] of routes.entries()) {\n validateVocabulary(\n `direct route ${route.id} strategy`,\n `directRoutes[${routeIndex}].strategies`,\n route.strategies ?? [],\n diagnostics,\n );\n }\n}\n\nfunction validateReferences(\n workflow: AssistantWorkflowDefinition<string, string, string, string>,\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n const toolCapabilities = new Map((workflow.tools ?? []).map((tool) => [tool.name, tool] as const));\n const toolBindings = new Map((workflow.toolBindings ?? []).map((binding) => [binding.name, binding] as const));\n const toolNames = new Set(toolCapabilities.keys());\n const presentationIds = new Set((workflow.presentations ?? []).map((presentation) => presentation.id));\n const subintentIds = new Set((workflow.subintents ?? []).map((subintent) => subintent.id));\n const memorySlotIds = new Set((workflow.memorySlots ?? []).map((slot) => slot.id));\n const planningStepIds = new Set((workflow.planningSteps ?? []).map((step) => step.id));\n const clarificationRuleIds = new Set((workflow.clarificationRules ?? []).map((rule) => rule.id));\n\n for (const [index, binding] of (workflow.toolBindings ?? []).entries()) {\n const capability = toolCapabilities.get(binding.name);\n if (toolCapabilities.size > 0 && !capability) {\n addDiagnostic(diagnostics, \"error\", \"binding_without_capability\", `toolBindings[${index}].name`, `Assistant workflow tool binding references unknown tool capability: ${binding.name}.`);\n }\n if (capability && capability.provider !== binding.provider) {\n addDiagnostic(diagnostics, \"error\", \"tool_provider_mismatch\", `toolBindings[${index}].provider`, `Assistant workflow tool binding ${binding.name} provider ${binding.provider} does not match capability provider ${capability.provider}.`);\n }\n }\n for (const [index, tool] of (workflow.tools ?? []).entries()) {\n if (!toolBindings.has(tool.name)) {\n addDiagnostic(diagnostics, \"warning\", \"unbound_tool_capability\", `tools[${index}].name`, `Assistant workflow tool capability ${tool.name} has no binding.`);\n }\n }\n\n for (const [index, step] of (workflow.planningSteps ?? []).entries()) {\n for (const toolName of [...(step.toolHints ?? []), ...(step.requiredToolHints ?? [])]) {\n if (toolNames.size > 0 && !toolNames.has(toolName)) {\n addDiagnostic(diagnostics, \"error\", \"unknown_tool_capability\", `planningSteps[${index}].toolHints`, `Assistant workflow planning step ${step.id} references unknown tool capability: ${toolName}.`);\n }\n }\n for (const slotId of [...(step.readsMemory ?? []), ...(step.writesMemory ?? [])]) {\n if (memorySlotIds.size > 0 && !memorySlotIds.has(slotId)) {\n addDiagnostic(diagnostics, \"error\", \"unknown_memory_slot\", `planningSteps[${index}].readsMemory`, `Assistant workflow planning step ${step.id} references unknown memory slot: ${slotId}.`);\n }\n }\n }\n\n for (const [index, rule] of (workflow.clarificationRules ?? []).entries()) {\n for (const slotId of [...(rule.readsMemory ?? []), ...(rule.writesMemory ?? [])]) {\n if (memorySlotIds.size > 0 && !memorySlotIds.has(slotId)) {\n addDiagnostic(diagnostics, \"error\", \"unknown_memory_slot\", `clarificationRules[${index}].readsMemory`, `Assistant workflow clarification rule ${rule.id} references unknown memory slot: ${slotId}.`);\n }\n }\n }\n\n for (const [index, intent] of workflow.intents.entries()) {\n validateIntentToolSelectionProfiles(intent, index, toolNames, subintentIds, diagnostics);\n validateIntentPlanningStepProfiles(intent, index, planningStepIds, toolNames, subintentIds, presentationIds, diagnostics);\n if (intent.defaultPresentation && !presentationIds.has(intent.defaultPresentation)) {\n addDiagnostic(diagnostics, \"error\", \"unknown_presentation\", `intents[${index}].defaultPresentation`, `Assistant workflow intent ${intent.id} references unknown presentation: ${intent.defaultPresentation}.`);\n }\n for (const toolName of [...(intent.toolHints ?? []), ...(intent.requiredToolHints ?? [])]) {\n if (toolNames.size > 0 && !toolNames.has(toolName)) {\n addDiagnostic(diagnostics, \"error\", \"unknown_tool_capability\", `intents[${index}].toolHints`, `Assistant workflow intent ${intent.id} references unknown tool capability: ${toolName}.`);\n }\n }\n for (const slotId of [\n ...(intent.memoryPolicy?.read ?? []),\n ...(intent.memoryPolicy?.write ?? []),\n ...(intent.memoryPolicy?.inject ?? []),\n ]) {\n if (memorySlotIds.size > 0 && !memorySlotIds.has(slotId)) {\n addDiagnostic(diagnostics, \"error\", \"unknown_memory_slot\", `intents[${index}].memoryPolicy`, `Assistant workflow intent ${intent.id} references unknown memory slot: ${slotId}.`);\n }\n }\n for (const stepId of intent.planningSteps ?? []) {\n if (planningStepIds.size > 0 && !planningStepIds.has(stepId)) {\n addDiagnostic(diagnostics, \"error\", \"unknown_planning_step\", `intents[${index}].planningSteps`, `Assistant workflow intent ${intent.id} references unknown planning step: ${stepId}.`);\n }\n }\n for (const ruleId of intent.clarificationRules ?? []) {\n if (clarificationRuleIds.size > 0 && !clarificationRuleIds.has(ruleId)) {\n addDiagnostic(diagnostics, \"error\", \"unknown_clarification_rule\", `intents[${index}].clarificationRules`, `Assistant workflow intent ${intent.id} references unknown clarification rule: ${ruleId}.`);\n }\n }\n }\n}\n\nfunction validateIntentPlanningStepProfiles(\n intent: AssistantWorkflowDefinition<string, string, string, string>[\"intents\"][number],\n intentIndex: number,\n planningStepIds: ReadonlySet<string>,\n toolNames: ReadonlySet<string>,\n subintentIds: ReadonlySet<string>,\n presentationIds: ReadonlySet<string>,\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n const seen = new Map<string, number>();\n for (const [profileIndex, profile] of (intent.planningStepProfiles ?? []).entries()) {\n const profilePath = `intents[${intentIndex}].planningStepProfiles[${profileIndex}]`;\n const normalized = normalizeAssistantWorkflowId(profile.id);\n if (!normalized) {\n addDiagnostic(diagnostics, \"error\", \"missing_id\", `${profilePath}.id`, `Assistant workflow intent ${intent.id} planning step profile id is required.`);\n continue;\n }\n if (normalized !== profile.id) {\n addDiagnostic(diagnostics, \"error\", \"unnormalized_id\", `${profilePath}.id`, `Assistant workflow intent ${intent.id} planning step profile id must already be normalized: ${profile.id}.`);\n }\n const firstIndex = seen.get(normalized);\n if (firstIndex !== undefined) {\n addDiagnostic(diagnostics, \"error\", \"duplicate_id\", `${profilePath}.id`, `Duplicate assistant workflow intent ${intent.id} planning step profile: ${normalized}; first seen at intents[${intentIndex}].planningStepProfiles[${firstIndex}].`);\n } else {\n seen.set(normalized, profileIndex);\n }\n if (!profile.description.trim().length) {\n addDiagnostic(diagnostics, \"error\", \"missing_description\", `${profilePath}.description`, `Assistant workflow intent ${intent.id} planning step profile ${normalized} description is required.`);\n }\n if (!profile.planningSteps.length) {\n addDiagnostic(diagnostics, \"error\", \"unknown_planning_step\", `${profilePath}.planningSteps`, `Assistant workflow intent ${intent.id} planning step profile ${normalized} must define at least one planning step.`);\n }\n for (const stepId of profile.planningSteps) {\n if (planningStepIds.size > 0 && !planningStepIds.has(stepId)) {\n addDiagnostic(diagnostics, \"error\", \"unknown_planning_step\", `${profilePath}.planningSteps`, `Assistant workflow intent ${intent.id} planning step profile ${normalized} references unknown planning step: ${stepId}.`);\n }\n }\n for (const toolName of profile.condition?.requiredTools ?? []) {\n if (toolNames.size > 0 && !toolNames.has(toolName)) {\n addDiagnostic(diagnostics, \"error\", \"unknown_tool_capability\", `${profilePath}.condition.requiredTools`, `Assistant workflow intent ${intent.id} planning step profile ${normalized} references unknown required tool: ${toolName}.`);\n }\n }\n const condition = profile.condition;\n if (condition?.subintent && subintentIds.size > 0 && !subintentIds.has(condition.subintent)) {\n addDiagnostic(diagnostics, \"error\", \"missing_id\", `${profilePath}.condition.subintent`, `Assistant workflow intent ${intent.id} planning step profile ${normalized} references unknown subintent: ${condition.subintent}.`);\n }\n if (condition?.presentation && presentationIds.size > 0 && !presentationIds.has(condition.presentation)) {\n addDiagnostic(diagnostics, \"error\", \"unknown_presentation\", `${profilePath}.condition.presentation`, `Assistant workflow intent ${intent.id} planning step profile ${normalized} references unknown presentation: ${condition.presentation}.`);\n }\n validatePlanningStepProfileCondition(intent.id, profile, profilePath, diagnostics);\n }\n}\n\nfunction validateIntentToolSelectionProfiles(\n intent: AssistantWorkflowDefinition<string, string, string, string>[\"intents\"][number],\n intentIndex: number,\n toolNames: ReadonlySet<string>,\n subintentIds: ReadonlySet<string>,\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n const seen = new Map<string, number>();\n for (const [profileIndex, profile] of (intent.toolSelectionProfiles ?? []).entries()) {\n const profilePath = `intents[${intentIndex}].toolSelectionProfiles[${profileIndex}]`;\n const normalized = normalizeAssistantWorkflowId(profile.id);\n if (!normalized) {\n addDiagnostic(diagnostics, \"error\", \"missing_id\", `${profilePath}.id`, `Assistant workflow intent ${intent.id} tool selection profile id is required.`);\n continue;\n }\n if (normalized !== profile.id) {\n addDiagnostic(diagnostics, \"error\", \"unnormalized_id\", `${profilePath}.id`, `Assistant workflow intent ${intent.id} tool selection profile id must already be normalized: ${profile.id}.`);\n }\n const firstIndex = seen.get(normalized);\n if (firstIndex !== undefined) {\n addDiagnostic(diagnostics, \"error\", \"duplicate_id\", `${profilePath}.id`, `Duplicate assistant workflow intent ${intent.id} tool selection profile: ${normalized}; first seen at intents[${intentIndex}].toolSelectionProfiles[${firstIndex}].`);\n } else {\n seen.set(normalized, profileIndex);\n }\n if (!profile.description.trim().length) {\n addDiagnostic(diagnostics, \"error\", \"missing_description\", `${profilePath}.description`, `Assistant workflow intent ${intent.id} tool selection profile ${normalized} description is required.`);\n }\n if (!profile.toolHints.length) {\n addDiagnostic(diagnostics, \"error\", \"missing_tool_hints\", `${profilePath}.toolHints`, `Assistant workflow intent ${intent.id} tool selection profile ${normalized} must define at least one tool hint.`);\n }\n for (const toolName of profile.toolHints) {\n if (toolNames.size > 0 && !toolNames.has(toolName)) {\n addDiagnostic(diagnostics, \"error\", \"unknown_tool_capability\", `${profilePath}.toolHints`, `Assistant workflow intent ${intent.id} tool selection profile ${normalized} references unknown tool capability: ${toolName}.`);\n }\n }\n validateToolSelectionProfileCondition(intent.id, profile, profilePath, subintentIds, diagnostics);\n }\n}\n\nfunction validatePlanningStepProfileCondition(\n intentId: string,\n profile: NonNullable<AssistantWorkflowDefinition<string, string, string, string>[\"intents\"][number][\"planningStepProfiles\"]>[number],\n profilePath: string,\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n const { minConfidence, maxConfidence, subintent, presentation, timeWindowHint, requiredTools } = profile.condition ?? {};\n if (minConfidence !== undefined && (!Number.isFinite(minConfidence) || minConfidence < 0 || minConfidence > 1)) {\n addDiagnostic(diagnostics, \"error\", \"invalid_planning_step_profile_condition\", `${profilePath}.condition.minConfidence`, `Assistant workflow intent ${intentId} planning step profile ${profile.id} minConfidence must be between 0 and 1.`);\n }\n if (maxConfidence !== undefined && (!Number.isFinite(maxConfidence) || maxConfidence < 0 || maxConfidence > 1)) {\n addDiagnostic(diagnostics, \"error\", \"invalid_planning_step_profile_condition\", `${profilePath}.condition.maxConfidence`, `Assistant workflow intent ${intentId} planning step profile ${profile.id} maxConfidence must be between 0 and 1.`);\n }\n if (minConfidence !== undefined && maxConfidence !== undefined && minConfidence > maxConfidence) {\n addDiagnostic(diagnostics, \"error\", \"invalid_planning_step_profile_condition\", `${profilePath}.condition`, `Assistant workflow intent ${intentId} planning step profile ${profile.id} minConfidence must not exceed maxConfidence.`);\n }\n if (subintent !== undefined && !subintent.trim().length) {\n addDiagnostic(diagnostics, \"error\", \"invalid_planning_step_profile_condition\", `${profilePath}.condition.subintent`, `Assistant workflow intent ${intentId} planning step profile ${profile.id} subintent must not be empty.`);\n }\n if (presentation !== undefined && !presentation.trim().length) {\n addDiagnostic(diagnostics, \"error\", \"invalid_planning_step_profile_condition\", `${profilePath}.condition.presentation`, `Assistant workflow intent ${intentId} planning step profile ${profile.id} presentation must not be empty.`);\n }\n if (timeWindowHint !== undefined && !timeWindowHint.trim().length) {\n addDiagnostic(diagnostics, \"error\", \"invalid_planning_step_profile_condition\", `${profilePath}.condition.timeWindowHint`, `Assistant workflow intent ${intentId} planning step profile ${profile.id} timeWindowHint must not be empty.`);\n }\n if (requiredTools !== undefined && requiredTools.length === 0) {\n addDiagnostic(diagnostics, \"error\", \"invalid_planning_step_profile_condition\", `${profilePath}.condition.requiredTools`, `Assistant workflow intent ${intentId} planning step profile ${profile.id} requiredTools must not be empty.`);\n }\n}\n\nfunction validateToolSelectionProfileCondition(\n intentId: string,\n profile: NonNullable<AssistantWorkflowDefinition<string, string, string, string>[\"intents\"][number][\"toolSelectionProfiles\"]>[number],\n profilePath: string,\n subintentIds: ReadonlySet<string>,\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n): void {\n const { minHop, maxHop, selectedReason, subintent } = profile.condition ?? {};\n if (minHop !== undefined && (!Number.isInteger(minHop) || minHop < 0)) {\n addDiagnostic(diagnostics, \"error\", \"invalid_tool_selection_profile_condition\", `${profilePath}.condition.minHop`, `Assistant workflow intent ${intentId} tool selection profile ${profile.id} minHop must be a non-negative integer.`);\n }\n if (maxHop !== undefined && (!Number.isInteger(maxHop) || maxHop < 0)) {\n addDiagnostic(diagnostics, \"error\", \"invalid_tool_selection_profile_condition\", `${profilePath}.condition.maxHop`, `Assistant workflow intent ${intentId} tool selection profile ${profile.id} maxHop must be a non-negative integer.`);\n }\n if (minHop !== undefined && maxHop !== undefined && minHop > maxHop) {\n addDiagnostic(diagnostics, \"error\", \"invalid_tool_selection_profile_condition\", `${profilePath}.condition`, `Assistant workflow intent ${intentId} tool selection profile ${profile.id} minHop must not exceed maxHop.`);\n }\n if (subintent !== undefined && subintent !== null) {\n const normalizedSubintent = subintent.trim();\n if (!normalizedSubintent.length) {\n addDiagnostic(diagnostics, \"error\", \"invalid_tool_selection_profile_condition\", `${profilePath}.condition.subintent`, `Assistant workflow intent ${intentId} tool selection profile ${profile.id} subintent must not be empty.`);\n } else if (subintentIds.size > 0 && !subintentIds.has(normalizedSubintent)) {\n addDiagnostic(diagnostics, \"error\", \"missing_id\", `${profilePath}.condition.subintent`, `Assistant workflow intent ${intentId} tool selection profile ${profile.id} references unknown subintent: ${normalizedSubintent}.`);\n }\n }\n if (selectedReason !== undefined && !selectedReason.trim().length) {\n addDiagnostic(diagnostics, \"error\", \"invalid_tool_selection_profile_condition\", `${profilePath}.condition.selectedReason`, `Assistant workflow intent ${intentId} tool selection profile ${profile.id} selectedReason must not be empty.`);\n }\n}\n\nfunction addDiagnostic(\n diagnostics: AssistantWorkflowDefinitionDiagnostic[],\n severity: AssistantWorkflowDefinitionDiagnosticSeverity,\n code: AssistantWorkflowDefinitionDiagnosticCode,\n path: string,\n message: string,\n): void {\n diagnostics.push({ severity, code, path, message });\n}\n"]}
|
|
@@ -22,6 +22,12 @@ export type AssistantWorkflowDefinitionDirectRouteDiff = {
|
|
|
22
22
|
removedStrategyIds: string[];
|
|
23
23
|
changed: boolean;
|
|
24
24
|
};
|
|
25
|
+
export type AssistantWorkflowDefinitionPlanningStepDiff = {
|
|
26
|
+
stepId: string;
|
|
27
|
+
addedDependencyStepIds: string[];
|
|
28
|
+
removedDependencyStepIds: string[];
|
|
29
|
+
changed: boolean;
|
|
30
|
+
};
|
|
25
31
|
export type AssistantWorkflowDefinitionDiff = {
|
|
26
32
|
fromWorkflowId: string;
|
|
27
33
|
toWorkflowId: string;
|
|
@@ -29,6 +35,8 @@ export type AssistantWorkflowDefinitionDiff = {
|
|
|
29
35
|
toVersion: number;
|
|
30
36
|
changed: boolean;
|
|
31
37
|
versionChanged: boolean;
|
|
38
|
+
executionBudgetChanged: boolean;
|
|
39
|
+
executionPolicyChanged: boolean;
|
|
32
40
|
addedIntentIds: string[];
|
|
33
41
|
removedIntentIds: string[];
|
|
34
42
|
addedToolNames: string[];
|
|
@@ -45,6 +53,7 @@ export type AssistantWorkflowDefinitionDiff = {
|
|
|
45
53
|
removedClarificationRuleIds: string[];
|
|
46
54
|
intentDiffs: AssistantWorkflowDefinitionIntentDiff[];
|
|
47
55
|
directRouteDiffs: AssistantWorkflowDefinitionDirectRouteDiff[];
|
|
56
|
+
planningStepDiffs: AssistantWorkflowDefinitionPlanningStepDiff[];
|
|
48
57
|
};
|
|
49
58
|
export declare function buildAssistantWorkflowDefinitionDiff(before: AssistantWorkflowDefinition, after: AssistantWorkflowDefinition): AssistantWorkflowDefinitionDiff;
|
|
50
59
|
export declare function buildAssistantWorkflowDefinitionDiffTracePayload(diff: AssistantWorkflowDefinitionDiff): Record<string, AssistantWorkflowJsonValue>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition-diff.d.ts","sourceRoot":"","sources":["../src/definition-diff.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,2BAA2B,EAE5B,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAEvE,MAAM,MAAM,qCAAqC,GAAG;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,sBAAsB,EAAE,MAAM,EAAE,CAAC;IACjC,wB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|
package/dist/definition-diff.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export function buildAssistantWorkflowDefinitionDiff(before, after) {
|
|
2
2
|
const intentDiffs = buildIntentDiffs(before.intents, after.intents);
|
|
3
3
|
const directRouteDiffs = buildDirectRouteDiffs(before.directRoutes ?? [], after.directRoutes ?? []);
|
|
4
|
+
const planningStepDiffs = buildPlanningStepDiffs(before.planningSteps ?? [], after.planningSteps ?? []);
|
|
4
5
|
const diff = {
|
|
5
6
|
fromWorkflowId: before.id,
|
|
6
7
|
toWorkflowId: after.id,
|
|
@@ -8,6 +9,8 @@ export function buildAssistantWorkflowDefinitionDiff(before, after) {
|
|
|
8
9
|
toVersion: after.version,
|
|
9
10
|
changed: false,
|
|
10
11
|
versionChanged: before.version !== after.version,
|
|
12
|
+
executionBudgetChanged: !sameJson(before.executionBudget ?? null, after.executionBudget ?? null),
|
|
13
|
+
executionPolicyChanged: !sameJson(before.executionPolicy ?? null, after.executionPolicy ?? null),
|
|
11
14
|
addedIntentIds: diffStrings(before.intents.map((intent) => intent.id), after.intents.map((intent) => intent.id)),
|
|
12
15
|
removedIntentIds: diffStrings(after.intents.map((intent) => intent.id), before.intents.map((intent) => intent.id)),
|
|
13
16
|
addedToolNames: diffStrings(before.tools?.map((tool) => tool.name) ?? [], after.tools?.map((tool) => tool.name) ?? []),
|
|
@@ -24,10 +27,13 @@ export function buildAssistantWorkflowDefinitionDiff(before, after) {
|
|
|
24
27
|
removedClarificationRuleIds: diffStrings(after.clarificationRules?.map((rule) => rule.id) ?? [], before.clarificationRules?.map((rule) => rule.id) ?? []),
|
|
25
28
|
intentDiffs,
|
|
26
29
|
directRouteDiffs,
|
|
30
|
+
planningStepDiffs,
|
|
27
31
|
};
|
|
28
32
|
return {
|
|
29
33
|
...diff,
|
|
30
34
|
changed: diff.versionChanged ||
|
|
35
|
+
diff.executionBudgetChanged ||
|
|
36
|
+
diff.executionPolicyChanged ||
|
|
31
37
|
diff.addedIntentIds.length > 0 ||
|
|
32
38
|
diff.removedIntentIds.length > 0 ||
|
|
33
39
|
diff.addedToolNames.length > 0 ||
|
|
@@ -43,7 +49,8 @@ export function buildAssistantWorkflowDefinitionDiff(before, after) {
|
|
|
43
49
|
diff.addedClarificationRuleIds.length > 0 ||
|
|
44
50
|
diff.removedClarificationRuleIds.length > 0 ||
|
|
45
51
|
diff.intentDiffs.some((intentDiff) => intentDiff.changed) ||
|
|
46
|
-
diff.directRouteDiffs.some((routeDiff) => routeDiff.changed)
|
|
52
|
+
diff.directRouteDiffs.some((routeDiff) => routeDiff.changed) ||
|
|
53
|
+
diff.planningStepDiffs.some((stepDiff) => stepDiff.changed),
|
|
47
54
|
};
|
|
48
55
|
}
|
|
49
56
|
export function buildAssistantWorkflowDefinitionDiffTracePayload(diff) {
|
|
@@ -54,6 +61,8 @@ export function buildAssistantWorkflowDefinitionDiffTracePayload(diff) {
|
|
|
54
61
|
toVersion: diff.toVersion,
|
|
55
62
|
changed: diff.changed,
|
|
56
63
|
versionChanged: diff.versionChanged,
|
|
64
|
+
executionBudgetChanged: diff.executionBudgetChanged,
|
|
65
|
+
executionPolicyChanged: diff.executionPolicyChanged,
|
|
57
66
|
addedIntentIds: diff.addedIntentIds,
|
|
58
67
|
removedIntentIds: diff.removedIntentIds,
|
|
59
68
|
addedToolNames: diff.addedToolNames,
|
|
@@ -90,8 +99,34 @@ export function buildAssistantWorkflowDefinitionDiffTracePayload(diff) {
|
|
|
90
99
|
removedStrategyIds: routeDiff.removedStrategyIds,
|
|
91
100
|
changed: routeDiff.changed,
|
|
92
101
|
})),
|
|
102
|
+
planningStepDiffs: diff.planningStepDiffs.map((stepDiff) => ({
|
|
103
|
+
stepId: stepDiff.stepId,
|
|
104
|
+
addedDependencyStepIds: stepDiff.addedDependencyStepIds,
|
|
105
|
+
removedDependencyStepIds: stepDiff.removedDependencyStepIds,
|
|
106
|
+
changed: stepDiff.changed,
|
|
107
|
+
})),
|
|
93
108
|
};
|
|
94
109
|
}
|
|
110
|
+
function buildPlanningStepDiffs(beforeSteps, afterSteps) {
|
|
111
|
+
const beforeById = new Map(beforeSteps.map((step) => [step.id, step]));
|
|
112
|
+
const diffs = [];
|
|
113
|
+
for (const afterStep of afterSteps) {
|
|
114
|
+
const beforeStep = beforeById.get(afterStep.id);
|
|
115
|
+
if (!beforeStep)
|
|
116
|
+
continue;
|
|
117
|
+
const addedDependencyStepIds = diffStrings(beforeStep.dependsOn ?? [], afterStep.dependsOn ?? []);
|
|
118
|
+
const removedDependencyStepIds = diffStrings(afterStep.dependsOn ?? [], beforeStep.dependsOn ?? []);
|
|
119
|
+
if (addedDependencyStepIds.length || removedDependencyStepIds.length) {
|
|
120
|
+
diffs.push({
|
|
121
|
+
stepId: afterStep.id,
|
|
122
|
+
addedDependencyStepIds,
|
|
123
|
+
removedDependencyStepIds,
|
|
124
|
+
changed: true,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return diffs.sort((left, right) => left.stepId.localeCompare(right.stepId));
|
|
129
|
+
}
|
|
95
130
|
function buildDirectRouteDiffs(beforeRoutes, afterRoutes) {
|
|
96
131
|
const beforeById = new Map(beforeRoutes.map((route) => [route.id, route]));
|
|
97
132
|
const diffs = [];
|
|
@@ -169,4 +204,7 @@ function diffStrings(before, after) {
|
|
|
169
204
|
.filter((value) => value.length > 0 && !beforeSet.has(value))
|
|
170
205
|
.sort();
|
|
171
206
|
}
|
|
207
|
+
function sameJson(left, right) {
|
|
208
|
+
return JSON.stringify(left) === JSON.stringify(right);
|
|
209
|
+
}
|
|
172
210
|
//# sourceMappingURL=definition-diff.js.map
|