@shapeshift-labs/frontier-loom-ui 0.1.0 → 0.1.1

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/client.js CHANGED
@@ -320,15 +320,17 @@ function contentTab(id, label, meta) {
320
320
  function WorkOverview({ dashboard, lanes, jobs, attention, audit, success }) {
321
321
  const health = dashboardHealthSummary(dashboard, jobs, attention);
322
322
  const contribution = contributionGrid(dashboard, jobs, dashboard.events);
323
- const successfulJobCount = successLikeJobCount(jobs);
324
- const progressRatio = health.jobCount ? successfulJobCount / health.jobCount : 0;
323
+ const resolvedWorkCount = resolvedWorkJobCount(jobs);
324
+ const workerSuccessCount = successLikeJobCount(jobs);
325
+ const progressRatio = health.jobCount ? resolvedWorkCount / health.jobCount : 0;
326
+ const workerReliabilityRatio = health.jobCount ? workerSuccessCount / health.jobCount : 0;
325
327
  const progressLabel = formatPercent(progressRatio);
326
328
  const progressWidth = Math.max(0, Math.min(100, progressRatio * 100));
327
329
  const cost = workCostSummary(dashboard, jobs);
328
330
  void lanes;
329
331
  void audit;
330
332
  void success;
331
- return _jsxs("div", { className: "work-layout", "data-scroll-id": "work", children: [_jsxs("section", { className: "goal-card", children: [_jsxs("div", { children: [_jsx("span", { children: "Goal" }), _jsx("h3", { children: currentGoalTitle(dashboard) }), _jsx("p", { children: goalProgressText(health, successfulJobCount) })] }), _jsxs("div", { className: "goal-progress", children: [_jsxs("div", { className: "goal-progress-head", children: [_jsx("b", { children: progressLabel }), _jsxs("span", { children: [text(successfulJobCount), " of ", text(health.jobCount), " tasks completed successfully"] })] }), _jsx("div", { className: "goal-progress-track", role: "img", "aria-label": `${progressLabel} successful task progress`, children: _jsx("span", { className: `goal-progress-fill ${health.tone}`, style: `width:${progressWidth}%` }) })] })] }), _jsxs("section", { className: "work-section work-contribution-section", children: [_jsxs("div", { className: "metric-section-head", children: [_jsx("h3", { children: "Progress by day" }), _jsxs("span", { children: [text(contribution.year), " \u00B7 January through December"] })] }), _jsx(ContributionGraph, { grid: contribution, prominent: true })] }), _jsxs("section", { className: "work-section", children: [_jsxs("div", { className: "metric-section-head", children: [_jsx("h3", { children: "Token cost estimate" }), _jsx("span", { children: cost.detail })] }), _jsxs("div", { className: "work-cost-metrics", children: [costMetric('Total input', cost.totalInput, cost.totalDetail), costMetric('Uncached input', cost.freshInput, cost.freshDetail), costMetric('Cached input', cost.cachedInput, cost.cachedDetail), costMetric('Budget warnings', cost.budgetWarnings, cost.budgetDetail)] })] })] });
333
+ return _jsxs("div", { className: "work-layout", "data-scroll-id": "work", children: [_jsxs("section", { className: "goal-card", children: [_jsxs("div", { children: [_jsx("span", { children: "Goal" }), _jsx("h3", { children: currentGoalTitle(dashboard) }), _jsx("p", { children: goalProgressText(jobs, health, resolvedWorkCount) })] }), _jsxs("div", { className: "goal-progress", children: [_jsxs("div", { className: "goal-progress-head", children: [_jsx("b", { children: progressLabel }), _jsxs("span", { children: [text(resolvedWorkCount), " of ", text(health.jobCount), " tasks resolved"] })] }), _jsx("div", { className: "goal-progress-track", role: "img", "aria-label": `${progressLabel} resolved work progress`, children: _jsx("span", { className: `goal-progress-fill ${progressTone(progressRatio, workerReliabilityRatio)}`, style: `width:${progressWidth}%` }) }), _jsxs("small", { className: "goal-reliability", children: ["Worker reliability ", formatPercent(workerReliabilityRatio), " \u00B7 ", text(workerSuccessCount), " clean completions"] })] })] }), _jsxs("section", { className: "work-section work-contribution-section", children: [_jsxs("div", { className: "metric-section-head", children: [_jsx("h3", { children: "Progress by day" }), _jsxs("span", { children: [text(contribution.year), " \u00B7 January through December"] })] }), _jsx(ContributionGraph, { grid: contribution, prominent: true })] }), _jsxs("section", { className: "work-section", children: [_jsxs("div", { className: "metric-section-head", children: [_jsx("h3", { children: "Token cost estimate" }), _jsx("span", { children: cost.detail })] }), _jsxs("div", { className: "work-cost-metrics", children: [costMetric('Total input', cost.totalInput, cost.totalDetail), costMetric('Uncached input', cost.freshInput, cost.freshDetail), costMetric('Cached input', cost.cachedInput, cost.cachedDetail), costMetric('Budget warnings', cost.budgetWarnings, cost.budgetDetail)] })] })] });
332
334
  }
333
335
  function currentGoalTitle(dashboard) {
334
336
  const backlog = recordValue(dashboard.backlog);
@@ -349,19 +351,28 @@ function sentenceCaseIdentifier(value) {
349
351
  return value;
350
352
  return spaced[0].toUpperCase() + spaced.slice(1);
351
353
  }
352
- function goalProgressText(health, successfulJobCount) {
354
+ function goalProgressText(jobs, health, resolvedWorkCount) {
353
355
  if (!health.jobCount)
354
356
  return 'No active swarm work is loaded yet.';
355
- const attentionCount = health.failedJobCount + health.blockedJobCount + health.warningJobCount;
356
- if (successfulJobCount >= health.jobCount)
357
- return 'Every tracked task has completed successfully.';
357
+ const unresolvedAttentionCount = jobs.filter(isCoordinatorReviewJob).length;
358
+ if (resolvedWorkCount >= health.jobCount)
359
+ return 'Every tracked task has either completed or been resolved by the coordinator.';
358
360
  if (health.runningJobCount) {
359
361
  return `The swarm is working through ${text(health.jobCount)} tracked tasks. ${text(health.runningJobCount)} are still running.`;
360
362
  }
361
363
  if (health.terminalJobCount >= health.jobCount) {
362
- return `Execution has finished, but ${text(attentionCount)} tasks still need review or fixes.`;
364
+ return unresolvedAttentionCount
365
+ ? `Execution has finished, but ${text(unresolvedAttentionCount)} tasks still need coordinator action.`
366
+ : 'Execution has finished and coordinator decisions have collapsed the open review queue.';
363
367
  }
364
- return `No agents are running right now. ${text(Math.max(0, health.jobCount - health.terminalJobCount))} tasks remain queued and ${text(attentionCount)} need review or fixes.`;
368
+ return `No agents are running right now. ${text(Math.max(0, health.jobCount - health.terminalJobCount))} tasks remain queued and ${text(unresolvedAttentionCount)} need coordinator action.`;
369
+ }
370
+ function progressTone(progressRatio, workerReliabilityRatio) {
371
+ if (progressRatio >= 0.8 && workerReliabilityRatio >= 0.5)
372
+ return 'good';
373
+ if (progressRatio >= 0.5)
374
+ return 'warn';
375
+ return 'bad';
365
376
  }
366
377
  function workCostSummary(dashboard, jobs) {
367
378
  const telemetry = tokenTimeSummary(dashboard, jobs);
@@ -1443,6 +1454,9 @@ function priorityRank(priority) {
1443
1454
  function successLikeJobCount(jobs) {
1444
1455
  return jobs.filter((job) => isCompletedJob(job) && !isFailedJob(job) && !isStaleJob(job)).length;
1445
1456
  }
1457
+ function resolvedWorkJobCount(jobs) {
1458
+ return jobs.filter((job) => isResolvedCoordinatorReviewJob(job) || (isCompletedJob(job) && !isFailedJob(job) && !isStaleJob(job))).length;
1459
+ }
1446
1460
  function laneLoadTone(lane) {
1447
1461
  if (lane.failedCount || lane.blockedCount)
1448
1462
  return 'bad';