@happyvertical/smrt-chat 0.51.39 → 0.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/AGENTS.md +19 -2
  2. package/README.md +13 -0
  3. package/dist/assistant-turn-events.d.ts +152 -0
  4. package/dist/assistant-turn-events.d.ts.map +1 -0
  5. package/dist/assistant-turn-events.js +2 -0
  6. package/dist/assistant-turn.d.ts +236 -0
  7. package/dist/assistant-turn.d.ts.map +1 -0
  8. package/dist/chunks/{ChatService-D48KBDZy.js → ChatService-jJi2JJJi.js} +2 -2
  9. package/dist/chunks/ChatService-jJi2JJJi.js.map +1 -0
  10. package/dist/chunks/assistant-turn-events-BbZUf-Ju.js +77 -0
  11. package/dist/chunks/assistant-turn-events-BbZUf-Ju.js.map +1 -0
  12. package/dist/index.d.ts +3 -1
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +776 -104
  15. package/dist/index.js.map +1 -1
  16. package/dist/internal/agent-runtime.js +1 -1
  17. package/dist/manifest.json +6 -2
  18. package/dist/models/AgentSession.d.ts +11 -1
  19. package/dist/models/AgentSession.d.ts.map +1 -1
  20. package/dist/smrt-knowledge.json +7 -13
  21. package/dist/svelte/components/assistant/AssistantChoiceCards.svelte +309 -0
  22. package/dist/svelte/components/assistant/AssistantChoiceCards.svelte.d.ts +19 -0
  23. package/dist/svelte/components/assistant/AssistantChoiceCards.svelte.d.ts.map +1 -0
  24. package/dist/svelte/components/assistant/AssistantComposer.svelte +116 -14
  25. package/dist/svelte/components/assistant/AssistantComposer.svelte.d.ts +28 -0
  26. package/dist/svelte/components/assistant/AssistantComposer.svelte.d.ts.map +1 -1
  27. package/dist/svelte/components/assistant/AssistantDock.svelte +196 -1
  28. package/dist/svelte/components/assistant/AssistantDock.svelte.d.ts +38 -1
  29. package/dist/svelte/components/assistant/AssistantDock.svelte.d.ts.map +1 -1
  30. package/dist/svelte/components/assistant/AssistantThreadList.svelte +13 -1
  31. package/dist/svelte/components/assistant/__tests__/AssistantDock.test.js +16 -16
  32. package/dist/svelte/components/assistant/__tests__/assistant-composer-dictation.test.js +197 -0
  33. package/dist/svelte/components/assistant/__tests__/assistant-dock-choices-pending.test.js +224 -0
  34. package/dist/svelte/components/assistant/__tests__/assistant-dock-choices-preview.test.js +312 -0
  35. package/dist/svelte/components/assistant/__tests__/assistant-dock-choices.test.js +338 -0
  36. package/dist/svelte/components/assistant/__tests__/assistant-dock-client-tools.test.js +442 -0
  37. package/dist/svelte/components/assistant/__tests__/assistant-dock-run.test.js +303 -0
  38. package/dist/svelte/components/assistant/__tests__/assistant-dock-settle.test.js +146 -0
  39. package/dist/svelte/components/assistant/assistant-choices.svelte.d.ts +251 -0
  40. package/dist/svelte/components/assistant/assistant-choices.svelte.d.ts.map +1 -0
  41. package/dist/svelte/components/assistant/assistant-choices.svelte.js +520 -0
  42. package/dist/svelte/components/assistant/assistant-transport.d.ts +54 -1
  43. package/dist/svelte/components/assistant/assistant-transport.d.ts.map +1 -1
  44. package/dist/svelte/components/assistant/assistant-transport.js +64 -0
  45. package/dist/svelte/components/assistant/client-tools.d.ts +85 -0
  46. package/dist/svelte/components/assistant/client-tools.d.ts.map +1 -0
  47. package/dist/svelte/components/assistant/client-tools.js +61 -0
  48. package/dist/svelte/components/assistant/create-assistant-dock-controller.svelte.d.ts +159 -0
  49. package/dist/svelte/components/assistant/create-assistant-dock-controller.svelte.d.ts.map +1 -1
  50. package/dist/svelte/components/assistant/create-assistant-dock-controller.svelte.js +0 -0
  51. package/dist/svelte/i18n.d.ts +15 -0
  52. package/dist/svelte/i18n.d.ts.map +1 -1
  53. package/dist/svelte/i18n.js +17 -1
  54. package/dist/svelte/index.d.ts +6 -2
  55. package/dist/svelte/index.d.ts.map +1 -1
  56. package/dist/svelte/index.js +8 -1
  57. package/dist/tool-allow-list.d.ts +8 -0
  58. package/dist/tool-allow-list.d.ts.map +1 -0
  59. package/dist/tool-loop.d.ts +191 -3
  60. package/dist/tool-loop.d.ts.map +1 -1
  61. package/package.json +19 -15
  62. package/dist/chunks/ChatService-D48KBDZy.js.map +0 -1
@@ -40,6 +40,7 @@ import type { AIInterface, AIMessage, AITool, ChatOptions } from '@happyvertical
40
40
  import { type PrincipalAuditSink, type PrincipalBinding, type PrincipalRun, type PrincipalTool } from '@happyvertical/smrt-agents';
41
41
  import { type SmrtClassOptions } from '@happyvertical/smrt-core';
42
42
  import { type PermissionDefinition } from '@happyvertical/smrt-users';
43
+ import { matchesToolAllowList } from './tool-allow-list.js';
43
44
  /** Default ceiling on tool-executing rounds before the loop force-terminates. */
44
45
  export declare const DEFAULT_MAX_STEPS = 8;
45
46
  /**
@@ -76,11 +77,85 @@ export interface ToolInvocation {
76
77
  observation: unknown;
77
78
  /** True when the call was denied (not on the allow-list / not permitted). */
78
79
  rejected: boolean;
79
- /** Error summary when `ok` is false. */
80
+ /**
81
+ * Error summary when `ok` is false: `not_permitted` (denied),
82
+ * `invalid_request` (the tool refused the arguments — a 4xx or validation
83
+ * error the model can fix and retry), or `execution_error` (the tool failed).
84
+ */
85
+ error?: string;
86
+ }
87
+ /**
88
+ * Why {@link runToolLoop} returned.
89
+ *
90
+ * - `client_tools`: the model called one or more browser-executed
91
+ * {@link ToolLoopOptions.clientTools}. The loop cannot run them, so it
92
+ * suspends: {@link ToolLoopResult.pendingClientToolCalls} lists them and
93
+ * {@link ToolLoopResult.messages} is the transcript to resume from (see
94
+ * {@link appendClientToolResults}).
95
+ * - `cancelled`: {@link ToolLoopOptions.signal} aborted.
96
+ * - `budget`: the token budget ({@link ToolLoopOptions.maxTotalTokens}) or
97
+ * the deadline ({@link ToolLoopOptions.deadline}) ran out before
98
+ * `maxSteps`; like `max_steps`, the last round is offered no tools, so the
99
+ * model answers with what it has.
100
+ */
101
+ export type ToolLoopStopReason = 'stop' | 'max_steps' | 'budget' | 'no_tools' | 'client_tools' | 'cancelled';
102
+ /**
103
+ * The effect a browser-executed tool declares. Mirrors smrt-web's
104
+ * `WebMcpToolEffect`: `read` runs, `write` is a proposal the user confirms,
105
+ * `destructive` always needs the user's own confirmation. The server never
106
+ * trusts this for authority — the browser re-reads the effect from its own
107
+ * registry before running a call — it is carried for step labels only.
108
+ */
109
+ export type ClientToolEffect = 'read' | 'write' | 'destructive';
110
+ /**
111
+ * A tool the model may call that runs in the user's BROWSER (a WebMCP page
112
+ * tool or view intent), not on the server. The declaration comes from the page
113
+ * and is untrusted: validate it with {@link sanitizeClientToolDeclarations} and
114
+ * narrow it with a server-side allow-list before offering it.
115
+ */
116
+ export interface ClientToolDefinition {
117
+ /** Tool name, `[A-Za-z0-9_-]{1,64}`. */
118
+ name: string;
119
+ description: string;
120
+ inputSchema: Record<string, unknown>;
121
+ effect: ClientToolEffect;
122
+ }
123
+ /** A browser tool call the loop suspended on. */
124
+ export interface PendingClientToolCall {
125
+ /** The model's tool-call id; the browser echoes it back with the result. */
126
+ id: string;
127
+ name: string;
128
+ args: Record<string, unknown>;
129
+ effect: ClientToolEffect;
130
+ }
131
+ /**
132
+ * A progress event from {@link runToolLoop}, for live "calling X / done"
133
+ * status lines. Best-effort telemetry: it never changes what the loop does.
134
+ */
135
+ export type ToolLoopStepEvent = {
136
+ type: 'round';
137
+ step: number;
138
+ } | {
139
+ type: 'tool_call';
140
+ callId: string;
141
+ slug: string;
142
+ args: Record<string, unknown>;
143
+ location: 'server' | 'client';
144
+ } | {
145
+ type: 'tool_result';
146
+ callId: string;
147
+ slug: string;
148
+ ok: boolean;
149
+ rejected: boolean;
80
150
  error?: string;
151
+ };
152
+ /** Token usage for one model round, reported to {@link ToolLoopOptions.onUsage}. */
153
+ export interface ToolLoopUsage {
154
+ promptTokens: number;
155
+ completionTokens: number;
156
+ totalTokens: number;
157
+ model?: string;
81
158
  }
82
- /** Why {@link runToolLoop} returned. */
83
- export type ToolLoopStopReason = 'stop' | 'max_steps' | 'no_tools';
84
159
  /** The outcome of a {@link runToolLoop} turn. */
85
160
  export interface ToolLoopResult {
86
161
  /** The model's final assistant text. */
@@ -95,6 +170,11 @@ export interface ToolLoopResult {
95
170
  messages: AIMessage[];
96
171
  /** Total tokens reported by the AI boundary, when available. */
97
172
  totalTokens: number;
173
+ /**
174
+ * Browser tool calls the loop suspended on (`stoppedReason: 'client_tools'`).
175
+ * Empty otherwise.
176
+ */
177
+ pendingClientToolCalls: PendingClientToolCall[];
98
178
  }
99
179
  /** Context handed to a custom {@link ToolLoopOptions.executeTool} implementation. */
100
180
  export interface ToolExecutionContext {
@@ -148,6 +228,53 @@ export interface ToolLoopOptions {
148
228
  executeTool?: (ctx: ToolExecutionContext) => Promise<unknown>;
149
229
  /** Notified after each tool invocation (for streaming/telemetry). */
150
230
  onInvocation?: (invocation: ToolInvocation) => void | Promise<void>;
231
+ /**
232
+ * Browser-executed tools offered alongside the server tools. A call to one
233
+ * is never executed here: the loop finishes the round's server calls, then
234
+ * returns `stoppedReason: 'client_tools'` with the calls in
235
+ * `pendingClientToolCalls`. Resume by appending the browser's results with
236
+ * {@link appendClientToolResults} and calling `runToolLoop` again with the
237
+ * returned transcript and `initialSteps: result.steps`.
238
+ *
239
+ * Pass only declarations that passed {@link sanitizeClientToolDeclarations}
240
+ * and the host's allow-list. A name that collides with a server tool is
241
+ * ignored (the server tool wins).
242
+ */
243
+ clientTools?: ClientToolDefinition[];
244
+ /**
245
+ * Tool-executing rounds already used by earlier legs of the same turn (a
246
+ * resume after a client-tool suspension). The `maxSteps` ceiling counts
247
+ * them, so suspending cannot reset the bound. Default 0.
248
+ */
249
+ initialSteps?: number;
250
+ /**
251
+ * Token budget for the whole turn, across every leg (#assistant-watch):
252
+ * once `initialTokens` plus this leg's usage reaches it, the next round is
253
+ * offered no tools and the loop stops with `budget`. Unset: no budget.
254
+ */
255
+ maxTotalTokens?: number;
256
+ /** Tokens earlier legs of the same turn already used. Default 0. */
257
+ initialTokens?: number;
258
+ /**
259
+ * Wall-clock deadline for the whole turn (epoch ms): past it, the next
260
+ * round is offered no tools and the loop stops with `budget`.
261
+ */
262
+ deadline?: number;
263
+ /** Clock for {@link deadline} (tests). Default `Date.now`. */
264
+ now?: () => number;
265
+ /**
266
+ * Cancels the turn. Checked before every model round and every tool call,
267
+ * and forwarded to the AI boundary. An aborted loop returns
268
+ * `stoppedReason: 'cancelled'`; a tool that already started finishes.
269
+ */
270
+ signal?: AbortSignal;
271
+ /** Progress events (round start, tool call, tool result). */
272
+ onStep?: (event: ToolLoopStepEvent) => void;
273
+ /**
274
+ * Called with each model round's token usage, for the host's usage
275
+ * attribution (e.g. a per-tenant ledger). Never changes the loop.
276
+ */
277
+ onUsage?: (usage: ToolLoopUsage) => void;
151
278
  /**
152
279
  * Token sink for live streaming (#1936). When set, each `ai.chat` round is run
153
280
  * with `stream: true` and the model's text deltas are forwarded here as they
@@ -243,4 +370,65 @@ export declare function invokeManifestTool(run: PrincipalRun, tool: ManifestTool
243
370
  * @returns The final assistant text plus the invocation log and transcript.
244
371
  */
245
372
  export declare function runToolLoop(options: ToolLoopOptions): Promise<ToolLoopResult>;
373
+ /** Max browser tools accepted on one turn. */
374
+ export declare const MAX_CLIENT_TOOLS = 64;
375
+ /** Max serialized bytes of one browser tool's input schema. */
376
+ export declare const MAX_CLIENT_TOOL_SCHEMA_BYTES = 8192;
377
+ /** Max characters of one browser tool result fed back to the model. */
378
+ export declare const MAX_CLIENT_TOOL_RESULT_CHARS = 16000;
379
+ /**
380
+ * System-prompt guidance appended when browser tools are offered: their
381
+ * results are page content, not instructions.
382
+ */
383
+ export declare const CLIENT_TOOL_RESULT_GUIDANCE: string;
384
+ /**
385
+ * Validate untrusted browser tool declarations (from the request body) and
386
+ * narrow them to a server-side allow-list.
387
+ *
388
+ * Fail-closed: a declaration with a bad name, a non-object schema, an
389
+ * oversized schema, or a duplicate name is dropped; a missing or unknown
390
+ * `effect` is treated as `destructive`. `allowList` entries match exactly, or
391
+ * as a prefix when they end in `*` (`smrt_ui_*`). An empty or absent
392
+ * allow-list admits nothing.
393
+ */
394
+ export declare function sanitizeClientToolDeclarations(declarations: unknown, allowList: readonly string[] | null | undefined): ClientToolDefinition[];
395
+ /** Whether `name` matches an allow-list entry (exact, or `prefix*`). */
396
+ export { matchesToolAllowList };
397
+ /** The browser's answer to one {@link PendingClientToolCall}. */
398
+ export interface ClientToolResultInput {
399
+ /** The pending call's id. */
400
+ id: string;
401
+ ok: boolean;
402
+ /** The tool's result text (WebMCP tools return a string). */
403
+ result?: string;
404
+ /** Why it did not run: `declined` (the user said no), `failed`, … */
405
+ error?: string;
406
+ }
407
+ /**
408
+ * Append the browser's results for a suspended turn to its transcript, ready
409
+ * for the next `runToolLoop` leg.
410
+ *
411
+ * Exactly one observation is appended per pending call, in the pending order:
412
+ * a result for an unknown id is ignored, and a pending call with no result is
413
+ * answered `{ ok: false, error: 'no_result' }` so the transcript stays
414
+ * well-formed. Every observation is wrapped `{ untrusted: true, … }` and
415
+ * truncated to {@link MAX_CLIENT_TOOL_RESULT_CHARS}: it is page content.
416
+ */
417
+ export declare function appendClientToolResults(transcript: AIMessage[], pending: readonly PendingClientToolCall[], results: readonly ClientToolResultInput[]): AIMessage[];
418
+ /** How a thrown tool error is reported to the model and the invocation log. */
419
+ export type ToolErrorKind = 'not_permitted' | 'invalid_request' | 'execution_error';
420
+ /**
421
+ * Classify an error a tool threw.
422
+ *
423
+ * - `401`/`403` → `not_permitted`: the caller lacks access, which no change
424
+ * of arguments fixes; reported as a rejection.
425
+ * - A {@link ValidationError}, or `400`/`404`/`409`/`422` → `invalid_request`:
426
+ * the tool refused the model's arguments, which it can correct and retry.
427
+ * - Everything else — `429` (retry later, not a different call), other 4xx,
428
+ * 5xx, database, network, and programming errors → `execution_error`.
429
+ *
430
+ * Permission errors thrown as {@link PrincipalToolNotAllowedError} /
431
+ * `OperationPermissionError` are classified by the caller before this runs.
432
+ */
433
+ export declare function classifyToolError(error: unknown): ToolErrorKind;
246
434
  //# sourceMappingURL=tool-loop.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tool-loop.d.ts","sourceRo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Q,CAAC;AAClD,uEAAuE;AACvE,eAAO,MAAM,4BAA4B,QAAS,CAAC;AASnD;;;GAGG;AACH,eAAO,MAAM,2BAA2B,QAGsC,CAAC;AAE/E;;;;;;;;;GASG;AACH,wBAAgB,8BAA8B,CAC5C,YAAY,EAAE,OAAO,EACrB,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,GAAG,SAAS,GAC9C,oBAAoB,EAAE,CA2CxB;AAED,wEAAwE;AACxE,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAahC,iEAAiE;AACjE,MAAM,WAAW,qBAAqB;IACpC,6BAA6B;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,OAAO,CAAC;IACZ,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,SAAS,EAAE,EACvB,OAAO,EAAE,SAAS,qBAAqB,EAAE,EACzC,OAAO,EAAE,SAAS,qBAAqB,EAAE,GACxC,SAAS,EAAE,CAmCb;AAMD,+EAA+E;AAC/E,MAAM,MAAM,aAAa,GACrB,eAAe,GACf,iBAAiB,GACjB,iBAAiB,CAAC;AAgBtB;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,CAQ/D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happyvertical/smrt-chat",
3
- "version": "0.51.39",
3
+ "version": "0.53.0",
4
4
  "smrtJsdoc": "strict",
5
5
  "description": "Chat rooms, DMs, threads, and agent conversations for the SMRT framework",
6
6
  "type": "module",
@@ -16,6 +16,10 @@
16
16
  "types": "./dist/client.d.ts",
17
17
  "import": "./dist/client.js"
18
18
  },
19
+ "./assistant-turn": {
20
+ "types": "./dist/assistant-turn-events.d.ts",
21
+ "import": "./dist/assistant-turn-events.js"
22
+ },
19
23
  "./data-surface-bridge": {
20
24
  "types": "./dist/data-surface-bridge.d.ts",
21
25
  "import": "./dist/data-surface-bridge.js"
@@ -70,19 +74,19 @@
70
74
  "access": "public"
71
75
  },
72
76
  "dependencies": {
73
- "@happyvertical/ai": "^0.96.0",
74
- "@happyvertical/smrt-agents": "0.51.39",
75
- "@happyvertical/smrt-core": "0.51.39",
76
- "@happyvertical/smrt-personas": "0.51.39",
77
- "@happyvertical/smrt-profiles": "0.51.39",
78
- "@happyvertical/smrt-tenancy": "0.51.39",
79
- "@happyvertical/smrt-types": "0.51.39",
80
- "@happyvertical/smrt-ui": "0.51.39",
81
- "@happyvertical/smrt-users": "0.51.39",
82
- "@happyvertical/sql": "^0.96.0"
77
+ "@happyvertical/ai": "^0.98.0",
78
+ "@happyvertical/smrt-agents": "0.53.0",
79
+ "@happyvertical/smrt-core": "0.53.0",
80
+ "@happyvertical/smrt-personas": "0.53.0",
81
+ "@happyvertical/smrt-profiles": "0.53.0",
82
+ "@happyvertical/smrt-tenancy": "0.53.0",
83
+ "@happyvertical/smrt-types": "0.53.0",
84
+ "@happyvertical/smrt-ui": "0.53.0",
85
+ "@happyvertical/smrt-users": "0.53.0",
86
+ "@happyvertical/sql": "^0.98.0"
83
87
  },
84
88
  "peerDependencies": {
85
- "svelte": "^5.57.1"
89
+ "svelte": "^5.57.0"
86
90
  },
87
91
  "peerDependenciesMeta": {
88
92
  "svelte": {
@@ -90,9 +94,9 @@
90
94
  }
91
95
  },
92
96
  "devDependencies": {
93
- "@happyvertical/smrt-playground": "0.51.39",
94
- "@happyvertical/smrt-vitest": "0.51.39",
95
- "@happyvertical/smrt-web": "0.51.39",
97
+ "@happyvertical/smrt-playground": "0.53.0",
98
+ "@happyvertical/smrt-vitest": "0.53.0",
99
+ "@happyvertical/smrt-web": "0.53.0",
96
100
  "@mlc-ai/web-llm": "^0.2.85",
97
101
  "bitgpu": "0.19.1",
98
102
  "@sveltejs/kit": "2.69.1",