@runtypelabs/sdk 4.10.0 → 4.12.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
@@ -4520,6 +4520,131 @@ interface paths {
4520
4520
  patch?: never;
4521
4521
  trace?: never;
4522
4522
  };
4523
+ "/v1/assets/{assetId}/extend": {
4524
+ parameters: {
4525
+ query?: never;
4526
+ header?: never;
4527
+ path?: never;
4528
+ cookie?: never;
4529
+ };
4530
+ get?: never;
4531
+ put?: never;
4532
+ /**
4533
+ * Extend preview expiry
4534
+ * @description Re-up a preview page's expiration, keeping the same URL. Defaults to the caller's current plan TTL; pass `expiresInSeconds` to choose a shorter lifetime (the plan TTL is a hard ceiling — longer requests are clamped). Works on live previews and on previews that have already expired (expired pages keep their stored content; only serving is blocked). Applies to preview-rendering assets created by `publish_page` — download assets are not time-gated at the serving layer and cannot be extended.
4535
+ */
4536
+ post: {
4537
+ parameters: {
4538
+ query?: never;
4539
+ header?: never;
4540
+ path: {
4541
+ /** @description Asset ID (e.g. "asset_01k…"). A trailing file extension (".html") is ignored. */
4542
+ assetId: string;
4543
+ };
4544
+ cookie?: never;
4545
+ };
4546
+ requestBody?: {
4547
+ content: {
4548
+ "application/json": {
4549
+ /** @description New lifetime in seconds (positive integer). Capped at the plan's preview TTL — shorter is honored, longer is clamped. Omit for the plan default. */
4550
+ expiresInSeconds?: number;
4551
+ } & {
4552
+ [key: string]: unknown;
4553
+ };
4554
+ };
4555
+ };
4556
+ responses: {
4557
+ /** @description Expiry extended */
4558
+ 200: {
4559
+ headers: {
4560
+ [name: string]: unknown;
4561
+ };
4562
+ content: {
4563
+ "application/json": {
4564
+ /** @description The asset ID that was extended. */
4565
+ assetId: string;
4566
+ /** @description New expiration timestamp (ISO 8601). null = permanent (plan grants no-expiry previews). */
4567
+ expiresAt: string | null;
4568
+ /** @description Seconds until the new expiration. null = permanent. */
4569
+ expiresIn: number | null;
4570
+ /** @enum {string} */
4571
+ rendering: "preview";
4572
+ /** @description The public URL of the asset (unchanged by extension). */
4573
+ url: string;
4574
+ };
4575
+ };
4576
+ };
4577
+ /** @description Asset is not a preview asset */
4578
+ 400: {
4579
+ headers: {
4580
+ [name: string]: unknown;
4581
+ };
4582
+ content: {
4583
+ "application/json": components["schemas"]["Error"];
4584
+ };
4585
+ };
4586
+ /** @description Unauthorized */
4587
+ 401: {
4588
+ headers: {
4589
+ [name: string]: unknown;
4590
+ };
4591
+ content: {
4592
+ "application/json": components["schemas"]["Error"];
4593
+ };
4594
+ };
4595
+ /** @description Insufficient permissions */
4596
+ 403: {
4597
+ headers: {
4598
+ [name: string]: unknown;
4599
+ };
4600
+ content: {
4601
+ "application/json": components["schemas"]["Error"];
4602
+ };
4603
+ };
4604
+ /** @description Asset not found */
4605
+ 404: {
4606
+ headers: {
4607
+ [name: string]: unknown;
4608
+ };
4609
+ content: {
4610
+ "application/json": components["schemas"]["Error"];
4611
+ };
4612
+ };
4613
+ /** @description Stored content no longer exists */
4614
+ 410: {
4615
+ headers: {
4616
+ [name: string]: unknown;
4617
+ };
4618
+ content: {
4619
+ "application/json": components["schemas"]["Error"];
4620
+ };
4621
+ };
4622
+ /** @description Internal server error */
4623
+ 500: {
4624
+ headers: {
4625
+ [name: string]: unknown;
4626
+ };
4627
+ content: {
4628
+ "application/json": components["schemas"]["Error"];
4629
+ };
4630
+ };
4631
+ /** @description Asset storage not configured */
4632
+ 503: {
4633
+ headers: {
4634
+ [name: string]: unknown;
4635
+ };
4636
+ content: {
4637
+ "application/json": components["schemas"]["Error"];
4638
+ };
4639
+ };
4640
+ };
4641
+ };
4642
+ delete?: never;
4643
+ options?: never;
4644
+ head?: never;
4645
+ patch?: never;
4646
+ trace?: never;
4647
+ };
4523
4648
  "/v1/assets/{orgId}/{assetId}": {
4524
4649
  parameters: {
4525
4650
  query?: never;
@@ -5446,6 +5571,7 @@ interface paths {
5446
5571
  maxMessagesPerSession: number | null;
5447
5572
  name: string | null;
5448
5573
  pinToVersion: string | null;
5574
+ productSurfaceId?: string | null;
5449
5575
  rateLimitPerHour: number | null;
5450
5576
  rateLimitPerMinute: number | null;
5451
5577
  sessionIdleTimeoutMinutes: number | null;
@@ -5557,6 +5683,7 @@ interface paths {
5557
5683
  maxMessagesPerSession: number | null;
5558
5684
  name: string | null;
5559
5685
  pinToVersion: string | null;
5686
+ productSurfaceId?: string | null;
5560
5687
  rateLimitPerHour: number | null;
5561
5688
  rateLimitPerMinute: number | null;
5562
5689
  sessionIdleTimeoutMinutes: number | null;
@@ -5673,6 +5800,7 @@ interface paths {
5673
5800
  maxMessagesPerSession: number | null;
5674
5801
  name: string | null;
5675
5802
  pinToVersion: string | null;
5803
+ productSurfaceId?: string | null;
5676
5804
  rateLimitPerHour: number | null;
5677
5805
  rateLimitPerMinute: number | null;
5678
5806
  sessionIdleTimeoutMinutes: number | null;
@@ -5790,6 +5918,7 @@ interface paths {
5790
5918
  maxMessagesPerSession: number | null;
5791
5919
  name: string | null;
5792
5920
  pinToVersion: string | null;
5921
+ productSurfaceId?: string | null;
5793
5922
  rateLimitPerHour: number | null;
5794
5923
  rateLimitPerMinute: number | null;
5795
5924
  sessionIdleTimeoutMinutes: number | null;
@@ -21179,7 +21308,7 @@ interface paths {
21179
21308
  /** @enum {string} */
21180
21309
  status?: "draft" | "active" | "paused";
21181
21310
  /** @enum {string} */
21182
- type: "chat" | "mcp" | "mcp_code" | "api" | "webhook" | "schedule" | "a2a" | "email" | "slack" | "sms" | "imessage" | "discord" | "whatsapp" | "telegram" | "hosted-page";
21311
+ type: "chat" | "mcp" | "mcp_code" | "api" | "webhook" | "schedule" | "a2a" | "email" | "slack" | "sms" | "imessage" | "discord" | "whatsapp" | "telegram" | "hosted-page" | "chrome_extension";
21183
21312
  };
21184
21313
  };
21185
21314
  };
@@ -31958,6 +32087,7 @@ interface paths {
31958
32087
  description: string | null;
31959
32088
  id: string;
31960
32089
  isActive: boolean;
32090
+ lastModifiedSource?: string | null;
31961
32091
  name: string;
31962
32092
  organizationId: string | null;
31963
32093
  parametersSchema?: {
@@ -32295,7 +32425,7 @@ interface paths {
32295
32425
  patch?: never;
32296
32426
  trace?: never;
32297
32427
  };
32298
- "/v1/tools/flows/{flowId}/convert-to-tool": {
32428
+ "/v1/tools/ensure": {
32299
32429
  parameters: {
32300
32430
  query?: never;
32301
32431
  header?: never;
@@ -32305,60 +32435,48 @@ interface paths {
32305
32435
  get?: never;
32306
32436
  put?: never;
32307
32437
  /**
32308
- * Convert flow to tool
32309
- * @description Create a flow-type tool from an existing flow, generating its parameters schema from the flow steps.
32438
+ * Ensure tool (config-as-code converge)
32439
+ * @description Idempotently converge a repo-defined tool 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 tool or update it when the canonical content hash differs. The response always carries the server-computed canonical hash. Set dryRun to plan without writing (CI drift gate), and onConflict: "overwrite" to converge over dashboard/API edits. Tools have no version snapshots, so there is no publish option.
32310
32440
  */
32311
32441
  post: {
32312
32442
  parameters: {
32313
32443
  query?: never;
32314
32444
  header?: never;
32315
- path: {
32316
- flowId: string;
32317
- };
32445
+ path?: never;
32318
32446
  cookie?: never;
32319
32447
  };
32320
32448
  requestBody?: {
32321
32449
  content: {
32322
32450
  "application/json": {
32323
- [key: string]: unknown;
32451
+ contentHash?: string;
32452
+ definition?: {
32453
+ config: {
32454
+ [key: string]: unknown;
32455
+ };
32456
+ description: string;
32457
+ name: string;
32458
+ parametersSchema: {
32459
+ [key: string]: unknown;
32460
+ };
32461
+ /** @enum {string} */
32462
+ toolType: "flow" | "custom" | "external" | "graphql" | "mcp" | "local" | "subagent";
32463
+ };
32464
+ dryRun?: boolean;
32465
+ expectedRemoteHash?: string;
32466
+ name: string;
32467
+ /** @enum {string} */
32468
+ onConflict?: "error" | "overwrite";
32324
32469
  };
32325
32470
  };
32326
32471
  };
32327
32472
  responses: {
32328
- /** @description Created tool */
32473
+ /** @description Converge result: unchanged | created | updated | definitionRequired (hash miss — retry with the full definition) | plan (dryRun) */
32329
32474
  200: {
32330
32475
  headers: {
32331
32476
  [name: string]: unknown;
32332
32477
  };
32333
32478
  content: {
32334
- "application/json": {
32335
- config: {
32336
- [key: string]: unknown;
32337
- } | null;
32338
- createdAt: string;
32339
- description: string | null;
32340
- id: string;
32341
- isActive: boolean;
32342
- name: string;
32343
- organizationId: string | null;
32344
- parametersSchema?: {
32345
- [key: string]: unknown;
32346
- };
32347
- toolType: string;
32348
- updatedAt: string;
32349
- userId: string;
32350
- validation?: {
32351
- warnings: {
32352
- code: string;
32353
- column?: number;
32354
- line?: number;
32355
- message: string;
32356
- /** @enum {string} */
32357
- severity: "error" | "warning";
32358
- suggestion?: string;
32359
- }[];
32360
- };
32361
- };
32479
+ "application/json": components["schemas"]["ToolEnsureResponse"];
32362
32480
  };
32363
32481
  };
32364
32482
  /** @description Validation error */
@@ -32388,13 +32506,22 @@ interface paths {
32388
32506
  "application/json": components["schemas"]["Error"];
32389
32507
  };
32390
32508
  };
32391
- /** @description Flow not found */
32392
- 404: {
32509
+ /** @description Conflict: external_modification (last write was not ensure; pass onConflict: "overwrite") or remote_changed (expectedRemoteHash guard) */
32510
+ 409: {
32393
32511
  headers: {
32394
32512
  [name: string]: unknown;
32395
32513
  };
32396
32514
  content: {
32397
- "application/json": components["schemas"]["Error"];
32515
+ "application/json": components["schemas"]["ToolEnsureConflict"];
32516
+ };
32517
+ };
32518
+ /** @description Submitted contentHash does not match the server-recomputed canonical hash */
32519
+ 422: {
32520
+ headers: {
32521
+ [name: string]: unknown;
32522
+ };
32523
+ content: {
32524
+ "application/json": components["schemas"]["ToolEnsureHashMismatch"];
32398
32525
  };
32399
32526
  };
32400
32527
  /** @description Internal server error */
@@ -32414,7 +32541,7 @@ interface paths {
32414
32541
  patch?: never;
32415
32542
  trace?: never;
32416
32543
  };
32417
- "/v1/tools/sandbox/cf-sandbox/deploy": {
32544
+ "/v1/tools/flows/{flowId}/convert-to-tool": {
32418
32545
  parameters: {
32419
32546
  query?: never;
32420
32547
  header?: never;
@@ -32424,14 +32551,16 @@ interface paths {
32424
32551
  get?: never;
32425
32552
  put?: never;
32426
32553
  /**
32427
- * Deploy Runtype Sandbox
32428
- * @description Deploy code to a persistent Runtype Sandbox container and return a preview URL.
32554
+ * Convert flow to tool
32555
+ * @description Create a flow-type tool from an existing flow, generating its parameters schema from the flow steps.
32429
32556
  */
32430
32557
  post: {
32431
32558
  parameters: {
32432
32559
  query?: never;
32433
32560
  header?: never;
32434
- path?: never;
32561
+ path: {
32562
+ flowId: string;
32563
+ };
32435
32564
  cookie?: never;
32436
32565
  };
32437
32566
  requestBody?: {
@@ -32442,19 +32571,40 @@ interface paths {
32442
32571
  };
32443
32572
  };
32444
32573
  responses: {
32445
- /** @description Sandbox deployment result */
32574
+ /** @description Created tool */
32446
32575
  200: {
32447
32576
  headers: {
32448
32577
  [name: string]: unknown;
32449
32578
  };
32450
32579
  content: {
32451
32580
  "application/json": {
32452
- error?: string;
32453
- output?: string;
32454
- previewUrl?: string;
32455
- sandboxId: string;
32456
- stage?: string;
32457
- status: string;
32581
+ config: {
32582
+ [key: string]: unknown;
32583
+ } | null;
32584
+ createdAt: string;
32585
+ description: string | null;
32586
+ id: string;
32587
+ isActive: boolean;
32588
+ lastModifiedSource?: string | null;
32589
+ name: string;
32590
+ organizationId: string | null;
32591
+ parametersSchema?: {
32592
+ [key: string]: unknown;
32593
+ };
32594
+ toolType: string;
32595
+ updatedAt: string;
32596
+ userId: string;
32597
+ validation?: {
32598
+ warnings: {
32599
+ code: string;
32600
+ column?: number;
32601
+ line?: number;
32602
+ message: string;
32603
+ /** @enum {string} */
32604
+ severity: "error" | "warning";
32605
+ suggestion?: string;
32606
+ }[];
32607
+ };
32458
32608
  };
32459
32609
  };
32460
32610
  };
@@ -32485,6 +32635,15 @@ interface paths {
32485
32635
  "application/json": components["schemas"]["Error"];
32486
32636
  };
32487
32637
  };
32638
+ /** @description Flow not found */
32639
+ 404: {
32640
+ headers: {
32641
+ [name: string]: unknown;
32642
+ };
32643
+ content: {
32644
+ "application/json": components["schemas"]["Error"];
32645
+ };
32646
+ };
32488
32647
  /** @description Internal server error */
32489
32648
  500: {
32490
32649
  headers: {
@@ -32502,40 +32661,35 @@ interface paths {
32502
32661
  patch?: never;
32503
32662
  trace?: never;
32504
32663
  };
32505
- "/v1/tools/sandbox/cf-sandbox/{sandboxId}": {
32664
+ "/v1/tools/pull": {
32506
32665
  parameters: {
32507
32666
  query?: never;
32508
32667
  header?: never;
32509
32668
  path?: never;
32510
32669
  cookie?: never;
32511
32670
  };
32512
- get?: never;
32513
- put?: never;
32514
- post?: never;
32515
32671
  /**
32516
- * Cleanup Runtype Sandbox
32517
- * @description Cleanup a deployed Runtype Sandbox container.
32672
+ * Pull tool definition (config-as-code)
32673
+ * @description Return the canonical config-as-code definition and provenance for a tool by name — the absorb-drift direction of the ensure protocol. The contentHash is recomputed from the live tool state, so it is accurate even immediately after a dashboard edit.
32518
32674
  */
32519
- delete: {
32675
+ get: {
32520
32676
  parameters: {
32521
- query?: never;
32522
- header?: never;
32523
- path: {
32524
- sandboxId: string;
32677
+ query: {
32678
+ name: string;
32525
32679
  };
32680
+ header?: never;
32681
+ path?: never;
32526
32682
  cookie?: never;
32527
32683
  };
32528
32684
  requestBody?: never;
32529
32685
  responses: {
32530
- /** @description Sandbox cleaned up */
32686
+ /** @description Canonical definition + provenance */
32531
32687
  200: {
32532
32688
  headers: {
32533
32689
  [name: string]: unknown;
32534
32690
  };
32535
32691
  content: {
32536
- "application/json": {
32537
- success: boolean;
32538
- };
32692
+ "application/json": components["schemas"]["ToolPullResponse"];
32539
32693
  };
32540
32694
  };
32541
32695
  /** @description Unauthorized */
@@ -32556,6 +32710,15 @@ interface paths {
32556
32710
  "application/json": components["schemas"]["Error"];
32557
32711
  };
32558
32712
  };
32713
+ /** @description No tool with that name in the account scope */
32714
+ 404: {
32715
+ headers: {
32716
+ [name: string]: unknown;
32717
+ };
32718
+ content: {
32719
+ "application/json": components["schemas"]["Error"];
32720
+ };
32721
+ };
32559
32722
  /** @description Internal server error */
32560
32723
  500: {
32561
32724
  headers: {
@@ -32567,12 +32730,15 @@ interface paths {
32567
32730
  };
32568
32731
  };
32569
32732
  };
32733
+ put?: never;
32734
+ post?: never;
32735
+ delete?: never;
32570
32736
  options?: never;
32571
32737
  head?: never;
32572
32738
  patch?: never;
32573
32739
  trace?: never;
32574
32740
  };
32575
- "/v1/tools/sandbox/deploy": {
32741
+ "/v1/tools/sandbox/cf-sandbox/deploy": {
32576
32742
  parameters: {
32577
32743
  query?: never;
32578
32744
  header?: never;
@@ -32582,8 +32748,166 @@ interface paths {
32582
32748
  get?: never;
32583
32749
  put?: never;
32584
32750
  /**
32585
- * Deploy Daytona sandbox
32586
- * @description Deploy code to a persistent Daytona sandbox and return a preview URL.
32751
+ * Deploy Runtype Sandbox
32752
+ * @description Deploy code to a persistent Runtype Sandbox container and return a preview URL.
32753
+ */
32754
+ post: {
32755
+ parameters: {
32756
+ query?: never;
32757
+ header?: never;
32758
+ path?: never;
32759
+ cookie?: never;
32760
+ };
32761
+ requestBody?: {
32762
+ content: {
32763
+ "application/json": {
32764
+ [key: string]: unknown;
32765
+ };
32766
+ };
32767
+ };
32768
+ responses: {
32769
+ /** @description Sandbox deployment result */
32770
+ 200: {
32771
+ headers: {
32772
+ [name: string]: unknown;
32773
+ };
32774
+ content: {
32775
+ "application/json": {
32776
+ error?: string;
32777
+ output?: string;
32778
+ previewUrl?: string;
32779
+ sandboxId: string;
32780
+ stage?: string;
32781
+ status: string;
32782
+ };
32783
+ };
32784
+ };
32785
+ /** @description Validation error */
32786
+ 400: {
32787
+ headers: {
32788
+ [name: string]: unknown;
32789
+ };
32790
+ content: {
32791
+ "application/json": components["schemas"]["Error"];
32792
+ };
32793
+ };
32794
+ /** @description Unauthorized */
32795
+ 401: {
32796
+ headers: {
32797
+ [name: string]: unknown;
32798
+ };
32799
+ content: {
32800
+ "application/json": components["schemas"]["Error"];
32801
+ };
32802
+ };
32803
+ /** @description Insufficient permissions */
32804
+ 403: {
32805
+ headers: {
32806
+ [name: string]: unknown;
32807
+ };
32808
+ content: {
32809
+ "application/json": components["schemas"]["Error"];
32810
+ };
32811
+ };
32812
+ /** @description Internal server error */
32813
+ 500: {
32814
+ headers: {
32815
+ [name: string]: unknown;
32816
+ };
32817
+ content: {
32818
+ "application/json": components["schemas"]["Error"];
32819
+ };
32820
+ };
32821
+ };
32822
+ };
32823
+ delete?: never;
32824
+ options?: never;
32825
+ head?: never;
32826
+ patch?: never;
32827
+ trace?: never;
32828
+ };
32829
+ "/v1/tools/sandbox/cf-sandbox/{sandboxId}": {
32830
+ parameters: {
32831
+ query?: never;
32832
+ header?: never;
32833
+ path?: never;
32834
+ cookie?: never;
32835
+ };
32836
+ get?: never;
32837
+ put?: never;
32838
+ post?: never;
32839
+ /**
32840
+ * Cleanup Runtype Sandbox
32841
+ * @description Cleanup a deployed Runtype Sandbox container.
32842
+ */
32843
+ delete: {
32844
+ parameters: {
32845
+ query?: never;
32846
+ header?: never;
32847
+ path: {
32848
+ sandboxId: string;
32849
+ };
32850
+ cookie?: never;
32851
+ };
32852
+ requestBody?: never;
32853
+ responses: {
32854
+ /** @description Sandbox cleaned up */
32855
+ 200: {
32856
+ headers: {
32857
+ [name: string]: unknown;
32858
+ };
32859
+ content: {
32860
+ "application/json": {
32861
+ success: boolean;
32862
+ };
32863
+ };
32864
+ };
32865
+ /** @description Unauthorized */
32866
+ 401: {
32867
+ headers: {
32868
+ [name: string]: unknown;
32869
+ };
32870
+ content: {
32871
+ "application/json": components["schemas"]["Error"];
32872
+ };
32873
+ };
32874
+ /** @description Insufficient permissions */
32875
+ 403: {
32876
+ headers: {
32877
+ [name: string]: unknown;
32878
+ };
32879
+ content: {
32880
+ "application/json": components["schemas"]["Error"];
32881
+ };
32882
+ };
32883
+ /** @description Internal server error */
32884
+ 500: {
32885
+ headers: {
32886
+ [name: string]: unknown;
32887
+ };
32888
+ content: {
32889
+ "application/json": components["schemas"]["Error"];
32890
+ };
32891
+ };
32892
+ };
32893
+ };
32894
+ options?: never;
32895
+ head?: never;
32896
+ patch?: never;
32897
+ trace?: never;
32898
+ };
32899
+ "/v1/tools/sandbox/deploy": {
32900
+ parameters: {
32901
+ query?: never;
32902
+ header?: never;
32903
+ path?: never;
32904
+ cookie?: never;
32905
+ };
32906
+ get?: never;
32907
+ put?: never;
32908
+ /**
32909
+ * Deploy Daytona sandbox
32910
+ * @description Deploy code to a persistent Daytona sandbox and return a preview URL.
32587
32911
  */
32588
32912
  post: {
32589
32913
  parameters: {
@@ -32861,6 +33185,7 @@ interface paths {
32861
33185
  description: string | null;
32862
33186
  id: string;
32863
33187
  isActive: boolean;
33188
+ lastModifiedSource?: string | null;
32864
33189
  name: string;
32865
33190
  organizationId: string | null;
32866
33191
  parametersSchema?: {
@@ -32953,6 +33278,7 @@ interface paths {
32953
33278
  description: string | null;
32954
33279
  id: string;
32955
33280
  isActive: boolean;
33281
+ lastModifiedSource?: string | null;
32956
33282
  name: string;
32957
33283
  organizationId: string | null;
32958
33284
  parametersSchema?: {
@@ -33584,7 +33910,9 @@ interface paths {
33584
33910
  features: {
33585
33911
  dashboardAssistantModel: string;
33586
33912
  enableAgentSkills: boolean;
33913
+ enableChromeSurface: boolean;
33587
33914
  enableDashboardAssistant: boolean;
33915
+ enableRuntypeApps: boolean;
33588
33916
  productGeneratorModel: string;
33589
33917
  };
33590
33918
  id: string;
@@ -34240,6 +34568,8 @@ interface components {
34240
34568
  lastModifiedSource: string | null;
34241
34569
  updatedAt: string | null;
34242
34570
  versionId: string | null;
34571
+ /** @description Present only when a raw tool_… reference could not be emitted as a portable tool:<name> (the tool was deleted, or its name is shadowed by an older same-named tool). Those references are left as raw ids, which the ensure surface rejects; each warning explains how to fix it. */
34572
+ warnings?: string[];
34243
34573
  };
34244
34574
  AgentSSEEvent: {
34245
34575
  agentId: string;
@@ -35378,6 +35708,8 @@ interface components {
35378
35708
  lastModifiedSource: string | null;
35379
35709
  updatedAt: string | null;
35380
35710
  versionId: string | null;
35711
+ /** @description Present only when a raw tool_… reference could not be emitted as a portable tool:<name> (the tool was deleted, or its name is shadowed by an older same-named tool). Those references are left as raw ids, which the ensure surface rejects; each warning explains how to fix it. */
35712
+ warnings?: string[];
35381
35713
  };
35382
35714
  FlowSSEEvent: {
35383
35715
  executionContext?: {
@@ -35776,6 +36108,58 @@ interface components {
35776
36108
  skillVersionId: string;
35777
36109
  status: string;
35778
36110
  };
36111
+ ToolEnsureConflict: {
36112
+ /** @enum {string} */
36113
+ code: "external_modification" | "remote_changed";
36114
+ currentHash?: string | null;
36115
+ error: string;
36116
+ lastModifiedSource?: string;
36117
+ modifiedAt?: string | null;
36118
+ };
36119
+ ToolEnsureHashMismatch: {
36120
+ /** @enum {string} */
36121
+ code: "content_hash_mismatch";
36122
+ /** @description The server-computed canonical hash of the submitted definition. */
36123
+ contentHash: string;
36124
+ error: string;
36125
+ };
36126
+ ToolEnsureResponse: {
36127
+ /** @description Server-computed canonical content hash. Clients should echo this hash in probes. */
36128
+ contentHash: string;
36129
+ /** @enum {string} */
36130
+ result: "unchanged" | "created" | "updated";
36131
+ toolId: string;
36132
+ } | {
36133
+ /** @enum {string} */
36134
+ result: "definitionRequired";
36135
+ } | {
36136
+ changedKeys: string[];
36137
+ /** @enum {string} */
36138
+ changes: "none" | "create" | "update";
36139
+ contentHash: string;
36140
+ remoteHash?: string;
36141
+ /** @enum {string} */
36142
+ result: "plan";
36143
+ toolId?: string;
36144
+ };
36145
+ ToolPullResponse: {
36146
+ contentHash: string;
36147
+ definition: {
36148
+ config: {
36149
+ [key: string]: unknown;
36150
+ };
36151
+ description: string;
36152
+ name: string;
36153
+ parametersSchema: {
36154
+ [key: string]: unknown;
36155
+ };
36156
+ /** @enum {string} */
36157
+ toolType: "flow" | "custom" | "external" | "graphql" | "mcp" | "local" | "subagent";
36158
+ };
36159
+ lastModifiedSource: string | null;
36160
+ toolId: string;
36161
+ updatedAt: string | null;
36162
+ };
35779
36163
  UpdateUserProfileResponse: {
35780
36164
  email?: string;
35781
36165
  firstName?: string;
@@ -37181,6 +37565,77 @@ interface BulkEditResponse {
37181
37565
  data: BulkEditResult[];
37182
37566
  recordIds?: number[];
37183
37567
  }
37568
+ /** A single unified step-level execution result for a record. */
37569
+ interface RecordStepResult {
37570
+ id: string;
37571
+ userId: string;
37572
+ organizationId: string | null;
37573
+ batchExecutionId: string | null;
37574
+ executionSessionId: string | null;
37575
+ flowId: string | null;
37576
+ flowVersionId: string | null;
37577
+ recordId: string | null;
37578
+ recordName: string | null;
37579
+ recordMetadata?: JsonValue | null;
37580
+ stepId: string | null;
37581
+ stepType: string;
37582
+ stepName: string;
37583
+ order: number | null;
37584
+ status: string;
37585
+ startedAt: string | null;
37586
+ completedAt: string | null;
37587
+ durationMs: number | null;
37588
+ outputPreview: string | null;
37589
+ stepConfig?: JsonValue | null;
37590
+ inputVariables?: JsonValue | null;
37591
+ resolvedPrompt?: string | null;
37592
+ modelUsed?: string | null;
37593
+ promptTokens?: number | null;
37594
+ completionTokens?: number | null;
37595
+ totalTokens?: number | null;
37596
+ estimatedCost?: string | null;
37597
+ errorMessage?: string | null;
37598
+ retryCount?: number | null;
37599
+ createdAt: string;
37600
+ }
37601
+ /** Query parameters for {@link RecordsEndpoint.getStepResults}. */
37602
+ interface RecordStepResultsParams {
37603
+ flowId?: string;
37604
+ batchId?: string;
37605
+ status?: string;
37606
+ from?: string;
37607
+ to?: string;
37608
+ sortBy?: string;
37609
+ sortOrder?: 'asc' | 'desc';
37610
+ limit?: number;
37611
+ offset?: number;
37612
+ }
37613
+ /** Paginated response from {@link RecordsEndpoint.getStepResults}. */
37614
+ interface RecordStepResultsResponse {
37615
+ data: RecordStepResult[];
37616
+ pagination: {
37617
+ limit: number;
37618
+ offset: number;
37619
+ returned: number;
37620
+ hasMore: boolean;
37621
+ };
37622
+ }
37623
+ /** Per-model cost line within a {@link RecordCostAggregation}. */
37624
+ interface RecordCostModelBreakdown {
37625
+ model: string;
37626
+ cost: number;
37627
+ tokens: number;
37628
+ count: number;
37629
+ }
37630
+ /** Aggregated cost breakdown for a record from {@link RecordsEndpoint.getCosts}. */
37631
+ interface RecordCostAggregation {
37632
+ totalCost: number;
37633
+ totalTokens: number;
37634
+ promptTokens: number;
37635
+ completionTokens: number;
37636
+ executionCount: number;
37637
+ modelBreakdown: RecordCostModelBreakdown[];
37638
+ }
37184
37639
  type ProviderApiKey = paths['/v1/provider-keys']['get']['responses'][200]['content']['application/json']['providerKeys'][number];
37185
37640
  /**
37186
37641
  * Provider enum for creating a provider key, derived from the generated OpenAPI
@@ -38084,6 +38539,13 @@ interface FlowPullResult {
38084
38539
  lastModifiedSource: string | null;
38085
38540
  updatedAt: string | null;
38086
38541
  versionId: string | null;
38542
+ /**
38543
+ * Present only when a raw `tool_…` reference could not be emitted as a
38544
+ * portable `tool:<name>` (the tool was deleted, or its name is shadowed by an
38545
+ * older same-named tool). Those references are left as raw ids — which
38546
+ * `defineFlow`/`ensure` reject — so each warning explains how to fix it.
38547
+ */
38548
+ warnings?: string[];
38087
38549
  }
38088
38550
  /** A 409 from the ensure protocol (external_modification or remote_changed). */
38089
38551
  declare class FlowEnsureConflictError extends Error {
@@ -39654,6 +40116,13 @@ interface AgentPullResult {
39654
40116
  lastModifiedSource: string | null;
39655
40117
  updatedAt: string | null;
39656
40118
  versionId: string | null;
40119
+ /**
40120
+ * Present only when a raw `tool_…` reference could not be emitted as a
40121
+ * portable `tool:<name>` (the tool was deleted, or its name is shadowed by an
40122
+ * older same-named tool). Those references are left as raw ids — which
40123
+ * `defineAgent`/`ensure` reject — so each warning explains how to fix it.
40124
+ */
40125
+ warnings?: string[];
39657
40126
  }
39658
40127
  /** A 409 from the ensure protocol (external_modification or remote_changed). */
39659
40128
  declare class AgentEnsureConflictError extends Error {
@@ -39710,6 +40179,190 @@ declare class AgentsNamespace {
39710
40179
  private request;
39711
40180
  }
39712
40181
 
40182
+ /**
40183
+ * Tool config-as-code: `defineTool`, `tools.ensure`, `tools.pull`.
40184
+ *
40185
+ * The deploy-time convergence postcondition for saved tools: "make the
40186
+ * platform's definition of this tool match this object; no-op if it already
40187
+ * does." Identity is name + account scope (the API key's org, else personal);
40188
+ * environment is whichever API the client points at. `ensure` never deletes,
40189
+ * and renaming a definition orphans the old tool and creates a new one.
40190
+ *
40191
+ * Wire protocol (POST /v1/tools/ensure — APQ-shaped, both APQ scars fixed):
40192
+ * 1. Hash-only probe `{ name, contentHash }`. A match is
40193
+ * `{ result: 'unchanged' }`; a miss is a NORMAL 200
40194
+ * `{ result: 'definitionRequired' }`, never an error.
40195
+ * 2. On a miss, retry with the full `definition`. The server recomputes the
40196
+ * canonical hash itself and returns it on every response — this SDK
40197
+ * echoes the server's hash (memoized per client instance) rather than
40198
+ * trusting its own serialization.
40199
+ *
40200
+ * Unlike agents/flows, tools have NO version snapshots: there is no
40201
+ * `release: 'publish'` option and no `versionId` on the result.
40202
+ *
40203
+ * The content hash is the canonical tool hash (`computeToolContentHash` —
40204
+ * mirrored from `packages/shared/src/utils/tool-content-hash.ts`; this package
40205
+ * is dependency-free by convention) over `{ toolType, description,
40206
+ * parametersSchema, config }`. `name` is identity, not content, so it is
40207
+ * excluded from the hash.
40208
+ *
40209
+ * See docs/adr/0003-agent-config-as-code-ensure.md for the design rationale.
40210
+ */
40211
+
40212
+ /** Canonical normalized form of a tool definition (name excluded — identity). */
40213
+ declare function normalizeToolDefinition(definition: ToolContentInput): {
40214
+ toolType: string;
40215
+ description?: string;
40216
+ parametersSchema: Record<string, unknown>;
40217
+ config: Record<string, unknown>;
40218
+ };
40219
+ /** SHA-256 (hex) over the canonical normalized tool definition. */
40220
+ declare function computeToolContentHash(definition: ToolContentInput): Promise<string>;
40221
+ interface ToolContentInput {
40222
+ description?: string | null;
40223
+ toolType: string;
40224
+ parametersSchema?: Record<string, unknown> | null;
40225
+ config?: Record<string, unknown> | null;
40226
+ }
40227
+ /** The tool types `ensure` accepts (mirrors the server's CreateToolSchema). */
40228
+ type ToolDefinitionType = 'flow' | 'custom' | 'external' | 'graphql' | 'mcp' | 'local' | 'subagent';
40229
+ /** `defineTool` input: identity (name) + the convergeable content fields. */
40230
+ interface DefineToolInput {
40231
+ name: string;
40232
+ description: string;
40233
+ toolType: ToolDefinitionType;
40234
+ parametersSchema: Record<string, unknown>;
40235
+ config: Record<string, unknown>;
40236
+ }
40237
+ /** The canonical (wire) definition produced by `defineTool`. */
40238
+ interface ToolDefinition {
40239
+ name: string;
40240
+ description: string;
40241
+ toolType: ToolDefinitionType;
40242
+ parametersSchema: Record<string, unknown>;
40243
+ config: Record<string, unknown>;
40244
+ }
40245
+ /**
40246
+ * Pure-local declarative constructor for a tool definition. No I/O. Validates
40247
+ * structure and rejects unknown fields. Deep validation (custom-tool code
40248
+ * preflight, {{secret:KEY}} reference rules) happens server-side at ensure
40249
+ * time, mirroring the create/update routes.
40250
+ *
40251
+ * @example
40252
+ * ```typescript
40253
+ * const weather = defineTool({
40254
+ * name: 'Weather Lookup',
40255
+ * description: 'Fetch the current weather for a city',
40256
+ * toolType: 'external',
40257
+ * parametersSchema: {
40258
+ * type: 'object',
40259
+ * properties: { city: { type: 'string' } },
40260
+ * required: ['city'],
40261
+ * },
40262
+ * config: { url: 'https://api.example.com/weather?q={{city}}', method: 'GET' },
40263
+ * })
40264
+ * ```
40265
+ */
40266
+ declare function defineTool(input: DefineToolInput): ToolDefinition;
40267
+ interface EnsureToolOptions {
40268
+ /** Plan without writing (the CI drift gate). Sends the full definition. */
40269
+ dryRun?: boolean;
40270
+ /**
40271
+ * What to do when the tool's last write came from the dashboard/API rather
40272
+ * than ensure. Default 'error' (HTTP 409 → ToolEnsureConflictError).
40273
+ */
40274
+ onConflict?: 'error' | 'overwrite';
40275
+ /**
40276
+ * TOCTOU guard binding a dry run to its apply: the write only proceeds if
40277
+ * the remote still hashes to this value (409 remote_changed otherwise).
40278
+ */
40279
+ expectedRemoteHash?: string;
40280
+ /** Implies dryRun; throws ToolDriftError unless the plan is 'none'. */
40281
+ expectNoChanges?: boolean;
40282
+ }
40283
+ interface EnsureToolConverged {
40284
+ result: 'unchanged' | 'created' | 'updated';
40285
+ toolId: string;
40286
+ /** The server-computed canonical hash (echo this — never your own). */
40287
+ contentHash: string;
40288
+ }
40289
+ interface EnsureToolPlan {
40290
+ result: 'plan';
40291
+ changes: 'none' | 'create' | 'update';
40292
+ changedKeys: string[];
40293
+ contentHash: string;
40294
+ remoteHash?: string;
40295
+ toolId?: string;
40296
+ }
40297
+ type EnsureToolResult = EnsureToolConverged | EnsureToolPlan;
40298
+ interface ToolPullResult {
40299
+ toolId: string;
40300
+ definition: ToolDefinition;
40301
+ contentHash: string;
40302
+ lastModifiedSource: string | null;
40303
+ updatedAt: string | null;
40304
+ }
40305
+ /** A 409 from the ensure protocol (external_modification or remote_changed). */
40306
+ declare class ToolEnsureConflictError extends Error {
40307
+ readonly code: 'external_modification' | 'remote_changed';
40308
+ readonly lastModifiedSource?: string;
40309
+ readonly modifiedAt?: string | null;
40310
+ readonly currentHash?: string | null;
40311
+ constructor(body: {
40312
+ error?: string;
40313
+ code: 'external_modification' | 'remote_changed';
40314
+ lastModifiedSource?: string;
40315
+ modifiedAt?: string | null;
40316
+ currentHash?: string | null;
40317
+ });
40318
+ }
40319
+ /** Thrown by `ensure(def, { expectNoChanges: true })` when drift is detected. */
40320
+ declare class ToolDriftError extends Error {
40321
+ readonly plan: EnsureToolPlan;
40322
+ constructor(plan: EnsureToolPlan);
40323
+ }
40324
+
40325
+ /**
40326
+ * ToolsNamespace — config-as-code operations for saved tools.
40327
+ *
40328
+ * `tools.ensure` is the deploy-time, non-executing converge (create-or-update a
40329
+ * tool by name + account scope); `tools.pull` is the absorb-drift direction.
40330
+ * Both delegate to the implementation in `tools-ensure.ts`.
40331
+ */
40332
+
40333
+ declare class ToolsNamespace {
40334
+ private getClient;
40335
+ constructor(getClient: () => RuntypeClient$1);
40336
+ /**
40337
+ * Idempotently converge a `defineTool` definition onto the platform.
40338
+ * Hash-first: the steady state is one tiny probe request. Creates or updates
40339
+ * the saved tool; never deletes. Identity is name + account scope.
40340
+ *
40341
+ * @example
40342
+ * ```typescript
40343
+ * const weather = defineTool({
40344
+ * name: 'Weather Lookup',
40345
+ * description: 'Fetch the current weather for a city',
40346
+ * toolType: 'external',
40347
+ * parametersSchema: { type: 'object', properties: { city: { type: 'string' } } },
40348
+ * config: { url: 'https://api.example.com/weather', method: 'GET' },
40349
+ * })
40350
+ *
40351
+ * // Converge (CI/deploy).
40352
+ * const result = await Runtype.tools.ensure(weather)
40353
+ *
40354
+ * // PR drift gate.
40355
+ * await Runtype.tools.ensure(weather, { expectNoChanges: true })
40356
+ * ```
40357
+ */
40358
+ ensure(definition: ToolDefinition, options?: EnsureToolOptions): Promise<EnsureToolResult>;
40359
+ /**
40360
+ * Pull the canonical definition + provenance for a tool by name — the
40361
+ * absorb-drift direction of the ensure protocol.
40362
+ */
40363
+ pull(name: string): Promise<ToolPullResult>;
40364
+ }
40365
+
39713
40366
  /**
39714
40367
  * Runtype - The unified SDK client for building and executing flows, batches, evals, and prompts
39715
40368
  *
@@ -39985,6 +40638,32 @@ declare class Runtype {
39985
40638
  * ```
39986
40639
  */
39987
40640
  static get agents(): AgentsNamespace;
40641
+ /**
40642
+ * Tools namespace - Tool config-as-code (define / ensure / pull)
40643
+ *
40644
+ * @example
40645
+ * ```typescript
40646
+ * import { defineTool, Runtype } from '@runtypelabs/sdk'
40647
+ *
40648
+ * const weather = defineTool({
40649
+ * name: 'Weather Lookup',
40650
+ * description: 'Fetch the current weather for a city',
40651
+ * toolType: 'external',
40652
+ * parametersSchema: { type: 'object', properties: { city: { type: 'string' } } },
40653
+ * config: { url: 'https://api.example.com/weather', method: 'GET' },
40654
+ * })
40655
+ *
40656
+ * // Converge at deploy time (idempotent; one tiny probe in steady state)
40657
+ * await Runtype.tools.ensure(weather)
40658
+ *
40659
+ * // CI drift gate
40660
+ * await Runtype.tools.ensure(weather, { expectNoChanges: true })
40661
+ *
40662
+ * // Absorb a dashboard edit back into the repo
40663
+ * const { definition } = await Runtype.tools.pull('Weather Lookup')
40664
+ * ```
40665
+ */
40666
+ static get tools(): ToolsNamespace;
39988
40667
  }
39989
40668
 
39990
40669
  /**
@@ -40235,6 +40914,8 @@ interface RunTaskStateSlice {
40235
40914
  isCreationTask?: boolean;
40236
40915
  /** For creation tasks: allowed write root (e.g. "public/"). Writes must stay under this path. */
40237
40916
  outputRoot?: string;
40917
+ /** Number of consecutive sessions with no tool actions (the stall-detection counter) */
40918
+ consecutiveEmptySessions?: number;
40238
40919
  sessions: Array<{
40239
40920
  actionKeys?: string[];
40240
40921
  hadTextOutput?: boolean;
@@ -40310,11 +40991,40 @@ interface WorkflowPhase {
40310
40991
  /** Return true if the agent's TASK_COMPLETE claim should be accepted in this phase */
40311
40992
  canAcceptCompletion?: (state: RunTaskStateSlice, trace: RunTaskToolTraceSlice) => boolean;
40312
40993
  }
40994
+ /**
40995
+ * Escalation policy for consecutive sessions with no tool actions.
40996
+ *
40997
+ * Every threshold counts the same `consecutiveEmptySessions` counter used for
40998
+ * stall detection: a session is empty when it performed no write, read,
40999
+ * discovery, or verification tool action. Text-only narration ("I'll create
41000
+ * the files now") does NOT reset the counter — a model that narrates intent
41001
+ * without calling tools still escalates here, even though phase-level
41002
+ * `buildRecoveryMessage` conditions keyed on `hadTextOutput` would not fire.
41003
+ */
41004
+ interface WorkflowStallPolicy {
41005
+ /**
41006
+ * Inject a generic recovery nudge into the next session after N consecutive
41007
+ * empty sessions, when the current phase's buildRecoveryMessage returns
41008
+ * nothing. Unset = no workflow-level nudge (legacy behavior).
41009
+ */
41010
+ nudgeAfter?: number;
41011
+ /**
41012
+ * Set `state.stallEscalationRequested` when the counter reaches N, signaling
41013
+ * the caller (via onSession) to restart with a fallback model. The SDK only
41014
+ * raises the signal — model switching is the caller's responsibility.
41015
+ * Unset = never signal.
41016
+ */
41017
+ escalateModelAfter?: number;
41018
+ /** Stop the run with status 'stalled' after N consecutive empty sessions (default 3). */
41019
+ stopAfter?: number;
41020
+ }
40313
41021
  interface WorkflowDefinition {
40314
41022
  /** Workflow name for logging/debugging */
40315
41023
  name: string;
40316
41024
  /** Ordered list of phases */
40317
41025
  phases: WorkflowPhase[];
41026
+ /** Escalation policy for consecutive sessions with no tool actions */
41027
+ stallPolicy?: WorkflowStallPolicy;
40318
41028
  /** Classify the user message into a variant (e.g. 'create' vs 'modify') */
40319
41029
  classifyVariant?: (message: string) => string | undefined;
40320
41030
  /** Generate bootstrap context before the first session */
@@ -40475,6 +41185,15 @@ declare class RecordsEndpoint {
40475
41185
  fromDate?: string;
40476
41186
  toDate?: string;
40477
41187
  }): Promise<any[]>;
41188
+ /**
41189
+ * Get unified step-level execution results for a record, with filtering and
41190
+ * pagination.
41191
+ */
41192
+ getStepResults(id: string, params?: RecordStepResultsParams): Promise<RecordStepResultsResponse>;
41193
+ /**
41194
+ * Get the aggregated cost breakdown (by model) for a record's executions.
41195
+ */
41196
+ getCosts(id: string): Promise<RecordCostAggregation>;
40478
41197
  /**
40479
41198
  * Delete a specific result for a record
40480
41199
  */
@@ -41752,6 +42471,12 @@ interface RunTaskState {
41752
42471
  * when that window re-crosses the threshold. 0/undefined = no compaction yet.
41753
42472
  */
41754
42473
  contextWindowBaseIndex?: number;
42474
+ /**
42475
+ * Set when the workflow's stallPolicy.escalateModelAfter threshold is reached.
42476
+ * Callers observe this in onSession and may restart with a fallback model.
42477
+ * Cleared as soon as a session performs tool actions again.
42478
+ */
42479
+ stallEscalationRequested?: boolean;
41755
42480
  /** Arbitrary bag for workflow-specific data */
41756
42481
  workflowState?: Record<string, unknown>;
41757
42482
  }
@@ -41808,6 +42533,20 @@ type RunTaskOnContextNotice = (event: RunTaskContextNoticeEvent) => void | Promi
41808
42533
  /**
41809
42534
  * Options for `agents.runTask()`
41810
42535
  */
42536
+ /**
42537
+ * Storage seam for hot-tail tool-output offloads. Given a large tool result
42538
+ * the SDK has already decided to offload (above its inline threshold), the
42539
+ * recorder persists the content however it likes and returns the reference
42540
+ * string to splice into the send view in place of the raw output. Return
42541
+ * `undefined` to decline and let the SDK fall back to its built-in store.
42542
+ */
42543
+ type RunTaskOffloadRecorder = (details: {
42544
+ toolCallId: string;
42545
+ toolName: string;
42546
+ content: string;
42547
+ }) => {
42548
+ reference: string;
42549
+ } | undefined;
41811
42550
  interface RunTaskOptions {
41812
42551
  /** The user message / task instruction for the agent */
41813
42552
  message: string;
@@ -41860,6 +42599,18 @@ interface RunTaskOptions {
41860
42599
  onContextNotice?: RunTaskOnContextNotice;
41861
42600
  /** Saved workflow state to seed a resumed or restarted marathon run */
41862
42601
  resumeState?: RunTaskResumeState;
42602
+ /**
42603
+ * Optional storage seam for hot-tail tool-output offloads. When supplied,
42604
+ * `offloadToolResult` delegates persistence to the recorder instead of the
42605
+ * built-in `.runtype/marathons/<slug>/tool-outputs/` fallback, and returns
42606
+ * the recorder's reference in place of the file-pointer marker. The CLI
42607
+ * backs this with its content-addressed ledger store so the 500–100k char
42608
+ * band becomes a first-class ledger citizen (content-addressed, hashed,
42609
+ * `read_offloaded_output`-resolvable, deduped). Returning `undefined` (or
42610
+ * throwing) falls back to the built-in store. A future server-side artifact
42611
+ * upload plugs into this same seam.
42612
+ */
42613
+ offloadRecorder?: RunTaskOffloadRecorder;
41863
42614
  /** How tool results are stored in message history for continuation.
41864
42615
  * 'hot-tail' (default): recent results inline, older offloaded to disk.
41865
42616
  * 'observation-mask': recent results inline, older replaced with placeholder.
@@ -43952,6 +44703,227 @@ declare const STEP_TYPE_TO_METHOD: {
43952
44703
  readonly 'memory-summary': "memorySummary";
43953
44704
  };
43954
44705
 
44706
+ /**
44707
+ * Named workflow hook registry.
44708
+ *
44709
+ * Workflow configs (the data form compiled by `compileWorkflowConfig`) can
44710
+ * reference behavior by name instead of carrying functions: `builtin:*` names
44711
+ * are reserved for the hooks that power the default workflow, and consumers
44712
+ * register their own under a custom namespace (e.g. `acme:my-completion`).
44713
+ *
44714
+ * Every hook declares which SLOT KIND it implements so a config that wires a
44715
+ * hook into the wrong slot fails at load/compile time with an actionable
44716
+ * error — not mid-marathon. Hook misfires in this system don't crash, they
44717
+ * stall, which is the worst failure mode to debug.
44718
+ */
44719
+
44720
+ interface WorkflowHookSignatures {
44721
+ /** WorkflowPhase.buildInstructions — used verbatim (no header is added) */
44722
+ instructions: (state: RunTaskStateSlice) => string;
44723
+ /** WorkflowPhase.buildToolGuidance */
44724
+ toolGuidance: (state: RunTaskStateSlice) => string[];
44725
+ /** WorkflowPhase.isComplete */
44726
+ completion: (ctx: WorkflowContext) => boolean;
44727
+ /** WorkflowPhase.buildTransitionSummary */
44728
+ transitionSummary: (state: RunTaskStateSlice, nextPhaseName: string) => string;
44729
+ /** WorkflowPhase.interceptToolCall — may only narrow (block); returning undefined never overrides an outer deny */
44730
+ intercept: (toolName: string, args: Record<string, unknown>, ctx: WorkflowContext) => string | undefined;
44731
+ /** WorkflowPhase.buildRecoveryMessage */
44732
+ recovery: (state: RunTaskStateSlice) => string | undefined;
44733
+ /** WorkflowPhase.shouldForceEndTurn */
44734
+ forceEndTurn: (snapshot: LocalToolExecutionLoopSnapshotSlice, ctx: WorkflowContext) => string | undefined;
44735
+ /** WorkflowPhase.canAcceptCompletion */
44736
+ acceptCompletion: (state: RunTaskStateSlice, trace: RunTaskToolTraceSlice) => boolean;
44737
+ /** WorkflowDefinition.classifyVariant */
44738
+ classify: (message: string) => string | undefined;
44739
+ /** WorkflowDefinition.generateBootstrapContext */
44740
+ bootstrap: (message: string, localTools: Record<string, LocalToolDefinition> | undefined, variant?: string) => Promise<string | undefined>;
44741
+ /** WorkflowDefinition.buildCandidateBlock */
44742
+ candidateBlock: (state: RunTaskStateSlice) => string;
44743
+ }
44744
+ type WorkflowHookKind = keyof WorkflowHookSignatures;
44745
+ interface WorkflowHookEntry<K extends WorkflowHookKind = WorkflowHookKind> {
44746
+ kind: K;
44747
+ fn: WorkflowHookSignatures[K];
44748
+ }
44749
+ /**
44750
+ * A string is a hook reference iff it full-matches `<namespace>:<id>` with
44751
+ * both segments lowercase [a-z0-9_-]. Inline prose (multi-word strings,
44752
+ * paths, sentences) never matches, so config slots can accept either form.
44753
+ */
44754
+ declare function isWorkflowHookRef(value: unknown): value is string;
44755
+ /**
44756
+ * Register a custom workflow hook. The `builtin:` namespace is reserved —
44757
+ * "replacing" a builtin means pointing the config slot at your own hook, not
44758
+ * mutating the registry, so a shipped default config keeps a stable meaning.
44759
+ * Re-registering an existing custom name overwrites it (last write wins
44760
+ * within one process, e.g. plugin reload).
44761
+ */
44762
+ declare function registerWorkflowHook<K extends WorkflowHookKind>(name: string, entry: WorkflowHookEntry<K>): void;
44763
+ /** Resolve a hook by name, validating the slot kind. Throws actionable errors. */
44764
+ declare function resolveWorkflowHook<K extends WorkflowHookKind>(name: string, expectedKind: K): WorkflowHookSignatures[K];
44765
+ /** List registered hooks (name + kind) for error messages and tooling. */
44766
+ declare function listWorkflowHooks(): Array<{
44767
+ name: string;
44768
+ kind: WorkflowHookKind;
44769
+ }>;
44770
+ /** Test seam: remove a custom hook (builtin entries cannot be removed). */
44771
+ declare function unregisterWorkflowHook(name: string): boolean;
44772
+
44773
+ /**
44774
+ * Declarative workflow configs and the compiler that turns them into a
44775
+ * `WorkflowDefinition`.
44776
+ *
44777
+ * This is the single compile path for marathon workflows-as-data: the CLI
44778
+ * playbook loader parses YAML/JSON into a `WorkflowConfig` and delegates here,
44779
+ * and the shipped default workflow is itself a `WorkflowConfig`
44780
+ * (`defaultWorkflowConfig` in default-workflow.ts) compiled through the same
44781
+ * function — so playbooks and the default cannot drift in semantics.
44782
+ *
44783
+ * Each behavior slot accepts either INLINE DATA (strings, declarative
44784
+ * criteria, policy rules) or a HOOK REFERENCE (`"<namespace>:<id>"`, see
44785
+ * hook-registry.ts) resolved against the registry with slot-kind validation
44786
+ * at compile time.
44787
+ *
44788
+ * The compiler is environment-free: no fs, no YAML, no glob library. Glob
44789
+ * matching for policy rules is injected via `WorkflowCompileDeps` (the CLI
44790
+ * passes micromatch); configs that use glob policies without a matcher fail
44791
+ * at compile time with an actionable error.
44792
+ */
44793
+
44794
+ declare const DEFAULT_RECOVERY_AFTER_EMPTY_SESSIONS = 2;
44795
+ /** A `"<namespace>:<id>"` reference into the workflow hook registry. */
44796
+ type WorkflowHookRef = string;
44797
+ interface WorkflowCompletionCriteriaConfig {
44798
+ /** Built-in criteria type, or a 'completion' hook reference */
44799
+ type: 'evidence' | 'sessions' | 'planWritten' | 'never' | WorkflowHookRef;
44800
+ minReadFiles?: number;
44801
+ minSessions?: number;
44802
+ }
44803
+ /**
44804
+ * Every behavior slot accepts inline data, a hook reference, or — for configs
44805
+ * authored in TypeScript (module playbooks, programmatic use) — a plain
44806
+ * function with the slot's hook signature. Functions never round-trip through
44807
+ * JSON/YAML, so declarative playbooks are unaffected.
44808
+ */
44809
+ type WorkflowSlot<K extends keyof WorkflowHookSignatures, Inline = never> = Inline | WorkflowHookRef | WorkflowHookSignatures[K];
44810
+ interface WorkflowRecoveryConfig {
44811
+ /** Inject after N consecutive empty sessions (default 2) */
44812
+ afterEmptySessions?: number;
44813
+ /** Recovery message; supports {{key}} interpolation from run state (e.g. {{planPath}}) */
44814
+ message: string;
44815
+ }
44816
+ /**
44817
+ * Declarative policy for narrowing runtime behavior.
44818
+ * Cannot override global denies (e.g. secret paths). Precedence: global deny > workflow deny > config narrowing.
44819
+ */
44820
+ interface WorkflowPolicyConfig {
44821
+ /** Glob patterns for allowed read paths (e.g. ["src/**", "docs/**"]). If set, reads outside these are blocked. */
44822
+ allowedReadGlobs?: string[];
44823
+ /** Glob patterns for allowed write paths. If set, writes outside these are blocked. */
44824
+ allowedWriteGlobs?: string[];
44825
+ /** Tool names to block (e.g. ["write_file", "search_repo"]). */
44826
+ blockedTools?: string[];
44827
+ /** Require verification before TASK_COMPLETE (consumed by the runner, not the compiler). */
44828
+ requireVerification?: boolean;
44829
+ /** Block discovery tools (search_repo, glob_files, tree_directory, list_directory). */
44830
+ blockDiscoveryTools?: boolean;
44831
+ /** Require plan to be written before any non-plan writes. */
44832
+ requirePlanBeforeWrite?: boolean;
44833
+ /** For creation tasks: allowed write root (e.g. "public/"). Consumed by the runner via state.outputRoot. */
44834
+ outputRoot?: string;
44835
+ }
44836
+ interface WorkflowMilestoneConfig {
44837
+ name: string;
44838
+ description?: string;
44839
+ /**
44840
+ * Inline instructions (interpolated, with a "--- Workflow Phase ---" header
44841
+ * added), an 'instructions' hook reference, or a function (both used verbatim).
44842
+ */
44843
+ instructions: WorkflowSlot<'instructions', string>;
44844
+ /** Inline guidance lines, a 'toolGuidance' hook reference, or a function. Policy-derived guidance is appended either way. */
44845
+ toolGuidance?: WorkflowSlot<'toolGuidance', string[]>;
44846
+ /** Declarative criteria object, or a 'completion' predicate function */
44847
+ completionCriteria?: WorkflowCompletionCriteriaConfig | WorkflowHookSignatures['completion'];
44848
+ /**
44849
+ * Inline boolean, an 'acceptCompletion' hook reference or function, or absent.
44850
+ * NOTE: absent means the slot is omitted from the compiled phase — the SDK
44851
+ * then ACCEPTS completion by default. Loaders that want reject-by-default
44852
+ * (the playbook behavior) must set `false` explicitly before compiling.
44853
+ */
44854
+ canAcceptCompletion?: WorkflowSlot<'acceptCompletion', boolean>;
44855
+ /** Inline recovery (triggered on the consecutive-empty-sessions counter), a 'recovery' hook reference, or a function */
44856
+ recovery?: WorkflowSlot<'recovery', WorkflowRecoveryConfig>;
44857
+ /** Inline summary (supports {{key}} + {{nextPhase}}), a 'transitionSummary' hook reference, or a function */
44858
+ transitionSummary?: WorkflowSlot<'transitionSummary', string>;
44859
+ /** An 'intercept' hook reference or function; runs after the policy intercept and can only narrow further */
44860
+ intercept?: WorkflowSlot<'intercept'>;
44861
+ /** A 'forceEndTurn' hook reference or function */
44862
+ forceEndTurn?: WorkflowSlot<'forceEndTurn'>;
44863
+ /** Per-milestone model override (consumed by the runner, not the compiler) */
44864
+ model?: string;
44865
+ /** Per-milestone fallback models (consumed by the runner, not the compiler) */
44866
+ fallbackModels?: unknown[];
44867
+ }
44868
+ interface WorkflowConfig {
44869
+ name: string;
44870
+ description?: string;
44871
+ stallPolicy?: WorkflowStallPolicy;
44872
+ policy?: WorkflowPolicyConfig;
44873
+ /** A 'classify' hook reference or function */
44874
+ classifyVariant?: WorkflowSlot<'classify'>;
44875
+ /** A 'bootstrap' hook reference or function */
44876
+ bootstrap?: WorkflowSlot<'bootstrap'>;
44877
+ /** A 'candidateBlock' hook reference or function */
44878
+ candidateBlock?: WorkflowSlot<'candidateBlock'>;
44879
+ milestones: WorkflowMilestoneConfig[];
44880
+ /** Runner-level passthrough (verification requirements); ignored by the compiler */
44881
+ verification?: {
44882
+ required: boolean;
44883
+ commands?: string[];
44884
+ };
44885
+ /** Runner-level passthrough (extra rules text); ignored by the compiler */
44886
+ rules?: string;
44887
+ }
44888
+ /**
44889
+ * A module playbook's default export: either a workflow config directly, or a
44890
+ * factory that receives the registration API and returns one. The API is
44891
+ * INJECTED so hooks land in the loading process's registry instance even when
44892
+ * the playbook module would resolve a different copy of @runtypelabs/sdk.
44893
+ */
44894
+ type WorkflowConfigFactory = (api: {
44895
+ registerWorkflowHook: typeof registerWorkflowHook;
44896
+ }) => WorkflowConfig | Promise<WorkflowConfig>;
44897
+ /**
44898
+ * Identity helper for TypeScript playbooks — exists purely for type inference
44899
+ * (the `defineConfig` pattern). Optional: a plain object/function export with
44900
+ * the same shape works identically, so playbook modules don't need
44901
+ * @runtypelabs/sdk installed at runtime.
44902
+ */
44903
+ declare function definePlaybook<T extends WorkflowConfig | WorkflowConfigFactory>(playbook: T): T;
44904
+ interface WorkflowCompileDeps {
44905
+ /**
44906
+ * Glob matcher for policy allowedReadGlobs / allowedWriteGlobs (the CLI
44907
+ * passes micromatch). Required at compile time when the config uses glob
44908
+ * policies; other configs compile without it.
44909
+ */
44910
+ matchPathGlobs?: (path: string, globs: string[]) => boolean;
44911
+ }
44912
+ declare function interpolateWorkflowTemplate(template: string, state: RunTaskStateSlice): string;
44913
+ /**
44914
+ * Generate tool-guidance lines from the policy block so the model is told
44915
+ * what the interceptor enforces. Guidance and enforcement compile from the
44916
+ * same config, so they cannot drift — a silently-enforced constraint teaches
44917
+ * the model that tools "don't work" instead of what the actual rule is.
44918
+ */
44919
+ declare function buildPolicyGuidance(policy?: WorkflowPolicyConfig): string[];
44920
+ /**
44921
+ * Compile a declarative workflow config into a WorkflowDefinition.
44922
+ * Hook references are resolved (and kind-validated) eagerly, so a bad
44923
+ * reference fails here — at load time — with an actionable error.
44924
+ */
44925
+ declare function compileWorkflowConfig(config: WorkflowConfig, deps?: WorkflowCompileDeps): WorkflowDefinition;
44926
+
43955
44927
  /**
43956
44928
  * Default marathon workflow: research → planning → execution.
43957
44929
  *
@@ -43960,6 +44932,23 @@ declare const STEP_TYPE_TO_METHOD: {
43960
44932
  * via the `workflowVariant` / `isCreationTask` flags on state.
43961
44933
  */
43962
44934
 
44935
+ /**
44936
+ * Register the default workflow's behaviors as `builtin:*` hooks. Idempotent.
44937
+ * Importing this module (or anything that pulls in `defaultWorkflow`) calls it
44938
+ * automatically; loaders that compile configs without importing the default
44939
+ * workflow (e.g. the CLI playbook loader) must call it explicitly before
44940
+ * `compileWorkflowConfig` so `builtin:*` references resolve.
44941
+ */
44942
+ declare function ensureDefaultWorkflowHooks(): void;
44943
+ /**
44944
+ * The default workflow expressed as a declarative config over `builtin:*`
44945
+ * hooks. This is the same shape the CLI playbook loader compiles, so a user
44946
+ * playbook can reuse any slice of the default by referencing the same hooks
44947
+ * (e.g. keep `builtin:research-guard` but supply custom execution
44948
+ * instructions). The heuristic logic stays in this file as named builtins;
44949
+ * the composition is data.
44950
+ */
44951
+ declare const defaultWorkflowConfig: WorkflowConfig;
43963
44952
  declare const defaultWorkflow: WorkflowDefinition;
43964
44953
 
43965
44954
  /**
@@ -44003,6 +44992,36 @@ declare const deployWorkflow: WorkflowDefinition;
44003
44992
 
44004
44993
  declare const gameWorkflow: WorkflowDefinition;
44005
44994
 
44995
+ /**
44996
+ * Helpers for WorkflowDefinition.stallPolicy: what happens when an agent
44997
+ * produces consecutive sessions with no tool actions.
44998
+ *
44999
+ * All thresholds count the run-level `consecutiveEmptySessions` counter (a
45000
+ * session is empty when it performed no write/read/discovery/verification
45001
+ * tool action), so narration-only sessions escalate here even though they
45002
+ * carry text output. Absent policy values preserve the legacy behavior:
45003
+ * no nudge, no escalation signal, stop after 3.
45004
+ */
45005
+
45006
+ declare const DEFAULT_STALL_STOP_AFTER = 3;
45007
+ /** Resolve how many consecutive empty sessions end the run as 'stalled'. */
45008
+ declare function resolveStallStopAfter(policy?: WorkflowStallPolicy): number;
45009
+ /**
45010
+ * Whether to raise the model-escalation signal for this empty-session count.
45011
+ * Fires exactly once per stall episode (when the counter reaches the
45012
+ * threshold), so a caller that cannot escalate is not re-signaled every
45013
+ * subsequent empty session.
45014
+ */
45015
+ declare function shouldRequestModelEscalation(policy: WorkflowStallPolicy | undefined, consecutiveEmptySessions: number): boolean;
45016
+ /** Whether the workflow-level empty-session nudge should be injected. */
45017
+ declare function shouldInjectEmptySessionNudge(policy: WorkflowStallPolicy | undefined, consecutiveEmptySessions: number): boolean;
45018
+ /**
45019
+ * Generic recovery nudge used when a phase has no buildRecoveryMessage of its
45020
+ * own (or it returned nothing). Targets the narration-without-tool-calls
45021
+ * failure mode directly.
45022
+ */
45023
+ declare function buildEmptySessionNudge(consecutiveEmptySessions: number): string;
45024
+
44006
45025
  /**
44007
45026
  * Utility functions shared between workflow phase handlers and AgentsEndpoint.
44008
45027
  *
@@ -44020,4 +45039,4 @@ declare function getLikelySupportingCandidatePaths(bestCandidatePath: string | u
44020
45039
  declare function getDefaultPlanPath(taskName: string): string;
44021
45040
  declare function sanitizeTaskSlug(taskName: string): string;
44022
45041
 
44023
- 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, 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 WorkflowContext, type WorkflowDefinition, type WorkflowPhase, applyGeneratedRuntimeToolProposalToDispatchRequest, attachRuntimeToolsToDispatchRequest, buildGeneratedRuntimeToolGateOutput, buildLedgerOffloadReference, buildSendViewOffloadMarker, computeAgentContentHash, computeFlowContentHash, createClient, createExternalTool, defaultWorkflow, defineAgent, defineFlow, deployWorkflow, evaluateGeneratedRuntimeToolProposal, extractDeclaredToolResultChars, gameWorkflow, getDefaultPlanPath, getLikelySupportingCandidatePaths, isDiscoveryToolName, isMarathonArtifactPath, isPreservationSensitiveTask, normalizeAgentDefinition, normalizeCandidatePath, parseFinalBuffer, parseLedgerArtifactRelativePath, parseOffloadedOutputId, parseSSEChunk, processStream, sanitizeTaskSlug, streamEvents };
45042
+ 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 DefineToolInput, 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 EnsureToolConverged, type EnsureToolOptions, type EnsureToolPlan, type EnsureToolResult, 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 RecordCostAggregation, type RecordCostModelBreakdown, type RecordFilter, type RecordFilterCondition, type RecordFilterGroup, type RecordFilterOperator, type RecordListItem, type RecordListParams, type RecordStepResult, type RecordStepResultsParams, type RecordStepResultsResponse, RecordsEndpoint, type RetrieveRecordStepConfig$1 as RetrieveRecordStepConfig, type RetryFallback, type RunTaskContextBudgetBreakdown, type RunTaskContextCompactionEvent, type RunTaskContextCompactionStrategy, type RunTaskContextNoticeEvent, type RunTaskContextSummaryEntry, type RunTaskContinuation, type RunTaskOffloadRecorder, 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 ToolDefinition, type ToolDefinitionType, ToolDriftError, ToolEnsureConflictError, type ToolPullResult, type ToolWithValidation, type ToolsConfig, ToolsEndpoint, ToolsNamespace, 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, computeToolContentHash, createClient, createExternalTool, defaultWorkflow, defaultWorkflowConfig, defineAgent, defineFlow, definePlaybook, defineTool, deployWorkflow, ensureDefaultWorkflowHooks, evaluateGeneratedRuntimeToolProposal, extractDeclaredToolResultChars, gameWorkflow, getDefaultPlanPath, getLikelySupportingCandidatePaths, interpolateWorkflowTemplate, isDiscoveryToolName, isMarathonArtifactPath, isPreservationSensitiveTask, isWorkflowHookRef, listWorkflowHooks, normalizeAgentDefinition, normalizeCandidatePath, normalizeToolDefinition, parseFinalBuffer, parseLedgerArtifactRelativePath, parseOffloadedOutputId, parseSSEChunk, processStream, registerWorkflowHook, resolveStallStopAfter, resolveWorkflowHook, sanitizeTaskSlug, shouldInjectEmptySessionNudge, shouldRequestModelEscalation, streamEvents, unregisterWorkflowHook };