@intentface/latch-server 0.9.1 → 0.10.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentface/latch-server",
3
- "version": "0.9.1",
3
+ "version": "0.10.0",
4
4
  "description": "The mountable Latch HTTP surface — one framework-agnostic Web handler (chat, approvals, lists, MCP connection OAuth). Hono adapter in the /hono subpath.",
5
5
  "keywords": [
6
6
  "ai",
@@ -36,8 +36,8 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "croner": "^10.0.1",
39
- "@intentface/latch-core": "^0.9.1",
40
- "@intentface/latch-mcp": "^0.9.1"
39
+ "@intentface/latch-core": "^0.10.0",
40
+ "@intentface/latch-mcp": "^0.10.0"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "ai": ">=7.0.0-beta.178",
package/dist/server.d.ts DELETED
@@ -1,18 +0,0 @@
1
- import { Hono } from "hono";
2
- import type { Principal, Runtime } from "@intentface/latch-core";
3
- /**
4
- * A mountable Hono app exposing the runtime over HTTP.
5
- *
6
- * Default route: `POST /agents/:agent/:id` — prompt the agent in conversation
7
- * `:id` (a client-chosen key, tenant-namespaced here), returning a streaming
8
- * UIMessage Response. Mount it under any prefix + your own middleware (embed),
9
- * or run it standalone. Auth is BYO via `resolveContext` — the core never
10
- * authenticates; everything below is scoped by the returned `Principal`.
11
- */
12
- export interface LatchServerConfig {
13
- runtime: Runtime;
14
- /** Map a request to a Principal (your existing auth). */
15
- resolveContext: (request: Request) => Principal | Promise<Principal>;
16
- }
17
- export declare function createLatchHono(config: LatchServerConfig): Hono;
18
- //# sourceMappingURL=server.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,KAAK,EAGV,SAAS,EACT,OAAO,EACR,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,yDAAyD;IACzD,cAAc,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;CACtE;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAwC/D"}
package/dist/server.js DELETED
@@ -1,61 +0,0 @@
1
- import { Hono } from "hono";
2
- export function createLatchHono(config) {
3
- const app = new Hono();
4
- app.post("/agents/:agent/:id", async (c) => {
5
- const principal = await config.resolveContext(c.req.raw);
6
- const agent = c.req.param("agent");
7
- const rawId = c.req.param("id");
8
- // Tenant-namespaced chat key: org_a's "ticket-1" ≠ org_b's "ticket-1".
9
- const chatId = `${principal.orgId}:${rawId}`;
10
- const body = (await c.req
11
- .json()
12
- .catch(() => ({})));
13
- const message = toUserMessage(body);
14
- return config.runtime.handleChat({
15
- agent,
16
- chatId,
17
- principal,
18
- message,
19
- request: c.req.raw,
20
- });
21
- });
22
- // HITL: submit tool-approval decisions and continue the turn (streams the
23
- // continuation, same as a chat turn). Body: `{ decisions: [{approvalId, approved, reason?}] }`.
24
- app.post("/agents/:agent/:id/approvals", async (c) => {
25
- const principal = await config.resolveContext(c.req.raw);
26
- const chatId = `${principal.orgId}:${c.req.param("id")}`;
27
- const body = (await c.req.json().catch(() => ({})));
28
- const decisions = Array.isArray(body.decisions) ? body.decisions : [];
29
- return config.runtime.applyApproval({
30
- chatId,
31
- principal,
32
- decisions,
33
- request: c.req.raw,
34
- });
35
- });
36
- return app;
37
- }
38
- /** Accept `{ message }`, `{ text }`, or a `useChat`-style `{ messages }` (last). */
39
- function toUserMessage(body) {
40
- const explicit = body.message;
41
- if (explicit?.parts)
42
- return explicit;
43
- let text = "";
44
- if (typeof body.text === "string") {
45
- text = body.text;
46
- }
47
- else if (Array.isArray(body.messages)) {
48
- const last = body.messages[body.messages.length - 1];
49
- text = (last?.parts ?? [])
50
- .filter((p) => p.type === "text")
51
- .map((p) => p.text)
52
- .join("");
53
- }
54
- return {
55
- id: crypto.randomUUID(),
56
- role: "user",
57
- parts: [{ type: "text", text }],
58
- metadata: { visibility: "user", createdAt: Date.now() },
59
- };
60
- }
61
- //# sourceMappingURL=server.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAuB5B,MAAM,UAAU,eAAe,CAAC,MAAyB;IACvD,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IAEvB,GAAG,CAAC,IAAI,CAAC,oBAAoB,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;QACzC,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACzD,MAAM,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACnC,MAAM,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAChC,uEAAuE;QACvE,MAAM,MAAM,GAAG,GAAG,SAAS,CAAC,KAAK,IAAI,KAAK,EAAE,CAAC;QAC7C,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG;aACtB,IAAI,EAAE;aACN,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAA4B,CAAC;QACjD,MAAM,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;QACpC,OAAO,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC;YAC/B,KAAK;YACL,MAAM;YACN,SAAS;YACT,OAAO;YACP,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG;SACnB,CAAC,CAAC;IACL,CAAC,CAAC,C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