@runtypelabs/persona 3.26.0 → 3.28.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 (39) hide show
  1. package/README.md +29 -13
  2. package/dist/animations/glyph-cycle.d.cts +1 -1
  3. package/dist/animations/glyph-cycle.d.ts +1 -1
  4. package/dist/animations/{types-BZVr1YOV.d.cts → types-CxvHw0X6.d.cts} +551 -1
  5. package/dist/animations/{types-BZVr1YOV.d.ts → types-CxvHw0X6.d.ts} +551 -1
  6. package/dist/animations/wipe.d.cts +1 -1
  7. package/dist/animations/wipe.d.ts +1 -1
  8. package/dist/codegen.cjs +80 -0
  9. package/dist/codegen.d.cts +143 -0
  10. package/dist/codegen.d.ts +143 -0
  11. package/dist/codegen.js +80 -0
  12. package/dist/index.cjs +35 -35
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +1230 -3
  15. package/dist/index.d.ts +1230 -3
  16. package/dist/index.global.js +35 -35
  17. package/dist/index.global.js.map +1 -1
  18. package/dist/index.js +31 -31
  19. package/dist/index.js.map +1 -1
  20. package/dist/install.global.js +1 -1
  21. package/dist/install.global.js.map +1 -1
  22. package/dist/launcher.global.js +133 -0
  23. package/dist/launcher.global.js.map +1 -0
  24. package/dist/smart-dom-reader.d.cts +551 -1
  25. package/dist/smart-dom-reader.d.ts +551 -1
  26. package/dist/theme-editor.d.cts +551 -1
  27. package/dist/theme-editor.d.ts +551 -1
  28. package/package.json +14 -4
  29. package/src/client.test.ts +9 -9
  30. package/src/codegen.test.ts +39 -0
  31. package/src/codegen.ts +20 -0
  32. package/src/generated/runtype-openapi-contract.ts +1249 -0
  33. package/src/index-core.ts +19 -0
  34. package/src/install.test.ts +442 -0
  35. package/src/install.ts +283 -49
  36. package/src/launcher-global.ts +115 -0
  37. package/src/runtime/init.test.ts +71 -0
  38. package/src/runtime/init.ts +17 -1
  39. package/src/types.ts +14 -8
@@ -970,6 +970,556 @@ type DeepPartial<T> = T extends object ? {
970
970
  [P in keyof T]?: DeepPartial<T[P]>;
971
971
  } : T;
972
972
 
973
+ type RuntypeAgentSSEEvent = {
974
+ agentId: string;
975
+ agentName: string;
976
+ config?: {
977
+ enableReflection?: boolean;
978
+ model?: string;
979
+ };
980
+ executionId: string;
981
+ maxTurns: number;
982
+ seq: number;
983
+ startedAt: string;
984
+ type: "agent_start";
985
+ } | {
986
+ executionId: string;
987
+ iteration: number;
988
+ maxTurns: number;
989
+ seq: number;
990
+ startedAt: string;
991
+ totalCost?: number;
992
+ type: "agent_iteration_start";
993
+ } | ({
994
+ executionId: string;
995
+ iteration: number;
996
+ role: "user" | "assistant" | "system";
997
+ seq: number;
998
+ turnId: string;
999
+ turnIndex: number;
1000
+ type: "agent_turn_start";
1001
+ }) | ({
1002
+ contentType: "text" | "thinking" | "tool_input";
1003
+ delta: string;
1004
+ executionId: string;
1005
+ iteration: number;
1006
+ seq: number;
1007
+ turnId: string;
1008
+ type: "agent_turn_delta";
1009
+ }) | ({
1010
+ completedAt: string;
1011
+ content?: string;
1012
+ cost?: number;
1013
+ estimatedContextBreakdown?: {
1014
+ categories: Record<string, {
1015
+ chars: number;
1016
+ estimatedTokens: number;
1017
+ }>;
1018
+ contextWindowSize?: number;
1019
+ estimatedTotalTokens: number;
1020
+ estimatedUtilizationPercent?: number;
1021
+ };
1022
+ executionId: string;
1023
+ iteration: number;
1024
+ role: "user" | "assistant" | "system";
1025
+ seq: number;
1026
+ stopReason?: "end_turn" | "max_tool_calls" | "length" | "content_filter" | "error" | "unknown";
1027
+ tokens?: {
1028
+ input: number;
1029
+ output: number;
1030
+ };
1031
+ turnId: string;
1032
+ type: "agent_turn_complete";
1033
+ }) | ({
1034
+ executionId: string;
1035
+ iteration: number;
1036
+ origin?: "webmcp" | "sdk";
1037
+ pageOrigin?: string;
1038
+ parameters?: Record<string, unknown>;
1039
+ seq: number;
1040
+ toolCallId: string;
1041
+ toolName: string;
1042
+ toolType: "flow" | "mcp" | "builtin" | "custom" | "external" | "advisor" | "subagent" | "local";
1043
+ type: "agent_tool_start";
1044
+ }) | {
1045
+ delta: string;
1046
+ executionId: string;
1047
+ iteration: number;
1048
+ seq: number;
1049
+ toolCallId: string;
1050
+ type: "agent_tool_delta";
1051
+ } | {
1052
+ delta: string;
1053
+ executionId: string;
1054
+ iteration: number;
1055
+ seq: number;
1056
+ toolCallId: string;
1057
+ type: "agent_tool_input_delta";
1058
+ } | {
1059
+ executionId: string;
1060
+ hiddenParameterNames?: Array<string>;
1061
+ iteration: number;
1062
+ parameters: Record<string, unknown>;
1063
+ seq: number;
1064
+ toolCallId: string;
1065
+ toolName: string;
1066
+ type: "agent_tool_input_complete";
1067
+ } | {
1068
+ executionId: string;
1069
+ executionTime?: number;
1070
+ iteration: number;
1071
+ result?: unknown;
1072
+ seq: number;
1073
+ success: boolean;
1074
+ toolCallId: string;
1075
+ toolName: string;
1076
+ type: "agent_tool_complete";
1077
+ } | ({
1078
+ executionId?: string;
1079
+ iteration: number;
1080
+ media: Array<({
1081
+ annotations?: {
1082
+ audience?: Array<"user" | "assistant">;
1083
+ };
1084
+ data: string;
1085
+ mediaType: string;
1086
+ type: "media";
1087
+ }) | ({
1088
+ annotations?: {
1089
+ audience?: Array<"user" | "assistant">;
1090
+ };
1091
+ mediaType?: string;
1092
+ type: "image-url";
1093
+ url: string;
1094
+ }) | ({
1095
+ annotations?: {
1096
+ audience?: Array<"user" | "assistant">;
1097
+ };
1098
+ mediaType: string;
1099
+ type: "file-url";
1100
+ url: string;
1101
+ })>;
1102
+ seq?: number;
1103
+ toolCallId: string;
1104
+ toolName: string;
1105
+ type: "agent_media";
1106
+ }) | {
1107
+ approvalId: string;
1108
+ description: string;
1109
+ executionId: string;
1110
+ externalAgent?: {
1111
+ contextId?: string;
1112
+ taskId?: string;
1113
+ };
1114
+ iteration?: number;
1115
+ parameters?: Record<string, unknown>;
1116
+ seq: number;
1117
+ startedAt: string;
1118
+ timeout: number;
1119
+ toolCallId: string;
1120
+ toolName: string;
1121
+ toolType: string;
1122
+ type: "agent_approval_start";
1123
+ } | ({
1124
+ approvalId: string;
1125
+ completedAt: string;
1126
+ decision: "approved" | "denied" | "timeout";
1127
+ executionId: string;
1128
+ resolvedBy: "user" | "system";
1129
+ seq: number;
1130
+ type: "agent_approval_complete";
1131
+ }) | ({
1132
+ awaitedAt: string;
1133
+ executionId: string;
1134
+ origin?: "webmcp" | "sdk";
1135
+ pageOrigin?: string;
1136
+ parameters?: Record<string, unknown>;
1137
+ seq: number;
1138
+ toolCallId?: string;
1139
+ toolId: string;
1140
+ toolName: string;
1141
+ type: "agent_await";
1142
+ }) | {
1143
+ completedAt: string;
1144
+ cost?: number;
1145
+ duration?: number;
1146
+ estimatedContextBreakdown?: {
1147
+ categories: Record<string, {
1148
+ chars: number;
1149
+ estimatedTokens: number;
1150
+ }>;
1151
+ contextWindowSize?: number;
1152
+ estimatedTotalTokens: number;
1153
+ estimatedUtilizationPercent?: number;
1154
+ };
1155
+ executionId: string;
1156
+ iteration: number;
1157
+ output?: string;
1158
+ runningTotalCost?: number;
1159
+ seq: number;
1160
+ stopConditionMet: boolean;
1161
+ tokens?: {
1162
+ input: number;
1163
+ output: number;
1164
+ };
1165
+ toolCallsMade: number;
1166
+ type: "agent_iteration_complete";
1167
+ } | {
1168
+ executionId: string;
1169
+ iteration: number;
1170
+ reflection?: string;
1171
+ seq: number;
1172
+ type: "agent_reflection";
1173
+ } | {
1174
+ activatedCapabilities: Array<string>;
1175
+ executionId: string;
1176
+ iteration: number;
1177
+ seq: number;
1178
+ skill: string;
1179
+ toolCallId: string;
1180
+ type: "agent_skill_loaded";
1181
+ } | ({
1182
+ executionId: string;
1183
+ iteration: number;
1184
+ outcome: "pending_approval" | "auto_published";
1185
+ proposalId?: string;
1186
+ seq: number;
1187
+ skill: string;
1188
+ toolCallId: string;
1189
+ type: "agent_skill_proposed";
1190
+ }) | ({
1191
+ agentId: string;
1192
+ completedAt: string;
1193
+ duration?: number;
1194
+ error?: string;
1195
+ executionId: string;
1196
+ externalAgent?: {
1197
+ contextId?: string;
1198
+ taskId?: string;
1199
+ };
1200
+ finalOutput?: string;
1201
+ iterations: number;
1202
+ seq: number;
1203
+ stopReason: "complete" | "end_turn" | "max_turns" | "max_cost" | "timeout" | "error";
1204
+ success: boolean;
1205
+ totalCost?: number;
1206
+ totalTokens?: {
1207
+ input: number;
1208
+ output: number;
1209
+ };
1210
+ type: "agent_complete";
1211
+ }) | {
1212
+ error: {
1213
+ code: string;
1214
+ details?: Record<string, unknown>;
1215
+ message: string;
1216
+ };
1217
+ executionId: string;
1218
+ iteration?: number;
1219
+ recoverable: boolean;
1220
+ seq: number;
1221
+ type: "agent_error";
1222
+ } | {
1223
+ executionId: string;
1224
+ seq: number;
1225
+ timestamp: string;
1226
+ type: "agent_ping";
1227
+ };
1228
+ type RuntypeFlowSSEEvent = {
1229
+ executionContext?: Record<string, unknown>;
1230
+ executionId?: string;
1231
+ flowId: string;
1232
+ flowName?: string;
1233
+ input?: unknown;
1234
+ seq?: number;
1235
+ source?: string;
1236
+ startedAt: string;
1237
+ toolContext?: {
1238
+ executionId: string;
1239
+ stepId: string;
1240
+ toolId: string;
1241
+ };
1242
+ totalSteps?: number;
1243
+ type: "flow_start";
1244
+ } | {
1245
+ completedAt?: string;
1246
+ completedSteps?: number;
1247
+ duration?: number;
1248
+ executionContext?: Record<string, unknown>;
1249
+ executionId?: string;
1250
+ executionTime?: number;
1251
+ failedSteps?: number;
1252
+ finalOutput?: string;
1253
+ flowId?: string;
1254
+ output?: unknown;
1255
+ seq?: number;
1256
+ source?: string;
1257
+ success?: boolean;
1258
+ successfulSteps?: number;
1259
+ toolContext?: {
1260
+ executionId: string;
1261
+ stepId: string;
1262
+ toolId: string;
1263
+ };
1264
+ totalSteps?: number;
1265
+ totalTokensUsed?: number;
1266
+ type: "flow_complete";
1267
+ } | ({
1268
+ code?: string;
1269
+ error: string | {
1270
+ code: string;
1271
+ message: string;
1272
+ stepId?: string;
1273
+ stepType?: string;
1274
+ };
1275
+ executionId?: string;
1276
+ executionTime?: number;
1277
+ flowId?: string;
1278
+ seq?: number;
1279
+ timestamp?: string;
1280
+ toolContext?: {
1281
+ executionId: string;
1282
+ stepId: string;
1283
+ toolId: string;
1284
+ };
1285
+ type: "flow_error";
1286
+ upgradeUrl?: string;
1287
+ }) | ({
1288
+ awaitedAt: string;
1289
+ executionId?: string;
1290
+ flowId: string;
1291
+ origin?: "webmcp" | "sdk";
1292
+ pageOrigin?: string;
1293
+ parameters?: Record<string, unknown>;
1294
+ seq?: number;
1295
+ toolCallId?: string;
1296
+ toolId?: string;
1297
+ toolName?: string;
1298
+ type: "flow_await";
1299
+ }) | {
1300
+ estimatedTokens?: number;
1301
+ executionId?: string;
1302
+ id?: string;
1303
+ index?: number;
1304
+ name?: string;
1305
+ seq?: number;
1306
+ startedAt: string;
1307
+ stepId?: string;
1308
+ stepName?: string;
1309
+ stepType?: string;
1310
+ toolContext?: {
1311
+ executionId: string;
1312
+ stepId: string;
1313
+ toolId: string;
1314
+ };
1315
+ totalSteps?: number;
1316
+ type: "step_start";
1317
+ } | {
1318
+ delta?: string;
1319
+ executionId?: string;
1320
+ id?: string;
1321
+ messageId?: string;
1322
+ partId?: string;
1323
+ seq?: number;
1324
+ text?: string;
1325
+ toolContext?: {
1326
+ executionId: string;
1327
+ stepId: string;
1328
+ toolId: string;
1329
+ };
1330
+ toolId?: string;
1331
+ type: "step_delta";
1332
+ } | ({
1333
+ completedAt?: string;
1334
+ duration?: number;
1335
+ durationMs?: number;
1336
+ error?: string;
1337
+ executionId?: string;
1338
+ executionTime?: number;
1339
+ id?: string;
1340
+ index?: number;
1341
+ name?: string;
1342
+ output?: unknown;
1343
+ result?: unknown;
1344
+ seq?: number;
1345
+ stepId?: string;
1346
+ stepName?: string;
1347
+ stepType?: string;
1348
+ stopReason?: "end_turn" | "max_tool_calls" | "length" | "content_filter" | "error" | "unknown";
1349
+ success?: boolean;
1350
+ tokensUsed?: number;
1351
+ toolContext?: {
1352
+ executionId: string;
1353
+ stepId: string;
1354
+ toolId: string;
1355
+ };
1356
+ type: "step_complete";
1357
+ }) | {
1358
+ error: string;
1359
+ executionId?: string;
1360
+ executionTime?: number;
1361
+ id?: string;
1362
+ index?: number;
1363
+ name?: string;
1364
+ seq?: number;
1365
+ stepType?: string;
1366
+ type: "step_error";
1367
+ } | {
1368
+ error?: string;
1369
+ executionId?: string;
1370
+ id: string;
1371
+ index?: number;
1372
+ name?: string;
1373
+ seq?: number;
1374
+ skippedAt: string;
1375
+ stepType: string;
1376
+ totalSteps: number;
1377
+ type: "step_skip";
1378
+ when: string;
1379
+ } | {
1380
+ executionId?: string;
1381
+ seq?: number;
1382
+ type: "step_await";
1383
+ [key: string]: unknown;
1384
+ } | ({
1385
+ agentContext?: {
1386
+ executionId: string;
1387
+ iteration: number;
1388
+ seq: number;
1389
+ };
1390
+ executionId?: string;
1391
+ hiddenParameterNames?: Array<string>;
1392
+ name?: string;
1393
+ parameters?: Record<string, unknown>;
1394
+ providerOptions?: Record<string, unknown>;
1395
+ seq?: number;
1396
+ startedAt?: string;
1397
+ stepId?: string;
1398
+ toolCallId?: string;
1399
+ toolId?: string;
1400
+ toolName?: string;
1401
+ toolType: "flow" | "mcp" | "builtin" | "custom" | "external" | "advisor" | "subagent" | "local";
1402
+ type: "tool_start";
1403
+ [key: string]: unknown;
1404
+ }) | {
1405
+ delta?: string;
1406
+ executionId?: string;
1407
+ seq?: number;
1408
+ toolId?: string;
1409
+ type: "tool_delta";
1410
+ [key: string]: unknown;
1411
+ } | {
1412
+ delta: string;
1413
+ executionId?: string;
1414
+ seq?: number;
1415
+ stepId?: string;
1416
+ toolCallId?: string;
1417
+ toolId?: string;
1418
+ type: "tool_input_delta";
1419
+ } | {
1420
+ executionId?: string;
1421
+ hiddenParameterNames?: Array<string>;
1422
+ parameters: Record<string, unknown>;
1423
+ providerOptions?: Record<string, unknown>;
1424
+ seq?: number;
1425
+ stepId?: string;
1426
+ toolCallId?: string;
1427
+ toolId?: string;
1428
+ toolName?: string;
1429
+ type: "tool_input_complete";
1430
+ } | {
1431
+ agentContext?: {
1432
+ executionId: string;
1433
+ iteration: number;
1434
+ seq: number;
1435
+ };
1436
+ completedAt?: string;
1437
+ error?: string;
1438
+ executionId?: string;
1439
+ executionTime?: number;
1440
+ name?: string;
1441
+ result?: unknown;
1442
+ seq?: number;
1443
+ stepId?: string;
1444
+ success: boolean;
1445
+ toolCallId?: string;
1446
+ toolCost?: number;
1447
+ toolId?: string;
1448
+ toolName?: string;
1449
+ type: "tool_complete";
1450
+ } | {
1451
+ agentContext?: {
1452
+ executionId: string;
1453
+ iteration: number;
1454
+ seq: number;
1455
+ };
1456
+ error: string;
1457
+ executionId?: string;
1458
+ executionTime?: number;
1459
+ failedAt?: string;
1460
+ name: string;
1461
+ seq?: number;
1462
+ toolId: string;
1463
+ type: "tool_error";
1464
+ } | {
1465
+ executionId?: string;
1466
+ id: string;
1467
+ seq?: number;
1468
+ text: string;
1469
+ type: "chunk";
1470
+ } | {
1471
+ executionId?: string;
1472
+ seq?: number;
1473
+ type: "text_start";
1474
+ [key: string]: unknown;
1475
+ } | {
1476
+ executionId?: string;
1477
+ seq?: number;
1478
+ type: "text_end";
1479
+ [key: string]: unknown;
1480
+ } | {
1481
+ executionId?: string;
1482
+ seq?: number;
1483
+ type: "reason_start";
1484
+ [key: string]: unknown;
1485
+ } | {
1486
+ executionId?: string;
1487
+ seq?: number;
1488
+ type: "reason_delta";
1489
+ [key: string]: unknown;
1490
+ } | {
1491
+ executionId?: string;
1492
+ seq?: number;
1493
+ type: "reason_complete";
1494
+ [key: string]: unknown;
1495
+ } | {
1496
+ executionId?: string;
1497
+ seq?: number;
1498
+ type: "source";
1499
+ [key: string]: unknown;
1500
+ } | {
1501
+ executionId?: string;
1502
+ seq?: number;
1503
+ type: "fallback_start";
1504
+ [key: string]: unknown;
1505
+ } | {
1506
+ executionId?: string;
1507
+ seq?: number;
1508
+ type: "fallback_complete";
1509
+ [key: string]: unknown;
1510
+ } | {
1511
+ executionId?: string;
1512
+ seq?: number;
1513
+ type: "fallback_exhausted";
1514
+ [key: string]: unknown;
1515
+ };
1516
+ type RuntypeStreamEventOf<U, T extends string> = Extract<U, {
1517
+ type: T;
1518
+ }>;
1519
+ type RuntypeAgentTurnCompleteEvent = RuntypeStreamEventOf<RuntypeAgentSSEEvent, "agent_turn_complete">;
1520
+ type RuntypeStepCompleteEvent = RuntypeStreamEventOf<RuntypeFlowSSEEvent, "step_complete">;
1521
+ type RuntypeStopReasonKind = NonNullable<RuntypeAgentTurnCompleteEvent["stopReason"] | RuntypeStepCompleteEvent["stopReason"]>;
1522
+
973
1523
  /**
974
1524
  * Text content part for multi-modal messages
975
1525
  */
@@ -4325,7 +4875,7 @@ type AgentWidgetMessageVariant = "assistant" | "reasoning" | "tool" | "approval"
4325
4875
  *
4326
4876
  * Absent (`undefined`) means "not reported" — distinct from `'unknown'`.
4327
4877
  */
4328
- type StopReasonKind = 'end_turn' | 'max_tool_calls' | 'length' | 'content_filter' | 'error' | 'unknown';
4878
+ type StopReasonKind = RuntypeStopReasonKind;
4329
4879
  /**
4330
4880
  * Represents a message in the chat conversation.
4331
4881
  *