@happyvertical/smrt-chat 0.40.5 → 0.40.7
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/AGENTS.md +1 -0
- package/dist/client.d.ts +132 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +97 -0
- package/dist/client.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/manifest.json +18 -18
- package/dist/smrt-knowledge.json +7 -6
- package/package.json +17 -13
package/AGENTS.md
CHANGED
|
@@ -65,6 +65,7 @@ The gateway bearer token proves only "this request came from the gateway"; it ne
|
|
|
65
65
|
|
|
66
66
|
- **`runChatConversationStream({ context, messages })`** — the transport-agnostic engine (an `AsyncGenerator<ChatStreamEvent>`). Dispatches on `context.binding`: **persona-bound** runs the full `runPersonaConversationTurn` with a token sink wired through the tool loop (`onToken` → `ai.chat({ stream: true, onProgress })`), then persists via `ChatService` and emits the persisted message as `done`; **plain/unbound** streams `ai.stream()` directly and emits a synthesized (unpersisted) `done`. Streamed tokens are a live PREVIEW (a tool-call round may narrate before acting); the `done` message is authoritative. Failures surface as an in-band `error` event, never a throw (the 200 has already committed once streaming starts).
|
|
67
67
|
- **`createChatStreamHandler({ authorize, allowedOrigins?, allowCredentials? })`** — a Fetch-compatible handler returning `text/event-stream` (mirrors `createVoiceGatewayTurnHandler`). `authorize(request, body)` is the SOLE trust boundary and works exactly like the voice gateway: this module NEVER authorizes from the request's `session` metadata — the app validates the caller (bearer session id / cookie / same-origin) and the claimed ids against the authenticated principal, and returns an already-authorized `ChatStreamContext`. Generation caps (`model`/`maxTokens`/`maxSteps`) live on the context (server-resolved), never on the request. Cross-origin embedding uses the same fail-closed CORS posture as core `_events` (#1861): the `Origin` is echoed only when allow-listed (never `*`), credentials only when opted in.
|
|
68
|
+
- **`SmrtChatBackend` (`@happyvertical/smrt-chat/client`)** — the consume side of the same contract: a browser SSE client (`src/client.ts`) that POSTs the conversation and dispatches `token`/`emotion`/`done`/`error` frames to streaming handlers, tolerating heartbeat comments and frames split across chunks. The subpath is BROWSER-SAFE and dependency-free (no server runtime, no workspace imports — keep it that way), and its widget-facing types are structurally identical to `@happyvertical/animation`'s `ChatBackend` contract so an instance plugs straight into the floating chat widget. `src/client.contract.ts` carries the compile-time locks pinning it to `chat-stream.ts`'s `ChatStreamEvent`/`ChatStreamSession` — a NON-test module precisely so `pnpm typecheck` actually enforces them (`tsconfig.typecheck.json` excludes `.test.ts` files, and Vitest transpiles without typechecking). A clean close without a `done` frame surfaces as an error (never an empty reply), and a settled turn cancels the reader so the connection is released promptly.
|
|
68
69
|
- **Persona path reuses the harness's own gates unchanged** — persona principal, fail-closed `allowedTools` offer+execution gates, tenant binding. `onToken` is best-effort telemetry threaded through `runToolLoop`; it never changes what the loop persists or authorizes.
|
|
69
70
|
- **Custom tools stream via `binding.extraTools`** — the persona binding threads an optional `extraTools?: PrincipalTool[]` down to `runPersonaConversationTurn`, so a *streamed* persona chat can offer non-manifest, service-backed tools (the persona messaging tool `messages.send`, or an assistance-request/lead-ticket tool wrapping a `@smrt({ api:false, mcp:false })` service) and thus *act*, not only answer — matching the non-streaming persona path. It is resolved server-side by `authorize` (trusted), never from request input, and stays fully gated: each tool is filtered by the persona's `allowedTools` (offer gate) and re-asserts the bound principal's authority in `execute` (execution gate). Offering a tool is not authorizing it.
|
|
70
71
|
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser client for smrt-chat's streaming chat route — the consume side of
|
|
3
|
+
* the SSE contract `createChatStreamHandler` serves (see `chat-stream.ts`,
|
|
4
|
+
* which owns the wire contract and exports the encode side).
|
|
5
|
+
*
|
|
6
|
+
* This module is BROWSER-SAFE and dependency-free: it must not import the
|
|
7
|
+
* server runtime (models, services, tool loop) or any workspace package, so
|
|
8
|
+
* a static site can ship it without dragging server code into the bundle. It
|
|
9
|
+
* is exported under the dedicated `@happyvertical/smrt-chat/client` subpath.
|
|
10
|
+
*
|
|
11
|
+
* POST {endpoint}
|
|
12
|
+
* Authorization: Bearer <sessionId> (SMRT bearer = session id)
|
|
13
|
+
* Content-Type: application/json
|
|
14
|
+
* Body: { "messages": ChatClientMessage[], "session": SmrtChatSession? }
|
|
15
|
+
*
|
|
16
|
+
* Response: text/event-stream, events as `data: <json>` lines:
|
|
17
|
+
* { "type": "token", "text": "..." }
|
|
18
|
+
* { "type": "emotion", "name": "heart" } (reserved; v1 engine forwards
|
|
19
|
+
* the model's inline cue as tokens)
|
|
20
|
+
* { "type": "control", "command": {...} } (#1921 host-page control lane;
|
|
21
|
+
* parsed, no client hook yet)
|
|
22
|
+
* { "type": "done", "message": ChatStreamMessage }
|
|
23
|
+
* { "type": "error", "error": "..." }
|
|
24
|
+
* plus `: heartbeat` comment lines every ~15s, which clients must ignore.
|
|
25
|
+
*
|
|
26
|
+
* The server always terminates a turn with a `done` or `error` frame; a clean
|
|
27
|
+
* close without one means an intermediary cut the stream (proxy idle timeout)
|
|
28
|
+
* and is surfaced as an error rather than an empty success.
|
|
29
|
+
*
|
|
30
|
+
* The widget-facing types below are STRUCTURALLY identical to
|
|
31
|
+
* `@happyvertical/animation`'s chat contract (`ChatBackend`, `ChatMessage`,
|
|
32
|
+
* `ChatStreamHandlers`, `ChatSendHandle`), so an instance drops straight into
|
|
33
|
+
* `createHappyChat({ backend })` without this package depending on the widget
|
|
34
|
+
* library. `client.contract.ts` pins the other seam under `pnpm typecheck`:
|
|
35
|
+
* every `ChatStreamEvent` the server can emit is assignable to
|
|
36
|
+
* `ChatClientStreamFrame`.
|
|
37
|
+
*/
|
|
38
|
+
/** A rendered conversation message (the widget-side shape; all fields set). */
|
|
39
|
+
export interface ChatClientMessage {
|
|
40
|
+
id: string;
|
|
41
|
+
role: 'user' | 'assistant' | 'system';
|
|
42
|
+
content: string;
|
|
43
|
+
createdAt: string;
|
|
44
|
+
}
|
|
45
|
+
/** Streaming callbacks for one assistant reply. */
|
|
46
|
+
export interface ChatClientStreamHandlers {
|
|
47
|
+
/** A chunk of assistant text (may be words or partial words). */
|
|
48
|
+
onToken(text: string): void;
|
|
49
|
+
/** An expression cue for the character (e.g. 'heart', 'wink'). */
|
|
50
|
+
onEmotion?(name: string): void;
|
|
51
|
+
/** The reply is complete; `message` is the final assembled message. */
|
|
52
|
+
onDone(message: ChatClientMessage): void;
|
|
53
|
+
onError(error: unknown): void;
|
|
54
|
+
}
|
|
55
|
+
export interface ChatClientSendHandle {
|
|
56
|
+
cancel(): void;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* A conversation backend. `send` receives the FULL message history (latest
|
|
60
|
+
* user message last) and streams the assistant reply through `handlers`.
|
|
61
|
+
*/
|
|
62
|
+
export interface ChatClientBackend {
|
|
63
|
+
send(messages: ChatClientMessage[], handlers: ChatClientStreamHandlers): ChatClientSendHandle;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Conversation identity, mirroring `ChatStreamSession`
|
|
67
|
+
* (`VoiceGatewayTurnMetadata`) so a server route can bind the turn to an
|
|
68
|
+
* AgentSession/persona. Mirrored rather than imported to keep this module
|
|
69
|
+
* free of server imports; `client.test.ts` asserts the shapes stay aligned.
|
|
70
|
+
*/
|
|
71
|
+
export interface SmrtChatSession {
|
|
72
|
+
tenantId?: string;
|
|
73
|
+
actorProfileId?: string;
|
|
74
|
+
chatRoomId?: string;
|
|
75
|
+
threadId?: string;
|
|
76
|
+
agentSessionId?: string;
|
|
77
|
+
personaId?: string;
|
|
78
|
+
voiceSessionId?: string;
|
|
79
|
+
}
|
|
80
|
+
export interface SmrtChatBackendOptions {
|
|
81
|
+
/** Full URL of the streaming chat route. */
|
|
82
|
+
endpoint: string;
|
|
83
|
+
/** SMRT bearer token (the session id). Omit for cookie/same-origin auth. */
|
|
84
|
+
token?: string;
|
|
85
|
+
/**
|
|
86
|
+
* fetch credentials mode (the `RequestCredentials` union, spelled out so
|
|
87
|
+
* this module typechecks without the DOM lib). Cookie auth from a
|
|
88
|
+
* cross-origin embed needs 'include' (pairs with the server's allow-listed
|
|
89
|
+
* credentialed CORS, smrt #1861); the default is fetch's own 'same-origin'.
|
|
90
|
+
*/
|
|
91
|
+
credentials?: 'omit' | 'same-origin' | 'include';
|
|
92
|
+
/** Conversation identity (persona/agent-session binding). */
|
|
93
|
+
session?: SmrtChatSession;
|
|
94
|
+
fetchImpl?: typeof fetch;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* One parsed wire frame. Deliberately lenient where the client can degrade
|
|
98
|
+
* (optional `message`/`error`) — and provably a superset of the server's
|
|
99
|
+
* `ChatStreamEvent` union (compile-time lock in `client.test.ts`).
|
|
100
|
+
*/
|
|
101
|
+
export type ChatClientStreamFrame = {
|
|
102
|
+
type: 'token';
|
|
103
|
+
text: string;
|
|
104
|
+
} | {
|
|
105
|
+
type: 'emotion';
|
|
106
|
+
name: string;
|
|
107
|
+
} | {
|
|
108
|
+
type: 'control';
|
|
109
|
+
command: unknown;
|
|
110
|
+
} | {
|
|
111
|
+
type: 'done';
|
|
112
|
+
message?: {
|
|
113
|
+
id?: string;
|
|
114
|
+
role: ChatClientMessage['role'];
|
|
115
|
+
content: string;
|
|
116
|
+
createdAt?: string;
|
|
117
|
+
};
|
|
118
|
+
} | {
|
|
119
|
+
type: 'error';
|
|
120
|
+
error?: string;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* SSE client for the streaming chat route (smrt-chat #1936). Structurally
|
|
124
|
+
* implements `@happyvertical/animation`'s `ChatBackend`, so it plugs straight
|
|
125
|
+
* into the floating chat widget.
|
|
126
|
+
*/
|
|
127
|
+
export declare class SmrtChatBackend implements ChatClientBackend {
|
|
128
|
+
private options;
|
|
129
|
+
constructor(options: SmrtChatBackendOptions);
|
|
130
|
+
send(messages: ChatClientMessage[], handlers: ChatClientStreamHandlers): ChatClientSendHandle;
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,+EAA+E;AAC/E,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,mDAAmD;AACnD,MAAM,WAAW,wBAAwB;IACvC,iEAAiE;IACjE,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,kEAAkE;IAClE,SAAS,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,uEAAuE;IACvE,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACzC,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,IAAI,IAAI,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,CACF,QAAQ,EAAE,iBAAiB,EAAE,EAC7B,QAAQ,EAAE,wBAAwB,GACjC,oBAAoB,CAAC;CACzB;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,sBAAsB;IACrC,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAAC;IACjD,6DAA6D;IAC7D,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B;AAED;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAC7B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GACrC;IACE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE;QACR,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAChC,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH,GACD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAmDtC;;;;GAIG;AACH,qBAAa,eAAgB,YAAW,iBAAiB;IACvD,OAAO,CAAC,OAAO,CAAyB;gBAE5B,OAAO,EAAE,sBAAsB;IAI3C,IAAI,CACF,QAAQ,EAAE,iBAAiB,EAAE,EAC7B,QAAQ,EAAE,wBAAwB,GACjC,oBAAoB;CA8FxB"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
//#region src/client.ts
|
|
2
|
+
var counter = 0;
|
|
3
|
+
function messageId() {
|
|
4
|
+
const c = globalThis.crypto;
|
|
5
|
+
if (c && typeof c.randomUUID === "function") return c.randomUUID();
|
|
6
|
+
counter += 1;
|
|
7
|
+
return `msg-${Date.now()}-${counter}`;
|
|
8
|
+
}
|
|
9
|
+
function extractEmotion(text) {
|
|
10
|
+
let emotion = null;
|
|
11
|
+
return {
|
|
12
|
+
clean: text.replace(/\s*\[emotion:(\w+)\]/g, (_, name) => {
|
|
13
|
+
emotion = name;
|
|
14
|
+
return "";
|
|
15
|
+
}).trim(),
|
|
16
|
+
emotion
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function finalizeMessage(message, content) {
|
|
20
|
+
return {
|
|
21
|
+
id: message?.id ?? messageId(),
|
|
22
|
+
role: message?.role ?? "assistant",
|
|
23
|
+
content,
|
|
24
|
+
createdAt: message?.createdAt ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
var SmrtChatBackend = class {
|
|
28
|
+
options;
|
|
29
|
+
constructor(options) {
|
|
30
|
+
this.options = options;
|
|
31
|
+
}
|
|
32
|
+
send(messages, handlers) {
|
|
33
|
+
const controller = new AbortController();
|
|
34
|
+
const fetchImpl = this.options.fetchImpl ?? fetch;
|
|
35
|
+
const headers = { "content-type": "application/json" };
|
|
36
|
+
if (this.options.token) headers.authorization = `Bearer ${this.options.token}`;
|
|
37
|
+
(async () => {
|
|
38
|
+
const response = await fetchImpl(this.options.endpoint, {
|
|
39
|
+
method: "POST",
|
|
40
|
+
headers,
|
|
41
|
+
credentials: this.options.credentials,
|
|
42
|
+
body: JSON.stringify({
|
|
43
|
+
messages,
|
|
44
|
+
session: this.options.session
|
|
45
|
+
}),
|
|
46
|
+
signal: controller.signal
|
|
47
|
+
});
|
|
48
|
+
if (!response.ok || !response.body) {
|
|
49
|
+
let detail = "";
|
|
50
|
+
try {
|
|
51
|
+
detail = (await response.text()).slice(0, 200);
|
|
52
|
+
} catch {}
|
|
53
|
+
throw new Error(`[smrt-chat] chat endpoint responded ${response.status}${detail ? `: ${detail}` : ""}`);
|
|
54
|
+
}
|
|
55
|
+
const reader = response.body.getReader();
|
|
56
|
+
const decoder = new TextDecoder();
|
|
57
|
+
let buffer = "";
|
|
58
|
+
let assembled = "";
|
|
59
|
+
for (;;) {
|
|
60
|
+
const { done, value } = await reader.read();
|
|
61
|
+
if (done) break;
|
|
62
|
+
buffer += decoder.decode(value, { stream: true });
|
|
63
|
+
let newline = buffer.indexOf("\n");
|
|
64
|
+
while (newline !== -1) {
|
|
65
|
+
const line = buffer.slice(0, newline).trim();
|
|
66
|
+
buffer = buffer.slice(newline + 1);
|
|
67
|
+
newline = buffer.indexOf("\n");
|
|
68
|
+
if (!line.startsWith("data:")) continue;
|
|
69
|
+
const event = JSON.parse(line.slice(5));
|
|
70
|
+
if (event.type === "token" && event.text) {
|
|
71
|
+
assembled += event.text;
|
|
72
|
+
handlers.onToken(event.text);
|
|
73
|
+
} else if (event.type === "emotion" && event.name) handlers.onEmotion?.(event.name);
|
|
74
|
+
else if (event.type === "control") {} else if (event.type === "error") {
|
|
75
|
+
handlers.onError(new Error(event.error ?? "[smrt-chat] chat stream error"));
|
|
76
|
+
reader.cancel().catch(() => {});
|
|
77
|
+
return;
|
|
78
|
+
} else if (event.type === "done") {
|
|
79
|
+
const { clean, emotion } = extractEmotion(event.message?.content ?? assembled);
|
|
80
|
+
if (emotion) handlers.onEmotion?.(emotion);
|
|
81
|
+
handlers.onDone(finalizeMessage(event.message, clean));
|
|
82
|
+
reader.cancel().catch(() => {});
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
throw new Error("[smrt-chat] chat stream ended without a done frame");
|
|
88
|
+
})().catch((error) => {
|
|
89
|
+
if (!controller.signal.aborted) handlers.onError(error);
|
|
90
|
+
});
|
|
91
|
+
return { cancel: () => controller.abort() };
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
//#endregion
|
|
95
|
+
export { SmrtChatBackend };
|
|
96
|
+
|
|
97
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","names":[],"sources":["../src/client.ts"],"sourcesContent":["/**\n * Browser client for smrt-chat's streaming chat route — the consume side of\n * the SSE contract `createChatStreamHandler` serves (see `chat-stream.ts`,\n * which owns the wire contract and exports the encode side).\n *\n * This module is BROWSER-SAFE and dependency-free: it must not import the\n * server runtime (models, services, tool loop) or any workspace package, so\n * a static site can ship it without dragging server code into the bundle. It\n * is exported under the dedicated `@happyvertical/smrt-chat/client` subpath.\n *\n * POST {endpoint}\n * Authorization: Bearer <sessionId> (SMRT bearer = session id)\n * Content-Type: application/json\n * Body: { \"messages\": ChatClientMessage[], \"session\": SmrtChatSession? }\n *\n * Response: text/event-stream, events as `data: <json>` lines:\n * { \"type\": \"token\", \"text\": \"...\" }\n * { \"type\": \"emotion\", \"name\": \"heart\" } (reserved; v1 engine forwards\n * the model's inline cue as tokens)\n * { \"type\": \"control\", \"command\": {...} } (#1921 host-page control lane;\n * parsed, no client hook yet)\n * { \"type\": \"done\", \"message\": ChatStreamMessage }\n * { \"type\": \"error\", \"error\": \"...\" }\n * plus `: heartbeat` comment lines every ~15s, which clients must ignore.\n *\n * The server always terminates a turn with a `done` or `error` frame; a clean\n * close without one means an intermediary cut the stream (proxy idle timeout)\n * and is surfaced as an error rather than an empty success.\n *\n * The widget-facing types below are STRUCTURALLY identical to\n * `@happyvertical/animation`'s chat contract (`ChatBackend`, `ChatMessage`,\n * `ChatStreamHandlers`, `ChatSendHandle`), so an instance drops straight into\n * `createHappyChat({ backend })` without this package depending on the widget\n * library. `client.contract.ts` pins the other seam under `pnpm typecheck`:\n * every `ChatStreamEvent` the server can emit is assignable to\n * `ChatClientStreamFrame`.\n */\n\n/** A rendered conversation message (the widget-side shape; all fields set). */\nexport interface ChatClientMessage {\n id: string;\n role: 'user' | 'assistant' | 'system';\n content: string;\n createdAt: string;\n}\n\n/** Streaming callbacks for one assistant reply. */\nexport interface ChatClientStreamHandlers {\n /** A chunk of assistant text (may be words or partial words). */\n onToken(text: string): void;\n /** An expression cue for the character (e.g. 'heart', 'wink'). */\n onEmotion?(name: string): void;\n /** The reply is complete; `message` is the final assembled message. */\n onDone(message: ChatClientMessage): void;\n onError(error: unknown): void;\n}\n\nexport interface ChatClientSendHandle {\n cancel(): void;\n}\n\n/**\n * A conversation backend. `send` receives the FULL message history (latest\n * user message last) and streams the assistant reply through `handlers`.\n */\nexport interface ChatClientBackend {\n send(\n messages: ChatClientMessage[],\n handlers: ChatClientStreamHandlers,\n ): ChatClientSendHandle;\n}\n\n/**\n * Conversation identity, mirroring `ChatStreamSession`\n * (`VoiceGatewayTurnMetadata`) so a server route can bind the turn to an\n * AgentSession/persona. Mirrored rather than imported to keep this module\n * free of server imports; `client.test.ts` asserts the shapes stay aligned.\n */\nexport interface SmrtChatSession {\n tenantId?: string;\n actorProfileId?: string;\n chatRoomId?: string;\n threadId?: string;\n agentSessionId?: string;\n personaId?: string;\n voiceSessionId?: string;\n}\n\nexport interface SmrtChatBackendOptions {\n /** Full URL of the streaming chat route. */\n endpoint: string;\n /** SMRT bearer token (the session id). Omit for cookie/same-origin auth. */\n token?: string;\n /**\n * fetch credentials mode (the `RequestCredentials` union, spelled out so\n * this module typechecks without the DOM lib). Cookie auth from a\n * cross-origin embed needs 'include' (pairs with the server's allow-listed\n * credentialed CORS, smrt #1861); the default is fetch's own 'same-origin'.\n */\n credentials?: 'omit' | 'same-origin' | 'include';\n /** Conversation identity (persona/agent-session binding). */\n session?: SmrtChatSession;\n fetchImpl?: typeof fetch;\n}\n\n/**\n * One parsed wire frame. Deliberately lenient where the client can degrade\n * (optional `message`/`error`) — and provably a superset of the server's\n * `ChatStreamEvent` union (compile-time lock in `client.test.ts`).\n */\nexport type ChatClientStreamFrame =\n | { type: 'token'; text: string }\n | { type: 'emotion'; name: string }\n | { type: 'control'; command: unknown }\n | {\n type: 'done';\n message?: {\n id?: string;\n role: ChatClientMessage['role'];\n content: string;\n createdAt?: string;\n };\n }\n | { type: 'error'; error?: string };\n\nlet counter = 0;\n\n/** Message id: crypto.randomUUID when available, counter fallback. */\nfunction messageId(): string {\n const c = (globalThis as { crypto?: { randomUUID?: () => string } }).crypto;\n if (c && typeof c.randomUUID === 'function') return c.randomUUID();\n counter += 1;\n return `msg-${Date.now()}-${counter}`;\n}\n\n/**\n * Pull `[emotion:name]` cues out of a reply, returning the clean text and the\n * last cue seen. The v1 streaming engine forwards the model's inline cue as\n * plain token text rather than an `emotion` frame, so the done message can\n * still carry it; strip it here so it never lands in the bubble/history, and\n * surface the emotion so the character still emotes.\n */\nfunction extractEmotion(text: string): {\n clean: string;\n emotion: string | null;\n} {\n let emotion: string | null = null;\n const clean = text\n .replace(/\\s*\\[emotion:(\\w+)\\]/g, (_, name: string) => {\n emotion = name;\n return '';\n })\n .trim();\n return { clean, emotion };\n}\n\n/**\n * Final message handed to `onDone`: keep the server's persisted identity\n * (id/createdAt) when present so a consumer reconciling with fetched room\n * history can match it, and fill honestly when the wire omitted it — the\n * wire shape has optional id/createdAt, the widget shape does not.\n */\nfunction finalizeMessage(\n message: Extract<ChatClientStreamFrame, { type: 'done' }>['message'],\n content: string,\n): ChatClientMessage {\n return {\n id: message?.id ?? messageId(),\n role: message?.role ?? 'assistant',\n content,\n createdAt: message?.createdAt ?? new Date().toISOString(),\n };\n}\n\n/**\n * SSE client for the streaming chat route (smrt-chat #1936). Structurally\n * implements `@happyvertical/animation`'s `ChatBackend`, so it plugs straight\n * into the floating chat widget.\n */\nexport class SmrtChatBackend implements ChatClientBackend {\n private options: SmrtChatBackendOptions;\n\n constructor(options: SmrtChatBackendOptions) {\n this.options = options;\n }\n\n send(\n messages: ChatClientMessage[],\n handlers: ChatClientStreamHandlers,\n ): ChatClientSendHandle {\n const controller = new AbortController();\n const fetchImpl = this.options.fetchImpl ?? fetch;\n const headers: Record<string, string> = {\n 'content-type': 'application/json',\n };\n if (this.options.token) {\n headers.authorization = `Bearer ${this.options.token}`;\n }\n\n (async () => {\n const response = await fetchImpl(this.options.endpoint, {\n method: 'POST',\n headers,\n credentials: this.options.credentials,\n body: JSON.stringify({\n messages,\n session: this.options.session,\n }),\n signal: controller.signal,\n });\n if (!response.ok || !response.body) {\n // The handler renders structured errors ({error, code}) — carry the\n // body so auth failures are distinguishable from bad requests.\n let detail = '';\n try {\n detail = (await response.text()).slice(0, 200);\n } catch {\n /* body unreadable — status alone will have to do */\n }\n throw new Error(\n `[smrt-chat] chat endpoint responded ${response.status}${\n detail ? `: ${detail}` : ''\n }`,\n );\n }\n const reader = response.body.getReader();\n const decoder = new TextDecoder();\n let buffer = '';\n let assembled = '';\n\n for (;;) {\n const { done, value } = await reader.read();\n if (done) break;\n buffer += decoder.decode(value, { stream: true });\n let newline = buffer.indexOf('\\n');\n while (newline !== -1) {\n const line = buffer.slice(0, newline).trim();\n buffer = buffer.slice(newline + 1);\n newline = buffer.indexOf('\\n');\n if (!line.startsWith('data:')) continue; // blank + `: heartbeat`\n const event = JSON.parse(line.slice(5)) as ChatClientStreamFrame;\n if (event.type === 'token' && event.text) {\n assembled += event.text;\n handlers.onToken(event.text);\n } else if (event.type === 'emotion' && event.name) {\n handlers.onEmotion?.(event.name);\n } else if (event.type === 'control') {\n // #1921 host-page control lane — recognized so the union stays\n // honest; no client hook yet (the widget executes controls via\n // its own registry when that wiring lands).\n } else if (event.type === 'error') {\n handlers.onError(\n new Error(event.error ?? '[smrt-chat] chat stream error'),\n );\n // The turn is settled but the server may keep sending (heartbeats,\n // late frames) — release the connection instead of leaving the\n // stream open until GC.\n reader.cancel().catch(() => {\n /* stream already closed — nothing to release */\n });\n return;\n } else if (event.type === 'done') {\n const raw = event.message?.content ?? assembled;\n const { clean, emotion } = extractEmotion(raw);\n if (emotion) handlers.onEmotion?.(emotion);\n handlers.onDone(finalizeMessage(event.message, clean));\n reader.cancel().catch(() => {\n /* stream already closed — nothing to release */\n });\n return;\n }\n }\n }\n // The server always terminates with done or error; a clean close\n // without one means an intermediary cut the stream. Never fabricate\n // a successful (possibly empty) reply out of a truncation.\n throw new Error('[smrt-chat] chat stream ended without a done frame');\n })().catch((error) => {\n if (!controller.signal.aborted) handlers.onError(error);\n });\n\n return { cancel: () => controller.abort() };\n }\n}\n"],"mappings":";AA6HA,IAAI,UAAU;AAGd,SAAS,YAAoB;CAC3B,MAAM,IAAK,WAA0D;CACrE,IAAI,KAAK,OAAO,EAAE,eAAe,YAAY,OAAO,EAAE,WAAW;CACjE,WAAW;CACX,OAAO,OAAO,KAAK,IAAI,EAAC,GAAI;AAC9B;AASA,SAAS,eAAe,MAGtB;CACA,IAAI,UAAyB;CAO7B,OAAO;EAAE,OANK,KACX,QAAQ,0BAA0B,GAAG,SAAiB;GACrD,UAAU;GACV,OAAO;EACT,CAAC,CAAA,CACA,KACM;EAAO;CAAQ;AAC1B;AAQA,SAAS,gBACP,SACA,SACmB;CACnB,OAAO;EACL,IAAI,SAAS,MAAM,UAAU;EAC7B,MAAM,SAAS,QAAQ;EACvB;EACA,WAAW,SAAS,8BAAa,IAAI,KAAK,EAAA,CAAE,YAAY;CAC1D;AACF;AAOO,IAAM,kBAAN,MAAmD;CAChD;CAER,YAAY,SAAiC;EAC3C,KAAK,UAAU;CACjB;CAEA,KACE,UACA,UACsB;EACtB,MAAM,aAAa,IAAI,gBAAgB;EACvC,MAAM,YAAY,KAAK,QAAQ,aAAa;EAC5C,MAAM,UAAkC,EACtC,gBAAgB,mBAClB;EACA,IAAI,KAAK,QAAQ,OACf,QAAQ,gBAAgB,UAAU,KAAK,QAAQ;EAGjD,CAAC,YAAY;GACX,MAAM,WAAW,MAAM,UAAU,KAAK,QAAQ,UAAU;IACtD,QAAQ;IACR;IACA,aAAa,KAAK,QAAQ;IAC1B,MAAM,KAAK,UAAU;KACnB;KACA,SAAS,KAAK,QAAQ;IACxB,CAAC;IACD,QAAQ,WAAW;GACrB,CAAC;GACD,IAAI,CAAC,SAAS,MAAM,CAAC,SAAS,MAAM;IAGlC,IAAI,SAAS;IACb,IAAI;KACF,UAAU,MAAM,SAAS,KAAK,EAAA,CAAG,MAAM,GAAG,GAAG;IAC/C,QAAQ,CAER;IACA,MAAM,IAAI,MACR,uCAAuC,SAAS,SAC9C,SAAS,KAAK,WAAW,IAE7B;GACF;GACA,MAAM,SAAS,SAAS,KAAK,UAAU;GACvC,MAAM,UAAU,IAAI,YAAY;GAChC,IAAI,SAAS;GACb,IAAI,YAAY;GAEhB,SAAS;IACP,MAAM,EAAE,MAAM,UAAU,MAAM,OAAO,KAAK;IAC1C,IAAI,MAAM;IACV,UAAU,QAAQ,OAAO,OAAO,EAAE,QAAQ,KAAK,CAAC;IAChD,IAAI,UAAU,OAAO,QAAQ,IAAI;IACjC,OAAO,YAAY,IAAI;KACrB,MAAM,OAAO,OAAO,MAAM,GAAG,OAAO,CAAA,CAAE,KAAK;KAC3C,SAAS,OAAO,MAAM,UAAU,CAAC;KACjC,UAAU,OAAO,QAAQ,IAAI;KAC7B,IAAI,CAAC,KAAK,WAAW,OAAO,GAAG;KAC/B,MAAM,QAAQ,KAAK,MAAM,KAAK,MAAM,CAAC,CAAC;KACtC,IAAI,MAAM,SAAS,WAAW,MAAM,MAAM;MACxC,aAAa,MAAM;MACnB,SAAS,QAAQ,MAAM,IAAI;KAC7B,OAAA,IAAW,MAAM,SAAS,aAAa,MAAM,MAC3C,SAAS,YAAY,MAAM,IAAI;UACjC,IAAW,MAAM,SAAS,WAAW,CAIrC,OAAA,IAAW,MAAM,SAAS,SAAS;MACjC,SAAS,QACP,IAAI,MAAM,MAAM,SAAS,+BAA+B,CAC1D;MAIA,OAAO,OAAO,CAAA,CAAE,YAAY,CAE5B,CAAC;MACD;KACF,OAAA,IAAW,MAAM,SAAS,QAAQ;MAEhC,MAAM,EAAE,OAAO,YAAY,eADf,MAAM,SAAS,WAAW,SACO;MAC7C,IAAI,SAAS,SAAS,YAAY,OAAO;MACzC,SAAS,OAAO,gBAAgB,MAAM,SAAS,KAAK,CAAC;MACrD,OAAO,OAAO,CAAA,CAAE,YAAY,CAE5B,CAAC;MACD;KACF;IACF;GACF;GAIA,MAAM,IAAI,MAAM,oDAAoD;EACtE,EAAA,CAAG,CAAA,CAAE,OAAO,UAAU;GACpB,IAAI,CAAC,WAAW,OAAO,SAAS,SAAS,QAAQ,KAAK;EACxD,CAAC;EAED,OAAO,EAAE,cAAc,WAAW,MAAM,EAAE;CAC5C;AACF"}
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { PrincipalToolNotAllowedError, executeAsPrincipal } from "@happyvertical
|
|
|
7
7
|
import { OperationPermissionError, PermissionCatalogService } from "@happyvertical/smrt-users";
|
|
8
8
|
import { TenantScoped, tenantId } from "@happyvertical/smrt-tenancy";
|
|
9
9
|
//#region src/__smrt-register__.ts
|
|
10
|
-
ObjectRegistry.registerPackageManifest(JSON.parse("{\"version\":\"1.0.0\",\"timestamp\":1784136065049,\"packageName\":\"@happyvertical/smrt-chat\",\"packageVersion\":\"0.40.5\",\"objects\":{\"@happyvertical/smrt-chat:AgentSessionCollection\":{\"name\":\"agentsessioncollection\",\"className\":\"AgentSessionCollection\",\"qualifiedName\":\"@happyvertical/smrt-chat:AgentSessionCollection\",\"collection\":\"agentsessions\",\"filePath\":\"/home/runner/.local/share/pnpm/store/.workspaces/arc-happyvertical-node-sqm7p-runner-8lw4l/smrt/smrt/packages/chat/src/collections/AgentSessionCollection.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{},\"methods\":{\"findActiveByParticipant\":{\"name\":\"findActiveByParticipant\",\"async\":true,\"parameters\":[{\"name\":\"participantProfileId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<AgentSession[]>\",\"isStatic\":false,\"isPublic\":true},\"findActiveSession\":{\"name\":\"findActiveSession\",\"async\":true,\"parameters\":[{\"name\":\"agentId\",\"type\":\"string\",\"optional\":false},{\"name\":\"participantProfileId\",\"type\":\"string\",\"optional\":false},{\"name\":\"tenantId\",\"type\":\"string | null\",\"optional\":false},{\"name\":\"sessionKey\",\"type\":\"string | null\",\"optional\":true}],\"returnType\":\"Promise<AgentSession | null>\",\"isStatic\":false,\"isPublic\":true},\"findOrCreate\":{\"name\":\"findOrCreate\",\"async\":true,\"parameters\":[{\"name\":\"params\",\"type\":\"object\",\"optional\":false}],\"returnType\":\"Promise<AgentSession>\",\"isStatic\":false,\"isPublic\":true},\"findByAgent\":{\"name\":\"findByAgent\",\"async\":true,\"parameters\":[{\"name\":\"agentId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<AgentSession[]>\",\"isStatic\":false,\"isPublic\":true},\"expireStale\":{\"name\":\"expireStale\",\"async\":true,\"parameters\":[{\"name\":\"olderThan\",\"type\":\"Date\",\"optional\":false},{\"name\":\"scope\",\"type\":\"object\",\"optional\":true}],\"returnType\":\"Promise<number>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"agent_sessions\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"AgentSession\",\"exportName\":\"AgentSessionCollection\",\"collectionExportName\":\"AgentSessionCollectionCollection\",\"schema\":{\"tableName\":\"agent_sessions\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"agent_sessions\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"}},\"indexes\":[{\"name\":\"agent_sessions_id_idx\",\"columns\":[\"id\"]},{\"name\":\"agent_sessions_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"e5de0db6\"}},\"@happyvertical/smrt-chat:ChatMessageCollection\":{\"name\":\"chatmessagecollection\",\"className\":\"ChatMessageCollection\",\"qualifiedName\":\"@happyvertical/smrt-chat:ChatMessageCollection\",\"collection\":\"chatmessages\",\"filePath\":\"/home/runner/.local/share/pnpm/store/.workspaces/arc-happyvertical-node-sqm7p-runner-8lw4l/smrt/smrt/packages/chat/src/collections/ChatMessageCollection.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{},\"methods\":{\"getByRoom\":{\"name\":\"getByRoom\",\"async\":true,\"parameters\":[{\"name\":\"roomId\",\"type\":\"string\",\"optional\":false},{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"options\",\"type\":\"object\",\"optional\":true}],\"returnType\":\"Promise<ChatMessage[]>\",\"isStatic\":false,\"isPublic\":true},\"getByThread\":{\"name\":\"getByThread\",\"async\":true,\"parameters\":[{\"name\":\"threadId\",\"type\":\"string\",\"optional\":false},{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<ChatMessage[]>\",\"isStatic\":false,\"isPublic\":true},\"getByAgentSession\":{\"name\":\"getByAgentSession\",\"async\":true,\"parameters\":[{\"name\":\"agentSessionId\",\"type\":\"string\",\"optional\":false},{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<ChatMessage[]>\",\"isStatic\":false,\"isPublic\":true},\"search\":{\"name\":\"search\",\"async\":true,\"parameters\":[{\"name\":\"filters\",\"type\":\"any\",\"optional\":false}],\"returnType\":\"Promise<ChatMessage[]>\",\"isStatic\":false,\"isPublic\":true},\"getUnreadCount\":{\"name\":\"getUnreadCount\",\"async\":true,\"parameters\":[{\"name\":\"roomId\",\"type\":\"string\",\"optional\":false},{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"lastReadMessageId\",\"type\":\"string | null\",\"optional\":false}],\"returnType\":\"Promise<number>\",\"isStatic\":false,\"isPublic\":true},\"getLatestPerRoom\":{\"name\":\"getLatestPerRoom\",\"async\":true,\"parameters\":[{\"name\":\"roomIds\",\"type\":\"string[]\",\"optional\":false},{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Map<string, ChatMessage>>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"chat_messages\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"ChatMessage\",\"exportName\":\"ChatMessageCollection\",\"collectionExportName\":\"ChatMessageCollectionCollection\",\"schema\":{\"tableName\":\"chat_messages\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"chat_messages\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"}},\"indexes\":[{\"name\":\"chat_messages_id_idx\",\"columns\":[\"id\"]},{\"name\":\"chat_messages_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"13b2dccb\"}},\"@happyvertical/smrt-chat:ChatParticipantCollection\":{\"name\":\"chatparticipantcollection\",\"className\":\"ChatParticipantCollection\",\"qualifiedName\":\"@happyvertical/smrt-chat:ChatParticipantCollection\",\"collection\":\"chatparticipants\",\"filePath\":\"/home/runner/.local/share/pnpm/store/.workspaces/arc-happyvertical-node-sqm7p-runner-8lw4l/smrt/smrt/packages/chat/src/collections/ChatParticipantCollection.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{},\"methods\":{\"getByRoom\":{\"name\":\"getByRoom\",\"async\":true,\"parameters\":[{\"name\":\"roomId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<ChatParticipant[]>\",\"isStatic\":false,\"isPublic\":true},\"getByProfile\":{\"name\":\"getByProfile\",\"async\":true,\"parameters\":[{\"name\":\"profileId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<ChatParticipant[]>\",\"isStatic\":false,\"isPublic\":true},\"findMembership\":{\"name\":\"findMembership\",\"async\":true,\"parameters\":[{\"name\":\"roomId\",\"type\":\"string\",\"optional\":false},{\"name\":\"profileId\",\"type\":\"string\",\"optional\":false},{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":true}],\"returnType\":\"Promise<ChatParticipant | null>\",\"isStatic\":false,\"isPublic\":true},\"findActiveMembership\":{\"name\":\"findActiveMembership\",\"async\":true,\"parameters\":[{\"name\":\"roomId\",\"type\":\"string\",\"optional\":false},{\"name\":\"profileId\",\"type\":\"string\",\"optional\":false},{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<ChatParticipant | null>\",\"isStatic\":false,\"isPublic\":true},\"isActiveMember\":{\"name\":\"isActiveMember\",\"async\":true,\"parameters\":[{\"name\":\"roomId\",\"type\":\"string\",\"optional\":false},{\"name\":\"profileId\",\"type\":\"string\",\"optional\":false},{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<boolean>\",\"isStatic\":false,\"isPublic\":true},\"getOnlineInRoom\":{\"name\":\"getOnlineInRoom\",\"async\":true,\"parameters\":[{\"name\":\"roomId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<ChatParticipant[]>\",\"isStatic\":false,\"isPublic\":true},\"getAdminsInRoom\":{\"name\":\"getAdminsInRoom\",\"async\":true,\"parameters\":[{\"name\":\"roomId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<ChatParticipant[]>\",\"isStatic\":false,\"isPublic\":true},\"countInRoom\":{\"name\":\"countInRoom\",\"async\":true,\"parameters\":[{\"name\":\"roomId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<number>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"chat_participants\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"ChatParticipant\",\"exportName\":\"ChatParticipantCollection\",\"collectionExportName\":\"ChatParticipantCollectionCollection\",\"schema\":{\"tableName\":\"chat_participants\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"chat_participants\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"}},\"indexes\":[{\"name\":\"chat_participants_id_idx\",\"columns\":[\"id\"]},{\"name\":\"chat_participants_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"f70abec0\"}},\"@happyvertical/smrt-chat:ChatReactionCollection\":{\"name\":\"chatreactioncollection\",\"className\":\"ChatReactionCollection\",\"qualifiedName\":\"@happyvertical/smrt-chat:ChatReactionCollection\",\"collection\":\"chatreactions\",\"filePath\":\"/home/runner/.local/share/pnpm/store/.workspaces/arc-happyvertical-node-sqm7p-runner-8lw4l/smrt/smrt/packages/chat/src/collections/ChatReactionCollection.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{},\"methods\":{\"getByMessage\":{\"name\":\"getByMessage\",\"async\":true,\"parameters\":[{\"name\":\"messageId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<ChatReaction[]>\",\"isStatic\":false,\"isPublic\":true},\"getReactionCounts\":{\"name\":\"getReactionCounts\",\"async\":true,\"parameters\":[{\"name\":\"messageId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Map<string, object>>\",\"isStatic\":false,\"isPublic\":true},\"toggle\":{\"name\":\"toggle\",\"async\":true,\"parameters\":[{\"name\":\"messageId\",\"type\":\"string\",\"optional\":false},{\"name\":\"profileId\",\"type\":\"string\",\"optional\":false},{\"name\":\"emoji\",\"type\":\"string\",\"optional\":false},{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<object>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"chat_reactions\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"ChatReaction\",\"exportName\":\"ChatReactionCollection\",\"collectionExportName\":\"ChatReactionCollectionCollection\",\"schema\":{\"tableName\":\"chat_reactions\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"chat_reactions\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"}},\"indexes\":[{\"name\":\"chat_reactions_id_idx\",\"columns\":[\"id\"]},{\"name\":\"chat_reactions_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"0ea62683\"}},\"@happyvertical/smrt-chat:ChatRoomCollection\":{\"name\":\"chatroomcollection\",\"className\":\"ChatRoomCollection\",\"qualifiedName\":\"@happyvertical/smrt-chat:ChatRoomCollection\",\"collection\":\"chatrooms\",\"filePath\":\"/home/runner/.local/share/pnpm/store/.workspaces/arc-happyvertical-node-sqm7p-runner-8lw4l/smrt/smrt/packages/chat/src/collections/ChatRoomCollection.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{},\"methods\":{\"findByType\":{\"name\":\"findByType\",\"async\":true,\"parameters\":[{\"name\":\"roomType\",\"type\":\"ChatRoomType\",\"optional\":false}],\"returnType\":\"Promise<ChatRoom[]>\",\"isStatic\":false,\"isPublic\":true},\"findPublic\":{\"name\":\"findPublic\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<ChatRoom[]>\",\"isStatic\":false,\"isPublic\":true},\"findDMs\":{\"name\":\"findDMs\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<ChatRoom[]>\",\"isStatic\":false,\"isPublic\":true},\"findAgentRooms\":{\"name\":\"findAgentRooms\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<ChatRoom[]>\",\"isStatic\":false,\"isPublic\":true},\"search\":{\"name\":\"search\",\"async\":true,\"parameters\":[{\"name\":\"query\",\"type\":\"string\",\"optional\":false},{\"name\":\"options\",\"type\":\"object\",\"optional\":true}],\"returnType\":\"Promise<ChatRoom[]>\",\"isStatic\":false,\"isPublic\":true},\"findOrCreateDM\":{\"name\":\"findOrCreateDM\",\"async\":true,\"parameters\":[{\"name\":\"profileId1\",\"type\":\"string\",\"optional\":false},{\"name\":\"profileId2\",\"type\":\"string\",\"optional\":false},{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"participants\",\"type\":\"ChatParticipantCollection\",\"optional\":false}],\"returnType\":\"Promise<ChatRoom>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"chat_rooms\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"ChatRoom\",\"exportName\":\"ChatRoomCollection\",\"collectionExportName\":\"ChatRoomCollectionCollection\",\"schema\":{\"tableName\":\"chat_rooms\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"chat_rooms\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"}},\"indexes\":[{\"name\":\"chat_rooms_id_idx\",\"columns\":[\"id\"]},{\"name\":\"chat_rooms_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"40be4b86\"}},\"@happyvertical/smrt-chat:ChatThreadCollection\":{\"name\":\"chatthreadcollection\",\"className\":\"ChatThreadCollection\",\"qualifiedName\":\"@happyvertical/smrt-chat:ChatThreadCollection\",\"collection\":\"chatthreads\",\"filePath\":\"/home/runner/.local/share/pnpm/store/.workspaces/arc-happyvertical-node-sqm7p-runner-8lw4l/smrt/smrt/packages/chat/src/collections/ChatThreadCollection.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{},\"methods\":{\"getByRoom\":{\"name\":\"getByRoom\",\"async\":true,\"parameters\":[{\"name\":\"roomId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<ChatThread[]>\",\"isStatic\":false,\"isPublic\":true},\"getActive\":{\"name\":\"getActive\",\"async\":true,\"parameters\":[{\"name\":\"roomId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<ChatThread[]>\",\"isStatic\":false,\"isPublic\":true},\"getUnresolved\":{\"name\":\"getUnresolved\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<ChatThread[]>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"chat_threads\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"ChatThread\",\"exportName\":\"ChatThreadCollection\",\"collectionExportName\":\"ChatThreadCollectionCollection\",\"schema\":{\"tableName\":\"chat_threads\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"chat_threads\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"}},\"indexes\":[{\"name\":\"chat_threads_id_idx\",\"columns\":[\"id\"]},{\"name\":\"chat_threads_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"760b62bd\"}},\"@happyvertical/smrt-chat:VoiceGatewayTurnCollection\":{\"name\":\"voicegatewayturncollection\",\"className\":\"VoiceGatewayTurnCollection\",\"qualifiedName\":\"@happyvertical/smrt-chat:VoiceGatewayTurnCollection\",\"collection\":\"voicegatewayturns\",\"filePath\":\"/home/runner/.local/share/pnpm/store/.workspaces/arc-happyvertical-node-sqm7p-runner-8lw4l/smrt/smrt/packages/chat/src/collections/VoiceGatewayTurnCollection.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{},\"methods\":{\"reserveTurn\":{\"name\":\"reserveTurn\",\"async\":true,\"parameters\":[{\"name\":\"input\",\"type\":\"object\",\"optional\":false}],\"returnType\":\"Promise<VoiceGatewayTurn>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"voice_gateway_turns\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"VoiceGatewayTurn\",\"exportName\":\"VoiceGatewayTurnCollection\",\"collectionExportName\":\"VoiceGatewayTurnCollectionCollection\",\"schema\":{\"tableName\":\"voice_gateway_turns\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"voice_gateway_turns\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"}},\"indexes\":[{\"name\":\"voice_gateway_turns_id_idx\",\"columns\":[\"id\"]},{\"name\":\"voice_gateway_turns_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"b0808d94\"}},\"@happyvertical/smrt-chat:VoiceSessionCollection\":{\"name\":\"voicesessioncollection\",\"className\":\"VoiceSessionCollection\",\"qualifiedName\":\"@happyvertical/smrt-chat:VoiceSessionCollection\",\"collection\":\"voicesessions\",\"filePath\":\"/home/runner/.local/share/pnpm/store/.workspaces/arc-happyvertical-node-sqm7p-runner-8lw4l/smrt/smrt/packages/chat/src/collections/VoiceSessionCollection.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{},\"methods\":{\"getActiveById\":{\"name\":\"getActiveById\",\"async\":true,\"parameters\":[{\"name\":\"id\",\"type\":\"string\",\"optional\":false},{\"name\":\"target\",\"type\":\"any\",\"optional\":true,\"default\":\"smrt:chat\"}],\"returnType\":\"Promise<VoiceSession | null>\",\"isStatic\":false,\"isPublic\":true},\"expireStale\":{\"name\":\"expireStale\",\"async\":true,\"parameters\":[{\"name\":\"olderThan\",\"type\":\"Date\",\"optional\":true},{\"name\":\"scope\",\"type\":\"object\",\"optional\":true}],\"returnType\":\"Promise<number>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"voice_sessions\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"VoiceSession\",\"exportName\":\"VoiceSessionCollection\",\"collectionExportName\":\"VoiceSessionCollectionCollection\",\"schema\":{\"tableName\":\"voice_sessions\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"voice_sessions\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"}},\"indexes\":[{\"name\":\"voice_sessions_id_idx\",\"columns\":[\"id\"]},{\"name\":\"voice_sessions_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"d9f462ed\"}},\"@happyvertical/smrt-chat:AgentSession\":{\"name\":\"agentsession\",\"className\":\"AgentSession\",\"qualifiedName\":\"@happyvertical/smrt-chat:AgentSession\",\"collection\":\"agentsessions\",\"filePath\":\"/home/runner/.local/share/pnpm/store/.workspaces/arc-happyvertical-node-sqm7p-runner-8lw4l/smrt/smrt/packages/chat/src/models/AgentSession.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"sqlType\":\"UUID\",\"nullable\":true,\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":false,\"autoPopulate\":true,\"nullable\":true,\"mode\":\"optional\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"agentId\":{\"type\":\"text\",\"required\":true,\"default\":\"\",\"_meta\":{\"required\":true}},\"participantProfileId\":{\"type\":\"crossPackageRef\",\"required\":true,\"related\":\"@happyvertical/smrt-profiles:Profile\"},\"chatRoomId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"ChatRoom\"},\"status\":{\"type\":\"text\",\"required\":true,\"default\":\"active\",\"_meta\":{\"required\":true}},\"allowedTools\":{\"type\":\"text\",\"required\":false,\"default\":\"[]\"},\"sessionContext\":{\"type\":\"text\",\"required\":false,\"default\":\"{}\"},\"systemPrompt\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"messageCount\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"totalTokensUsed\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"maxTokens\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"maxMessages\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"lastMessageAt\":{\"type\":\"datetime\",\"required\":false},\"expiresAt\":{\"type\":\"datetime\",\"required\":false},\"closedAt\":{\"type\":\"datetime\",\"required\":false}},\"methods\":{\"getAllowedTools\":{\"name\":\"getAllowedTools\",\"async\":false,\"parameters\":[],\"returnType\":\"string[]\",\"isStatic\":false,\"isPublic\":true},\"setAllowedTools\":{\"name\":\"setAllowedTools\",\"async\":false,\"parameters\":[{\"name\":\"tools\",\"type\":\"string[]\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"isToolAllowed\":{\"name\":\"isToolAllowed\",\"async\":false,\"parameters\":[{\"name\":\"toolName\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isActive\":{\"name\":\"isActive\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isExpired\":{\"name\":\"isExpired\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"close\":{\"name\":\"close\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"expire\":{\"name\":\"expire\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"getSessionContext\":{\"name\":\"getSessionContext\",\"async\":false,\"parameters\":[],\"returnType\":\"Record<string>\",\"isStatic\":false,\"isPublic\":true},\"setSessionContext\":{\"name\":\"setSessionContext\",\"async\":false,\"parameters\":[{\"name\":\"ctx\",\"type\":\"Record<string>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"getSessionKey\":{\"name\":\"getSessionKey\",\"async\":false,\"parameters\":[],\"returnType\":\"string | null\",\"isStatic\":false,\"isPublic\":true},\"updateSessionContext\":{\"name\":\"updateSessionContext\",\"async\":true,\"parameters\":[{\"name\":\"updates\",\"type\":\"Record<string>\",\"optional\":false}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"recordMessage\":{\"name\":\"recordMessage\",\"async\":true,\"parameters\":[{\"name\":\"tokensUsed\",\"type\":\"number\",\"optional\":true}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"agent_sessions\",\"api\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"cli\":true,\"tenantScoped\":{\"mode\":\"optional\"}},\"extends\":\"SmrtObject\",\"exportName\":\"AgentSession\",\"collectionExportName\":\"AgentSessionCollection\",\"validationRules\":[{\"field\":\"agentId\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"participantProfileId\",\"rule\":\"required\",\"fieldType\":\"crossPackageRef\"},{\"field\":\"status\",\"rule\":\"required\",\"fieldType\":\"text\"}],\"schema\":{\"tableName\":\"agent_sessions\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"agent_sessions\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID,\\n \\\"agent_id\\\" TEXT NOT NULL DEFAULT '',\\n \\\"participant_profile_id\\\" UUID NOT NULL,\\n \\\"chat_room_id\\\" UUID,\\n \\\"status\\\" TEXT NOT NULL DEFAULT 'active',\\n \\\"allowed_tools\\\" TEXT DEFAULT '[]',\\n \\\"session_context\\\" TEXT DEFAULT '{}',\\n \\\"system_prompt\\\" TEXT DEFAULT '',\\n \\\"message_count\\\" INTEGER DEFAULT 0,\\n \\\"total_tokens_used\\\" INTEGER DEFAULT 0,\\n \\\"max_tokens\\\" INTEGER DEFAULT 0,\\n \\\"max_messages\\\" INTEGER DEFAULT 0,\\n \\\"last_message_at\\\" TIMESTAMP,\\n \\\"expires_at\\\" TIMESTAMP,\\n \\\"closed_at\\\" TIMESTAMP\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false,\"unique\":false},\"agent_id\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"\"},\"participant_profile_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"chat_room_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false},\"status\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"active\"},\"allowed_tools\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"[]\"},\"session_context\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"},\"system_prompt\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"message_count\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"total_tokens_used\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"max_tokens\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"max_messages\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"last_message_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"expires_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"closed_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"agent_sessions_id_idx\",\"columns\":[\"id\"]},{\"name\":\"agent_sessions_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"9de59339\"}},\"@happyvertical/smrt-chat:ChatMessage\":{\"name\":\"chatmessage\",\"className\":\"ChatMessage\",\"qualifiedName\":\"@happyvertical/smrt-chat:ChatMessage\",\"collection\":\"chatmessages\",\"filePath\":\"/home/runner/.local/share/pnpm/store/.workspaces/arc-happyvertical-node-sqm7p-runner-8lw4l/smrt/smrt/packages/chat/src/models/ChatMessage.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"roomId\":{\"type\":\"foreignKey\",\"required\":true,\"related\":\"ChatRoom\",\"_meta\":{\"required\":true}},\"threadId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"ChatThread\"},\"senderProfileId\":{\"type\":\"crossPackageRef\",\"required\":true,\"related\":\"@happyvertical/smrt-profiles:Profile\"},\"agentSessionId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"AgentSession\"},\"content\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"messageType\":{\"type\":\"text\",\"required\":true,\"default\":\"text\",\"_meta\":{\"required\":true}},\"role\":{\"type\":\"text\",\"required\":true,\"default\":\"user\",\"_meta\":{\"required\":true}},\"isEdited\":{\"type\":\"boolean\",\"required\":false,\"default\":false},\"editedAt\":{\"type\":\"datetime\",\"required\":false},\"isDeleted\":{\"type\":\"boolean\",\"required\":false,\"default\":false},\"replyToMessageId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"ChatMessage\"},\"metadata\":{\"type\":\"text\",\"required\":false,\"default\":\"{}\"},\"toolCallData\":{\"type\":\"text\",\"required\":false},\"attachments\":{\"type\":\"text\",\"required\":false,\"default\":\"[]\"}},\"methods\":{\"getAttachments\":{\"name\":\"getAttachments\",\"async\":false,\"parameters\":[],\"returnType\":\"Array<object>\",\"isStatic\":false,\"isPublic\":true},\"setAttachments\":{\"name\":\"setAttachments\",\"async\":false,\"parameters\":[{\"name\":\"items\",\"type\":\"Array<object>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"getMetadata\":{\"name\":\"getMetadata\",\"async\":false,\"parameters\":[],\"returnType\":\"Record<string>\",\"isStatic\":false,\"isPublic\":true},\"setMetadata\":{\"name\":\"setMetadata\",\"async\":false,\"parameters\":[{\"name\":\"data\",\"type\":\"Record<string>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"getToolCallData\":{\"name\":\"getToolCallData\",\"async\":false,\"parameters\":[],\"returnType\":\"Record<string> | null\",\"isStatic\":false,\"isPublic\":true},\"setToolCallData\":{\"name\":\"setToolCallData\",\"async\":false,\"parameters\":[{\"name\":\"data\",\"type\":\"Record<string> | null\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"hasAttachments\":{\"name\":\"hasAttachments\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isToolCall\":{\"name\":\"isToolCall\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isToolResult\":{\"name\":\"isToolResult\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isFromAgent\":{\"name\":\"isFromAgent\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isSystemMessage\":{\"name\":\"isSystemMessage\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"edit\":{\"name\":\"edit\",\"async\":true,\"parameters\":[{\"name\":\"newContent\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"softDelete\":{\"name\":\"softDelete\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"getPreview\":{\"name\":\"getPreview\",\"async\":false,\"parameters\":[{\"name\":\"maxLength\",\"type\":\"any\",\"optional\":true}],\"returnType\":\"string\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"chat_messages\",\"api\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"cli\":true,\"tenantScoped\":{\"mode\":\"required\"}},\"extends\":\"SmrtObject\",\"exportName\":\"ChatMessage\",\"collectionExportName\":\"ChatMessageCollection\",\"validationRules\":[{\"field\":\"tenantId\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"roomId\",\"rule\":\"required\",\"fieldType\":\"foreignKey\"},{\"field\":\"senderProfileId\",\"rule\":\"required\",\"fieldType\":\"crossPackageRef\"},{\"field\":\"messageType\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"role\",\"rule\":\"required\",\"fieldType\":\"text\"}],\"schema\":{\"tableName\":\"chat_messages\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"chat_messages\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID NOT NULL,\\n \\\"room_id\\\" UUID NOT NULL,\\n \\\"thread_id\\\" UUID,\\n \\\"sender_profile_id\\\" UUID NOT NULL,\\n \\\"agent_session_id\\\" UUID,\\n \\\"content\\\" TEXT DEFAULT '',\\n \\\"message_type\\\" TEXT NOT NULL DEFAULT 'text',\\n \\\"role\\\" TEXT NOT NULL DEFAULT 'user',\\n \\\"is_edited\\\" BOOLEAN DEFAULT FALSE,\\n \\\"edited_at\\\" TIMESTAMP,\\n \\\"is_deleted\\\" BOOLEAN DEFAULT FALSE,\\n \\\"reply_to_message_id\\\" UUID,\\n \\\"metadata\\\" TEXT DEFAULT '{}',\\n \\\"tool_call_data\\\" TEXT,\\n \\\"attachments\\\" TEXT DEFAULT '[]'\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":true,\"unique\":false},\"room_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":true,\"unique\":false},\"thread_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false},\"sender_profile_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"agent_session_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false},\"content\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"message_type\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"text\"},\"role\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"user\"},\"is_edited\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":false},\"edited_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"is_deleted\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":false},\"reply_to_message_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"},\"tool_call_data\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"attachments\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"[]\"}},\"indexes\":[{\"name\":\"chat_messages_id_idx\",\"columns\":[\"id\"]},{\"name\":\"chat_messages_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"7469514e\"}},\"@happyvertical/smrt-chat:ChatParticipant\":{\"name\":\"chatparticipant\",\"className\":\"ChatParticipant\",\"qualifiedName\":\"@happyvertical/smrt-chat:ChatParticipant\",\"collection\":\"chatparticipants\",\"filePath\":\"/home/runner/.local/share/pnpm/store/.workspaces/arc-happyvertical-node-sqm7p-runner-8lw4l/smrt/smrt/packages/chat/src/models/ChatParticipant.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"roomId\":{\"type\":\"foreignKey\",\"required\":true,\"related\":\"ChatRoom\",\"_meta\":{\"required\":true}},\"profileId\":{\"type\":\"crossPackageRef\",\"required\":true,\"related\":\"@happyvertical/smrt-profiles:Profile\"},\"role\":{\"type\":\"text\",\"required\":true,\"default\":\"member\",\"_meta\":{\"required\":true}},\"status\":{\"type\":\"text\",\"required\":true,\"default\":\"active\",\"_meta\":{\"required\":true}},\"onlineStatus\":{\"type\":\"text\",\"required\":true,\"default\":\"offline\",\"_meta\":{\"required\":true}},\"lastReadMessageId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"ChatMessage\"},\"lastSeenAt\":{\"type\":\"datetime\",\"required\":false},\"joinedAt\":{\"type\":\"datetime\",\"required\":false},\"nickname\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"isMuted\":{\"type\":\"boolean\",\"required\":false,\"default\":false},\"isPinned\":{\"type\":\"boolean\",\"required\":false,\"default\":false}},\"methods\":{\"isActive\":{\"name\":\"isActive\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isOwner\":{\"name\":\"isOwner\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isAdmin\":{\"name\":\"isAdmin\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"markRead\":{\"name\":\"markRead\",\"async\":true,\"parameters\":[{\"name\":\"messageId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"leave\":{\"name\":\"leave\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"setOnline\":{\"name\":\"setOnline\",\"async\":true,\"parameters\":[{\"name\":\"status\",\"type\":\"OnlineStatus\",\"optional\":false}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"chat_participants\",\"api\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"cli\":true,\"tenantScoped\":{\"mode\":\"required\"}},\"extends\":\"SmrtObject\",\"exportName\":\"ChatParticipant\",\"collectionExportName\":\"ChatParticipantCollection\",\"validationRules\":[{\"field\":\"tenantId\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"roomId\",\"rule\":\"required\",\"fieldType\":\"foreignKey\"},{\"field\":\"profileId\",\"rule\":\"required\",\"fieldType\":\"crossPackageRef\"},{\"field\":\"role\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"status\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"onlineStatus\",\"rule\":\"required\",\"fieldType\":\"text\"}],\"schema\":{\"tableName\":\"chat_participants\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"chat_participants\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID NOT NULL,\\n \\\"room_id\\\" UUID NOT NULL,\\n \\\"profile_id\\\" UUID NOT NULL,\\n \\\"role\\\" TEXT NOT NULL DEFAULT 'member',\\n \\\"status\\\" TEXT NOT NULL DEFAULT 'active',\\n \\\"online_status\\\" TEXT NOT NULL DEFAULT 'offline',\\n \\\"last_read_message_id\\\" UUID,\\n \\\"last_seen_at\\\" TIMESTAMP,\\n \\\"joined_at\\\" TIMESTAMP,\\n \\\"nickname\\\" TEXT DEFAULT '',\\n \\\"is_muted\\\" BOOLEAN DEFAULT FALSE,\\n \\\"is_pinned\\\" BOOLEAN DEFAULT FALSE\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":true,\"unique\":false},\"room_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":true,\"unique\":false},\"profile_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"role\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"member\"},\"status\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"active\"},\"online_status\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"offline\"},\"last_read_message_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false},\"last_seen_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"joined_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"nickname\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"is_muted\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":false},\"is_pinned\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":false}},\"indexes\":[{\"name\":\"chat_participants_id_idx\",\"columns\":[\"id\"]},{\"name\":\"chat_participants_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"50824444\"}},\"@happyvertical/smrt-chat:ChatReaction\":{\"name\":\"chatreaction\",\"className\":\"ChatReaction\",\"qualifiedName\":\"@happyvertical/smrt-chat:ChatReaction\",\"collection\":\"chatreactions\",\"filePath\":\"/home/runner/.local/share/pnpm/store/.workspaces/arc-happyvertical-node-sqm7p-runner-8lw4l/smrt/smrt/packages/chat/src/models/ChatReaction.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"messageId\":{\"type\":\"foreignKey\",\"required\":true,\"related\":\"ChatMessage\",\"_meta\":{\"required\":true}},\"profileId\":{\"type\":\"crossPackageRef\",\"required\":true,\"related\":\"@happyvertical/smrt-profiles:Profile\"},\"emoji\":{\"type\":\"text\",\"required\":true,\"default\":\"\",\"_meta\":{\"required\":true}}},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"chat_reactions\",\"api\":{\"include\":[\"list\"]},\"mcp\":{\"include\":[\"list\"]},\"cli\":false,\"tenantScoped\":{\"mode\":\"required\"}},\"extends\":\"SmrtObject\",\"exportName\":\"ChatReaction\",\"collectionExportName\":\"ChatReactionCollection\",\"validationRules\":[{\"field\":\"tenantId\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"messageId\",\"rule\":\"required\",\"fieldType\":\"foreignKey\"},{\"field\":\"profileId\",\"rule\":\"required\",\"fieldType\":\"crossPackageRef\"},{\"field\":\"emoji\",\"rule\":\"required\",\"fieldType\":\"text\"}],\"schema\":{\"tableName\":\"chat_reactions\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"chat_reactions\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID NOT NULL,\\n \\\"message_id\\\" UUID NOT NULL,\\n \\\"profile_id\\\" UUID NOT NULL,\\n \\\"emoji\\\" TEXT NOT NULL DEFAULT ''\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":true,\"unique\":false},\"message_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":true,\"unique\":false},\"profile_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"emoji\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"\"}},\"indexes\":[{\"name\":\"chat_reactions_id_idx\",\"columns\":[\"id\"]},{\"name\":\"chat_reactions_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"8378c874\"}},\"@happyvertical/smrt-chat:ChatRoom\":{\"name\":\"chatroom\",\"className\":\"ChatRoom\",\"qualifiedName\":\"@happyvertical/smrt-chat:ChatRoom\",\"collection\":\"chatrooms\",\"filePath\":\"/home/runner/.local/share/pnpm/store/.workspaces/arc-happyvertical-node-sqm7p-runner-8lw4l/smrt/smrt/packages/chat/src/models/ChatRoom.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"name\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"description\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"roomType\":{\"type\":\"text\",\"required\":true,\"default\":\"public\",\"_meta\":{\"required\":true}},\"status\":{\"type\":\"text\",\"required\":true,\"default\":\"active\",\"_meta\":{\"required\":true}},\"topic\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"avatarUrl\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"isArchived\":{\"type\":\"boolean\",\"required\":false,\"default\":false},\"maxParticipants\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"metadata\":{\"type\":\"text\",\"required\":false,\"default\":\"{}\"},\"createdByProfileId\":{\"type\":\"crossPackageRef\",\"required\":false,\"related\":\"@happyvertical/smrt-profiles:Profile\"},\"lastMessageAt\":{\"type\":\"datetime\",\"required\":false}},\"methods\":{\"getMetadata\":{\"name\":\"getMetadata\",\"async\":false,\"parameters\":[],\"returnType\":\"ChatRoomMetadata\",\"isStatic\":false,\"isPublic\":true},\"setMetadata\":{\"name\":\"setMetadata\",\"async\":false,\"parameters\":[{\"name\":\"data\",\"type\":\"ChatRoomMetadata\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"updateMetadata\":{\"name\":\"updateMetadata\",\"async\":false,\"parameters\":[{\"name\":\"updates\",\"type\":\"ChatRoomMetadata\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"isDM\":{\"name\":\"isDM\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isAgentRoom\":{\"name\":\"isAgentRoom\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isPublic\":{\"name\":\"isPublic\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isActive\":{\"name\":\"isActive\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"archive\":{\"name\":\"archive\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"unarchive\":{\"name\":\"unarchive\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"chat_rooms\",\"api\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"cli\":true,\"tenantScoped\":{\"mode\":\"required\"}},\"extends\":\"SmrtObject\",\"exportName\":\"ChatRoom\",\"collectionExportName\":\"ChatRoomCollection\",\"validationRules\":[{\"field\":\"tenantId\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"roomType\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"status\",\"rule\":\"required\",\"fieldType\":\"text\"}],\"schema\":{\"tableName\":\"chat_rooms\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"chat_rooms\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID NOT NULL,\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"description\\\" TEXT DEFAULT '',\\n \\\"room_type\\\" TEXT NOT NULL DEFAULT 'public',\\n \\\"status\\\" TEXT NOT NULL DEFAULT 'active',\\n \\\"topic\\\" TEXT DEFAULT '',\\n \\\"avatar_url\\\" TEXT DEFAULT '',\\n \\\"is_archived\\\" BOOLEAN DEFAULT FALSE,\\n \\\"max_participants\\\" INTEGER DEFAULT 0,\\n \\\"metadata\\\" TEXT DEFAULT '{}',\\n \\\"created_by_profile_id\\\" UUID,\\n \\\"last_message_at\\\" TIMESTAMP\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":true,\"unique\":false},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"description\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"room_type\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"public\"},\"status\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"active\"},\"topic\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"avatar_url\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"is_archived\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":false},\"max_participants\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"},\"created_by_profile_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false},\"last_message_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"chat_rooms_id_idx\",\"columns\":[\"id\"]},{\"name\":\"chat_rooms_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"3665d881\"}},\"@happyvertical/smrt-chat:ChatThread\":{\"name\":\"chatthread\",\"className\":\"ChatThread\",\"qualifiedName\":\"@happyvertical/smrt-chat:ChatThread\",\"collection\":\"chatthreads\",\"filePath\":\"/home/runner/.local/share/pnpm/store/.workspaces/arc-happyvertical-node-sqm7p-runner-8lw4l/smrt/smrt/packages/chat/src/models/ChatThread.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"roomId\":{\"type\":\"foreignKey\",\"required\":true,\"related\":\"ChatRoom\",\"_meta\":{\"required\":true}},\"rootMessageId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"ChatMessage\",\"_meta\":{\"nullable\":true}},\"title\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"isResolved\":{\"type\":\"boolean\",\"required\":false,\"default\":false},\"messageCount\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"lastMessageAt\":{\"type\":\"datetime\",\"required\":false},\"participantCount\":{\"type\":\"integer\",\"required\":false,\"default\":0}},\"methods\":{\"resolve\":{\"name\":\"resolve\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"reopen\":{\"name\":\"reopen\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"chat_threads\",\"api\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"cli\":true,\"tenantScoped\":{\"mode\":\"required\"}},\"extends\":\"SmrtObject\",\"exportName\":\"ChatThread\",\"collectionExportName\":\"ChatThreadCollection\",\"validationRules\":[{\"field\":\"tenantId\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"roomId\",\"rule\":\"required\",\"fieldType\":\"foreignKey\"}],\"schema\":{\"tableName\":\"chat_threads\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"chat_threads\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID NOT NULL,\\n \\\"room_id\\\" UUID NOT NULL,\\n \\\"root_message_id\\\" UUID,\\n \\\"title\\\" TEXT DEFAULT '',\\n \\\"is_resolved\\\" BOOLEAN DEFAULT FALSE,\\n \\\"message_count\\\" INTEGER DEFAULT 0,\\n \\\"last_message_at\\\" TIMESTAMP,\\n \\\"participant_count\\\" INTEGER DEFAULT 0\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":true,\"unique\":false},\"room_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":true,\"unique\":false},\"root_message_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false},\"title\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"is_resolved\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":false},\"message_count\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"last_message_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"participant_count\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0}},\"indexes\":[{\"name\":\"chat_threads_id_idx\",\"columns\":[\"id\"]},{\"name\":\"chat_threads_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"6fd35191\"}},\"@happyvertical/smrt-chat:VoiceGatewayTurn\":{\"name\":\"voicegatewayturn\",\"className\":\"VoiceGatewayTurn\",\"qualifiedName\":\"@happyvertical/smrt-chat:VoiceGatewayTurn\",\"collection\":\"voicegatewayturns\",\"filePath\":\"/home/runner/.local/share/pnpm/store/.workspaces/arc-happyvertical-node-sqm7p-runner-8lw4l/smrt/smrt/packages/chat/src/models/VoiceGatewayTurn.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"voiceSessionId\":{\"type\":\"foreignKey\",\"required\":true,\"related\":\"VoiceSession\",\"_meta\":{\"required\":true}},\"gatewaySessionId\":{\"type\":\"text\",\"required\":true,\"default\":\"\",\"_meta\":{\"required\":true}},\"gatewayTurnId\":{\"type\":\"text\",\"required\":true,\"default\":\"\",\"_meta\":{\"required\":true}},\"target\":{\"type\":\"text\",\"required\":true,\"default\":\"smrt:chat\",\"_meta\":{\"required\":true}},\"status\":{\"type\":\"text\",\"required\":true,\"default\":\"processing\",\"_meta\":{\"required\":true}},\"completedAt\":{\"type\":\"datetime\",\"required\":false},\"failedAt\":{\"type\":\"datetime\",\"required\":false}},\"methods\":{\"complete\":{\"name\":\"complete\",\"async\":true,\"parameters\":[{\"name\":\"now\",\"type\":\"Date\",\"optional\":true}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"fail\":{\"name\":\"fail\",\"async\":true,\"parameters\":[{\"name\":\"now\",\"type\":\"Date\",\"optional\":true}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"voice_gateway_turns\",\"conflictColumns\":[\"voice_session_id\",\"gateway_turn_id\"],\"api\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"cli\":false,\"tenantScoped\":{\"mode\":\"required\"}},\"extends\":\"SmrtObject\",\"exportName\":\"VoiceGatewayTurn\",\"collectionExportName\":\"VoiceGatewayTurnCollection\",\"validationRules\":[{\"field\":\"tenantId\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"voiceSessionId\",\"rule\":\"required\",\"fieldType\":\"foreignKey\"},{\"field\":\"gatewaySessionId\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"gatewayTurnId\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"target\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"status\",\"rule\":\"required\",\"fieldType\":\"text\"}],\"schema\":{\"tableName\":\"voice_gateway_turns\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"voice_gateway_turns\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID NOT NULL,\\n \\\"voice_session_id\\\" UUID NOT NULL,\\n \\\"gateway_session_id\\\" TEXT NOT NULL DEFAULT '',\\n \\\"gateway_turn_id\\\" TEXT NOT NULL DEFAULT '',\\n \\\"target\\\" TEXT NOT NULL DEFAULT 'smrt:chat',\\n \\\"status\\\" TEXT NOT NULL DEFAULT 'processing',\\n \\\"completed_at\\\" TIMESTAMP,\\n \\\"failed_at\\\" TIMESTAMP\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":true,\"unique\":false},\"voice_session_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":true,\"unique\":false},\"gateway_session_id\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"\"},\"gateway_turn_id\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"\"},\"target\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"smrt:chat\"},\"status\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"processing\"},\"completed_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"failed_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"voice_gateway_turns_id_idx\",\"columns\":[\"id\"]},{\"name\":\"voice_gateway_turns_voice_session_id_gateway_turn_id_idx\",\"columns\":[\"voice_session_id\",\"gateway_turn_id\"],\"unique\":true}],\"version\":\"45e2867c\"}},\"@happyvertical/smrt-chat:VoiceSession\":{\"name\":\"voicesession\",\"className\":\"VoiceSession\",\"qualifiedName\":\"@happyvertical/smrt-chat:VoiceSession\",\"collection\":\"voicesessions\",\"filePath\":\"/home/runner/.local/share/pnpm/store/.workspaces/arc-happyvertical-node-sqm7p-runner-8lw4l/smrt/smrt/packages/chat/src/models/VoiceSession.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"gatewaySessionId\":{\"type\":\"text\",\"required\":true,\"default\":\"\",\"_meta\":{\"required\":true}},\"actorProfileId\":{\"type\":\"crossPackageRef\",\"required\":true,\"related\":\"@happyvertical/smrt-profiles:Profile\"},\"actorUserId\":{\"type\":\"crossPackageRef\",\"required\":false,\"related\":\"@happyvertical/smrt-users:User\",\"_meta\":{\"nullable\":true}},\"personaId\":{\"type\":\"crossPackageRef\",\"required\":true,\"related\":\"@happyvertical/smrt-personas:AgentPersona\"},\"agentSessionId\":{\"type\":\"foreignKey\",\"required\":true,\"related\":\"AgentSession\",\"_meta\":{\"required\":true}},\"chatRoomId\":{\"type\":\"foreignKey\",\"required\":true,\"related\":\"ChatRoom\",\"_meta\":{\"required\":true}},\"threadId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"ChatThread\"},\"target\":{\"type\":\"text\",\"required\":true,\"default\":\"smrt:chat\",\"_meta\":{\"required\":true}},\"status\":{\"type\":\"text\",\"required\":true,\"default\":\"active\",\"_meta\":{\"required\":true}},\"expiresAt\":{\"type\":\"datetime\",\"required\":true,\"_meta\":{\"required\":true}},\"lastTurnAt\":{\"type\":\"datetime\",\"required\":false},\"lastGatewayTurnId\":{\"type\":\"text\",\"required\":false},\"personaSnapshot\":{\"type\":\"text\",\"required\":false,\"default\":\"{}\"},\"metadata\":{\"type\":\"text\",\"required\":false,\"default\":\"{}\"},\"processedTurnIds\":{\"type\":\"text\",\"required\":false,\"default\":\"[]\"}},\"methods\":{\"isActive\":{\"name\":\"isActive\",\"async\":false,\"parameters\":[{\"name\":\"now\",\"type\":\"Date\",\"optional\":true}],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isExpired\":{\"name\":\"isExpired\",\"async\":false,\"parameters\":[{\"name\":\"now\",\"type\":\"Date\",\"optional\":true}],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"expire\":{\"name\":\"expire\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"revoke\":{\"name\":\"revoke\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"getPersonaSnapshot\":{\"name\":\"getPersonaSnapshot\",\"async\":false,\"parameters\":[],\"returnType\":\"ConversationPersona\",\"isStatic\":false,\"isPublic\":true},\"setPersonaSnapshot\":{\"name\":\"setPersonaSnapshot\",\"async\":false,\"parameters\":[{\"name\":\"persona\",\"type\":\"ConversationPersona\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"getMetadata\":{\"name\":\"getMetadata\",\"async\":false,\"parameters\":[],\"returnType\":\"Record<string>\",\"isStatic\":false,\"isPublic\":true},\"setMetadata\":{\"name\":\"setMetadata\",\"async\":false,\"parameters\":[{\"name\":\"metadata\",\"type\":\"Record<string>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"getProcessedTurnIds\":{\"name\":\"getProcessedTurnIds\",\"async\":false,\"parameters\":[],\"returnType\":\"string[]\",\"isStatic\":false,\"isPublic\":true},\"hasProcessedTurn\":{\"name\":\"hasProcessedTurn\",\"async\":false,\"parameters\":[{\"name\":\"turnId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"recordGatewayTurn\":{\"name\":\"recordGatewayTurn\",\"async\":false,\"parameters\":[{\"name\":\"turnId\",\"type\":\"string\",\"optional\":false},{\"name\":\"maxRememberedTurns\",\"type\":\"any\",\"optional\":true}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"voice_sessions\",\"api\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"cli\":true,\"tenantScoped\":{\"mode\":\"required\"}},\"extends\":\"SmrtObject\",\"exportName\":\"VoiceSession\",\"collectionExportName\":\"VoiceSessionCollection\",\"validationRules\":[{\"field\":\"tenantId\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"gatewaySessionId\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"actorProfileId\",\"rule\":\"required\",\"fieldType\":\"crossPackageRef\"},{\"field\":\"personaId\",\"rule\":\"required\",\"fieldType\":\"crossPackageRef\"},{\"field\":\"agentSessionId\",\"rule\":\"required\",\"fieldType\":\"foreignKey\"},{\"field\":\"chatRoomId\",\"rule\":\"required\",\"fieldType\":\"foreignKey\"},{\"field\":\"target\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"status\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"expiresAt\",\"rule\":\"required\",\"fieldType\":\"datetime\"}],\"schema\":{\"tableName\":\"voice_sessions\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"voice_sessions\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID NOT NULL,\\n \\\"gateway_session_id\\\" TEXT NOT NULL DEFAULT '',\\n \\\"actor_profile_id\\\" UUID NOT NULL,\\n \\\"actor_user_id\\\" UUID,\\n \\\"persona_id\\\" UUID NOT NULL,\\n \\\"agent_session_id\\\" UUID NOT NULL,\\n \\\"chat_room_id\\\" UUID NOT NULL,\\n \\\"thread_id\\\" UUID,\\n \\\"target\\\" TEXT NOT NULL DEFAULT 'smrt:chat',\\n \\\"status\\\" TEXT NOT NULL DEFAULT 'active',\\n \\\"expires_at\\\" TIMESTAMP NOT NULL,\\n \\\"last_turn_at\\\" TIMESTAMP,\\n \\\"last_gateway_turn_id\\\" TEXT,\\n \\\"persona_snapshot\\\" TEXT DEFAULT '{}',\\n \\\"metadata\\\" TEXT DEFAULT '{}',\\n \\\"processed_turn_ids\\\" TEXT DEFAULT '[]'\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":true,\"unique\":false},\"gateway_session_id\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"\"},\"actor_profile_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"actor_user_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false},\"persona_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"agent_session_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":true,\"unique\":false},\"chat_room_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":true,\"unique\":false},\"thread_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false},\"target\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"smrt:chat\"},\"status\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"active\"},\"expires_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"unique\":false},\"last_turn_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"last_gateway_turn_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"persona_snapshot\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"},\"processed_turn_ids\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"[]\"}},\"indexes\":[{\"name\":\"voice_sessions_id_idx\",\"columns\":[\"id\"]},{\"name\":\"voice_sessions_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"348c29ef\"}}},\"moduleType\":\"smrt\",\"smrtDependencies\":[\"@happyvertical/smrt-agents\",\"@happyvertical/smrt-core\",\"@happyvertical/smrt-personas\",\"@happyvertical/smrt-profiles\",\"@happyvertical/smrt-tenancy\",\"@happyvertical/smrt-users\"]}"));
|
|
10
|
+
ObjectRegistry.registerPackageManifest(JSON.parse("{\"version\":\"1.0.0\",\"timestamp\":1784269738357,\"packageName\":\"@happyvertical/smrt-chat\",\"packageVersion\":\"0.40.7\",\"objects\":{\"@happyvertical/smrt-chat:AgentSessionCollection\":{\"name\":\"agentsessioncollection\",\"className\":\"AgentSessionCollection\",\"qualifiedName\":\"@happyvertical/smrt-chat:AgentSessionCollection\",\"collection\":\"agentsessions\",\"filePath\":\"/home/runner/_work/smrt/smrt/packages/chat/src/collections/AgentSessionCollection.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{},\"methods\":{\"findActiveByParticipant\":{\"name\":\"findActiveByParticipant\",\"async\":true,\"parameters\":[{\"name\":\"participantProfileId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<AgentSession[]>\",\"isStatic\":false,\"isPublic\":true},\"findActiveSession\":{\"name\":\"findActiveSession\",\"async\":true,\"parameters\":[{\"name\":\"agentId\",\"type\":\"string\",\"optional\":false},{\"name\":\"participantProfileId\",\"type\":\"string\",\"optional\":false},{\"name\":\"tenantId\",\"type\":\"string | null\",\"optional\":false},{\"name\":\"sessionKey\",\"type\":\"string | null\",\"optional\":true}],\"returnType\":\"Promise<AgentSession | null>\",\"isStatic\":false,\"isPublic\":true},\"findOrCreate\":{\"name\":\"findOrCreate\",\"async\":true,\"parameters\":[{\"name\":\"params\",\"type\":\"object\",\"optional\":false}],\"returnType\":\"Promise<AgentSession>\",\"isStatic\":false,\"isPublic\":true},\"findByAgent\":{\"name\":\"findByAgent\",\"async\":true,\"parameters\":[{\"name\":\"agentId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<AgentSession[]>\",\"isStatic\":false,\"isPublic\":true},\"expireStale\":{\"name\":\"expireStale\",\"async\":true,\"parameters\":[{\"name\":\"olderThan\",\"type\":\"Date\",\"optional\":false},{\"name\":\"scope\",\"type\":\"object\",\"optional\":true}],\"returnType\":\"Promise<number>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"agent_sessions\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"AgentSession\",\"exportName\":\"AgentSessionCollection\",\"collectionExportName\":\"AgentSessionCollectionCollection\",\"schema\":{\"tableName\":\"agent_sessions\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"agent_sessions\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"}},\"indexes\":[{\"name\":\"agent_sessions_id_idx\",\"columns\":[\"id\"]},{\"name\":\"agent_sessions_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"e5de0db6\"}},\"@happyvertical/smrt-chat:ChatMessageCollection\":{\"name\":\"chatmessagecollection\",\"className\":\"ChatMessageCollection\",\"qualifiedName\":\"@happyvertical/smrt-chat:ChatMessageCollection\",\"collection\":\"chatmessages\",\"filePath\":\"/home/runner/_work/smrt/smrt/packages/chat/src/collections/ChatMessageCollection.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{},\"methods\":{\"getByRoom\":{\"name\":\"getByRoom\",\"async\":true,\"parameters\":[{\"name\":\"roomId\",\"type\":\"string\",\"optional\":false},{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"options\",\"type\":\"object\",\"optional\":true}],\"returnType\":\"Promise<ChatMessage[]>\",\"isStatic\":false,\"isPublic\":true},\"getByThread\":{\"name\":\"getByThread\",\"async\":true,\"parameters\":[{\"name\":\"threadId\",\"type\":\"string\",\"optional\":false},{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<ChatMessage[]>\",\"isStatic\":false,\"isPublic\":true},\"getByAgentSession\":{\"name\":\"getByAgentSession\",\"async\":true,\"parameters\":[{\"name\":\"agentSessionId\",\"type\":\"string\",\"optional\":false},{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<ChatMessage[]>\",\"isStatic\":false,\"isPublic\":true},\"search\":{\"name\":\"search\",\"async\":true,\"parameters\":[{\"name\":\"filters\",\"type\":\"any\",\"optional\":false}],\"returnType\":\"Promise<ChatMessage[]>\",\"isStatic\":false,\"isPublic\":true},\"getUnreadCount\":{\"name\":\"getUnreadCount\",\"async\":true,\"parameters\":[{\"name\":\"roomId\",\"type\":\"string\",\"optional\":false},{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"lastReadMessageId\",\"type\":\"string | null\",\"optional\":false}],\"returnType\":\"Promise<number>\",\"isStatic\":false,\"isPublic\":true},\"getLatestPerRoom\":{\"name\":\"getLatestPerRoom\",\"async\":true,\"parameters\":[{\"name\":\"roomIds\",\"type\":\"string[]\",\"optional\":false},{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Map<string, ChatMessage>>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"chat_messages\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"ChatMessage\",\"exportName\":\"ChatMessageCollection\",\"collectionExportName\":\"ChatMessageCollectionCollection\",\"schema\":{\"tableName\":\"chat_messages\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"chat_messages\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"}},\"indexes\":[{\"name\":\"chat_messages_id_idx\",\"columns\":[\"id\"]},{\"name\":\"chat_messages_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"13b2dccb\"}},\"@happyvertical/smrt-chat:ChatParticipantCollection\":{\"name\":\"chatparticipantcollection\",\"className\":\"ChatParticipantCollection\",\"qualifiedName\":\"@happyvertical/smrt-chat:ChatParticipantCollection\",\"collection\":\"chatparticipants\",\"filePath\":\"/home/runner/_work/smrt/smrt/packages/chat/src/collections/ChatParticipantCollection.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{},\"methods\":{\"getByRoom\":{\"name\":\"getByRoom\",\"async\":true,\"parameters\":[{\"name\":\"roomId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<ChatParticipant[]>\",\"isStatic\":false,\"isPublic\":true},\"getByProfile\":{\"name\":\"getByProfile\",\"async\":true,\"parameters\":[{\"name\":\"profileId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<ChatParticipant[]>\",\"isStatic\":false,\"isPublic\":true},\"findMembership\":{\"name\":\"findMembership\",\"async\":true,\"parameters\":[{\"name\":\"roomId\",\"type\":\"string\",\"optional\":false},{\"name\":\"profileId\",\"type\":\"string\",\"optional\":false},{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":true}],\"returnType\":\"Promise<ChatParticipant | null>\",\"isStatic\":false,\"isPublic\":true},\"findActiveMembership\":{\"name\":\"findActiveMembership\",\"async\":true,\"parameters\":[{\"name\":\"roomId\",\"type\":\"string\",\"optional\":false},{\"name\":\"profileId\",\"type\":\"string\",\"optional\":false},{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<ChatParticipant | null>\",\"isStatic\":false,\"isPublic\":true},\"isActiveMember\":{\"name\":\"isActiveMember\",\"async\":true,\"parameters\":[{\"name\":\"roomId\",\"type\":\"string\",\"optional\":false},{\"name\":\"profileId\",\"type\":\"string\",\"optional\":false},{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<boolean>\",\"isStatic\":false,\"isPublic\":true},\"getOnlineInRoom\":{\"name\":\"getOnlineInRoom\",\"async\":true,\"parameters\":[{\"name\":\"roomId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<ChatParticipant[]>\",\"isStatic\":false,\"isPublic\":true},\"getAdminsInRoom\":{\"name\":\"getAdminsInRoom\",\"async\":true,\"parameters\":[{\"name\":\"roomId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<ChatParticipant[]>\",\"isStatic\":false,\"isPublic\":true},\"countInRoom\":{\"name\":\"countInRoom\",\"async\":true,\"parameters\":[{\"name\":\"roomId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<number>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"chat_participants\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"ChatParticipant\",\"exportName\":\"ChatParticipantCollection\",\"collectionExportName\":\"ChatParticipantCollectionCollection\",\"schema\":{\"tableName\":\"chat_participants\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"chat_participants\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"}},\"indexes\":[{\"name\":\"chat_participants_id_idx\",\"columns\":[\"id\"]},{\"name\":\"chat_participants_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"f70abec0\"}},\"@happyvertical/smrt-chat:ChatReactionCollection\":{\"name\":\"chatreactioncollection\",\"className\":\"ChatReactionCollection\",\"qualifiedName\":\"@happyvertical/smrt-chat:ChatReactionCollection\",\"collection\":\"chatreactions\",\"filePath\":\"/home/runner/_work/smrt/smrt/packages/chat/src/collections/ChatReactionCollection.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{},\"methods\":{\"getByMessage\":{\"name\":\"getByMessage\",\"async\":true,\"parameters\":[{\"name\":\"messageId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<ChatReaction[]>\",\"isStatic\":false,\"isPublic\":true},\"getReactionCounts\":{\"name\":\"getReactionCounts\",\"async\":true,\"parameters\":[{\"name\":\"messageId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Map<string, object>>\",\"isStatic\":false,\"isPublic\":true},\"toggle\":{\"name\":\"toggle\",\"async\":true,\"parameters\":[{\"name\":\"messageId\",\"type\":\"string\",\"optional\":false},{\"name\":\"profileId\",\"type\":\"string\",\"optional\":false},{\"name\":\"emoji\",\"type\":\"string\",\"optional\":false},{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<object>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"chat_reactions\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"ChatReaction\",\"exportName\":\"ChatReactionCollection\",\"collectionExportName\":\"ChatReactionCollectionCollection\",\"schema\":{\"tableName\":\"chat_reactions\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"chat_reactions\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"}},\"indexes\":[{\"name\":\"chat_reactions_id_idx\",\"columns\":[\"id\"]},{\"name\":\"chat_reactions_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"0ea62683\"}},\"@happyvertical/smrt-chat:ChatRoomCollection\":{\"name\":\"chatroomcollection\",\"className\":\"ChatRoomCollection\",\"qualifiedName\":\"@happyvertical/smrt-chat:ChatRoomCollection\",\"collection\":\"chatrooms\",\"filePath\":\"/home/runner/_work/smrt/smrt/packages/chat/src/collections/ChatRoomCollection.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{},\"methods\":{\"findByType\":{\"name\":\"findByType\",\"async\":true,\"parameters\":[{\"name\":\"roomType\",\"type\":\"ChatRoomType\",\"optional\":false}],\"returnType\":\"Promise<ChatRoom[]>\",\"isStatic\":false,\"isPublic\":true},\"findPublic\":{\"name\":\"findPublic\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<ChatRoom[]>\",\"isStatic\":false,\"isPublic\":true},\"findDMs\":{\"name\":\"findDMs\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<ChatRoom[]>\",\"isStatic\":false,\"isPublic\":true},\"findAgentRooms\":{\"name\":\"findAgentRooms\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<ChatRoom[]>\",\"isStatic\":false,\"isPublic\":true},\"search\":{\"name\":\"search\",\"async\":true,\"parameters\":[{\"name\":\"query\",\"type\":\"string\",\"optional\":false},{\"name\":\"options\",\"type\":\"object\",\"optional\":true}],\"returnType\":\"Promise<ChatRoom[]>\",\"isStatic\":false,\"isPublic\":true},\"findOrCreateDM\":{\"name\":\"findOrCreateDM\",\"async\":true,\"parameters\":[{\"name\":\"profileId1\",\"type\":\"string\",\"optional\":false},{\"name\":\"profileId2\",\"type\":\"string\",\"optional\":false},{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"participants\",\"type\":\"ChatParticipantCollection\",\"optional\":false}],\"returnType\":\"Promise<ChatRoom>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"chat_rooms\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"ChatRoom\",\"exportName\":\"ChatRoomCollection\",\"collectionExportName\":\"ChatRoomCollectionCollection\",\"schema\":{\"tableName\":\"chat_rooms\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"chat_rooms\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"}},\"indexes\":[{\"name\":\"chat_rooms_id_idx\",\"columns\":[\"id\"]},{\"name\":\"chat_rooms_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"40be4b86\"}},\"@happyvertical/smrt-chat:ChatThreadCollection\":{\"name\":\"chatthreadcollection\",\"className\":\"ChatThreadCollection\",\"qualifiedName\":\"@happyvertical/smrt-chat:ChatThreadCollection\",\"collection\":\"chatthreads\",\"filePath\":\"/home/runner/_work/smrt/smrt/packages/chat/src/collections/ChatThreadCollection.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{},\"methods\":{\"getByRoom\":{\"name\":\"getByRoom\",\"async\":true,\"parameters\":[{\"name\":\"roomId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<ChatThread[]>\",\"isStatic\":false,\"isPublic\":true},\"getActive\":{\"name\":\"getActive\",\"async\":true,\"parameters\":[{\"name\":\"roomId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<ChatThread[]>\",\"isStatic\":false,\"isPublic\":true},\"getUnresolved\":{\"name\":\"getUnresolved\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<ChatThread[]>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"chat_threads\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"ChatThread\",\"exportName\":\"ChatThreadCollection\",\"collectionExportName\":\"ChatThreadCollectionCollection\",\"schema\":{\"tableName\":\"chat_threads\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"chat_threads\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"}},\"indexes\":[{\"name\":\"chat_threads_id_idx\",\"columns\":[\"id\"]},{\"name\":\"chat_threads_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"760b62bd\"}},\"@happyvertical/smrt-chat:VoiceGatewayTurnCollection\":{\"name\":\"voicegatewayturncollection\",\"className\":\"VoiceGatewayTurnCollection\",\"qualifiedName\":\"@happyvertical/smrt-chat:VoiceGatewayTurnCollection\",\"collection\":\"voicegatewayturns\",\"filePath\":\"/home/runner/_work/smrt/smrt/packages/chat/src/collections/VoiceGatewayTurnCollection.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{},\"methods\":{\"reserveTurn\":{\"name\":\"reserveTurn\",\"async\":true,\"parameters\":[{\"name\":\"input\",\"type\":\"object\",\"optional\":false}],\"returnType\":\"Promise<VoiceGatewayTurn>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"voice_gateway_turns\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"VoiceGatewayTurn\",\"exportName\":\"VoiceGatewayTurnCollection\",\"collectionExportName\":\"VoiceGatewayTurnCollectionCollection\",\"schema\":{\"tableName\":\"voice_gateway_turns\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"voice_gateway_turns\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"}},\"indexes\":[{\"name\":\"voice_gateway_turns_id_idx\",\"columns\":[\"id\"]},{\"name\":\"voice_gateway_turns_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"b0808d94\"}},\"@happyvertical/smrt-chat:VoiceSessionCollection\":{\"name\":\"voicesessioncollection\",\"className\":\"VoiceSessionCollection\",\"qualifiedName\":\"@happyvertical/smrt-chat:VoiceSessionCollection\",\"collection\":\"voicesessions\",\"filePath\":\"/home/runner/_work/smrt/smrt/packages/chat/src/collections/VoiceSessionCollection.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{},\"methods\":{\"getActiveById\":{\"name\":\"getActiveById\",\"async\":true,\"parameters\":[{\"name\":\"id\",\"type\":\"string\",\"optional\":false},{\"name\":\"target\",\"type\":\"any\",\"optional\":true,\"default\":\"smrt:chat\"}],\"returnType\":\"Promise<VoiceSession | null>\",\"isStatic\":false,\"isPublic\":true},\"expireStale\":{\"name\":\"expireStale\",\"async\":true,\"parameters\":[{\"name\":\"olderThan\",\"type\":\"Date\",\"optional\":true},{\"name\":\"scope\",\"type\":\"object\",\"optional\":true}],\"returnType\":\"Promise<number>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"voice_sessions\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"VoiceSession\",\"exportName\":\"VoiceSessionCollection\",\"collectionExportName\":\"VoiceSessionCollectionCollection\",\"schema\":{\"tableName\":\"voice_sessions\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"voice_sessions\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"}},\"indexes\":[{\"name\":\"voice_sessions_id_idx\",\"columns\":[\"id\"]},{\"name\":\"voice_sessions_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"d9f462ed\"}},\"@happyvertical/smrt-chat:AgentSession\":{\"name\":\"agentsession\",\"className\":\"AgentSession\",\"qualifiedName\":\"@happyvertical/smrt-chat:AgentSession\",\"collection\":\"agentsessions\",\"filePath\":\"/home/runner/_work/smrt/smrt/packages/chat/src/models/AgentSession.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"sqlType\":\"UUID\",\"nullable\":true,\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":false,\"autoPopulate\":true,\"nullable\":true,\"mode\":\"optional\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"agentId\":{\"type\":\"text\",\"required\":true,\"default\":\"\",\"_meta\":{\"required\":true}},\"participantProfileId\":{\"type\":\"crossPackageRef\",\"required\":true,\"related\":\"@happyvertical/smrt-profiles:Profile\"},\"chatRoomId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"ChatRoom\"},\"status\":{\"type\":\"text\",\"required\":true,\"default\":\"active\",\"_meta\":{\"required\":true}},\"allowedTools\":{\"type\":\"text\",\"required\":false,\"default\":\"[]\"},\"sessionContext\":{\"type\":\"text\",\"required\":false,\"default\":\"{}\"},\"systemPrompt\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"messageCount\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"totalTokensUsed\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"maxTokens\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"maxMessages\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"lastMessageAt\":{\"type\":\"datetime\",\"required\":false},\"expiresAt\":{\"type\":\"datetime\",\"required\":false},\"closedAt\":{\"type\":\"datetime\",\"required\":false}},\"methods\":{\"getAllowedTools\":{\"name\":\"getAllowedTools\",\"async\":false,\"parameters\":[],\"returnType\":\"string[]\",\"isStatic\":false,\"isPublic\":true},\"setAllowedTools\":{\"name\":\"setAllowedTools\",\"async\":false,\"parameters\":[{\"name\":\"tools\",\"type\":\"string[]\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"isToolAllowed\":{\"name\":\"isToolAllowed\",\"async\":false,\"parameters\":[{\"name\":\"toolName\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isActive\":{\"name\":\"isActive\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isExpired\":{\"name\":\"isExpired\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"close\":{\"name\":\"close\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"expire\":{\"name\":\"expire\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"getSessionContext\":{\"name\":\"getSessionContext\",\"async\":false,\"parameters\":[],\"returnType\":\"Record<string>\",\"isStatic\":false,\"isPublic\":true},\"setSessionContext\":{\"name\":\"setSessionContext\",\"async\":false,\"parameters\":[{\"name\":\"ctx\",\"type\":\"Record<string>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"getSessionKey\":{\"name\":\"getSessionKey\",\"async\":false,\"parameters\":[],\"returnType\":\"string | null\",\"isStatic\":false,\"isPublic\":true},\"updateSessionContext\":{\"name\":\"updateSessionContext\",\"async\":true,\"parameters\":[{\"name\":\"updates\",\"type\":\"Record<string>\",\"optional\":false}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"recordMessage\":{\"name\":\"recordMessage\",\"async\":true,\"parameters\":[{\"name\":\"tokensUsed\",\"type\":\"number\",\"optional\":true}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"agent_sessions\",\"api\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"cli\":true,\"tenantScoped\":{\"mode\":\"optional\"}},\"extends\":\"SmrtObject\",\"exportName\":\"AgentSession\",\"collectionExportName\":\"AgentSessionCollection\",\"validationRules\":[{\"field\":\"agentId\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"participantProfileId\",\"rule\":\"required\",\"fieldType\":\"crossPackageRef\"},{\"field\":\"status\",\"rule\":\"required\",\"fieldType\":\"text\"}],\"schema\":{\"tableName\":\"agent_sessions\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"agent_sessions\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID,\\n \\\"agent_id\\\" TEXT NOT NULL DEFAULT '',\\n \\\"participant_profile_id\\\" UUID NOT NULL,\\n \\\"chat_room_id\\\" UUID,\\n \\\"status\\\" TEXT NOT NULL DEFAULT 'active',\\n \\\"allowed_tools\\\" TEXT DEFAULT '[]',\\n \\\"session_context\\\" TEXT DEFAULT '{}',\\n \\\"system_prompt\\\" TEXT DEFAULT '',\\n \\\"message_count\\\" INTEGER DEFAULT 0,\\n \\\"total_tokens_used\\\" INTEGER DEFAULT 0,\\n \\\"max_tokens\\\" INTEGER DEFAULT 0,\\n \\\"max_messages\\\" INTEGER DEFAULT 0,\\n \\\"last_message_at\\\" TIMESTAMP,\\n \\\"expires_at\\\" TIMESTAMP,\\n \\\"closed_at\\\" TIMESTAMP\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false,\"unique\":false},\"agent_id\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"\"},\"participant_profile_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"chat_room_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false},\"status\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"active\"},\"allowed_tools\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"[]\"},\"session_context\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"},\"system_prompt\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"message_count\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"total_tokens_used\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"max_tokens\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"max_messages\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"last_message_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"expires_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"closed_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"agent_sessions_id_idx\",\"columns\":[\"id\"]},{\"name\":\"agent_sessions_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"9de59339\"}},\"@happyvertical/smrt-chat:ChatMessage\":{\"name\":\"chatmessage\",\"className\":\"ChatMessage\",\"qualifiedName\":\"@happyvertical/smrt-chat:ChatMessage\",\"collection\":\"chatmessages\",\"filePath\":\"/home/runner/_work/smrt/smrt/packages/chat/src/models/ChatMessage.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"roomId\":{\"type\":\"foreignKey\",\"required\":true,\"related\":\"ChatRoom\",\"_meta\":{\"required\":true}},\"threadId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"ChatThread\"},\"senderProfileId\":{\"type\":\"crossPackageRef\",\"required\":true,\"related\":\"@happyvertical/smrt-profiles:Profile\"},\"agentSessionId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"AgentSession\"},\"content\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"messageType\":{\"type\":\"text\",\"required\":true,\"default\":\"text\",\"_meta\":{\"required\":true}},\"role\":{\"type\":\"text\",\"required\":true,\"default\":\"user\",\"_meta\":{\"required\":true}},\"isEdited\":{\"type\":\"boolean\",\"required\":false,\"default\":false},\"editedAt\":{\"type\":\"datetime\",\"required\":false},\"isDeleted\":{\"type\":\"boolean\",\"required\":false,\"default\":false},\"replyToMessageId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"ChatMessage\"},\"metadata\":{\"type\":\"text\",\"required\":false,\"default\":\"{}\"},\"toolCallData\":{\"type\":\"text\",\"required\":false},\"attachments\":{\"type\":\"text\",\"required\":false,\"default\":\"[]\"}},\"methods\":{\"getAttachments\":{\"name\":\"getAttachments\",\"async\":false,\"parameters\":[],\"returnType\":\"Array<object>\",\"isStatic\":false,\"isPublic\":true},\"setAttachments\":{\"name\":\"setAttachments\",\"async\":false,\"parameters\":[{\"name\":\"items\",\"type\":\"Array<object>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"getMetadata\":{\"name\":\"getMetadata\",\"async\":false,\"parameters\":[],\"returnType\":\"Record<string>\",\"isStatic\":false,\"isPublic\":true},\"setMetadata\":{\"name\":\"setMetadata\",\"async\":false,\"parameters\":[{\"name\":\"data\",\"type\":\"Record<string>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"getToolCallData\":{\"name\":\"getToolCallData\",\"async\":false,\"parameters\":[],\"returnType\":\"Record<string> | null\",\"isStatic\":false,\"isPublic\":true},\"setToolCallData\":{\"name\":\"setToolCallData\",\"async\":false,\"parameters\":[{\"name\":\"data\",\"type\":\"Record<string> | null\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"hasAttachments\":{\"name\":\"hasAttachments\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isToolCall\":{\"name\":\"isToolCall\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isToolResult\":{\"name\":\"isToolResult\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isFromAgent\":{\"name\":\"isFromAgent\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isSystemMessage\":{\"name\":\"isSystemMessage\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"edit\":{\"name\":\"edit\",\"async\":true,\"parameters\":[{\"name\":\"newContent\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"softDelete\":{\"name\":\"softDelete\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"getPreview\":{\"name\":\"getPreview\",\"async\":false,\"parameters\":[{\"name\":\"maxLength\",\"type\":\"any\",\"optional\":true}],\"returnType\":\"string\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"chat_messages\",\"api\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"cli\":true,\"tenantScoped\":{\"mode\":\"required\"}},\"extends\":\"SmrtObject\",\"exportName\":\"ChatMessage\",\"collectionExportName\":\"ChatMessageCollection\",\"validationRules\":[{\"field\":\"tenantId\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"roomId\",\"rule\":\"required\",\"fieldType\":\"foreignKey\"},{\"field\":\"senderProfileId\",\"rule\":\"required\",\"fieldType\":\"crossPackageRef\"},{\"field\":\"messageType\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"role\",\"rule\":\"required\",\"fieldType\":\"text\"}],\"schema\":{\"tableName\":\"chat_messages\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"chat_messages\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID NOT NULL,\\n \\\"room_id\\\" UUID NOT NULL,\\n \\\"thread_id\\\" UUID,\\n \\\"sender_profile_id\\\" UUID NOT NULL,\\n \\\"agent_session_id\\\" UUID,\\n \\\"content\\\" TEXT DEFAULT '',\\n \\\"message_type\\\" TEXT NOT NULL DEFAULT 'text',\\n \\\"role\\\" TEXT NOT NULL DEFAULT 'user',\\n \\\"is_edited\\\" BOOLEAN DEFAULT FALSE,\\n \\\"edited_at\\\" TIMESTAMP,\\n \\\"is_deleted\\\" BOOLEAN DEFAULT FALSE,\\n \\\"reply_to_message_id\\\" UUID,\\n \\\"metadata\\\" TEXT DEFAULT '{}',\\n \\\"tool_call_data\\\" TEXT,\\n \\\"attachments\\\" TEXT DEFAULT '[]'\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":true,\"unique\":false},\"room_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":true,\"unique\":false},\"thread_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false},\"sender_profile_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"agent_session_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false},\"content\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"message_type\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"text\"},\"role\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"user\"},\"is_edited\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":false},\"edited_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"is_deleted\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":false},\"reply_to_message_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"},\"tool_call_data\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"attachments\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"[]\"}},\"indexes\":[{\"name\":\"chat_messages_id_idx\",\"columns\":[\"id\"]},{\"name\":\"chat_messages_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"7469514e\"}},\"@happyvertical/smrt-chat:ChatParticipant\":{\"name\":\"chatparticipant\",\"className\":\"ChatParticipant\",\"qualifiedName\":\"@happyvertical/smrt-chat:ChatParticipant\",\"collection\":\"chatparticipants\",\"filePath\":\"/home/runner/_work/smrt/smrt/packages/chat/src/models/ChatParticipant.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"roomId\":{\"type\":\"foreignKey\",\"required\":true,\"related\":\"ChatRoom\",\"_meta\":{\"required\":true}},\"profileId\":{\"type\":\"crossPackageRef\",\"required\":true,\"related\":\"@happyvertical/smrt-profiles:Profile\"},\"role\":{\"type\":\"text\",\"required\":true,\"default\":\"member\",\"_meta\":{\"required\":true}},\"status\":{\"type\":\"text\",\"required\":true,\"default\":\"active\",\"_meta\":{\"required\":true}},\"onlineStatus\":{\"type\":\"text\",\"required\":true,\"default\":\"offline\",\"_meta\":{\"required\":true}},\"lastReadMessageId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"ChatMessage\"},\"lastSeenAt\":{\"type\":\"datetime\",\"required\":false},\"joinedAt\":{\"type\":\"datetime\",\"required\":false},\"nickname\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"isMuted\":{\"type\":\"boolean\",\"required\":false,\"default\":false},\"isPinned\":{\"type\":\"boolean\",\"required\":false,\"default\":false}},\"methods\":{\"isActive\":{\"name\":\"isActive\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isOwner\":{\"name\":\"isOwner\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isAdmin\":{\"name\":\"isAdmin\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"markRead\":{\"name\":\"markRead\",\"async\":true,\"parameters\":[{\"name\":\"messageId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"leave\":{\"name\":\"leave\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"setOnline\":{\"name\":\"setOnline\",\"async\":true,\"parameters\":[{\"name\":\"status\",\"type\":\"OnlineStatus\",\"optional\":false}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"chat_participants\",\"api\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"cli\":true,\"tenantScoped\":{\"mode\":\"required\"}},\"extends\":\"SmrtObject\",\"exportName\":\"ChatParticipant\",\"collectionExportName\":\"ChatParticipantCollection\",\"validationRules\":[{\"field\":\"tenantId\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"roomId\",\"rule\":\"required\",\"fieldType\":\"foreignKey\"},{\"field\":\"profileId\",\"rule\":\"required\",\"fieldType\":\"crossPackageRef\"},{\"field\":\"role\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"status\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"onlineStatus\",\"rule\":\"required\",\"fieldType\":\"text\"}],\"schema\":{\"tableName\":\"chat_participants\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"chat_participants\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID NOT NULL,\\n \\\"room_id\\\" UUID NOT NULL,\\n \\\"profile_id\\\" UUID NOT NULL,\\n \\\"role\\\" TEXT NOT NULL DEFAULT 'member',\\n \\\"status\\\" TEXT NOT NULL DEFAULT 'active',\\n \\\"online_status\\\" TEXT NOT NULL DEFAULT 'offline',\\n \\\"last_read_message_id\\\" UUID,\\n \\\"last_seen_at\\\" TIMESTAMP,\\n \\\"joined_at\\\" TIMESTAMP,\\n \\\"nickname\\\" TEXT DEFAULT '',\\n \\\"is_muted\\\" BOOLEAN DEFAULT FALSE,\\n \\\"is_pinned\\\" BOOLEAN DEFAULT FALSE\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":true,\"unique\":false},\"room_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":true,\"unique\":false},\"profile_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"role\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"member\"},\"status\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"active\"},\"online_status\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"offline\"},\"last_read_message_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false},\"last_seen_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"joined_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"nickname\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"is_muted\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":false},\"is_pinned\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":false}},\"indexes\":[{\"name\":\"chat_participants_id_idx\",\"columns\":[\"id\"]},{\"name\":\"chat_participants_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"50824444\"}},\"@happyvertical/smrt-chat:ChatReaction\":{\"name\":\"chatreaction\",\"className\":\"ChatReaction\",\"qualifiedName\":\"@happyvertical/smrt-chat:ChatReaction\",\"collection\":\"chatreactions\",\"filePath\":\"/home/runner/_work/smrt/smrt/packages/chat/src/models/ChatReaction.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"messageId\":{\"type\":\"foreignKey\",\"required\":true,\"related\":\"ChatMessage\",\"_meta\":{\"required\":true}},\"profileId\":{\"type\":\"crossPackageRef\",\"required\":true,\"related\":\"@happyvertical/smrt-profiles:Profile\"},\"emoji\":{\"type\":\"text\",\"required\":true,\"default\":\"\",\"_meta\":{\"required\":true}}},\"methods\":{},\"decoratorConfig\":{\"tableName\":\"chat_reactions\",\"api\":{\"include\":[\"list\"]},\"mcp\":{\"include\":[\"list\"]},\"cli\":false,\"tenantScoped\":{\"mode\":\"required\"}},\"extends\":\"SmrtObject\",\"exportName\":\"ChatReaction\",\"collectionExportName\":\"ChatReactionCollection\",\"validationRules\":[{\"field\":\"tenantId\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"messageId\",\"rule\":\"required\",\"fieldType\":\"foreignKey\"},{\"field\":\"profileId\",\"rule\":\"required\",\"fieldType\":\"crossPackageRef\"},{\"field\":\"emoji\",\"rule\":\"required\",\"fieldType\":\"text\"}],\"schema\":{\"tableName\":\"chat_reactions\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"chat_reactions\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID NOT NULL,\\n \\\"message_id\\\" UUID NOT NULL,\\n \\\"profile_id\\\" UUID NOT NULL,\\n \\\"emoji\\\" TEXT NOT NULL DEFAULT ''\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":true,\"unique\":false},\"message_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":true,\"unique\":false},\"profile_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"emoji\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"\"}},\"indexes\":[{\"name\":\"chat_reactions_id_idx\",\"columns\":[\"id\"]},{\"name\":\"chat_reactions_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"8378c874\"}},\"@happyvertical/smrt-chat:ChatRoom\":{\"name\":\"chatroom\",\"className\":\"ChatRoom\",\"qualifiedName\":\"@happyvertical/smrt-chat:ChatRoom\",\"collection\":\"chatrooms\",\"filePath\":\"/home/runner/_work/smrt/smrt/packages/chat/src/models/ChatRoom.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"name\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"description\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"roomType\":{\"type\":\"text\",\"required\":true,\"default\":\"public\",\"_meta\":{\"required\":true}},\"status\":{\"type\":\"text\",\"required\":true,\"default\":\"active\",\"_meta\":{\"required\":true}},\"topic\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"avatarUrl\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"isArchived\":{\"type\":\"boolean\",\"required\":false,\"default\":false},\"maxParticipants\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"metadata\":{\"type\":\"text\",\"required\":false,\"default\":\"{}\"},\"createdByProfileId\":{\"type\":\"crossPackageRef\",\"required\":false,\"related\":\"@happyvertical/smrt-profiles:Profile\"},\"lastMessageAt\":{\"type\":\"datetime\",\"required\":false}},\"methods\":{\"getMetadata\":{\"name\":\"getMetadata\",\"async\":false,\"parameters\":[],\"returnType\":\"ChatRoomMetadata\",\"isStatic\":false,\"isPublic\":true},\"setMetadata\":{\"name\":\"setMetadata\",\"async\":false,\"parameters\":[{\"name\":\"data\",\"type\":\"ChatRoomMetadata\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"updateMetadata\":{\"name\":\"updateMetadata\",\"async\":false,\"parameters\":[{\"name\":\"updates\",\"type\":\"ChatRoomMetadata\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"isDM\":{\"name\":\"isDM\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isAgentRoom\":{\"name\":\"isAgentRoom\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isPublic\":{\"name\":\"isPublic\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isActive\":{\"name\":\"isActive\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"archive\":{\"name\":\"archive\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"unarchive\":{\"name\":\"unarchive\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"chat_rooms\",\"api\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"cli\":true,\"tenantScoped\":{\"mode\":\"required\"}},\"extends\":\"SmrtObject\",\"exportName\":\"ChatRoom\",\"collectionExportName\":\"ChatRoomCollection\",\"validationRules\":[{\"field\":\"tenantId\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"roomType\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"status\",\"rule\":\"required\",\"fieldType\":\"text\"}],\"schema\":{\"tableName\":\"chat_rooms\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"chat_rooms\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID NOT NULL,\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"description\\\" TEXT DEFAULT '',\\n \\\"room_type\\\" TEXT NOT NULL DEFAULT 'public',\\n \\\"status\\\" TEXT NOT NULL DEFAULT 'active',\\n \\\"topic\\\" TEXT DEFAULT '',\\n \\\"avatar_url\\\" TEXT DEFAULT '',\\n \\\"is_archived\\\" BOOLEAN DEFAULT FALSE,\\n \\\"max_participants\\\" INTEGER DEFAULT 0,\\n \\\"metadata\\\" TEXT DEFAULT '{}',\\n \\\"created_by_profile_id\\\" UUID,\\n \\\"last_message_at\\\" TIMESTAMP\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":true,\"unique\":false},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"description\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"room_type\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"public\"},\"status\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"active\"},\"topic\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"avatar_url\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"is_archived\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":false},\"max_participants\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"},\"created_by_profile_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false},\"last_message_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"chat_rooms_id_idx\",\"columns\":[\"id\"]},{\"name\":\"chat_rooms_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"3665d881\"}},\"@happyvertical/smrt-chat:ChatThread\":{\"name\":\"chatthread\",\"className\":\"ChatThread\",\"qualifiedName\":\"@happyvertical/smrt-chat:ChatThread\",\"collection\":\"chatthreads\",\"filePath\":\"/home/runner/_work/smrt/smrt/packages/chat/src/models/ChatThread.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"roomId\":{\"type\":\"foreignKey\",\"required\":true,\"related\":\"ChatRoom\",\"_meta\":{\"required\":true}},\"rootMessageId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"ChatMessage\",\"_meta\":{\"nullable\":true}},\"title\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"isResolved\":{\"type\":\"boolean\",\"required\":false,\"default\":false},\"messageCount\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"lastMessageAt\":{\"type\":\"datetime\",\"required\":false},\"participantCount\":{\"type\":\"integer\",\"required\":false,\"default\":0}},\"methods\":{\"resolve\":{\"name\":\"resolve\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"reopen\":{\"name\":\"reopen\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"chat_threads\",\"api\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"cli\":true,\"tenantScoped\":{\"mode\":\"required\"}},\"extends\":\"SmrtObject\",\"exportName\":\"ChatThread\",\"collectionExportName\":\"ChatThreadCollection\",\"validationRules\":[{\"field\":\"tenantId\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"roomId\",\"rule\":\"required\",\"fieldType\":\"foreignKey\"}],\"schema\":{\"tableName\":\"chat_threads\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"chat_threads\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID NOT NULL,\\n \\\"room_id\\\" UUID NOT NULL,\\n \\\"root_message_id\\\" UUID,\\n \\\"title\\\" TEXT DEFAULT '',\\n \\\"is_resolved\\\" BOOLEAN DEFAULT FALSE,\\n \\\"message_count\\\" INTEGER DEFAULT 0,\\n \\\"last_message_at\\\" TIMESTAMP,\\n \\\"participant_count\\\" INTEGER DEFAULT 0\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":true,\"unique\":false},\"room_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":true,\"unique\":false},\"root_message_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false},\"title\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"is_resolved\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":false},\"message_count\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"last_message_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"participant_count\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0}},\"indexes\":[{\"name\":\"chat_threads_id_idx\",\"columns\":[\"id\"]},{\"name\":\"chat_threads_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"6fd35191\"}},\"@happyvertical/smrt-chat:VoiceGatewayTurn\":{\"name\":\"voicegatewayturn\",\"className\":\"VoiceGatewayTurn\",\"qualifiedName\":\"@happyvertical/smrt-chat:VoiceGatewayTurn\",\"collection\":\"voicegatewayturns\",\"filePath\":\"/home/runner/_work/smrt/smrt/packages/chat/src/models/VoiceGatewayTurn.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"voiceSessionId\":{\"type\":\"foreignKey\",\"required\":true,\"related\":\"VoiceSession\",\"_meta\":{\"required\":true}},\"gatewaySessionId\":{\"type\":\"text\",\"required\":true,\"default\":\"\",\"_meta\":{\"required\":true}},\"gatewayTurnId\":{\"type\":\"text\",\"required\":true,\"default\":\"\",\"_meta\":{\"required\":true}},\"target\":{\"type\":\"text\",\"required\":true,\"default\":\"smrt:chat\",\"_meta\":{\"required\":true}},\"status\":{\"type\":\"text\",\"required\":true,\"default\":\"processing\",\"_meta\":{\"required\":true}},\"completedAt\":{\"type\":\"datetime\",\"required\":false},\"failedAt\":{\"type\":\"datetime\",\"required\":false}},\"methods\":{\"complete\":{\"name\":\"complete\",\"async\":true,\"parameters\":[{\"name\":\"now\",\"type\":\"Date\",\"optional\":true}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"fail\":{\"name\":\"fail\",\"async\":true,\"parameters\":[{\"name\":\"now\",\"type\":\"Date\",\"optional\":true}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"voice_gateway_turns\",\"conflictColumns\":[\"voice_session_id\",\"gateway_turn_id\"],\"api\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"cli\":false,\"tenantScoped\":{\"mode\":\"required\"}},\"extends\":\"SmrtObject\",\"exportName\":\"VoiceGatewayTurn\",\"collectionExportName\":\"VoiceGatewayTurnCollection\",\"validationRules\":[{\"field\":\"tenantId\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"voiceSessionId\",\"rule\":\"required\",\"fieldType\":\"foreignKey\"},{\"field\":\"gatewaySessionId\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"gatewayTurnId\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"target\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"status\",\"rule\":\"required\",\"fieldType\":\"text\"}],\"schema\":{\"tableName\":\"voice_gateway_turns\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"voice_gateway_turns\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID NOT NULL,\\n \\\"voice_session_id\\\" UUID NOT NULL,\\n \\\"gateway_session_id\\\" TEXT NOT NULL DEFAULT '',\\n \\\"gateway_turn_id\\\" TEXT NOT NULL DEFAULT '',\\n \\\"target\\\" TEXT NOT NULL DEFAULT 'smrt:chat',\\n \\\"status\\\" TEXT NOT NULL DEFAULT 'processing',\\n \\\"completed_at\\\" TIMESTAMP,\\n \\\"failed_at\\\" TIMESTAMP\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":true,\"unique\":false},\"voice_session_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":true,\"unique\":false},\"gateway_session_id\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"\"},\"gateway_turn_id\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"\"},\"target\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"smrt:chat\"},\"status\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"processing\"},\"completed_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"failed_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"voice_gateway_turns_id_idx\",\"columns\":[\"id\"]},{\"name\":\"voice_gateway_turns_voice_session_id_gateway_turn_id_idx\",\"columns\":[\"voice_session_id\",\"gateway_turn_id\"],\"unique\":true}],\"version\":\"45e2867c\"}},\"@happyvertical/smrt-chat:VoiceSession\":{\"name\":\"voicesession\",\"className\":\"VoiceSession\",\"qualifiedName\":\"@happyvertical/smrt-chat:VoiceSession\",\"collection\":\"voicesessions\",\"filePath\":\"/home/runner/_work/smrt/smrt/packages/chat/src/models/VoiceSession.ts\",\"packageName\":\"@happyvertical/smrt-chat\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":true,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":true,\"autoPopulate\":true,\"nullable\":false,\"mode\":\"required\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"gatewaySessionId\":{\"type\":\"text\",\"required\":true,\"default\":\"\",\"_meta\":{\"required\":true}},\"actorProfileId\":{\"type\":\"crossPackageRef\",\"required\":true,\"related\":\"@happyvertical/smrt-profiles:Profile\"},\"actorUserId\":{\"type\":\"crossPackageRef\",\"required\":false,\"related\":\"@happyvertical/smrt-users:User\",\"_meta\":{\"nullable\":true}},\"personaId\":{\"type\":\"crossPackageRef\",\"required\":true,\"related\":\"@happyvertical/smrt-personas:AgentPersona\"},\"agentSessionId\":{\"type\":\"foreignKey\",\"required\":true,\"related\":\"AgentSession\",\"_meta\":{\"required\":true}},\"chatRoomId\":{\"type\":\"foreignKey\",\"required\":true,\"related\":\"ChatRoom\",\"_meta\":{\"required\":true}},\"threadId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"ChatThread\"},\"target\":{\"type\":\"text\",\"required\":true,\"default\":\"smrt:chat\",\"_meta\":{\"required\":true}},\"status\":{\"type\":\"text\",\"required\":true,\"default\":\"active\",\"_meta\":{\"required\":true}},\"expiresAt\":{\"type\":\"datetime\",\"required\":true,\"_meta\":{\"required\":true}},\"lastTurnAt\":{\"type\":\"datetime\",\"required\":false},\"lastGatewayTurnId\":{\"type\":\"text\",\"required\":false},\"personaSnapshot\":{\"type\":\"text\",\"required\":false,\"default\":\"{}\"},\"metadata\":{\"type\":\"text\",\"required\":false,\"default\":\"{}\"},\"processedTurnIds\":{\"type\":\"text\",\"required\":false,\"default\":\"[]\"}},\"methods\":{\"isActive\":{\"name\":\"isActive\",\"async\":false,\"parameters\":[{\"name\":\"now\",\"type\":\"Date\",\"optional\":true}],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isExpired\":{\"name\":\"isExpired\",\"async\":false,\"parameters\":[{\"name\":\"now\",\"type\":\"Date\",\"optional\":true}],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"expire\":{\"name\":\"expire\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"revoke\":{\"name\":\"revoke\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"getPersonaSnapshot\":{\"name\":\"getPersonaSnapshot\",\"async\":false,\"parameters\":[],\"returnType\":\"ConversationPersona\",\"isStatic\":false,\"isPublic\":true},\"setPersonaSnapshot\":{\"name\":\"setPersonaSnapshot\",\"async\":false,\"parameters\":[{\"name\":\"persona\",\"type\":\"ConversationPersona\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"getMetadata\":{\"name\":\"getMetadata\",\"async\":false,\"parameters\":[],\"returnType\":\"Record<string>\",\"isStatic\":false,\"isPublic\":true},\"setMetadata\":{\"name\":\"setMetadata\",\"async\":false,\"parameters\":[{\"name\":\"metadata\",\"type\":\"Record<string>\",\"optional\":false}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"getProcessedTurnIds\":{\"name\":\"getProcessedTurnIds\",\"async\":false,\"parameters\":[],\"returnType\":\"string[]\",\"isStatic\":false,\"isPublic\":true},\"hasProcessedTurn\":{\"name\":\"hasProcessedTurn\",\"async\":false,\"parameters\":[{\"name\":\"turnId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"recordGatewayTurn\":{\"name\":\"recordGatewayTurn\",\"async\":false,\"parameters\":[{\"name\":\"turnId\",\"type\":\"string\",\"optional\":false},{\"name\":\"maxRememberedTurns\",\"type\":\"any\",\"optional\":true}],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"voice_sessions\",\"api\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"cli\":true,\"tenantScoped\":{\"mode\":\"required\"}},\"extends\":\"SmrtObject\",\"exportName\":\"VoiceSession\",\"collectionExportName\":\"VoiceSessionCollection\",\"validationRules\":[{\"field\":\"tenantId\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"gatewaySessionId\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"actorProfileId\",\"rule\":\"required\",\"fieldType\":\"crossPackageRef\"},{\"field\":\"personaId\",\"rule\":\"required\",\"fieldType\":\"crossPackageRef\"},{\"field\":\"agentSessionId\",\"rule\":\"required\",\"fieldType\":\"foreignKey\"},{\"field\":\"chatRoomId\",\"rule\":\"required\",\"fieldType\":\"foreignKey\"},{\"field\":\"target\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"status\",\"rule\":\"required\",\"fieldType\":\"text\"},{\"field\":\"expiresAt\",\"rule\":\"required\",\"fieldType\":\"datetime\"}],\"schema\":{\"tableName\":\"voice_sessions\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"voice_sessions\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID NOT NULL,\\n \\\"gateway_session_id\\\" TEXT NOT NULL DEFAULT '',\\n \\\"actor_profile_id\\\" UUID NOT NULL,\\n \\\"actor_user_id\\\" UUID,\\n \\\"persona_id\\\" UUID NOT NULL,\\n \\\"agent_session_id\\\" UUID NOT NULL,\\n \\\"chat_room_id\\\" UUID NOT NULL,\\n \\\"thread_id\\\" UUID,\\n \\\"target\\\" TEXT NOT NULL DEFAULT 'smrt:chat',\\n \\\"status\\\" TEXT NOT NULL DEFAULT 'active',\\n \\\"expires_at\\\" TIMESTAMP NOT NULL,\\n \\\"last_turn_at\\\" TIMESTAMP,\\n \\\"last_gateway_turn_id\\\" TEXT,\\n \\\"persona_snapshot\\\" TEXT DEFAULT '{}',\\n \\\"metadata\\\" TEXT DEFAULT '{}',\\n \\\"processed_turn_ids\\\" TEXT DEFAULT '[]'\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":true,\"unique\":false},\"gateway_session_id\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"\"},\"actor_profile_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"actor_user_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false},\"persona_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":true,\"unique\":false},\"agent_session_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":true,\"unique\":false},\"chat_room_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":true,\"unique\":false},\"thread_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false},\"target\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"smrt:chat\"},\"status\":{\"type\":\"TEXT\",\"notNull\":true,\"unique\":false,\"default\":\"active\"},\"expires_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"unique\":false},\"last_turn_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"last_gateway_turn_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"persona_snapshot\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"},\"metadata\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"{}\"},\"processed_turn_ids\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"[]\"}},\"indexes\":[{\"name\":\"voice_sessions_id_idx\",\"columns\":[\"id\"]},{\"name\":\"voice_sessions_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"348c29ef\"}}},\"moduleType\":\"smrt\",\"smrtDependencies\":[\"@happyvertical/smrt-agents\",\"@happyvertical/smrt-core\",\"@happyvertical/smrt-personas\",\"@happyvertical/smrt-profiles\",\"@happyvertical/smrt-tenancy\",\"@happyvertical/smrt-users\"]}"));
|
|
11
11
|
//#endregion
|
|
12
12
|
//#region src/chat-feedback.ts
|
|
13
13
|
async function captureChatFeedback(options) {
|
package/dist/manifest.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "1.0.0",
|
|
3
|
-
"timestamp":
|
|
3
|
+
"timestamp": 1784269738357,
|
|
4
4
|
"packageName": "@happyvertical/smrt-chat",
|
|
5
|
-
"packageVersion": "0.40.
|
|
5
|
+
"packageVersion": "0.40.7",
|
|
6
6
|
"objects": {
|
|
7
7
|
"@happyvertical/smrt-chat:AgentSessionCollection": {
|
|
8
8
|
"name": "agentsessioncollection",
|
|
9
9
|
"className": "AgentSessionCollection",
|
|
10
10
|
"qualifiedName": "@happyvertical/smrt-chat:AgentSessionCollection",
|
|
11
11
|
"collection": "agentsessions",
|
|
12
|
-
"filePath": "/home/runner
|
|
12
|
+
"filePath": "/home/runner/_work/smrt/smrt/packages/chat/src/collections/AgentSessionCollection.ts",
|
|
13
13
|
"packageName": "@happyvertical/smrt-chat",
|
|
14
14
|
"fields": {},
|
|
15
15
|
"methods": {
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
"className": "ChatMessageCollection",
|
|
166
166
|
"qualifiedName": "@happyvertical/smrt-chat:ChatMessageCollection",
|
|
167
167
|
"collection": "chatmessages",
|
|
168
|
-
"filePath": "/home/runner
|
|
168
|
+
"filePath": "/home/runner/_work/smrt/smrt/packages/chat/src/collections/ChatMessageCollection.ts",
|
|
169
169
|
"packageName": "@happyvertical/smrt-chat",
|
|
170
170
|
"fields": {},
|
|
171
171
|
"methods": {
|
|
@@ -350,7 +350,7 @@
|
|
|
350
350
|
"className": "ChatParticipantCollection",
|
|
351
351
|
"qualifiedName": "@happyvertical/smrt-chat:ChatParticipantCollection",
|
|
352
352
|
"collection": "chatparticipants",
|
|
353
|
-
"filePath": "/home/runner
|
|
353
|
+
"filePath": "/home/runner/_work/smrt/smrt/packages/chat/src/collections/ChatParticipantCollection.ts",
|
|
354
354
|
"packageName": "@happyvertical/smrt-chat",
|
|
355
355
|
"fields": {},
|
|
356
356
|
"methods": {
|
|
@@ -558,7 +558,7 @@
|
|
|
558
558
|
"className": "ChatReactionCollection",
|
|
559
559
|
"qualifiedName": "@happyvertical/smrt-chat:ChatReactionCollection",
|
|
560
560
|
"collection": "chatreactions",
|
|
561
|
-
"filePath": "/home/runner
|
|
561
|
+
"filePath": "/home/runner/_work/smrt/smrt/packages/chat/src/collections/ChatReactionCollection.ts",
|
|
562
562
|
"packageName": "@happyvertical/smrt-chat",
|
|
563
563
|
"fields": {},
|
|
564
564
|
"methods": {
|
|
@@ -681,7 +681,7 @@
|
|
|
681
681
|
"className": "ChatRoomCollection",
|
|
682
682
|
"qualifiedName": "@happyvertical/smrt-chat:ChatRoomCollection",
|
|
683
683
|
"collection": "chatrooms",
|
|
684
|
-
"filePath": "/home/runner
|
|
684
|
+
"filePath": "/home/runner/_work/smrt/smrt/packages/chat/src/collections/ChatRoomCollection.ts",
|
|
685
685
|
"packageName": "@happyvertical/smrt-chat",
|
|
686
686
|
"fields": {},
|
|
687
687
|
"methods": {
|
|
@@ -833,7 +833,7 @@
|
|
|
833
833
|
"className": "ChatThreadCollection",
|
|
834
834
|
"qualifiedName": "@happyvertical/smrt-chat:ChatThreadCollection",
|
|
835
835
|
"collection": "chatthreads",
|
|
836
|
-
"filePath": "/home/runner
|
|
836
|
+
"filePath": "/home/runner/_work/smrt/smrt/packages/chat/src/collections/ChatThreadCollection.ts",
|
|
837
837
|
"packageName": "@happyvertical/smrt-chat",
|
|
838
838
|
"fields": {},
|
|
839
839
|
"methods": {
|
|
@@ -935,7 +935,7 @@
|
|
|
935
935
|
"className": "VoiceGatewayTurnCollection",
|
|
936
936
|
"qualifiedName": "@happyvertical/smrt-chat:VoiceGatewayTurnCollection",
|
|
937
937
|
"collection": "voicegatewayturns",
|
|
938
|
-
"filePath": "/home/runner
|
|
938
|
+
"filePath": "/home/runner/_work/smrt/smrt/packages/chat/src/collections/VoiceGatewayTurnCollection.ts",
|
|
939
939
|
"packageName": "@happyvertical/smrt-chat",
|
|
940
940
|
"fields": {},
|
|
941
941
|
"methods": {
|
|
@@ -1015,7 +1015,7 @@
|
|
|
1015
1015
|
"className": "VoiceSessionCollection",
|
|
1016
1016
|
"qualifiedName": "@happyvertical/smrt-chat:VoiceSessionCollection",
|
|
1017
1017
|
"collection": "voicesessions",
|
|
1018
|
-
"filePath": "/home/runner
|
|
1018
|
+
"filePath": "/home/runner/_work/smrt/smrt/packages/chat/src/collections/VoiceSessionCollection.ts",
|
|
1019
1019
|
"packageName": "@happyvertical/smrt-chat",
|
|
1020
1020
|
"fields": {},
|
|
1021
1021
|
"methods": {
|
|
@@ -1120,7 +1120,7 @@
|
|
|
1120
1120
|
"className": "AgentSession",
|
|
1121
1121
|
"qualifiedName": "@happyvertical/smrt-chat:AgentSession",
|
|
1122
1122
|
"collection": "agentsessions",
|
|
1123
|
-
"filePath": "/home/runner
|
|
1123
|
+
"filePath": "/home/runner/_work/smrt/smrt/packages/chat/src/models/AgentSession.ts",
|
|
1124
1124
|
"packageName": "@happyvertical/smrt-chat",
|
|
1125
1125
|
"fields": {
|
|
1126
1126
|
"tenantId": {
|
|
@@ -1523,7 +1523,7 @@
|
|
|
1523
1523
|
"className": "ChatMessage",
|
|
1524
1524
|
"qualifiedName": "@happyvertical/smrt-chat:ChatMessage",
|
|
1525
1525
|
"collection": "chatmessages",
|
|
1526
|
-
"filePath": "/home/runner
|
|
1526
|
+
"filePath": "/home/runner/_work/smrt/smrt/packages/chat/src/models/ChatMessage.ts",
|
|
1527
1527
|
"packageName": "@happyvertical/smrt-chat",
|
|
1528
1528
|
"fields": {
|
|
1529
1529
|
"tenantId": {
|
|
@@ -1956,7 +1956,7 @@
|
|
|
1956
1956
|
"className": "ChatParticipant",
|
|
1957
1957
|
"qualifiedName": "@happyvertical/smrt-chat:ChatParticipant",
|
|
1958
1958
|
"collection": "chatparticipants",
|
|
1959
|
-
"filePath": "/home/runner
|
|
1959
|
+
"filePath": "/home/runner/_work/smrt/smrt/packages/chat/src/models/ChatParticipant.ts",
|
|
1960
1960
|
"packageName": "@happyvertical/smrt-chat",
|
|
1961
1961
|
"fields": {
|
|
1962
1962
|
"tenantId": {
|
|
@@ -2282,7 +2282,7 @@
|
|
|
2282
2282
|
"className": "ChatReaction",
|
|
2283
2283
|
"qualifiedName": "@happyvertical/smrt-chat:ChatReaction",
|
|
2284
2284
|
"collection": "chatreactions",
|
|
2285
|
-
"filePath": "/home/runner
|
|
2285
|
+
"filePath": "/home/runner/_work/smrt/smrt/packages/chat/src/models/ChatReaction.ts",
|
|
2286
2286
|
"packageName": "@happyvertical/smrt-chat",
|
|
2287
2287
|
"fields": {
|
|
2288
2288
|
"tenantId": {
|
|
@@ -2445,7 +2445,7 @@
|
|
|
2445
2445
|
"className": "ChatRoom",
|
|
2446
2446
|
"qualifiedName": "@happyvertical/smrt-chat:ChatRoom",
|
|
2447
2447
|
"collection": "chatrooms",
|
|
2448
|
-
"filePath": "/home/runner
|
|
2448
|
+
"filePath": "/home/runner/_work/smrt/smrt/packages/chat/src/models/ChatRoom.ts",
|
|
2449
2449
|
"packageName": "@happyvertical/smrt-chat",
|
|
2450
2450
|
"fields": {
|
|
2451
2451
|
"tenantId": {
|
|
@@ -2776,7 +2776,7 @@
|
|
|
2776
2776
|
"className": "ChatThread",
|
|
2777
2777
|
"qualifiedName": "@happyvertical/smrt-chat:ChatThread",
|
|
2778
2778
|
"collection": "chatthreads",
|
|
2779
|
-
"filePath": "/home/runner
|
|
2779
|
+
"filePath": "/home/runner/_work/smrt/smrt/packages/chat/src/models/ChatThread.ts",
|
|
2780
2780
|
"packageName": "@happyvertical/smrt-chat",
|
|
2781
2781
|
"fields": {
|
|
2782
2782
|
"tenantId": {
|
|
@@ -2990,7 +2990,7 @@
|
|
|
2990
2990
|
"className": "VoiceGatewayTurn",
|
|
2991
2991
|
"qualifiedName": "@happyvertical/smrt-chat:VoiceGatewayTurn",
|
|
2992
2992
|
"collection": "voicegatewayturns",
|
|
2993
|
-
"filePath": "/home/runner
|
|
2993
|
+
"filePath": "/home/runner/_work/smrt/smrt/packages/chat/src/models/VoiceGatewayTurn.ts",
|
|
2994
2994
|
"packageName": "@happyvertical/smrt-chat",
|
|
2995
2995
|
"fields": {
|
|
2996
2996
|
"tenantId": {
|
|
@@ -3247,7 +3247,7 @@
|
|
|
3247
3247
|
"className": "VoiceSession",
|
|
3248
3248
|
"qualifiedName": "@happyvertical/smrt-chat:VoiceSession",
|
|
3249
3249
|
"collection": "voicesessions",
|
|
3250
|
-
"filePath": "/home/runner
|
|
3250
|
+
"filePath": "/home/runner/_work/smrt/smrt/packages/chat/src/models/VoiceSession.ts",
|
|
3251
3251
|
"packageName": "@happyvertical/smrt-chat",
|
|
3252
3252
|
"fields": {
|
|
3253
3253
|
"tenantId": {
|
package/dist/smrt-knowledge.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"generatedAt": "2026-07-
|
|
3
|
+
"generatedAt": "2026-07-17T06:29:04.112Z",
|
|
4
4
|
"packageName": "@happyvertical/smrt-chat",
|
|
5
|
-
"packageVersion": "0.40.
|
|
5
|
+
"packageVersion": "0.40.7",
|
|
6
6
|
"sourceManifestPath": "dist/manifest.json",
|
|
7
7
|
"agentDocPath": "AGENTS.md",
|
|
8
8
|
"sourceHashes": {
|
|
9
|
-
"manifest": "
|
|
10
|
-
"packageJson": "
|
|
11
|
-
"agents": "
|
|
9
|
+
"manifest": "efc87cbb7447a6e785b5174b5e13c25585ad37c2524596aaa9b1514ea68e6c02",
|
|
10
|
+
"packageJson": "032154ecce20d7aa5567491f0fd5346870a8be377085beac160208eac831e3b6",
|
|
11
|
+
"agents": "1cf0059cf2de39d183d21873a0df0cc8c5979dd2707d880007d6c462dd92cae1"
|
|
12
12
|
},
|
|
13
13
|
"exports": [
|
|
14
14
|
".",
|
|
15
|
+
"./client",
|
|
15
16
|
"./internal/agent-runtime",
|
|
16
17
|
"./manifest",
|
|
17
18
|
"./manifest.json",
|
|
@@ -1984,5 +1985,5 @@
|
|
|
1984
1985
|
"polymorphicAssociations": 0,
|
|
1985
1986
|
"uuidColumns": 46
|
|
1986
1987
|
},
|
|
1987
|
-
"agentDoc": "# @happyvertical/smrt-chat\n\nChat rooms, threads, and agent sessions with app-controlled tool whitelisting.\n\n## Dev Server\n\n`pnpm --dir packages/chat dev` runs a package-local SvelteKit workbench. The root\nroute is an interactive chat surface with a dev-only `/api/dev-chat` endpoint:\nit uses `@happyvertical/ai` when local provider credentials are present and\nfalls back to a deterministic local assistant otherwise. `/api/dev-chat-stream`\nis its SSE companion (#1936) — the same provider/local-fallback resolution wired\nthrough `createChatStreamHandler` in plain mode, so an embedded `SmrtChatBackend`\nclient can exercise token streaming locally. `/previews` hosts the shared\ncomponent playground entries from `src/svelte/playground.ts`.\n\nThe root workbench also has a dev-only voice conversation mode. It reads voice\ngateway connection details through `/api/dev-voice/config`, streams browser mic\naudio to `WS /ws/voice` as PCM16 mono, appends gateway transcripts/responses to\nthe chat, and plays returned TTS audio. Exposing\n`SMRT_CHAT_DEV_VOICE_GATEWAY_TOKEN` to the browser requires\n`SMRT_CHAT_DEV_VOICE_GATEWAY_EXPOSE_TOKEN=true`; keep that local-only.\n\n## Models\n\nInternal models — all mutations go through the membership/owner-checked `ChatService` (S5 #1392) or the voice adapter's binding-checked flow. EVERY `@smrt()` model in this package (ChatRoom, ChatMessage, ChatParticipant, ChatThread, ChatReaction, AgentSession, VoiceSession) has a READ-ONLY generated REST/MCP surface (`list`/`get` only); `create`/`update`/`delete` are intentionally NOT generated so the raw collection routes cannot skip the service-layer authorization. A structural regression test enumerates the registry to assert no chat model exposes a mutating op.\n\n`ChatService` is a CLOSED FACADE (S5 #1392). The raw collections (`rooms`, `messages`, `participants`, `threads`, `agentSessions`, `reactions`, `voiceSessions`) are ES `#private` fields — they are NOT on the public `ChatService` type and the package index does NOT export the collection classes, so a consumer cannot do `chat.messages.create({senderProfileId, role})` / `new ChatParticipantCollection(...)` to mutate around the authorization. The security-sensitive internals (`#writeMessage`, `#emitAgentReply`, `#enrollParticipant`, `#loadActiveSession`, `#requireActiveMembership`, `#requireRoomAdmin`, `#extractToolName`) are ES `#private` too, so they are unreachable at runtime — TypeScript `private` alone is erased and would leave them callable on the prototype. The agent-reply bridge is a `Symbol`-keyed static (not the old enumerable `_runAgentReply`), reachable only by the module-local `sendAgentReply` that holds the non-exported symbol.\n\n- **ChatRoom**: `roomType` (public/private/dm/agent), `status`, `topic`, `maxParticipants`, `lastMessageAt`. Tenant-scoped (required).\n- **ChatMessage**: shared by users + agents. `role` (user/assistant/system/tool), `messageType` (text/system/action/file/tool_call/tool_result), `toolCallData` JSON. Unified model — no separate agent message type. Tenant-scoped (required).\n- **ChatParticipant**: `role` (owner/admin/member/viewer), `onlineStatus`, `lastReadMessageId`, `isMuted`. Tenant-scoped (required).\n- **ChatThread**: `rootMessageId`, `isResolved`, `messageCount`. Created via `ChatService.startThread()` (member-checked). Tenant-scoped (required).\n- **ChatReaction**: `messageId`, `profileId`, `emoji`. Added/removed via `ChatService.addReaction()`/`removeReaction()` (member-checked, self-keyed). Tenant-scoped (required).\n- **AgentSession**: `agentId` (string ref, not FK), `allowedTools` (JSON string array), `sessionContext` (JSON), `systemPrompt`, limits (`maxTokens`/`maxMessages`/`expiresAt`). Optional tenancy.\n- **VoiceSession**: short-lived voice-gateway binding over `(tenant, actorProfileId, personaId, room/thread/agentSession)` plus a persona snapshot, gateway `session_id`, expiry, replay tracking, and metadata. Tenant-scoped (required). Generated surface is read-only; creation and turns go through `createVoiceChatSession()` / `handleVoiceGatewayTurn()`.\n\n## ChatService\n\nEvery public write takes an explicit server-supplied `actorProfileId` (the authenticated principal the route injects) — never a caller-controlled `senderProfileId`/`role` (S5 #1392).\n\nFacade: `sendMessage()` (authors as the actor with `role: 'user'`; room-membership-checked; no caller-supplied sender/role and no public membership-skip), `createRoom()` (acting actor becomes owner — no caller-supplied `createdByProfileId`), `startThread()` (member-checked; optional `rootMessageId` bound to the same room+tenant), `addParticipant()`/`removeParticipant()` (owner/admin-checked; self-leave allowed), `updateRoom()` (owner/admin-checked), `addReaction()`/`removeReaction()` (member-checked, self-keyed), `getOrCreateDM()` (actor must be a DM participant), `createAgentSession()` (acting actor becomes the session participant — no caller-supplied `participantProfileId`; the existing-session room lookup is tenant-bound; optional `sessionKey` scopes session identity to a conversation subject so distinct keys get distinct sessions/rooms and a session opened for one subject is never reused/rewritten for another). Tenant-bound read facade (replaces raw-collection reach-ins; consumers apply their own ownership/context checks on the returned rows): `getAgentSession({agentSessionId, tenantId})`, `findActiveAgentSessions({tenantId, agentId, participantProfileId})`, `getThread({threadId, tenantId})`, `listRoomThreads({roomId, actorProfileId, tenantId})` (membership-gated), `getThreadMessages({threadId, actorProfileId, tenantId, limit?})` (membership-gated, chronological), `getRoomMessages({roomId, actorProfileId, tenantId})`/`getRoomForMember(roomId, actorProfileId, tenantId)` (membership-checked reads gated on the server-supplied `actorProfileId`, never a caller-controlled subject id — confused-deputy avoidance; `tenantId` required), `updateAgentSessionConfig()` (owner-checked; `tenantId` mandatory and bound into the lookup). Agent session messaging is split by authority: `sendAgentUserMessage()` (caller `actorProfileId` must be the session participant; always authored as the participant). The agent-authored reply path `sendAgentReply(service, params)` is an exported **function — NOT a `ChatService` method and NOT on the package index**; it is reachable only via the dedicated `@happyvertical/smrt-chat/internal/agent-runtime` subpath (S5 #1392), so only trusted in-process agent-runtime code that explicitly opts into that subpath can author as the agent. It authors as `session.agentId`, accepts an optional same-room/tenant `threadId`, and gates tool calls fail-closed against `allowedTools`. The shared internal persistence path (`writeMessage`) is private — it alone may author an arbitrary profile/role or skip the membership check, and is unreachable from any route; it also validates every supplied `threadId`/`agentSessionId`/`replyToMessageId` belongs to the SAME room AND tenant (tenant/room-bound lookups) before use, rejecting cross-room/cross-tenant references. Auto-creates rooms/sessions/participants via an internal `enrollParticipant`.\n\n## Agent Tool Whitelisting\n\n`allowedTools` is a JSON array controlled by the consuming app. Fail-closed: an empty/unparseable whitelist permits NO tools. The internal `sendAgentReply(service, params)` function enforces the whitelist before emitting any `tool`/`tool_call` message; a caller cannot supply a `senderProfileId`/`role` to post as the agent, and the function is not reachable from the package index.\n\n## Conversational Harness (L3, #1891)\n\nThe \"chat with your learning agent\" surface — the real agentic runtime for `AgentSession` (the only shipping chat runtime before this was a single-shot completion). This is the new **acyclic `chat → personas` / `chat → agents` / `chat → users` edge**; keep it that way (personas/agents/users never depend back on chat).\n\n- **`runToolLoop(options)`** (`tool-loop.ts`) — a bounded `tool_call → observe → respond` loop. Tools are **manifest operations** of installed packages: `buildManifestToolCatalog({ allowedTools })` reads the `PermissionCatalogService` catalog and keeps only the `(collection, action)` entries named in the persona's allow-list (the **offer gate**; absent/empty ⇒ NO tools). The loop runs inside one `executeAsPrincipal` context, and `invokeManifestTool` executes each op **in-process (\"side door\")** against `run.context.database` (the RLS tx when Postgres RLS is on), after re-asserting the fail-closed allow-list (`run.assertToolAllowed`) AND the catalog permission (`run.assertOperation`) — the **execution gate**. Bounded by a max-steps ceiling (`DEFAULT_MAX_STEPS = 8`): on the ceiling it disables tools for one final completion so the turn always terminates with text.\n- **`runPersonaConversationTurn(options)`** (`persona-conversation.ts`) — binds a conversation to an `AgentPersona`/`ResolvedPersona`: runs as its principal (`runAsUserId`), offers only its `allowedTools`, speaks its instructions (`resolvePersonaInstructions`, layering approved learned directives), and injects its **recalled learning memory** (`personaLearningMemory`, isolated per `memoryScope`) into the system prompt. `bindPersonaToSession()` mirrors the persona's `allowedTools`/instructions onto the `AgentSession` so the chat authoring gate agrees with the loop's offer gate. Authors the reply (and each executed tool) via the internal `sendAgentReply` bridge.\n- **Agent orchestration** (L3, #1892) — the loop accepts non-manifest **`extraTools`** (`PrincipalTool[]`, from `@happyvertical/smrt-agents`), gated by the *same* fail-closed allow-list. The standard **`invoke-agent`** tool (`createInvokeAgentTool`, slug `agents.invoke`) lets a conversational agent delegate to a **worker agent under its own principal** — the worker runs via `executeAsPrincipal` as the originating user (never its own authority), the principal is immutable along the chain, and its completion is surfaced back into the conversation. `runPersonaConversationTurn` filters `extraTools` by the persona's `allowedTools` (offer gate); the tool's `execute` re-asserts `assertToolAllowed` (execution gate). See `@happyvertical/smrt-agents` for the delegation envelope + transports.\n- **Chat feedback capture** (`chat-feedback.ts`) — `captureChatFeedback()` + `acceptAppliedChange`/`rejectAppliedChange`/`correctResponse`/`rateResponse`/`thumbsUp`/`thumbsDown` write a `Feedback` row (personas) carrying the conversation's **correlation-id**, and (by default) reinforce the persona's learning memory (`reinforceFromFeedback`). So an in-chat reject decays a strategy below the reuse floor and it stops being recalled; a correction supersedes its stored value.\n\n## Voice Gateway Turns (#1910)\n\nVoice is an input mode for the existing persona chat harness, not a separate chat runtime. `createVoiceChatSession()` creates a short-lived `VoiceSession` for an authenticated actor/profile, binding tenant, persona, agent session, room, and optional thread. `handleVoiceGatewayTurn()` resolves that binding from `metadata.voiceSessionId`, checks the gateway's `session_id` and any supplied tenant/profile/persona/session/thread metadata against the server-side binding, persists the transcript through `ChatService.sendAgentUserMessage()`, runs `runPersonaConversationTurn()`, stamps voice/correlation metadata onto the persisted user/assistant/tool messages, records the gateway `turn_id`, and returns the gateway response contract. The Fetch-compatible `createVoiceGatewayTurnHandler()` adds the coarse gateway bearer-token check.\n\nThe gateway bearer token proves only \"this request came from the gateway\"; it never authorizes the end user. The short-lived `VoiceSession` binding is the user/session proof, and untrusted gateway metadata must be validated against that binding before any chat write or tool loop. Tool execution remains fail-closed through the persona allow-list mirrored onto `AgentSession` by `bindPersonaToSession()`.\n\n## Token Streaming (SSE, #1936)\n\n`chat-stream.ts` is the SSE seam for embeddable conversational UIs (first consumer: the Happy chat widget, `animation#5`): a client POSTs the conversation so far and receives a `text/event-stream` of `data: <json>` frames — `token` deltas as the model generates, then a final `done` frame with the message. The wire `ChatStreamEvent` union also declares `emotion` and `control` (#1921 host-page control commands) lanes for forward compatibility; the v1 engine emits `token`/`done`/`error`.\n\n- **`runChatConversationStream({ context, messages })`** — the transport-agnostic engine (an `AsyncGenerator<ChatStreamEvent>`). Dispatches on `context.binding`: **persona-bound** runs the full `runPersonaConversationTurn` with a token sink wired through the tool loop (`onToken` → `ai.chat({ stream: true, onProgress })`), then persists via `ChatService` and emits the persisted message as `done`; **plain/unbound** streams `ai.stream()` directly and emits a synthesized (unpersisted) `done`. Streamed tokens are a live PREVIEW (a tool-call round may narrate before acting); the `done` message is authoritative. Failures surface as an in-band `error` event, never a throw (the 200 has already committed once streaming starts).\n- **`createChatStreamHandler({ authorize, allowedOrigins?, allowCredentials? })`** — a Fetch-compatible handler returning `text/event-stream` (mirrors `createVoiceGatewayTurnHandler`). `authorize(request, body)` is the SOLE trust boundary and works exactly like the voice gateway: this module NEVER authorizes from the request's `session` metadata — the app validates the caller (bearer session id / cookie / same-origin) and the claimed ids against the authenticated principal, and returns an already-authorized `ChatStreamContext`. Generation caps (`model`/`maxTokens`/`maxSteps`) live on the context (server-resolved), never on the request. Cross-origin embedding uses the same fail-closed CORS posture as core `_events` (#1861): the `Origin` is echoed only when allow-listed (never `*`), credentials only when opted in.\n- **Persona path reuses the harness's own gates unchanged** — persona principal, fail-closed `allowedTools` offer+execution gates, tenant binding. `onToken` is best-effort telemetry threaded through `runToolLoop`; it never changes what the loop persists or authorizes.\n- **Custom tools stream via `binding.extraTools`** — the persona binding threads an optional `extraTools?: PrincipalTool[]` down to `runPersonaConversationTurn`, so a *streamed* persona chat can offer non-manifest, service-backed tools (the persona messaging tool `messages.send`, or an assistance-request/lead-ticket tool wrapping a `@smrt({ api:false, mcp:false })` service) and thus *act*, not only answer — matching the non-streaming persona path. It is resolved server-side by `authorize` (trusted), never from request input, and stays fully gated: each tool is filtered by the persona's `allowedTools` (offer gate) and re-asserts the bound principal's authority in `execute` (execution gate). Offering a tool is not authorizing it.\n\n## Gotchas\n\n- **sessionContext, not context**: `context` is reserved for slug scoping. Use `getSessionContext()`/`updateSessionContext()` for agent memory.\n- **Agent rooms auto-created**: `roomType: 'agent'`, `maxParticipants` defaults to 2; the agent is enrolled as a member so its replies pass the membership check. `createAgentSession()` re-enrolls the participant AND the agent on the existing-session path, so legacy sessions created before the agent was enrolled self-heal.\n- **Per-subject sessions need `sessionKey`**: `createAgentSession()` reuses ANY active session for the same `(agentId, participantProfileId, tenantId)`. Callers that open separate conversations per subject (e.g. one content-editor session per content id) MUST pass a stable `sessionKey` (stored in `sessionContext.__sessionKey`, read via `AgentSession.getSessionKey()`); otherwise a session opened for one subject is reused and its context overwritten for another, surfacing the wrong room/threads (S5 #1392). A keyed create never reuses a keyless/legacy session.\n- **Session expiry**: check `isActive()` before allowing messages (expiresAt or limit-based)\n- **DM identity**: derived from the deterministic per-tenant `canonicalDmRoomId()` and the authoritative `chat_participants` join, not client metadata; concurrent creates upsert onto one row.\n- **Tenant-bound lookups**: membership/session/DM lookups REQUIRE `tenantId` and always bind it into the WHERE clause (`findActiveMembership`/`isActiveMember`/`findActiveSession` take a required `tenantId`; AgentSession's `null` tenant is an explicit bound scope, not \"any tenant\") so they can never resolve a row from another tenant.\n"
|
|
1988
|
+
"agentDoc": "# @happyvertical/smrt-chat\n\nChat rooms, threads, and agent sessions with app-controlled tool whitelisting.\n\n## Dev Server\n\n`pnpm --dir packages/chat dev` runs a package-local SvelteKit workbench. The root\nroute is an interactive chat surface with a dev-only `/api/dev-chat` endpoint:\nit uses `@happyvertical/ai` when local provider credentials are present and\nfalls back to a deterministic local assistant otherwise. `/api/dev-chat-stream`\nis its SSE companion (#1936) — the same provider/local-fallback resolution wired\nthrough `createChatStreamHandler` in plain mode, so an embedded `SmrtChatBackend`\nclient can exercise token streaming locally. `/previews` hosts the shared\ncomponent playground entries from `src/svelte/playground.ts`.\n\nThe root workbench also has a dev-only voice conversation mode. It reads voice\ngateway connection details through `/api/dev-voice/config`, streams browser mic\naudio to `WS /ws/voice` as PCM16 mono, appends gateway transcripts/responses to\nthe chat, and plays returned TTS audio. Exposing\n`SMRT_CHAT_DEV_VOICE_GATEWAY_TOKEN` to the browser requires\n`SMRT_CHAT_DEV_VOICE_GATEWAY_EXPOSE_TOKEN=true`; keep that local-only.\n\n## Models\n\nInternal models — all mutations go through the membership/owner-checked `ChatService` (S5 #1392) or the voice adapter's binding-checked flow. EVERY `@smrt()` model in this package (ChatRoom, ChatMessage, ChatParticipant, ChatThread, ChatReaction, AgentSession, VoiceSession) has a READ-ONLY generated REST/MCP surface (`list`/`get` only); `create`/`update`/`delete` are intentionally NOT generated so the raw collection routes cannot skip the service-layer authorization. A structural regression test enumerates the registry to assert no chat model exposes a mutating op.\n\n`ChatService` is a CLOSED FACADE (S5 #1392). The raw collections (`rooms`, `messages`, `participants`, `threads`, `agentSessions`, `reactions`, `voiceSessions`) are ES `#private` fields — they are NOT on the public `ChatService` type and the package index does NOT export the collection classes, so a consumer cannot do `chat.messages.create({senderProfileId, role})` / `new ChatParticipantCollection(...)` to mutate around the authorization. The security-sensitive internals (`#writeMessage`, `#emitAgentReply`, `#enrollParticipant`, `#loadActiveSession`, `#requireActiveMembership`, `#requireRoomAdmin`, `#extractToolName`) are ES `#private` too, so they are unreachable at runtime — TypeScript `private` alone is erased and would leave them callable on the prototype. The agent-reply bridge is a `Symbol`-keyed static (not the old enumerable `_runAgentReply`), reachable only by the module-local `sendAgentReply` that holds the non-exported symbol.\n\n- **ChatRoom**: `roomType` (public/private/dm/agent), `status`, `topic`, `maxParticipants`, `lastMessageAt`. Tenant-scoped (required).\n- **ChatMessage**: shared by users + agents. `role` (user/assistant/system/tool), `messageType` (text/system/action/file/tool_call/tool_result), `toolCallData` JSON. Unified model — no separate agent message type. Tenant-scoped (required).\n- **ChatParticipant**: `role` (owner/admin/member/viewer), `onlineStatus`, `lastReadMessageId`, `isMuted`. Tenant-scoped (required).\n- **ChatThread**: `rootMessageId`, `isResolved`, `messageCount`. Created via `ChatService.startThread()` (member-checked). Tenant-scoped (required).\n- **ChatReaction**: `messageId`, `profileId`, `emoji`. Added/removed via `ChatService.addReaction()`/`removeReaction()` (member-checked, self-keyed). Tenant-scoped (required).\n- **AgentSession**: `agentId` (string ref, not FK), `allowedTools` (JSON string array), `sessionContext` (JSON), `systemPrompt`, limits (`maxTokens`/`maxMessages`/`expiresAt`). Optional tenancy.\n- **VoiceSession**: short-lived voice-gateway binding over `(tenant, actorProfileId, personaId, room/thread/agentSession)` plus a persona snapshot, gateway `session_id`, expiry, replay tracking, and metadata. Tenant-scoped (required). Generated surface is read-only; creation and turns go through `createVoiceChatSession()` / `handleVoiceGatewayTurn()`.\n\n## ChatService\n\nEvery public write takes an explicit server-supplied `actorProfileId` (the authenticated principal the route injects) — never a caller-controlled `senderProfileId`/`role` (S5 #1392).\n\nFacade: `sendMessage()` (authors as the actor with `role: 'user'`; room-membership-checked; no caller-supplied sender/role and no public membership-skip), `createRoom()` (acting actor becomes owner — no caller-supplied `createdByProfileId`), `startThread()` (member-checked; optional `rootMessageId` bound to the same room+tenant), `addParticipant()`/`removeParticipant()` (owner/admin-checked; self-leave allowed), `updateRoom()` (owner/admin-checked), `addReaction()`/`removeReaction()` (member-checked, self-keyed), `getOrCreateDM()` (actor must be a DM participant), `createAgentSession()` (acting actor becomes the session participant — no caller-supplied `participantProfileId`; the existing-session room lookup is tenant-bound; optional `sessionKey` scopes session identity to a conversation subject so distinct keys get distinct sessions/rooms and a session opened for one subject is never reused/rewritten for another). Tenant-bound read facade (replaces raw-collection reach-ins; consumers apply their own ownership/context checks on the returned rows): `getAgentSession({agentSessionId, tenantId})`, `findActiveAgentSessions({tenantId, agentId, participantProfileId})`, `getThread({threadId, tenantId})`, `listRoomThreads({roomId, actorProfileId, tenantId})` (membership-gated), `getThreadMessages({threadId, actorProfileId, tenantId, limit?})` (membership-gated, chronological), `getRoomMessages({roomId, actorProfileId, tenantId})`/`getRoomForMember(roomId, actorProfileId, tenantId)` (membership-checked reads gated on the server-supplied `actorProfileId`, never a caller-controlled subject id — confused-deputy avoidance; `tenantId` required), `updateAgentSessionConfig()` (owner-checked; `tenantId` mandatory and bound into the lookup). Agent session messaging is split by authority: `sendAgentUserMessage()` (caller `actorProfileId` must be the session participant; always authored as the participant). The agent-authored reply path `sendAgentReply(service, params)` is an exported **function — NOT a `ChatService` method and NOT on the package index**; it is reachable only via the dedicated `@happyvertical/smrt-chat/internal/agent-runtime` subpath (S5 #1392), so only trusted in-process agent-runtime code that explicitly opts into that subpath can author as the agent. It authors as `session.agentId`, accepts an optional same-room/tenant `threadId`, and gates tool calls fail-closed against `allowedTools`. The shared internal persistence path (`writeMessage`) is private — it alone may author an arbitrary profile/role or skip the membership check, and is unreachable from any route; it also validates every supplied `threadId`/`agentSessionId`/`replyToMessageId` belongs to the SAME room AND tenant (tenant/room-bound lookups) before use, rejecting cross-room/cross-tenant references. Auto-creates rooms/sessions/participants via an internal `enrollParticipant`.\n\n## Agent Tool Whitelisting\n\n`allowedTools` is a JSON array controlled by the consuming app. Fail-closed: an empty/unparseable whitelist permits NO tools. The internal `sendAgentReply(service, params)` function enforces the whitelist before emitting any `tool`/`tool_call` message; a caller cannot supply a `senderProfileId`/`role` to post as the agent, and the function is not reachable from the package index.\n\n## Conversational Harness (L3, #1891)\n\nThe \"chat with your learning agent\" surface — the real agentic runtime for `AgentSession` (the only shipping chat runtime before this was a single-shot completion). This is the new **acyclic `chat → personas` / `chat → agents` / `chat → users` edge**; keep it that way (personas/agents/users never depend back on chat).\n\n- **`runToolLoop(options)`** (`tool-loop.ts`) — a bounded `tool_call → observe → respond` loop. Tools are **manifest operations** of installed packages: `buildManifestToolCatalog({ allowedTools })` reads the `PermissionCatalogService` catalog and keeps only the `(collection, action)` entries named in the persona's allow-list (the **offer gate**; absent/empty ⇒ NO tools). The loop runs inside one `executeAsPrincipal` context, and `invokeManifestTool` executes each op **in-process (\"side door\")** against `run.context.database` (the RLS tx when Postgres RLS is on), after re-asserting the fail-closed allow-list (`run.assertToolAllowed`) AND the catalog permission (`run.assertOperation`) — the **execution gate**. Bounded by a max-steps ceiling (`DEFAULT_MAX_STEPS = 8`): on the ceiling it disables tools for one final completion so the turn always terminates with text.\n- **`runPersonaConversationTurn(options)`** (`persona-conversation.ts`) — binds a conversation to an `AgentPersona`/`ResolvedPersona`: runs as its principal (`runAsUserId`), offers only its `allowedTools`, speaks its instructions (`resolvePersonaInstructions`, layering approved learned directives), and injects its **recalled learning memory** (`personaLearningMemory`, isolated per `memoryScope`) into the system prompt. `bindPersonaToSession()` mirrors the persona's `allowedTools`/instructions onto the `AgentSession` so the chat authoring gate agrees with the loop's offer gate. Authors the reply (and each executed tool) via the internal `sendAgentReply` bridge.\n- **Agent orchestration** (L3, #1892) — the loop accepts non-manifest **`extraTools`** (`PrincipalTool[]`, from `@happyvertical/smrt-agents`), gated by the *same* fail-closed allow-list. The standard **`invoke-agent`** tool (`createInvokeAgentTool`, slug `agents.invoke`) lets a conversational agent delegate to a **worker agent under its own principal** — the worker runs via `executeAsPrincipal` as the originating user (never its own authority), the principal is immutable along the chain, and its completion is surfaced back into the conversation. `runPersonaConversationTurn` filters `extraTools` by the persona's `allowedTools` (offer gate); the tool's `execute` re-asserts `assertToolAllowed` (execution gate). See `@happyvertical/smrt-agents` for the delegation envelope + transports.\n- **Chat feedback capture** (`chat-feedback.ts`) — `captureChatFeedback()` + `acceptAppliedChange`/`rejectAppliedChange`/`correctResponse`/`rateResponse`/`thumbsUp`/`thumbsDown` write a `Feedback` row (personas) carrying the conversation's **correlation-id**, and (by default) reinforce the persona's learning memory (`reinforceFromFeedback`). So an in-chat reject decays a strategy below the reuse floor and it stops being recalled; a correction supersedes its stored value.\n\n## Voice Gateway Turns (#1910)\n\nVoice is an input mode for the existing persona chat harness, not a separate chat runtime. `createVoiceChatSession()` creates a short-lived `VoiceSession` for an authenticated actor/profile, binding tenant, persona, agent session, room, and optional thread. `handleVoiceGatewayTurn()` resolves that binding from `metadata.voiceSessionId`, checks the gateway's `session_id` and any supplied tenant/profile/persona/session/thread metadata against the server-side binding, persists the transcript through `ChatService.sendAgentUserMessage()`, runs `runPersonaConversationTurn()`, stamps voice/correlation metadata onto the persisted user/assistant/tool messages, records the gateway `turn_id`, and returns the gateway response contract. The Fetch-compatible `createVoiceGatewayTurnHandler()` adds the coarse gateway bearer-token check.\n\nThe gateway bearer token proves only \"this request came from the gateway\"; it never authorizes the end user. The short-lived `VoiceSession` binding is the user/session proof, and untrusted gateway metadata must be validated against that binding before any chat write or tool loop. Tool execution remains fail-closed through the persona allow-list mirrored onto `AgentSession` by `bindPersonaToSession()`.\n\n## Token Streaming (SSE, #1936)\n\n`chat-stream.ts` is the SSE seam for embeddable conversational UIs (first consumer: the Happy chat widget, `animation#5`): a client POSTs the conversation so far and receives a `text/event-stream` of `data: <json>` frames — `token` deltas as the model generates, then a final `done` frame with the message. The wire `ChatStreamEvent` union also declares `emotion` and `control` (#1921 host-page control commands) lanes for forward compatibility; the v1 engine emits `token`/`done`/`error`.\n\n- **`runChatConversationStream({ context, messages })`** — the transport-agnostic engine (an `AsyncGenerator<ChatStreamEvent>`). Dispatches on `context.binding`: **persona-bound** runs the full `runPersonaConversationTurn` with a token sink wired through the tool loop (`onToken` → `ai.chat({ stream: true, onProgress })`), then persists via `ChatService` and emits the persisted message as `done`; **plain/unbound** streams `ai.stream()` directly and emits a synthesized (unpersisted) `done`. Streamed tokens are a live PREVIEW (a tool-call round may narrate before acting); the `done` message is authoritative. Failures surface as an in-band `error` event, never a throw (the 200 has already committed once streaming starts).\n- **`createChatStreamHandler({ authorize, allowedOrigins?, allowCredentials? })`** — a Fetch-compatible handler returning `text/event-stream` (mirrors `createVoiceGatewayTurnHandler`). `authorize(request, body)` is the SOLE trust boundary and works exactly like the voice gateway: this module NEVER authorizes from the request's `session` metadata — the app validates the caller (bearer session id / cookie / same-origin) and the claimed ids against the authenticated principal, and returns an already-authorized `ChatStreamContext`. Generation caps (`model`/`maxTokens`/`maxSteps`) live on the context (server-resolved), never on the request. Cross-origin embedding uses the same fail-closed CORS posture as core `_events` (#1861): the `Origin` is echoed only when allow-listed (never `*`), credentials only when opted in.\n- **`SmrtChatBackend` (`@happyvertical/smrt-chat/client`)** — the consume side of the same contract: a browser SSE client (`src/client.ts`) that POSTs the conversation and dispatches `token`/`emotion`/`done`/`error` frames to streaming handlers, tolerating heartbeat comments and frames split across chunks. The subpath is BROWSER-SAFE and dependency-free (no server runtime, no workspace imports — keep it that way), and its widget-facing types are structurally identical to `@happyvertical/animation`'s `ChatBackend` contract so an instance plugs straight into the floating chat widget. `src/client.contract.ts` carries the compile-time locks pinning it to `chat-stream.ts`'s `ChatStreamEvent`/`ChatStreamSession` — a NON-test module precisely so `pnpm typecheck` actually enforces them (`tsconfig.typecheck.json` excludes `.test.ts` files, and Vitest transpiles without typechecking). A clean close without a `done` frame surfaces as an error (never an empty reply), and a settled turn cancels the reader so the connection is released promptly.\n- **Persona path reuses the harness's own gates unchanged** — persona principal, fail-closed `allowedTools` offer+execution gates, tenant binding. `onToken` is best-effort telemetry threaded through `runToolLoop`; it never changes what the loop persists or authorizes.\n- **Custom tools stream via `binding.extraTools`** — the persona binding threads an optional `extraTools?: PrincipalTool[]` down to `runPersonaConversationTurn`, so a *streamed* persona chat can offer non-manifest, service-backed tools (the persona messaging tool `messages.send`, or an assistance-request/lead-ticket tool wrapping a `@smrt({ api:false, mcp:false })` service) and thus *act*, not only answer — matching the non-streaming persona path. It is resolved server-side by `authorize` (trusted), never from request input, and stays fully gated: each tool is filtered by the persona's `allowedTools` (offer gate) and re-asserts the bound principal's authority in `execute` (execution gate). Offering a tool is not authorizing it.\n\n## Gotchas\n\n- **sessionContext, not context**: `context` is reserved for slug scoping. Use `getSessionContext()`/`updateSessionContext()` for agent memory.\n- **Agent rooms auto-created**: `roomType: 'agent'`, `maxParticipants` defaults to 2; the agent is enrolled as a member so its replies pass the membership check. `createAgentSession()` re-enrolls the participant AND the agent on the existing-session path, so legacy sessions created before the agent was enrolled self-heal.\n- **Per-subject sessions need `sessionKey`**: `createAgentSession()` reuses ANY active session for the same `(agentId, participantProfileId, tenantId)`. Callers that open separate conversations per subject (e.g. one content-editor session per content id) MUST pass a stable `sessionKey` (stored in `sessionContext.__sessionKey`, read via `AgentSession.getSessionKey()`); otherwise a session opened for one subject is reused and its context overwritten for another, surfacing the wrong room/threads (S5 #1392). A keyed create never reuses a keyless/legacy session.\n- **Session expiry**: check `isActive()` before allowing messages (expiresAt or limit-based)\n- **DM identity**: derived from the deterministic per-tenant `canonicalDmRoomId()` and the authoritative `chat_participants` join, not client metadata; concurrent creates upsert onto one row.\n- **Tenant-bound lookups**: membership/session/DM lookups REQUIRE `tenantId` and always bind it into the WHERE clause (`findActiveMembership`/`isActiveMember`/`findActiveSession` take a required `tenantId`; AgentSession's `null` tenant is an explicit bound scope, not \"any tenant\") so they can never resolve a row from another tenant.\n"
|
|
1988
1989
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/smrt-chat",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.7",
|
|
4
4
|
"description": "Chat rooms, DMs, threads, and agent conversations for the SMRT framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"smrtRawPrimitives": "strict",
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"import": "./dist/index.js"
|
|
13
13
|
},
|
|
14
|
+
"./client": {
|
|
15
|
+
"types": "./dist/client.d.ts",
|
|
16
|
+
"import": "./dist/client.js"
|
|
17
|
+
},
|
|
14
18
|
"./ui": {
|
|
15
19
|
"types": "./dist/ui.d.ts",
|
|
16
20
|
"import": "./dist/ui.js"
|
|
@@ -56,15 +60,15 @@
|
|
|
56
60
|
"access": "public"
|
|
57
61
|
},
|
|
58
62
|
"dependencies": {
|
|
59
|
-
"@happyvertical/ai": "^0.80.
|
|
60
|
-
"@happyvertical/sql": "^0.80.
|
|
61
|
-
"@happyvertical/smrt-agents": "0.40.
|
|
62
|
-
"@happyvertical/smrt-core": "0.40.
|
|
63
|
-
"@happyvertical/smrt-personas": "0.40.
|
|
64
|
-
"@happyvertical/smrt-
|
|
65
|
-
"@happyvertical/smrt-types": "0.40.
|
|
66
|
-
"@happyvertical/smrt-
|
|
67
|
-
"@happyvertical/smrt-users": "0.40.
|
|
63
|
+
"@happyvertical/ai": "^0.80.2",
|
|
64
|
+
"@happyvertical/sql": "^0.80.2",
|
|
65
|
+
"@happyvertical/smrt-agents": "0.40.7",
|
|
66
|
+
"@happyvertical/smrt-core": "0.40.7",
|
|
67
|
+
"@happyvertical/smrt-personas": "0.40.7",
|
|
68
|
+
"@happyvertical/smrt-ui": "0.40.7",
|
|
69
|
+
"@happyvertical/smrt-types": "0.40.7",
|
|
70
|
+
"@happyvertical/smrt-tenancy": "0.40.7",
|
|
71
|
+
"@happyvertical/smrt-users": "0.40.7"
|
|
68
72
|
},
|
|
69
73
|
"peerDependencies": {
|
|
70
74
|
"svelte": "^5.56.4"
|
|
@@ -85,9 +89,9 @@
|
|
|
85
89
|
"typescript": "5.9.3",
|
|
86
90
|
"vite": "8.1.4",
|
|
87
91
|
"vitest": "4.1.10",
|
|
88
|
-
"@happyvertical/smrt-playground": "0.40.
|
|
89
|
-
"@happyvertical/smrt-profiles": "0.40.
|
|
90
|
-
"@happyvertical/smrt-vitest": "0.40.
|
|
92
|
+
"@happyvertical/smrt-playground": "0.40.7",
|
|
93
|
+
"@happyvertical/smrt-profiles": "0.40.7",
|
|
94
|
+
"@happyvertical/smrt-vitest": "0.40.7"
|
|
91
95
|
},
|
|
92
96
|
"scripts": {
|
|
93
97
|
"build": "SMRT_PACKAGE_BUILD=1 vite build --mode library && SMRT_PACKAGE_BUILD=1 svelte-package -i src/svelte -o dist/svelte --tsconfig tsconfig.svelte.json",
|