@vendian/cli 0.0.44 → 0.0.45
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/README.md +0 -2
- package/cli-wrapper.mjs +23 -225
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,6 @@ vendian
|
|
|
8
8
|
vendian login
|
|
9
9
|
vendian init --output-dir ./agents
|
|
10
10
|
vendian create "My Agent" --output-dir ./agents
|
|
11
|
-
vendian cloud local run --collection-id YOUR_COLLECTION --path ./agents/my-agent --input-json '{}'
|
|
12
11
|
vendian cloud local serve --agents-dir ./agents
|
|
13
12
|
```
|
|
14
13
|
|
|
@@ -24,7 +23,6 @@ vendian create "My Agent" --output-dir ./agents
|
|
|
24
23
|
vendian validate ./agents/my-agent --runtime
|
|
25
24
|
vendian test ./agents/my-agent --dry-run --mock-credentials
|
|
26
25
|
vendian models
|
|
27
|
-
vendian cloud local run --collection-id YOUR_COLLECTION --path ./agents/my-agent --input-json '{}'
|
|
28
26
|
vendian cloud local serve --agents-dir ./agents
|
|
29
27
|
```
|
|
30
28
|
|
package/cli-wrapper.mjs
CHANGED
|
@@ -1522,13 +1522,11 @@ init_process();
|
|
|
1522
1522
|
init_paths();
|
|
1523
1523
|
|
|
1524
1524
|
// src/serve-events.js
|
|
1525
|
-
var LEGACY_COLLECTION_RESOLVED_EVENT = ["work", "space_resolved"].join("");
|
|
1526
1525
|
function initialServeState() {
|
|
1527
1526
|
return {
|
|
1528
1527
|
connected: false,
|
|
1529
1528
|
daemonId: "",
|
|
1530
1529
|
cliSessionId: "",
|
|
1531
|
-
collectionId: "",
|
|
1532
1530
|
agents: [],
|
|
1533
1531
|
activity: "Starting local daemon",
|
|
1534
1532
|
currentJob: null,
|
|
@@ -1576,9 +1574,6 @@ function applyServeEvent(state, event) {
|
|
|
1576
1574
|
...state,
|
|
1577
1575
|
logs: appendLog(state.logs, event)
|
|
1578
1576
|
};
|
|
1579
|
-
if (event.type === "collection_resolved" || event.type === LEGACY_COLLECTION_RESOLVED_EVENT) {
|
|
1580
|
-
return { ...next, collectionId: stringValue(event.collectionId), activity: "Collection resolved" };
|
|
1581
|
-
}
|
|
1582
1577
|
if (event.type === "daemon_registered") {
|
|
1583
1578
|
return {
|
|
1584
1579
|
...next,
|
|
@@ -2089,9 +2084,6 @@ function serveDebugEntry(event) {
|
|
|
2089
2084
|
const timestamp = event.timestamp || event.occurredAt || (/* @__PURE__ */ new Date()).toISOString();
|
|
2090
2085
|
const base = { timestamp, eventType: type, level: debugLevel(event) };
|
|
2091
2086
|
switch (type) {
|
|
2092
|
-
case "collection_resolved":
|
|
2093
|
-
case LEGACY_COLLECTION_RESOLVED_EVENT:
|
|
2094
|
-
return { ...base, message: `collection resolved id=${stringValue(event.collectionId || "unknown")}` };
|
|
2095
2087
|
case "daemon_registered":
|
|
2096
2088
|
return { ...base, message: `daemon registered daemon=${shortId(event.daemonId)} cli=${shortId(event.cliSessionId)}` };
|
|
2097
2089
|
case "daemon_event_stream_connected":
|
|
@@ -2329,11 +2321,10 @@ var MAX_EVENTS = 5e3;
|
|
|
2329
2321
|
var MAX_RUNS = 50;
|
|
2330
2322
|
function createServeLogStore({
|
|
2331
2323
|
agentsDir: agentsDir2 = "./agents",
|
|
2332
|
-
collectionId: collectionId2 = "",
|
|
2333
2324
|
env = process.env,
|
|
2334
2325
|
platform = process.platform
|
|
2335
2326
|
} = {}) {
|
|
2336
|
-
const file = serveLogFilePath({ agentsDir: agentsDir2,
|
|
2327
|
+
const file = serveLogFilePath({ agentsDir: agentsDir2, env, platform });
|
|
2337
2328
|
let appendCount = 0;
|
|
2338
2329
|
return {
|
|
2339
2330
|
file,
|
|
@@ -2348,7 +2339,6 @@ function createServeLogStore({
|
|
|
2348
2339
|
fs10.mkdirSync(path7.dirname(file), { recursive: true });
|
|
2349
2340
|
const record = {
|
|
2350
2341
|
version: 1,
|
|
2351
|
-
collectionId: collectionId2 || "",
|
|
2352
2342
|
agentsDir: String(agentsDir2 || "./agents"),
|
|
2353
2343
|
relativePath: normalized.relativePath,
|
|
2354
2344
|
entry: normalized.entry
|
|
@@ -2368,14 +2358,13 @@ function createServeLogStore({
|
|
|
2368
2358
|
}
|
|
2369
2359
|
function serveLogFilePath({
|
|
2370
2360
|
agentsDir: agentsDir2 = "./agents",
|
|
2371
|
-
collectionId: collectionId2 = "",
|
|
2372
2361
|
env = process.env,
|
|
2373
2362
|
platform = process.platform
|
|
2374
2363
|
} = {}) {
|
|
2375
2364
|
const root = vendianHome(env, platform);
|
|
2376
2365
|
const resolvedAgentsDir = path7.resolve(String(agentsDir2 || "./agents"));
|
|
2377
|
-
const hash = crypto2.createHash("sha256").update(
|
|
2378
|
-
return path7.join(root, "serve-logs",
|
|
2366
|
+
const hash = crypto2.createHash("sha256").update(resolvedAgentsDir).digest("hex").slice(0, 16);
|
|
2367
|
+
return path7.join(root, "serve-logs", `default-${hash}.jsonl`);
|
|
2379
2368
|
}
|
|
2380
2369
|
function readServeLogRecords(file) {
|
|
2381
2370
|
if (!file || !fs10.existsSync(file)) {
|
|
@@ -2425,28 +2414,24 @@ function trimServeLogRecords(records) {
|
|
|
2425
2414
|
return !runId || keepRuns.has(runId);
|
|
2426
2415
|
}).slice(-MAX_EVENTS);
|
|
2427
2416
|
}
|
|
2428
|
-
function safePathPart(value) {
|
|
2429
|
-
return String(value || "default").replace(/[^a-zA-Z0-9_.-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80) || "default";
|
|
2430
|
-
}
|
|
2431
2417
|
|
|
2432
2418
|
// src/serve-process.js
|
|
2433
2419
|
import { spawn as spawn2 } from "node:child_process";
|
|
2434
2420
|
async function spawnLocalServeEventStream({
|
|
2435
2421
|
agentsDir: agentsDir2 = "./agents",
|
|
2436
|
-
collectionId: collectionId2 = "",
|
|
2437
2422
|
env = process.env,
|
|
2438
2423
|
platform = process.platform,
|
|
2439
2424
|
onProgress = null
|
|
2440
2425
|
} = {}) {
|
|
2441
|
-
const invocation = await preparePythonVendianInvocation(buildLocalServeEventStreamArgs({ agentsDir: agentsDir2
|
|
2426
|
+
const invocation = await preparePythonVendianInvocation(buildLocalServeEventStreamArgs({ agentsDir: agentsDir2 }), { env, platform, onProgress });
|
|
2442
2427
|
return spawn2(invocation.command, invocation.args, {
|
|
2443
2428
|
env: invocation.env,
|
|
2444
2429
|
stdio: ["ignore", "pipe", "pipe"],
|
|
2445
2430
|
shell: false
|
|
2446
2431
|
});
|
|
2447
2432
|
}
|
|
2448
|
-
function buildLocalServeEventStreamArgs({ agentsDir: agentsDir2 = "./agents"
|
|
2449
|
-
|
|
2433
|
+
function buildLocalServeEventStreamArgs({ agentsDir: agentsDir2 = "./agents" } = {}) {
|
|
2434
|
+
return [
|
|
2450
2435
|
"cloud",
|
|
2451
2436
|
"local",
|
|
2452
2437
|
"serve",
|
|
@@ -2454,14 +2439,10 @@ function buildLocalServeEventStreamArgs({ agentsDir: agentsDir2 = "./agents", co
|
|
|
2454
2439
|
agentsDir2 || "./agents",
|
|
2455
2440
|
"--event-stream"
|
|
2456
2441
|
];
|
|
2457
|
-
if (collectionId2) {
|
|
2458
|
-
args.push("--collection-id", collectionId2);
|
|
2459
|
-
}
|
|
2460
|
-
return args;
|
|
2461
2442
|
}
|
|
2462
2443
|
|
|
2463
2444
|
// src/version.js
|
|
2464
|
-
var CLI_VERSION = true ? "0.0.
|
|
2445
|
+
var CLI_VERSION = true ? "0.0.45" : process.env.npm_package_version || "0.0.0-dev";
|
|
2465
2446
|
|
|
2466
2447
|
// src/dev-server.js
|
|
2467
2448
|
var __dirname = path8.dirname(fileURLToPath(import.meta.url));
|
|
@@ -2473,7 +2454,6 @@ var serveLogs = [];
|
|
|
2473
2454
|
var logStore = null;
|
|
2474
2455
|
var agentsDir = "";
|
|
2475
2456
|
var activeServeAgentsDir = "";
|
|
2476
|
-
var collectionId = "";
|
|
2477
2457
|
var activeAuthLogin = null;
|
|
2478
2458
|
async function startDevServer({
|
|
2479
2459
|
port = 3859,
|
|
@@ -2616,7 +2596,6 @@ function apiStatus(req, res) {
|
|
|
2616
2596
|
serving,
|
|
2617
2597
|
agentsDir,
|
|
2618
2598
|
serveAgentsDir: serving ? activeServeAgentsDir || agentsDir : "",
|
|
2619
|
-
collectionId,
|
|
2620
2599
|
connected: serveState.connected,
|
|
2621
2600
|
activity: serveState.activity,
|
|
2622
2601
|
agentCount: serveState.agents.length,
|
|
@@ -2830,38 +2809,34 @@ async function apiValidate(req, res, body) {
|
|
|
2830
2809
|
}
|
|
2831
2810
|
function resolveServeStartTarget(body = {}, current = {}) {
|
|
2832
2811
|
const targetDir = body.agentsDir || current.agentsDir || "";
|
|
2833
|
-
|
|
2834
|
-
return { ok: true, agentsDir: targetDir, collectionId: targetCollection };
|
|
2812
|
+
return { ok: true, agentsDir: targetDir };
|
|
2835
2813
|
}
|
|
2836
2814
|
function devServerStateAfterServeStart(current = {}, target = {}) {
|
|
2837
2815
|
return {
|
|
2838
2816
|
agentsDir: current.agentsDir || "",
|
|
2839
|
-
activeServeAgentsDir: target.agentsDir || current.agentsDir || ""
|
|
2840
|
-
collectionId: target.collectionId || current.collectionId || ""
|
|
2817
|
+
activeServeAgentsDir: target.agentsDir || current.agentsDir || ""
|
|
2841
2818
|
};
|
|
2842
2819
|
}
|
|
2843
2820
|
async function apiServeStart(req, res, body) {
|
|
2844
2821
|
if (childProcessIsRunning(serveChild)) {
|
|
2845
2822
|
return jsonResponse(res, { ok: false, error: "Already serving" });
|
|
2846
2823
|
}
|
|
2847
|
-
const target = resolveServeStartTarget(body, { agentsDir
|
|
2824
|
+
const target = resolveServeStartTarget(body, { agentsDir });
|
|
2848
2825
|
if (!target.ok) {
|
|
2849
2826
|
return jsonResponse(res, target, 400);
|
|
2850
2827
|
}
|
|
2851
2828
|
try {
|
|
2852
2829
|
const targetDir = target.agentsDir;
|
|
2853
|
-
const targetCollection = target.collectionId;
|
|
2854
2830
|
const invocation = await preparePythonVendianInvocation(
|
|
2855
|
-
buildLocalServeEventStreamArgs({ agentsDir: targetDir
|
|
2831
|
+
buildLocalServeEventStreamArgs({ agentsDir: targetDir }),
|
|
2856
2832
|
{ onProgress: null }
|
|
2857
2833
|
);
|
|
2858
|
-
const nextState = devServerStateAfterServeStart({ agentsDir
|
|
2834
|
+
const nextState = devServerStateAfterServeStart({ agentsDir }, target);
|
|
2859
2835
|
agentsDir = nextState.agentsDir;
|
|
2860
2836
|
activeServeAgentsDir = nextState.activeServeAgentsDir;
|
|
2861
|
-
collectionId = nextState.collectionId;
|
|
2862
2837
|
serveState = initialServeState();
|
|
2863
2838
|
serveLogs = [];
|
|
2864
|
-
logStore = createServeLogStore({ agentsDir: activeServeAgentsDir
|
|
2839
|
+
logStore = createServeLogStore({ agentsDir: activeServeAgentsDir });
|
|
2865
2840
|
serveChild = spawn3(invocation.command, invocation.args, {
|
|
2866
2841
|
env: invocation.env,
|
|
2867
2842
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -3116,59 +3091,6 @@ init_paths();
|
|
|
3116
3091
|
init_setup();
|
|
3117
3092
|
init_process();
|
|
3118
3093
|
|
|
3119
|
-
// src/collections.js
|
|
3120
|
-
init_process();
|
|
3121
|
-
async function listCloudCollections({
|
|
3122
|
-
env = process.env,
|
|
3123
|
-
platform = process.platform,
|
|
3124
|
-
prepareInvocation = preparePythonVendianInvocation,
|
|
3125
|
-
run: run2 = runCapture,
|
|
3126
|
-
onProgress = null,
|
|
3127
|
-
timeoutMs = 2e4
|
|
3128
|
-
} = {}) {
|
|
3129
|
-
const progress = typeof onProgress === "function" ? onProgress : () => {
|
|
3130
|
-
};
|
|
3131
|
-
progress("Checking managed Python runtime");
|
|
3132
|
-
const invocation = await prepareInvocation(["cloud", "collections", "list", "--json"], {
|
|
3133
|
-
env,
|
|
3134
|
-
platform,
|
|
3135
|
-
onProgress: progress,
|
|
3136
|
-
skipAutoUpdate: true
|
|
3137
|
-
});
|
|
3138
|
-
progress("Loading collections from Vendian");
|
|
3139
|
-
const result = run2(invocation.command, invocation.args, { env: invocation.env, timeout: timeoutMs });
|
|
3140
|
-
if (!result.ok) {
|
|
3141
|
-
return {
|
|
3142
|
-
ok: false,
|
|
3143
|
-
collections: [],
|
|
3144
|
-
error: (result.stderr || result.stdout || `collection list exited with code ${result.status}`).trim()
|
|
3145
|
-
};
|
|
3146
|
-
}
|
|
3147
|
-
try {
|
|
3148
|
-
return { ok: true, collections: normalizeCollectionList(JSON.parse(result.stdout)), error: "" };
|
|
3149
|
-
} catch (error) {
|
|
3150
|
-
const message = error && typeof error.message === "string" ? error.message : String(error);
|
|
3151
|
-
return { ok: false, collections: [], error: `Could not parse collection list: ${message}` };
|
|
3152
|
-
}
|
|
3153
|
-
}
|
|
3154
|
-
function normalizeCollectionList(payload) {
|
|
3155
|
-
const data = payload && typeof payload === "object" && "data" in payload ? payload.data : payload;
|
|
3156
|
-
const raw = Array.isArray(data) ? data : data && typeof data === "object" && Array.isArray(data.data) ? data.data : data && typeof data === "object" && Array.isArray(data.collections) ? data.collections : [];
|
|
3157
|
-
return raw.filter((item) => item && typeof item === "object").map((item) => ({
|
|
3158
|
-
id: stringValue2(item.id),
|
|
3159
|
-
name: stringValue2(item.name || item.slug || item.id || "Unnamed collection"),
|
|
3160
|
-
slug: stringValue2(item.slug)
|
|
3161
|
-
})).filter((item) => item.id);
|
|
3162
|
-
}
|
|
3163
|
-
function collectionLabel(collection) {
|
|
3164
|
-
const name = collection?.name || collection?.slug || collection?.id || "Unnamed collection";
|
|
3165
|
-
const slug = collection?.slug && collection.slug !== name ? ` (${collection.slug})` : "";
|
|
3166
|
-
return `${name}${slug}`;
|
|
3167
|
-
}
|
|
3168
|
-
function stringValue2(value) {
|
|
3169
|
-
return value == null ? "" : String(value).trim();
|
|
3170
|
-
}
|
|
3171
|
-
|
|
3172
3094
|
// src/ui/figures.js
|
|
3173
3095
|
var supportsUnicode = process.platform !== "win32" || Boolean(
|
|
3174
3096
|
process.env.WT_SESSION || // Windows Terminal
|
|
@@ -3397,7 +3319,6 @@ var HOME_ACTIONS = [
|
|
|
3397
3319
|
{ value: "serve", label: "Serve my agents", desc: "Start agents and stream their logs" },
|
|
3398
3320
|
{ value: "connect", label: "Login / Switch", desc: "Sign in or switch to a different environment" },
|
|
3399
3321
|
{ value: "create", label: "Create Agent", desc: "Build a new agent from a template" },
|
|
3400
|
-
{ value: "run", label: "Run once", desc: "Execute one agent immediately" },
|
|
3401
3322
|
{ value: "commands", label: "Commands", desc: "Show all CLI commands" },
|
|
3402
3323
|
{ value: "exit", label: "Exit", desc: "" }
|
|
3403
3324
|
];
|
|
@@ -3477,14 +3398,13 @@ var COMMAND_GROUPS = [
|
|
|
3477
3398
|
] },
|
|
3478
3399
|
{ section: "Running agents", commands: [
|
|
3479
3400
|
{ cmd: "vendian dev", desc: "Open the dev UI in your browser" },
|
|
3480
|
-
{ cmd: "vendian cloud local run --collection-id ID --path . --input-json '{}'", desc: "Run one agent" },
|
|
3481
3401
|
{ cmd: "vendian cloud local serve --agents-dir .", desc: "Start agents" },
|
|
3482
3402
|
{ cmd: "vendian login --backend staging", desc: "Sign in to staging" }
|
|
3483
3403
|
] },
|
|
3484
3404
|
{ section: "Syncing & deploying", commands: [
|
|
3485
|
-
{ cmd: "vendian cloud
|
|
3486
|
-
{ cmd: "vendian cloud
|
|
3487
|
-
{ cmd: "vendian cloud
|
|
3405
|
+
{ cmd: "vendian cloud suite status --remote", desc: "Check source-set status" },
|
|
3406
|
+
{ cmd: "vendian cloud suite push --wait", desc: "Push selected source-set code" },
|
|
3407
|
+
{ cmd: "vendian cloud suite deploy --environment staging", desc: "Deploy a source set" }
|
|
3488
3408
|
] },
|
|
3489
3409
|
{ section: "Maintenance", commands: [
|
|
3490
3410
|
{ cmd: "vendian doctor", desc: "Check if everything is set up" },
|
|
@@ -3559,84 +3479,6 @@ async function pickAgentsFromFolder({ env, platform, candidate }) {
|
|
|
3559
3479
|
if (idx === 0) return { agentsDir: candidate.path };
|
|
3560
3480
|
return { agentsDir: named[idx - 1].path };
|
|
3561
3481
|
}
|
|
3562
|
-
async function pickSingleAgentToRun({ env, platform, candidates }) {
|
|
3563
|
-
if (candidates.length === 0) {
|
|
3564
|
-
clearScreen();
|
|
3565
|
-
print("");
|
|
3566
|
-
print(col.yellow(" Couldn't find any agents."));
|
|
3567
|
-
const input = await ask("Agent folder", "./agents/my-agent");
|
|
3568
|
-
if (!input) return null;
|
|
3569
|
-
return { path: input, displayName: friendlyName(path9.basename(input) || "Agent") };
|
|
3570
|
-
}
|
|
3571
|
-
const agents = candidates.flatMap((candidate) => {
|
|
3572
|
-
const folders = findAgentFolders(candidate.absolutePath);
|
|
3573
|
-
if (folders.length > 0) {
|
|
3574
|
-
return folders.map((folder) => ({
|
|
3575
|
-
path: folder.path,
|
|
3576
|
-
displayName: readManifestName(folder.absolutePath) || friendlyName(folder.name || path9.basename(folder.path))
|
|
3577
|
-
}));
|
|
3578
|
-
}
|
|
3579
|
-
return [{
|
|
3580
|
-
path: candidate.path,
|
|
3581
|
-
displayName: readManifestName(candidate.absolutePath) || friendlyName(path9.basename(candidate.absolutePath) || candidate.path)
|
|
3582
|
-
}];
|
|
3583
|
-
});
|
|
3584
|
-
if (agents.length === 1) return agents[0];
|
|
3585
|
-
clearScreen();
|
|
3586
|
-
printHeader({ env, platform });
|
|
3587
|
-
print("");
|
|
3588
|
-
print(col.bold(" Which agent do you want to run?"));
|
|
3589
|
-
print("");
|
|
3590
|
-
const items = agents.map((a) => `${a.displayName.padEnd(32)} ${col.gray(a.path)}`);
|
|
3591
|
-
const idx = await pickMenu(items, { allowBack: true });
|
|
3592
|
-
if (idx === null || idx === -1) return null;
|
|
3593
|
-
return agents[idx];
|
|
3594
|
-
}
|
|
3595
|
-
async function chooseCloudCollection({ env, platform, loadingTitle, pickerTitle } = {}) {
|
|
3596
|
-
print("");
|
|
3597
|
-
process.stdout.write(` ${col.gray(loadingTitle || "Loading collections...")}
|
|
3598
|
-
`);
|
|
3599
|
-
let result;
|
|
3600
|
-
try {
|
|
3601
|
-
result = await listCloudCollections({
|
|
3602
|
-
env,
|
|
3603
|
-
platform,
|
|
3604
|
-
onProgress: (msg) => {
|
|
3605
|
-
process.stdout.write(`\r ${col.gray(clip(msg, 60))} `);
|
|
3606
|
-
}
|
|
3607
|
-
});
|
|
3608
|
-
process.stdout.write("\r" + " ".repeat(70) + "\r");
|
|
3609
|
-
} catch (error) {
|
|
3610
|
-
process.stdout.write("\r" + " ".repeat(70) + "\r");
|
|
3611
|
-
print(col.red(`
|
|
3612
|
-
Couldn't connect: ${errMsg(error)}`));
|
|
3613
|
-
print(col.gray(" Make sure you are signed in (choose Login / Switch from the menu)."));
|
|
3614
|
-
await pressEnterToContinue({ grabActive: false });
|
|
3615
|
-
return null;
|
|
3616
|
-
}
|
|
3617
|
-
if (!result.ok) {
|
|
3618
|
-
print(col.red(`
|
|
3619
|
-
${fig.cross} ${result.error}`));
|
|
3620
|
-
await pressEnterToContinue({ grabActive: false });
|
|
3621
|
-
return null;
|
|
3622
|
-
}
|
|
3623
|
-
if (result.collections.length === 0) return null;
|
|
3624
|
-
if (result.collections.length === 1) {
|
|
3625
|
-
const collection2 = result.collections[0];
|
|
3626
|
-
return { id: collection2.id || "", label: collectionLabel(collection2) };
|
|
3627
|
-
}
|
|
3628
|
-
clearScreen();
|
|
3629
|
-
print("");
|
|
3630
|
-
printHeader({ env, platform });
|
|
3631
|
-
print("");
|
|
3632
|
-
print(col.bold(` ${pickerTitle || "Choose a collection:"}`));
|
|
3633
|
-
print("");
|
|
3634
|
-
const items = result.collections.map((collection2) => collectionLabel(collection2));
|
|
3635
|
-
const idx = await pickMenu(items, { allowBack: true });
|
|
3636
|
-
if (idx === null || idx === -1) return null;
|
|
3637
|
-
const collection = result.collections[idx];
|
|
3638
|
-
return { id: collection.id || "", label: collectionLabel(collection) };
|
|
3639
|
-
}
|
|
3640
3482
|
async function showCreate({ env, platform }) {
|
|
3641
3483
|
clearScreen();
|
|
3642
3484
|
printHeader({ env, platform });
|
|
@@ -3652,28 +3494,6 @@ async function showCreate({ env, platform }) {
|
|
|
3652
3494
|
);
|
|
3653
3495
|
return "home";
|
|
3654
3496
|
}
|
|
3655
|
-
async function showRun({ env, platform }) {
|
|
3656
|
-
const candidates = findAgentDirectoryCandidates();
|
|
3657
|
-
const picked = await pickSingleAgentToRun({ env, platform, candidates });
|
|
3658
|
-
if (!picked) return "home";
|
|
3659
|
-
const collection = await chooseCloudCollection({
|
|
3660
|
-
env,
|
|
3661
|
-
platform,
|
|
3662
|
-
loadingTitle: "Getting ready to run this agent...",
|
|
3663
|
-
pickerTitle: "Which collection should own this run?"
|
|
3664
|
-
});
|
|
3665
|
-
if (!collection) return "home";
|
|
3666
|
-
const inputJson = await ask("Input JSON", "{}");
|
|
3667
|
-
await withOutputMode(
|
|
3668
|
-
`Running ${picked.displayName}`,
|
|
3669
|
-
() => forwardToPythonVendian(buildLocalRunArgs({
|
|
3670
|
-
agentPath: picked.path,
|
|
3671
|
-
collectionId: collection.id,
|
|
3672
|
-
inputJson: inputJson || "{}"
|
|
3673
|
-
}), { env, platform })
|
|
3674
|
-
);
|
|
3675
|
-
return "home";
|
|
3676
|
-
}
|
|
3677
3497
|
async function showServe({ env, platform }) {
|
|
3678
3498
|
const candidates = findAgentDirectoryCandidates();
|
|
3679
3499
|
const picked = await pickAgentsToRun({ env, platform, candidates });
|
|
@@ -3682,12 +3502,10 @@ async function showServe({ env, platform }) {
|
|
|
3682
3502
|
return await runServeDashboard({
|
|
3683
3503
|
env,
|
|
3684
3504
|
platform,
|
|
3685
|
-
agentsDir: agentsDir2
|
|
3686
|
-
collectionId: "",
|
|
3687
|
-
collectionLabel: "Admin Local Lab"
|
|
3505
|
+
agentsDir: agentsDir2
|
|
3688
3506
|
});
|
|
3689
3507
|
}
|
|
3690
|
-
async function runServeDashboard({ env, platform, agentsDir: agentsDir2
|
|
3508
|
+
async function runServeDashboard({ env, platform, agentsDir: agentsDir2 }) {
|
|
3691
3509
|
let state = initialServeState();
|
|
3692
3510
|
let child = null;
|
|
3693
3511
|
let ctrlCArmed = false;
|
|
@@ -3707,7 +3525,7 @@ async function runServeDashboard({ env, platform, agentsDir: agentsDir2, collect
|
|
|
3707
3525
|
print(col.gray("\u2550".repeat(W)));
|
|
3708
3526
|
print(` ${col.cyan(col.bold("\u2191 VENDIAN"))} ${col.bold("Serving agents")}`);
|
|
3709
3527
|
print(` ${col.gray("Dir:")} ${agentsDir2}`);
|
|
3710
|
-
print(` ${col.gray("
|
|
3528
|
+
print(` ${col.gray("Backend:")} ${envLabel(activeCloudAuthStatus({ env, platform }).apiUrl) || "active endpoint"}`);
|
|
3711
3529
|
print(col.gray(hr(W)));
|
|
3712
3530
|
print(col.gray(" S stop gracefully | ^c ^c exit"));
|
|
3713
3531
|
print(col.gray(hr(W)));
|
|
@@ -3824,7 +3642,7 @@ async function runServeDashboard({ env, platform, agentsDir: agentsDir2, collect
|
|
|
3824
3642
|
}
|
|
3825
3643
|
}
|
|
3826
3644
|
try {
|
|
3827
|
-
logStore2 = createServeLogStore({ agentsDir: agentsDir2,
|
|
3645
|
+
logStore2 = createServeLogStore({ agentsDir: agentsDir2, env, platform });
|
|
3828
3646
|
const historicalLogs = logStore2.load();
|
|
3829
3647
|
if (historicalLogs.length > 0) {
|
|
3830
3648
|
const agentLogs = mergeAgentLogRecords(state.agentLogs, historicalLogs);
|
|
@@ -3832,7 +3650,6 @@ async function runServeDashboard({ env, platform, agentsDir: agentsDir2, collect
|
|
|
3832
3650
|
}
|
|
3833
3651
|
child = await spawnLocalServeEventStream({
|
|
3834
3652
|
agentsDir: agentsDir2,
|
|
3835
|
-
collectionId: collectionId2,
|
|
3836
3653
|
env,
|
|
3837
3654
|
platform,
|
|
3838
3655
|
onProgress: (msg) => {
|
|
@@ -4024,9 +3841,6 @@ async function mainLoop({ env, platform }) {
|
|
|
4024
3841
|
case "create":
|
|
4025
3842
|
next = await showCreate({ env, platform });
|
|
4026
3843
|
break;
|
|
4027
|
-
case "run":
|
|
4028
|
-
next = await showRun({ env, platform });
|
|
4029
|
-
break;
|
|
4030
3844
|
case "serve":
|
|
4031
3845
|
next = await showServe({ env, platform });
|
|
4032
3846
|
break;
|
|
@@ -4130,23 +3944,6 @@ function endpointErrorStatus(error) {
|
|
|
4130
3944
|
const message = error && typeof error.message === "string" ? error.message : String(error || "Connection failed");
|
|
4131
3945
|
return `${fig.cross} ${message}`;
|
|
4132
3946
|
}
|
|
4133
|
-
function buildLocalRunArgs({
|
|
4134
|
-
agentPath = ".",
|
|
4135
|
-
collectionId: collectionId2 = "",
|
|
4136
|
-
inputJson = "{}"
|
|
4137
|
-
} = {}) {
|
|
4138
|
-
return [
|
|
4139
|
-
"cloud",
|
|
4140
|
-
"local",
|
|
4141
|
-
"run",
|
|
4142
|
-
"--collection-id",
|
|
4143
|
-
collectionId2,
|
|
4144
|
-
"--path",
|
|
4145
|
-
agentPath || ".",
|
|
4146
|
-
"--input-json",
|
|
4147
|
-
inputJson || "{}"
|
|
4148
|
-
];
|
|
4149
|
-
}
|
|
4150
3947
|
function stopSignalForAttempt(attempt = 0) {
|
|
4151
3948
|
if (!Number.isFinite(attempt) || attempt <= 0) return "SIGINT";
|
|
4152
3949
|
if (attempt === 1) return "SIGTERM";
|
|
@@ -4180,8 +3977,9 @@ function helpText() {
|
|
|
4180
3977
|
" vendian validate ./agents/my-agent --runtime",
|
|
4181
3978
|
" vendian models",
|
|
4182
3979
|
" vendian cloud local serve --agents-dir ./agents",
|
|
4183
|
-
" vendian cloud
|
|
4184
|
-
" vendian cloud
|
|
3980
|
+
" vendian cloud suite status --path vendian-suite.yaml --remote",
|
|
3981
|
+
" vendian cloud suite push --path vendian-suite.yaml --wait",
|
|
3982
|
+
" vendian cloud suite deploy --path vendian-suite.yaml --environment staging",
|
|
4185
3983
|
" vendian doctor",
|
|
4186
3984
|
" vendian update",
|
|
4187
3985
|
"",
|