@runtypelabs/sdk 4.9.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.
package/dist/index.d.ts CHANGED
@@ -908,6 +908,7 @@ interface paths {
908
908
  config: {
909
909
  [key: string]: unknown;
910
910
  } | null;
911
+ configHash: string | null;
911
912
  createdAt: string;
912
913
  dashboardUrl?: string;
913
914
  description: string | null;
@@ -919,6 +920,7 @@ interface paths {
919
920
  icon: string | null;
920
921
  id: string;
921
922
  lastHealthCheckAt: string | null;
923
+ lastModifiedSource: string | null;
922
924
  name: string;
923
925
  organizationId: string | null;
924
926
  primaryFlowId: string | null;
@@ -991,6 +993,268 @@ interface paths {
991
993
  patch?: never;
992
994
  trace?: never;
993
995
  };
996
+ "/v1/agents/ensure": {
997
+ parameters: {
998
+ query?: never;
999
+ header?: never;
1000
+ path?: never;
1001
+ cookie?: never;
1002
+ };
1003
+ get?: never;
1004
+ put?: never;
1005
+ /**
1006
+ * Ensure agent (config-as-code converge)
1007
+ * @description Idempotently converge a repo-defined agent definition onto the platform. Identity is name + account scope. Hash-only probes skip the payload in the steady state (a miss is a normal 200 `definitionRequired` response, not an error); full requests create the agent or append a new version when the canonical content hash differs. Non-executing: never touches the execution pipeline. The response always carries the server-computed canonical hash. Set dryRun to plan without writing (CI drift gate), onConflict: "overwrite" to converge over dashboard/API edits, and release: "publish" to also re-aim the published-version pointer.
1008
+ */
1009
+ post: {
1010
+ parameters: {
1011
+ query?: never;
1012
+ header?: never;
1013
+ path?: never;
1014
+ cookie?: never;
1015
+ };
1016
+ requestBody?: {
1017
+ content: {
1018
+ "application/json": {
1019
+ contentHash?: string;
1020
+ definition?: {
1021
+ config?: {
1022
+ advisor?: {
1023
+ model: string;
1024
+ systemPrompt?: string;
1025
+ } | null;
1026
+ artifacts?: {
1027
+ /** @enum {boolean} */
1028
+ enabled: true;
1029
+ types: ("markdown" | "component")[];
1030
+ };
1031
+ errorHandling?: {
1032
+ fallbacks?: ({
1033
+ delay?: number;
1034
+ /** @enum {string} */
1035
+ type: "retry";
1036
+ } | {
1037
+ delay?: number;
1038
+ maxTokens?: number;
1039
+ model: string;
1040
+ temperature?: number;
1041
+ /** @enum {string} */
1042
+ type: "model";
1043
+ } | {
1044
+ delay?: number;
1045
+ message: string;
1046
+ /** @enum {string} */
1047
+ type: "message";
1048
+ })[];
1049
+ /** @enum {string} */
1050
+ onError: "fail" | "continue" | "fallback";
1051
+ triggers?: {
1052
+ /** @enum {string} */
1053
+ type: "error" | "empty-output";
1054
+ }[];
1055
+ };
1056
+ frequencyPenalty?: number;
1057
+ /** @enum {string} */
1058
+ loggingPolicy?: "default" | "on" | "off";
1059
+ loopConfig?: {
1060
+ enableReflection?: boolean;
1061
+ maxCost?: number;
1062
+ maxTurns?: number;
1063
+ reflectionInterval?: number;
1064
+ };
1065
+ memory?: {
1066
+ enabled: boolean;
1067
+ injectSummary?: boolean;
1068
+ profileTemplate?: string;
1069
+ };
1070
+ model?: string;
1071
+ presencePenalty?: number;
1072
+ reasoning?: boolean | {
1073
+ budgetTokens?: number;
1074
+ enabled: boolean;
1075
+ includeThoughts?: boolean;
1076
+ /** @enum {string} */
1077
+ reasoningEffort?: "minimal" | "low" | "medium" | "high" | "xhigh";
1078
+ /** @enum {string} */
1079
+ reasoningSummary?: "auto" | "detailed";
1080
+ thinkingBudget?: number;
1081
+ };
1082
+ seed?: number;
1083
+ systemPrompt?: string;
1084
+ temperature?: number;
1085
+ temporal?: {
1086
+ elapsedThresholdSeconds?: number;
1087
+ groundNow?: boolean;
1088
+ injectElapsed?: boolean;
1089
+ timezone?: string;
1090
+ };
1091
+ tools?: {
1092
+ approval?: {
1093
+ requestReason?: boolean;
1094
+ require: string[] | boolean;
1095
+ timeout?: number;
1096
+ };
1097
+ codeModeConfig?: {
1098
+ description?: string;
1099
+ timeoutMs?: number;
1100
+ toolPool: string[];
1101
+ };
1102
+ maxToolCalls?: number;
1103
+ mcpServers?: {
1104
+ allowedTools?: string[];
1105
+ auth?: {
1106
+ headerName?: string;
1107
+ password?: string;
1108
+ token?: string;
1109
+ /** @enum {string} */
1110
+ type: "api_key" | "bearer" | "basic" | "custom_header" | "none";
1111
+ username?: string;
1112
+ };
1113
+ enabled?: boolean;
1114
+ id: string;
1115
+ name?: string;
1116
+ timeout?: number;
1117
+ /** @enum {string} */
1118
+ transport?: "streamable_http" | "rest";
1119
+ url: string;
1120
+ }[];
1121
+ perToolLimits?: {
1122
+ [key: string]: {
1123
+ maxCalls?: number;
1124
+ required?: boolean;
1125
+ };
1126
+ };
1127
+ runtimeTools?: {
1128
+ config: {
1129
+ [key: string]: unknown;
1130
+ };
1131
+ description: string;
1132
+ name: string;
1133
+ parametersSchema: {
1134
+ [key: string]: unknown;
1135
+ };
1136
+ /** @enum {string} */
1137
+ toolType: "flow" | "custom" | "external" | "local" | "advisor" | "subagent" | "search";
1138
+ }[];
1139
+ subagentConfig?: {
1140
+ allowNesting?: boolean;
1141
+ defaultMaxTurns?: number;
1142
+ defaultModel?: string;
1143
+ defaultTimeoutMs?: number;
1144
+ maxSpawnsPerRun?: number;
1145
+ maxTurnsLimit?: number;
1146
+ toolPool: string[];
1147
+ };
1148
+ /** @enum {string} */
1149
+ toolCallStrategy?: "auto" | "required" | "none";
1150
+ toolConfigs?: {
1151
+ [key: string]: {
1152
+ [key: string]: unknown;
1153
+ };
1154
+ };
1155
+ toolIds?: string[];
1156
+ };
1157
+ topK?: number;
1158
+ topP?: number;
1159
+ voice?: {
1160
+ elevenLabs?: {
1161
+ modelId?: string;
1162
+ similarity?: number;
1163
+ stability?: number;
1164
+ voiceId?: string;
1165
+ };
1166
+ enabled?: boolean;
1167
+ /** @enum {string} */
1168
+ interruptionMode?: "none" | "cancel" | "barge-in";
1169
+ provider?: string;
1170
+ };
1171
+ };
1172
+ description?: string;
1173
+ icon?: string;
1174
+ name: string;
1175
+ };
1176
+ dryRun?: boolean;
1177
+ expectedRemoteHash?: string;
1178
+ name: string;
1179
+ /** @enum {string} */
1180
+ onConflict?: "error" | "overwrite";
1181
+ /** @enum {string} */
1182
+ release?: "none" | "publish";
1183
+ };
1184
+ };
1185
+ };
1186
+ responses: {
1187
+ /** @description Converge result: unchanged | created | updated | definitionRequired (hash miss — retry with the full definition) | plan (dryRun) */
1188
+ 200: {
1189
+ headers: {
1190
+ [name: string]: unknown;
1191
+ };
1192
+ content: {
1193
+ "application/json": components["schemas"]["AgentEnsureResponse"];
1194
+ };
1195
+ };
1196
+ /** @description Validation error (or unsupported agent type for ensure) */
1197
+ 400: {
1198
+ headers: {
1199
+ [name: string]: unknown;
1200
+ };
1201
+ content: {
1202
+ "application/json": components["schemas"]["Error"];
1203
+ };
1204
+ };
1205
+ /** @description Unauthorized */
1206
+ 401: {
1207
+ headers: {
1208
+ [name: string]: unknown;
1209
+ };
1210
+ content: {
1211
+ "application/json": components["schemas"]["Error"];
1212
+ };
1213
+ };
1214
+ /** @description Insufficient permissions */
1215
+ 403: {
1216
+ headers: {
1217
+ [name: string]: unknown;
1218
+ };
1219
+ content: {
1220
+ "application/json": components["schemas"]["Error"];
1221
+ };
1222
+ };
1223
+ /** @description Conflict: external_modification (last write was not ensure; pass onConflict: "overwrite") or remote_changed (expectedRemoteHash guard) */
1224
+ 409: {
1225
+ headers: {
1226
+ [name: string]: unknown;
1227
+ };
1228
+ content: {
1229
+ "application/json": components["schemas"]["AgentEnsureConflict"];
1230
+ };
1231
+ };
1232
+ /** @description Submitted contentHash does not match the server-recomputed canonical hash */
1233
+ 422: {
1234
+ headers: {
1235
+ [name: string]: unknown;
1236
+ };
1237
+ content: {
1238
+ "application/json": components["schemas"]["AgentEnsureHashMismatch"];
1239
+ };
1240
+ };
1241
+ /** @description Internal server error */
1242
+ 500: {
1243
+ headers: {
1244
+ [name: string]: unknown;
1245
+ };
1246
+ content: {
1247
+ "application/json": components["schemas"]["Error"];
1248
+ };
1249
+ };
1250
+ };
1251
+ };
1252
+ delete?: never;
1253
+ options?: never;
1254
+ head?: never;
1255
+ patch?: never;
1256
+ trace?: never;
1257
+ };
994
1258
  "/v1/agents/fetch-agent-card": {
995
1259
  parameters: {
996
1260
  query?: never;
@@ -1124,6 +1388,92 @@ interface paths {
1124
1388
  patch?: never;
1125
1389
  trace?: never;
1126
1390
  };
1391
+ "/v1/agents/pull": {
1392
+ parameters: {
1393
+ query?: never;
1394
+ header?: never;
1395
+ path?: never;
1396
+ cookie?: never;
1397
+ };
1398
+ /**
1399
+ * Pull agent definition (config-as-code)
1400
+ * @description Return the canonical config-as-code definition and provenance for an agent by name — the absorb-drift direction of the ensure protocol. The contentHash is recomputed from the live agent state, so it is accurate even immediately after a dashboard edit.
1401
+ */
1402
+ get: {
1403
+ parameters: {
1404
+ query: {
1405
+ name: string;
1406
+ };
1407
+ header?: never;
1408
+ path?: never;
1409
+ cookie?: never;
1410
+ };
1411
+ requestBody?: never;
1412
+ responses: {
1413
+ /** @description Canonical definition + provenance */
1414
+ 200: {
1415
+ headers: {
1416
+ [name: string]: unknown;
1417
+ };
1418
+ content: {
1419
+ "application/json": components["schemas"]["AgentPullResponse"];
1420
+ };
1421
+ };
1422
+ /** @description Invalid parameters or unsupported agent type */
1423
+ 400: {
1424
+ headers: {
1425
+ [name: string]: unknown;
1426
+ };
1427
+ content: {
1428
+ "application/json": components["schemas"]["Error"];
1429
+ };
1430
+ };
1431
+ /** @description Unauthorized */
1432
+ 401: {
1433
+ headers: {
1434
+ [name: string]: unknown;
1435
+ };
1436
+ content: {
1437
+ "application/json": components["schemas"]["Error"];
1438
+ };
1439
+ };
1440
+ /** @description Insufficient permissions */
1441
+ 403: {
1442
+ headers: {
1443
+ [name: string]: unknown;
1444
+ };
1445
+ content: {
1446
+ "application/json": components["schemas"]["Error"];
1447
+ };
1448
+ };
1449
+ /** @description No agent with that name in the account scope */
1450
+ 404: {
1451
+ headers: {
1452
+ [name: string]: unknown;
1453
+ };
1454
+ content: {
1455
+ "application/json": components["schemas"]["Error"];
1456
+ };
1457
+ };
1458
+ /** @description Internal server error */
1459
+ 500: {
1460
+ headers: {
1461
+ [name: string]: unknown;
1462
+ };
1463
+ content: {
1464
+ "application/json": components["schemas"]["Error"];
1465
+ };
1466
+ };
1467
+ };
1468
+ };
1469
+ put?: never;
1470
+ post?: never;
1471
+ delete?: never;
1472
+ options?: never;
1473
+ head?: never;
1474
+ patch?: never;
1475
+ trace?: never;
1476
+ };
1127
1477
  "/v1/agents/{id}": {
1128
1478
  parameters: {
1129
1479
  query?: never;
@@ -1173,6 +1523,7 @@ interface paths {
1173
1523
  config: {
1174
1524
  [key: string]: unknown;
1175
1525
  } | null;
1526
+ configHash: string | null;
1176
1527
  createdAt: string;
1177
1528
  dashboardUrl?: string;
1178
1529
  description: string | null;
@@ -1183,6 +1534,7 @@ interface paths {
1183
1534
  icon: string | null;
1184
1535
  id: string;
1185
1536
  lastHealthCheckAt: string | null;
1537
+ lastModifiedSource: string | null;
1186
1538
  name: string;
1187
1539
  organizationId: string | null;
1188
1540
  primaryFlow: {
@@ -1551,6 +1903,7 @@ interface paths {
1551
1903
  config: {
1552
1904
  [key: string]: unknown;
1553
1905
  } | null;
1906
+ configHash: string | null;
1554
1907
  createdAt: string;
1555
1908
  dashboardUrl?: string;
1556
1909
  description: string | null;
@@ -1562,6 +1915,7 @@ interface paths {
1562
1915
  icon: string | null;
1563
1916
  id: string;
1564
1917
  lastHealthCheckAt: string | null;
1918
+ lastModifiedSource: string | null;
1565
1919
  name: string;
1566
1920
  organizationId: string | null;
1567
1921
  primaryFlowId: string | null;
@@ -3938,9 +4292,19 @@ interface paths {
3938
4292
  };
3939
4293
  cookie?: never;
3940
4294
  };
3941
- /** @description The app bundle as a zip archive. */
4295
+ /** @description The app bundle: either a raw zip archive (application/zip) or JSON file maps (application/json) that the API zips server-side. */
3942
4296
  requestBody: {
3943
4297
  content: {
4298
+ "application/json": {
4299
+ /** @description Text files for the bundle, path (relative to bundle root) to content. */
4300
+ files: {
4301
+ [key: string]: string;
4302
+ };
4303
+ /** @description Binary files for the bundle, path to base64-encoded content. */
4304
+ filesBase64?: {
4305
+ [key: string]: string;
4306
+ };
4307
+ };
3944
4308
  "application/zip": string;
3945
4309
  };
3946
4310
  };
@@ -5082,6 +5446,7 @@ interface paths {
5082
5446
  maxMessagesPerSession: number | null;
5083
5447
  name: string | null;
5084
5448
  pinToVersion: string | null;
5449
+ productSurfaceId?: string | null;
5085
5450
  rateLimitPerHour: number | null;
5086
5451
  rateLimitPerMinute: number | null;
5087
5452
  sessionIdleTimeoutMinutes: number | null;
@@ -5193,6 +5558,7 @@ interface paths {
5193
5558
  maxMessagesPerSession: number | null;
5194
5559
  name: string | null;
5195
5560
  pinToVersion: string | null;
5561
+ productSurfaceId?: string | null;
5196
5562
  rateLimitPerHour: number | null;
5197
5563
  rateLimitPerMinute: number | null;
5198
5564
  sessionIdleTimeoutMinutes: number | null;
@@ -5309,6 +5675,7 @@ interface paths {
5309
5675
  maxMessagesPerSession: number | null;
5310
5676
  name: string | null;
5311
5677
  pinToVersion: string | null;
5678
+ productSurfaceId?: string | null;
5312
5679
  rateLimitPerHour: number | null;
5313
5680
  rateLimitPerMinute: number | null;
5314
5681
  sessionIdleTimeoutMinutes: number | null;
@@ -5426,6 +5793,7 @@ interface paths {
5426
5793
  maxMessagesPerSession: number | null;
5427
5794
  name: string | null;
5428
5795
  pinToVersion: string | null;
5796
+ productSurfaceId?: string | null;
5429
5797
  rateLimitPerHour: number | null;
5430
5798
  rateLimitPerMinute: number | null;
5431
5799
  sessionIdleTimeoutMinutes: number | null;
@@ -10155,82 +10523,276 @@ interface paths {
10155
10523
  };
10156
10524
  };
10157
10525
  };
10158
- put?: never;
10526
+ put?: never;
10527
+ /**
10528
+ * Create flow
10529
+ * @description Create a new flow with step definitions.
10530
+ */
10531
+ post: {
10532
+ parameters: {
10533
+ query?: never;
10534
+ header?: never;
10535
+ path?: never;
10536
+ cookie?: never;
10537
+ };
10538
+ requestBody?: {
10539
+ content: {
10540
+ "application/json": {
10541
+ flowSteps?: {
10542
+ config?: unknown;
10543
+ /** @default true */
10544
+ enabled?: boolean;
10545
+ id?: string;
10546
+ name: string;
10547
+ order?: number;
10548
+ /** @enum {string} */
10549
+ type: "prompt" | "crawl" | "fetch-url" | "retrieve-record" | "fetch-github" | "api-call" | "transform-data" | "template" | "conditional" | "set-variable" | "upsert-record" | "send-email" | "send-text" | "send-event" | "send-stream" | "update-record" | "search" | "generate-embedding" | "vector-search" | "tool-call" | "wait-until" | "paginate-api" | "store-vector" | "execute-agent" | "store-asset" | "generate-pdf" | "save-memory" | "recall-memory" | "memory-summary";
10550
+ when?: string;
10551
+ }[];
10552
+ name: string;
10553
+ steps?: {
10554
+ config?: unknown;
10555
+ /** @default true */
10556
+ enabled?: boolean;
10557
+ id?: string;
10558
+ name: string;
10559
+ order?: number;
10560
+ /** @enum {string} */
10561
+ type: "prompt" | "crawl" | "fetch-url" | "retrieve-record" | "fetch-github" | "api-call" | "transform-data" | "template" | "conditional" | "set-variable" | "upsert-record" | "send-email" | "send-text" | "send-event" | "send-stream" | "update-record" | "search" | "generate-embedding" | "vector-search" | "tool-call" | "wait-until" | "paginate-api" | "store-vector" | "execute-agent" | "store-asset" | "generate-pdf" | "save-memory" | "recall-memory" | "memory-summary";
10562
+ when?: string;
10563
+ }[];
10564
+ };
10565
+ };
10566
+ };
10567
+ responses: {
10568
+ /** @description Created flow */
10569
+ 201: {
10570
+ headers: {
10571
+ [name: string]: unknown;
10572
+ };
10573
+ content: {
10574
+ "application/json": {
10575
+ createdAt: string;
10576
+ dashboardUrl?: string;
10577
+ flowSteps: {
10578
+ config?: {
10579
+ [key: string]: unknown;
10580
+ };
10581
+ enabled?: boolean;
10582
+ id: string;
10583
+ name?: string;
10584
+ order?: number;
10585
+ type: string;
10586
+ }[];
10587
+ id: string;
10588
+ lastRunAt?: string | null;
10589
+ name: string;
10590
+ organizationId: string | null;
10591
+ sampleMetadata?: {
10592
+ [key: string]: unknown;
10593
+ };
10594
+ stepCount?: number;
10595
+ updatedAt: string;
10596
+ userId: string;
10597
+ };
10598
+ };
10599
+ };
10600
+ /** @description Validation error */
10601
+ 400: {
10602
+ headers: {
10603
+ [name: string]: unknown;
10604
+ };
10605
+ content: {
10606
+ "application/json": components["schemas"]["Error"];
10607
+ };
10608
+ };
10609
+ /** @description Unauthorized */
10610
+ 401: {
10611
+ headers: {
10612
+ [name: string]: unknown;
10613
+ };
10614
+ content: {
10615
+ "application/json": components["schemas"]["Error"];
10616
+ };
10617
+ };
10618
+ /** @description Insufficient permissions */
10619
+ 403: {
10620
+ headers: {
10621
+ [name: string]: unknown;
10622
+ };
10623
+ content: {
10624
+ "application/json": components["schemas"]["Error"];
10625
+ };
10626
+ };
10627
+ /** @description Internal server error */
10628
+ 500: {
10629
+ headers: {
10630
+ [name: string]: unknown;
10631
+ };
10632
+ content: {
10633
+ "application/json": components["schemas"]["Error"];
10634
+ };
10635
+ };
10636
+ };
10637
+ };
10638
+ delete?: never;
10639
+ options?: never;
10640
+ head?: never;
10641
+ patch?: never;
10642
+ trace?: never;
10643
+ };
10644
+ "/v1/flows/ensure": {
10645
+ parameters: {
10646
+ query?: never;
10647
+ header?: never;
10648
+ path?: never;
10649
+ cookie?: never;
10650
+ };
10651
+ get?: never;
10652
+ put?: never;
10653
+ /**
10654
+ * Ensure flow (config-as-code converge)
10655
+ * @description Idempotently converge a repo-defined flow definition onto the platform. Identity is name + account scope. Hash-only probes skip the payload in the steady state (a miss is a normal 200 `definitionRequired` response, not an error); full requests create the flow or append a new version when the canonical content hash differs. Non-executing: never touches the execution pipeline — the deploy-time sibling of the dispatch-coupled `flowMode: "upsert"` (which saves and runs in one request). The response always carries the server-computed canonical hash. Set dryRun to plan without writing (CI drift gate), onConflict: "overwrite" to converge over dashboard/API edits, and release: "publish" to also re-aim the published-version pointer.
10656
+ */
10657
+ post: {
10658
+ parameters: {
10659
+ query?: never;
10660
+ header?: never;
10661
+ path?: never;
10662
+ cookie?: never;
10663
+ };
10664
+ requestBody?: {
10665
+ content: {
10666
+ "application/json": {
10667
+ contentHash?: string;
10668
+ definition?: {
10669
+ name: string;
10670
+ steps: {
10671
+ config?: {
10672
+ [key: string]: unknown;
10673
+ };
10674
+ enabled?: boolean;
10675
+ name: string;
10676
+ order?: number;
10677
+ type: string;
10678
+ when?: string;
10679
+ }[];
10680
+ };
10681
+ dryRun?: boolean;
10682
+ expectedRemoteHash?: string;
10683
+ name: string;
10684
+ /** @enum {string} */
10685
+ onConflict?: "error" | "overwrite";
10686
+ /** @enum {string} */
10687
+ release?: "none" | "publish";
10688
+ };
10689
+ };
10690
+ };
10691
+ responses: {
10692
+ /** @description Converge result: unchanged | created | updated | definitionRequired (hash miss — retry with the full definition) | plan (dryRun) */
10693
+ 200: {
10694
+ headers: {
10695
+ [name: string]: unknown;
10696
+ };
10697
+ content: {
10698
+ "application/json": components["schemas"]["FlowEnsureResponse"];
10699
+ };
10700
+ };
10701
+ /** @description Validation error */
10702
+ 400: {
10703
+ headers: {
10704
+ [name: string]: unknown;
10705
+ };
10706
+ content: {
10707
+ "application/json": components["schemas"]["Error"];
10708
+ };
10709
+ };
10710
+ /** @description Unauthorized */
10711
+ 401: {
10712
+ headers: {
10713
+ [name: string]: unknown;
10714
+ };
10715
+ content: {
10716
+ "application/json": components["schemas"]["Error"];
10717
+ };
10718
+ };
10719
+ /** @description Insufficient permissions */
10720
+ 403: {
10721
+ headers: {
10722
+ [name: string]: unknown;
10723
+ };
10724
+ content: {
10725
+ "application/json": components["schemas"]["Error"];
10726
+ };
10727
+ };
10728
+ /** @description Conflict: external_modification (last write was not ensure; pass onConflict: "overwrite") or remote_changed (expectedRemoteHash guard) */
10729
+ 409: {
10730
+ headers: {
10731
+ [name: string]: unknown;
10732
+ };
10733
+ content: {
10734
+ "application/json": components["schemas"]["FlowEnsureConflict"];
10735
+ };
10736
+ };
10737
+ /** @description Submitted contentHash does not match the server-recomputed canonical hash */
10738
+ 422: {
10739
+ headers: {
10740
+ [name: string]: unknown;
10741
+ };
10742
+ content: {
10743
+ "application/json": components["schemas"]["FlowEnsureHashMismatch"];
10744
+ };
10745
+ };
10746
+ /** @description Internal server error */
10747
+ 500: {
10748
+ headers: {
10749
+ [name: string]: unknown;
10750
+ };
10751
+ content: {
10752
+ "application/json": components["schemas"]["Error"];
10753
+ };
10754
+ };
10755
+ };
10756
+ };
10757
+ delete?: never;
10758
+ options?: never;
10759
+ head?: never;
10760
+ patch?: never;
10761
+ trace?: never;
10762
+ };
10763
+ "/v1/flows/pull": {
10764
+ parameters: {
10765
+ query?: never;
10766
+ header?: never;
10767
+ path?: never;
10768
+ cookie?: never;
10769
+ };
10159
10770
  /**
10160
- * Create flow
10161
- * @description Create a new flow with step definitions.
10771
+ * Pull flow definition (config-as-code)
10772
+ * @description Return the canonical config-as-code definition and provenance for a flow by name — the absorb-drift direction of the ensure protocol. The contentHash is recomputed from the live flow state, so it is accurate even immediately after a dashboard edit.
10162
10773
  */
10163
- post: {
10774
+ get: {
10164
10775
  parameters: {
10165
- query?: never;
10776
+ query: {
10777
+ name: string;
10778
+ };
10166
10779
  header?: never;
10167
10780
  path?: never;
10168
10781
  cookie?: never;
10169
10782
  };
10170
- requestBody?: {
10171
- content: {
10172
- "application/json": {
10173
- flowSteps?: {
10174
- config?: unknown;
10175
- /** @default true */
10176
- enabled?: boolean;
10177
- id?: string;
10178
- name: string;
10179
- order?: number;
10180
- /** @enum {string} */
10181
- type: "prompt" | "crawl" | "fetch-url" | "retrieve-record" | "fetch-github" | "api-call" | "transform-data" | "template" | "conditional" | "set-variable" | "upsert-record" | "send-email" | "send-text" | "send-event" | "send-stream" | "update-record" | "search" | "generate-embedding" | "vector-search" | "tool-call" | "wait-until" | "paginate-api" | "store-vector" | "execute-agent" | "store-asset" | "generate-pdf" | "save-memory" | "recall-memory" | "memory-summary";
10182
- when?: string;
10183
- }[];
10184
- name: string;
10185
- steps?: {
10186
- config?: unknown;
10187
- /** @default true */
10188
- enabled?: boolean;
10189
- id?: string;
10190
- name: string;
10191
- order?: number;
10192
- /** @enum {string} */
10193
- type: "prompt" | "crawl" | "fetch-url" | "retrieve-record" | "fetch-github" | "api-call" | "transform-data" | "template" | "conditional" | "set-variable" | "upsert-record" | "send-email" | "send-text" | "send-event" | "send-stream" | "update-record" | "search" | "generate-embedding" | "vector-search" | "tool-call" | "wait-until" | "paginate-api" | "store-vector" | "execute-agent" | "store-asset" | "generate-pdf" | "save-memory" | "recall-memory" | "memory-summary";
10194
- when?: string;
10195
- }[];
10196
- };
10197
- };
10198
- };
10783
+ requestBody?: never;
10199
10784
  responses: {
10200
- /** @description Created flow */
10201
- 201: {
10785
+ /** @description Canonical definition + provenance */
10786
+ 200: {
10202
10787
  headers: {
10203
10788
  [name: string]: unknown;
10204
10789
  };
10205
10790
  content: {
10206
- "application/json": {
10207
- createdAt: string;
10208
- dashboardUrl?: string;
10209
- flowSteps: {
10210
- config?: {
10211
- [key: string]: unknown;
10212
- };
10213
- enabled?: boolean;
10214
- id: string;
10215
- name?: string;
10216
- order?: number;
10217
- type: string;
10218
- }[];
10219
- id: string;
10220
- lastRunAt?: string | null;
10221
- name: string;
10222
- organizationId: string | null;
10223
- sampleMetadata?: {
10224
- [key: string]: unknown;
10225
- };
10226
- stepCount?: number;
10227
- updatedAt: string;
10228
- userId: string;
10229
- };
10791
+ "application/json": components["schemas"]["FlowPullResponse"];
10230
10792
  };
10231
10793
  };
10232
- /** @description Validation error */
10233
- 400: {
10794
+ /** @description Unauthorized */
10795
+ 401: {
10234
10796
  headers: {
10235
10797
  [name: string]: unknown;
10236
10798
  };
@@ -10238,8 +10800,8 @@ interface paths {
10238
10800
  "application/json": components["schemas"]["Error"];
10239
10801
  };
10240
10802
  };
10241
- /** @description Unauthorized */
10242
- 401: {
10803
+ /** @description Insufficient permissions */
10804
+ 403: {
10243
10805
  headers: {
10244
10806
  [name: string]: unknown;
10245
10807
  };
@@ -10247,8 +10809,8 @@ interface paths {
10247
10809
  "application/json": components["schemas"]["Error"];
10248
10810
  };
10249
10811
  };
10250
- /** @description Insufficient permissions */
10251
- 403: {
10812
+ /** @description No flow with that name in the account scope */
10813
+ 404: {
10252
10814
  headers: {
10253
10815
  [name: string]: unknown;
10254
10816
  };
@@ -10267,6 +10829,8 @@ interface paths {
10267
10829
  };
10268
10830
  };
10269
10831
  };
10832
+ put?: never;
10833
+ post?: never;
10270
10834
  delete?: never;
10271
10835
  options?: never;
10272
10836
  head?: never;
@@ -17730,6 +18294,12 @@ interface paths {
17730
18294
  supported: boolean;
17731
18295
  supportsReasoningSummary?: boolean;
17732
18296
  };
18297
+ /** @description True when any provider entry supports extended reasoning */
18298
+ supportsReasoning?: boolean;
18299
+ /** @description True when any provider entry supports tool/function calling */
18300
+ supportsToolUse?: boolean;
18301
+ /** @description True when any provider entry supports image input */
18302
+ supportsVision?: boolean;
17733
18303
  tags: string[];
17734
18304
  uiCategory?: string;
17735
18305
  uiPriority?: number;
@@ -20613,7 +21183,7 @@ interface paths {
20613
21183
  /** @enum {string} */
20614
21184
  status?: "draft" | "active" | "paused";
20615
21185
  /** @enum {string} */
20616
- type: "chat" | "mcp" | "mcp_code" | "api" | "webhook" | "schedule" | "a2a" | "email" | "slack" | "sms" | "imessage" | "discord" | "whatsapp" | "telegram" | "hosted-page";
21186
+ type: "chat" | "mcp" | "mcp_code" | "api" | "webhook" | "schedule" | "a2a" | "email" | "slack" | "sms" | "imessage" | "discord" | "whatsapp" | "telegram" | "hosted-page" | "chrome_extension";
20617
21187
  };
20618
21188
  };
20619
21189
  };
@@ -30106,9 +30676,7 @@ interface paths {
30106
30676
  };
30107
30677
  content: {
30108
30678
  "application/json": {
30109
- data: {
30110
- [key: string]: unknown;
30111
- }[];
30679
+ data: components["schemas"]["EnrichedSkillProposal"][];
30112
30680
  };
30113
30681
  };
30114
30682
  };
@@ -30171,7 +30739,7 @@ interface paths {
30171
30739
  };
30172
30740
  content: {
30173
30741
  "application/json": {
30174
- [key: string]: unknown;
30742
+ proposal: components["schemas"]["SkillProposal"];
30175
30743
  };
30176
30744
  };
30177
30745
  };
@@ -30244,7 +30812,7 @@ interface paths {
30244
30812
  };
30245
30813
  content: {
30246
30814
  "application/json": {
30247
- [key: string]: unknown;
30815
+ proposal: components["schemas"]["SkillProposal"];
30248
30816
  };
30249
30817
  };
30250
30818
  };
@@ -30283,12 +30851,16 @@ interface paths {
30283
30851
  };
30284
30852
  /**
30285
30853
  * List skills
30286
- * @description List skills for the authenticated owner, optionally filtered by status.
30854
+ * @description List skills for the authenticated owner with cursor pagination, optionally filtered by status. Ordered newest-first (id descending).
30287
30855
  */
30288
30856
  get: {
30289
30857
  parameters: {
30290
30858
  query?: {
30291
30859
  status?: "draft" | "active" | "archived";
30860
+ limit?: string;
30861
+ cursor?: string;
30862
+ direction?: string;
30863
+ includeCount?: string;
30292
30864
  };
30293
30865
  header?: never;
30294
30866
  path?: never;
@@ -30296,7 +30868,7 @@ interface paths {
30296
30868
  };
30297
30869
  requestBody?: never;
30298
30870
  responses: {
30299
- /** @description Skills */
30871
+ /** @description Paginated list of skills */
30300
30872
  200: {
30301
30873
  headers: {
30302
30874
  [name: string]: unknown;
@@ -30306,9 +30878,19 @@ interface paths {
30306
30878
  data: {
30307
30879
  [key: string]: unknown;
30308
30880
  }[];
30881
+ pagination: components["schemas"]["Pagination"];
30309
30882
  };
30310
30883
  };
30311
30884
  };
30885
+ /** @description Invalid parameters */
30886
+ 400: {
30887
+ headers: {
30888
+ [name: string]: unknown;
30889
+ };
30890
+ content: {
30891
+ "application/json": components["schemas"]["Error"];
30892
+ };
30893
+ };
30312
30894
  /** @description Unauthorized */
30313
30895
  401: {
30314
30896
  headers: {
@@ -33006,6 +33588,7 @@ interface paths {
33006
33588
  features: {
33007
33589
  dashboardAssistantModel: string;
33008
33590
  enableAgentSkills: boolean;
33591
+ enableChromeSurface: boolean;
33009
33592
  enableDashboardAssistant: boolean;
33010
33593
  productGeneratorModel: string;
33011
33594
  };
@@ -33464,6 +34047,205 @@ interface components {
33464
34047
  timestamp?: string;
33465
34048
  };
33466
34049
  };
34050
+ AgentEnsureConflict: {
34051
+ /** @enum {string} */
34052
+ code: "external_modification" | "remote_changed";
34053
+ currentHash?: string | null;
34054
+ error: string;
34055
+ lastModifiedSource?: string;
34056
+ modifiedAt?: string | null;
34057
+ };
34058
+ AgentEnsureHashMismatch: {
34059
+ /** @enum {string} */
34060
+ code: "content_hash_mismatch";
34061
+ /** @description The server-computed canonical hash of the submitted definition. */
34062
+ contentHash: string;
34063
+ error: string;
34064
+ };
34065
+ AgentEnsureResponse: {
34066
+ agentId: string;
34067
+ /** @description Server-computed canonical content hash. Clients should echo this hash in probes. */
34068
+ contentHash: string;
34069
+ /** @enum {string} */
34070
+ result: "unchanged" | "created" | "updated";
34071
+ /** @description The version snapshot backing this state (null if snapshotting failed). */
34072
+ versionId: string | null;
34073
+ } | {
34074
+ /** @enum {string} */
34075
+ result: "definitionRequired";
34076
+ } | {
34077
+ agentId?: string;
34078
+ changedKeys: string[];
34079
+ /** @enum {string} */
34080
+ changes: "none" | "create" | "update";
34081
+ contentHash: string;
34082
+ remoteHash?: string;
34083
+ /** @enum {string} */
34084
+ result: "plan";
34085
+ };
34086
+ AgentPullResponse: {
34087
+ agentId: string;
34088
+ contentHash: string;
34089
+ definition: {
34090
+ config?: {
34091
+ advisor?: {
34092
+ model: string;
34093
+ systemPrompt?: string;
34094
+ } | null;
34095
+ artifacts?: {
34096
+ /** @enum {boolean} */
34097
+ enabled: true;
34098
+ types: ("markdown" | "component")[];
34099
+ };
34100
+ errorHandling?: {
34101
+ fallbacks?: ({
34102
+ delay?: number;
34103
+ /** @enum {string} */
34104
+ type: "retry";
34105
+ } | {
34106
+ delay?: number;
34107
+ maxTokens?: number;
34108
+ model: string;
34109
+ temperature?: number;
34110
+ /** @enum {string} */
34111
+ type: "model";
34112
+ } | {
34113
+ delay?: number;
34114
+ message: string;
34115
+ /** @enum {string} */
34116
+ type: "message";
34117
+ })[];
34118
+ /** @enum {string} */
34119
+ onError: "fail" | "continue" | "fallback";
34120
+ triggers?: {
34121
+ /** @enum {string} */
34122
+ type: "error" | "empty-output";
34123
+ }[];
34124
+ };
34125
+ frequencyPenalty?: number;
34126
+ /** @enum {string} */
34127
+ loggingPolicy?: "default" | "on" | "off";
34128
+ loopConfig?: {
34129
+ enableReflection?: boolean;
34130
+ maxCost?: number;
34131
+ maxTurns?: number;
34132
+ reflectionInterval?: number;
34133
+ };
34134
+ memory?: {
34135
+ enabled: boolean;
34136
+ injectSummary?: boolean;
34137
+ profileTemplate?: string;
34138
+ };
34139
+ model?: string;
34140
+ presencePenalty?: number;
34141
+ reasoning?: boolean | {
34142
+ budgetTokens?: number;
34143
+ enabled: boolean;
34144
+ includeThoughts?: boolean;
34145
+ /** @enum {string} */
34146
+ reasoningEffort?: "minimal" | "low" | "medium" | "high" | "xhigh";
34147
+ /** @enum {string} */
34148
+ reasoningSummary?: "auto" | "detailed";
34149
+ thinkingBudget?: number;
34150
+ };
34151
+ seed?: number;
34152
+ systemPrompt?: string;
34153
+ temperature?: number;
34154
+ temporal?: {
34155
+ elapsedThresholdSeconds?: number;
34156
+ groundNow?: boolean;
34157
+ injectElapsed?: boolean;
34158
+ timezone?: string;
34159
+ };
34160
+ tools?: {
34161
+ approval?: {
34162
+ requestReason?: boolean;
34163
+ require: string[] | boolean;
34164
+ timeout?: number;
34165
+ };
34166
+ codeModeConfig?: {
34167
+ description?: string;
34168
+ timeoutMs?: number;
34169
+ toolPool: string[];
34170
+ };
34171
+ maxToolCalls?: number;
34172
+ mcpServers?: {
34173
+ allowedTools?: string[];
34174
+ auth?: {
34175
+ headerName?: string;
34176
+ password?: string;
34177
+ token?: string;
34178
+ /** @enum {string} */
34179
+ type: "api_key" | "bearer" | "basic" | "custom_header" | "none";
34180
+ username?: string;
34181
+ };
34182
+ enabled?: boolean;
34183
+ id: string;
34184
+ name?: string;
34185
+ timeout?: number;
34186
+ /** @enum {string} */
34187
+ transport?: "streamable_http" | "rest";
34188
+ url: string;
34189
+ }[];
34190
+ perToolLimits?: {
34191
+ [key: string]: {
34192
+ maxCalls?: number;
34193
+ required?: boolean;
34194
+ };
34195
+ };
34196
+ runtimeTools?: {
34197
+ config: {
34198
+ [key: string]: unknown;
34199
+ };
34200
+ description: string;
34201
+ name: string;
34202
+ parametersSchema: {
34203
+ [key: string]: unknown;
34204
+ };
34205
+ /** @enum {string} */
34206
+ toolType: "flow" | "custom" | "external" | "local" | "advisor" | "subagent" | "search";
34207
+ }[];
34208
+ subagentConfig?: {
34209
+ allowNesting?: boolean;
34210
+ defaultMaxTurns?: number;
34211
+ defaultModel?: string;
34212
+ defaultTimeoutMs?: number;
34213
+ maxSpawnsPerRun?: number;
34214
+ maxTurnsLimit?: number;
34215
+ toolPool: string[];
34216
+ };
34217
+ /** @enum {string} */
34218
+ toolCallStrategy?: "auto" | "required" | "none";
34219
+ toolConfigs?: {
34220
+ [key: string]: {
34221
+ [key: string]: unknown;
34222
+ };
34223
+ };
34224
+ toolIds?: string[];
34225
+ };
34226
+ topK?: number;
34227
+ topP?: number;
34228
+ voice?: {
34229
+ elevenLabs?: {
34230
+ modelId?: string;
34231
+ similarity?: number;
34232
+ stability?: number;
34233
+ voiceId?: string;
34234
+ };
34235
+ enabled?: boolean;
34236
+ /** @enum {string} */
34237
+ interruptionMode?: "none" | "cancel" | "barge-in";
34238
+ provider?: string;
34239
+ };
34240
+ };
34241
+ description?: string;
34242
+ icon?: string;
34243
+ name: string;
34244
+ };
34245
+ lastModifiedSource: string | null;
34246
+ updatedAt: string | null;
34247
+ versionId: string | null;
34248
+ };
33467
34249
  AgentSSEEvent: {
33468
34250
  agentId: string;
33469
34251
  agentName: string;
@@ -34506,6 +35288,34 @@ interface components {
34506
35288
  } & {
34507
35289
  [key: string]: unknown;
34508
35290
  });
35291
+ EnrichedSkillProposal: components["schemas"]["SkillProposal"] & {
35292
+ proposingAgent: {
35293
+ id: string;
35294
+ name: string;
35295
+ } | null;
35296
+ resolvedCapabilityNames: {
35297
+ [key: string]: string | null;
35298
+ };
35299
+ skill: {
35300
+ description: string | null;
35301
+ id: string;
35302
+ name: string;
35303
+ status: string;
35304
+ } | null;
35305
+ version: {
35306
+ id: string;
35307
+ manifest: {
35308
+ body: string;
35309
+ frontmatter: {
35310
+ [key: string]: unknown;
35311
+ };
35312
+ runtype: {
35313
+ [key: string]: unknown;
35314
+ };
35315
+ };
35316
+ versionNumber: number;
35317
+ } | null;
35318
+ };
34509
35319
  Error: {
34510
35320
  details?: {
34511
35321
  /** @description Stable Runtype validation code (e.g. MISSING_REQUIRED_FIELD, INVALID_ENUM). */
@@ -34518,6 +35328,62 @@ interface components {
34518
35328
  }[];
34519
35329
  error: string;
34520
35330
  };
35331
+ FlowEnsureConflict: {
35332
+ /** @enum {string} */
35333
+ code: "external_modification" | "remote_changed";
35334
+ currentHash?: string | null;
35335
+ error: string;
35336
+ lastModifiedSource?: string;
35337
+ modifiedAt?: string | null;
35338
+ };
35339
+ FlowEnsureHashMismatch: {
35340
+ /** @enum {string} */
35341
+ code: "content_hash_mismatch";
35342
+ /** @description The server-computed canonical hash of the submitted definition. */
35343
+ contentHash: string;
35344
+ error: string;
35345
+ };
35346
+ FlowEnsureResponse: {
35347
+ /** @description Server-computed canonical content hash. Clients should echo this hash in probes. */
35348
+ contentHash: string;
35349
+ flowId: string;
35350
+ /** @enum {string} */
35351
+ result: "unchanged" | "created" | "updated";
35352
+ /** @description The version snapshot backing this state (null if snapshotting failed). */
35353
+ versionId: string | null;
35354
+ } | {
35355
+ /** @enum {string} */
35356
+ result: "definitionRequired";
35357
+ } | {
35358
+ changedKeys: string[];
35359
+ /** @enum {string} */
35360
+ changes: "none" | "create" | "update";
35361
+ contentHash: string;
35362
+ flowId?: string;
35363
+ remoteHash?: string;
35364
+ /** @enum {string} */
35365
+ result: "plan";
35366
+ };
35367
+ FlowPullResponse: {
35368
+ contentHash: string;
35369
+ definition: {
35370
+ name: string;
35371
+ steps: {
35372
+ config?: {
35373
+ [key: string]: unknown;
35374
+ };
35375
+ enabled?: boolean;
35376
+ name: string;
35377
+ order?: number;
35378
+ type: string;
35379
+ when?: string;
35380
+ }[];
35381
+ };
35382
+ flowId: string;
35383
+ lastModifiedSource: string | null;
35384
+ updatedAt: string | null;
35385
+ versionId: string | null;
35386
+ };
34521
35387
  FlowSSEEvent: {
34522
35388
  executionContext?: {
34523
35389
  [key: string]: unknown;
@@ -34903,6 +35769,18 @@ interface components {
34903
35769
  op: "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "between" | "contains" | "startsWith" | "endsWith" | "in" | "notIn" | "isSet" | "isNotSet" | "isTrue" | "isFalse" | "withinLastDays" | "olderThanDays";
34904
35770
  value?: unknown;
34905
35771
  };
35772
+ SkillProposal: {
35773
+ createdAt: string;
35774
+ id: string;
35775
+ organizationId: string | null;
35776
+ proposingAgentExecutionId: string | null;
35777
+ proposingUserId: string;
35778
+ rejectionReason: string | null;
35779
+ reviewedAt: string | null;
35780
+ reviewedBy: string | null;
35781
+ skillVersionId: string;
35782
+ status: string;
35783
+ };
34906
35784
  UpdateUserProfileResponse: {
34907
35785
  email?: string;
34908
35786
  firstName?: string;
@@ -36232,6 +37110,9 @@ interface ModelConfig {
36232
37110
  supportsStreaming?: boolean;
36233
37111
  supportedResponseFormats?: string[];
36234
37112
  supportsSearch?: boolean;
37113
+ supportsVision?: boolean;
37114
+ supportsToolUse?: boolean;
37115
+ supportsReasoning?: boolean;
36235
37116
  isEnabled: boolean;
36236
37117
  isDefault: boolean;
36237
37118
  settings: JsonObject;
@@ -37084,6 +37965,151 @@ interface BillingSpendAnalyticsParams {
37084
37965
  days?: number;
37085
37966
  }
37086
37967
 
37968
+ /**
37969
+ * Flow config-as-code: `defineFlow`, `flows.ensure`, `flows.pull`.
37970
+ *
37971
+ * The non-executing sibling of `flows.upsert()` — `upsert` is the
37972
+ * dispatch-coupled save-and-run motion (it saves the flow AND executes it in
37973
+ * one request); `ensure` is the deploy-time convergence postcondition: "make
37974
+ * the platform's definition of this flow match this object; no-op if it
37975
+ * already does." Identity is name + account scope (the API key's org, else
37976
+ * personal); environment is whichever API the client points at. `ensure`
37977
+ * never deletes, and renaming a definition orphans the old flow and creates a
37978
+ * new one.
37979
+ *
37980
+ * Wire protocol (POST /v1/flows/ensure — APQ-shaped, both APQ scars fixed):
37981
+ * 1. Hash-only probe `{ name, contentHash }`. A match is
37982
+ * `{ result: 'unchanged' }`; a miss is a NORMAL 200
37983
+ * `{ result: 'definitionRequired' }`, never an error.
37984
+ * 2. On a miss, retry with the full `definition`. The server recomputes the
37985
+ * canonical hash itself and returns it on every response — this SDK
37986
+ * echoes the server's hash (memoized per client instance) rather than
37987
+ * trusting its own serialization.
37988
+ *
37989
+ * The content hash is the SAME steps-only hash the flow upsert protocol uses
37990
+ * (`computeFlowContentHash` — mirrored from
37991
+ * `packages/shared/src/utils/flow-content-hash.ts`; this package is
37992
+ * dependency-free by convention), so ensure and upsert interoperate on the
37993
+ * same flow. The flow definition surface is `{ name, steps }` — description
37994
+ * is not part of the v1 ensure surface (the shared hash covers steps only).
37995
+ *
37996
+ * See docs/adr/0003-agent-config-as-code-ensure.md for the design rationale.
37997
+ */
37998
+
37999
+ /** SHA-256 (hex) over the canonical normalized step list (steps only). */
38000
+ declare function computeFlowContentHash(steps: unknown[]): Promise<string>;
38001
+ /**
38002
+ * A definition step. Deliberately has no `id` — step ids are server artifacts
38003
+ * (minted on create, carried by name across converges), so definitions stay
38004
+ * environment-portable. The step config is typed loosely per SDK convention;
38005
+ * the server validates strictly through the canonical flow validator.
38006
+ */
38007
+ interface FlowDefinitionStep {
38008
+ type: string;
38009
+ name: string;
38010
+ order?: number;
38011
+ enabled?: boolean;
38012
+ when?: string;
38013
+ config?: Record<string, unknown>;
38014
+ }
38015
+ /** `defineFlow` input: identity + the ordered step list. */
38016
+ interface DefineFlowInput {
38017
+ name: string;
38018
+ steps: FlowDefinitionStep[];
38019
+ }
38020
+ /** The canonical (wire) definition produced by `defineFlow`. */
38021
+ interface FlowDefinition {
38022
+ name: string;
38023
+ steps: Array<FlowDefinitionStep & {
38024
+ order: number;
38025
+ }>;
38026
+ }
38027
+ /**
38028
+ * Pure-local declarative constructor for a flow definition. No I/O.
38029
+ * Validates structure, rejects unknown fields, assigns explicit step order
38030
+ * (1-based, matching the flow builder) when omitted, and rejects
38031
+ * account-scoped `tool_…` references (definitions must be
38032
+ * environment-portable: the same `defineFlow` converges staging and
38033
+ * production). Deep per-step validation happens server-side at ensure time
38034
+ * through the canonical flow validator.
38035
+ *
38036
+ * @example
38037
+ * ```typescript
38038
+ * const onboardingFlow = defineFlow({
38039
+ * name: 'Onboarding Digest',
38040
+ * steps: [
38041
+ * {
38042
+ * type: 'prompt',
38043
+ * name: 'Summarize signups',
38044
+ * config: { model: 'claude-sonnet-4-6', userPrompt: 'Summarize: {{signups}}' },
38045
+ * },
38046
+ * ],
38047
+ * })
38048
+ * ```
38049
+ */
38050
+ declare function defineFlow(input: DefineFlowInput): FlowDefinition;
38051
+ interface EnsureFlowOptions {
38052
+ /** Plan without writing (the CI drift gate). Sends the full definition. */
38053
+ dryRun?: boolean;
38054
+ /**
38055
+ * What to do when the flow's last write came from the dashboard/API
38056
+ * rather than ensure. Default 'error' (HTTP 409 → FlowEnsureConflictError).
38057
+ */
38058
+ onConflict?: 'error' | 'overwrite';
38059
+ /** 'publish' also re-aims the published-version pointer. Default 'none'. */
38060
+ release?: 'none' | 'publish';
38061
+ /**
38062
+ * TOCTOU guard binding a dry run to its apply: the write only proceeds if
38063
+ * the remote still hashes to this value (409 remote_changed otherwise).
38064
+ */
38065
+ expectedRemoteHash?: string;
38066
+ /** Implies dryRun; throws FlowDriftError unless the plan is 'none'. */
38067
+ expectNoChanges?: boolean;
38068
+ }
38069
+ interface EnsureFlowConverged {
38070
+ result: 'unchanged' | 'created' | 'updated';
38071
+ flowId: string;
38072
+ versionId: string | null;
38073
+ /** The server-computed canonical hash (echo this — never your own). */
38074
+ contentHash: string;
38075
+ }
38076
+ interface EnsureFlowPlan {
38077
+ result: 'plan';
38078
+ changes: 'none' | 'create' | 'update';
38079
+ changedKeys: string[];
38080
+ contentHash: string;
38081
+ remoteHash?: string;
38082
+ flowId?: string;
38083
+ }
38084
+ type EnsureFlowResult = EnsureFlowConverged | EnsureFlowPlan;
38085
+ interface FlowPullResult {
38086
+ flowId: string;
38087
+ definition: FlowDefinition;
38088
+ contentHash: string;
38089
+ lastModifiedSource: string | null;
38090
+ updatedAt: string | null;
38091
+ versionId: string | null;
38092
+ }
38093
+ /** A 409 from the ensure protocol (external_modification or remote_changed). */
38094
+ declare class FlowEnsureConflictError extends Error {
38095
+ readonly code: 'external_modification' | 'remote_changed';
38096
+ readonly lastModifiedSource?: string;
38097
+ readonly modifiedAt?: string | null;
38098
+ readonly currentHash?: string | null;
38099
+ constructor(body: {
38100
+ error?: string;
38101
+ code: 'external_modification' | 'remote_changed';
38102
+ lastModifiedSource?: string;
38103
+ modifiedAt?: string | null;
38104
+ currentHash?: string | null;
38105
+ });
38106
+ }
38107
+ /** Thrown by `ensure(def, { expectNoChanges: true })` when drift is detected. */
38108
+ declare class FlowDriftError extends Error {
38109
+ readonly plan: EnsureFlowPlan;
38110
+ constructor(plan: EnsureFlowPlan);
38111
+ }
38112
+
37087
38113
  /**
37088
38114
  * FlowsNamespace - Static namespace for flow operations
37089
38115
  *
@@ -37145,8 +38171,11 @@ declare class FlowsNamespace {
37145
38171
  /**
37146
38172
  * Create or update a flow by name (upsert mode)
37147
38173
  *
37148
- * The recommended pattern for code-first flow management.
37149
- * Creates the flow if it doesn't exist, updates if steps changed.
38174
+ * The recommended pattern for code-first flow management when you want to
38175
+ * save AND run in one dispatch. For a deploy-time, non-executing converge
38176
+ * (CI/CD config-as-code), use {@link ensure} instead — upsert and ensure
38177
+ * are siblings, not versions of each other: upsert is the runtime verb
38178
+ * (save-and-run), ensure is the deploy verb (converge only).
37150
38179
  *
37151
38180
  * @example
37152
38181
  * ```typescript
@@ -37159,6 +38188,29 @@ declare class FlowsNamespace {
37159
38188
  * ```
37160
38189
  */
37161
38190
  upsert(config: UpsertFlowConfig): RuntypeFlowBuilder;
38191
+ /**
38192
+ * Idempotently converge a `defineFlow` definition onto the platform —
38193
+ * the deploy-time, non-executing sibling of {@link upsert}. Hash-first:
38194
+ * the steady state is one tiny probe request. Creates an immutable version
38195
+ * snapshot on every change; never deletes; never executes the flow.
38196
+ *
38197
+ * @example
38198
+ * ```typescript
38199
+ * const def = defineFlow({ name: 'Onboarding Digest', steps: [...] })
38200
+ *
38201
+ * // Converge (CI/deploy).
38202
+ * const result = await Runtype.flows.ensure(def)
38203
+ *
38204
+ * // PR drift gate.
38205
+ * await Runtype.flows.ensure(def, { expectNoChanges: true })
38206
+ * ```
38207
+ */
38208
+ ensure(definition: FlowDefinition, options?: EnsureFlowOptions): Promise<EnsureFlowResult>;
38209
+ /**
38210
+ * Pull the canonical definition + provenance for a flow by name — the
38211
+ * absorb-drift direction of the ensure protocol.
38212
+ */
38213
+ pull(name: string): Promise<FlowPullResult>;
37162
38214
  /**
37163
38215
  * Create a virtual flow (one-off, not saved)
37164
38216
  *
@@ -38158,6 +39210,58 @@ interface SkillProposal {
38158
39210
  reviewedAt: string | null;
38159
39211
  rejectionReason: string | null;
38160
39212
  createdAt: string;
39213
+ /**
39214
+ * Server-enrichment field: the skill this proposal targets. Present on the
39215
+ * list endpoint (`proposals.list()`) so reviewers can see WHAT they are
39216
+ * approving. `null` when the underlying skill row was deleted out from under
39217
+ * the proposal; entirely **absent** on older API servers — consumers must
39218
+ * tolerate it being `undefined`.
39219
+ */
39220
+ skill?: {
39221
+ id: string;
39222
+ name: string;
39223
+ description: string | null;
39224
+ status: string;
39225
+ } | null;
39226
+ /**
39227
+ * Server-enrichment field: the proposed skill version's content. Present on
39228
+ * the list endpoint so reviewers can read the manifest body (the instructions
39229
+ * that would be injected into another agent's context) before approving.
39230
+ * `null` when the underlying version row was deleted; entirely **absent** on
39231
+ * older API servers — consumers must tolerate it being `undefined`.
39232
+ */
39233
+ version?: {
39234
+ id: string;
39235
+ versionNumber: number;
39236
+ manifest: {
39237
+ frontmatter: Record<string, unknown>;
39238
+ /**
39239
+ * The `runtype` extension block — capability bindings (flows, agents,
39240
+ * tools, MCP servers, inline tools) + trustLevel. These bindings are the
39241
+ * most security-relevant part of an approval decision, so the review queue
39242
+ * surfaces them. Optional: older API servers omit it from this list view.
39243
+ */
39244
+ runtype?: SkillRuntypeExtensions;
39245
+ body: string;
39246
+ };
39247
+ } | null;
39248
+ /**
39249
+ * Server-enrichment field: the agent that authored this proposal, resolved
39250
+ * from the proposing execution. `null` when the execution/agent row is gone,
39251
+ * the execution was a synthesized subagent, or the agent is outside the
39252
+ * reviewer's tenant; entirely **absent** on older API servers.
39253
+ */
39254
+ proposingAgent?: {
39255
+ id: string;
39256
+ name: string;
39257
+ } | null;
39258
+ /**
39259
+ * Server-enrichment field: tenant-scoped id → name map for every flow/agent/
39260
+ * tool ID referenced in the manifest's capability block. A `null` name means
39261
+ * the ID does not resolve inside the reviewer's account (a review signal —
39262
+ * surfaced, not dropped); entirely **absent** on older API servers.
39263
+ */
39264
+ resolvedCapabilityNames?: Record<string, string | null>;
38161
39265
  }
38162
39266
  /**
38163
39267
  * Create/update a skill from a raw SKILL.md document. The frontmatter +
@@ -38195,6 +39299,37 @@ interface SkillWithVersion {
38195
39299
  skill: Skill;
38196
39300
  version: SkillVersion;
38197
39301
  }
39302
+ /** Query params accepted by the skills list endpoint. */
39303
+ interface SkillListParams {
39304
+ /** Filter by lifecycle status. */
39305
+ status?: SkillStatus;
39306
+ /** Page size (1-200, server default 100). */
39307
+ limit?: number;
39308
+ /** Opaque cursor from a previous page's `pagination.nextCursor`/`prevCursor`. */
39309
+ cursor?: string;
39310
+ /** Pagination direction relative to the cursor (default `'next'`). */
39311
+ direction?: 'next' | 'prev';
39312
+ /** Include `totalCount`/`totalPages` in the pagination envelope (extra query). */
39313
+ includeCount?: boolean;
39314
+ }
39315
+ /** The standard cursor-pagination envelope returned by list endpoints. */
39316
+ interface SkillListPagination {
39317
+ nextCursor: string | null;
39318
+ prevCursor: string | null;
39319
+ hasMore: boolean;
39320
+ hasPrev: boolean;
39321
+ limit: number;
39322
+ currentOffset: number;
39323
+ totalPages?: number;
39324
+ currentPage?: number;
39325
+ totalCount?: number;
39326
+ }
39327
+ /** A page of skills with its pagination envelope. */
39328
+ interface SkillListPage {
39329
+ data: Skill[];
39330
+ /** Absent on older API servers that predate skills-list pagination. */
39331
+ pagination?: SkillListPagination;
39332
+ }
38198
39333
  /**
38199
39334
  * The admin review queue for agent-authored skill proposals. This is the human
38200
39335
  * review surface for the deployed-agent data plane — listing, approving, and
@@ -38256,15 +39391,26 @@ declare class SkillsNamespace {
38256
39391
  create(input: SkillWriteInput): Promise<SkillWithVersion>;
38257
39392
  /**
38258
39393
  * List skills for the authenticated owner, optionally filtered by status.
39394
+ * Returns just the rows (one page); pass `cursor`/`limit` to page, or use
39395
+ * {@link listPage} when you need the pagination envelope.
38259
39396
  *
38260
39397
  * @example
38261
39398
  * ```typescript
38262
39399
  * const active = await Runtype.skills.list({ status: 'active' })
38263
39400
  * ```
38264
39401
  */
38265
- list(params?: {
38266
- status?: SkillStatus;
38267
- }): Promise<Skill[]>;
39402
+ list(params?: SkillListParams): Promise<Skill[]>;
39403
+ /**
39404
+ * List skills with the cursor-pagination envelope (mirrors the tools list
39405
+ * shape: `{ data, pagination }`).
39406
+ *
39407
+ * @example
39408
+ * ```typescript
39409
+ * const page1 = await Runtype.skills.listPage({ limit: 50, includeCount: true })
39410
+ * const page2 = await Runtype.skills.listPage({ limit: 50, cursor: page1.pagination?.nextCursor ?? undefined })
39411
+ * ```
39412
+ */
39413
+ listPage(params?: SkillListParams): Promise<SkillListPage>;
38268
39414
  /**
38269
39415
  * Get a skill and its full version history.
38270
39416
  *
@@ -38329,6 +39475,246 @@ declare class SkillsNamespace {
38329
39475
  listBindings(agentId: string): Promise<AgentSkillBinding[]>;
38330
39476
  }
38331
39477
 
39478
+ /**
39479
+ * AgentsNamespace — agent config-as-code: `defineAgent`, `ensure`, `pull`.
39480
+ *
39481
+ * `ensure` is a convergence postcondition, not a save button: "make the
39482
+ * platform's definition of this agent match this object; no-op if it already
39483
+ * does." Identity is name + account scope (the API key's org, else personal);
39484
+ * environment is whichever API the client points at. `ensure` never deletes,
39485
+ * and renaming a definition orphans the old agent and creates a new one.
39486
+ *
39487
+ * Wire protocol (POST /v1/agents/ensure — APQ-shaped, both APQ scars fixed):
39488
+ * 1. Hash-only probe `{ name, contentHash }`. A match is
39489
+ * `{ result: 'unchanged' }`; a miss is a NORMAL 200
39490
+ * `{ result: 'definitionRequired' }`, never an error.
39491
+ * 2. On a miss, retry with the full `definition`. The server recomputes the
39492
+ * canonical hash itself and returns it on every response — this SDK
39493
+ * echoes the server's hash (memoized per client instance) rather than
39494
+ * trusting its own serialization.
39495
+ *
39496
+ * The content-hash implementation below is an INLINED COPY of
39497
+ * `packages/shared/src/utils/agent-content-hash.ts` (this package is
39498
+ * dependency-free by convention, mirroring the flow content hash in
39499
+ * flows-namespace.ts). Parity is pinned by the shared fixture corpus in
39500
+ * `packages/shared/test-fixtures/agent-content-hash/cases.json`, asserted by
39501
+ * both packages' test suites. Change both copies (and regenerate the corpus)
39502
+ * in the same PR.
39503
+ *
39504
+ * See docs/adr/0003-agent-config-as-code-ensure.md for the design rationale.
39505
+ */
39506
+
39507
+ /** Canonical normalized form — must stay byte-identical to the shared impl. */
39508
+ declare function normalizeAgentDefinition(definition: {
39509
+ name: string;
39510
+ description?: string | null;
39511
+ icon?: string | null;
39512
+ config?: Record<string, unknown> | null;
39513
+ }): {
39514
+ name: string;
39515
+ description?: string;
39516
+ icon?: string;
39517
+ config: Record<string, unknown>;
39518
+ };
39519
+ /** SHA-256 (hex) over the canonical normalized definition. */
39520
+ declare function computeAgentContentHash(definition: {
39521
+ name: string;
39522
+ description?: string | null;
39523
+ icon?: string | null;
39524
+ config?: Record<string, unknown> | null;
39525
+ }): Promise<string>;
39526
+ /**
39527
+ * The runtime-config surface accepted in a definition (mirrors
39528
+ * `agentRuntimeConfigSchema` in @runtypelabs/shared; deep leaves are typed
39529
+ * loosely per SDK convention — the server validates strictly).
39530
+ */
39531
+ interface AgentDefinitionConfig {
39532
+ model?: string;
39533
+ systemPrompt?: string;
39534
+ temperature?: number;
39535
+ topP?: number;
39536
+ topK?: number;
39537
+ frequencyPenalty?: number;
39538
+ presencePenalty?: number;
39539
+ seed?: number;
39540
+ tools?: {
39541
+ toolIds?: string[];
39542
+ toolConfigs?: Record<string, Record<string, unknown>>;
39543
+ runtimeTools?: Array<Record<string, unknown>>;
39544
+ mcpServers?: Array<Record<string, unknown>>;
39545
+ maxToolCalls?: number;
39546
+ toolCallStrategy?: 'auto' | 'required' | 'none';
39547
+ approval?: {
39548
+ require: string[] | boolean;
39549
+ timeout?: number;
39550
+ requestReason?: boolean;
39551
+ };
39552
+ perToolLimits?: Record<string, {
39553
+ maxCalls?: number;
39554
+ required?: boolean;
39555
+ }>;
39556
+ subagentConfig?: Record<string, unknown>;
39557
+ codeModeConfig?: Record<string, unknown>;
39558
+ };
39559
+ artifacts?: {
39560
+ enabled: true;
39561
+ types: Array<'markdown' | 'component'>;
39562
+ };
39563
+ reasoning?: boolean | Record<string, unknown>;
39564
+ advisor?: {
39565
+ model: string;
39566
+ systemPrompt?: string;
39567
+ } | null;
39568
+ loopConfig?: {
39569
+ maxTurns?: number;
39570
+ maxCost?: number;
39571
+ enableReflection?: boolean;
39572
+ reflectionInterval?: number;
39573
+ };
39574
+ voice?: Record<string, unknown>;
39575
+ errorHandling?: Record<string, unknown>;
39576
+ loggingPolicy?: 'default' | 'on' | 'off';
39577
+ temporal?: Record<string, unknown>;
39578
+ memory?: {
39579
+ enabled: boolean;
39580
+ profileTemplate?: string;
39581
+ injectSummary?: boolean;
39582
+ };
39583
+ }
39584
+ /**
39585
+ * `defineAgent` input — the flat authoring shape: identity + presentation
39586
+ * fields alongside the runtime-config fields.
39587
+ */
39588
+ interface DefineAgentInput extends AgentDefinitionConfig {
39589
+ name: string;
39590
+ description?: string;
39591
+ icon?: string;
39592
+ }
39593
+ /** The canonical (wire) definition produced by `defineAgent`. */
39594
+ interface AgentDefinition {
39595
+ name: string;
39596
+ description?: string;
39597
+ icon?: string;
39598
+ config: AgentDefinitionConfig;
39599
+ }
39600
+ /**
39601
+ * Pure-local declarative constructor for an agent definition. No I/O.
39602
+ * Validates structure, rejects unknown top-level fields, and rejects
39603
+ * account-scoped `tool_…` references (definitions must be
39604
+ * environment-portable: the same `defineAgent` converges staging and
39605
+ * production). Deep validation happens server-side at ensure time.
39606
+ *
39607
+ * @example
39608
+ * ```typescript
39609
+ * const pricingAssistant = defineAgent({
39610
+ * name: 'Pricing Assistant',
39611
+ * description: 'Marketing pricing page chat assistant.',
39612
+ * icon: '💬',
39613
+ * model: 'claude-sonnet-4-6',
39614
+ * temperature: 0.7,
39615
+ * loopConfig: { maxTurns: 1 },
39616
+ * systemPrompt: renderPricingPrompt(plans),
39617
+ * })
39618
+ * ```
39619
+ */
39620
+ declare function defineAgent(input: DefineAgentInput): AgentDefinition;
39621
+ interface EnsureAgentOptions {
39622
+ /** Plan without writing (the CI drift gate). Sends the full definition. */
39623
+ dryRun?: boolean;
39624
+ /**
39625
+ * What to do when the agent's last write came from the dashboard/API/MCP
39626
+ * rather than ensure. Default 'error' (HTTP 409 → AgentEnsureConflictError).
39627
+ */
39628
+ onConflict?: 'error' | 'overwrite';
39629
+ /** 'publish' also re-aims the published-version pointer. Default 'none'. */
39630
+ release?: 'none' | 'publish';
39631
+ /**
39632
+ * TOCTOU guard binding a dry run to its apply: the write only proceeds if
39633
+ * the remote still hashes to this value (409 remote_changed otherwise).
39634
+ */
39635
+ expectedRemoteHash?: string;
39636
+ /** Implies dryRun; throws AgentDriftError unless the plan is 'none'. */
39637
+ expectNoChanges?: boolean;
39638
+ }
39639
+ interface EnsureAgentConverged {
39640
+ result: 'unchanged' | 'created' | 'updated';
39641
+ agentId: string;
39642
+ versionId: string | null;
39643
+ /** The server-computed canonical hash (echo this — never your own). */
39644
+ contentHash: string;
39645
+ }
39646
+ interface EnsureAgentPlan {
39647
+ result: 'plan';
39648
+ changes: 'none' | 'create' | 'update';
39649
+ changedKeys: string[];
39650
+ contentHash: string;
39651
+ remoteHash?: string;
39652
+ agentId?: string;
39653
+ }
39654
+ type EnsureAgentResult = EnsureAgentConverged | EnsureAgentPlan;
39655
+ interface AgentPullResult {
39656
+ agentId: string;
39657
+ definition: AgentDefinition;
39658
+ contentHash: string;
39659
+ lastModifiedSource: string | null;
39660
+ updatedAt: string | null;
39661
+ versionId: string | null;
39662
+ }
39663
+ /** A 409 from the ensure protocol (external_modification or remote_changed). */
39664
+ declare class AgentEnsureConflictError extends Error {
39665
+ readonly code: 'external_modification' | 'remote_changed';
39666
+ readonly lastModifiedSource?: string;
39667
+ readonly modifiedAt?: string | null;
39668
+ readonly currentHash?: string | null;
39669
+ constructor(body: {
39670
+ error?: string;
39671
+ code: 'external_modification' | 'remote_changed';
39672
+ lastModifiedSource?: string;
39673
+ modifiedAt?: string | null;
39674
+ currentHash?: string | null;
39675
+ });
39676
+ }
39677
+ /** Thrown by `ensure(def, { expectNoChanges: true })` when drift is detected. */
39678
+ declare class AgentDriftError extends Error {
39679
+ readonly plan: EnsureAgentPlan;
39680
+ constructor(plan: EnsureAgentPlan);
39681
+ }
39682
+ /**
39683
+ * Agent config-as-code operations.
39684
+ *
39685
+ * @example
39686
+ * ```typescript
39687
+ * const def = defineAgent({ name: 'Pricing Assistant', model: 'claude-sonnet-4-6', systemPrompt })
39688
+ *
39689
+ * // Converge (CI/deploy). Steady state is one tiny probe request.
39690
+ * const result = await Runtype.agents.ensure(def)
39691
+ *
39692
+ * // PR drift gate.
39693
+ * await Runtype.agents.ensure(def, { expectNoChanges: true })
39694
+ *
39695
+ * // Absorb a dashboard edit back into the repo.
39696
+ * const { definition } = await Runtype.agents.pull('Pricing Assistant')
39697
+ * ```
39698
+ */
39699
+ declare class AgentsNamespace {
39700
+ private getClient;
39701
+ constructor(getClient: () => RuntypeClient$1);
39702
+ /**
39703
+ * Idempotently converge a definition onto the platform. Hash-first: probes
39704
+ * with a content hash, and only ships the full definition when the server
39705
+ * reports a miss (`definitionRequired`). Creates an immutable version
39706
+ * snapshot on every change; never deletes.
39707
+ */
39708
+ ensure(definition: AgentDefinition, options?: EnsureAgentOptions): Promise<EnsureAgentResult>;
39709
+ /**
39710
+ * Pull the canonical definition + provenance for an agent by name — the
39711
+ * absorb-drift direction. The contentHash reflects the live agent state.
39712
+ */
39713
+ pull(name: string): Promise<AgentPullResult>;
39714
+ private memoize;
39715
+ private request;
39716
+ }
39717
+
38332
39718
  /**
38333
39719
  * Runtype - The unified SDK client for building and executing flows, batches, evals, and prompts
38334
39720
  *
@@ -38580,6 +39966,30 @@ declare class Runtype {
38580
39966
  * ```
38581
39967
  */
38582
39968
  static get skills(): SkillsNamespace;
39969
+ /**
39970
+ * Agents namespace - Agent config-as-code (define / ensure / pull)
39971
+ *
39972
+ * @example
39973
+ * ```typescript
39974
+ * import { defineAgent, Runtype } from '@runtypelabs/sdk'
39975
+ *
39976
+ * const assistant = defineAgent({
39977
+ * name: 'Pricing Assistant',
39978
+ * model: 'claude-sonnet-4-6',
39979
+ * systemPrompt: renderPrompt(pricingData),
39980
+ * })
39981
+ *
39982
+ * // Converge at deploy time (idempotent; one tiny probe in steady state)
39983
+ * await Runtype.agents.ensure(assistant)
39984
+ *
39985
+ * // CI drift gate
39986
+ * await Runtype.agents.ensure(assistant, { expectNoChanges: true })
39987
+ *
39988
+ * // Absorb a dashboard edit back into the repo
39989
+ * const { definition } = await Runtype.agents.pull('Pricing Assistant')
39990
+ * ```
39991
+ */
39992
+ static get agents(): AgentsNamespace;
38583
39993
  }
38584
39994
 
38585
39995
  /**
@@ -38830,6 +40240,8 @@ interface RunTaskStateSlice {
38830
40240
  isCreationTask?: boolean;
38831
40241
  /** For creation tasks: allowed write root (e.g. "public/"). Writes must stay under this path. */
38832
40242
  outputRoot?: string;
40243
+ /** Number of consecutive sessions with no tool actions (the stall-detection counter) */
40244
+ consecutiveEmptySessions?: number;
38833
40245
  sessions: Array<{
38834
40246
  actionKeys?: string[];
38835
40247
  hadTextOutput?: boolean;
@@ -38905,11 +40317,40 @@ interface WorkflowPhase {
38905
40317
  /** Return true if the agent's TASK_COMPLETE claim should be accepted in this phase */
38906
40318
  canAcceptCompletion?: (state: RunTaskStateSlice, trace: RunTaskToolTraceSlice) => boolean;
38907
40319
  }
40320
+ /**
40321
+ * Escalation policy for consecutive sessions with no tool actions.
40322
+ *
40323
+ * Every threshold counts the same `consecutiveEmptySessions` counter used for
40324
+ * stall detection: a session is empty when it performed no write, read,
40325
+ * discovery, or verification tool action. Text-only narration ("I'll create
40326
+ * the files now") does NOT reset the counter — a model that narrates intent
40327
+ * without calling tools still escalates here, even though phase-level
40328
+ * `buildRecoveryMessage` conditions keyed on `hadTextOutput` would not fire.
40329
+ */
40330
+ interface WorkflowStallPolicy {
40331
+ /**
40332
+ * Inject a generic recovery nudge into the next session after N consecutive
40333
+ * empty sessions, when the current phase's buildRecoveryMessage returns
40334
+ * nothing. Unset = no workflow-level nudge (legacy behavior).
40335
+ */
40336
+ nudgeAfter?: number;
40337
+ /**
40338
+ * Set `state.stallEscalationRequested` when the counter reaches N, signaling
40339
+ * the caller (via onSession) to restart with a fallback model. The SDK only
40340
+ * raises the signal — model switching is the caller's responsibility.
40341
+ * Unset = never signal.
40342
+ */
40343
+ escalateModelAfter?: number;
40344
+ /** Stop the run with status 'stalled' after N consecutive empty sessions (default 3). */
40345
+ stopAfter?: number;
40346
+ }
38908
40347
  interface WorkflowDefinition {
38909
40348
  /** Workflow name for logging/debugging */
38910
40349
  name: string;
38911
40350
  /** Ordered list of phases */
38912
40351
  phases: WorkflowPhase[];
40352
+ /** Escalation policy for consecutive sessions with no tool actions */
40353
+ stallPolicy?: WorkflowStallPolicy;
38913
40354
  /** Classify the user message into a variant (e.g. 'create' vs 'modify') */
38914
40355
  classifyVariant?: (message: string) => string | undefined;
38915
40356
  /** Generate bootstrap context before the first session */
@@ -38931,6 +40372,7 @@ interface ApiClient {
38931
40372
  patch<T>(path: string, data?: any): Promise<T>;
38932
40373
  delete<T>(path: string, data?: any): Promise<T>;
38933
40374
  postFormData<T>(path: string, formData: FormData): Promise<T>;
40375
+ postBinary<T>(path: string, body: Uint8Array, contentType: string): Promise<T>;
38934
40376
  requestStream(path: string, options?: RequestInit): Promise<Response>;
38935
40377
  }
38936
40378
  /**
@@ -40181,6 +41623,14 @@ interface ExecuteWithLocalToolsOptions {
40181
41623
  * delivered at the next session boundary instead of after the full session.
40182
41624
  */
40183
41625
  shouldInterrupt?: () => boolean;
41626
+ /**
41627
+ * Hard-abort signal for the in-flight execution. When it aborts, the
41628
+ * active SSE stream is cancelled and the pause/resume loop returns a
41629
+ * synthetic `agent_complete` (stopReason 'end_turn') carrying the cost and
41630
+ * tokens observed so far — it does NOT throw. Callers distinguish an
41631
+ * aborted run by checking their own signal, not the returned event.
41632
+ */
41633
+ abortSignal?: AbortSignal;
40184
41634
  }
40185
41635
  /**
40186
41636
  * Status of a long-task agent run
@@ -40243,6 +41693,14 @@ interface RunTaskSessionSummary {
40243
41693
  /** ISO timestamp when this session completed */
40244
41694
  completedAt: string;
40245
41695
  }
41696
+ interface RunTaskContextSummaryEntry {
41697
+ id: string;
41698
+ sessionIndex: number;
41699
+ mode: 'auto' | 'forced';
41700
+ strategy: 'provider_native' | 'summary_fallback';
41701
+ content: string;
41702
+ createdAt: string;
41703
+ }
40246
41704
  /**
40247
41705
  * Accumulated state for a long-task agent run.
40248
41706
  * This is both the in-memory state and the record metadata shape.
@@ -40321,10 +41779,25 @@ interface RunTaskState {
40321
41779
  lastCompletionRejectionReason?: string;
40322
41780
  /** Number of consecutive sessions with no tool actions (for stall detection) */
40323
41781
  consecutiveEmptySessions?: number;
41782
+ /** Durable summaries generated by history compaction; mirrored into the marathon tree log. */
41783
+ contextCompactionSummaries?: RunTaskContextSummaryEntry[];
41784
+ /**
41785
+ * Send-window base: index into `messages` of the first message NOT covered
41786
+ * by the latest compaction summary. Replay sends
41787
+ * `[latest summary, messages since base, continuation]` and re-compacts only
41788
+ * when that window re-crosses the threshold. 0/undefined = no compaction yet.
41789
+ */
41790
+ contextWindowBaseIndex?: number;
41791
+ /**
41792
+ * Set when the workflow's stallPolicy.escalateModelAfter threshold is reached.
41793
+ * Callers observe this in onSession and may restart with a fallback model.
41794
+ * Cleared as soon as a session performs tool actions again.
41795
+ */
41796
+ stallEscalationRequested?: boolean;
40324
41797
  /** Arbitrary bag for workflow-specific data */
40325
41798
  workflowState?: Record<string, unknown>;
40326
41799
  }
40327
- type RunTaskResumeState = Pick<RunTaskState, 'originalMessage' | 'bootstrapContext' | 'workflowPhase' | 'planPath' | 'planWritten' | 'bestCandidatePath' | 'bestCandidateReason' | 'candidatePaths' | 'recentReadPaths' | 'recentActionKeys' | 'bestCandidateNeedsVerification' | 'bestCandidateVerified' | 'verificationRequired' | 'lastVerificationPassed' | 'consecutiveBlockedVerificationSessions' | 'isCreationTask' | 'outputRoot' | 'workflowVariant' | 'workflowState'>;
41800
+ type RunTaskResumeState = Pick<RunTaskState, 'originalMessage' | 'bootstrapContext' | 'workflowPhase' | 'planPath' | 'planWritten' | 'bestCandidatePath' | 'bestCandidateReason' | 'candidatePaths' | 'recentReadPaths' | 'recentActionKeys' | 'bestCandidateNeedsVerification' | 'bestCandidateVerified' | 'verificationRequired' | 'lastVerificationPassed' | 'consecutiveBlockedVerificationSessions' | 'isCreationTask' | 'outputRoot' | 'workflowVariant' | 'contextCompactionSummaries' | 'contextWindowBaseIndex' | 'workflowState'>;
40328
41801
  /**
40329
41802
  * Callback invoked after each session completes.
40330
41803
  * Return `false` to stop the loop early.
@@ -40339,6 +41812,12 @@ interface RunTaskContextBudgetBreakdown {
40339
41812
  summaryTokens?: number;
40340
41813
  reservedOutputTokens?: number;
40341
41814
  effectiveInputBudgetTokens?: number;
41815
+ /** Estimated tokens in the actual send-view after tool-result reduction. */
41816
+ sendEstimatedInputTokens?: number;
41817
+ /** Tool-result tokens in the actual send-view after tool-result reduction. */
41818
+ sendToolOutputTokens?: number;
41819
+ /** Estimated tokens saved by deriving the send-view from full-fidelity history. */
41820
+ toolOutputReductionTokens?: number;
40342
41821
  estimatedInputTokens: number;
40343
41822
  }
40344
41823
  interface RunTaskContextCompactionEvent {
@@ -40450,6 +41929,15 @@ interface RunTaskOptions {
40450
41929
  * instead of after the session completes.
40451
41930
  */
40452
41931
  hasQueuedUserMessages?: () => boolean;
41932
+ /**
41933
+ * Hard abort for the in-flight task (e.g. user pressed Esc). Aborting
41934
+ * cancels the active session's stream, preserves the cost/tokens observed
41935
+ * so far, persists state via `onSession`, and resolves `runTask` with
41936
+ * status 'paused' (resumable) — it never rejects because of the abort.
41937
+ * In-flight stream cancellation requires the `localTools` streaming path;
41938
+ * other execution paths honor the abort at the next session boundary.
41939
+ */
41940
+ abortSignal?: AbortSignal;
40453
41941
  }
40454
41942
  /**
40455
41943
  * Final result returned by `agents.runTask()`
@@ -40571,7 +42059,9 @@ declare class AgentsEndpoint {
40571
42059
  * // ...
40572
42060
  * ```
40573
42061
  */
40574
- executeStream(id: string, data: AgentExecuteRequest): Promise<Response>;
42062
+ executeStream(id: string, data: AgentExecuteRequest, init?: {
42063
+ signal?: AbortSignal;
42064
+ }): Promise<Response>;
40575
42065
  /**
40576
42066
  * Execute an agent with streaming and callbacks
40577
42067
  *
@@ -40651,10 +42141,21 @@ declare class AgentsEndpoint {
40651
42141
  private normalizeCandidatePath;
40652
42142
  private dedupeNormalizedCandidatePaths;
40653
42143
  /**
40654
- * Compact old tool results based on context mode and window setting.
40655
- * Modifies messages in-place.
42144
+ * Resolve the replay window: the base index sliced off the full history and
42145
+ * the durable summary message that stands in for everything before it.
42146
+ * The base is honored ONLY when the latest summary actually exists —
42147
+ * slicing history with no summary substitute would silently drop prior
42148
+ * context (defensive against states that carried a base but lost their
42149
+ * summaries). The base is also clamped so a stale pointer (fork truncation,
42150
+ * trimmed legacy state) never slices past the end of the array.
42151
+ */
42152
+ private resolveWindowReplay;
42153
+ /**
42154
+ * Derive the message view sent to the model based on context mode and window
42155
+ * setting. This never mutates persisted marathon history; masking/offloading
42156
+ * is a send-time view over the full-fidelity ledger/history.
40656
42157
  */
40657
- private compactToolResults;
42158
+ private deriveToolContextMessages;
40658
42159
  private compactOneResult;
40659
42160
  private isMarathonArtifactPath;
40660
42161
  private isDiscoveryToolName;
@@ -40720,6 +42221,7 @@ declare class AgentsEndpoint {
40720
42221
  private resolveCompactStrategy;
40721
42222
  private estimateTextTokens;
40722
42223
  private estimateUnknownTokens;
42224
+ private extractDeclaredToolResultChars;
40723
42225
  private estimateMessageContentTokens;
40724
42226
  private estimateToolCallTokens;
40725
42227
  private estimateToolResultTokens;
@@ -40730,13 +42232,13 @@ declare class AgentsEndpoint {
40730
42232
  private loadBuiltinToolSchemas;
40731
42233
  private buildDefaultCompactInstructions;
40732
42234
  private resolveCompactInstructions;
42235
+ private extractArtifactReferencesFromMessages;
40733
42236
  private extractArtifactReferences;
40734
42237
  private buildContextBudgetBreakdown;
40735
42238
  private emitContextCompactionEvent;
40736
42239
  private emitContextNotice;
40737
42240
  private buildCompactHistoryMessagesWithLifecycle;
40738
42241
  private buildCompactHistoryMessages;
40739
- private isCompactHistoryMessageSet;
40740
42242
  /**
40741
42243
  * Generate a compact summary of prior work for continuation context.
40742
42244
  * Used when compact mode is enabled to keep token usage low.
@@ -41075,6 +42577,103 @@ declare class BillingEndpoint {
41075
42577
  */
41076
42578
  getSpendAnalytics(params?: BillingSpendAnalyticsParams): Promise<Record<string, unknown>>;
41077
42579
  }
42580
+ /** App manifest (`runtype.app.json`) — mirrors @runtypelabs/shared appManifestSchema. */
42581
+ interface AppManifest {
42582
+ name: string;
42583
+ description?: string;
42584
+ capabilities: {
42585
+ flows: string[];
42586
+ agents: string[];
42587
+ };
42588
+ data: Array<{
42589
+ namespace: string;
42590
+ access: 'read' | 'read-write';
42591
+ }>;
42592
+ auth: 'none' | 'optional' | 'required';
42593
+ }
42594
+ interface App {
42595
+ id: string;
42596
+ slug: string;
42597
+ shortId: string;
42598
+ hostname: string;
42599
+ /** Public origin the app serves from, e.g. https://retro-board-x7k2p9.runtype.run */
42600
+ url: string;
42601
+ name: string;
42602
+ description: string | null;
42603
+ activeVersionId: string | null;
42604
+ visibility: 'public' | 'unlisted';
42605
+ status: 'active' | 'suspended';
42606
+ clientTokenId: string | null;
42607
+ createdAt: string;
42608
+ updatedAt: string;
42609
+ }
42610
+ interface AppVersion {
42611
+ id: string;
42612
+ appId: string;
42613
+ versionNumber: number;
42614
+ bundleHash: string;
42615
+ manifest: AppManifest;
42616
+ sizeBytes: number;
42617
+ fileCount: number;
42618
+ status: 'uploaded' | 'active' | 'superseded';
42619
+ createdBy: string;
42620
+ createdAt: string;
42621
+ }
42622
+ interface CreateAppRequest {
42623
+ /** Lowercase letters, digits, hyphens; must start with a letter; max 40 chars. */
42624
+ slug: string;
42625
+ name: string;
42626
+ description?: string;
42627
+ visibility?: 'public' | 'unlisted';
42628
+ }
42629
+ interface UpdateAppRequest {
42630
+ name?: string;
42631
+ description?: string | null;
42632
+ visibility?: 'public' | 'unlisted';
42633
+ status?: 'active' | 'suspended';
42634
+ }
42635
+ /**
42636
+ * Apps endpoint handlers — Runtype Apps are hosted AI apps served at
42637
+ * {slug}-{shortId}.runtype.run. Deploy = upload a version (zip), then
42638
+ * activate (instant pointer flip); rollback = activate an older version.
42639
+ */
42640
+ declare class AppsEndpoint {
42641
+ private client;
42642
+ constructor(client: ApiClient);
42643
+ /** List apps for the authenticated owner, newest first. */
42644
+ list(): Promise<{
42645
+ data: App[];
42646
+ }>;
42647
+ /** Get an app by id, including its URL and active version pointer. */
42648
+ get(id: string): Promise<App>;
42649
+ /** Create an app. A client token scoped to the app origin is auto-provisioned. */
42650
+ create(data: CreateAppRequest): Promise<App>;
42651
+ /** Update name, description, visibility, or status (suspended serves 410). */
42652
+ update(id: string, data: UpdateAppRequest): Promise<App>;
42653
+ /** Delete an app, its versions, and its hosting. Irreversible. */
42654
+ delete(id: string): Promise<{
42655
+ success: boolean;
42656
+ }>;
42657
+ /** List an app's versions, newest first. */
42658
+ listVersions(id: string): Promise<{
42659
+ data: AppVersion[];
42660
+ }>;
42661
+ /** Upload a zipped bundle (raw application/zip body) as a new version. */
42662
+ uploadVersion(id: string, zipBytes: Uint8Array): Promise<AppVersion>;
42663
+ /**
42664
+ * Upload a bundle from in-memory file maps (the API zips server-side).
42665
+ * Text files in `files`, binary files base64-encoded in `filesBase64`.
42666
+ */
42667
+ uploadVersionFiles(id: string, data: {
42668
+ files: Record<string, string>;
42669
+ filesBase64?: Record<string, string>;
42670
+ }): Promise<AppVersion>;
42671
+ /** Activate an uploaded version (deploy or rollback). */
42672
+ activate(id: string, versionId: string): Promise<{
42673
+ app: App;
42674
+ version: AppVersion;
42675
+ }>;
42676
+ }
41078
42677
 
41079
42678
  /**
41080
42679
  * @layer sdk
@@ -41154,6 +42753,7 @@ declare class RuntypeClient implements ApiClient {
41154
42753
  clientTokens: ClientTokensEndpoint;
41155
42754
  agents: AgentsEndpoint;
41156
42755
  secrets: SecretsEndpoint;
42756
+ apps: AppsEndpoint;
41157
42757
  schedules: SchedulesEndpoint;
41158
42758
  surfaces: SurfacesEndpoint;
41159
42759
  conversations: ConversationsEndpoint;
@@ -41211,6 +42811,10 @@ declare class RuntypeClient implements ApiClient {
41211
42811
  * POST request with FormData support for file uploads
41212
42812
  */
41213
42813
  postFormData<T>(path: string, formData: FormData): Promise<T>;
42814
+ /**
42815
+ * POST request with a raw binary body (e.g. application/zip bundle uploads).
42816
+ */
42817
+ postBinary<T>(path: string, body: Uint8Array, contentType: string): Promise<T>;
41214
42818
  /**
41215
42819
  * Generic request that returns raw Response for streaming
41216
42820
  */
@@ -41259,6 +42863,50 @@ declare class RuntypeApiError extends Error {
41259
42863
  */
41260
42864
  declare function createClient(config?: ClientConfig): RuntypeClient;
41261
42865
 
42866
+ /**
42867
+ * Offload marker contract — the single source of truth for the reference
42868
+ * strings that replace large tool outputs in marathon send views.
42869
+ *
42870
+ * Two producers emit these markers:
42871
+ * - the SDK's hot-tail send-view offload (`AgentsEndpoint.offloadToolResult`)
42872
+ * - the CLI's ledger offload (`packages/cli/src/marathon/context-offload.ts`)
42873
+ *
42874
+ * Two consumers parse them back:
42875
+ * - `extractDeclaredToolResultChars` recovers TRUE output sizes for honest
42876
+ * token accounting (the compaction threshold must see real sizes, not
42877
+ * placeholder sizes — the original "double lossy compression" bug)
42878
+ * - the CLI session chunker re-expands ledger references to full payloads
42879
+ * before semantic indexing
42880
+ *
42881
+ * Because accounting and recall silently degrade when a producer's copy
42882
+ * drifts from a consumer's regex, both sides MUST build and parse through
42883
+ * this module. Do not inline these strings elsewhere.
42884
+ */
42885
+ declare const LEDGER_ARTIFACT_LINE_PREFIX = "Ledger artifact: ";
42886
+ /** SDK hot-tail send-view marker: large tool result replaced by a file pointer. */
42887
+ declare function buildSendViewOffloadMarker(details: {
42888
+ toolName: string;
42889
+ charLength: number;
42890
+ filePath: string;
42891
+ }): string;
42892
+ /** CLI ledger offload reference: content-addressed artifact recorded in the tree log. */
42893
+ declare function buildLedgerOffloadReference(details: {
42894
+ outputId: string;
42895
+ charLength: number;
42896
+ relativePath: string;
42897
+ preview: string;
42898
+ truncated: boolean;
42899
+ }): string;
42900
+ /**
42901
+ * Recover the declared true size from an offload marker. Returns undefined
42902
+ * for values that are not offload markers (or not strings).
42903
+ */
42904
+ declare function extractDeclaredToolResultChars(value: unknown): number | undefined;
42905
+ /** Parse the artifact/output id out of a ledger offload reference. */
42906
+ declare function parseOffloadedOutputId(value: string): string | undefined;
42907
+ /** Parse the tree-log-relative artifact path out of a ledger offload reference. */
42908
+ declare function parseLedgerArtifactRelativePath(value: string): string | undefined;
42909
+
41262
42910
  /**
41263
42911
  * SSE Stream Utilities for FlowBuilder
41264
42912
  *
@@ -42346,6 +43994,227 @@ declare const STEP_TYPE_TO_METHOD: {
42346
43994
  readonly 'memory-summary': "memorySummary";
42347
43995
  };
42348
43996
 
43997
+ /**
43998
+ * Named workflow hook registry.
43999
+ *
44000
+ * Workflow configs (the data form compiled by `compileWorkflowConfig`) can
44001
+ * reference behavior by name instead of carrying functions: `builtin:*` names
44002
+ * are reserved for the hooks that power the default workflow, and consumers
44003
+ * register their own under a custom namespace (e.g. `acme:my-completion`).
44004
+ *
44005
+ * Every hook declares which SLOT KIND it implements so a config that wires a
44006
+ * hook into the wrong slot fails at load/compile time with an actionable
44007
+ * error — not mid-marathon. Hook misfires in this system don't crash, they
44008
+ * stall, which is the worst failure mode to debug.
44009
+ */
44010
+
44011
+ interface WorkflowHookSignatures {
44012
+ /** WorkflowPhase.buildInstructions — used verbatim (no header is added) */
44013
+ instructions: (state: RunTaskStateSlice) => string;
44014
+ /** WorkflowPhase.buildToolGuidance */
44015
+ toolGuidance: (state: RunTaskStateSlice) => string[];
44016
+ /** WorkflowPhase.isComplete */
44017
+ completion: (ctx: WorkflowContext) => boolean;
44018
+ /** WorkflowPhase.buildTransitionSummary */
44019
+ transitionSummary: (state: RunTaskStateSlice, nextPhaseName: string) => string;
44020
+ /** WorkflowPhase.interceptToolCall — may only narrow (block); returning undefined never overrides an outer deny */
44021
+ intercept: (toolName: string, args: Record<string, unknown>, ctx: WorkflowContext) => string | undefined;
44022
+ /** WorkflowPhase.buildRecoveryMessage */
44023
+ recovery: (state: RunTaskStateSlice) => string | undefined;
44024
+ /** WorkflowPhase.shouldForceEndTurn */
44025
+ forceEndTurn: (snapshot: LocalToolExecutionLoopSnapshotSlice, ctx: WorkflowContext) => string | undefined;
44026
+ /** WorkflowPhase.canAcceptCompletion */
44027
+ acceptCompletion: (state: RunTaskStateSlice, trace: RunTaskToolTraceSlice) => boolean;
44028
+ /** WorkflowDefinition.classifyVariant */
44029
+ classify: (message: string) => string | undefined;
44030
+ /** WorkflowDefinition.generateBootstrapContext */
44031
+ bootstrap: (message: string, localTools: Record<string, LocalToolDefinition> | undefined, variant?: string) => Promise<string | undefined>;
44032
+ /** WorkflowDefinition.buildCandidateBlock */
44033
+ candidateBlock: (state: RunTaskStateSlice) => string;
44034
+ }
44035
+ type WorkflowHookKind = keyof WorkflowHookSignatures;
44036
+ interface WorkflowHookEntry<K extends WorkflowHookKind = WorkflowHookKind> {
44037
+ kind: K;
44038
+ fn: WorkflowHookSignatures[K];
44039
+ }
44040
+ /**
44041
+ * A string is a hook reference iff it full-matches `<namespace>:<id>` with
44042
+ * both segments lowercase [a-z0-9_-]. Inline prose (multi-word strings,
44043
+ * paths, sentences) never matches, so config slots can accept either form.
44044
+ */
44045
+ declare function isWorkflowHookRef(value: unknown): value is string;
44046
+ /**
44047
+ * Register a custom workflow hook. The `builtin:` namespace is reserved —
44048
+ * "replacing" a builtin means pointing the config slot at your own hook, not
44049
+ * mutating the registry, so a shipped default config keeps a stable meaning.
44050
+ * Re-registering an existing custom name overwrites it (last write wins
44051
+ * within one process, e.g. plugin reload).
44052
+ */
44053
+ declare function registerWorkflowHook<K extends WorkflowHookKind>(name: string, entry: WorkflowHookEntry<K>): void;
44054
+ /** Resolve a hook by name, validating the slot kind. Throws actionable errors. */
44055
+ declare function resolveWorkflowHook<K extends WorkflowHookKind>(name: string, expectedKind: K): WorkflowHookSignatures[K];
44056
+ /** List registered hooks (name + kind) for error messages and tooling. */
44057
+ declare function listWorkflowHooks(): Array<{
44058
+ name: string;
44059
+ kind: WorkflowHookKind;
44060
+ }>;
44061
+ /** Test seam: remove a custom hook (builtin entries cannot be removed). */
44062
+ declare function unregisterWorkflowHook(name: string): boolean;
44063
+
44064
+ /**
44065
+ * Declarative workflow configs and the compiler that turns them into a
44066
+ * `WorkflowDefinition`.
44067
+ *
44068
+ * This is the single compile path for marathon workflows-as-data: the CLI
44069
+ * playbook loader parses YAML/JSON into a `WorkflowConfig` and delegates here,
44070
+ * and the shipped default workflow is itself a `WorkflowConfig`
44071
+ * (`defaultWorkflowConfig` in default-workflow.ts) compiled through the same
44072
+ * function — so playbooks and the default cannot drift in semantics.
44073
+ *
44074
+ * Each behavior slot accepts either INLINE DATA (strings, declarative
44075
+ * criteria, policy rules) or a HOOK REFERENCE (`"<namespace>:<id>"`, see
44076
+ * hook-registry.ts) resolved against the registry with slot-kind validation
44077
+ * at compile time.
44078
+ *
44079
+ * The compiler is environment-free: no fs, no YAML, no glob library. Glob
44080
+ * matching for policy rules is injected via `WorkflowCompileDeps` (the CLI
44081
+ * passes micromatch); configs that use glob policies without a matcher fail
44082
+ * at compile time with an actionable error.
44083
+ */
44084
+
44085
+ declare const DEFAULT_RECOVERY_AFTER_EMPTY_SESSIONS = 2;
44086
+ /** A `"<namespace>:<id>"` reference into the workflow hook registry. */
44087
+ type WorkflowHookRef = string;
44088
+ interface WorkflowCompletionCriteriaConfig {
44089
+ /** Built-in criteria type, or a 'completion' hook reference */
44090
+ type: 'evidence' | 'sessions' | 'planWritten' | 'never' | WorkflowHookRef;
44091
+ minReadFiles?: number;
44092
+ minSessions?: number;
44093
+ }
44094
+ /**
44095
+ * Every behavior slot accepts inline data, a hook reference, or — for configs
44096
+ * authored in TypeScript (module playbooks, programmatic use) — a plain
44097
+ * function with the slot's hook signature. Functions never round-trip through
44098
+ * JSON/YAML, so declarative playbooks are unaffected.
44099
+ */
44100
+ type WorkflowSlot<K extends keyof WorkflowHookSignatures, Inline = never> = Inline | WorkflowHookRef | WorkflowHookSignatures[K];
44101
+ interface WorkflowRecoveryConfig {
44102
+ /** Inject after N consecutive empty sessions (default 2) */
44103
+ afterEmptySessions?: number;
44104
+ /** Recovery message; supports {{key}} interpolation from run state (e.g. {{planPath}}) */
44105
+ message: string;
44106
+ }
44107
+ /**
44108
+ * Declarative policy for narrowing runtime behavior.
44109
+ * Cannot override global denies (e.g. secret paths). Precedence: global deny > workflow deny > config narrowing.
44110
+ */
44111
+ interface WorkflowPolicyConfig {
44112
+ /** Glob patterns for allowed read paths (e.g. ["src/**", "docs/**"]). If set, reads outside these are blocked. */
44113
+ allowedReadGlobs?: string[];
44114
+ /** Glob patterns for allowed write paths. If set, writes outside these are blocked. */
44115
+ allowedWriteGlobs?: string[];
44116
+ /** Tool names to block (e.g. ["write_file", "search_repo"]). */
44117
+ blockedTools?: string[];
44118
+ /** Require verification before TASK_COMPLETE (consumed by the runner, not the compiler). */
44119
+ requireVerification?: boolean;
44120
+ /** Block discovery tools (search_repo, glob_files, tree_directory, list_directory). */
44121
+ blockDiscoveryTools?: boolean;
44122
+ /** Require plan to be written before any non-plan writes. */
44123
+ requirePlanBeforeWrite?: boolean;
44124
+ /** For creation tasks: allowed write root (e.g. "public/"). Consumed by the runner via state.outputRoot. */
44125
+ outputRoot?: string;
44126
+ }
44127
+ interface WorkflowMilestoneConfig {
44128
+ name: string;
44129
+ description?: string;
44130
+ /**
44131
+ * Inline instructions (interpolated, with a "--- Workflow Phase ---" header
44132
+ * added), an 'instructions' hook reference, or a function (both used verbatim).
44133
+ */
44134
+ instructions: WorkflowSlot<'instructions', string>;
44135
+ /** Inline guidance lines, a 'toolGuidance' hook reference, or a function. Policy-derived guidance is appended either way. */
44136
+ toolGuidance?: WorkflowSlot<'toolGuidance', string[]>;
44137
+ /** Declarative criteria object, or a 'completion' predicate function */
44138
+ completionCriteria?: WorkflowCompletionCriteriaConfig | WorkflowHookSignatures['completion'];
44139
+ /**
44140
+ * Inline boolean, an 'acceptCompletion' hook reference or function, or absent.
44141
+ * NOTE: absent means the slot is omitted from the compiled phase — the SDK
44142
+ * then ACCEPTS completion by default. Loaders that want reject-by-default
44143
+ * (the playbook behavior) must set `false` explicitly before compiling.
44144
+ */
44145
+ canAcceptCompletion?: WorkflowSlot<'acceptCompletion', boolean>;
44146
+ /** Inline recovery (triggered on the consecutive-empty-sessions counter), a 'recovery' hook reference, or a function */
44147
+ recovery?: WorkflowSlot<'recovery', WorkflowRecoveryConfig>;
44148
+ /** Inline summary (supports {{key}} + {{nextPhase}}), a 'transitionSummary' hook reference, or a function */
44149
+ transitionSummary?: WorkflowSlot<'transitionSummary', string>;
44150
+ /** An 'intercept' hook reference or function; runs after the policy intercept and can only narrow further */
44151
+ intercept?: WorkflowSlot<'intercept'>;
44152
+ /** A 'forceEndTurn' hook reference or function */
44153
+ forceEndTurn?: WorkflowSlot<'forceEndTurn'>;
44154
+ /** Per-milestone model override (consumed by the runner, not the compiler) */
44155
+ model?: string;
44156
+ /** Per-milestone fallback models (consumed by the runner, not the compiler) */
44157
+ fallbackModels?: unknown[];
44158
+ }
44159
+ interface WorkflowConfig {
44160
+ name: string;
44161
+ description?: string;
44162
+ stallPolicy?: WorkflowStallPolicy;
44163
+ policy?: WorkflowPolicyConfig;
44164
+ /** A 'classify' hook reference or function */
44165
+ classifyVariant?: WorkflowSlot<'classify'>;
44166
+ /** A 'bootstrap' hook reference or function */
44167
+ bootstrap?: WorkflowSlot<'bootstrap'>;
44168
+ /** A 'candidateBlock' hook reference or function */
44169
+ candidateBlock?: WorkflowSlot<'candidateBlock'>;
44170
+ milestones: WorkflowMilestoneConfig[];
44171
+ /** Runner-level passthrough (verification requirements); ignored by the compiler */
44172
+ verification?: {
44173
+ required: boolean;
44174
+ commands?: string[];
44175
+ };
44176
+ /** Runner-level passthrough (extra rules text); ignored by the compiler */
44177
+ rules?: string;
44178
+ }
44179
+ /**
44180
+ * A module playbook's default export: either a workflow config directly, or a
44181
+ * factory that receives the registration API and returns one. The API is
44182
+ * INJECTED so hooks land in the loading process's registry instance even when
44183
+ * the playbook module would resolve a different copy of @runtypelabs/sdk.
44184
+ */
44185
+ type WorkflowConfigFactory = (api: {
44186
+ registerWorkflowHook: typeof registerWorkflowHook;
44187
+ }) => WorkflowConfig | Promise<WorkflowConfig>;
44188
+ /**
44189
+ * Identity helper for TypeScript playbooks — exists purely for type inference
44190
+ * (the `defineConfig` pattern). Optional: a plain object/function export with
44191
+ * the same shape works identically, so playbook modules don't need
44192
+ * @runtypelabs/sdk installed at runtime.
44193
+ */
44194
+ declare function definePlaybook<T extends WorkflowConfig | WorkflowConfigFactory>(playbook: T): T;
44195
+ interface WorkflowCompileDeps {
44196
+ /**
44197
+ * Glob matcher for policy allowedReadGlobs / allowedWriteGlobs (the CLI
44198
+ * passes micromatch). Required at compile time when the config uses glob
44199
+ * policies; other configs compile without it.
44200
+ */
44201
+ matchPathGlobs?: (path: string, globs: string[]) => boolean;
44202
+ }
44203
+ declare function interpolateWorkflowTemplate(template: string, state: RunTaskStateSlice): string;
44204
+ /**
44205
+ * Generate tool-guidance lines from the policy block so the model is told
44206
+ * what the interceptor enforces. Guidance and enforcement compile from the
44207
+ * same config, so they cannot drift — a silently-enforced constraint teaches
44208
+ * the model that tools "don't work" instead of what the actual rule is.
44209
+ */
44210
+ declare function buildPolicyGuidance(policy?: WorkflowPolicyConfig): string[];
44211
+ /**
44212
+ * Compile a declarative workflow config into a WorkflowDefinition.
44213
+ * Hook references are resolved (and kind-validated) eagerly, so a bad
44214
+ * reference fails here — at load time — with an actionable error.
44215
+ */
44216
+ declare function compileWorkflowConfig(config: WorkflowConfig, deps?: WorkflowCompileDeps): WorkflowDefinition;
44217
+
42349
44218
  /**
42350
44219
  * Default marathon workflow: research → planning → execution.
42351
44220
  *
@@ -42354,6 +44223,23 @@ declare const STEP_TYPE_TO_METHOD: {
42354
44223
  * via the `workflowVariant` / `isCreationTask` flags on state.
42355
44224
  */
42356
44225
 
44226
+ /**
44227
+ * Register the default workflow's behaviors as `builtin:*` hooks. Idempotent.
44228
+ * Importing this module (or anything that pulls in `defaultWorkflow`) calls it
44229
+ * automatically; loaders that compile configs without importing the default
44230
+ * workflow (e.g. the CLI playbook loader) must call it explicitly before
44231
+ * `compileWorkflowConfig` so `builtin:*` references resolve.
44232
+ */
44233
+ declare function ensureDefaultWorkflowHooks(): void;
44234
+ /**
44235
+ * The default workflow expressed as a declarative config over `builtin:*`
44236
+ * hooks. This is the same shape the CLI playbook loader compiles, so a user
44237
+ * playbook can reuse any slice of the default by referencing the same hooks
44238
+ * (e.g. keep `builtin:research-guard` but supply custom execution
44239
+ * instructions). The heuristic logic stays in this file as named builtins;
44240
+ * the composition is data.
44241
+ */
44242
+ declare const defaultWorkflowConfig: WorkflowConfig;
42357
44243
  declare const defaultWorkflow: WorkflowDefinition;
42358
44244
 
42359
44245
  /**
@@ -42397,6 +44283,36 @@ declare const deployWorkflow: WorkflowDefinition;
42397
44283
 
42398
44284
  declare const gameWorkflow: WorkflowDefinition;
42399
44285
 
44286
+ /**
44287
+ * Helpers for WorkflowDefinition.stallPolicy: what happens when an agent
44288
+ * produces consecutive sessions with no tool actions.
44289
+ *
44290
+ * All thresholds count the run-level `consecutiveEmptySessions` counter (a
44291
+ * session is empty when it performed no write/read/discovery/verification
44292
+ * tool action), so narration-only sessions escalate here even though they
44293
+ * carry text output. Absent policy values preserve the legacy behavior:
44294
+ * no nudge, no escalation signal, stop after 3.
44295
+ */
44296
+
44297
+ declare const DEFAULT_STALL_STOP_AFTER = 3;
44298
+ /** Resolve how many consecutive empty sessions end the run as 'stalled'. */
44299
+ declare function resolveStallStopAfter(policy?: WorkflowStallPolicy): number;
44300
+ /**
44301
+ * Whether to raise the model-escalation signal for this empty-session count.
44302
+ * Fires exactly once per stall episode (when the counter reaches the
44303
+ * threshold), so a caller that cannot escalate is not re-signaled every
44304
+ * subsequent empty session.
44305
+ */
44306
+ declare function shouldRequestModelEscalation(policy: WorkflowStallPolicy | undefined, consecutiveEmptySessions: number): boolean;
44307
+ /** Whether the workflow-level empty-session nudge should be injected. */
44308
+ declare function shouldInjectEmptySessionNudge(policy: WorkflowStallPolicy | undefined, consecutiveEmptySessions: number): boolean;
44309
+ /**
44310
+ * Generic recovery nudge used when a phase has no buildRecoveryMessage of its
44311
+ * own (or it returned nothing). Targets the narration-without-tool-calls
44312
+ * failure mode directly.
44313
+ */
44314
+ declare function buildEmptySessionNudge(consecutiveEmptySessions: number): string;
44315
+
42400
44316
  /**
42401
44317
  * Utility functions shared between workflow phase handlers and AgentsEndpoint.
42402
44318
  *
@@ -42414,4 +44330,4 @@ declare function getLikelySupportingCandidatePaths(bestCandidatePath: string | u
42414
44330
  declare function getDefaultPlanPath(taskName: string): string;
42415
44331
  declare function sanitizeTaskSlug(taskName: string): string;
42416
44332
 
42417
- export { type Agent, type AgentApprovalCompleteEvent, type AgentApprovalStartEvent, type AgentCompleteEvent, type AgentErrorEvent, type AgentEvent, type AgentEventType, type AgentExecuteRequest, type AgentExecuteResponse, type AgentIterationCompleteEvent, type AgentIterationStartEvent, type AgentMediaEvent, type AgentMessage, type AgentPausedEvent, type AgentPingEvent, type AgentReflectionEvent, type AgentRuntimeToolDefinition, type AgentStartEvent, type AgentStreamCallbacks, type AgentStreamEvent, type AgentSubagentConfig, type AgentToolCompleteEvent, type AgentToolDeltaEvent, type AgentToolInputCompleteEvent, type AgentToolInputDeltaEvent, type AgentToolStartEvent, type AgentTurnCompleteEvent, type AgentTurnDeltaEvent, type AgentTurnStartEvent, type AgentVersionDetail, type AgentVersionListItem, type AgentVersionPublishResponse, AgentVersionsEndpoint, type AgentVersionsListResponse, AgentsEndpoint, AnalyticsEndpoint, type ApiClient, type ApiKey, ApiKeysEndpoint, type ApiResponse, type ApplyGeneratedProposalOptions, type ApplyGeneratedProposalResult, type AttachRuntimeToolsOptions, type BaseAgentEvent, BatchBuilder, type BatchClient, type BatchListParams, type BatchOptions, type BatchRequest, type BatchResult, type BatchScheduleConfig, type BatchStatus, BatchesNamespace, BillingEndpoint, type BillingSpendAnalyticsParams, type BindSkillInput, type BuiltInTool, type BulkEditCondition, type BulkEditRequest, type BulkEditResponse, type BulkEditResult, ChatEndpoint, ClientBatchBuilder, type ClientConfig, type ClientConversation, ClientEvalBuilder, ClientFlowBuilder, type ClientToken, type ClientTokenConfig, type ClientTokenEnvironment, type ClientTokenVersionPin, ClientTokensEndpoint, type ClientToolDefinition, type ClientWidgetTheme, type ConditionalStepConfig$1 as ConditionalStepConfig, type ContextErrorHandling, type ContextFallback, ContextTemplatesEndpoint, type Conversation, type ConversationListItem, type ConversationListParams, type ConversationMessage, type ConversationSource, ConversationsEndpoint, type ConversationsListResponse, type CreateApiKeyRequest, type CreateClientTokenRequest, type CreateClientTokenResponse, type CreateConversationRequest, type CreateFlowRequest, type CreateModelConfigRequest, type CreatePromptData, type CreatePromptRequest, type CreateProviderKeyRequest, type CreateRecordRequest, type CreateScheduleRequest, type CreateSecretRequest, type CreateToolRequest, type CustomMCPServer, type CustomMCPServerAuth, type CustomToolConfig, type DeployCfSandboxRequest, type DeployCfSandboxResponse, type DeploySandboxRequest, type DeploySandboxResponse, type DiscoveredModel, type DispatchClient, DispatchEndpoint, type DispatchEnvironment, type DispatchEvent, type DispatchOptions$1 as DispatchOptions, type DispatchRequest, type ErrorHandlingMode, EvalBuilder, type EvalClient, EvalEndpoint, type EvalListParams, type EvalOptions, type EvalRecord, type EvalRequest, type EvalResult, type EvalRunConfig, EvalRunner, type EvalStatus, EvalsNamespace, type ExecuteToolRequest, type ExecuteToolResponse, type ExternalAgentContext, type ExternalToolConfig, type FallbackFailEvent, type FallbackStartEvent, type FallbackSuccessEvent, type FallbackTrigger, type FallbackTriggerType, type FallbacksExhaustedEvent, type FallbacksInitiatedEvent, type FetchGitHubStepConfig$1 as FetchGitHubStepConfig, type FetchUrlStepConfig$1 as FetchUrlStepConfig, type FieldFormat, type FileContentPart, type Flow, type FlowAttachment, FlowBuilder, type FlowCompleteEvent, type FlowConfig$1 as FlowConfig, type FlowErrorEvent, type FlowFallback, type FlowListItem, type FlowPausedEvent, FlowResult, type FlowStartEvent, type FlowStep, type FlowStepDefinition, type FlowStepType, FlowStepsEndpoint, type FlowStreamEvent, type FlowSummary, type FlowToolConfig, type FlowValidationClient, type FlowValidationIssue, type FlowValidationResult, type FlowVersionDetail, type FlowVersionListItem, type FlowVersionPublishResponse, FlowVersionsEndpoint, type FlowVersionsListResponse, FlowsEndpoint, FlowsNamespace, type GenerateEmbeddingStepConfig$1 as GenerateEmbeddingStepConfig, type GeneratedRuntimeToolGateDecision, type GeneratedRuntimeToolGateOptions, type ImageContentPart, type Integration, type IntegrationTool, IntegrationsEndpoint, type IntegrationsListResponse, type JSONSchema, type JsonArray, type JsonObject, type JsonPrimitive, type JsonValue, type ListConversationsResponse, type ListParams, type LocalToolConfig, type LocalToolDefinition, type LocalToolExecutionCompleteEvent, type LocalToolExecutionLoopSnapshotSlice, type LocalToolExecutionStartEvent, type LogEntry, type LogQueryParams, type LogQueryResponse, type LogQueryResult, type LogStatsParams, type LogStatsResponse, type LogStatsResult, LogsEndpoint, type Message$1 as Message, type MessageContent, type MessageFallback, type Metadata, type ModelConfig, ModelConfigsEndpoint, type ModelFallback, type ModelOverride, type ModelUsageDetail, type ModelUsageQueryParams, type ModelUsageResponse, type ModelUsageSummary, type ModelUsageTimeSeries, type PaginationResponse, type Prompt$1 as Prompt, type PromptErrorHandling, type PromptFallback, type PromptListParams, type PromptRunOptions, PromptRunner, type PromptStepConfig$1 as PromptStepConfig, PromptsEndpoint, PromptsNamespace, type ProviderApiKey, type ProviderKeyModel, ProviderKeysEndpoint, type ReasoningConfig, type ReasoningContentPart, type ReasoningValue, type RecordConfig$1 as RecordConfig, type RecordFilter, type RecordFilterCondition, type RecordFilterGroup, type RecordFilterOperator, type RecordListItem, type RecordListParams, RecordsEndpoint, type RetrieveRecordStepConfig$1 as RetrieveRecordStepConfig, type RetryFallback, type RunTaskContextBudgetBreakdown, type RunTaskContextCompactionEvent, type RunTaskContextCompactionStrategy, type RunTaskContextNoticeEvent, type RunTaskContinuation, type RunTaskOnContextCompaction, type RunTaskOnContextNotice, type RunTaskOnSession, type RunTaskOptions, type RunTaskResult, type RunTaskResumeState, type RunTaskSessionSummary, type RunTaskState, type RunTaskStateSlice, type RunTaskStatus, type RunTaskToolTraceSlice, type RuntimeCustomToolConfig, type RuntimeExternalToolConfig, type RuntimeFlowToolConfig, type RuntimeLocalToolConfig, type RuntimeSubagentToolConfig, type RuntimeTool, type RuntimeToolConfig, Runtype, type AgentSkillBinding as RuntypeAgentSkillBinding, RuntypeApiError, RuntypeClient, type ConditionalStepConfig as RuntypeConditionalStepConfig, type RuntypeConfig, type FetchGitHubStepConfig as RuntypeFetchGitHubStepConfig, type FetchUrlStepConfig as RuntypeFetchUrlStepConfig, RuntypeFlowBuilder, type FlowConfig as RuntypeFlowConfig, type GenerateEmbeddingStepConfig as RuntypeGenerateEmbeddingStepConfig, type Message as RuntypeMessage, type ModelOverride$1 as RuntypeModelOverride, type Prompt as RuntypePrompt, type PromptStepConfig as RuntypePromptStepConfig, type RuntypeRecord, type RecordConfig as RuntypeRecordConfig, type RetrieveRecordStepConfig as RuntypeRetrieveRecordStepConfig, type SearchStepConfig as RuntypeSearchStepConfig, type SendEmailStepConfig as RuntypeSendEmailStepConfig, type SendEventStepConfig as RuntypeSendEventStepConfig, type SendStreamStepConfig as RuntypeSendStreamStepConfig, type SendTextStepConfig as RuntypeSendTextStepConfig, type SetVariableStepConfig as RuntypeSetVariableStepConfig, type Skill as RuntypeSkill, type SkillCapabilities as RuntypeSkillCapabilities, type SkillFrontmatter as RuntypeSkillFrontmatter, type SkillManifest as RuntypeSkillManifest, type SkillProposal as RuntypeSkillProposal, type SkillRuntypeExtensions as RuntypeSkillRuntypeExtensions, type SkillVersion as RuntypeSkillVersion, type TransformDataStepConfig as RuntypeTransformDataStepConfig, type UpsertFlowConfig as RuntypeUpsertFlowConfig, type UpsertRecordStepConfig as RuntypeUpsertRecordStepConfig, type VectorSearchStepConfig as RuntypeVectorSearchStepConfig, type WaitUntilStepConfig as RuntypeWaitUntilStepConfig, STEP_FIELD_REGISTRY, STEP_TYPE_TO_METHOD, type Schedule, type ScheduleExecutionOptions, type ScheduleListParams, type ScheduleMessage, type ScheduleMessageSet, type ScheduleMessages, type ScheduleMutationResponse, type ScheduleRun, type ScheduleRunNowResponse, type ScheduleStatusResponse, type ScheduleTarget, type ScheduleTrigger, SchedulesEndpoint, type SearchStepConfig$1 as SearchStepConfig, type Secret, type SecretCheckResponse, type SecretDeleteResponse, type SecretSetupUrlRequest, type SecretSetupUrlResponse, SecretsEndpoint, type SendEmailStepConfig$1 as SendEmailStepConfig, type SendEventStepConfig$1 as SendEventStepConfig, type SendStreamStepConfig$1 as SendStreamStepConfig, type SendTextStepConfig$1 as SendTextStepConfig, type SetVariableStepConfig$1 as SetVariableStepConfig, type SkillManifestInput, type SkillMarkdownInput, type SkillOrigin, type SkillProposalStatus, SkillProposalsNamespace, type SkillStatus, type SkillTrustLevel, type SkillVersionStatus, type SkillWithVersion, type SkillWriteInput, SkillsNamespace, type SlackInstallRequest, type StepCompleteEvent, type StepDeltaEvent, type StepFallback, type StepFieldMeta, type StepStartEvent, type StepWaitingLocalEvent, type StreamCallbacks, type StreamEvent, type StreamEventOf, type SubagentToolConfig, type Surface, type SurfaceListParams, SurfacesEndpoint, type TextContentPart, type Tool, type ToolConfig, type ToolWithValidation, type ToolsConfig, ToolsEndpoint, type TransformDataStepConfig$1 as TransformDataStepConfig, type UpdateClientTokenRequest, type UpdateConversationRequest, type UpdatePromptData, type UpdateProviderKeyRequest, type UpdateScheduleRequest, type UpdateSecretRequest, type UpdateToolRequest, type UpdatedFlow, type UpsertFlowConfig$1 as UpsertFlowConfig, type UpsertOptions, type UpsertRecordStepConfig$1 as UpsertRecordStepConfig, type UserProfile, UsersEndpoint, type VectorSearchStepConfig$1 as VectorSearchStepConfig, type VersionType, type WaitUntilStepConfig$1 as WaitUntilStepConfig, type WorkflowContext, type WorkflowDefinition, type WorkflowPhase, applyGeneratedRuntimeToolProposalToDispatchRequest, attachRuntimeToolsToDispatchRequest, buildGeneratedRuntimeToolGateOutput, createClient, createExternalTool, defaultWorkflow, deployWorkflow, evaluateGeneratedRuntimeToolProposal, gameWorkflow, getDefaultPlanPath, getLikelySupportingCandidatePaths, isDiscoveryToolName, isMarathonArtifactPath, isPreservationSensitiveTask, normalizeCandidatePath, parseFinalBuffer, parseSSEChunk, processStream, sanitizeTaskSlug, streamEvents };
44333
+ export { type Agent, type AgentApprovalCompleteEvent, type AgentApprovalStartEvent, type AgentCompleteEvent, type AgentDefinition, type AgentDefinitionConfig, AgentDriftError, AgentEnsureConflictError, type AgentErrorEvent, type AgentEvent, type AgentEventType, type AgentExecuteRequest, type AgentExecuteResponse, type AgentIterationCompleteEvent, type AgentIterationStartEvent, type AgentMediaEvent, type AgentMessage, type AgentPausedEvent, type AgentPingEvent, type AgentPullResult, type AgentReflectionEvent, type AgentRuntimeToolDefinition, type AgentStartEvent, type AgentStreamCallbacks, type AgentStreamEvent, type AgentSubagentConfig, type AgentToolCompleteEvent, type AgentToolDeltaEvent, type AgentToolInputCompleteEvent, type AgentToolInputDeltaEvent, type AgentToolStartEvent, type AgentTurnCompleteEvent, type AgentTurnDeltaEvent, type AgentTurnStartEvent, type AgentVersionDetail, type AgentVersionListItem, type AgentVersionPublishResponse, AgentVersionsEndpoint, type AgentVersionsListResponse, AgentsEndpoint, AgentsNamespace, AnalyticsEndpoint, type ApiClient, type ApiKey, ApiKeysEndpoint, type ApiResponse, type App, type AppManifest, type AppVersion, type ApplyGeneratedProposalOptions, type ApplyGeneratedProposalResult, AppsEndpoint, type AttachRuntimeToolsOptions, type BaseAgentEvent, BatchBuilder, type BatchClient, type BatchListParams, type BatchOptions, type BatchRequest, type BatchResult, type BatchScheduleConfig, type BatchStatus, BatchesNamespace, BillingEndpoint, type BillingSpendAnalyticsParams, type BindSkillInput, type BuiltInTool, type BulkEditCondition, type BulkEditRequest, type BulkEditResponse, type BulkEditResult, ChatEndpoint, ClientBatchBuilder, type ClientConfig, type ClientConversation, ClientEvalBuilder, ClientFlowBuilder, type ClientToken, type ClientTokenConfig, type ClientTokenEnvironment, type ClientTokenVersionPin, ClientTokensEndpoint, type ClientToolDefinition, type ClientWidgetTheme, type ConditionalStepConfig$1 as ConditionalStepConfig, type ContextErrorHandling, type ContextFallback, ContextTemplatesEndpoint, type Conversation, type ConversationListItem, type ConversationListParams, type ConversationMessage, type ConversationSource, ConversationsEndpoint, type ConversationsListResponse, type CreateApiKeyRequest, type CreateAppRequest, type CreateClientTokenRequest, type CreateClientTokenResponse, type CreateConversationRequest, type CreateFlowRequest, type CreateModelConfigRequest, type CreatePromptData, type CreatePromptRequest, type CreateProviderKeyRequest, type CreateRecordRequest, type CreateScheduleRequest, type CreateSecretRequest, type CreateToolRequest, type CustomMCPServer, type CustomMCPServerAuth, type CustomToolConfig, DEFAULT_RECOVERY_AFTER_EMPTY_SESSIONS, DEFAULT_STALL_STOP_AFTER, type DefineAgentInput, type DefineFlowInput, type DeployCfSandboxRequest, type DeployCfSandboxResponse, type DeploySandboxRequest, type DeploySandboxResponse, type DiscoveredModel, type DispatchClient, DispatchEndpoint, type DispatchEnvironment, type DispatchEvent, type DispatchOptions$1 as DispatchOptions, type DispatchRequest, type EnsureAgentConverged, type EnsureAgentOptions, type EnsureAgentPlan, type EnsureAgentResult, type EnsureFlowConverged, type EnsureFlowOptions, type EnsureFlowPlan, type EnsureFlowResult, type ErrorHandlingMode, EvalBuilder, type EvalClient, EvalEndpoint, type EvalListParams, type EvalOptions, type EvalRecord, type EvalRequest, type EvalResult, type EvalRunConfig, EvalRunner, type EvalStatus, EvalsNamespace, type ExecuteToolRequest, type ExecuteToolResponse, type ExternalAgentContext, type ExternalToolConfig, type FallbackFailEvent, type FallbackStartEvent, type FallbackSuccessEvent, type FallbackTrigger, type FallbackTriggerType, type FallbacksExhaustedEvent, type FallbacksInitiatedEvent, type FetchGitHubStepConfig$1 as FetchGitHubStepConfig, type FetchUrlStepConfig$1 as FetchUrlStepConfig, type FieldFormat, type FileContentPart, type Flow, type FlowAttachment, FlowBuilder, type FlowCompleteEvent, type FlowConfig$1 as FlowConfig, type FlowDefinition, type FlowDefinitionStep, FlowDriftError, FlowEnsureConflictError, type FlowErrorEvent, type FlowFallback, type FlowListItem, type FlowPausedEvent, type FlowPullResult, FlowResult, type FlowStartEvent, type FlowStep, type FlowStepDefinition, type FlowStepType, FlowStepsEndpoint, type FlowStreamEvent, type FlowSummary, type FlowToolConfig, type FlowValidationClient, type FlowValidationIssue, type FlowValidationResult, type FlowVersionDetail, type FlowVersionListItem, type FlowVersionPublishResponse, FlowVersionsEndpoint, type FlowVersionsListResponse, FlowsEndpoint, FlowsNamespace, type GenerateEmbeddingStepConfig$1 as GenerateEmbeddingStepConfig, type GeneratedRuntimeToolGateDecision, type GeneratedRuntimeToolGateOptions, type ImageContentPart, type Integration, type IntegrationTool, IntegrationsEndpoint, type IntegrationsListResponse, type JSONSchema, type JsonArray, type JsonObject, type JsonPrimitive, type JsonValue, LEDGER_ARTIFACT_LINE_PREFIX, type ListConversationsResponse, type ListParams, type LocalToolConfig, type LocalToolDefinition, type LocalToolExecutionCompleteEvent, type LocalToolExecutionLoopSnapshotSlice, type LocalToolExecutionStartEvent, type LogEntry, type LogQueryParams, type LogQueryResponse, type LogQueryResult, type LogStatsParams, type LogStatsResponse, type LogStatsResult, LogsEndpoint, type Message$1 as Message, type MessageContent, type MessageFallback, type Metadata, type ModelConfig, ModelConfigsEndpoint, type ModelFallback, type ModelOverride, type ModelUsageDetail, type ModelUsageQueryParams, type ModelUsageResponse, type ModelUsageSummary, type ModelUsageTimeSeries, type PaginationResponse, type Prompt$1 as Prompt, type PromptErrorHandling, type PromptFallback, type PromptListParams, type PromptRunOptions, PromptRunner, type PromptStepConfig$1 as PromptStepConfig, PromptsEndpoint, PromptsNamespace, type ProviderApiKey, type ProviderKeyModel, ProviderKeysEndpoint, type ReasoningConfig, type ReasoningContentPart, type ReasoningValue, type RecordConfig$1 as RecordConfig, type RecordFilter, type RecordFilterCondition, type RecordFilterGroup, type RecordFilterOperator, type RecordListItem, type RecordListParams, RecordsEndpoint, type RetrieveRecordStepConfig$1 as RetrieveRecordStepConfig, type RetryFallback, type RunTaskContextBudgetBreakdown, type RunTaskContextCompactionEvent, type RunTaskContextCompactionStrategy, type RunTaskContextNoticeEvent, type RunTaskContextSummaryEntry, type RunTaskContinuation, type RunTaskOnContextCompaction, type RunTaskOnContextNotice, type RunTaskOnSession, type RunTaskOptions, type RunTaskResult, type RunTaskResumeState, type RunTaskSessionSummary, type RunTaskState, type RunTaskStateSlice, type RunTaskStatus, type RunTaskToolTraceSlice, type RuntimeCustomToolConfig, type RuntimeExternalToolConfig, type RuntimeFlowToolConfig, type RuntimeLocalToolConfig, type RuntimeSubagentToolConfig, type RuntimeTool, type RuntimeToolConfig, Runtype, type AgentSkillBinding as RuntypeAgentSkillBinding, RuntypeApiError, RuntypeClient, type ConditionalStepConfig as RuntypeConditionalStepConfig, type RuntypeConfig, type FetchGitHubStepConfig as RuntypeFetchGitHubStepConfig, type FetchUrlStepConfig as RuntypeFetchUrlStepConfig, RuntypeFlowBuilder, type FlowConfig as RuntypeFlowConfig, type GenerateEmbeddingStepConfig as RuntypeGenerateEmbeddingStepConfig, type Message as RuntypeMessage, type ModelOverride$1 as RuntypeModelOverride, type Prompt as RuntypePrompt, type PromptStepConfig as RuntypePromptStepConfig, type RuntypeRecord, type RecordConfig as RuntypeRecordConfig, type RetrieveRecordStepConfig as RuntypeRetrieveRecordStepConfig, type SearchStepConfig as RuntypeSearchStepConfig, type SendEmailStepConfig as RuntypeSendEmailStepConfig, type SendEventStepConfig as RuntypeSendEventStepConfig, type SendStreamStepConfig as RuntypeSendStreamStepConfig, type SendTextStepConfig as RuntypeSendTextStepConfig, type SetVariableStepConfig as RuntypeSetVariableStepConfig, type Skill as RuntypeSkill, type SkillCapabilities as RuntypeSkillCapabilities, type SkillFrontmatter as RuntypeSkillFrontmatter, type SkillManifest as RuntypeSkillManifest, type SkillProposal as RuntypeSkillProposal, type SkillRuntypeExtensions as RuntypeSkillRuntypeExtensions, type SkillVersion as RuntypeSkillVersion, type TransformDataStepConfig as RuntypeTransformDataStepConfig, type UpsertFlowConfig as RuntypeUpsertFlowConfig, type UpsertRecordStepConfig as RuntypeUpsertRecordStepConfig, type VectorSearchStepConfig as RuntypeVectorSearchStepConfig, type WaitUntilStepConfig as RuntypeWaitUntilStepConfig, STEP_FIELD_REGISTRY, STEP_TYPE_TO_METHOD, type Schedule, type ScheduleExecutionOptions, type ScheduleListParams, type ScheduleMessage, type ScheduleMessageSet, type ScheduleMessages, type ScheduleMutationResponse, type ScheduleRun, type ScheduleRunNowResponse, type ScheduleStatusResponse, type ScheduleTarget, type ScheduleTrigger, SchedulesEndpoint, type SearchStepConfig$1 as SearchStepConfig, type Secret, type SecretCheckResponse, type SecretDeleteResponse, type SecretSetupUrlRequest, type SecretSetupUrlResponse, SecretsEndpoint, type SendEmailStepConfig$1 as SendEmailStepConfig, type SendEventStepConfig$1 as SendEventStepConfig, type SendStreamStepConfig$1 as SendStreamStepConfig, type SendTextStepConfig$1 as SendTextStepConfig, type SetVariableStepConfig$1 as SetVariableStepConfig, type SkillListPage, type SkillListPagination, type SkillListParams, type SkillManifestInput, type SkillMarkdownInput, type SkillOrigin, type SkillProposalStatus, SkillProposalsNamespace, type SkillStatus, type SkillTrustLevel, type SkillVersionStatus, type SkillWithVersion, type SkillWriteInput, SkillsNamespace, type SlackInstallRequest, type StepCompleteEvent, type StepDeltaEvent, type StepFallback, type StepFieldMeta, type StepStartEvent, type StepWaitingLocalEvent, type StreamCallbacks, type StreamEvent, type StreamEventOf, type SubagentToolConfig, type Surface, type SurfaceListParams, SurfacesEndpoint, type TextContentPart, type Tool, type ToolConfig, type ToolWithValidation, type ToolsConfig, ToolsEndpoint, type TransformDataStepConfig$1 as TransformDataStepConfig, type UpdateAppRequest, type UpdateClientTokenRequest, type UpdateConversationRequest, type UpdatePromptData, type UpdateProviderKeyRequest, type UpdateScheduleRequest, type UpdateSecretRequest, type UpdateToolRequest, type UpdatedFlow, type UpsertFlowConfig$1 as UpsertFlowConfig, type UpsertOptions, type UpsertRecordStepConfig$1 as UpsertRecordStepConfig, type UserProfile, UsersEndpoint, type VectorSearchStepConfig$1 as VectorSearchStepConfig, type VersionType, type WaitUntilStepConfig$1 as WaitUntilStepConfig, type WorkflowCompileDeps, type WorkflowCompletionCriteriaConfig, type WorkflowConfig, type WorkflowConfigFactory, type WorkflowContext, type WorkflowDefinition, type WorkflowHookEntry, type WorkflowHookKind, type WorkflowHookRef, type WorkflowHookSignatures, type WorkflowMilestoneConfig, type WorkflowPhase, type WorkflowPolicyConfig, type WorkflowRecoveryConfig, type WorkflowSlot, type WorkflowStallPolicy, applyGeneratedRuntimeToolProposalToDispatchRequest, attachRuntimeToolsToDispatchRequest, buildEmptySessionNudge, buildGeneratedRuntimeToolGateOutput, buildLedgerOffloadReference, buildPolicyGuidance, buildSendViewOffloadMarker, compileWorkflowConfig, computeAgentContentHash, computeFlowContentHash, createClient, createExternalTool, defaultWorkflow, defaultWorkflowConfig, defineAgent, defineFlow, definePlaybook, deployWorkflow, ensureDefaultWorkflowHooks, evaluateGeneratedRuntimeToolProposal, extractDeclaredToolResultChars, gameWorkflow, getDefaultPlanPath, getLikelySupportingCandidatePaths, interpolateWorkflowTemplate, isDiscoveryToolName, isMarathonArtifactPath, isPreservationSensitiveTask, isWorkflowHookRef, listWorkflowHooks, normalizeAgentDefinition, normalizeCandidatePath, parseFinalBuffer, parseLedgerArtifactRelativePath, parseOffloadedOutputId, parseSSEChunk, processStream, registerWorkflowHook, resolveStallStopAfter, resolveWorkflowHook, sanitizeTaskSlug, shouldInjectEmptySessionNudge, shouldRequestModelEscalation, streamEvents, unregisterWorkflowHook };