@loopstack/advanced-workflows-examples 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +176 -0
- package/dist/advanced-workflows-examples.module.d.ts +3 -0
- package/dist/advanced-workflows-examples.module.d.ts.map +1 -0
- package/dist/advanced-workflows-examples.module.js +95 -0
- package/dist/advanced-workflows-examples.module.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/workflows/agent-error-handling/agent-error-handling-failing-sub.workflow.d.ts +5 -0
- package/dist/workflows/agent-error-handling/agent-error-handling-failing-sub.workflow.d.ts.map +1 -0
- package/dist/workflows/agent-error-handling/agent-error-handling-failing-sub.workflow.js +29 -0
- package/dist/workflows/agent-error-handling/agent-error-handling-failing-sub.workflow.js.map +1 -0
- package/dist/workflows/agent-error-handling/agent-error-handling.ui.yaml +6 -0
- package/dist/workflows/agent-error-handling/agent-error-handling.workflow.d.ts +34 -0
- package/dist/workflows/agent-error-handling/agent-error-handling.workflow.d.ts.map +1 -0
- package/dist/workflows/agent-error-handling/agent-error-handling.workflow.js +158 -0
- package/dist/workflows/agent-error-handling/agent-error-handling.workflow.js.map +1 -0
- package/dist/workflows/agent-error-handling/templates/system.md +12 -0
- package/dist/workflows/agent-error-handling/tools/failing-sub-workflow.tool.d.ts +12 -0
- package/dist/workflows/agent-error-handling/tools/failing-sub-workflow.tool.d.ts.map +1 -0
- package/dist/workflows/agent-error-handling/tools/failing-sub-workflow.tool.js +40 -0
- package/dist/workflows/agent-error-handling/tools/failing-sub-workflow.tool.js.map +1 -0
- package/dist/workflows/agent-error-handling/tools/runtime-error.tool.d.ts +11 -0
- package/dist/workflows/agent-error-handling/tools/runtime-error.tool.d.ts.map +1 -0
- package/dist/workflows/agent-error-handling/tools/runtime-error.tool.js +33 -0
- package/dist/workflows/agent-error-handling/tools/runtime-error.tool.js.map +1 -0
- package/dist/workflows/agent-error-handling/tools/strict-schema.tool.d.ts +10 -0
- package/dist/workflows/agent-error-handling/tools/strict-schema.tool.d.ts.map +1 -0
- package/dist/workflows/agent-error-handling/tools/strict-schema.tool.js +31 -0
- package/dist/workflows/agent-error-handling/tools/strict-schema.tool.js.map +1 -0
- package/dist/workflows/batch-processing/batch-processing-example.workflow.d.ts +27 -0
- package/dist/workflows/batch-processing/batch-processing-example.workflow.d.ts.map +1 -0
- package/dist/workflows/batch-processing/batch-processing-example.workflow.js +93 -0
- package/dist/workflows/batch-processing/batch-processing-example.workflow.js.map +1 -0
- package/dist/workflows/custom-tool/custom-tool-example.ui.yaml +6 -0
- package/dist/workflows/custom-tool/custom-tool-example.workflow.d.ts +23 -0
- package/dist/workflows/custom-tool/custom-tool-example.workflow.d.ts.map +1 -0
- package/dist/workflows/custom-tool/custom-tool-example.workflow.js +95 -0
- package/dist/workflows/custom-tool/custom-tool-example.workflow.js.map +1 -0
- package/dist/workflows/custom-tool/index.d.ts +2 -0
- package/dist/workflows/custom-tool/index.d.ts.map +1 -0
- package/dist/workflows/custom-tool/index.js +18 -0
- package/dist/workflows/custom-tool/index.js.map +1 -0
- package/dist/workflows/custom-tool/services/math.service.d.ts +4 -0
- package/dist/workflows/custom-tool/services/math.service.d.ts.map +1 -0
- package/dist/workflows/custom-tool/services/math.service.js +20 -0
- package/dist/workflows/custom-tool/services/math.service.js.map +1 -0
- package/dist/workflows/custom-tool/tools/counter.tool.d.ts +7 -0
- package/dist/workflows/custom-tool/tools/counter.tool.d.ts.map +1 -0
- package/dist/workflows/custom-tool/tools/counter.tool.js +25 -0
- package/dist/workflows/custom-tool/tools/counter.tool.js.map +1 -0
- package/dist/workflows/custom-tool/tools/index.d.ts +3 -0
- package/dist/workflows/custom-tool/tools/index.d.ts.map +1 -0
- package/dist/workflows/custom-tool/tools/index.js +19 -0
- package/dist/workflows/custom-tool/tools/index.js.map +1 -0
- package/dist/workflows/custom-tool/tools/math-sum.tool.d.ts +16 -0
- package/dist/workflows/custom-tool/tools/math-sum.tool.d.ts.map +1 -0
- package/dist/workflows/custom-tool/tools/math-sum.tool.js +42 -0
- package/dist/workflows/custom-tool/tools/math-sum.tool.js.map +1 -0
- package/dist/workflows/dynamic-routing/dynamic-routing-example.workflow.d.ts +24 -0
- package/dist/workflows/dynamic-routing/dynamic-routing-example.workflow.d.ts.map +1 -0
- package/dist/workflows/dynamic-routing/dynamic-routing-example.workflow.js +115 -0
- package/dist/workflows/dynamic-routing/dynamic-routing-example.workflow.js.map +1 -0
- package/dist/workflows/error-retry/error-retry-example.ui.yaml +25 -0
- package/dist/workflows/error-retry/error-retry-example.workflow.d.ts +43 -0
- package/dist/workflows/error-retry/error-retry-example.workflow.d.ts.map +1 -0
- package/dist/workflows/error-retry/error-retry-example.workflow.js +343 -0
- package/dist/workflows/error-retry/error-retry-example.workflow.js.map +1 -0
- package/dist/workflows/error-retry/failing-child.workflow.d.ts +5 -0
- package/dist/workflows/error-retry/failing-child.workflow.d.ts.map +1 -0
- package/dist/workflows/error-retry/failing-child.workflow.js +36 -0
- package/dist/workflows/error-retry/failing-child.workflow.js.map +1 -0
- package/dist/workflows/error-retry/tools/slow.tool.d.ts +10 -0
- package/dist/workflows/error-retry/tools/slow.tool.d.ts.map +1 -0
- package/dist/workflows/error-retry/tools/slow.tool.js +27 -0
- package/dist/workflows/error-retry/tools/slow.tool.js.map +1 -0
- package/dist/workflows/error-retry/tools/step1.tool.d.ts +6 -0
- package/dist/workflows/error-retry/tools/step1.tool.d.ts.map +1 -0
- package/dist/workflows/error-retry/tools/step1.tool.js +26 -0
- package/dist/workflows/error-retry/tools/step1.tool.js.map +1 -0
- package/dist/workflows/error-retry/tools/step2.tool.d.ts +10 -0
- package/dist/workflows/error-retry/tools/step2.tool.d.ts.map +1 -0
- package/dist/workflows/error-retry/tools/step2.tool.js +29 -0
- package/dist/workflows/error-retry/tools/step2.tool.js.map +1 -0
- package/dist/workflows/fan-out/fan-out-example.workflow.d.ts +12 -0
- package/dist/workflows/fan-out/fan-out-example.workflow.d.ts.map +1 -0
- package/dist/workflows/fan-out/fan-out-example.workflow.js +68 -0
- package/dist/workflows/fan-out/fan-out-example.workflow.js.map +1 -0
- package/dist/workflows/module-config/consumers/default-greeting.module.d.ts +3 -0
- package/dist/workflows/module-config/consumers/default-greeting.module.d.ts.map +1 -0
- package/dist/workflows/module-config/consumers/default-greeting.module.js +21 -0
- package/dist/workflows/module-config/consumers/default-greeting.module.js.map +1 -0
- package/dist/workflows/module-config/consumers/default-greeting.workflow.d.ts +9 -0
- package/dist/workflows/module-config/consumers/default-greeting.workflow.d.ts.map +1 -0
- package/dist/workflows/module-config/consumers/default-greeting.workflow.js +47 -0
- package/dist/workflows/module-config/consumers/default-greeting.workflow.js.map +1 -0
- package/dist/workflows/module-config/consumers/french-greeting.module.d.ts +3 -0
- package/dist/workflows/module-config/consumers/french-greeting.module.d.ts.map +1 -0
- package/dist/workflows/module-config/consumers/french-greeting.module.js +23 -0
- package/dist/workflows/module-config/consumers/french-greeting.module.js.map +1 -0
- package/dist/workflows/module-config/consumers/french-greeting.workflow.d.ts +9 -0
- package/dist/workflows/module-config/consumers/french-greeting.workflow.d.ts.map +1 -0
- package/dist/workflows/module-config/consumers/french-greeting.workflow.js +47 -0
- package/dist/workflows/module-config/consumers/french-greeting.workflow.js.map +1 -0
- package/dist/workflows/module-config/consumers/german-greeting.module.d.ts +3 -0
- package/dist/workflows/module-config/consumers/german-greeting.module.d.ts.map +1 -0
- package/dist/workflows/module-config/consumers/german-greeting.module.js +23 -0
- package/dist/workflows/module-config/consumers/german-greeting.module.js.map +1 -0
- package/dist/workflows/module-config/consumers/german-greeting.workflow.d.ts +9 -0
- package/dist/workflows/module-config/consumers/german-greeting.workflow.d.ts.map +1 -0
- package/dist/workflows/module-config/consumers/german-greeting.workflow.js +47 -0
- package/dist/workflows/module-config/consumers/german-greeting.workflow.js.map +1 -0
- package/dist/workflows/module-config/consumers/nested-greeting.module.d.ts +3 -0
- package/dist/workflows/module-config/consumers/nested-greeting.module.d.ts.map +1 -0
- package/dist/workflows/module-config/consumers/nested-greeting.module.js +23 -0
- package/dist/workflows/module-config/consumers/nested-greeting.module.js.map +1 -0
- package/dist/workflows/module-config/consumers/nested-greeting.workflow.d.ts +9 -0
- package/dist/workflows/module-config/consumers/nested-greeting.workflow.d.ts.map +1 -0
- package/dist/workflows/module-config/consumers/nested-greeting.workflow.js +47 -0
- package/dist/workflows/module-config/consumers/nested-greeting.workflow.js.map +1 -0
- package/dist/workflows/module-config/greeter/greeter-agent.module.d.ts +8 -0
- package/dist/workflows/module-config/greeter/greeter-agent.module.d.ts.map +1 -0
- package/dist/workflows/module-config/greeter/greeter-agent.module.js +36 -0
- package/dist/workflows/module-config/greeter/greeter-agent.module.js.map +1 -0
- package/dist/workflows/module-config/greeter/greeter.constants.d.ts +6 -0
- package/dist/workflows/module-config/greeter/greeter.constants.d.ts.map +1 -0
- package/dist/workflows/module-config/greeter/greeter.constants.js +5 -0
- package/dist/workflows/module-config/greeter/greeter.constants.js.map +1 -0
- package/dist/workflows/module-config/greeter/greeter.module.d.ts +7 -0
- package/dist/workflows/module-config/greeter/greeter.module.d.ts.map +1 -0
- package/dist/workflows/module-config/greeter/greeter.module.js +47 -0
- package/dist/workflows/module-config/greeter/greeter.module.js.map +1 -0
- package/dist/workflows/module-config/greeter/greeter.tool.d.ts +17 -0
- package/dist/workflows/module-config/greeter/greeter.tool.d.ts.map +1 -0
- package/dist/workflows/module-config/greeter/greeter.tool.js +45 -0
- package/dist/workflows/module-config/greeter/greeter.tool.js.map +1 -0
- package/dist/workflows/module-config/greeter/index.d.ts +4 -0
- package/dist/workflows/module-config/greeter/index.d.ts.map +1 -0
- package/dist/workflows/module-config/greeter/index.js +20 -0
- package/dist/workflows/module-config/greeter/index.js.map +1 -0
- package/dist/workflows/sequence/sequence-example.workflow.d.ts +12 -0
- package/dist/workflows/sequence/sequence-example.workflow.d.ts.map +1 -0
- package/dist/workflows/sequence/sequence-example.workflow.js +67 -0
- package/dist/workflows/sequence/sequence-example.workflow.js.map +1 -0
- package/dist/workflows/sub-workflow/sub-workflow-error-handling.workflow.d.ts +10 -0
- package/dist/workflows/sub-workflow/sub-workflow-error-handling.workflow.d.ts.map +1 -0
- package/dist/workflows/sub-workflow/sub-workflow-error-handling.workflow.js +77 -0
- package/dist/workflows/sub-workflow/sub-workflow-error-handling.workflow.js.map +1 -0
- package/dist/workflows/sub-workflow/sub-workflow-failing-sub.workflow.d.ts +5 -0
- package/dist/workflows/sub-workflow/sub-workflow-failing-sub.workflow.d.ts.map +1 -0
- package/dist/workflows/sub-workflow/sub-workflow-failing-sub.workflow.js +36 -0
- package/dist/workflows/sub-workflow/sub-workflow-failing-sub.workflow.js.map +1 -0
- package/dist/workflows/sub-workflow/sub-workflow-parent.workflow.d.ts +15 -0
- package/dist/workflows/sub-workflow/sub-workflow-parent.workflow.d.ts.map +1 -0
- package/dist/workflows/sub-workflow/sub-workflow-parent.workflow.js +84 -0
- package/dist/workflows/sub-workflow/sub-workflow-parent.workflow.js.map +1 -0
- package/dist/workflows/sub-workflow/sub-workflow-show-modes.workflow.d.ts +17 -0
- package/dist/workflows/sub-workflow/sub-workflow-show-modes.workflow.d.ts.map +1 -0
- package/dist/workflows/sub-workflow/sub-workflow-show-modes.workflow.js +93 -0
- package/dist/workflows/sub-workflow/sub-workflow-show-modes.workflow.js.map +1 -0
- package/dist/workflows/sub-workflow/sub-workflow-sub.workflow.d.ts +5 -0
- package/dist/workflows/sub-workflow/sub-workflow-sub.workflow.d.ts.map +1 -0
- package/dist/workflows/sub-workflow/sub-workflow-sub.workflow.js +36 -0
- package/dist/workflows/sub-workflow/sub-workflow-sub.workflow.js.map +1 -0
- package/dist/workflows/ui-documents/ui-documents-example.workflow.d.ts +6 -0
- package/dist/workflows/ui-documents/ui-documents-example.workflow.d.ts.map +1 -0
- package/dist/workflows/ui-documents/ui-documents-example.workflow.js +51 -0
- package/dist/workflows/ui-documents/ui-documents-example.workflow.js.map +1 -0
- package/dist/workflows/workflow-state/tool-results-example.workflow.d.ts +10 -0
- package/dist/workflows/workflow-state/tool-results-example.workflow.d.ts.map +1 -0
- package/dist/workflows/workflow-state/tool-results-example.workflow.js +48 -0
- package/dist/workflows/workflow-state/tool-results-example.workflow.js.map +1 -0
- package/dist/workflows/workflow-state/workflow-state-example.workflow.d.ts +11 -0
- package/dist/workflows/workflow-state/workflow-state-example.workflow.d.ts.map +1 -0
- package/dist/workflows/workflow-state/workflow-state-example.workflow.js +51 -0
- package/dist/workflows/workflow-state/workflow-state-example.workflow.js.map +1 -0
- package/package.json +56 -0
- package/src/advanced-workflows-examples.module.ts +83 -0
- package/src/index.ts +17 -0
- package/src/workflows/agent-error-handling/agent-error-handling-failing-sub.workflow.ts +13 -0
- package/src/workflows/agent-error-handling/agent-error-handling.ui.yaml +6 -0
- package/src/workflows/agent-error-handling/agent-error-handling.workflow.ts +130 -0
- package/src/workflows/agent-error-handling/templates/system.md +12 -0
- package/src/workflows/agent-error-handling/tools/failing-sub-workflow.tool.ts +32 -0
- package/src/workflows/agent-error-handling/tools/runtime-error.tool.ts +29 -0
- package/src/workflows/agent-error-handling/tools/strict-schema.tool.ts +21 -0
- package/src/workflows/batch-processing/batch-processing-example.workflow.ts +79 -0
- package/src/workflows/custom-tool/custom-tool-example.ui.yaml +6 -0
- package/src/workflows/custom-tool/custom-tool-example.workflow.ts +87 -0
- package/src/workflows/custom-tool/index.ts +1 -0
- package/src/workflows/custom-tool/services/math.service.ts +8 -0
- package/src/workflows/custom-tool/tools/counter.tool.ts +16 -0
- package/src/workflows/custom-tool/tools/index.ts +2 -0
- package/src/workflows/custom-tool/tools/math-sum.tool.ts +30 -0
- package/src/workflows/dynamic-routing/dynamic-routing-example.workflow.ts +86 -0
- package/src/workflows/error-retry/error-retry-example.ui.yaml +25 -0
- package/src/workflows/error-retry/error-retry-example.workflow.ts +286 -0
- package/src/workflows/error-retry/failing-child.workflow.ts +20 -0
- package/src/workflows/error-retry/tools/slow.tool.ts +17 -0
- package/src/workflows/error-retry/tools/step1.tool.ts +16 -0
- package/src/workflows/error-retry/tools/step2.tool.ts +20 -0
- package/src/workflows/fan-out/fan-out-example.workflow.ts +58 -0
- package/src/workflows/module-config/consumers/default-greeting.module.ts +12 -0
- package/src/workflows/module-config/consumers/default-greeting.workflow.ts +24 -0
- package/src/workflows/module-config/consumers/french-greeting.module.ts +14 -0
- package/src/workflows/module-config/consumers/french-greeting.workflow.ts +25 -0
- package/src/workflows/module-config/consumers/german-greeting.module.ts +14 -0
- package/src/workflows/module-config/consumers/german-greeting.workflow.ts +24 -0
- package/src/workflows/module-config/consumers/nested-greeting.module.ts +15 -0
- package/src/workflows/module-config/consumers/nested-greeting.workflow.ts +25 -0
- package/src/workflows/module-config/greeter/greeter-agent.module.ts +33 -0
- package/src/workflows/module-config/greeter/greeter.constants.ts +6 -0
- package/src/workflows/module-config/greeter/greeter.module.ts +48 -0
- package/src/workflows/module-config/greeter/greeter.tool.ts +38 -0
- package/src/workflows/module-config/greeter/index.ts +3 -0
- package/src/workflows/sequence/sequence-example.workflow.ts +57 -0
- package/src/workflows/sub-workflow/sub-workflow-error-handling.workflow.ts +63 -0
- package/src/workflows/sub-workflow/sub-workflow-failing-sub.workflow.ts +21 -0
- package/src/workflows/sub-workflow/sub-workflow-parent.workflow.ts +58 -0
- package/src/workflows/sub-workflow/sub-workflow-show-modes.workflow.ts +73 -0
- package/src/workflows/sub-workflow/sub-workflow-sub.workflow.ts +17 -0
- package/src/workflows/ui-documents/ui-documents-example.workflow.ts +43 -0
- package/src/workflows/workflow-state/tool-results-example.workflow.ts +28 -0
- package/src/workflows/workflow-state/workflow-state-example.workflow.ts +33 -0
package/README.md
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Advanced Workflows Examples
|
|
3
|
+
description: In-depth examples of advanced Loopstack workflow patterns — state, dynamic routing, error retry, sub-workflows (parent, fan-out, sequence, show modes, error handling), batch processing, custom tools, configurable modules, and built-in UI documents.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @loopstack/advanced-workflows-examples
|
|
7
|
+
|
|
8
|
+
> Advanced workflow pattern examples for the [Loopstack](https://loopstack.ai) automation framework.
|
|
9
|
+
|
|
10
|
+
Deep-dive examples for framework patterns authors reach for less often but want available when they need them. Pick the example that matches your problem.
|
|
11
|
+
|
|
12
|
+
## Install as Source (Recommended)
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npx giget@latest gh:loopstack-ai/loopstack/registry/examples/advanced-workflows-examples src/advanced-workflows-examples
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Register the module:
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { Module } from '@nestjs/common';
|
|
22
|
+
import { LoopstackModule } from '@loopstack/loopstack-module';
|
|
23
|
+
import { AdvancedWorkflowsExamplesModule } from './advanced-workflows-examples/advanced-workflows-examples.module';
|
|
24
|
+
|
|
25
|
+
@Module({
|
|
26
|
+
imports: [LoopstackModule.forRoot(), AdvancedWorkflowsExamplesModule],
|
|
27
|
+
})
|
|
28
|
+
export class AppModule {}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Install as a Dependency
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install @loopstack/advanced-workflows-examples
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { AdvancedWorkflowsExamplesModule } from '@loopstack/advanced-workflows-examples';
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Examples
|
|
42
|
+
|
|
43
|
+
| Example | Studio title | Description |
|
|
44
|
+
| ------------------------------------- | ----------------------------------------------- | --------------------------------------------------------------------------------------- |
|
|
45
|
+
| [Workflow State](#workflow-state) | `Advanced - Workflow State Example` | Persist typed state across transitions via `assignState()` |
|
|
46
|
+
| [Dynamic Routing](#dynamic-routing) | `Advanced - Dynamic Routing Example` | Conditional routing with `@Guard` decorators and transition priorities |
|
|
47
|
+
| [Error Retry](#error-retry) | `Advanced - Error Retry Example` | Auto-retry, manual retry, custom error places, timeouts, hybrid |
|
|
48
|
+
| [Sub-Workflow](#sub-workflow) | `Advanced - Sub-Workflow Example` | Launch a child workflow via `.run()` and resume on callback |
|
|
49
|
+
| [Fan-Out](#fan-out) | `Advanced - Fan-Out Example` | Parallel sub-workflows with single aggregated callback (`FanOutWorkflow`) |
|
|
50
|
+
| [Sequence](#sequence) | `Advanced - Sequence Example` | Sequential sub-workflows with single aggregated callback (`SequenceWorkflow`) |
|
|
51
|
+
| [Batch Processing](#batch-processing) | `Advanced - Batch Processing Example` | Chunked processing of a list in fixed-size batches |
|
|
52
|
+
| [Custom Tool](#custom-tool) | `Advanced - Custom Tool Example` | Authoring custom tools — stateless + stateful, `@Tool()`, Zod schemas, NestJS injection |
|
|
53
|
+
| [Module Config](#module-config) | `Advanced - Module Config (Default/German/...)` | `forRoot` / `forFeature` patterns for configurable modules |
|
|
54
|
+
| [UI Documents](#ui-documents) | `Advanced - UI Documents Example` | Smoke test for built-in document types (Message, Error, Markdown, Plain) |
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Workflow State
|
|
59
|
+
|
|
60
|
+
Two related workflows demonstrating state management:
|
|
61
|
+
|
|
62
|
+
- `WorkflowStateWorkflow` — minimal pattern: assign state, read it in the next transition.
|
|
63
|
+
- `WorkflowToolResultsWorkflow` — store tool results in state and reference them later.
|
|
64
|
+
|
|
65
|
+
### Files
|
|
66
|
+
|
|
67
|
+
- `workflow-state-example.workflow.ts`
|
|
68
|
+
- `tool-results-example.workflow.ts`
|
|
69
|
+
|
|
70
|
+
## Dynamic Routing
|
|
71
|
+
|
|
72
|
+
Demonstrates `@Guard`-based conditional routing — multiple transitions out of one state, evaluated in priority order, the first one whose guard returns true wins.
|
|
73
|
+
|
|
74
|
+
### Files
|
|
75
|
+
|
|
76
|
+
- `dynamic-routing-example.workflow.ts`
|
|
77
|
+
|
|
78
|
+
## Error Retry
|
|
79
|
+
|
|
80
|
+
Demonstrates every retry/error mode in one workflow:
|
|
81
|
+
|
|
82
|
+
1. **Auto-retry** with exponential backoff
|
|
83
|
+
2. **Manual retry** via Retry button
|
|
84
|
+
3. **Custom error place** with recovery transition
|
|
85
|
+
4. **Timeout** with manual retry
|
|
86
|
+
5. **Hybrid** (auto-retry + custom error place)
|
|
87
|
+
|
|
88
|
+
### Files
|
|
89
|
+
|
|
90
|
+
- `error-retry-example.workflow.ts`
|
|
91
|
+
- `error-retry-example.ui.yaml`
|
|
92
|
+
- `tools/{step1,step2,slow}.tool.ts`
|
|
93
|
+
|
|
94
|
+
## Sub-Workflow
|
|
95
|
+
|
|
96
|
+
Five workflow files demonstrating sub-workflow composition:
|
|
97
|
+
|
|
98
|
+
- `sub-workflow-parent.workflow.ts` — basic parent that launches a child via `.run()`
|
|
99
|
+
- `sub-workflow-sub.workflow.ts` — the child workflow
|
|
100
|
+
- `sub-workflow-failing-sub.workflow.ts` — a child that always fails (used by error-handling)
|
|
101
|
+
- `sub-workflow-error-handling.workflow.ts` — parent handles failed children via `input.hasError` / `input.errorMessage`
|
|
102
|
+
- `sub-workflow-show-modes.workflow.ts` — every `show` mode (`inline`, `link`, `hidden`) in one flow
|
|
103
|
+
|
|
104
|
+
For parallel and sequential composition see [Fan-Out](../fan-out/README.md) and [Sequence](../sequence/README.md).
|
|
105
|
+
|
|
106
|
+
## Fan-Out
|
|
107
|
+
|
|
108
|
+
Launches multiple sub-workflows in parallel via `FanOutWorkflow` from `@loopstack/core`. The parent receives a single callback once all children complete.
|
|
109
|
+
|
|
110
|
+
### Files
|
|
111
|
+
|
|
112
|
+
- `fan-out-example.workflow.ts`
|
|
113
|
+
|
|
114
|
+
## Sequence
|
|
115
|
+
|
|
116
|
+
Runs multiple sub-workflows one at a time via `SequenceWorkflow` from `@loopstack/core`. The parent receives a single aggregated callback after the last child completes.
|
|
117
|
+
|
|
118
|
+
### Files
|
|
119
|
+
|
|
120
|
+
- `sequence-example.workflow.ts`
|
|
121
|
+
|
|
122
|
+
## Batch Processing
|
|
123
|
+
|
|
124
|
+
Processes a list of items in fixed-size batches. Items within a batch run concurrently (`Promise.all`), batches run sequentially via a state-machine loop. Distinct from `FanOutWorkflow` which runs all sub-workflows simultaneously.
|
|
125
|
+
|
|
126
|
+
Useful for rate-limited APIs, memory-bounded processing, or quota-constrained operations.
|
|
127
|
+
|
|
128
|
+
### Files
|
|
129
|
+
|
|
130
|
+
- `batch-processing-example.workflow.ts`
|
|
131
|
+
|
|
132
|
+
## Custom Tool
|
|
133
|
+
|
|
134
|
+
Demonstrates authoring custom tools by extending `BaseTool`:
|
|
135
|
+
|
|
136
|
+
- `MathSumTool` — stateless, computes `a + b`
|
|
137
|
+
- `CounterTool` — stateful, persists across checkpoints
|
|
138
|
+
- `MathService` — supporting NestJS service injected into a tool
|
|
139
|
+
|
|
140
|
+
### Files
|
|
141
|
+
|
|
142
|
+
- `custom-tool-example.workflow.ts`
|
|
143
|
+
- `custom-tool-example.ui.yaml`
|
|
144
|
+
- `tools/math-sum.tool.ts` (stateless)
|
|
145
|
+
- `tools/counter.tool.ts` (stateful)
|
|
146
|
+
- `services/math.service.ts`
|
|
147
|
+
|
|
148
|
+
## Module Config
|
|
149
|
+
|
|
150
|
+
Four scenarios for configurable modules:
|
|
151
|
+
|
|
152
|
+
1. **Default Greeting** — no `forFeature` override; uses `forRoot` global defaults
|
|
153
|
+
2. **German Greeting** — `forFeature` override per module
|
|
154
|
+
3. **French Greeting** — independent `forFeature`, proves per-module isolation
|
|
155
|
+
4. **Nested Greeting** — config passed through a wrapper module (`GreeterAgentModule.forFeature`)
|
|
156
|
+
|
|
157
|
+
Each consumer module registers its own `@Workflow` so all four show up in the sidebar.
|
|
158
|
+
|
|
159
|
+
### Files
|
|
160
|
+
|
|
161
|
+
- `greeter/` — configurable module (`forRoot`, `forFeature`, constants, tool)
|
|
162
|
+
- `consumers/` — four module + workflow pairs, one per scenario
|
|
163
|
+
|
|
164
|
+
## UI Documents
|
|
165
|
+
|
|
166
|
+
A small workflow that saves one of each built-in document type so you can verify Studio renders them correctly.
|
|
167
|
+
|
|
168
|
+
### Files
|
|
169
|
+
|
|
170
|
+
- `ui-documents-example.workflow.ts`
|
|
171
|
+
|
|
172
|
+
## About
|
|
173
|
+
|
|
174
|
+
Author: [Jakob Klippel](https://www.linkedin.com/in/jakob-klippel/)
|
|
175
|
+
|
|
176
|
+
License: MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advanced-workflows-examples.module.d.ts","sourceRoot":"","sources":["../src/advanced-workflows-examples.module.ts"],"names":[],"mappings":"AAmDA,qBA+Ba,+BAA+B;CAAG"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.AdvancedWorkflowsExamplesModule = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const claude_module_1 = require("@loopstack/claude-module");
|
|
12
|
+
const common_2 = require("@loopstack/common");
|
|
13
|
+
const agent_error_handling_failing_sub_workflow_1 = require("./workflows/agent-error-handling/agent-error-handling-failing-sub.workflow");
|
|
14
|
+
const agent_error_handling_workflow_1 = require("./workflows/agent-error-handling/agent-error-handling.workflow");
|
|
15
|
+
const failing_sub_workflow_tool_1 = require("./workflows/agent-error-handling/tools/failing-sub-workflow.tool");
|
|
16
|
+
const runtime_error_tool_1 = require("./workflows/agent-error-handling/tools/runtime-error.tool");
|
|
17
|
+
const strict_schema_tool_1 = require("./workflows/agent-error-handling/tools/strict-schema.tool");
|
|
18
|
+
const batch_processing_example_workflow_1 = require("./workflows/batch-processing/batch-processing-example.workflow");
|
|
19
|
+
const custom_tool_example_workflow_1 = require("./workflows/custom-tool/custom-tool-example.workflow");
|
|
20
|
+
const math_service_1 = require("./workflows/custom-tool/services/math.service");
|
|
21
|
+
const counter_tool_1 = require("./workflows/custom-tool/tools/counter.tool");
|
|
22
|
+
const math_sum_tool_1 = require("./workflows/custom-tool/tools/math-sum.tool");
|
|
23
|
+
const dynamic_routing_example_workflow_1 = require("./workflows/dynamic-routing/dynamic-routing-example.workflow");
|
|
24
|
+
const error_retry_example_workflow_1 = require("./workflows/error-retry/error-retry-example.workflow");
|
|
25
|
+
const failing_child_workflow_1 = require("./workflows/error-retry/failing-child.workflow");
|
|
26
|
+
const slow_tool_1 = require("./workflows/error-retry/tools/slow.tool");
|
|
27
|
+
const step1_tool_1 = require("./workflows/error-retry/tools/step1.tool");
|
|
28
|
+
const step2_tool_1 = require("./workflows/error-retry/tools/step2.tool");
|
|
29
|
+
const fan_out_example_workflow_1 = require("./workflows/fan-out/fan-out-example.workflow");
|
|
30
|
+
const default_greeting_module_1 = require("./workflows/module-config/consumers/default-greeting.module");
|
|
31
|
+
const french_greeting_module_1 = require("./workflows/module-config/consumers/french-greeting.module");
|
|
32
|
+
const german_greeting_module_1 = require("./workflows/module-config/consumers/german-greeting.module");
|
|
33
|
+
const nested_greeting_module_1 = require("./workflows/module-config/consumers/nested-greeting.module");
|
|
34
|
+
const greeter_module_1 = require("./workflows/module-config/greeter/greeter.module");
|
|
35
|
+
const sequence_example_workflow_1 = require("./workflows/sequence/sequence-example.workflow");
|
|
36
|
+
const sub_workflow_error_handling_workflow_1 = require("./workflows/sub-workflow/sub-workflow-error-handling.workflow");
|
|
37
|
+
const sub_workflow_failing_sub_workflow_1 = require("./workflows/sub-workflow/sub-workflow-failing-sub.workflow");
|
|
38
|
+
const sub_workflow_parent_workflow_1 = require("./workflows/sub-workflow/sub-workflow-parent.workflow");
|
|
39
|
+
const sub_workflow_show_modes_workflow_1 = require("./workflows/sub-workflow/sub-workflow-show-modes.workflow");
|
|
40
|
+
const sub_workflow_sub_workflow_1 = require("./workflows/sub-workflow/sub-workflow-sub.workflow");
|
|
41
|
+
const ui_documents_example_workflow_1 = require("./workflows/ui-documents/ui-documents-example.workflow");
|
|
42
|
+
const tool_results_example_workflow_1 = require("./workflows/workflow-state/tool-results-example.workflow");
|
|
43
|
+
const workflow_state_example_workflow_1 = require("./workflows/workflow-state/workflow-state-example.workflow");
|
|
44
|
+
const WORKFLOWS = [
|
|
45
|
+
workflow_state_example_workflow_1.WorkflowStateWorkflow,
|
|
46
|
+
tool_results_example_workflow_1.WorkflowToolResultsWorkflow,
|
|
47
|
+
dynamic_routing_example_workflow_1.DynamicRoutingExampleWorkflow,
|
|
48
|
+
error_retry_example_workflow_1.ErrorRetryWorkflow,
|
|
49
|
+
sub_workflow_parent_workflow_1.RunSubWorkflowExampleParentWorkflow,
|
|
50
|
+
sub_workflow_error_handling_workflow_1.RunSubWorkflowExampleErrorHandlingWorkflow,
|
|
51
|
+
sub_workflow_show_modes_workflow_1.RunSubWorkflowExampleShowModesWorkflow,
|
|
52
|
+
fan_out_example_workflow_1.RunSubWorkflowExampleFanOutWorkflow,
|
|
53
|
+
sequence_example_workflow_1.RunSubWorkflowExampleSequenceWorkflow,
|
|
54
|
+
batch_processing_example_workflow_1.BatchProcessingExampleWorkflow,
|
|
55
|
+
custom_tool_example_workflow_1.CustomToolExampleWorkflow,
|
|
56
|
+
ui_documents_example_workflow_1.TestUiDocumentsWorkflow,
|
|
57
|
+
agent_error_handling_workflow_1.AgentErrorHandlingWorkflow,
|
|
58
|
+
];
|
|
59
|
+
let AdvancedWorkflowsExamplesModule = class AdvancedWorkflowsExamplesModule {
|
|
60
|
+
};
|
|
61
|
+
exports.AdvancedWorkflowsExamplesModule = AdvancedWorkflowsExamplesModule;
|
|
62
|
+
exports.AdvancedWorkflowsExamplesModule = AdvancedWorkflowsExamplesModule = __decorate([
|
|
63
|
+
(0, common_2.StudioApp)({
|
|
64
|
+
title: 'Advanced Workflows Examples',
|
|
65
|
+
workflows: WORKFLOWS,
|
|
66
|
+
}),
|
|
67
|
+
(0, common_1.Module)({
|
|
68
|
+
imports: [
|
|
69
|
+
claude_module_1.ClaudeModule,
|
|
70
|
+
greeter_module_1.GreeterModule.forRoot({ language: 'en', greeting: 'Hello' }),
|
|
71
|
+
default_greeting_module_1.DefaultGreetingModule,
|
|
72
|
+
german_greeting_module_1.GermanGreetingModule,
|
|
73
|
+
french_greeting_module_1.FrenchGreetingModule,
|
|
74
|
+
nested_greeting_module_1.NestedGreetingModule,
|
|
75
|
+
],
|
|
76
|
+
providers: [
|
|
77
|
+
math_service_1.MathService,
|
|
78
|
+
math_sum_tool_1.MathSumTool,
|
|
79
|
+
counter_tool_1.CounterTool,
|
|
80
|
+
step1_tool_1.Step1Tool,
|
|
81
|
+
step2_tool_1.Step2Tool,
|
|
82
|
+
slow_tool_1.SlowTool,
|
|
83
|
+
strict_schema_tool_1.StrictSchemaTool,
|
|
84
|
+
runtime_error_tool_1.RuntimeErrorTool,
|
|
85
|
+
failing_sub_workflow_tool_1.FailingSubWorkflowTool,
|
|
86
|
+
failing_child_workflow_1.ErrorRetryFailingChildWorkflow,
|
|
87
|
+
sub_workflow_sub_workflow_1.RunSubWorkflowExampleSubWorkflow,
|
|
88
|
+
sub_workflow_failing_sub_workflow_1.RunSubWorkflowExampleFailingSubWorkflow,
|
|
89
|
+
agent_error_handling_failing_sub_workflow_1.AgentErrorHandlingFailingSubWorkflow,
|
|
90
|
+
...WORKFLOWS,
|
|
91
|
+
],
|
|
92
|
+
exports: WORKFLOWS,
|
|
93
|
+
})
|
|
94
|
+
], AdvancedWorkflowsExamplesModule);
|
|
95
|
+
//# sourceMappingURL=advanced-workflows-examples.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advanced-workflows-examples.module.js","sourceRoot":"","sources":["../src/advanced-workflows-examples.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,4DAAwD;AACxD,8CAA8C;AAC9C,0IAAkI;AAClI,kHAA4G;AAC5G,gHAA0G;AAC1G,kGAA6F;AAC7F,kGAA6F;AAC7F,sHAAgH;AAChH,uGAAiG;AACjG,gFAA4E;AAC5E,6EAAyE;AACzE,+EAA0E;AAC1E,mHAA6G;AAC7G,uGAA0F;AAC1F,2FAAgG;AAChG,uEAAmE;AACnE,yEAAqE;AACrE,yEAAqE;AACrE,2FAAmG;AACnG,yGAAoG;AACpG,uGAAkG;AAClG,uGAAkG;AAClG,uGAAkG;AAClG,qFAAiF;AACjF,8FAAuG;AACvG,wHAA2H;AAC3H,kHAAqH;AACrH,wGAA4G;AAC5G,gHAAmH;AACnH,kGAAsG;AACtG,0GAAiG;AACjG,4GAAuG;AACvG,gHAAmG;AAEnG,MAAM,SAAS,GAAG;IAChB,uDAAqB;IACrB,2DAA2B;IAC3B,gEAA6B;IAC7B,iDAAkB;IAClB,kEAAmC;IACnC,iFAA0C;IAC1C,yEAAsC;IACtC,8DAAmC;IACnC,iEAAqC;IACrC,kEAA8B;IAC9B,wDAAyB;IACzB,uDAAuB;IACvB,0DAA0B;CAC3B,CAAC;AAiCK,IAAM,+BAA+B,GAArC,MAAM,+BAA+B;CAAG,CAAA;AAAlC,0EAA+B;0CAA/B,+BAA+B;IA/B3C,IAAA,kBAAS,EAAC;QACT,KAAK,EAAE,6BAA6B;QACpC,SAAS,EAAE,SAAS;KACrB,CAAC;IACD,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,4BAAY;YACZ,8BAAa,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;YAC5D,+CAAqB;YACrB,6CAAoB;YACpB,6CAAoB;YACpB,6CAAoB;SACrB;QACD,SAAS,EAAE;YACT,0BAAW;YACX,2BAAW;YACX,0BAAW;YACX,sBAAS;YACT,sBAAS;YACT,oBAAQ;YACR,qCAAgB;YAChB,qCAAgB;YAChB,kDAAsB;YACtB,uDAA8B;YAC9B,4DAAgC;YAChC,2EAAuC;YACvC,gFAAoC;YACpC,GAAG,SAAS;SACb;QACD,OAAO,EAAE,SAAS;KACnB,CAAC;GACW,+BAA+B,CAAG"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from './advanced-workflows-examples.module';
|
|
2
|
+
export * from './workflows/workflow-state/workflow-state-example.workflow';
|
|
3
|
+
export * from './workflows/workflow-state/tool-results-example.workflow';
|
|
4
|
+
export * from './workflows/dynamic-routing/dynamic-routing-example.workflow';
|
|
5
|
+
export * from './workflows/error-retry/error-retry-example.workflow';
|
|
6
|
+
export * from './workflows/sub-workflow/sub-workflow-parent.workflow';
|
|
7
|
+
export * from './workflows/sub-workflow/sub-workflow-sub.workflow';
|
|
8
|
+
export * from './workflows/sub-workflow/sub-workflow-failing-sub.workflow';
|
|
9
|
+
export * from './workflows/sub-workflow/sub-workflow-error-handling.workflow';
|
|
10
|
+
export * from './workflows/sub-workflow/sub-workflow-show-modes.workflow';
|
|
11
|
+
export * from './workflows/fan-out/fan-out-example.workflow';
|
|
12
|
+
export * from './workflows/sequence/sequence-example.workflow';
|
|
13
|
+
export * from './workflows/batch-processing/batch-processing-example.workflow';
|
|
14
|
+
export * from './workflows/custom-tool/custom-tool-example.workflow';
|
|
15
|
+
export * from './workflows/ui-documents/ui-documents-example.workflow';
|
|
16
|
+
export * from './workflows/agent-error-handling/agent-error-handling.workflow';
|
|
17
|
+
export * from './workflows/agent-error-handling/agent-error-handling-failing-sub.workflow';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sCAAsC,CAAC;AACrD,cAAc,4DAA4D,CAAC;AAC3E,cAAc,0DAA0D,CAAC;AACzE,cAAc,8DAA8D,CAAC;AAC7E,cAAc,sDAAsD,CAAC;AACrE,cAAc,uDAAuD,CAAC;AACtE,cAAc,oDAAoD,CAAC;AACnE,cAAc,4DAA4D,CAAC;AAC3E,cAAc,+DAA+D,CAAC;AAC9E,cAAc,2DAA2D,CAAC;AAC1E,cAAc,8CAA8C,CAAC;AAC7D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,gEAAgE,CAAC;AAC/E,cAAc,sDAAsD,CAAC;AACrE,cAAc,wDAAwD,CAAC;AACvE,cAAc,gEAAgE,CAAC;AAC/E,cAAc,4EAA4E,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./advanced-workflows-examples.module"), exports);
|
|
18
|
+
__exportStar(require("./workflows/workflow-state/workflow-state-example.workflow"), exports);
|
|
19
|
+
__exportStar(require("./workflows/workflow-state/tool-results-example.workflow"), exports);
|
|
20
|
+
__exportStar(require("./workflows/dynamic-routing/dynamic-routing-example.workflow"), exports);
|
|
21
|
+
__exportStar(require("./workflows/error-retry/error-retry-example.workflow"), exports);
|
|
22
|
+
__exportStar(require("./workflows/sub-workflow/sub-workflow-parent.workflow"), exports);
|
|
23
|
+
__exportStar(require("./workflows/sub-workflow/sub-workflow-sub.workflow"), exports);
|
|
24
|
+
__exportStar(require("./workflows/sub-workflow/sub-workflow-failing-sub.workflow"), exports);
|
|
25
|
+
__exportStar(require("./workflows/sub-workflow/sub-workflow-error-handling.workflow"), exports);
|
|
26
|
+
__exportStar(require("./workflows/sub-workflow/sub-workflow-show-modes.workflow"), exports);
|
|
27
|
+
__exportStar(require("./workflows/fan-out/fan-out-example.workflow"), exports);
|
|
28
|
+
__exportStar(require("./workflows/sequence/sequence-example.workflow"), exports);
|
|
29
|
+
__exportStar(require("./workflows/batch-processing/batch-processing-example.workflow"), exports);
|
|
30
|
+
__exportStar(require("./workflows/custom-tool/custom-tool-example.workflow"), exports);
|
|
31
|
+
__exportStar(require("./workflows/ui-documents/ui-documents-example.workflow"), exports);
|
|
32
|
+
__exportStar(require("./workflows/agent-error-handling/agent-error-handling.workflow"), exports);
|
|
33
|
+
__exportStar(require("./workflows/agent-error-handling/agent-error-handling-failing-sub.workflow"), exports);
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uEAAqD;AACrD,6FAA2E;AAC3E,2FAAyE;AACzE,+FAA6E;AAC7E,uFAAqE;AACrE,wFAAsE;AACtE,qFAAmE;AACnE,6FAA2E;AAC3E,gGAA8E;AAC9E,4FAA0E;AAC1E,+EAA6D;AAC7D,iFAA+D;AAC/D,iGAA+E;AAC/E,uFAAqE;AACrE,yFAAuE;AACvE,iGAA+E;AAC/E,6GAA2F"}
|
package/dist/workflows/agent-error-handling/agent-error-handling-failing-sub.workflow.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-error-handling-failing-sub.workflow.d.ts","sourceRoot":"","sources":["../../../src/workflows/agent-error-handling/agent-error-handling-failing-sub.workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAwB,MAAM,mBAAmB,CAAC;AAMvE,qBACa,oCAAqC,SAAQ,YAAY;IAEpE,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAGtC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AgentErrorHandlingFailingSubWorkflow = void 0;
|
|
13
|
+
const common_1 = require("@loopstack/common");
|
|
14
|
+
let AgentErrorHandlingFailingSubWorkflow = class AgentErrorHandlingFailingSubWorkflow extends common_1.BaseWorkflow {
|
|
15
|
+
start(_state) {
|
|
16
|
+
return Promise.reject(new Error('Simulated sub-workflow failure.'));
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
exports.AgentErrorHandlingFailingSubWorkflow = AgentErrorHandlingFailingSubWorkflow;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, common_1.Transition)({ to: 'done' }),
|
|
22
|
+
__metadata("design:type", Function),
|
|
23
|
+
__metadata("design:paramtypes", [Object]),
|
|
24
|
+
__metadata("design:returntype", void 0)
|
|
25
|
+
], AgentErrorHandlingFailingSubWorkflow.prototype, "start", null);
|
|
26
|
+
exports.AgentErrorHandlingFailingSubWorkflow = AgentErrorHandlingFailingSubWorkflow = __decorate([
|
|
27
|
+
(0, common_1.Workflow)({ title: 'Agent Error Handling - Failing Sub-Workflow' })
|
|
28
|
+
], AgentErrorHandlingFailingSubWorkflow);
|
|
29
|
+
//# sourceMappingURL=agent-error-handling-failing-sub.workflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-error-handling-failing-sub.workflow.js","sourceRoot":"","sources":["../../../src/workflows/agent-error-handling/agent-error-handling-failing-sub.workflow.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAAuE;AAOhE,IAAM,oCAAoC,GAA1C,MAAM,oCAAqC,SAAQ,qBAAY;IAEpE,KAAK,CAAC,MAA+B;QACnC,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC,CAAC;IACtE,CAAC;CACF,CAAA;AALY,oFAAoC;AAE/C;IADC,IAAA,mBAAU,EAAC,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;;;;iEAG1B;+CAJU,oCAAoC;IADhD,IAAA,iBAAQ,EAAC,EAAE,KAAK,EAAE,6CAA6C,EAAE,CAAC;GACtD,oCAAoC,CAKhD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BaseWorkflow } from '@loopstack/common';
|
|
2
|
+
import type { RunContext, TransitionInput, WorkflowOrchestrator } from '@loopstack/common';
|
|
3
|
+
import type { LlmDelegateResult, LlmGenerateTextResult } from '@loopstack/llm-provider-module';
|
|
4
|
+
import { LlmDelegateToolCallsTool, LlmGenerateTextTool, LlmUpdateToolResultTool } from '@loopstack/llm-provider-module';
|
|
5
|
+
import { FailingSubWorkflowTool } from './tools/failing-sub-workflow.tool';
|
|
6
|
+
import { RuntimeErrorTool } from './tools/runtime-error.tool';
|
|
7
|
+
import { StrictSchemaTool } from './tools/strict-schema.tool';
|
|
8
|
+
interface AgentErrorHandlingState {
|
|
9
|
+
llmResult?: LlmGenerateTextResult;
|
|
10
|
+
delegateResult?: LlmDelegateResult;
|
|
11
|
+
turnCount: number;
|
|
12
|
+
}
|
|
13
|
+
export declare class AgentErrorHandlingWorkflow extends BaseWorkflow {
|
|
14
|
+
private readonly llmGenerateText;
|
|
15
|
+
private readonly llmDelegateToolCalls;
|
|
16
|
+
private readonly llmUpdateToolResult;
|
|
17
|
+
private readonly strictSchema;
|
|
18
|
+
private readonly runtimeError;
|
|
19
|
+
private readonly failingSubWorkflow;
|
|
20
|
+
private readonly orchestrator;
|
|
21
|
+
constructor(llmGenerateText: LlmGenerateTextTool, llmDelegateToolCalls: LlmDelegateToolCallsTool, llmUpdateToolResult: LlmUpdateToolResultTool, strictSchema: StrictSchemaTool, runtimeError: RuntimeErrorTool, failingSubWorkflow: FailingSubWorkflowTool, orchestrator: WorkflowOrchestrator);
|
|
22
|
+
setup(_state: AgentErrorHandlingState): Promise<void>;
|
|
23
|
+
llmTurn(state: AgentErrorHandlingState): Promise<void>;
|
|
24
|
+
executeToolCalls(state: AgentErrorHandlingState): Promise<void>;
|
|
25
|
+
toolResultReceived(state: AgentErrorHandlingState, input: TransitionInput): Promise<void>;
|
|
26
|
+
toolsComplete(_state: AgentErrorHandlingState): void;
|
|
27
|
+
cancelPendingTools(state: AgentErrorHandlingState, ctx: RunContext): Promise<void>;
|
|
28
|
+
respond(_state: AgentErrorHandlingState): void;
|
|
29
|
+
private hasToolCalls;
|
|
30
|
+
private allToolsComplete;
|
|
31
|
+
private isEndTurn;
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=agent-error-handling.workflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-error-handling.workflow.d.ts","sourceRoot":"","sources":["../../../src/workflows/agent-error-handling/agent-error-handling.workflow.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAuE,MAAM,mBAAmB,CAAC;AACtH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC3F,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC/F,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EAEnB,uBAAuB,EACxB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,UAAU,uBAAuB;IAC/B,SAAS,CAAC,EAAE,qBAAqB,CAAC;IAClC,cAAc,CAAC,EAAE,iBAAiB,CAAC;IACnC,SAAS,EAAE,MAAM,CAAC;CACnB;AAUD,qBAMa,0BAA2B,SAAQ,YAAY;IAExD,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IACrC,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACJ,OAAO,CAAC,QAAQ,CAAC,YAAY;gBAN3C,eAAe,EAAE,mBAAmB,EACpC,oBAAoB,EAAE,wBAAwB,EAC9C,mBAAmB,EAAE,uBAAuB,EAC5C,YAAY,EAAE,gBAAgB,EAC9B,YAAY,EAAE,gBAAgB,EAC9B,kBAAkB,EAAE,sBAAsB,EACX,YAAY,EAAE,oBAAoB;IAM9E,KAAK,CAAC,MAAM,EAAE,uBAAuB;IAmBrC,OAAO,CAAC,KAAK,EAAE,uBAAuB;IAoBtC,gBAAgB,CAAC,KAAK,EAAE,uBAAuB;IAS/C,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,EAAE,KAAK,EAAE,eAAe;IAU/E,aAAa,CAAC,MAAM,EAAE,uBAAuB;IAGvC,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,EAAE,GAAG,EAAE,UAAU;IAMxE,OAAO,CAAC,MAAM,EAAE,uBAAuB;IAEvC,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,SAAS;CAGlB"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.AgentErrorHandlingWorkflow = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const node_path_1 = require("node:path");
|
|
18
|
+
const common_2 = require("@loopstack/common");
|
|
19
|
+
const llm_provider_module_1 = require("@loopstack/llm-provider-module");
|
|
20
|
+
const failing_sub_workflow_tool_1 = require("./tools/failing-sub-workflow.tool");
|
|
21
|
+
const runtime_error_tool_1 = require("./tools/runtime-error.tool");
|
|
22
|
+
const strict_schema_tool_1 = require("./tools/strict-schema.tool");
|
|
23
|
+
let AgentErrorHandlingWorkflow = class AgentErrorHandlingWorkflow extends common_2.BaseWorkflow {
|
|
24
|
+
llmGenerateText;
|
|
25
|
+
llmDelegateToolCalls;
|
|
26
|
+
llmUpdateToolResult;
|
|
27
|
+
strictSchema;
|
|
28
|
+
runtimeError;
|
|
29
|
+
failingSubWorkflow;
|
|
30
|
+
orchestrator;
|
|
31
|
+
constructor(llmGenerateText, llmDelegateToolCalls, llmUpdateToolResult, strictSchema, runtimeError, failingSubWorkflow, orchestrator) {
|
|
32
|
+
super();
|
|
33
|
+
this.llmGenerateText = llmGenerateText;
|
|
34
|
+
this.llmDelegateToolCalls = llmDelegateToolCalls;
|
|
35
|
+
this.llmUpdateToolResult = llmUpdateToolResult;
|
|
36
|
+
this.strictSchema = strictSchema;
|
|
37
|
+
this.runtimeError = runtimeError;
|
|
38
|
+
this.failingSubWorkflow = failingSubWorkflow;
|
|
39
|
+
this.orchestrator = orchestrator;
|
|
40
|
+
}
|
|
41
|
+
async setup(_state) {
|
|
42
|
+
await this.documentStore.save(common_2.MessageDocument, {
|
|
43
|
+
role: 'assistant',
|
|
44
|
+
text: '# Agent Error Handling Example\n\n' +
|
|
45
|
+
'This workflow tests how tool errors are handled and fed back to the LLM.\n\n' +
|
|
46
|
+
'The LLM will deliberately trigger errors, then self-correct.',
|
|
47
|
+
});
|
|
48
|
+
await this.documentStore.save(llm_provider_module_1.LlmMessageDocument, {
|
|
49
|
+
role: 'user',
|
|
50
|
+
text: 'Follow the instructions in your system prompt exactly. ' +
|
|
51
|
+
'Start with step 1: call strictSchema with no arguments.',
|
|
52
|
+
});
|
|
53
|
+
this.assignState({ turnCount: 0 });
|
|
54
|
+
}
|
|
55
|
+
async llmTurn(state) {
|
|
56
|
+
const result = await this.llmGenerateText.call({}, {
|
|
57
|
+
config: {
|
|
58
|
+
provider: 'claude',
|
|
59
|
+
model: 'claude-sonnet-4-6',
|
|
60
|
+
system: this.render((0, node_path_1.join)(__dirname, 'templates', 'system.md')),
|
|
61
|
+
tools: ['strict_schema', 'runtime_error', 'failing_sub_workflow'],
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
this.assignState({
|
|
65
|
+
turnCount: state.turnCount + 1,
|
|
66
|
+
llmResult: result.data,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
async executeToolCalls(state) {
|
|
70
|
+
const result = await this.llmDelegateToolCalls.call({
|
|
71
|
+
message: state.llmResult.message,
|
|
72
|
+
callback: { transition: 'toolResultReceived' },
|
|
73
|
+
});
|
|
74
|
+
this.assignState({ delegateResult: result.data });
|
|
75
|
+
}
|
|
76
|
+
async toolResultReceived(state, input) {
|
|
77
|
+
const result = await this.llmUpdateToolResult.call({
|
|
78
|
+
delegateResult: state.delegateResult,
|
|
79
|
+
completedTool: input,
|
|
80
|
+
});
|
|
81
|
+
this.assignState({ delegateResult: result.data });
|
|
82
|
+
}
|
|
83
|
+
toolsComplete(_state) { }
|
|
84
|
+
async cancelPendingTools(state, ctx) {
|
|
85
|
+
await this.orchestrator.cancelChildren(ctx.workflowId);
|
|
86
|
+
}
|
|
87
|
+
respond(_state) { }
|
|
88
|
+
hasToolCalls(state) {
|
|
89
|
+
return state.llmResult?.message.stopReason === 'tool_use';
|
|
90
|
+
}
|
|
91
|
+
allToolsComplete(state) {
|
|
92
|
+
return !!state.delegateResult?.allCompleted;
|
|
93
|
+
}
|
|
94
|
+
isEndTurn(state) {
|
|
95
|
+
return state.llmResult?.message.stopReason === 'end_turn';
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
exports.AgentErrorHandlingWorkflow = AgentErrorHandlingWorkflow;
|
|
99
|
+
__decorate([
|
|
100
|
+
(0, common_2.Transition)({ to: 'ready' }),
|
|
101
|
+
__metadata("design:type", Function),
|
|
102
|
+
__metadata("design:paramtypes", [Object]),
|
|
103
|
+
__metadata("design:returntype", Promise)
|
|
104
|
+
], AgentErrorHandlingWorkflow.prototype, "setup", null);
|
|
105
|
+
__decorate([
|
|
106
|
+
(0, common_2.Transition)({ from: 'ready', to: 'prompt_executed' }),
|
|
107
|
+
__metadata("design:type", Function),
|
|
108
|
+
__metadata("design:paramtypes", [Object]),
|
|
109
|
+
__metadata("design:returntype", Promise)
|
|
110
|
+
], AgentErrorHandlingWorkflow.prototype, "llmTurn", null);
|
|
111
|
+
__decorate([
|
|
112
|
+
(0, common_2.Transition)({ from: 'prompt_executed', to: 'awaiting_tools', priority: 10 }),
|
|
113
|
+
(0, common_2.Guard)('hasToolCalls'),
|
|
114
|
+
__metadata("design:type", Function),
|
|
115
|
+
__metadata("design:paramtypes", [Object]),
|
|
116
|
+
__metadata("design:returntype", Promise)
|
|
117
|
+
], AgentErrorHandlingWorkflow.prototype, "executeToolCalls", null);
|
|
118
|
+
__decorate([
|
|
119
|
+
(0, common_2.Transition)({ from: 'awaiting_tools', to: 'awaiting_tools', wait: true }),
|
|
120
|
+
__metadata("design:type", Function),
|
|
121
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
122
|
+
__metadata("design:returntype", Promise)
|
|
123
|
+
], AgentErrorHandlingWorkflow.prototype, "toolResultReceived", null);
|
|
124
|
+
__decorate([
|
|
125
|
+
(0, common_2.Transition)({ from: 'awaiting_tools', to: 'ready' }),
|
|
126
|
+
(0, common_2.Guard)('allToolsComplete'),
|
|
127
|
+
__metadata("design:type", Function),
|
|
128
|
+
__metadata("design:paramtypes", [Object]),
|
|
129
|
+
__metadata("design:returntype", void 0)
|
|
130
|
+
], AgentErrorHandlingWorkflow.prototype, "toolsComplete", null);
|
|
131
|
+
__decorate([
|
|
132
|
+
(0, common_2.Transition)({ from: 'awaiting_tools', to: 'ready', wait: true }),
|
|
133
|
+
__metadata("design:type", Function),
|
|
134
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
135
|
+
__metadata("design:returntype", Promise)
|
|
136
|
+
], AgentErrorHandlingWorkflow.prototype, "cancelPendingTools", null);
|
|
137
|
+
__decorate([
|
|
138
|
+
(0, common_2.Transition)({ from: 'prompt_executed', to: 'end' }),
|
|
139
|
+
(0, common_2.Guard)('isEndTurn'),
|
|
140
|
+
__metadata("design:type", Function),
|
|
141
|
+
__metadata("design:paramtypes", [Object]),
|
|
142
|
+
__metadata("design:returntype", void 0)
|
|
143
|
+
], AgentErrorHandlingWorkflow.prototype, "respond", null);
|
|
144
|
+
exports.AgentErrorHandlingWorkflow = AgentErrorHandlingWorkflow = __decorate([
|
|
145
|
+
(0, common_2.Workflow)({
|
|
146
|
+
title: 'Advanced Workflows - Agent Error Handling Example',
|
|
147
|
+
description: 'Exercises every tool-error path in an agent loop — schema validation failures, runtime exceptions, failed sub-workflows — and verifies the LLM receives identical is_error tool_results and can self-correct.',
|
|
148
|
+
widget: './agent-error-handling.ui.yaml',
|
|
149
|
+
}),
|
|
150
|
+
__param(6, (0, common_1.Inject)(common_2.WORKFLOW_ORCHESTRATOR)),
|
|
151
|
+
__metadata("design:paramtypes", [llm_provider_module_1.LlmGenerateTextTool,
|
|
152
|
+
llm_provider_module_1.LlmDelegateToolCallsTool,
|
|
153
|
+
llm_provider_module_1.LlmUpdateToolResultTool,
|
|
154
|
+
strict_schema_tool_1.StrictSchemaTool,
|
|
155
|
+
runtime_error_tool_1.RuntimeErrorTool,
|
|
156
|
+
failing_sub_workflow_tool_1.FailingSubWorkflowTool, Object])
|
|
157
|
+
], AgentErrorHandlingWorkflow);
|
|
158
|
+
//# sourceMappingURL=agent-error-handling.workflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-error-handling.workflow.js","sourceRoot":"","sources":["../../../src/workflows/agent-error-handling/agent-error-handling.workflow.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
You are a test assistant that follows instructions precisely. You are fully autonomous — do NOT ask the user for input or confirmation. Just proceed through each step on your own.
|
|
2
|
+
|
|
3
|
+
Complete these steps IN ORDER. Do exactly one step per turn:
|
|
4
|
+
|
|
5
|
+
1. Call the `strictSchema` tool with NO arguments (empty object {}). This will fail — that is expected.
|
|
6
|
+
2. After seeing the validation error, call `strictSchema` correctly with { "name": "World" }.
|
|
7
|
+
3. Call the `runtimeError` tool with { "shouldFail": true }. This will fail — that is expected.
|
|
8
|
+
4. After seeing the runtime error, call `runtimeError` with { "shouldFail": false }.
|
|
9
|
+
5. Call the `failingSubWorkflow` tool with {}. This launches a sub-workflow that will fail — that is expected.
|
|
10
|
+
6. After seeing the sub-workflow error, respond with a brief summary of what happened (do NOT call any tools).
|
|
11
|
+
|
|
12
|
+
IMPORTANT: Only perform ONE step per turn. Do NOT skip steps. Do NOT wait for user input between steps.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseTool, ToolCallOptions, ToolEnvelope } from '@loopstack/common';
|
|
2
|
+
import type { RunContext } from '@loopstack/common';
|
|
3
|
+
import { AgentErrorHandlingFailingSubWorkflow } from '../agent-error-handling-failing-sub.workflow';
|
|
4
|
+
export type FailingSubWorkflowToolResult = {
|
|
5
|
+
workflowId: string;
|
|
6
|
+
};
|
|
7
|
+
export declare class FailingSubWorkflowTool extends BaseTool<object, object, FailingSubWorkflowToolResult> {
|
|
8
|
+
private readonly failingWorkflow;
|
|
9
|
+
constructor(failingWorkflow: AgentErrorHandlingFailingSubWorkflow);
|
|
10
|
+
protected handle(_args: object, _ctx: RunContext, options?: ToolCallOptions): Promise<ToolEnvelope<FailingSubWorkflowToolResult>>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=failing-sub-workflow.tool.d.ts.map
|