melchizedek-agents 0.17.0 → 0.19.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 (290) hide show
  1. package/.env.example +35 -3
  2. package/AGENT_SETUP.md +2 -1
  3. package/CHANGELOG.md +929 -0
  4. package/DOCUMENTATION.md +290 -66
  5. package/README.md +42 -1
  6. package/config/agents/examples/harness.yaml +3 -1
  7. package/config/agents/examples/model_zoo.yaml +10 -9
  8. package/config/agents/syndicateSchema.yaml +63 -16
  9. package/config/agents/templates/account_memory.yaml +2 -6
  10. package/config/agents/templates/case_desk.yaml +3 -9
  11. package/config/agents/templates/draft_review.yaml +3 -9
  12. package/config/agents/templates/intake_extractor.yaml +1 -3
  13. package/config/agents/templates/research_brief.yaml +3 -9
  14. package/config/agents/templates/research_desk.yaml +3 -9
  15. package/config/agents/templates/review_panel.yaml +4 -12
  16. package/config/agents/templates/support_triage.yaml +4 -12
  17. package/config/agents/templates/systems_operator.yaml +2 -6
  18. package/db/hardening.sql +10 -3
  19. package/db/migrations/0012_audit_log.sql +98 -0
  20. package/db/migrations/0013_tool_credentials.sql +260 -0
  21. package/dist/lib/a2a/app.d.ts +90 -6
  22. package/dist/lib/a2a/app.js +201 -6
  23. package/dist/lib/a2a/executor.d.ts +54 -7
  24. package/dist/lib/a2a/executor.js +134 -16
  25. package/dist/lib/a2a/remoteAgent.d.ts +24 -9
  26. package/dist/lib/a2a/remoteAgent.js +31 -14
  27. package/dist/lib/compile.d.ts +121 -31
  28. package/dist/lib/compile.js +153 -113
  29. package/dist/lib/compileAdk.d.ts +29 -0
  30. package/dist/lib/compileAdk.js +132 -0
  31. package/dist/lib/compileNative.d.ts +85 -0
  32. package/dist/lib/compileNative.js +222 -0
  33. package/dist/lib/config.d.ts +13 -5
  34. package/dist/lib/config.js +13 -5
  35. package/dist/lib/doctor.js +1 -0
  36. package/dist/lib/index.d.ts +2 -1
  37. package/dist/lib/index.js +2 -1
  38. package/dist/lib/loadEnv.d.ts +5 -0
  39. package/dist/lib/loadEnv.js +7 -0
  40. package/dist/lib/loadSyndicate.d.ts +22 -0
  41. package/dist/lib/memory/erase.d.ts +5 -3
  42. package/dist/lib/memory/erase.js +5 -2
  43. package/dist/lib/memory/namespace.d.ts +8 -1
  44. package/dist/lib/memory/namespace.js +12 -6
  45. package/dist/lib/memory/providers.d.ts +27 -0
  46. package/dist/lib/memory/providers.js +30 -1
  47. package/dist/lib/memory/supabaseMemoryService.d.ts +37 -3
  48. package/dist/lib/memory/supabaseMemoryService.js +42 -2
  49. package/dist/lib/model.d.ts +47 -0
  50. package/dist/lib/model.js +37 -0
  51. package/dist/lib/models/adapterResolver.d.ts +113 -0
  52. package/dist/lib/models/adapterResolver.js +136 -0
  53. package/dist/lib/models/adkGeminiAdapter.d.ts +90 -0
  54. package/dist/lib/models/adkGeminiAdapter.js +367 -0
  55. package/dist/lib/models/adkShim.d.ts +111 -0
  56. package/dist/lib/models/adkShim.js +136 -0
  57. package/dist/lib/models/capabilities.d.ts +3 -0
  58. package/dist/lib/models/capabilities.js +20 -13
  59. package/dist/lib/models/chatCompletionsAdapter.d.ts +279 -0
  60. package/dist/lib/models/chatCompletionsAdapter.js +854 -0
  61. package/dist/lib/models/circuitBreaker.d.ts +42 -0
  62. package/dist/lib/models/circuitBreaker.js +70 -0
  63. package/dist/lib/models/claudeAdapter.d.ts +103 -0
  64. package/dist/lib/models/claudeAdapter.js +669 -0
  65. package/dist/lib/models/claudeLlm.d.ts +39 -62
  66. package/dist/lib/models/claudeLlm.js +44 -349
  67. package/dist/lib/models/claudeModels.d.ts +127 -0
  68. package/dist/lib/models/claudeModels.js +237 -0
  69. package/dist/lib/models/contract.d.ts +395 -0
  70. package/dist/lib/models/contract.js +39 -0
  71. package/dist/lib/models/endpoints.js +2 -1
  72. package/dist/lib/models/errorResponse.d.ts +50 -0
  73. package/dist/lib/models/errorResponse.js +48 -0
  74. package/dist/lib/models/fallback.d.ts +48 -0
  75. package/dist/lib/models/fallback.js +116 -0
  76. package/dist/lib/models/fallbackAdapter.d.ts +55 -0
  77. package/dist/lib/models/fallbackAdapter.js +62 -0
  78. package/dist/lib/models/gateway.js +2 -1
  79. package/dist/lib/models/gatewayAdapter.d.ts +51 -0
  80. package/dist/lib/models/gatewayAdapter.js +81 -0
  81. package/dist/lib/models/gatewayLlm.d.ts +12 -33
  82. package/dist/lib/models/gatewayLlm.js +14 -75
  83. package/dist/lib/models/geminiAdapter.d.ts +123 -0
  84. package/dist/lib/models/geminiAdapter.js +831 -0
  85. package/dist/lib/models/geminiState.d.ts +25 -0
  86. package/dist/lib/models/geminiState.js +25 -0
  87. package/dist/lib/models/genaiMapping.d.ts +263 -0
  88. package/dist/lib/models/genaiMapping.js +862 -0
  89. package/dist/lib/models/gptAdapter.d.ts +240 -0
  90. package/dist/lib/models/gptAdapter.js +804 -0
  91. package/dist/lib/models/gptLlm.d.ts +63 -123
  92. package/dist/lib/models/gptLlm.js +88 -602
  93. package/dist/lib/models/grokAdapter.d.ts +86 -0
  94. package/dist/lib/models/grokAdapter.js +142 -0
  95. package/dist/lib/models/grokLlm.d.ts +22 -45
  96. package/dist/lib/models/grokLlm.js +22 -67
  97. package/dist/lib/models/kimiAdapter.d.ts +157 -0
  98. package/dist/lib/models/kimiAdapter.js +203 -0
  99. package/dist/lib/models/kimiLlm.d.ts +15 -107
  100. package/dist/lib/models/kimiLlm.js +17 -153
  101. package/dist/lib/models/ollamaAdapter.d.ts +125 -0
  102. package/dist/lib/models/ollamaAdapter.js +155 -0
  103. package/dist/lib/models/ollamaLlm.d.ts +11 -107
  104. package/dist/lib/models/ollamaLlm.js +13 -151
  105. package/dist/lib/models/openAiCompatibleLlm.d.ts +73 -216
  106. package/dist/lib/models/openAiCompatibleLlm.js +109 -671
  107. package/dist/lib/models/providerState.d.ts +63 -0
  108. package/dist/lib/models/providerState.js +61 -0
  109. package/dist/lib/models/reasoning.d.ts +26 -0
  110. package/dist/lib/models/reasoning.js +59 -0
  111. package/dist/lib/models/registry.d.ts +58 -35
  112. package/dist/lib/models/registry.js +89 -118
  113. package/dist/lib/models/retry.d.ts +2 -1
  114. package/dist/lib/models/retry.js +3 -2
  115. package/dist/lib/models/schemaNormalize.d.ts +98 -0
  116. package/dist/lib/models/schemaNormalize.js +321 -1
  117. package/dist/lib/models/tracedGemini.d.ts +41 -0
  118. package/dist/lib/models/tracedGemini.js +98 -0
  119. package/dist/lib/models/urls.d.ts +11 -0
  120. package/dist/lib/models/urls.js +16 -0
  121. package/dist/lib/net/redirects.d.ts +21 -2
  122. package/dist/lib/net/redirects.js +11 -34
  123. package/dist/lib/observability/audit.d.ts +25 -0
  124. package/dist/lib/observability/audit.js +39 -0
  125. package/dist/lib/observability/lineage.d.ts +14 -0
  126. package/dist/lib/observability/lineage.js +33 -0
  127. package/dist/lib/observability/metrics.d.ts +6 -0
  128. package/dist/lib/observability/supabaseSpanExporter.d.ts +10 -4
  129. package/dist/lib/observability/supabaseSpanExporter.js +17 -9
  130. package/dist/lib/observability/tracer.d.ts +39 -8
  131. package/dist/lib/observability/tracer.js +59 -20
  132. package/dist/lib/runtime/adkMemoryBridge.d.ts +46 -0
  133. package/dist/lib/runtime/adkMemoryBridge.js +68 -0
  134. package/dist/lib/runtime/adkSessionBridge.d.ts +78 -0
  135. package/dist/lib/runtime/adkSessionBridge.js +176 -0
  136. package/dist/lib/runtime/credentials.d.ts +59 -0
  137. package/dist/lib/runtime/credentials.js +62 -0
  138. package/dist/lib/runtime/events.d.ts +229 -0
  139. package/dist/lib/runtime/events.js +274 -0
  140. package/dist/lib/runtime/logging.d.ts +32 -0
  141. package/dist/lib/runtime/logging.js +55 -0
  142. package/dist/lib/runtime/memoryService.d.ts +72 -0
  143. package/dist/lib/runtime/memoryService.js +25 -0
  144. package/dist/lib/runtime/native/agentLoop.d.ts +203 -0
  145. package/dist/lib/runtime/native/agentLoop.js +687 -0
  146. package/dist/lib/runtime/native/compaction.d.ts +103 -0
  147. package/dist/lib/runtime/native/compaction.js +191 -0
  148. package/dist/lib/runtime/native/delegate.d.ts +98 -0
  149. package/dist/lib/runtime/native/delegate.js +173 -0
  150. package/dist/lib/runtime/native/history.d.ts +83 -0
  151. package/dist/lib/runtime/native/history.js +312 -0
  152. package/dist/lib/runtime/native/interrupts.d.ts +126 -0
  153. package/dist/lib/runtime/native/interrupts.js +291 -0
  154. package/dist/lib/runtime/native/request.d.ts +215 -0
  155. package/dist/lib/runtime/native/request.js +585 -0
  156. package/dist/lib/runtime/native/selfCorrection.d.ts +106 -0
  157. package/dist/lib/runtime/native/selfCorrection.js +253 -0
  158. package/dist/lib/runtime/native/step.d.ts +148 -0
  159. package/dist/lib/runtime/native/step.js +239 -0
  160. package/dist/lib/runtime/native/taskMode.d.ts +64 -0
  161. package/dist/lib/runtime/native/taskMode.js +126 -0
  162. package/dist/lib/runtime/native/telemetry.d.ts +75 -0
  163. package/dist/lib/runtime/native/telemetry.js +299 -0
  164. package/dist/lib/runtime/native/tempState.d.ts +31 -0
  165. package/dist/lib/runtime/native/tempState.js +56 -0
  166. package/dist/lib/runtime/nativeTurn.d.ts +86 -0
  167. package/dist/lib/runtime/nativeTurn.js +107 -0
  168. package/dist/lib/runtime/questions.d.ts +29 -7
  169. package/dist/lib/runtime/questions.js +47 -32
  170. package/dist/lib/runtime/runtimeFlag.d.ts +30 -0
  171. package/dist/lib/runtime/runtimeFlag.js +50 -0
  172. package/dist/lib/runtime/sessions.d.ts +166 -0
  173. package/dist/lib/runtime/sessions.js +201 -0
  174. package/dist/lib/runtime/syndicateTurn.d.ts +44 -6
  175. package/dist/lib/runtime/syndicateTurn.js +205 -33
  176. package/dist/lib/session/supabaseSessionService.d.ts +64 -17
  177. package/dist/lib/session/supabaseSessionService.js +148 -105
  178. package/dist/lib/session/transcript.d.ts +68 -22
  179. package/dist/lib/session/transcript.js +102 -28
  180. package/dist/lib/skills.js +33 -7
  181. package/dist/lib/storage/postgres/credentialStore.d.ts +20 -0
  182. package/dist/lib/storage/postgres/credentialStore.js +82 -0
  183. package/dist/lib/storage/postgres/index.d.ts +15 -0
  184. package/dist/lib/storage/postgres/index.js +7 -0
  185. package/dist/lib/storage/postgres/sessionService.d.ts +43 -15
  186. package/dist/lib/storage/postgres/sessionService.js +128 -66
  187. package/dist/lib/syndicateSchema.d.ts +55 -0
  188. package/dist/lib/syndicateSchema.js +91 -7
  189. package/dist/lib/toolRegistry.d.ts +15 -2
  190. package/dist/lib/toolRegistry.js +33 -17
  191. package/dist/lib/tools/adkTool.d.ts +81 -0
  192. package/dist/lib/tools/adkTool.js +268 -0
  193. package/dist/lib/tools/auth.d.ts +118 -0
  194. package/dist/lib/tools/auth.js +89 -0
  195. package/dist/lib/tools/collectionsSearchTool.d.ts +7 -6
  196. package/dist/lib/tools/collectionsSearchTool.js +11 -26
  197. package/dist/lib/tools/credentialCipher.d.ts +58 -0
  198. package/dist/lib/tools/credentialCipher.js +116 -0
  199. package/dist/lib/tools/credentialStore.d.ts +77 -0
  200. package/dist/lib/tools/credentialStore.js +246 -0
  201. package/dist/lib/tools/examples.d.ts +43 -0
  202. package/dist/lib/tools/examples.js +62 -0
  203. package/dist/lib/tools/generateImageTool.d.ts +15 -6
  204. package/dist/lib/tools/generateImageTool.js +19 -29
  205. package/dist/lib/tools/inspectImageTool.d.ts +9 -6
  206. package/dist/lib/tools/inspectImageTool.js +13 -17
  207. package/dist/lib/tools/mcpToolFactory.d.ts +68 -1
  208. package/dist/lib/tools/mcpToolFactory.js +106 -50
  209. package/dist/lib/tools/memoryTools.d.ts +61 -0
  210. package/dist/lib/tools/memoryTools.js +119 -0
  211. package/dist/lib/tools/nativeTools.d.ts +38 -0
  212. package/dist/lib/tools/nativeTools.js +43 -0
  213. package/dist/lib/tools/oauthConsent.d.ts +181 -0
  214. package/dist/lib/tools/oauthConsent.js +330 -0
  215. package/dist/lib/tools/openapi/call.d.ts +108 -0
  216. package/dist/lib/tools/openapi/call.js +295 -0
  217. package/dist/lib/tools/openapi/parse.d.ts +147 -0
  218. package/dist/lib/tools/openapi/parse.js +570 -0
  219. package/dist/lib/tools/openapiTools.d.ts +31 -17
  220. package/dist/lib/tools/openapiTools.js +150 -117
  221. package/dist/lib/tools/scienceTools.d.ts +14 -14
  222. package/dist/lib/tools/skillToolset.d.ts +58 -87
  223. package/dist/lib/tools/skillToolset.js +61 -142
  224. package/dist/lib/tools/skills/env.d.ts +58 -0
  225. package/dist/lib/tools/skills/env.js +165 -0
  226. package/dist/lib/tools/skills/executor.d.ts +114 -0
  227. package/dist/lib/tools/skills/executor.js +331 -0
  228. package/dist/lib/tools/skills/frontmatter.d.ts +79 -0
  229. package/dist/lib/tools/skills/frontmatter.js +215 -0
  230. package/dist/lib/tools/skills/loader.d.ts +91 -0
  231. package/dist/lib/tools/skills/loader.js +257 -0
  232. package/dist/lib/tools/skills/tools.d.ts +187 -0
  233. package/dist/lib/tools/skills/tools.js +386 -0
  234. package/dist/lib/tools/taskTools.d.ts +15 -15
  235. package/dist/lib/tools/tool.d.ts +354 -0
  236. package/dist/lib/tools/tool.js +304 -0
  237. package/dist/lib/tools/toolContract.d.ts +89 -33
  238. package/dist/lib/tools/toolContract.js +104 -82
  239. package/dist/lib/tools/urlContextTool.d.ts +3 -0
  240. package/dist/lib/tools/urlContextTool.js +5 -1
  241. package/dist/lib/tools/webExtractTool.d.ts +2 -2
  242. package/dist/lib/tools/webExtractTool.js +2 -1
  243. package/dist/lib/tools/webSearchTool.d.ts +6 -9
  244. package/dist/lib/tools/webSearchTool.js +14 -59
  245. package/dist/lib/tools/wikiTools.d.ts +19 -19
  246. package/dist/lib/tools/wikiTools.js +13 -9
  247. package/dist/lib/tools/xApiSearchTool.d.ts +2 -2
  248. package/dist/lib/tools/xApiSearchTool.js +2 -1
  249. package/dist/lib/tools/xSearchTool.d.ts +7 -9
  250. package/dist/lib/tools/xSearchTool.js +11 -62
  251. package/dist/lib/tools/xaiSearchParams.d.ts +41 -0
  252. package/dist/lib/tools/xaiSearchParams.js +126 -0
  253. package/dist/lib/wiki/agentRun.d.ts +12 -0
  254. package/dist/lib/wiki/agentRun.js +72 -34
  255. package/dist/lib/wiki/entities.d.ts +12 -0
  256. package/dist/lib/wiki/entities.js +45 -3
  257. package/dist/lib/workflow/agentNode.d.ts +136 -0
  258. package/dist/lib/workflow/agentNode.js +274 -0
  259. package/dist/lib/workflow/graph.d.ts +177 -0
  260. package/dist/lib/workflow/graph.js +458 -0
  261. package/dist/lib/workflow/nodeEvents.d.ts +50 -0
  262. package/dist/lib/workflow/nodeEvents.js +101 -0
  263. package/dist/lib/workflow/pause.d.ts +122 -0
  264. package/dist/lib/workflow/pause.js +180 -0
  265. package/dist/lib/workflow/resume.d.ts +165 -0
  266. package/dist/lib/workflow/resume.js +440 -0
  267. package/dist/lib/workflow/route.d.ts +58 -0
  268. package/dist/lib/workflow/route.js +69 -0
  269. package/dist/lib/workflow/scheduler.d.ts +415 -0
  270. package/dist/lib/workflow/scheduler.js +743 -0
  271. package/dist/lib/workflow/toolNode.d.ts +127 -0
  272. package/dist/lib/workflow/toolNode.js +236 -0
  273. package/dist/lib/workflow/turn.d.ts +118 -0
  274. package/dist/lib/workflow/turn.js +216 -0
  275. package/dist/lib/workflowConfig.d.ts +3 -2
  276. package/dist/lib/workflowConfig.js +3 -12
  277. package/dist/scripts/a2a_server.js +55 -11
  278. package/dist/scripts/assistant_worker.d.ts +2 -1
  279. package/dist/scripts/assistant_worker.js +9 -4
  280. package/dist/scripts/db.d.ts +9 -0
  281. package/dist/scripts/db.js +30 -15
  282. package/dist/scripts/syndicate_chat.js +19 -10
  283. package/package.json +6 -3
  284. package/skills/briefs/melchizedek-author.md +3 -2
  285. package/skills/briefs/melchizedek-models.md +13 -9
  286. package/skills/briefs/melchizedek.md +3 -3
  287. package/skills/melchizedek/SKILL.md +2 -1
  288. package/skills/melchizedek-author/SKILL.md +2 -1
  289. package/skills/melchizedek-author/assets/minimal.yaml +2 -0
  290. package/skills/melchizedek-models/SKILL.md +23 -6
@@ -8,6 +8,12 @@
8
8
  * cancellation, the per-server concurrency cap, and memory ingestion after
9
9
  * the reply. Every turn semantic — dispatch, delegation, relay fallback,
10
10
  * guards, the step cap — is the runtime's.
11
+ *
12
+ * Its stores are the engine's (ADR 0080): it takes a session store and a
13
+ * memory service with either face, the engine's or ADK's, reads a session
14
+ * through the engine's SessionService, and hands the turn runner the faces
15
+ * its fixed signature names through the bridges
16
+ * (lib/runtime/adkSessionBridge.ts, lib/runtime/adkMemoryBridge.ts).
11
17
  */
12
18
  import { createHash, randomUUID } from 'node:crypto';
13
19
  import { AsyncLocalStorage } from 'node:async_hooks';
@@ -17,9 +23,12 @@ import { nestedLoader } from '../loadSyndicate.js';
17
23
  import { configDigest } from '../observability/lineage.js';
18
24
  import { turnLockKey } from './turnLock.js';
19
25
  import { ingestTurnMemory, runSyndicateTurn } from '../runtime/syndicateTurn.js';
26
+ import { asAdkSessionService, asSessionService } from '../runtime/adkSessionBridge.js';
27
+ import { asAdkMemoryService } from '../runtime/adkMemoryBridge.js';
20
28
  import { approvalResponsePart, describeApproval, pendingApproval } from '../runtime/approvals.js';
21
29
  import { declaresApprovals } from '../compile.js';
22
30
  import { describeInput } from '../runtime/syndicateTurn.js';
31
+ import { describeConsent } from '../runtime/credentials.js';
23
32
  export const requestContextStorage = new AsyncLocalStorage();
24
33
  /** The app name every A2A session and memory silo is stored under. */
25
34
  export const A2A_APP_NAME = 'melchizedek-a2a';
@@ -122,28 +131,64 @@ export function a2aPartsToMessage(rawParts) {
122
131
  return { parts };
123
132
  }
124
133
  const NO_USAGE = { llmCalls: 0, inputTokens: 0, outputTokens: 0, thinkingTokens: 0 };
125
- /** Concurrency cap and in-flight registry shared by all executors. */
134
+ /** Concurrency caps and in-flight registry shared by all executors. */
126
135
  export class TaskLimiter {
127
136
  max;
137
+ perScope;
138
+ perCaller;
128
139
  running = new Map();
140
+ /** taskId → the keys it counts against, so release frees exactly those. */
141
+ keysOf = new Map();
142
+ counts = new Map();
129
143
  draining = false;
130
144
  idleWaiters = [];
131
- constructor(max) {
145
+ constructor(max, limits = {}) {
132
146
  this.max = max > 0 ? max : Infinity;
147
+ this.perScope = limits.perScope && limits.perScope > 0 ? limits.perScope : Infinity;
148
+ this.perCaller = limits.perCaller && limits.perCaller > 0 ? limits.perCaller : Infinity;
149
+ }
150
+ /**
151
+ * Why a task for this scope and caller may not start now, or undefined.
152
+ * Checked before acquire() so the refusal can name the cap that was hit.
153
+ */
154
+ refusal(who = {}) {
155
+ if (this.draining)
156
+ return 'The server is shutting down; retry shortly.';
157
+ if (this.running.size >= this.max)
158
+ return `The server is at its limit of ${this.max} concurrent tasks; retry shortly.`;
159
+ if (who.scopeKey && (this.counts.get(`s:${who.scopeKey}`) ?? 0) >= this.perScope) {
160
+ return `This user already has ${this.perScope} tasks running, the most allowed at once; retry when one finishes.`;
161
+ }
162
+ if (who.caller && (this.counts.get(`c:${who.caller}`) ?? 0) >= this.perCaller) {
163
+ return `This caller already has ${this.perCaller} tasks running, the most allowed at once; retry when one finishes.`;
164
+ }
165
+ return undefined;
133
166
  }
134
167
  get inFlight() {
135
168
  return this.running.size;
136
169
  }
137
- /** Reserve a slot. Returns undefined when saturated or shutting down. */
138
- acquire(taskId) {
139
- if (this.draining || this.running.size >= this.max)
170
+ /** Reserve a slot. Returns undefined when any cap is reached or the server is shutting down. */
171
+ acquire(taskId, who = {}) {
172
+ if (this.refusal(who))
140
173
  return undefined;
141
174
  const controller = new AbortController();
142
175
  this.running.set(taskId, controller);
176
+ const keys = [who.scopeKey && `s:${who.scopeKey}`, who.caller && `c:${who.caller}`].filter((k) => !!k);
177
+ for (const k of keys)
178
+ this.counts.set(k, (this.counts.get(k) ?? 0) + 1);
179
+ this.keysOf.set(taskId, keys);
143
180
  return controller;
144
181
  }
145
182
  release(taskId) {
146
183
  this.running.delete(taskId);
184
+ for (const k of this.keysOf.get(taskId) ?? []) {
185
+ const n = (this.counts.get(k) ?? 1) - 1;
186
+ if (n > 0)
187
+ this.counts.set(k, n);
188
+ else
189
+ this.counts.delete(k);
190
+ }
191
+ this.keysOf.delete(taskId);
147
192
  if (this.running.size === 0)
148
193
  for (const w of this.idleWaiters.splice(0))
149
194
  w();
@@ -267,6 +312,39 @@ function publishApprovalRequest(eventBus, taskId, contextId, pending) {
267
312
  metadata: undefined,
268
313
  }));
269
314
  }
315
+ /**
316
+ * A call waits for an OAuth grant (ADR 0085): the task ends input-required,
317
+ * naming the provider, with a data part carrying the authorization URL and
318
+ * its state nonce. The person opens the URL; the server's callback stores
319
+ * the grant; the next message on the conversation resumes the call. The
320
+ * part carries no token, code or verifier.
321
+ */
322
+ function publishConsentRequest(eventBus, taskId, contextId, pending) {
323
+ const message = statusMessage(taskId, contextId, `Authorization needed: ${describeConsent(pending)}. Open ${pending.authUri} to authorize, then send any message on this conversation to continue.`);
324
+ message.parts.push({
325
+ content: {
326
+ $case: 'data',
327
+ value: {
328
+ type: 'consent_request',
329
+ consent_id: pending.id,
330
+ agent: pending.agent,
331
+ provider: pending.provider,
332
+ authorization_url: pending.authUri,
333
+ state: pending.state,
334
+ scopes: pending.scopes,
335
+ },
336
+ },
337
+ metadata: undefined,
338
+ filename: '',
339
+ mediaType: 'application/json',
340
+ });
341
+ eventBus.publish(AgentEvent.statusUpdate({
342
+ taskId,
343
+ contextId,
344
+ status: { state: TaskState.TASK_STATE_INPUT_REQUIRED, message, timestamp: new Date().toISOString() },
345
+ metadata: undefined,
346
+ }));
347
+ }
270
348
  /**
271
349
  * The caller's answer to the open approval, from the raw A2A parts: a data
272
350
  * part `{ approval: { id, approved } }` naming that request, or the text
@@ -339,8 +417,16 @@ export function answerStream(eventBus, taskId, contextId) {
339
417
  export class SyndicateExecutor {
340
418
  opts;
341
419
  configHash;
420
+ /** The store as the engine reads it. */
421
+ sessions;
422
+ /** The faces the turn runner's fixed signature names (ADR 0045 item 4). */
423
+ turnSessions;
424
+ turnMemory;
342
425
  constructor(opts) {
343
426
  this.opts = opts;
427
+ this.sessions = asSessionService(opts.sessionService);
428
+ this.turnSessions = asAdkSessionService(opts.sessionService);
429
+ this.turnMemory = opts.memoryService ? asAdkMemoryService(opts.memoryService) : undefined;
344
430
  }
345
431
  /** Provenance stamp for every turn this executor serves (lineage.ts). */
346
432
  configHashFor() {
@@ -367,6 +453,8 @@ export class SyndicateExecutor {
367
453
  // Reports the task once: to the task log and metrics, and its spend to
368
454
  // the policy. Never throws into the task.
369
455
  let reported = false;
456
+ // The turn's trace (the last root span started: a dispatch turn's answer).
457
+ let traceId;
370
458
  const report = async (ctx, status, reason, usage = NO_USAGE) => {
371
459
  if (reported)
372
460
  return;
@@ -382,6 +470,9 @@ export class SyndicateExecutor {
382
470
  }
383
471
  try {
384
472
  this.opts.onTaskEnd?.({
473
+ taskId,
474
+ traceId,
475
+ ...(ctx?.traceparent ? { callerTraceId: ctx.traceparent.split('-')[1] } : {}),
385
476
  agentId,
386
477
  syndicate: config.syndicate_name,
387
478
  caller: ctx?.caller,
@@ -395,6 +486,21 @@ export class SyndicateExecutor {
395
486
  catch {
396
487
  /* a broken log sink must not fail the task */
397
488
  }
489
+ try {
490
+ this.opts.onAudit?.({
491
+ event: 'task.end',
492
+ outcome: status,
493
+ caller: ctx?.caller,
494
+ scopeHash: scopeKey ? createHash('sha256').update(scopeKey).digest('hex').slice(0, 12) : undefined,
495
+ sourceIp: ctx?.sourceIp,
496
+ agentId,
497
+ taskId,
498
+ detail: { syndicate: config.syndicate_name, ...(reason ? { reason } : {}), ...(traceId ? { traceId } : {}), durationMs: Date.now() - started, llmCalls: usage.llmCalls },
499
+ });
500
+ }
501
+ catch {
502
+ /* nor a broken audit sink */
503
+ }
398
504
  };
399
505
  let ctxForReport;
400
506
  try {
@@ -443,11 +549,10 @@ export class SyndicateExecutor {
443
549
  return;
444
550
  }
445
551
  }
446
- slot = this.opts.limiter.acquire(taskId);
552
+ const who = { scopeKey: ctx.scopeKey, caller: ctx.caller };
553
+ slot = this.opts.limiter.acquire(taskId, who);
447
554
  if (!slot) {
448
- const why = this.opts.limiter.isDraining
449
- ? 'The server is shutting down; retry shortly.'
450
- : `The server is at its limit of ${this.opts.limiter.max} concurrent tasks; retry shortly.`;
555
+ const why = this.opts.limiter.refusal(who) ?? 'The server is at capacity; retry shortly.';
451
556
  warn(`Task ${short} rejected — ${why}`);
452
557
  publishFinal(eventBus, taskId, contextId, 'rejected', why);
453
558
  await report(ctx, 'rejected', 'capacity');
@@ -476,8 +581,10 @@ export class SyndicateExecutor {
476
581
  // Approvals (ADR 0028): while a gated call waits, a message is its
477
582
  // answer, or the request is repeated without spending a model call.
478
583
  if (declaresApprovals(config)) {
479
- const session = await this.opts.sessionService.getSession({ appName, userId, sessionId: contextId });
480
- const pending = pendingApproval(session?.events ?? []);
584
+ const session = await this.sessions.get({ appName, userId, sessionId: contextId });
585
+ // The stored Event JSON either way (ADR 0052): pendingApproval still
586
+ // names ADK's Event, which a TurnEvent reaches only through a cast.
587
+ const pending = pendingApproval((session?.events ?? []));
481
588
  if (pending) {
482
589
  const answer = approvalAnswer(rawParts, pending);
483
590
  if (!answer) {
@@ -496,16 +603,21 @@ export class SyndicateExecutor {
496
603
  appName,
497
604
  userId,
498
605
  sessionId: contextId,
499
- sessionService: this.opts.sessionService,
500
- memoryService: this.opts.memoryService,
606
+ sessionService: this.turnSessions,
607
+ memoryService: this.turnMemory,
501
608
  compile: this.opts.compileFor(ctx),
502
609
  signal: slot.signal,
503
610
  deadlineMs: this.opts.taskTimeoutMs,
611
+ ...(this.opts.toolCredentials ? { toolCredentials: this.opts.toolCredentials } : {}),
504
612
  streaming: !!stream,
505
613
  trace: {
506
614
  taskId,
507
615
  configHash: this.configHashFor(),
508
616
  attributes: surfaceAttributes(ctx),
617
+ traceparent: ctx.traceparent,
618
+ onSpanStart: (ids) => {
619
+ traceId = ids.traceId;
620
+ },
509
621
  },
510
622
  events: {
511
623
  onProgress: (text) => publishWorking(eventBus, taskId, contextId, text),
@@ -532,6 +644,12 @@ export class SyndicateExecutor {
532
644
  await report(ctx, 'input-required', 'approval', u);
533
645
  return;
534
646
  }
647
+ if (result.status === 'input-required' && result.consent) {
648
+ log(`⏸ Task ${short} waiting for ${result.consent.provider} authorization after ${spent}`);
649
+ publishConsentRequest(eventBus, taskId, contextId, result.consent);
650
+ await report(ctx, 'input-required', 'consent', u);
651
+ return;
652
+ }
535
653
  if (result.status === 'input-required' && result.input) {
536
654
  log(`⏸ Task ${short} waiting for input from ${result.input.node} after ${spent}`);
537
655
  publishInputRequest(eventBus, taskId, contextId, result.input);
@@ -550,11 +668,11 @@ export class SyndicateExecutor {
550
668
  // Long-term memory: there is no "session end" on a server, so ingest
551
669
  // after every completed task. Runs AFTER the final publish, so it never
552
670
  // delays the reply, and a failure here never fails the task.
553
- if (this.opts.memoryService) {
671
+ if (this.turnMemory) {
554
672
  try {
555
673
  await ingestTurnMemory({
556
- memoryService: this.opts.memoryService,
557
- sessionService: this.opts.sessionService,
674
+ memoryService: this.turnMemory,
675
+ sessionService: this.turnSessions,
558
676
  appName,
559
677
  userId,
560
678
  sessionId: contextId,
@@ -12,7 +12,9 @@
12
12
  *
13
13
  * Built on the official A2A SDK client with its v0.3 compatibility layer on,
14
14
  * so a remote agent may speak A2A 1.0 (e.g. Microsoft Foundry) or 0.3 (most
15
- * other platforms today); the card decides. It does not depend on ADK.
15
+ * other platforms today); the card decides. The client does not depend on
16
+ * ADK, and the tool is the engine's own (remoteAgentOwnTool); the ADK
17
+ * runtime receives it through toFunctionTool (remoteAgentTool).
16
18
  *
17
19
  * Security:
18
20
  * - Every URL — the card and the endpoint the card names — passes the
@@ -27,7 +29,8 @@
27
29
  */
28
30
  import type { AgentCard, Message, Task } from '@a2a-js/sdk';
29
31
  import type { Client } from '@a2a-js/sdk/client';
30
- import { FunctionTool } from '@google/adk';
32
+ import type { FunctionTool } from '@google/adk';
33
+ import type { Tool } from '../tools/tool.ts';
31
34
  export interface RemoteAnswer {
32
35
  state: string;
33
36
  text: string;
@@ -79,13 +82,25 @@ export declare class RemoteA2AAgent {
79
82
  export declare function remoteContextId(localSessionId: string | undefined, subagentName: string): string | undefined;
80
83
  /** Render a remote result as the tool output the orchestrator reads. */
81
84
  export declare function remoteToolOutput(name: string, answer: RemoteAnswer): string;
82
- /**
83
- * The subagent as a tool with AgentTool's contract (one `request` string), so
84
- * an orchestrator delegates to it exactly as to a local subagent. Failures
85
- * come back as readable text, never as a throw into the runner.
86
- */
87
- export declare function remoteAgentTool(params: {
85
+ /** What a remote agent tool is built from: the subagent's name and description, and where it is served. */
86
+ export interface RemoteAgentToolParams {
88
87
  name: string;
89
88
  description: string;
90
89
  url: string;
91
- }): FunctionTool;
90
+ }
91
+ /**
92
+ * The subagent as an own Tool (lib/tools/tool.ts, ADR 0062) with AgentTool's
93
+ * contract (one `request` string), so an orchestrator delegates to it
94
+ * exactly as to a local subagent, on either runtime. The remote
95
+ * conversation is keyed by the local session (`ctx.sessionId`), and the call
96
+ * aborts with the turn (`ctx.signal`). Failures come back as readable text,
97
+ * never as a throw into the runner.
98
+ */
99
+ export declare function remoteAgentOwnTool(params: RemoteAgentToolParams): Tool;
100
+ /**
101
+ * The remote agent tool as the ADK runtime runs it: the FunctionTool
102
+ * toFunctionTool (lib/tools/adkTool.ts) makes of remoteAgentOwnTool, which
103
+ * declares the same parameters the hand-built FunctionTool declared and
104
+ * carries the own Tool for toolOf().
105
+ */
106
+ export declare function remoteAgentTool(params: RemoteAgentToolParams): FunctionTool;
@@ -12,7 +12,9 @@
12
12
  *
13
13
  * Built on the official A2A SDK client with its v0.3 compatibility layer on,
14
14
  * so a remote agent may speak A2A 1.0 (e.g. Microsoft Foundry) or 0.3 (most
15
- * other platforms today); the card decides. It does not depend on ADK.
15
+ * other platforms today); the card decides. The client does not depend on
16
+ * ADK, and the tool is the engine's own (remoteAgentOwnTool); the ADK
17
+ * runtime receives it through toFunctionTool (remoteAgentTool).
16
18
  *
17
19
  * Security:
18
20
  * - Every URL — the card and the endpoint the card names — passes the
@@ -28,9 +30,9 @@
28
30
  import { createHash, randomUUID } from 'node:crypto';
29
31
  import { Role, TaskState } from '@a2a-js/sdk';
30
32
  import { ClientFactory, DefaultAgentCardResolver, JsonRpcTransportFactory, RestTransportFactory } from '@a2a-js/sdk/client';
31
- import { FunctionTool } from '@google/adk';
32
33
  import { checkHost } from '../net/addressGuard.js';
33
34
  import { currentTurnSignal } from '../runtime/turnControl.js';
35
+ import { toFunctionTool } from '../tools/adkTool.js';
34
36
  const FETCH_TIMEOUT_MS = 30_000;
35
37
  const POLL_INTERVAL_MS = 1_500;
36
38
  const DEFAULT_TASK_TIMEOUT_MS = 10 * 60 * 1000;
@@ -234,29 +236,35 @@ export function remoteToolOutput(name, answer) {
234
236
  return `Error: remote agent ${name} ended in state '${answer.state}'${answer.text ? ` — ${answer.text}` : ''}.`;
235
237
  }
236
238
  /**
237
- * The subagent as a tool with AgentTool's contract (one `request` string), so
238
- * an orchestrator delegates to it exactly as to a local subagent. Failures
239
- * come back as readable text, never as a throw into the runner.
239
+ * The subagent as an own Tool (lib/tools/tool.ts, ADR 0062) with AgentTool's
240
+ * contract (one `request` string), so an orchestrator delegates to it
241
+ * exactly as to a local subagent, on either runtime. The remote
242
+ * conversation is keyed by the local session (`ctx.sessionId`), and the call
243
+ * aborts with the turn (`ctx.signal`). Failures come back as readable text,
244
+ * never as a throw into the runner.
240
245
  */
241
- export function remoteAgentTool(params) {
246
+ export function remoteAgentOwnTool(params) {
242
247
  const client = new RemoteA2AAgent(params.url);
243
- return new FunctionTool({
248
+ const declaration = {
244
249
  name: params.name,
245
250
  description: params.description || `Remote agent ${params.name}`,
246
251
  parameters: {
247
- type: 'OBJECT',
248
- properties: { request: { type: 'STRING', description: `What to ask ${params.name}.` } },
252
+ type: 'object',
253
+ properties: { request: { type: 'string', description: `What to ask ${params.name}.` } },
249
254
  required: ['request'],
250
255
  },
251
- execute: async (input, toolContext) => {
252
- const args = (input ?? {});
256
+ };
257
+ return {
258
+ name: params.name,
259
+ declaration: () => declaration,
260
+ execute: async (args, ctx) => {
253
261
  const request = String(args?.request ?? '').trim();
254
262
  if (!request)
255
263
  return `Error: ${params.name} needs a request.`;
256
264
  try {
257
265
  const answer = await client.send(request, {
258
- contextId: remoteContextId(toolContext?.invocationContext?.session?.id, params.name),
259
- signal: currentTurnSignal(),
266
+ contextId: remoteContextId(ctx?.sessionId, params.name),
267
+ signal: ctx?.signal ?? currentTurnSignal(),
260
268
  });
261
269
  return remoteToolOutput(params.name, answer);
262
270
  }
@@ -264,5 +272,14 @@ export function remoteAgentTool(params) {
264
272
  return `Error: remote agent ${params.name} could not be reached (${err instanceof Error ? err.message : String(err)}).`;
265
273
  }
266
274
  },
267
- });
275
+ };
276
+ }
277
+ /**
278
+ * The remote agent tool as the ADK runtime runs it: the FunctionTool
279
+ * toFunctionTool (lib/tools/adkTool.ts) makes of remoteAgentOwnTool, which
280
+ * declares the same parameters the hand-built FunctionTool declared and
281
+ * carries the own Tool for toolOf().
282
+ */
283
+ export function remoteAgentTool(params) {
284
+ return toFunctionTool(remoteAgentOwnTool(params));
268
285
  }
@@ -1,5 +1,6 @@
1
1
  /**
2
- * lib/compile.ts — the one YAML → ADK agent-graph compiler.
2
+ * lib/compile.ts — the one YAML → agent compiler: a runtime-neutral
3
+ * AgentSpec, and the ADK agent graph built from it.
3
4
  *
4
5
  * WHY this file exists:
5
6
  * The A2A server carried this logic as two closures inside its executor,
@@ -26,11 +27,20 @@
26
27
  * paths build subagents through the same function, so the agent a route
27
28
  * dispatches to is identical to the one DELEGATE would have wrapped.
28
29
  * Contract and rationale: lib/dispatch.ts.
30
+ *
31
+ * ── One spec, two runtimes (ADR 0073) ─────────────────────────────────────
32
+ * compileSpec and compileSubagentSpec do the work every runtime shares:
33
+ * resolve and gate the tools, append the skills index, resolve the model
34
+ * once, build the generateContentConfig. The result is an AgentSpec.
35
+ * lib/compileAdk.ts builds ADK's LlmAgent from it (compileGraph and
36
+ * compileSubagent are spec + compileAdk), and lib/compileNative.ts builds
37
+ * the native loop's NativeAgent (ADR 0045). runSyndicateTurn picks one by
38
+ * MELCHIZEDEK_RUNTIME or its `runtime` option.
29
39
  */
30
- import { FunctionTool, LlmAgent } from '@google/adk';
31
- import type { BaseTool } from '@google/adk';
32
- import type { BaseLlm } from '@google/adk';
33
- import type { SubagentYamlConfig, SyndicateYamlConfig } from './loadSyndicate.ts';
40
+ import { BaseLlm, FunctionTool } from '@google/adk';
41
+ import type { BaseTool, LlmAgent } from '@google/adk';
42
+ import type { ReasoningSetting, SubagentYamlConfig, SyndicateYamlConfig } from './loadSyndicate.ts';
43
+ import type { ExampleConfig } from './tools/examples.ts';
34
44
  import type { SkillsConfig } from './tools/skillToolset.ts';
35
45
  export interface CompileOptions {
36
46
  /**
@@ -57,16 +67,22 @@ export interface CompileOptions {
57
67
  */
58
68
  nodeConfig?: (agentName: string) => Record<string, unknown> | undefined;
59
69
  }
60
- /** An agent's `context:` block: compact a long conversation into a summary (ADR 0033). */
61
- export interface ContextConfig {
62
- /** Compact when the last request's prompt passed this many tokens. */
63
- compact_after_tokens: number;
64
- /** Events kept verbatim after the summary. Default 6. */
65
- keep_recent_events?: number;
66
- /** The model that writes the summary. Default: the agent's own. */
67
- summary_model?: string;
68
- }
69
- export declare const DEFAULT_KEEP_RECENT_EVENTS = 6;
70
+ export { REASONING_BUDGETS, reasoningConfig } from './models/reasoning.ts';
71
+ /**
72
+ * An agent's generateContentConfig with its `reasoning:` key mapped in for
73
+ * the model it runs on. Unchanged (the same object) when the agent sets no
74
+ * `reasoning`. The loader refuses `reasoning` next to the older spelling;
75
+ * this refuses it too, for a config built in code.
76
+ */
77
+ export declare function withReasoning(agent: {
78
+ name?: string;
79
+ reasoning?: ReasoningSetting;
80
+ generateContentConfig?: object;
81
+ }, model: string | undefined): Record<string, unknown> | undefined;
82
+ /** An agent's `context:` block and its default, owned by the native compactor (ADR 0033); compileAdk hands the same values to ADK's. */
83
+ export type { ContextConfig } from './runtime/native/compaction.ts';
84
+ import type { ContextConfig } from './runtime/native/compaction.ts';
85
+ export { DEFAULT_KEEP_RECENT_EVENTS } from './runtime/native/compaction.ts';
70
86
  /**
71
87
  * A copy of a FunctionTool that runs only after a person approves the call
72
88
  * (ADR 0028). ADK's own gate does the work: the call raises an
@@ -76,21 +92,23 @@ export declare const DEFAULT_KEEP_RECENT_EVENTS = 6;
76
92
  */
77
93
  export declare function requireApprovalOn(tool: FunctionTool): FunctionTool;
78
94
  /**
79
- * A copy of an OpenAPI tool (lib/tools/openapiTools.ts) that runs only after
80
- * a person approves the call: the same confirmation interrupt FunctionTool's
81
- * own gate raises, so the turn pauses and resumes exactly as ADR 0028 says.
95
+ * A copy of an ADK BaseTool that runs only after a person approves the
96
+ * call: the same confirmation interrupt FunctionTool's own gate raises, so
97
+ * the turn pauses and resumes exactly as ADR 0028 says. The engine no
98
+ * longer uses it: an OpenAPI operation is a FunctionTool over an own Tool
99
+ * (ADR 0067) and takes requireApprovalOn like every registry tool.
100
+ * @deprecated Gate a FunctionTool with requireApprovalOn, or an own Tool
101
+ * with requireApproval (lib/tools/tool.ts).
82
102
  */
83
103
  export declare function requireApprovalOnBaseTool<T extends BaseTool>(tool: T): T;
84
104
  /** True when any agent of a syndicate may pause for approval: a gated tool, or skill scripts. */
85
105
  export declare function declaresApprovals(config: SyndicateYamlConfig): boolean;
86
- /** An agent's `examples:` entry: one exchange the model should imitate. */
87
- export interface ExampleConfig {
88
- input: string;
89
- output: string;
90
- }
106
+ export type { ExampleConfig };
91
107
  /**
92
- * ADK's ExampleTool from YAML pairs: never called by the model, it adds the
93
- * exchanges to every request's instruction as few-shot examples.
108
+ * An agent's `examples:` as the ADK tool for their InstructionTool
109
+ * (lib/tools/examples.ts): never called by the model, it adds the exchanges
110
+ * to every request's instruction as few-shot examples, in the words ADK's
111
+ * ExampleTool used.
94
112
  */
95
113
  export declare function examplesTool(examples: ExampleConfig[] | undefined): unknown[];
96
114
  /** True when a turn running this agent directly may pause for a person (ADR 0028). */
@@ -99,15 +117,87 @@ export declare function agentGates(agent: {
99
117
  skills?: SkillsConfig;
100
118
  } | undefined): boolean;
101
119
  /**
102
- * Builds ONE runnable agent from a subagent entry. A `yaml_reference` entry
103
- * compiles the nested syndicate's whole graph under this entry's name and
120
+ * One entry of an agent's tool list, in the order the model sees it.
121
+ * `tool` is a resolved tool as the registry gives it: during the dual
122
+ * period an ADK object that carries its own Tool or InstructionTool
123
+ * (lib/tools/adkTool.ts), an MCP tool or the skills toolset, gated by
124
+ * require_approval where the YAML says so. `agent` is a delegated subagent
125
+ * (DELEGATE mode), `remote` a subagent served over A2A.
126
+ */
127
+ export type SpecTool = {
128
+ kind: 'tool';
129
+ tool: unknown;
130
+ } | {
131
+ kind: 'agent';
132
+ agent: AgentSpec;
133
+ } | {
134
+ kind: 'remote';
135
+ name: string;
136
+ description: string;
137
+ url: string;
138
+ };
139
+ /**
140
+ * One YAML agent, compiled, for either runtime: what lib/compileAdk.ts
141
+ * turns into ADK's LlmAgent and lib/compileNative.ts into the native loop's
142
+ * NativeAgent. Built once per agent by compileSpec and compileSubagentSpec:
143
+ * the tools resolved (OpenAPI operations built, MCP tools listed) and
144
+ * gated, the skills index appended to the instruction, the model resolved
145
+ * once through CompileOptions.resolveModel, and the generateContentConfig
146
+ * built for the model the agent runs on.
147
+ */
148
+ export interface AgentSpec {
149
+ name: string;
150
+ description?: string;
151
+ /** The model id the YAML names; undefined when the agent takes the resolver's default. */
152
+ model?: string;
153
+ /** What CompileOptions.resolveModel returned for `model`: an id, or an adapter instance (a BYOK one on the A2A server). */
154
+ resolvedModel?: unknown;
155
+ /** The id the agent runs on: the YAML's, else the resolved adapter's. */
156
+ modelId?: string;
157
+ /** `fallback_model:`, unresolved: each runtime resolves it where it calls it. */
158
+ fallbackModel?: string;
159
+ /** The YAML instruction, with the skills index appended when the agent has `skills:`. */
160
+ instruction: string;
161
+ globalInstruction?: string;
162
+ tools: SpecTool[];
163
+ outputSchema?: Record<string, unknown>;
164
+ /** The YAML's config with `reasoning:` mapped in and server-side tool invocations on, as both runtimes send it. */
165
+ generateContentConfig: Record<string, unknown>;
166
+ includeContents?: 'default' | 'none';
167
+ outputKey?: string;
168
+ disallowTransferToParent?: boolean;
169
+ disallowTransferToPeers?: boolean;
170
+ /** `code_execution: gemini`. */
171
+ codeExecution?: 'gemini';
172
+ /** `context:`: compaction (ADR 0033). */
173
+ context?: ContextConfig;
174
+ /** `mode: task`. */
175
+ mode?: 'task';
176
+ }
177
+ /**
178
+ * The spec of ONE agent from a subagent entry. A `yaml_reference` entry is
179
+ * the nested syndicate's whole graph under this entry's name and
104
180
  * description, so the parent sees one tool (or one route) either way.
105
181
  */
182
+ export declare function compileSubagentSpec(subCfg: SubagentYamlConfig, opts?: CompileOptions): Promise<AgentSpec>;
183
+ /**
184
+ * The spec of a syndicate's orchestrator. In DELEGATE mode its subagents
185
+ * come first among its tools, as delegations; in PLAN-DISPATCH mode it gets
186
+ * none (ADK refuses outputSchema + AgentTool on one agent — see
187
+ * config/agents/critic.yaml), and the caller dispatches to a route's own
188
+ * spec itself.
189
+ */
190
+ export declare function compileSpec(config: SyndicateYamlConfig, opts?: CompileOptions, overrideName?: string, overrideDescription?: string): Promise<AgentSpec>;
191
+ /**
192
+ * Builds ONE runnable ADK agent from a subagent entry: its spec, as
193
+ * lib/compileAdk.ts builds it. A workflow node's settings
194
+ * (CompileOptions.nodeConfig) apply to a local agent, not to a nested
195
+ * syndicate's orchestrator.
196
+ */
106
197
  export declare function compileSubagent(subCfg: SubagentYamlConfig, opts?: CompileOptions): Promise<LlmAgent>;
107
198
  /**
108
- * Compiles a syndicate's orchestrator. In DELEGATE mode its subagents are
109
- * attached as AgentTools; in PLAN-DISPATCH mode it gets none (ADK refuses
110
- * outputSchema + AgentTool on one agent — see config/agents/critic.yaml),
111
- * and the caller dispatches to `compileSubagent(route)` itself.
199
+ * Compiles a syndicate's orchestrator for the ADK runtime. In DELEGATE mode
200
+ * its subagents are attached as AgentTools; in PLAN-DISPATCH mode it gets
201
+ * none, and the caller dispatches to `compileSubagent(route)` itself.
112
202
  */
113
203
  export declare function compileGraph(config: SyndicateYamlConfig, opts?: CompileOptions, overrideName?: string, overrideDescription?: string): Promise<LlmAgent>;