@agentic-surfaces/cli 0.1.7 → 0.1.9

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/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { readFileSync, readdirSync, existsSync } from "node:fs";
2
2
  import { join, dirname, resolve } from "node:path";
3
3
  import { spawn } from "node:child_process";
4
- import { loadWorkflow, runWorkflowOnce, Scheduler, loadProjectConfig, buildWorkflowRunner, defaultRegistry } from "@agentic-surfaces/core";
4
+ import { loadWorkflow, runWorkflowOnce, Scheduler, loadProjectConfig, buildWorkflowRunner, defaultRegistry, parseAgentFile } from "@agentic-surfaces/core";
5
5
  import { serve, StreamingObserver } from "@agentic-surfaces/server";
6
6
  import { buildServices } from "./services.js";
7
7
  const CONFIG = "agentic-surfaces.config.yaml";
@@ -33,6 +33,36 @@ function loadWorkflows(dir) {
33
33
  }
34
34
  return map;
35
35
  }
36
+ // Load agents/<name>.md from the project into a name→AgentDefinition map.
37
+ // A bad agent file is reported and skipped (consistent with workflow loading).
38
+ function loadAgents(projectDir) {
39
+ const map = new Map();
40
+ const agentsDir = join(projectDir, "agents");
41
+ if (!existsSync(agentsDir))
42
+ return map;
43
+ for (const f of readdirSync(agentsDir).filter((f) => f.endsWith(".md"))) {
44
+ try {
45
+ const def = parseAgentFile(readFileSync(join(agentsDir, f), "utf8"), f.replace(/\.md$/, ""));
46
+ map.set(def.name, def);
47
+ }
48
+ catch (err) {
49
+ console.error(`skipping agent ${f}:`, err instanceof Error ? err.message : String(err));
50
+ }
51
+ }
52
+ return map;
53
+ }
54
+ // Walk up to the directory that contains agentic-surfaces.config.yaml.
55
+ function findProjectDir(start) {
56
+ let dir = resolve(start);
57
+ for (;;) {
58
+ if (existsSync(join(dir, CONFIG)))
59
+ return dir;
60
+ const parent = dirname(dir);
61
+ if (parent === dir)
62
+ return undefined;
63
+ dir = parent;
64
+ }
65
+ }
36
66
  // `--ui`: start the live dashboard (HTTP server + SSE) and return its
37
67
  // StreamingObserver so run lifecycle events stream to the browser.
38
68
  function startUi() {
@@ -88,11 +118,12 @@ export async function run(argv) {
88
118
  const pc = loadProjectConfig(dir);
89
119
  const workflowsDir = pc?.workflows ? join(dir, pc.workflows) : dir;
90
120
  const allWorkflows = loadWorkflows(workflowsDir);
121
+ const agents = loadAgents(dir);
91
122
  const registry = defaultRegistry();
92
123
  const observer = new StreamingObserver();
93
124
  const services = buildServices({ projectConfig: pc });
94
- const runWorkflowFn = buildWorkflowRunner({ workflows: allWorkflows, registry, services, observer });
95
- const servicesWithRunner = { ...services, runWorkflow: runWorkflowFn };
125
+ const runWorkflowFn = buildWorkflowRunner({ workflows: allWorkflows, registry, services: { ...services, agents }, observer });
126
+ const servicesWithRunner = { ...services, agents, runWorkflow: runWorkflowFn };
96
127
  // Cron-triggered workflows fire on schedule too.
97
128
  const sched = new Scheduler(servicesWithRunner, registry, observer);
98
129
  for (const [, w] of allWorkflows)
@@ -104,6 +135,8 @@ export async function run(argv) {
104
135
  observer,
105
136
  workflows: [...allWorkflows.values()],
106
137
  onRun: (name) => runWorkflowFn(name, undefined),
138
+ config: { dryRun: pc?.dryRun, agent: { model: pc?.agent?.model, effort: pc?.agent?.effort } },
139
+ agents: [...agents.values()],
107
140
  });
108
141
  const url = `http://127.0.0.1:${actualPort}`;
109
142
  openBrowser(url);
@@ -136,11 +169,12 @@ export async function run(argv) {
136
169
  }
137
170
  catch { /* skip unparseable */ }
138
171
  }
172
+ const agents = loadAgents(findProjectDir(dirname(file)) ?? dir);
139
173
  const registry = defaultRegistry();
140
174
  const session = rest.includes("--ui") ? startUi() : undefined;
141
175
  const observer = session?.observer;
142
- const runWorkflowFn = buildWorkflowRunner({ workflows: allWorkflows, registry, services, observer });
143
- const servicesWithRunner = { ...services, runWorkflow: runWorkflowFn };
176
+ const runWorkflowFn = buildWorkflowRunner({ workflows: allWorkflows, registry, services: { ...services, agents }, observer });
177
+ const servicesWithRunner = { ...services, agents, runWorkflow: runWorkflowFn };
144
178
  // A run error must NOT tear down the --ui server: the failure is already
145
179
  // streamed to the dashboard (the failed node + run), so keep serving so it
146
180
  // stays inspectable. Without --ui, an error still exits non-zero.
@@ -173,11 +207,12 @@ export async function run(argv) {
173
207
  }
174
208
  catch { /* skip unparseable */ }
175
209
  }
210
+ const agents = loadAgents(dir);
176
211
  const registry = defaultRegistry();
177
212
  const session = rest.includes("--ui") ? startUi() : undefined;
178
213
  const observer = session?.observer;
179
- const runWorkflowFn = buildWorkflowRunner({ workflows: allWorkflows, registry, services, observer });
180
- const servicesWithRunner = { ...services, runWorkflow: runWorkflowFn };
214
+ const runWorkflowFn = buildWorkflowRunner({ workflows: allWorkflows, registry, services: { ...services, agents }, observer });
215
+ const servicesWithRunner = { ...services, agents, runWorkflow: runWorkflowFn };
181
216
  const sched = new Scheduler(servicesWithRunner, registry, observer);
182
217
  for (const [, w] of allWorkflows)
183
218
  sched.add(w);
package/dist/services.js CHANGED
@@ -11,6 +11,7 @@ export function buildServices(opts = {}) {
11
11
  dryRun: pc?.dryRun ?? false,
12
12
  agentDefaults: pc ? {
13
13
  model: pc.agent?.model,
14
+ effort: pc.agent?.effort,
14
15
  runner: pc.agent?.runner,
15
16
  mcpServers: pc.agent?.mcpServers,
16
17
  } : undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentic-surfaces/cli",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -21,9 +21,9 @@
21
21
  "dist"
22
22
  ],
23
23
  "dependencies": {
24
- "@agentic-surfaces/core": "0.1.7",
25
- "@agentic-surfaces/agent": "0.1.7",
26
- "@agentic-surfaces/server": "0.1.7"
24
+ "@agentic-surfaces/core": "0.1.9",
25
+ "@agentic-surfaces/agent": "0.1.9",
26
+ "@agentic-surfaces/server": "0.1.9"
27
27
  },
28
28
  "scripts": {
29
29
  "build": "tsc -b",