@ailu-ai/contracts 2.0.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 (142) hide show
  1. package/LICENSE +201 -0
  2. package/dist/admin.d.ts +99 -0
  3. package/dist/admin.d.ts.map +1 -0
  4. package/dist/admin.js +59 -0
  5. package/dist/admin.js.map +1 -0
  6. package/dist/admin.test.d.ts +2 -0
  7. package/dist/admin.test.d.ts.map +1 -0
  8. package/dist/admin.test.js +42 -0
  9. package/dist/admin.test.js.map +1 -0
  10. package/dist/approvals.d.ts +58 -0
  11. package/dist/approvals.d.ts.map +1 -0
  12. package/dist/approvals.js +28 -0
  13. package/dist/approvals.js.map +1 -0
  14. package/dist/artifacts.d.ts +22 -0
  15. package/dist/artifacts.d.ts.map +1 -0
  16. package/dist/artifacts.js +9 -0
  17. package/dist/artifacts.js.map +1 -0
  18. package/dist/catalog.d.ts +626 -0
  19. package/dist/catalog.d.ts.map +1 -0
  20. package/dist/catalog.js +69 -0
  21. package/dist/catalog.js.map +1 -0
  22. package/dist/catalog.test.d.ts +2 -0
  23. package/dist/catalog.test.d.ts.map +1 -0
  24. package/dist/catalog.test.js +98 -0
  25. package/dist/catalog.test.js.map +1 -0
  26. package/dist/compliance.d.ts +428 -0
  27. package/dist/compliance.d.ts.map +1 -0
  28. package/dist/compliance.js +80 -0
  29. package/dist/compliance.js.map +1 -0
  30. package/dist/connectors.d.ts +161 -0
  31. package/dist/connectors.d.ts.map +1 -0
  32. package/dist/connectors.js +49 -0
  33. package/dist/connectors.js.map +1 -0
  34. package/dist/error-envelope.d.ts +16 -0
  35. package/dist/error-envelope.d.ts.map +1 -0
  36. package/dist/error-envelope.js +7 -0
  37. package/dist/error-envelope.js.map +1 -0
  38. package/dist/eval.d.ts +144 -0
  39. package/dist/eval.d.ts.map +1 -0
  40. package/dist/eval.js +36 -0
  41. package/dist/eval.js.map +1 -0
  42. package/dist/events.d.ts +359 -0
  43. package/dist/events.d.ts.map +1 -0
  44. package/dist/events.js +134 -0
  45. package/dist/events.js.map +1 -0
  46. package/dist/fleet.d.ts +147 -0
  47. package/dist/fleet.d.ts.map +1 -0
  48. package/dist/fleet.js +34 -0
  49. package/dist/fleet.js.map +1 -0
  50. package/dist/fs-policy.d.ts +101 -0
  51. package/dist/fs-policy.d.ts.map +1 -0
  52. package/dist/fs-policy.js +36 -0
  53. package/dist/fs-policy.js.map +1 -0
  54. package/dist/fs-policy.test.d.ts +2 -0
  55. package/dist/fs-policy.test.d.ts.map +1 -0
  56. package/dist/fs-policy.test.js +35 -0
  57. package/dist/fs-policy.test.js.map +1 -0
  58. package/dist/fs.d.ts +182 -0
  59. package/dist/fs.d.ts.map +1 -0
  60. package/dist/fs.js +59 -0
  61. package/dist/fs.js.map +1 -0
  62. package/dist/fs.test.d.ts +2 -0
  63. package/dist/fs.test.d.ts.map +1 -0
  64. package/dist/fs.test.js +35 -0
  65. package/dist/fs.test.js.map +1 -0
  66. package/dist/graphs.d.ts +951 -0
  67. package/dist/graphs.d.ts.map +1 -0
  68. package/dist/graphs.js +94 -0
  69. package/dist/graphs.js.map +1 -0
  70. package/dist/graphs.test.d.ts +2 -0
  71. package/dist/graphs.test.d.ts.map +1 -0
  72. package/dist/graphs.test.js +65 -0
  73. package/dist/graphs.test.js.map +1 -0
  74. package/dist/index.d.ts +25 -0
  75. package/dist/index.d.ts.map +1 -0
  76. package/dist/index.js +25 -0
  77. package/dist/index.js.map +1 -0
  78. package/dist/index.test.d.ts +2 -0
  79. package/dist/index.test.d.ts.map +1 -0
  80. package/dist/index.test.js +9 -0
  81. package/dist/index.test.js.map +1 -0
  82. package/dist/knowledge.d.ts +315 -0
  83. package/dist/knowledge.d.ts.map +1 -0
  84. package/dist/knowledge.js +111 -0
  85. package/dist/knowledge.js.map +1 -0
  86. package/dist/knowledge.test.d.ts +2 -0
  87. package/dist/knowledge.test.d.ts.map +1 -0
  88. package/dist/knowledge.test.js +22 -0
  89. package/dist/knowledge.test.js.map +1 -0
  90. package/dist/node-metadata.d.ts +3096 -0
  91. package/dist/node-metadata.d.ts.map +1 -0
  92. package/dist/node-metadata.js +184 -0
  93. package/dist/node-metadata.js.map +1 -0
  94. package/dist/node-metadata.test.d.ts +2 -0
  95. package/dist/node-metadata.test.d.ts.map +1 -0
  96. package/dist/node-metadata.test.js +126 -0
  97. package/dist/node-metadata.test.js.map +1 -0
  98. package/dist/observability.d.ts +154 -0
  99. package/dist/observability.d.ts.map +1 -0
  100. package/dist/observability.js +34 -0
  101. package/dist/observability.js.map +1 -0
  102. package/dist/pii.d.ts +88 -0
  103. package/dist/pii.d.ts.map +1 -0
  104. package/dist/pii.js +42 -0
  105. package/dist/pii.js.map +1 -0
  106. package/dist/principal.d.ts +81 -0
  107. package/dist/principal.d.ts.map +1 -0
  108. package/dist/principal.js +48 -0
  109. package/dist/principal.js.map +1 -0
  110. package/dist/principal.test.d.ts +2 -0
  111. package/dist/principal.test.d.ts.map +1 -0
  112. package/dist/principal.test.js +44 -0
  113. package/dist/principal.test.js.map +1 -0
  114. package/dist/registries.d.ts +26 -0
  115. package/dist/registries.d.ts.map +1 -0
  116. package/dist/registries.js +11 -0
  117. package/dist/registries.js.map +1 -0
  118. package/dist/router.d.ts +48 -0
  119. package/dist/router.d.ts.map +1 -0
  120. package/dist/router.js +22 -0
  121. package/dist/router.js.map +1 -0
  122. package/dist/runs.d.ts +270 -0
  123. package/dist/runs.d.ts.map +1 -0
  124. package/dist/runs.js +108 -0
  125. package/dist/runs.js.map +1 -0
  126. package/dist/runs.test.d.ts +2 -0
  127. package/dist/runs.test.d.ts.map +1 -0
  128. package/dist/runs.test.js +79 -0
  129. package/dist/runs.test.js.map +1 -0
  130. package/dist/search.d.ts +88 -0
  131. package/dist/search.d.ts.map +1 -0
  132. package/dist/search.js +23 -0
  133. package/dist/search.js.map +1 -0
  134. package/dist/skills.d.ts +208 -0
  135. package/dist/skills.d.ts.map +1 -0
  136. package/dist/skills.js +63 -0
  137. package/dist/skills.js.map +1 -0
  138. package/dist/tenant.d.ts +204 -0
  139. package/dist/tenant.d.ts.map +1 -0
  140. package/dist/tenant.js +46 -0
  141. package/dist/tenant.js.map +1 -0
  142. package/package.json +33 -0
@@ -0,0 +1,3096 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * The SHARED CARRIER for catalog-backed graph nodes.
4
+ *
5
+ * A graph node that is a catalog COMPONENT carries `node.metadata.component =
6
+ * { kind, params }`; a catalog AGENT node carries `node.metadata.agent =
7
+ * { provider?, model?, tier?, system?, toolNames?, maxIterations?,
8
+ * suspendForApproval?, approvalToolNames?, outputChannel?, outputStyle?,
9
+ * contextBudget?, todosChannel?, enableFs?, resolvedMiddleware? }`.
10
+ *
11
+ * The graph editor EMITS these into `node.metadata`; the API run path READS
12
+ * `node.metadata` to assemble `EngineSpec.componentNodes` (kind + params) and
13
+ * `EngineSpec.agents` (the agent spec). Typing the carrier here keeps it
14
+ * end-to-end typed across the API ↔ Studio boundary even though the underlying
15
+ * `NodeDefinitionDto.metadata` stays an open `Record<string, unknown>`.
16
+ */
17
+ /** A catalog COMPONENT carrier: a `kind` plus its parameter bag. */
18
+ export declare const ComponentNodeMetadataSchema: z.ZodObject<{
19
+ /** One of `ComponentRegistry::kinds()` (e.g. "promptBuilder") or an integration name. */
20
+ kind: z.ZodString;
21
+ /** The component's parameter bag; validated by the native factory at assemble time. */
22
+ params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
23
+ }, "strip", z.ZodTypeAny, {
24
+ params: Record<string, unknown>;
25
+ kind: string;
26
+ }, {
27
+ params: Record<string, unknown>;
28
+ kind: string;
29
+ }>;
30
+ /** A catalog AGENT carrier: mirrors the engine `AgentSpec` (all fields optional in the editor). */
31
+ export declare const AgentNodeMetadataSchema: z.ZodObject<{
32
+ provider: z.ZodOptional<z.ZodString>;
33
+ model: z.ZodOptional<z.ZodString>;
34
+ tier: z.ZodOptional<z.ZodEnum<["frontier", "balanced", "fast", "creative"]>>;
35
+ /** A custom OpenAI-compatible endpoint (`model.openaiCompatible`) and the env var naming its key. */
36
+ baseURL: z.ZodOptional<z.ZodString>;
37
+ apiKeyEnv: z.ZodOptional<z.ZodString>;
38
+ system: z.ZodOptional<z.ZodString>;
39
+ toolNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
40
+ /** Each tool's description and input JSON Schema, as the LLM sees them. */
41
+ toolSpecs: z.ZodOptional<z.ZodArray<z.ZodObject<{
42
+ name: z.ZodString;
43
+ description: z.ZodOptional<z.ZodString>;
44
+ jsonSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
45
+ }, "strip", z.ZodTypeAny, {
46
+ name: string;
47
+ description?: string | undefined;
48
+ jsonSchema?: Record<string, unknown> | undefined;
49
+ }, {
50
+ name: string;
51
+ description?: string | undefined;
52
+ jsonSchema?: Record<string, unknown> | undefined;
53
+ }>, "many">>;
54
+ maxIterations: z.ZodOptional<z.ZodNumber>;
55
+ suspendForApproval: z.ZodOptional<z.ZodBoolean>;
56
+ approvalToolNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
57
+ outputChannel: z.ZodOptional<z.ZodString>;
58
+ /** ADR 0014 — terse output directive on the system prompt. */
59
+ outputStyle: z.ZodOptional<z.ZodLiteral<"terse">>;
60
+ /** ADR 0014 — cap (chars) on the agent's seed message (the injected `Input`/`State` dump). */
61
+ contextBudget: z.ZodOptional<z.ZodNumber>;
62
+ /** ADR 0022/0023 — durable channel the agent's `writeTodos` list is persisted into. */
63
+ todosChannel: z.ZodOptional<z.ZodString>;
64
+ /** ADR 0030 phase 9e — channel carrying the run's multimodal input blocks. */
65
+ inputBlocksChannel: z.ZodOptional<z.ZodString>;
66
+ /** The only channels the agent is shown in its seed state (context isolation). */
67
+ visibleChannels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
68
+ /** ADR 0026 phase 11 — governed long-term memory overlay (namespace tenant-scoped). */
69
+ memory: z.ZodOptional<z.ZodObject<{
70
+ namespace: z.ZodString;
71
+ topK: z.ZodOptional<z.ZodNumber>;
72
+ recall: z.ZodOptional<z.ZodEnum<["vector", "graph", "both"]>>;
73
+ }, "strip", z.ZodTypeAny, {
74
+ namespace: string;
75
+ topK?: number | undefined;
76
+ recall?: "vector" | "graph" | "both" | undefined;
77
+ }, {
78
+ namespace: string;
79
+ topK?: number | undefined;
80
+ recall?: "vector" | "graph" | "both" | undefined;
81
+ }>>;
82
+ /** ADR 0035 phase 12 — governed skills overlay (progressive disclosure; namespace tenant-scoped). */
83
+ skills: z.ZodOptional<z.ZodObject<{
84
+ namespace: z.ZodString;
85
+ /** Explicit `name@version` pins — the must-apply playbooks. */
86
+ required: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
87
+ /** Cap on advisory (vector-selected) skills. */
88
+ advisoryK: z.ZodOptional<z.ZodNumber>;
89
+ }, "strip", z.ZodTypeAny, {
90
+ namespace: string;
91
+ required?: string[] | undefined;
92
+ advisoryK?: number | undefined;
93
+ }, {
94
+ namespace: string;
95
+ required?: string[] | undefined;
96
+ advisoryK?: number | undefined;
97
+ }>>;
98
+ /** ADR 0024 phase 2c/2d — opt this agent into the governed virtual filesystem tools. */
99
+ enableFs: z.ZodOptional<z.ZodBoolean>;
100
+ /**
101
+ * ADR 0075 (issue #566 G3) — attach an external MCP server's tools to this agent, mid-run. The
102
+ * value references a tenant-owned `connector_connections` row (`provider: "mcp"`), resolved and
103
+ * connected at run start; every discovered tool is unconditionally `requiresApproval` (an MCP
104
+ * server is code Ailu does not control and cannot statically vet). Distinct from `toolNames`/
105
+ * `approvalToolNames` above — those are re-derived at run start to include the tools this
106
+ * connection discovers, since the tool set isn't known until the server is actually queried.
107
+ */
108
+ mcpConnectionId: z.ZodOptional<z.ZodString>;
109
+ /**
110
+ * Issue #566 G19 — attach one or more governed action-tool connectors to this agent, mid-run.
111
+ * Keyed by provider id (e.g. `"slack"`), value is a tenant-owned `connector_connections` row id.
112
+ * Same resolution shape as `mcpConnectionId` (control plane resolves the connection, discovers
113
+ * that provider's action tools, merges them into `toolNames`/`approvalToolNames` before the run
114
+ * reaches this carrier — the Rust engine never resolves a connection itself), generalized to a
115
+ * map so adding the NEXT provider (Linear, Salesforce, ...) never needs another engine field/
116
+ * release — only a new product-side adapter keyed into the same map.
117
+ */
118
+ actionConnections: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
119
+ /**
120
+ * ADR 0025 phase 3d — the resolved EFFICIENCY middleware list. A discriminated union of
121
+ * efficiency-only kinds (compress / terse / contextBudget): a GOVERNANCE kind (redact /
122
+ * approvalGate / fsPolicy) fails this schema BY CONSTRUCTION, so any consumer that runs it
123
+ * (e.g. `readAgentMetadata`) drops the malformed agent. This is a **type-level + validation
124
+ * guarantee** for callers that opt to validate; it is NOT auto-applied on the persisted
125
+ * catalog run path today (that path reads an unvalidated carrier — the RUNTIME enforcer
126
+ * there is the Rust bridge, whose match only honours efficiency kinds and ignores governance
127
+ * kinds). The SDK's `toRustAgentConfig` throw-gate covers the in-process builder path.
128
+ */
129
+ resolvedMiddleware: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
130
+ kind: z.ZodLiteral<"compress">;
131
+ }, "strip", z.ZodTypeAny, {
132
+ kind: "compress";
133
+ }, {
134
+ kind: "compress";
135
+ }>, z.ZodObject<{
136
+ kind: z.ZodLiteral<"terse">;
137
+ }, "strip", z.ZodTypeAny, {
138
+ kind: "terse";
139
+ }, {
140
+ kind: "terse";
141
+ }>, z.ZodObject<{
142
+ kind: z.ZodLiteral<"contextBudget">;
143
+ params: z.ZodObject<{
144
+ chars: z.ZodNumber;
145
+ }, "strip", z.ZodTypeAny, {
146
+ chars: number;
147
+ }, {
148
+ chars: number;
149
+ }>;
150
+ }, "strip", z.ZodTypeAny, {
151
+ params: {
152
+ chars: number;
153
+ };
154
+ kind: "contextBudget";
155
+ }, {
156
+ params: {
157
+ chars: number;
158
+ };
159
+ kind: "contextBudget";
160
+ }>, z.ZodObject<{
161
+ kind: z.ZodLiteral<"reflection">;
162
+ params: z.ZodOptional<z.ZodObject<{
163
+ threshold: z.ZodOptional<z.ZodNumber>;
164
+ }, "strip", z.ZodTypeAny, {
165
+ threshold?: number | undefined;
166
+ }, {
167
+ threshold?: number | undefined;
168
+ }>>;
169
+ }, "strip", z.ZodTypeAny, {
170
+ kind: "reflection";
171
+ params?: {
172
+ threshold?: number | undefined;
173
+ } | undefined;
174
+ }, {
175
+ kind: "reflection";
176
+ params?: {
177
+ threshold?: number | undefined;
178
+ } | undefined;
179
+ }>, z.ZodObject<{
180
+ kind: z.ZodLiteral<"structuredOutput">;
181
+ params: z.ZodObject<{
182
+ schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
183
+ name: z.ZodOptional<z.ZodString>;
184
+ strict: z.ZodOptional<z.ZodBoolean>;
185
+ mode: z.ZodOptional<z.ZodEnum<["required", "lenient"]>>;
186
+ retryCap: z.ZodOptional<z.ZodNumber>;
187
+ }, "strip", z.ZodTypeAny, {
188
+ schema: Record<string, unknown>;
189
+ strict?: boolean | undefined;
190
+ name?: string | undefined;
191
+ mode?: "required" | "lenient" | undefined;
192
+ retryCap?: number | undefined;
193
+ }, {
194
+ schema: Record<string, unknown>;
195
+ strict?: boolean | undefined;
196
+ name?: string | undefined;
197
+ mode?: "required" | "lenient" | undefined;
198
+ retryCap?: number | undefined;
199
+ }>;
200
+ }, "strip", z.ZodTypeAny, {
201
+ params: {
202
+ schema: Record<string, unknown>;
203
+ strict?: boolean | undefined;
204
+ name?: string | undefined;
205
+ mode?: "required" | "lenient" | undefined;
206
+ retryCap?: number | undefined;
207
+ };
208
+ kind: "structuredOutput";
209
+ }, {
210
+ params: {
211
+ schema: Record<string, unknown>;
212
+ strict?: boolean | undefined;
213
+ name?: string | undefined;
214
+ mode?: "required" | "lenient" | undefined;
215
+ retryCap?: number | undefined;
216
+ };
217
+ kind: "structuredOutput";
218
+ }>]>, "many">>;
219
+ }, "strip", z.ZodTypeAny, {
220
+ provider?: string | undefined;
221
+ tier?: "frontier" | "balanced" | "fast" | "creative" | undefined;
222
+ suspendForApproval?: boolean | undefined;
223
+ outputChannel?: string | undefined;
224
+ model?: string | undefined;
225
+ baseURL?: string | undefined;
226
+ apiKeyEnv?: string | undefined;
227
+ system?: string | undefined;
228
+ toolNames?: string[] | undefined;
229
+ toolSpecs?: {
230
+ name: string;
231
+ description?: string | undefined;
232
+ jsonSchema?: Record<string, unknown> | undefined;
233
+ }[] | undefined;
234
+ maxIterations?: number | undefined;
235
+ approvalToolNames?: string[] | undefined;
236
+ outputStyle?: "terse" | undefined;
237
+ contextBudget?: number | undefined;
238
+ todosChannel?: string | undefined;
239
+ inputBlocksChannel?: string | undefined;
240
+ visibleChannels?: string[] | undefined;
241
+ memory?: {
242
+ namespace: string;
243
+ topK?: number | undefined;
244
+ recall?: "vector" | "graph" | "both" | undefined;
245
+ } | undefined;
246
+ skills?: {
247
+ namespace: string;
248
+ required?: string[] | undefined;
249
+ advisoryK?: number | undefined;
250
+ } | undefined;
251
+ enableFs?: boolean | undefined;
252
+ mcpConnectionId?: string | undefined;
253
+ actionConnections?: Record<string, string> | undefined;
254
+ resolvedMiddleware?: ({
255
+ kind: "compress";
256
+ } | {
257
+ kind: "terse";
258
+ } | {
259
+ params: {
260
+ chars: number;
261
+ };
262
+ kind: "contextBudget";
263
+ } | {
264
+ kind: "reflection";
265
+ params?: {
266
+ threshold?: number | undefined;
267
+ } | undefined;
268
+ } | {
269
+ params: {
270
+ schema: Record<string, unknown>;
271
+ strict?: boolean | undefined;
272
+ name?: string | undefined;
273
+ mode?: "required" | "lenient" | undefined;
274
+ retryCap?: number | undefined;
275
+ };
276
+ kind: "structuredOutput";
277
+ })[] | undefined;
278
+ }, {
279
+ provider?: string | undefined;
280
+ tier?: "frontier" | "balanced" | "fast" | "creative" | undefined;
281
+ suspendForApproval?: boolean | undefined;
282
+ outputChannel?: string | undefined;
283
+ model?: string | undefined;
284
+ baseURL?: string | undefined;
285
+ apiKeyEnv?: string | undefined;
286
+ system?: string | undefined;
287
+ toolNames?: string[] | undefined;
288
+ toolSpecs?: {
289
+ name: string;
290
+ description?: string | undefined;
291
+ jsonSchema?: Record<string, unknown> | undefined;
292
+ }[] | undefined;
293
+ maxIterations?: number | undefined;
294
+ approvalToolNames?: string[] | undefined;
295
+ outputStyle?: "terse" | undefined;
296
+ contextBudget?: number | undefined;
297
+ todosChannel?: string | undefined;
298
+ inputBlocksChannel?: string | undefined;
299
+ visibleChannels?: string[] | undefined;
300
+ memory?: {
301
+ namespace: string;
302
+ topK?: number | undefined;
303
+ recall?: "vector" | "graph" | "both" | undefined;
304
+ } | undefined;
305
+ skills?: {
306
+ namespace: string;
307
+ required?: string[] | undefined;
308
+ advisoryK?: number | undefined;
309
+ } | undefined;
310
+ enableFs?: boolean | undefined;
311
+ mcpConnectionId?: string | undefined;
312
+ actionConnections?: Record<string, string> | undefined;
313
+ resolvedMiddleware?: ({
314
+ kind: "compress";
315
+ } | {
316
+ kind: "terse";
317
+ } | {
318
+ params: {
319
+ chars: number;
320
+ };
321
+ kind: "contextBudget";
322
+ } | {
323
+ kind: "reflection";
324
+ params?: {
325
+ threshold?: number | undefined;
326
+ } | undefined;
327
+ } | {
328
+ params: {
329
+ schema: Record<string, unknown>;
330
+ strict?: boolean | undefined;
331
+ name?: string | undefined;
332
+ mode?: "required" | "lenient" | undefined;
333
+ retryCap?: number | undefined;
334
+ };
335
+ kind: "structuredOutput";
336
+ })[] | undefined;
337
+ }>;
338
+ /**
339
+ * A catalog MAP-AGENTS carrier (ADR 0027 phase 4b — dynamic fan-out): run `subAgent` once per item
340
+ * in the `overChannel` array and collect the per-item results (in input order) into `joinAt`. The
341
+ * sub-agent is itself an agent carrier (same shape as a plain agent node → deepagents parity: skills,
342
+ * memory, fs, planning all apply to each spawn). Mirrors the engine `MapAgentSpec`.
343
+ */
344
+ export declare const MapAgentNodeMetadataSchema: z.ZodObject<{
345
+ /** Channel holding the array of items to fan the sub-agent out over. */
346
+ overChannel: z.ZodString;
347
+ /** Channel the array of per-item results lands in (one entry per item, in input order). */
348
+ joinAt: z.ZodString;
349
+ /** The sub-agent run per item — a full agent carrier. */
350
+ subAgent: z.ZodObject<{
351
+ provider: z.ZodOptional<z.ZodString>;
352
+ model: z.ZodOptional<z.ZodString>;
353
+ tier: z.ZodOptional<z.ZodEnum<["frontier", "balanced", "fast", "creative"]>>;
354
+ /** A custom OpenAI-compatible endpoint (`model.openaiCompatible`) and the env var naming its key. */
355
+ baseURL: z.ZodOptional<z.ZodString>;
356
+ apiKeyEnv: z.ZodOptional<z.ZodString>;
357
+ system: z.ZodOptional<z.ZodString>;
358
+ toolNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
359
+ /** Each tool's description and input JSON Schema, as the LLM sees them. */
360
+ toolSpecs: z.ZodOptional<z.ZodArray<z.ZodObject<{
361
+ name: z.ZodString;
362
+ description: z.ZodOptional<z.ZodString>;
363
+ jsonSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
364
+ }, "strip", z.ZodTypeAny, {
365
+ name: string;
366
+ description?: string | undefined;
367
+ jsonSchema?: Record<string, unknown> | undefined;
368
+ }, {
369
+ name: string;
370
+ description?: string | undefined;
371
+ jsonSchema?: Record<string, unknown> | undefined;
372
+ }>, "many">>;
373
+ maxIterations: z.ZodOptional<z.ZodNumber>;
374
+ suspendForApproval: z.ZodOptional<z.ZodBoolean>;
375
+ approvalToolNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
376
+ outputChannel: z.ZodOptional<z.ZodString>;
377
+ /** ADR 0014 — terse output directive on the system prompt. */
378
+ outputStyle: z.ZodOptional<z.ZodLiteral<"terse">>;
379
+ /** ADR 0014 — cap (chars) on the agent's seed message (the injected `Input`/`State` dump). */
380
+ contextBudget: z.ZodOptional<z.ZodNumber>;
381
+ /** ADR 0022/0023 — durable channel the agent's `writeTodos` list is persisted into. */
382
+ todosChannel: z.ZodOptional<z.ZodString>;
383
+ /** ADR 0030 phase 9e — channel carrying the run's multimodal input blocks. */
384
+ inputBlocksChannel: z.ZodOptional<z.ZodString>;
385
+ /** The only channels the agent is shown in its seed state (context isolation). */
386
+ visibleChannels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
387
+ /** ADR 0026 phase 11 — governed long-term memory overlay (namespace tenant-scoped). */
388
+ memory: z.ZodOptional<z.ZodObject<{
389
+ namespace: z.ZodString;
390
+ topK: z.ZodOptional<z.ZodNumber>;
391
+ recall: z.ZodOptional<z.ZodEnum<["vector", "graph", "both"]>>;
392
+ }, "strip", z.ZodTypeAny, {
393
+ namespace: string;
394
+ topK?: number | undefined;
395
+ recall?: "vector" | "graph" | "both" | undefined;
396
+ }, {
397
+ namespace: string;
398
+ topK?: number | undefined;
399
+ recall?: "vector" | "graph" | "both" | undefined;
400
+ }>>;
401
+ /** ADR 0035 phase 12 — governed skills overlay (progressive disclosure; namespace tenant-scoped). */
402
+ skills: z.ZodOptional<z.ZodObject<{
403
+ namespace: z.ZodString;
404
+ /** Explicit `name@version` pins — the must-apply playbooks. */
405
+ required: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
406
+ /** Cap on advisory (vector-selected) skills. */
407
+ advisoryK: z.ZodOptional<z.ZodNumber>;
408
+ }, "strip", z.ZodTypeAny, {
409
+ namespace: string;
410
+ required?: string[] | undefined;
411
+ advisoryK?: number | undefined;
412
+ }, {
413
+ namespace: string;
414
+ required?: string[] | undefined;
415
+ advisoryK?: number | undefined;
416
+ }>>;
417
+ /** ADR 0024 phase 2c/2d — opt this agent into the governed virtual filesystem tools. */
418
+ enableFs: z.ZodOptional<z.ZodBoolean>;
419
+ /**
420
+ * ADR 0075 (issue #566 G3) — attach an external MCP server's tools to this agent, mid-run. The
421
+ * value references a tenant-owned `connector_connections` row (`provider: "mcp"`), resolved and
422
+ * connected at run start; every discovered tool is unconditionally `requiresApproval` (an MCP
423
+ * server is code Ailu does not control and cannot statically vet). Distinct from `toolNames`/
424
+ * `approvalToolNames` above — those are re-derived at run start to include the tools this
425
+ * connection discovers, since the tool set isn't known until the server is actually queried.
426
+ */
427
+ mcpConnectionId: z.ZodOptional<z.ZodString>;
428
+ /**
429
+ * Issue #566 G19 — attach one or more governed action-tool connectors to this agent, mid-run.
430
+ * Keyed by provider id (e.g. `"slack"`), value is a tenant-owned `connector_connections` row id.
431
+ * Same resolution shape as `mcpConnectionId` (control plane resolves the connection, discovers
432
+ * that provider's action tools, merges them into `toolNames`/`approvalToolNames` before the run
433
+ * reaches this carrier — the Rust engine never resolves a connection itself), generalized to a
434
+ * map so adding the NEXT provider (Linear, Salesforce, ...) never needs another engine field/
435
+ * release — only a new product-side adapter keyed into the same map.
436
+ */
437
+ actionConnections: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
438
+ /**
439
+ * ADR 0025 phase 3d — the resolved EFFICIENCY middleware list. A discriminated union of
440
+ * efficiency-only kinds (compress / terse / contextBudget): a GOVERNANCE kind (redact /
441
+ * approvalGate / fsPolicy) fails this schema BY CONSTRUCTION, so any consumer that runs it
442
+ * (e.g. `readAgentMetadata`) drops the malformed agent. This is a **type-level + validation
443
+ * guarantee** for callers that opt to validate; it is NOT auto-applied on the persisted
444
+ * catalog run path today (that path reads an unvalidated carrier — the RUNTIME enforcer
445
+ * there is the Rust bridge, whose match only honours efficiency kinds and ignores governance
446
+ * kinds). The SDK's `toRustAgentConfig` throw-gate covers the in-process builder path.
447
+ */
448
+ resolvedMiddleware: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
449
+ kind: z.ZodLiteral<"compress">;
450
+ }, "strip", z.ZodTypeAny, {
451
+ kind: "compress";
452
+ }, {
453
+ kind: "compress";
454
+ }>, z.ZodObject<{
455
+ kind: z.ZodLiteral<"terse">;
456
+ }, "strip", z.ZodTypeAny, {
457
+ kind: "terse";
458
+ }, {
459
+ kind: "terse";
460
+ }>, z.ZodObject<{
461
+ kind: z.ZodLiteral<"contextBudget">;
462
+ params: z.ZodObject<{
463
+ chars: z.ZodNumber;
464
+ }, "strip", z.ZodTypeAny, {
465
+ chars: number;
466
+ }, {
467
+ chars: number;
468
+ }>;
469
+ }, "strip", z.ZodTypeAny, {
470
+ params: {
471
+ chars: number;
472
+ };
473
+ kind: "contextBudget";
474
+ }, {
475
+ params: {
476
+ chars: number;
477
+ };
478
+ kind: "contextBudget";
479
+ }>, z.ZodObject<{
480
+ kind: z.ZodLiteral<"reflection">;
481
+ params: z.ZodOptional<z.ZodObject<{
482
+ threshold: z.ZodOptional<z.ZodNumber>;
483
+ }, "strip", z.ZodTypeAny, {
484
+ threshold?: number | undefined;
485
+ }, {
486
+ threshold?: number | undefined;
487
+ }>>;
488
+ }, "strip", z.ZodTypeAny, {
489
+ kind: "reflection";
490
+ params?: {
491
+ threshold?: number | undefined;
492
+ } | undefined;
493
+ }, {
494
+ kind: "reflection";
495
+ params?: {
496
+ threshold?: number | undefined;
497
+ } | undefined;
498
+ }>, z.ZodObject<{
499
+ kind: z.ZodLiteral<"structuredOutput">;
500
+ params: z.ZodObject<{
501
+ schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
502
+ name: z.ZodOptional<z.ZodString>;
503
+ strict: z.ZodOptional<z.ZodBoolean>;
504
+ mode: z.ZodOptional<z.ZodEnum<["required", "lenient"]>>;
505
+ retryCap: z.ZodOptional<z.ZodNumber>;
506
+ }, "strip", z.ZodTypeAny, {
507
+ schema: Record<string, unknown>;
508
+ strict?: boolean | undefined;
509
+ name?: string | undefined;
510
+ mode?: "required" | "lenient" | undefined;
511
+ retryCap?: number | undefined;
512
+ }, {
513
+ schema: Record<string, unknown>;
514
+ strict?: boolean | undefined;
515
+ name?: string | undefined;
516
+ mode?: "required" | "lenient" | undefined;
517
+ retryCap?: number | undefined;
518
+ }>;
519
+ }, "strip", z.ZodTypeAny, {
520
+ params: {
521
+ schema: Record<string, unknown>;
522
+ strict?: boolean | undefined;
523
+ name?: string | undefined;
524
+ mode?: "required" | "lenient" | undefined;
525
+ retryCap?: number | undefined;
526
+ };
527
+ kind: "structuredOutput";
528
+ }, {
529
+ params: {
530
+ schema: Record<string, unknown>;
531
+ strict?: boolean | undefined;
532
+ name?: string | undefined;
533
+ mode?: "required" | "lenient" | undefined;
534
+ retryCap?: number | undefined;
535
+ };
536
+ kind: "structuredOutput";
537
+ }>]>, "many">>;
538
+ }, "strip", z.ZodTypeAny, {
539
+ provider?: string | undefined;
540
+ tier?: "frontier" | "balanced" | "fast" | "creative" | undefined;
541
+ suspendForApproval?: boolean | undefined;
542
+ outputChannel?: string | undefined;
543
+ model?: string | undefined;
544
+ baseURL?: string | undefined;
545
+ apiKeyEnv?: string | undefined;
546
+ system?: string | undefined;
547
+ toolNames?: string[] | undefined;
548
+ toolSpecs?: {
549
+ name: string;
550
+ description?: string | undefined;
551
+ jsonSchema?: Record<string, unknown> | undefined;
552
+ }[] | undefined;
553
+ maxIterations?: number | undefined;
554
+ approvalToolNames?: string[] | undefined;
555
+ outputStyle?: "terse" | undefined;
556
+ contextBudget?: number | undefined;
557
+ todosChannel?: string | undefined;
558
+ inputBlocksChannel?: string | undefined;
559
+ visibleChannels?: string[] | undefined;
560
+ memory?: {
561
+ namespace: string;
562
+ topK?: number | undefined;
563
+ recall?: "vector" | "graph" | "both" | undefined;
564
+ } | undefined;
565
+ skills?: {
566
+ namespace: string;
567
+ required?: string[] | undefined;
568
+ advisoryK?: number | undefined;
569
+ } | undefined;
570
+ enableFs?: boolean | undefined;
571
+ mcpConnectionId?: string | undefined;
572
+ actionConnections?: Record<string, string> | undefined;
573
+ resolvedMiddleware?: ({
574
+ kind: "compress";
575
+ } | {
576
+ kind: "terse";
577
+ } | {
578
+ params: {
579
+ chars: number;
580
+ };
581
+ kind: "contextBudget";
582
+ } | {
583
+ kind: "reflection";
584
+ params?: {
585
+ threshold?: number | undefined;
586
+ } | undefined;
587
+ } | {
588
+ params: {
589
+ schema: Record<string, unknown>;
590
+ strict?: boolean | undefined;
591
+ name?: string | undefined;
592
+ mode?: "required" | "lenient" | undefined;
593
+ retryCap?: number | undefined;
594
+ };
595
+ kind: "structuredOutput";
596
+ })[] | undefined;
597
+ }, {
598
+ provider?: string | undefined;
599
+ tier?: "frontier" | "balanced" | "fast" | "creative" | undefined;
600
+ suspendForApproval?: boolean | undefined;
601
+ outputChannel?: string | undefined;
602
+ model?: string | undefined;
603
+ baseURL?: string | undefined;
604
+ apiKeyEnv?: string | undefined;
605
+ system?: string | undefined;
606
+ toolNames?: string[] | undefined;
607
+ toolSpecs?: {
608
+ name: string;
609
+ description?: string | undefined;
610
+ jsonSchema?: Record<string, unknown> | undefined;
611
+ }[] | undefined;
612
+ maxIterations?: number | undefined;
613
+ approvalToolNames?: string[] | undefined;
614
+ outputStyle?: "terse" | undefined;
615
+ contextBudget?: number | undefined;
616
+ todosChannel?: string | undefined;
617
+ inputBlocksChannel?: string | undefined;
618
+ visibleChannels?: string[] | undefined;
619
+ memory?: {
620
+ namespace: string;
621
+ topK?: number | undefined;
622
+ recall?: "vector" | "graph" | "both" | undefined;
623
+ } | undefined;
624
+ skills?: {
625
+ namespace: string;
626
+ required?: string[] | undefined;
627
+ advisoryK?: number | undefined;
628
+ } | undefined;
629
+ enableFs?: boolean | undefined;
630
+ mcpConnectionId?: string | undefined;
631
+ actionConnections?: Record<string, string> | undefined;
632
+ resolvedMiddleware?: ({
633
+ kind: "compress";
634
+ } | {
635
+ kind: "terse";
636
+ } | {
637
+ params: {
638
+ chars: number;
639
+ };
640
+ kind: "contextBudget";
641
+ } | {
642
+ kind: "reflection";
643
+ params?: {
644
+ threshold?: number | undefined;
645
+ } | undefined;
646
+ } | {
647
+ params: {
648
+ schema: Record<string, unknown>;
649
+ strict?: boolean | undefined;
650
+ name?: string | undefined;
651
+ mode?: "required" | "lenient" | undefined;
652
+ retryCap?: number | undefined;
653
+ };
654
+ kind: "structuredOutput";
655
+ })[] | undefined;
656
+ }>;
657
+ /** When true, a spawn that needs approval suspends the whole map (default false). */
658
+ suspendForApproval: z.ZodOptional<z.ZodBoolean>;
659
+ }, "strip", z.ZodTypeAny, {
660
+ joinAt: string;
661
+ overChannel: string;
662
+ subAgent: {
663
+ provider?: string | undefined;
664
+ tier?: "frontier" | "balanced" | "fast" | "creative" | undefined;
665
+ suspendForApproval?: boolean | undefined;
666
+ outputChannel?: string | undefined;
667
+ model?: string | undefined;
668
+ baseURL?: string | undefined;
669
+ apiKeyEnv?: string | undefined;
670
+ system?: string | undefined;
671
+ toolNames?: string[] | undefined;
672
+ toolSpecs?: {
673
+ name: string;
674
+ description?: string | undefined;
675
+ jsonSchema?: Record<string, unknown> | undefined;
676
+ }[] | undefined;
677
+ maxIterations?: number | undefined;
678
+ approvalToolNames?: string[] | undefined;
679
+ outputStyle?: "terse" | undefined;
680
+ contextBudget?: number | undefined;
681
+ todosChannel?: string | undefined;
682
+ inputBlocksChannel?: string | undefined;
683
+ visibleChannels?: string[] | undefined;
684
+ memory?: {
685
+ namespace: string;
686
+ topK?: number | undefined;
687
+ recall?: "vector" | "graph" | "both" | undefined;
688
+ } | undefined;
689
+ skills?: {
690
+ namespace: string;
691
+ required?: string[] | undefined;
692
+ advisoryK?: number | undefined;
693
+ } | undefined;
694
+ enableFs?: boolean | undefined;
695
+ mcpConnectionId?: string | undefined;
696
+ actionConnections?: Record<string, string> | undefined;
697
+ resolvedMiddleware?: ({
698
+ kind: "compress";
699
+ } | {
700
+ kind: "terse";
701
+ } | {
702
+ params: {
703
+ chars: number;
704
+ };
705
+ kind: "contextBudget";
706
+ } | {
707
+ kind: "reflection";
708
+ params?: {
709
+ threshold?: number | undefined;
710
+ } | undefined;
711
+ } | {
712
+ params: {
713
+ schema: Record<string, unknown>;
714
+ strict?: boolean | undefined;
715
+ name?: string | undefined;
716
+ mode?: "required" | "lenient" | undefined;
717
+ retryCap?: number | undefined;
718
+ };
719
+ kind: "structuredOutput";
720
+ })[] | undefined;
721
+ };
722
+ suspendForApproval?: boolean | undefined;
723
+ }, {
724
+ joinAt: string;
725
+ overChannel: string;
726
+ subAgent: {
727
+ provider?: string | undefined;
728
+ tier?: "frontier" | "balanced" | "fast" | "creative" | undefined;
729
+ suspendForApproval?: boolean | undefined;
730
+ outputChannel?: string | undefined;
731
+ model?: string | undefined;
732
+ baseURL?: string | undefined;
733
+ apiKeyEnv?: string | undefined;
734
+ system?: string | undefined;
735
+ toolNames?: string[] | undefined;
736
+ toolSpecs?: {
737
+ name: string;
738
+ description?: string | undefined;
739
+ jsonSchema?: Record<string, unknown> | undefined;
740
+ }[] | undefined;
741
+ maxIterations?: number | undefined;
742
+ approvalToolNames?: string[] | undefined;
743
+ outputStyle?: "terse" | undefined;
744
+ contextBudget?: number | undefined;
745
+ todosChannel?: string | undefined;
746
+ inputBlocksChannel?: string | undefined;
747
+ visibleChannels?: string[] | undefined;
748
+ memory?: {
749
+ namespace: string;
750
+ topK?: number | undefined;
751
+ recall?: "vector" | "graph" | "both" | undefined;
752
+ } | undefined;
753
+ skills?: {
754
+ namespace: string;
755
+ required?: string[] | undefined;
756
+ advisoryK?: number | undefined;
757
+ } | undefined;
758
+ enableFs?: boolean | undefined;
759
+ mcpConnectionId?: string | undefined;
760
+ actionConnections?: Record<string, string> | undefined;
761
+ resolvedMiddleware?: ({
762
+ kind: "compress";
763
+ } | {
764
+ kind: "terse";
765
+ } | {
766
+ params: {
767
+ chars: number;
768
+ };
769
+ kind: "contextBudget";
770
+ } | {
771
+ kind: "reflection";
772
+ params?: {
773
+ threshold?: number | undefined;
774
+ } | undefined;
775
+ } | {
776
+ params: {
777
+ schema: Record<string, unknown>;
778
+ strict?: boolean | undefined;
779
+ name?: string | undefined;
780
+ mode?: "required" | "lenient" | undefined;
781
+ retryCap?: number | undefined;
782
+ };
783
+ kind: "structuredOutput";
784
+ })[] | undefined;
785
+ };
786
+ suspendForApproval?: boolean | undefined;
787
+ }>;
788
+ /**
789
+ * The slice of `node.metadata` the catalog carrier owns. All keys are optional;
790
+ * a node carries at most one (a component OR an agent OR a mapAgents fan-out).
791
+ * Other metadata keys are untouched.
792
+ */
793
+ export declare const CatalogNodeMetadataSchema: z.ZodObject<{
794
+ component: z.ZodOptional<z.ZodObject<{
795
+ /** One of `ComponentRegistry::kinds()` (e.g. "promptBuilder") or an integration name. */
796
+ kind: z.ZodString;
797
+ /** The component's parameter bag; validated by the native factory at assemble time. */
798
+ params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
799
+ }, "strip", z.ZodTypeAny, {
800
+ params: Record<string, unknown>;
801
+ kind: string;
802
+ }, {
803
+ params: Record<string, unknown>;
804
+ kind: string;
805
+ }>>;
806
+ agent: z.ZodOptional<z.ZodObject<{
807
+ provider: z.ZodOptional<z.ZodString>;
808
+ model: z.ZodOptional<z.ZodString>;
809
+ tier: z.ZodOptional<z.ZodEnum<["frontier", "balanced", "fast", "creative"]>>;
810
+ /** A custom OpenAI-compatible endpoint (`model.openaiCompatible`) and the env var naming its key. */
811
+ baseURL: z.ZodOptional<z.ZodString>;
812
+ apiKeyEnv: z.ZodOptional<z.ZodString>;
813
+ system: z.ZodOptional<z.ZodString>;
814
+ toolNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
815
+ /** Each tool's description and input JSON Schema, as the LLM sees them. */
816
+ toolSpecs: z.ZodOptional<z.ZodArray<z.ZodObject<{
817
+ name: z.ZodString;
818
+ description: z.ZodOptional<z.ZodString>;
819
+ jsonSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
820
+ }, "strip", z.ZodTypeAny, {
821
+ name: string;
822
+ description?: string | undefined;
823
+ jsonSchema?: Record<string, unknown> | undefined;
824
+ }, {
825
+ name: string;
826
+ description?: string | undefined;
827
+ jsonSchema?: Record<string, unknown> | undefined;
828
+ }>, "many">>;
829
+ maxIterations: z.ZodOptional<z.ZodNumber>;
830
+ suspendForApproval: z.ZodOptional<z.ZodBoolean>;
831
+ approvalToolNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
832
+ outputChannel: z.ZodOptional<z.ZodString>;
833
+ /** ADR 0014 — terse output directive on the system prompt. */
834
+ outputStyle: z.ZodOptional<z.ZodLiteral<"terse">>;
835
+ /** ADR 0014 — cap (chars) on the agent's seed message (the injected `Input`/`State` dump). */
836
+ contextBudget: z.ZodOptional<z.ZodNumber>;
837
+ /** ADR 0022/0023 — durable channel the agent's `writeTodos` list is persisted into. */
838
+ todosChannel: z.ZodOptional<z.ZodString>;
839
+ /** ADR 0030 phase 9e — channel carrying the run's multimodal input blocks. */
840
+ inputBlocksChannel: z.ZodOptional<z.ZodString>;
841
+ /** The only channels the agent is shown in its seed state (context isolation). */
842
+ visibleChannels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
843
+ /** ADR 0026 phase 11 — governed long-term memory overlay (namespace tenant-scoped). */
844
+ memory: z.ZodOptional<z.ZodObject<{
845
+ namespace: z.ZodString;
846
+ topK: z.ZodOptional<z.ZodNumber>;
847
+ recall: z.ZodOptional<z.ZodEnum<["vector", "graph", "both"]>>;
848
+ }, "strip", z.ZodTypeAny, {
849
+ namespace: string;
850
+ topK?: number | undefined;
851
+ recall?: "vector" | "graph" | "both" | undefined;
852
+ }, {
853
+ namespace: string;
854
+ topK?: number | undefined;
855
+ recall?: "vector" | "graph" | "both" | undefined;
856
+ }>>;
857
+ /** ADR 0035 phase 12 — governed skills overlay (progressive disclosure; namespace tenant-scoped). */
858
+ skills: z.ZodOptional<z.ZodObject<{
859
+ namespace: z.ZodString;
860
+ /** Explicit `name@version` pins — the must-apply playbooks. */
861
+ required: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
862
+ /** Cap on advisory (vector-selected) skills. */
863
+ advisoryK: z.ZodOptional<z.ZodNumber>;
864
+ }, "strip", z.ZodTypeAny, {
865
+ namespace: string;
866
+ required?: string[] | undefined;
867
+ advisoryK?: number | undefined;
868
+ }, {
869
+ namespace: string;
870
+ required?: string[] | undefined;
871
+ advisoryK?: number | undefined;
872
+ }>>;
873
+ /** ADR 0024 phase 2c/2d — opt this agent into the governed virtual filesystem tools. */
874
+ enableFs: z.ZodOptional<z.ZodBoolean>;
875
+ /**
876
+ * ADR 0075 (issue #566 G3) — attach an external MCP server's tools to this agent, mid-run. The
877
+ * value references a tenant-owned `connector_connections` row (`provider: "mcp"`), resolved and
878
+ * connected at run start; every discovered tool is unconditionally `requiresApproval` (an MCP
879
+ * server is code Ailu does not control and cannot statically vet). Distinct from `toolNames`/
880
+ * `approvalToolNames` above — those are re-derived at run start to include the tools this
881
+ * connection discovers, since the tool set isn't known until the server is actually queried.
882
+ */
883
+ mcpConnectionId: z.ZodOptional<z.ZodString>;
884
+ /**
885
+ * Issue #566 G19 — attach one or more governed action-tool connectors to this agent, mid-run.
886
+ * Keyed by provider id (e.g. `"slack"`), value is a tenant-owned `connector_connections` row id.
887
+ * Same resolution shape as `mcpConnectionId` (control plane resolves the connection, discovers
888
+ * that provider's action tools, merges them into `toolNames`/`approvalToolNames` before the run
889
+ * reaches this carrier — the Rust engine never resolves a connection itself), generalized to a
890
+ * map so adding the NEXT provider (Linear, Salesforce, ...) never needs another engine field/
891
+ * release — only a new product-side adapter keyed into the same map.
892
+ */
893
+ actionConnections: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
894
+ /**
895
+ * ADR 0025 phase 3d — the resolved EFFICIENCY middleware list. A discriminated union of
896
+ * efficiency-only kinds (compress / terse / contextBudget): a GOVERNANCE kind (redact /
897
+ * approvalGate / fsPolicy) fails this schema BY CONSTRUCTION, so any consumer that runs it
898
+ * (e.g. `readAgentMetadata`) drops the malformed agent. This is a **type-level + validation
899
+ * guarantee** for callers that opt to validate; it is NOT auto-applied on the persisted
900
+ * catalog run path today (that path reads an unvalidated carrier — the RUNTIME enforcer
901
+ * there is the Rust bridge, whose match only honours efficiency kinds and ignores governance
902
+ * kinds). The SDK's `toRustAgentConfig` throw-gate covers the in-process builder path.
903
+ */
904
+ resolvedMiddleware: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
905
+ kind: z.ZodLiteral<"compress">;
906
+ }, "strip", z.ZodTypeAny, {
907
+ kind: "compress";
908
+ }, {
909
+ kind: "compress";
910
+ }>, z.ZodObject<{
911
+ kind: z.ZodLiteral<"terse">;
912
+ }, "strip", z.ZodTypeAny, {
913
+ kind: "terse";
914
+ }, {
915
+ kind: "terse";
916
+ }>, z.ZodObject<{
917
+ kind: z.ZodLiteral<"contextBudget">;
918
+ params: z.ZodObject<{
919
+ chars: z.ZodNumber;
920
+ }, "strip", z.ZodTypeAny, {
921
+ chars: number;
922
+ }, {
923
+ chars: number;
924
+ }>;
925
+ }, "strip", z.ZodTypeAny, {
926
+ params: {
927
+ chars: number;
928
+ };
929
+ kind: "contextBudget";
930
+ }, {
931
+ params: {
932
+ chars: number;
933
+ };
934
+ kind: "contextBudget";
935
+ }>, z.ZodObject<{
936
+ kind: z.ZodLiteral<"reflection">;
937
+ params: z.ZodOptional<z.ZodObject<{
938
+ threshold: z.ZodOptional<z.ZodNumber>;
939
+ }, "strip", z.ZodTypeAny, {
940
+ threshold?: number | undefined;
941
+ }, {
942
+ threshold?: number | undefined;
943
+ }>>;
944
+ }, "strip", z.ZodTypeAny, {
945
+ kind: "reflection";
946
+ params?: {
947
+ threshold?: number | undefined;
948
+ } | undefined;
949
+ }, {
950
+ kind: "reflection";
951
+ params?: {
952
+ threshold?: number | undefined;
953
+ } | undefined;
954
+ }>, z.ZodObject<{
955
+ kind: z.ZodLiteral<"structuredOutput">;
956
+ params: z.ZodObject<{
957
+ schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
958
+ name: z.ZodOptional<z.ZodString>;
959
+ strict: z.ZodOptional<z.ZodBoolean>;
960
+ mode: z.ZodOptional<z.ZodEnum<["required", "lenient"]>>;
961
+ retryCap: z.ZodOptional<z.ZodNumber>;
962
+ }, "strip", z.ZodTypeAny, {
963
+ schema: Record<string, unknown>;
964
+ strict?: boolean | undefined;
965
+ name?: string | undefined;
966
+ mode?: "required" | "lenient" | undefined;
967
+ retryCap?: number | undefined;
968
+ }, {
969
+ schema: Record<string, unknown>;
970
+ strict?: boolean | undefined;
971
+ name?: string | undefined;
972
+ mode?: "required" | "lenient" | undefined;
973
+ retryCap?: number | undefined;
974
+ }>;
975
+ }, "strip", z.ZodTypeAny, {
976
+ params: {
977
+ schema: Record<string, unknown>;
978
+ strict?: boolean | undefined;
979
+ name?: string | undefined;
980
+ mode?: "required" | "lenient" | undefined;
981
+ retryCap?: number | undefined;
982
+ };
983
+ kind: "structuredOutput";
984
+ }, {
985
+ params: {
986
+ schema: Record<string, unknown>;
987
+ strict?: boolean | undefined;
988
+ name?: string | undefined;
989
+ mode?: "required" | "lenient" | undefined;
990
+ retryCap?: number | undefined;
991
+ };
992
+ kind: "structuredOutput";
993
+ }>]>, "many">>;
994
+ }, "strip", z.ZodTypeAny, {
995
+ provider?: string | undefined;
996
+ tier?: "frontier" | "balanced" | "fast" | "creative" | undefined;
997
+ suspendForApproval?: boolean | undefined;
998
+ outputChannel?: string | undefined;
999
+ model?: string | undefined;
1000
+ baseURL?: string | undefined;
1001
+ apiKeyEnv?: string | undefined;
1002
+ system?: string | undefined;
1003
+ toolNames?: string[] | undefined;
1004
+ toolSpecs?: {
1005
+ name: string;
1006
+ description?: string | undefined;
1007
+ jsonSchema?: Record<string, unknown> | undefined;
1008
+ }[] | undefined;
1009
+ maxIterations?: number | undefined;
1010
+ approvalToolNames?: string[] | undefined;
1011
+ outputStyle?: "terse" | undefined;
1012
+ contextBudget?: number | undefined;
1013
+ todosChannel?: string | undefined;
1014
+ inputBlocksChannel?: string | undefined;
1015
+ visibleChannels?: string[] | undefined;
1016
+ memory?: {
1017
+ namespace: string;
1018
+ topK?: number | undefined;
1019
+ recall?: "vector" | "graph" | "both" | undefined;
1020
+ } | undefined;
1021
+ skills?: {
1022
+ namespace: string;
1023
+ required?: string[] | undefined;
1024
+ advisoryK?: number | undefined;
1025
+ } | undefined;
1026
+ enableFs?: boolean | undefined;
1027
+ mcpConnectionId?: string | undefined;
1028
+ actionConnections?: Record<string, string> | undefined;
1029
+ resolvedMiddleware?: ({
1030
+ kind: "compress";
1031
+ } | {
1032
+ kind: "terse";
1033
+ } | {
1034
+ params: {
1035
+ chars: number;
1036
+ };
1037
+ kind: "contextBudget";
1038
+ } | {
1039
+ kind: "reflection";
1040
+ params?: {
1041
+ threshold?: number | undefined;
1042
+ } | undefined;
1043
+ } | {
1044
+ params: {
1045
+ schema: Record<string, unknown>;
1046
+ strict?: boolean | undefined;
1047
+ name?: string | undefined;
1048
+ mode?: "required" | "lenient" | undefined;
1049
+ retryCap?: number | undefined;
1050
+ };
1051
+ kind: "structuredOutput";
1052
+ })[] | undefined;
1053
+ }, {
1054
+ provider?: string | undefined;
1055
+ tier?: "frontier" | "balanced" | "fast" | "creative" | undefined;
1056
+ suspendForApproval?: boolean | undefined;
1057
+ outputChannel?: string | undefined;
1058
+ model?: string | undefined;
1059
+ baseURL?: string | undefined;
1060
+ apiKeyEnv?: string | undefined;
1061
+ system?: string | undefined;
1062
+ toolNames?: string[] | undefined;
1063
+ toolSpecs?: {
1064
+ name: string;
1065
+ description?: string | undefined;
1066
+ jsonSchema?: Record<string, unknown> | undefined;
1067
+ }[] | undefined;
1068
+ maxIterations?: number | undefined;
1069
+ approvalToolNames?: string[] | undefined;
1070
+ outputStyle?: "terse" | undefined;
1071
+ contextBudget?: number | undefined;
1072
+ todosChannel?: string | undefined;
1073
+ inputBlocksChannel?: string | undefined;
1074
+ visibleChannels?: string[] | undefined;
1075
+ memory?: {
1076
+ namespace: string;
1077
+ topK?: number | undefined;
1078
+ recall?: "vector" | "graph" | "both" | undefined;
1079
+ } | undefined;
1080
+ skills?: {
1081
+ namespace: string;
1082
+ required?: string[] | undefined;
1083
+ advisoryK?: number | undefined;
1084
+ } | undefined;
1085
+ enableFs?: boolean | undefined;
1086
+ mcpConnectionId?: string | undefined;
1087
+ actionConnections?: Record<string, string> | undefined;
1088
+ resolvedMiddleware?: ({
1089
+ kind: "compress";
1090
+ } | {
1091
+ kind: "terse";
1092
+ } | {
1093
+ params: {
1094
+ chars: number;
1095
+ };
1096
+ kind: "contextBudget";
1097
+ } | {
1098
+ kind: "reflection";
1099
+ params?: {
1100
+ threshold?: number | undefined;
1101
+ } | undefined;
1102
+ } | {
1103
+ params: {
1104
+ schema: Record<string, unknown>;
1105
+ strict?: boolean | undefined;
1106
+ name?: string | undefined;
1107
+ mode?: "required" | "lenient" | undefined;
1108
+ retryCap?: number | undefined;
1109
+ };
1110
+ kind: "structuredOutput";
1111
+ })[] | undefined;
1112
+ }>>;
1113
+ mapAgents: z.ZodOptional<z.ZodObject<{
1114
+ /** Channel holding the array of items to fan the sub-agent out over. */
1115
+ overChannel: z.ZodString;
1116
+ /** Channel the array of per-item results lands in (one entry per item, in input order). */
1117
+ joinAt: z.ZodString;
1118
+ /** The sub-agent run per item — a full agent carrier. */
1119
+ subAgent: z.ZodObject<{
1120
+ provider: z.ZodOptional<z.ZodString>;
1121
+ model: z.ZodOptional<z.ZodString>;
1122
+ tier: z.ZodOptional<z.ZodEnum<["frontier", "balanced", "fast", "creative"]>>;
1123
+ /** A custom OpenAI-compatible endpoint (`model.openaiCompatible`) and the env var naming its key. */
1124
+ baseURL: z.ZodOptional<z.ZodString>;
1125
+ apiKeyEnv: z.ZodOptional<z.ZodString>;
1126
+ system: z.ZodOptional<z.ZodString>;
1127
+ toolNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1128
+ /** Each tool's description and input JSON Schema, as the LLM sees them. */
1129
+ toolSpecs: z.ZodOptional<z.ZodArray<z.ZodObject<{
1130
+ name: z.ZodString;
1131
+ description: z.ZodOptional<z.ZodString>;
1132
+ jsonSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1133
+ }, "strip", z.ZodTypeAny, {
1134
+ name: string;
1135
+ description?: string | undefined;
1136
+ jsonSchema?: Record<string, unknown> | undefined;
1137
+ }, {
1138
+ name: string;
1139
+ description?: string | undefined;
1140
+ jsonSchema?: Record<string, unknown> | undefined;
1141
+ }>, "many">>;
1142
+ maxIterations: z.ZodOptional<z.ZodNumber>;
1143
+ suspendForApproval: z.ZodOptional<z.ZodBoolean>;
1144
+ approvalToolNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1145
+ outputChannel: z.ZodOptional<z.ZodString>;
1146
+ /** ADR 0014 — terse output directive on the system prompt. */
1147
+ outputStyle: z.ZodOptional<z.ZodLiteral<"terse">>;
1148
+ /** ADR 0014 — cap (chars) on the agent's seed message (the injected `Input`/`State` dump). */
1149
+ contextBudget: z.ZodOptional<z.ZodNumber>;
1150
+ /** ADR 0022/0023 — durable channel the agent's `writeTodos` list is persisted into. */
1151
+ todosChannel: z.ZodOptional<z.ZodString>;
1152
+ /** ADR 0030 phase 9e — channel carrying the run's multimodal input blocks. */
1153
+ inputBlocksChannel: z.ZodOptional<z.ZodString>;
1154
+ /** The only channels the agent is shown in its seed state (context isolation). */
1155
+ visibleChannels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1156
+ /** ADR 0026 phase 11 — governed long-term memory overlay (namespace tenant-scoped). */
1157
+ memory: z.ZodOptional<z.ZodObject<{
1158
+ namespace: z.ZodString;
1159
+ topK: z.ZodOptional<z.ZodNumber>;
1160
+ recall: z.ZodOptional<z.ZodEnum<["vector", "graph", "both"]>>;
1161
+ }, "strip", z.ZodTypeAny, {
1162
+ namespace: string;
1163
+ topK?: number | undefined;
1164
+ recall?: "vector" | "graph" | "both" | undefined;
1165
+ }, {
1166
+ namespace: string;
1167
+ topK?: number | undefined;
1168
+ recall?: "vector" | "graph" | "both" | undefined;
1169
+ }>>;
1170
+ /** ADR 0035 phase 12 — governed skills overlay (progressive disclosure; namespace tenant-scoped). */
1171
+ skills: z.ZodOptional<z.ZodObject<{
1172
+ namespace: z.ZodString;
1173
+ /** Explicit `name@version` pins — the must-apply playbooks. */
1174
+ required: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1175
+ /** Cap on advisory (vector-selected) skills. */
1176
+ advisoryK: z.ZodOptional<z.ZodNumber>;
1177
+ }, "strip", z.ZodTypeAny, {
1178
+ namespace: string;
1179
+ required?: string[] | undefined;
1180
+ advisoryK?: number | undefined;
1181
+ }, {
1182
+ namespace: string;
1183
+ required?: string[] | undefined;
1184
+ advisoryK?: number | undefined;
1185
+ }>>;
1186
+ /** ADR 0024 phase 2c/2d — opt this agent into the governed virtual filesystem tools. */
1187
+ enableFs: z.ZodOptional<z.ZodBoolean>;
1188
+ /**
1189
+ * ADR 0075 (issue #566 G3) — attach an external MCP server's tools to this agent, mid-run. The
1190
+ * value references a tenant-owned `connector_connections` row (`provider: "mcp"`), resolved and
1191
+ * connected at run start; every discovered tool is unconditionally `requiresApproval` (an MCP
1192
+ * server is code Ailu does not control and cannot statically vet). Distinct from `toolNames`/
1193
+ * `approvalToolNames` above — those are re-derived at run start to include the tools this
1194
+ * connection discovers, since the tool set isn't known until the server is actually queried.
1195
+ */
1196
+ mcpConnectionId: z.ZodOptional<z.ZodString>;
1197
+ /**
1198
+ * Issue #566 G19 — attach one or more governed action-tool connectors to this agent, mid-run.
1199
+ * Keyed by provider id (e.g. `"slack"`), value is a tenant-owned `connector_connections` row id.
1200
+ * Same resolution shape as `mcpConnectionId` (control plane resolves the connection, discovers
1201
+ * that provider's action tools, merges them into `toolNames`/`approvalToolNames` before the run
1202
+ * reaches this carrier — the Rust engine never resolves a connection itself), generalized to a
1203
+ * map so adding the NEXT provider (Linear, Salesforce, ...) never needs another engine field/
1204
+ * release — only a new product-side adapter keyed into the same map.
1205
+ */
1206
+ actionConnections: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1207
+ /**
1208
+ * ADR 0025 phase 3d — the resolved EFFICIENCY middleware list. A discriminated union of
1209
+ * efficiency-only kinds (compress / terse / contextBudget): a GOVERNANCE kind (redact /
1210
+ * approvalGate / fsPolicy) fails this schema BY CONSTRUCTION, so any consumer that runs it
1211
+ * (e.g. `readAgentMetadata`) drops the malformed agent. This is a **type-level + validation
1212
+ * guarantee** for callers that opt to validate; it is NOT auto-applied on the persisted
1213
+ * catalog run path today (that path reads an unvalidated carrier — the RUNTIME enforcer
1214
+ * there is the Rust bridge, whose match only honours efficiency kinds and ignores governance
1215
+ * kinds). The SDK's `toRustAgentConfig` throw-gate covers the in-process builder path.
1216
+ */
1217
+ resolvedMiddleware: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
1218
+ kind: z.ZodLiteral<"compress">;
1219
+ }, "strip", z.ZodTypeAny, {
1220
+ kind: "compress";
1221
+ }, {
1222
+ kind: "compress";
1223
+ }>, z.ZodObject<{
1224
+ kind: z.ZodLiteral<"terse">;
1225
+ }, "strip", z.ZodTypeAny, {
1226
+ kind: "terse";
1227
+ }, {
1228
+ kind: "terse";
1229
+ }>, z.ZodObject<{
1230
+ kind: z.ZodLiteral<"contextBudget">;
1231
+ params: z.ZodObject<{
1232
+ chars: z.ZodNumber;
1233
+ }, "strip", z.ZodTypeAny, {
1234
+ chars: number;
1235
+ }, {
1236
+ chars: number;
1237
+ }>;
1238
+ }, "strip", z.ZodTypeAny, {
1239
+ params: {
1240
+ chars: number;
1241
+ };
1242
+ kind: "contextBudget";
1243
+ }, {
1244
+ params: {
1245
+ chars: number;
1246
+ };
1247
+ kind: "contextBudget";
1248
+ }>, z.ZodObject<{
1249
+ kind: z.ZodLiteral<"reflection">;
1250
+ params: z.ZodOptional<z.ZodObject<{
1251
+ threshold: z.ZodOptional<z.ZodNumber>;
1252
+ }, "strip", z.ZodTypeAny, {
1253
+ threshold?: number | undefined;
1254
+ }, {
1255
+ threshold?: number | undefined;
1256
+ }>>;
1257
+ }, "strip", z.ZodTypeAny, {
1258
+ kind: "reflection";
1259
+ params?: {
1260
+ threshold?: number | undefined;
1261
+ } | undefined;
1262
+ }, {
1263
+ kind: "reflection";
1264
+ params?: {
1265
+ threshold?: number | undefined;
1266
+ } | undefined;
1267
+ }>, z.ZodObject<{
1268
+ kind: z.ZodLiteral<"structuredOutput">;
1269
+ params: z.ZodObject<{
1270
+ schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1271
+ name: z.ZodOptional<z.ZodString>;
1272
+ strict: z.ZodOptional<z.ZodBoolean>;
1273
+ mode: z.ZodOptional<z.ZodEnum<["required", "lenient"]>>;
1274
+ retryCap: z.ZodOptional<z.ZodNumber>;
1275
+ }, "strip", z.ZodTypeAny, {
1276
+ schema: Record<string, unknown>;
1277
+ strict?: boolean | undefined;
1278
+ name?: string | undefined;
1279
+ mode?: "required" | "lenient" | undefined;
1280
+ retryCap?: number | undefined;
1281
+ }, {
1282
+ schema: Record<string, unknown>;
1283
+ strict?: boolean | undefined;
1284
+ name?: string | undefined;
1285
+ mode?: "required" | "lenient" | undefined;
1286
+ retryCap?: number | undefined;
1287
+ }>;
1288
+ }, "strip", z.ZodTypeAny, {
1289
+ params: {
1290
+ schema: Record<string, unknown>;
1291
+ strict?: boolean | undefined;
1292
+ name?: string | undefined;
1293
+ mode?: "required" | "lenient" | undefined;
1294
+ retryCap?: number | undefined;
1295
+ };
1296
+ kind: "structuredOutput";
1297
+ }, {
1298
+ params: {
1299
+ schema: Record<string, unknown>;
1300
+ strict?: boolean | undefined;
1301
+ name?: string | undefined;
1302
+ mode?: "required" | "lenient" | undefined;
1303
+ retryCap?: number | undefined;
1304
+ };
1305
+ kind: "structuredOutput";
1306
+ }>]>, "many">>;
1307
+ }, "strip", z.ZodTypeAny, {
1308
+ provider?: string | undefined;
1309
+ tier?: "frontier" | "balanced" | "fast" | "creative" | undefined;
1310
+ suspendForApproval?: boolean | undefined;
1311
+ outputChannel?: string | undefined;
1312
+ model?: string | undefined;
1313
+ baseURL?: string | undefined;
1314
+ apiKeyEnv?: string | undefined;
1315
+ system?: string | undefined;
1316
+ toolNames?: string[] | undefined;
1317
+ toolSpecs?: {
1318
+ name: string;
1319
+ description?: string | undefined;
1320
+ jsonSchema?: Record<string, unknown> | undefined;
1321
+ }[] | undefined;
1322
+ maxIterations?: number | undefined;
1323
+ approvalToolNames?: string[] | undefined;
1324
+ outputStyle?: "terse" | undefined;
1325
+ contextBudget?: number | undefined;
1326
+ todosChannel?: string | undefined;
1327
+ inputBlocksChannel?: string | undefined;
1328
+ visibleChannels?: string[] | undefined;
1329
+ memory?: {
1330
+ namespace: string;
1331
+ topK?: number | undefined;
1332
+ recall?: "vector" | "graph" | "both" | undefined;
1333
+ } | undefined;
1334
+ skills?: {
1335
+ namespace: string;
1336
+ required?: string[] | undefined;
1337
+ advisoryK?: number | undefined;
1338
+ } | undefined;
1339
+ enableFs?: boolean | undefined;
1340
+ mcpConnectionId?: string | undefined;
1341
+ actionConnections?: Record<string, string> | undefined;
1342
+ resolvedMiddleware?: ({
1343
+ kind: "compress";
1344
+ } | {
1345
+ kind: "terse";
1346
+ } | {
1347
+ params: {
1348
+ chars: number;
1349
+ };
1350
+ kind: "contextBudget";
1351
+ } | {
1352
+ kind: "reflection";
1353
+ params?: {
1354
+ threshold?: number | undefined;
1355
+ } | undefined;
1356
+ } | {
1357
+ params: {
1358
+ schema: Record<string, unknown>;
1359
+ strict?: boolean | undefined;
1360
+ name?: string | undefined;
1361
+ mode?: "required" | "lenient" | undefined;
1362
+ retryCap?: number | undefined;
1363
+ };
1364
+ kind: "structuredOutput";
1365
+ })[] | undefined;
1366
+ }, {
1367
+ provider?: string | undefined;
1368
+ tier?: "frontier" | "balanced" | "fast" | "creative" | undefined;
1369
+ suspendForApproval?: boolean | undefined;
1370
+ outputChannel?: string | undefined;
1371
+ model?: string | undefined;
1372
+ baseURL?: string | undefined;
1373
+ apiKeyEnv?: string | undefined;
1374
+ system?: string | undefined;
1375
+ toolNames?: string[] | undefined;
1376
+ toolSpecs?: {
1377
+ name: string;
1378
+ description?: string | undefined;
1379
+ jsonSchema?: Record<string, unknown> | undefined;
1380
+ }[] | undefined;
1381
+ maxIterations?: number | undefined;
1382
+ approvalToolNames?: string[] | undefined;
1383
+ outputStyle?: "terse" | undefined;
1384
+ contextBudget?: number | undefined;
1385
+ todosChannel?: string | undefined;
1386
+ inputBlocksChannel?: string | undefined;
1387
+ visibleChannels?: string[] | undefined;
1388
+ memory?: {
1389
+ namespace: string;
1390
+ topK?: number | undefined;
1391
+ recall?: "vector" | "graph" | "both" | undefined;
1392
+ } | undefined;
1393
+ skills?: {
1394
+ namespace: string;
1395
+ required?: string[] | undefined;
1396
+ advisoryK?: number | undefined;
1397
+ } | undefined;
1398
+ enableFs?: boolean | undefined;
1399
+ mcpConnectionId?: string | undefined;
1400
+ actionConnections?: Record<string, string> | undefined;
1401
+ resolvedMiddleware?: ({
1402
+ kind: "compress";
1403
+ } | {
1404
+ kind: "terse";
1405
+ } | {
1406
+ params: {
1407
+ chars: number;
1408
+ };
1409
+ kind: "contextBudget";
1410
+ } | {
1411
+ kind: "reflection";
1412
+ params?: {
1413
+ threshold?: number | undefined;
1414
+ } | undefined;
1415
+ } | {
1416
+ params: {
1417
+ schema: Record<string, unknown>;
1418
+ strict?: boolean | undefined;
1419
+ name?: string | undefined;
1420
+ mode?: "required" | "lenient" | undefined;
1421
+ retryCap?: number | undefined;
1422
+ };
1423
+ kind: "structuredOutput";
1424
+ })[] | undefined;
1425
+ }>;
1426
+ /** When true, a spawn that needs approval suspends the whole map (default false). */
1427
+ suspendForApproval: z.ZodOptional<z.ZodBoolean>;
1428
+ }, "strip", z.ZodTypeAny, {
1429
+ joinAt: string;
1430
+ overChannel: string;
1431
+ subAgent: {
1432
+ provider?: string | undefined;
1433
+ tier?: "frontier" | "balanced" | "fast" | "creative" | undefined;
1434
+ suspendForApproval?: boolean | undefined;
1435
+ outputChannel?: string | undefined;
1436
+ model?: string | undefined;
1437
+ baseURL?: string | undefined;
1438
+ apiKeyEnv?: string | undefined;
1439
+ system?: string | undefined;
1440
+ toolNames?: string[] | undefined;
1441
+ toolSpecs?: {
1442
+ name: string;
1443
+ description?: string | undefined;
1444
+ jsonSchema?: Record<string, unknown> | undefined;
1445
+ }[] | undefined;
1446
+ maxIterations?: number | undefined;
1447
+ approvalToolNames?: string[] | undefined;
1448
+ outputStyle?: "terse" | undefined;
1449
+ contextBudget?: number | undefined;
1450
+ todosChannel?: string | undefined;
1451
+ inputBlocksChannel?: string | undefined;
1452
+ visibleChannels?: string[] | undefined;
1453
+ memory?: {
1454
+ namespace: string;
1455
+ topK?: number | undefined;
1456
+ recall?: "vector" | "graph" | "both" | undefined;
1457
+ } | undefined;
1458
+ skills?: {
1459
+ namespace: string;
1460
+ required?: string[] | undefined;
1461
+ advisoryK?: number | undefined;
1462
+ } | undefined;
1463
+ enableFs?: boolean | undefined;
1464
+ mcpConnectionId?: string | undefined;
1465
+ actionConnections?: Record<string, string> | undefined;
1466
+ resolvedMiddleware?: ({
1467
+ kind: "compress";
1468
+ } | {
1469
+ kind: "terse";
1470
+ } | {
1471
+ params: {
1472
+ chars: number;
1473
+ };
1474
+ kind: "contextBudget";
1475
+ } | {
1476
+ kind: "reflection";
1477
+ params?: {
1478
+ threshold?: number | undefined;
1479
+ } | undefined;
1480
+ } | {
1481
+ params: {
1482
+ schema: Record<string, unknown>;
1483
+ strict?: boolean | undefined;
1484
+ name?: string | undefined;
1485
+ mode?: "required" | "lenient" | undefined;
1486
+ retryCap?: number | undefined;
1487
+ };
1488
+ kind: "structuredOutput";
1489
+ })[] | undefined;
1490
+ };
1491
+ suspendForApproval?: boolean | undefined;
1492
+ }, {
1493
+ joinAt: string;
1494
+ overChannel: string;
1495
+ subAgent: {
1496
+ provider?: string | undefined;
1497
+ tier?: "frontier" | "balanced" | "fast" | "creative" | undefined;
1498
+ suspendForApproval?: boolean | undefined;
1499
+ outputChannel?: string | undefined;
1500
+ model?: string | undefined;
1501
+ baseURL?: string | undefined;
1502
+ apiKeyEnv?: string | undefined;
1503
+ system?: string | undefined;
1504
+ toolNames?: string[] | undefined;
1505
+ toolSpecs?: {
1506
+ name: string;
1507
+ description?: string | undefined;
1508
+ jsonSchema?: Record<string, unknown> | undefined;
1509
+ }[] | undefined;
1510
+ maxIterations?: number | undefined;
1511
+ approvalToolNames?: string[] | undefined;
1512
+ outputStyle?: "terse" | undefined;
1513
+ contextBudget?: number | undefined;
1514
+ todosChannel?: string | undefined;
1515
+ inputBlocksChannel?: string | undefined;
1516
+ visibleChannels?: string[] | undefined;
1517
+ memory?: {
1518
+ namespace: string;
1519
+ topK?: number | undefined;
1520
+ recall?: "vector" | "graph" | "both" | undefined;
1521
+ } | undefined;
1522
+ skills?: {
1523
+ namespace: string;
1524
+ required?: string[] | undefined;
1525
+ advisoryK?: number | undefined;
1526
+ } | undefined;
1527
+ enableFs?: boolean | undefined;
1528
+ mcpConnectionId?: string | undefined;
1529
+ actionConnections?: Record<string, string> | undefined;
1530
+ resolvedMiddleware?: ({
1531
+ kind: "compress";
1532
+ } | {
1533
+ kind: "terse";
1534
+ } | {
1535
+ params: {
1536
+ chars: number;
1537
+ };
1538
+ kind: "contextBudget";
1539
+ } | {
1540
+ kind: "reflection";
1541
+ params?: {
1542
+ threshold?: number | undefined;
1543
+ } | undefined;
1544
+ } | {
1545
+ params: {
1546
+ schema: Record<string, unknown>;
1547
+ strict?: boolean | undefined;
1548
+ name?: string | undefined;
1549
+ mode?: "required" | "lenient" | undefined;
1550
+ retryCap?: number | undefined;
1551
+ };
1552
+ kind: "structuredOutput";
1553
+ })[] | undefined;
1554
+ };
1555
+ suspendForApproval?: boolean | undefined;
1556
+ }>>;
1557
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1558
+ component: z.ZodOptional<z.ZodObject<{
1559
+ /** One of `ComponentRegistry::kinds()` (e.g. "promptBuilder") or an integration name. */
1560
+ kind: z.ZodString;
1561
+ /** The component's parameter bag; validated by the native factory at assemble time. */
1562
+ params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1563
+ }, "strip", z.ZodTypeAny, {
1564
+ params: Record<string, unknown>;
1565
+ kind: string;
1566
+ }, {
1567
+ params: Record<string, unknown>;
1568
+ kind: string;
1569
+ }>>;
1570
+ agent: z.ZodOptional<z.ZodObject<{
1571
+ provider: z.ZodOptional<z.ZodString>;
1572
+ model: z.ZodOptional<z.ZodString>;
1573
+ tier: z.ZodOptional<z.ZodEnum<["frontier", "balanced", "fast", "creative"]>>;
1574
+ /** A custom OpenAI-compatible endpoint (`model.openaiCompatible`) and the env var naming its key. */
1575
+ baseURL: z.ZodOptional<z.ZodString>;
1576
+ apiKeyEnv: z.ZodOptional<z.ZodString>;
1577
+ system: z.ZodOptional<z.ZodString>;
1578
+ toolNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1579
+ /** Each tool's description and input JSON Schema, as the LLM sees them. */
1580
+ toolSpecs: z.ZodOptional<z.ZodArray<z.ZodObject<{
1581
+ name: z.ZodString;
1582
+ description: z.ZodOptional<z.ZodString>;
1583
+ jsonSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1584
+ }, "strip", z.ZodTypeAny, {
1585
+ name: string;
1586
+ description?: string | undefined;
1587
+ jsonSchema?: Record<string, unknown> | undefined;
1588
+ }, {
1589
+ name: string;
1590
+ description?: string | undefined;
1591
+ jsonSchema?: Record<string, unknown> | undefined;
1592
+ }>, "many">>;
1593
+ maxIterations: z.ZodOptional<z.ZodNumber>;
1594
+ suspendForApproval: z.ZodOptional<z.ZodBoolean>;
1595
+ approvalToolNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1596
+ outputChannel: z.ZodOptional<z.ZodString>;
1597
+ /** ADR 0014 — terse output directive on the system prompt. */
1598
+ outputStyle: z.ZodOptional<z.ZodLiteral<"terse">>;
1599
+ /** ADR 0014 — cap (chars) on the agent's seed message (the injected `Input`/`State` dump). */
1600
+ contextBudget: z.ZodOptional<z.ZodNumber>;
1601
+ /** ADR 0022/0023 — durable channel the agent's `writeTodos` list is persisted into. */
1602
+ todosChannel: z.ZodOptional<z.ZodString>;
1603
+ /** ADR 0030 phase 9e — channel carrying the run's multimodal input blocks. */
1604
+ inputBlocksChannel: z.ZodOptional<z.ZodString>;
1605
+ /** The only channels the agent is shown in its seed state (context isolation). */
1606
+ visibleChannels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1607
+ /** ADR 0026 phase 11 — governed long-term memory overlay (namespace tenant-scoped). */
1608
+ memory: z.ZodOptional<z.ZodObject<{
1609
+ namespace: z.ZodString;
1610
+ topK: z.ZodOptional<z.ZodNumber>;
1611
+ recall: z.ZodOptional<z.ZodEnum<["vector", "graph", "both"]>>;
1612
+ }, "strip", z.ZodTypeAny, {
1613
+ namespace: string;
1614
+ topK?: number | undefined;
1615
+ recall?: "vector" | "graph" | "both" | undefined;
1616
+ }, {
1617
+ namespace: string;
1618
+ topK?: number | undefined;
1619
+ recall?: "vector" | "graph" | "both" | undefined;
1620
+ }>>;
1621
+ /** ADR 0035 phase 12 — governed skills overlay (progressive disclosure; namespace tenant-scoped). */
1622
+ skills: z.ZodOptional<z.ZodObject<{
1623
+ namespace: z.ZodString;
1624
+ /** Explicit `name@version` pins — the must-apply playbooks. */
1625
+ required: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1626
+ /** Cap on advisory (vector-selected) skills. */
1627
+ advisoryK: z.ZodOptional<z.ZodNumber>;
1628
+ }, "strip", z.ZodTypeAny, {
1629
+ namespace: string;
1630
+ required?: string[] | undefined;
1631
+ advisoryK?: number | undefined;
1632
+ }, {
1633
+ namespace: string;
1634
+ required?: string[] | undefined;
1635
+ advisoryK?: number | undefined;
1636
+ }>>;
1637
+ /** ADR 0024 phase 2c/2d — opt this agent into the governed virtual filesystem tools. */
1638
+ enableFs: z.ZodOptional<z.ZodBoolean>;
1639
+ /**
1640
+ * ADR 0075 (issue #566 G3) — attach an external MCP server's tools to this agent, mid-run. The
1641
+ * value references a tenant-owned `connector_connections` row (`provider: "mcp"`), resolved and
1642
+ * connected at run start; every discovered tool is unconditionally `requiresApproval` (an MCP
1643
+ * server is code Ailu does not control and cannot statically vet). Distinct from `toolNames`/
1644
+ * `approvalToolNames` above — those are re-derived at run start to include the tools this
1645
+ * connection discovers, since the tool set isn't known until the server is actually queried.
1646
+ */
1647
+ mcpConnectionId: z.ZodOptional<z.ZodString>;
1648
+ /**
1649
+ * Issue #566 G19 — attach one or more governed action-tool connectors to this agent, mid-run.
1650
+ * Keyed by provider id (e.g. `"slack"`), value is a tenant-owned `connector_connections` row id.
1651
+ * Same resolution shape as `mcpConnectionId` (control plane resolves the connection, discovers
1652
+ * that provider's action tools, merges them into `toolNames`/`approvalToolNames` before the run
1653
+ * reaches this carrier — the Rust engine never resolves a connection itself), generalized to a
1654
+ * map so adding the NEXT provider (Linear, Salesforce, ...) never needs another engine field/
1655
+ * release — only a new product-side adapter keyed into the same map.
1656
+ */
1657
+ actionConnections: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1658
+ /**
1659
+ * ADR 0025 phase 3d — the resolved EFFICIENCY middleware list. A discriminated union of
1660
+ * efficiency-only kinds (compress / terse / contextBudget): a GOVERNANCE kind (redact /
1661
+ * approvalGate / fsPolicy) fails this schema BY CONSTRUCTION, so any consumer that runs it
1662
+ * (e.g. `readAgentMetadata`) drops the malformed agent. This is a **type-level + validation
1663
+ * guarantee** for callers that opt to validate; it is NOT auto-applied on the persisted
1664
+ * catalog run path today (that path reads an unvalidated carrier — the RUNTIME enforcer
1665
+ * there is the Rust bridge, whose match only honours efficiency kinds and ignores governance
1666
+ * kinds). The SDK's `toRustAgentConfig` throw-gate covers the in-process builder path.
1667
+ */
1668
+ resolvedMiddleware: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
1669
+ kind: z.ZodLiteral<"compress">;
1670
+ }, "strip", z.ZodTypeAny, {
1671
+ kind: "compress";
1672
+ }, {
1673
+ kind: "compress";
1674
+ }>, z.ZodObject<{
1675
+ kind: z.ZodLiteral<"terse">;
1676
+ }, "strip", z.ZodTypeAny, {
1677
+ kind: "terse";
1678
+ }, {
1679
+ kind: "terse";
1680
+ }>, z.ZodObject<{
1681
+ kind: z.ZodLiteral<"contextBudget">;
1682
+ params: z.ZodObject<{
1683
+ chars: z.ZodNumber;
1684
+ }, "strip", z.ZodTypeAny, {
1685
+ chars: number;
1686
+ }, {
1687
+ chars: number;
1688
+ }>;
1689
+ }, "strip", z.ZodTypeAny, {
1690
+ params: {
1691
+ chars: number;
1692
+ };
1693
+ kind: "contextBudget";
1694
+ }, {
1695
+ params: {
1696
+ chars: number;
1697
+ };
1698
+ kind: "contextBudget";
1699
+ }>, z.ZodObject<{
1700
+ kind: z.ZodLiteral<"reflection">;
1701
+ params: z.ZodOptional<z.ZodObject<{
1702
+ threshold: z.ZodOptional<z.ZodNumber>;
1703
+ }, "strip", z.ZodTypeAny, {
1704
+ threshold?: number | undefined;
1705
+ }, {
1706
+ threshold?: number | undefined;
1707
+ }>>;
1708
+ }, "strip", z.ZodTypeAny, {
1709
+ kind: "reflection";
1710
+ params?: {
1711
+ threshold?: number | undefined;
1712
+ } | undefined;
1713
+ }, {
1714
+ kind: "reflection";
1715
+ params?: {
1716
+ threshold?: number | undefined;
1717
+ } | undefined;
1718
+ }>, z.ZodObject<{
1719
+ kind: z.ZodLiteral<"structuredOutput">;
1720
+ params: z.ZodObject<{
1721
+ schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1722
+ name: z.ZodOptional<z.ZodString>;
1723
+ strict: z.ZodOptional<z.ZodBoolean>;
1724
+ mode: z.ZodOptional<z.ZodEnum<["required", "lenient"]>>;
1725
+ retryCap: z.ZodOptional<z.ZodNumber>;
1726
+ }, "strip", z.ZodTypeAny, {
1727
+ schema: Record<string, unknown>;
1728
+ strict?: boolean | undefined;
1729
+ name?: string | undefined;
1730
+ mode?: "required" | "lenient" | undefined;
1731
+ retryCap?: number | undefined;
1732
+ }, {
1733
+ schema: Record<string, unknown>;
1734
+ strict?: boolean | undefined;
1735
+ name?: string | undefined;
1736
+ mode?: "required" | "lenient" | undefined;
1737
+ retryCap?: number | undefined;
1738
+ }>;
1739
+ }, "strip", z.ZodTypeAny, {
1740
+ params: {
1741
+ schema: Record<string, unknown>;
1742
+ strict?: boolean | undefined;
1743
+ name?: string | undefined;
1744
+ mode?: "required" | "lenient" | undefined;
1745
+ retryCap?: number | undefined;
1746
+ };
1747
+ kind: "structuredOutput";
1748
+ }, {
1749
+ params: {
1750
+ schema: Record<string, unknown>;
1751
+ strict?: boolean | undefined;
1752
+ name?: string | undefined;
1753
+ mode?: "required" | "lenient" | undefined;
1754
+ retryCap?: number | undefined;
1755
+ };
1756
+ kind: "structuredOutput";
1757
+ }>]>, "many">>;
1758
+ }, "strip", z.ZodTypeAny, {
1759
+ provider?: string | undefined;
1760
+ tier?: "frontier" | "balanced" | "fast" | "creative" | undefined;
1761
+ suspendForApproval?: boolean | undefined;
1762
+ outputChannel?: string | undefined;
1763
+ model?: string | undefined;
1764
+ baseURL?: string | undefined;
1765
+ apiKeyEnv?: string | undefined;
1766
+ system?: string | undefined;
1767
+ toolNames?: string[] | undefined;
1768
+ toolSpecs?: {
1769
+ name: string;
1770
+ description?: string | undefined;
1771
+ jsonSchema?: Record<string, unknown> | undefined;
1772
+ }[] | undefined;
1773
+ maxIterations?: number | undefined;
1774
+ approvalToolNames?: string[] | undefined;
1775
+ outputStyle?: "terse" | undefined;
1776
+ contextBudget?: number | undefined;
1777
+ todosChannel?: string | undefined;
1778
+ inputBlocksChannel?: string | undefined;
1779
+ visibleChannels?: string[] | undefined;
1780
+ memory?: {
1781
+ namespace: string;
1782
+ topK?: number | undefined;
1783
+ recall?: "vector" | "graph" | "both" | undefined;
1784
+ } | undefined;
1785
+ skills?: {
1786
+ namespace: string;
1787
+ required?: string[] | undefined;
1788
+ advisoryK?: number | undefined;
1789
+ } | undefined;
1790
+ enableFs?: boolean | undefined;
1791
+ mcpConnectionId?: string | undefined;
1792
+ actionConnections?: Record<string, string> | undefined;
1793
+ resolvedMiddleware?: ({
1794
+ kind: "compress";
1795
+ } | {
1796
+ kind: "terse";
1797
+ } | {
1798
+ params: {
1799
+ chars: number;
1800
+ };
1801
+ kind: "contextBudget";
1802
+ } | {
1803
+ kind: "reflection";
1804
+ params?: {
1805
+ threshold?: number | undefined;
1806
+ } | undefined;
1807
+ } | {
1808
+ params: {
1809
+ schema: Record<string, unknown>;
1810
+ strict?: boolean | undefined;
1811
+ name?: string | undefined;
1812
+ mode?: "required" | "lenient" | undefined;
1813
+ retryCap?: number | undefined;
1814
+ };
1815
+ kind: "structuredOutput";
1816
+ })[] | undefined;
1817
+ }, {
1818
+ provider?: string | undefined;
1819
+ tier?: "frontier" | "balanced" | "fast" | "creative" | undefined;
1820
+ suspendForApproval?: boolean | undefined;
1821
+ outputChannel?: string | undefined;
1822
+ model?: string | undefined;
1823
+ baseURL?: string | undefined;
1824
+ apiKeyEnv?: string | undefined;
1825
+ system?: string | undefined;
1826
+ toolNames?: string[] | undefined;
1827
+ toolSpecs?: {
1828
+ name: string;
1829
+ description?: string | undefined;
1830
+ jsonSchema?: Record<string, unknown> | undefined;
1831
+ }[] | undefined;
1832
+ maxIterations?: number | undefined;
1833
+ approvalToolNames?: string[] | undefined;
1834
+ outputStyle?: "terse" | undefined;
1835
+ contextBudget?: number | undefined;
1836
+ todosChannel?: string | undefined;
1837
+ inputBlocksChannel?: string | undefined;
1838
+ visibleChannels?: string[] | undefined;
1839
+ memory?: {
1840
+ namespace: string;
1841
+ topK?: number | undefined;
1842
+ recall?: "vector" | "graph" | "both" | undefined;
1843
+ } | undefined;
1844
+ skills?: {
1845
+ namespace: string;
1846
+ required?: string[] | undefined;
1847
+ advisoryK?: number | undefined;
1848
+ } | undefined;
1849
+ enableFs?: boolean | undefined;
1850
+ mcpConnectionId?: string | undefined;
1851
+ actionConnections?: Record<string, string> | undefined;
1852
+ resolvedMiddleware?: ({
1853
+ kind: "compress";
1854
+ } | {
1855
+ kind: "terse";
1856
+ } | {
1857
+ params: {
1858
+ chars: number;
1859
+ };
1860
+ kind: "contextBudget";
1861
+ } | {
1862
+ kind: "reflection";
1863
+ params?: {
1864
+ threshold?: number | undefined;
1865
+ } | undefined;
1866
+ } | {
1867
+ params: {
1868
+ schema: Record<string, unknown>;
1869
+ strict?: boolean | undefined;
1870
+ name?: string | undefined;
1871
+ mode?: "required" | "lenient" | undefined;
1872
+ retryCap?: number | undefined;
1873
+ };
1874
+ kind: "structuredOutput";
1875
+ })[] | undefined;
1876
+ }>>;
1877
+ mapAgents: z.ZodOptional<z.ZodObject<{
1878
+ /** Channel holding the array of items to fan the sub-agent out over. */
1879
+ overChannel: z.ZodString;
1880
+ /** Channel the array of per-item results lands in (one entry per item, in input order). */
1881
+ joinAt: z.ZodString;
1882
+ /** The sub-agent run per item — a full agent carrier. */
1883
+ subAgent: z.ZodObject<{
1884
+ provider: z.ZodOptional<z.ZodString>;
1885
+ model: z.ZodOptional<z.ZodString>;
1886
+ tier: z.ZodOptional<z.ZodEnum<["frontier", "balanced", "fast", "creative"]>>;
1887
+ /** A custom OpenAI-compatible endpoint (`model.openaiCompatible`) and the env var naming its key. */
1888
+ baseURL: z.ZodOptional<z.ZodString>;
1889
+ apiKeyEnv: z.ZodOptional<z.ZodString>;
1890
+ system: z.ZodOptional<z.ZodString>;
1891
+ toolNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1892
+ /** Each tool's description and input JSON Schema, as the LLM sees them. */
1893
+ toolSpecs: z.ZodOptional<z.ZodArray<z.ZodObject<{
1894
+ name: z.ZodString;
1895
+ description: z.ZodOptional<z.ZodString>;
1896
+ jsonSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1897
+ }, "strip", z.ZodTypeAny, {
1898
+ name: string;
1899
+ description?: string | undefined;
1900
+ jsonSchema?: Record<string, unknown> | undefined;
1901
+ }, {
1902
+ name: string;
1903
+ description?: string | undefined;
1904
+ jsonSchema?: Record<string, unknown> | undefined;
1905
+ }>, "many">>;
1906
+ maxIterations: z.ZodOptional<z.ZodNumber>;
1907
+ suspendForApproval: z.ZodOptional<z.ZodBoolean>;
1908
+ approvalToolNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1909
+ outputChannel: z.ZodOptional<z.ZodString>;
1910
+ /** ADR 0014 — terse output directive on the system prompt. */
1911
+ outputStyle: z.ZodOptional<z.ZodLiteral<"terse">>;
1912
+ /** ADR 0014 — cap (chars) on the agent's seed message (the injected `Input`/`State` dump). */
1913
+ contextBudget: z.ZodOptional<z.ZodNumber>;
1914
+ /** ADR 0022/0023 — durable channel the agent's `writeTodos` list is persisted into. */
1915
+ todosChannel: z.ZodOptional<z.ZodString>;
1916
+ /** ADR 0030 phase 9e — channel carrying the run's multimodal input blocks. */
1917
+ inputBlocksChannel: z.ZodOptional<z.ZodString>;
1918
+ /** The only channels the agent is shown in its seed state (context isolation). */
1919
+ visibleChannels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1920
+ /** ADR 0026 phase 11 — governed long-term memory overlay (namespace tenant-scoped). */
1921
+ memory: z.ZodOptional<z.ZodObject<{
1922
+ namespace: z.ZodString;
1923
+ topK: z.ZodOptional<z.ZodNumber>;
1924
+ recall: z.ZodOptional<z.ZodEnum<["vector", "graph", "both"]>>;
1925
+ }, "strip", z.ZodTypeAny, {
1926
+ namespace: string;
1927
+ topK?: number | undefined;
1928
+ recall?: "vector" | "graph" | "both" | undefined;
1929
+ }, {
1930
+ namespace: string;
1931
+ topK?: number | undefined;
1932
+ recall?: "vector" | "graph" | "both" | undefined;
1933
+ }>>;
1934
+ /** ADR 0035 phase 12 — governed skills overlay (progressive disclosure; namespace tenant-scoped). */
1935
+ skills: z.ZodOptional<z.ZodObject<{
1936
+ namespace: z.ZodString;
1937
+ /** Explicit `name@version` pins — the must-apply playbooks. */
1938
+ required: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1939
+ /** Cap on advisory (vector-selected) skills. */
1940
+ advisoryK: z.ZodOptional<z.ZodNumber>;
1941
+ }, "strip", z.ZodTypeAny, {
1942
+ namespace: string;
1943
+ required?: string[] | undefined;
1944
+ advisoryK?: number | undefined;
1945
+ }, {
1946
+ namespace: string;
1947
+ required?: string[] | undefined;
1948
+ advisoryK?: number | undefined;
1949
+ }>>;
1950
+ /** ADR 0024 phase 2c/2d — opt this agent into the governed virtual filesystem tools. */
1951
+ enableFs: z.ZodOptional<z.ZodBoolean>;
1952
+ /**
1953
+ * ADR 0075 (issue #566 G3) — attach an external MCP server's tools to this agent, mid-run. The
1954
+ * value references a tenant-owned `connector_connections` row (`provider: "mcp"`), resolved and
1955
+ * connected at run start; every discovered tool is unconditionally `requiresApproval` (an MCP
1956
+ * server is code Ailu does not control and cannot statically vet). Distinct from `toolNames`/
1957
+ * `approvalToolNames` above — those are re-derived at run start to include the tools this
1958
+ * connection discovers, since the tool set isn't known until the server is actually queried.
1959
+ */
1960
+ mcpConnectionId: z.ZodOptional<z.ZodString>;
1961
+ /**
1962
+ * Issue #566 G19 — attach one or more governed action-tool connectors to this agent, mid-run.
1963
+ * Keyed by provider id (e.g. `"slack"`), value is a tenant-owned `connector_connections` row id.
1964
+ * Same resolution shape as `mcpConnectionId` (control plane resolves the connection, discovers
1965
+ * that provider's action tools, merges them into `toolNames`/`approvalToolNames` before the run
1966
+ * reaches this carrier — the Rust engine never resolves a connection itself), generalized to a
1967
+ * map so adding the NEXT provider (Linear, Salesforce, ...) never needs another engine field/
1968
+ * release — only a new product-side adapter keyed into the same map.
1969
+ */
1970
+ actionConnections: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1971
+ /**
1972
+ * ADR 0025 phase 3d — the resolved EFFICIENCY middleware list. A discriminated union of
1973
+ * efficiency-only kinds (compress / terse / contextBudget): a GOVERNANCE kind (redact /
1974
+ * approvalGate / fsPolicy) fails this schema BY CONSTRUCTION, so any consumer that runs it
1975
+ * (e.g. `readAgentMetadata`) drops the malformed agent. This is a **type-level + validation
1976
+ * guarantee** for callers that opt to validate; it is NOT auto-applied on the persisted
1977
+ * catalog run path today (that path reads an unvalidated carrier — the RUNTIME enforcer
1978
+ * there is the Rust bridge, whose match only honours efficiency kinds and ignores governance
1979
+ * kinds). The SDK's `toRustAgentConfig` throw-gate covers the in-process builder path.
1980
+ */
1981
+ resolvedMiddleware: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
1982
+ kind: z.ZodLiteral<"compress">;
1983
+ }, "strip", z.ZodTypeAny, {
1984
+ kind: "compress";
1985
+ }, {
1986
+ kind: "compress";
1987
+ }>, z.ZodObject<{
1988
+ kind: z.ZodLiteral<"terse">;
1989
+ }, "strip", z.ZodTypeAny, {
1990
+ kind: "terse";
1991
+ }, {
1992
+ kind: "terse";
1993
+ }>, z.ZodObject<{
1994
+ kind: z.ZodLiteral<"contextBudget">;
1995
+ params: z.ZodObject<{
1996
+ chars: z.ZodNumber;
1997
+ }, "strip", z.ZodTypeAny, {
1998
+ chars: number;
1999
+ }, {
2000
+ chars: number;
2001
+ }>;
2002
+ }, "strip", z.ZodTypeAny, {
2003
+ params: {
2004
+ chars: number;
2005
+ };
2006
+ kind: "contextBudget";
2007
+ }, {
2008
+ params: {
2009
+ chars: number;
2010
+ };
2011
+ kind: "contextBudget";
2012
+ }>, z.ZodObject<{
2013
+ kind: z.ZodLiteral<"reflection">;
2014
+ params: z.ZodOptional<z.ZodObject<{
2015
+ threshold: z.ZodOptional<z.ZodNumber>;
2016
+ }, "strip", z.ZodTypeAny, {
2017
+ threshold?: number | undefined;
2018
+ }, {
2019
+ threshold?: number | undefined;
2020
+ }>>;
2021
+ }, "strip", z.ZodTypeAny, {
2022
+ kind: "reflection";
2023
+ params?: {
2024
+ threshold?: number | undefined;
2025
+ } | undefined;
2026
+ }, {
2027
+ kind: "reflection";
2028
+ params?: {
2029
+ threshold?: number | undefined;
2030
+ } | undefined;
2031
+ }>, z.ZodObject<{
2032
+ kind: z.ZodLiteral<"structuredOutput">;
2033
+ params: z.ZodObject<{
2034
+ schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2035
+ name: z.ZodOptional<z.ZodString>;
2036
+ strict: z.ZodOptional<z.ZodBoolean>;
2037
+ mode: z.ZodOptional<z.ZodEnum<["required", "lenient"]>>;
2038
+ retryCap: z.ZodOptional<z.ZodNumber>;
2039
+ }, "strip", z.ZodTypeAny, {
2040
+ schema: Record<string, unknown>;
2041
+ strict?: boolean | undefined;
2042
+ name?: string | undefined;
2043
+ mode?: "required" | "lenient" | undefined;
2044
+ retryCap?: number | undefined;
2045
+ }, {
2046
+ schema: Record<string, unknown>;
2047
+ strict?: boolean | undefined;
2048
+ name?: string | undefined;
2049
+ mode?: "required" | "lenient" | undefined;
2050
+ retryCap?: number | undefined;
2051
+ }>;
2052
+ }, "strip", z.ZodTypeAny, {
2053
+ params: {
2054
+ schema: Record<string, unknown>;
2055
+ strict?: boolean | undefined;
2056
+ name?: string | undefined;
2057
+ mode?: "required" | "lenient" | undefined;
2058
+ retryCap?: number | undefined;
2059
+ };
2060
+ kind: "structuredOutput";
2061
+ }, {
2062
+ params: {
2063
+ schema: Record<string, unknown>;
2064
+ strict?: boolean | undefined;
2065
+ name?: string | undefined;
2066
+ mode?: "required" | "lenient" | undefined;
2067
+ retryCap?: number | undefined;
2068
+ };
2069
+ kind: "structuredOutput";
2070
+ }>]>, "many">>;
2071
+ }, "strip", z.ZodTypeAny, {
2072
+ provider?: string | undefined;
2073
+ tier?: "frontier" | "balanced" | "fast" | "creative" | undefined;
2074
+ suspendForApproval?: boolean | undefined;
2075
+ outputChannel?: string | undefined;
2076
+ model?: string | undefined;
2077
+ baseURL?: string | undefined;
2078
+ apiKeyEnv?: string | undefined;
2079
+ system?: string | undefined;
2080
+ toolNames?: string[] | undefined;
2081
+ toolSpecs?: {
2082
+ name: string;
2083
+ description?: string | undefined;
2084
+ jsonSchema?: Record<string, unknown> | undefined;
2085
+ }[] | undefined;
2086
+ maxIterations?: number | undefined;
2087
+ approvalToolNames?: string[] | undefined;
2088
+ outputStyle?: "terse" | undefined;
2089
+ contextBudget?: number | undefined;
2090
+ todosChannel?: string | undefined;
2091
+ inputBlocksChannel?: string | undefined;
2092
+ visibleChannels?: string[] | undefined;
2093
+ memory?: {
2094
+ namespace: string;
2095
+ topK?: number | undefined;
2096
+ recall?: "vector" | "graph" | "both" | undefined;
2097
+ } | undefined;
2098
+ skills?: {
2099
+ namespace: string;
2100
+ required?: string[] | undefined;
2101
+ advisoryK?: number | undefined;
2102
+ } | undefined;
2103
+ enableFs?: boolean | undefined;
2104
+ mcpConnectionId?: string | undefined;
2105
+ actionConnections?: Record<string, string> | undefined;
2106
+ resolvedMiddleware?: ({
2107
+ kind: "compress";
2108
+ } | {
2109
+ kind: "terse";
2110
+ } | {
2111
+ params: {
2112
+ chars: number;
2113
+ };
2114
+ kind: "contextBudget";
2115
+ } | {
2116
+ kind: "reflection";
2117
+ params?: {
2118
+ threshold?: number | undefined;
2119
+ } | undefined;
2120
+ } | {
2121
+ params: {
2122
+ schema: Record<string, unknown>;
2123
+ strict?: boolean | undefined;
2124
+ name?: string | undefined;
2125
+ mode?: "required" | "lenient" | undefined;
2126
+ retryCap?: number | undefined;
2127
+ };
2128
+ kind: "structuredOutput";
2129
+ })[] | undefined;
2130
+ }, {
2131
+ provider?: string | undefined;
2132
+ tier?: "frontier" | "balanced" | "fast" | "creative" | undefined;
2133
+ suspendForApproval?: boolean | undefined;
2134
+ outputChannel?: string | undefined;
2135
+ model?: string | undefined;
2136
+ baseURL?: string | undefined;
2137
+ apiKeyEnv?: string | undefined;
2138
+ system?: string | undefined;
2139
+ toolNames?: string[] | undefined;
2140
+ toolSpecs?: {
2141
+ name: string;
2142
+ description?: string | undefined;
2143
+ jsonSchema?: Record<string, unknown> | undefined;
2144
+ }[] | undefined;
2145
+ maxIterations?: number | undefined;
2146
+ approvalToolNames?: string[] | undefined;
2147
+ outputStyle?: "terse" | undefined;
2148
+ contextBudget?: number | undefined;
2149
+ todosChannel?: string | undefined;
2150
+ inputBlocksChannel?: string | undefined;
2151
+ visibleChannels?: string[] | undefined;
2152
+ memory?: {
2153
+ namespace: string;
2154
+ topK?: number | undefined;
2155
+ recall?: "vector" | "graph" | "both" | undefined;
2156
+ } | undefined;
2157
+ skills?: {
2158
+ namespace: string;
2159
+ required?: string[] | undefined;
2160
+ advisoryK?: number | undefined;
2161
+ } | undefined;
2162
+ enableFs?: boolean | undefined;
2163
+ mcpConnectionId?: string | undefined;
2164
+ actionConnections?: Record<string, string> | undefined;
2165
+ resolvedMiddleware?: ({
2166
+ kind: "compress";
2167
+ } | {
2168
+ kind: "terse";
2169
+ } | {
2170
+ params: {
2171
+ chars: number;
2172
+ };
2173
+ kind: "contextBudget";
2174
+ } | {
2175
+ kind: "reflection";
2176
+ params?: {
2177
+ threshold?: number | undefined;
2178
+ } | undefined;
2179
+ } | {
2180
+ params: {
2181
+ schema: Record<string, unknown>;
2182
+ strict?: boolean | undefined;
2183
+ name?: string | undefined;
2184
+ mode?: "required" | "lenient" | undefined;
2185
+ retryCap?: number | undefined;
2186
+ };
2187
+ kind: "structuredOutput";
2188
+ })[] | undefined;
2189
+ }>;
2190
+ /** When true, a spawn that needs approval suspends the whole map (default false). */
2191
+ suspendForApproval: z.ZodOptional<z.ZodBoolean>;
2192
+ }, "strip", z.ZodTypeAny, {
2193
+ joinAt: string;
2194
+ overChannel: string;
2195
+ subAgent: {
2196
+ provider?: string | undefined;
2197
+ tier?: "frontier" | "balanced" | "fast" | "creative" | undefined;
2198
+ suspendForApproval?: boolean | undefined;
2199
+ outputChannel?: string | undefined;
2200
+ model?: string | undefined;
2201
+ baseURL?: string | undefined;
2202
+ apiKeyEnv?: string | undefined;
2203
+ system?: string | undefined;
2204
+ toolNames?: string[] | undefined;
2205
+ toolSpecs?: {
2206
+ name: string;
2207
+ description?: string | undefined;
2208
+ jsonSchema?: Record<string, unknown> | undefined;
2209
+ }[] | undefined;
2210
+ maxIterations?: number | undefined;
2211
+ approvalToolNames?: string[] | undefined;
2212
+ outputStyle?: "terse" | undefined;
2213
+ contextBudget?: number | undefined;
2214
+ todosChannel?: string | undefined;
2215
+ inputBlocksChannel?: string | undefined;
2216
+ visibleChannels?: string[] | undefined;
2217
+ memory?: {
2218
+ namespace: string;
2219
+ topK?: number | undefined;
2220
+ recall?: "vector" | "graph" | "both" | undefined;
2221
+ } | undefined;
2222
+ skills?: {
2223
+ namespace: string;
2224
+ required?: string[] | undefined;
2225
+ advisoryK?: number | undefined;
2226
+ } | undefined;
2227
+ enableFs?: boolean | undefined;
2228
+ mcpConnectionId?: string | undefined;
2229
+ actionConnections?: Record<string, string> | undefined;
2230
+ resolvedMiddleware?: ({
2231
+ kind: "compress";
2232
+ } | {
2233
+ kind: "terse";
2234
+ } | {
2235
+ params: {
2236
+ chars: number;
2237
+ };
2238
+ kind: "contextBudget";
2239
+ } | {
2240
+ kind: "reflection";
2241
+ params?: {
2242
+ threshold?: number | undefined;
2243
+ } | undefined;
2244
+ } | {
2245
+ params: {
2246
+ schema: Record<string, unknown>;
2247
+ strict?: boolean | undefined;
2248
+ name?: string | undefined;
2249
+ mode?: "required" | "lenient" | undefined;
2250
+ retryCap?: number | undefined;
2251
+ };
2252
+ kind: "structuredOutput";
2253
+ })[] | undefined;
2254
+ };
2255
+ suspendForApproval?: boolean | undefined;
2256
+ }, {
2257
+ joinAt: string;
2258
+ overChannel: string;
2259
+ subAgent: {
2260
+ provider?: string | undefined;
2261
+ tier?: "frontier" | "balanced" | "fast" | "creative" | undefined;
2262
+ suspendForApproval?: boolean | undefined;
2263
+ outputChannel?: string | undefined;
2264
+ model?: string | undefined;
2265
+ baseURL?: string | undefined;
2266
+ apiKeyEnv?: string | undefined;
2267
+ system?: string | undefined;
2268
+ toolNames?: string[] | undefined;
2269
+ toolSpecs?: {
2270
+ name: string;
2271
+ description?: string | undefined;
2272
+ jsonSchema?: Record<string, unknown> | undefined;
2273
+ }[] | undefined;
2274
+ maxIterations?: number | undefined;
2275
+ approvalToolNames?: string[] | undefined;
2276
+ outputStyle?: "terse" | undefined;
2277
+ contextBudget?: number | undefined;
2278
+ todosChannel?: string | undefined;
2279
+ inputBlocksChannel?: string | undefined;
2280
+ visibleChannels?: string[] | undefined;
2281
+ memory?: {
2282
+ namespace: string;
2283
+ topK?: number | undefined;
2284
+ recall?: "vector" | "graph" | "both" | undefined;
2285
+ } | undefined;
2286
+ skills?: {
2287
+ namespace: string;
2288
+ required?: string[] | undefined;
2289
+ advisoryK?: number | undefined;
2290
+ } | undefined;
2291
+ enableFs?: boolean | undefined;
2292
+ mcpConnectionId?: string | undefined;
2293
+ actionConnections?: Record<string, string> | undefined;
2294
+ resolvedMiddleware?: ({
2295
+ kind: "compress";
2296
+ } | {
2297
+ kind: "terse";
2298
+ } | {
2299
+ params: {
2300
+ chars: number;
2301
+ };
2302
+ kind: "contextBudget";
2303
+ } | {
2304
+ kind: "reflection";
2305
+ params?: {
2306
+ threshold?: number | undefined;
2307
+ } | undefined;
2308
+ } | {
2309
+ params: {
2310
+ schema: Record<string, unknown>;
2311
+ strict?: boolean | undefined;
2312
+ name?: string | undefined;
2313
+ mode?: "required" | "lenient" | undefined;
2314
+ retryCap?: number | undefined;
2315
+ };
2316
+ kind: "structuredOutput";
2317
+ })[] | undefined;
2318
+ };
2319
+ suspendForApproval?: boolean | undefined;
2320
+ }>>;
2321
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
2322
+ component: z.ZodOptional<z.ZodObject<{
2323
+ /** One of `ComponentRegistry::kinds()` (e.g. "promptBuilder") or an integration name. */
2324
+ kind: z.ZodString;
2325
+ /** The component's parameter bag; validated by the native factory at assemble time. */
2326
+ params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2327
+ }, "strip", z.ZodTypeAny, {
2328
+ params: Record<string, unknown>;
2329
+ kind: string;
2330
+ }, {
2331
+ params: Record<string, unknown>;
2332
+ kind: string;
2333
+ }>>;
2334
+ agent: z.ZodOptional<z.ZodObject<{
2335
+ provider: z.ZodOptional<z.ZodString>;
2336
+ model: z.ZodOptional<z.ZodString>;
2337
+ tier: z.ZodOptional<z.ZodEnum<["frontier", "balanced", "fast", "creative"]>>;
2338
+ /** A custom OpenAI-compatible endpoint (`model.openaiCompatible`) and the env var naming its key. */
2339
+ baseURL: z.ZodOptional<z.ZodString>;
2340
+ apiKeyEnv: z.ZodOptional<z.ZodString>;
2341
+ system: z.ZodOptional<z.ZodString>;
2342
+ toolNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2343
+ /** Each tool's description and input JSON Schema, as the LLM sees them. */
2344
+ toolSpecs: z.ZodOptional<z.ZodArray<z.ZodObject<{
2345
+ name: z.ZodString;
2346
+ description: z.ZodOptional<z.ZodString>;
2347
+ jsonSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2348
+ }, "strip", z.ZodTypeAny, {
2349
+ name: string;
2350
+ description?: string | undefined;
2351
+ jsonSchema?: Record<string, unknown> | undefined;
2352
+ }, {
2353
+ name: string;
2354
+ description?: string | undefined;
2355
+ jsonSchema?: Record<string, unknown> | undefined;
2356
+ }>, "many">>;
2357
+ maxIterations: z.ZodOptional<z.ZodNumber>;
2358
+ suspendForApproval: z.ZodOptional<z.ZodBoolean>;
2359
+ approvalToolNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2360
+ outputChannel: z.ZodOptional<z.ZodString>;
2361
+ /** ADR 0014 — terse output directive on the system prompt. */
2362
+ outputStyle: z.ZodOptional<z.ZodLiteral<"terse">>;
2363
+ /** ADR 0014 — cap (chars) on the agent's seed message (the injected `Input`/`State` dump). */
2364
+ contextBudget: z.ZodOptional<z.ZodNumber>;
2365
+ /** ADR 0022/0023 — durable channel the agent's `writeTodos` list is persisted into. */
2366
+ todosChannel: z.ZodOptional<z.ZodString>;
2367
+ /** ADR 0030 phase 9e — channel carrying the run's multimodal input blocks. */
2368
+ inputBlocksChannel: z.ZodOptional<z.ZodString>;
2369
+ /** The only channels the agent is shown in its seed state (context isolation). */
2370
+ visibleChannels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2371
+ /** ADR 0026 phase 11 — governed long-term memory overlay (namespace tenant-scoped). */
2372
+ memory: z.ZodOptional<z.ZodObject<{
2373
+ namespace: z.ZodString;
2374
+ topK: z.ZodOptional<z.ZodNumber>;
2375
+ recall: z.ZodOptional<z.ZodEnum<["vector", "graph", "both"]>>;
2376
+ }, "strip", z.ZodTypeAny, {
2377
+ namespace: string;
2378
+ topK?: number | undefined;
2379
+ recall?: "vector" | "graph" | "both" | undefined;
2380
+ }, {
2381
+ namespace: string;
2382
+ topK?: number | undefined;
2383
+ recall?: "vector" | "graph" | "both" | undefined;
2384
+ }>>;
2385
+ /** ADR 0035 phase 12 — governed skills overlay (progressive disclosure; namespace tenant-scoped). */
2386
+ skills: z.ZodOptional<z.ZodObject<{
2387
+ namespace: z.ZodString;
2388
+ /** Explicit `name@version` pins — the must-apply playbooks. */
2389
+ required: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2390
+ /** Cap on advisory (vector-selected) skills. */
2391
+ advisoryK: z.ZodOptional<z.ZodNumber>;
2392
+ }, "strip", z.ZodTypeAny, {
2393
+ namespace: string;
2394
+ required?: string[] | undefined;
2395
+ advisoryK?: number | undefined;
2396
+ }, {
2397
+ namespace: string;
2398
+ required?: string[] | undefined;
2399
+ advisoryK?: number | undefined;
2400
+ }>>;
2401
+ /** ADR 0024 phase 2c/2d — opt this agent into the governed virtual filesystem tools. */
2402
+ enableFs: z.ZodOptional<z.ZodBoolean>;
2403
+ /**
2404
+ * ADR 0075 (issue #566 G3) — attach an external MCP server's tools to this agent, mid-run. The
2405
+ * value references a tenant-owned `connector_connections` row (`provider: "mcp"`), resolved and
2406
+ * connected at run start; every discovered tool is unconditionally `requiresApproval` (an MCP
2407
+ * server is code Ailu does not control and cannot statically vet). Distinct from `toolNames`/
2408
+ * `approvalToolNames` above — those are re-derived at run start to include the tools this
2409
+ * connection discovers, since the tool set isn't known until the server is actually queried.
2410
+ */
2411
+ mcpConnectionId: z.ZodOptional<z.ZodString>;
2412
+ /**
2413
+ * Issue #566 G19 — attach one or more governed action-tool connectors to this agent, mid-run.
2414
+ * Keyed by provider id (e.g. `"slack"`), value is a tenant-owned `connector_connections` row id.
2415
+ * Same resolution shape as `mcpConnectionId` (control plane resolves the connection, discovers
2416
+ * that provider's action tools, merges them into `toolNames`/`approvalToolNames` before the run
2417
+ * reaches this carrier — the Rust engine never resolves a connection itself), generalized to a
2418
+ * map so adding the NEXT provider (Linear, Salesforce, ...) never needs another engine field/
2419
+ * release — only a new product-side adapter keyed into the same map.
2420
+ */
2421
+ actionConnections: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2422
+ /**
2423
+ * ADR 0025 phase 3d — the resolved EFFICIENCY middleware list. A discriminated union of
2424
+ * efficiency-only kinds (compress / terse / contextBudget): a GOVERNANCE kind (redact /
2425
+ * approvalGate / fsPolicy) fails this schema BY CONSTRUCTION, so any consumer that runs it
2426
+ * (e.g. `readAgentMetadata`) drops the malformed agent. This is a **type-level + validation
2427
+ * guarantee** for callers that opt to validate; it is NOT auto-applied on the persisted
2428
+ * catalog run path today (that path reads an unvalidated carrier — the RUNTIME enforcer
2429
+ * there is the Rust bridge, whose match only honours efficiency kinds and ignores governance
2430
+ * kinds). The SDK's `toRustAgentConfig` throw-gate covers the in-process builder path.
2431
+ */
2432
+ resolvedMiddleware: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
2433
+ kind: z.ZodLiteral<"compress">;
2434
+ }, "strip", z.ZodTypeAny, {
2435
+ kind: "compress";
2436
+ }, {
2437
+ kind: "compress";
2438
+ }>, z.ZodObject<{
2439
+ kind: z.ZodLiteral<"terse">;
2440
+ }, "strip", z.ZodTypeAny, {
2441
+ kind: "terse";
2442
+ }, {
2443
+ kind: "terse";
2444
+ }>, z.ZodObject<{
2445
+ kind: z.ZodLiteral<"contextBudget">;
2446
+ params: z.ZodObject<{
2447
+ chars: z.ZodNumber;
2448
+ }, "strip", z.ZodTypeAny, {
2449
+ chars: number;
2450
+ }, {
2451
+ chars: number;
2452
+ }>;
2453
+ }, "strip", z.ZodTypeAny, {
2454
+ params: {
2455
+ chars: number;
2456
+ };
2457
+ kind: "contextBudget";
2458
+ }, {
2459
+ params: {
2460
+ chars: number;
2461
+ };
2462
+ kind: "contextBudget";
2463
+ }>, z.ZodObject<{
2464
+ kind: z.ZodLiteral<"reflection">;
2465
+ params: z.ZodOptional<z.ZodObject<{
2466
+ threshold: z.ZodOptional<z.ZodNumber>;
2467
+ }, "strip", z.ZodTypeAny, {
2468
+ threshold?: number | undefined;
2469
+ }, {
2470
+ threshold?: number | undefined;
2471
+ }>>;
2472
+ }, "strip", z.ZodTypeAny, {
2473
+ kind: "reflection";
2474
+ params?: {
2475
+ threshold?: number | undefined;
2476
+ } | undefined;
2477
+ }, {
2478
+ kind: "reflection";
2479
+ params?: {
2480
+ threshold?: number | undefined;
2481
+ } | undefined;
2482
+ }>, z.ZodObject<{
2483
+ kind: z.ZodLiteral<"structuredOutput">;
2484
+ params: z.ZodObject<{
2485
+ schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2486
+ name: z.ZodOptional<z.ZodString>;
2487
+ strict: z.ZodOptional<z.ZodBoolean>;
2488
+ mode: z.ZodOptional<z.ZodEnum<["required", "lenient"]>>;
2489
+ retryCap: z.ZodOptional<z.ZodNumber>;
2490
+ }, "strip", z.ZodTypeAny, {
2491
+ schema: Record<string, unknown>;
2492
+ strict?: boolean | undefined;
2493
+ name?: string | undefined;
2494
+ mode?: "required" | "lenient" | undefined;
2495
+ retryCap?: number | undefined;
2496
+ }, {
2497
+ schema: Record<string, unknown>;
2498
+ strict?: boolean | undefined;
2499
+ name?: string | undefined;
2500
+ mode?: "required" | "lenient" | undefined;
2501
+ retryCap?: number | undefined;
2502
+ }>;
2503
+ }, "strip", z.ZodTypeAny, {
2504
+ params: {
2505
+ schema: Record<string, unknown>;
2506
+ strict?: boolean | undefined;
2507
+ name?: string | undefined;
2508
+ mode?: "required" | "lenient" | undefined;
2509
+ retryCap?: number | undefined;
2510
+ };
2511
+ kind: "structuredOutput";
2512
+ }, {
2513
+ params: {
2514
+ schema: Record<string, unknown>;
2515
+ strict?: boolean | undefined;
2516
+ name?: string | undefined;
2517
+ mode?: "required" | "lenient" | undefined;
2518
+ retryCap?: number | undefined;
2519
+ };
2520
+ kind: "structuredOutput";
2521
+ }>]>, "many">>;
2522
+ }, "strip", z.ZodTypeAny, {
2523
+ provider?: string | undefined;
2524
+ tier?: "frontier" | "balanced" | "fast" | "creative" | undefined;
2525
+ suspendForApproval?: boolean | undefined;
2526
+ outputChannel?: string | undefined;
2527
+ model?: string | undefined;
2528
+ baseURL?: string | undefined;
2529
+ apiKeyEnv?: string | undefined;
2530
+ system?: string | undefined;
2531
+ toolNames?: string[] | undefined;
2532
+ toolSpecs?: {
2533
+ name: string;
2534
+ description?: string | undefined;
2535
+ jsonSchema?: Record<string, unknown> | undefined;
2536
+ }[] | undefined;
2537
+ maxIterations?: number | undefined;
2538
+ approvalToolNames?: string[] | undefined;
2539
+ outputStyle?: "terse" | undefined;
2540
+ contextBudget?: number | undefined;
2541
+ todosChannel?: string | undefined;
2542
+ inputBlocksChannel?: string | undefined;
2543
+ visibleChannels?: string[] | undefined;
2544
+ memory?: {
2545
+ namespace: string;
2546
+ topK?: number | undefined;
2547
+ recall?: "vector" | "graph" | "both" | undefined;
2548
+ } | undefined;
2549
+ skills?: {
2550
+ namespace: string;
2551
+ required?: string[] | undefined;
2552
+ advisoryK?: number | undefined;
2553
+ } | undefined;
2554
+ enableFs?: boolean | undefined;
2555
+ mcpConnectionId?: string | undefined;
2556
+ actionConnections?: Record<string, string> | undefined;
2557
+ resolvedMiddleware?: ({
2558
+ kind: "compress";
2559
+ } | {
2560
+ kind: "terse";
2561
+ } | {
2562
+ params: {
2563
+ chars: number;
2564
+ };
2565
+ kind: "contextBudget";
2566
+ } | {
2567
+ kind: "reflection";
2568
+ params?: {
2569
+ threshold?: number | undefined;
2570
+ } | undefined;
2571
+ } | {
2572
+ params: {
2573
+ schema: Record<string, unknown>;
2574
+ strict?: boolean | undefined;
2575
+ name?: string | undefined;
2576
+ mode?: "required" | "lenient" | undefined;
2577
+ retryCap?: number | undefined;
2578
+ };
2579
+ kind: "structuredOutput";
2580
+ })[] | undefined;
2581
+ }, {
2582
+ provider?: string | undefined;
2583
+ tier?: "frontier" | "balanced" | "fast" | "creative" | undefined;
2584
+ suspendForApproval?: boolean | undefined;
2585
+ outputChannel?: string | undefined;
2586
+ model?: string | undefined;
2587
+ baseURL?: string | undefined;
2588
+ apiKeyEnv?: string | undefined;
2589
+ system?: string | undefined;
2590
+ toolNames?: string[] | undefined;
2591
+ toolSpecs?: {
2592
+ name: string;
2593
+ description?: string | undefined;
2594
+ jsonSchema?: Record<string, unknown> | undefined;
2595
+ }[] | undefined;
2596
+ maxIterations?: number | undefined;
2597
+ approvalToolNames?: string[] | undefined;
2598
+ outputStyle?: "terse" | undefined;
2599
+ contextBudget?: number | undefined;
2600
+ todosChannel?: string | undefined;
2601
+ inputBlocksChannel?: string | undefined;
2602
+ visibleChannels?: string[] | undefined;
2603
+ memory?: {
2604
+ namespace: string;
2605
+ topK?: number | undefined;
2606
+ recall?: "vector" | "graph" | "both" | undefined;
2607
+ } | undefined;
2608
+ skills?: {
2609
+ namespace: string;
2610
+ required?: string[] | undefined;
2611
+ advisoryK?: number | undefined;
2612
+ } | undefined;
2613
+ enableFs?: boolean | undefined;
2614
+ mcpConnectionId?: string | undefined;
2615
+ actionConnections?: Record<string, string> | undefined;
2616
+ resolvedMiddleware?: ({
2617
+ kind: "compress";
2618
+ } | {
2619
+ kind: "terse";
2620
+ } | {
2621
+ params: {
2622
+ chars: number;
2623
+ };
2624
+ kind: "contextBudget";
2625
+ } | {
2626
+ kind: "reflection";
2627
+ params?: {
2628
+ threshold?: number | undefined;
2629
+ } | undefined;
2630
+ } | {
2631
+ params: {
2632
+ schema: Record<string, unknown>;
2633
+ strict?: boolean | undefined;
2634
+ name?: string | undefined;
2635
+ mode?: "required" | "lenient" | undefined;
2636
+ retryCap?: number | undefined;
2637
+ };
2638
+ kind: "structuredOutput";
2639
+ })[] | undefined;
2640
+ }>>;
2641
+ mapAgents: z.ZodOptional<z.ZodObject<{
2642
+ /** Channel holding the array of items to fan the sub-agent out over. */
2643
+ overChannel: z.ZodString;
2644
+ /** Channel the array of per-item results lands in (one entry per item, in input order). */
2645
+ joinAt: z.ZodString;
2646
+ /** The sub-agent run per item — a full agent carrier. */
2647
+ subAgent: z.ZodObject<{
2648
+ provider: z.ZodOptional<z.ZodString>;
2649
+ model: z.ZodOptional<z.ZodString>;
2650
+ tier: z.ZodOptional<z.ZodEnum<["frontier", "balanced", "fast", "creative"]>>;
2651
+ /** A custom OpenAI-compatible endpoint (`model.openaiCompatible`) and the env var naming its key. */
2652
+ baseURL: z.ZodOptional<z.ZodString>;
2653
+ apiKeyEnv: z.ZodOptional<z.ZodString>;
2654
+ system: z.ZodOptional<z.ZodString>;
2655
+ toolNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2656
+ /** Each tool's description and input JSON Schema, as the LLM sees them. */
2657
+ toolSpecs: z.ZodOptional<z.ZodArray<z.ZodObject<{
2658
+ name: z.ZodString;
2659
+ description: z.ZodOptional<z.ZodString>;
2660
+ jsonSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2661
+ }, "strip", z.ZodTypeAny, {
2662
+ name: string;
2663
+ description?: string | undefined;
2664
+ jsonSchema?: Record<string, unknown> | undefined;
2665
+ }, {
2666
+ name: string;
2667
+ description?: string | undefined;
2668
+ jsonSchema?: Record<string, unknown> | undefined;
2669
+ }>, "many">>;
2670
+ maxIterations: z.ZodOptional<z.ZodNumber>;
2671
+ suspendForApproval: z.ZodOptional<z.ZodBoolean>;
2672
+ approvalToolNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2673
+ outputChannel: z.ZodOptional<z.ZodString>;
2674
+ /** ADR 0014 — terse output directive on the system prompt. */
2675
+ outputStyle: z.ZodOptional<z.ZodLiteral<"terse">>;
2676
+ /** ADR 0014 — cap (chars) on the agent's seed message (the injected `Input`/`State` dump). */
2677
+ contextBudget: z.ZodOptional<z.ZodNumber>;
2678
+ /** ADR 0022/0023 — durable channel the agent's `writeTodos` list is persisted into. */
2679
+ todosChannel: z.ZodOptional<z.ZodString>;
2680
+ /** ADR 0030 phase 9e — channel carrying the run's multimodal input blocks. */
2681
+ inputBlocksChannel: z.ZodOptional<z.ZodString>;
2682
+ /** The only channels the agent is shown in its seed state (context isolation). */
2683
+ visibleChannels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2684
+ /** ADR 0026 phase 11 — governed long-term memory overlay (namespace tenant-scoped). */
2685
+ memory: z.ZodOptional<z.ZodObject<{
2686
+ namespace: z.ZodString;
2687
+ topK: z.ZodOptional<z.ZodNumber>;
2688
+ recall: z.ZodOptional<z.ZodEnum<["vector", "graph", "both"]>>;
2689
+ }, "strip", z.ZodTypeAny, {
2690
+ namespace: string;
2691
+ topK?: number | undefined;
2692
+ recall?: "vector" | "graph" | "both" | undefined;
2693
+ }, {
2694
+ namespace: string;
2695
+ topK?: number | undefined;
2696
+ recall?: "vector" | "graph" | "both" | undefined;
2697
+ }>>;
2698
+ /** ADR 0035 phase 12 — governed skills overlay (progressive disclosure; namespace tenant-scoped). */
2699
+ skills: z.ZodOptional<z.ZodObject<{
2700
+ namespace: z.ZodString;
2701
+ /** Explicit `name@version` pins — the must-apply playbooks. */
2702
+ required: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2703
+ /** Cap on advisory (vector-selected) skills. */
2704
+ advisoryK: z.ZodOptional<z.ZodNumber>;
2705
+ }, "strip", z.ZodTypeAny, {
2706
+ namespace: string;
2707
+ required?: string[] | undefined;
2708
+ advisoryK?: number | undefined;
2709
+ }, {
2710
+ namespace: string;
2711
+ required?: string[] | undefined;
2712
+ advisoryK?: number | undefined;
2713
+ }>>;
2714
+ /** ADR 0024 phase 2c/2d — opt this agent into the governed virtual filesystem tools. */
2715
+ enableFs: z.ZodOptional<z.ZodBoolean>;
2716
+ /**
2717
+ * ADR 0075 (issue #566 G3) — attach an external MCP server's tools to this agent, mid-run. The
2718
+ * value references a tenant-owned `connector_connections` row (`provider: "mcp"`), resolved and
2719
+ * connected at run start; every discovered tool is unconditionally `requiresApproval` (an MCP
2720
+ * server is code Ailu does not control and cannot statically vet). Distinct from `toolNames`/
2721
+ * `approvalToolNames` above — those are re-derived at run start to include the tools this
2722
+ * connection discovers, since the tool set isn't known until the server is actually queried.
2723
+ */
2724
+ mcpConnectionId: z.ZodOptional<z.ZodString>;
2725
+ /**
2726
+ * Issue #566 G19 — attach one or more governed action-tool connectors to this agent, mid-run.
2727
+ * Keyed by provider id (e.g. `"slack"`), value is a tenant-owned `connector_connections` row id.
2728
+ * Same resolution shape as `mcpConnectionId` (control plane resolves the connection, discovers
2729
+ * that provider's action tools, merges them into `toolNames`/`approvalToolNames` before the run
2730
+ * reaches this carrier — the Rust engine never resolves a connection itself), generalized to a
2731
+ * map so adding the NEXT provider (Linear, Salesforce, ...) never needs another engine field/
2732
+ * release — only a new product-side adapter keyed into the same map.
2733
+ */
2734
+ actionConnections: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2735
+ /**
2736
+ * ADR 0025 phase 3d — the resolved EFFICIENCY middleware list. A discriminated union of
2737
+ * efficiency-only kinds (compress / terse / contextBudget): a GOVERNANCE kind (redact /
2738
+ * approvalGate / fsPolicy) fails this schema BY CONSTRUCTION, so any consumer that runs it
2739
+ * (e.g. `readAgentMetadata`) drops the malformed agent. This is a **type-level + validation
2740
+ * guarantee** for callers that opt to validate; it is NOT auto-applied on the persisted
2741
+ * catalog run path today (that path reads an unvalidated carrier — the RUNTIME enforcer
2742
+ * there is the Rust bridge, whose match only honours efficiency kinds and ignores governance
2743
+ * kinds). The SDK's `toRustAgentConfig` throw-gate covers the in-process builder path.
2744
+ */
2745
+ resolvedMiddleware: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
2746
+ kind: z.ZodLiteral<"compress">;
2747
+ }, "strip", z.ZodTypeAny, {
2748
+ kind: "compress";
2749
+ }, {
2750
+ kind: "compress";
2751
+ }>, z.ZodObject<{
2752
+ kind: z.ZodLiteral<"terse">;
2753
+ }, "strip", z.ZodTypeAny, {
2754
+ kind: "terse";
2755
+ }, {
2756
+ kind: "terse";
2757
+ }>, z.ZodObject<{
2758
+ kind: z.ZodLiteral<"contextBudget">;
2759
+ params: z.ZodObject<{
2760
+ chars: z.ZodNumber;
2761
+ }, "strip", z.ZodTypeAny, {
2762
+ chars: number;
2763
+ }, {
2764
+ chars: number;
2765
+ }>;
2766
+ }, "strip", z.ZodTypeAny, {
2767
+ params: {
2768
+ chars: number;
2769
+ };
2770
+ kind: "contextBudget";
2771
+ }, {
2772
+ params: {
2773
+ chars: number;
2774
+ };
2775
+ kind: "contextBudget";
2776
+ }>, z.ZodObject<{
2777
+ kind: z.ZodLiteral<"reflection">;
2778
+ params: z.ZodOptional<z.ZodObject<{
2779
+ threshold: z.ZodOptional<z.ZodNumber>;
2780
+ }, "strip", z.ZodTypeAny, {
2781
+ threshold?: number | undefined;
2782
+ }, {
2783
+ threshold?: number | undefined;
2784
+ }>>;
2785
+ }, "strip", z.ZodTypeAny, {
2786
+ kind: "reflection";
2787
+ params?: {
2788
+ threshold?: number | undefined;
2789
+ } | undefined;
2790
+ }, {
2791
+ kind: "reflection";
2792
+ params?: {
2793
+ threshold?: number | undefined;
2794
+ } | undefined;
2795
+ }>, z.ZodObject<{
2796
+ kind: z.ZodLiteral<"structuredOutput">;
2797
+ params: z.ZodObject<{
2798
+ schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2799
+ name: z.ZodOptional<z.ZodString>;
2800
+ strict: z.ZodOptional<z.ZodBoolean>;
2801
+ mode: z.ZodOptional<z.ZodEnum<["required", "lenient"]>>;
2802
+ retryCap: z.ZodOptional<z.ZodNumber>;
2803
+ }, "strip", z.ZodTypeAny, {
2804
+ schema: Record<string, unknown>;
2805
+ strict?: boolean | undefined;
2806
+ name?: string | undefined;
2807
+ mode?: "required" | "lenient" | undefined;
2808
+ retryCap?: number | undefined;
2809
+ }, {
2810
+ schema: Record<string, unknown>;
2811
+ strict?: boolean | undefined;
2812
+ name?: string | undefined;
2813
+ mode?: "required" | "lenient" | undefined;
2814
+ retryCap?: number | undefined;
2815
+ }>;
2816
+ }, "strip", z.ZodTypeAny, {
2817
+ params: {
2818
+ schema: Record<string, unknown>;
2819
+ strict?: boolean | undefined;
2820
+ name?: string | undefined;
2821
+ mode?: "required" | "lenient" | undefined;
2822
+ retryCap?: number | undefined;
2823
+ };
2824
+ kind: "structuredOutput";
2825
+ }, {
2826
+ params: {
2827
+ schema: Record<string, unknown>;
2828
+ strict?: boolean | undefined;
2829
+ name?: string | undefined;
2830
+ mode?: "required" | "lenient" | undefined;
2831
+ retryCap?: number | undefined;
2832
+ };
2833
+ kind: "structuredOutput";
2834
+ }>]>, "many">>;
2835
+ }, "strip", z.ZodTypeAny, {
2836
+ provider?: string | undefined;
2837
+ tier?: "frontier" | "balanced" | "fast" | "creative" | undefined;
2838
+ suspendForApproval?: boolean | undefined;
2839
+ outputChannel?: string | undefined;
2840
+ model?: string | undefined;
2841
+ baseURL?: string | undefined;
2842
+ apiKeyEnv?: string | undefined;
2843
+ system?: string | undefined;
2844
+ toolNames?: string[] | undefined;
2845
+ toolSpecs?: {
2846
+ name: string;
2847
+ description?: string | undefined;
2848
+ jsonSchema?: Record<string, unknown> | undefined;
2849
+ }[] | undefined;
2850
+ maxIterations?: number | undefined;
2851
+ approvalToolNames?: string[] | undefined;
2852
+ outputStyle?: "terse" | undefined;
2853
+ contextBudget?: number | undefined;
2854
+ todosChannel?: string | undefined;
2855
+ inputBlocksChannel?: string | undefined;
2856
+ visibleChannels?: string[] | undefined;
2857
+ memory?: {
2858
+ namespace: string;
2859
+ topK?: number | undefined;
2860
+ recall?: "vector" | "graph" | "both" | undefined;
2861
+ } | undefined;
2862
+ skills?: {
2863
+ namespace: string;
2864
+ required?: string[] | undefined;
2865
+ advisoryK?: number | undefined;
2866
+ } | undefined;
2867
+ enableFs?: boolean | undefined;
2868
+ mcpConnectionId?: string | undefined;
2869
+ actionConnections?: Record<string, string> | undefined;
2870
+ resolvedMiddleware?: ({
2871
+ kind: "compress";
2872
+ } | {
2873
+ kind: "terse";
2874
+ } | {
2875
+ params: {
2876
+ chars: number;
2877
+ };
2878
+ kind: "contextBudget";
2879
+ } | {
2880
+ kind: "reflection";
2881
+ params?: {
2882
+ threshold?: number | undefined;
2883
+ } | undefined;
2884
+ } | {
2885
+ params: {
2886
+ schema: Record<string, unknown>;
2887
+ strict?: boolean | undefined;
2888
+ name?: string | undefined;
2889
+ mode?: "required" | "lenient" | undefined;
2890
+ retryCap?: number | undefined;
2891
+ };
2892
+ kind: "structuredOutput";
2893
+ })[] | undefined;
2894
+ }, {
2895
+ provider?: string | undefined;
2896
+ tier?: "frontier" | "balanced" | "fast" | "creative" | undefined;
2897
+ suspendForApproval?: boolean | undefined;
2898
+ outputChannel?: string | undefined;
2899
+ model?: string | undefined;
2900
+ baseURL?: string | undefined;
2901
+ apiKeyEnv?: string | undefined;
2902
+ system?: string | undefined;
2903
+ toolNames?: string[] | undefined;
2904
+ toolSpecs?: {
2905
+ name: string;
2906
+ description?: string | undefined;
2907
+ jsonSchema?: Record<string, unknown> | undefined;
2908
+ }[] | undefined;
2909
+ maxIterations?: number | undefined;
2910
+ approvalToolNames?: string[] | undefined;
2911
+ outputStyle?: "terse" | undefined;
2912
+ contextBudget?: number | undefined;
2913
+ todosChannel?: string | undefined;
2914
+ inputBlocksChannel?: string | undefined;
2915
+ visibleChannels?: string[] | undefined;
2916
+ memory?: {
2917
+ namespace: string;
2918
+ topK?: number | undefined;
2919
+ recall?: "vector" | "graph" | "both" | undefined;
2920
+ } | undefined;
2921
+ skills?: {
2922
+ namespace: string;
2923
+ required?: string[] | undefined;
2924
+ advisoryK?: number | undefined;
2925
+ } | undefined;
2926
+ enableFs?: boolean | undefined;
2927
+ mcpConnectionId?: string | undefined;
2928
+ actionConnections?: Record<string, string> | undefined;
2929
+ resolvedMiddleware?: ({
2930
+ kind: "compress";
2931
+ } | {
2932
+ kind: "terse";
2933
+ } | {
2934
+ params: {
2935
+ chars: number;
2936
+ };
2937
+ kind: "contextBudget";
2938
+ } | {
2939
+ kind: "reflection";
2940
+ params?: {
2941
+ threshold?: number | undefined;
2942
+ } | undefined;
2943
+ } | {
2944
+ params: {
2945
+ schema: Record<string, unknown>;
2946
+ strict?: boolean | undefined;
2947
+ name?: string | undefined;
2948
+ mode?: "required" | "lenient" | undefined;
2949
+ retryCap?: number | undefined;
2950
+ };
2951
+ kind: "structuredOutput";
2952
+ })[] | undefined;
2953
+ }>;
2954
+ /** When true, a spawn that needs approval suspends the whole map (default false). */
2955
+ suspendForApproval: z.ZodOptional<z.ZodBoolean>;
2956
+ }, "strip", z.ZodTypeAny, {
2957
+ joinAt: string;
2958
+ overChannel: string;
2959
+ subAgent: {
2960
+ provider?: string | undefined;
2961
+ tier?: "frontier" | "balanced" | "fast" | "creative" | undefined;
2962
+ suspendForApproval?: boolean | undefined;
2963
+ outputChannel?: string | undefined;
2964
+ model?: string | undefined;
2965
+ baseURL?: string | undefined;
2966
+ apiKeyEnv?: string | undefined;
2967
+ system?: string | undefined;
2968
+ toolNames?: string[] | undefined;
2969
+ toolSpecs?: {
2970
+ name: string;
2971
+ description?: string | undefined;
2972
+ jsonSchema?: Record<string, unknown> | undefined;
2973
+ }[] | undefined;
2974
+ maxIterations?: number | undefined;
2975
+ approvalToolNames?: string[] | undefined;
2976
+ outputStyle?: "terse" | undefined;
2977
+ contextBudget?: number | undefined;
2978
+ todosChannel?: string | undefined;
2979
+ inputBlocksChannel?: string | undefined;
2980
+ visibleChannels?: string[] | undefined;
2981
+ memory?: {
2982
+ namespace: string;
2983
+ topK?: number | undefined;
2984
+ recall?: "vector" | "graph" | "both" | undefined;
2985
+ } | undefined;
2986
+ skills?: {
2987
+ namespace: string;
2988
+ required?: string[] | undefined;
2989
+ advisoryK?: number | undefined;
2990
+ } | undefined;
2991
+ enableFs?: boolean | undefined;
2992
+ mcpConnectionId?: string | undefined;
2993
+ actionConnections?: Record<string, string> | undefined;
2994
+ resolvedMiddleware?: ({
2995
+ kind: "compress";
2996
+ } | {
2997
+ kind: "terse";
2998
+ } | {
2999
+ params: {
3000
+ chars: number;
3001
+ };
3002
+ kind: "contextBudget";
3003
+ } | {
3004
+ kind: "reflection";
3005
+ params?: {
3006
+ threshold?: number | undefined;
3007
+ } | undefined;
3008
+ } | {
3009
+ params: {
3010
+ schema: Record<string, unknown>;
3011
+ strict?: boolean | undefined;
3012
+ name?: string | undefined;
3013
+ mode?: "required" | "lenient" | undefined;
3014
+ retryCap?: number | undefined;
3015
+ };
3016
+ kind: "structuredOutput";
3017
+ })[] | undefined;
3018
+ };
3019
+ suspendForApproval?: boolean | undefined;
3020
+ }, {
3021
+ joinAt: string;
3022
+ overChannel: string;
3023
+ subAgent: {
3024
+ provider?: string | undefined;
3025
+ tier?: "frontier" | "balanced" | "fast" | "creative" | undefined;
3026
+ suspendForApproval?: boolean | undefined;
3027
+ outputChannel?: string | undefined;
3028
+ model?: string | undefined;
3029
+ baseURL?: string | undefined;
3030
+ apiKeyEnv?: string | undefined;
3031
+ system?: string | undefined;
3032
+ toolNames?: string[] | undefined;
3033
+ toolSpecs?: {
3034
+ name: string;
3035
+ description?: string | undefined;
3036
+ jsonSchema?: Record<string, unknown> | undefined;
3037
+ }[] | undefined;
3038
+ maxIterations?: number | undefined;
3039
+ approvalToolNames?: string[] | undefined;
3040
+ outputStyle?: "terse" | undefined;
3041
+ contextBudget?: number | undefined;
3042
+ todosChannel?: string | undefined;
3043
+ inputBlocksChannel?: string | undefined;
3044
+ visibleChannels?: string[] | undefined;
3045
+ memory?: {
3046
+ namespace: string;
3047
+ topK?: number | undefined;
3048
+ recall?: "vector" | "graph" | "both" | undefined;
3049
+ } | undefined;
3050
+ skills?: {
3051
+ namespace: string;
3052
+ required?: string[] | undefined;
3053
+ advisoryK?: number | undefined;
3054
+ } | undefined;
3055
+ enableFs?: boolean | undefined;
3056
+ mcpConnectionId?: string | undefined;
3057
+ actionConnections?: Record<string, string> | undefined;
3058
+ resolvedMiddleware?: ({
3059
+ kind: "compress";
3060
+ } | {
3061
+ kind: "terse";
3062
+ } | {
3063
+ params: {
3064
+ chars: number;
3065
+ };
3066
+ kind: "contextBudget";
3067
+ } | {
3068
+ kind: "reflection";
3069
+ params?: {
3070
+ threshold?: number | undefined;
3071
+ } | undefined;
3072
+ } | {
3073
+ params: {
3074
+ schema: Record<string, unknown>;
3075
+ strict?: boolean | undefined;
3076
+ name?: string | undefined;
3077
+ mode?: "required" | "lenient" | undefined;
3078
+ retryCap?: number | undefined;
3079
+ };
3080
+ kind: "structuredOutput";
3081
+ })[] | undefined;
3082
+ };
3083
+ suspendForApproval?: boolean | undefined;
3084
+ }>>;
3085
+ }, z.ZodTypeAny, "passthrough">>;
3086
+ export type ComponentNodeMetadata = z.infer<typeof ComponentNodeMetadataSchema>;
3087
+ export type AgentNodeMetadata = z.infer<typeof AgentNodeMetadataSchema>;
3088
+ export type MapAgentNodeMetadata = z.infer<typeof MapAgentNodeMetadataSchema>;
3089
+ export type CatalogNodeMetadata = z.infer<typeof CatalogNodeMetadataSchema>;
3090
+ /** Narrow an open metadata bag to its component carrier, if present and valid. */
3091
+ export declare const readComponentMetadata: (metadata: Record<string, unknown> | undefined) => ComponentNodeMetadata | undefined;
3092
+ /** Narrow an open metadata bag to its agent carrier, if present and valid. */
3093
+ export declare const readAgentMetadata: (metadata: Record<string, unknown> | undefined) => AgentNodeMetadata | undefined;
3094
+ /** Narrow an open metadata bag to its mapAgents (dynamic fan-out) carrier, if present and valid. */
3095
+ export declare const readMapAgentMetadata: (metadata: Record<string, unknown> | undefined) => MapAgentNodeMetadata | undefined;
3096
+ //# sourceMappingURL=node-metadata.d.ts.map