agent-state-machine 2.0.14 → 2.0.15
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/package.json +2 -1
- package/templates/project-builder/README.md +119 -0
- package/templates/project-builder/agents/assumptions-clarifier.md +66 -0
- package/templates/project-builder/agents/code-reviewer.md +82 -0
- package/templates/project-builder/agents/code-writer.md +75 -0
- package/templates/project-builder/agents/requirements-clarifier.md +56 -0
- package/templates/project-builder/agents/roadmap-generator.md +74 -0
- package/templates/project-builder/agents/scope-clarifier.md +45 -0
- package/templates/project-builder/agents/security-clarifier.md +72 -0
- package/templates/project-builder/agents/security-reviewer.md +72 -0
- package/templates/project-builder/agents/task-planner.md +63 -0
- package/templates/project-builder/agents/test-planner.md +77 -0
- package/templates/project-builder/config.js +13 -0
- package/templates/project-builder/scripts/mac-notification.js +24 -0
- package/templates/project-builder/scripts/text-human.js +92 -0
- package/templates/project-builder/scripts/workflow-helpers.js +167 -0
- package/templates/project-builder/state/current.json +9 -0
- package/templates/project-builder/state/history.jsonl +0 -0
- package/templates/project-builder/steering/config.json +5 -0
- package/templates/project-builder/steering/global.md +19 -0
- package/templates/project-builder/workflow.js +394 -0
- package/templates/starter/README.md +118 -0
- package/templates/starter/agents/example.js +36 -0
- package/templates/starter/agents/yoda-greeter.md +12 -0
- package/templates/starter/agents/yoda-name-collector.md +12 -0
- package/templates/starter/config.js +12 -0
- package/templates/starter/interactions/.gitkeep +0 -0
- package/templates/starter/scripts/mac-notification.js +24 -0
- package/templates/starter/state/current.json +9 -0
- package/templates/starter/state/history.jsonl +0 -0
- package/templates/starter/steering/config.json +5 -0
- package/templates/starter/steering/global.md +19 -0
- package/templates/starter/workflow.js +52 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
/**
|
|
3
|
+
* __WORKFLOW_NAME__ Workflow
|
|
4
|
+
*
|
|
5
|
+
* Native JavaScript workflow - write normal async/await code!
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - memory object auto-persists to disk (use memory guards for idempotency)
|
|
9
|
+
* - Use standard JS control flow (if, for, etc.)
|
|
10
|
+
* - Interactive prompts pause and wait for user input
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { agent, memory, askHuman, parallel } from 'agent-state-machine';
|
|
14
|
+
import { notify } from './scripts/mac-notification.js';
|
|
15
|
+
|
|
16
|
+
export default async function() {
|
|
17
|
+
console.log('Starting __WORKFLOW_NAME__ workflow...');
|
|
18
|
+
|
|
19
|
+
// Example: Get user input (saved to memory)
|
|
20
|
+
const userLocation = await askHuman('Where do you live?');
|
|
21
|
+
console.log('Example prompt answer:', userLocation);
|
|
22
|
+
|
|
23
|
+
const userName = await agent('yoda-name-collector');
|
|
24
|
+
memory.userName = userName;
|
|
25
|
+
|
|
26
|
+
// Provide context
|
|
27
|
+
// const userName = await agent('yoda-name-collector', { name: 'Luke' });
|
|
28
|
+
|
|
29
|
+
console.log('Example agent memory.userName:', memory.userName || userName);
|
|
30
|
+
|
|
31
|
+
// Context is explicit: pass what the agent needs
|
|
32
|
+
const { greeting } = await agent('yoda-greeter', { userLocation, memory });
|
|
33
|
+
console.log('Example agent greeting::', greeting);
|
|
34
|
+
|
|
35
|
+
// Or you can provide context manually
|
|
36
|
+
// await agent('yoda-greeter', userName);
|
|
37
|
+
|
|
38
|
+
// Example: Parallel execution
|
|
39
|
+
// const [a, b, c] = await parallel([
|
|
40
|
+
// agent('yoda-greeter', { name: 'the names augustus but friends call me gus' }),
|
|
41
|
+
// agent('yoda-greeter', { name: 'uriah' }),
|
|
42
|
+
// agent('yoda-greeter', { name: 'lucas' })
|
|
43
|
+
// ]);
|
|
44
|
+
|
|
45
|
+
// console.log('a: ' + JSON.stringify(a))
|
|
46
|
+
// console.log('b: ' + JSON.stringify(b))
|
|
47
|
+
// console.log('c: ' + JSON.stringify(c))
|
|
48
|
+
|
|
49
|
+
notify(['__WORKFLOW_NAME__', userName.name || userName + ' has been greeted!']);
|
|
50
|
+
|
|
51
|
+
console.log('Workflow completed!');
|
|
52
|
+
}
|