agentix-cli 0.131.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 (151) hide show
  1. package/dist/{App-WZ3HAKES.js → App-WQPA77VJ.js} +2 -2
  2. package/dist/{ChatApp-K4HDJL2S.js → ChatApp-TGW66I4Y.js} +2 -2
  3. package/dist/{absorb-eval-ER27DHHK.js → absorb-eval-37XZJACN.js} +2 -2
  4. package/dist/{agent-AQSVISXX.js → agent-FWHYHXWC.js} +2 -2
  5. package/dist/{board-dashboard-3AI2Z2SP.js → board-dashboard-GKE4KWJH.js} +435 -270
  6. package/dist/board-dashboard-GKE4KWJH.js.map +1 -0
  7. package/dist/{builtin-W6KNX7RS.js → builtin-YD7MC572.js} +2 -2
  8. package/dist/chunk-2BF6HJJD.js +54 -0
  9. package/dist/chunk-2BF6HJJD.js.map +1 -0
  10. package/dist/{chunk-MFIM5Y3J.js → chunk-3TETB22A.js} +2 -2
  11. package/dist/{chunk-7UPFZJIT.js → chunk-4NEO5KB2.js} +30 -30
  12. package/dist/chunk-4NEO5KB2.js.map +1 -0
  13. package/dist/{chunk-B2Q3PTPS.js → chunk-4XPVU3N2.js} +2 -2
  14. package/dist/chunk-57Y2WZT2.js +55 -0
  15. package/dist/chunk-57Y2WZT2.js.map +1 -0
  16. package/dist/{chunk-E2VDBT3T.js → chunk-ANC5QXFB.js} +2 -2
  17. package/dist/chunk-BI6VG4DV.js +37 -0
  18. package/dist/chunk-BI6VG4DV.js.map +1 -0
  19. package/dist/{chunk-YQRWUF4Y.js → chunk-D5IHICX3.js} +2 -2
  20. package/dist/{chunk-IA7INHXY.js → chunk-F5PVUB4Y.js} +2 -2
  21. package/dist/{chunk-CL33CRH5.js → chunk-F7GKG5ZO.js} +3 -3
  22. package/dist/chunk-F7GKG5ZO.js.map +1 -0
  23. package/dist/{chunk-L2WVQREN.js → chunk-GUEIF7ZF.js} +2 -2
  24. package/dist/{chunk-APZIH3AY.js → chunk-GZY5DYXT.js} +2 -2
  25. package/dist/chunk-HF5EF335.js +8 -0
  26. package/dist/chunk-HF5EF335.js.map +1 -0
  27. package/dist/{chunk-AKOXTIJS.js → chunk-HIUHKOKK.js} +2 -2
  28. package/dist/chunk-IDZXAOBC.js +156 -0
  29. package/dist/chunk-IDZXAOBC.js.map +1 -0
  30. package/dist/chunk-IZDKRNXC.js +52 -0
  31. package/dist/chunk-IZDKRNXC.js.map +1 -0
  32. package/dist/{chunk-CSWGYSC4.js → chunk-JA5Y4LDP.js} +2 -2
  33. package/dist/{chunk-ERNBJLIQ.js → chunk-KUOH5MFS.js} +2 -2
  34. package/dist/{chunk-YA6E47BR.js → chunk-OQV3LWJI.js} +2 -2
  35. package/dist/{chunk-2YB2G2BP.js → chunk-PHCWYKQW.js} +2 -2
  36. package/dist/{chunk-GLQLCBJS.js → chunk-QSKG754X.js} +6 -3
  37. package/dist/chunk-QSKG754X.js.map +1 -0
  38. package/dist/{chunk-6O6NW3ZG.js → chunk-RJFPCW7T.js} +2 -2
  39. package/dist/{chunk-YVR6652A.js → chunk-RTHZQGFC.js} +2 -2
  40. package/dist/{chunk-KRK7OOTK.js → chunk-S2UXDEGW.js} +2 -2
  41. package/dist/{chunk-L4ZS4HGJ.js → chunk-SJPQQ4OF.js} +255 -247
  42. package/dist/chunk-SJPQQ4OF.js.map +1 -0
  43. package/dist/{chunk-WKQQIYOE.js → chunk-V4IFJLQS.js} +2 -2
  44. package/dist/{chunk-L4ALHWII.js → chunk-VH2ASPFQ.js} +2 -2
  45. package/dist/{chunk-AD4QZZVN.js → chunk-YXFTUOZR.js} +2 -2
  46. package/dist/{chunk-KIYV4ZHG.js → chunk-ZN5DC6WS.js} +2 -2
  47. package/dist/cli.js +1 -1
  48. package/dist/{client-YIR3ELVN.js → client-7UW2ELPP.js} +2 -2
  49. package/dist/config-TNYVPT4R.js +2 -0
  50. package/dist/{config-mutate-KDRHKQE4.js → config-mutate-GV7BVG3I.js} +2 -2
  51. package/dist/config-mutator-AKCR3VKM.js +2 -0
  52. package/dist/{contributions-MTKXXLIP.js → contributions-J57B3KIX.js} +2 -2
  53. package/dist/{doctor-FJ5RCG4J.js → doctor-ROKIYJRT.js} +2 -2
  54. package/dist/{failure-candidates-JNGUVBDG.js → failure-candidates-XZSZP4HT.js} +2 -2
  55. package/dist/follow-up-tool-S2U7DFSW.js +7 -0
  56. package/dist/follow-up-tool-S2U7DFSW.js.map +1 -0
  57. package/dist/{hub-CF4VFSRT.js → hub-HOVJC4HR.js} +2 -2
  58. package/dist/index.d.ts +1432 -6
  59. package/dist/index.js +1 -1
  60. package/dist/{program-ZPNEAACQ.js → program-LAOU5DQ3.js} +225 -217
  61. package/dist/program-LAOU5DQ3.js.map +1 -0
  62. package/dist/{promote-G6BOY7K5.js → promote-FVWRM4BE.js} +2 -2
  63. package/dist/query-HBCL3FHO.js +2 -0
  64. package/dist/query-settings-RD6GEN2V.js +3 -0
  65. package/dist/query-settings-RD6GEN2V.js.map +1 -0
  66. package/dist/{registry-TAUHYJCK.js → registry-NT4H7HYP.js} +2 -2
  67. package/dist/{request-planner-V3R5J3V4.js → request-planner-JOXSAAHO.js} +2 -2
  68. package/dist/{review-candidates-TC7RJB4W.js → review-candidates-6N5435V7.js} +2 -2
  69. package/dist/{routing-XQD74ERK.js → routing-6G2QVFIG.js} +2 -2
  70. package/dist/schedule-tool-3NYUPKSC.js +2 -0
  71. package/dist/{scheduler-WOOXIOER.js → scheduler-WOH2O3EP.js} +2 -2
  72. package/dist/{seat-B75JIAS3.js → seat-I2FBJDTV.js} +2 -2
  73. package/dist/{select-I6BSBQXP.js → select-5YZQJLLD.js} +2 -2
  74. package/dist/{set-enabled-THNVITGU.js → set-enabled-CQEUZLHU.js} +2 -2
  75. package/dist/{tool-LFWTZHB7.js → tool-PIJXUBEC.js} +2 -2
  76. package/dist/{tool-CEBIS6GK.js → tool-R77KFLZ3.js} +2 -2
  77. package/dist/wiki-GCOFERTB.js +2 -0
  78. package/package.json +2 -1
  79. package/dist/board-dashboard-3AI2Z2SP.js.map +0 -1
  80. package/dist/chunk-2SXF66O6.js +0 -55
  81. package/dist/chunk-2SXF66O6.js.map +0 -1
  82. package/dist/chunk-2ZDV3DCT.js +0 -52
  83. package/dist/chunk-2ZDV3DCT.js.map +0 -1
  84. package/dist/chunk-76Z4VHDX.js +0 -8
  85. package/dist/chunk-76Z4VHDX.js.map +0 -1
  86. package/dist/chunk-7UPFZJIT.js.map +0 -1
  87. package/dist/chunk-CBFBGN7J.js +0 -54
  88. package/dist/chunk-CBFBGN7J.js.map +0 -1
  89. package/dist/chunk-CL33CRH5.js.map +0 -1
  90. package/dist/chunk-GLQLCBJS.js.map +0 -1
  91. package/dist/chunk-L4ZS4HGJ.js.map +0 -1
  92. package/dist/chunk-VSL2SSBH.js +0 -156
  93. package/dist/chunk-VSL2SSBH.js.map +0 -1
  94. package/dist/chunk-YPCZ5TNK.js +0 -37
  95. package/dist/chunk-YPCZ5TNK.js.map +0 -1
  96. package/dist/config-4DOJYA2K.js +0 -2
  97. package/dist/config-mutator-4PPBACWU.js +0 -2
  98. package/dist/follow-up-tool-SVZDSUIU.js +0 -6
  99. package/dist/follow-up-tool-SVZDSUIU.js.map +0 -1
  100. package/dist/program-ZPNEAACQ.js.map +0 -1
  101. package/dist/query-H24BI3BI.js +0 -2
  102. package/dist/query-settings-IJB3QMDW.js +0 -3
  103. package/dist/query-settings-IJB3QMDW.js.map +0 -1
  104. package/dist/schedule-tool-U6KLY5MT.js +0 -2
  105. package/dist/wiki-3ATPAHC2.js +0 -2
  106. /package/dist/{App-WZ3HAKES.js.map → App-WQPA77VJ.js.map} +0 -0
  107. /package/dist/{ChatApp-K4HDJL2S.js.map → ChatApp-TGW66I4Y.js.map} +0 -0
  108. /package/dist/{absorb-eval-ER27DHHK.js.map → absorb-eval-37XZJACN.js.map} +0 -0
  109. /package/dist/{agent-AQSVISXX.js.map → agent-FWHYHXWC.js.map} +0 -0
  110. /package/dist/{builtin-W6KNX7RS.js.map → builtin-YD7MC572.js.map} +0 -0
  111. /package/dist/{chunk-MFIM5Y3J.js.map → chunk-3TETB22A.js.map} +0 -0
  112. /package/dist/{chunk-B2Q3PTPS.js.map → chunk-4XPVU3N2.js.map} +0 -0
  113. /package/dist/{chunk-E2VDBT3T.js.map → chunk-ANC5QXFB.js.map} +0 -0
  114. /package/dist/{chunk-YQRWUF4Y.js.map → chunk-D5IHICX3.js.map} +0 -0
  115. /package/dist/{chunk-IA7INHXY.js.map → chunk-F5PVUB4Y.js.map} +0 -0
  116. /package/dist/{chunk-L2WVQREN.js.map → chunk-GUEIF7ZF.js.map} +0 -0
  117. /package/dist/{chunk-APZIH3AY.js.map → chunk-GZY5DYXT.js.map} +0 -0
  118. /package/dist/{chunk-AKOXTIJS.js.map → chunk-HIUHKOKK.js.map} +0 -0
  119. /package/dist/{chunk-CSWGYSC4.js.map → chunk-JA5Y4LDP.js.map} +0 -0
  120. /package/dist/{chunk-ERNBJLIQ.js.map → chunk-KUOH5MFS.js.map} +0 -0
  121. /package/dist/{chunk-YA6E47BR.js.map → chunk-OQV3LWJI.js.map} +0 -0
  122. /package/dist/{chunk-2YB2G2BP.js.map → chunk-PHCWYKQW.js.map} +0 -0
  123. /package/dist/{chunk-6O6NW3ZG.js.map → chunk-RJFPCW7T.js.map} +0 -0
  124. /package/dist/{chunk-YVR6652A.js.map → chunk-RTHZQGFC.js.map} +0 -0
  125. /package/dist/{chunk-KRK7OOTK.js.map → chunk-S2UXDEGW.js.map} +0 -0
  126. /package/dist/{chunk-WKQQIYOE.js.map → chunk-V4IFJLQS.js.map} +0 -0
  127. /package/dist/{chunk-L4ALHWII.js.map → chunk-VH2ASPFQ.js.map} +0 -0
  128. /package/dist/{chunk-AD4QZZVN.js.map → chunk-YXFTUOZR.js.map} +0 -0
  129. /package/dist/{chunk-KIYV4ZHG.js.map → chunk-ZN5DC6WS.js.map} +0 -0
  130. /package/dist/{client-YIR3ELVN.js.map → client-7UW2ELPP.js.map} +0 -0
  131. /package/dist/{config-4DOJYA2K.js.map → config-TNYVPT4R.js.map} +0 -0
  132. /package/dist/{config-mutate-KDRHKQE4.js.map → config-mutate-GV7BVG3I.js.map} +0 -0
  133. /package/dist/{config-mutator-4PPBACWU.js.map → config-mutator-AKCR3VKM.js.map} +0 -0
  134. /package/dist/{contributions-MTKXXLIP.js.map → contributions-J57B3KIX.js.map} +0 -0
  135. /package/dist/{doctor-FJ5RCG4J.js.map → doctor-ROKIYJRT.js.map} +0 -0
  136. /package/dist/{failure-candidates-JNGUVBDG.js.map → failure-candidates-XZSZP4HT.js.map} +0 -0
  137. /package/dist/{hub-CF4VFSRT.js.map → hub-HOVJC4HR.js.map} +0 -0
  138. /package/dist/{promote-G6BOY7K5.js.map → promote-FVWRM4BE.js.map} +0 -0
  139. /package/dist/{query-H24BI3BI.js.map → query-HBCL3FHO.js.map} +0 -0
  140. /package/dist/{registry-TAUHYJCK.js.map → registry-NT4H7HYP.js.map} +0 -0
  141. /package/dist/{request-planner-V3R5J3V4.js.map → request-planner-JOXSAAHO.js.map} +0 -0
  142. /package/dist/{review-candidates-TC7RJB4W.js.map → review-candidates-6N5435V7.js.map} +0 -0
  143. /package/dist/{routing-XQD74ERK.js.map → routing-6G2QVFIG.js.map} +0 -0
  144. /package/dist/{schedule-tool-U6KLY5MT.js.map → schedule-tool-3NYUPKSC.js.map} +0 -0
  145. /package/dist/{scheduler-WOOXIOER.js.map → scheduler-WOH2O3EP.js.map} +0 -0
  146. /package/dist/{seat-B75JIAS3.js.map → seat-I2FBJDTV.js.map} +0 -0
  147. /package/dist/{select-I6BSBQXP.js.map → select-5YZQJLLD.js.map} +0 -0
  148. /package/dist/{set-enabled-THNVITGU.js.map → set-enabled-CQEUZLHU.js.map} +0 -0
  149. /package/dist/{tool-LFWTZHB7.js.map → tool-PIJXUBEC.js.map} +0 -0
  150. /package/dist/{tool-CEBIS6GK.js.map → tool-R77KFLZ3.js.map} +0 -0
  151. /package/dist/{wiki-3ATPAHC2.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;
@@ -5526,6 +5535,34 @@ declare const daemonConfigSchema: z.ZodObject<{
5526
5535
  windowMinutes?: number | undefined;
5527
5536
  } | undefined;
5528
5537
  }>>;
5538
+ /** Stop and resume signals (agents/signals, #857): stop a running task
5539
+ * cleanly, keep the agent's resume plan, resume it later. The owner may
5540
+ * always signal; an agent may signal tasks it dispatched, or any task
5541
+ * when listed in allowAgents; a mesh peer only when listed in allowPeers. */
5542
+ signals: z.ZodDefault<z.ZodObject<{
5543
+ enabled: z.ZodDefault<z.ZodBoolean>;
5544
+ /** How long the stopped agent gets to write its resume plan. Past it,
5545
+ * the wind-down is stopped and a plan is built from the trace. */
5546
+ windDownSeconds: z.ZodDefault<z.ZodNumber>;
5547
+ /** Agents that may stop or resume any agent's task here ("*" for all). */
5548
+ allowAgents: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
5549
+ /** Mesh peers (node names) whose stop and resume signals are accepted. */
5550
+ allowPeers: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
5551
+ /** Loop brake: most signals one root id may carry in a day. */
5552
+ maxPerRoot: z.ZodDefault<z.ZodNumber>;
5553
+ }, "strip", z.ZodTypeAny, {
5554
+ enabled: boolean;
5555
+ windDownSeconds: number;
5556
+ allowAgents: string[];
5557
+ allowPeers: string[];
5558
+ maxPerRoot: number;
5559
+ }, {
5560
+ enabled?: boolean | undefined;
5561
+ windDownSeconds?: number | undefined;
5562
+ allowAgents?: string[] | undefined;
5563
+ allowPeers?: string[] | undefined;
5564
+ maxPerRoot?: number | undefined;
5565
+ }>>;
5529
5566
  /** Open requests (src/requests, #356): what a person asked an agent for
5530
5567
  * is recorded and followed until it is done, declined or dropped. Off
5531
5568
  * by default. */
@@ -7346,6 +7383,26 @@ declare const daemonConfigSchema: z.ZodObject<{
7346
7383
  stallMinutes?: number | undefined;
7347
7384
  maxNudges?: number | undefined;
7348
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
+ }>>;
7349
7406
  /** Controls whether the dashboard exposes the visual editor. "readonly"
7350
7407
  * serves the list + run timelines but strips write controls from the
7351
7408
  * page. "disabled" hides the tab entirely. */
@@ -7353,6 +7410,11 @@ declare const daemonConfigSchema: z.ZodObject<{
7353
7410
  }, "strip", z.ZodTypeAny, {
7354
7411
  dir: string;
7355
7412
  enabled: boolean;
7413
+ required: {
7414
+ enabled: boolean;
7415
+ agents: Record<string, boolean>;
7416
+ exemptQuestions: boolean;
7417
+ };
7356
7418
  followUp: {
7357
7419
  enabled: boolean;
7358
7420
  agents: Record<string, boolean>;
@@ -7374,6 +7436,11 @@ declare const daemonConfigSchema: z.ZodObject<{
7374
7436
  }, {
7375
7437
  dir?: string | undefined;
7376
7438
  enabled?: boolean | undefined;
7439
+ required?: {
7440
+ enabled?: boolean | undefined;
7441
+ agents?: Record<string, boolean> | undefined;
7442
+ exemptQuestions?: boolean | undefined;
7443
+ } | undefined;
7377
7444
  followUp?: {
7378
7445
  enabled?: boolean | undefined;
7379
7446
  agents?: Record<string, boolean> | undefined;
@@ -8030,6 +8097,7 @@ declare const daemonConfigSchema: z.ZodObject<{
8030
8097
  candidates: number;
8031
8098
  sharedCandidates: number;
8032
8099
  maxPages: number;
8100
+ linkedPages: number;
8033
8101
  pageChars: number;
8034
8102
  navigatorModel: string;
8035
8103
  answerModel: string;
@@ -8520,6 +8588,13 @@ declare const daemonConfigSchema: z.ZodObject<{
8520
8588
  };
8521
8589
  drainTimeoutSeconds?: number | undefined;
8522
8590
  };
8591
+ signals: {
8592
+ enabled: boolean;
8593
+ windDownSeconds: number;
8594
+ allowAgents: string[];
8595
+ allowPeers: string[];
8596
+ maxPerRoot: number;
8597
+ };
8523
8598
  people: {
8524
8599
  agents: string[];
8525
8600
  id: string;
@@ -8650,6 +8725,11 @@ declare const daemonConfigSchema: z.ZodObject<{
8650
8725
  workflows: {
8651
8726
  dir: string;
8652
8727
  enabled: boolean;
8728
+ required: {
8729
+ enabled: boolean;
8730
+ agents: Record<string, boolean>;
8731
+ exemptQuestions: boolean;
8732
+ };
8653
8733
  followUp: {
8654
8734
  enabled: boolean;
8655
8735
  agents: Record<string, boolean>;
@@ -8973,6 +9053,7 @@ declare const daemonConfigSchema: z.ZodObject<{
8973
9053
  candidates?: number | undefined;
8974
9054
  sharedCandidates?: number | undefined;
8975
9055
  maxPages?: number | undefined;
9056
+ linkedPages?: number | undefined;
8976
9057
  pageChars?: number | undefined;
8977
9058
  navigatorModel?: string | undefined;
8978
9059
  answerModel?: string | undefined;
@@ -9525,6 +9606,13 @@ declare const daemonConfigSchema: z.ZodObject<{
9525
9606
  } | undefined;
9526
9607
  drainTimeoutSeconds?: number | undefined;
9527
9608
  } | undefined;
9609
+ signals?: {
9610
+ enabled?: boolean | undefined;
9611
+ windDownSeconds?: number | undefined;
9612
+ allowAgents?: string[] | undefined;
9613
+ allowPeers?: string[] | undefined;
9614
+ maxPerRoot?: number | undefined;
9615
+ } | undefined;
9528
9616
  people?: {
9529
9617
  id: string;
9530
9618
  name: string;
@@ -9655,6 +9743,11 @@ declare const daemonConfigSchema: z.ZodObject<{
9655
9743
  workflows?: {
9656
9744
  dir?: string | undefined;
9657
9745
  enabled?: boolean | undefined;
9746
+ required?: {
9747
+ enabled?: boolean | undefined;
9748
+ agents?: Record<string, boolean> | undefined;
9749
+ exemptQuestions?: boolean | undefined;
9750
+ } | undefined;
9658
9751
  followUp?: {
9659
9752
  enabled?: boolean | undefined;
9660
9753
  agents?: Record<string, boolean> | undefined;
@@ -10202,6 +10295,8 @@ interface AgentXEvents {
10202
10295
  /** A daemon shutdown stopped the run. Its trace stays in flight so the
10203
10296
  * next boot can resume it. */
10204
10297
  interrupted?: boolean;
10298
+ /** Ended by a stop signal (agents/signals, #857): status `stopped`. */
10299
+ stopped?: boolean;
10205
10300
  inputTokens?: number;
10206
10301
  outputTokens?: number;
10207
10302
  cacheReadTokens?: number;
@@ -10435,6 +10530,8 @@ declare class AgentXDaemon {
10435
10530
  private landscape;
10436
10531
  private heartbeat;
10437
10532
  private stopEventWaker?;
10533
+ /** Stop and resume signals (agents/signals, #857). */
10534
+ private signals;
10438
10535
  private business?;
10439
10536
  private httpServer?;
10440
10537
  private attachSweep?;
@@ -10525,6 +10622,12 @@ declare class AgentXDaemon {
10525
10622
  private bootTimes;
10526
10623
  /** Every start on record with who stopped the one before (boot-record.ts). */
10527
10624
  private bootLog;
10625
+ /** The resumers that re-enter a run where it came from: used by the boot
10626
+ * resume pass and by resume signals (agents/signals, #857). */
10627
+ private resumeCoordinatorInstance?;
10628
+ private resumeCoordinator;
10629
+ /** Stop a running task with a resume plan, and resume it later (#857). */
10630
+ private createSignalService;
10528
10631
  /** Resume, report or skip each run the last restart cut off. Never throws. */
10529
10632
  private resumeInterruptedRuns;
10530
10633
  /**
@@ -11024,7 +11127,9 @@ interface FriendlyError {
11024
11127
  /** Optional next step the user can take. */
11025
11128
  fix?: string;
11026
11129
  /** Machine-readable error category for routing / retries. */
11027
- kind: "out_of_credits" | "overage_disabled" | "usage_cap" | "auth" | "permission" | "rate_limit" | "overloaded" | "context_too_large" | "invalid_request" | "upstream_api" | "timeout" | "cancelled" | "interrupted" | "unknown";
11130
+ kind: "out_of_credits" | "overage_disabled" | "usage_cap" | "auth" | "permission" | "rate_limit" | "overloaded" | "context_too_large" | "invalid_request" | "upstream_api" | "timeout" | "cancelled" | "interrupted"
11131
+ /** Ended by a stop signal; its resume plan is saved (#857). */
11132
+ | "stopped" | "unknown";
11028
11133
  /** Whether this error is transient — a retry has a reasonable chance of succeeding. */
11029
11134
  retryable: boolean;
11030
11135
  /** Source error text retained for logs / debugging. */
@@ -11119,10 +11224,12 @@ interface IncomingMessage {
11119
11224
  runbookFiles?: string[];
11120
11225
  /** Set when this message re-runs one a restart cut off (agents/resume):
11121
11226
  * the note for the agent, the attempt number, and the run it continues. */
11227
+ /** `rootId`: a task resumed after a stop signal keeps its root (#857). */
11122
11228
  resume?: {
11123
11229
  note: string;
11124
11230
  attempt: number;
11125
11231
  resumedFrom: string;
11232
+ rootId?: string;
11126
11233
  };
11127
11234
  }
11128
11235
  interface OutgoingMessage {
@@ -13192,6 +13299,1271 @@ declare class LandscapeBuilder {
13192
13299
  private extractCapability;
13193
13300
  }
13194
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
+
13195
14567
  interface RunningTask {
13196
14568
  /** Unique id for this execution (timestamp-based). */
13197
14569
  id: string;
@@ -13216,6 +14588,15 @@ interface RunningTask {
13216
14588
  intentPath?: string[];
13217
14589
  /** Step autonomy the turn runs at (report | propose | act). Unset = act. */
13218
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
+ };
13219
14600
  }
13220
14601
  type TaskOutputSubscriber = (chunk: string) => void;
13221
14602
  /** Persisted record of a finished task, written to .agentx/task-history. */
@@ -13231,8 +14612,9 @@ interface TaskRecord {
13231
14612
  durationMs: number;
13232
14613
  ok: boolean;
13233
14614
  error?: string;
13234
- /** Set when a deadline ended the run: `timeout`, with the step it was in. */
13235
- status?: "timeout";
14615
+ /** Set when a deadline ended the run: `timeout`, with the step it was in;
14616
+ * `stopped` when a stop signal ended it (#857). */
14617
+ status?: "timeout" | "stopped";
13236
14618
  step?: string;
13237
14619
  /** Final agent text (one-shot, may be empty if streaming captured it). */
13238
14620
  responseText: string;
@@ -13283,6 +14665,9 @@ declare class AgentRegistry {
13283
14665
  * its `action.send` / `agent` nodes. Duck-typed to avoid a circular import
13284
14666
  * on WorkflowDispatcher. */
13285
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?;
13286
14671
  private messageQueue;
13287
14672
  /**
13288
14673
  * Voice chats a waiting question has claimed between its wait ending and
@@ -13311,6 +14696,10 @@ declare class AgentRegistry {
13311
14696
  private taskAborts;
13312
14697
  /** Runs a daemon shutdown stopped, with the reason each one reports. */
13313
14698
  private interruptedRuns;
14699
+ /** Runs a stop signal ended, with the reason each one reports (#857). */
14700
+ private stoppedRuns;
14701
+ /** Callers waiting for a run to let go of its slot (whenRunEnds). */
14702
+ private runEndWaiters;
13314
14703
  /** Claude cloud sessions this node launched (#622), by issue. Created on
13315
14704
  * first use so a fleet with the setting off never touches the file. */
13316
14705
  private cloudSessions?;
@@ -13344,6 +14733,7 @@ declare class AgentRegistry {
13344
14733
  /** Wire the workflow auto-runner — see field doc above. Daemon calls this
13345
14734
  * after WorkflowDispatcher boot. Pass undefined to detach (e.g. during
13346
14735
  * reload). */
14736
+ setWorkflowRunStore(runs: RunStore | undefined): void;
13347
14737
  setWorkflowAutoRunner(runner: NonNullable<AgentRegistry["workflowAutoRunner"]> | undefined): void;
13348
14738
  /** Hot-swap the provider map. Daemon reload calls this after agentx.json
13349
14739
  * changes — the next task that executes will resolve credentials through
@@ -13357,6 +14747,9 @@ declare class AgentRegistry {
13357
14747
  * execute-time for landscape + session policies, so next-task semantics
13358
14748
  * match setProviders. */
13359
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;
13360
14753
  /** Swap the people list on a config reload (#384). Turns read it when
13361
14754
  * they start, so the next turn is stamped from the new list. */
13362
14755
  setPeople(people: DaemonConfig["people"]): void;
@@ -13494,6 +14887,9 @@ declare class AgentRegistry {
13494
14887
  };
13495
14888
  hourlyTasks?: number[];
13496
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;
13497
14893
  /**
13498
14894
  * Write a finished task record to disk under .agentx/task-history/<agent>/<yyyy-mm-dd>/.
13499
14895
  * Side-effects only — call sites should treat failure as best-effort.
@@ -13556,6 +14952,7 @@ declare class AgentRegistry {
13556
14952
  taskId: string;
13557
14953
  context: NonNullable<AgentTask["context"]>;
13558
14954
  autonomy?: AgentTask["autonomy"];
14955
+ workflowRunId?: string;
13559
14956
  } | null;
13560
14957
  /** Whether every slot of `agentId` is taken, and by which runs. Lets a
13561
14958
  * synchronous delegation refuse at once when the only slot is held by
@@ -13585,6 +14982,34 @@ declare class AgentRegistry {
13585
14982
  channel: string;
13586
14983
  chatId: string;
13587
14984
  } | null;
14985
+ /**
14986
+ * Stop signal (#857). Aborts the run like an operator stop, but it ends
14987
+ * with status `stopped` and errorKind "stopped" instead of cancelled, so
14988
+ * nothing reports it as a failure. False when no live run matches.
14989
+ */
14990
+ stopRunningTask(taskId: string, reason: string): boolean;
14991
+ /** Resolves once the run `taskId` has let go of its slot (at once when it
14992
+ * is not running), or after `timeoutMs`. */
14993
+ whenRunEnds(taskId: string, timeoutMs: number): Promise<void>;
14994
+ /** A running task a stop signal can address: by its id, or the only run
14995
+ * of `agentId` on a chat. Null when none (or several) match. */
14996
+ signalTarget(by: {
14997
+ taskId?: string;
14998
+ agentId?: string;
14999
+ channel?: string;
15000
+ chatId?: string;
15001
+ }): {
15002
+ taskId: string;
15003
+ traceId?: string;
15004
+ agentId: string;
15005
+ channel: string;
15006
+ chatId: string;
15007
+ sender?: string;
15008
+ rootId?: string;
15009
+ originalMessage: string;
15010
+ origin: RunOrigin | null;
15011
+ workflowRunId?: string;
15012
+ } | null;
13588
15013
  /**
13589
15014
  * Daemon shutdown: stop every run still going once the drain limit is
13590
15015
  * spent. Each one ends as `interrupted` with `reason` rather than as a
@@ -14566,6 +15991,7 @@ interface Resumer {
14566
15991
  run: InterruptedRun;
14567
15992
  note: string;
14568
15993
  attempt: number;
15994
+ rootId?: string;
14569
15995
  }): Promise<void>;
14570
15996
  /** One line to the chat the run came from. */
14571
15997
  tell?(origin: RunOrigin, text: string): Promise<void>;