@exaudeus/workrail 3.64.0 → 3.65.0

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.
@@ -47,6 +47,7 @@ const node_outputs_js_1 = require("../projections/node-outputs.js");
47
47
  const advance_outcomes_js_1 = require("../projections/advance-outcomes.js");
48
48
  const artifacts_js_1 = require("../projections/artifacts.js");
49
49
  const run_context_js_1 = require("../projections/run-context.js");
50
+ const session_metrics_js_1 = require("../projections/session-metrics.js");
50
51
  const sorted_event_log_js_1 = require("../durable-core/sorted-event-log.js");
51
52
  const run_execution_trace_js_1 = require("../projections/run-execution-trace.js");
52
53
  const constants_js_1 = require("../durable-core/constants.js");
@@ -198,18 +199,28 @@ class ConsoleService {
198
199
  message: `Failed to load session ${sessionIdStr}: ${storeErr.message}`,
199
200
  }))
200
201
  .andThen((truth) => {
202
+ const metrics = (0, session_metrics_js_1.projectSessionMetricsV2)(truth.events);
203
+ const repoRoot = extractRepoRoot(truth.events);
201
204
  const dagRes = (0, run_dag_js_1.projectRunDagV2)(truth.events);
202
205
  const detailRA = (() => {
203
206
  if (dagRes.isErr()) {
204
207
  return resolveRunCompletion(truth.events, this.ports.snapshotStore)
205
- .map((completionMap) => projectSessionDetail(sessionId, truth, completionMap, {}, {}));
208
+ .map((completionMap) => ({
209
+ ...projectSessionDetail(sessionId, truth, completionMap, {}, {}),
210
+ metrics,
211
+ repoRoot,
212
+ }));
206
213
  }
207
214
  const dag = dagRes.value;
208
215
  return neverthrow_1.ResultAsync.combine([
209
216
  resolveRunCompletion(truth.events, this.ports.snapshotStore),
210
217
  resolveStepLabels(dag, this.ports.snapshotStore, this.ports.pinnedWorkflowStore),
211
218
  resolveWorkflowNames(dag, this.ports.pinnedWorkflowStore),
212
- ]).map(([completionMap, stepLabels, workflowNames]) => projectSessionDetail(sessionId, truth, completionMap, stepLabels, workflowNames));
219
+ ]).map(([completionMap, stepLabels, workflowNames]) => ({
220
+ ...projectSessionDetail(sessionId, truth, completionMap, stepLabels, workflowNames),
221
+ metrics,
222
+ repoRoot,
223
+ }));
213
224
  })();
214
225
  const isLiveRA = neverthrow_1.ResultAsync.fromSafePromise(isSessionLiveFromEventLog(sessionIdStr));
215
226
  return neverthrow_1.ResultAsync.combine([detailRA, isLiveRA]).andThen(([detail, isLive]) => {
@@ -632,6 +643,7 @@ function projectSessionSummary(sessionId, truth, completionByRunId, workflowName
632
643
  return false;
633
644
  return Object.values(contextRes.value.byRunId).some((runCtx) => runCtx.context['is_autonomous'] === 'true');
634
645
  })();
646
+ const metrics = (0, session_metrics_js_1.projectSessionMetricsV2)(events);
635
647
  const runs = Object.values(dag.runsById);
636
648
  const run = runs[0];
637
649
  if (!run) {
@@ -656,6 +668,7 @@ function projectSessionSummary(sessionId, truth, completionByRunId, workflowName
656
668
  isAutonomous,
657
669
  isLive,
658
670
  parentSessionId,
671
+ metrics,
659
672
  };
660
673
  }
661
674
  const workflow = run.workflow;
@@ -702,6 +715,7 @@ function projectSessionSummary(sessionId, truth, completionByRunId, workflowName
702
715
  isAutonomous,
703
716
  isLive,
704
717
  parentSessionId,
718
+ metrics,
705
719
  };
706
720
  }
707
721
  function projectSessionDetail(sessionId, truth, completionByRunId, stepLabels, workflowNames, skippedStepsMap = {}) {
@@ -712,7 +726,7 @@ function projectSessionDetail(sessionId, truth, completionByRunId, stepLabels, w
712
726
  const sessionTitle = sortedEventsRes.isOk() ? deriveSessionTitle(sortedEventsRes.value) : null;
713
727
  const dagRes = (0, run_dag_js_1.projectRunDagV2)(events);
714
728
  if (dagRes.isErr()) {
715
- return { sessionId, sessionTitle, health: sessionHealth, runs: [] };
729
+ return { sessionId, sessionTitle, health: sessionHealth, runs: [], metrics: null, repoRoot: null };
716
730
  }
717
731
  const statusRes = sortedEventsRes.isOk() ? (0, run_status_signals_js_1.projectRunStatusSignalsV2)(sortedEventsRes.value) : (0, neverthrow_2.err)(sortedEventsRes.error);
718
732
  const gapsRes = sortedEventsRes.isOk() ? (0, gaps_js_1.projectGapsV2)(sortedEventsRes.value) : (0, neverthrow_2.err)(sortedEventsRes.error);
@@ -781,7 +795,7 @@ function projectSessionDetail(sessionId, truth, completionByRunId, stepLabels, w
781
795
  skippedSteps: skippedStepsMap[run.runId] ?? [],
782
796
  };
783
797
  });
784
- return { sessionId, sessionTitle, health: sessionHealth, runs };
798
+ return { sessionId, sessionTitle, health: sessionHealth, runs, metrics: null, repoRoot: null };
785
799
  }
786
800
  function deriveRunStatus(isBlocked, hasUnresolvedCriticalGaps, isComplete) {
787
801
  if (isBlocked)
@@ -1,3 +1,5 @@
1
+ import type { SessionMetricsV2 } from '../projections/session-metrics.js';
2
+ export type { SessionMetricsV2 };
1
3
  export type ConsoleRunStatus = 'in_progress' | 'complete' | 'complete_with_gaps' | 'blocked';
2
4
  export type ConsoleSessionStatus = ConsoleRunStatus | 'dormant';
3
5
  export type ConsoleSessionHealth = 'healthy' | 'corrupt';
@@ -21,6 +23,7 @@ export interface ConsoleSessionSummary {
21
23
  readonly isAutonomous: boolean;
22
24
  readonly isLive: boolean;
23
25
  readonly parentSessionId: string | null;
26
+ readonly metrics: SessionMetricsV2 | null;
24
27
  }
25
28
  export interface ConsoleSessionListResponse {
26
29
  readonly sessions: readonly ConsoleSessionSummary[];
@@ -90,6 +93,8 @@ export interface ConsoleSessionDetail {
90
93
  readonly runs: readonly ConsoleDagRun[];
91
94
  readonly isLive?: boolean;
92
95
  readonly liveActivity?: readonly ConsoleToolActivity[] | null;
96
+ readonly metrics: SessionMetricsV2 | null;
97
+ readonly repoRoot: string | null;
93
98
  }
94
99
  export type ConsoleValidationOutcome = 'pass' | 'fail';
95
100
  export interface ConsoleValidationResult {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exaudeus/workrail",
3
- "version": "3.64.0",
3
+ "version": "3.65.0",
4
4
  "description": "Step-by-step workflow enforcement for AI agents via MCP",
5
5
  "license": "MIT",
6
6
  "repository": {