@exaudeus/workrail 3.65.0 → 3.67.0
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/dist/application/validation.js +1 -1
- package/dist/console/standalone-console.js +4 -1
- package/dist/console-ui/assets/{index-DmFHE8v_.js → index-tOl8Vowf.js} +1 -1
- package/dist/console-ui/index.html +1 -1
- package/dist/infrastructure/storage/schema-validating-workflow-storage.d.ts +21 -2
- package/dist/infrastructure/storage/schema-validating-workflow-storage.js +48 -0
- package/dist/manifest.json +29 -29
- package/dist/mcp/handlers/v2-workflow.js +23 -6
- package/dist/mcp/output-schemas.d.ts +36 -0
- package/dist/mcp/output-schemas.js +11 -1
- package/dist/types/workflow-definition.d.ts +1 -0
- package/dist/v2/durable-core/domain/prompt-renderer.d.ts +1 -0
- package/dist/v2/durable-core/domain/prompt-renderer.js +40 -0
- package/dist/v2/projections/session-metrics.d.ts +1 -1
- package/dist/v2/projections/session-metrics.js +16 -35
- package/dist/v2/usecases/console-routes.d.ts +2 -2
- package/docs/authoring-v2.md +30 -7
- package/docs/authoring.md +28 -0
- package/package.json +1 -1
- package/spec/authoring-spec.json +37 -0
- package/spec/workflow.schema.json +5 -0
- package/workflows/adaptive-ticket-creation.json +2 -1
- package/workflows/architecture-scalability-audit.json +1 -0
- package/workflows/bug-investigation.agentic.v2.json +1 -0
- package/workflows/classify-task-workflow.json +1 -0
- package/workflows/coding-task-workflow-agentic.json +1 -0
- package/workflows/cross-platform-code-conversion.v2.json +8 -7
- package/workflows/document-creation-workflow.json +2 -1
- package/workflows/documentation-update-workflow.json +2 -1
- package/workflows/intelligent-test-case-generation.json +2 -1
- package/workflows/learner-centered-course-workflow.json +2 -1
- package/workflows/mr-review-workflow.agentic.v2.json +1 -0
- package/workflows/personal-learning-materials-creation-branched.json +1 -0
- package/workflows/presentation-creation.json +2 -1
- package/workflows/production-readiness-audit.json +1 -0
- package/workflows/relocation-workflow-us.json +1 -0
- package/workflows/routines/context-gathering.json +2 -1
- package/workflows/routines/design-review.json +1 -0
- package/workflows/routines/execution-simulation.json +2 -1
- package/workflows/routines/feature-implementation.json +4 -3
- package/workflows/routines/final-verification.json +1 -0
- package/workflows/routines/hypothesis-challenge.json +13 -3
- package/workflows/routines/ideation.json +1 -1
- package/workflows/routines/parallel-work-partitioning.json +1 -0
- package/workflows/routines/philosophy-alignment.json +2 -1
- package/workflows/routines/plan-analysis.json +2 -1
- package/workflows/routines/plan-generation.json +2 -1
- package/workflows/routines/tension-driven-design.json +1 -0
- package/workflows/scoped-documentation-workflow.json +2 -1
- package/workflows/test-artifact-loop-control.json +8 -2
- package/workflows/test-session-persistence.json +1 -0
- package/workflows/ui-ux-design-workflow.json +1 -0
- package/workflows/workflow-diagnose-environment.json +1 -0
- package/workflows/workflow-for-workflows.json +32 -76
- package/workflows/wr.discovery.json +1 -0
- package/workflows/wr.shaping.json +21 -6
- package/workflows/workflow-for-workflows.v2.json +0 -760
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { IWorkflowStorage, ICompositeWorkflowStorage } from '../../types/storage';
|
|
2
2
|
import { Workflow, WorkflowSummary, WorkflowDefinition, WorkflowSource } from '../../types/workflow';
|
|
3
|
-
export
|
|
3
|
+
export interface ValidationWarning {
|
|
4
|
+
readonly workflowId: string;
|
|
5
|
+
readonly sourceKind: string;
|
|
6
|
+
readonly errors: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface HasValidationWarnings {
|
|
9
|
+
loadAllWorkflowsWithWarnings(): Promise<{
|
|
10
|
+
readonly workflows: readonly Workflow[];
|
|
11
|
+
readonly warnings: readonly ValidationWarning[];
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
14
|
+
export declare class SchemaValidatingWorkflowStorage implements IWorkflowStorage, HasValidationWarnings {
|
|
4
15
|
private readonly inner;
|
|
5
16
|
readonly kind: "single";
|
|
6
17
|
private readonly validator;
|
|
@@ -8,11 +19,15 @@ export declare class SchemaValidatingWorkflowStorage implements IWorkflowStorage
|
|
|
8
19
|
get source(): WorkflowSource;
|
|
9
20
|
private validateDefinition;
|
|
10
21
|
loadAllWorkflows(): Promise<readonly Workflow[]>;
|
|
22
|
+
loadAllWorkflowsWithWarnings(): Promise<{
|
|
23
|
+
readonly workflows: readonly Workflow[];
|
|
24
|
+
readonly warnings: readonly ValidationWarning[];
|
|
25
|
+
}>;
|
|
11
26
|
getWorkflowById(id: string): Promise<Workflow | null>;
|
|
12
27
|
listWorkflowSummaries(): Promise<readonly WorkflowSummary[]>;
|
|
13
28
|
save(definition: WorkflowDefinition): Promise<void>;
|
|
14
29
|
}
|
|
15
|
-
export declare class SchemaValidatingCompositeWorkflowStorage implements ICompositeWorkflowStorage {
|
|
30
|
+
export declare class SchemaValidatingCompositeWorkflowStorage implements ICompositeWorkflowStorage, HasValidationWarnings {
|
|
16
31
|
private readonly inner;
|
|
17
32
|
readonly kind: "composite";
|
|
18
33
|
private readonly validator;
|
|
@@ -21,6 +36,10 @@ export declare class SchemaValidatingCompositeWorkflowStorage implements ICompos
|
|
|
21
36
|
getSources(): readonly WorkflowSource[];
|
|
22
37
|
getStorageInstances(): readonly IWorkflowStorage[];
|
|
23
38
|
loadAllWorkflows(): Promise<readonly Workflow[]>;
|
|
39
|
+
loadAllWorkflowsWithWarnings(): Promise<{
|
|
40
|
+
readonly workflows: readonly Workflow[];
|
|
41
|
+
readonly warnings: readonly ValidationWarning[];
|
|
42
|
+
}>;
|
|
24
43
|
getWorkflowById(id: string): Promise<Workflow | null>;
|
|
25
44
|
listWorkflowSummaries(): Promise<readonly WorkflowSummary[]>;
|
|
26
45
|
save(definition: WorkflowDefinition): Promise<void>;
|
|
@@ -54,6 +54,30 @@ class SchemaValidatingWorkflowStorage {
|
|
|
54
54
|
}
|
|
55
55
|
return validWorkflows;
|
|
56
56
|
}
|
|
57
|
+
async loadAllWorkflowsWithWarnings() {
|
|
58
|
+
const workflows = await this.inner.loadAllWorkflows();
|
|
59
|
+
const validWorkflows = [];
|
|
60
|
+
const warnings = [];
|
|
61
|
+
for (const workflow of workflows) {
|
|
62
|
+
try {
|
|
63
|
+
if (this.validateDefinition(workflow.definition, workflow.source.kind)) {
|
|
64
|
+
validWorkflows.push(workflow);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
69
|
+
reportValidationFailure(workflow.definition.id, workflow.source.kind, errorMessage);
|
|
70
|
+
if (workflow.source.kind !== 'bundled') {
|
|
71
|
+
warnings.push({
|
|
72
|
+
workflowId: workflow.definition.id,
|
|
73
|
+
sourceKind: workflow.source.kind,
|
|
74
|
+
errors: [errorMessage],
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return { workflows: validWorkflows, warnings };
|
|
80
|
+
}
|
|
57
81
|
async getWorkflowById(id) {
|
|
58
82
|
const workflow = await this.inner.getWorkflowById(id);
|
|
59
83
|
if (!workflow) {
|
|
@@ -117,6 +141,30 @@ class SchemaValidatingCompositeWorkflowStorage {
|
|
|
117
141
|
}
|
|
118
142
|
return validWorkflows;
|
|
119
143
|
}
|
|
144
|
+
async loadAllWorkflowsWithWarnings() {
|
|
145
|
+
const workflows = await this.inner.loadAllWorkflows();
|
|
146
|
+
const validWorkflows = [];
|
|
147
|
+
const warnings = [];
|
|
148
|
+
for (const workflow of workflows) {
|
|
149
|
+
try {
|
|
150
|
+
if (this.validateDefinition(workflow.definition, workflow.source.kind)) {
|
|
151
|
+
validWorkflows.push(workflow);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
catch (err) {
|
|
155
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
156
|
+
reportValidationFailure(workflow.definition.id, workflow.source.kind, errorMessage);
|
|
157
|
+
if (workflow.source.kind !== 'bundled') {
|
|
158
|
+
warnings.push({
|
|
159
|
+
workflowId: workflow.definition.id,
|
|
160
|
+
sourceKind: workflow.source.kind,
|
|
161
|
+
errors: [errorMessage],
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return { workflows: validWorkflows, warnings };
|
|
167
|
+
}
|
|
120
168
|
async getWorkflowById(id) {
|
|
121
169
|
const workflow = await this.inner.getWorkflowById(id);
|
|
122
170
|
if (!workflow)
|
package/dist/manifest.json
CHANGED
|
@@ -230,8 +230,8 @@
|
|
|
230
230
|
"bytes": 460
|
|
231
231
|
},
|
|
232
232
|
"application/validation.js": {
|
|
233
|
-
"sha256": "
|
|
234
|
-
"bytes":
|
|
233
|
+
"sha256": "12e4d064d5500259b62df0ab594a5fd9e5e0c59e7d7766b19ef80a7ada46a795",
|
|
234
|
+
"bytes": 1512
|
|
235
235
|
},
|
|
236
236
|
"cli-worktrain.d.ts": {
|
|
237
237
|
"sha256": "43e818adf60173644896298637f47b01d5819b17eda46eaa32d0c7d64724d012",
|
|
@@ -477,12 +477,12 @@
|
|
|
477
477
|
"sha256": "40290b50e21ee7e82433efe13b1aa31c1ea608bd057a5c4e324982f284bc928b",
|
|
478
478
|
"bytes": 60673
|
|
479
479
|
},
|
|
480
|
-
"console-ui/assets/index-
|
|
481
|
-
"sha256": "
|
|
480
|
+
"console-ui/assets/index-tOl8Vowf.js": {
|
|
481
|
+
"sha256": "f598d8869c96cf01f1adc245ac289f9614d7616ce1d8f0a86a0bb9665a26fe5d",
|
|
482
482
|
"bytes": 767983
|
|
483
483
|
},
|
|
484
484
|
"console-ui/index.html": {
|
|
485
|
-
"sha256": "
|
|
485
|
+
"sha256": "908a96c5cb785772a69156cc4c8abaa821f37104d8b7ed0ce0f8db077d7d62e3",
|
|
486
486
|
"bytes": 417
|
|
487
487
|
},
|
|
488
488
|
"console/standalone-console.d.ts": {
|
|
@@ -490,8 +490,8 @@
|
|
|
490
490
|
"bytes": 788
|
|
491
491
|
},
|
|
492
492
|
"console/standalone-console.js": {
|
|
493
|
-
"sha256": "
|
|
494
|
-
"bytes":
|
|
493
|
+
"sha256": "4847b32ce53ad1934e6f18dde435bcf7f0fc4374125eb58360d9cdeada616fe7",
|
|
494
|
+
"bytes": 6689
|
|
495
495
|
},
|
|
496
496
|
"context-assembly/deps.d.ts": {
|
|
497
497
|
"sha256": "d699ae8f8f081d92708eba5969e35cf24a45d3f86de72d308ffc4a542b954bc3",
|
|
@@ -902,12 +902,12 @@
|
|
|
902
902
|
"bytes": 7902
|
|
903
903
|
},
|
|
904
904
|
"infrastructure/storage/schema-validating-workflow-storage.d.ts": {
|
|
905
|
-
"sha256": "
|
|
906
|
-
"bytes":
|
|
905
|
+
"sha256": "f22a2e7e65407478d86aa5d5a7546ca35947dc448425309e5be5ba4f8efa5ce6",
|
|
906
|
+
"bytes": 2023
|
|
907
907
|
},
|
|
908
908
|
"infrastructure/storage/schema-validating-workflow-storage.js": {
|
|
909
|
-
"sha256": "
|
|
910
|
-
"bytes":
|
|
909
|
+
"sha256": "4004fac4f8cb1b5cadbe060a389fe6a97377eedc6d4209b92da0d82d36a5e1b0",
|
|
910
|
+
"bytes": 7801
|
|
911
911
|
},
|
|
912
912
|
"infrastructure/storage/storage.d.ts": {
|
|
913
913
|
"sha256": "481c5c0ef797baa7f18cff6a468a1de6d1ef34dd4b35f53e318e30b825b31e63",
|
|
@@ -1234,8 +1234,8 @@
|
|
|
1234
1234
|
"bytes": 4343
|
|
1235
1235
|
},
|
|
1236
1236
|
"mcp/handlers/v2-workflow.js": {
|
|
1237
|
-
"sha256": "
|
|
1238
|
-
"bytes":
|
|
1237
|
+
"sha256": "ed2594e771344c5c3fed99e92b196f72dcfdf1d34ef8dc911bf6e9a12669ef0d",
|
|
1238
|
+
"bytes": 28075
|
|
1239
1239
|
},
|
|
1240
1240
|
"mcp/handlers/v2-workspace-resolution.d.ts": {
|
|
1241
1241
|
"sha256": "dd4de57b4918ebe749cf8c1df70c02bf1effc50932634bae60db53c9a157e872",
|
|
@@ -1262,12 +1262,12 @@
|
|
|
1262
1262
|
"bytes": 7991
|
|
1263
1263
|
},
|
|
1264
1264
|
"mcp/output-schemas.d.ts": {
|
|
1265
|
-
"sha256": "
|
|
1266
|
-
"bytes":
|
|
1265
|
+
"sha256": "03207cb284fb77d0859cb089b0717ac38d9a1f2a997f101324d8efb90c540b5c",
|
|
1266
|
+
"bytes": 94179
|
|
1267
1267
|
},
|
|
1268
1268
|
"mcp/output-schemas.js": {
|
|
1269
|
-
"sha256": "
|
|
1270
|
-
"bytes":
|
|
1269
|
+
"sha256": "73547ff9f84f0f91c0d541a846d917eb1595d7feaec0684afe2271658b774402",
|
|
1270
|
+
"bytes": 23062
|
|
1271
1271
|
},
|
|
1272
1272
|
"mcp/render-envelope.d.ts": {
|
|
1273
1273
|
"sha256": "22e83e1aba52968a7136cf289125a217b5f462a5a66a1eebe4669006e3326fdb",
|
|
@@ -1782,8 +1782,8 @@
|
|
|
1782
1782
|
"bytes": 395
|
|
1783
1783
|
},
|
|
1784
1784
|
"types/workflow-definition.d.ts": {
|
|
1785
|
-
"sha256": "
|
|
1786
|
-
"bytes":
|
|
1785
|
+
"sha256": "1d79940ddcbea1a97a20383685c76a2a749dc371d997434a5af740a756e6252c",
|
|
1786
|
+
"bytes": 6110
|
|
1787
1787
|
},
|
|
1788
1788
|
"types/workflow-definition.js": {
|
|
1789
1789
|
"sha256": "33e3c33243f18cb3440a38d79b3c25daa87fe6ad14f2d28c43b9a4e12a72fcd6",
|
|
@@ -2062,12 +2062,12 @@
|
|
|
2062
2062
|
"bytes": 942
|
|
2063
2063
|
},
|
|
2064
2064
|
"v2/durable-core/domain/prompt-renderer.d.ts": {
|
|
2065
|
-
"sha256": "
|
|
2066
|
-
"bytes":
|
|
2065
|
+
"sha256": "bb5f2781d439c533184749c4d02259965546accaedad18c33571961c56e6d167",
|
|
2066
|
+
"bytes": 1664
|
|
2067
2067
|
},
|
|
2068
2068
|
"v2/durable-core/domain/prompt-renderer.js": {
|
|
2069
|
-
"sha256": "
|
|
2070
|
-
"bytes":
|
|
2069
|
+
"sha256": "fe7d177a79cf8cbf2ee814a0e20e24b4cb3ea1b332c4f6aaf57d0f601a95419b",
|
|
2070
|
+
"bytes": 22976
|
|
2071
2071
|
},
|
|
2072
2072
|
"v2/durable-core/domain/reason-model.d.ts": {
|
|
2073
2073
|
"sha256": "a944e7e0d9b3c73468488263cb0aa1e446c023f8084fd2af53cbda3f3bfcd37a",
|
|
@@ -3062,12 +3062,12 @@
|
|
|
3062
3062
|
"bytes": 550
|
|
3063
3063
|
},
|
|
3064
3064
|
"v2/projections/session-metrics.d.ts": {
|
|
3065
|
-
"sha256": "
|
|
3066
|
-
"bytes":
|
|
3065
|
+
"sha256": "e145784946e29a7a6473c130cc7e11032f62ecd98274796b181136821e4c2aa0",
|
|
3066
|
+
"bytes": 730
|
|
3067
3067
|
},
|
|
3068
3068
|
"v2/projections/session-metrics.js": {
|
|
3069
|
-
"sha256": "
|
|
3070
|
-
"bytes":
|
|
3069
|
+
"sha256": "89a1ee5aae79a19c7fc60840e62741a7dd93028562e72cd26a15e4988953c6c4",
|
|
3070
|
+
"bytes": 3421
|
|
3071
3071
|
},
|
|
3072
3072
|
"v2/read-only/v1-to-v2-shim.d.ts": {
|
|
3073
3073
|
"sha256": "b122df1d4eb4119b65465baa00f157ca4466575d3bc6ac20054a361eaff48e02",
|
|
@@ -3078,8 +3078,8 @@
|
|
|
3078
3078
|
"bytes": 4795
|
|
3079
3079
|
},
|
|
3080
3080
|
"v2/usecases/console-routes.d.ts": {
|
|
3081
|
-
"sha256": "
|
|
3082
|
-
"bytes":
|
|
3081
|
+
"sha256": "9acde26458a0cb2dabcafa9daa2ea1ba72e261422b77491e9d086ecc54c19234",
|
|
3082
|
+
"bytes": 572
|
|
3083
3083
|
},
|
|
3084
3084
|
"v2/usecases/console-routes.js": {
|
|
3085
3085
|
"sha256": "cac41733df0270c8882c1ccc57e616862e422b7dd4aaf78783bb98a21c6edd81",
|
|
@@ -192,7 +192,14 @@ async function handleV2ListWorkflows(input, ctx) {
|
|
|
192
192
|
const warnings = managedStoreError
|
|
193
193
|
? [`Managed workflow source store was temporarily unavailable (${managedStoreError}). Managed sources were not loaded.`]
|
|
194
194
|
: undefined;
|
|
195
|
-
|
|
195
|
+
const hasValidationWarnings = (r) => typeof r.loadAllWorkflowsWithWarnings === 'function';
|
|
196
|
+
let capturedValidationWarnings;
|
|
197
|
+
return neverthrow_1.ResultAsync.fromPromise(hasValidationWarnings(workflowReader)
|
|
198
|
+
? (0, with_timeout_js_1.withTimeout)(workflowReader.loadAllWorkflowsWithWarnings(), TIMEOUT_MS, 'list_workflows').then(({ workflows, warnings }) => {
|
|
199
|
+
capturedValidationWarnings = warnings.length > 0 ? warnings : undefined;
|
|
200
|
+
return workflows;
|
|
201
|
+
})
|
|
202
|
+
: (0, with_timeout_js_1.withTimeout)(workflowReader.loadAllWorkflows(), TIMEOUT_MS, 'list_workflows'), (err) => (0, error_mapper_js_1.mapUnknownErrorToToolError)(err))
|
|
196
203
|
.andThen((allWorkflows) => {
|
|
197
204
|
const workflowMap = new Map(allWorkflows.map((w) => [w.definition.id, w]));
|
|
198
205
|
const summaries = allWorkflows.map((w) => ({
|
|
@@ -233,11 +240,18 @@ async function handleV2ListWorkflows(input, ctx) {
|
|
|
233
240
|
return undefined;
|
|
234
241
|
return buildTagSummary(WORKFLOW_TAGS, sortedIds);
|
|
235
242
|
})();
|
|
236
|
-
const nextStepHint =
|
|
237
|
-
|
|
238
|
-
'
|
|
239
|
-
|
|
240
|
-
|
|
243
|
+
const nextStepHint = (() => {
|
|
244
|
+
if (tagSummaryEntry) {
|
|
245
|
+
return 'Pick a tag from tagSummary that fits the user\'s goal, then call list_workflows with tags=["<tagId>"]. ' +
|
|
246
|
+
'If a workflow ID in examples[] already matches, call start_workflow directly — no second list call needed. ' +
|
|
247
|
+
'If multiple tags could apply, pick the most specific one.';
|
|
248
|
+
}
|
|
249
|
+
if (capturedValidationWarnings) {
|
|
250
|
+
return 'One or more workflow files failed validation and were excluded from the workflows list. ' +
|
|
251
|
+
'Fix the errors listed in validationWarnings in the workflow file(s) and retry list_workflows to confirm.';
|
|
252
|
+
}
|
|
253
|
+
return undefined;
|
|
254
|
+
})();
|
|
241
255
|
if (!input.includeSources) {
|
|
242
256
|
const includeStaleRoots = !tagSummaryEntry && stalePaths.length > 0;
|
|
243
257
|
const payload = {
|
|
@@ -246,6 +260,7 @@ async function handleV2ListWorkflows(input, ctx) {
|
|
|
246
260
|
...(nextStepHint ? { _nextStep: nextStepHint } : {}),
|
|
247
261
|
...(includeStaleRoots ? { staleRoots: [...stalePaths] } : {}),
|
|
248
262
|
...(warnings ? { warnings } : {}),
|
|
263
|
+
...(capturedValidationWarnings ? { validationWarnings: [...capturedValidationWarnings] } : {}),
|
|
249
264
|
};
|
|
250
265
|
return (0, neverthrow_1.okAsync)((0, types_js_1.success)(payload));
|
|
251
266
|
}
|
|
@@ -256,6 +271,7 @@ async function handleV2ListWorkflows(input, ctx) {
|
|
|
256
271
|
...(nextStepHint ? { _nextStep: nextStepHint } : {}),
|
|
257
272
|
...(stalePaths.length > 0 ? { staleRoots: [...stalePaths] } : {}),
|
|
258
273
|
...(warnings ? { warnings } : {}),
|
|
274
|
+
...(capturedValidationWarnings ? { validationWarnings: [...capturedValidationWarnings] } : {}),
|
|
259
275
|
sources: [],
|
|
260
276
|
};
|
|
261
277
|
return (0, neverthrow_1.okAsync)((0, types_js_1.success)(payload));
|
|
@@ -267,6 +283,7 @@ async function handleV2ListWorkflows(input, ctx) {
|
|
|
267
283
|
...(nextStepHint ? { _nextStep: nextStepHint } : {}),
|
|
268
284
|
...(stalePaths.length > 0 ? { staleRoots: [...stalePaths] } : {}),
|
|
269
285
|
...(warnings ? { warnings } : {}),
|
|
286
|
+
...(capturedValidationWarnings ? { validationWarnings: [...capturedValidationWarnings] } : {}),
|
|
270
287
|
sources: [...sources],
|
|
271
288
|
};
|
|
272
289
|
return (0, types_js_1.success)(payload);
|
|
@@ -437,6 +437,19 @@ export declare const TagSummaryItemSchema: z.ZodObject<{
|
|
|
437
437
|
displayName: string;
|
|
438
438
|
count: number;
|
|
439
439
|
}>;
|
|
440
|
+
export declare const V2ValidationWarningSchema: z.ZodObject<{
|
|
441
|
+
workflowId: z.ZodString;
|
|
442
|
+
sourceKind: z.ZodString;
|
|
443
|
+
errors: z.ZodArray<z.ZodString, "many">;
|
|
444
|
+
}, "strip", z.ZodTypeAny, {
|
|
445
|
+
workflowId: string;
|
|
446
|
+
sourceKind: string;
|
|
447
|
+
errors: string[];
|
|
448
|
+
}, {
|
|
449
|
+
workflowId: string;
|
|
450
|
+
sourceKind: string;
|
|
451
|
+
errors: string[];
|
|
452
|
+
}>;
|
|
440
453
|
export declare const V2WorkflowListOutputSchema: z.ZodObject<{
|
|
441
454
|
workflows: z.ZodArray<z.ZodObject<{
|
|
442
455
|
workflowId: z.ZodString;
|
|
@@ -727,6 +740,19 @@ export declare const V2WorkflowListOutputSchema: z.ZodObject<{
|
|
|
727
740
|
} | undefined;
|
|
728
741
|
stale?: true | undefined;
|
|
729
742
|
}>, "many">>;
|
|
743
|
+
validationWarnings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
744
|
+
workflowId: z.ZodString;
|
|
745
|
+
sourceKind: z.ZodString;
|
|
746
|
+
errors: z.ZodArray<z.ZodString, "many">;
|
|
747
|
+
}, "strip", z.ZodTypeAny, {
|
|
748
|
+
workflowId: string;
|
|
749
|
+
sourceKind: string;
|
|
750
|
+
errors: string[];
|
|
751
|
+
}, {
|
|
752
|
+
workflowId: string;
|
|
753
|
+
sourceKind: string;
|
|
754
|
+
errors: string[];
|
|
755
|
+
}>, "many">>;
|
|
730
756
|
}, "strip", z.ZodTypeAny, {
|
|
731
757
|
workflows: {
|
|
732
758
|
kind: "workflow";
|
|
@@ -797,6 +823,11 @@ export declare const V2WorkflowListOutputSchema: z.ZodObject<{
|
|
|
797
823
|
}[] | undefined;
|
|
798
824
|
_nextStep?: string | undefined;
|
|
799
825
|
staleRoots?: string[] | undefined;
|
|
826
|
+
validationWarnings?: {
|
|
827
|
+
workflowId: string;
|
|
828
|
+
sourceKind: string;
|
|
829
|
+
errors: string[];
|
|
830
|
+
}[] | undefined;
|
|
800
831
|
}, {
|
|
801
832
|
workflows: {
|
|
802
833
|
kind: "workflow";
|
|
@@ -867,6 +898,11 @@ export declare const V2WorkflowListOutputSchema: z.ZodObject<{
|
|
|
867
898
|
}[] | undefined;
|
|
868
899
|
_nextStep?: string | undefined;
|
|
869
900
|
staleRoots?: string[] | undefined;
|
|
901
|
+
validationWarnings?: {
|
|
902
|
+
workflowId: string;
|
|
903
|
+
sourceKind: string;
|
|
904
|
+
errors: string[];
|
|
905
|
+
}[] | undefined;
|
|
870
906
|
}>;
|
|
871
907
|
export declare const V2WorkflowInspectOutputSchema: z.ZodObject<{
|
|
872
908
|
workflowId: z.ZodString;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OpenDashboardOutputSchema = exports.ReadSessionSchemaOutputSchema = exports.ReadSessionOutputSchema = exports.UpdateSessionOutputSchema = exports.CreateSessionOutputSchema = exports.V2StartWorkflowOutputSchema = exports.V2CheckpointWorkflowOutputSchema = exports.V2ResumeSessionOutputSchema = exports.V2ContinueWorkflowOutputSchema = exports.V2StepContextSchema = exports.V2BindingDriftWarningSchema = exports.V2BlockerReportSchema = exports.V2ResumeNextCallSchema = exports.V2NextCallSchema = exports.V2NextIntentSchema = exports.V2PreferencesSchema = exports.V2PendingStepSchema = exports.V2WorkflowInspectOutputSchema = exports.V2WorkflowListOutputSchema = exports.TagSummaryItemSchema = exports.V2WorkflowSourceCatalogEntrySchema = exports.V2WorkflowListItemSchema = exports.StalenessSummarySchema = exports.WorkflowGetSchemaOutputSchema = exports.WorkflowValidateJsonOutputSchema = exports.WorkflowNextOutputSchema = exports.WorkflowGetOutputSchema = exports.WorkflowListOutputSchema = exports.WorkflowSummarySchema = exports.JsonValueSchema = void 0;
|
|
3
|
+
exports.OpenDashboardOutputSchema = exports.ReadSessionSchemaOutputSchema = exports.ReadSessionOutputSchema = exports.UpdateSessionOutputSchema = exports.CreateSessionOutputSchema = exports.V2StartWorkflowOutputSchema = exports.V2CheckpointWorkflowOutputSchema = exports.V2ResumeSessionOutputSchema = exports.V2ContinueWorkflowOutputSchema = exports.V2StepContextSchema = exports.V2BindingDriftWarningSchema = exports.V2BlockerReportSchema = exports.V2ResumeNextCallSchema = exports.V2NextCallSchema = exports.V2NextIntentSchema = exports.V2PreferencesSchema = exports.V2PendingStepSchema = exports.V2WorkflowInspectOutputSchema = exports.V2WorkflowListOutputSchema = exports.V2ValidationWarningSchema = exports.TagSummaryItemSchema = exports.V2WorkflowSourceCatalogEntrySchema = exports.V2WorkflowListItemSchema = exports.StalenessSummarySchema = exports.WorkflowGetSchemaOutputSchema = exports.WorkflowValidateJsonOutputSchema = exports.WorkflowNextOutputSchema = exports.WorkflowGetOutputSchema = exports.WorkflowListOutputSchema = exports.WorkflowSummarySchema = exports.JsonValueSchema = void 0;
|
|
4
4
|
exports.toPendingStep = toPendingStep;
|
|
5
5
|
const zod_1 = require("zod");
|
|
6
6
|
const state_js_1 = require("../domain/execution/state.js");
|
|
@@ -113,6 +113,11 @@ exports.TagSummaryItemSchema = zod_1.z.object({
|
|
|
113
113
|
when: zod_1.z.array(zod_1.z.string()).describe('Intent phrases describing when to use workflows in this tag.'),
|
|
114
114
|
examples: zod_1.z.array(zod_1.z.string()).describe('Representative workflow IDs for this tag.'),
|
|
115
115
|
});
|
|
116
|
+
exports.V2ValidationWarningSchema = zod_1.z.object({
|
|
117
|
+
workflowId: zod_1.z.string().min(1),
|
|
118
|
+
sourceKind: zod_1.z.string().min(1),
|
|
119
|
+
errors: zod_1.z.array(zod_1.z.string().min(1)).min(1),
|
|
120
|
+
});
|
|
116
121
|
exports.V2WorkflowListOutputSchema = zod_1.z.object({
|
|
117
122
|
workflows: zod_1.z.array(exports.V2WorkflowListItemSchema),
|
|
118
123
|
tagSummary: zod_1.z.array(exports.TagSummaryItemSchema).optional().describe('Tag summary for the workflow catalog. Present when no tags filter was applied. ' +
|
|
@@ -126,6 +131,11 @@ exports.V2WorkflowListOutputSchema = zod_1.z.object({
|
|
|
126
131
|
'Example: the managed source store was temporarily unavailable and managed sources were not loaded.'),
|
|
127
132
|
sources: zod_1.z.array(exports.V2WorkflowSourceCatalogEntrySchema).optional().describe('Source catalog for this workspace. Only present when includeSources was true in the request. ' +
|
|
128
133
|
'Shows where workflows come from with effective and shadowed counts per source.'),
|
|
134
|
+
validationWarnings: zod_1.z.array(exports.V2ValidationWarningSchema).optional().describe('Structured validation errors for non-bundled workflow files that failed JSON schema validation ' +
|
|
135
|
+
'and were excluded from the workflows list. Each entry identifies which workflow failed ' +
|
|
136
|
+
'(workflowId), which source it came from (sourceKind), and the specific validation errors (errors[]). ' +
|
|
137
|
+
'Absent when all workflows pass validation. Fix the listed errors in the workflow file and retry ' +
|
|
138
|
+
'list_workflows to confirm. Bundled (built-in) workflow failures are never included here.'),
|
|
129
139
|
});
|
|
130
140
|
exports.V2WorkflowInspectOutputSchema = zod_1.z.object({
|
|
131
141
|
workflowId: zod_1.z.string().min(1),
|
|
@@ -138,6 +138,7 @@ export interface WorkflowDefinition {
|
|
|
138
138
|
readonly validatedAgainstSpecVersion?: number;
|
|
139
139
|
readonly about?: string;
|
|
140
140
|
readonly examples?: readonly string[];
|
|
141
|
+
readonly metricsProfile?: 'coding' | 'review' | 'research' | 'design' | 'ticket' | 'none';
|
|
141
142
|
}
|
|
142
143
|
export declare function isLoopStepDefinition(step: WorkflowStepDefinition | LoopStepDefinition): step is LoopStepDefinition;
|
|
143
144
|
export declare function isWorkflowStepDefinition(step: WorkflowStepDefinition | LoopStepDefinition): step is WorkflowStepDefinition;
|
|
@@ -9,6 +9,7 @@ export type PromptRenderError = {
|
|
|
9
9
|
readonly message: string;
|
|
10
10
|
};
|
|
11
11
|
export declare function formatAssessmentRequirementsForTest(assessments: readonly Pick<AssessmentDefinition, 'id' | 'purpose' | 'dimensions'>[]): readonly string[];
|
|
12
|
+
export declare function buildMetricsSection(profile: 'coding' | 'review' | 'research' | 'design' | 'ticket' | 'none' | undefined, isLastStep: boolean, cleanFormat: boolean): string;
|
|
12
13
|
export declare function assembleFragmentedPrompt(fragments: readonly PromptFragment[], context: Record<string, unknown>): string;
|
|
13
14
|
export interface StepMetadata {
|
|
14
15
|
readonly stepId: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.formatAssessmentRequirementsForTest = formatAssessmentRequirementsForTest;
|
|
4
|
+
exports.buildMetricsSection = buildMetricsSection;
|
|
4
5
|
exports.assembleFragmentedPrompt = assembleFragmentedPrompt;
|
|
5
6
|
exports.renderPendingPrompt = renderPendingPrompt;
|
|
6
7
|
const neverthrow_1 = require("neverthrow");
|
|
@@ -204,6 +205,39 @@ function formatAssessmentRequirements(assessments) {
|
|
|
204
205
|
}
|
|
205
206
|
return requirements;
|
|
206
207
|
}
|
|
208
|
+
function buildMetricsSection(profile, isLastStep, cleanFormat) {
|
|
209
|
+
if (!profile || profile === 'none')
|
|
210
|
+
return '';
|
|
211
|
+
switch (profile) {
|
|
212
|
+
case 'coding': {
|
|
213
|
+
const shaFooter = cleanFormat
|
|
214
|
+
? '\n\nMetrics: update context.metrics_commit_shas with the FULL accumulated SHA list (shallow merge -- partial lists lose earlier commits).'
|
|
215
|
+
: '\n\n**METRICS (System):** This is a coding workflow. After each commit, update `context.metrics_commit_shas` with the FULL accumulated list of commit SHAs from this session -- not just the current step\'s commits. Context uses shallow merge: sending only new SHAs permanently loses earlier ones.\n\nCall `continue_workflow` with:\n- `context: { metrics_commit_shas: ["<sha1>", "<sha2>", ...] }` -- full list, every step that has commits';
|
|
216
|
+
if (!isLastStep)
|
|
217
|
+
return shaFooter;
|
|
218
|
+
const finalFooter = cleanFormat
|
|
219
|
+
? '\n\nMetrics (final): also set metrics_outcome, metrics_pr_numbers, metrics_files_changed, metrics_lines_added, metrics_lines_removed in context.'
|
|
220
|
+
: '\n\n**METRICS (System):** This is the final step. Also report:\n- `metrics_outcome`: `"success"` | `"partial"` | `"abandoned"` | `"error"`\n- `metrics_pr_numbers`: array of integer PR numbers (not URLs)\n- `metrics_files_changed`: integer count\n- `metrics_lines_added`: integer count\n- `metrics_lines_removed`: integer count\n\nCall `continue_workflow` with all of the above in `context: { metrics_commit_shas: [...], metrics_outcome: "success", ... }`.';
|
|
221
|
+
return shaFooter + finalFooter;
|
|
222
|
+
}
|
|
223
|
+
case 'review': {
|
|
224
|
+
if (!isLastStep)
|
|
225
|
+
return '';
|
|
226
|
+
return cleanFormat
|
|
227
|
+
? '\n\nMetrics (final): set metrics_pr_numbers (integer array) and metrics_outcome in context.'
|
|
228
|
+
: '\n\n**METRICS (System):** This is the final step of a review workflow. Report:\n- `metrics_pr_numbers`: array of integer PR numbers reviewed (not URLs)\n- `metrics_outcome`: `"success"` | `"partial"` | `"abandoned"` | `"error"`\n\nCall `continue_workflow` with `context: { metrics_pr_numbers: [123], metrics_outcome: "success" }`.';
|
|
229
|
+
}
|
|
230
|
+
case 'research':
|
|
231
|
+
case 'design':
|
|
232
|
+
case 'ticket': {
|
|
233
|
+
if (!isLastStep)
|
|
234
|
+
return '';
|
|
235
|
+
return cleanFormat
|
|
236
|
+
? '\n\nMetrics (final): set metrics_outcome in context.'
|
|
237
|
+
: '\n\n**METRICS (System):** This is the final step. Report:\n- `metrics_outcome`: `"success"` | `"partial"` | `"abandoned"` | `"error"`\n\nCall `continue_workflow` with `context: { metrics_outcome: "success" }`.';
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
207
241
|
function assembleFragmentedPrompt(fragments, context) {
|
|
208
242
|
return fragments
|
|
209
243
|
.filter(f => (0, condition_evaluator_js_1.evaluateCondition)(f.when, context))
|
|
@@ -336,6 +370,11 @@ function renderPendingPrompt(args) {
|
|
|
336
370
|
const fragmentSuffix = promptFragments && promptFragments.length > 0
|
|
337
371
|
? assembleFragmentedPrompt(promptFragments, renderContext)
|
|
338
372
|
: '';
|
|
373
|
+
const lastTopLevelStepId = args.workflow.definition.steps.at(-1)?.id;
|
|
374
|
+
const isLastTopLevelStep = args.stepId === lastTopLevelStepId;
|
|
375
|
+
const isLastExitStep = isExitStep && resolveParentLoopStep(args.workflow, args.stepId)?.id === lastTopLevelStepId;
|
|
376
|
+
const isLastStep = isLastTopLevelStep || isLastExitStep;
|
|
377
|
+
const metricsSection = buildMetricsSection(args.workflow.definition.metricsProfile, isLastStep, cleanResponseFormat);
|
|
339
378
|
const enhancedPrompt = [
|
|
340
379
|
loopBanner,
|
|
341
380
|
basePrompt,
|
|
@@ -344,6 +383,7 @@ function renderPendingPrompt(args) {
|
|
|
344
383
|
assessmentSection,
|
|
345
384
|
notesSection,
|
|
346
385
|
fragmentSuffix ? '\n\n' + fragmentSuffix : '',
|
|
386
|
+
metricsSection,
|
|
347
387
|
].join('');
|
|
348
388
|
if (!args.rehydrateOnly) {
|
|
349
389
|
return (0, neverthrow_1.ok)({ stepId: args.stepId, title: baseTitle, prompt: enhancedPrompt, agentRole, requireConfirmation });
|
|
@@ -4,7 +4,7 @@ export interface SessionMetricsV2 {
|
|
|
4
4
|
readonly endGitSha: string | null;
|
|
5
5
|
readonly gitBranch: string | null;
|
|
6
6
|
readonly agentCommitShas: readonly string[];
|
|
7
|
-
readonly captureConfidence: 'high' | '
|
|
7
|
+
readonly captureConfidence: 'high' | 'none';
|
|
8
8
|
readonly durationMs: number | undefined;
|
|
9
9
|
readonly outcome: 'success' | 'partial' | 'abandoned' | 'error' | null;
|
|
10
10
|
readonly prNumbers: readonly number[];
|
|
@@ -3,24 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.projectSessionMetricsV2 = projectSessionMetricsV2;
|
|
4
4
|
const constants_js_1 = require("../durable-core/constants.js");
|
|
5
5
|
function projectSessionMetricsV2(events) {
|
|
6
|
-
let
|
|
7
|
-
let runCompletedRunId = null;
|
|
6
|
+
let runCompleted = null;
|
|
8
7
|
for (const e of events) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
runCompletedData = asUnknown.data;
|
|
12
|
-
runCompletedRunId = asUnknown.scope?.runId ?? null;
|
|
8
|
+
if (e.kind === 'run_completed') {
|
|
9
|
+
runCompleted = e;
|
|
13
10
|
break;
|
|
14
11
|
}
|
|
15
12
|
}
|
|
16
|
-
if (
|
|
13
|
+
if (runCompleted === null) {
|
|
17
14
|
return null;
|
|
18
15
|
}
|
|
16
|
+
const runCompletedRunId = runCompleted.scope.runId;
|
|
19
17
|
const metricsContext = {};
|
|
20
18
|
for (const e of events) {
|
|
21
19
|
if (e.kind !== constants_js_1.EVENT_KIND.CONTEXT_SET)
|
|
22
20
|
continue;
|
|
23
|
-
if (
|
|
21
|
+
if (e.scope?.runId !== runCompletedRunId)
|
|
24
22
|
continue;
|
|
25
23
|
const ctx = e.data.context;
|
|
26
24
|
if (!ctx || typeof ctx !== 'object' || Array.isArray(ctx))
|
|
@@ -32,25 +30,15 @@ function projectSessionMetricsV2(events) {
|
|
|
32
30
|
}
|
|
33
31
|
}
|
|
34
32
|
}
|
|
35
|
-
const d =
|
|
33
|
+
const d = runCompleted.data;
|
|
36
34
|
const startGitSha = typeof d.startGitSha === 'string' ? d.startGitSha : null;
|
|
37
35
|
const endGitSha = typeof d.endGitSha === 'string' ? d.endGitSha : null;
|
|
38
36
|
const gitBranch = typeof d.gitBranch === 'string' ? d.gitBranch : null;
|
|
39
|
-
const agentCommitShas =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
const captureConfidenceRaw = d.captureConfidence;
|
|
48
|
-
const captureConfidence = captureConfidenceRaw === 'high' || captureConfidenceRaw === 'medium' || captureConfidenceRaw === 'none'
|
|
49
|
-
? captureConfidenceRaw
|
|
50
|
-
: 'none';
|
|
51
|
-
const durationMs = typeof d.durationMs === 'number' && Number.isFinite(d.durationMs)
|
|
52
|
-
? d.durationMs
|
|
53
|
-
: undefined;
|
|
37
|
+
const agentCommitShas = Array.isArray(d.agentCommitShas)
|
|
38
|
+
? d.agentCommitShas.filter((s) => typeof s === 'string')
|
|
39
|
+
: [];
|
|
40
|
+
const durationMs = typeof d.durationMs === 'number' && Number.isFinite(d.durationMs) ? d.durationMs : undefined;
|
|
41
|
+
const captureConfidence = d.captureConfidence === 'high' ? 'high' : 'none';
|
|
54
42
|
const outcomeRaw = metricsContext['metrics_outcome'];
|
|
55
43
|
const outcome = outcomeRaw === 'success' || outcomeRaw === 'partial' || outcomeRaw === 'abandoned' || outcomeRaw === 'error'
|
|
56
44
|
? outcomeRaw
|
|
@@ -68,24 +56,17 @@ function projectSessionMetricsV2(events) {
|
|
|
68
56
|
const metricCommitShas = [];
|
|
69
57
|
if (Array.isArray(commitShasRaw)) {
|
|
70
58
|
for (const sha of commitShasRaw) {
|
|
71
|
-
if (typeof sha === 'string')
|
|
59
|
+
if (typeof sha === 'string')
|
|
72
60
|
metricCommitShas.push(sha);
|
|
73
|
-
}
|
|
74
61
|
}
|
|
75
62
|
}
|
|
76
63
|
const finalAgentCommitShas = metricCommitShas.length > 0 ? metricCommitShas : agentCommitShas;
|
|
77
64
|
const filesChangedRaw = metricsContext['metrics_files_changed'];
|
|
78
|
-
const filesChanged = typeof filesChangedRaw === 'number' && Number.isFinite(filesChangedRaw)
|
|
79
|
-
? filesChangedRaw
|
|
80
|
-
: null;
|
|
65
|
+
const filesChanged = typeof filesChangedRaw === 'number' && Number.isFinite(filesChangedRaw) ? filesChangedRaw : null;
|
|
81
66
|
const linesAddedRaw = metricsContext['metrics_lines_added'];
|
|
82
|
-
const linesAdded = typeof linesAddedRaw === 'number' && Number.isFinite(linesAddedRaw)
|
|
83
|
-
? linesAddedRaw
|
|
84
|
-
: null;
|
|
67
|
+
const linesAdded = typeof linesAddedRaw === 'number' && Number.isFinite(linesAddedRaw) ? linesAddedRaw : null;
|
|
85
68
|
const linesRemovedRaw = metricsContext['metrics_lines_removed'];
|
|
86
|
-
const linesRemoved = typeof linesRemovedRaw === 'number' && Number.isFinite(linesRemovedRaw)
|
|
87
|
-
? linesRemovedRaw
|
|
88
|
-
: null;
|
|
69
|
+
const linesRemoved = typeof linesRemovedRaw === 'number' && Number.isFinite(linesRemovedRaw) ? linesRemovedRaw : null;
|
|
89
70
|
return {
|
|
90
71
|
startGitSha,
|
|
91
72
|
endGitSha,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Application } from 'express';
|
|
2
2
|
import type { ConsoleService } from './console-service.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { IWorkflowReader } from '../../types/storage.js';
|
|
4
4
|
import type { ToolCallTimingRingBuffer } from '../../mcp/tool-call-timing.js';
|
|
5
5
|
import type { V2ToolContext } from '../../mcp/types.js';
|
|
6
|
-
export declare function mountConsoleRoutes(app: Application, consoleService: ConsoleService, workflowService?:
|
|
6
|
+
export declare function mountConsoleRoutes(app: Application, consoleService: ConsoleService, workflowService?: IWorkflowReader, timingRingBuffer?: ToolCallTimingRingBuffer, toolCallsPerfFile?: string, serverVersion?: string, v2ToolContext?: V2ToolContext): () => void;
|