@agentic-surfaces/cli 0.1.25 → 0.1.27
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 +15 -8
- package/dist/services.d.ts +2 -0
- package/dist/services.js +2 -0
- package/package.json +4 -4
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, parseAgentFile } from "@agentic-surfaces/core";
|
|
4
|
+
import { loadWorkflow, runWorkflowOnce, Scheduler, loadProjectConfig, buildWorkflowRunner, defaultRegistry, parseAgentFile, FilePauseState } 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";
|
|
@@ -105,6 +105,7 @@ function launchUi(opts) {
|
|
|
105
105
|
agents: [...opts.agents.values()],
|
|
106
106
|
onRun: opts.onRun,
|
|
107
107
|
cache: opts.cache,
|
|
108
|
+
pause: opts.pause,
|
|
108
109
|
config: { dryRun: opts.dryRun, agent: opts.agentDefaults, version: VERSION },
|
|
109
110
|
});
|
|
110
111
|
const url = `http://127.0.0.1:${p}`;
|
|
@@ -161,11 +162,13 @@ export async function run(argv) {
|
|
|
161
162
|
const agents = loadAgents(dir);
|
|
162
163
|
const registry = defaultRegistry();
|
|
163
164
|
const observer = new StreamingObserver();
|
|
164
|
-
const services = buildServices({ projectConfig: pc });
|
|
165
|
+
const services = buildServices({ projectConfig: pc, projectDir: dir });
|
|
165
166
|
const runWorkflowFn = buildWorkflowRunner({ workflows: allWorkflows, registry, services: { ...services, agents }, observer });
|
|
166
167
|
const servicesWithRunner = { ...services, agents, runWorkflow: runWorkflowFn };
|
|
168
|
+
// Platform-wide play/pause (file-backed so it survives a --watch restart).
|
|
169
|
+
const pause = new FilePauseState();
|
|
167
170
|
// Cron-triggered workflows fire on schedule too.
|
|
168
|
-
const sched = new Scheduler(servicesWithRunner, registry, observer);
|
|
171
|
+
const sched = new Scheduler(servicesWithRunner, registry, observer, pause);
|
|
169
172
|
for (const [, w] of allWorkflows)
|
|
170
173
|
sched.add(w);
|
|
171
174
|
sched.start();
|
|
@@ -173,6 +176,7 @@ export async function run(argv) {
|
|
|
173
176
|
observer, workflows: allWorkflows, agents,
|
|
174
177
|
onRun: (name, payload) => runWorkflowFn(name, payload),
|
|
175
178
|
cache: services.cache,
|
|
179
|
+
pause,
|
|
176
180
|
dryRun: pc?.dryRun,
|
|
177
181
|
agentDefaults: { model: pc?.agent?.model, effort: pc?.agent?.effort },
|
|
178
182
|
});
|
|
@@ -195,7 +199,8 @@ export async function run(argv) {
|
|
|
195
199
|
const fake = rest.includes("--fake");
|
|
196
200
|
const pc = findProjectConfig(dirname(file));
|
|
197
201
|
const wf = loadWorkflow(readFileSync(file, "utf8"));
|
|
198
|
-
const
|
|
202
|
+
const projectDir = findProjectDir(dirname(file)) ?? dirname(file);
|
|
203
|
+
const services = buildServices(fake ? { fakeAgent: [{ text: "fake reply" }], projectConfig: pc, projectDir } : { projectConfig: pc, projectDir });
|
|
199
204
|
const dir = dirname(file);
|
|
200
205
|
const allWorkflows = new Map();
|
|
201
206
|
for (const f of readdirSync(dir).filter(f => f.endsWith(".yaml") && f !== "agentic-surfaces.config.yaml")) {
|
|
@@ -205,7 +210,7 @@ export async function run(argv) {
|
|
|
205
210
|
}
|
|
206
211
|
catch { /* skip unparseable */ }
|
|
207
212
|
}
|
|
208
|
-
const agents = loadAgents(
|
|
213
|
+
const agents = loadAgents(projectDir);
|
|
209
214
|
const registry = defaultRegistry();
|
|
210
215
|
const ui = rest.includes("--ui");
|
|
211
216
|
const observer = ui ? new StreamingObserver() : undefined;
|
|
@@ -240,7 +245,7 @@ export async function run(argv) {
|
|
|
240
245
|
const dir = rest.find(a => !a.startsWith("--")) ?? ".";
|
|
241
246
|
const pc = loadProjectConfig(dir);
|
|
242
247
|
const workflowsDir = pc?.workflows ? join(dir, pc.workflows) : dir;
|
|
243
|
-
const services = buildServices({ projectConfig: pc });
|
|
248
|
+
const services = buildServices({ projectConfig: pc, projectDir: dir });
|
|
244
249
|
const allWorkflows = new Map();
|
|
245
250
|
const yamlFiles = readdirSync(workflowsDir).filter(f => f.endsWith(".yaml") && f !== "agentic-surfaces.config.yaml");
|
|
246
251
|
for (const f of yamlFiles) {
|
|
@@ -256,16 +261,18 @@ export async function run(argv) {
|
|
|
256
261
|
const observer = ui ? new StreamingObserver() : undefined;
|
|
257
262
|
const runWorkflowFn = buildWorkflowRunner({ workflows: allWorkflows, registry, services: { ...services, agents }, observer });
|
|
258
263
|
const servicesWithRunner = { ...services, agents, runWorkflow: runWorkflowFn };
|
|
259
|
-
const
|
|
264
|
+
const pause = new FilePauseState();
|
|
265
|
+
const sched = new Scheduler(servicesWithRunner, registry, observer, pause);
|
|
260
266
|
for (const [, w] of allWorkflows)
|
|
261
267
|
sched.add(w);
|
|
262
268
|
sched.start();
|
|
263
|
-
console.log(
|
|
269
|
+
console.log(`scheduler started; watching ${workflowsDir}${pause.isPaused() ? " (PAUSED)" : ""}`);
|
|
264
270
|
if (ui) {
|
|
265
271
|
const url = launchUi({
|
|
266
272
|
observer: observer, workflows: allWorkflows, agents,
|
|
267
273
|
onRun: (name, payload) => runWorkflowFn(name, payload),
|
|
268
274
|
cache: services.cache,
|
|
275
|
+
pause,
|
|
269
276
|
dryRun: pc?.dryRun,
|
|
270
277
|
agentDefaults: { model: pc?.agent?.model, effort: pc?.agent?.effort },
|
|
271
278
|
});
|
package/dist/services.d.ts
CHANGED
|
@@ -4,4 +4,6 @@ import type { Services } from "@agentic-surfaces/core";
|
|
|
4
4
|
export declare function buildServices(opts?: {
|
|
5
5
|
fakeAgent?: AgentResult[];
|
|
6
6
|
projectConfig?: ProjectConfig;
|
|
7
|
+
/** Project dir (where the config lives) — a `full` agent's cwd + plugin-path base. */
|
|
8
|
+
projectDir?: string;
|
|
7
9
|
}): Services;
|
package/dist/services.js
CHANGED
|
@@ -9,11 +9,13 @@ export function buildServices(opts = {}) {
|
|
|
9
9
|
logger: { info: (m, meta) => console.log(m, meta ?? ""), error: (m, meta) => console.error(m, meta ?? "") },
|
|
10
10
|
fetch: globalThis.fetch,
|
|
11
11
|
dryRun: pc?.dryRun ?? false,
|
|
12
|
+
projectDir: opts.projectDir,
|
|
12
13
|
agentDefaults: pc ? {
|
|
13
14
|
model: pc.agent?.model,
|
|
14
15
|
effort: pc.agent?.effort,
|
|
15
16
|
runner: pc.agent?.runner,
|
|
16
17
|
mcpServers: pc.agent?.mcpServers,
|
|
18
|
+
capabilities: pc.agent?.capabilities,
|
|
17
19
|
} : undefined,
|
|
18
20
|
};
|
|
19
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentic-surfaces/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.27",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"README.md"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@agentic-surfaces/
|
|
26
|
-
"@agentic-surfaces/
|
|
27
|
-
"@agentic-surfaces/server": "0.1.
|
|
25
|
+
"@agentic-surfaces/core": "0.1.27",
|
|
26
|
+
"@agentic-surfaces/agent": "0.1.27",
|
|
27
|
+
"@agentic-surfaces/server": "0.1.27"
|
|
28
28
|
},
|
|
29
29
|
"repository": {
|
|
30
30
|
"type": "git",
|