@loopstack/meeting-notes-example-workflow 0.20.7 → 0.21.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.
@@ -1,43 +1,61 @@
1
1
  import { z } from 'zod';
2
2
  import { ClaudeGenerateDocument } from '@loopstack/claude-module';
3
- import { InjectDocument, InjectTool, Input, Runtime, State, Workflow } from '@loopstack/common';
4
- import { CreateDocument } from '@loopstack/core';
3
+ import { BaseWorkflow, Final, Initial, InjectTool, Transition, Workflow } from '@loopstack/common';
5
4
  import { MeetingNotesDocument, MeetingNotesDocumentSchema } from './documents/meeting-notes-document';
6
5
  import { OptimizedMeetingNotesDocumentSchema, OptimizedNotesDocument } from './documents/optimized-notes-document';
7
6
 
8
7
  @Workflow({
9
- configFile: __dirname + '/meeting-notes.workflow.yaml',
8
+ uiConfig: __dirname + '/meeting-notes.ui.yaml',
9
+ schema: z.object({
10
+ inputText: z
11
+ .string()
12
+ .default(
13
+ '- meeting 1.1.2025\n- budget: need 2 cut costs sarah said\n- hire new person?? --> marketing\n- vendor pricing - follow up needed by anna',
14
+ ),
15
+ }),
10
16
  })
11
- export class MeetingNotesWorkflow {
17
+ export class MeetingNotesWorkflow extends BaseWorkflow<{ inputText: string }> {
12
18
  @InjectTool() claudeGenerateDocument: ClaudeGenerateDocument;
13
- @InjectTool() createDocument: CreateDocument;
14
- @InjectDocument() meetingNotesDocument: MeetingNotesDocument;
15
- @InjectDocument() optimizedNotesDocument: OptimizedNotesDocument;
16
19
 
17
- @Input({
18
- schema: z.object({
19
- inputText: z
20
- .string()
21
- .default(
22
- '- meeting 1.1.2025\n- budget: need 2 cut costs sarah said\n- hire new person?? --> marketing\n- vendor pricing - follow up needed by anna',
23
- ),
24
- }),
25
- })
26
- args: {
27
- inputText: string;
28
- };
20
+ meetingNotes?: z.infer<typeof MeetingNotesDocumentSchema>;
21
+ optimizedNotes?: z.infer<typeof OptimizedMeetingNotesDocumentSchema>;
29
22
 
30
- @State({
31
- schema: z.object({
32
- meetingNotes: MeetingNotesDocumentSchema.optional(),
33
- optimizedNotes: OptimizedMeetingNotesDocumentSchema.optional(),
34
- }),
35
- })
36
- state: {
37
- meetingNotes?: z.infer<typeof MeetingNotesDocumentSchema>;
38
- optimizedNotes?: z.infer<typeof OptimizedMeetingNotesDocumentSchema>;
39
- };
23
+ @Initial({ to: 'waiting_for_response' })
24
+ async createForm(args: { inputText: string }) {
25
+ await this.repository.save(
26
+ MeetingNotesDocument,
27
+ {
28
+ text: `Unstructured Notes:\n\n${args.inputText}`,
29
+ },
30
+ { id: 'input' },
31
+ );
32
+ }
40
33
 
41
- @Runtime()
42
- runtime: any;
34
+ @Transition({ from: 'waiting_for_response', to: 'response_received', wait: true, schema: MeetingNotesDocumentSchema })
35
+ async userResponse(payload: z.infer<typeof MeetingNotesDocumentSchema>) {
36
+ const result = await this.repository.save(MeetingNotesDocument, payload, { id: 'input' });
37
+ this.meetingNotes = result.content as z.infer<typeof MeetingNotesDocumentSchema>;
38
+ }
39
+
40
+ @Transition({ from: 'response_received', to: 'notes_optimized' })
41
+ async optimizeNotes() {
42
+ await this.claudeGenerateDocument.call({
43
+ claude: { model: 'claude-sonnet-4-6' },
44
+ response: {
45
+ id: 'final',
46
+ document: OptimizedNotesDocument,
47
+ },
48
+ prompt: `Extract all information from the provided meeting notes into the structured document.
49
+
50
+ <Meeting Notes>
51
+ ${this.meetingNotes?.text}
52
+ </Meeting Notes>`,
53
+ });
54
+ }
55
+
56
+ @Final({ from: 'notes_optimized', wait: true, schema: OptimizedMeetingNotesDocumentSchema })
57
+ async confirm(payload: z.infer<typeof OptimizedMeetingNotesDocumentSchema>) {
58
+ const result = await this.repository.save(OptimizedNotesDocument, payload, { id: 'final' });
59
+ this.optimizedNotes = result.content as z.infer<typeof OptimizedMeetingNotesDocumentSchema>;
60
+ }
43
61
  }
@@ -1,76 +0,0 @@
1
- title: 'Human-in-the-loop Demo (Meeting Notes Optimizer)'
2
-
3
- description: 'A demo workflow to demonstrate how to use AI to structure meeting notes.'
4
-
5
- ui:
6
- form:
7
- properties:
8
- inputText:
9
- title: 'Text'
10
- widget: 'textarea'
11
-
12
- transitions:
13
- - id: create_form
14
- from: start
15
- to: waiting_for_response
16
- call:
17
- - id: form
18
- tool: createDocument
19
- args:
20
- id: input
21
- document: meetingNotesDocument
22
- update:
23
- content:
24
- text: |
25
- Unstructured Notes:
26
-
27
- {{ args.inputText }}
28
-
29
- - id: user_response
30
- from: waiting_for_response
31
- to: response_received
32
- trigger: manual
33
- call:
34
- - id: create_response
35
- tool: createDocument
36
- args:
37
- id: input
38
- document: meetingNotesDocument
39
- update:
40
- content: ${{ runtime.transition.payload }}
41
- assign:
42
- meetingNotes: ${{ result.data.content }}
43
-
44
- - id: optimize_notes
45
- from: response_received
46
- to: notes_optimized
47
- call:
48
- - id: prompt
49
- tool: claudeGenerateDocument
50
- args:
51
- claude:
52
- model: claude-sonnet-4-6
53
- response:
54
- id: final
55
- document: optimizedNotesDocument
56
- prompt: |
57
- Extract all information from the provided meeting notes into the structured document.
58
-
59
- <Meeting Notes>
60
- {{ state.meetingNotes.text }}
61
- </Meeting Notes>
62
-
63
- - id: confirm
64
- from: notes_optimized
65
- to: end
66
- trigger: manual
67
- call:
68
- - id: create_response
69
- tool: createDocument
70
- args:
71
- id: final
72
- document: optimizedNotesDocument
73
- update:
74
- content: ${{ runtime.transition.payload }}
75
- assign:
76
- optimizedNotes: ${{ result.data.content }}
@@ -1,76 +0,0 @@
1
- title: 'Human-in-the-loop Demo (Meeting Notes Optimizer)'
2
-
3
- description: 'A demo workflow to demonstrate how to use AI to structure meeting notes.'
4
-
5
- ui:
6
- form:
7
- properties:
8
- inputText:
9
- title: 'Text'
10
- widget: 'textarea'
11
-
12
- transitions:
13
- - id: create_form
14
- from: start
15
- to: waiting_for_response
16
- call:
17
- - id: form
18
- tool: createDocument
19
- args:
20
- id: input
21
- document: meetingNotesDocument
22
- update:
23
- content:
24
- text: |
25
- Unstructured Notes:
26
-
27
- {{ args.inputText }}
28
-
29
- - id: user_response
30
- from: waiting_for_response
31
- to: response_received
32
- trigger: manual
33
- call:
34
- - id: create_response
35
- tool: createDocument
36
- args:
37
- id: input
38
- document: meetingNotesDocument
39
- update:
40
- content: ${{ runtime.transition.payload }}
41
- assign:
42
- meetingNotes: ${{ result.data.content }}
43
-
44
- - id: optimize_notes
45
- from: response_received
46
- to: notes_optimized
47
- call:
48
- - id: prompt
49
- tool: claudeGenerateDocument
50
- args:
51
- claude:
52
- model: claude-sonnet-4-6
53
- response:
54
- id: final
55
- document: optimizedNotesDocument
56
- prompt: |
57
- Extract all information from the provided meeting notes into the structured document.
58
-
59
- <Meeting Notes>
60
- {{ state.meetingNotes.text }}
61
- </Meeting Notes>
62
-
63
- - id: confirm
64
- from: notes_optimized
65
- to: end
66
- trigger: manual
67
- call:
68
- - id: create_response
69
- tool: createDocument
70
- args:
71
- id: final
72
- document: optimizedNotesDocument
73
- update:
74
- content: ${{ runtime.transition.payload }}
75
- assign:
76
- optimizedNotes: ${{ result.data.content }}