@tonyclaw/agent-inspector 2.0.33 → 2.0.34
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/.output/nitro.json +1 -1
- package/.output/public/assets/{CompareDrawer-ClTJxdoU.js → CompareDrawer-s5T7W5_w.js} +1 -1
- package/.output/public/assets/{ProxyViewerContainer--Pes01q2.js → ProxyViewerContainer-DfGfP9VH.js} +4 -4
- package/.output/public/assets/{ReplayDialog-iuzfh85b.js → ReplayDialog-DIxp-ccL.js} +1 -1
- package/.output/public/assets/{RequestAnatomy-FZnnP9Gx.js → RequestAnatomy-tfdpiRgw.js} +1 -1
- package/.output/public/assets/{ResponseView-MZ6ZWvbL.js → ResponseView-DMZp3aLW.js} +1 -1
- package/.output/public/assets/{StreamingChunkSequence-B8mZMdzs.js → StreamingChunkSequence-xXzLVw7m.js} +1 -1
- package/.output/public/assets/_sessionId-Dfxcty_X.js +1 -0
- package/.output/public/assets/index-DztLtWHr.js +1 -0
- package/.output/public/assets/{main-B797Hnge.js → main-DHq8ZD95.js} +2 -2
- package/.output/server/_libs/ajv.mjs +827 -6191
- package/.output/server/_libs/cookie-es.mjs +7 -21
- package/.output/server/_libs/h3-v2.mjs +18 -7
- package/.output/server/_libs/json-schema-traverse.mjs +1 -90
- package/.output/server/_libs/seroval-plugins.mjs +5 -5
- package/.output/server/_libs/seroval.mjs +606 -596
- package/.output/server/_libs/srvx.mjs +10 -5
- package/.output/server/_libs/tanstack__history.mjs +55 -38
- package/.output/server/_libs/tanstack__router-core.mjs +4366 -4075
- package/.output/server/{_sessionId-DD05qd8d.mjs → _sessionId-Bow47H8m.mjs} +4 -4
- package/.output/server/_ssr/{CompareDrawer-oGOG5-kQ.mjs → CompareDrawer-Ctn56NJX.mjs} +4 -4
- package/.output/server/_ssr/{ProxyViewerContainer-Bbl5tqT1.mjs → ProxyViewerContainer-DgPsLI2Q.mjs} +7 -7
- package/.output/server/_ssr/{ReplayDialog-BegfwWIy.mjs → ReplayDialog-BD9_rksD.mjs} +5 -5
- package/.output/server/_ssr/{RequestAnatomy-BW_X2DyZ.mjs → RequestAnatomy-BJyzD8pO.mjs} +4 -4
- package/.output/server/_ssr/{ResponseView-Bx_uJ4RS.mjs → ResponseView-lebGC0QX.mjs} +4 -4
- package/.output/server/_ssr/{StreamingChunkSequence-CQp5QQnB.mjs → StreamingChunkSequence-BcOLywzn.mjs} +4 -4
- package/.output/server/_ssr/{index-ODSKeDD8.mjs → index-CgJOsItz.mjs} +4 -4
- package/.output/server/_ssr/index.mjs +20 -11
- package/.output/server/_ssr/{router-QcI4GOvo.mjs → router-BMv4lGQi.mjs} +5192 -5268
- package/.output/server/{_tanstack-start-manifest_v-dEujKJ3-.mjs → _tanstack-start-manifest_v-D2LyT1-l.mjs} +1 -1
- package/.output/server/index.mjs +65 -65
- package/README.md +23 -0
- package/package.json +6 -2
- package/src/lib/groupContract.ts +0 -2
- package/src/lib/runContract.ts +0 -3
- package/src/mcp/server.ts +101 -164
- package/src/mcp/toolHandlers.ts +80 -177
- package/src/routes/api/groups.$groupId.evidence.ts +14 -33
- package/src/routes/api/groups.$groupId.sessions.ts +9 -9
- package/src/routes/api/groups.$groupId.ts +19 -13
- package/src/routes/api/groups.ts +3 -3
- package/src/routes/api/runs.$runId.evidence.ts +14 -21
- package/src/routes/api/runs.$runId.ts +9 -9
- package/src/routes/api/runs.ts +9 -5
- package/src/services/groups.ts +110 -0
- package/src/services/result.ts +17 -0
- package/src/services/runs.ts +76 -0
- package/.output/public/assets/_sessionId-Bc26Rfxs.js +0 -1
- package/.output/public/assets/index-C6AiRPsJ.js +0 -1
package/src/routes/api/runs.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { createFileRoute } from "@tanstack/react-router";
|
|
2
2
|
import { CreateInspectorRunInputSchema } from "../../lib/runContract";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
RECENT_FAILURES_DEFAULT_LIMIT,
|
|
5
|
+
createInspectorRun,
|
|
6
|
+
listInspectorRecentFailures,
|
|
7
|
+
listInspectorRuns,
|
|
8
|
+
} from "../../services/runs";
|
|
5
9
|
|
|
6
10
|
type JsonBodyResult = { ok: true; value: unknown } | { ok: false };
|
|
7
11
|
|
|
@@ -32,10 +36,10 @@ export const Route = createFileRoute("/api/runs")({
|
|
|
32
36
|
url.searchParams.get("limit"),
|
|
33
37
|
RECENT_FAILURES_DEFAULT_LIMIT,
|
|
34
38
|
);
|
|
35
|
-
return Response.json(
|
|
39
|
+
return Response.json(listInspectorRecentFailures(limit));
|
|
36
40
|
}
|
|
37
41
|
|
|
38
|
-
return Response.json(
|
|
42
|
+
return Response.json(listInspectorRuns());
|
|
39
43
|
},
|
|
40
44
|
POST: async ({ request }: { request: Request }) => {
|
|
41
45
|
const body = await readJsonBody(request);
|
|
@@ -51,7 +55,7 @@ export const Route = createFileRoute("/api/runs")({
|
|
|
51
55
|
);
|
|
52
56
|
}
|
|
53
57
|
|
|
54
|
-
return Response.json(
|
|
58
|
+
return Response.json(createInspectorRun(parsed.data), { status: 201 });
|
|
55
59
|
},
|
|
56
60
|
},
|
|
57
61
|
},
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type AddInspectorGroupSessionInput,
|
|
3
|
+
type CreateInspectorGroupInput,
|
|
4
|
+
type DeleteInspectorGroupOptions,
|
|
5
|
+
type DeleteInspectorGroupResponse,
|
|
6
|
+
type GroupEvidenceExportOptions,
|
|
7
|
+
type GroupEvidenceExportResult,
|
|
8
|
+
type GroupEvidenceReadResponse,
|
|
9
|
+
type InspectorGroup,
|
|
10
|
+
type InspectorGroupMember,
|
|
11
|
+
type InspectorGroupsListResponse,
|
|
12
|
+
type UpdateInspectorGroupInput,
|
|
13
|
+
} from "../lib/groupContract";
|
|
14
|
+
import {
|
|
15
|
+
exportGroupEvidence,
|
|
16
|
+
readGroupEvidenceDocument,
|
|
17
|
+
readGroupEvidenceMarkdown,
|
|
18
|
+
} from "../proxy/groupEvidenceExporter";
|
|
19
|
+
import {
|
|
20
|
+
addGroupSession,
|
|
21
|
+
createGroup,
|
|
22
|
+
deleteGroup,
|
|
23
|
+
getGroup,
|
|
24
|
+
listGroups,
|
|
25
|
+
updateGroup,
|
|
26
|
+
} from "../proxy/groupStore";
|
|
27
|
+
import { serviceError, serviceOk, type ServiceResult } from "./result";
|
|
28
|
+
|
|
29
|
+
export type GroupSessionsRead = {
|
|
30
|
+
groupId: string;
|
|
31
|
+
members: InspectorGroupMember[];
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export function listInspectorGroups(): InspectorGroupsListResponse {
|
|
35
|
+
return { groups: listGroups() };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function createInspectorGroup(input: CreateInspectorGroupInput): InspectorGroup {
|
|
39
|
+
return createGroup(input);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function getInspectorGroup(groupId: string): ServiceResult<InspectorGroup> {
|
|
43
|
+
const group = getGroup(groupId);
|
|
44
|
+
if (group === null) return serviceError("not-found", 404, "Group not found");
|
|
45
|
+
return serviceOk(group);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function updateInspectorGroup(
|
|
49
|
+
groupId: string,
|
|
50
|
+
input: UpdateInspectorGroupInput,
|
|
51
|
+
): ServiceResult<InspectorGroup> {
|
|
52
|
+
const group = updateGroup(groupId, input);
|
|
53
|
+
if (group === null) return serviceError("not-found", 404, "Group not found");
|
|
54
|
+
return serviceOk(group);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function deleteInspectorGroup(
|
|
58
|
+
groupId: string,
|
|
59
|
+
options: DeleteInspectorGroupOptions,
|
|
60
|
+
): ServiceResult<DeleteInspectorGroupResponse> {
|
|
61
|
+
const result = deleteGroup(groupId, options);
|
|
62
|
+
if (result === null) return serviceError("not-found", 404, "Group not found");
|
|
63
|
+
return serviceOk(result);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function readInspectorGroupSessions(groupId: string): ServiceResult<GroupSessionsRead> {
|
|
67
|
+
const group = getGroup(groupId);
|
|
68
|
+
if (group === null) return serviceError("not-found", 404, "Group not found");
|
|
69
|
+
return serviceOk({ groupId: group.id, members: group.members });
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function addInspectorGroupSession(
|
|
73
|
+
groupId: string,
|
|
74
|
+
input: AddInspectorGroupSessionInput,
|
|
75
|
+
): ServiceResult<InspectorGroup> {
|
|
76
|
+
const group = addGroupSession(groupId, input);
|
|
77
|
+
if (group === null) return serviceError("not-found", 404, "Group not found");
|
|
78
|
+
return serviceOk(group);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export async function exportInspectorGroupEvidence(
|
|
82
|
+
groupId: string,
|
|
83
|
+
options: GroupEvidenceExportOptions,
|
|
84
|
+
baseUrl: string,
|
|
85
|
+
): Promise<ServiceResult<GroupEvidenceExportResult>> {
|
|
86
|
+
const group = getGroup(groupId);
|
|
87
|
+
if (group === null) return serviceError("not-found", 404, "Group not found");
|
|
88
|
+
return serviceOk(await exportGroupEvidence(group, options, baseUrl));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function readInspectorGroupEvidence(
|
|
92
|
+
groupId: string,
|
|
93
|
+
): ServiceResult<GroupEvidenceReadResponse> {
|
|
94
|
+
const group = getGroup(groupId);
|
|
95
|
+
if (group === null) return serviceError("not-found", 404, "Group not found");
|
|
96
|
+
|
|
97
|
+
const markdown = readGroupEvidenceMarkdown(group);
|
|
98
|
+
if (group.evidence === null || markdown === null) {
|
|
99
|
+
return serviceError("not-exported", 404, "Evidence has not been exported for this group");
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const document = readGroupEvidenceDocument(group);
|
|
103
|
+
return serviceOk({
|
|
104
|
+
group,
|
|
105
|
+
evidence: group.evidence,
|
|
106
|
+
markdown,
|
|
107
|
+
summary: document?.summary ?? null,
|
|
108
|
+
report: document?.jenkinsReport ?? null,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type ServiceErrorCode = "not-found" | "not-exported";
|
|
2
|
+
|
|
3
|
+
export type ServiceResult<T> =
|
|
4
|
+
| { ok: true; value: T }
|
|
5
|
+
| { ok: false; code: ServiceErrorCode; status: number; message: string };
|
|
6
|
+
|
|
7
|
+
export function serviceOk<T>(value: T): ServiceResult<T> {
|
|
8
|
+
return { ok: true, value };
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function serviceError(
|
|
12
|
+
code: ServiceErrorCode,
|
|
13
|
+
status: number,
|
|
14
|
+
message: string,
|
|
15
|
+
): ServiceResult<never> {
|
|
16
|
+
return { ok: false, code, status, message };
|
|
17
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type CreateInspectorRunInput,
|
|
3
|
+
type EvidenceExportOptions,
|
|
4
|
+
type EvidenceExportResult,
|
|
5
|
+
type InspectorRun,
|
|
6
|
+
type InspectorRunEvidence,
|
|
7
|
+
type RecentFailuresResponse,
|
|
8
|
+
type UpdateInspectorRunInput,
|
|
9
|
+
} from "../lib/runContract";
|
|
10
|
+
import { exportRunEvidence, readEvidenceMarkdown } from "../proxy/evidenceExporter";
|
|
11
|
+
import { RECENT_FAILURES_DEFAULT_LIMIT, listRecentFailures } from "../proxy/runFailures";
|
|
12
|
+
import { createRun, getRun, listRuns, updateRun } from "../proxy/runStore";
|
|
13
|
+
import { serviceError, serviceOk, type ServiceResult } from "./result";
|
|
14
|
+
|
|
15
|
+
export type InspectorRunsList = {
|
|
16
|
+
runs: InspectorRun[];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type RunEvidenceRead = {
|
|
20
|
+
run: InspectorRun;
|
|
21
|
+
evidence: InspectorRunEvidence;
|
|
22
|
+
markdown: string;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export function listInspectorRuns(): InspectorRunsList {
|
|
26
|
+
return { runs: listRuns() };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function createInspectorRun(input: CreateInspectorRunInput): InspectorRun {
|
|
30
|
+
return createRun(input);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function getInspectorRun(runId: string): ServiceResult<InspectorRun> {
|
|
34
|
+
const run = getRun(runId);
|
|
35
|
+
if (run === null) return serviceError("not-found", 404, "Run not found");
|
|
36
|
+
return serviceOk(run);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function updateInspectorRun(
|
|
40
|
+
runId: string,
|
|
41
|
+
input: UpdateInspectorRunInput,
|
|
42
|
+
): ServiceResult<InspectorRun> {
|
|
43
|
+
const run = updateRun(runId, input);
|
|
44
|
+
if (run === null) return serviceError("not-found", 404, "Run not found");
|
|
45
|
+
return serviceOk(run);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function listInspectorRecentFailures(
|
|
49
|
+
limit: number = RECENT_FAILURES_DEFAULT_LIMIT,
|
|
50
|
+
): RecentFailuresResponse {
|
|
51
|
+
return listRecentFailures(limit);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { RECENT_FAILURES_DEFAULT_LIMIT };
|
|
55
|
+
|
|
56
|
+
export async function exportInspectorRunEvidence(
|
|
57
|
+
runId: string,
|
|
58
|
+
options: EvidenceExportOptions,
|
|
59
|
+
baseUrl: string,
|
|
60
|
+
): Promise<ServiceResult<EvidenceExportResult>> {
|
|
61
|
+
const run = getRun(runId);
|
|
62
|
+
if (run === null) return serviceError("not-found", 404, "Run not found");
|
|
63
|
+
return serviceOk(await exportRunEvidence(run, options, baseUrl));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function readInspectorRunEvidence(runId: string): ServiceResult<RunEvidenceRead> {
|
|
67
|
+
const run = getRun(runId);
|
|
68
|
+
if (run === null) return serviceError("not-found", 404, "Run not found");
|
|
69
|
+
|
|
70
|
+
const markdown = readEvidenceMarkdown(run);
|
|
71
|
+
if (run.evidence === null || markdown === null) {
|
|
72
|
+
return serviceError("not-exported", 404, "Evidence has not been exported for this run");
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return serviceOk({ run, evidence: run.evidence, markdown });
|
|
76
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{R as s,j as e}from"./main-B797Hnge.js";import{P as i}from"./ProxyViewerContainer--Pes01q2.js";function t(){const{sessionId:o}=s.useParams();return e.jsx(i,{initialSessionId:o},o)}export{t as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{P as o}from"./ProxyViewerContainer--Pes01q2.js";import"./main-B797Hnge.js";const r=o;export{r as component};
|