@inf-monkeys-tech/monkeys-design 1.0.10 → 1.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.
package/dist/index.js CHANGED
@@ -16935,6 +16935,29 @@ var EVENT_CAPABILITIES = {
16935
16935
  artifact: "artifacts",
16936
16936
  usage: "usage"
16937
16937
  };
16938
+ function projectRun(events) {
16939
+ const statuses = events.filter(
16940
+ (event) => event.eventType === "status"
16941
+ );
16942
+ const run = statuses.at(-1);
16943
+ if (!run) return void 0;
16944
+ if (run.payload.status !== "stopped" || run.payload.durationMs !== void 0) return run;
16945
+ const runStatuses = run.runId ? statuses.filter((event) => event.runId === run.runId && event.sequence <= run.sequence) : statuses.filter((event) => event.sequence <= run.sequence);
16946
+ let previousStoppedIndex = -1;
16947
+ for (let index = runStatuses.length - 1; index >= 0; index -= 1) {
16948
+ const event = runStatuses[index];
16949
+ if (event.sequence < run.sequence && event.payload.status === "stopped") {
16950
+ previousStoppedIndex = index;
16951
+ break;
16952
+ }
16953
+ }
16954
+ const started = runStatuses.slice(previousStoppedIndex + 1).reverse().find((event) => event.payload.status === "running" || event.payload.status === "queued");
16955
+ const startedAt = started?.payload.startedAt ?? started?.occurredAt;
16956
+ const stoppedAt = run.payload.stoppedAt ?? run.occurredAt;
16957
+ if (!startedAt || !stoppedAt) return run;
16958
+ const durationMs = Date.parse(stoppedAt) - Date.parse(startedAt);
16959
+ return Number.isFinite(durationMs) && durationMs >= 0 ? { ...run, resolvedDurationMs: durationMs } : run;
16960
+ }
16938
16961
  function isVisible(event, capabilities) {
16939
16962
  const capability = EVENT_CAPABILITIES[event.eventType];
16940
16963
  return capability ? capabilities[capability] === true : true;
@@ -16990,9 +17013,7 @@ function createAgentWorkbenchActivityModel(viewModel) {
16990
17013
  usage: [...visibleEvents].reverse().find(
16991
17014
  (event) => event.eventType === "usage"
16992
17015
  ),
16993
- run: [...visibleEvents].reverse().find(
16994
- (event) => event.eventType === "status"
16995
- )
17016
+ run: projectRun(visibleEvents)
16996
17017
  };
16997
17018
  }
16998
17019
  function JsonValue({ value, className }) {
@@ -17171,7 +17192,9 @@ function formatDuration2(durationMs) {
17171
17192
  const seconds = totalSeconds % 60;
17172
17193
  return minutes > 0 ? `${minutes}m ${seconds}s` : `${seconds}s`;
17173
17194
  }
17174
- function RunStatus({ event }) {
17195
+ function RunStatus({
17196
+ event
17197
+ }) {
17175
17198
  const messages = useMonkeysLocaleMessages().agentWorkbench;
17176
17199
  const status = event.payload.status;
17177
17200
  if (status !== "stopping" && status !== "stopped") return null;
@@ -17183,7 +17206,9 @@ function RunStatus({ event }) {
17183
17206
  children: [
17184
17207
  status === "stopping" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-4 animate-spin", "aria-hidden": "true" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleStop, { className: "size-4", "aria-hidden": "true" }),
17185
17208
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: status === "stopping" ? messages.run.stopping : messages.run.stoppedAfter({
17186
- duration: formatDuration2(event.payload.durationMs ?? 0)
17209
+ duration: formatDuration2(
17210
+ event.payload.durationMs ?? event.resolvedDurationMs ?? 0
17211
+ )
17187
17212
  }) })
17188
17213
  ]
17189
17214
  }