@evalops/maestro 0.10.26 → 0.10.28

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 (37) hide show
  1. package/dist/agent/transport/reusable-tool-results.d.ts +38 -0
  2. package/dist/agent/transport/reusable-tool-results.d.ts.map +1 -0
  3. package/dist/agent/transport/reusable-tool-results.js +432 -0
  4. package/dist/agent/transport/reusable-tool-results.js.map +1 -0
  5. package/dist/agent/transport.d.ts +1 -1
  6. package/dist/agent/transport.d.ts.map +1 -1
  7. package/dist/agent/transport.js +1 -430
  8. package/dist/agent/transport.js.map +1 -1
  9. package/dist/audit/logger.d.ts +2 -2
  10. package/dist/cli/commands/run.d.ts +15 -0
  11. package/dist/cli/commands/run.d.ts.map +1 -1
  12. package/dist/cli/commands/run.js +35 -0
  13. package/dist/cli/commands/run.js.map +1 -1
  14. package/dist/cli.js +739 -630
  15. package/dist/node_modules/@evalops/contracts/package.json +1 -1
  16. package/dist/node_modules/@evalops/tui/package.json +1 -1
  17. package/dist/platform/agent-registry-client.d.ts +6 -0
  18. package/dist/platform/agent-registry-client.d.ts.map +1 -1
  19. package/dist/platform/agent-registry-client.js +6 -0
  20. package/dist/platform/agent-registry-client.js.map +1 -1
  21. package/dist/server/agent-runtime-ledger.d.ts +5 -0
  22. package/dist/server/agent-runtime-ledger.d.ts.map +1 -1
  23. package/dist/server/agent-runtime-ledger.js +63 -0
  24. package/dist/server/agent-runtime-ledger.js.map +1 -1
  25. package/dist/server/headless-runtime/broker.d.ts +81 -0
  26. package/dist/server/headless-runtime/broker.d.ts.map +1 -0
  27. package/dist/server/headless-runtime/broker.js +201 -0
  28. package/dist/server/headless-runtime/broker.js.map +1 -0
  29. package/dist/server/headless-runtime-service.d.ts +3 -37
  30. package/dist/server/headless-runtime-service.d.ts.map +1 -1
  31. package/dist/server/headless-runtime-service.js +1 -199
  32. package/dist/server/headless-runtime-service.js.map +1 -1
  33. package/dist/session/manager.d.ts +1 -0
  34. package/dist/session/manager.d.ts.map +1 -1
  35. package/dist/session/manager.js.map +1 -1
  36. package/dist/version.json +2 -2
  37. package/package.json +1 -1
@@ -131,10 +131,10 @@ export declare function queryAuditLogs(filters: {
131
131
  action: string;
132
132
  status: "error" | "denied" | "success" | "failure";
133
133
  createdAt: Date;
134
- sessionId: string | null;
135
- userId: string | null;
136
134
  traceId: string | null;
137
135
  requestId: string | null;
136
+ sessionId: string | null;
137
+ userId: string | null;
138
138
  durationMs: number | null;
139
139
  resourceId: string | null;
140
140
  resourceType: string | null;
@@ -58,6 +58,8 @@ interface RunReconstructionReport {
58
58
  id: string;
59
59
  title?: string;
60
60
  summary?: string;
61
+ resumeSummary?: string;
62
+ memoryExtractionHash?: string;
61
63
  createdAt: string;
62
64
  updatedAt: string;
63
65
  messageCount: number;
@@ -75,6 +77,19 @@ interface RunReconstructionReport {
75
77
  trajectoryScore: AgentTrajectoryScoreReport;
76
78
  trajectoryInspection: AgentTrajectoryInspectionReport;
77
79
  agentRuntimeLedger: AgentRuntimeLedgerReport;
80
+ durability: RunDurabilitySummary;
81
+ }
82
+ interface RunDurabilitySummary {
83
+ reconstructable: boolean;
84
+ sessionFilePresent: boolean;
85
+ resumeSummaryPresent: boolean;
86
+ memoryExtractionHashPresent: boolean;
87
+ contextManifestPresent: boolean;
88
+ compactionCheckpoints: number;
89
+ pendingRequests: number;
90
+ agentRuntimeLedgerEntries: number;
91
+ replayDeterministic: boolean;
92
+ promotionIdempotencyKey: string;
78
93
  }
79
94
  declare function buildRunReconstructionReport(sessionId: string, options?: RunInspectOptions): Promise<RunReconstructionReport | null>;
80
95
  declare function renderRunReconstruction(report: RunReconstructionReport): string;
@@ -1 +1 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/run.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,KAAK,wBAAwB,EAE7B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACN,KAAK,+BAA+B,EAEpC,MAAM,6CA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AC7B,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAiGzC;AAoCD,iBAAS,uBAAuB,CAAC,MAAM,EAAE,uBAAuB,GAAG,MAAM,CAuBxE;AAED,wBAAsB,gBAAgB,CACrC,UAAU,CAAC,EAAE,MAAM,EACnB,IAAI,GAAE,MAAM,EAAO,EACnB,OAAO,GAAE,iBAAsB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAsCf;AAED,eAAO,MAAM,OAAO;;;CAGnB,CAAC"}
@@ -175,6 +175,27 @@ function buildCoverage(counts, promptContext, contextManifest) {
175
175
  mcpContext: contextManifest.mcpServers > 0 || promptContext.mcpServers > 0,
176
176
  };
177
177
  }
178
+ function buildDurabilitySummary(input) {
179
+ const sessionFilePresent = typeof input.sessionFile === "string" && input.sessionFile.length > 0;
180
+ const contextManifestPresent = input.contextManifest.protocolVersion !== undefined;
181
+ const replayDeterministic = input.agentRuntimeLedger.replay.deterministic;
182
+ return {
183
+ reconstructable: sessionFilePresent &&
184
+ input.counts.timelineItems > 0 &&
185
+ replayDeterministic,
186
+ sessionFilePresent,
187
+ resumeSummaryPresent: typeof input.session.resumeSummary === "string" &&
188
+ input.session.resumeSummary.trim().length > 0,
189
+ memoryExtractionHashPresent: typeof input.session.memoryExtractionHash === "string" &&
190
+ input.session.memoryExtractionHash.trim().length > 0,
191
+ contextManifestPresent,
192
+ compactionCheckpoints: input.counts.byType["compaction.created"] ?? 0,
193
+ pendingRequests: input.counts.byType["wait.pending"] ?? 0,
194
+ agentRuntimeLedgerEntries: input.agentRuntimeLedger.counts.entries,
195
+ replayDeterministic,
196
+ promotionIdempotencyKey: input.agentRuntimeLedger.promotion.idempotencyKey,
197
+ };
198
+ }
178
199
  async function buildRunReconstructionReport(sessionId, options = {}) {
179
200
  const manager = new SessionManager(false, undefined, {
180
201
  sessionDir: options.sessionDir,
@@ -233,6 +254,12 @@ async function buildRunReconstructionReport(sessionId, options = {}) {
233
254
  if (session.summary) {
234
255
  sessionReport.summary = session.summary;
235
256
  }
257
+ if (session.resumeSummary) {
258
+ sessionReport.resumeSummary = session.resumeSummary;
259
+ }
260
+ if (session.memoryExtractionHash) {
261
+ sessionReport.memoryExtractionHash = session.memoryExtractionHash;
262
+ }
236
263
  if (header?.cwd) {
237
264
  sessionReport.cwd = header.cwd;
238
265
  }
@@ -252,6 +279,13 @@ async function buildRunReconstructionReport(sessionId, options = {}) {
252
279
  trajectoryScore,
253
280
  trajectoryInspection,
254
281
  agentRuntimeLedger,
282
+ durability: buildDurabilitySummary({
283
+ sessionFile,
284
+ session,
285
+ counts,
286
+ contextManifest,
287
+ agentRuntimeLedger,
288
+ }),
255
289
  };
256
290
  }
257
291
  function renderCoverage(coverage) {
@@ -297,6 +331,7 @@ function renderRunReconstruction(report) {
297
331
  `Trajectory score: ${report.trajectoryScore.counts.failed} failed, ${report.trajectoryScore.counts.warnings} warnings across ${report.trajectoryScore.counts.rules} rule(s)`,
298
332
  `Replay lab: ${report.trajectoryInspection.counts.jumpTargets} event/source jump target(s), redaction=${report.trajectoryInspection.redaction.default}`,
299
333
  `AgentRuntime ledger: ${report.agentRuntimeLedger.counts.entries} entries, ${report.agentRuntimeLedger.counts.promotionOperations} dry-run promotion op(s), replay deterministic=${report.agentRuntimeLedger.replay.deterministic ? "yes" : "no"}`,
334
+ `Durability: reconstructable=${report.durability.reconstructable ? "yes" : "no"}, resume summary=${report.durability.resumeSummaryPresent ? "yes" : "no"}, memory hash=${report.durability.memoryExtractionHashPresent ? "yes" : "no"}, checkpoints=${report.durability.compactionCheckpoints}, pending waits=${report.durability.pendingRequests}`,
300
335
  `Coverage: ${renderCoverage(report.coverage)}`,
301
336
  `Prompt context: ${report.promptContext.entries} entries (${report.promptContext.projectDocs} docs, ${report.promptContext.mcpServers} MCP servers)`,
302
337
  `Context manifest: ${report.contextManifest.entries} entries (${report.contextManifest.projectDocs} docs, ${report.contextManifest.mcpServers} MCP servers, ${report.contextManifest.mcpResources} resources, ${report.contextManifest.mcpPrompts} prompts, ${report.contextManifest.diagnostics} diagnostics)`,
@@ -1 +1 @@
1
- {"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/cli/commands/run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAEN,6BAA6B,GAC7B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAEN,oCAAoC,GACpC,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,yCAAyC,EAAE,MAAM,6CAA6C,CAAC;AACxG,OAAO,EAEN,2BAA2B,GAC3B,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAEN,0BAA0B,GAC1B,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAEN,0BAA0B,GAC1B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAGrE,MAAM,yBAAyB,GAAG,uCAAuC,CAAC;AAiF1E,SAAS,KAAK;IACb,OAAO,wEAAwE,CAAC;AACjF,CAAC;AAED,SAAS,aAAa,CAAC,OAAe;IACrC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IAClC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAClC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC;AAED,SAAS,UAAU,CAAC,OAAuB;IAC1C,OAAO,OAAO,CAAC,IAAI,CAClB,CAAC,KAAK,EAA+B,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAChE,CAAC;AACH,CAAC;AAED,SAAS,oBAAoB,CAC5B,MAAsC,EACtC,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,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7C,OAAO;IACR,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAG;IACtB,4BAA4B;IAC5B,uBAAuB;CACvB,CAAC","sourcesContent":["import chalk from \"chalk\";\nimport { parseMcpToolName } from \"../../mcp/names.js\";\nimport {\n\ttype AgentRuntimeLedgerReport,\n\tbuildAgentRuntimeLedgerReport,\n} from \"../../server/agent-runtime-ledger.js\";\nimport {\n\ttype AgentTrajectoryInspectionReport,\n\tbuildAgentTrajectoryInspectionReport,\n} from \"../../server/agent-trajectory-inspection.js\";\nimport { DEFAULT_AGENT_TRAJECTORY_REPLAY_LAB_RULES } from \"../../server/agent-trajectory-replay-lab.js\";\nimport {\n\ttype AgentTrajectoryReplayReport,\n\treplayAgentTrajectoryReport,\n} from \"../../server/agent-trajectory-replay.js\";\nimport {\n\ttype AgentTrajectoryScoreReport,\n\tscoreAgentTrajectoryReport,\n} from \"../../server/agent-trajectory-scorers.js\";\nimport {\n\ttype AgentTrajectoryReport,\n\tbuildAgentTrajectoryReport,\n} from \"../../server/agent-trajectory.js\";\nimport { buildComposerRunTimeline } from \"../../server/session-timeline.js\";\nimport { SessionManager } from \"../../session/manager.js\";\nimport { migrateToCurrentVersion } from \"../../session/migration.js\";\nimport type { SessionEntry, SessionHeaderEntry } from \"../../session/types.js\";\n\nconst RUN_RECONSTRUCTION_SCHEMA = \"evalops.maestro.run-reconstruction.v1\";\n\ntype ComposerRunTimeline = ReturnType<typeof buildComposerRunTimeline>;\ntype ComposerRunTimelineItem = ComposerRunTimeline[\"items\"][number];\n\ninterface RunInspectOptions {\n\tjson?: boolean;\n\tsessionDir?: string;\n}\n\ninterface ReconstructionCountSummary {\n\ttimelineItems: number;\n\tbyType: Record<string, number>;\n\tbyStatus: Record<string, number>;\n\tbyVisibility: Record<string, number>;\n}\n\ninterface ReconstructionCoverage {\n\tpromptInputs: boolean;\n\tassistantResponses: boolean;\n\ttoolRequests: boolean;\n\ttoolResults: boolean;\n\tcontextManifest: boolean;\n\tcontextDiagnostics: boolean;\n\tfileChanges: boolean;\n\tartifacts: boolean;\n\tpolicyDecisions: boolean;\n\tdiagnostics: boolean;\n\tcompactions: boolean;\n\tpendingRequests: boolean;\n\tmcpContext: boolean;\n}\n\ninterface PromptContextSummary {\n\tentries: number;\n\tprojectDocs: number;\n\tmcpServers: number;\n}\n\ninterface ContextManifestSummary {\n\tprotocolVersion?: string;\n\tversion?: number;\n\tcwd?: string;\n\tentries: number;\n\tprojectDocs: number;\n\tmcpServers: number;\n\tmcpResources: number;\n\tmcpPrompts: number;\n\tdiagnostics: number;\n\tbyKind: Record<string, number>;\n\tbySource: Record<string, number>;\n\tbyStatus: Record<string, number>;\n\tprojectDocBytesRead?: number;\n\tprojectDocMaxBytes?: number;\n}\n\ninterface RunReconstructionReport {\n\tschemaVersion: typeof RUN_RECONSTRUCTION_SCHEMA;\n\tsession: {\n\t\tid: string;\n\t\ttitle?: string;\n\t\tsummary?: string;\n\t\tcreatedAt: string;\n\t\tupdatedAt: string;\n\t\tmessageCount: number;\n\t\tsessionFile: string;\n\t\tcwd?: string;\n\t\tmodel?: string;\n\t};\n\tcounts: ReconstructionCountSummary;\n\tcoverage: ReconstructionCoverage;\n\tpromptContext: PromptContextSummary;\n\tcontextManifest: ContextManifestSummary;\n\ttimeline: ComposerRunTimeline;\n\ttrajectory: AgentTrajectoryReport;\n\ttrajectoryReplay: AgentTrajectoryReplayReport;\n\ttrajectoryScore: AgentTrajectoryScoreReport;\n\ttrajectoryInspection: AgentTrajectoryInspectionReport;\n\tagentRuntimeLedger: AgentRuntimeLedgerReport;\n}\n\nfunction usage(): string {\n\treturn \"Usage: maestro run inspect|ledger|replay|promote <session-id> [--json]\";\n}\n\nfunction exitWithUsage(message: string): never {\n\tconsole.error(chalk.red(message));\n\tconsole.error(chalk.dim(usage()));\n\tprocess.exit(1);\n}\n\nfunction findHeader(entries: SessionEntry[]): SessionHeaderEntry | undefined {\n\treturn entries.find(\n\t\t(entry): entry is SessionHeaderEntry => entry.type === \"session\",\n\t);\n}\n\nfunction promptContextSummary(\n\theader: SessionHeaderEntry | undefined,\n\ttimeline: ComposerRunTimeline,\n): PromptContextSummary {\n\tconst manifest = header?.promptContextManifest;\n\tconst entries = Array.isArray(\n\t\t(manifest as { entries?: unknown } | undefined)?.entries,\n\t)\n\t\t? ((manifest as { entries: unknown[] }).entries ?? [])\n\t\t: [];\n\tlet projectDocs = 0;\n\tconst mcpServers = new Set<string>();\n\tfor (const entry of entries) {\n\t\tif (!entry || typeof entry !== \"object\") continue;\n\t\tconst kind = (entry as { kind?: unknown }).kind;\n\t\tconst sourceKind = (entry as { sourceKind?: unknown }).sourceKind;\n\t\tconst resourceKind = (entry as { resourceKind?: unknown }).resourceKind;\n\t\tif (\n\t\t\tkind === \"project_doc\" ||\n\t\t\tsourceKind === \"project\" ||\n\t\t\tsourceKind === \"global\"\n\t\t) {\n\t\t\tprojectDocs += 1;\n\t\t} else if (kind === \"mcp_server\" || resourceKind === \"mcp_server\") {\n\t\t\tconst serverName =\n\t\t\t\t(entry as { serverName?: unknown }).serverName ??\n\t\t\t\t(entry as { resourceId?: unknown }).resourceId ??\n\t\t\t\t(entry as { providerId?: unknown }).providerId ??\n\t\t\t\t(entry as { id?: unknown }).id;\n\t\t\tmcpServers.add(typeof serverName === \"string\" ? serverName : \"unknown\");\n\t\t}\n\t}\n\tfor (const tool of header?.tools ?? []) {\n\t\tconst mcpTool = parseMcpToolName(tool.name);\n\t\tif (mcpTool) {\n\t\t\tmcpServers.add(mcpTool.server);\n\t\t}\n\t}\n\tfor (const item of timeline.items) {\n\t\tif (!item.toolName) continue;\n\t\tconst mcpTool = parseMcpToolName(item.toolName);\n\t\tif (mcpTool) {\n\t\t\tmcpServers.add(mcpTool.server);\n\t\t}\n\t}\n\treturn {\n\t\tentries: entries.length,\n\t\tprojectDocs,\n\t\tmcpServers: mcpServers.size,\n\t};\n}\n\nfunction contextManifestSummary(\n\theader: SessionHeaderEntry | undefined,\n\ttimeline: ComposerRunTimeline,\n\tpromptContext: PromptContextSummary,\n): ContextManifestSummary {\n\tconst manifest = header?.unifiedContextManifest;\n\tconst byKind: Record<string, number> = {};\n\tconst bySource: Record<string, number> = {};\n\tconst byStatus: Record<string, number> = {};\n\tconst mcpServers = new Set<string>();\n\tlet mcpResources = 0;\n\tlet mcpPrompts = 0;\n\tlet projectDocs = 0;\n\n\tfor (const entry of manifest?.entries ?? []) {\n\t\tincrement(byKind, entry.kind);\n\t\tincrement(bySource, entry.source);\n\t\tincrement(byStatus, entry.status);\n\t\tif (entry.kind === \"project_doc\") {\n\t\t\tprojectDocs += 1;\n\t\t}\n\t\tif (entry.kind === \"mcp_server\") {\n\t\t\tmcpServers.add(entry.serverName ?? entry.id);\n\t\t}\n\t\tif (entry.kind === \"mcp_resource\") {\n\t\t\tmcpResources += 1;\n\t\t\tif (entry.serverName) {\n\t\t\t\tmcpServers.add(entry.serverName);\n\t\t\t}\n\t\t}\n\t\tif (entry.kind === \"mcp_prompt\") {\n\t\t\tmcpPrompts += 1;\n\t\t\tif (entry.serverName) {\n\t\t\t\tmcpServers.add(entry.serverName);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const tool of header?.tools ?? []) {\n\t\tconst mcpTool = parseMcpToolName(tool.name);\n\t\tif (mcpTool) {\n\t\t\tmcpServers.add(mcpTool.server);\n\t\t}\n\t}\n\tfor (const item of timeline.items) {\n\t\tif (!item.toolName) continue;\n\t\tconst mcpTool = parseMcpToolName(item.toolName);\n\t\tif (mcpTool) {\n\t\t\tmcpServers.add(mcpTool.server);\n\t\t}\n\t}\n\n\tconst summary: ContextManifestSummary = {\n\t\tentries: manifest?.entries.length ?? promptContext.entries,\n\t\tprojectDocs: manifest ? projectDocs : promptContext.projectDocs,\n\t\tmcpServers: manifest ? mcpServers.size : promptContext.mcpServers,\n\t\tmcpResources,\n\t\tmcpPrompts,\n\t\tdiagnostics: manifest?.diagnostics.length ?? 0,\n\t\tbyKind,\n\t\tbySource,\n\t\tbyStatus,\n\t};\n\tif (manifest) {\n\t\tsummary.protocolVersion = manifest.protocolVersion;\n\t\tsummary.version = manifest.version;\n\t\tsummary.cwd = manifest.cwd;\n\t\tsummary.projectDocBytesRead = manifest.projectDocs.bytesRead;\n\t\tif (manifest.projectDocs.maxBytes !== undefined) {\n\t\t\tsummary.projectDocMaxBytes = manifest.projectDocs.maxBytes;\n\t\t}\n\t}\n\treturn summary;\n}\n\nfunction increment(map: Record<string, number>, key: unknown): void {\n\tif (typeof key !== \"string\" || key.length === 0) return;\n\tmap[key] = (map[key] ?? 0) + 1;\n}\n\nfunction countTimeline(\n\ttimeline: ComposerRunTimeline,\n): ReconstructionCountSummary {\n\tconst byType: Record<string, number> = {};\n\tconst byStatus: Record<string, number> = {};\n\tconst byVisibility: Record<string, number> = {};\n\tfor (const item of timeline.items) {\n\t\tincrement(byType, item.type);\n\t\tincrement(byStatus, item.status);\n\t\tincrement(byVisibility, item.visibility);\n\t}\n\treturn {\n\t\ttimelineItems: timeline.items.length,\n\t\tbyType,\n\t\tbyStatus,\n\t\tbyVisibility,\n\t};\n}\n\nfunction buildCoverage(\n\tcounts: ReconstructionCountSummary,\n\tpromptContext: PromptContextSummary,\n\tcontextManifest: ContextManifestSummary,\n): ReconstructionCoverage {\n\treturn {\n\t\tpromptInputs: (counts.byType[\"message.user\"] ?? 0) > 0,\n\t\tassistantResponses: (counts.byType[\"message.assistant\"] ?? 0) > 0,\n\t\ttoolRequests: (counts.byType[\"tool.requested\"] ?? 0) > 0,\n\t\ttoolResults:\n\t\t\t(counts.byType[\"tool.completed\"] ?? 0) +\n\t\t\t\t(counts.byType[\"tool.failed\"] ?? 0) >\n\t\t\t0,\n\t\tcontextManifest: contextManifest.protocolVersion !== undefined,\n\t\tcontextDiagnostics: contextManifest.diagnostics > 0,\n\t\tfileChanges: (counts.byType[\"file.changed\"] ?? 0) > 0,\n\t\tartifacts: (counts.byType[\"artifact.linked\"] ?? 0) > 0,\n\t\tpolicyDecisions: (counts.byType[\"policy.decision\"] ?? 0) > 0,\n\t\tdiagnostics: (counts.byType[\"diagnostic.delta\"] ?? 0) > 0,\n\t\tcompactions: (counts.byType[\"compaction.created\"] ?? 0) > 0,\n\t\tpendingRequests: (counts.byType[\"wait.pending\"] ?? 0) > 0,\n\t\tmcpContext: contextManifest.mcpServers > 0 || promptContext.mcpServers > 0,\n\t};\n}\n\nasync function buildRunReconstructionReport(\n\tsessionId: string,\n\toptions: RunInspectOptions = {},\n): Promise<RunReconstructionReport | null> {\n\tconst manager = new SessionManager(false, undefined, {\n\t\tsessionDir: options.sessionDir,\n\t});\n\tconst sessionFile = manager.getSessionFileById(sessionId);\n\tif (!sessionFile) {\n\t\treturn null;\n\t}\n\tconst [session, entries] = await Promise.all([\n\t\tmanager.loadSession(sessionId),\n\t\tmanager.loadEntries(sessionId),\n\t]);\n\tif (!session || !entries) {\n\t\treturn null;\n\t}\n\tmigrateToCurrentVersion(entries);\n\n\tconst header = findHeader(entries);\n\tconst timeline = buildComposerRunTimeline({\n\t\tsessionId,\n\t\tentries,\n\t\tmessages: session.messages,\n\t});\n\tconst trajectory = buildAgentTrajectoryReport(timeline);\n\tconst trajectoryReplay = replayAgentTrajectoryReport(trajectory);\n\tconst trajectoryScore = scoreAgentTrajectoryReport(\n\t\ttrajectory,\n\t\tDEFAULT_AGENT_TRAJECTORY_REPLAY_LAB_RULES,\n\t);\n\tconst trajectoryInspection = buildAgentTrajectoryInspectionReport({\n\t\ttimelineItems: timeline.items,\n\t\ttrajectory,\n\t\treplay: trajectoryReplay,\n\t\tscore: trajectoryScore,\n\t});\n\tconst agentRuntimeLedger = buildAgentRuntimeLedgerReport({\n\t\tsession: {\n\t\t\tid: session.id,\n\t\t\tsessionFile,\n\t\t\t...(header?.cwd ? { cwd: header.cwd } : {}),\n\t\t\t...(header?.model ? { model: header.model } : {}),\n\t\t},\n\t\ttimeline,\n\t\ttrajectory,\n\t\treplay: trajectoryReplay,\n\t});\n\tconst counts = countTimeline(timeline);\n\tconst context = promptContextSummary(header, timeline);\n\tconst contextManifest = contextManifestSummary(header, timeline, context);\n\n\tconst sessionReport: RunReconstructionReport[\"session\"] = {\n\t\tid: session.id,\n\t\tcreatedAt: session.createdAt,\n\t\tupdatedAt: session.updatedAt,\n\t\tmessageCount: session.messageCount,\n\t\tsessionFile,\n\t};\n\tif (session.title) {\n\t\tsessionReport.title = session.title;\n\t}\n\tif (session.summary) {\n\t\tsessionReport.summary = session.summary;\n\t}\n\tif (header?.cwd) {\n\t\tsessionReport.cwd = header.cwd;\n\t}\n\tif (header?.model) {\n\t\tsessionReport.model = header.model;\n\t}\n\n\treturn {\n\t\tschemaVersion: RUN_RECONSTRUCTION_SCHEMA,\n\t\tsession: sessionReport,\n\t\tcounts,\n\t\tcoverage: buildCoverage(counts, context, contextManifest),\n\t\tpromptContext: context,\n\t\tcontextManifest,\n\t\ttimeline,\n\t\ttrajectory,\n\t\ttrajectoryReplay,\n\t\ttrajectoryScore,\n\t\ttrajectoryInspection,\n\t\tagentRuntimeLedger,\n\t};\n}\n\nfunction renderCoverage(coverage: ReconstructionCoverage): string {\n\tconst labels: Array<[keyof ReconstructionCoverage, string]> = [\n\t\t[\"promptInputs\", \"prompt inputs\"],\n\t\t[\"assistantResponses\", \"assistant responses\"],\n\t\t[\"toolRequests\", \"tool requests\"],\n\t\t[\"toolResults\", \"tool results\"],\n\t\t[\"contextManifest\", \"context manifest\"],\n\t\t[\"contextDiagnostics\", \"context diagnostics\"],\n\t\t[\"fileChanges\", \"file changes\"],\n\t\t[\"artifacts\", \"artifacts\"],\n\t\t[\"policyDecisions\", \"policy decisions\"],\n\t\t[\"diagnostics\", \"diagnostics\"],\n\t\t[\"compactions\", \"compactions\"],\n\t\t[\"pendingRequests\", \"pending waits\"],\n\t\t[\"mcpContext\", \"MCP context\"],\n\t];\n\treturn labels\n\t\t.map(([key, label]) => `${coverage[key] ? \"yes\" : \"no\"} ${label}`)\n\t\t.join(\", \");\n}\n\nfunction renderTimelinePreview(timeline: ComposerRunTimeline): string[] {\n\treturn timeline.items.slice(0, 12).map((item: ComposerRunTimelineItem) => {\n\t\tconst parts = [\n\t\t\titem.timestamp,\n\t\t\titem.type,\n\t\t\titem.status,\n\t\t\titem.title,\n\t\t\titem.summary,\n\t\t].filter(Boolean);\n\t\treturn ` - ${parts.join(\" | \")}`;\n\t});\n}\n\nfunction renderRunReconstruction(report: RunReconstructionReport): string {\n\tconst lines = [\n\t\tchalk.bold(`Run reconstruction: ${report.session.id}`),\n\t\t`Session file: ${report.session.sessionFile}`,\n\t\t`Messages: ${report.session.messageCount}`,\n\t\t`Timeline items: ${report.counts.timelineItems}`,\n\t\t`Trajectory events: ${report.trajectory.counts.events}`,\n\t\t`Replay deltas: ${report.trajectoryReplay.counts.deltas} (${report.trajectoryReplay.counts.errors} errors, ${report.trajectoryReplay.counts.warnings} warnings)`,\n\t\t`Trajectory score: ${report.trajectoryScore.counts.failed} failed, ${report.trajectoryScore.counts.warnings} warnings across ${report.trajectoryScore.counts.rules} rule(s)`,\n\t\t`Replay lab: ${report.trajectoryInspection.counts.jumpTargets} event/source jump target(s), redaction=${report.trajectoryInspection.redaction.default}`,\n\t\t`AgentRuntime ledger: ${report.agentRuntimeLedger.counts.entries} entries, ${report.agentRuntimeLedger.counts.promotionOperations} dry-run promotion op(s), replay deterministic=${report.agentRuntimeLedger.replay.deterministic ? \"yes\" : \"no\"}`,\n\t\t`Coverage: ${renderCoverage(report.coverage)}`,\n\t\t`Prompt context: ${report.promptContext.entries} entries (${report.promptContext.projectDocs} docs, ${report.promptContext.mcpServers} MCP servers)`,\n\t\t`Context manifest: ${report.contextManifest.entries} entries (${report.contextManifest.projectDocs} docs, ${report.contextManifest.mcpServers} MCP servers, ${report.contextManifest.mcpResources} resources, ${report.contextManifest.mcpPrompts} prompts, ${report.contextManifest.diagnostics} diagnostics)`,\n\t\t\"\",\n\t\tchalk.bold(\"Timeline preview\"),\n\t\t...renderTimelinePreview(report.timeline),\n\t];\n\tif (report.timeline.items.length > 12) {\n\t\tlines.push(` ... ${report.timeline.items.length - 12} more item(s)`);\n\t}\n\treturn lines.join(\"\\n\");\n}\n\nexport async function handleRunCommand(\n\tsubcommand?: string,\n\targs: string[] = [],\n\toptions: RunInspectOptions = {},\n): Promise<void> {\n\tif (\n\t\tsubcommand !== \"inspect\" &&\n\t\tsubcommand !== \"ledger\" &&\n\t\tsubcommand !== \"replay\" &&\n\t\tsubcommand !== \"promote\"\n\t) {\n\t\texitWithUsage(\"Run subcommand required.\");\n\t}\n\tconst sessionId = args.find((arg) => !arg.startsWith(\"-\"));\n\tif (!sessionId) {\n\t\texitWithUsage(\"Session id required.\");\n\t}\n\n\tconst report = await buildRunReconstructionReport(sessionId, options);\n\tif (!report) {\n\t\texitWithUsage(`Session not found: ${sessionId}`);\n\t}\n\n\tif (subcommand === \"ledger\") {\n\t\tconsole.log(JSON.stringify(report.agentRuntimeLedger, null, 2));\n\t\treturn;\n\t}\n\tif (subcommand === \"replay\") {\n\t\tconsole.log(JSON.stringify(report.agentRuntimeLedger.replay, null, 2));\n\t\treturn;\n\t}\n\tif (subcommand === \"promote\") {\n\t\tconsole.log(JSON.stringify(report.agentRuntimeLedger.promotion, null, 2));\n\t\treturn;\n\t}\n\n\tif (options.json || args.includes(\"--json\")) {\n\t\tconsole.log(JSON.stringify(report, null, 2));\n\t\treturn;\n\t}\n\n\tconsole.log(renderRunReconstruction(report));\n}\n\nexport const testing = {\n\tbuildRunReconstructionReport,\n\trenderRunReconstruction,\n};\n"]}
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/cli/commands/run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD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AI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,kBAAkB,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC1E,OAAO;IACR,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7C,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7C,OAAO;IACR,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAG;IACtB,4BAA4B;IAC5B,uBAAuB;CACvB,CAAC","sourcesContent":["import chalk from \"chalk\";\nimport { parseMcpToolName } from \"../../mcp/names.js\";\nimport {\n\ttype AgentRuntimeLedgerReport,\n\tbuildAgentRuntimeLedgerReport,\n} from \"../../server/agent-runtime-ledger.js\";\nimport {\n\ttype AgentTrajectoryInspectionReport,\n\tbuildAgentTrajectoryInspectionReport,\n} from \"../../server/agent-trajectory-inspection.js\";\nimport { DEFAULT_AGENT_TRAJECTORY_REPLAY_LAB_RULES } from \"../../server/agent-trajectory-replay-lab.js\";\nimport {\n\ttype AgentTrajectoryReplayReport,\n\treplayAgentTrajectoryReport,\n} from \"../../server/agent-trajectory-replay.js\";\nimport {\n\ttype AgentTrajectoryScoreReport,\n\tscoreAgentTrajectoryReport,\n} from \"../../server/agent-trajectory-scorers.js\";\nimport {\n\ttype AgentTrajectoryReport,\n\tbuildAgentTrajectoryReport,\n} from \"../../server/agent-trajectory.js\";\nimport { buildComposerRunTimeline } from \"../../server/session-timeline.js\";\nimport { SessionManager } from \"../../session/manager.js\";\nimport { migrateToCurrentVersion } from \"../../session/migration.js\";\nimport type { SessionEntry, SessionHeaderEntry } from \"../../session/types.js\";\n\nconst RUN_RECONSTRUCTION_SCHEMA = \"evalops.maestro.run-reconstruction.v1\";\n\ntype ComposerRunTimeline = ReturnType<typeof buildComposerRunTimeline>;\ntype ComposerRunTimelineItem = ComposerRunTimeline[\"items\"][number];\n\ninterface RunInspectOptions {\n\tjson?: boolean;\n\tsessionDir?: string;\n}\n\ninterface ReconstructionCountSummary {\n\ttimelineItems: number;\n\tbyType: Record<string, number>;\n\tbyStatus: Record<string, number>;\n\tbyVisibility: Record<string, number>;\n}\n\ninterface ReconstructionCoverage {\n\tpromptInputs: boolean;\n\tassistantResponses: boolean;\n\ttoolRequests: boolean;\n\ttoolResults: boolean;\n\tcontextManifest: boolean;\n\tcontextDiagnostics: boolean;\n\tfileChanges: boolean;\n\tartifacts: boolean;\n\tpolicyDecisions: boolean;\n\tdiagnostics: boolean;\n\tcompactions: boolean;\n\tpendingRequests: boolean;\n\tmcpContext: boolean;\n}\n\ninterface PromptContextSummary {\n\tentries: number;\n\tprojectDocs: number;\n\tmcpServers: number;\n}\n\ninterface ContextManifestSummary {\n\tprotocolVersion?: string;\n\tversion?: number;\n\tcwd?: string;\n\tentries: number;\n\tprojectDocs: number;\n\tmcpServers: number;\n\tmcpResources: number;\n\tmcpPrompts: number;\n\tdiagnostics: number;\n\tbyKind: Record<string, number>;\n\tbySource: Record<string, number>;\n\tbyStatus: Record<string, number>;\n\tprojectDocBytesRead?: number;\n\tprojectDocMaxBytes?: number;\n}\n\ninterface RunReconstructionReport {\n\tschemaVersion: typeof RUN_RECONSTRUCTION_SCHEMA;\n\tsession: {\n\t\tid: string;\n\t\ttitle?: string;\n\t\tsummary?: string;\n\t\tresumeSummary?: string;\n\t\tmemoryExtractionHash?: string;\n\t\tcreatedAt: string;\n\t\tupdatedAt: string;\n\t\tmessageCount: number;\n\t\tsessionFile: string;\n\t\tcwd?: string;\n\t\tmodel?: string;\n\t};\n\tcounts: ReconstructionCountSummary;\n\tcoverage: ReconstructionCoverage;\n\tpromptContext: PromptContextSummary;\n\tcontextManifest: ContextManifestSummary;\n\ttimeline: ComposerRunTimeline;\n\ttrajectory: AgentTrajectoryReport;\n\ttrajectoryReplay: AgentTrajectoryReplayReport;\n\ttrajectoryScore: AgentTrajectoryScoreReport;\n\ttrajectoryInspection: AgentTrajectoryInspectionReport;\n\tagentRuntimeLedger: AgentRuntimeLedgerReport;\n\tdurability: RunDurabilitySummary;\n}\n\ninterface RunDurabilitySummary {\n\treconstructable: boolean;\n\tsessionFilePresent: boolean;\n\tresumeSummaryPresent: boolean;\n\tmemoryExtractionHashPresent: boolean;\n\tcontextManifestPresent: boolean;\n\tcompactionCheckpoints: number;\n\tpendingRequests: number;\n\tagentRuntimeLedgerEntries: number;\n\treplayDeterministic: boolean;\n\tpromotionIdempotencyKey: string;\n}\n\nfunction usage(): string {\n\treturn \"Usage: maestro run inspect|ledger|replay|promote <session-id> [--json]\";\n}\n\nfunction exitWithUsage(message: string): never {\n\tconsole.error(chalk.red(message));\n\tconsole.error(chalk.dim(usage()));\n\tprocess.exit(1);\n}\n\nfunction findHeader(entries: SessionEntry[]): SessionHeaderEntry | undefined {\n\treturn entries.find(\n\t\t(entry): entry is SessionHeaderEntry => entry.type === \"session\",\n\t);\n}\n\nfunction promptContextSummary(\n\theader: SessionHeaderEntry | undefined,\n\ttimeline: ComposerRunTimeline,\n): PromptContextSummary {\n\tconst manifest = header?.promptContextManifest;\n\tconst entries = Array.isArray(\n\t\t(manifest as { entries?: unknown } | undefined)?.entries,\n\t)\n\t\t? ((manifest as { entries: unknown[] }).entries ?? [])\n\t\t: [];\n\tlet projectDocs = 0;\n\tconst mcpServers = new Set<string>();\n\tfor (const entry of entries) {\n\t\tif (!entry || typeof entry !== \"object\") continue;\n\t\tconst kind = (entry as { kind?: unknown }).kind;\n\t\tconst sourceKind = (entry as { sourceKind?: unknown }).sourceKind;\n\t\tconst resourceKind = (entry as { resourceKind?: unknown }).resourceKind;\n\t\tif (\n\t\t\tkind === \"project_doc\" ||\n\t\t\tsourceKind === \"project\" ||\n\t\t\tsourceKind === \"global\"\n\t\t) {\n\t\t\tprojectDocs += 1;\n\t\t} else if (kind === \"mcp_server\" || resourceKind === \"mcp_server\") {\n\t\t\tconst serverName =\n\t\t\t\t(entry as { serverName?: unknown }).serverName ??\n\t\t\t\t(entry as { resourceId?: unknown }).resourceId ??\n\t\t\t\t(entry as { providerId?: unknown }).providerId ??\n\t\t\t\t(entry as { id?: unknown }).id;\n\t\t\tmcpServers.add(typeof serverName === \"string\" ? serverName : \"unknown\");\n\t\t}\n\t}\n\tfor (const tool of header?.tools ?? []) {\n\t\tconst mcpTool = parseMcpToolName(tool.name);\n\t\tif (mcpTool) {\n\t\t\tmcpServers.add(mcpTool.server);\n\t\t}\n\t}\n\tfor (const item of timeline.items) {\n\t\tif (!item.toolName) continue;\n\t\tconst mcpTool = parseMcpToolName(item.toolName);\n\t\tif (mcpTool) {\n\t\t\tmcpServers.add(mcpTool.server);\n\t\t}\n\t}\n\treturn {\n\t\tentries: entries.length,\n\t\tprojectDocs,\n\t\tmcpServers: mcpServers.size,\n\t};\n}\n\nfunction contextManifestSummary(\n\theader: SessionHeaderEntry | undefined,\n\ttimeline: ComposerRunTimeline,\n\tpromptContext: PromptContextSummary,\n): ContextManifestSummary {\n\tconst manifest = header?.unifiedContextManifest;\n\tconst byKind: Record<string, number> = {};\n\tconst bySource: Record<string, number> = {};\n\tconst byStatus: Record<string, number> = {};\n\tconst mcpServers = new Set<string>();\n\tlet mcpResources = 0;\n\tlet mcpPrompts = 0;\n\tlet projectDocs = 0;\n\n\tfor (const entry of manifest?.entries ?? []) {\n\t\tincrement(byKind, entry.kind);\n\t\tincrement(bySource, entry.source);\n\t\tincrement(byStatus, entry.status);\n\t\tif (entry.kind === \"project_doc\") {\n\t\t\tprojectDocs += 1;\n\t\t}\n\t\tif (entry.kind === \"mcp_server\") {\n\t\t\tmcpServers.add(entry.serverName ?? entry.id);\n\t\t}\n\t\tif (entry.kind === \"mcp_resource\") {\n\t\t\tmcpResources += 1;\n\t\t\tif (entry.serverName) {\n\t\t\t\tmcpServers.add(entry.serverName);\n\t\t\t}\n\t\t}\n\t\tif (entry.kind === \"mcp_prompt\") {\n\t\t\tmcpPrompts += 1;\n\t\t\tif (entry.serverName) {\n\t\t\t\tmcpServers.add(entry.serverName);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const tool of header?.tools ?? []) {\n\t\tconst mcpTool = parseMcpToolName(tool.name);\n\t\tif (mcpTool) {\n\t\t\tmcpServers.add(mcpTool.server);\n\t\t}\n\t}\n\tfor (const item of timeline.items) {\n\t\tif (!item.toolName) continue;\n\t\tconst mcpTool = parseMcpToolName(item.toolName);\n\t\tif (mcpTool) {\n\t\t\tmcpServers.add(mcpTool.server);\n\t\t}\n\t}\n\n\tconst summary: ContextManifestSummary = {\n\t\tentries: manifest?.entries.length ?? promptContext.entries,\n\t\tprojectDocs: manifest ? projectDocs : promptContext.projectDocs,\n\t\tmcpServers: manifest ? mcpServers.size : promptContext.mcpServers,\n\t\tmcpResources,\n\t\tmcpPrompts,\n\t\tdiagnostics: manifest?.diagnostics.length ?? 0,\n\t\tbyKind,\n\t\tbySource,\n\t\tbyStatus,\n\t};\n\tif (manifest) {\n\t\tsummary.protocolVersion = manifest.protocolVersion;\n\t\tsummary.version = manifest.version;\n\t\tsummary.cwd = manifest.cwd;\n\t\tsummary.projectDocBytesRead = manifest.projectDocs.bytesRead;\n\t\tif (manifest.projectDocs.maxBytes !== undefined) {\n\t\t\tsummary.projectDocMaxBytes = manifest.projectDocs.maxBytes;\n\t\t}\n\t}\n\treturn summary;\n}\n\nfunction increment(map: Record<string, number>, key: unknown): void {\n\tif (typeof key !== \"string\" || key.length === 0) return;\n\tmap[key] = (map[key] ?? 0) + 1;\n}\n\nfunction countTimeline(\n\ttimeline: ComposerRunTimeline,\n): ReconstructionCountSummary {\n\tconst byType: Record<string, number> = {};\n\tconst byStatus: Record<string, number> = {};\n\tconst byVisibility: Record<string, number> = {};\n\tfor (const item of timeline.items) {\n\t\tincrement(byType, item.type);\n\t\tincrement(byStatus, item.status);\n\t\tincrement(byVisibility, item.visibility);\n\t}\n\treturn {\n\t\ttimelineItems: timeline.items.length,\n\t\tbyType,\n\t\tbyStatus,\n\t\tbyVisibility,\n\t};\n}\n\nfunction buildCoverage(\n\tcounts: ReconstructionCountSummary,\n\tpromptContext: PromptContextSummary,\n\tcontextManifest: ContextManifestSummary,\n): ReconstructionCoverage {\n\treturn {\n\t\tpromptInputs: (counts.byType[\"message.user\"] ?? 0) > 0,\n\t\tassistantResponses: (counts.byType[\"message.assistant\"] ?? 0) > 0,\n\t\ttoolRequests: (counts.byType[\"tool.requested\"] ?? 0) > 0,\n\t\ttoolResults:\n\t\t\t(counts.byType[\"tool.completed\"] ?? 0) +\n\t\t\t\t(counts.byType[\"tool.failed\"] ?? 0) >\n\t\t\t0,\n\t\tcontextManifest: contextManifest.protocolVersion !== undefined,\n\t\tcontextDiagnostics: contextManifest.diagnostics > 0,\n\t\tfileChanges: (counts.byType[\"file.changed\"] ?? 0) > 0,\n\t\tartifacts: (counts.byType[\"artifact.linked\"] ?? 0) > 0,\n\t\tpolicyDecisions: (counts.byType[\"policy.decision\"] ?? 0) > 0,\n\t\tdiagnostics: (counts.byType[\"diagnostic.delta\"] ?? 0) > 0,\n\t\tcompactions: (counts.byType[\"compaction.created\"] ?? 0) > 0,\n\t\tpendingRequests: (counts.byType[\"wait.pending\"] ?? 0) > 0,\n\t\tmcpContext: contextManifest.mcpServers > 0 || promptContext.mcpServers > 0,\n\t};\n}\n\nfunction buildDurabilitySummary(input: {\n\tsessionFile?: string;\n\tsession: { resumeSummary?: string; memoryExtractionHash?: string };\n\tcounts: ReconstructionCountSummary;\n\tcontextManifest: ContextManifestSummary;\n\tagentRuntimeLedger: AgentRuntimeLedgerReport;\n}): RunDurabilitySummary {\n\tconst sessionFilePresent =\n\t\ttypeof input.sessionFile === \"string\" && input.sessionFile.length > 0;\n\tconst contextManifestPresent =\n\t\tinput.contextManifest.protocolVersion !== undefined;\n\tconst replayDeterministic = input.agentRuntimeLedger.replay.deterministic;\n\treturn {\n\t\treconstructable:\n\t\t\tsessionFilePresent &&\n\t\t\tinput.counts.timelineItems > 0 &&\n\t\t\treplayDeterministic,\n\t\tsessionFilePresent,\n\t\tresumeSummaryPresent:\n\t\t\ttypeof input.session.resumeSummary === \"string\" &&\n\t\t\tinput.session.resumeSummary.trim().length > 0,\n\t\tmemoryExtractionHashPresent:\n\t\t\ttypeof input.session.memoryExtractionHash === \"string\" &&\n\t\t\tinput.session.memoryExtractionHash.trim().length > 0,\n\t\tcontextManifestPresent,\n\t\tcompactionCheckpoints: input.counts.byType[\"compaction.created\"] ?? 0,\n\t\tpendingRequests: input.counts.byType[\"wait.pending\"] ?? 0,\n\t\tagentRuntimeLedgerEntries: input.agentRuntimeLedger.counts.entries,\n\t\treplayDeterministic,\n\t\tpromotionIdempotencyKey: input.agentRuntimeLedger.promotion.idempotencyKey,\n\t};\n}\n\nasync function buildRunReconstructionReport(\n\tsessionId: string,\n\toptions: RunInspectOptions = {},\n): Promise<RunReconstructionReport | null> {\n\tconst manager = new SessionManager(false, undefined, {\n\t\tsessionDir: options.sessionDir,\n\t});\n\tconst sessionFile = manager.getSessionFileById(sessionId);\n\tif (!sessionFile) {\n\t\treturn null;\n\t}\n\tconst [session, entries] = await Promise.all([\n\t\tmanager.loadSession(sessionId),\n\t\tmanager.loadEntries(sessionId),\n\t]);\n\tif (!session || !entries) {\n\t\treturn null;\n\t}\n\tmigrateToCurrentVersion(entries);\n\n\tconst header = findHeader(entries);\n\tconst timeline = buildComposerRunTimeline({\n\t\tsessionId,\n\t\tentries,\n\t\tmessages: session.messages,\n\t});\n\tconst trajectory = buildAgentTrajectoryReport(timeline);\n\tconst trajectoryReplay = replayAgentTrajectoryReport(trajectory);\n\tconst trajectoryScore = scoreAgentTrajectoryReport(\n\t\ttrajectory,\n\t\tDEFAULT_AGENT_TRAJECTORY_REPLAY_LAB_RULES,\n\t);\n\tconst trajectoryInspection = buildAgentTrajectoryInspectionReport({\n\t\ttimelineItems: timeline.items,\n\t\ttrajectory,\n\t\treplay: trajectoryReplay,\n\t\tscore: trajectoryScore,\n\t});\n\tconst agentRuntimeLedger = buildAgentRuntimeLedgerReport({\n\t\tsession: {\n\t\t\tid: session.id,\n\t\t\tsessionFile,\n\t\t\t...(header?.cwd ? { cwd: header.cwd } : {}),\n\t\t\t...(header?.model ? { model: header.model } : {}),\n\t\t},\n\t\ttimeline,\n\t\ttrajectory,\n\t\treplay: trajectoryReplay,\n\t});\n\tconst counts = countTimeline(timeline);\n\tconst context = promptContextSummary(header, timeline);\n\tconst contextManifest = contextManifestSummary(header, timeline, context);\n\n\tconst sessionReport: RunReconstructionReport[\"session\"] = {\n\t\tid: session.id,\n\t\tcreatedAt: session.createdAt,\n\t\tupdatedAt: session.updatedAt,\n\t\tmessageCount: session.messageCount,\n\t\tsessionFile,\n\t};\n\tif (session.title) {\n\t\tsessionReport.title = session.title;\n\t}\n\tif (session.summary) {\n\t\tsessionReport.summary = session.summary;\n\t}\n\tif (session.resumeSummary) {\n\t\tsessionReport.resumeSummary = session.resumeSummary;\n\t}\n\tif (session.memoryExtractionHash) {\n\t\tsessionReport.memoryExtractionHash = session.memoryExtractionHash;\n\t}\n\tif (header?.cwd) {\n\t\tsessionReport.cwd = header.cwd;\n\t}\n\tif (header?.model) {\n\t\tsessionReport.model = header.model;\n\t}\n\n\treturn {\n\t\tschemaVersion: RUN_RECONSTRUCTION_SCHEMA,\n\t\tsession: sessionReport,\n\t\tcounts,\n\t\tcoverage: buildCoverage(counts, context, contextManifest),\n\t\tpromptContext: context,\n\t\tcontextManifest,\n\t\ttimeline,\n\t\ttrajectory,\n\t\ttrajectoryReplay,\n\t\ttrajectoryScore,\n\t\ttrajectoryInspection,\n\t\tagentRuntimeLedger,\n\t\tdurability: buildDurabilitySummary({\n\t\t\tsessionFile,\n\t\t\tsession,\n\t\t\tcounts,\n\t\t\tcontextManifest,\n\t\t\tagentRuntimeLedger,\n\t\t}),\n\t};\n}\n\nfunction renderCoverage(coverage: ReconstructionCoverage): string {\n\tconst labels: Array<[keyof ReconstructionCoverage, string]> = [\n\t\t[\"promptInputs\", \"prompt inputs\"],\n\t\t[\"assistantResponses\", \"assistant responses\"],\n\t\t[\"toolRequests\", \"tool requests\"],\n\t\t[\"toolResults\", \"tool results\"],\n\t\t[\"contextManifest\", \"context manifest\"],\n\t\t[\"contextDiagnostics\", \"context diagnostics\"],\n\t\t[\"fileChanges\", \"file changes\"],\n\t\t[\"artifacts\", \"artifacts\"],\n\t\t[\"policyDecisions\", \"policy decisions\"],\n\t\t[\"diagnostics\", \"diagnostics\"],\n\t\t[\"compactions\", \"compactions\"],\n\t\t[\"pendingRequests\", \"pending waits\"],\n\t\t[\"mcpContext\", \"MCP context\"],\n\t];\n\treturn labels\n\t\t.map(([key, label]) => `${coverage[key] ? \"yes\" : \"no\"} ${label}`)\n\t\t.join(\", \");\n}\n\nfunction renderTimelinePreview(timeline: ComposerRunTimeline): string[] {\n\treturn timeline.items.slice(0, 12).map((item: ComposerRunTimelineItem) => {\n\t\tconst parts = [\n\t\t\titem.timestamp,\n\t\t\titem.type,\n\t\t\titem.status,\n\t\t\titem.title,\n\t\t\titem.summary,\n\t\t].filter(Boolean);\n\t\treturn ` - ${parts.join(\" | \")}`;\n\t});\n}\n\nfunction renderRunReconstruction(report: RunReconstructionReport): string {\n\tconst lines = [\n\t\tchalk.bold(`Run reconstruction: ${report.session.id}`),\n\t\t`Session file: ${report.session.sessionFile}`,\n\t\t`Messages: ${report.session.messageCount}`,\n\t\t`Timeline items: ${report.counts.timelineItems}`,\n\t\t`Trajectory events: ${report.trajectory.counts.events}`,\n\t\t`Replay deltas: ${report.trajectoryReplay.counts.deltas} (${report.trajectoryReplay.counts.errors} errors, ${report.trajectoryReplay.counts.warnings} warnings)`,\n\t\t`Trajectory score: ${report.trajectoryScore.counts.failed} failed, ${report.trajectoryScore.counts.warnings} warnings across ${report.trajectoryScore.counts.rules} rule(s)`,\n\t\t`Replay lab: ${report.trajectoryInspection.counts.jumpTargets} event/source jump target(s), redaction=${report.trajectoryInspection.redaction.default}`,\n\t\t`AgentRuntime ledger: ${report.agentRuntimeLedger.counts.entries} entries, ${report.agentRuntimeLedger.counts.promotionOperations} dry-run promotion op(s), replay deterministic=${report.agentRuntimeLedger.replay.deterministic ? \"yes\" : \"no\"}`,\n\t\t`Durability: reconstructable=${report.durability.reconstructable ? \"yes\" : \"no\"}, resume summary=${report.durability.resumeSummaryPresent ? \"yes\" : \"no\"}, memory hash=${report.durability.memoryExtractionHashPresent ? \"yes\" : \"no\"}, checkpoints=${report.durability.compactionCheckpoints}, pending waits=${report.durability.pendingRequests}`,\n\t\t`Coverage: ${renderCoverage(report.coverage)}`,\n\t\t`Prompt context: ${report.promptContext.entries} entries (${report.promptContext.projectDocs} docs, ${report.promptContext.mcpServers} MCP servers)`,\n\t\t`Context manifest: ${report.contextManifest.entries} entries (${report.contextManifest.projectDocs} docs, ${report.contextManifest.mcpServers} MCP servers, ${report.contextManifest.mcpResources} resources, ${report.contextManifest.mcpPrompts} prompts, ${report.contextManifest.diagnostics} diagnostics)`,\n\t\t\"\",\n\t\tchalk.bold(\"Timeline preview\"),\n\t\t...renderTimelinePreview(report.timeline),\n\t];\n\tif (report.timeline.items.length > 12) {\n\t\tlines.push(` ... ${report.timeline.items.length - 12} more item(s)`);\n\t}\n\treturn lines.join(\"\\n\");\n}\n\nexport async function handleRunCommand(\n\tsubcommand?: string,\n\targs: string[] = [],\n\toptions: RunInspectOptions = {},\n): Promise<void> {\n\tif (\n\t\tsubcommand !== \"inspect\" &&\n\t\tsubcommand !== \"ledger\" &&\n\t\tsubcommand !== \"replay\" &&\n\t\tsubcommand !== \"promote\"\n\t) {\n\t\texitWithUsage(\"Run subcommand required.\");\n\t}\n\tconst sessionId = args.find((arg) => !arg.startsWith(\"-\"));\n\tif (!sessionId) {\n\t\texitWithUsage(\"Session id required.\");\n\t}\n\n\tconst report = await buildRunReconstructionReport(sessionId, options);\n\tif (!report) {\n\t\texitWithUsage(`Session not found: ${sessionId}`);\n\t}\n\n\tif (subcommand === \"ledger\") {\n\t\tconsole.log(JSON.stringify(report.agentRuntimeLedger, null, 2));\n\t\treturn;\n\t}\n\tif (subcommand === \"replay\") {\n\t\tconsole.log(JSON.stringify(report.agentRuntimeLedger.replay, null, 2));\n\t\treturn;\n\t}\n\tif (subcommand === \"promote\") {\n\t\tconsole.log(JSON.stringify(report.agentRuntimeLedger.promotion, null, 2));\n\t\treturn;\n\t}\n\n\tif (options.json || args.includes(\"--json\")) {\n\t\tconsole.log(JSON.stringify(report, null, 2));\n\t\treturn;\n\t}\n\n\tconsole.log(renderRunReconstruction(report));\n}\n\nexport const testing = {\n\tbuildRunReconstructionReport,\n\trenderRunReconstruction,\n};\n"]}