@runtypelabs/persona 4.10.0 → 4.11.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 (61) hide show
  1. package/dist/animations/glyph-cycle.d.cts +1 -1
  2. package/dist/animations/glyph-cycle.d.ts +1 -1
  3. package/dist/animations/{types-4ROVJ1gA.d.cts → types-DveIaNx6.d.cts} +11 -316
  4. package/dist/animations/{types-4ROVJ1gA.d.ts → types-DveIaNx6.d.ts} +11 -316
  5. package/dist/animations/wipe.d.cts +1 -1
  6. package/dist/animations/wipe.d.ts +1 -1
  7. package/dist/chunk-MMUPR2JW.js +1 -0
  8. package/dist/codegen.cjs +1 -1
  9. package/dist/codegen.js +1 -1
  10. package/dist/{context-mentions-7S5KVUTG.js → context-mentions-ONG7A7M6.js} +1 -1
  11. package/dist/context-mentions.d.cts +35 -316
  12. package/dist/context-mentions.d.ts +35 -316
  13. package/dist/index.cjs +67 -67
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +40 -317
  16. package/dist/index.d.ts +40 -317
  17. package/dist/index.global.js +55 -55
  18. package/dist/index.global.js.map +1 -1
  19. package/dist/index.js +78 -78
  20. package/dist/index.js.map +1 -1
  21. package/dist/smart-dom-reader.d.cts +35 -316
  22. package/dist/smart-dom-reader.d.ts +35 -316
  23. package/dist/theme-editor-preview.cjs +66 -66
  24. package/dist/theme-editor-preview.d.cts +35 -316
  25. package/dist/theme-editor-preview.d.ts +35 -316
  26. package/dist/theme-editor-preview.js +55 -55
  27. package/dist/theme-editor.cjs +5 -5
  28. package/dist/theme-editor.d.cts +35 -316
  29. package/dist/theme-editor.d.ts +35 -316
  30. package/dist/theme-editor.js +9 -9
  31. package/dist/widget.css +1 -1
  32. package/package.json +1 -1
  33. package/src/components/approval-bubble.ts +0 -1
  34. package/src/components/composer-parts.ts +19 -19
  35. package/src/components/context-mention-button.test.ts +5 -1
  36. package/src/components/context-mention-button.ts +6 -4
  37. package/src/components/header-builder.test.ts +3 -3
  38. package/src/components/header-parts.ts +14 -108
  39. package/src/components/message-bubble.test.ts +49 -0
  40. package/src/components/message-bubble.ts +8 -7
  41. package/src/components/reasoning-bubble.ts +0 -2
  42. package/src/components/tool-bubble.ts +0 -2
  43. package/src/generated/runtype-openapi-contract.ts +11 -317
  44. package/src/index-core.ts +7 -1
  45. package/src/runtime/host-layout.test.ts +94 -0
  46. package/src/runtime/host-layout.ts +9 -1
  47. package/src/runtime/init.test.ts +33 -0
  48. package/src/runtime/init.ts +4 -0
  49. package/src/styles/widget.css +118 -58
  50. package/src/theme-editor/sections.test.ts +33 -0
  51. package/src/theme-editor/sections.ts +10 -1
  52. package/src/types.ts +25 -0
  53. package/src/ui.attachments-drop.test.ts +2 -1
  54. package/src/ui.message-width.test.ts +407 -0
  55. package/src/ui.mount-fill-min-width.test.ts +81 -0
  56. package/src/ui.ts +158 -238
  57. package/src/utils/table-scroll-fade.test.ts +123 -0
  58. package/src/utils/table-scroll-fade.ts +75 -0
  59. package/src/utils/tooltip.test.ts +226 -0
  60. package/src/utils/tooltip.ts +245 -0
  61. package/dist/chunk-IPVK3KOM.js +0 -1
@@ -846,6 +846,10 @@ type RuntypeExecutionStreamEvent = ({
846
846
  completedAt?: string;
847
847
  durationMs?: number;
848
848
  executionId: string;
849
+ externalAgent?: {
850
+ contextId?: string;
851
+ taskId?: string;
852
+ };
849
853
  failedSteps?: number;
850
854
  finalOutput?: string;
851
855
  iterations?: number;
@@ -860,6 +864,7 @@ type RuntypeExecutionStreamEvent = ({
860
864
  input: number;
861
865
  output: number;
862
866
  };
867
+ totalTokensUsed?: number;
863
868
  type: "execution_complete";
864
869
  }) | ({
865
870
  blockReason?: string;
@@ -1119,12 +1124,17 @@ type RuntypeExecutionStreamEvent = ({
1119
1124
  stepId?: string;
1120
1125
  success: boolean;
1121
1126
  toolCallId: string;
1127
+ toolCost?: number;
1122
1128
  toolName?: string;
1123
1129
  type: "tool_complete";
1124
1130
  } | {
1125
1131
  approvalId: string;
1126
1132
  description?: string;
1127
1133
  executionId: string;
1134
+ externalAgent?: {
1135
+ contextId?: string;
1136
+ taskId?: string;
1137
+ };
1128
1138
  iteration?: number;
1129
1139
  parameters?: Record<string, unknown>;
1130
1140
  reason?: string;
@@ -1192,326 +1202,11 @@ type RuntypeExecutionStreamEvent = ({
1192
1202
  type: "custom";
1193
1203
  value?: unknown;
1194
1204
  };
1195
- type RuntypeFlowSSEEvent = {
1196
- executionContext?: Record<string, unknown>;
1197
- executionId?: string;
1198
- flowId: string;
1199
- flowName?: string;
1200
- input?: unknown;
1201
- seq?: number;
1202
- source?: string;
1203
- startedAt: string;
1204
- toolContext?: {
1205
- executionId: string;
1206
- stepId: string;
1207
- toolId: string;
1208
- };
1209
- totalSteps?: number;
1210
- type: "flow_start";
1211
- } | {
1212
- claudeManagedAgentId?: string;
1213
- completedAt?: string;
1214
- completedSteps?: number;
1215
- duration?: number;
1216
- executionContext?: Record<string, unknown>;
1217
- executionId?: string;
1218
- executionTime?: number;
1219
- failedSteps?: number;
1220
- finalOutput?: string;
1221
- flowId?: string;
1222
- flowName?: string;
1223
- output?: unknown;
1224
- seq?: number;
1225
- source?: string;
1226
- success?: boolean;
1227
- successfulSteps?: number;
1228
- toolContext?: {
1229
- executionId: string;
1230
- stepId: string;
1231
- toolId: string;
1232
- };
1233
- totalSteps?: number;
1234
- totalTokensUsed?: number;
1235
- type: "flow_complete";
1236
- } | ({
1237
- blockReason?: string;
1238
- code?: string;
1239
- error: string | {
1240
- code: string;
1241
- message: string;
1242
- stepId?: string;
1243
- stepType?: string;
1244
- };
1245
- executionId?: string;
1246
- executionTime?: number;
1247
- flowId?: string;
1248
- seq?: number;
1249
- timestamp?: string;
1250
- toolContext?: {
1251
- executionId: string;
1252
- stepId: string;
1253
- toolId: string;
1254
- };
1255
- type: "flow_error";
1256
- upgradeUrl?: string;
1257
- }) | ({
1258
- approvalId?: string;
1259
- awaitReason?: string;
1260
- awaitedAt: string;
1261
- crawlId?: string;
1262
- elicitation?: {
1263
- message: string;
1264
- mode: "form" | "url";
1265
- pauseCount?: number;
1266
- requestedSchema?: Record<string, unknown>;
1267
- serverName?: string;
1268
- url?: string;
1269
- };
1270
- executionId?: string;
1271
- flowId: string;
1272
- origin?: "webmcp" | "sdk";
1273
- pageOrigin?: string;
1274
- parameters?: Record<string, unknown>;
1275
- seq?: number;
1276
- stepId?: string;
1277
- timeout?: number;
1278
- toolCallId?: string;
1279
- toolId?: string;
1280
- toolName?: string;
1281
- type: "flow_await";
1282
- }) | {
1283
- estimatedTokens?: number;
1284
- executionId?: string;
1285
- id?: string;
1286
- index?: number;
1287
- name?: string;
1288
- outputVariable?: string;
1289
- seq?: number;
1290
- startedAt: string;
1291
- stepId?: string;
1292
- stepName?: string;
1293
- stepType?: string;
1294
- toolContext?: {
1295
- executionId: string;
1296
- stepId: string;
1297
- toolId: string;
1298
- };
1299
- totalSteps?: number;
1300
- type: "step_start";
1301
- } | {
1302
- delta?: string;
1303
- executionId?: string;
1304
- id?: string;
1305
- messageId?: string;
1306
- partId?: string;
1307
- seq?: number;
1308
- text?: string;
1309
- toolContext?: {
1310
- executionId: string;
1311
- stepId: string;
1312
- toolId: string;
1313
- };
1314
- toolId?: string;
1315
- type: "step_delta";
1316
- } | ({
1317
- completedAt?: string;
1318
- duration?: number;
1319
- durationMs?: number;
1320
- error?: string | null;
1321
- executionId?: string;
1322
- executionTime?: number;
1323
- id?: string;
1324
- index?: number;
1325
- name?: string;
1326
- output?: unknown;
1327
- result?: unknown;
1328
- seq?: number;
1329
- stepId?: string;
1330
- stepName?: string;
1331
- stepType?: string;
1332
- stopReason?: "end_turn" | "max_tool_calls" | "length" | "content_filter" | "error" | "unknown";
1333
- success?: boolean;
1334
- tokensUsed?: number;
1335
- toolContext?: {
1336
- executionId: string;
1337
- stepId: string;
1338
- toolId: string;
1339
- };
1340
- type: "step_complete";
1341
- unresolvedVariables?: Array<string>;
1342
- }) | {
1343
- error: string;
1344
- executionId?: string;
1345
- executionTime?: number;
1346
- id?: string;
1347
- index?: number;
1348
- name?: string;
1349
- seq?: number;
1350
- stepType?: string;
1351
- type: "step_error";
1352
- } | {
1353
- error?: string;
1354
- executionId?: string;
1355
- id: string;
1356
- index?: number;
1357
- name?: string;
1358
- seq?: number;
1359
- skippedAt: string;
1360
- stepType: string;
1361
- totalSteps: number;
1362
- type: "step_skip";
1363
- when: string;
1364
- } | ({
1365
- elicitation?: {
1366
- message: string;
1367
- mode: "form" | "url";
1368
- pauseCount?: number;
1369
- requestedSchema?: Record<string, unknown>;
1370
- serverName?: string;
1371
- url?: string;
1372
- };
1373
- executionId?: string;
1374
- reason?: string;
1375
- seq?: number;
1376
- type: "step_await";
1377
- [key: string]: unknown;
1378
- }) | ({
1379
- agentContext?: {
1380
- executionId: string;
1381
- iteration: number;
1382
- seq: number;
1383
- };
1384
- executionId?: string;
1385
- hiddenParameterNames?: Array<string>;
1386
- name?: string;
1387
- parameters?: Record<string, unknown>;
1388
- providerOptions?: Record<string, unknown>;
1389
- seq?: number;
1390
- startedAt?: string;
1391
- stepId?: string;
1392
- toolCallId?: string;
1393
- toolId?: string;
1394
- toolName?: string;
1395
- toolType: "flow" | "mcp" | "builtin" | "custom" | "external" | "advisor" | "subagent" | "local";
1396
- type: "tool_start";
1397
- [key: string]: unknown;
1398
- }) | {
1399
- delta?: string;
1400
- executionId?: string;
1401
- seq?: number;
1402
- toolId?: string;
1403
- type: "tool_delta";
1404
- [key: string]: unknown;
1405
- } | {
1406
- delta: string;
1407
- executionId?: string;
1408
- seq?: number;
1409
- stepId?: string;
1410
- toolCallId?: string;
1411
- toolId?: string;
1412
- type: "tool_input_delta";
1413
- } | {
1414
- executionId?: string;
1415
- hiddenParameterNames?: Array<string>;
1416
- parameters: Record<string, unknown>;
1417
- providerOptions?: Record<string, unknown>;
1418
- seq?: number;
1419
- stepId?: string;
1420
- toolCallId?: string;
1421
- toolId?: string;
1422
- toolName?: string;
1423
- type: "tool_input_complete";
1424
- } | {
1425
- agentContext?: {
1426
- executionId: string;
1427
- iteration: number;
1428
- seq: number;
1429
- };
1430
- completedAt?: string;
1431
- error?: string;
1432
- executionId?: string;
1433
- executionTime?: number;
1434
- name?: string;
1435
- result?: unknown;
1436
- seq?: number;
1437
- stepId?: string;
1438
- success: boolean;
1439
- toolCallId?: string;
1440
- toolCost?: number;
1441
- toolId?: string;
1442
- toolName?: string;
1443
- type: "tool_complete";
1444
- } | {
1445
- agentContext?: {
1446
- executionId: string;
1447
- iteration: number;
1448
- seq: number;
1449
- };
1450
- error: string;
1451
- executionId?: string;
1452
- executionTime?: number;
1453
- failedAt?: string;
1454
- name: string;
1455
- seq?: number;
1456
- toolId: string;
1457
- type: "tool_error";
1458
- } | {
1459
- executionId?: string;
1460
- id: string;
1461
- seq?: number;
1462
- text: string;
1463
- type: "chunk";
1464
- } | {
1465
- executionId?: string;
1466
- seq?: number;
1467
- type: "text_start";
1468
- [key: string]: unknown;
1469
- } | {
1470
- executionId?: string;
1471
- seq?: number;
1472
- type: "text_end";
1473
- [key: string]: unknown;
1474
- } | {
1475
- executionId?: string;
1476
- seq?: number;
1477
- type: "reason_start";
1478
- [key: string]: unknown;
1479
- } | {
1480
- executionId?: string;
1481
- seq?: number;
1482
- type: "reason_delta";
1483
- [key: string]: unknown;
1484
- } | {
1485
- executionId?: string;
1486
- seq?: number;
1487
- type: "reason_complete";
1488
- [key: string]: unknown;
1489
- } | {
1490
- executionId?: string;
1491
- seq?: number;
1492
- type: "source";
1493
- [key: string]: unknown;
1494
- } | {
1495
- executionId?: string;
1496
- seq?: number;
1497
- type: "fallback_start";
1498
- [key: string]: unknown;
1499
- } | {
1500
- executionId?: string;
1501
- seq?: number;
1502
- type: "fallback_complete";
1503
- [key: string]: unknown;
1504
- } | {
1505
- executionId?: string;
1506
- seq?: number;
1507
- type: "fallback_exhausted";
1508
- [key: string]: unknown;
1509
- };
1510
1205
  type RuntypeStreamEventOf<U, T extends string> = Extract<U, {
1511
1206
  type: T;
1512
1207
  }>;
1513
1208
  type RuntypeTurnCompleteEvent = RuntypeStreamEventOf<RuntypeExecutionStreamEvent, "turn_complete">;
1514
- type RuntypeStepCompleteEvent = RuntypeStreamEventOf<RuntypeFlowSSEEvent, "step_complete">;
1209
+ type RuntypeStepCompleteEvent = RuntypeStreamEventOf<RuntypeExecutionStreamEvent, "step_complete">;
1515
1210
  type RuntypeStopReasonKind = NonNullable<RuntypeTurnCompleteEvent["stopReason"] | RuntypeStepCompleteEvent["stopReason"]>;
1516
1211
 
1517
1212
  /**
@@ -5132,6 +4827,26 @@ type AgentWidgetTimestampConfig = {
5132
4827
  /** Custom formatter for timestamp display */
5133
4828
  format?: (date: Date) => string;
5134
4829
  };
4830
+ /**
4831
+ * Width configuration for one message role.
4832
+ *
4833
+ * `content` shrink-wraps the rendered message up to `maxWidth`; `full` fills
4834
+ * the available transcript track up to `maxWidth`. The track already accounts
4835
+ * for transcript padding and, when present, the avatar and its gap.
4836
+ */
4837
+ type AgentWidgetMessageRoleLayout = {
4838
+ /**
4839
+ * Message width behavior.
4840
+ * - content: size to the rendered content (the backward-compatible default)
4841
+ * - full: fill the available transcript track
4842
+ */
4843
+ width?: "content" | "full";
4844
+ /**
4845
+ * Optional CSS max-width (for example "80%", "42rem", or "72ch").
4846
+ * Defaults to "85%" for content width and "100%" for full width.
4847
+ */
4848
+ maxWidth?: string;
4849
+ };
5135
4850
  /**
5136
4851
  * Message layout configuration
5137
4852
  * Allows customization of how chat messages are displayed
@@ -5150,6 +4865,10 @@ type AgentWidgetMessageLayoutConfig = {
5150
4865
  timestamp?: AgentWidgetTimestampConfig;
5151
4866
  /** Group consecutive messages from the same role */
5152
4867
  groupConsecutive?: boolean;
4868
+ /** Width behavior for user-authored message rows */
4869
+ user?: AgentWidgetMessageRoleLayout;
4870
+ /** Width behavior for assistant-authored message rows and assistant UI variants */
4871
+ assistant?: AgentWidgetMessageRoleLayout;
5153
4872
  /**
5154
4873
  * Custom renderer for user messages
5155
4874
  * When provided, replaces the default user message rendering