agentix-cli 0.23.0 → 0.25.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 (191) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +102 -103
  3. package/agentx.example.json +9 -3
  4. package/dist/App-6Y7B3YQH.js +8 -0
  5. package/dist/App-6Y7B3YQH.js.map +1 -0
  6. package/dist/ChatApp-KIEUJ2DS.js +7 -0
  7. package/dist/ChatApp-KIEUJ2DS.js.map +1 -0
  8. package/dist/{agent-FSE4KRLX.js → agent-QGZIAZMY.js} +2 -2
  9. package/dist/architect-SEPWMWS4.js +2 -0
  10. package/dist/{board-dashboard-PUACKWAN.js → board-dashboard-CQ5F4GPD.js} +3756 -1010
  11. package/dist/board-dashboard-CQ5F4GPD.js.map +1 -0
  12. package/dist/builtin-FRKAQMFS.js +2 -0
  13. package/dist/chunk-2WVX3LEC.js +2 -0
  14. package/dist/chunk-2WVX3LEC.js.map +1 -0
  15. package/dist/chunk-3WQFCIB6.js +24 -0
  16. package/dist/chunk-3WQFCIB6.js.map +1 -0
  17. package/dist/chunk-53GCFZPR.js +116 -0
  18. package/dist/chunk-53GCFZPR.js.map +1 -0
  19. package/dist/{chunk-IKBHHTIT.js → chunk-5U35WAZF.js} +2 -2
  20. package/dist/chunk-67Q4DCPS.js +54 -0
  21. package/dist/chunk-67Q4DCPS.js.map +1 -0
  22. package/dist/chunk-76Z4VHDX.js +8 -0
  23. package/dist/chunk-76Z4VHDX.js.map +1 -0
  24. package/dist/{chunk-7P5QRX5W.js → chunk-BFXONUUN.js} +2 -2
  25. package/dist/{chunk-DXTIG5YV.js → chunk-FDMWOPEL.js} +2 -2
  26. package/dist/chunk-FDWOECJY.js +54 -0
  27. package/dist/chunk-FDWOECJY.js.map +1 -0
  28. package/dist/chunk-G57RZCXM.js +5 -0
  29. package/dist/chunk-G57RZCXM.js.map +1 -0
  30. package/dist/{chunk-NOF4HSGK.js → chunk-H5D7ATXS.js} +2 -2
  31. package/dist/chunk-HA3XI7Z2.js +155 -0
  32. package/dist/chunk-HA3XI7Z2.js.map +1 -0
  33. package/dist/chunk-HR4JSRZS.js +3 -0
  34. package/dist/{chunk-A6BKSZQA.js.map → chunk-HR4JSRZS.js.map} +1 -1
  35. package/dist/chunk-I3SIXTJO.js +44 -0
  36. package/dist/chunk-I3SIXTJO.js.map +1 -0
  37. package/dist/chunk-ISEBLHWX.js +118 -0
  38. package/dist/chunk-ISEBLHWX.js.map +1 -0
  39. package/dist/{chunk-4ITQP3XL.js → chunk-JP5IEXR7.js} +2 -2
  40. package/dist/chunk-JXWAGMI2.js +13 -0
  41. package/dist/chunk-JXWAGMI2.js.map +1 -0
  42. package/dist/chunk-KUCCW2VG.js +431 -0
  43. package/dist/chunk-KUCCW2VG.js.map +1 -0
  44. package/dist/chunk-LDHPMJ7M.js +257 -0
  45. package/dist/chunk-LDHPMJ7M.js.map +1 -0
  46. package/dist/{chunk-KWUWZQGV.js → chunk-LNXCJWOU.js} +29 -30
  47. package/dist/chunk-LNXCJWOU.js.map +1 -0
  48. package/dist/chunk-M4AMWP3H.js +178 -0
  49. package/dist/chunk-M4AMWP3H.js.map +1 -0
  50. package/dist/chunk-NGSIRE4X.js +126 -0
  51. package/dist/chunk-NGSIRE4X.js.map +1 -0
  52. package/dist/{chunk-CNNLREHD.js → chunk-P4VWIVKN.js} +268 -410
  53. package/dist/chunk-P4VWIVKN.js.map +1 -0
  54. package/dist/chunk-Q6YO7LYE.js +47 -0
  55. package/dist/chunk-Q6YO7LYE.js.map +1 -0
  56. package/dist/chunk-TMKLHTCG.js +971 -0
  57. package/dist/chunk-TMKLHTCG.js.map +1 -0
  58. package/dist/chunk-TRJTTBE2.js +7 -0
  59. package/dist/chunk-TRJTTBE2.js.map +1 -0
  60. package/dist/chunk-U2CKL755.js +4 -0
  61. package/dist/chunk-U2CKL755.js.map +1 -0
  62. package/dist/chunk-UCQ2N3KO.js +9 -0
  63. package/dist/chunk-UCQ2N3KO.js.map +1 -0
  64. package/dist/chunk-W4YR2RO2.js +2 -0
  65. package/dist/chunk-W4YR2RO2.js.map +1 -0
  66. package/dist/cli.js +1 -1
  67. package/dist/cli.js.map +1 -1
  68. package/dist/client-GGVVLOOF.js +2 -0
  69. package/dist/{compaction-BTUJJ3LJ.js → compaction-NWEMOSHA.js} +3 -3
  70. package/dist/config-7FSZFRTQ.js +2 -0
  71. package/dist/config-mutator-POCOYYJ4.js +2 -0
  72. package/dist/{context-planner-I7ID7XF3.js → context-planner-45GEWKGL.js} +2 -2
  73. package/dist/doctor-DHLBEKA4.js +2 -0
  74. package/dist/heal-HZ3EQD52.js +2 -0
  75. package/dist/index.d.ts +1193 -225
  76. package/dist/index.js +12 -12
  77. package/dist/index.js.map +1 -1
  78. package/dist/memory-extract-AENFVVO5.js +2 -0
  79. package/dist/processes-UIC4XXA6.js +2 -0
  80. package/dist/program-WVAVJFND.js +2 -0
  81. package/dist/projects-api-KRME2YKZ.js +2 -0
  82. package/dist/projects-api-KRME2YKZ.js.map +1 -0
  83. package/dist/projects-mutate-3NHVG437.js +7 -0
  84. package/dist/projects-mutate-3NHVG437.js.map +1 -0
  85. package/dist/providers-L27BJ5A6.js +2 -0
  86. package/dist/registry-T36ZIAWV.js +2 -0
  87. package/dist/rotation-memo-B3EXXSEH.js +13 -0
  88. package/dist/rotation-memo-B3EXXSEH.js.map +1 -0
  89. package/dist/scheduler-GH7TIKYS.js +2 -0
  90. package/dist/surface-usage-PRL6Z4U3.js +2 -0
  91. package/dist/wiki-M6YNRFC4.js +2 -0
  92. package/dist/workflows/templates/branching.yaml +75 -0
  93. package/dist/workflows/templates/extract.yaml +59 -0
  94. package/dist/workflows/templates/linear.yaml +37 -0
  95. package/dist/workflows/templates/retry.yaml +61 -0
  96. package/dist/workspace-setup-TBQAHYHJ.js +2 -0
  97. package/package.json +10 -3
  98. package/dist/board-dashboard-PUACKWAN.js.map +0 -1
  99. package/dist/builtin-TQKMR42Z.js +0 -2
  100. package/dist/chunk-3SHMHYPD.js +0 -450
  101. package/dist/chunk-3SHMHYPD.js.map +0 -1
  102. package/dist/chunk-4INOOHND.js +0 -6
  103. package/dist/chunk-4INOOHND.js.map +0 -1
  104. package/dist/chunk-5F3J55LG.js +0 -2
  105. package/dist/chunk-5F3J55LG.js.map +0 -1
  106. package/dist/chunk-72PAN7UI.js +0 -103
  107. package/dist/chunk-72PAN7UI.js.map +0 -1
  108. package/dist/chunk-A6BKSZQA.js +0 -3
  109. package/dist/chunk-BHSPAP4U.js +0 -44
  110. package/dist/chunk-BHSPAP4U.js.map +0 -1
  111. package/dist/chunk-BOUKM2PS.js +0 -163
  112. package/dist/chunk-BOUKM2PS.js.map +0 -1
  113. package/dist/chunk-CDNWCYF7.js +0 -2
  114. package/dist/chunk-CDNWCYF7.js.map +0 -1
  115. package/dist/chunk-CNNLREHD.js.map +0 -1
  116. package/dist/chunk-EK37JHJI.js +0 -13
  117. package/dist/chunk-EK37JHJI.js.map +0 -1
  118. package/dist/chunk-EQPUB7CZ.js +0 -685
  119. package/dist/chunk-EQPUB7CZ.js.map +0 -1
  120. package/dist/chunk-EW27SCCC.js +0 -2
  121. package/dist/chunk-EW27SCCC.js.map +0 -1
  122. package/dist/chunk-GOLZ6NEL.js +0 -111
  123. package/dist/chunk-GOLZ6NEL.js.map +0 -1
  124. package/dist/chunk-JGXE2YNV.js +0 -46
  125. package/dist/chunk-JGXE2YNV.js.map +0 -1
  126. package/dist/chunk-KWUWZQGV.js.map +0 -1
  127. package/dist/chunk-MTRWXRFF.js +0 -380
  128. package/dist/chunk-MTRWXRFF.js.map +0 -1
  129. package/dist/chunk-N67JZAXU.js +0 -2
  130. package/dist/chunk-N67JZAXU.js.map +0 -1
  131. package/dist/chunk-PD5Q7D6Z.js +0 -7
  132. package/dist/chunk-PD5Q7D6Z.js.map +0 -1
  133. package/dist/chunk-Q6CAFGXT.js +0 -118
  134. package/dist/chunk-Q6CAFGXT.js.map +0 -1
  135. package/dist/chunk-WJXU5F4Z.js +0 -53
  136. package/dist/chunk-WJXU5F4Z.js.map +0 -1
  137. package/dist/chunk-ZZFXI3CS.js +0 -8
  138. package/dist/chunk-ZZFXI3CS.js.map +0 -1
  139. package/dist/config-ADS54KLC.js +0 -2
  140. package/dist/config-mutator-WTRMBZTO.js +0 -2
  141. package/dist/doctor-T6RB4Q5X.js +0 -2
  142. package/dist/editor-chat-RVLCKKB7.js +0 -137
  143. package/dist/editor-chat-RVLCKKB7.js.map +0 -1
  144. package/dist/heal-YEQYWX2L.js +0 -2
  145. package/dist/inbox-BIN2S5XN.js +0 -2
  146. package/dist/memory-extract-KRCHD3OP.js +0 -2
  147. package/dist/processes-RJ6RDP32.js +0 -2
  148. package/dist/program-V7NGFB2R.js +0 -2
  149. package/dist/providers-WVCMIW67.js +0 -2
  150. package/dist/registry-42HEWCLA.js +0 -2
  151. package/dist/rotation-memo-GMTZPMNE.js +0 -13
  152. package/dist/rotation-memo-GMTZPMNE.js.map +0 -1
  153. package/dist/scheduler-C56ABAVP.js +0 -2
  154. package/dist/slack-6P7ZJ32Y.js +0 -3
  155. package/dist/slack-6P7ZJ32Y.js.map +0 -1
  156. package/dist/store-BAPDZHXE.js +0 -2
  157. package/dist/task-store-RHISEU6V.js +0 -2
  158. package/dist/telegram-PIYDRM46.js +0 -3
  159. package/dist/telegram-PIYDRM46.js.map +0 -1
  160. package/dist/types-ZRLHHCGB.js +0 -2
  161. package/dist/web/workflow-editor.global.js +0 -1452
  162. package/dist/web/workflow-editor.global.js.map +0 -1
  163. package/dist/whatsapp-PFRDMUMT.js +0 -3
  164. package/dist/whatsapp-PFRDMUMT.js.map +0 -1
  165. package/dist/wiki-53W5NLZV.js +0 -2
  166. package/dist/workspace-setup-DQCZX2NE.js +0 -2
  167. package/dist/workspace-setup-DQCZX2NE.js.map +0 -1
  168. /package/dist/{agent-FSE4KRLX.js.map → agent-QGZIAZMY.js.map} +0 -0
  169. /package/dist/{builtin-TQKMR42Z.js.map → architect-SEPWMWS4.js.map} +0 -0
  170. /package/dist/{config-ADS54KLC.js.map → builtin-FRKAQMFS.js.map} +0 -0
  171. /package/dist/{chunk-IKBHHTIT.js.map → chunk-5U35WAZF.js.map} +0 -0
  172. /package/dist/{chunk-7P5QRX5W.js.map → chunk-BFXONUUN.js.map} +0 -0
  173. /package/dist/{chunk-DXTIG5YV.js.map → chunk-FDMWOPEL.js.map} +0 -0
  174. /package/dist/{chunk-NOF4HSGK.js.map → chunk-H5D7ATXS.js.map} +0 -0
  175. /package/dist/{chunk-4ITQP3XL.js.map → chunk-JP5IEXR7.js.map} +0 -0
  176. /package/dist/{config-mutator-WTRMBZTO.js.map → client-GGVVLOOF.js.map} +0 -0
  177. /package/dist/{compaction-BTUJJ3LJ.js.map → compaction-NWEMOSHA.js.map} +0 -0
  178. /package/dist/{doctor-T6RB4Q5X.js.map → config-7FSZFRTQ.js.map} +0 -0
  179. /package/dist/{heal-YEQYWX2L.js.map → config-mutator-POCOYYJ4.js.map} +0 -0
  180. /package/dist/{context-planner-I7ID7XF3.js.map → context-planner-45GEWKGL.js.map} +0 -0
  181. /package/dist/{inbox-BIN2S5XN.js.map → doctor-DHLBEKA4.js.map} +0 -0
  182. /package/dist/{memory-extract-KRCHD3OP.js.map → heal-HZ3EQD52.js.map} +0 -0
  183. /package/dist/{processes-RJ6RDP32.js.map → memory-extract-AENFVVO5.js.map} +0 -0
  184. /package/dist/{program-V7NGFB2R.js.map → processes-UIC4XXA6.js.map} +0 -0
  185. /package/dist/{providers-WVCMIW67.js.map → program-WVAVJFND.js.map} +0 -0
  186. /package/dist/{registry-42HEWCLA.js.map → providers-L27BJ5A6.js.map} +0 -0
  187. /package/dist/{scheduler-C56ABAVP.js.map → registry-T36ZIAWV.js.map} +0 -0
  188. /package/dist/{store-BAPDZHXE.js.map → scheduler-GH7TIKYS.js.map} +0 -0
  189. /package/dist/{task-store-RHISEU6V.js.map → surface-usage-PRL6Z4U3.js.map} +0 -0
  190. /package/dist/{types-ZRLHHCGB.js.map → wiki-M6YNRFC4.js.map} +0 -0
  191. /package/dist/{wiki-53W5NLZV.js.map → workspace-setup-TBQAHYHJ.js.map} +0 -0
package/dist/index.d.ts CHANGED
@@ -23,6 +23,12 @@ interface ProviderOptions {
23
23
  maxTokens?: number;
24
24
  temperature?: number;
25
25
  apiKey?: string;
26
+ /** Operator-cancel signal — passed straight to fetch() so the in-
27
+ * flight HTTP request to the provider can be closed when the
28
+ * task is cancelled. Without this, /api/tasks/:id/cancel only
29
+ * marks the task aborted in the registry; the underlying request
30
+ * can hang for hours waiting for the model to finish thinking. */
31
+ abortSignal?: AbortSignal;
26
32
  }
27
33
  type StreamEvent = {
28
34
  type: "text_delta";
@@ -37,6 +43,9 @@ type StreamEvent = {
37
43
  } | {
38
44
  type: "tool_use_end";
39
45
  name: string;
46
+ } | {
47
+ type: "thinking_delta";
48
+ text: string;
40
49
  } | {
41
50
  type: "done";
42
51
  result: GenerationResult;
@@ -61,6 +70,9 @@ type ContentBlock = {
61
70
  tool_use_id: string;
62
71
  content: string;
63
72
  is_error?: boolean;
73
+ } | {
74
+ type: "reasoning";
75
+ text: string;
64
76
  };
65
77
  interface RawGenerationResult {
66
78
  content: ContentBlock[];
@@ -80,9 +92,41 @@ interface AgentProvider {
80
92
  description: string;
81
93
  input_schema: Record<string, unknown>;
82
94
  }>, options?: ProviderOptions): Promise<RawGenerationResult>;
95
+ /**
96
+ * Streaming variant of generateRaw — emits text_delta events as the
97
+ * model generates so callers can pipe per-token to UIs (voice TTS,
98
+ * SSE, etc.) AND still get the full RawGenerationResult at the end
99
+ * with the tool_use blocks intact, so the agentic loop's tool
100
+ * dispatch keeps working unchanged. Optional — runAgenticLoop falls
101
+ * back to generateRaw() when this isn't implemented.
102
+ */
103
+ generateRawStream?(messages: AnthropicMessage[], systemPrompt: string, tools: Array<{
104
+ name: string;
105
+ description: string;
106
+ input_schema: Record<string, unknown>;
107
+ }>, options?: ProviderOptions): AsyncIterable<RawStreamEvent>;
83
108
  }
109
+ /**
110
+ * Event stream from generateRawStream. text_delta arrives per chunk so
111
+ * the caller can stream to a UI; tool_use blocks accumulate silently and
112
+ * are surfaced in the terminal raw_result event so the agentic loop's
113
+ * tool dispatch logic stays unchanged.
114
+ */
115
+ type RawStreamEvent = {
116
+ type: "text_delta";
117
+ text: string;
118
+ } | {
119
+ type: "thinking_delta";
120
+ text: string;
121
+ } | {
122
+ type: "raw_result";
123
+ result: RawGenerationResult;
124
+ } | {
125
+ type: "error";
126
+ error: string;
127
+ };
84
128
  declare const agentConfigSchema$1: z.ZodObject<{
85
- provider: z.ZodDefault<z.ZodEnum<["claude-code", "claude", "openai", "ollama", "custom"]>>;
129
+ provider: z.ZodDefault<z.ZodEnum<["claude-code", "claude", "openai", "deepseek", "ollama", "demo", "custom"]>>;
86
130
  model: z.ZodOptional<z.ZodString>;
87
131
  apiKey: z.ZodOptional<z.ZodString>;
88
132
  skills: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
@@ -117,7 +161,7 @@ declare const agentConfigSchema$1: z.ZodObject<{
117
161
  disabledTools?: string[] | undefined;
118
162
  }>>;
119
163
  }, "strip", z.ZodTypeAny, {
120
- provider: "claude-code" | "claude" | "openai" | "ollama" | "custom";
164
+ provider: "claude-code" | "claude" | "openai" | "deepseek" | "ollama" | "demo" | "custom";
121
165
  skills: string[];
122
166
  output: {
123
167
  dir: string;
@@ -134,7 +178,7 @@ declare const agentConfigSchema$1: z.ZodObject<{
134
178
  model?: string | undefined;
135
179
  apiKey?: string | undefined;
136
180
  }, {
137
- provider?: "claude-code" | "claude" | "openai" | "ollama" | "custom" | undefined;
181
+ provider?: "claude-code" | "claude" | "openai" | "deepseek" | "ollama" | "demo" | "custom" | undefined;
138
182
  model?: string | undefined;
139
183
  apiKey?: string | undefined;
140
184
  skills?: string[] | undefined;
@@ -168,6 +212,25 @@ declare class ClaudeProvider implements AgentProvider {
168
212
  input_schema: Record<string, unknown>;
169
213
  }>, options?: ProviderOptions): Promise<RawGenerationResult>;
170
214
  stream(messages: GenerationMessage[], options?: ProviderOptions): AsyncIterable<StreamEvent>;
215
+ /**
216
+ * Streaming variant of generateRaw — yields text_delta events per
217
+ * chunk so callers can pipe per-token to a UI, AND assembles the full
218
+ * RawGenerationResult (with tool_use blocks intact, stop_reason set)
219
+ * so the agentic loop's tool dispatch keeps working unchanged.
220
+ *
221
+ * Implementation mirrors stream() but:
222
+ * - Targets generateRaw's signature (anthropicMessages + systemPrompt +
223
+ * tools as parameters, not interleaved messages).
224
+ * - Builds a ContentBlock[] with both text and tool_use blocks in the
225
+ * order they arrived, so the agentic loop's `result.content.filter(
226
+ * b => b.type === "tool_use")` still finds them.
227
+ * - Yields one terminal `raw_result` event the loop consumes.
228
+ */
229
+ generateRawStream(messages: AnthropicMessage[], systemPrompt: string, tools: Array<{
230
+ name: string;
231
+ description: string;
232
+ input_schema: Record<string, unknown>;
233
+ }>, options?: ProviderOptions): AsyncIterable<RawStreamEvent>;
171
234
  private buildHeaders;
172
235
  private callApi;
173
236
  private parseResponse;
@@ -228,8 +291,14 @@ declare class ClaudeCodeProvider implements AgentProvider {
228
291
  private parseApiResponse;
229
292
  }
230
293
 
231
- type ProviderName = "claude-code" | "claude" | "openai" | "ollama" | "custom";
232
- declare function createProvider(name?: ProviderName, apiKey?: string): AgentProvider;
294
+ type ProviderName = "claude-code" | "claude" | "openai" | "deepseek" | "ollama" | "demo" | "custom";
295
+ interface CreateProviderOptions {
296
+ /** Toggle DeepSeek thinking-mode (`reasoning_content` blocks). Default
297
+ * `true` for DeepSeek baseUrls. Wire this from
298
+ * `providers.<name>.thinking` in agentx.json. */
299
+ thinking?: boolean;
300
+ }
301
+ declare function createProvider(name?: ProviderName, apiKey?: string, opts?: CreateProviderOptions): AgentProvider;
233
302
 
234
303
  interface MemoryEntry {
235
304
  id: string;
@@ -328,6 +397,41 @@ declare class HealEngine {
328
397
  private generateFix;
329
398
  }
330
399
 
400
+ /**
401
+ * Get all tool definitions in Anthropic API format (for generateRaw()).
402
+ * Optionally filter by enabled tool names.
403
+ */
404
+ declare function getAnthropicTools(enabledTools?: string[]): Array<{
405
+ name: string;
406
+ description: string;
407
+ input_schema: Record<string, unknown>;
408
+ }>;
409
+ /**
410
+ * Get the legacy tools (create_files + ask_user) for backward compatibility.
411
+ */
412
+ declare function getLegacyTools(): Array<{
413
+ name: string;
414
+ description: string;
415
+ input_schema: Record<string, unknown>;
416
+ }>;
417
+ /**
418
+ * Format tool descriptions for inclusion in a system prompt.
419
+ * Used when the `claude` CLI binary handles its own tools —
420
+ * we describe our additional tools as text so the binary's built-in
421
+ * capabilities (read, write, bash) handle them natively.
422
+ */
423
+ declare function formatToolsForSystemPrompt(): string;
424
+ declare const ALL_TOOL_NAMES: string[];
425
+
426
+ interface NoqtaToolContext {
427
+ /** The noqta.tn user UUID this tool call impersonates. */
428
+ userId: string;
429
+ /** Logical agent id (for the audit table's X-Agent-Id column). */
430
+ agentId?: string;
431
+ /** Override the noqta.tn base URL — defaults to NOQTA_API_URL env or https://noqta.tn. */
432
+ apiUrl?: string;
433
+ }
434
+
331
435
  interface TechStack {
332
436
  languages: Language[];
333
437
  frameworks: Framework[];
@@ -467,6 +571,27 @@ interface SkillMatch {
467
571
  matchReason: string;
468
572
  }
469
573
 
574
+ /** stdio MCP server — spawned as a child process, JSON-RPC over NDJSON
575
+ * on stdin/stdout. The `type` field is optional for backward compat
576
+ * with the original config shape (`{ command, args, env }`). */
577
+ interface McpStdioSpec {
578
+ type?: "stdio";
579
+ command: string;
580
+ args?: string[];
581
+ env?: Record<string, string>;
582
+ }
583
+ /** HTTP MCP server (Streamable HTTP transport) — POST JSON-RPC bodies to
584
+ * `url`, server may answer as `application/json` or stream as
585
+ * `text/event-stream` (`data: <json>` lines). Optional `headers` get
586
+ * merged into every request (auth tokens, tenancy hints, etc.). */
587
+ interface McpHttpSpec {
588
+ type: "http";
589
+ url: string;
590
+ headers?: Record<string, string>;
591
+ }
592
+ type McpServerSpec = McpStdioSpec | McpHttpSpec;
593
+ type McpServerMap = Record<string, McpServerSpec>;
594
+
470
595
  interface AgentContext {
471
596
  techStack: TechStack;
472
597
  schemas: ProjectSchemas;
@@ -498,6 +623,34 @@ interface GenerateOptions {
498
623
  lintCommand?: string;
499
624
  maxAttempts?: number;
500
625
  };
626
+ /** Enables the noqta workspace tool catalog (list_projects, create_task,
627
+ * …) in the agentic loop and threads the user_id through to the
628
+ * executor. Without this set, the noqta-tools are absent from the
629
+ * agent's tool list — keeps non-noqta agents clean. The bearer is
630
+ * read from env at dispatch time and NEVER enters the prompt. */
631
+ noqtaContext?: NoqtaToolContext;
632
+ /** Provider-level options forwarded to `createProvider`. Today only
633
+ * `thinking` (for DeepSeek thinking-mode). Wired from
634
+ * `providers.<name>.thinking` in agentx.json by the daemon's
635
+ * orchestrator-tier dispatch path. */
636
+ providerOpts?: {
637
+ thinking?: boolean;
638
+ };
639
+ /** Operator-cancel signal. When the daemon's task-cancel API fires
640
+ * the AbortController, runAgenticLoop forwards this into the
641
+ * provider's fetch() so the in-flight HTTP call is actually
642
+ * closed. Without this, /api/tasks/:id/cancel for orchestrator-
643
+ * tier agents only marks the task `cancelled` in the registry
644
+ * while the underlying DeepSeek request keeps running (seen in
645
+ * production: 100+ minute hangs). */
646
+ abortSignal?: AbortSignal;
647
+ /** External MCP servers to boot for this generation. Each entry is
648
+ * spawned as a stdio child, its tools listed via tools/list, and
649
+ * exposed to the agentic loop as `mcp__<server>__<tool>`. Wired
650
+ * from `effectiveMcpConfig(agent)` by the orchestrator tier in
651
+ * src/agents/runtime.ts — CLI-backed tiers (claude-code, codex-cli)
652
+ * load their own `.mcp.json` natively and ignore this. */
653
+ mcpServers?: McpServerMap;
501
654
  }
502
655
  interface GenerateResult {
503
656
  files: WriteResult;
@@ -505,6 +658,11 @@ interface GenerateResult {
505
658
  outputType: OutputType;
506
659
  followUp?: string;
507
660
  tokensUsed?: number;
661
+ /** Split tokens when the provider supplies them (Claude raw mode does;
662
+ * CLI mode and legacy fallbacks may not). Callers that bill by
663
+ * direction should prefer these over a 30/70 estimate of tokensUsed. */
664
+ inputTokens?: number;
665
+ outputTokens?: number;
508
666
  healResult?: HealResult;
509
667
  }
510
668
  declare function createAgentContext(cwd: string, task: string, config?: Partial<AgentConfig>): Promise<AgentContext>;
@@ -562,32 +720,6 @@ interface OutputConfig {
562
720
  declare const OUTPUT_CONFIGS: Record<string, OutputConfig>;
563
721
  declare function resolveOutputType(userHint: string | undefined, taskDescription: string): OutputType;
564
722
 
565
- /**
566
- * Get all tool definitions in Anthropic API format (for generateRaw()).
567
- * Optionally filter by enabled tool names.
568
- */
569
- declare function getAnthropicTools(enabledTools?: string[]): Array<{
570
- name: string;
571
- description: string;
572
- input_schema: Record<string, unknown>;
573
- }>;
574
- /**
575
- * Get the legacy tools (create_files + ask_user) for backward compatibility.
576
- */
577
- declare function getLegacyTools(): Array<{
578
- name: string;
579
- description: string;
580
- input_schema: Record<string, unknown>;
581
- }>;
582
- /**
583
- * Format tool descriptions for inclusion in a system prompt.
584
- * Used when the `claude` CLI binary handles its own tools —
585
- * we describe our additional tools as text so the binary's built-in
586
- * capabilities (read, write, bash) handle them natively.
587
- */
588
- declare function formatToolsForSystemPrompt(): string;
589
- declare const ALL_TOOL_NAMES: string[];
590
-
591
723
  interface ToolCallInput {
592
724
  name: string;
593
725
  id: string;
@@ -606,6 +738,16 @@ interface ToolExecutorOptions {
606
738
  interactive?: boolean;
607
739
  overwrite?: boolean;
608
740
  dryRun?: boolean;
741
+ /** When set, noqta-tools (list_projects, create_task, etc.) become
742
+ * available — the executor dispatches them by POSTing to
743
+ * /api/agent/tools with the server-held bearer. The bearer NEVER
744
+ * enters the model's prompt context. Omit to leave noqta-tools off
745
+ * (the agent will see "Unknown tool" if it calls one anyway). */
746
+ noqtaContext?: NoqtaToolContext;
747
+ /** Operator-cancel signal. When fired we short-circuit `execute()`
748
+ * before dispatch and forward to execa as `cancelSignal` so a
749
+ * hung shell command can't outlive the abort. */
750
+ abortSignal?: AbortSignal;
609
751
  }
610
752
  declare class ToolExecutor {
611
753
  private cwd;
@@ -928,7 +1070,7 @@ declare class PermissionManager {
928
1070
  }
929
1071
  declare const globalPermissions: PermissionManager;
930
1072
 
931
- declare const HOOK_EVENTS: readonly ["pre:generate", "post:generate", "pre:file-write", "post:file-write", "pre:prompt", "post:response", "pre:command", "on:error", "pre:tool-call", "post:tool-call", "pre:channel-message", "post:channel-message", "pre:a2a-task", "pre:cron-run", "post:cron-run", "on:gitlab-pipeline", "on:gitlab-issue"];
1073
+ declare const HOOK_EVENTS: readonly ["pre:generate", "post:generate", "pre:file-write", "post:file-write", "pre:prompt", "post:response", "pre:command", "on:error", "pre:tool-call", "post:tool-call", "pre:channel-message", "post:channel-message", "pre:a2a-task", "pre:cron-run", "post:cron-run", "on:gitlab-pipeline", "on:gitlab-issue", "on:gitlab-mr", "on:gitlab-note", "on:github-issue", "on:github-pr", "on:github-push", "on:stripe-event", "on:sentry-issue", "on:vercel-deployment", "on:odoo-event", "on:hubspot-event"];
932
1074
  type HookEvent = (typeof HOOK_EVENTS)[number];
933
1075
  declare const BLOCKING_EVENTS: HookEvent[];
934
1076
  declare const hookDefinitionSchema: z.ZodObject<{
@@ -936,7 +1078,7 @@ declare const hookDefinitionSchema: z.ZodObject<{
936
1078
  type: z.ZodEnum<["command", "prompt", "script"]>;
937
1079
  command: z.ZodOptional<z.ZodString>;
938
1080
  prompt: z.ZodOptional<z.ZodString>;
939
- provider: z.ZodOptional<z.ZodEnum<["claude-code", "claude", "openai", "ollama", "custom"]>>;
1081
+ provider: z.ZodOptional<z.ZodEnum<["claude-code", "claude", "openai", "deepseek", "ollama", "custom"]>>;
940
1082
  model: z.ZodOptional<z.ZodString>;
941
1083
  script: z.ZodOptional<z.ZodString>;
942
1084
  priority: z.ZodDefault<z.ZodNumber>;
@@ -946,7 +1088,7 @@ declare const hookDefinitionSchema: z.ZodObject<{
946
1088
  enabled: boolean;
947
1089
  name: string;
948
1090
  priority: number;
949
- provider?: "claude-code" | "claude" | "openai" | "ollama" | "custom" | undefined;
1091
+ provider?: "claude-code" | "claude" | "openai" | "deepseek" | "ollama" | "custom" | undefined;
950
1092
  model?: string | undefined;
951
1093
  script?: string | undefined;
952
1094
  command?: string | undefined;
@@ -954,7 +1096,7 @@ declare const hookDefinitionSchema: z.ZodObject<{
954
1096
  }, {
955
1097
  type: "script" | "command" | "prompt";
956
1098
  name: string;
957
- provider?: "claude-code" | "claude" | "openai" | "ollama" | "custom" | undefined;
1099
+ provider?: "claude-code" | "claude" | "openai" | "deepseek" | "ollama" | "custom" | undefined;
958
1100
  model?: string | undefined;
959
1101
  enabled?: boolean | undefined;
960
1102
  script?: string | undefined;
@@ -1309,7 +1451,7 @@ declare class A2AClient {
1309
1451
  declare const agentConfigSchema: z.ZodObject<{
1310
1452
  name: z.ZodString;
1311
1453
  workspace: z.ZodString;
1312
- tier: z.ZodDefault<z.ZodEnum<["claude-code", "sdk", "orchestrator"]>>;
1454
+ tier: z.ZodDefault<z.ZodEnum<["claude-code", "codex-cli", "opencode", "sdk", "orchestrator"]>>;
1313
1455
  provider: z.ZodOptional<z.ZodString>;
1314
1456
  model: z.ZodOptional<z.ZodString>;
1315
1457
  systemPrompt: z.ZodOptional<z.ZodString>;
@@ -1336,19 +1478,44 @@ declare const agentConfigSchema: z.ZodObject<{
1336
1478
  /** MCP servers this agent's Claude Code session should load. Synced
1337
1479
  * to <workspace>/.mcp.json at daemon boot via agent-mcp.ts. Operator
1338
1480
  * edits to .mcp.json are respected (see SyncResult.skipped-operator-owned). */
1339
- mcp: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1481
+ mcp: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
1482
+ type: z.ZodLiteral<"http">;
1483
+ url: z.ZodString;
1484
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1485
+ }, "strip", z.ZodTypeAny, {
1486
+ type: "http";
1487
+ url: string;
1488
+ headers?: Record<string, string> | undefined;
1489
+ }, {
1490
+ type: "http";
1491
+ url: string;
1492
+ headers?: Record<string, string> | undefined;
1493
+ }>, z.ZodObject<{
1494
+ type: z.ZodOptional<z.ZodLiteral<"stdio">>;
1340
1495
  command: z.ZodString;
1341
1496
  args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1342
1497
  env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1343
1498
  }, "strip", z.ZodTypeAny, {
1344
1499
  command: string;
1345
1500
  args: string[];
1501
+ type?: "stdio" | undefined;
1346
1502
  env?: Record<string, string> | undefined;
1347
1503
  }, {
1348
1504
  command: string;
1505
+ type?: "stdio" | undefined;
1349
1506
  env?: Record<string, string> | undefined;
1350
1507
  args?: string[] | undefined;
1351
- }>>>;
1508
+ }>]>>>;
1509
+ /** Enable CodeGraph (https://github.com/colbymchenry/codegraph) for this
1510
+ * agent's claude-code or codex-cli workspace. When true, agentx (a) adds
1511
+ * a codegraph MCP server to <workspace>/.mcp.json, (b) extends
1512
+ * .claude/settings.json permissions.allow with the codegraph_* tools,
1513
+ * (c) appends a CodeGraph instruction section to the managed CLAUDE.md,
1514
+ * and (d) background-indexes the workspace at daemon boot if .codegraph/
1515
+ * is missing. Off by default — flip on for coding agents (mtgl-v2-coder,
1516
+ * ksi-v2-coder, hasanah-coding, etc.) where token-volume on exploration
1517
+ * loops is the bottleneck. */
1518
+ codegraph: z.ZodDefault<z.ZodBoolean>;
1352
1519
  /** Per-agent override for the global `session.contextStrategy`. Lets
1353
1520
  * one agent run `planner` (smaller upfront context, more tool-driven
1354
1521
  * exploration) while siblings stay on `layered`. Used for agents that
@@ -1360,6 +1527,10 @@ declare const agentConfigSchema: z.ZodObject<{
1360
1527
  * etc.) once a `references/` registry exists in the agent's workspace
1361
1528
  * or repo root. See src/agents/references/. */
1362
1529
  contextReferences: z.ZodDefault<z.ZodBoolean>;
1530
+ /** Whether this agent may emit in-band `agentx:ui` rich-message directives
1531
+ * (buttons/polls/media) on chat channels. Default true — set false to make
1532
+ * the render layer strip any directive and send plain text only. */
1533
+ richMessages: z.ZodDefault<z.ZodBoolean>;
1363
1534
  maxConcurrent: z.ZodDefault<z.ZodNumber>;
1364
1535
  /** Hard wall-clock cap on a single Claude Code invocation. Exceeding the
1365
1536
  * cap sends SIGTERM (exit 143). Default 20 min — bump for devops/coder
@@ -1381,6 +1552,14 @@ declare const agentConfigSchema: z.ZodObject<{
1381
1552
  * without a schema bump. Empty/unset means no enforcement
1382
1553
  * (default — backward compatible). */
1383
1554
  toolUseRequired: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1555
+ /** Per-agent override for the channel-level `autoReplyLegacy` on
1556
+ * gitlab/github. When set, it wins over `channels.<name>.autoReplyLegacy`
1557
+ * for this agent's replies: `true` makes the daemon auto-post the agent's
1558
+ * final text as a comment (right for coder agents that end their turn with
1559
+ * a summary and don't call `agentx_channel_reply`); `false` suppresses it
1560
+ * (right for chatty agents whose reasoning shouldn't land as a comment).
1561
+ * Unset → fall back to the channel default. */
1562
+ gitlabAutoReply: z.ZodOptional<z.ZodBoolean>;
1384
1563
  /** When true, this agent's claude-code dispatches reuse a long-lived
1385
1564
  * subprocess per (channel, chatId) instead of spawning a fresh
1386
1565
  * `claude -p` per turn. Driven over stdin via stream-json input,
@@ -1416,14 +1595,98 @@ declare const agentConfigSchema: z.ZodObject<{
1416
1595
  * - "public": external apps can POST /api/public/agents/<id>/messages
1417
1596
  * with a scoped token (agent:<id> or agent:*). */
1418
1597
  access: z.ZodDefault<z.ZodEnum<["private", "public"]>>;
1598
+ /** Per-agent third-party integrations registry. Declares which services
1599
+ * this agent has credentials for (telegram-bot, hubspot, gitlab-user,
1600
+ * gmail, etc.). Secrets stay in env vars / keyring; this block holds
1601
+ * declarations + non-secret metadata only. Skills and channel adapters
1602
+ * read from here to know what the agent can use. See INTEGRATION_KINDS. */
1603
+ integrations: z.ZodDefault<z.ZodArray<z.ZodObject<{
1604
+ /** Service identifier — open string, well-known values in INTEGRATION_KINDS. */
1605
+ kind: z.ZodString;
1606
+ /** Human-readable label (e.g. "@cx_bot", "Noqta CRM", "anis@noqta.tn"). Unique per (agent, kind). */
1607
+ label: z.ZodString;
1608
+ credentials: z.ZodDefault<z.ZodObject<{
1609
+ /** Env var holding the secret. Uppercase identifier; daemon resolves at use-time. */
1610
+ tokenEnv: z.ZodOptional<z.ZodString>;
1611
+ /** Alternate env-var keys for credential schemes that need >1 secret
1612
+ * (e.g. HubSpot private app + portal id, OAuth refresh tokens). */
1613
+ privateAppTokenEnv: z.ZodOptional<z.ZodString>;
1614
+ apiKeyEnv: z.ZodOptional<z.ZodString>;
1615
+ refreshTokenEnv: z.ZodOptional<z.ZodString>;
1616
+ clientIdEnv: z.ZodOptional<z.ZodString>;
1617
+ clientSecretEnv: z.ZodOptional<z.ZodString>;
1618
+ /** OS keyring directive — credential lives in macOS Keychain / Linux
1619
+ * Secret Service / Windows Credential Manager. The skill that reads
1620
+ * this integration is responsible for resolving the keyring entry
1621
+ * (typically keyed by agentId+kind). */
1622
+ auth: z.ZodOptional<z.ZodLiteral<"keyring">>;
1623
+ /** File-based session directory (WhatsApp, Telegram MTProto, etc.). */
1624
+ sessionDir: z.ZodOptional<z.ZodString>;
1625
+ }, "strict", z.ZodTypeAny, {
1626
+ tokenEnv?: string | undefined;
1627
+ privateAppTokenEnv?: string | undefined;
1628
+ apiKeyEnv?: string | undefined;
1629
+ refreshTokenEnv?: string | undefined;
1630
+ clientIdEnv?: string | undefined;
1631
+ clientSecretEnv?: string | undefined;
1632
+ auth?: "keyring" | undefined;
1633
+ sessionDir?: string | undefined;
1634
+ }, {
1635
+ tokenEnv?: string | undefined;
1636
+ privateAppTokenEnv?: string | undefined;
1637
+ apiKeyEnv?: string | undefined;
1638
+ refreshTokenEnv?: string | undefined;
1639
+ clientIdEnv?: string | undefined;
1640
+ clientSecretEnv?: string | undefined;
1641
+ auth?: "keyring" | undefined;
1642
+ sessionDir?: string | undefined;
1643
+ }>>;
1644
+ /** Non-secret metadata — username, email, host URL, portal id, JID, etc.
1645
+ * Visible in the dashboard and to skills. */
1646
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
1647
+ /** Operator-set toggle without removing the entry. */
1648
+ enabled: z.ZodDefault<z.ZodBoolean>;
1649
+ }, "strip", z.ZodTypeAny, {
1650
+ enabled: boolean;
1651
+ credentials: {
1652
+ tokenEnv?: string | undefined;
1653
+ privateAppTokenEnv?: string | undefined;
1654
+ apiKeyEnv?: string | undefined;
1655
+ refreshTokenEnv?: string | undefined;
1656
+ clientIdEnv?: string | undefined;
1657
+ clientSecretEnv?: string | undefined;
1658
+ auth?: "keyring" | undefined;
1659
+ sessionDir?: string | undefined;
1660
+ };
1661
+ metadata: Record<string, string | number | boolean>;
1662
+ label: string;
1663
+ kind: string;
1664
+ }, {
1665
+ label: string;
1666
+ kind: string;
1667
+ enabled?: boolean | undefined;
1668
+ credentials?: {
1669
+ tokenEnv?: string | undefined;
1670
+ privateAppTokenEnv?: string | undefined;
1671
+ apiKeyEnv?: string | undefined;
1672
+ refreshTokenEnv?: string | undefined;
1673
+ clientIdEnv?: string | undefined;
1674
+ clientSecretEnv?: string | undefined;
1675
+ auth?: "keyring" | undefined;
1676
+ sessionDir?: string | undefined;
1677
+ } | undefined;
1678
+ metadata?: Record<string, string | number | boolean> | undefined;
1679
+ }>, "many">>;
1419
1680
  }, "strip", z.ZodTypeAny, {
1420
1681
  name: string;
1421
1682
  workspace: string;
1422
- tier: "claude-code" | "sdk" | "orchestrator";
1683
+ tier: "claude-code" | "codex-cli" | "opencode" | "sdk" | "orchestrator";
1423
1684
  mentions: string[];
1424
1685
  intents: string[];
1425
1686
  maxDelegationDepth: number;
1687
+ codegraph: boolean;
1426
1688
  contextReferences: boolean;
1689
+ richMessages: boolean;
1427
1690
  maxConcurrent: number;
1428
1691
  maxExecutionMinutes: number;
1429
1692
  permissionMode: string;
@@ -1437,36 +1700,66 @@ declare const agentConfigSchema: z.ZodObject<{
1437
1700
  intervalMinutes: number;
1438
1701
  };
1439
1702
  access: "private" | "public";
1703
+ integrations: {
1704
+ enabled: boolean;
1705
+ credentials: {
1706
+ tokenEnv?: string | undefined;
1707
+ privateAppTokenEnv?: string | undefined;
1708
+ apiKeyEnv?: string | undefined;
1709
+ refreshTokenEnv?: string | undefined;
1710
+ clientIdEnv?: string | undefined;
1711
+ clientSecretEnv?: string | undefined;
1712
+ auth?: "keyring" | undefined;
1713
+ sessionDir?: string | undefined;
1714
+ };
1715
+ metadata: Record<string, string | number | boolean>;
1716
+ label: string;
1717
+ kind: string;
1718
+ }[];
1440
1719
  provider?: string | undefined;
1441
1720
  model?: string | undefined;
1442
1721
  systemPrompt?: string | undefined;
1443
1722
  mcp?: Record<string, {
1444
1723
  command: string;
1445
1724
  args: string[];
1725
+ type?: "stdio" | undefined;
1446
1726
  env?: Record<string, string> | undefined;
1727
+ } | {
1728
+ type: "http";
1729
+ url: string;
1730
+ headers?: Record<string, string> | undefined;
1447
1731
  }> | undefined;
1448
1732
  contextStrategy?: "layered" | "planner" | undefined;
1733
+ gitlabAutoReply?: boolean | undefined;
1449
1734
  }, {
1450
1735
  name: string;
1451
1736
  workspace: string;
1452
1737
  provider?: string | undefined;
1453
1738
  model?: string | undefined;
1454
- tier?: "claude-code" | "sdk" | "orchestrator" | undefined;
1739
+ tier?: "claude-code" | "codex-cli" | "opencode" | "sdk" | "orchestrator" | undefined;
1455
1740
  systemPrompt?: string | undefined;
1456
1741
  mentions?: string[] | undefined;
1457
1742
  intents?: string[] | undefined;
1458
1743
  maxDelegationDepth?: number | undefined;
1459
1744
  mcp?: Record<string, {
1460
1745
  command: string;
1746
+ type?: "stdio" | undefined;
1461
1747
  env?: Record<string, string> | undefined;
1462
1748
  args?: string[] | undefined;
1749
+ } | {
1750
+ type: "http";
1751
+ url: string;
1752
+ headers?: Record<string, string> | undefined;
1463
1753
  }> | undefined;
1754
+ codegraph?: boolean | undefined;
1464
1755
  contextStrategy?: "layered" | "planner" | undefined;
1465
1756
  contextReferences?: boolean | undefined;
1757
+ richMessages?: boolean | undefined;
1466
1758
  maxConcurrent?: number | undefined;
1467
1759
  maxExecutionMinutes?: number | undefined;
1468
1760
  permissionMode?: string | undefined;
1469
1761
  toolUseRequired?: string[] | undefined;
1762
+ gitlabAutoReply?: boolean | undefined;
1470
1763
  persistentProcess?: boolean | undefined;
1471
1764
  queueMode?: "collect" | "followup" | "drop" | undefined;
1472
1765
  heartbeat?: {
@@ -1476,6 +1769,22 @@ declare const agentConfigSchema: z.ZodObject<{
1476
1769
  intervalMinutes?: number | undefined;
1477
1770
  } | undefined;
1478
1771
  access?: "private" | "public" | undefined;
1772
+ integrations?: {
1773
+ label: string;
1774
+ kind: string;
1775
+ enabled?: boolean | undefined;
1776
+ credentials?: {
1777
+ tokenEnv?: string | undefined;
1778
+ privateAppTokenEnv?: string | undefined;
1779
+ apiKeyEnv?: string | undefined;
1780
+ refreshTokenEnv?: string | undefined;
1781
+ clientIdEnv?: string | undefined;
1782
+ clientSecretEnv?: string | undefined;
1783
+ auth?: "keyring" | undefined;
1784
+ sessionDir?: string | undefined;
1785
+ } | undefined;
1786
+ metadata?: Record<string, string | number | boolean> | undefined;
1787
+ }[] | undefined;
1479
1788
  }>;
1480
1789
  declare const cronJobSchema: z.ZodObject<{
1481
1790
  enabled: z.ZodDefault<z.ZodBoolean>;
@@ -1569,19 +1878,28 @@ declare const daemonConfigSchema: z.ZodObject<{
1569
1878
  apiKey: z.ZodOptional<z.ZodString>;
1570
1879
  defaultModel: z.ZodOptional<z.ZodString>;
1571
1880
  baseUrl: z.ZodOptional<z.ZodString>;
1881
+ /** Toggle thinking-mode output on backends that support it (DeepSeek
1882
+ * V4 `reasoning_content`). When `true` (the DeepSeek default), the
1883
+ * agent streams its reasoning live in the dashboard task modal and
1884
+ * the agentic round-trip echoes it back on the next iteration. Set
1885
+ * to `false` to disable for cost/latency-sensitive agents. Ignored
1886
+ * on backends that don't speak the thinking-mode protocol. */
1887
+ thinking: z.ZodOptional<z.ZodBoolean>;
1572
1888
  }, "strip", z.ZodTypeAny, {
1573
1889
  apiKey?: string | undefined;
1890
+ thinking?: boolean | undefined;
1574
1891
  defaultModel?: string | undefined;
1575
1892
  baseUrl?: string | undefined;
1576
1893
  }, {
1577
1894
  apiKey?: string | undefined;
1895
+ thinking?: boolean | undefined;
1578
1896
  defaultModel?: string | undefined;
1579
1897
  baseUrl?: string | undefined;
1580
1898
  }>>>;
1581
1899
  agents: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
1582
1900
  name: z.ZodString;
1583
1901
  workspace: z.ZodString;
1584
- tier: z.ZodDefault<z.ZodEnum<["claude-code", "sdk", "orchestrator"]>>;
1902
+ tier: z.ZodDefault<z.ZodEnum<["claude-code", "codex-cli", "opencode", "sdk", "orchestrator"]>>;
1585
1903
  provider: z.ZodOptional<z.ZodString>;
1586
1904
  model: z.ZodOptional<z.ZodString>;
1587
1905
  systemPrompt: z.ZodOptional<z.ZodString>;
@@ -1608,19 +1926,44 @@ declare const daemonConfigSchema: z.ZodObject<{
1608
1926
  /** MCP servers this agent's Claude Code session should load. Synced
1609
1927
  * to <workspace>/.mcp.json at daemon boot via agent-mcp.ts. Operator
1610
1928
  * edits to .mcp.json are respected (see SyncResult.skipped-operator-owned). */
1611
- mcp: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1929
+ mcp: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
1930
+ type: z.ZodLiteral<"http">;
1931
+ url: z.ZodString;
1932
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1933
+ }, "strip", z.ZodTypeAny, {
1934
+ type: "http";
1935
+ url: string;
1936
+ headers?: Record<string, string> | undefined;
1937
+ }, {
1938
+ type: "http";
1939
+ url: string;
1940
+ headers?: Record<string, string> | undefined;
1941
+ }>, z.ZodObject<{
1942
+ type: z.ZodOptional<z.ZodLiteral<"stdio">>;
1612
1943
  command: z.ZodString;
1613
1944
  args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1614
1945
  env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1615
1946
  }, "strip", z.ZodTypeAny, {
1616
1947
  command: string;
1617
1948
  args: string[];
1949
+ type?: "stdio" | undefined;
1618
1950
  env?: Record<string, string> | undefined;
1619
1951
  }, {
1620
1952
  command: string;
1953
+ type?: "stdio" | undefined;
1621
1954
  env?: Record<string, string> | undefined;
1622
1955
  args?: string[] | undefined;
1623
- }>>>;
1956
+ }>]>>>;
1957
+ /** Enable CodeGraph (https://github.com/colbymchenry/codegraph) for this
1958
+ * agent's claude-code or codex-cli workspace. When true, agentx (a) adds
1959
+ * a codegraph MCP server to <workspace>/.mcp.json, (b) extends
1960
+ * .claude/settings.json permissions.allow with the codegraph_* tools,
1961
+ * (c) appends a CodeGraph instruction section to the managed CLAUDE.md,
1962
+ * and (d) background-indexes the workspace at daemon boot if .codegraph/
1963
+ * is missing. Off by default — flip on for coding agents (mtgl-v2-coder,
1964
+ * ksi-v2-coder, hasanah-coding, etc.) where token-volume on exploration
1965
+ * loops is the bottleneck. */
1966
+ codegraph: z.ZodDefault<z.ZodBoolean>;
1624
1967
  /** Per-agent override for the global `session.contextStrategy`. Lets
1625
1968
  * one agent run `planner` (smaller upfront context, more tool-driven
1626
1969
  * exploration) while siblings stay on `layered`. Used for agents that
@@ -1632,6 +1975,10 @@ declare const daemonConfigSchema: z.ZodObject<{
1632
1975
  * etc.) once a `references/` registry exists in the agent's workspace
1633
1976
  * or repo root. See src/agents/references/. */
1634
1977
  contextReferences: z.ZodDefault<z.ZodBoolean>;
1978
+ /** Whether this agent may emit in-band `agentx:ui` rich-message directives
1979
+ * (buttons/polls/media) on chat channels. Default true — set false to make
1980
+ * the render layer strip any directive and send plain text only. */
1981
+ richMessages: z.ZodDefault<z.ZodBoolean>;
1635
1982
  maxConcurrent: z.ZodDefault<z.ZodNumber>;
1636
1983
  /** Hard wall-clock cap on a single Claude Code invocation. Exceeding the
1637
1984
  * cap sends SIGTERM (exit 143). Default 20 min — bump for devops/coder
@@ -1653,6 +2000,14 @@ declare const daemonConfigSchema: z.ZodObject<{
1653
2000
  * without a schema bump. Empty/unset means no enforcement
1654
2001
  * (default — backward compatible). */
1655
2002
  toolUseRequired: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
2003
+ /** Per-agent override for the channel-level `autoReplyLegacy` on
2004
+ * gitlab/github. When set, it wins over `channels.<name>.autoReplyLegacy`
2005
+ * for this agent's replies: `true` makes the daemon auto-post the agent's
2006
+ * final text as a comment (right for coder agents that end their turn with
2007
+ * a summary and don't call `agentx_channel_reply`); `false` suppresses it
2008
+ * (right for chatty agents whose reasoning shouldn't land as a comment).
2009
+ * Unset → fall back to the channel default. */
2010
+ gitlabAutoReply: z.ZodOptional<z.ZodBoolean>;
1656
2011
  /** When true, this agent's claude-code dispatches reuse a long-lived
1657
2012
  * subprocess per (channel, chatId) instead of spawning a fresh
1658
2013
  * `claude -p` per turn. Driven over stdin via stream-json input,
@@ -1688,14 +2043,98 @@ declare const daemonConfigSchema: z.ZodObject<{
1688
2043
  * - "public": external apps can POST /api/public/agents/<id>/messages
1689
2044
  * with a scoped token (agent:<id> or agent:*). */
1690
2045
  access: z.ZodDefault<z.ZodEnum<["private", "public"]>>;
2046
+ /** Per-agent third-party integrations registry. Declares which services
2047
+ * this agent has credentials for (telegram-bot, hubspot, gitlab-user,
2048
+ * gmail, etc.). Secrets stay in env vars / keyring; this block holds
2049
+ * declarations + non-secret metadata only. Skills and channel adapters
2050
+ * read from here to know what the agent can use. See INTEGRATION_KINDS. */
2051
+ integrations: z.ZodDefault<z.ZodArray<z.ZodObject<{
2052
+ /** Service identifier — open string, well-known values in INTEGRATION_KINDS. */
2053
+ kind: z.ZodString;
2054
+ /** Human-readable label (e.g. "@cx_bot", "Noqta CRM", "anis@noqta.tn"). Unique per (agent, kind). */
2055
+ label: z.ZodString;
2056
+ credentials: z.ZodDefault<z.ZodObject<{
2057
+ /** Env var holding the secret. Uppercase identifier; daemon resolves at use-time. */
2058
+ tokenEnv: z.ZodOptional<z.ZodString>;
2059
+ /** Alternate env-var keys for credential schemes that need >1 secret
2060
+ * (e.g. HubSpot private app + portal id, OAuth refresh tokens). */
2061
+ privateAppTokenEnv: z.ZodOptional<z.ZodString>;
2062
+ apiKeyEnv: z.ZodOptional<z.ZodString>;
2063
+ refreshTokenEnv: z.ZodOptional<z.ZodString>;
2064
+ clientIdEnv: z.ZodOptional<z.ZodString>;
2065
+ clientSecretEnv: z.ZodOptional<z.ZodString>;
2066
+ /** OS keyring directive — credential lives in macOS Keychain / Linux
2067
+ * Secret Service / Windows Credential Manager. The skill that reads
2068
+ * this integration is responsible for resolving the keyring entry
2069
+ * (typically keyed by agentId+kind). */
2070
+ auth: z.ZodOptional<z.ZodLiteral<"keyring">>;
2071
+ /** File-based session directory (WhatsApp, Telegram MTProto, etc.). */
2072
+ sessionDir: z.ZodOptional<z.ZodString>;
2073
+ }, "strict", z.ZodTypeAny, {
2074
+ tokenEnv?: string | undefined;
2075
+ privateAppTokenEnv?: string | undefined;
2076
+ apiKeyEnv?: string | undefined;
2077
+ refreshTokenEnv?: string | undefined;
2078
+ clientIdEnv?: string | undefined;
2079
+ clientSecretEnv?: string | undefined;
2080
+ auth?: "keyring" | undefined;
2081
+ sessionDir?: string | undefined;
2082
+ }, {
2083
+ tokenEnv?: string | undefined;
2084
+ privateAppTokenEnv?: string | undefined;
2085
+ apiKeyEnv?: string | undefined;
2086
+ refreshTokenEnv?: string | undefined;
2087
+ clientIdEnv?: string | undefined;
2088
+ clientSecretEnv?: string | undefined;
2089
+ auth?: "keyring" | undefined;
2090
+ sessionDir?: string | undefined;
2091
+ }>>;
2092
+ /** Non-secret metadata — username, email, host URL, portal id, JID, etc.
2093
+ * Visible in the dashboard and to skills. */
2094
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
2095
+ /** Operator-set toggle without removing the entry. */
2096
+ enabled: z.ZodDefault<z.ZodBoolean>;
2097
+ }, "strip", z.ZodTypeAny, {
2098
+ enabled: boolean;
2099
+ credentials: {
2100
+ tokenEnv?: string | undefined;
2101
+ privateAppTokenEnv?: string | undefined;
2102
+ apiKeyEnv?: string | undefined;
2103
+ refreshTokenEnv?: string | undefined;
2104
+ clientIdEnv?: string | undefined;
2105
+ clientSecretEnv?: string | undefined;
2106
+ auth?: "keyring" | undefined;
2107
+ sessionDir?: string | undefined;
2108
+ };
2109
+ metadata: Record<string, string | number | boolean>;
2110
+ label: string;
2111
+ kind: string;
2112
+ }, {
2113
+ label: string;
2114
+ kind: string;
2115
+ enabled?: boolean | undefined;
2116
+ credentials?: {
2117
+ tokenEnv?: string | undefined;
2118
+ privateAppTokenEnv?: string | undefined;
2119
+ apiKeyEnv?: string | undefined;
2120
+ refreshTokenEnv?: string | undefined;
2121
+ clientIdEnv?: string | undefined;
2122
+ clientSecretEnv?: string | undefined;
2123
+ auth?: "keyring" | undefined;
2124
+ sessionDir?: string | undefined;
2125
+ } | undefined;
2126
+ metadata?: Record<string, string | number | boolean> | undefined;
2127
+ }>, "many">>;
1691
2128
  }, "strip", z.ZodTypeAny, {
1692
2129
  name: string;
1693
2130
  workspace: string;
1694
- tier: "claude-code" | "sdk" | "orchestrator";
2131
+ tier: "claude-code" | "codex-cli" | "opencode" | "sdk" | "orchestrator";
1695
2132
  mentions: string[];
1696
2133
  intents: string[];
1697
2134
  maxDelegationDepth: number;
2135
+ codegraph: boolean;
1698
2136
  contextReferences: boolean;
2137
+ richMessages: boolean;
1699
2138
  maxConcurrent: number;
1700
2139
  maxExecutionMinutes: number;
1701
2140
  permissionMode: string;
@@ -1709,36 +2148,66 @@ declare const daemonConfigSchema: z.ZodObject<{
1709
2148
  intervalMinutes: number;
1710
2149
  };
1711
2150
  access: "private" | "public";
2151
+ integrations: {
2152
+ enabled: boolean;
2153
+ credentials: {
2154
+ tokenEnv?: string | undefined;
2155
+ privateAppTokenEnv?: string | undefined;
2156
+ apiKeyEnv?: string | undefined;
2157
+ refreshTokenEnv?: string | undefined;
2158
+ clientIdEnv?: string | undefined;
2159
+ clientSecretEnv?: string | undefined;
2160
+ auth?: "keyring" | undefined;
2161
+ sessionDir?: string | undefined;
2162
+ };
2163
+ metadata: Record<string, string | number | boolean>;
2164
+ label: string;
2165
+ kind: string;
2166
+ }[];
1712
2167
  provider?: string | undefined;
1713
2168
  model?: string | undefined;
1714
2169
  systemPrompt?: string | undefined;
1715
2170
  mcp?: Record<string, {
1716
2171
  command: string;
1717
2172
  args: string[];
2173
+ type?: "stdio" | undefined;
1718
2174
  env?: Record<string, string> | undefined;
2175
+ } | {
2176
+ type: "http";
2177
+ url: string;
2178
+ headers?: Record<string, string> | undefined;
1719
2179
  }> | undefined;
1720
2180
  contextStrategy?: "layered" | "planner" | undefined;
2181
+ gitlabAutoReply?: boolean | undefined;
1721
2182
  }, {
1722
2183
  name: string;
1723
2184
  workspace: string;
1724
2185
  provider?: string | undefined;
1725
2186
  model?: string | undefined;
1726
- tier?: "claude-code" | "sdk" | "orchestrator" | undefined;
2187
+ tier?: "claude-code" | "codex-cli" | "opencode" | "sdk" | "orchestrator" | undefined;
1727
2188
  systemPrompt?: string | undefined;
1728
2189
  mentions?: string[] | undefined;
1729
2190
  intents?: string[] | undefined;
1730
2191
  maxDelegationDepth?: number | undefined;
1731
2192
  mcp?: Record<string, {
1732
2193
  command: string;
2194
+ type?: "stdio" | undefined;
1733
2195
  env?: Record<string, string> | undefined;
1734
2196
  args?: string[] | undefined;
2197
+ } | {
2198
+ type: "http";
2199
+ url: string;
2200
+ headers?: Record<string, string> | undefined;
1735
2201
  }> | undefined;
2202
+ codegraph?: boolean | undefined;
1736
2203
  contextStrategy?: "layered" | "planner" | undefined;
1737
2204
  contextReferences?: boolean | undefined;
2205
+ richMessages?: boolean | undefined;
1738
2206
  maxConcurrent?: number | undefined;
1739
2207
  maxExecutionMinutes?: number | undefined;
1740
2208
  permissionMode?: string | undefined;
1741
2209
  toolUseRequired?: string[] | undefined;
2210
+ gitlabAutoReply?: boolean | undefined;
1742
2211
  persistentProcess?: boolean | undefined;
1743
2212
  queueMode?: "collect" | "followup" | "drop" | undefined;
1744
2213
  heartbeat?: {
@@ -1748,6 +2217,22 @@ declare const daemonConfigSchema: z.ZodObject<{
1748
2217
  intervalMinutes?: number | undefined;
1749
2218
  } | undefined;
1750
2219
  access?: "private" | "public" | undefined;
2220
+ integrations?: {
2221
+ label: string;
2222
+ kind: string;
2223
+ enabled?: boolean | undefined;
2224
+ credentials?: {
2225
+ tokenEnv?: string | undefined;
2226
+ privateAppTokenEnv?: string | undefined;
2227
+ apiKeyEnv?: string | undefined;
2228
+ refreshTokenEnv?: string | undefined;
2229
+ clientIdEnv?: string | undefined;
2230
+ clientSecretEnv?: string | undefined;
2231
+ auth?: "keyring" | undefined;
2232
+ sessionDir?: string | undefined;
2233
+ } | undefined;
2234
+ metadata?: Record<string, string | number | boolean> | undefined;
2235
+ }[] | undefined;
1751
2236
  }>>>;
1752
2237
  channels: z.ZodDefault<z.ZodObject<{
1753
2238
  telegram: z.ZodDefault<z.ZodObject<{
@@ -1943,8 +2428,8 @@ declare const daemonConfigSchema: z.ZodObject<{
1943
2428
  defaultAgent?: string | undefined;
1944
2429
  }, {
1945
2430
  enabled?: boolean | undefined;
1946
- allowFrom?: string[] | undefined;
1947
2431
  sessionDir?: string | undefined;
2432
+ allowFrom?: string[] | undefined;
1948
2433
  defaultAgent?: string | undefined;
1949
2434
  routes?: {
1950
2435
  agent: string;
@@ -1969,43 +2454,19 @@ declare const daemonConfigSchema: z.ZodObject<{
1969
2454
  retentionDays?: number | undefined;
1970
2455
  } | undefined;
1971
2456
  }>>;
1972
- discord: z.ZodDefault<z.ZodObject<{
1973
- enabled: z.ZodDefault<z.ZodBoolean>;
1974
- token: z.ZodOptional<z.ZodString>;
1975
- agentBinding: z.ZodOptional<z.ZodString>;
1976
- }, "strip", z.ZodTypeAny, {
1977
- enabled: boolean;
1978
- token?: string | undefined;
1979
- agentBinding?: string | undefined;
1980
- }, {
1981
- enabled?: boolean | undefined;
1982
- token?: string | undefined;
1983
- agentBinding?: string | undefined;
1984
- }>>;
1985
- slack: z.ZodDefault<z.ZodObject<{
1986
- enabled: z.ZodDefault<z.ZodBoolean>;
1987
- /** xoxb-... — bot user OAuth token from the Slack app's "OAuth & Permissions" tab. */
1988
- botToken: z.ZodOptional<z.ZodString>;
1989
- /** xapp-... — app-level token with connections:write scope (for Socket Mode). */
1990
- appToken: z.ZodOptional<z.ZodString>;
1991
- agentBinding: z.ZodOptional<z.ZodString>;
1992
- }, "strip", z.ZodTypeAny, {
1993
- enabled: boolean;
1994
- agentBinding?: string | undefined;
1995
- botToken?: string | undefined;
1996
- appToken?: string | undefined;
1997
- }, {
1998
- enabled?: boolean | undefined;
1999
- agentBinding?: string | undefined;
2000
- botToken?: string | undefined;
2001
- appToken?: string | undefined;
2002
- }>>;
2003
2457
  gitlab: z.ZodDefault<z.ZodObject<{
2004
2458
  enabled: z.ZodDefault<z.ZodBoolean>;
2005
2459
  webhookPort: z.ZodDefault<z.ZodNumber>;
2006
2460
  webhookSecret: z.ZodOptional<z.ZodString>;
2007
2461
  host: z.ZodDefault<z.ZodString>;
2008
2462
  token: z.ZodOptional<z.ZodString>;
2463
+ /** Legacy auto-reply: when true (default), the router posts the agent's
2464
+ * `response.content` as a comment automatically. When false, the agent
2465
+ * must call the `channel.reply` action explicitly to reply — agent
2466
+ * reasoning text is logged but not posted. Flip to false once the
2467
+ * project's agents have migrated their gitlab skill to use channel.reply.
2468
+ * Default true preserves today's behaviour for unmigrated projects. */
2469
+ autoReplyLegacy: z.ZodDefault<z.ZodBoolean>;
2009
2470
  routes: z.ZodDefault<z.ZodArray<z.ZodObject<{
2010
2471
  project: z.ZodString;
2011
2472
  agent: z.ZodString;
@@ -2047,6 +2508,7 @@ declare const daemonConfigSchema: z.ZodObject<{
2047
2508
  }[];
2048
2509
  webhookPort: number;
2049
2510
  host: string;
2511
+ autoReplyLegacy: boolean;
2050
2512
  agentMappings: {
2051
2513
  agentId: string;
2052
2514
  gitlabUsernames: string[];
@@ -2066,6 +2528,7 @@ declare const daemonConfigSchema: z.ZodObject<{
2066
2528
  webhookPort?: number | undefined;
2067
2529
  webhookSecret?: string | undefined;
2068
2530
  host?: string | undefined;
2531
+ autoReplyLegacy?: boolean | undefined;
2069
2532
  agentMappings?: {
2070
2533
  agentId: string;
2071
2534
  token?: string | undefined;
@@ -2076,6 +2539,9 @@ declare const daemonConfigSchema: z.ZodObject<{
2076
2539
  }>>;
2077
2540
  github: z.ZodDefault<z.ZodObject<{
2078
2541
  enabled: z.ZodDefault<z.ZodBoolean>;
2542
+ /** Legacy auto-reply — same semantics as gitlab.autoReplyLegacy.
2543
+ * Defaults true; set false once agent skills use channel.reply. */
2544
+ autoReplyLegacy: z.ZodDefault<z.ZodBoolean>;
2079
2545
  /** GitHub PAT or env var (${GITHUB_TOKEN}) for posting comments back. */
2080
2546
  token: z.ZodOptional<z.ZodString>;
2081
2547
  /** Path to file containing the token (first line read at startup). */
@@ -2125,6 +2591,7 @@ declare const daemonConfigSchema: z.ZodObject<{
2125
2591
  agent: string;
2126
2592
  repo: string;
2127
2593
  }[];
2594
+ autoReplyLegacy: boolean;
2128
2595
  agentMappings: {
2129
2596
  agentId: string;
2130
2597
  githubUsernames: string[];
@@ -2146,6 +2613,7 @@ declare const daemonConfigSchema: z.ZodObject<{
2146
2613
  repo: string;
2147
2614
  }[] | undefined;
2148
2615
  webhookSecret?: string | undefined;
2616
+ autoReplyLegacy?: boolean | undefined;
2149
2617
  agentMappings?: {
2150
2618
  agentId: string;
2151
2619
  token?: string | undefined;
@@ -2324,6 +2792,7 @@ declare const daemonConfigSchema: z.ZodObject<{
2324
2792
  }[];
2325
2793
  webhookPort: number;
2326
2794
  host: string;
2795
+ autoReplyLegacy: boolean;
2327
2796
  agentMappings: {
2328
2797
  agentId: string;
2329
2798
  gitlabUsernames: string[];
@@ -2334,20 +2803,6 @@ declare const daemonConfigSchema: z.ZodObject<{
2334
2803
  token?: string | undefined;
2335
2804
  webhookSecret?: string | undefined;
2336
2805
  };
2337
- telegram: {
2338
- enabled: boolean;
2339
- accounts: Record<string, {
2340
- token: string;
2341
- agentBinding: string;
2342
- pollInbound: boolean;
2343
- allowFrom?: string[] | undefined;
2344
- }>;
2345
- policy: {
2346
- dm: "block" | "pair";
2347
- group: "all" | "mention-required";
2348
- allowFrom?: string[] | undefined;
2349
- };
2350
- };
2351
2806
  whatsapp: {
2352
2807
  enabled: boolean;
2353
2808
  sessionDir: string;
@@ -2376,16 +2831,19 @@ declare const daemonConfigSchema: z.ZodObject<{
2376
2831
  allowFrom?: string[] | undefined;
2377
2832
  defaultAgent?: string | undefined;
2378
2833
  };
2379
- discord: {
2380
- enabled: boolean;
2381
- token?: string | undefined;
2382
- agentBinding?: string | undefined;
2383
- };
2384
- slack: {
2834
+ telegram: {
2385
2835
  enabled: boolean;
2386
- agentBinding?: string | undefined;
2387
- botToken?: string | undefined;
2388
- appToken?: string | undefined;
2836
+ accounts: Record<string, {
2837
+ token: string;
2838
+ agentBinding: string;
2839
+ pollInbound: boolean;
2840
+ allowFrom?: string[] | undefined;
2841
+ }>;
2842
+ policy: {
2843
+ dm: "block" | "pair";
2844
+ group: "all" | "mention-required";
2845
+ allowFrom?: string[] | undefined;
2846
+ };
2389
2847
  };
2390
2848
  github: {
2391
2849
  enabled: boolean;
@@ -2393,6 +2851,7 @@ declare const daemonConfigSchema: z.ZodObject<{
2393
2851
  agent: string;
2394
2852
  repo: string;
2395
2853
  }[];
2854
+ autoReplyLegacy: boolean;
2396
2855
  agentMappings: {
2397
2856
  agentId: string;
2398
2857
  githubUsernames: string[];
@@ -2448,6 +2907,7 @@ declare const daemonConfigSchema: z.ZodObject<{
2448
2907
  webhookPort?: number | undefined;
2449
2908
  webhookSecret?: string | undefined;
2450
2909
  host?: string | undefined;
2910
+ autoReplyLegacy?: boolean | undefined;
2451
2911
  agentMappings?: {
2452
2912
  agentId: string;
2453
2913
  token?: string | undefined;
@@ -2456,24 +2916,10 @@ declare const daemonConfigSchema: z.ZodObject<{
2456
2916
  node?: string | undefined;
2457
2917
  }[] | undefined;
2458
2918
  } | undefined;
2459
- telegram?: {
2460
- enabled?: boolean | undefined;
2461
- accounts?: Record<string, {
2462
- token: string;
2463
- agentBinding: string;
2464
- allowFrom?: string[] | undefined;
2465
- pollInbound?: boolean | undefined;
2466
- }> | undefined;
2467
- policy?: {
2468
- allowFrom?: string[] | undefined;
2469
- dm?: "block" | "pair" | undefined;
2470
- group?: "all" | "mention-required" | undefined;
2471
- } | undefined;
2472
- } | undefined;
2473
2919
  whatsapp?: {
2474
2920
  enabled?: boolean | undefined;
2475
- allowFrom?: string[] | undefined;
2476
2921
  sessionDir?: string | undefined;
2922
+ allowFrom?: string[] | undefined;
2477
2923
  defaultAgent?: string | undefined;
2478
2924
  routes?: {
2479
2925
  agent: string;
@@ -2498,16 +2944,19 @@ declare const daemonConfigSchema: z.ZodObject<{
2498
2944
  retentionDays?: number | undefined;
2499
2945
  } | undefined;
2500
2946
  } | undefined;
2501
- discord?: {
2502
- enabled?: boolean | undefined;
2503
- token?: string | undefined;
2504
- agentBinding?: string | undefined;
2505
- } | undefined;
2506
- slack?: {
2947
+ telegram?: {
2507
2948
  enabled?: boolean | undefined;
2508
- agentBinding?: string | undefined;
2509
- botToken?: string | undefined;
2510
- appToken?: string | undefined;
2949
+ accounts?: Record<string, {
2950
+ token: string;
2951
+ agentBinding: string;
2952
+ allowFrom?: string[] | undefined;
2953
+ pollInbound?: boolean | undefined;
2954
+ }> | undefined;
2955
+ policy?: {
2956
+ allowFrom?: string[] | undefined;
2957
+ dm?: "block" | "pair" | undefined;
2958
+ group?: "all" | "mention-required" | undefined;
2959
+ } | undefined;
2511
2960
  } | undefined;
2512
2961
  github?: {
2513
2962
  enabled?: boolean | undefined;
@@ -2517,6 +2966,7 @@ declare const daemonConfigSchema: z.ZodObject<{
2517
2966
  repo: string;
2518
2967
  }[] | undefined;
2519
2968
  webhookSecret?: string | undefined;
2969
+ autoReplyLegacy?: boolean | undefined;
2520
2970
  agentMappings?: {
2521
2971
  agentId: string;
2522
2972
  token?: string | undefined;
@@ -3129,7 +3579,7 @@ declare const daemonConfigSchema: z.ZodObject<{
3129
3579
  }, "strip", z.ZodTypeAny, {
3130
3580
  id: string;
3131
3581
  title: string;
3132
- kind: "open-backlog" | "scoped-label" | "closed" | "label";
3582
+ kind: "label" | "open-backlog" | "scoped-label" | "closed";
3133
3583
  scopedPrefix: string;
3134
3584
  mapsToLabel?: string | undefined;
3135
3585
  scopedLabel?: string | undefined;
@@ -3137,7 +3587,7 @@ declare const daemonConfigSchema: z.ZodObject<{
3137
3587
  }, {
3138
3588
  id: string;
3139
3589
  title: string;
3140
- kind?: "open-backlog" | "scoped-label" | "closed" | "label" | undefined;
3590
+ kind?: "label" | "open-backlog" | "scoped-label" | "closed" | undefined;
3141
3591
  mapsToLabel?: string | undefined;
3142
3592
  scopedLabel?: string | undefined;
3143
3593
  scopedPrefix?: string | undefined;
@@ -3179,7 +3629,7 @@ declare const daemonConfigSchema: z.ZodObject<{
3179
3629
  columns: {
3180
3630
  id: string;
3181
3631
  title: string;
3182
- kind: "open-backlog" | "scoped-label" | "closed" | "label";
3632
+ kind: "label" | "open-backlog" | "scoped-label" | "closed";
3183
3633
  scopedPrefix: string;
3184
3634
  mapsToLabel?: string | undefined;
3185
3635
  scopedLabel?: string | undefined;
@@ -3211,7 +3661,7 @@ declare const daemonConfigSchema: z.ZodObject<{
3211
3661
  columns?: {
3212
3662
  id: string;
3213
3663
  title: string;
3214
- kind?: "open-backlog" | "scoped-label" | "closed" | "label" | undefined;
3664
+ kind?: "label" | "open-backlog" | "scoped-label" | "closed" | undefined;
3215
3665
  mapsToLabel?: string | undefined;
3216
3666
  scopedLabel?: string | undefined;
3217
3667
  scopedPrefix?: string | undefined;
@@ -3359,6 +3809,22 @@ declare const daemonConfigSchema: z.ZodObject<{
3359
3809
  workflows: z.ZodDefault<z.ZodObject<{
3360
3810
  enabled: z.ZodDefault<z.ZodBoolean>;
3361
3811
  dir: z.ZodDefault<z.ZodString>;
3812
+ matching: z.ZodDefault<z.ZodObject<{
3813
+ enabled: z.ZodDefault<z.ZodBoolean>;
3814
+ mode: z.ZodDefault<z.ZodEnum<["suggest", "auto"]>>;
3815
+ autoRunThreshold: z.ZodDefault<z.ZodNumber>;
3816
+ suggestThreshold: z.ZodDefault<z.ZodNumber>;
3817
+ }, "strip", z.ZodTypeAny, {
3818
+ enabled: boolean;
3819
+ mode: "auto" | "suggest";
3820
+ autoRunThreshold: number;
3821
+ suggestThreshold: number;
3822
+ }, {
3823
+ enabled?: boolean | undefined;
3824
+ mode?: "auto" | "suggest" | undefined;
3825
+ autoRunThreshold?: number | undefined;
3826
+ suggestThreshold?: number | undefined;
3827
+ }>>;
3362
3828
  /** Controls whether the dashboard exposes the visual editor. "readonly"
3363
3829
  * serves the list + run timelines but strips write controls from the
3364
3830
  * page. "disabled" hides the tab entirely. */
@@ -3366,18 +3832,108 @@ declare const daemonConfigSchema: z.ZodObject<{
3366
3832
  }, "strip", z.ZodTypeAny, {
3367
3833
  dir: string;
3368
3834
  enabled: boolean;
3835
+ matching: {
3836
+ enabled: boolean;
3837
+ mode: "auto" | "suggest";
3838
+ autoRunThreshold: number;
3839
+ suggestThreshold: number;
3840
+ };
3369
3841
  editor: "disabled" | "readonly" | "edit";
3370
3842
  }, {
3371
3843
  dir?: string | undefined;
3372
3844
  enabled?: boolean | undefined;
3845
+ matching?: {
3846
+ enabled?: boolean | undefined;
3847
+ mode?: "auto" | "suggest" | undefined;
3848
+ autoRunThreshold?: number | undefined;
3849
+ suggestThreshold?: number | undefined;
3850
+ } | undefined;
3373
3851
  editor?: "disabled" | "readonly" | "edit" | undefined;
3374
3852
  }>>;
3853
+ /** Procedures — user-perspective SOPs mined from recurring activity.
3854
+ * The extraction cadence itself lives in `crons.procedure-extract`
3855
+ * (written by `agentx procedure watch`); this block holds the miner's
3856
+ * thresholds and the injection gates the daemon reads. */
3857
+ procedures: z.ZodDefault<z.ZodObject<{
3858
+ enabled: z.ZodDefault<z.ZodBoolean>;
3859
+ dir: z.ZodDefault<z.ZodString>;
3860
+ extraction: z.ZodDefault<z.ZodObject<{
3861
+ enabled: z.ZodDefault<z.ZodBoolean>;
3862
+ /** Count patterns live after each completed task (no LLM cost). */
3863
+ onTaskCompletion: z.ZodDefault<z.ZodBoolean>;
3864
+ minOccurrences: z.ZodDefault<z.ZodNumber>;
3865
+ sinceDays: z.ZodDefault<z.ZodNumber>;
3866
+ maxClusters: z.ZodDefault<z.ZodNumber>;
3867
+ /** Agent whose session distills drafts (LLM path). */
3868
+ via: z.ZodOptional<z.ZodString>;
3869
+ }, "strip", z.ZodTypeAny, {
3870
+ enabled: boolean;
3871
+ onTaskCompletion: boolean;
3872
+ minOccurrences: number;
3873
+ sinceDays: number;
3874
+ maxClusters: number;
3875
+ via?: string | undefined;
3876
+ }, {
3877
+ enabled?: boolean | undefined;
3878
+ onTaskCompletion?: boolean | undefined;
3879
+ minOccurrences?: number | undefined;
3880
+ sinceDays?: number | undefined;
3881
+ maxClusters?: number | undefined;
3882
+ via?: string | undefined;
3883
+ }>>;
3884
+ /** Inject matching procedures into fresh agent sessions as guidance. */
3885
+ injection: z.ZodDefault<z.ZodObject<{
3886
+ enabled: z.ZodDefault<z.ZodBoolean>;
3887
+ maxProcedures: z.ZodDefault<z.ZodNumber>;
3888
+ minScore: z.ZodDefault<z.ZodNumber>;
3889
+ }, "strip", z.ZodTypeAny, {
3890
+ enabled: boolean;
3891
+ maxProcedures: number;
3892
+ minScore: number;
3893
+ }, {
3894
+ enabled?: boolean | undefined;
3895
+ maxProcedures?: number | undefined;
3896
+ minScore?: number | undefined;
3897
+ }>>;
3898
+ }, "strip", z.ZodTypeAny, {
3899
+ dir: string;
3900
+ enabled: boolean;
3901
+ extraction: {
3902
+ enabled: boolean;
3903
+ onTaskCompletion: boolean;
3904
+ minOccurrences: number;
3905
+ sinceDays: number;
3906
+ maxClusters: number;
3907
+ via?: string | undefined;
3908
+ };
3909
+ injection: {
3910
+ enabled: boolean;
3911
+ maxProcedures: number;
3912
+ minScore: number;
3913
+ };
3914
+ }, {
3915
+ dir?: string | undefined;
3916
+ enabled?: boolean | undefined;
3917
+ extraction?: {
3918
+ enabled?: boolean | undefined;
3919
+ onTaskCompletion?: boolean | undefined;
3920
+ minOccurrences?: number | undefined;
3921
+ sinceDays?: number | undefined;
3922
+ maxClusters?: number | undefined;
3923
+ via?: string | undefined;
3924
+ } | undefined;
3925
+ injection?: {
3926
+ enabled?: boolean | undefined;
3927
+ maxProcedures?: number | undefined;
3928
+ minScore?: number | undefined;
3929
+ } | undefined;
3930
+ }>>;
3375
3931
  /** Registered inbound webhooks — an inventory the dashboard manages. Each
3376
3932
  * entry binds an (agent, source) pair to an optional signing secret. The
3377
3933
  * actual inbound URL is always POST /webhook/<agentId>/<source>. */
3378
3934
  webhooks: z.ZodDefault<z.ZodArray<z.ZodObject<{
3379
3935
  id: z.ZodString;
3380
- source: z.ZodEnum<["gitlab", "github", "sentry", "stripe", "discord", "slack", "custom"]>;
3936
+ source: z.ZodString;
3381
3937
  agentId: z.ZodString;
3382
3938
  secretEnv: z.ZodOptional<z.ZodString>;
3383
3939
  description: z.ZodOptional<z.ZodString>;
@@ -3404,7 +3960,7 @@ declare const daemonConfigSchema: z.ZodObject<{
3404
3960
  }, "strip", z.ZodTypeAny, {
3405
3961
  enabled: boolean;
3406
3962
  id: string;
3407
- source: "custom" | "gitlab" | "discord" | "slack" | "github" | "sentry" | "stripe";
3963
+ source: string;
3408
3964
  agentId: string;
3409
3965
  description?: string | undefined;
3410
3966
  triggers?: Record<string, string> | undefined;
@@ -3413,7 +3969,7 @@ declare const daemonConfigSchema: z.ZodObject<{
3413
3969
  defaultWorkflow?: string | undefined;
3414
3970
  }, {
3415
3971
  id: string;
3416
- source: "custom" | "gitlab" | "discord" | "slack" | "github" | "sentry" | "stripe";
3972
+ source: string;
3417
3973
  agentId: string;
3418
3974
  enabled?: boolean | undefined;
3419
3975
  description?: string | undefined;
@@ -3423,17 +3979,19 @@ declare const daemonConfigSchema: z.ZodObject<{
3423
3979
  defaultWorkflow?: string | undefined;
3424
3980
  }>, "many">>;
3425
3981
  /** Session cache-reuse policy. Controls when we drop a Claude `--resume`
3426
- * session and rebuild the prompt from scratch.
3427
- * - `staleMinutes`: idle timeout before rotation. Longer is cheaper at
3428
- * Opus rates but lets a session accumulate tool-result bloat across an
3429
- * all-day chat.
3430
- * - `maxTurnsPerSession`: hard cap on turns per Claude session. Prevents
3431
- * unbounded `--resume` growth. When hit, next turn starts fresh with
3432
- * the compacted summary + recent-messages context.
3433
- * - `tierTwoThresholdTokens`: if the prior turn's (input + cacheRead +
3434
- * cacheCreate) exceeded this, rotate proactively. Claude bills tier-2
3435
- * at 1.5× above 200K total input, so rotating before that threshold
3436
- * undercuts the multiplier. */
3982
+ * session and rebuild the prompt from scratch. Every rotation captures a
3983
+ * continuity memo that's injected into the chat's next fresh session.
3984
+ * - `staleMinutes`: idle timeout before rotation. 12 h default — chat
3985
+ * conversations must survive a workday's pauses; overnight silence
3986
+ * starts fresh.
3987
+ * - `maxTurnsPerSession`: backstop cap on turns per Claude session.
3988
+ * Size-based rotation measures real context now, so this rarely fires
3989
+ * first.
3990
+ * - `tierTwoThresholdTokens`: rotate when the prior turn's END-OF-TURN
3991
+ * per-request context (last API call's input + cacheRead + cacheCreate)
3992
+ * reaches this. Claude bills the 1.5× long-context rate above 200K
3993
+ * per REQUEST — 180K leaves headroom. NOT the cumulative turn total:
3994
+ * that sums cache reads across every call and reads 10-20× too high. */
3437
3995
  session: z.ZodDefault<z.ZodObject<{
3438
3996
  staleMinutes: z.ZodDefault<z.ZodNumber>;
3439
3997
  maxTurnsPerSession: z.ZodDefault<z.ZodNumber>;
@@ -3479,15 +4037,45 @@ declare const daemonConfigSchema: z.ZodObject<{
3479
4037
  * default — installs that don't list plugins are unaffected. Plugin
3480
4038
  * authoring guide: docs/architecture/plugins.md. */
3481
4039
  plugins: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
4040
+ /** Persistent-process pool eviction knobs (handoff #8). The pool keeps
4041
+ * one warm Claude subprocess per (agent, channel, chatId) so latency
4042
+ * stays low; without bounds, an idle process can serve traffic days
4043
+ * later with stale context. These knobs cap that risk. All values are
4044
+ * in seconds for operator-friendliness; the registry uses ms internally.
4045
+ *
4046
+ * - `maxIdleSeconds`: a handle becomes eligible for cap-pressured
4047
+ * eviction this many seconds after its last turn. Default 30s
4048
+ * (matches the registry's pre-config behavior).
4049
+ * - `maxAgeSeconds`: a handle is killed unconditionally on the next
4050
+ * sweep once its total wall-clock idleness exceeds this. Default
4051
+ * 2700s (45min) — matches the registry's pre-config staleTimeoutMs.
4052
+ * - `sweepIntervalSeconds`: how often the sweeper checks. Default 5s.
4053
+ *
4054
+ * See `agents.<id>.persistentProcess` to opt an agent into the pool. */
4055
+ processPool: z.ZodDefault<z.ZodObject<{
4056
+ maxIdleSeconds: z.ZodDefault<z.ZodNumber>;
4057
+ maxAgeSeconds: z.ZodDefault<z.ZodNumber>;
4058
+ sweepIntervalSeconds: z.ZodDefault<z.ZodNumber>;
4059
+ }, "strip", z.ZodTypeAny, {
4060
+ maxIdleSeconds: number;
4061
+ maxAgeSeconds: number;
4062
+ sweepIntervalSeconds: number;
4063
+ }, {
4064
+ maxIdleSeconds?: number | undefined;
4065
+ maxAgeSeconds?: number | undefined;
4066
+ sweepIntervalSeconds?: number | undefined;
4067
+ }>>;
3482
4068
  }, "strip", z.ZodTypeAny, {
3483
4069
  agents: Record<string, {
3484
4070
  name: string;
3485
4071
  workspace: string;
3486
- tier: "claude-code" | "sdk" | "orchestrator";
4072
+ tier: "claude-code" | "codex-cli" | "opencode" | "sdk" | "orchestrator";
3487
4073
  mentions: string[];
3488
4074
  intents: string[];
3489
4075
  maxDelegationDepth: number;
4076
+ codegraph: boolean;
3490
4077
  contextReferences: boolean;
4078
+ richMessages: boolean;
3491
4079
  maxConcurrent: number;
3492
4080
  maxExecutionMinutes: number;
3493
4081
  permissionMode: string;
@@ -3501,15 +4089,37 @@ declare const daemonConfigSchema: z.ZodObject<{
3501
4089
  intervalMinutes: number;
3502
4090
  };
3503
4091
  access: "private" | "public";
4092
+ integrations: {
4093
+ enabled: boolean;
4094
+ credentials: {
4095
+ tokenEnv?: string | undefined;
4096
+ privateAppTokenEnv?: string | undefined;
4097
+ apiKeyEnv?: string | undefined;
4098
+ refreshTokenEnv?: string | undefined;
4099
+ clientIdEnv?: string | undefined;
4100
+ clientSecretEnv?: string | undefined;
4101
+ auth?: "keyring" | undefined;
4102
+ sessionDir?: string | undefined;
4103
+ };
4104
+ metadata: Record<string, string | number | boolean>;
4105
+ label: string;
4106
+ kind: string;
4107
+ }[];
3504
4108
  provider?: string | undefined;
3505
4109
  model?: string | undefined;
3506
4110
  systemPrompt?: string | undefined;
3507
4111
  mcp?: Record<string, {
3508
4112
  command: string;
3509
4113
  args: string[];
4114
+ type?: "stdio" | undefined;
3510
4115
  env?: Record<string, string> | undefined;
4116
+ } | {
4117
+ type: "http";
4118
+ url: string;
4119
+ headers?: Record<string, string> | undefined;
3511
4120
  }> | undefined;
3512
4121
  contextStrategy?: "layered" | "planner" | undefined;
4122
+ gitlabAutoReply?: boolean | undefined;
3513
4123
  }>;
3514
4124
  mesh: {
3515
4125
  enabled: boolean;
@@ -3545,6 +4155,7 @@ declare const daemonConfigSchema: z.ZodObject<{
3545
4155
  };
3546
4156
  providers: Record<string, {
3547
4157
  apiKey?: string | undefined;
4158
+ thinking?: boolean | undefined;
3548
4159
  defaultModel?: string | undefined;
3549
4160
  baseUrl?: string | undefined;
3550
4161
  }>;
@@ -3557,6 +4168,7 @@ declare const daemonConfigSchema: z.ZodObject<{
3557
4168
  }[];
3558
4169
  webhookPort: number;
3559
4170
  host: string;
4171
+ autoReplyLegacy: boolean;
3560
4172
  agentMappings: {
3561
4173
  agentId: string;
3562
4174
  gitlabUsernames: string[];
@@ -3567,20 +4179,6 @@ declare const daemonConfigSchema: z.ZodObject<{
3567
4179
  token?: string | undefined;
3568
4180
  webhookSecret?: string | undefined;
3569
4181
  };
3570
- telegram: {
3571
- enabled: boolean;
3572
- accounts: Record<string, {
3573
- token: string;
3574
- agentBinding: string;
3575
- pollInbound: boolean;
3576
- allowFrom?: string[] | undefined;
3577
- }>;
3578
- policy: {
3579
- dm: "block" | "pair";
3580
- group: "all" | "mention-required";
3581
- allowFrom?: string[] | undefined;
3582
- };
3583
- };
3584
4182
  whatsapp: {
3585
4183
  enabled: boolean;
3586
4184
  sessionDir: string;
@@ -3609,16 +4207,19 @@ declare const daemonConfigSchema: z.ZodObject<{
3609
4207
  allowFrom?: string[] | undefined;
3610
4208
  defaultAgent?: string | undefined;
3611
4209
  };
3612
- discord: {
3613
- enabled: boolean;
3614
- token?: string | undefined;
3615
- agentBinding?: string | undefined;
3616
- };
3617
- slack: {
4210
+ telegram: {
3618
4211
  enabled: boolean;
3619
- agentBinding?: string | undefined;
3620
- botToken?: string | undefined;
3621
- appToken?: string | undefined;
4212
+ accounts: Record<string, {
4213
+ token: string;
4214
+ agentBinding: string;
4215
+ pollInbound: boolean;
4216
+ allowFrom?: string[] | undefined;
4217
+ }>;
4218
+ policy: {
4219
+ dm: "block" | "pair";
4220
+ group: "all" | "mention-required";
4221
+ allowFrom?: string[] | undefined;
4222
+ };
3622
4223
  };
3623
4224
  github: {
3624
4225
  enabled: boolean;
@@ -3626,6 +4227,7 @@ declare const daemonConfigSchema: z.ZodObject<{
3626
4227
  agent: string;
3627
4228
  repo: string;
3628
4229
  }[];
4230
+ autoReplyLegacy: boolean;
3629
4231
  agentMappings: {
3630
4232
  agentId: string;
3631
4233
  githubUsernames: string[];
@@ -3732,7 +4334,7 @@ declare const daemonConfigSchema: z.ZodObject<{
3732
4334
  columns: {
3733
4335
  id: string;
3734
4336
  title: string;
3735
- kind: "open-backlog" | "scoped-label" | "closed" | "label";
4337
+ kind: "label" | "open-backlog" | "scoped-label" | "closed";
3736
4338
  scopedPrefix: string;
3737
4339
  mapsToLabel?: string | undefined;
3738
4340
  scopedLabel?: string | undefined;
@@ -3767,12 +4369,35 @@ declare const daemonConfigSchema: z.ZodObject<{
3767
4369
  workflows: {
3768
4370
  dir: string;
3769
4371
  enabled: boolean;
4372
+ matching: {
4373
+ enabled: boolean;
4374
+ mode: "auto" | "suggest";
4375
+ autoRunThreshold: number;
4376
+ suggestThreshold: number;
4377
+ };
3770
4378
  editor: "disabled" | "readonly" | "edit";
3771
4379
  };
4380
+ procedures: {
4381
+ dir: string;
4382
+ enabled: boolean;
4383
+ extraction: {
4384
+ enabled: boolean;
4385
+ onTaskCompletion: boolean;
4386
+ minOccurrences: number;
4387
+ sinceDays: number;
4388
+ maxClusters: number;
4389
+ via?: string | undefined;
4390
+ };
4391
+ injection: {
4392
+ enabled: boolean;
4393
+ maxProcedures: number;
4394
+ minScore: number;
4395
+ };
4396
+ };
3772
4397
  webhooks: {
3773
4398
  enabled: boolean;
3774
4399
  id: string;
3775
- source: "custom" | "gitlab" | "discord" | "slack" | "github" | "sentry" | "stripe";
4400
+ source: string;
3776
4401
  agentId: string;
3777
4402
  description?: string | undefined;
3778
4403
  triggers?: Record<string, string> | undefined;
@@ -3789,6 +4414,11 @@ declare const daemonConfigSchema: z.ZodObject<{
3789
4414
  maxClaudeCodeDispatchesPer5h: number;
3790
4415
  };
3791
4416
  plugins: string[];
4417
+ processPool: {
4418
+ maxIdleSeconds: number;
4419
+ maxAgeSeconds: number;
4420
+ sweepIntervalSeconds: number;
4421
+ };
3792
4422
  business?: {
3793
4423
  enabled: boolean;
3794
4424
  projects: {
@@ -3863,22 +4493,30 @@ declare const daemonConfigSchema: z.ZodObject<{
3863
4493
  workspace: string;
3864
4494
  provider?: string | undefined;
3865
4495
  model?: string | undefined;
3866
- tier?: "claude-code" | "sdk" | "orchestrator" | undefined;
4496
+ tier?: "claude-code" | "codex-cli" | "opencode" | "sdk" | "orchestrator" | undefined;
3867
4497
  systemPrompt?: string | undefined;
3868
4498
  mentions?: string[] | undefined;
3869
4499
  intents?: string[] | undefined;
3870
4500
  maxDelegationDepth?: number | undefined;
3871
4501
  mcp?: Record<string, {
3872
4502
  command: string;
4503
+ type?: "stdio" | undefined;
3873
4504
  env?: Record<string, string> | undefined;
3874
4505
  args?: string[] | undefined;
4506
+ } | {
4507
+ type: "http";
4508
+ url: string;
4509
+ headers?: Record<string, string> | undefined;
3875
4510
  }> | undefined;
4511
+ codegraph?: boolean | undefined;
3876
4512
  contextStrategy?: "layered" | "planner" | undefined;
3877
4513
  contextReferences?: boolean | undefined;
4514
+ richMessages?: boolean | undefined;
3878
4515
  maxConcurrent?: number | undefined;
3879
4516
  maxExecutionMinutes?: number | undefined;
3880
4517
  permissionMode?: string | undefined;
3881
4518
  toolUseRequired?: string[] | undefined;
4519
+ gitlabAutoReply?: boolean | undefined;
3882
4520
  persistentProcess?: boolean | undefined;
3883
4521
  queueMode?: "collect" | "followup" | "drop" | undefined;
3884
4522
  heartbeat?: {
@@ -3888,6 +4526,22 @@ declare const daemonConfigSchema: z.ZodObject<{
3888
4526
  intervalMinutes?: number | undefined;
3889
4527
  } | undefined;
3890
4528
  access?: "private" | "public" | undefined;
4529
+ integrations?: {
4530
+ label: string;
4531
+ kind: string;
4532
+ enabled?: boolean | undefined;
4533
+ credentials?: {
4534
+ tokenEnv?: string | undefined;
4535
+ privateAppTokenEnv?: string | undefined;
4536
+ apiKeyEnv?: string | undefined;
4537
+ refreshTokenEnv?: string | undefined;
4538
+ clientIdEnv?: string | undefined;
4539
+ clientSecretEnv?: string | undefined;
4540
+ auth?: "keyring" | undefined;
4541
+ sessionDir?: string | undefined;
4542
+ } | undefined;
4543
+ metadata?: Record<string, string | number | boolean> | undefined;
4544
+ }[] | undefined;
3891
4545
  }> | undefined;
3892
4546
  mesh?: {
3893
4547
  enabled?: boolean | undefined;
@@ -3917,6 +4571,7 @@ declare const daemonConfigSchema: z.ZodObject<{
3917
4571
  } | undefined;
3918
4572
  providers?: Record<string, {
3919
4573
  apiKey?: string | undefined;
4574
+ thinking?: boolean | undefined;
3920
4575
  defaultModel?: string | undefined;
3921
4576
  baseUrl?: string | undefined;
3922
4577
  }> | undefined;
@@ -3931,6 +4586,7 @@ declare const daemonConfigSchema: z.ZodObject<{
3931
4586
  webhookPort?: number | undefined;
3932
4587
  webhookSecret?: string | undefined;
3933
4588
  host?: string | undefined;
4589
+ autoReplyLegacy?: boolean | undefined;
3934
4590
  agentMappings?: {
3935
4591
  agentId: string;
3936
4592
  token?: string | undefined;
@@ -3939,24 +4595,10 @@ declare const daemonConfigSchema: z.ZodObject<{
3939
4595
  node?: string | undefined;
3940
4596
  }[] | undefined;
3941
4597
  } | undefined;
3942
- telegram?: {
3943
- enabled?: boolean | undefined;
3944
- accounts?: Record<string, {
3945
- token: string;
3946
- agentBinding: string;
3947
- allowFrom?: string[] | undefined;
3948
- pollInbound?: boolean | undefined;
3949
- }> | undefined;
3950
- policy?: {
3951
- allowFrom?: string[] | undefined;
3952
- dm?: "block" | "pair" | undefined;
3953
- group?: "all" | "mention-required" | undefined;
3954
- } | undefined;
3955
- } | undefined;
3956
4598
  whatsapp?: {
3957
4599
  enabled?: boolean | undefined;
3958
- allowFrom?: string[] | undefined;
3959
4600
  sessionDir?: string | undefined;
4601
+ allowFrom?: string[] | undefined;
3960
4602
  defaultAgent?: string | undefined;
3961
4603
  routes?: {
3962
4604
  agent: string;
@@ -3981,16 +4623,19 @@ declare const daemonConfigSchema: z.ZodObject<{
3981
4623
  retentionDays?: number | undefined;
3982
4624
  } | undefined;
3983
4625
  } | undefined;
3984
- discord?: {
3985
- enabled?: boolean | undefined;
3986
- token?: string | undefined;
3987
- agentBinding?: string | undefined;
3988
- } | undefined;
3989
- slack?: {
4626
+ telegram?: {
3990
4627
  enabled?: boolean | undefined;
3991
- agentBinding?: string | undefined;
3992
- botToken?: string | undefined;
3993
- appToken?: string | undefined;
4628
+ accounts?: Record<string, {
4629
+ token: string;
4630
+ agentBinding: string;
4631
+ allowFrom?: string[] | undefined;
4632
+ pollInbound?: boolean | undefined;
4633
+ }> | undefined;
4634
+ policy?: {
4635
+ allowFrom?: string[] | undefined;
4636
+ dm?: "block" | "pair" | undefined;
4637
+ group?: "all" | "mention-required" | undefined;
4638
+ } | undefined;
3994
4639
  } | undefined;
3995
4640
  github?: {
3996
4641
  enabled?: boolean | undefined;
@@ -4000,6 +4645,7 @@ declare const daemonConfigSchema: z.ZodObject<{
4000
4645
  repo: string;
4001
4646
  }[] | undefined;
4002
4647
  webhookSecret?: string | undefined;
4648
+ autoReplyLegacy?: boolean | undefined;
4003
4649
  agentMappings?: {
4004
4650
  agentId: string;
4005
4651
  token?: string | undefined;
@@ -4167,7 +4813,7 @@ declare const daemonConfigSchema: z.ZodObject<{
4167
4813
  columns?: {
4168
4814
  id: string;
4169
4815
  title: string;
4170
- kind?: "open-backlog" | "scoped-label" | "closed" | "label" | undefined;
4816
+ kind?: "label" | "open-backlog" | "scoped-label" | "closed" | undefined;
4171
4817
  mapsToLabel?: string | undefined;
4172
4818
  scopedLabel?: string | undefined;
4173
4819
  scopedPrefix?: string | undefined;
@@ -4201,11 +4847,34 @@ declare const daemonConfigSchema: z.ZodObject<{
4201
4847
  workflows?: {
4202
4848
  dir?: string | undefined;
4203
4849
  enabled?: boolean | undefined;
4850
+ matching?: {
4851
+ enabled?: boolean | undefined;
4852
+ mode?: "auto" | "suggest" | undefined;
4853
+ autoRunThreshold?: number | undefined;
4854
+ suggestThreshold?: number | undefined;
4855
+ } | undefined;
4204
4856
  editor?: "disabled" | "readonly" | "edit" | undefined;
4205
4857
  } | undefined;
4858
+ procedures?: {
4859
+ dir?: string | undefined;
4860
+ enabled?: boolean | undefined;
4861
+ extraction?: {
4862
+ enabled?: boolean | undefined;
4863
+ onTaskCompletion?: boolean | undefined;
4864
+ minOccurrences?: number | undefined;
4865
+ sinceDays?: number | undefined;
4866
+ maxClusters?: number | undefined;
4867
+ via?: string | undefined;
4868
+ } | undefined;
4869
+ injection?: {
4870
+ enabled?: boolean | undefined;
4871
+ maxProcedures?: number | undefined;
4872
+ minScore?: number | undefined;
4873
+ } | undefined;
4874
+ } | undefined;
4206
4875
  webhooks?: {
4207
4876
  id: string;
4208
- source: "custom" | "gitlab" | "discord" | "slack" | "github" | "sentry" | "stripe";
4877
+ source: string;
4209
4878
  agentId: string;
4210
4879
  enabled?: boolean | undefined;
4211
4880
  description?: string | undefined;
@@ -4223,6 +4892,11 @@ declare const daemonConfigSchema: z.ZodObject<{
4223
4892
  maxClaudeCodeDispatchesPer5h?: number | undefined;
4224
4893
  } | undefined;
4225
4894
  plugins?: string[] | undefined;
4895
+ processPool?: {
4896
+ maxIdleSeconds?: number | undefined;
4897
+ maxAgeSeconds?: number | undefined;
4898
+ sweepIntervalSeconds?: number | undefined;
4899
+ } | undefined;
4226
4900
  }>;
4227
4901
  type DaemonConfig = z.infer<typeof daemonConfigSchema>;
4228
4902
  type AgentDef = z.infer<typeof agentConfigSchema>;
@@ -4320,6 +4994,13 @@ declare class A2AMesh {
4320
4994
  * caller is allowed to act for this agent. Optional during the
4321
4995
  * log-warn rollout; missing values produce a server-side warning. */
4322
4996
  senderAgentId?: string;
4997
+ /** Force a fresh session on the receiving daemon (clears cached
4998
+ * claudeSessionId + kills any persistent-process handle keyed
4999
+ * on the receiver's (agent, channel, chatId) before exec).
5000
+ * Defaults undefined → receiver applies its own auto-default
5001
+ * (true when senderAgentId is set, otherwise false). Set
5002
+ * explicitly to override. */
5003
+ freshSession?: boolean;
4323
5004
  /** Origin context — channel, chatId, sender, channelMeta, etc. Forwarded
4324
5005
  * to the receiving daemon's /task handler verbatim so the receiver's
4325
5006
  * registry.execute() keys the session by the SAME (channel, chatId)
@@ -4330,6 +5011,27 @@ declare class A2AMesh {
4330
5011
  * 2026-04-29 issue #709. Shape matches AgentTask.context. */
4331
5012
  context?: Record<string, unknown>;
4332
5013
  }): Promise<string>;
5014
+ /**
5015
+ * Streaming variant of `sendTask`. POSTs to the peer's `/task` with
5016
+ * `Accept: text/event-stream`, parses the agentx SSE wire (event/data
5017
+ * pairs), and yields `{event, data}` records as they arrive — text
5018
+ * deltas, thinking chunks, tool start/result, and a terminal
5019
+ * `done` (or `error`).
5020
+ *
5021
+ * Same timeout + dispatcher story as sendTask: undici dispatcher with
5022
+ * disabled headersTimeout/bodyTimeout so a multi-minute agent run does
5023
+ * not get killed by the default 300s headers cap, while an
5024
+ * AbortController enforces our own wall-clock.
5025
+ */
5026
+ sendTaskStream(peerName: string, text: string, agentId?: string, opts?: {
5027
+ timeoutMs?: number;
5028
+ senderAgentId?: string;
5029
+ freshSession?: boolean;
5030
+ context?: Record<string, unknown>;
5031
+ }): AsyncGenerator<{
5032
+ event: string;
5033
+ data: any;
5034
+ }>;
4333
5035
  /**
4334
5036
  * Forward a WebRTC signaling message (SDP / ICE / hangup) to a remote peer's
4335
5037
  * /webrtc/signal endpoint. Not gated by peer health — a healthy control plane
@@ -4359,6 +5061,12 @@ declare class A2AMesh {
4359
5061
  * workflow `action.send` to forward outbound messages back to the peer
4360
5062
  * that owns the channel when the workflow runs on a different node.
4361
5063
  */
5064
+ /**
5065
+ * Auth headers for daemon-level fetches to a peer's protected endpoints.
5066
+ * Tokens deliberately never ride along in directory() — it is served to
5067
+ * dashboards and /mesh; look them up per-request by peer name instead.
5068
+ */
5069
+ authHeaders(peerName: string): Record<string, string>;
4362
5070
  directory(): Array<{
4363
5071
  peer: string;
4364
5072
  peerUrl: string;
@@ -4467,12 +5175,17 @@ declare class AgentXDaemon {
4467
5175
  private registry;
4468
5176
  private router;
4469
5177
  private cron;
5178
+ /** Per-project webhook rules. Hot-reloaded from .agentx/projects/.
5179
+ * Wired into the gitlab/github adapters at startup so they can gate
5180
+ * events and resolve runbook paths. */
5181
+ private projectRules;
4470
5182
  private mesh?;
4471
5183
  private hooks;
4472
5184
  private landscape;
4473
5185
  private heartbeat;
4474
5186
  private business?;
4475
5187
  private httpServer?;
5188
+ private attachSweep?;
4476
5189
  private webhooks;
4477
5190
  private github?;
4478
5191
  private webrtc?;
@@ -4553,6 +5266,13 @@ declare class AgentXDaemon {
4553
5266
  * The page does getUserMedia, RTCPeerConnection, and POSTs/listens signals.
4554
5267
  */
4555
5268
  private serveCallPage;
5269
+ /** POST endpoints that mesh peers call across the network. Everything
5270
+ * else on this server is either read-only, loopback-operated (CLI,
5271
+ * same-host dashboard), or carries its own secret (chat routes). */
5272
+ private static readonly MESH_PROTECTED_PATHS;
5273
+ /** Wraps decideMeshAuth (daemon/mesh-auth.ts) with token collection,
5274
+ * logging, and the 401 response. */
5275
+ private checkMeshAuth;
4556
5276
  private handleHttp;
4557
5277
  /**
4558
5278
  * OpenAI-compatible chat completions endpoint.
@@ -4567,6 +5287,13 @@ declare class AgentXDaemon {
4567
5287
  */
4568
5288
  private handleOpenAICompat;
4569
5289
  private json;
5290
+ /** Resolve a GitLab API token for the given agent, checking (in order):
5291
+ * 1. `channels.gitlab.agentMappings[].token` — legacy per-agent token
5292
+ * 2. `agents[id].integrations[]` (kind=gitlab-user, tokenEnv) — newer
5293
+ * style used by agents declared via `agentx manage`
5294
+ * 3. `channels.gitlab.token` — global fallback (group bot identity)
5295
+ * Returns the token plus a `source` tag for diagnostic logging. */
5296
+ private resolveGitlabTokenForAgent;
4570
5297
  /** Pick today's usage rollup according to AGENTX_USAGE_READ:
4571
5298
  * - "sqlite": SQLite only (empty if db null / no rows)
4572
5299
  * - "json": JSON only (legacy behaviour)
@@ -4594,10 +5321,6 @@ declare class AgentXDaemon {
4594
5321
  * heavy lifting is in `AgentRegistry.agentMemory` (AgentMemory); this
4595
5322
  * is a thin JSON wrapper that validates + delegates. */
4596
5323
  private handleMemoryApi;
4597
- /** Mesh receiver for forwarded workflow events. Peers POST the same
4598
- * payload shape the MeshForwarder sends. Enforces that the run is
4599
- * actually home'd here before acting — protects against routing loops. */
4600
- private handleTaskApi;
4601
5324
  private handleWorkflowEvent;
4602
5325
  /** Mesh-callable outbound send. A peer's workflow `action.send` invokes
4603
5326
  * this when the channel lives on this node (e.g. clawd-server hosts
@@ -4617,6 +5340,13 @@ declare class AgentXDaemon {
4617
5340
  * `sources` in the response tells the editor where the entries came from
4618
5341
  * so it can show that metadata alongside. */
4619
5342
  private handleChannelChats;
5343
+ /** Replay a draft as an ad-hoc workflow. The draft itself stays in
5344
+ * `_drafts/`; we register a copy as `_adhoc-replay-<draftId>-<ts>.yaml`
5345
+ * in the active store, hot-reload, and fire it through the dispatcher.
5346
+ * Input is sourced from a trace pulled out of the draft's
5347
+ * `sourceTaskIds` — caller can override which trace via `taskId` in the
5348
+ * body, or supply a payload directly via `input`. */
5349
+ private handleWorkflowDraftReplay;
4620
5350
  /** Manual run endpoint used by `agentx workflow run <id>`. Only workflows
4621
5351
  * whose trigger node is `trigger.manual` are runnable here — any other
4622
5352
  * source expects a live event and shouldn't race with a manual kick. */
@@ -4800,6 +5530,19 @@ declare class TokenTracker {
4800
5530
  private save;
4801
5531
  }
4802
5532
 
5533
+ interface FriendlyError {
5534
+ /** One-line, operator-facing message suitable for a dashboard card or chat reply. */
5535
+ message: string;
5536
+ /** Optional next step the user can take. */
5537
+ fix?: string;
5538
+ /** Machine-readable error category for routing / retries. */
5539
+ kind: "out_of_credits" | "overage_disabled" | "usage_cap" | "auth" | "permission" | "rate_limit" | "overloaded" | "context_too_large" | "invalid_request" | "upstream_api" | "timeout" | "cancelled" | "unknown";
5540
+ /** Whether this error is transient — a retry has a reasonable chance of succeeding. */
5541
+ retryable: boolean;
5542
+ /** Source error text retained for logs / debugging. */
5543
+ raw?: string;
5544
+ }
5545
+
4803
5546
  interface AgentPeer {
4804
5547
  id: string;
4805
5548
  name: string;
@@ -4902,15 +5645,38 @@ interface AgentTask {
4902
5645
  };
4903
5646
  facts?: string[];
4904
5647
  };
5648
+ /** Path to the project root whose runbook (CLAUDE.md / AGENTS.md / etc.)
5649
+ * should be injected into the agent's system prefix for this task.
5650
+ * Set by the gitlab/github adapters when a project rule resolves a
5651
+ * `runbook:` path. Optional. */
5652
+ runbookPath?: string;
5653
+ /** Override list of files to read from runbookPath. Optional. */
5654
+ runbookFiles?: string[];
4905
5655
  };
4906
5656
  }
4907
5657
  interface AgentResponse {
4908
5658
  content: string;
4909
5659
  error?: string;
5660
+ /** Typed discriminator on `error`. Lets dispatchers and workflow nodes
5661
+ * branch on the failure cause without string-matching the friendly
5662
+ * message (which is operator-facing prose, not machine input). The
5663
+ * full FriendlyError taxonomy is in error-map.ts; common ones to
5664
+ * branch on: `out_of_credits`, `rate_limit`, `auth`, `timeout`. */
5665
+ errorKind?: FriendlyError["kind"];
4910
5666
  tokensUsed?: number;
4911
5667
  duration?: number;
4912
5668
  claudeSessionId?: string;
5669
+ codexSessionId?: string;
5670
+ opencodeSessionId?: string;
4913
5671
  usage?: TokenUsage;
5672
+ /** End-of-turn context size: the LAST API call's (input + cacheRead +
5673
+ * cacheCreate) inside this turn, captured from the final assistant
5674
+ * stream event. `usage` above is CUMULATIVE across every call in the
5675
+ * agentic loop (a tool-heavy turn easily sums to millions via cache
5676
+ * reads) — only this field reflects how full the conversation context
5677
+ * actually is, so rotation decisions must use it, never `usage`.
5678
+ * Undefined on non-streaming paths (result JSON has no per-call data). */
5679
+ contextTokens?: number;
4914
5680
  /** The model Claude actually billed for (from the CLI's init event). When
4915
5681
  * absent, cost reporting should fall back to the model override / agent
4916
5682
  * config. Knowing the billed model is what makes cache-aware pricing
@@ -4921,6 +5687,10 @@ interface AgentResponse {
4921
5687
  * requested agent (the local registry didn't have it). Name of the
4922
5688
  * peer that actually ran it. */
4923
5689
  viaMesh?: string;
5690
+ /** Set when a live Claude Code session attached to this identity answered
5691
+ * the task instead of a spawned provider (attach mode). Claude Code
5692
+ * session id of the terminal that wrote the reply. */
5693
+ viaAttachedSession?: string;
4924
5694
  }
4925
5695
  /** Callback for streaming text deltas */
4926
5696
  type StreamCallback = (delta: string, fullText: string) => void;
@@ -4938,18 +5708,34 @@ interface TokenUsage {
4938
5708
  * Execute a task using the Claude Code CLI (tier: "claude-code").
4939
5709
  * Non-streaming — waits for full response.
4940
5710
  */
4941
- declare function executeClaudeCode(agent: AgentDef, task: AgentTask, historyContext?: string, resumeSessionId?: string): Promise<AgentResponse>;
5711
+ declare function executeClaudeCode(agent: AgentDef, task: AgentTask, historyContext?: string, resumeSessionId?: string, abortSignal?: AbortSignal): Promise<AgentResponse>;
5712
+ declare function executeOpenCodeCli(agent: AgentDef, task: AgentTask, onDelta?: StreamCallback, historyContext?: string, resumeSessionId?: string, onEvent?: (event: any) => void, abortSignal?: AbortSignal): Promise<AgentResponse>;
4942
5713
  /**
4943
5714
  * Execute a task using the Claude Agent SDK (tier: "sdk").
4944
5715
  */
4945
5716
  declare function executeSdk(agent: AgentDef, task: AgentTask, apiKey: string, historyContext?: string): Promise<AgentResponse>;
4946
5717
  /**
4947
5718
  * Execute a task using agentx's own orchestrator (tier: "orchestrator").
5719
+ *
5720
+ * When `onDelta` is supplied, switches from `generate()` (single-shot) to
5721
+ * `generateStream()` and forwards text deltas as they arrive. This is what
5722
+ * lets the daemon's POST /chat?stream=true actually stream Claude/DeepSeek
5723
+ * tokens — without it, the orchestrator returned only after the agentic
5724
+ * loop finished and SSE clients saw `role` then `stop` with no content
5725
+ * between (the failure mode that surfaced on the noqta-public smoke test
5726
+ * after the tier switch).
4948
5727
  */
4949
- declare function executeOrchestrator(agent: AgentDef, task: AgentTask, apiKey?: string, historyContext?: string): Promise<AgentResponse>;
5728
+ /** Side-channel for reasoning/thinking chunks — distinct from
5729
+ * StreamCallback so callers can route them to a different UI lane
5730
+ * (e.g. a collapsible thinking block on noqta.tn, a dimmed terminal
5731
+ * block in the dashboard) without polluting the visible response. */
5732
+ type ThinkingCallback = (text: string) => void;
5733
+ declare function executeOrchestrator(agent: AgentDef, task: AgentTask, apiKey?: string, historyContext?: string, onDelta?: StreamCallback, providerOpts?: {
5734
+ thinking?: boolean;
5735
+ }, onThinking?: ThinkingCallback, abortSignal?: AbortSignal, onEvent?: (event: any) => void): Promise<AgentResponse>;
4950
5736
  declare function executeTask(agent: AgentDef, task: AgentTask, providers: Record<string, {
4951
5737
  apiKey?: string;
4952
- }>, onDelta?: StreamCallback, historyContext?: string, resumeSessionId?: string, onEvent?: (event: any) => void): Promise<AgentResponse>;
5738
+ }>, onDelta?: StreamCallback, historyContext?: string, resumeSessionId?: string, onEvent?: (event: any) => void, abortSignal?: AbortSignal, onThinking?: ThinkingCallback): Promise<AgentResponse>;
4953
5739
 
4954
5740
  interface DriftReport {
4955
5741
  /** 0-1 score: 0 = no drift, 1 = complete drift */
@@ -5092,6 +5878,17 @@ interface IncomingMessage {
5092
5878
  eventId: string;
5093
5879
  decidedBy: string;
5094
5880
  };
5881
+ /** Path to the project root whose runbook (CLAUDE.md / AGENTS.md / etc.)
5882
+ * the agent should consult for this task. Set by the gitlab/github
5883
+ * adapters when a project rule resolves a `runbook:` path. The agent
5884
+ * registry reads the file set into the cacheable system prefix.
5885
+ * Undefined when no rule matched — agent uses its own workspace's
5886
+ * CLAUDE.md as before. */
5887
+ runbookPath?: string;
5888
+ /** Override list of files the registry should read from runbookPath.
5889
+ * Carried alongside the path so per-project customisation applies
5890
+ * without the registry re-reading the rule. */
5891
+ runbookFiles?: string[];
5095
5892
  }
5096
5893
  interface OutgoingMessage {
5097
5894
  channel: string;
@@ -5112,6 +5909,12 @@ interface OutgoingMessage {
5112
5909
  mimetype?: string;
5113
5910
  fileName?: string;
5114
5911
  };
5912
+ /** URL inline buttons (Phase 1). Telegram renders an inline_keyboard;
5913
+ * channels without button support ignore them. */
5914
+ buttons?: Array<{
5915
+ label: string;
5916
+ url: string;
5917
+ }>;
5115
5918
  }
5116
5919
  interface ChannelAdapter {
5117
5920
  readonly name: string;
@@ -5178,6 +5981,8 @@ interface Session {
5178
5981
  chatId: string;
5179
5982
  day: string;
5180
5983
  claudeSessionId?: string;
5984
+ codexSessionId?: string;
5985
+ opencodeSessionId?: string;
5181
5986
  messages: SessionMessage[];
5182
5987
  createdAt: string;
5183
5988
  updatedAt: string;
@@ -5186,11 +5991,24 @@ interface Session {
5186
5991
  * Claude CLI replays the entire prior session on every turn, so long
5187
5992
  * sessions pay a linearly growing cache-read tax. */
5188
5993
  turnCount?: number;
5189
- /** Total billable input of the LAST turn on this claudeSessionId
5190
- * (inputTokens + cacheReadTokens + cacheCreateTokens). Used to detect
5191
- * tier-2 hits (>200K) from the prior turn so we can rotate before the
5192
- * next turn pays the 1.5× multiplier again. */
5994
+ /** CUMULATIVE billable input of the LAST turn on this claudeSessionId
5995
+ * (inputTokens + cacheReadTokens + cacheCreateTokens summed across every
5996
+ * API call in the agentic loop). Kept for observability/billing only —
5997
+ * a tool-heavy turn sums to millions via cache reads, so this must NOT
5998
+ * drive rotation decisions. See lastTurnContextTokens. */
5193
5999
  lastTurnInputTokens?: number;
6000
+ /** End-of-turn CONTEXT size: the last API call's (input + cacheRead +
6001
+ * cacheCreate) inside the previous turn — how full the conversation
6002
+ * window actually is. This is the tier-2 rotation metric. Absent when
6003
+ * the turn ran through a non-streaming path (no per-call usage). */
6004
+ lastTurnContextTokens?: number;
6005
+ }
6006
+ /** Continuity memo captured from a dying session at rotation time —
6007
+ * injected deterministically into the chat's next fresh session. */
6008
+ interface RotationMemoRecord {
6009
+ memo: string;
6010
+ reason: string;
6011
+ capturedAt: string;
5194
6012
  }
5195
6013
  declare class SessionStore {
5196
6014
  private sessionsDir;
@@ -5241,6 +6059,10 @@ declare class SessionStore {
5241
6059
  * Get or create a session for this agent+channel+chat+day.
5242
6060
  */
5243
6061
  getSession(agentId: string, channel: string, chatId: string): Session;
6062
+ /** Yesterday's (UTC) session record for the same triple, or null. Only
6063
+ * one day back — a gap of 2+ days is stale at any sane staleMinutes,
6064
+ * so scanning further would never change the outcome. */
6065
+ private loadPreviousDaySession;
5244
6066
  /**
5245
6067
  * Add a user message to the session. Consecutive duplicates from the same
5246
6068
  * sender are collapsed — when a user re-sends the exact same text (retry,
@@ -5248,6 +6070,14 @@ declare class SessionStore {
5248
6070
  * replayed history and re-burns tokens on every subsequent turn.
5249
6071
  */
5250
6072
  addUserMessage(agentId: string, channel: string, chatId: string, senderName: string, content: string): void;
6073
+ /**
6074
+ * Pop the last user message if it matches `expectedContent` (exact equality
6075
+ * after trim). Used by the operator Update flow when Stop was pressed
6076
+ * first — the cancelled user turn has no agent reply, so leaving it in
6077
+ * history makes the next Update read as a bare orphan ask. Match guard
6078
+ * prevents removing something a concurrent path just added.
6079
+ */
6080
+ removeLastUserMessageIfMatches(agentId: string, channel: string, chatId: string, expectedContent: string): boolean;
5251
6081
  /**
5252
6082
  * Add an agent response to the session. Same dedup rule as user messages —
5253
6083
  * retries and duplicate responses shouldn't be replayed on every turn.
@@ -5262,12 +6092,19 @@ declare class SessionStore {
5262
6092
  * Store the Claude Code session ID after first invocation.
5263
6093
  */
5264
6094
  setClaudeSessionId(agentId: string, channel: string, chatId: string, claudeSessionId: string): void;
6095
+ getCodexSessionId(agentId: string, channel: string, chatId: string): string | undefined;
6096
+ setCodexSessionId(agentId: string, channel: string, chatId: string, codexSessionId: string): void;
6097
+ getOpenCodeSessionId(agentId: string, channel: string, chatId: string): string | undefined;
6098
+ setOpenCodeSessionId(agentId: string, channel: string, chatId: string, opencodeSessionId: string): void;
5265
6099
  /**
5266
6100
  * Build conversation history string to prepend to the prompt.
5267
6101
  * Returns empty string if no history.
5268
6102
  * Used for non-claude-code tiers that don't have native sessions.
5269
6103
  */
5270
- buildHistoryContext(agentId: string, channel: string, chatId: string): string;
6104
+ buildHistoryContext(agentId: string, channel: string, chatId: string, opts?: {
6105
+ maxMessages?: number;
6106
+ maxChars?: number;
6107
+ }): string;
5271
6108
  /**
5272
6109
  * Recall conversation turns across multiple stored sessions for an agent.
5273
6110
  *
@@ -5339,7 +6176,7 @@ declare class SessionStore {
5339
6176
  sessionFile: string;
5340
6177
  }>;
5341
6178
  /**
5342
- * Check if a Claude session is stale (idle too long for --resume to be useful).
6179
+ * Check if a native CLI session is stale (idle too long for resume to be useful).
5343
6180
  * When stale, the resumed context will be too far behind — better to start fresh.
5344
6181
  */
5345
6182
  isSessionStale(agentId: string, channel: string, chatId: string): boolean;
@@ -5371,35 +6208,57 @@ declare class SessionStore {
5371
6208
  */
5372
6209
  hasCompaction(agentId: string, channel: string, chatId: string): boolean;
5373
6210
  /**
5374
- * Clear the stored Claude session ID so next invocation starts fresh.
6211
+ * Clear stored native CLI session IDs so next invocation starts fresh.
5375
6212
  * Also resets the per-session turn counter and last-turn input size —
5376
- * those are only meaningful relative to the current claudeSessionId.
6213
+ * those are only meaningful relative to the current native session.
5377
6214
  */
5378
6215
  clearClaudeSessionId(agentId: string, channel: string, chatId: string): void;
6216
+ /**
6217
+ * Reset the entire AgentX-side conversation for a delegated fresh session.
6218
+ * Claude needs the native session id cleared; Codex and other non-native
6219
+ * runtimes also need the rendered message history removed or they will see
6220
+ * stale turns through buildHistoryContext().
6221
+ */
6222
+ clearSession(agentId: string, channel: string, chatId: string): void;
5379
6223
  /**
5380
6224
  * Check whether this session has hit the max-turns cap. Rotate when true
5381
6225
  * to stop --resume replay from growing unbounded across a long chat.
5382
6226
  */
5383
6227
  shouldRotateByTurns(agentId: string, channel: string, chatId: string): boolean;
5384
6228
  /**
5385
- * Check whether the LAST turn on this session pushed total input past
5386
- * the tier-2 threshold. If yes, rotate so we don't pay the 1.5×
5387
- * multiplier again on the next turn.
6229
+ * Check whether the LAST turn left the conversation context near the
6230
+ * tier-2 boundary. Uses `lastTurnContextTokens` (the final API call's
6231
+ * per-request input — the true context size) when the runtime captured
6232
+ * it; falls back to the cumulative turn total only when it didn't.
6233
+ * The cumulative number sums cache reads across every call in an
6234
+ * agentic turn (easily 10-20× the real context), so preferring the
6235
+ * per-call metric is what stops rotation from firing on every
6236
+ * tool-heavy turn — the "agent forgets mid-task" bug.
5388
6237
  */
5389
6238
  shouldRotateByTierTwo(agentId: string, channel: string, chatId: string): boolean;
5390
6239
  /**
5391
6240
  * Record a completed turn's token usage and bump the turn counter.
5392
- * Called after a successful Claude response returns with usage info.
6241
+ * Called after a successful native CLI response returns with usage info.
6242
+ * `contextTokens` is the end-of-turn per-request context size (see
6243
+ * AgentResponse.contextTokens); undefined on non-streaming paths.
5393
6244
  */
5394
6245
  recordTurnUsage(agentId: string, channel: string, chatId: string, usage: {
5395
6246
  inputTokens: number;
5396
6247
  outputTokens: number;
5397
6248
  cacheReadTokens: number;
5398
6249
  cacheCreateTokens: number;
5399
- }): void;
6250
+ }, contextTokens?: number): void;
6251
+ private rotationMemoFile;
6252
+ private readRotationMemos;
6253
+ setRotationMemo(agentId: string, channel: string, chatId: string, memo: string, reason: string): void;
6254
+ /** Latest memo for this chat, or null when absent/expired (7-day TTL). */
6255
+ getRotationMemo(agentId: string, channel: string, chatId: string): RotationMemoRecord | null;
5400
6256
  /** Diagnostic getters — used by registry logging. */
5401
6257
  getTurnCount(agentId: string, channel: string, chatId: string): number;
5402
6258
  getLastTurnInputTokens(agentId: string, channel: string, chatId: string): number;
6259
+ /** The rotation metric shouldRotateByTierTwo actually used: per-request
6260
+ * context size when available, else the cumulative fallback. */
6261
+ getLastTurnContextTokens(agentId: string, channel: string, chatId: string): number;
5403
6262
  getMaxTurnsPerSession(): number;
5404
6263
  getTierTwoThresholdTokens(): number;
5405
6264
  /**
@@ -6026,10 +6885,10 @@ declare const classificationSchema: z.ZodObject<{
6026
6885
  input?: string | undefined;
6027
6886
  };
6028
6887
  channel?: string | undefined;
6888
+ preview?: string | undefined;
6029
6889
  agentId?: string | undefined;
6030
6890
  sender?: string | undefined;
6031
6891
  confidence?: number | undefined;
6032
- preview?: string | undefined;
6033
6892
  }, {
6034
6893
  path: string[];
6035
6894
  status: "pending" | "approved" | "rejected";
@@ -6037,6 +6896,7 @@ declare const classificationSchema: z.ZodObject<{
6037
6896
  ts: string;
6038
6897
  msgHash: string;
6039
6898
  channel?: string | undefined;
6899
+ preview?: string | undefined;
6040
6900
  agentId?: string | undefined;
6041
6901
  sender?: string | undefined;
6042
6902
  proposedAxes?: Record<string, Record<string, string>> | undefined;
@@ -6045,7 +6905,6 @@ declare const classificationSchema: z.ZodObject<{
6045
6905
  input?: string | undefined;
6046
6906
  } | undefined;
6047
6907
  confidence?: number | undefined;
6048
- preview?: string | undefined;
6049
6908
  }>;
6050
6909
  type Classification = z.infer<typeof classificationSchema>;
6051
6910
  /** Row in the fingerprint → path snap cache. */
@@ -6065,16 +6924,16 @@ declare const fingerprintEntrySchema: z.ZodObject<{
6065
6924
  updatedAt: z.ZodString;
6066
6925
  }, "strip", z.ZodTypeAny, {
6067
6926
  path: string[];
6927
+ updatedAt: string;
6068
6928
  leaf: {
6069
6929
  output?: string | undefined;
6070
6930
  input?: string | undefined;
6071
6931
  };
6072
6932
  fingerprint: string;
6073
- updatedAt: string;
6074
6933
  }, {
6075
6934
  path: string[];
6076
- fingerprint: string;
6077
6935
  updatedAt: string;
6936
+ fingerprint: string;
6078
6937
  leaf?: {
6079
6938
  output?: string | undefined;
6080
6939
  input?: string | undefined;
@@ -6152,16 +7011,16 @@ declare const indexFileSchema: z.ZodObject<{
6152
7011
  updatedAt: z.ZodString;
6153
7012
  }, "strip", z.ZodTypeAny, {
6154
7013
  path: string[];
7014
+ updatedAt: string;
6155
7015
  leaf: {
6156
7016
  output?: string | undefined;
6157
7017
  input?: string | undefined;
6158
7018
  };
6159
7019
  fingerprint: string;
6160
- updatedAt: string;
6161
7020
  }, {
6162
7021
  path: string[];
6163
- fingerprint: string;
6164
7022
  updatedAt: string;
7023
+ fingerprint: string;
6165
7024
  leaf?: {
6166
7025
  output?: string | undefined;
6167
7026
  input?: string | undefined;
@@ -6170,19 +7029,19 @@ declare const indexFileSchema: z.ZodObject<{
6170
7029
  }, "strip", z.ZodTypeAny, {
6171
7030
  entries: Record<string, {
6172
7031
  path: string[];
7032
+ updatedAt: string;
6173
7033
  leaf: {
6174
7034
  output?: string | undefined;
6175
7035
  input?: string | undefined;
6176
7036
  };
6177
7037
  fingerprint: string;
6178
- updatedAt: string;
6179
7038
  }>;
6180
7039
  version: number;
6181
7040
  }, {
6182
7041
  entries?: Record<string, {
6183
7042
  path: string[];
6184
- fingerprint: string;
6185
7043
  updatedAt: string;
7044
+ fingerprint: string;
6186
7045
  leaf?: {
6187
7046
  output?: string | undefined;
6188
7047
  input?: string | undefined;
@@ -6478,6 +7337,13 @@ declare class AgentRegistry {
6478
7337
  * the requested agent before returning "Unknown agent". Duck-typed so
6479
7338
  * we don't create a circular import with src/a2a/mesh.ts. */
6480
7339
  private meshFallback?;
7340
+ /** Workflow auto-runner — invoked when workflow matching is in `mode: "auto"`
7341
+ * and a candidate workflow's confidence ≥ autoRunThreshold. Wired by the
7342
+ * daemon after the workflow dispatcher is constructed. Returns the runId of
7343
+ * the started workflow run; the workflow itself owns posting any reply via
7344
+ * its `action.send` / `agent` nodes. Duck-typed to avoid a circular import
7345
+ * on WorkflowDispatcher. */
7346
+ private workflowAutoRunner?;
6481
7347
  private messageQueue;
6482
7348
  /** Intent Knowledge Graph classifier. Null when graph.enabled=false. */
6483
7349
  private classifier?;
@@ -6488,6 +7354,15 @@ declare class AgentRegistry {
6488
7354
  private activeSouls;
6489
7355
  /** Live output captured per running task id — drives the dashboard streaming modal. */
6490
7356
  private taskOutputs;
7357
+ /** Per-running-task AbortController. Set when execution starts, removed in
7358
+ * finally. Cancel paths (operator stop / replace) call .abort() and the
7359
+ * runtime kills the underlying claude subprocess.
7360
+ *
7361
+ * `originalMessage` is the user text recorded in SessionStore at the start
7362
+ * of this run. When the operator presses Stop first then Update, we use it
7363
+ * to drop the orphan cancelled turn from history so the Update reads as an
7364
+ * edit, not a bare follow-up. */
7365
+ private taskAborts;
6491
7366
  /** Last completed task summary per agent — single-line blurb for the dashboard card. */
6492
7367
  private lastSummaries;
6493
7368
  /** 24-hour sparkline cache per agent — recomputed from disk at most once a minute. */
@@ -6507,6 +7382,10 @@ declare class AgentRegistry {
6507
7382
  * agent this node doesn't have. Called by the daemon after mesh boot.
6508
7383
  * Pass `undefined` to disable fallback (testing, mesh disabled). */
6509
7384
  setMeshFallback(mesh: NonNullable<AgentRegistry["meshFallback"]>): void;
7385
+ /** Wire the workflow auto-runner — see field doc above. Daemon calls this
7386
+ * after WorkflowDispatcher boot. Pass undefined to detach (e.g. during
7387
+ * reload). */
7388
+ setWorkflowAutoRunner(runner: NonNullable<AgentRegistry["workflowAutoRunner"]> | undefined): void;
6510
7389
  /** Hot-swap the provider map. Daemon reload calls this after agentx.json
6511
7390
  * changes — the next task that executes will resolve credentials through
6512
7391
  * the fresh table (see executeTask call-site). In-flight tasks keep the
@@ -6584,7 +7463,7 @@ declare class AgentRegistry {
6584
7463
  * this, every dispatched decision sits in-flight forever and the
6585
7464
  * active-task check becomes vacuously over-aggressive.
6586
7465
  */
6587
- execute(task: AgentTask, onDelta?: StreamCallback): Promise<AgentResponse>;
7466
+ execute(task: AgentTask, onDelta?: StreamCallback, onThinking?: ThinkingCallback, onEvent?: (event: any) => void): Promise<AgentResponse>;
6588
7467
  /**
6589
7468
  * Internal dispatcher — the real body. See `execute` for the public
6590
7469
  * wrapper that adds intent-ledger resolution recording.
@@ -6647,6 +7526,47 @@ declare class AgentRegistry {
6647
7526
  */
6648
7527
  getTaskRecord(agentId: string, taskId: string): TaskRecord | null;
6649
7528
  private safe;
7529
+ /**
7530
+ * Post a queued message's response back to its originating channel.
7531
+ * Used by the flush block in `execute()` — channel messages that arrive
7532
+ * while the agent is busy are queued and re-dispatched here, bypassing
7533
+ * the router; without this helper the agent's reply would never reach
7534
+ * the user. Skipped silently for internal channels (`test`, `api`,
7535
+ * `a2a`, `cron`, `workflow`, …) where no adapter is registered.
7536
+ */
7537
+ private postQueuedResponseToChannel;
7538
+ /**
7539
+ * Operator stop. Aborts the in-flight run for `taskId` (kills the
7540
+ * underlying claude subprocess via the AbortSignal threaded through
7541
+ * runtime.ts). Returns the task's identity for HTTP / audit callers,
7542
+ * or null when no live run matches.
7543
+ */
7544
+ cancelRunningTask(taskId: string, reason?: string): {
7545
+ agentId: string;
7546
+ channel: string;
7547
+ chatId: string;
7548
+ } | null;
7549
+ /**
7550
+ * Queue a follow-up correction/update for an in-flight task. The message
7551
+ * lands in the per-session MessageQueue and is dispatched after the
7552
+ * current run finishes — same path channel messages take while the agent
7553
+ * is busy. With `replace=true` we cancel the current run first so the
7554
+ * follow-up runs immediately.
7555
+ *
7556
+ * Returns the resolved identity + queue position, or null when no live
7557
+ * run matches taskId.
7558
+ */
7559
+ queueFollowUp(taskId: string, message: string, sender: string, opts?: {
7560
+ replace?: boolean;
7561
+ reason?: string;
7562
+ }): {
7563
+ agentId: string;
7564
+ channel: string;
7565
+ chatId: string;
7566
+ replaced: boolean;
7567
+ edited: boolean;
7568
+ pending: number;
7569
+ } | null;
6650
7570
  /**
6651
7571
  * Subscribe to live output for a running task. Returns the buffer that has
6652
7572
  * accumulated so far plus an unsubscribe handle. If the task is unknown,
@@ -7451,6 +8371,7 @@ declare class KPI {
7451
8371
  recordBlocker(agentId: string): void;
7452
8372
  private recomputeUtil;
7453
8373
  private persist;
8374
+ private writeStats;
7454
8375
  flush(): void;
7455
8376
  snapshot(): DailyStats;
7456
8377
  /** Markdown summary for end-of-day main-channel post. */
@@ -7552,6 +8473,12 @@ declare class MessageRouter {
7552
8473
  * file is pruned to only live TTL entries before each write.
7553
8474
  */
7554
8475
  private recentMessageIds;
8476
+ private activeMessageKeys;
8477
+ /** Outbound idempotency table — opt-in via sendOutbound(opts.idempotencyKey).
8478
+ * Key: `channel|chatId|hash-or-key`. Value: { postedAt epochMs, messageId }.
8479
+ * Bounded growth — coarse "drop oldest 10%" sweep when over the cap. */
8480
+ private sendDedupeMap;
8481
+ private readonly SEND_DEDUPE_MAX;
7555
8482
  private readonly MESSAGE_ID_TTL_MS;
7556
8483
  private readonly MESSAGE_ID_MAX_ENTRIES;
7557
8484
  private readonly DEDUP_STORE_PATH;
@@ -7593,9 +8520,24 @@ declare class MessageRouter {
7593
8520
  * Used for agent-initiated messages, cron notifications, cross-channel routing.
7594
8521
  *
7595
8522
  * If accountId is not provided for Telegram, auto-resolves from agentId binding.
8523
+ *
8524
+ * `opts.idempotencyKey` — when set, the router caches the (channel,chatId,key)
8525
+ * tuple for `dedupeWindowMs` (default 60s) and returns the cached messageId
8526
+ * for repeat calls within the window. The default key is a sha256 of the
8527
+ * body so an agent that re-runs the same `channel.reply` tool call doesn't
8528
+ * produce duplicate comments — the canonical fix for the raw-curl-twice
8529
+ * scenario diagnosed on MR #236 (2026-05-08).
8530
+ *
8531
+ * Why here and not in the adapter: the router is the single funnel for
8532
+ * agent + cron + API + cross-channel sends. Workflow `action.send` lives
8533
+ * at a different abstraction (explicit, scripted, retry semantics owned
8534
+ * by the engine) so it intentionally stays on the direct adapter path.
7596
8535
  */
7597
8536
  sendOutbound(msg: OutgoingMessage & {
7598
8537
  accountId?: string;
8538
+ }, opts?: {
8539
+ idempotencyKey?: string;
8540
+ dedupeWindowMs?: number;
7599
8541
  }): Promise<string | void>;
7600
8542
  /** List registered channel names. */
7601
8543
  getChannelNames(): string[];
@@ -7612,6 +8554,7 @@ declare class MessageRouter {
7612
8554
  * Stamps the key when false. Size-bounded GC avoids unbounded growth.
7613
8555
  */
7614
8556
  private isDuplicateMessage;
8557
+ private messageKey;
7615
8558
  /**
7616
8559
  * Phase 1 commit 6.b — record one router decision in the intent ledger
7617
8560
  * when the source is enabled (mode != "off"). Covers all router
@@ -7642,7 +8585,18 @@ declare class MessageRouter {
7642
8585
  * Works on Telegram (multi-account), WhatsApp (shared number), Discord.
7643
8586
  */
7644
8587
  private handleBotToBotChain;
8588
+ private sendDedupeKey;
8589
+ private sendDedupeGet;
8590
+ private sendDedupeStore;
7645
8591
  private adapterSend;
8592
+ /** Whether an agent may emit rich `agentx:ui` messages on this channel.
8593
+ * Gated by per-agent `richMessages` (default true) and restricted to the
8594
+ * interactive chat channels that render buttons/polls natively. */
8595
+ private richMessagesAllowed;
8596
+ /** Attach directive extras to a just-delivered reply: buttons onto the last
8597
+ * text message (edit reply_markup), poll + media as follow-up messages.
8598
+ * Best-effort — a failure here never breaks the text reply. */
8599
+ private attachUiExtras;
7646
8600
  private adapterEdit;
7647
8601
  private adapterReact;
7648
8602
  private startTypingLoop;
@@ -7697,6 +8651,7 @@ declare class TelegramAdapter implements ChannelAdapter {
7697
8651
  * or its token changes, so its pollLoop observes the stop and exits without
7698
8652
  * affecting siblings. Keyed by accountId. */
7699
8653
  private accountPolling;
8654
+ private accountVerifyRetryTimers;
7700
8655
  private log;
7701
8656
  /** Global allowlist fallback. When a per-account allowFrom is unset,
7702
8657
  * this list applies. When BOTH are unset, everything is rejected
@@ -7721,6 +8676,7 @@ declare class TelegramAdapter implements ChannelAdapter {
7721
8676
  * the bot's identity, then spawns the long-poll loop. No-op if the account
7722
8677
  * is already polling. */
7723
8678
  private startAccount;
8679
+ private scheduleVerifyRetry;
7724
8680
  /** Stop a single account's poll loop without touching siblings. Flips the
7725
8681
  * per-account gate and aborts the in-flight long-poll so Telegram releases
7726
8682
  * the server-side session immediately (otherwise a new start with the same
@@ -7771,6 +8727,12 @@ declare class TelegramAdapter implements ChannelAdapter {
7771
8727
  send(msg: OutgoingMessage & {
7772
8728
  accountId?: string;
7773
8729
  }): Promise<string>;
8730
+ /** Add/replace inline URL buttons on an existing message (editMessageReplyMarkup).
8731
+ * Used to attach an agentx:ui button row to a streamed reply. Best-effort. */
8732
+ setMessageButtons(chatId: string, messageId: string, buttons: Array<{
8733
+ label: string;
8734
+ url: string;
8735
+ }>, accountId?: string): Promise<boolean>;
7774
8736
  /** Best-effort outbound shadow log. Captures every successful send into
7775
8737
  * the same per-chat shadow file the inbound writer uses, so seedHistory
7776
8738
  * + agent introspection see a complete picture (which bot identity sent
@@ -7796,6 +8758,12 @@ declare class TelegramAdapter implements ChannelAdapter {
7796
8758
  accountId?: string;
7797
8759
  parseMode?: "markdown" | "html" | "plain";
7798
8760
  }): Promise<string>;
8761
+ /** Build a Telegram inline_keyboard reply_markup from URL buttons (one row
8762
+ * per button). Shared by sendWithInlineButtons and send()'s `buttons`. */
8763
+ private inlineKeyboardMarkup;
8764
+ /** Send a single (already chunk-sized) message with optional reply_markup,
8765
+ * with the standard HTML→plain parse-mode fallback. Returns message id. */
8766
+ private sendOneWithMarkup;
7799
8767
  /**
7800
8768
  * Edit an existing message (for streaming updates).
7801
8769
  */
@@ -8227,4 +9195,4 @@ declare function handleError(error: unknown): void;
8227
9195
  */
8228
9196
  declare function getPackageInfo(): PackageJson;
8229
9197
 
8230
- export { A2AClient, A2AMesh, A2AServer, A2AServerConfig, ALL_TOOL_NAMES, AgentCard, AgentConfig, AgentContext, AgentDef, AgentProvider, AgentRegistry, AgentResponse, AgentTask, AgentXDaemon, AgentXRuntime, AnthropicMessage, AuthConfig, AxisDef, AxisType, BLOCKING_EVENTS, ChannelAdapter, Classification, ClassificationSource, ClassificationStatus, ClaudeCodeProvider, ClaudeProvider, ContentBlock, ContextBuilder, CronJobDef, CronJobState, CronRunResult, CronScheduler, DaemonConfig, EnhanceConfig, EnhanceEngine, EnhanceResult, FingerprintEntry, GenerateOptions, GenerateResult, GenerateStreamEvent, GeneratedFile, GenerationMessage, GenerationResult, GitCommitResult, GitDiffFile, GitLogEntry, GitManager, GitStatus, GraphNode, GraphSchema, GraphStore, GraphStoreOptions, HOOK_EVENTS, HealConfig, HealEngine, HealResult, HookContext, HookDefinition, HookEvent, HookHandler, HookRegistry, HookResult, IncomingMessage, IndexFile, LevelDef, Memory, MemoryEntry, MemoryHierarchy, MemoryStore$1 as MemoryStore, MeshPeer, MessageRouter, MiddlewareFn, ModelUsage, NodesFile, OUTPUT_CONFIGS, OUTPUT_TYPES, OutgoingMessage, OutputConfig, OutputType, PERMISSION_MODES, PROVIDER_CAPABILITIES, PermissionAction, PermissionConfig, PermissionManager, PermissionMode, PermissionRule, Pipeline, PipelineRequest, PipelineResponse, ProjectSchemas, ProviderCapabilities, ProviderName, ProviderOptions, RawGenerationResult, ReplEngine, ReplOptions, RuntimeConfig, STARTER_SCHEMA, Session$1 as Session, StepUsage, StreamEvent, Task, TaskArtifact, TaskMessage, TaskState, TaskStatusUpdate, TechStack, TelegramAdapter, ToolCallInput, ToolExecutor, ToolExecutorOptions, ToolResult, UsageSummary, UsageTracker, WhatsAppAdapter, WikiAccess, WikiArticle, WikiArticleMeta, WikiEntry, WikiIndex, WikiStore, agentConfigSchema$1 as agentConfigSchema, checkCapabilities, createAgentContext, createProvider, createSession, daemonConfigSchema, debug, detectSchemas, detectTechStack, ensureCredentials, executeClaudeCode, executeOrchestrator, executeSdk, executeTask, exportSession, formatSchemas, formatTechStack, formatToolsForSystemPrompt, gatherContext7Docs, generate, generateSkill, generateSkillMd, generateStream, getAnthropicTools, getCommand, getLegacyTools, getPackageInfo, globalHooks, globalPermissions, globalTracker, handleError, installSkillPackage, isCommand, isDebug, listInstalledSkills, listSessions, loadAuthConfig, loadDaemonConfig, loadHooks, loadLatestSession, loadLocalSkills, loadProjectInstructions, loadSession, logger, matchSkillsToTask, outputTypeDescriptions, parseCommand, parseSkillContent, parseSkillFile, permissionConfigSchema, permissionModeSchema, registerCommand, resolveAtImports, resolveOutputType, resolveToken, runModelSetup, saveAuthConfig, saveSession, setDebug, startMcpServer, validateWorkspaces };
9198
+ export { A2AClient, A2AMesh, A2AServer, A2AServerConfig, ALL_TOOL_NAMES, AgentCard, AgentConfig, AgentContext, AgentDef, AgentProvider, AgentRegistry, AgentResponse, AgentTask, AgentXDaemon, AgentXRuntime, AnthropicMessage, AuthConfig, AxisDef, AxisType, BLOCKING_EVENTS, ChannelAdapter, Classification, ClassificationSource, ClassificationStatus, ClaudeCodeProvider, ClaudeProvider, ContentBlock, ContextBuilder, CronJobDef, CronJobState, CronRunResult, CronScheduler, DaemonConfig, EnhanceConfig, EnhanceEngine, EnhanceResult, FingerprintEntry, GenerateOptions, GenerateResult, GenerateStreamEvent, GeneratedFile, GenerationMessage, GenerationResult, GitCommitResult, GitDiffFile, GitLogEntry, GitManager, GitStatus, GraphNode, GraphSchema, GraphStore, GraphStoreOptions, HOOK_EVENTS, HealConfig, HealEngine, HealResult, HookContext, HookDefinition, HookEvent, HookHandler, HookRegistry, HookResult, IncomingMessage, IndexFile, LevelDef, Memory, MemoryEntry, MemoryHierarchy, MemoryStore$1 as MemoryStore, MeshPeer, MessageRouter, MiddlewareFn, ModelUsage, NodesFile, OUTPUT_CONFIGS, OUTPUT_TYPES, OutgoingMessage, OutputConfig, OutputType, PERMISSION_MODES, PROVIDER_CAPABILITIES, PermissionAction, PermissionConfig, PermissionManager, PermissionMode, PermissionRule, Pipeline, PipelineRequest, PipelineResponse, ProjectSchemas, ProviderCapabilities, ProviderName, ProviderOptions, RawGenerationResult, ReplEngine, ReplOptions, RuntimeConfig, STARTER_SCHEMA, Session$1 as Session, StepUsage, StreamEvent, Task, TaskArtifact, TaskMessage, TaskState, TaskStatusUpdate, TechStack, TelegramAdapter, ToolCallInput, ToolExecutor, ToolExecutorOptions, ToolResult, UsageSummary, UsageTracker, WhatsAppAdapter, WikiAccess, WikiArticle, WikiArticleMeta, WikiEntry, WikiIndex, WikiStore, agentConfigSchema$1 as agentConfigSchema, checkCapabilities, createAgentContext, createProvider, createSession, daemonConfigSchema, debug, detectSchemas, detectTechStack, ensureCredentials, executeClaudeCode, executeOpenCodeCli, executeOrchestrator, executeSdk, executeTask, exportSession, formatSchemas, formatTechStack, formatToolsForSystemPrompt, gatherContext7Docs, generate, generateSkill, generateSkillMd, generateStream, getAnthropicTools, getCommand, getLegacyTools, getPackageInfo, globalHooks, globalPermissions, globalTracker, handleError, installSkillPackage, isCommand, isDebug, listInstalledSkills, listSessions, loadAuthConfig, loadDaemonConfig, loadHooks, loadLatestSession, loadLocalSkills, loadProjectInstructions, loadSession, logger, matchSkillsToTask, outputTypeDescriptions, parseCommand, parseSkillContent, parseSkillFile, permissionConfigSchema, permissionModeSchema, registerCommand, resolveAtImports, resolveOutputType, resolveToken, runModelSetup, saveAuthConfig, saveSession, setDebug, startMcpServer, validateWorkspaces };