agent-lyceum 0.46.0 → 0.47.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.
@@ -6,8 +6,8 @@
6
6
  <meta name="lyceum-token" content="__LYCEUM_TOKEN__" />
7
7
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
8
8
  <title>agent-lyceum</title>
9
- <script type="module" crossorigin src="/assets/index-C8HSRh87.js"></script>
10
- <link rel="stylesheet" crossorigin href="/assets/index-DGBtVh9L.css">
9
+ <script type="module" crossorigin src="/assets/index-DR70f29d.js"></script>
10
+ <link rel="stylesheet" crossorigin href="/assets/index-B6zfKBBo.css">
11
11
  </head>
12
12
  <body>
13
13
  <div id="root"></div>
@@ -159,6 +159,28 @@ export async function handleApi(req, res, url, deps) {
159
159
  else
160
160
  send(res, 404, { error: "這次任務沒有待回答的問題。" });
161
161
  }
162
+ else if (req.method === "GET" && (p === "/api/reports" || p === "/api/report")) {
163
+ const project = url.searchParams.get("project") ?? "";
164
+ const run = url.searchParams.get("run") ?? "";
165
+ if (!NAME_RE.test(project) || !NAME_RE.test(run)) {
166
+ send(res, 400, { error: "請求格式不對。" });
167
+ return true;
168
+ }
169
+ if (p === "/api/reports") {
170
+ const reports = deps.listReports(project, run);
171
+ if (reports)
172
+ send(res, 200, { reports });
173
+ else
174
+ send(res, 404, { error: "找不到這次任務。" });
175
+ }
176
+ else {
177
+ const report = deps.readReport(project, run, url.searchParams.get("id") ?? "");
178
+ if (report)
179
+ send(res, 200, report);
180
+ else
181
+ send(res, 404, { error: "找不到這份報告。" });
182
+ }
183
+ }
162
184
  else if (req.method === "POST" && p === "/api/ask/answers") {
163
185
  const b = await body(req, res);
164
186
  if (!b)