@vendian/cli 0.0.10 → 0.0.11

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 +533 -78
  2. package/package.json +1 -1
package/cli-wrapper.mjs CHANGED
@@ -24765,10 +24765,10 @@ var require_react_reconciler_development = __commonJS({
24765
24765
  var setErrorHandler = null;
24766
24766
  var setSuspenseHandler = null;
24767
24767
  {
24768
- var copyWithDeleteImpl = function(obj, path7, index2) {
24769
- var key = path7[index2];
24768
+ var copyWithDeleteImpl = function(obj, path8, index2) {
24769
+ var key = path8[index2];
24770
24770
  var updated = isArray(obj) ? obj.slice() : assign({}, obj);
24771
- if (index2 + 1 === path7.length) {
24771
+ if (index2 + 1 === path8.length) {
24772
24772
  if (isArray(updated)) {
24773
24773
  updated.splice(key, 1);
24774
24774
  } else {
@@ -24776,11 +24776,11 @@ var require_react_reconciler_development = __commonJS({
24776
24776
  }
24777
24777
  return updated;
24778
24778
  }
24779
- updated[key] = copyWithDeleteImpl(obj[key], path7, index2 + 1);
24779
+ updated[key] = copyWithDeleteImpl(obj[key], path8, index2 + 1);
24780
24780
  return updated;
24781
24781
  };
24782
- var copyWithDelete = function(obj, path7) {
24783
- return copyWithDeleteImpl(obj, path7, 0);
24782
+ var copyWithDelete = function(obj, path8) {
24783
+ return copyWithDeleteImpl(obj, path8, 0);
24784
24784
  };
24785
24785
  var copyWithRenameImpl = function(obj, oldPath, newPath, index2) {
24786
24786
  var oldKey = oldPath[index2];
@@ -24818,17 +24818,17 @@ var require_react_reconciler_development = __commonJS({
24818
24818
  }
24819
24819
  return copyWithRenameImpl(obj, oldPath, newPath, 0);
24820
24820
  };
24821
- var copyWithSetImpl = function(obj, path7, index2, value) {
24822
- if (index2 >= path7.length) {
24821
+ var copyWithSetImpl = function(obj, path8, index2, value) {
24822
+ if (index2 >= path8.length) {
24823
24823
  return value;
24824
24824
  }
24825
- var key = path7[index2];
24825
+ var key = path8[index2];
24826
24826
  var updated = isArray(obj) ? obj.slice() : assign({}, obj);
24827
- updated[key] = copyWithSetImpl(obj[key], path7, index2 + 1, value);
24827
+ updated[key] = copyWithSetImpl(obj[key], path8, index2 + 1, value);
24828
24828
  return updated;
24829
24829
  };
24830
- var copyWithSet = function(obj, path7, value) {
24831
- return copyWithSetImpl(obj, path7, 0, value);
24830
+ var copyWithSet = function(obj, path8, value) {
24831
+ return copyWithSetImpl(obj, path8, 0, value);
24832
24832
  };
24833
24833
  var findHook = function(fiber, id) {
24834
24834
  var currentHook2 = fiber.memoizedState;
@@ -24838,10 +24838,10 @@ var require_react_reconciler_development = __commonJS({
24838
24838
  }
24839
24839
  return currentHook2;
24840
24840
  };
24841
- overrideHookState = function(fiber, id, path7, value) {
24841
+ overrideHookState = function(fiber, id, path8, value) {
24842
24842
  var hook = findHook(fiber, id);
24843
24843
  if (hook !== null) {
24844
- var newState = copyWithSet(hook.memoizedState, path7, value);
24844
+ var newState = copyWithSet(hook.memoizedState, path8, value);
24845
24845
  hook.memoizedState = newState;
24846
24846
  hook.baseState = newState;
24847
24847
  fiber.memoizedProps = assign({}, fiber.memoizedProps);
@@ -24851,10 +24851,10 @@ var require_react_reconciler_development = __commonJS({
24851
24851
  }
24852
24852
  }
24853
24853
  };
24854
- overrideHookStateDeletePath = function(fiber, id, path7) {
24854
+ overrideHookStateDeletePath = function(fiber, id, path8) {
24855
24855
  var hook = findHook(fiber, id);
24856
24856
  if (hook !== null) {
24857
- var newState = copyWithDelete(hook.memoizedState, path7);
24857
+ var newState = copyWithDelete(hook.memoizedState, path8);
24858
24858
  hook.memoizedState = newState;
24859
24859
  hook.baseState = newState;
24860
24860
  fiber.memoizedProps = assign({}, fiber.memoizedProps);
@@ -24877,8 +24877,8 @@ var require_react_reconciler_development = __commonJS({
24877
24877
  }
24878
24878
  }
24879
24879
  };
24880
- overrideProps = function(fiber, path7, value) {
24881
- fiber.pendingProps = copyWithSet(fiber.memoizedProps, path7, value);
24880
+ overrideProps = function(fiber, path8, value) {
24881
+ fiber.pendingProps = copyWithSet(fiber.memoizedProps, path8, value);
24882
24882
  if (fiber.alternate) {
24883
24883
  fiber.alternate.pendingProps = fiber.pendingProps;
24884
24884
  }
@@ -24887,8 +24887,8 @@ var require_react_reconciler_development = __commonJS({
24887
24887
  scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
24888
24888
  }
24889
24889
  };
24890
- overridePropsDeletePath = function(fiber, path7) {
24891
- fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path7);
24890
+ overridePropsDeletePath = function(fiber, path8) {
24891
+ fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path8);
24892
24892
  if (fiber.alternate) {
24893
24893
  fiber.alternate.pendingProps = fiber.pendingProps;
24894
24894
  }
@@ -32281,7 +32281,7 @@ var init_Text = __esm({
32281
32281
  });
32282
32282
 
32283
32283
  // node_modules/ink/build/components/ErrorOverview.js
32284
- import * as fs10 from "node:fs";
32284
+ import * as fs11 from "node:fs";
32285
32285
  import { cwd } from "node:process";
32286
32286
  function ErrorOverview({ error }) {
32287
32287
  const stack = error.stack ? error.stack.split("\n").slice(1) : void 0;
@@ -32289,8 +32289,8 @@ function ErrorOverview({ error }) {
32289
32289
  const filePath = cleanupPath(origin?.file);
32290
32290
  let excerpt;
32291
32291
  let lineWidth = 0;
32292
- if (filePath && origin?.line && fs10.existsSync(filePath)) {
32293
- const sourceCode = fs10.readFileSync(filePath, "utf8");
32292
+ if (filePath && origin?.line && fs11.existsSync(filePath)) {
32293
+ const sourceCode = fs11.readFileSync(filePath, "utf8");
32294
32294
  excerpt = dist_default3(sourceCode, origin.line);
32295
32295
  if (excerpt) {
32296
32296
  for (const { line } of excerpt) {
@@ -32385,8 +32385,8 @@ var init_ErrorOverview = __esm({
32385
32385
  init_dist3();
32386
32386
  init_Box();
32387
32387
  init_Text();
32388
- cleanupPath = (path7) => {
32389
- return path7?.replace(`file://${cwd()}/`, "");
32388
+ cleanupPath = (path8) => {
32389
+ return path8?.replace(`file://${cwd()}/`, "");
32390
32390
  };
32391
32391
  stackUtils = new import_stack_utils.default({
32392
32392
  cwd: cwd(),
@@ -36738,11 +36738,11 @@ function maybeAutoUpdateManagedEnv({
36738
36738
  }
36739
36739
 
36740
36740
  // src/tui.js
36741
- import fs11 from "node:fs";
36741
+ import fs12 from "node:fs";
36742
36742
  import readlinePromises from "node:readline/promises";
36743
36743
 
36744
36744
  // src/version.js
36745
- var CLI_VERSION = true ? "0.0.10" : process.env.npm_package_version || "0.0.0-dev";
36745
+ var CLI_VERSION = true ? "0.0.11" : process.env.npm_package_version || "0.0.0-dev";
36746
36746
 
36747
36747
  // src/npm-update.js
36748
36748
  var NPM_CHECK_INTERVAL_MS = 30 * 60 * 1e3;
@@ -37094,6 +37094,7 @@ function initialServeState() {
37094
37094
  logs: [],
37095
37095
  agentLogs: {},
37096
37096
  // per-agent logs keyed by relativePath
37097
+ agentRunState: {},
37097
37098
  newAgents: [],
37098
37099
  stopped: false,
37099
37100
  jobsRun: 0
@@ -37147,9 +37148,15 @@ function applyServeEvent(state, event) {
37147
37148
  return { ...next, activity: `Preparing ${agentLabel(event)}` };
37148
37149
  }
37149
37150
  if (event.type === "agent_prepare_completed") {
37151
+ const runState = event.status === "error" ? setAgentRunState(state.agentRunState, agentLabel(event), {
37152
+ status: "error",
37153
+ lastEventAt: event.timestamp || (/* @__PURE__ */ new Date()).toISOString(),
37154
+ errorMessage: stringValue(event.error || event.errorMessage || "Agent setup failed")
37155
+ }) : state.agentRunState;
37150
37156
  return {
37151
37157
  ...next,
37152
37158
  activity: `${agentLabel(event)} ${event.status === "error" ? "needs setup" : "ready"}`,
37159
+ agentRunState: runState,
37153
37160
  errors: event.error ? appendError(state.errors, agentLabel(event), event.error) : state.errors
37154
37161
  };
37155
37162
  }
@@ -37160,19 +37167,47 @@ function applyServeEvent(state, event) {
37160
37167
  ...next,
37161
37168
  agents,
37162
37169
  newAgents,
37170
+ agentRunState: reconcileInventoryRunState(state.agentRunState, agents, event.timestamp),
37163
37171
  activity: newAgents.length ? `${newAgents.length} new agent${newAgents.length === 1 ? "" : "s"} synced` : `Inventory synced (${Number(event.agentCount ?? agents.length ?? 0)} agent(s))`
37164
37172
  };
37165
37173
  }
37166
37174
  if (event.type === "job_started") {
37175
+ const relativePath = agentLabel(event);
37176
+ const timestamp = event.timestamp || (/* @__PURE__ */ new Date()).toISOString();
37167
37177
  return {
37168
37178
  ...next,
37179
+ agentLogs: appendAgentLog(state.agentLogs, event),
37180
+ agentRunState: setAgentRunState(state.agentRunState, relativePath, {
37181
+ status: "running",
37182
+ runId: stringValue(event.runId || event.deployRequestId),
37183
+ jobType: stringValue(event.jobType || "run"),
37184
+ startedAt: timestamp,
37185
+ completedAt: null,
37186
+ lastEventAt: timestamp,
37187
+ errorMessage: null
37188
+ }),
37169
37189
  currentJob: event,
37170
37190
  activity: `Running ${jobLabel(event)}`
37171
37191
  };
37172
37192
  }
37173
37193
  if (event.type === "job_completed") {
37194
+ const relativePath = agentLabel(event);
37195
+ const timestamp = event.timestamp || (/* @__PURE__ */ new Date()).toISOString();
37196
+ const success = event.success !== false;
37197
+ const runId = stringValue(event.runId || event.deployRequestId);
37198
+ const previous = (state.agentRunState || {})[relativePath];
37199
+ const effectiveSuccess = success && !(previous?.status === "error" && previous?.runId === runId);
37174
37200
  return {
37175
37201
  ...next,
37202
+ agentLogs: appendAgentLog(state.agentLogs, event),
37203
+ agentRunState: setAgentRunState(state.agentRunState, relativePath, {
37204
+ status: effectiveSuccess ? "completed" : "error",
37205
+ runId,
37206
+ jobType: stringValue(event.jobType || "run"),
37207
+ completedAt: timestamp,
37208
+ lastEventAt: timestamp,
37209
+ errorMessage: effectiveSuccess ? null : previous?.errorMessage || stringValue(event.error || "Job failed")
37210
+ }),
37176
37211
  jobsRun: state.jobsRun + 1,
37177
37212
  currentJob: null,
37178
37213
  activity: `${jobLabel(event)} completed`
@@ -37188,8 +37223,20 @@ function applyServeEvent(state, event) {
37188
37223
  return { ...next, retry: event, activity: `Retrying ${stringValue(event.activity)} in ${formatSeconds(event.delaySeconds)}` };
37189
37224
  }
37190
37225
  if (event.type === "error") {
37226
+ const relativePath = event.relativePath || event.path ? agentLabel(event) : "";
37227
+ const timestamp = event.timestamp || (/* @__PURE__ */ new Date()).toISOString();
37228
+ const hasAgentScope = Boolean(relativePath);
37191
37229
  return {
37192
37230
  ...next,
37231
+ agentLogs: hasAgentScope ? appendAgentLog(state.agentLogs, event) : state.agentLogs,
37232
+ agentRunState: hasAgentScope ? setAgentRunState(state.agentRunState, relativePath, {
37233
+ status: "error",
37234
+ runId: stringValue(event.runId || event.deployRequestId),
37235
+ jobType: stringValue(event.jobType || "run"),
37236
+ completedAt: timestamp,
37237
+ lastEventAt: timestamp,
37238
+ errorMessage: stringValue(event.error || event.code || "Unknown error")
37239
+ }) : state.agentRunState,
37193
37240
  activity: "Error",
37194
37241
  errors: appendError(state.errors, jobLabel(event), event.error || event.code || "Unknown error")
37195
37242
  };
@@ -37205,9 +37252,21 @@ function applyServeEvent(state, event) {
37205
37252
  };
37206
37253
  }
37207
37254
  if (event.type === "run_log") {
37255
+ const entry = serveEventAgentLogEntry(event);
37256
+ const nextRunState = entry && entry.entry.eventType === "completion" ? setAgentRunState(state.agentRunState, entry.relativePath, {
37257
+ status: entry.entry.success === false ? "error" : "completed",
37258
+ runId: entry.entry.runId,
37259
+ completedAt: entry.entry.timestamp,
37260
+ lastEventAt: entry.entry.timestamp,
37261
+ errorMessage: entry.entry.success === false ? formatErrorMessage(entry.entry.error) : null
37262
+ }) : entry ? setAgentRunState(state.agentRunState, entry.relativePath, {
37263
+ runId: entry.entry.runId,
37264
+ lastEventAt: entry.entry.timestamp
37265
+ }) : state.agentRunState;
37208
37266
  return {
37209
37267
  ...next,
37210
- agentLogs: appendAgentLog(state.agentLogs, event)
37268
+ agentLogs: appendAgentLog(state.agentLogs, event),
37269
+ agentRunState: nextRunState
37211
37270
  };
37212
37271
  }
37213
37272
  return next;
@@ -37232,31 +37291,240 @@ function appendLog(logs, event) {
37232
37291
  return [...logs, event].slice(-200);
37233
37292
  }
37234
37293
  function appendAgentLog(agentLogs, event) {
37235
- const key = stringValue(event.relativePath || ".");
37294
+ const normalized = serveEventAgentLogEntry(event);
37295
+ if (!normalized) {
37296
+ return agentLogs || {};
37297
+ }
37298
+ const key = normalized.relativePath;
37236
37299
  const existing = agentLogs[key] || [];
37237
- const entry = {
37238
- timestamp: event.timestamp || (/* @__PURE__ */ new Date()).toISOString(),
37239
- runId: stringValue(event.runId),
37240
- eventType: stringValue(event.eventType),
37241
- level: stringValue(event.level || "info"),
37242
- message: stringValue(event.message),
37243
- stepId: event.stepId ? stringValue(event.stepId) : null,
37244
- current: event.current ?? null,
37245
- total: event.total ?? null,
37246
- success: event.success ?? null,
37247
- error: event.error ?? null
37248
- };
37249
37300
  return {
37250
37301
  ...agentLogs,
37251
- [key]: [...existing, entry].slice(-100)
37302
+ [key]: [...existing, normalized.entry].slice(-5e3)
37252
37303
  };
37253
37304
  }
37254
37305
  function agentLogEntries(agentLogs, relativePath) {
37255
37306
  return (agentLogs || {})[relativePath] || [];
37256
37307
  }
37308
+ function mergeAgentLogRecords(agentLogs, records = []) {
37309
+ let next = agentLogs || {};
37310
+ for (const record of records) {
37311
+ if (!record || typeof record !== "object") continue;
37312
+ const relativePath = stringValue(record.relativePath || ".");
37313
+ const entry = record.entry && typeof record.entry === "object" ? record.entry : record;
37314
+ const existing = next[relativePath] || [];
37315
+ next = {
37316
+ ...next,
37317
+ [relativePath]: [...existing, normalizeStoredAgentLogEntry(entry)].slice(-5e3)
37318
+ };
37319
+ }
37320
+ return next;
37321
+ }
37322
+ function agentRunStateFromLogs(agentLogs, { includeRunning = true } = {}) {
37323
+ let next = {};
37324
+ for (const [relativePath, entries] of Object.entries(agentLogs || {})) {
37325
+ for (const entry of entries || []) {
37326
+ const timestamp = entry.timestamp || (/* @__PURE__ */ new Date()).toISOString();
37327
+ const runId = stringValue(entry.runId);
37328
+ const current = next[relativePath] || {};
37329
+ if (entry.eventType === "job_started") {
37330
+ next = setAgentRunState(next, relativePath, {
37331
+ status: includeRunning ? "running" : current.status,
37332
+ runId,
37333
+ jobType: entry.jobType ? stringValue(entry.jobType) : current.jobType,
37334
+ startedAt: timestamp,
37335
+ lastEventAt: timestamp
37336
+ });
37337
+ continue;
37338
+ }
37339
+ if (entry.eventType === "completion" || entry.eventType === "job_completed") {
37340
+ const failed = entry.success === false || current.status === "error" && current.runId === runId;
37341
+ next = setAgentRunState(next, relativePath, {
37342
+ status: failed ? "error" : "completed",
37343
+ runId,
37344
+ jobType: entry.jobType ? stringValue(entry.jobType) : current.jobType,
37345
+ completedAt: timestamp,
37346
+ lastEventAt: timestamp,
37347
+ errorMessage: failed ? formatErrorMessage(entry.error) || current.errorMessage || stringValue(entry.message || "Job failed") : null
37348
+ });
37349
+ continue;
37350
+ }
37351
+ if (entry.eventType === "error" || entry.level === "error" && entry.success === false) {
37352
+ next = setAgentRunState(next, relativePath, {
37353
+ status: "error",
37354
+ runId,
37355
+ jobType: entry.jobType ? stringValue(entry.jobType) : current.jobType,
37356
+ completedAt: timestamp,
37357
+ lastEventAt: timestamp,
37358
+ errorMessage: formatErrorMessage(entry.error) || stringValue(entry.message || "Job failed")
37359
+ });
37360
+ continue;
37361
+ }
37362
+ if (runId || timestamp) {
37363
+ next = setAgentRunState(next, relativePath, {
37364
+ runId: runId || current.runId,
37365
+ lastEventAt: timestamp
37366
+ });
37367
+ }
37368
+ }
37369
+ }
37370
+ return next;
37371
+ }
37372
+ function serveEventAgentLogEntry(event) {
37373
+ if (!event || typeof event !== "object") {
37374
+ return null;
37375
+ }
37376
+ const type = stringValue(event.type);
37377
+ const relativePath = stringValue(event.relativePath || event.path || ".");
37378
+ const timestamp = event.timestamp || (/* @__PURE__ */ new Date()).toISOString();
37379
+ if (type === "run_log") {
37380
+ return {
37381
+ relativePath,
37382
+ entry: {
37383
+ timestamp,
37384
+ runId: stringValue(event.runId),
37385
+ eventType: stringValue(event.eventType || "log"),
37386
+ level: stringValue(event.level || "info"),
37387
+ message: stringValue(event.message),
37388
+ stepId: event.stepId ? stringValue(event.stepId) : null,
37389
+ current: event.current ?? null,
37390
+ total: event.total ?? null,
37391
+ success: event.success ?? null,
37392
+ error: event.error ?? null,
37393
+ jobType: event.jobType ? stringValue(event.jobType) : null
37394
+ }
37395
+ };
37396
+ }
37397
+ if (type === "job_started") {
37398
+ const jobType = stringValue(event.jobType || "run");
37399
+ return {
37400
+ relativePath,
37401
+ entry: {
37402
+ timestamp,
37403
+ runId: stringValue(event.runId || event.deployRequestId),
37404
+ eventType: "job_started",
37405
+ level: "info",
37406
+ message: `Started ${jobType}`,
37407
+ stepId: null,
37408
+ current: null,
37409
+ total: null,
37410
+ success: null,
37411
+ error: null,
37412
+ jobType
37413
+ }
37414
+ };
37415
+ }
37416
+ if (type === "job_completed") {
37417
+ const success = event.success !== false;
37418
+ const jobType = stringValue(event.jobType || "run");
37419
+ return {
37420
+ relativePath,
37421
+ entry: {
37422
+ timestamp,
37423
+ runId: stringValue(event.runId || event.deployRequestId),
37424
+ eventType: "job_completed",
37425
+ level: success ? "info" : "error",
37426
+ message: success ? "Completed successfully" : stringValue(event.error || "Failed"),
37427
+ stepId: null,
37428
+ current: null,
37429
+ total: null,
37430
+ success,
37431
+ error: event.error ?? null,
37432
+ jobType
37433
+ }
37434
+ };
37435
+ }
37436
+ if (type === "error" && (event.relativePath || event.path)) {
37437
+ return {
37438
+ relativePath,
37439
+ entry: {
37440
+ timestamp,
37441
+ runId: stringValue(event.runId || event.deployRequestId),
37442
+ eventType: "error",
37443
+ level: "error",
37444
+ message: stringValue(event.error || event.code || "Unknown error"),
37445
+ stepId: null,
37446
+ current: null,
37447
+ total: null,
37448
+ success: false,
37449
+ error: event.error ?? event.code ?? null,
37450
+ jobType: event.jobType ? stringValue(event.jobType) : null
37451
+ }
37452
+ };
37453
+ }
37454
+ return null;
37455
+ }
37456
+ function agentRuntimeStatus(agent, agentRunState = {}) {
37457
+ const path8 = stringValue(agent?.relativePath || ".");
37458
+ const run2 = (agentRunState || {})[path8];
37459
+ const inventoryStatus = stringValue(agent?.status);
37460
+ if (run2?.status === "running") {
37461
+ return { status: "running", label: "running", run: run2 };
37462
+ }
37463
+ if (run2?.status === "error" || inventoryStatus === "error") {
37464
+ return { status: "error", label: "error", run: run2 };
37465
+ }
37466
+ if (inventoryStatus === "online") {
37467
+ return { status: run2?.status === "completed" ? "completed" : "ready", label: "ready", run: run2 };
37468
+ }
37469
+ if (run2?.status === "completed") {
37470
+ return { status: "completed", label: "ready", run: run2 };
37471
+ }
37472
+ return { status: inventoryStatus || "unknown", label: inventoryStatus || "unknown", run: run2 };
37473
+ }
37257
37474
  function appendError(errors, scope, message) {
37258
37475
  return [...errors, { scope, message: stringValue(message) }].slice(-20);
37259
37476
  }
37477
+ function setAgentRunState(agentRunState, relativePath, patch) {
37478
+ const key = stringValue(relativePath || ".");
37479
+ return {
37480
+ ...agentRunState || {},
37481
+ [key]: {
37482
+ ...(agentRunState || {})[key] || {},
37483
+ ...patch
37484
+ }
37485
+ };
37486
+ }
37487
+ function reconcileInventoryRunState(agentRunState, agents, timestamp) {
37488
+ let next = agentRunState || {};
37489
+ for (const agent of agents || []) {
37490
+ const path8 = stringValue(agent?.relativePath || ".");
37491
+ const current = next[path8];
37492
+ if (agent?.status === "error") {
37493
+ next = setAgentRunState(next, path8, {
37494
+ status: "error",
37495
+ lastEventAt: timestamp || (/* @__PURE__ */ new Date()).toISOString(),
37496
+ errorMessage: stringValue(agent.errorMessage || agent.error || "Agent setup failed")
37497
+ });
37498
+ } else if (agent?.status === "online" && current?.status === "error" && !current?.runId) {
37499
+ next = setAgentRunState(next, path8, {
37500
+ status: "ready",
37501
+ lastEventAt: timestamp || (/* @__PURE__ */ new Date()).toISOString(),
37502
+ errorMessage: null
37503
+ });
37504
+ }
37505
+ }
37506
+ return next;
37507
+ }
37508
+ function normalizeStoredAgentLogEntry(entry) {
37509
+ return {
37510
+ timestamp: entry.timestamp || (/* @__PURE__ */ new Date()).toISOString(),
37511
+ runId: stringValue(entry.runId),
37512
+ eventType: stringValue(entry.eventType || "log"),
37513
+ level: stringValue(entry.level || "info"),
37514
+ message: stringValue(entry.message),
37515
+ stepId: entry.stepId ? stringValue(entry.stepId) : null,
37516
+ current: entry.current ?? null,
37517
+ total: entry.total ?? null,
37518
+ success: entry.success ?? null,
37519
+ error: entry.error ?? null,
37520
+ jobType: entry.jobType ? stringValue(entry.jobType) : null
37521
+ };
37522
+ }
37523
+ function formatErrorMessage(error) {
37524
+ if (!error) return null;
37525
+ if (typeof error === "object") return stringValue(error.message || "error");
37526
+ return stringValue(error);
37527
+ }
37260
37528
  function findNewAgents(previous, next) {
37261
37529
  const seen = new Set(previous.map(agentKey).filter(Boolean));
37262
37530
  return next.filter((agent) => {
@@ -37314,6 +37582,114 @@ function buildLocalServeEventStreamArgs({ agentsDir = "./agents", collectionId =
37314
37582
  return args;
37315
37583
  }
37316
37584
 
37585
+ // src/serve-log-store.js
37586
+ import crypto2 from "node:crypto";
37587
+ import fs10 from "node:fs";
37588
+ import path7 from "node:path";
37589
+ var MAX_EVENTS = 5e3;
37590
+ var MAX_RUNS = 50;
37591
+ function createServeLogStore({
37592
+ agentsDir = "./agents",
37593
+ collectionId = "",
37594
+ env: env3 = process.env,
37595
+ platform: platform2 = process.platform
37596
+ } = {}) {
37597
+ const file = serveLogFilePath({ agentsDir, collectionId, env: env3, platform: platform2 });
37598
+ let appendCount = 0;
37599
+ return {
37600
+ file,
37601
+ load() {
37602
+ return readServeLogRecords(file);
37603
+ },
37604
+ append(event) {
37605
+ const normalized = serveEventAgentLogEntry(event);
37606
+ if (!normalized) {
37607
+ return false;
37608
+ }
37609
+ fs10.mkdirSync(path7.dirname(file), { recursive: true });
37610
+ const record = {
37611
+ version: 1,
37612
+ collectionId: collectionId || "",
37613
+ agentsDir: String(agentsDir || "./agents"),
37614
+ relativePath: normalized.relativePath,
37615
+ entry: normalized.entry
37616
+ };
37617
+ fs10.appendFileSync(file, `${JSON.stringify(record)}
37618
+ `, "utf8");
37619
+ appendCount += 1;
37620
+ if (appendCount % 50 === 0) {
37621
+ compactServeLogFile(file);
37622
+ }
37623
+ return true;
37624
+ },
37625
+ compact() {
37626
+ compactServeLogFile(file);
37627
+ }
37628
+ };
37629
+ }
37630
+ function serveLogFilePath({
37631
+ agentsDir = "./agents",
37632
+ collectionId = "",
37633
+ env: env3 = process.env,
37634
+ platform: platform2 = process.platform
37635
+ } = {}) {
37636
+ const root = vendianHome(env3, platform2);
37637
+ const resolvedAgentsDir = path7.resolve(String(agentsDir || "./agents"));
37638
+ const hash = crypto2.createHash("sha256").update(`${collectionId || "default"}\0${resolvedAgentsDir}`).digest("hex").slice(0, 16);
37639
+ return path7.join(root, "serve-logs", `${safePathPart(collectionId || "default")}-${hash}.jsonl`);
37640
+ }
37641
+ function readServeLogRecords(file) {
37642
+ if (!file || !fs10.existsSync(file)) {
37643
+ return [];
37644
+ }
37645
+ const records = [];
37646
+ const lines = fs10.readFileSync(file, "utf8").split(/\r?\n/);
37647
+ for (const line of lines) {
37648
+ const value = line.trim();
37649
+ if (!value) continue;
37650
+ try {
37651
+ const record = JSON.parse(value);
37652
+ if (record && typeof record === "object" && record.entry && record.relativePath) {
37653
+ records.push({ relativePath: String(record.relativePath), entry: record.entry });
37654
+ }
37655
+ } catch {
37656
+ }
37657
+ }
37658
+ return trimServeLogRecords(records);
37659
+ }
37660
+ function compactServeLogFile(file) {
37661
+ if (!file || !fs10.existsSync(file)) {
37662
+ return;
37663
+ }
37664
+ const records = readServeLogRecords(file);
37665
+ const tmp = `${file}.tmp`;
37666
+ fs10.writeFileSync(
37667
+ tmp,
37668
+ records.map((record) => JSON.stringify({ version: 1, ...record })).join("\n") + (records.length ? "\n" : ""),
37669
+ "utf8"
37670
+ );
37671
+ fs10.renameSync(tmp, file);
37672
+ }
37673
+ function trimServeLogRecords(records) {
37674
+ const runIds = [];
37675
+ const seen = /* @__PURE__ */ new Set();
37676
+ for (const record of records) {
37677
+ const runId = String(record.entry?.runId || "");
37678
+ if (runId && !seen.has(runId)) {
37679
+ seen.add(runId);
37680
+ runIds.push(runId);
37681
+ }
37682
+ }
37683
+ const keepRuns = new Set(runIds.slice(-MAX_RUNS));
37684
+ return records.filter((record) => {
37685
+ const runId = String(record.entry?.runId || "");
37686
+ return !runId || keepRuns.has(runId);
37687
+ }).slice(-MAX_EVENTS);
37688
+ }
37689
+ function safePathPart(value) {
37690
+ return String(value || "default").replace(/[^a-zA-Z0-9_.-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80) || "default";
37691
+ }
37692
+
37317
37693
  // src/workspaces.js
37318
37694
  async function listCloudWorkspaces({
37319
37695
  env: env3 = process.env,
@@ -37558,7 +37934,7 @@ function runtimeSummary({ env: env3 = process.env, platform: platform2 = process
37558
37934
  const config = loadConfig(env3, platform2);
37559
37935
  const venvPath = managedVenvPath(env3, platform2);
37560
37936
  const vendianPath = venvVendian(venvPath, platform2);
37561
- const installed = fs11.existsSync(vendianPath);
37937
+ const installed = fs12.existsSync(vendianPath);
37562
37938
  const lastUpdate = Date.parse(config.lastManagedUpdateAt || "");
37563
37939
  const stale = !Number.isFinite(lastUpdate) || now - lastUpdate > 24 * 60 * 60 * 1e3;
37564
37940
  return {
@@ -37969,11 +38345,26 @@ function ServeScreen({ env: env3, platform: platform2, input, onBack, onState, o
37969
38345
  setStarted(true);
37970
38346
  setStartupError("");
37971
38347
  try {
38348
+ const logStore = createServeLogStore({ agentsDir: serveRoot, collectionId, env: env3, platform: platform2 });
38349
+ const historicalLogs = logStore.load();
38350
+ if (historicalLogs.length > 0) {
38351
+ setState((current) => {
38352
+ const agentLogs = mergeAgentLogRecords(current.agentLogs, historicalLogs);
38353
+ return {
38354
+ ...current,
38355
+ agentLogs,
38356
+ agentRunState: {
38357
+ ...agentRunStateFromLogs(agentLogs, { includeRunning: false }),
38358
+ ...current.agentRunState
38359
+ }
38360
+ };
38361
+ });
38362
+ }
37972
38363
  const nextChild = await spawnLocalServeEventStream({ agentsDir: serveRoot, collectionId, env: env3, platform: platform2 });
37973
38364
  setChild(nextChild);
37974
38365
  attachServeChild(nextChild, setState, setStartupError, ({ message } = {}) => {
37975
38366
  setState((current) => current.stopped ? current : { ...current, stopped: true, activity: message ? "Runtime update required" : "Process exited" });
37976
- });
38367
+ }, logStore);
37977
38368
  } catch (error) {
37978
38369
  setStartupError(errorMessage2(error));
37979
38370
  }
@@ -38089,8 +38480,9 @@ function ServeScreen({ env: env3, platform: platform2, input, onBack, onState, o
38089
38480
  h(AgentLogViewer, {
38090
38481
  agents: state.agents,
38091
38482
  agentLogs: state.agentLogs,
38483
+ agentRunState: state.agentRunState,
38092
38484
  logMode,
38093
- onSelectAgent: (path7) => setLogMode(path7),
38485
+ onSelectAgent: (path8) => setLogMode(path8),
38094
38486
  onBack: () => {
38095
38487
  if (logMode === "picker") {
38096
38488
  setLogMode(null);
@@ -38127,7 +38519,7 @@ function ServeScreen({ env: env3, platform: platform2, input, onBack, onState, o
38127
38519
  { color: colors.success },
38128
38520
  ` ${fig.check} New agents synced automatically: ${state.newAgents.map((agent) => agent.relativePath || agent.manifestName || agent.path || "agent").join(", ")}`
38129
38521
  ),
38130
- h(AgentTable, { agents: state.agents }),
38522
+ h(AgentTable, { agents: state.agents, agentRunState: state.agentRunState }),
38131
38523
  state.retry && h(Text2, { color: colors.warning }, ` ${fig.warning} Retry: ${state.retry.activity} in ${Number(state.retry.delaySeconds || 0).toFixed(1)}s`),
38132
38524
  state.errors.length > 0 && h(
38133
38525
  Box2,
@@ -38150,7 +38542,7 @@ function ServeScreen({ env: env3, platform: platform2, input, onBack, onState, o
38150
38542
  exitArmed && h(Text2, { color: colors.warning, bold: true }, " Press Ctrl+C again to exit.")
38151
38543
  );
38152
38544
  }
38153
- function AgentTable({ agents }) {
38545
+ function AgentTable({ agents, agentRunState = {} }) {
38154
38546
  if (!agents.length) {
38155
38547
  return h(Text2, { color: colors.muted }, ` ${fig.dotEmpty} No agents discovered yet.`);
38156
38548
  }
@@ -38162,17 +38554,18 @@ function AgentTable({ agents }) {
38162
38554
  const headerLine = ` ${"Path".padEnd(pathW)} ${"Name".padEnd(nameW)} ${"Creds".padEnd(credW)} ${"Status".padEnd(statusW)}`;
38163
38555
  const separator = ` ${fig.horizontal.repeat(pathW + nameW + credW + statusW + 3)}`;
38164
38556
  const rows = agents.slice(0, 16).map((agent) => {
38165
- const path7 = clip(agent.relativePath || ".", pathW);
38557
+ const path8 = clip(agent.relativePath || ".", pathW);
38166
38558
  const name = clip(agent.manifestName || agent.manifest?.name || "-", nameW);
38167
38559
  const creds = credentialLabel(agent);
38168
- const status = String(agent.status || "-");
38169
- const statusColor = status === "online" ? colors.success : status === "error" ? colors.error : colors.warning;
38170
- const statusIcon = status === "online" ? fig.dot : status === "error" ? fig.cross : fig.dotEmpty;
38560
+ const runtime = agentRuntimeStatus(agent, agentRunState);
38561
+ const status = runtime.label || "-";
38562
+ const statusColor = runtimeStatusColor(runtime.status);
38563
+ const statusIcon = runtimeStatusIcon(runtime.status);
38171
38564
  return h(
38172
38565
  Text2,
38173
38566
  { key: agent.localAgentId || agent.relativePath },
38174
38567
  h(Text2, { color: colors.muted }, " "),
38175
- h(Text2, null, path7.padEnd(pathW)),
38568
+ h(Text2, null, path8.padEnd(pathW)),
38176
38569
  h(Text2, null, " "),
38177
38570
  h(Text2, null, name.padEnd(nameW)),
38178
38571
  h(Text2, null, " "),
@@ -38191,6 +38584,18 @@ function AgentTable({ agents }) {
38191
38584
  hiddenCount > 0 && h(Text2, { color: colors.muted }, ` ${fig.ellipsis} and ${hiddenCount} more`)
38192
38585
  );
38193
38586
  }
38587
+ function runtimeStatusColor(status) {
38588
+ if (status === "running") return colors.accent;
38589
+ if (status === "ready" || status === "completed") return colors.success;
38590
+ if (status === "error") return colors.error;
38591
+ return colors.warning;
38592
+ }
38593
+ function runtimeStatusIcon(status) {
38594
+ if (status === "running") return fig.arrow;
38595
+ if (status === "ready" || status === "completed") return fig.dot;
38596
+ if (status === "error") return fig.cross;
38597
+ return fig.dotEmpty;
38598
+ }
38194
38599
  function FooterBar({ items }) {
38195
38600
  if (!items || !items.length) return null;
38196
38601
  return h(
@@ -38204,39 +38609,39 @@ function FooterBar({ items }) {
38204
38609
  ]).flat().filter(Boolean)
38205
38610
  );
38206
38611
  }
38207
- function AgentLogViewer({ agents, agentLogs, logMode, onSelectAgent, onBack }) {
38612
+ function AgentLogViewer({ agents, agentLogs, agentRunState, logMode, onSelectAgent, onBack }) {
38208
38613
  if (logMode === "picker") {
38209
- return h(AgentLogPicker, { agents, agentLogs, onSelectAgent, onBack });
38614
+ return h(AgentLogPicker, { agents, agentLogs, agentRunState, onSelectAgent, onBack });
38210
38615
  }
38211
- return h(AgentLogDetail, { relativePath: logMode, agentLogs, agents, onBack });
38616
+ return h(AgentLogDetail, { relativePath: logMode, agentLogs, agentRunState, agents, onBack });
38212
38617
  }
38213
- function AgentLogPicker({ agents, agentLogs, onSelectAgent, onBack }) {
38618
+ function AgentLogPicker({ agents, agentLogs, agentRunState = {}, onSelectAgent, onBack }) {
38214
38619
  const [selectedIndex, setSelectedIndex] = useState5(0);
38215
38620
  const agentList = agents.map((agent) => {
38216
- const path7 = agent.relativePath || ".";
38217
- const logs = agentLogEntries(agentLogs, path7);
38621
+ const path8 = agent.relativePath || ".";
38622
+ const logs = agentLogEntries(agentLogs, path8);
38218
38623
  const lastLog = logs.length > 0 ? logs[logs.length - 1] : null;
38219
38624
  const hasErrors = logs.some((l) => l.level === "error" || l.eventType === "completion" && l.success === false);
38220
38625
  return {
38221
- path: path7,
38222
- name: agent.manifestName || agent.manifest?.name || path7,
38626
+ path: path8,
38627
+ name: agent.manifestName || agent.manifest?.name || path8,
38223
38628
  logCount: logs.length,
38224
38629
  lastLog,
38225
38630
  hasErrors,
38226
- status: agent.status || "-"
38631
+ status: agentRuntimeStatus(agent, agentRunState)
38227
38632
  };
38228
38633
  });
38229
38634
  const inventoryPaths = new Set(agentList.map((a) => a.path));
38230
- for (const path7 of Object.keys(agentLogs || {})) {
38231
- if (!inventoryPaths.has(path7)) {
38232
- const logs = agentLogEntries(agentLogs, path7);
38635
+ for (const path8 of Object.keys(agentLogs || {})) {
38636
+ if (!inventoryPaths.has(path8)) {
38637
+ const logs = agentLogEntries(agentLogs, path8);
38233
38638
  agentList.push({
38234
- path: path7,
38235
- name: path7,
38639
+ path: path8,
38640
+ name: path8,
38236
38641
  logCount: logs.length,
38237
38642
  lastLog: logs.length > 0 ? logs[logs.length - 1] : null,
38238
38643
  hasErrors: logs.some((l) => l.level === "error"),
38239
- status: "offline"
38644
+ status: { status: "unknown", label: "offline" }
38240
38645
  });
38241
38646
  }
38242
38647
  }
@@ -38265,14 +38670,15 @@ function AgentLogPicker({ agents, agentLogs, onSelectAgent, onBack }) {
38265
38670
  );
38266
38671
  }
38267
38672
  const pathW = 24;
38268
- const nameW = 26;
38673
+ const nameW = 24;
38674
+ const statusW = 10;
38269
38675
  return h(
38270
38676
  Box2,
38271
38677
  { flexDirection: "column" },
38272
38678
  h(Text2, { bold: true, color: colors.brand }, ` ${fig.horizontal.repeat(3)} Agent Logs ${fig.horizontal.repeat(20)}`),
38273
38679
  h(Text2, null, ""),
38274
- h(Text2, { color: colors.muted }, ` ${"Agent".padEnd(nameW)} ${"Logs".padEnd(6)} ${"Last event"}`),
38275
- h(Text2, { color: colors.muted }, ` ${fig.horizontal.repeat(nameW + 6 + 30)}`),
38680
+ h(Text2, { color: colors.muted }, ` ${"Agent".padEnd(nameW)} ${"Status".padEnd(statusW)} ${"Logs".padEnd(6)} ${"Last event"}`),
38681
+ h(Text2, { color: colors.muted }, ` ${fig.horizontal.repeat(nameW + statusW + 6 + 32)}`),
38276
38682
  ...agentList.map((agent, i) => {
38277
38683
  const isActive = i === selectedIndex;
38278
38684
  const logCountColor = agent.hasErrors ? colors.error : agent.logCount > 0 ? colors.success : colors.muted;
@@ -38282,6 +38688,7 @@ function AgentLogPicker({ agents, agentLogs, onSelectAgent, onBack }) {
38282
38688
  { key: agent.path },
38283
38689
  h(Text2, { color: isActive ? colors.accent : colors.muted }, isActive ? ` ${fig.arrow} ` : " "),
38284
38690
  h(Text2, { bold: isActive }, clip(agent.name, nameW - 2).padEnd(nameW)),
38691
+ h(Text2, { color: runtimeStatusColor(agent.status.status) }, `${runtimeStatusIcon(agent.status.status)} ${agent.status.label}`.padEnd(statusW)),
38285
38692
  h(Text2, { color: logCountColor }, String(agent.logCount).padEnd(6)),
38286
38693
  h(Text2, { color: colors.muted }, clip(lastEvent, 36))
38287
38694
  );
@@ -38294,10 +38701,11 @@ function AgentLogPicker({ agents, agentLogs, onSelectAgent, onBack }) {
38294
38701
  ] })
38295
38702
  );
38296
38703
  }
38297
- function AgentLogDetail({ relativePath, agentLogs, agents, onBack }) {
38704
+ function AgentLogDetail({ relativePath, agentLogs, agentRunState = {}, agents, onBack }) {
38298
38705
  const logs = agentLogEntries(agentLogs, relativePath);
38299
38706
  const agent = agents.find((a) => (a.relativePath || ".") === relativePath);
38300
38707
  const agentName = agent?.manifestName || agent?.manifest?.name || relativePath;
38708
+ const runtime = agent ? agentRuntimeStatus(agent, agentRunState) : { status: agentRunState?.[relativePath]?.status || "unknown", label: agentRunState?.[relativePath]?.status || "offline" };
38301
38709
  const [scrollOffset, setScrollOffset] = useState5(0);
38302
38710
  const visibleCount = Math.min(20, Math.max(8, (process.stdout.rows || 24) - 10));
38303
38711
  useInput2((input, key) => {
@@ -38315,29 +38723,44 @@ function AgentLogDetail({ relativePath, agentLogs, agents, onBack }) {
38315
38723
  });
38316
38724
  const effectiveOffset = logs.length <= visibleCount ? 0 : scrollOffset >= logs.length - visibleCount - 2 ? Math.max(0, logs.length - visibleCount) : scrollOffset;
38317
38725
  const visibleLogs = logs.slice(effectiveOffset, effectiveOffset + visibleCount);
38726
+ const visibleRows = groupedLogRows(visibleLogs, logs[effectiveOffset - 1]);
38727
+ const messageWidth = Math.max(50, Math.min((process.stdout.columns || 80) - 18, 120));
38318
38728
  return h(
38319
38729
  Box2,
38320
38730
  { flexDirection: "column" },
38321
38731
  h(Text2, { bold: true, color: colors.brand }, ` ${fig.horizontal.repeat(3)} ${agentName}`),
38322
- h(Text2, { color: colors.muted }, ` ${relativePath} ${fig.dash} ${logs.length} log entries`),
38732
+ h(
38733
+ Text2,
38734
+ null,
38735
+ h(Text2, { color: colors.muted }, ` ${relativePath} ${fig.dash} ${logs.length} log entries ${fig.dash} `),
38736
+ h(Text2, { color: runtimeStatusColor(runtime.status) }, `${runtimeStatusIcon(runtime.status)} ${runtime.label}`)
38737
+ ),
38323
38738
  h(Text2, null, ""),
38324
38739
  logs.length === 0 ? h(Text2, { color: colors.muted }, " No logs recorded yet for this agent. Logs appear during runs.") : h(
38325
38740
  Box2,
38326
38741
  { flexDirection: "column" },
38327
- ...visibleLogs.map((entry, i) => {
38742
+ ...visibleRows.map((row, i) => {
38743
+ if (row.type === "divider") {
38744
+ return h(
38745
+ Text2,
38746
+ { key: `divider-${effectiveOffset}-${i}`, color: colors.dim },
38747
+ ` ${fig.horizontal.repeat(3)} run ${clip(row.runId, 24)} ${fig.horizontal.repeat(12)}`
38748
+ );
38749
+ }
38750
+ const entry = row.entry;
38328
38751
  const levelColor = entry.level === "error" ? colors.error : entry.level === "warning" ? colors.warning : entry.level === "debug" ? colors.dim : colors.muted;
38329
38752
  const timeStr = formatLogTime(entry.timestamp);
38330
- const icon = entry.eventType === "completion" ? entry.success ? fig.check : fig.cross : entry.eventType === "step_event" ? fig.arrow : entry.eventType === "progress" ? fig.dotEmpty : entry.level === "error" ? fig.cross : fig.dash;
38331
- const iconColor = entry.eventType === "completion" ? entry.success ? colors.success : colors.error : levelColor;
38753
+ const icon = entry.eventType === "completion" ? entry.success ? fig.check : fig.cross : entry.eventType === "job_started" ? fig.arrow : entry.eventType === "job_completed" ? entry.success === false ? fig.cross : fig.check : entry.eventType === "step_event" ? fig.arrow : entry.eventType === "progress" ? fig.dotEmpty : entry.eventType === "error" || entry.level === "error" ? fig.cross : fig.dash;
38754
+ const iconColor = entry.eventType === "completion" ? entry.success ? colors.success : colors.error : entry.eventType === "job_started" ? colors.accent : entry.eventType === "job_completed" ? entry.success === false ? colors.error : colors.success : levelColor;
38332
38755
  return h(
38333
38756
  Text2,
38334
- { key: `${effectiveOffset + i}` },
38757
+ { key: `entry-${effectiveOffset}-${i}` },
38335
38758
  h(Text2, { color: colors.dim }, ` ${timeStr} `),
38336
38759
  h(Text2, { color: iconColor }, `${icon} `),
38337
38760
  h(
38338
38761
  Text2,
38339
38762
  { color: entry.level === "error" ? colors.error : colors.text },
38340
- clip(formatAgentLogEntry(entry), 60)
38763
+ clip(formatAgentLogEntry(entry), messageWidth)
38341
38764
  )
38342
38765
  );
38343
38766
  }),
@@ -38359,6 +38782,12 @@ function formatAgentLogEntry(entry) {
38359
38782
  if (!entry) return "";
38360
38783
  const type = entry.eventType || "";
38361
38784
  switch (type) {
38785
+ case "job_started":
38786
+ return entry.message || `Started ${entry.jobType || "run"}`;
38787
+ case "job_completed":
38788
+ return entry.success === false ? `Failed: ${formatEntryError(entry.error) || entry.message || "error"}` : entry.message || "Completed successfully";
38789
+ case "error":
38790
+ return `Error: ${entry.message || formatEntryError(entry.error) || "unknown error"}`;
38362
38791
  case "log":
38363
38792
  return entry.message || "";
38364
38793
  case "progress": {
@@ -38381,6 +38810,24 @@ function formatAgentLogEntry(entry) {
38381
38810
  return entry.message || type || "event";
38382
38811
  }
38383
38812
  }
38813
+ function groupedLogRows(logs, previousEntry) {
38814
+ const rows = [];
38815
+ let currentRunId = previousEntry?.runId || "";
38816
+ for (const entry of logs) {
38817
+ const runId = entry.runId || "";
38818
+ if (runId && runId !== currentRunId) {
38819
+ rows.push({ type: "divider", runId });
38820
+ currentRunId = runId;
38821
+ }
38822
+ rows.push({ type: "entry", entry });
38823
+ }
38824
+ return rows;
38825
+ }
38826
+ function formatEntryError(error) {
38827
+ if (!error) return "";
38828
+ if (typeof error === "object") return error.message || "error";
38829
+ return String(error);
38830
+ }
38384
38831
  function formatLogTime(timestamp) {
38385
38832
  if (!timestamp) return " ";
38386
38833
  try {
@@ -38526,7 +38973,7 @@ function BackHint({ onBack }) {
38526
38973
  });
38527
38974
  return null;
38528
38975
  }
38529
- function attachServeChild(child, setState, setStartupError, onExit) {
38976
+ function attachServeChild(child, setState, setStartupError, onExit, logStore = null) {
38530
38977
  let buffer = "";
38531
38978
  const stderrChunks = [];
38532
38979
  child.stdout.setEncoding("utf8");
@@ -38538,6 +38985,10 @@ function attachServeChild(child, setState, setStartupError, onExit) {
38538
38985
  try {
38539
38986
  const event = parseServeEventLine(line);
38540
38987
  if (event) {
38988
+ try {
38989
+ logStore?.append(event);
38990
+ } catch {
38991
+ }
38541
38992
  setState((current) => applyServeEvent(current, event));
38542
38993
  }
38543
38994
  } catch (error) {
@@ -38558,6 +39009,10 @@ function attachServeChild(child, setState, setStartupError, onExit) {
38558
39009
  });
38559
39010
  child.on("error", (error) => setStartupError(errorMessage2(error)));
38560
39011
  child.on("exit", (code, signal) => {
39012
+ try {
39013
+ logStore?.compact();
39014
+ } catch {
39015
+ }
38561
39016
  const message = serveProcessExitMessage({ stderr: stderrChunks.join("\n"), code, signal });
38562
39017
  if (message) {
38563
39018
  setStartupError(message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vendian/cli",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "Public Vendian CLI bootstrapper and launcher",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,