@yushih/agent-symposium 0.0.0-stage → 0.0.1

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 (68) hide show
  1. package/README.md +2 -2
  2. package/api/contract.js +39 -0
  3. package/package.json +15 -4
  4. package/package.json~ +17 -0
  5. package/public/assets/abnfDiagram-VCTEODGH-Js6Rrzgw.js +1 -0
  6. package/public/assets/architectureDiagram-5GKGNRK7-D1XJWPp5.js +36 -0
  7. package/public/assets/blockDiagram-I7D4REHJ-C0IusX6s.js +129 -0
  8. package/public/assets/c4Diagram-7LVT6UL2-VqSRyhiL.js +38 -0
  9. package/public/assets/channel-BBLi4I4y.js +1 -0
  10. package/public/assets/chunk-2Q5K7J3B-gW5WXQ_L.js +1 -0
  11. package/public/assets/chunk-5VM5RSS4-JpZyZpNy.js +15 -0
  12. package/public/assets/chunk-F27PBJKO-i24AbnCS.js +1 -0
  13. package/public/assets/chunk-IMKFNOWR-CZPfsfvy.js +231 -0
  14. package/public/assets/chunk-JWPE2WC7-4m0OBNzR.js +1 -0
  15. package/public/assets/chunk-POPQ4Y6H-DRAyn2gm.js +1 -0
  16. package/public/assets/chunk-SVP7TREG-Clh6ApHO.js +88 -0
  17. package/public/assets/chunk-TICWLB2K-NdBF09L-.js +206 -0
  18. package/public/assets/chunk-XXDRQBXY-GOkNmdCR.js +1 -0
  19. package/public/assets/classDiagram-ZZMXUADV-oVrpdu5B.js +1 -0
  20. package/public/assets/classDiagram-v2-VYDZK3BY-BN7Y2lnx.js +1 -0
  21. package/public/assets/cose-bilkent-JH36ORCC-v1dSRzjh.js +1 -0
  22. package/public/assets/cynefin-OW5HDTMX-DF5PyYiH.js +166 -0
  23. package/public/assets/cynefinDiagram-5FMLGOSQ-BT_Y-cAy.js +62 -0
  24. package/public/assets/cytoscape.esm-BHa1VTXv.js +321 -0
  25. package/public/assets/d3-scale-4DPf7zan.js +1 -0
  26. package/public/assets/dagre-GXQ25YYZ-BdIw5lbe.js +4 -0
  27. package/public/assets/diagram-S7CK7UJ4-C7FBKTZS.js +30 -0
  28. package/public/assets/diagram-UQ7AKVKN-lKdG7lqX.js +41 -0
  29. package/public/assets/diagram-VSXAHHWV-D_3F9ILF.js +3 -0
  30. package/public/assets/diagram-VX7I27RA-CDlQWNIj.js +24 -0
  31. package/public/assets/diagram-Z3DM3KII-DwScjNa6.js +24 -0
  32. package/public/assets/ebnfDiagram-PWID7BFC-CvYgSJJ8.js +1 -0
  33. package/public/assets/erDiagram-RLTQ6QDP-BTvcZ95I.js +99 -0
  34. package/public/assets/flowDiagram-HODETNUW-yqFIam_I.js +168 -0
  35. package/public/assets/ganttDiagram-EL5Y4UJY-CmO3baEZ.js +292 -0
  36. package/public/assets/gitGraphDiagram-WWUBYQGX-D9BBCVBd.js +106 -0
  37. package/public/assets/index-C7iS8lCk.css +1 -0
  38. package/public/assets/index-_OdfRxhK.js +68 -0
  39. package/public/assets/infoDiagram-27XIBGKW-l4ZAb9bV.js +2 -0
  40. package/public/assets/ishikawaDiagram-5VMMS53U-DCWxeMY-.js +70 -0
  41. package/public/assets/journeyDiagram-3NMN7TZE-DyFpfxWW.js +139 -0
  42. package/public/assets/kanban-definition-UXKFOSKX-D8ymfQnB.js +89 -0
  43. package/public/assets/katex-HP8lGamR.js +257 -0
  44. package/public/assets/layout-cA8VY5f7.js +1 -0
  45. package/public/assets/mermaid.core-DPkPce7p.js +308 -0
  46. package/public/assets/mindmap-definition-YA3MSWOX-Dlp2rW3e.js +96 -0
  47. package/public/assets/pegDiagram-XKGWAZYB-DodDrWUK.js +1 -0
  48. package/public/assets/pieDiagram-E7YTZNPT-OEEepLsx.js +39 -0
  49. package/public/assets/quadrantDiagram-AXDQQJYC-D28ZmzWs.js +7 -0
  50. package/public/assets/railroadDiagram-O6MQD6OU-CWmn2qRn.js +1 -0
  51. package/public/assets/requirementDiagram-BXWQKSXE-BFcRQnk_.js +84 -0
  52. package/public/assets/sankeyDiagram-P5KCCOFB-A0R7BzAD.js +40 -0
  53. package/public/assets/sequenceDiagram-WJ2MYXX4-DvHW0_gb.js +162 -0
  54. package/public/assets/sizeCapture-INFHLROL-DXG_91Jv.js +1 -0
  55. package/public/assets/stateDiagram-D77RDMKH-Cmt-TYLs.js +1 -0
  56. package/public/assets/stateDiagram-v2-MP3YSRHH-D_3rt-M8.js +1 -0
  57. package/public/assets/swimlanes-42K2YHIH-DMxcvovR.js +1 -0
  58. package/public/assets/swimlanesDiagram-VR7AAH4N-DZpV22EG.js +8 -0
  59. package/public/assets/timeline-definition-24CTP7MA-DNOeH402.js +120 -0
  60. package/public/assets/vennDiagram-4TSXK5OY-DoeDdhSY.js +34 -0
  61. package/public/assets/wardleyDiagram-VM6X3IG4-D8kM2WC_.js +78 -0
  62. package/public/assets/xychartDiagram-S5SC5T6Z-BF_OH43h.js +7 -0
  63. package/public/index.html +3 -0
  64. package/server/app.js +107 -0
  65. package/server/chat.js +70 -0
  66. package/server/main.js +50 -0
  67. package/server/presentation.js +34 -0
  68. package/server/repository.js +42 -0
package/server/main.js ADDED
@@ -0,0 +1,50 @@
1
+ import { createReadStream } from "node:fs";
2
+ import { stat } from "node:fs/promises";
3
+ import { extname, join } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import { startServer } from "./app.js";
6
+ const publicDir = fileURLToPath(new URL("../public/", import.meta.url));
7
+ const contentTypes = {
8
+ ".html": "text/html; charset=utf-8", ".js": "text/javascript; charset=utf-8",
9
+ ".css": "text/css; charset=utf-8", ".svg": "image/svg+xml", ".png": "image/png",
10
+ ".woff2": "font/woff2", ".woff": "font/woff", ".json": "application/json"
11
+ };
12
+ await startServer(async (request, response) => {
13
+ if (request.method !== "GET" && request.method !== "HEAD") {
14
+ response.writeHead(405, { Allow: "GET, HEAD" }).end();
15
+ return;
16
+ }
17
+ let path;
18
+ try {
19
+ path = decodeURIComponent((request.url ?? "/").split("?")[0]);
20
+ }
21
+ catch {
22
+ response.writeHead(400).end();
23
+ return;
24
+ }
25
+ const parts = path === "/" ? ["index.html"] : path.slice(1).split("/");
26
+ if (parts.some(part => !part || part.startsWith(".") || /[\\:\0]/.test(part))) {
27
+ response.writeHead(404).end();
28
+ return;
29
+ }
30
+ const file = join(publicDir, ...parts);
31
+ try {
32
+ const info = await stat(file);
33
+ if (!info.isFile()) {
34
+ response.writeHead(404).end();
35
+ return;
36
+ }
37
+ response.writeHead(200, {
38
+ "Content-Type": contentTypes[extname(file)] ?? "application/octet-stream",
39
+ "Content-Length": info.size,
40
+ "X-Content-Type-Options": "nosniff"
41
+ });
42
+ if (request.method === "HEAD")
43
+ response.end();
44
+ else
45
+ createReadStream(file).on("error", () => response.destroy()).pipe(response);
46
+ }
47
+ catch {
48
+ response.writeHead(404).end();
49
+ }
50
+ });
@@ -0,0 +1,34 @@
1
+ import { parse } from "smol-toml";
2
+ import { PresentationUpload } from "../api/contract.js";
3
+ export async function receivePresentation(request, response, origin, publish) {
4
+ function reject(status, message) {
5
+ response.writeHead(status, { "Content-Type": "text/plain; charset=utf-8" }).end(message);
6
+ }
7
+ if (request.headers.host !== new URL(origin).host || (request.headers.origin && request.headers.origin !== origin))
8
+ return reject(403, "Use the local review server.");
9
+ if (request.method !== PresentationUpload.method) {
10
+ response.setHeader("Allow", PresentationUpload.method);
11
+ return reject(405, "Use POST.");
12
+ }
13
+ if (request.headers["content-type"]?.split(";")[0].trim() !== PresentationUpload.contentType)
14
+ return reject(415, "Send an application/toml body.");
15
+ const chunks = [];
16
+ let bytes = 0;
17
+ try {
18
+ for await (const chunk of request) {
19
+ bytes += chunk.length;
20
+ if (bytes > 4 * 1024 * 1024)
21
+ return reject(413, "Presentation exceeds 4 MiB.");
22
+ chunks.push(chunk);
23
+ }
24
+ const source = new TextDecoder("utf-8", { fatal: true }).decode(Buffer.concat(chunks));
25
+ const result = PresentationUpload.document.safeParse(parse(source));
26
+ if (!result.success)
27
+ return reject(400, "Expected a pages array with an html string for each page.");
28
+ publish(result.data);
29
+ response.writeHead(204).end();
30
+ }
31
+ catch {
32
+ reject(400, "Could not read a UTF-8 TOML presentation.");
33
+ }
34
+ }
@@ -0,0 +1,42 @@
1
+ import { execFile } from "node:child_process";
2
+ import { basename } from "node:path";
3
+ import { Effect } from "effect";
4
+ export function git(cwd, args, allowed = []) {
5
+ return Effect.tryPromise(() => new Promise((resolve, reject) => {
6
+ execFile("git", ["--literal-pathspecs", ...args], { cwd, maxBuffer: 64 * 1024 * 1024 }, (error, stdout) => {
7
+ if (error && !allowed.includes(Number(error.code)))
8
+ reject(error);
9
+ else
10
+ resolve(stdout);
11
+ });
12
+ }));
13
+ }
14
+ const fields = (s) => s.split("\0").filter(Boolean);
15
+ export function snapshot(root) {
16
+ return Effect.gen(function* () {
17
+ const hasHead = yield* git(root, ["rev-parse", "--verify", "-q", "HEAD"], [1]);
18
+ const base = hasHead ? ["HEAD"] : [];
19
+ const paths = fields(yield* git(root, ["ls-files", "--cached", "--others", "--exclude-standard", "-z"]));
20
+ const files = new Map(paths.map(path => [path, { path, status: "clean", patch: "" }]));
21
+ const untracked = fields(yield* git(root, ["ls-files", "--others", "--exclude-standard", "-z"]));
22
+ // A newly initialized repository compares against Git's canonical empty tree.
23
+ const revision = base.length ? base : [(yield* git(root, ["hash-object", "-t", "tree", "/dev/null"])).trim()];
24
+ const changes = fields(yield* git(root, ["diff", "--name-status", "-z", "-M", ...revision, "--"]));
25
+ const opts = ["--no-ext-diff", "--no-textconv", "--no-color", "-M"];
26
+ for (let i = 0; i < changes.length;) {
27
+ const code = changes[i++][0], first = changes[i++];
28
+ const path = code === "R" ? changes[i++] : first;
29
+ const from = code === "R" ? first : undefined;
30
+ if (from)
31
+ files.delete(from);
32
+ const patch = yield* git(root, ["diff", ...opts, ...revision, "--", ...(from ? [from] : []), path]);
33
+ const status = { R: "renamed", D: "deleted", A: "added", U: "conflict" }[code] ?? "modified";
34
+ files.set(path, { path, from, status, patch });
35
+ }
36
+ for (const path of untracked) {
37
+ const patch = yield* git(root, ["diff", "--no-index", ...opts, "--", "/dev/null", path], [1]);
38
+ files.set(path, { path, status: "added", patch });
39
+ }
40
+ return { repository: basename(root), files: [...files.values()].sort((a, b) => a.path.localeCompare(b.path)) };
41
+ });
42
+ }