@agentic-surfaces/cli 0.1.0 → 0.1.2

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.
Files changed (2) hide show
  1. package/dist/index.js +29 -5
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { readFileSync, readdirSync } from "node:fs";
2
2
  import { join, dirname } from "node:path";
3
- import { loadWorkflow, runWorkflowOnce, Scheduler, loadProjectConfig } from "@agentic-surfaces/core";
3
+ import { loadWorkflow, runWorkflowOnce, Scheduler, loadProjectConfig, buildWorkflowRunner, defaultRegistry } from "@agentic-surfaces/core";
4
4
  import { buildServices } from "./services.js";
5
5
  export async function run(argv) {
6
6
  const [cmd, ...rest] = argv;
@@ -20,7 +20,19 @@ export async function run(argv) {
20
20
  const pc = loadProjectConfig(dirname(file));
21
21
  const wf = loadWorkflow(readFileSync(file, "utf8"));
22
22
  const services = buildServices(fake ? { fakeAgent: [{ text: "fake reply" }], projectConfig: pc } : { projectConfig: pc });
23
- const outputs = await runWorkflowOnce(wf, { services });
23
+ const dir = dirname(file);
24
+ const allWorkflows = new Map();
25
+ for (const f of readdirSync(dir).filter(f => f.endsWith(".yaml") && f !== "agentic-surfaces.config.yaml")) {
26
+ try {
27
+ const w = loadWorkflow(readFileSync(join(dir, f), "utf8"));
28
+ allWorkflows.set(w.name, w);
29
+ }
30
+ catch { /* skip unparseable */ }
31
+ }
32
+ const registry = defaultRegistry();
33
+ const runWorkflowFn = buildWorkflowRunner({ workflows: allWorkflows, registry, services });
34
+ const servicesWithRunner = { ...services, runWorkflow: runWorkflowFn };
35
+ const outputs = await runWorkflowOnce(wf, { registry, services: servicesWithRunner });
24
36
  console.log("ran", wf.name, "->", [...outputs.keys()].join(", "));
25
37
  return 0;
26
38
  }
@@ -29,9 +41,21 @@ export async function run(argv) {
29
41
  const pc = loadProjectConfig(dir);
30
42
  const workflowsDir = pc?.workflows ? join(dir, pc.workflows) : dir;
31
43
  const services = buildServices({ projectConfig: pc });
32
- const sched = new Scheduler(services);
33
- for (const f of readdirSync(workflowsDir).filter(f => f.endsWith(".yaml") && f !== "agentic-surfaces.config.yaml"))
34
- sched.add(loadWorkflow(readFileSync(join(workflowsDir, f), "utf8")));
44
+ const allWorkflows = new Map();
45
+ const yamlFiles = readdirSync(workflowsDir).filter(f => f.endsWith(".yaml") && f !== "agentic-surfaces.config.yaml");
46
+ for (const f of yamlFiles) {
47
+ try {
48
+ const w = loadWorkflow(readFileSync(join(workflowsDir, f), "utf8"));
49
+ allWorkflows.set(w.name, w);
50
+ }
51
+ catch { /* skip unparseable */ }
52
+ }
53
+ const registry = defaultRegistry();
54
+ const runWorkflowFn = buildWorkflowRunner({ workflows: allWorkflows, registry, services });
55
+ const servicesWithRunner = { ...services, runWorkflow: runWorkflowFn };
56
+ const sched = new Scheduler(servicesWithRunner, registry);
57
+ for (const [, w] of allWorkflows)
58
+ sched.add(w);
35
59
  sched.start();
36
60
  console.log("scheduler started; watching", workflowsDir);
37
61
  return 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentic-surfaces/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -21,8 +21,8 @@
21
21
  "dist"
22
22
  ],
23
23
  "dependencies": {
24
- "@agentic-surfaces/core": "0.1.0",
25
- "@agentic-surfaces/agent": "0.1.0"
24
+ "@agentic-surfaces/core": "0.1.2",
25
+ "@agentic-surfaces/agent": "0.1.2"
26
26
  },
27
27
  "scripts": {
28
28
  "build": "tsc -b",