agentix-cli 0.132.0 → 0.133.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/dist/{App-VPYWOTTH.js → App-WQPA77VJ.js} +2 -2
  2. package/dist/{ChatApp-SNED4KJB.js → ChatApp-TGW66I4Y.js} +2 -2
  3. package/dist/{absorb-eval-WGO4JWTO.js → absorb-eval-37XZJACN.js} +2 -2
  4. package/dist/{agent-HXQYYLWZ.js → agent-FWHYHXWC.js} +2 -2
  5. package/dist/{board-dashboard-44JPXA7J.js → board-dashboard-GKE4KWJH.js} +357 -254
  6. package/dist/board-dashboard-GKE4KWJH.js.map +1 -0
  7. package/dist/chunk-2BF6HJJD.js +54 -0
  8. package/dist/chunk-2BF6HJJD.js.map +1 -0
  9. package/dist/{chunk-Z7RJ3K3J.js → chunk-3TETB22A.js} +2 -2
  10. package/dist/{chunk-JRVJXAVC.js → chunk-4NEO5KB2.js} +30 -30
  11. package/dist/chunk-4NEO5KB2.js.map +1 -0
  12. package/dist/{chunk-XWVBLISN.js → chunk-4XPVU3N2.js} +2 -2
  13. package/dist/chunk-57Y2WZT2.js +55 -0
  14. package/dist/chunk-57Y2WZT2.js.map +1 -0
  15. package/dist/{chunk-UDMI4TYM.js → chunk-ANC5QXFB.js} +2 -2
  16. package/dist/chunk-BI6VG4DV.js +37 -0
  17. package/dist/chunk-BI6VG4DV.js.map +1 -0
  18. package/dist/{chunk-KDQI5S7F.js → chunk-D5IHICX3.js} +2 -2
  19. package/dist/{chunk-724IBN5Y.js → chunk-F5PVUB4Y.js} +2 -2
  20. package/dist/{chunk-3K35L73A.js → chunk-F7GKG5ZO.js} +2 -2
  21. package/dist/{chunk-KKQPV6SO.js → chunk-GUEIF7ZF.js} +2 -2
  22. package/dist/{chunk-JNKATLF7.js → chunk-GZY5DYXT.js} +2 -2
  23. package/dist/{chunk-VCQVF44A.js → chunk-HIUHKOKK.js} +2 -2
  24. package/dist/chunk-IDZXAOBC.js +156 -0
  25. package/dist/chunk-IDZXAOBC.js.map +1 -0
  26. package/dist/chunk-IZDKRNXC.js +52 -0
  27. package/dist/chunk-IZDKRNXC.js.map +1 -0
  28. package/dist/{chunk-ZG4G6BFP.js → chunk-JA5Y4LDP.js} +2 -2
  29. package/dist/{chunk-KQH4LPYC.js → chunk-KUOH5MFS.js} +2 -2
  30. package/dist/{chunk-WWNZL7XB.js → chunk-OQV3LWJI.js} +2 -2
  31. package/dist/{chunk-CM74OUXW.js → chunk-PHCWYKQW.js} +2 -2
  32. package/dist/{chunk-QNKSRROH.js → chunk-RJFPCW7T.js} +2 -2
  33. package/dist/{chunk-74LPAKQY.js → chunk-RTHZQGFC.js} +2 -2
  34. package/dist/{chunk-MDGYSHO5.js → chunk-S2UXDEGW.js} +2 -2
  35. package/dist/{chunk-62NXS7PT.js → chunk-SJPQQ4OF.js} +221 -221
  36. package/dist/chunk-SJPQQ4OF.js.map +1 -0
  37. package/dist/{chunk-A6QJ4VFT.js → chunk-V4IFJLQS.js} +2 -2
  38. package/dist/{chunk-3WYLK3SX.js → chunk-VH2ASPFQ.js} +2 -2
  39. package/dist/{chunk-RYGVTAP4.js → chunk-ZN5DC6WS.js} +2 -2
  40. package/dist/cli.js +1 -1
  41. package/dist/{client-TXZF32NO.js → client-7UW2ELPP.js} +2 -2
  42. package/dist/config-TNYVPT4R.js +2 -0
  43. package/dist/{config-mutate-KDBXIN7R.js → config-mutate-GV7BVG3I.js} +2 -2
  44. package/dist/config-mutator-AKCR3VKM.js +2 -0
  45. package/dist/{contributions-FBVULRR4.js → contributions-J57B3KIX.js} +2 -2
  46. package/dist/{doctor-NBWYG743.js → doctor-ROKIYJRT.js} +2 -2
  47. package/dist/follow-up-tool-S2U7DFSW.js +7 -0
  48. package/dist/follow-up-tool-S2U7DFSW.js.map +1 -0
  49. package/dist/{hub-3QTJ7E3O.js → hub-HOVJC4HR.js} +2 -2
  50. package/dist/index.d.ts +1339 -3
  51. package/dist/index.js +1 -1
  52. package/dist/{program-SA5O6IQ3.js → program-LAOU5DQ3.js} +195 -195
  53. package/dist/program-LAOU5DQ3.js.map +1 -0
  54. package/dist/{promote-4XHYWHLA.js → promote-FVWRM4BE.js} +2 -2
  55. package/dist/query-HBCL3FHO.js +2 -0
  56. package/dist/query-settings-RD6GEN2V.js +3 -0
  57. package/dist/query-settings-RD6GEN2V.js.map +1 -0
  58. package/dist/{registry-LM35AE2P.js → registry-NT4H7HYP.js} +2 -2
  59. package/dist/{request-planner-4BAAOUBH.js → request-planner-JOXSAAHO.js} +2 -2
  60. package/dist/{review-candidates-TM53WR7G.js → review-candidates-6N5435V7.js} +2 -2
  61. package/dist/{routing-QLS6UMLM.js → routing-6G2QVFIG.js} +2 -2
  62. package/dist/schedule-tool-3NYUPKSC.js +2 -0
  63. package/dist/{scheduler-PVXLF2VJ.js → scheduler-WOH2O3EP.js} +2 -2
  64. package/dist/{seat-OUUN3F45.js → seat-I2FBJDTV.js} +2 -2
  65. package/dist/{select-D7UUSODY.js → select-5YZQJLLD.js} +2 -2
  66. package/dist/{set-enabled-FDNS6KW6.js → set-enabled-CQEUZLHU.js} +2 -2
  67. package/dist/{tool-J5FM3OPM.js → tool-PIJXUBEC.js} +2 -2
  68. package/dist/{tool-SCBQYDI3.js → tool-R77KFLZ3.js} +2 -2
  69. package/dist/wiki-GCOFERTB.js +2 -0
  70. package/package.json +2 -1
  71. package/dist/board-dashboard-44JPXA7J.js.map +0 -1
  72. package/dist/chunk-2ZDV3DCT.js +0 -52
  73. package/dist/chunk-2ZDV3DCT.js.map +0 -1
  74. package/dist/chunk-62NXS7PT.js.map +0 -1
  75. package/dist/chunk-7D3RJSN4.js +0 -156
  76. package/dist/chunk-7D3RJSN4.js.map +0 -1
  77. package/dist/chunk-EQ33PFXP.js +0 -55
  78. package/dist/chunk-EQ33PFXP.js.map +0 -1
  79. package/dist/chunk-JRVJXAVC.js.map +0 -1
  80. package/dist/chunk-RH3J4LCP.js +0 -37
  81. package/dist/chunk-RH3J4LCP.js.map +0 -1
  82. package/dist/chunk-S2RRPTS3.js +0 -54
  83. package/dist/chunk-S2RRPTS3.js.map +0 -1
  84. package/dist/config-ZIXIH23X.js +0 -2
  85. package/dist/config-mutator-HKFGPJMG.js +0 -2
  86. package/dist/follow-up-tool-E5XKSPKA.js +0 -6
  87. package/dist/follow-up-tool-E5XKSPKA.js.map +0 -1
  88. package/dist/program-SA5O6IQ3.js.map +0 -1
  89. package/dist/query-ZGD32CE2.js +0 -2
  90. package/dist/query-settings-BSDXFS3V.js +0 -3
  91. package/dist/query-settings-BSDXFS3V.js.map +0 -1
  92. package/dist/schedule-tool-TTCWBAQ4.js +0 -2
  93. package/dist/wiki-IGRRQL6H.js +0 -2
  94. /package/dist/{App-VPYWOTTH.js.map → App-WQPA77VJ.js.map} +0 -0
  95. /package/dist/{ChatApp-SNED4KJB.js.map → ChatApp-TGW66I4Y.js.map} +0 -0
  96. /package/dist/{absorb-eval-WGO4JWTO.js.map → absorb-eval-37XZJACN.js.map} +0 -0
  97. /package/dist/{agent-HXQYYLWZ.js.map → agent-FWHYHXWC.js.map} +0 -0
  98. /package/dist/{chunk-Z7RJ3K3J.js.map → chunk-3TETB22A.js.map} +0 -0
  99. /package/dist/{chunk-XWVBLISN.js.map → chunk-4XPVU3N2.js.map} +0 -0
  100. /package/dist/{chunk-UDMI4TYM.js.map → chunk-ANC5QXFB.js.map} +0 -0
  101. /package/dist/{chunk-KDQI5S7F.js.map → chunk-D5IHICX3.js.map} +0 -0
  102. /package/dist/{chunk-724IBN5Y.js.map → chunk-F5PVUB4Y.js.map} +0 -0
  103. /package/dist/{chunk-3K35L73A.js.map → chunk-F7GKG5ZO.js.map} +0 -0
  104. /package/dist/{chunk-KKQPV6SO.js.map → chunk-GUEIF7ZF.js.map} +0 -0
  105. /package/dist/{chunk-JNKATLF7.js.map → chunk-GZY5DYXT.js.map} +0 -0
  106. /package/dist/{chunk-VCQVF44A.js.map → chunk-HIUHKOKK.js.map} +0 -0
  107. /package/dist/{chunk-ZG4G6BFP.js.map → chunk-JA5Y4LDP.js.map} +0 -0
  108. /package/dist/{chunk-KQH4LPYC.js.map → chunk-KUOH5MFS.js.map} +0 -0
  109. /package/dist/{chunk-WWNZL7XB.js.map → chunk-OQV3LWJI.js.map} +0 -0
  110. /package/dist/{chunk-CM74OUXW.js.map → chunk-PHCWYKQW.js.map} +0 -0
  111. /package/dist/{chunk-QNKSRROH.js.map → chunk-RJFPCW7T.js.map} +0 -0
  112. /package/dist/{chunk-74LPAKQY.js.map → chunk-RTHZQGFC.js.map} +0 -0
  113. /package/dist/{chunk-MDGYSHO5.js.map → chunk-S2UXDEGW.js.map} +0 -0
  114. /package/dist/{chunk-A6QJ4VFT.js.map → chunk-V4IFJLQS.js.map} +0 -0
  115. /package/dist/{chunk-3WYLK3SX.js.map → chunk-VH2ASPFQ.js.map} +0 -0
  116. /package/dist/{chunk-RYGVTAP4.js.map → chunk-ZN5DC6WS.js.map} +0 -0
  117. /package/dist/{client-TXZF32NO.js.map → client-7UW2ELPP.js.map} +0 -0
  118. /package/dist/{config-ZIXIH23X.js.map → config-TNYVPT4R.js.map} +0 -0
  119. /package/dist/{config-mutate-KDBXIN7R.js.map → config-mutate-GV7BVG3I.js.map} +0 -0
  120. /package/dist/{config-mutator-HKFGPJMG.js.map → config-mutator-AKCR3VKM.js.map} +0 -0
  121. /package/dist/{contributions-FBVULRR4.js.map → contributions-J57B3KIX.js.map} +0 -0
  122. /package/dist/{doctor-NBWYG743.js.map → doctor-ROKIYJRT.js.map} +0 -0
  123. /package/dist/{hub-3QTJ7E3O.js.map → hub-HOVJC4HR.js.map} +0 -0
  124. /package/dist/{promote-4XHYWHLA.js.map → promote-FVWRM4BE.js.map} +0 -0
  125. /package/dist/{query-ZGD32CE2.js.map → query-HBCL3FHO.js.map} +0 -0
  126. /package/dist/{registry-LM35AE2P.js.map → registry-NT4H7HYP.js.map} +0 -0
  127. /package/dist/{request-planner-4BAAOUBH.js.map → request-planner-JOXSAAHO.js.map} +0 -0
  128. /package/dist/{review-candidates-TM53WR7G.js.map → review-candidates-6N5435V7.js.map} +0 -0
  129. /package/dist/{routing-QLS6UMLM.js.map → routing-6G2QVFIG.js.map} +0 -0
  130. /package/dist/{schedule-tool-TTCWBAQ4.js.map → schedule-tool-3NYUPKSC.js.map} +0 -0
  131. /package/dist/{scheduler-PVXLF2VJ.js.map → scheduler-WOH2O3EP.js.map} +0 -0
  132. /package/dist/{seat-OUUN3F45.js.map → seat-I2FBJDTV.js.map} +0 -0
  133. /package/dist/{select-D7UUSODY.js.map → select-5YZQJLLD.js.map} +0 -0
  134. /package/dist/{set-enabled-FDNS6KW6.js.map → set-enabled-CQEUZLHU.js.map} +0 -0
  135. /package/dist/{tool-J5FM3OPM.js.map → tool-PIJXUBEC.js.map} +0 -0
  136. /package/dist/{tool-SCBQYDI3.js.map → tool-R77KFLZ3.js.map} +0 -0
  137. /package/dist/{wiki-IGRRQL6H.js.map → wiki-GCOFERTB.js.map} +0 -0
package/dist/index.d.ts CHANGED
@@ -3114,7 +3114,9 @@ declare const daemonConfigSchema: z.ZodObject<{
3114
3114
  /** How pages are picked (#855). `summaries`: from the one-line page
3115
3115
  * summaries `agentx wiki summarize` writes, then a live read.
3116
3116
  * `catalog`: from titles, then a walk along the pages' links.
3117
- * `auto`: `summaries` once summaries exist, `catalog` until then. */
3117
+ * `auto`: `summaries` once most of the agent's own pages have a
3118
+ * summary (AUTO_SUMMARY_COVERAGE in src/wiki/query.ts), `catalog`
3119
+ * until then. */
3118
3120
  method: z.ZodDefault<z.ZodEnum<["auto", "summaries", "catalog"]>>;
3119
3121
  /** The agent's own pages shown to the model that picks. */
3120
3122
  candidates: z.ZodDefault<z.ZodNumber>;
@@ -3122,6 +3124,9 @@ declare const daemonConfigSchema: z.ZodObject<{
3122
3124
  sharedCandidates: z.ZodDefault<z.ZodNumber>;
3123
3125
  /** Most pages opened for one answer. */
3124
3126
  maxPages: z.ZodDefault<z.ZodNumber>;
3127
+ /** Pages also opened along the `related` links of the picked pages
3128
+ * (summaries method), in total. 0: none. */
3129
+ linkedPages: z.ZodDefault<z.ZodNumber>;
3125
3130
  /** Characters of each opened page given to the answer. */
3126
3131
  pageChars: z.ZodDefault<z.ZodNumber>;
3127
3132
  /** Model that picks pages from the summary lines. */
@@ -3291,6 +3296,7 @@ declare const daemonConfigSchema: z.ZodObject<{
3291
3296
  candidates: number;
3292
3297
  sharedCandidates: number;
3293
3298
  maxPages: number;
3299
+ linkedPages: number;
3294
3300
  pageChars: number;
3295
3301
  navigatorModel: string;
3296
3302
  answerModel: string;
@@ -3329,6 +3335,7 @@ declare const daemonConfigSchema: z.ZodObject<{
3329
3335
  candidates?: number | undefined;
3330
3336
  sharedCandidates?: number | undefined;
3331
3337
  maxPages?: number | undefined;
3338
+ linkedPages?: number | undefined;
3332
3339
  pageChars?: number | undefined;
3333
3340
  navigatorModel?: string | undefined;
3334
3341
  answerModel?: string | undefined;
@@ -3371,8 +3378,8 @@ declare const daemonConfigSchema: z.ZodObject<{
3371
3378
  maxWords: z.ZodDefault<z.ZodNumber>;
3372
3379
  /** When `agentx wiki summarize` runs on its own (cron, 5 fields).
3373
3380
  * Unset: no job is added. */
3374
- schedule: z.ZodOptional<z.ZodString>;
3375
- timezone: z.ZodDefault<z.ZodString>;
3381
+ schedule: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
3382
+ timezone: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
3376
3383
  /** Agent the job is filed under. Unset: `node.defaultAgent`, else
3377
3384
  * the first agent. */
3378
3385
  agent: z.ZodOptional<z.ZodString>;
@@ -3411,6 +3418,7 @@ declare const daemonConfigSchema: z.ZodObject<{
3411
3418
  candidates: number;
3412
3419
  sharedCandidates: number;
3413
3420
  maxPages: number;
3421
+ linkedPages: number;
3414
3422
  pageChars: number;
3415
3423
  navigatorModel: string;
3416
3424
  answerModel: string;
@@ -3470,6 +3478,7 @@ declare const daemonConfigSchema: z.ZodObject<{
3470
3478
  candidates?: number | undefined;
3471
3479
  sharedCandidates?: number | undefined;
3472
3480
  maxPages?: number | undefined;
3481
+ linkedPages?: number | undefined;
3473
3482
  pageChars?: number | undefined;
3474
3483
  navigatorModel?: string | undefined;
3475
3484
  answerModel?: string | undefined;
@@ -7374,6 +7383,26 @@ declare const daemonConfigSchema: z.ZodObject<{
7374
7383
  stallMinutes?: number | undefined;
7375
7384
  maxNudges?: number | undefined;
7376
7385
  }>>;
7386
+ /** Run every task through a workflow (#858): a saved workflow that
7387
+ * fits, else a plan the agent writes first, else the one-step
7388
+ * `linear` template. Needs `enabled`. Off by default. */
7389
+ required: z.ZodDefault<z.ZodObject<{
7390
+ enabled: z.ZodDefault<z.ZodBoolean>;
7391
+ /** Per agent, by id: true or false wins over `enabled`. */
7392
+ agents: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
7393
+ /** A plain question answered in one turn, with no plan and only tools
7394
+ * that change nothing, leaves no run. On by default: such a turn has
7395
+ * nothing to follow up. */
7396
+ exemptQuestions: z.ZodDefault<z.ZodBoolean>;
7397
+ }, "strip", z.ZodTypeAny, {
7398
+ enabled: boolean;
7399
+ agents: Record<string, boolean>;
7400
+ exemptQuestions: boolean;
7401
+ }, {
7402
+ enabled?: boolean | undefined;
7403
+ agents?: Record<string, boolean> | undefined;
7404
+ exemptQuestions?: boolean | undefined;
7405
+ }>>;
7377
7406
  /** Controls whether the dashboard exposes the visual editor. "readonly"
7378
7407
  * serves the list + run timelines but strips write controls from the
7379
7408
  * page. "disabled" hides the tab entirely. */
@@ -7381,6 +7410,11 @@ declare const daemonConfigSchema: z.ZodObject<{
7381
7410
  }, "strip", z.ZodTypeAny, {
7382
7411
  dir: string;
7383
7412
  enabled: boolean;
7413
+ required: {
7414
+ enabled: boolean;
7415
+ agents: Record<string, boolean>;
7416
+ exemptQuestions: boolean;
7417
+ };
7384
7418
  followUp: {
7385
7419
  enabled: boolean;
7386
7420
  agents: Record<string, boolean>;
@@ -7402,6 +7436,11 @@ declare const daemonConfigSchema: z.ZodObject<{
7402
7436
  }, {
7403
7437
  dir?: string | undefined;
7404
7438
  enabled?: boolean | undefined;
7439
+ required?: {
7440
+ enabled?: boolean | undefined;
7441
+ agents?: Record<string, boolean> | undefined;
7442
+ exemptQuestions?: boolean | undefined;
7443
+ } | undefined;
7405
7444
  followUp?: {
7406
7445
  enabled?: boolean | undefined;
7407
7446
  agents?: Record<string, boolean> | undefined;
@@ -8058,6 +8097,7 @@ declare const daemonConfigSchema: z.ZodObject<{
8058
8097
  candidates: number;
8059
8098
  sharedCandidates: number;
8060
8099
  maxPages: number;
8100
+ linkedPages: number;
8061
8101
  pageChars: number;
8062
8102
  navigatorModel: string;
8063
8103
  answerModel: string;
@@ -8685,6 +8725,11 @@ declare const daemonConfigSchema: z.ZodObject<{
8685
8725
  workflows: {
8686
8726
  dir: string;
8687
8727
  enabled: boolean;
8728
+ required: {
8729
+ enabled: boolean;
8730
+ agents: Record<string, boolean>;
8731
+ exemptQuestions: boolean;
8732
+ };
8688
8733
  followUp: {
8689
8734
  enabled: boolean;
8690
8735
  agents: Record<string, boolean>;
@@ -9008,6 +9053,7 @@ declare const daemonConfigSchema: z.ZodObject<{
9008
9053
  candidates?: number | undefined;
9009
9054
  sharedCandidates?: number | undefined;
9010
9055
  maxPages?: number | undefined;
9056
+ linkedPages?: number | undefined;
9011
9057
  pageChars?: number | undefined;
9012
9058
  navigatorModel?: string | undefined;
9013
9059
  answerModel?: string | undefined;
@@ -9697,6 +9743,11 @@ declare const daemonConfigSchema: z.ZodObject<{
9697
9743
  workflows?: {
9698
9744
  dir?: string | undefined;
9699
9745
  enabled?: boolean | undefined;
9746
+ required?: {
9747
+ enabled?: boolean | undefined;
9748
+ agents?: Record<string, boolean> | undefined;
9749
+ exemptQuestions?: boolean | undefined;
9750
+ } | undefined;
9700
9751
  followUp?: {
9701
9752
  enabled?: boolean | undefined;
9702
9753
  agents?: Record<string, boolean> | undefined;
@@ -13248,6 +13299,1271 @@ declare class LandscapeBuilder {
13248
13299
  private extractCapability;
13249
13300
  }
13250
13301
 
13302
+ declare const runStatusSchema: z.ZodEnum<["running", "paused", "completed", "failed", "canceled"]>;
13303
+ type RunStatus = z.infer<typeof runStatusSchema>;
13304
+ declare const nodeExecutionEntrySchema: z.ZodObject<{
13305
+ at: z.ZodString;
13306
+ nodeId: z.ZodString;
13307
+ /** Which upstream node outputs fed this execution. Usually one id, or
13308
+ * empty for the trigger. */
13309
+ inputKeys: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
13310
+ status: z.ZodEnum<["ok", "failed", "timeout", "skipped", "paused", "resumed"]>;
13311
+ /** The node's output bundle, if successful. Stored here so the full run
13312
+ * history can be replayed without the live context. */
13313
+ output: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
13314
+ /** Per-(runId, nodeId, eventId) key used to drop duplicate webhook
13315
+ * deliveries when a run is resumed from a checkpoint. */
13316
+ idempotencyKey: z.ZodString;
13317
+ note: z.ZodOptional<z.ZodString>;
13318
+ /** When the step began (#858). `at` is when it was recorded, so the
13319
+ * step took `durationMs` from here. Absent on entries written before. */
13320
+ startedAt: z.ZodOptional<z.ZodString>;
13321
+ /** How long the step ran, in milliseconds (#858). */
13322
+ durationMs: z.ZodOptional<z.ZodNumber>;
13323
+ }, "strip", z.ZodTypeAny, {
13324
+ at: string;
13325
+ status: "timeout" | "ok" | "failed" | "skipped" | "resumed" | "paused";
13326
+ idempotencyKey: string;
13327
+ nodeId: string;
13328
+ inputKeys: string[];
13329
+ output?: Record<string, unknown> | undefined;
13330
+ durationMs?: number | undefined;
13331
+ note?: string | undefined;
13332
+ startedAt?: string | undefined;
13333
+ }, {
13334
+ at: string;
13335
+ status: "timeout" | "ok" | "failed" | "skipped" | "resumed" | "paused";
13336
+ idempotencyKey: string;
13337
+ nodeId: string;
13338
+ output?: Record<string, unknown> | undefined;
13339
+ durationMs?: number | undefined;
13340
+ note?: string | undefined;
13341
+ startedAt?: string | undefined;
13342
+ inputKeys?: string[] | undefined;
13343
+ }>;
13344
+ type NodeExecutionEntry = z.infer<typeof nodeExecutionEntrySchema>;
13345
+ declare const entityRefSchema: z.ZodObject<{
13346
+ backend: z.ZodString;
13347
+ /** Stable identifier for the entity this run is scoped to. Used to key
13348
+ * the entity index so webhook re-entry can find the active run. */
13349
+ id: z.ZodString;
13350
+ }, "strip", z.ZodTypeAny, {
13351
+ id: string;
13352
+ backend: string;
13353
+ }, {
13354
+ id: string;
13355
+ backend: string;
13356
+ }>;
13357
+ type EntityRef = z.infer<typeof entityRefSchema>;
13358
+ declare const pausedAtSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
13359
+ kind: z.ZodLiteral<"checkpoint">;
13360
+ nodeId: z.ZodString;
13361
+ checkpointName: z.ZodString;
13362
+ /** Filter applied to incoming events for resume. Same shape as the
13363
+ * matching trigger.channel filter. */
13364
+ resumeMatch: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
13365
+ }, "strip", z.ZodTypeAny, {
13366
+ kind: "checkpoint";
13367
+ nodeId: string;
13368
+ checkpointName: string;
13369
+ resumeMatch: Record<string, unknown>;
13370
+ }, {
13371
+ kind: "checkpoint";
13372
+ nodeId: string;
13373
+ checkpointName: string;
13374
+ resumeMatch?: Record<string, unknown> | undefined;
13375
+ }>, z.ZodObject<{
13376
+ kind: z.ZodLiteral<"subProcess">;
13377
+ nodeId: z.ZodString;
13378
+ childRunId: z.ZodString;
13379
+ childWorkflowId: z.ZodString;
13380
+ }, "strip", z.ZodTypeAny, {
13381
+ kind: "subProcess";
13382
+ nodeId: string;
13383
+ childRunId: string;
13384
+ childWorkflowId: string;
13385
+ }, {
13386
+ kind: "subProcess";
13387
+ nodeId: string;
13388
+ childRunId: string;
13389
+ childWorkflowId: string;
13390
+ }>, z.ZodObject<{
13391
+ kind: z.ZodLiteral<"signalWait">;
13392
+ nodeId: z.ZodString;
13393
+ signalName: z.ZodString;
13394
+ /** Optional field-match filter against the emitted signal payload. */
13395
+ match: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
13396
+ scope: z.ZodDefault<z.ZodEnum<["workflow", "global"]>>;
13397
+ }, "strip", z.ZodTypeAny, {
13398
+ match: Record<string, unknown>;
13399
+ kind: "signalWait";
13400
+ scope: "workflow" | "global";
13401
+ nodeId: string;
13402
+ signalName: string;
13403
+ }, {
13404
+ kind: "signalWait";
13405
+ nodeId: string;
13406
+ signalName: string;
13407
+ match?: Record<string, unknown> | undefined;
13408
+ scope?: "workflow" | "global" | undefined;
13409
+ }>, z.ZodObject<{
13410
+ kind: z.ZodLiteral<"timerWait">;
13411
+ nodeId: z.ZodString;
13412
+ /** ISO-8601 instant when the timer should fire. */
13413
+ fireAt: z.ZodString;
13414
+ }, "strip", z.ZodTypeAny, {
13415
+ kind: "timerWait";
13416
+ nodeId: string;
13417
+ fireAt: string;
13418
+ }, {
13419
+ kind: "timerWait";
13420
+ nodeId: string;
13421
+ fireAt: string;
13422
+ }>, z.ZodObject<{
13423
+ kind: z.ZodLiteral<"ownerDecision">;
13424
+ nodeId: z.ZodString;
13425
+ cardId: z.ZodString;
13426
+ purpose: z.ZodEnum<["ask", "send", "start"]>;
13427
+ message: z.ZodOptional<z.ZodObject<{
13428
+ channel: z.ZodString;
13429
+ chatId: z.ZodString;
13430
+ accountId: z.ZodOptional<z.ZodString>;
13431
+ text: z.ZodString;
13432
+ to: z.ZodOptional<z.ZodString>;
13433
+ }, "strip", z.ZodTypeAny, {
13434
+ text: string;
13435
+ channel: string;
13436
+ chatId: string;
13437
+ to?: string | undefined;
13438
+ accountId?: string | undefined;
13439
+ }, {
13440
+ text: string;
13441
+ channel: string;
13442
+ chatId: string;
13443
+ to?: string | undefined;
13444
+ accountId?: string | undefined;
13445
+ }>>;
13446
+ }, "strip", z.ZodTypeAny, {
13447
+ kind: "ownerDecision";
13448
+ cardId: string;
13449
+ nodeId: string;
13450
+ purpose: "start" | "send" | "ask";
13451
+ message?: {
13452
+ text: string;
13453
+ channel: string;
13454
+ chatId: string;
13455
+ to?: string | undefined;
13456
+ accountId?: string | undefined;
13457
+ } | undefined;
13458
+ }, {
13459
+ kind: "ownerDecision";
13460
+ cardId: string;
13461
+ nodeId: string;
13462
+ purpose: "start" | "send" | "ask";
13463
+ message?: {
13464
+ text: string;
13465
+ channel: string;
13466
+ chatId: string;
13467
+ to?: string | undefined;
13468
+ accountId?: string | undefined;
13469
+ } | undefined;
13470
+ }>, z.ZodObject<{
13471
+ kind: z.ZodLiteral<"replyWait">;
13472
+ nodeId: z.ZodString;
13473
+ channel: z.ZodString;
13474
+ chatId: z.ZodString;
13475
+ accountId: z.ZodOptional<z.ZodString>;
13476
+ /** In a group: only this sender's message counts. */
13477
+ from: z.ZodOptional<z.ZodString>;
13478
+ deadline: z.ZodString;
13479
+ nextRemindAt: z.ZodOptional<z.ZodString>;
13480
+ remindEveryMs: z.ZodOptional<z.ZodNumber>;
13481
+ reminders: z.ZodDefault<z.ZodNumber>;
13482
+ maxReminders: z.ZodDefault<z.ZodNumber>;
13483
+ /** A person.message step whose sent text the reminder repeats. Unset:
13484
+ * the reminder goes to the owner instead. */
13485
+ reminds: z.ZodOptional<z.ZodString>;
13486
+ }, "strip", z.ZodTypeAny, {
13487
+ channel: string;
13488
+ chatId: string;
13489
+ kind: "replyWait";
13490
+ reminders: number;
13491
+ nodeId: string;
13492
+ deadline: string;
13493
+ maxReminders: number;
13494
+ from?: string | undefined;
13495
+ accountId?: string | undefined;
13496
+ nextRemindAt?: string | undefined;
13497
+ remindEveryMs?: number | undefined;
13498
+ reminds?: string | undefined;
13499
+ }, {
13500
+ channel: string;
13501
+ chatId: string;
13502
+ kind: "replyWait";
13503
+ nodeId: string;
13504
+ deadline: string;
13505
+ from?: string | undefined;
13506
+ accountId?: string | undefined;
13507
+ reminders?: number | undefined;
13508
+ nextRemindAt?: string | undefined;
13509
+ remindEveryMs?: number | undefined;
13510
+ maxReminders?: number | undefined;
13511
+ reminds?: string | undefined;
13512
+ }>, z.ZodObject<{
13513
+ kind: z.ZodLiteral<"agentStep">;
13514
+ nodeId: z.ZodString;
13515
+ agentId: z.ZodString;
13516
+ nudges: z.ZodDefault<z.ZodNumber>;
13517
+ maxNudges: z.ZodDefault<z.ZodNumber>;
13518
+ stallMs: z.ZodNumber;
13519
+ nextNudgeAt: z.ZodOptional<z.ZodString>;
13520
+ /** Set once the step is blocked: no more nudges, the owner is told. */
13521
+ blocked: z.ZodOptional<z.ZodString>;
13522
+ }, "strip", z.ZodTypeAny, {
13523
+ kind: "agentStep";
13524
+ agentId: string;
13525
+ nudges: number;
13526
+ maxNudges: number;
13527
+ nodeId: string;
13528
+ stallMs: number;
13529
+ blocked?: string | undefined;
13530
+ nextNudgeAt?: string | undefined;
13531
+ }, {
13532
+ kind: "agentStep";
13533
+ agentId: string;
13534
+ nodeId: string;
13535
+ stallMs: number;
13536
+ blocked?: string | undefined;
13537
+ nudges?: number | undefined;
13538
+ maxNudges?: number | undefined;
13539
+ nextNudgeAt?: string | undefined;
13540
+ }>]>;
13541
+ type PausedAt = z.infer<typeof pausedAtSchema>;
13542
+ /** What a follow-up run is about and who started it (#788). Runs that
13543
+ * triggers start have none. */
13544
+ declare const runMetaSchema: z.ZodObject<{
13545
+ /** One line: what this run is doing, in the owner's words. */
13546
+ title: z.ZodOptional<z.ZodString>;
13547
+ /** What the run concerns, as "kind:name" (client:acme, employee:sam,
13548
+ * project:site, idea:newsletter). The progress view groups by these. */
13549
+ tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
13550
+ /** The agent that started it. */
13551
+ startedBy: z.ZodOptional<z.ZodString>;
13552
+ /** The open request (src/requests) this run serves. */
13553
+ requestId: z.ZodOptional<z.ZodString>;
13554
+ /** Followed: nudges, reminders, a blocked notice and one summary at
13555
+ * the end. */
13556
+ followUp: z.ZodDefault<z.ZodBoolean>;
13557
+ /** The owner approved this run's messages when it started. */
13558
+ approvedAtStart: z.ZodDefault<z.ZodBoolean>;
13559
+ /** The messages that approval covers, by step id: recipient and text as
13560
+ * the owner saw them (messageKey). Any other message is asked again. */
13561
+ approved: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
13562
+ /** Why the run cannot go on without the owner, and when they were told. */
13563
+ blocked: z.ZodOptional<z.ZodObject<{
13564
+ nodeId: z.ZodString;
13565
+ reason: z.ZodString;
13566
+ at: z.ZodString;
13567
+ }, "strip", z.ZodTypeAny, {
13568
+ at: string;
13569
+ reason: string;
13570
+ nodeId: string;
13571
+ }, {
13572
+ at: string;
13573
+ reason: string;
13574
+ nodeId: string;
13575
+ }>>;
13576
+ /** The owner got the end summary. Sent once. */
13577
+ endNotifiedAt: z.ZodOptional<z.ZodString>;
13578
+ /** A task run inside a workflow because `workflows.required` is on
13579
+ * (#858): the agent turn it wraps. `mode` is `linear` (the one-step
13580
+ * template) until the agent writes a plan. */
13581
+ wrap: z.ZodOptional<z.ZodObject<{
13582
+ agentId: z.ZodString;
13583
+ channel: z.ZodString;
13584
+ mode: z.ZodEnum<["linear", "plan"]>;
13585
+ taskId: z.ZodOptional<z.ZodString>;
13586
+ }, "strip", z.ZodTypeAny, {
13587
+ channel: string;
13588
+ mode: "plan" | "linear";
13589
+ agentId: string;
13590
+ taskId?: string | undefined;
13591
+ }, {
13592
+ channel: string;
13593
+ mode: "plan" | "linear";
13594
+ agentId: string;
13595
+ taskId?: string | undefined;
13596
+ }>>;
13597
+ /** The plan the agent wrote for a wrapped task, and each change to it. */
13598
+ plan: z.ZodOptional<z.ZodObject<{
13599
+ steps: z.ZodArray<z.ZodObject<{
13600
+ id: z.ZodString;
13601
+ title: z.ZodString;
13602
+ }, "strip", z.ZodTypeAny, {
13603
+ id: string;
13604
+ title: string;
13605
+ }, {
13606
+ id: string;
13607
+ title: string;
13608
+ }>, "many">;
13609
+ /** The step the agent said it started, and when. */
13610
+ current: z.ZodOptional<z.ZodObject<{
13611
+ id: z.ZodString;
13612
+ startedAt: z.ZodString;
13613
+ }, "strip", z.ZodTypeAny, {
13614
+ id: string;
13615
+ startedAt: string;
13616
+ }, {
13617
+ id: string;
13618
+ startedAt: string;
13619
+ }>>;
13620
+ revisions: z.ZodDefault<z.ZodArray<z.ZodObject<{
13621
+ at: z.ZodString;
13622
+ /** `plan`: the first plan. `revise`: a change to the steps left. */
13623
+ kind: z.ZodEnum<["plan", "revise"]>;
13624
+ reason: z.ZodOptional<z.ZodString>;
13625
+ /** The step ids still to do after this change. */
13626
+ steps: z.ZodArray<z.ZodString, "many">;
13627
+ /** The step ids the change dropped. */
13628
+ dropped: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
13629
+ }, "strip", z.ZodTypeAny, {
13630
+ at: string;
13631
+ steps: string[];
13632
+ kind: "plan" | "revise";
13633
+ dropped: string[];
13634
+ reason?: string | undefined;
13635
+ }, {
13636
+ at: string;
13637
+ steps: string[];
13638
+ kind: "plan" | "revise";
13639
+ reason?: string | undefined;
13640
+ dropped?: string[] | undefined;
13641
+ }>, "many">>;
13642
+ }, "strip", z.ZodTypeAny, {
13643
+ steps: {
13644
+ id: string;
13645
+ title: string;
13646
+ }[];
13647
+ revisions: {
13648
+ at: string;
13649
+ steps: string[];
13650
+ kind: "plan" | "revise";
13651
+ dropped: string[];
13652
+ reason?: string | undefined;
13653
+ }[];
13654
+ current?: {
13655
+ id: string;
13656
+ startedAt: string;
13657
+ } | undefined;
13658
+ }, {
13659
+ steps: {
13660
+ id: string;
13661
+ title: string;
13662
+ }[];
13663
+ current?: {
13664
+ id: string;
13665
+ startedAt: string;
13666
+ } | undefined;
13667
+ revisions?: {
13668
+ at: string;
13669
+ steps: string[];
13670
+ kind: "plan" | "revise";
13671
+ reason?: string | undefined;
13672
+ dropped?: string[] | undefined;
13673
+ }[] | undefined;
13674
+ }>>;
13675
+ }, "strip", z.ZodTypeAny, {
13676
+ followUp: boolean;
13677
+ tags: string[];
13678
+ approvedAtStart: boolean;
13679
+ blocked?: {
13680
+ at: string;
13681
+ reason: string;
13682
+ nodeId: string;
13683
+ } | undefined;
13684
+ plan?: {
13685
+ steps: {
13686
+ id: string;
13687
+ title: string;
13688
+ }[];
13689
+ revisions: {
13690
+ at: string;
13691
+ steps: string[];
13692
+ kind: "plan" | "revise";
13693
+ dropped: string[];
13694
+ reason?: string | undefined;
13695
+ }[];
13696
+ current?: {
13697
+ id: string;
13698
+ startedAt: string;
13699
+ } | undefined;
13700
+ } | undefined;
13701
+ title?: string | undefined;
13702
+ approved?: Record<string, string> | undefined;
13703
+ requestId?: string | undefined;
13704
+ startedBy?: string | undefined;
13705
+ endNotifiedAt?: string | undefined;
13706
+ wrap?: {
13707
+ channel: string;
13708
+ mode: "plan" | "linear";
13709
+ agentId: string;
13710
+ taskId?: string | undefined;
13711
+ } | undefined;
13712
+ }, {
13713
+ followUp?: boolean | undefined;
13714
+ tags?: string[] | undefined;
13715
+ blocked?: {
13716
+ at: string;
13717
+ reason: string;
13718
+ nodeId: string;
13719
+ } | undefined;
13720
+ plan?: {
13721
+ steps: {
13722
+ id: string;
13723
+ title: string;
13724
+ }[];
13725
+ current?: {
13726
+ id: string;
13727
+ startedAt: string;
13728
+ } | undefined;
13729
+ revisions?: {
13730
+ at: string;
13731
+ steps: string[];
13732
+ kind: "plan" | "revise";
13733
+ reason?: string | undefined;
13734
+ dropped?: string[] | undefined;
13735
+ }[] | undefined;
13736
+ } | undefined;
13737
+ title?: string | undefined;
13738
+ approved?: Record<string, string> | undefined;
13739
+ requestId?: string | undefined;
13740
+ startedBy?: string | undefined;
13741
+ approvedAtStart?: boolean | undefined;
13742
+ endNotifiedAt?: string | undefined;
13743
+ wrap?: {
13744
+ channel: string;
13745
+ mode: "plan" | "linear";
13746
+ agentId: string;
13747
+ taskId?: string | undefined;
13748
+ } | undefined;
13749
+ }>;
13750
+ type RunMeta = z.infer<typeof runMetaSchema>;
13751
+ declare const workflowRunSchema: z.ZodObject<{
13752
+ id: z.ZodString;
13753
+ workflowId: z.ZodString;
13754
+ workflowVersion: z.ZodLiteral<2>;
13755
+ homeNode: z.ZodString;
13756
+ status: z.ZodEnum<["running", "paused", "completed", "failed", "canceled"]>;
13757
+ pausedAt: z.ZodOptional<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
13758
+ kind: z.ZodLiteral<"checkpoint">;
13759
+ nodeId: z.ZodString;
13760
+ checkpointName: z.ZodString;
13761
+ /** Filter applied to incoming events for resume. Same shape as the
13762
+ * matching trigger.channel filter. */
13763
+ resumeMatch: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
13764
+ }, "strip", z.ZodTypeAny, {
13765
+ kind: "checkpoint";
13766
+ nodeId: string;
13767
+ checkpointName: string;
13768
+ resumeMatch: Record<string, unknown>;
13769
+ }, {
13770
+ kind: "checkpoint";
13771
+ nodeId: string;
13772
+ checkpointName: string;
13773
+ resumeMatch?: Record<string, unknown> | undefined;
13774
+ }>, z.ZodObject<{
13775
+ kind: z.ZodLiteral<"subProcess">;
13776
+ nodeId: z.ZodString;
13777
+ childRunId: z.ZodString;
13778
+ childWorkflowId: z.ZodString;
13779
+ }, "strip", z.ZodTypeAny, {
13780
+ kind: "subProcess";
13781
+ nodeId: string;
13782
+ childRunId: string;
13783
+ childWorkflowId: string;
13784
+ }, {
13785
+ kind: "subProcess";
13786
+ nodeId: string;
13787
+ childRunId: string;
13788
+ childWorkflowId: string;
13789
+ }>, z.ZodObject<{
13790
+ kind: z.ZodLiteral<"signalWait">;
13791
+ nodeId: z.ZodString;
13792
+ signalName: z.ZodString;
13793
+ /** Optional field-match filter against the emitted signal payload. */
13794
+ match: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
13795
+ scope: z.ZodDefault<z.ZodEnum<["workflow", "global"]>>;
13796
+ }, "strip", z.ZodTypeAny, {
13797
+ match: Record<string, unknown>;
13798
+ kind: "signalWait";
13799
+ scope: "workflow" | "global";
13800
+ nodeId: string;
13801
+ signalName: string;
13802
+ }, {
13803
+ kind: "signalWait";
13804
+ nodeId: string;
13805
+ signalName: string;
13806
+ match?: Record<string, unknown> | undefined;
13807
+ scope?: "workflow" | "global" | undefined;
13808
+ }>, z.ZodObject<{
13809
+ kind: z.ZodLiteral<"timerWait">;
13810
+ nodeId: z.ZodString;
13811
+ /** ISO-8601 instant when the timer should fire. */
13812
+ fireAt: z.ZodString;
13813
+ }, "strip", z.ZodTypeAny, {
13814
+ kind: "timerWait";
13815
+ nodeId: string;
13816
+ fireAt: string;
13817
+ }, {
13818
+ kind: "timerWait";
13819
+ nodeId: string;
13820
+ fireAt: string;
13821
+ }>, z.ZodObject<{
13822
+ kind: z.ZodLiteral<"ownerDecision">;
13823
+ nodeId: z.ZodString;
13824
+ cardId: z.ZodString;
13825
+ purpose: z.ZodEnum<["ask", "send", "start"]>;
13826
+ message: z.ZodOptional<z.ZodObject<{
13827
+ channel: z.ZodString;
13828
+ chatId: z.ZodString;
13829
+ accountId: z.ZodOptional<z.ZodString>;
13830
+ text: z.ZodString;
13831
+ to: z.ZodOptional<z.ZodString>;
13832
+ }, "strip", z.ZodTypeAny, {
13833
+ text: string;
13834
+ channel: string;
13835
+ chatId: string;
13836
+ to?: string | undefined;
13837
+ accountId?: string | undefined;
13838
+ }, {
13839
+ text: string;
13840
+ channel: string;
13841
+ chatId: string;
13842
+ to?: string | undefined;
13843
+ accountId?: string | undefined;
13844
+ }>>;
13845
+ }, "strip", z.ZodTypeAny, {
13846
+ kind: "ownerDecision";
13847
+ cardId: string;
13848
+ nodeId: string;
13849
+ purpose: "start" | "send" | "ask";
13850
+ message?: {
13851
+ text: string;
13852
+ channel: string;
13853
+ chatId: string;
13854
+ to?: string | undefined;
13855
+ accountId?: string | undefined;
13856
+ } | undefined;
13857
+ }, {
13858
+ kind: "ownerDecision";
13859
+ cardId: string;
13860
+ nodeId: string;
13861
+ purpose: "start" | "send" | "ask";
13862
+ message?: {
13863
+ text: string;
13864
+ channel: string;
13865
+ chatId: string;
13866
+ to?: string | undefined;
13867
+ accountId?: string | undefined;
13868
+ } | undefined;
13869
+ }>, z.ZodObject<{
13870
+ kind: z.ZodLiteral<"replyWait">;
13871
+ nodeId: z.ZodString;
13872
+ channel: z.ZodString;
13873
+ chatId: z.ZodString;
13874
+ accountId: z.ZodOptional<z.ZodString>;
13875
+ /** In a group: only this sender's message counts. */
13876
+ from: z.ZodOptional<z.ZodString>;
13877
+ deadline: z.ZodString;
13878
+ nextRemindAt: z.ZodOptional<z.ZodString>;
13879
+ remindEveryMs: z.ZodOptional<z.ZodNumber>;
13880
+ reminders: z.ZodDefault<z.ZodNumber>;
13881
+ maxReminders: z.ZodDefault<z.ZodNumber>;
13882
+ /** A person.message step whose sent text the reminder repeats. Unset:
13883
+ * the reminder goes to the owner instead. */
13884
+ reminds: z.ZodOptional<z.ZodString>;
13885
+ }, "strip", z.ZodTypeAny, {
13886
+ channel: string;
13887
+ chatId: string;
13888
+ kind: "replyWait";
13889
+ reminders: number;
13890
+ nodeId: string;
13891
+ deadline: string;
13892
+ maxReminders: number;
13893
+ from?: string | undefined;
13894
+ accountId?: string | undefined;
13895
+ nextRemindAt?: string | undefined;
13896
+ remindEveryMs?: number | undefined;
13897
+ reminds?: string | undefined;
13898
+ }, {
13899
+ channel: string;
13900
+ chatId: string;
13901
+ kind: "replyWait";
13902
+ nodeId: string;
13903
+ deadline: string;
13904
+ from?: string | undefined;
13905
+ accountId?: string | undefined;
13906
+ reminders?: number | undefined;
13907
+ nextRemindAt?: string | undefined;
13908
+ remindEveryMs?: number | undefined;
13909
+ maxReminders?: number | undefined;
13910
+ reminds?: string | undefined;
13911
+ }>, z.ZodObject<{
13912
+ kind: z.ZodLiteral<"agentStep">;
13913
+ nodeId: z.ZodString;
13914
+ agentId: z.ZodString;
13915
+ nudges: z.ZodDefault<z.ZodNumber>;
13916
+ maxNudges: z.ZodDefault<z.ZodNumber>;
13917
+ stallMs: z.ZodNumber;
13918
+ nextNudgeAt: z.ZodOptional<z.ZodString>;
13919
+ /** Set once the step is blocked: no more nudges, the owner is told. */
13920
+ blocked: z.ZodOptional<z.ZodString>;
13921
+ }, "strip", z.ZodTypeAny, {
13922
+ kind: "agentStep";
13923
+ agentId: string;
13924
+ nudges: number;
13925
+ maxNudges: number;
13926
+ nodeId: string;
13927
+ stallMs: number;
13928
+ blocked?: string | undefined;
13929
+ nextNudgeAt?: string | undefined;
13930
+ }, {
13931
+ kind: "agentStep";
13932
+ agentId: string;
13933
+ nodeId: string;
13934
+ stallMs: number;
13935
+ blocked?: string | undefined;
13936
+ nudges?: number | undefined;
13937
+ maxNudges?: number | undefined;
13938
+ nextNudgeAt?: string | undefined;
13939
+ }>]>>;
13940
+ /** Output bundles keyed by producing node id. Downstream nodes read via
13941
+ * `{{<nodeId>.<path>}}` in templates. */
13942
+ context: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
13943
+ /** Node ids queued for execution next. The walk driver pops from this
13944
+ * until it's empty or a checkpoint pauses the run. */
13945
+ pending: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
13946
+ /** Per-`gateway.parallel(mode=join)` arrival tracker. Keys are join node
13947
+ * ids; values are the upstream node ids that have already delivered.
13948
+ * The join fires once when arrived.length === #incoming edges. Entries
13949
+ * are deleted from the map on fire so repeated passes (rare, but
13950
+ * possible via crash + retry) stay idempotent. */
13951
+ joinCounters: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
13952
+ entityRef: z.ZodObject<{
13953
+ backend: z.ZodString;
13954
+ /** Stable identifier for the entity this run is scoped to. Used to key
13955
+ * the entity index so webhook re-entry can find the active run. */
13956
+ id: z.ZodString;
13957
+ }, "strip", z.ZodTypeAny, {
13958
+ id: string;
13959
+ backend: string;
13960
+ }, {
13961
+ id: string;
13962
+ backend: string;
13963
+ }>;
13964
+ history: z.ZodDefault<z.ZodArray<z.ZodObject<{
13965
+ at: z.ZodString;
13966
+ nodeId: z.ZodString;
13967
+ /** Which upstream node outputs fed this execution. Usually one id, or
13968
+ * empty for the trigger. */
13969
+ inputKeys: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
13970
+ status: z.ZodEnum<["ok", "failed", "timeout", "skipped", "paused", "resumed"]>;
13971
+ /** The node's output bundle, if successful. Stored here so the full run
13972
+ * history can be replayed without the live context. */
13973
+ output: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
13974
+ /** Per-(runId, nodeId, eventId) key used to drop duplicate webhook
13975
+ * deliveries when a run is resumed from a checkpoint. */
13976
+ idempotencyKey: z.ZodString;
13977
+ note: z.ZodOptional<z.ZodString>;
13978
+ /** When the step began (#858). `at` is when it was recorded, so the
13979
+ * step took `durationMs` from here. Absent on entries written before. */
13980
+ startedAt: z.ZodOptional<z.ZodString>;
13981
+ /** How long the step ran, in milliseconds (#858). */
13982
+ durationMs: z.ZodOptional<z.ZodNumber>;
13983
+ }, "strip", z.ZodTypeAny, {
13984
+ at: string;
13985
+ status: "timeout" | "ok" | "failed" | "skipped" | "resumed" | "paused";
13986
+ idempotencyKey: string;
13987
+ nodeId: string;
13988
+ inputKeys: string[];
13989
+ output?: Record<string, unknown> | undefined;
13990
+ durationMs?: number | undefined;
13991
+ note?: string | undefined;
13992
+ startedAt?: string | undefined;
13993
+ }, {
13994
+ at: string;
13995
+ status: "timeout" | "ok" | "failed" | "skipped" | "resumed" | "paused";
13996
+ idempotencyKey: string;
13997
+ nodeId: string;
13998
+ output?: Record<string, unknown> | undefined;
13999
+ durationMs?: number | undefined;
14000
+ note?: string | undefined;
14001
+ startedAt?: string | undefined;
14002
+ inputKeys?: string[] | undefined;
14003
+ }>, "many">>;
14004
+ /** Parent run id if this run is a sub-process child. Root runs have no
14005
+ * parent. */
14006
+ parentRunId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
14007
+ /** The parent node in the parent run that spawned this child. Null on
14008
+ * root runs. */
14009
+ parentNodeId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
14010
+ /** Root ancestor. Self-referential on root runs. Lets queries fetch the
14011
+ * entire composition tree in one shot. */
14012
+ rootRunId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
14013
+ /** Depth from root. 0 on root runs, N on Nth-level descendants. */
14014
+ depth: z.ZodDefault<z.ZodNumber>;
14015
+ /** Event-bus root the run was started under (src/events/envelope.ts).
14016
+ * Resumes after a pause or restart publish under it again. */
14017
+ eventRootId: z.ZodOptional<z.ZodString>;
14018
+ /** Follow-up runs only (#788). */
14019
+ meta: z.ZodOptional<z.ZodObject<{
14020
+ /** One line: what this run is doing, in the owner's words. */
14021
+ title: z.ZodOptional<z.ZodString>;
14022
+ /** What the run concerns, as "kind:name" (client:acme, employee:sam,
14023
+ * project:site, idea:newsletter). The progress view groups by these. */
14024
+ tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
14025
+ /** The agent that started it. */
14026
+ startedBy: z.ZodOptional<z.ZodString>;
14027
+ /** The open request (src/requests) this run serves. */
14028
+ requestId: z.ZodOptional<z.ZodString>;
14029
+ /** Followed: nudges, reminders, a blocked notice and one summary at
14030
+ * the end. */
14031
+ followUp: z.ZodDefault<z.ZodBoolean>;
14032
+ /** The owner approved this run's messages when it started. */
14033
+ approvedAtStart: z.ZodDefault<z.ZodBoolean>;
14034
+ /** The messages that approval covers, by step id: recipient and text as
14035
+ * the owner saw them (messageKey). Any other message is asked again. */
14036
+ approved: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
14037
+ /** Why the run cannot go on without the owner, and when they were told. */
14038
+ blocked: z.ZodOptional<z.ZodObject<{
14039
+ nodeId: z.ZodString;
14040
+ reason: z.ZodString;
14041
+ at: z.ZodString;
14042
+ }, "strip", z.ZodTypeAny, {
14043
+ at: string;
14044
+ reason: string;
14045
+ nodeId: string;
14046
+ }, {
14047
+ at: string;
14048
+ reason: string;
14049
+ nodeId: string;
14050
+ }>>;
14051
+ /** The owner got the end summary. Sent once. */
14052
+ endNotifiedAt: z.ZodOptional<z.ZodString>;
14053
+ /** A task run inside a workflow because `workflows.required` is on
14054
+ * (#858): the agent turn it wraps. `mode` is `linear` (the one-step
14055
+ * template) until the agent writes a plan. */
14056
+ wrap: z.ZodOptional<z.ZodObject<{
14057
+ agentId: z.ZodString;
14058
+ channel: z.ZodString;
14059
+ mode: z.ZodEnum<["linear", "plan"]>;
14060
+ taskId: z.ZodOptional<z.ZodString>;
14061
+ }, "strip", z.ZodTypeAny, {
14062
+ channel: string;
14063
+ mode: "plan" | "linear";
14064
+ agentId: string;
14065
+ taskId?: string | undefined;
14066
+ }, {
14067
+ channel: string;
14068
+ mode: "plan" | "linear";
14069
+ agentId: string;
14070
+ taskId?: string | undefined;
14071
+ }>>;
14072
+ /** The plan the agent wrote for a wrapped task, and each change to it. */
14073
+ plan: z.ZodOptional<z.ZodObject<{
14074
+ steps: z.ZodArray<z.ZodObject<{
14075
+ id: z.ZodString;
14076
+ title: z.ZodString;
14077
+ }, "strip", z.ZodTypeAny, {
14078
+ id: string;
14079
+ title: string;
14080
+ }, {
14081
+ id: string;
14082
+ title: string;
14083
+ }>, "many">;
14084
+ /** The step the agent said it started, and when. */
14085
+ current: z.ZodOptional<z.ZodObject<{
14086
+ id: z.ZodString;
14087
+ startedAt: z.ZodString;
14088
+ }, "strip", z.ZodTypeAny, {
14089
+ id: string;
14090
+ startedAt: string;
14091
+ }, {
14092
+ id: string;
14093
+ startedAt: string;
14094
+ }>>;
14095
+ revisions: z.ZodDefault<z.ZodArray<z.ZodObject<{
14096
+ at: z.ZodString;
14097
+ /** `plan`: the first plan. `revise`: a change to the steps left. */
14098
+ kind: z.ZodEnum<["plan", "revise"]>;
14099
+ reason: z.ZodOptional<z.ZodString>;
14100
+ /** The step ids still to do after this change. */
14101
+ steps: z.ZodArray<z.ZodString, "many">;
14102
+ /** The step ids the change dropped. */
14103
+ dropped: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
14104
+ }, "strip", z.ZodTypeAny, {
14105
+ at: string;
14106
+ steps: string[];
14107
+ kind: "plan" | "revise";
14108
+ dropped: string[];
14109
+ reason?: string | undefined;
14110
+ }, {
14111
+ at: string;
14112
+ steps: string[];
14113
+ kind: "plan" | "revise";
14114
+ reason?: string | undefined;
14115
+ dropped?: string[] | undefined;
14116
+ }>, "many">>;
14117
+ }, "strip", z.ZodTypeAny, {
14118
+ steps: {
14119
+ id: string;
14120
+ title: string;
14121
+ }[];
14122
+ revisions: {
14123
+ at: string;
14124
+ steps: string[];
14125
+ kind: "plan" | "revise";
14126
+ dropped: string[];
14127
+ reason?: string | undefined;
14128
+ }[];
14129
+ current?: {
14130
+ id: string;
14131
+ startedAt: string;
14132
+ } | undefined;
14133
+ }, {
14134
+ steps: {
14135
+ id: string;
14136
+ title: string;
14137
+ }[];
14138
+ current?: {
14139
+ id: string;
14140
+ startedAt: string;
14141
+ } | undefined;
14142
+ revisions?: {
14143
+ at: string;
14144
+ steps: string[];
14145
+ kind: "plan" | "revise";
14146
+ reason?: string | undefined;
14147
+ dropped?: string[] | undefined;
14148
+ }[] | undefined;
14149
+ }>>;
14150
+ }, "strip", z.ZodTypeAny, {
14151
+ followUp: boolean;
14152
+ tags: string[];
14153
+ approvedAtStart: boolean;
14154
+ blocked?: {
14155
+ at: string;
14156
+ reason: string;
14157
+ nodeId: string;
14158
+ } | undefined;
14159
+ plan?: {
14160
+ steps: {
14161
+ id: string;
14162
+ title: string;
14163
+ }[];
14164
+ revisions: {
14165
+ at: string;
14166
+ steps: string[];
14167
+ kind: "plan" | "revise";
14168
+ dropped: string[];
14169
+ reason?: string | undefined;
14170
+ }[];
14171
+ current?: {
14172
+ id: string;
14173
+ startedAt: string;
14174
+ } | undefined;
14175
+ } | undefined;
14176
+ title?: string | undefined;
14177
+ approved?: Record<string, string> | undefined;
14178
+ requestId?: string | undefined;
14179
+ startedBy?: string | undefined;
14180
+ endNotifiedAt?: string | undefined;
14181
+ wrap?: {
14182
+ channel: string;
14183
+ mode: "plan" | "linear";
14184
+ agentId: string;
14185
+ taskId?: string | undefined;
14186
+ } | undefined;
14187
+ }, {
14188
+ followUp?: boolean | undefined;
14189
+ tags?: string[] | undefined;
14190
+ blocked?: {
14191
+ at: string;
14192
+ reason: string;
14193
+ nodeId: string;
14194
+ } | undefined;
14195
+ plan?: {
14196
+ steps: {
14197
+ id: string;
14198
+ title: string;
14199
+ }[];
14200
+ current?: {
14201
+ id: string;
14202
+ startedAt: string;
14203
+ } | undefined;
14204
+ revisions?: {
14205
+ at: string;
14206
+ steps: string[];
14207
+ kind: "plan" | "revise";
14208
+ reason?: string | undefined;
14209
+ dropped?: string[] | undefined;
14210
+ }[] | undefined;
14211
+ } | undefined;
14212
+ title?: string | undefined;
14213
+ approved?: Record<string, string> | undefined;
14214
+ requestId?: string | undefined;
14215
+ startedBy?: string | undefined;
14216
+ approvedAtStart?: boolean | undefined;
14217
+ endNotifiedAt?: string | undefined;
14218
+ wrap?: {
14219
+ channel: string;
14220
+ mode: "plan" | "linear";
14221
+ agentId: string;
14222
+ taskId?: string | undefined;
14223
+ } | undefined;
14224
+ }>>;
14225
+ createdAt: z.ZodString;
14226
+ updatedAt: z.ZodString;
14227
+ }, "strip", z.ZodTypeAny, {
14228
+ status: "failed" | "completed" | "canceled" | "paused" | "running";
14229
+ id: string;
14230
+ context: Record<string, Record<string, unknown>>;
14231
+ pending: string[];
14232
+ updatedAt: string;
14233
+ history: {
14234
+ at: string;
14235
+ status: "timeout" | "ok" | "failed" | "skipped" | "resumed" | "paused";
14236
+ idempotencyKey: string;
14237
+ nodeId: string;
14238
+ inputKeys: string[];
14239
+ output?: Record<string, unknown> | undefined;
14240
+ durationMs?: number | undefined;
14241
+ note?: string | undefined;
14242
+ startedAt?: string | undefined;
14243
+ }[];
14244
+ createdAt: string;
14245
+ workflowVersion: 2;
14246
+ workflowId: string;
14247
+ homeNode: string;
14248
+ joinCounters: Record<string, string[]>;
14249
+ entityRef: {
14250
+ id: string;
14251
+ backend: string;
14252
+ };
14253
+ parentRunId: string | null;
14254
+ parentNodeId: string | null;
14255
+ rootRunId: string | null;
14256
+ depth: number;
14257
+ pausedAt?: {
14258
+ kind: "checkpoint";
14259
+ nodeId: string;
14260
+ checkpointName: string;
14261
+ resumeMatch: Record<string, unknown>;
14262
+ } | {
14263
+ kind: "subProcess";
14264
+ nodeId: string;
14265
+ childRunId: string;
14266
+ childWorkflowId: string;
14267
+ } | {
14268
+ match: Record<string, unknown>;
14269
+ kind: "signalWait";
14270
+ scope: "workflow" | "global";
14271
+ nodeId: string;
14272
+ signalName: string;
14273
+ } | {
14274
+ kind: "timerWait";
14275
+ nodeId: string;
14276
+ fireAt: string;
14277
+ } | {
14278
+ kind: "ownerDecision";
14279
+ cardId: string;
14280
+ nodeId: string;
14281
+ purpose: "start" | "send" | "ask";
14282
+ message?: {
14283
+ text: string;
14284
+ channel: string;
14285
+ chatId: string;
14286
+ to?: string | undefined;
14287
+ accountId?: string | undefined;
14288
+ } | undefined;
14289
+ } | {
14290
+ channel: string;
14291
+ chatId: string;
14292
+ kind: "replyWait";
14293
+ reminders: number;
14294
+ nodeId: string;
14295
+ deadline: string;
14296
+ maxReminders: number;
14297
+ from?: string | undefined;
14298
+ accountId?: string | undefined;
14299
+ nextRemindAt?: string | undefined;
14300
+ remindEveryMs?: number | undefined;
14301
+ reminds?: string | undefined;
14302
+ } | {
14303
+ kind: "agentStep";
14304
+ agentId: string;
14305
+ nudges: number;
14306
+ maxNudges: number;
14307
+ nodeId: string;
14308
+ stallMs: number;
14309
+ blocked?: string | undefined;
14310
+ nextNudgeAt?: string | undefined;
14311
+ } | undefined;
14312
+ eventRootId?: string | undefined;
14313
+ meta?: {
14314
+ followUp: boolean;
14315
+ tags: string[];
14316
+ approvedAtStart: boolean;
14317
+ blocked?: {
14318
+ at: string;
14319
+ reason: string;
14320
+ nodeId: string;
14321
+ } | undefined;
14322
+ plan?: {
14323
+ steps: {
14324
+ id: string;
14325
+ title: string;
14326
+ }[];
14327
+ revisions: {
14328
+ at: string;
14329
+ steps: string[];
14330
+ kind: "plan" | "revise";
14331
+ dropped: string[];
14332
+ reason?: string | undefined;
14333
+ }[];
14334
+ current?: {
14335
+ id: string;
14336
+ startedAt: string;
14337
+ } | undefined;
14338
+ } | undefined;
14339
+ title?: string | undefined;
14340
+ approved?: Record<string, string> | undefined;
14341
+ requestId?: string | undefined;
14342
+ startedBy?: string | undefined;
14343
+ endNotifiedAt?: string | undefined;
14344
+ wrap?: {
14345
+ channel: string;
14346
+ mode: "plan" | "linear";
14347
+ agentId: string;
14348
+ taskId?: string | undefined;
14349
+ } | undefined;
14350
+ } | undefined;
14351
+ }, {
14352
+ status: "failed" | "completed" | "canceled" | "paused" | "running";
14353
+ id: string;
14354
+ updatedAt: string;
14355
+ createdAt: string;
14356
+ workflowVersion: 2;
14357
+ workflowId: string;
14358
+ homeNode: string;
14359
+ entityRef: {
14360
+ id: string;
14361
+ backend: string;
14362
+ };
14363
+ context?: Record<string, Record<string, unknown>> | undefined;
14364
+ pending?: string[] | undefined;
14365
+ history?: {
14366
+ at: string;
14367
+ status: "timeout" | "ok" | "failed" | "skipped" | "resumed" | "paused";
14368
+ idempotencyKey: string;
14369
+ nodeId: string;
14370
+ output?: Record<string, unknown> | undefined;
14371
+ durationMs?: number | undefined;
14372
+ note?: string | undefined;
14373
+ startedAt?: string | undefined;
14374
+ inputKeys?: string[] | undefined;
14375
+ }[] | undefined;
14376
+ pausedAt?: {
14377
+ kind: "checkpoint";
14378
+ nodeId: string;
14379
+ checkpointName: string;
14380
+ resumeMatch?: Record<string, unknown> | undefined;
14381
+ } | {
14382
+ kind: "subProcess";
14383
+ nodeId: string;
14384
+ childRunId: string;
14385
+ childWorkflowId: string;
14386
+ } | {
14387
+ kind: "signalWait";
14388
+ nodeId: string;
14389
+ signalName: string;
14390
+ match?: Record<string, unknown> | undefined;
14391
+ scope?: "workflow" | "global" | undefined;
14392
+ } | {
14393
+ kind: "timerWait";
14394
+ nodeId: string;
14395
+ fireAt: string;
14396
+ } | {
14397
+ kind: "ownerDecision";
14398
+ cardId: string;
14399
+ nodeId: string;
14400
+ purpose: "start" | "send" | "ask";
14401
+ message?: {
14402
+ text: string;
14403
+ channel: string;
14404
+ chatId: string;
14405
+ to?: string | undefined;
14406
+ accountId?: string | undefined;
14407
+ } | undefined;
14408
+ } | {
14409
+ channel: string;
14410
+ chatId: string;
14411
+ kind: "replyWait";
14412
+ nodeId: string;
14413
+ deadline: string;
14414
+ from?: string | undefined;
14415
+ accountId?: string | undefined;
14416
+ reminders?: number | undefined;
14417
+ nextRemindAt?: string | undefined;
14418
+ remindEveryMs?: number | undefined;
14419
+ maxReminders?: number | undefined;
14420
+ reminds?: string | undefined;
14421
+ } | {
14422
+ kind: "agentStep";
14423
+ agentId: string;
14424
+ nodeId: string;
14425
+ stallMs: number;
14426
+ blocked?: string | undefined;
14427
+ nudges?: number | undefined;
14428
+ maxNudges?: number | undefined;
14429
+ nextNudgeAt?: string | undefined;
14430
+ } | undefined;
14431
+ joinCounters?: Record<string, string[]> | undefined;
14432
+ parentRunId?: string | null | undefined;
14433
+ parentNodeId?: string | null | undefined;
14434
+ rootRunId?: string | null | undefined;
14435
+ depth?: number | undefined;
14436
+ eventRootId?: string | undefined;
14437
+ meta?: {
14438
+ followUp?: boolean | undefined;
14439
+ tags?: string[] | undefined;
14440
+ blocked?: {
14441
+ at: string;
14442
+ reason: string;
14443
+ nodeId: string;
14444
+ } | undefined;
14445
+ plan?: {
14446
+ steps: {
14447
+ id: string;
14448
+ title: string;
14449
+ }[];
14450
+ current?: {
14451
+ id: string;
14452
+ startedAt: string;
14453
+ } | undefined;
14454
+ revisions?: {
14455
+ at: string;
14456
+ steps: string[];
14457
+ kind: "plan" | "revise";
14458
+ reason?: string | undefined;
14459
+ dropped?: string[] | undefined;
14460
+ }[] | undefined;
14461
+ } | undefined;
14462
+ title?: string | undefined;
14463
+ approved?: Record<string, string> | undefined;
14464
+ requestId?: string | undefined;
14465
+ startedBy?: string | undefined;
14466
+ approvedAtStart?: boolean | undefined;
14467
+ endNotifiedAt?: string | undefined;
14468
+ wrap?: {
14469
+ channel: string;
14470
+ mode: "plan" | "linear";
14471
+ agentId: string;
14472
+ taskId?: string | undefined;
14473
+ } | undefined;
14474
+ } | undefined;
14475
+ }>;
14476
+ type WorkflowRun = z.infer<typeof workflowRunSchema>;
14477
+
14478
+ interface RunStoreOptions {
14479
+ baseDir?: string;
14480
+ /** This daemon's mesh peer id. Stamped as `homeNode` on run creation so
14481
+ * later code can verify ownership before mutating. */
14482
+ nodeId: string;
14483
+ }
14484
+ declare class RunStore {
14485
+ readonly baseDir: string;
14486
+ readonly runsDir: string;
14487
+ readonly indexDir: string;
14488
+ readonly nodeId: string;
14489
+ constructor(opts: RunStoreOptions);
14490
+ private runPath;
14491
+ private indexPath;
14492
+ /** Create a new run. Seeds the initial pending queue (typically the
14493
+ * trigger node's immediate successors) and writes an entity-index entry
14494
+ * so future events for the same entity land on this home node. */
14495
+ create(args: {
14496
+ workflowId: string;
14497
+ initialPending: string[];
14498
+ entityRef: EntityRef;
14499
+ initialContext?: Record<string, Record<string, unknown>>;
14500
+ /** Optional parent-run linkage for sub-process children. */
14501
+ parentRunId?: string | null;
14502
+ parentNodeId?: string | null;
14503
+ rootRunId?: string | null;
14504
+ depth?: number;
14505
+ /** Defaults to the current event root, if any. */
14506
+ eventRootId?: string;
14507
+ /** Follow-up runs (#788): title, tags, who started it. */
14508
+ meta?: RunMeta;
14509
+ /** A run id chosen before the run exists (#858: the agent is told it
14510
+ * before its turn starts). Default: a fresh UUID. */
14511
+ id?: string;
14512
+ }): WorkflowRun;
14513
+ /** Read the latest snapshot of a run by replaying the jsonl log. */
14514
+ get(runId: string): WorkflowRun | null;
14515
+ /** Look up the active run id for an entity, if any. */
14516
+ getActiveByEntity(entity: EntityRef): string | null;
14517
+ /** Which node owns a given entity (null if unclaimed). Used by the
14518
+ * dispatcher to decide whether to process locally or forward via mesh. */
14519
+ getHomeNodeByEntity(entity: EntityRef): string | null;
14520
+ /** Record a single node's execution. Appends an `exec` line and returns
14521
+ * the updated run snapshot. Idempotent: if an entry with the same
14522
+ * idempotencyKey already exists, the call is a no-op. */
14523
+ recordExecution(args: {
14524
+ runId: string;
14525
+ entry: NodeExecutionEntry;
14526
+ nextPending: string[];
14527
+ status?: RunStatus;
14528
+ pausedAt?: PausedAt | null;
14529
+ /** Optional updated context snapshot. When provided, replaces the run's
14530
+ * context wholesale (used when a node's output bundle lands). When
14531
+ * omitted, context is carried forward unchanged. */
14532
+ context?: Record<string, Record<string, unknown>>;
14533
+ /** Optional updated join-counter map. Undefined = carry forward. */
14534
+ joinCounters?: Record<string, string[]>;
14535
+ }): WorkflowRun | null;
14536
+ /** Mutate status without adding a history entry — used for
14537
+ * pause / resume / cancel commands from the CLI or dashboard. */
14538
+ setStatus(runId: string, status: RunStatus): WorkflowRun | null;
14539
+ /** Merge fields into a run's meta (#788). Appends a snapshot, like
14540
+ * setStatus; history and context are carried over as they are. */
14541
+ setMeta(runId: string, patch: Partial<RunMeta>): WorkflowRun | null;
14542
+ /** Merge into a run's meta and replace its pending queue (#858: a plan
14543
+ * written or changed mid-run). Appends a snapshot; history is kept. */
14544
+ patch(runId: string, patch: {
14545
+ meta?: Partial<RunMeta>;
14546
+ pending?: string[];
14547
+ }): WorkflowRun | null;
14548
+ /** Remove a run and its entity index entry, as if it never ran (#858: a
14549
+ * plain question exempted from workflows.required). */
14550
+ discard(runId: string): boolean;
14551
+ /** List runs, newest first. */
14552
+ list(opts?: {
14553
+ workflowId?: string;
14554
+ limit?: number;
14555
+ }): WorkflowRun[];
14556
+ /** Retention: keep at most `maxRuns` completed/failed/canceled runs
14557
+ * younger than `maxDays`. Running/paused runs are never pruned. */
14558
+ prune(policy: {
14559
+ maxRuns: number;
14560
+ maxDays: number;
14561
+ }): number;
14562
+ private appendSnapshot;
14563
+ private writeIndex;
14564
+ private clearIndex;
14565
+ }
14566
+
13251
14567
  interface RunningTask {
13252
14568
  /** Unique id for this execution (timestamp-based). */
13253
14569
  id: string;
@@ -13272,6 +14588,15 @@ interface RunningTask {
13272
14588
  intentPath?: string[];
13273
14589
  /** Step autonomy the turn runs at (report | propose | act). Unset = act. */
13274
14590
  autonomy?: AgentTask["autonomy"];
14591
+ /** The workflow run this turn belongs to (#858): a step of a run, or
14592
+ * the run a task is wrapped in under workflows.required. `step` and
14593
+ * `title` are filled in when the agent list is read. */
14594
+ workflow?: {
14595
+ runId: string;
14596
+ workflowId?: string;
14597
+ step?: string;
14598
+ title?: string;
14599
+ };
13275
14600
  }
13276
14601
  type TaskOutputSubscriber = (chunk: string) => void;
13277
14602
  /** Persisted record of a finished task, written to .agentx/task-history. */
@@ -13340,6 +14665,9 @@ declare class AgentRegistry {
13340
14665
  * its `action.send` / `agent` nodes. Duck-typed to avoid a circular import
13341
14666
  * on WorkflowDispatcher. */
13342
14667
  private workflowAutoRunner?;
14668
+ /** Where wrapped tasks keep their run (#858). Wired by the daemon with
14669
+ * the workflow engine's run store; unset means no wrapping. */
14670
+ private workflowRuns?;
13343
14671
  private messageQueue;
13344
14672
  /**
13345
14673
  * Voice chats a waiting question has claimed between its wait ending and
@@ -13405,6 +14733,7 @@ declare class AgentRegistry {
13405
14733
  /** Wire the workflow auto-runner — see field doc above. Daemon calls this
13406
14734
  * after WorkflowDispatcher boot. Pass undefined to detach (e.g. during
13407
14735
  * reload). */
14736
+ setWorkflowRunStore(runs: RunStore | undefined): void;
13408
14737
  setWorkflowAutoRunner(runner: NonNullable<AgentRegistry["workflowAutoRunner"]> | undefined): void;
13409
14738
  /** Hot-swap the provider map. Daemon reload calls this after agentx.json
13410
14739
  * changes — the next task that executes will resolve credentials through
@@ -13418,6 +14747,9 @@ declare class AgentRegistry {
13418
14747
  * execute-time for landscape + session policies, so next-task semantics
13419
14748
  * match setProviders. */
13420
14749
  setConfig(next: DaemonConfig): void;
14750
+ /** Swap the workflows block on a config reload (#858): matching,
14751
+ * follow-up and required settings are read per turn. */
14752
+ setWorkflows(workflows: DaemonConfig["workflows"]): void;
13421
14753
  /** Swap the people list on a config reload (#384). Turns read it when
13422
14754
  * they start, so the next turn is stamped from the new list. */
13423
14755
  setPeople(people: DaemonConfig["people"]): void;
@@ -13555,6 +14887,9 @@ declare class AgentRegistry {
13555
14887
  };
13556
14888
  hourlyTasks?: number[];
13557
14889
  }>;
14890
+ /** Running tasks with the workflow run each belongs to and the step it
14891
+ * is on (#858), read from the run store; the stored list is not touched. */
14892
+ private withWorkflowSteps;
13558
14893
  /**
13559
14894
  * Write a finished task record to disk under .agentx/task-history/<agent>/<yyyy-mm-dd>/.
13560
14895
  * Side-effects only — call sites should treat failure as best-effort.
@@ -13617,6 +14952,7 @@ declare class AgentRegistry {
13617
14952
  taskId: string;
13618
14953
  context: NonNullable<AgentTask["context"]>;
13619
14954
  autonomy?: AgentTask["autonomy"];
14955
+ workflowRunId?: string;
13620
14956
  } | null;
13621
14957
  /** Whether every slot of `agentId` is taken, and by which runs. Lets a
13622
14958
  * synchronous delegation refuse at once when the only slot is held by