@loopstack/accessing-tool-results-example-workflow 0.18.1 → 0.19.0-rc.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/README.md CHANGED
@@ -49,7 +49,7 @@ Use npm install if you want to use and maintain the module as node dependency.
49
49
  > This step is automatically done for you when using the `loopstack add` command.
50
50
 
51
51
  - Add `AccessingToolResultsExampleModule` to the imports of `default.module.ts` or any other custom module.
52
- - Inject the `WorkflowToolResultsWorkflow` workflow to your workspace class using the `@Workflow()` decorator.
52
+ - Inject the `WorkflowToolResultsWorkflow` workflow to your workspace class using the `@InjectWorkflow()` decorator.
53
53
 
54
54
  See here for more information about working with [Modules](https://loopstack.ai/docs/building-with-loopstack/creating-a-module) and [Workspaces](https://loopstack.ai/docs/building-with-loopstack/creating-workspaces)
55
55
 
@@ -98,7 +98,7 @@ Tool results persist and can be accessed from subsequent transitions using the s
98
98
  Define custom helper functions in your workflow class for complex data extraction:
99
99
 
100
100
  ```typescript
101
- @Helper()
101
+ @DefineHelper()
102
102
  extractMessage(metadata: WorkflowMetadataInterface): string {
103
103
  return metadata.tools.create_some_data.say_hello.data;
104
104
  }
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './workflow-tool-results.workflow';
2
2
  export * from './tool-results-example.module';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export declare class ToolResultsExampleModule {
2
2
  }
3
+ //# sourceMappingURL=tool-results-example.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-results-example.module.d.ts","sourceRoot":"","sources":["../src/tool-results-example.module.ts"],"names":[],"mappings":"AAMA,qBAKa,wBAAwB;CAAG"}
@@ -8,7 +8,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.ToolResultsExampleModule = void 0;
10
10
  const common_1 = require("@nestjs/common");
11
- const core_1 = require("@loopstack/core");
12
11
  const core_ui_module_1 = require("@loopstack/core-ui-module");
13
12
  const create_chat_message_tool_1 = require("@loopstack/create-chat-message-tool");
14
13
  const create_value_tool_1 = require("@loopstack/create-value-tool");
@@ -18,7 +17,7 @@ let ToolResultsExampleModule = class ToolResultsExampleModule {
18
17
  exports.ToolResultsExampleModule = ToolResultsExampleModule;
19
18
  exports.ToolResultsExampleModule = ToolResultsExampleModule = __decorate([
20
19
  (0, common_1.Module)({
21
- imports: [core_1.LoopCoreModule, core_ui_module_1.CoreUiModule, create_value_tool_1.CreateValueToolModule, create_chat_message_tool_1.CreateChatMessageToolModule],
20
+ imports: [core_ui_module_1.CoreUiModule, create_value_tool_1.CreateValueToolModule, create_chat_message_tool_1.CreateChatMessageToolModule],
22
21
  providers: [workflow_tool_results_workflow_1.WorkflowToolResultsWorkflow],
23
22
  exports: [workflow_tool_results_workflow_1.WorkflowToolResultsWorkflow],
24
23
  })
@@ -1 +1 @@
1
- {"version":3,"file":"tool-results-example.module.js","sourceRoot":"","sources":["../src/tool-results-example.module.ts"],"names":[],"mappings":";;;;;;;;;AAeA,2CAAwC;AACxC,0CAAiD;AACjD,8DAAyD;AACzD,kFAAkF;AAClF,oEAAqE;AACrE,qFAA+E;AAOxE,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;CAAG,CAAA;AAA3B,4DAAwB;mCAAxB,wBAAwB;IALpC,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,qBAAc,EAAE,6BAAY,EAAE,yCAAqB,EAAE,sDAA2B,CAAC;QAC3F,SAAS,EAAE,CAAC,4DAA2B,CAAC;QACxC,OAAO,EAAE,CAAC,4DAA2B,CAAC;KACvC,CAAC;GACW,wBAAwB,CAAG"}
1
+ {"version":3,"file":"tool-results-example.module.js","sourceRoot":"","sources":["../src/tool-results-example.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,8DAAyD;AACzD,kFAAkF;AAClF,oEAAqE;AACrE,qFAA+E;AAOxE,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;CAAG,CAAA;AAA3B,4DAAwB;mCAAxB,wBAAwB;IALpC,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,6BAAY,EAAE,yCAAqB,EAAE,sDAA2B,CAAC;QAC3E,SAAS,EAAE,CAAC,4DAA2B,CAAC;QACxC,OAAO,EAAE,CAAC,4DAA2B,CAAC;KACvC,CAAC;GACW,wBAAwB,CAAG"}
@@ -1,7 +1,7 @@
1
- import { WorkflowBase } from '@loopstack/core';
2
- import { WorkflowMetadataInterface } from '@loopstack/core/dist/workflow-processor/interfaces/workflow-metadata.interface';
3
- export declare class WorkflowToolResultsWorkflow extends WorkflowBase {
1
+ import { WorkflowMetadataInterface } from '@loopstack/common';
2
+ export declare class WorkflowToolResultsWorkflow {
4
3
  private createValue;
5
4
  private createChatMessage;
6
5
  extractMessage(metadata: WorkflowMetadataInterface): string;
7
6
  }
7
+ //# sourceMappingURL=workflow-tool-results.workflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-tool-results.workflow.d.ts","sourceRoot":"","sources":["../src/workflow-tool-results.workflow.ts"],"names":[],"mappings":"AACA,OAAO,EAAsC,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAYlG,qBAIa,2BAA2B;IACxB,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,iBAAiB,CAAoB;IAG3D,cAAc,CAAC,QAAQ,EAAE,yBAAyB,GAAG,MAAM;CAI5D"}
@@ -12,10 +12,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.WorkflowToolResultsWorkflow = void 0;
13
13
  const common_1 = require("@nestjs/common");
14
14
  const common_2 = require("@loopstack/common");
15
- const core_1 = require("@loopstack/core");
16
15
  const create_chat_message_tool_1 = require("@loopstack/create-chat-message-tool");
17
16
  const create_value_tool_1 = require("@loopstack/create-value-tool");
18
- let WorkflowToolResultsWorkflow = class WorkflowToolResultsWorkflow extends core_1.WorkflowBase {
17
+ let WorkflowToolResultsWorkflow = class WorkflowToolResultsWorkflow {
19
18
  createValue;
20
19
  createChatMessage;
21
20
  extractMessage(metadata) {
@@ -25,22 +24,22 @@ let WorkflowToolResultsWorkflow = class WorkflowToolResultsWorkflow extends core
25
24
  };
26
25
  exports.WorkflowToolResultsWorkflow = WorkflowToolResultsWorkflow;
27
26
  __decorate([
28
- (0, common_2.Tool)(),
27
+ (0, common_2.InjectTool)(),
29
28
  __metadata("design:type", create_value_tool_1.CreateValue)
30
29
  ], WorkflowToolResultsWorkflow.prototype, "createValue", void 0);
31
30
  __decorate([
32
- (0, common_2.Tool)(),
31
+ (0, common_2.InjectTool)(),
33
32
  __metadata("design:type", create_chat_message_tool_1.CreateChatMessage)
34
33
  ], WorkflowToolResultsWorkflow.prototype, "createChatMessage", void 0);
35
34
  __decorate([
36
- (0, common_2.Helper)(),
35
+ (0, common_2.DefineHelper)(),
37
36
  __metadata("design:type", Function),
38
37
  __metadata("design:paramtypes", [Object]),
39
38
  __metadata("design:returntype", String)
40
39
  ], WorkflowToolResultsWorkflow.prototype, "extractMessage", null);
41
40
  exports.WorkflowToolResultsWorkflow = WorkflowToolResultsWorkflow = __decorate([
42
41
  (0, common_1.Injectable)(),
43
- (0, common_2.BlockConfig)({
42
+ (0, common_2.Workflow)({
44
43
  configFile: __dirname + '/workflow-tool-results.workflow.yaml',
45
44
  })
46
45
  ], WorkflowToolResultsWorkflow);
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-tool-results.workflow.js","sourceRoot":"","sources":["../src/workflow-tool-results.workflow.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,8CAA8D;AAC9D,0CAA+C;AAE/C,kFAAwE;AACxE,oEAA2D;AAcpD,IAAM,2BAA2B,GAAjC,MAAM,2BAA4B,SAAQ,mBAAY;IAC3C,WAAW,CAAc;IACzB,iBAAiB,CAAoB;IAGrD,cAAc,CAAC,QAAmC;QAChD,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAyC,CAAC;QACjE,OAAO,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC;IAC/C,CAAC;CACF,CAAA;AATY,kEAA2B;AACtB;IAAf,IAAA,aAAI,GAAE;8BAAsB,+BAAW;gEAAC;AACzB;IAAf,IAAA,aAAI,GAAE;8BAA4B,4CAAiB;sEAAC;AAGrD;IADC,IAAA,eAAM,GAAE;;;;iEAIR;sCARU,2BAA2B;IAJvC,IAAA,mBAAU,GAAE;IACZ,IAAA,oBAAW,EAAC;QACX,UAAU,EAAE,SAAS,GAAG,sCAAsC;KAC/D,CAAC;GACW,2BAA2B,CASvC"}
1
+ {"version":3,"file":"workflow-tool-results.workflow.js","sourceRoot":"","sources":["../src/workflow-tool-results.workflow.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,8CAAkG;AAClG,kFAAwE;AACxE,oEAA2D;AAcpD,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IAChB,WAAW,CAAc;IACzB,iBAAiB,CAAoB;IAG3D,cAAc,CAAC,QAAmC;QAChD,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAyC,CAAC;QACjE,OAAO,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC;IAC/C,CAAC;CACF,CAAA;AATY,kEAA2B;AAChB;IAArB,IAAA,mBAAU,GAAE;8BAAsB,+BAAW;gEAAC;AACzB;IAArB,IAAA,mBAAU,GAAE;8BAA4B,4CAAiB;sEAAC;AAG3D;IADC,IAAA,qBAAY,GAAE;;;;iEAId;sCARU,2BAA2B;IAJvC,IAAA,mBAAU,GAAE;IACZ,IAAA,iBAAQ,EAAC;QACR,UAAU,EAAE,SAAS,GAAG,sCAAsC;KAC/D,CAAC;GACW,2BAA2B,CASvC"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@loopstack/accessing-tool-results-example-workflow",
3
3
  "displayName": "Loopstack Tool Results Example",
4
4
  "description": "A simple workflow showing different methods of how to access tool results in a subsequent workflow step.",
5
- "version": "0.18.1",
5
+ "version": "0.19.0-rc.0",
6
6
  "author": {
7
7
  "name": "Jakob Klippel",
8
8
  "url": "https://www.linkedin.com/in/jakob-klippel/"
@@ -31,11 +31,10 @@
31
31
  "watch": "nest build --watch"
32
32
  },
33
33
  "dependencies": {
34
- "@loopstack/common": "^0.18.0",
35
- "@loopstack/core": "^0.18.0",
36
- "@loopstack/core-ui-module": "^0.18.1",
37
- "@loopstack/create-chat-message-tool": "^0.18.1",
38
- "@loopstack/create-value-tool": "^0.18.1",
34
+ "@loopstack/common": "^0.19.0-rc.0",
35
+ "@loopstack/core-ui-module": "^0.19.0-rc.0",
36
+ "@loopstack/create-chat-message-tool": "^0.19.0-rc.0",
37
+ "@loopstack/create-value-tool": "^0.19.0-rc.0",
39
38
  "@nestjs/common": "^11.1.12",
40
39
  "zod": "^4.3.5"
41
40
  },
@@ -1,5 +1,6 @@
1
1
  import { TestingModule } from '@nestjs/testing';
2
- import { BlockExecutionContextDto, LoopCoreModule, WorkflowProcessorService } from '@loopstack/core';
2
+ import { BlockExecutionContextDto, getBlockHelpers } from '@loopstack/common';
3
+ import { WorkflowProcessorService } from '@loopstack/core';
3
4
  import { CoreUiModule } from '@loopstack/core-ui-module';
4
5
  import { CreateChatMessage, CreateChatMessageToolModule } from '@loopstack/create-chat-message-tool';
5
6
  import { CreateValue, CreateValueToolModule } from '@loopstack/create-value-tool';
@@ -17,7 +18,7 @@ describe('WorkflowToolResultsWorkflow', () => {
17
18
  beforeEach(async () => {
18
19
  module = await createWorkflowTest()
19
20
  .forWorkflow(WorkflowToolResultsWorkflow)
20
- .withImports(LoopCoreModule, CoreUiModule, CreateValueToolModule, CreateChatMessageToolModule)
21
+ .withImports(CoreUiModule, CreateValueToolModule, CreateChatMessageToolModule)
21
22
  .withToolOverride(CreateValue)
22
23
  .withToolOverride(CreateChatMessage)
23
24
  .compile();
@@ -38,7 +39,7 @@ describe('WorkflowToolResultsWorkflow', () => {
38
39
  });
39
40
 
40
41
  it('should have extractMessage helper', () => {
41
- expect(workflow.helpers).toContain('extractMessage');
42
+ expect(getBlockHelpers(workflow)).toContain('extractMessage');
42
43
  });
43
44
 
44
45
  describe('tool result access', () => {
@@ -84,7 +85,7 @@ describe('WorkflowToolResultsWorkflow', () => {
84
85
  const result = await processor.process(workflow, {}, context);
85
86
 
86
87
  // Should complete both transitions
87
- const history = result.state.caretaker.getHistory();
88
+ const history = result.state.getHistory();
88
89
  expect(history.some((h) => h.metadata.transition?.transition === 'create_some_data')).toBe(true);
89
90
  expect(history.some((h) => h.metadata.transition?.transition === 'access_data')).toBe(true);
90
91
 
@@ -1,27 +1,11 @@
1
- /*
2
- Copyright 2025 Jakob Klippel.
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
1
  import { Module } from '@nestjs/common';
17
- import { LoopCoreModule } from '@loopstack/core';
18
2
  import { CoreUiModule } from '@loopstack/core-ui-module';
19
3
  import { CreateChatMessageToolModule } from '@loopstack/create-chat-message-tool';
20
4
  import { CreateValueToolModule } from '@loopstack/create-value-tool';
21
5
  import { WorkflowToolResultsWorkflow } from './workflow-tool-results.workflow';
22
6
 
23
7
  @Module({
24
- imports: [LoopCoreModule, CoreUiModule, CreateValueToolModule, CreateChatMessageToolModule],
8
+ imports: [CoreUiModule, CreateValueToolModule, CreateChatMessageToolModule],
25
9
  providers: [WorkflowToolResultsWorkflow],
26
10
  exports: [WorkflowToolResultsWorkflow],
27
11
  })
@@ -1,7 +1,5 @@
1
1
  import { Injectable } from '@nestjs/common';
2
- import { BlockConfig, Helper, Tool } from '@loopstack/common';
3
- import { WorkflowBase } from '@loopstack/core';
4
- import { WorkflowMetadataInterface } from '@loopstack/core/dist/workflow-processor/interfaces/workflow-metadata.interface';
2
+ import { DefineHelper, InjectTool, Workflow, WorkflowMetadataInterface } from '@loopstack/common';
5
3
  import { CreateChatMessage } from '@loopstack/create-chat-message-tool';
6
4
  import { CreateValue } from '@loopstack/create-value-tool';
7
5
 
@@ -14,14 +12,14 @@ interface WorkflowToolsMetadata {
14
12
  }
15
13
 
16
14
  @Injectable()
17
- @BlockConfig({
15
+ @Workflow({
18
16
  configFile: __dirname + '/workflow-tool-results.workflow.yaml',
19
17
  })
20
- export class WorkflowToolResultsWorkflow extends WorkflowBase {
21
- @Tool() private createValue: CreateValue;
22
- @Tool() private createChatMessage: CreateChatMessage;
18
+ export class WorkflowToolResultsWorkflow {
19
+ @InjectTool() private createValue: CreateValue;
20
+ @InjectTool() private createChatMessage: CreateChatMessage;
23
21
 
24
- @Helper()
22
+ @DefineHelper()
25
23
  extractMessage(metadata: WorkflowMetadataInterface): string {
26
24
  const tools = metadata.tools as unknown as WorkflowToolsMetadata;
27
25
  return tools.create_some_data.say_hello.data;