@ui-calling/server 0.0.0-stage → 0.1.0-preview.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.
- package/LICENSE +21 -0
- package/README.md +13 -2
- package/dist/chunk-I3ADKMLT.js +134 -0
- package/dist/chunk-I3ADKMLT.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/node.d.ts +22 -0
- package/dist/node.js +38 -0
- package/dist/node.js.map +1 -0
- package/package.json +63 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 San Pau
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ui-calling/server
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The HTTP routes screens talk to: load a link's data, post events, upload files. A Hono app that runs on Node, Bun, Deno and Workers.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { uiCallingHandler, uiCallingRoutes } from "@ui-calling/server";
|
|
7
|
+
import { uiCallingNodeHandler } from "@ui-calling/server/node";
|
|
8
|
+
|
|
9
|
+
app.route("/api/ui", uiCallingRoutes(ui, { dev: process.env.NODE_ENV !== "production" })); // Hono
|
|
10
|
+
const handler = uiCallingHandler(ui); // (Request) => Response, e.g. a Next.js route: GET, POST and DELETE
|
|
11
|
+
app.use("/api/ui", uiCallingNodeHandler(ui)); // Express, Fastify (reply.raw), http.createServer: before any body parser
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
`dev: true` adds the routes behind `npx ui-calling link` and `events` (localhost only). Routes and errors: `npx ui-calling guide api`.
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { Hono } from "hono";
|
|
3
|
+
import { getCookie, setCookie } from "hono/cookie";
|
|
4
|
+
import { bodyLimit } from "hono/body-limit";
|
|
5
|
+
import { UiCallingError, formatEventsForAgent } from "@ui-calling/core";
|
|
6
|
+
var DEVICE_COOKIE = "uic_device";
|
|
7
|
+
function uiCallingRoutes(ui, opts = {}) {
|
|
8
|
+
const app = new Hono();
|
|
9
|
+
app.use("*", async (c, next) => {
|
|
10
|
+
await next();
|
|
11
|
+
c.header("Cache-Control", "no-store");
|
|
12
|
+
c.header("Referrer-Policy", "no-referrer");
|
|
13
|
+
});
|
|
14
|
+
const bindDevice = async (c, next) => {
|
|
15
|
+
const token = c.req.param("token");
|
|
16
|
+
const { issue } = await ui.device(token, getCookie(c, DEVICE_COOKIE));
|
|
17
|
+
if (issue) {
|
|
18
|
+
const path = c.req.path.slice(0, c.req.path.indexOf(`/sessions/${token}`) + `/sessions/${token}`.length);
|
|
19
|
+
setCookie(c, DEVICE_COOKIE, issue, { path, httpOnly: true, sameSite: "Strict", secure: new URL(c.req.url).protocol === "https:" });
|
|
20
|
+
}
|
|
21
|
+
await next();
|
|
22
|
+
};
|
|
23
|
+
app.use("/sessions/:token/*", bindDevice);
|
|
24
|
+
app.get("/sessions/:token", async (c) => c.json(await ui.open(c.req.param("token"))));
|
|
25
|
+
if (opts.dev && process.env.NODE_ENV !== "production") {
|
|
26
|
+
console.warn("[ui-calling] dev routes are on (/dev/links, /dev/events): localhost only, never in production");
|
|
27
|
+
app.use("/dev/*", async (c, next) => {
|
|
28
|
+
const host = new URL(c.req.url).hostname;
|
|
29
|
+
if (!["localhost", "127.0.0.1", "[::1]", "::1"].includes(host)) return c.json({ error: "not_found" }, 404);
|
|
30
|
+
await next();
|
|
31
|
+
});
|
|
32
|
+
app.post("/dev/links", async (c) => {
|
|
33
|
+
const body = await c.req.json();
|
|
34
|
+
const spec = ui.tools().find((t) => t.name === body.surface || t.name.endsWith(`_${body.surface}`));
|
|
35
|
+
if (!spec) return c.json({ error: "unknown_surface", message: `No surface "${body.surface}". Surfaces: ${ui.tools().map((t) => t.name).join(", ")}` }, 404);
|
|
36
|
+
const subject = body.subject ?? "dev-user";
|
|
37
|
+
const conversationId = body.conversationId ?? `dev:${subject}`;
|
|
38
|
+
const props = spec.input_schema.properties ?? {};
|
|
39
|
+
const input = Object.fromEntries(
|
|
40
|
+
Object.entries(body.input ?? {}).map(([k, v]) => [k, props[k]?.type === "string" && (typeof v === "number" || typeof v === "boolean") ? String(v) : v])
|
|
41
|
+
);
|
|
42
|
+
const run = await ui.runTool(spec.name, { ...input, ...body.locale ? { locale: body.locale } : {} }, { conversationId, subject });
|
|
43
|
+
if (!run.ok) {
|
|
44
|
+
const code = run.error.code;
|
|
45
|
+
if (code === "invalid_payload") {
|
|
46
|
+
const required = spec.input_schema.required ?? [];
|
|
47
|
+
const fields = Object.entries(props).filter(([k]) => k !== "locale").map(([k, p]) => ({ name: k, type: typeof p.type === "string" ? p.type : "json", required: required.includes(k) }));
|
|
48
|
+
return c.json({ error: code, message: run.error.message, fields }, 400);
|
|
49
|
+
}
|
|
50
|
+
return c.json({ error: code, message: run.error.message }, code === "unknown_surface" ? 400 : code === "unexpected" ? 500 : 422);
|
|
51
|
+
}
|
|
52
|
+
return c.json({ url: run.silent ? void 0 : run.link.url, conversationId, toolResult: run.content });
|
|
53
|
+
});
|
|
54
|
+
app.get("/dev/events/:conversationId", async (c) => {
|
|
55
|
+
const timeZone = c.req.query("timeZone") ?? ui.timeZone;
|
|
56
|
+
const hide = new Set((c.req.query("hide") ?? "").split(",").filter(Boolean));
|
|
57
|
+
const events = (await ui.events(c.req.param("conversationId"))).filter((e) => !hide.has(e.type));
|
|
58
|
+
return c.text(formatEventsForAgent(events, { timeZone }) || "(no events yet)");
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
const smallBody = bodyLimit({ maxSize: 4 * 1024, onError: (c) => c.json({ error: "payload_too_large", message: "Too large" }, 413) });
|
|
62
|
+
app.post("/sessions/:token/verify", smallBody, async (c) => {
|
|
63
|
+
const body = await c.req.json().catch(() => ({}));
|
|
64
|
+
if (typeof body.code !== "string") return c.json({ error: "invalid_payload", message: "Missing code" }, 400);
|
|
65
|
+
return c.json(await ui.verify(c.req.param("token"), body.code));
|
|
66
|
+
});
|
|
67
|
+
app.post("/sessions/:token/verify/send", async (c) => c.json(await ui.sendCode(c.req.param("token"))));
|
|
68
|
+
app.post(
|
|
69
|
+
"/sessions/:token/events",
|
|
70
|
+
// Events are small: an ID and the user's choices. Anything bigger is a mistake or abuse.
|
|
71
|
+
bodyLimit({ maxSize: 64 * 1024, onError: (c) => c.json({ error: "payload_too_large", message: "Event too large" }, 413) }),
|
|
72
|
+
async (c) => {
|
|
73
|
+
const body = await c.req.json().catch(() => ({}));
|
|
74
|
+
if (!body.type) return c.json({ error: "invalid_payload", message: "Missing event type" }, 400);
|
|
75
|
+
if (body.key !== void 0 && typeof body.key !== "string") return c.json({ error: "invalid_payload", message: "The event key must be a string" }, 400);
|
|
76
|
+
const result = await ui.emit(c.req.param("token"), body.type, body.payload, { key: body.key });
|
|
77
|
+
const { event, data } = result;
|
|
78
|
+
return c.json({ event: event ? { id: event.id, type: event.type } : null, data, ..."repeat" in result ? { repeat: true } : {} });
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
app.post(
|
|
82
|
+
"/sessions/:token/files/:slot",
|
|
83
|
+
bodyLimit({
|
|
84
|
+
maxSize: ui.maxUploadBytes + 64 * 1024,
|
|
85
|
+
onError: (c) => c.json({ error: "invalid_file", reason: "file_too_large", message: "File too large" }, 413)
|
|
86
|
+
}),
|
|
87
|
+
async (c) => {
|
|
88
|
+
const body = await c.req.parseBody().catch(() => ({}));
|
|
89
|
+
const file = body.file;
|
|
90
|
+
if (!(file instanceof File)) return c.json({ error: "invalid_file", reason: "no_file", message: 'Send the file in a multipart field named "file"' }, 400);
|
|
91
|
+
const ref = await ui.upload(c.req.param("token"), c.req.param("slot"), {
|
|
92
|
+
name: file.name,
|
|
93
|
+
type: file.type,
|
|
94
|
+
bytes: new Uint8Array(await file.arrayBuffer())
|
|
95
|
+
});
|
|
96
|
+
return c.json({ file: ref });
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
app.get("/sessions/:token/files/:id", async (c) => {
|
|
100
|
+
const { file, bytes } = await ui.file(c.req.param("token"), c.req.param("id"));
|
|
101
|
+
return c.body(bytes, 200, {
|
|
102
|
+
"Content-Type": file.type,
|
|
103
|
+
// Images and PDFs show in the page; anything else downloads instead of rendering on this origin.
|
|
104
|
+
"Content-Disposition": `${/^image\/|^application\/pdf$/.test(file.type) ? "inline" : "attachment"}; filename*=UTF-8''${encodeURIComponent(file.name)}`,
|
|
105
|
+
// Uploaded bytes are untrusted: never let the browser guess a type or run anything in them.
|
|
106
|
+
"X-Content-Type-Options": "nosniff",
|
|
107
|
+
"Content-Security-Policy": "default-src 'none'; sandbox"
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
app.delete("/sessions/:token/files/:id", async (c) => {
|
|
111
|
+
await ui.deleteFile(c.req.param("token"), c.req.param("id"));
|
|
112
|
+
return c.json({ ok: true });
|
|
113
|
+
});
|
|
114
|
+
app.onError((err, c) => {
|
|
115
|
+
if (err instanceof UiCallingError) {
|
|
116
|
+
const { code, message, retryable, reason, surface, locale } = err;
|
|
117
|
+
return c.json({ error: code, message, retryable, reason, surface, locale }, err.status);
|
|
118
|
+
}
|
|
119
|
+
console.error(err);
|
|
120
|
+
return c.json({ error: "internal" }, 500);
|
|
121
|
+
});
|
|
122
|
+
return app;
|
|
123
|
+
}
|
|
124
|
+
function uiCallingHandler(ui, opts = {}) {
|
|
125
|
+
const app = new Hono().basePath(opts.basePath ?? "/api/ui");
|
|
126
|
+
app.route("/", uiCallingRoutes(ui, opts));
|
|
127
|
+
return (request) => app.fetch(request);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export {
|
|
131
|
+
uiCallingRoutes,
|
|
132
|
+
uiCallingHandler
|
|
133
|
+
};
|
|
134
|
+
//# sourceMappingURL=chunk-I3ADKMLT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { Hono, type Context, type Next } from \"hono\";\nimport { getCookie, setCookie } from \"hono/cookie\";\nimport { bodyLimit } from \"hono/body-limit\";\nimport { UiCallingError, formatEventsForAgent, type UiCalling } from \"@ui-calling/core\";\n\n/**\n * Routes the screen talks to (session, events, and files for surfaces that declare them). Mount them under any prefix:\n * app.route(\"/api/ui\", uiCallingRoutes(ui))\n *\n * Link previews: WhatsApp and other crawlers fetch the page HTML but don't run\n * its JavaScript, so they never hit these routes. That keeps previews from\n * leaking data or counting as \"opened\".\n */\nconst DEVICE_COOKIE = \"uic_device\";\n\nexport function uiCallingRoutes(ui: UiCalling, opts: RouteOptions = {}) {\n const app = new Hono();\n\n app.use(\"*\", async (c, next) => {\n await next();\n // The token lives in the page URL: never cache responses or send it on as a Referer.\n c.header(\"Cache-Control\", \"no-store\");\n c.header(\"Referrer-Policy\", \"no-referrer\");\n });\n\n // Surfaces with `bindToDevice`: the first browser to open the link gets a cookie scoped to this link's routes,\n // and every later request must carry it. Other surfaces pass straight through.\n const bindDevice = async (c: Context, next: Next) => {\n const token = c.req.param(\"token\")!;\n const { issue } = await ui.device(token, getCookie(c, DEVICE_COOKIE));\n if (issue) {\n const path = c.req.path.slice(0, c.req.path.indexOf(`/sessions/${token}`) + `/sessions/${token}`.length);\n setCookie(c, DEVICE_COOKIE, issue, { path, httpOnly: true, sameSite: \"Strict\", secure: new URL(c.req.url).protocol === \"https:\" });\n }\n await next();\n };\n // One registration: in Hono \"/sessions/:token/*\" also matches \"/sessions/:token\", and a second pass would refuse\n // the cookie the first one just issued (the browser hasn't sent it yet).\n app.use(\"/sessions/:token/*\", bindDevice);\n\n app.get(\"/sessions/:token\", async (c) => c.json(await ui.open(c.req.param(\"token\"))));\n\n // Development only: open a screen for a test user without an agent, and see what the agent would read.\n // `npx ui-calling link` and `npx ui-calling events` call these. Never mounted in production.\n if (opts.dev && process.env.NODE_ENV !== \"production\") {\n // They open any user's screens with no login: localhost only, so a dev server reachable through a tunnel or\n // a misconfigured deploy (`next dev` in production, NODE_ENV=development) doesn't expose them.\n console.warn(\"[ui-calling] dev routes are on (/dev/links, /dev/events): localhost only, never in production\");\n app.use(\"/dev/*\", async (c, next) => {\n const host = new URL(c.req.url).hostname;\n if (![\"localhost\", \"127.0.0.1\", \"[::1]\", \"::1\"].includes(host)) return c.json({ error: \"not_found\" }, 404);\n await next();\n });\n app.post(\"/dev/links\", async (c) => {\n const body = await c.req.json<{ surface?: string; input?: Record<string, unknown>; subject?: string; conversationId?: string; locale?: string }>();\n const spec = ui.tools().find((t) => t.name === body.surface || t.name.endsWith(`_${body.surface}`));\n if (!spec) return c.json({ error: \"unknown_surface\", message: `No surface \"${body.surface}\". Surfaces: ${ui.tools().map((t) => t.name).join(\", \")}` }, 404);\n const subject = body.subject ?? \"dev-user\";\n const conversationId = body.conversationId ?? `dev:${subject}`;\n // The CLI reads id=1 as a number: where the contract wants a string, give it one.\n const props = (spec.input_schema.properties ?? {}) as Record<string, { type?: unknown }>;\n const input = Object.fromEntries(\n Object.entries(body.input ?? {}).map(([k, v]) => [k, props[k]?.type === \"string\" && (typeof v === \"number\" || typeof v === \"boolean\") ? String(v) : v]),\n );\n const run = await ui.runTool(spec.name, { ...input, ...(body.locale ? { locale: body.locale } : {}) }, { conversationId, subject });\n // A refusal from resolve (e.g. the test user isn't linked) is 422 with its code; bad input stays 400 and says\n // what the contract takes; anything else (a store that's down, resolve throwing) is 500.\n if (!run.ok) {\n const code = run.error.code;\n if (code === \"invalid_payload\") {\n const required = (spec.input_schema.required ?? []) as string[];\n const fields = Object.entries(props).filter(([k]) => k !== \"locale\").map(([k, p]) => ({ name: k, type: typeof p.type === \"string\" ? p.type : \"json\", required: required.includes(k) }));\n return c.json({ error: code, message: run.error.message, fields }, 400);\n }\n return c.json({ error: code, message: run.error.message }, code === \"unknown_surface\" ? 400 : code === \"unexpected\" ? 500 : 422);\n }\n return c.json({ url: run.silent ? undefined : run.link.url, conversationId, toolResult: run.content });\n });\n app.get(\"/dev/events/:conversationId\", async (c) => {\n // The runtime's zone unless asked for another: the same clock the agent reads.\n const timeZone = c.req.query(\"timeZone\") ?? ui.timeZone;\n // ?hide=left,returned leaves out event types, as an agent usually does with tab switches.\n const hide = new Set((c.req.query(\"hide\") ?? \"\").split(\",\").filter(Boolean));\n const events = (await ui.events(c.req.param(\"conversationId\"))).filter((e) => !hide.has(e.type));\n return c.text(formatEventsForAgent(events, { timeZone }) || \"(no events yet)\");\n });\n }\n\n // Surfaces with `verify`: the PIN or code the user typed, and \"send me a code\". Tiny bodies, like events.\n const smallBody = bodyLimit({ maxSize: 4 * 1024, onError: (c) => c.json({ error: \"payload_too_large\", message: \"Too large\" }, 413) });\n app.post(\"/sessions/:token/verify\", smallBody, async (c) => {\n const body = await c.req.json<{ code?: unknown }>().catch(() => ({}) as { code?: unknown });\n if (typeof body.code !== \"string\") return c.json({ error: \"invalid_payload\", message: \"Missing code\" }, 400);\n return c.json(await ui.verify(c.req.param(\"token\"), body.code));\n });\n app.post(\"/sessions/:token/verify/send\", async (c) => c.json(await ui.sendCode(c.req.param(\"token\"))));\n\n app.post(\n \"/sessions/:token/events\",\n // Events are small: an ID and the user's choices. Anything bigger is a mistake or abuse.\n bodyLimit({ maxSize: 64 * 1024, onError: (c) => c.json({ error: \"payload_too_large\", message: \"Event too large\" }, 413) }),\n async (c) => {\n type Body = { type?: string; payload?: unknown; key?: unknown };\n const body = await c.req.json<Body>().catch(() => ({}) as Body);\n if (!body.type) return c.json({ error: \"invalid_payload\", message: \"Missing event type\" }, 400);\n if (body.key !== undefined && typeof body.key !== \"string\") return c.json({ error: \"invalid_payload\", message: \"The event key must be a string\" }, 400);\n const result = await ui.emit(c.req.param(\"token\"), body.type, body.payload, { key: body.key });\n const { event, data } = result;\n // No event when the handler returned ctx.unchanged(): a repeat that changed nothing.\n // `repeat`: this key already ran, so nothing ran now; `event` is the one the first try recorded.\n return c.json({ event: event ? { id: event.id, type: event.type } : null, data, ...(\"repeat\" in result ? { repeat: true } : {}) });\n },\n );\n\n // Uploads are multipart, with the file in a field named \"file\". The exact limit is per slot (checked by\n // the runtime); this cap only stops bodies bigger than any slot accepts before they're read.\n app.post(\n \"/sessions/:token/files/:slot\",\n bodyLimit({\n maxSize: ui.maxUploadBytes + 64 * 1024,\n onError: (c) => c.json({ error: \"invalid_file\", reason: \"file_too_large\", message: \"File too large\" }, 413),\n }),\n async (c) => {\n const body = await c.req.parseBody().catch(() => ({}) as Record<string, unknown>);\n const file = body.file;\n if (!(file instanceof File)) return c.json({ error: \"invalid_file\", reason: \"no_file\", message: \"Send the file in a multipart field named \\\"file\\\"\" }, 400);\n const ref = await ui.upload(c.req.param(\"token\"), c.req.param(\"slot\"), {\n name: file.name,\n type: file.type,\n bytes: new Uint8Array(await file.arrayBuffer()),\n });\n return c.json({ file: ref });\n },\n );\n\n app.get(\"/sessions/:token/files/:id\", async (c) => {\n const { file, bytes } = await ui.file(c.req.param(\"token\"), c.req.param(\"id\"));\n return c.body(bytes as Uint8Array<ArrayBuffer>, 200, {\n \"Content-Type\": file.type,\n // Images and PDFs show in the page; anything else downloads instead of rendering on this origin.\n \"Content-Disposition\": `${/^image\\/|^application\\/pdf$/.test(file.type) ? \"inline\" : \"attachment\"}; filename*=UTF-8''${encodeURIComponent(file.name)}`,\n // Uploaded bytes are untrusted: never let the browser guess a type or run anything in them.\n \"X-Content-Type-Options\": \"nosniff\",\n \"Content-Security-Policy\": \"default-src 'none'; sandbox\",\n });\n });\n\n app.delete(\"/sessions/:token/files/:id\", async (c) => {\n await ui.deleteFile(c.req.param(\"token\"), c.req.param(\"id\"));\n return c.json({ ok: true });\n });\n\n app.onError((err, c) => {\n if (err instanceof UiCallingError) {\n const { code, message, retryable, reason, surface, locale } = err;\n return c.json({ error: code, message, retryable, reason, surface, locale }, err.status);\n }\n console.error(err);\n return c.json({ error: \"internal\" }, 500);\n });\n\n return app;\n}\n\nexport type RouteOptions = {\n /**\n * Add development routes: `POST /dev/links` opens a screen for a test user, `GET /dev/events/:conversationId`\n * shows what the agent would read. Ignored when NODE_ENV is \"production\". `init` sets it for `next dev`.\n */\n dev?: boolean;\n};\n\n/**\n * The same routes as a plain `(Request) => Response` handler, for frameworks that take one:\n * Next.js route handlers, Remix/React Router actions, Bun.serve, Deno, Workers…\n *\n * // app/api/ui/[...path]/route.ts\n * const handler = uiCallingHandler(ui);\n * export { handler as GET, handler as POST, handler as DELETE }; // DELETE: removing an uploaded file\n */\nexport function uiCallingHandler(ui: UiCalling, opts: RouteOptions & { basePath?: string } = {}) {\n const app = new Hono().basePath(opts.basePath ?? \"/api/ui\");\n app.route(\"/\", uiCallingRoutes(ui, opts));\n return (request: Request) => app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AM,SAAS,WAAW,QAAQ,SAAS,OAAO,IAAI;AAC9D,aAAO,EAAE,KAAK,EAAE,OAAO,MAAM,SAAS,WAAW,QAAQ,SAAS,OAAO,GAAG,IAAI,MAAM;AAAA,IACxF;AACA,YAAQ,MAAM,GAAG;AACjB,WAAO,EAAE,KAAK,EAAE,OAAO,WAAW,GAAG,GAAG;AAAA,EAC1C,CAAC;AAED,SAAO;AACT;AAkBO,SAAS,iBAAiB,IAAe,OAA6C,CAAC,GAAG;AAC/F,QAAM,MAAM,IAAI,KAAK,EAAE,SAAS,KAAK,YAAY,SAAS;AAC1D,MAAI,MAAM,KAAK,gBAAgB,IAAI,IAAI,CAAC;AACxC,SAAO,CAAC,YAAqB,IAAI,MAAM,OAAO;AAChD;","names":[]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as hono_types from 'hono/types';
|
|
2
|
+
import { Hono } from 'hono';
|
|
3
|
+
import { UiCalling } from '@ui-calling/core';
|
|
4
|
+
|
|
5
|
+
declare function uiCallingRoutes(ui: UiCalling, opts?: RouteOptions): Hono<hono_types.BlankEnv, hono_types.BlankSchema, "/">;
|
|
6
|
+
type RouteOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* Add development routes: `POST /dev/links` opens a screen for a test user, `GET /dev/events/:conversationId`
|
|
9
|
+
* shows what the agent would read. Ignored when NODE_ENV is "production". `init` sets it for `next dev`.
|
|
10
|
+
*/
|
|
11
|
+
dev?: boolean;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The same routes as a plain `(Request) => Response` handler, for frameworks that take one:
|
|
15
|
+
* Next.js route handlers, Remix/React Router actions, Bun.serve, Deno, Workers…
|
|
16
|
+
*
|
|
17
|
+
* // app/api/ui/[...path]/route.ts
|
|
18
|
+
* const handler = uiCallingHandler(ui);
|
|
19
|
+
* export { handler as GET, handler as POST, handler as DELETE }; // DELETE: removing an uploaded file
|
|
20
|
+
*/
|
|
21
|
+
declare function uiCallingHandler(ui: UiCalling, opts?: RouteOptions & {
|
|
22
|
+
basePath?: string;
|
|
23
|
+
}): (request: Request) => Response | Promise<Response>;
|
|
24
|
+
|
|
25
|
+
export { uiCallingHandler, uiCallingRoutes };
|
|
26
|
+
export type { RouteOptions };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/node.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
+
import { UiCalling } from '@ui-calling/core';
|
|
3
|
+
import { RouteOptions } from './index.js';
|
|
4
|
+
import 'hono/types';
|
|
5
|
+
import 'hono';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The same routes as a Node `(req, res)` handler, for Express, Fastify (`reply.raw`), Koa or `http.createServer`.
|
|
9
|
+
* Its own entry point so the main one stays free of Node built-ins (Workers, Deno).
|
|
10
|
+
*
|
|
11
|
+
* app.use("/api/ui", uiCallingNodeHandler(ui, { dev: process.env.NODE_ENV !== "production" })); // before express.json()
|
|
12
|
+
*
|
|
13
|
+
* Mount it before any body parser: it reads the raw body (events, file uploads). `basePath` is where you mount
|
|
14
|
+
* it (default /api/ui); Express's `req.originalUrl` is used, so the mount path isn't lost.
|
|
15
|
+
*/
|
|
16
|
+
declare function uiCallingNodeHandler(ui: UiCalling, opts?: RouteOptions & {
|
|
17
|
+
basePath?: string;
|
|
18
|
+
}): (req: IncomingMessage & {
|
|
19
|
+
originalUrl?: string;
|
|
20
|
+
}, res: ServerResponse) => Promise<undefined>;
|
|
21
|
+
|
|
22
|
+
export { uiCallingNodeHandler };
|
package/dist/node.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
uiCallingHandler
|
|
3
|
+
} from "./chunk-I3ADKMLT.js";
|
|
4
|
+
|
|
5
|
+
// src/node.ts
|
|
6
|
+
import { Readable } from "node:stream";
|
|
7
|
+
function uiCallingNodeHandler(ui, opts = {}) {
|
|
8
|
+
const handler = uiCallingHandler(ui, opts);
|
|
9
|
+
return async (req, res) => {
|
|
10
|
+
const url = new URL(req.originalUrl ?? req.url ?? "/", `http://${req.headers.host ?? "localhost"}`);
|
|
11
|
+
const headers = new Headers();
|
|
12
|
+
for (const [k, v] of Object.entries(req.headers)) {
|
|
13
|
+
if (v !== void 0) for (const one of Array.isArray(v) ? v : [v]) headers.append(k, one);
|
|
14
|
+
}
|
|
15
|
+
const hasBody = req.method !== "GET" && req.method !== "HEAD";
|
|
16
|
+
const response = await handler(
|
|
17
|
+
new Request(url, {
|
|
18
|
+
method: req.method,
|
|
19
|
+
headers,
|
|
20
|
+
body: hasBody ? Readable.toWeb(req) : void 0,
|
|
21
|
+
// Node's fetch needs this to send a streamed body; lib.dom's RequestInit doesn't list it.
|
|
22
|
+
...hasBody ? { duplex: "half" } : {}
|
|
23
|
+
})
|
|
24
|
+
);
|
|
25
|
+
res.statusCode = response.status;
|
|
26
|
+
response.headers.forEach((v, k) => {
|
|
27
|
+
if (k !== "set-cookie") res.setHeader(k, v);
|
|
28
|
+
});
|
|
29
|
+
const cookies = response.headers.getSetCookie();
|
|
30
|
+
if (cookies.length) res.setHeader("set-cookie", cookies);
|
|
31
|
+
if (!response.body) return void res.end();
|
|
32
|
+
Readable.fromWeb(response.body).pipe(res);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
uiCallingNodeHandler
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=node.js.map
|
package/dist/node.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/node.ts"],"sourcesContent":["import type { IncomingMessage, ServerResponse } from \"node:http\";\nimport { Readable } from \"node:stream\";\nimport type { UiCalling } from \"@ui-calling/core\";\nimport { uiCallingHandler, type RouteOptions } from \"./index\";\n\n/**\n * The same routes as a Node `(req, res)` handler, for Express, Fastify (`reply.raw`), Koa or `http.createServer`.\n * Its own entry point so the main one stays free of Node built-ins (Workers, Deno).\n *\n * app.use(\"/api/ui\", uiCallingNodeHandler(ui, { dev: process.env.NODE_ENV !== \"production\" })); // before express.json()\n *\n * Mount it before any body parser: it reads the raw body (events, file uploads). `basePath` is where you mount\n * it (default /api/ui); Express's `req.originalUrl` is used, so the mount path isn't lost.\n */\nexport function uiCallingNodeHandler(ui: UiCalling, opts: RouteOptions & { basePath?: string } = {}) {\n const handler = uiCallingHandler(ui, opts);\n return async (req: IncomingMessage & { originalUrl?: string }, res: ServerResponse) => {\n const url = new URL(req.originalUrl ?? req.url ?? \"/\", `http://${req.headers.host ?? \"localhost\"}`);\n const headers = new Headers();\n for (const [k, v] of Object.entries(req.headers)) {\n if (v !== undefined) for (const one of Array.isArray(v) ? v : [v]) headers.append(k, one);\n }\n const hasBody = req.method !== \"GET\" && req.method !== \"HEAD\";\n const response = await handler(\n new Request(url, {\n method: req.method,\n headers,\n body: hasBody ? (Readable.toWeb(req) as ReadableStream) : undefined,\n // Node's fetch needs this to send a streamed body; lib.dom's RequestInit doesn't list it.\n ...(hasBody ? { duplex: \"half\" } : {}),\n } as RequestInit),\n );\n res.statusCode = response.status;\n response.headers.forEach((v, k) => {\n if (k !== \"set-cookie\") res.setHeader(k, v);\n });\n const cookies = response.headers.getSetCookie();\n if (cookies.length) res.setHeader(\"set-cookie\", cookies);\n if (!response.body) return void res.end();\n Readable.fromWeb(response.body as import(\"node:stream/web\").ReadableStream).pipe(res);\n };\n}\n"],"mappings":";;;;;AACA,SAAS,gBAAgB;AAalB,SAAS,qBAAqB,IAAe,OAA6C,CAAC,GAAG;AACnG,QAAM,UAAU,iBAAiB,IAAI,IAAI;AACzC,SAAO,OAAO,KAAiD,QAAwB;AACrF,UAAM,MAAM,IAAI,IAAI,IAAI,eAAe,IAAI,OAAO,KAAK,UAAU,IAAI,QAAQ,QAAQ,WAAW,EAAE;AAClG,UAAM,UAAU,IAAI,QAAQ;AAC5B,eAAW,CAAC,GAAG,CAAC,KAAK,OAAO,QAAQ,IAAI,OAAO,GAAG;AAChD,UAAI,MAAM,OAAW,YAAW,OAAO,MAAM,QAAQ,CAAC,IAAI,IAAI,CAAC,CAAC,EAAG,SAAQ,OAAO,GAAG,GAAG;AAAA,IAC1F;AACA,UAAM,UAAU,IAAI,WAAW,SAAS,IAAI,WAAW;AACvD,UAAM,WAAW,MAAM;AAAA,MACrB,IAAI,QAAQ,KAAK;AAAA,QACf,QAAQ,IAAI;AAAA,QACZ;AAAA,QACA,MAAM,UAAW,SAAS,MAAM,GAAG,IAAuB;AAAA;AAAA,QAE1D,GAAI,UAAU,EAAE,QAAQ,OAAO,IAAI,CAAC;AAAA,MACtC,CAAgB;AAAA,IAClB;AACA,QAAI,aAAa,SAAS;AAC1B,aAAS,QAAQ,QAAQ,CAAC,GAAG,MAAM;AACjC,UAAI,MAAM,aAAc,KAAI,UAAU,GAAG,CAAC;AAAA,IAC5C,CAAC;AACD,UAAM,UAAU,SAAS,QAAQ,aAAa;AAC9C,QAAI,QAAQ,OAAQ,KAAI,UAAU,cAAc,OAAO;AACvD,QAAI,CAAC,SAAS,KAAM,QAAO,KAAK,IAAI,IAAI;AACxC,aAAS,QAAQ,SAAS,IAAgD,EAAE,KAAK,GAAG;AAAA,EACtF;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,65 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui-calling/server",
|
|
3
|
-
"version": "0.0.0
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0-preview.0",
|
|
4
|
+
"description": "HTTP routes that serve ui-calling surfaces and collect their events (Hono, runs on Node, Bun, Workers; a Node (req, res) handler for Express and Fastify).",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/pausanchez/ui-calling.git",
|
|
9
|
+
"directory": "packages/server"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/pausanchez/ui-calling#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/pausanchez/ui-calling/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"ui-calling",
|
|
17
|
+
"hono",
|
|
18
|
+
"agents",
|
|
19
|
+
"ui",
|
|
20
|
+
"express"
|
|
21
|
+
],
|
|
22
|
+
"type": "module",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"ui-calling-source": "./src/index.ts",
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"default": "./dist/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./node": {
|
|
30
|
+
"ui-calling-source": "./src/node.ts",
|
|
31
|
+
"types": "./dist/node.d.ts",
|
|
32
|
+
"default": "./dist/node.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"files": [
|
|
37
|
+
"dist",
|
|
38
|
+
"LICENSE"
|
|
39
|
+
],
|
|
40
|
+
"sideEffects": false,
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsup"
|
|
43
|
+
},
|
|
44
|
+
"tsup": {
|
|
45
|
+
"entry": {
|
|
46
|
+
"index": "src/index.ts",
|
|
47
|
+
"node": "src/node.ts"
|
|
48
|
+
},
|
|
49
|
+
"format": [
|
|
50
|
+
"esm"
|
|
51
|
+
],
|
|
52
|
+
"dts": true,
|
|
53
|
+
"clean": true,
|
|
54
|
+
"sourcemap": true,
|
|
55
|
+
"target": "es2022",
|
|
56
|
+
"removeNodeProtocol": false
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"@ui-calling/core": "^0.1.0-preview.0",
|
|
60
|
+
"hono": "^4.13.0"
|
|
61
|
+
},
|
|
62
|
+
"publishConfig": {
|
|
63
|
+
"access": "public"
|
|
64
|
+
}
|
|
65
|
+
}
|