@vendian/cli 0.0.16 → 0.0.17

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/cli-wrapper.mjs +112 -9
  2. package/package.json +1 -1
package/cli-wrapper.mjs CHANGED
@@ -36675,21 +36675,27 @@ async function forwardToPythonVendian(args, { env: env3 = process.env, platform:
36675
36675
  recordForwardedDocsCommand(args, code, { env: env3, platform: platform2 });
36676
36676
  process.exitCode = code;
36677
36677
  }
36678
- async function preparePythonVendianInvocation(args, { env: env3 = process.env, platform: platform2 = process.platform } = {}) {
36678
+ async function preparePythonVendianInvocation(args, { env: env3 = process.env, platform: platform2 = process.platform, onProgress = null } = {}) {
36679
36679
  const venvPath = managedVenvPath(env3, platform2);
36680
36680
  const vendianPath = venvVendian(venvPath, platform2);
36681
+ reportProgress(onProgress, "Checking managed Python runtime");
36681
36682
  if (!fs8.existsSync(vendianPath)) {
36682
36683
  throw new Error("Vendian is not set up yet. Run `vendian login` first.");
36683
36684
  }
36684
36685
  const loadedConfig = loadConfig(env3, platform2);
36685
36686
  const requiresPackageAccess = commandNeedsPackageAccess(args);
36687
+ if (requiresPackageAccess) {
36688
+ reportProgress(onProgress, "Refreshing package access");
36689
+ }
36686
36690
  const refreshed = requiresPackageAccess ? await refreshPackageAccessFromCloudAuth({ config: loadedConfig, env: env3, platform: platform2 }) : { config: loadedConfig };
36687
- maybeAutoUpdateManagedEnv({ env: env3, platform: platform2, venvPath });
36691
+ maybeAutoUpdateManagedEnv({ env: env3, platform: platform2, venvPath, onProgress });
36688
36692
  const config = refreshed.config;
36693
+ reportProgress(onProgress, "Preparing package indexes");
36689
36694
  const registry = registryConfig(config, env3, platform2);
36690
36695
  if (requiresPackageAccess && !registry.token) {
36691
36696
  throw new Error("Package access is missing. Run `vendian login` or `vendian update` before starting local agents.");
36692
36697
  }
36698
+ reportProgress(onProgress, "Launching local serve daemon");
36693
36699
  return {
36694
36700
  command: vendianPath,
36695
36701
  args,
@@ -36738,7 +36744,8 @@ function maybeAutoUpdateManagedEnv({
36738
36744
  save = saveConfig,
36739
36745
  installPackages = installVendianPackages,
36740
36746
  refreshDocs = refreshAgentDocsWorkspaces,
36741
- now = Date.now()
36747
+ now = Date.now(),
36748
+ onProgress = null
36742
36749
  } = {}) {
36743
36750
  if (env3.VENDIAN_SKIP_AUTO_UPDATE === "1") {
36744
36751
  return false;
@@ -36760,10 +36767,13 @@ function maybeAutoUpdateManagedEnv({
36760
36767
  if (log) {
36761
36768
  console.error("[vendian] Checking managed CLI/runtime updates...");
36762
36769
  }
36770
+ reportProgress(onProgress, "Installing managed CLI/runtime updates");
36763
36771
  installPackages({ pythonPath, venvPath, config, env: env3, platform: platform2 });
36764
36772
  const next = { ...config, lastManagedUpdateAt: new Date(now).toISOString() };
36765
36773
  save(next, env3, platform2);
36774
+ reportProgress(onProgress, "Refreshing generated agent docs");
36766
36775
  refreshDocs({ config: next, venvPath, env: env3, platform: platform2 });
36776
+ reportProgress(onProgress, "Managed CLI/runtime ready");
36767
36777
  return true;
36768
36778
  } catch (error) {
36769
36779
  const message = error && typeof error.message === "string" ? error.message : String(error);
@@ -36773,13 +36783,18 @@ function maybeAutoUpdateManagedEnv({
36773
36783
  return false;
36774
36784
  }
36775
36785
  }
36786
+ function reportProgress(onProgress, message) {
36787
+ if (typeof onProgress === "function") {
36788
+ onProgress(message);
36789
+ }
36790
+ }
36776
36791
 
36777
36792
  // src/tui.js
36778
36793
  import fs12 from "node:fs";
36779
36794
  import readlinePromises from "node:readline/promises";
36780
36795
 
36781
36796
  // src/version.js
36782
- var CLI_VERSION = true ? "0.0.16" : process.env.npm_package_version || "0.0.0-dev";
36797
+ var CLI_VERSION = true ? "0.0.17" : process.env.npm_package_version || "0.0.0-dev";
36783
36798
 
36784
36799
  // src/npm-update.js
36785
36800
  var NPM_CHECK_INTERVAL_MS = 30 * 60 * 1e3;
@@ -37182,8 +37197,43 @@ function applyServeEvent(state, event) {
37182
37197
  activity: "Daemon registered"
37183
37198
  };
37184
37199
  }
37200
+ if (event.type === "agent_prepare_plan") {
37201
+ const agentCount = Number(event.agentCount || 0);
37202
+ const environmentCount = Number(event.environmentCount || 0);
37203
+ return {
37204
+ ...next,
37205
+ activity: `Preparing ${agentCount} agent${agentCount === 1 ? "" : "s"} across ${environmentCount} dependency set${environmentCount === 1 ? "" : "s"}`
37206
+ };
37207
+ }
37185
37208
  if (event.type === "agent_prepare_started") {
37186
- return { ...next, activity: `Preparing ${agentLabel(event)}` };
37209
+ const relativePath = agentLabel(event);
37210
+ const timestamp = event.timestamp || (/* @__PURE__ */ new Date()).toISOString();
37211
+ return {
37212
+ ...next,
37213
+ agentLogs: appendAgentLog(state.agentLogs, event),
37214
+ agentRunState: setAgentRunState(state.agentRunState, relativePath, {
37215
+ status: "preparing",
37216
+ lastEventAt: timestamp,
37217
+ progressMessage: "Preparing agent"
37218
+ }),
37219
+ activity: `Preparing ${relativePath}`
37220
+ };
37221
+ }
37222
+ if (event.type === "agent_prepare_progress") {
37223
+ const relativePath = agentLabel(event);
37224
+ const timestamp = event.timestamp || (/* @__PURE__ */ new Date()).toISOString();
37225
+ const message = stringValue(event.message || event.stage || "Preparing agent");
37226
+ return {
37227
+ ...next,
37228
+ agentLogs: appendAgentLog(state.agentLogs, event),
37229
+ agentRunState: setAgentRunState(state.agentRunState, relativePath, {
37230
+ status: "preparing",
37231
+ lastEventAt: timestamp,
37232
+ progressStage: stringValue(event.stage),
37233
+ progressMessage: message
37234
+ }),
37235
+ activity: `${relativePath}: ${message}`
37236
+ };
37187
37237
  }
37188
37238
  if (event.type === "agent_prepare_completed") {
37189
37239
  const isError = event.status === "error";
@@ -37197,10 +37247,16 @@ function applyServeEvent(state, event) {
37197
37247
  lastEventAt: event.timestamp || (/* @__PURE__ */ new Date()).toISOString(),
37198
37248
  disabledReason: stringValue(event.disabledReason || event.warning || "System dependency not met"),
37199
37249
  resolutionHints: Array.isArray(event.resolutionHints) ? event.resolutionHints : []
37200
- }) : state.agentRunState;
37250
+ }) : setAgentRunState(state.agentRunState, agentLabel(event), {
37251
+ status: "ready",
37252
+ lastEventAt: event.timestamp || (/* @__PURE__ */ new Date()).toISOString(),
37253
+ progressMessage: null,
37254
+ progressStage: null
37255
+ });
37201
37256
  const activityLabel = isError ? `${agentLabel(event)} needs setup` : isDisabled ? `${agentLabel(event)} disabled (deps not met locally)` : `${agentLabel(event)} ready`;
37202
37257
  return {
37203
37258
  ...next,
37259
+ agentLogs: appendAgentLog(state.agentLogs, event),
37204
37260
  activity: activityLabel,
37205
37261
  agentRunState: runState,
37206
37262
  errors: isError && event.error ? appendError(state.errors, agentLabel(event), event.error) : state.errors
@@ -37515,6 +37571,25 @@ function serveEventAgentLogEntry(event) {
37515
37571
  }
37516
37572
  };
37517
37573
  }
37574
+ if (type === "agent_prepare_started" || type === "agent_prepare_progress" || type === "agent_prepare_completed") {
37575
+ const success = type === "agent_prepare_completed" ? event.status !== "error" : null;
37576
+ return {
37577
+ relativePath,
37578
+ entry: {
37579
+ timestamp,
37580
+ runId: "",
37581
+ eventType: type,
37582
+ level: event.status === "error" ? "error" : "info",
37583
+ message: agentPrepareLogMessage(event),
37584
+ stepId: stringValue(event.stage || type),
37585
+ current: null,
37586
+ total: null,
37587
+ success,
37588
+ error: event.error ?? null,
37589
+ jobType: null
37590
+ }
37591
+ };
37592
+ }
37518
37593
  if (type === "process_exit" || type === "daemon_exit") {
37519
37594
  const message = stringValue(event.message || processExitMessage(event));
37520
37595
  return {
@@ -37548,6 +37623,9 @@ function agentRuntimeStatus(agent, agentRunState = {}) {
37548
37623
  if (run2?.status === "running") {
37549
37624
  return { status: "running", label: "running", run: run2 };
37550
37625
  }
37626
+ if (run2?.status === "preparing") {
37627
+ return { status: "preparing", label: "preparing", run: run2 };
37628
+ }
37551
37629
  if (run2?.status === "error" || inventoryStatus === "error") {
37552
37630
  return { status: "error", label: "error", run: run2 };
37553
37631
  }
@@ -37702,6 +37780,17 @@ function processExitMessage(event) {
37702
37780
  }
37703
37781
  return "Agent serve exited";
37704
37782
  }
37783
+ function agentPrepareLogMessage(event) {
37784
+ if (event.type === "agent_prepare_started") {
37785
+ return "Preparing agent";
37786
+ }
37787
+ if (event.type === "agent_prepare_completed") {
37788
+ if (event.status === "error") return stringValue(event.error || event.errorMessage || "Agent setup failed");
37789
+ if (event.status === "disabled") return stringValue(event.warning || event.disabledReason || "Agent disabled locally");
37790
+ return "Agent ready";
37791
+ }
37792
+ return stringValue(event.message || event.stage || "Preparing agent");
37793
+ }
37705
37794
  function textTail(value, limit = 800) {
37706
37795
  const text = String(value || "").trim().replace(/\s+/g, " ");
37707
37796
  return text.length > limit ? text.slice(-limit) : text;
@@ -37717,9 +37806,10 @@ async function spawnLocalServeEventStream({
37717
37806
  agentsDir = "./agents",
37718
37807
  collectionId = "",
37719
37808
  env: env3 = process.env,
37720
- platform: platform2 = process.platform
37809
+ platform: platform2 = process.platform,
37810
+ onProgress = null
37721
37811
  } = {}) {
37722
- const invocation = await preparePythonVendianInvocation(buildLocalServeEventStreamArgs({ agentsDir, collectionId }), { env: env3, platform: platform2 });
37812
+ const invocation = await preparePythonVendianInvocation(buildLocalServeEventStreamArgs({ agentsDir, collectionId }), { env: env3, platform: platform2, onProgress });
37723
37813
  return spawn2(invocation.command, invocation.args, {
37724
37814
  env: invocation.env,
37725
37815
  stdio: ["ignore", "pipe", "pipe"],
@@ -38541,6 +38631,7 @@ function ServeScreen({ env: env3, platform: platform2, input, onBack, onState, o
38541
38631
  setStarted(true);
38542
38632
  setStartupError("");
38543
38633
  try {
38634
+ setState((current) => ({ ...current, activity: "Loading previous agent logs" }));
38544
38635
  const logStore = createServeLogStore({ agentsDir: serveRoot, collectionId, env: env3, platform: platform2 });
38545
38636
  const historicalLogs = logStore.load();
38546
38637
  if (historicalLogs.length > 0) {
@@ -38556,7 +38647,17 @@ function ServeScreen({ env: env3, platform: platform2, input, onBack, onState, o
38556
38647
  };
38557
38648
  });
38558
38649
  }
38559
- const nextChild = await spawnLocalServeEventStream({ agentsDir: serveRoot, collectionId, env: env3, platform: platform2 });
38650
+ setState((current) => ({ ...current, activity: "Preparing managed runtime" }));
38651
+ const nextChild = await spawnLocalServeEventStream({
38652
+ agentsDir: serveRoot,
38653
+ collectionId,
38654
+ env: env3,
38655
+ platform: platform2,
38656
+ onProgress: (message) => {
38657
+ setState((current) => ({ ...current, activity: message || "Preparing managed runtime" }));
38658
+ }
38659
+ });
38660
+ setState((current) => ({ ...current, activity: "Waiting for daemon events" }));
38560
38661
  setChild(nextChild);
38561
38662
  attachServeChild(nextChild, setState, setStartupError, ({ message } = {}) => {
38562
38663
  setState((current) => current.stopped ? current : { ...current, stopped: true, activity: message ? "Runtime update required" : "Process exited" });
@@ -38815,6 +38916,7 @@ function DisabledAgentsFooter({ agents, agentRunState = {} }) {
38815
38916
  }
38816
38917
  function runtimeStatusColor(status) {
38817
38918
  if (status === "running") return colors.accent;
38919
+ if (status === "preparing") return colors.brand;
38818
38920
  if (status === "ready" || status === "completed") return colors.success;
38819
38921
  if (status === "disabled") return colors.warning;
38820
38922
  if (status === "error") return colors.error;
@@ -38822,6 +38924,7 @@ function runtimeStatusColor(status) {
38822
38924
  }
38823
38925
  function runtimeStatusIcon(status) {
38824
38926
  if (status === "running") return fig.arrow;
38927
+ if (status === "preparing") return fig.dotEmpty;
38825
38928
  if (status === "ready" || status === "completed") return fig.dot;
38826
38929
  if (status === "disabled") return fig.warning;
38827
38930
  if (status === "error") return fig.cross;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vendian/cli",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "description": "Public Vendian CLI bootstrapper and launcher",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,