@tonyclaw/agent-inspector 2.0.30 → 2.0.31

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 (38) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/{CompareDrawer-BDzfRSt1.js → CompareDrawer-tIUf2EJm.js} +1 -1
  3. package/.output/public/assets/ProxyViewerContainer-BxRaXhKR.js +115 -0
  4. package/.output/public/assets/{ReplayDialog-p-5TKg75.js → ReplayDialog-D6v1xcuC.js} +1 -1
  5. package/.output/public/assets/{RequestAnatomy-G0dV8-D_.js → RequestAnatomy-D6PniTlx.js} +1 -1
  6. package/.output/public/assets/{ResponseView-D2wE6lD-.js → ResponseView-Sx8PjuvU.js} +1 -1
  7. package/.output/public/assets/{StreamingChunkSequence-D8JRK-j_.js → StreamingChunkSequence-D-Rbfnxh.js} +1 -1
  8. package/.output/public/assets/_sessionId-BhNTuZ31.js +1 -0
  9. package/.output/public/assets/index-Byk60-jA.css +1 -0
  10. package/.output/public/assets/index-Kxptlkpg.js +1 -0
  11. package/.output/public/assets/{main-XHHZsOBK.js → main-B1kdhY98.js} +2 -2
  12. package/.output/server/_libs/lucide-react.mjs +159 -134
  13. package/.output/server/{_sessionId-CK9QEhkB.mjs → _sessionId-BceHFKf4.mjs} +2 -2
  14. package/.output/server/_ssr/{CompareDrawer-BJVPFMIx.mjs → CompareDrawer-uSxK5Ei5.mjs} +3 -3
  15. package/.output/server/_ssr/{ProxyViewerContainer-DhbmJ2zj.mjs → ProxyViewerContainer-_npQ_f2i.mjs} +566 -17
  16. package/.output/server/_ssr/{ReplayDialog-DXRj95Gj.mjs → ReplayDialog-BHAzSLCT.mjs} +4 -4
  17. package/.output/server/_ssr/{RequestAnatomy-CrYJTXdJ.mjs → RequestAnatomy-DjlZLXBd.mjs} +3 -3
  18. package/.output/server/_ssr/{ResponseView-4ESqSITr.mjs → ResponseView-BuDEJ3fl.mjs} +3 -3
  19. package/.output/server/_ssr/{StreamingChunkSequence-Czdko5n_.mjs → StreamingChunkSequence-DFcu0bD8.mjs} +3 -3
  20. package/.output/server/_ssr/{index-bei0I7qL.mjs → index-Bw6Fw33c.mjs} +2 -2
  21. package/.output/server/_ssr/index.mjs +2 -2
  22. package/.output/server/_ssr/{router-sQh4Gk8J.mjs → router-D90tMCb3.mjs} +50 -15
  23. package/.output/server/{_tanstack-start-manifest_v-C0fdSWnA.mjs → _tanstack-start-manifest_v-BVM4AUlx.mjs} +1 -1
  24. package/.output/server/index.mjs +56 -56
  25. package/package.json +1 -1
  26. package/src/components/ProxyViewer.tsx +9 -2
  27. package/src/components/groups/GroupsDialog.tsx +732 -0
  28. package/src/lib/groupContract.ts +11 -2
  29. package/src/lib/runContract.ts +2 -0
  30. package/src/lib/useGroupEvidence.ts +33 -0
  31. package/src/lib/useGroups.ts +28 -0
  32. package/src/mcp/server.ts +4 -1
  33. package/src/proxy/groupEvidenceExporter.ts +13 -0
  34. package/src/routes/api/groups.$groupId.evidence.ts +14 -2
  35. package/.output/public/assets/ProxyViewerContainer-NtOD8Ex_.js +0 -115
  36. package/.output/public/assets/_sessionId-zimzVrJE.js +0 -1
  37. package/.output/public/assets/index-Cv5vPgpr.js +0 -1
  38. package/.output/public/assets/index-CwlHPmgL.css +0 -1
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { JsonValueSchema } from "../proxy/schemas";
3
- import { InspectorRunSchema, InspectorRunStatusSchema, JenkinsReportSchema } from "./runContract";
3
+ import { EvidenceReportSchema, InspectorRunSchema, InspectorRunStatusSchema } from "./runContract";
4
4
  import { SessionInfoSchema, SessionTokenUsageSchema } from "./sessionInfoContract";
5
5
 
6
6
  export const InspectorGroupStatusSchema = z.enum([
@@ -112,12 +112,20 @@ export const InspectorGroupEvidenceSummarySchema = z.object({
112
112
  runningMembers: z.number().int().nonnegative(),
113
113
  });
114
114
 
115
+ export const GroupEvidenceReadResponseSchema = z.object({
116
+ group: InspectorGroupSchema,
117
+ evidence: InspectorGroupEvidenceSchema,
118
+ markdown: z.string(),
119
+ summary: InspectorGroupEvidenceSummarySchema.nullable(),
120
+ report: EvidenceReportSchema.nullable(),
121
+ });
122
+
115
123
  export const GroupEvidenceExportResultSchema = z.object({
116
124
  group: InspectorGroupSchema,
117
125
  evidence: InspectorGroupEvidenceSchema,
118
126
  members: z.array(InspectorGroupExportMemberSchema),
119
127
  summary: InspectorGroupEvidenceSummarySchema,
120
- jenkinsReport: JenkinsReportSchema,
128
+ jenkinsReport: EvidenceReportSchema,
121
129
  });
122
130
 
123
131
  export const InspectorGroupsListResponseSchema = z.object({
@@ -135,5 +143,6 @@ export type AddInspectorGroupSessionInput = z.infer<typeof AddInspectorGroupSess
135
143
  export type GroupEvidenceExportOptions = z.infer<typeof GroupEvidenceExportOptionsSchema>;
136
144
  export type InspectorGroupExportMember = z.infer<typeof InspectorGroupExportMemberSchema>;
137
145
  export type InspectorGroupEvidenceSummary = z.infer<typeof InspectorGroupEvidenceSummarySchema>;
146
+ export type GroupEvidenceReadResponse = z.infer<typeof GroupEvidenceReadResponseSchema>;
138
147
  export type GroupEvidenceExportResult = z.infer<typeof GroupEvidenceExportResultSchema>;
139
148
  export type InspectorGroupsListResponse = z.infer<typeof InspectorGroupsListResponseSchema>;
@@ -71,6 +71,7 @@ export const JenkinsReportSchema = z.object({
71
71
  summary: z.string(),
72
72
  markdown: z.string(),
73
73
  });
74
+ export const EvidenceReportSchema = JenkinsReportSchema;
74
75
 
75
76
  export const InspectorRunSchema = z.object({
76
77
  id: z.string(),
@@ -153,6 +154,7 @@ export type RunTimelineEvent = z.infer<typeof RunTimelineEventSchema>;
153
154
  export type FailureCategory = z.infer<typeof FailureCategorySchema>;
154
155
  export type FailureClassification = z.infer<typeof FailureClassificationSchema>;
155
156
  export type JenkinsReport = z.infer<typeof JenkinsReportSchema>;
157
+ export type EvidenceReport = JenkinsReport;
156
158
  export type InspectorRun = z.infer<typeof InspectorRunSchema>;
157
159
  export type CreateInspectorRunInput = z.infer<typeof CreateInspectorRunInputSchema>;
158
160
  export type UpdateInspectorRunInput = z.infer<typeof UpdateInspectorRunInputSchema>;
@@ -0,0 +1,33 @@
1
+ import useSWR, { type SWRResponse } from "swr";
2
+ import {
3
+ GroupEvidenceReadResponseSchema,
4
+ type GroupEvidenceReadResponse,
5
+ type InspectorGroup,
6
+ } from "./groupContract";
7
+ import { fetchJson } from "./apiClient";
8
+
9
+ type UseGroupEvidenceResult = {
10
+ evidenceResponse: GroupEvidenceReadResponse | null;
11
+ isLoading: boolean;
12
+ error: Error | undefined;
13
+ mutate: SWRResponse<GroupEvidenceReadResponse, Error>["mutate"];
14
+ };
15
+
16
+ function evidenceKey(group: InspectorGroup | null): string | null {
17
+ if (group === null || group.evidence === null) return null;
18
+ return `/api/groups/${encodeURIComponent(group.id)}/evidence`;
19
+ }
20
+
21
+ export function useGroupEvidence(group: InspectorGroup | null): UseGroupEvidenceResult {
22
+ const response: SWRResponse<GroupEvidenceReadResponse, Error> = useSWR<
23
+ GroupEvidenceReadResponse,
24
+ Error
25
+ >(evidenceKey(group), (url: string) => fetchJson(url, GroupEvidenceReadResponseSchema));
26
+
27
+ return {
28
+ evidenceResponse: response.data ?? null,
29
+ isLoading: response.isLoading,
30
+ error: response.error,
31
+ mutate: response.mutate,
32
+ };
33
+ }
@@ -0,0 +1,28 @@
1
+ import useSWR, { type SWRResponse } from "swr";
2
+ import {
3
+ InspectorGroupsListResponseSchema,
4
+ type InspectorGroup,
5
+ type InspectorGroupsListResponse,
6
+ } from "./groupContract";
7
+ import { fetchJson } from "./apiClient";
8
+
9
+ type UseGroupsResult = {
10
+ groups: InspectorGroup[];
11
+ isLoading: boolean;
12
+ error: Error | undefined;
13
+ mutate: SWRResponse<InspectorGroupsListResponse, Error>["mutate"];
14
+ };
15
+
16
+ export function useGroups(): UseGroupsResult {
17
+ const response: SWRResponse<InspectorGroupsListResponse, Error> = useSWR<
18
+ InspectorGroupsListResponse,
19
+ Error
20
+ >("/api/groups", (url: string) => fetchJson(url, InspectorGroupsListResponseSchema));
21
+
22
+ return {
23
+ groups: response.data?.groups ?? [],
24
+ isLoading: response.isLoading,
25
+ error: response.error,
26
+ mutate: response.mutate,
27
+ };
28
+ }
package/src/mcp/server.ts CHANGED
@@ -16,6 +16,7 @@
16
16
  */
17
17
 
18
18
  import { z } from "zod";
19
+ import packageJson from "../../package.json";
19
20
  import {
20
21
  type GetPromptResult,
21
22
  type ListResourcesResult,
@@ -80,12 +81,14 @@ import {
80
81
 
81
82
  type ServerPair = { server: McpServer; transport: WebStandardStreamableHTTPServerTransport };
82
83
 
84
+ export const MCP_SERVER_VERSION = packageJson.version;
85
+
83
86
  let initialized: ServerPair | null = null;
84
87
  let initPromise: Promise<ServerPair> | null = null;
85
88
 
86
89
  function buildServer(): ServerPair {
87
90
  const server = new McpServer(
88
- { name: "agent-inspector", version: "1.0.0" },
91
+ { name: "agent-inspector", version: MCP_SERVER_VERSION },
89
92
  { capabilities: { tools: {}, resources: {}, prompts: {} } },
90
93
  );
91
94
  registerTools(server);
@@ -1,6 +1,7 @@
1
1
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import {
4
+ GroupEvidenceExportResultSchema,
4
5
  type GroupEvidenceExportOptions,
5
6
  type GroupEvidenceExportResult,
6
7
  type InspectorGroup,
@@ -339,3 +340,15 @@ export function readGroupEvidenceMarkdown(group: InspectorGroup): string | null
339
340
  return null;
340
341
  }
341
342
  }
343
+
344
+ export function readGroupEvidenceDocument(group: InspectorGroup): GroupEvidenceExportResult | null {
345
+ const path = group.evidence?.jsonPath;
346
+ if (path === undefined || !existsSync(path)) return null;
347
+ try {
348
+ const raw: unknown = JSON.parse(readFileSync(path, "utf8"));
349
+ const parsed = GroupEvidenceExportResultSchema.safeParse(raw);
350
+ return parsed.success ? parsed.data : null;
351
+ } catch {
352
+ return null;
353
+ }
354
+ }
@@ -1,6 +1,10 @@
1
1
  import { createFileRoute } from "@tanstack/react-router";
2
2
  import { GroupEvidenceExportOptionsSchema } from "../../lib/groupContract";
3
- import { exportGroupEvidence, readGroupEvidenceMarkdown } from "../../proxy/groupEvidenceExporter";
3
+ import {
4
+ exportGroupEvidence,
5
+ readGroupEvidenceDocument,
6
+ readGroupEvidenceMarkdown,
7
+ } from "../../proxy/groupEvidenceExporter";
4
8
  import { getGroup } from "../../proxy/groupStore";
5
9
 
6
10
  type JsonBodyResult = { ok: true; value: unknown } | { ok: false };
@@ -32,7 +36,15 @@ export const Route = createFileRoute("/api/groups/$groupId/evidence")({
32
36
  );
33
37
  }
34
38
 
35
- return Response.json({ group, evidence: group.evidence, markdown });
39
+ const document = readGroupEvidenceDocument(group);
40
+
41
+ return Response.json({
42
+ group,
43
+ evidence: group.evidence,
44
+ markdown,
45
+ summary: document?.summary ?? null,
46
+ report: document?.jenkinsReport ?? null,
47
+ });
36
48
  },
37
49
  POST: async ({ params, request }: { params: { groupId: string }; request: Request }) => {
38
50
  const group = getGroup(params.groupId);