@desplega.ai/agent-swarm 1.102.0 → 1.104.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 (174) hide show
  1. package/README.md +2 -0
  2. package/dist/{actions-j9399ktm.js → actions-2expzt47.js} +6 -6
  3. package/dist/{app-tnq1pz27.js → app-dr8hwx7z.js} +3 -3
  4. package/dist/{assistant-c7y92gkw.js → assistant-9rhgsw7v.js} +9 -10
  5. package/dist/{boot-reembed-b97r699t.js → boot-reembed-3q1aywnz.js} +5 -4
  6. package/dist/{boot-reembed-k7e6fc1p.js → boot-reembed-9kt97g1z.js} +4 -3
  7. package/dist/{boot-scrub-logs-14kbc61y.js → boot-scrub-logs-vskq108e.js} +2 -2
  8. package/dist/{claude-managed-adapter-g07dbz3b.js → claude-managed-adapter-z29hjgzz.js} +3 -3
  9. package/dist/{cli-d0t4854c.js → cli-0jw6j755.js} +220 -478
  10. package/dist/{cli-vgck9mqq.js → cli-23zk7xqy.js} +171 -49
  11. package/dist/{cli-g5px3d7x.js → cli-2957pqpj.js} +24 -1
  12. package/dist/{cli-zmf7refz.js → cli-2g9jf9ek.js} +1 -1
  13. package/dist/{cli-mhj07xbq.js → cli-2hap19dv.js} +3 -3
  14. package/dist/{cli-wjyyv518.js → cli-3j01d33e.js} +9 -14
  15. package/dist/{cli-zk4gn40w.js → cli-54h5daha.js} +41 -31
  16. package/dist/{cli-2aaa9mqr.js → cli-5pf0b84v.js} +2 -2
  17. package/dist/{cli-stqqf5kh.js → cli-7v4y3hyd.js} +1 -1
  18. package/dist/{cli-7xdq3jg3.js → cli-92fqyjcv.js} +1 -1
  19. package/dist/{cli-g861fwjp.js → cli-d4z1csms.js} +30 -5
  20. package/dist/{cli-r68m8arr.js → cli-e7bwjntj.js} +1 -1
  21. package/dist/{cli-q6jzg6wj.js → cli-etvgz5x8.js} +5 -7
  22. package/dist/{cli-9qascwj7.js → cli-gj2n2ec1.js} +1 -1
  23. package/dist/{cli-axtg1zaa.js → cli-khe4x17a.js} +1 -1
  24. package/dist/{cli-zctkpdmd.js → cli-nzc0h54v.js} +121 -2
  25. package/dist/{cli-k81y1cjb.js → cli-p4cj4vhc.js} +351 -24
  26. package/dist/{cli-fjx4x7nn.js → cli-q5tshxd6.js} +1 -1
  27. package/dist/{http-eq6wxve6.js → cli-qvzgncd8.js} +85356 -77793
  28. package/dist/{cli-k1ghyj8b.js → cli-s42f54ja.js} +1 -1
  29. package/dist/{cli-dgab5x2h.js → cli-t9v14cnd.js} +23 -4
  30. package/dist/{cli-qbc6mncp.js → cli-v1syqkcb.js} +900 -352
  31. package/dist/{cli-xde8vhhp.js → cli-w1nfskkg.js} +2 -2
  32. package/dist/{cli-ap4md0gc.js → cli-y9p3e94h.js} +30 -5
  33. package/dist/{cli-hc4rd6sv.js → cli-yjt8a36k.js} +3 -3
  34. package/dist/{cli-s8jw5bmg.js → cli-yp2krx5r.js} +2 -2
  35. package/dist/{cli-5bqa41fd.js → cli-yvektv79.js} +1 -1
  36. package/dist/{cli-sygq3fhn.js → cli-zaxksbgj.js} +5 -5
  37. package/dist/{cli-t2jk33ta.js → cli-zghef0em.js} +18 -6
  38. package/dist/cli.js +11 -11
  39. package/dist/{codex-adapter-wf119mnw.js → codex-adapter-w0xharsg.js} +3 -3
  40. package/dist/{codex-session-runner-1gknw7mh.js → codex-session-runner-kzbjcm2k.js} +3 -3
  41. package/dist/{commands-2wyn3swb.js → commands-wfrkef57.js} +2 -2
  42. package/dist/{db-567ntpxv.js → db-c42pxt7h.js} +2 -2
  43. package/dist/{handlers-wvwpk2kj.js → handlers-n36zkfvx.js} +10 -12
  44. package/dist/{hook-fatkywc0.js → hook-gw3vhv6s.js} +8 -6
  45. package/dist/http-59ygpn2h.js +17263 -0
  46. package/dist/{index-d1rm4ea3.js → index-881c1baf.js} +9 -8
  47. package/dist/{index-400x6p3j.js → index-jca7jdpt.js} +23 -10
  48. package/dist/{index-6aj8966p.js → index-xf6fp4y1.js} +5 -5
  49. package/dist/{index-9wqh5352.js → index-xz8vaa5c.js} +14 -11
  50. package/dist/{keepalive-6x9nx92g.js → keepalive-mj4302vw.js} +4 -4
  51. package/dist/{lead-5fgqwe13.js → lead-qm0xjvkv.js} +23 -23
  52. package/dist/{maintenance-eajx5k1k.js → maintenance-xppxbe4t.js} +5 -4
  53. package/dist/{onboard-jc1w1edg.js → onboard-ejx6yxh8.js} +2 -2
  54. package/dist/{otel-impl-8k375amf.js → otel-impl-zs5exkpk.js} +1 -1
  55. package/dist/{pi-mono-adapter-hf8sw7hs.js → pi-mono-adapter-zf7dt1wg.js} +1 -1
  56. package/dist/{pricing-refresh-zed6916t.js → pricing-refresh-nqyf8bkb.js} +4 -4
  57. package/dist/{seed-pricing-5805qzkz.js → seed-pricing-w3x550cj.js} +3 -3
  58. package/dist/{setup-wz05vxh0.js → setup-7729ktfj.js} +2 -2
  59. package/dist/{worker-j359graf.js → worker-4ttemwhw.js} +23 -23
  60. package/openapi.json +159 -4
  61. package/package.json +3 -3
  62. package/src/be/db.ts +83 -13
  63. package/src/be/memory/constants.ts +6 -0
  64. package/src/be/memory/providers/sqlite-store.ts +468 -71
  65. package/src/be/memory/raters/retrieval.ts +4 -2
  66. package/src/be/memory/reranker.ts +5 -2
  67. package/src/be/memory/retrieval-store.ts +2 -0
  68. package/src/be/memory/types.ts +46 -0
  69. package/src/be/migrations/098_repo_hooks_config.sql +3 -0
  70. package/src/be/migrations/099_memory_structured_key_versioning.sql +41 -0
  71. package/src/be/migrations/100_memory_retrieval_source.sql +8 -0
  72. package/src/be/migrations/101_script_connections.sql +67 -0
  73. package/src/be/script-connections.ts +744 -0
  74. package/src/be/script-credential-broker.ts +38 -0
  75. package/src/be/scripts/typecheck.ts +23 -2
  76. package/src/be/seed-scripts/catalog/boot-triage.inline.ts +16 -4
  77. package/src/be/seed-scripts/catalog/boot-triage.ts +16 -4
  78. package/src/be/task-lifecycle-events.ts +42 -0
  79. package/src/commands/runner.ts +182 -31
  80. package/src/github/task-reactions.ts +21 -0
  81. package/src/heartbeat/heartbeat.ts +42 -1
  82. package/src/heartbeat/index.ts +7 -1
  83. package/src/hooks/tool-loop-detection.test.ts +40 -0
  84. package/src/hooks/tool-loop-detection.ts +37 -1
  85. package/src/http/agents.ts +7 -0
  86. package/src/http/index.ts +16 -2
  87. package/src/http/memory.ts +127 -14
  88. package/src/http/prompt-templates.ts +1 -1
  89. package/src/http/repos.ts +5 -1
  90. package/src/http/schedules.ts +1 -1
  91. package/src/http/scripts.ts +15 -14
  92. package/src/http/session-data.ts +2 -0
  93. package/src/http/tasks.ts +2 -1
  94. package/src/http/workflows.ts +1 -0
  95. package/src/prompts/resolver.ts +1 -1
  96. package/src/scheduler/scheduler.ts +25 -2
  97. package/src/scripts-runtime/api-client.ts +100 -0
  98. package/src/scripts-runtime/api-types.ts +45 -0
  99. package/src/scripts-runtime/credential-broker/README.md +40 -0
  100. package/src/scripts-runtime/credential-broker/broker.ts +51 -0
  101. package/src/scripts-runtime/credential-broker/default-bindings.ts +19 -0
  102. package/src/scripts-runtime/credential-broker/fetch-patch.ts +102 -0
  103. package/src/scripts-runtime/credential-broker/index.ts +17 -0
  104. package/src/scripts-runtime/credential-broker/store.ts +72 -0
  105. package/src/scripts-runtime/credential-broker/types.ts +54 -0
  106. package/src/scripts-runtime/ctx.ts +11 -1
  107. package/src/scripts-runtime/egress-secrets.ts +14 -76
  108. package/src/scripts-runtime/eval-harness.ts +1 -1
  109. package/src/scripts-runtime/executors/types.ts +5 -5
  110. package/src/scripts-runtime/loader.ts +6 -1
  111. package/src/scripts-runtime/sdk-allowlist.ts +1 -0
  112. package/src/scripts-runtime/types/stdlib.d.ts +11 -0
  113. package/src/scripts-runtime/types/swarm-sdk.d.ts +11 -0
  114. package/src/server-runtime-counters.ts +12 -0
  115. package/src/server-user.ts +1 -2
  116. package/src/server.ts +11 -0
  117. package/src/telemetry.ts +18 -1
  118. package/src/tests/credential-broker.test.ts +281 -0
  119. package/src/tests/heartbeat.test.ts +239 -0
  120. package/src/tests/http-api-integration.test.ts +4 -0
  121. package/src/tests/memory-edit.test.ts +177 -0
  122. package/src/tests/memory-hybrid.test.ts +212 -0
  123. package/src/tests/model-control.test.ts +6 -6
  124. package/src/tests/runner-repo-autostash.test.ts +39 -8
  125. package/src/tests/script-connections.test.ts +360 -0
  126. package/src/tests/scripts-http.test.ts +16 -10
  127. package/src/tests/scripts-runtime-secret-egress.test.ts +26 -5
  128. package/src/tests/swarm-config-reserved-keys.test.ts +23 -0
  129. package/src/tests/swarm-repos.test.ts +25 -2
  130. package/src/tests/task-lifecycle-events.test.ts +53 -0
  131. package/src/tests/task-lifecycle-telemetry.test.ts +37 -1
  132. package/src/tests/telemetry-init.test.ts +32 -0
  133. package/src/tests/update-schedule-mcp-tool.test.ts +83 -4
  134. package/src/tools/credential-bindings/index.ts +1 -0
  135. package/src/tools/credential-bindings/tool.ts +238 -0
  136. package/src/tools/memory-edit.ts +148 -0
  137. package/src/tools/memory-search.ts +17 -10
  138. package/src/tools/prompt-templates/preview.ts +1 -1
  139. package/src/tools/repos/update-repo.ts +6 -1
  140. package/src/tools/schedules/create-schedule.ts +1 -1
  141. package/src/tools/schedules/delete-schedule.ts +18 -8
  142. package/src/tools/schedules/update-schedule.ts +5 -10
  143. package/src/tools/script-connections/index.ts +1 -0
  144. package/src/tools/script-connections/tool.ts +167 -0
  145. package/src/tools/send-task.ts +7 -2
  146. package/src/tools/swarm-config/delete-config.ts +5 -0
  147. package/src/tools/swarm-config/set-config.ts +23 -1
  148. package/src/tools/task-action.ts +6 -2
  149. package/src/tools/tool-config.ts +6 -1
  150. package/src/types.ts +161 -1
  151. package/src/utils/template.ts +127 -0
  152. package/src/workflows/engine.ts +7 -0
  153. package/src/workflows/executors/agent-task.ts +1 -2
  154. package/src/workflows/executors/swarm-script.ts +2 -0
  155. package/src/workflows/template.ts +12 -121
  156. package/src/workflows/triggers.ts +6 -2
  157. package/templates/community/code-health-reports/PLAYBOOK.md +355 -0
  158. package/templates/community/code-health-reports/README.md +38 -0
  159. package/templates/community/code-health-reports/lead-prompt.md +52 -0
  160. package/templates/community/code-health-reports/report.mjs +378 -0
  161. package/templates/community/code-health-reports/run.sh +143 -0
  162. package/templates/community/dora-metrics/PLAYBOOK.md +294 -0
  163. package/templates/community/dora-metrics/README.md +39 -0
  164. package/templates/community/dora-metrics/lead-prompt.md +56 -0
  165. package/templates/community/dora-metrics/report.mjs +393 -0
  166. package/templates/community/dora-metrics/run.sh +113 -0
  167. package/templates/schedules/weekly-code-health-reports/config.json +13 -0
  168. package/templates/schedules/weekly-code-health-reports/content.md +60 -0
  169. package/templates/schedules/weekly-dora-metrics/config.json +13 -0
  170. package/templates/schedules/weekly-dora-metrics/content.md +61 -0
  171. package/dist/cli-2deg0cen.js +0 -120
  172. package/dist/cli-tsz1q7gk.js +0 -23871
  173. package/src/model-tiers.ts +0 -140
  174. package/templates/community/.gitkeep +0 -0
@@ -11,7 +11,6 @@ import {
11
11
  array,
12
12
  boolean,
13
13
  discriminatedUnion,
14
- exports_external,
15
14
  exports_iso,
16
15
  lazy,
17
16
  literal,
@@ -26,7 +25,7 @@ import {
26
25
  import {
27
26
  init_package,
28
27
  package_default
29
- } from "./cli-hc4rd6sv.js";
28
+ } from "./cli-yjt8a36k.js";
30
29
  import {
31
30
  init_secret_scrubber,
32
31
  scrubSecrets
@@ -46,467 +45,7 @@ function parseProviderMeta(rawProvider, rawMeta) {
46
45
  }
47
46
  var init_provider_metadata = () => {};
48
47
 
49
- // src/github/app.ts
50
- function isGitHubEnabled() {
51
- const githubDisable = process.env.GITHUB_DISABLE;
52
- if (githubDisable === "true" || githubDisable === "1") {
53
- return false;
54
- }
55
- return !!process.env.GITHUB_WEBHOOK_SECRET;
56
- }
57
- function resetGitHub() {
58
- initialized = false;
59
- webhookSecret = null;
60
- appId = null;
61
- privateKey = null;
62
- tokenCache.clear();
63
- }
64
- function initGitHub() {
65
- if (initialized) {
66
- console.log("[GitHub] Already initialized, skipping");
67
- return isGitHubEnabled();
68
- }
69
- initialized = true;
70
- const githubDisable = process.env.GITHUB_DISABLE;
71
- if (githubDisable === "true" || githubDisable === "1") {
72
- console.log("[GitHub] Disabled via GITHUB_DISABLE");
73
- return false;
74
- }
75
- webhookSecret = process.env.GITHUB_WEBHOOK_SECRET ?? null;
76
- if (!webhookSecret) {
77
- console.log("[GitHub] Missing GITHUB_WEBHOOK_SECRET, GitHub integration disabled");
78
- return false;
79
- }
80
- appId = process.env.GITHUB_APP_ID ?? null;
81
- const rawPrivateKey = process.env.GITHUB_APP_PRIVATE_KEY ?? null;
82
- if (appId && rawPrivateKey) {
83
- if (rawPrivateKey.startsWith("-----BEGIN")) {
84
- privateKey = rawPrivateKey.replace(/\\n/g, `
85
- `);
86
- } else {
87
- privateKey = Buffer.from(rawPrivateKey, "base64").toString("utf-8");
88
- }
89
- console.log("[GitHub] App credentials loaded for bot reactions");
90
- } else {
91
- console.log("[GitHub] No App credentials, bot reactions disabled");
92
- }
93
- console.log("[GitHub] Webhook handler initialized");
94
- return true;
95
- }
96
- function isReactionsEnabled() {
97
- return !!(appId && privateKey);
98
- }
99
- async function verifyWebhookSignature(payload, signature) {
100
- if (!webhookSecret || !signature) {
101
- console.log(`[GitHub] Signature verification failed: webhookSecret=${!!webhookSecret}, signature=${!!signature}`);
102
- return false;
103
- }
104
- if (!signature.startsWith("sha256=")) {
105
- return false;
106
- }
107
- const expectedSig = signature.slice(7);
108
- const encoder = new TextEncoder;
109
- const key = await crypto.subtle.importKey("raw", encoder.encode(webhookSecret), { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
110
- const signatureBuffer = await crypto.subtle.sign("HMAC", key, encoder.encode(payload));
111
- const computedSig = Array.from(new Uint8Array(signatureBuffer)).map((b) => b.toString(16).padStart(2, "0")).join("");
112
- if (computedSig.length !== expectedSig.length) {
113
- console.log(`[GitHub] Signature length mismatch: computed=${computedSig.length}, expected=${expectedSig.length}`);
114
- return false;
115
- }
116
- let result = 0;
117
- for (let i = 0;i < computedSig.length; i++) {
118
- result |= computedSig.charCodeAt(i) ^ expectedSig.charCodeAt(i);
119
- }
120
- const isValid = result === 0;
121
- if (!isValid) {
122
- console.log(`[GitHub] Signature mismatch:`);
123
- console.log(` Expected: ${expectedSig}`);
124
- console.log(` Computed: ${computedSig}`);
125
- }
126
- return isValid;
127
- }
128
- async function generateAppJWT() {
129
- if (!appId || !privateKey) {
130
- return null;
131
- }
132
- const now = Math.floor(Date.now() / 1000);
133
- const payload = {
134
- iat: now - 60,
135
- exp: now + 600,
136
- iss: appId
137
- };
138
- const base64url = (data) => {
139
- const base64 = Buffer.isBuffer(data) ? data.toString("base64") : Buffer.from(data).toString("base64");
140
- return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
141
- };
142
- const header = { alg: "RS256", typ: "JWT" };
143
- const headerB64 = base64url(JSON.stringify(header));
144
- const payloadB64 = base64url(JSON.stringify(payload));
145
- const signingInput = `${headerB64}.${payloadB64}`;
146
- try {
147
- const crypto2 = await import("node:crypto");
148
- const sign = crypto2.createSign("RSA-SHA256");
149
- sign.update(signingInput);
150
- const signature = sign.sign(privateKey);
151
- const signatureB64 = base64url(signature);
152
- return `${signingInput}.${signatureB64}`;
153
- } catch (error) {
154
- console.error("[GitHub] Failed to generate JWT:", error);
155
- return null;
156
- }
157
- }
158
- async function getInstallationToken(installationId) {
159
- const cached = tokenCache.get(installationId);
160
- if (cached && cached.expiresAt > Date.now() + 60000) {
161
- return cached.token;
162
- }
163
- const jwt = await generateAppJWT();
164
- if (!jwt) {
165
- console.log("[GitHub] No JWT available, cannot get installation token");
166
- return null;
167
- }
168
- try {
169
- const response = await fetch(`https://api.github.com/app/installations/${installationId}/access_tokens`, {
170
- method: "POST",
171
- headers: {
172
- Accept: "application/vnd.github+json",
173
- Authorization: `Bearer ${jwt}`,
174
- "X-GitHub-Api-Version": "2022-11-28"
175
- }
176
- });
177
- if (!response.ok) {
178
- const errorText = await response.text();
179
- console.error(`[GitHub] Failed to get installation token: ${response.status} ${errorText}`);
180
- return null;
181
- }
182
- const data = await response.json();
183
- const expiresAt = new Date(data.expires_at).getTime();
184
- tokenCache.set(installationId, { token: data.token, expiresAt });
185
- console.log(`[GitHub] Got installation token for ${installationId}, expires at ${data.expires_at}`);
186
- return data.token;
187
- } catch (error) {
188
- console.error("[GitHub] Error getting installation token:", error);
189
- return null;
190
- }
191
- }
192
- var initialized = false, webhookSecret = null, appId = null, privateKey = null, tokenCache;
193
- var init_app = __esm(() => {
194
- tokenCache = new Map;
195
- });
196
-
197
- // src/github/reactions.ts
198
- async function addReaction(repo, commentId, reaction, installationId) {
199
- if (!isReactionsEnabled()) {
200
- console.log("[GitHub] Reactions not enabled, skipping");
201
- return false;
202
- }
203
- const token = await getInstallationToken(installationId);
204
- if (!token) {
205
- console.log("[GitHub] No installation token, skipping reaction");
206
- return false;
207
- }
208
- try {
209
- const response = await fetch(`https://api.github.com/repos/${repo}/issues/comments/${commentId}/reactions`, {
210
- method: "POST",
211
- headers: {
212
- Accept: "application/vnd.github+json",
213
- Authorization: `Bearer ${token}`,
214
- "X-GitHub-Api-Version": "2022-11-28",
215
- "Content-Type": "application/json"
216
- },
217
- body: JSON.stringify({ content: reaction })
218
- });
219
- if (!response.ok) {
220
- const errorText = await response.text();
221
- console.error(`[GitHub] Failed to add reaction: ${response.status} ${errorText}`);
222
- return false;
223
- }
224
- console.log(`[GitHub] Added ${reaction} reaction to comment ${commentId}`);
225
- return true;
226
- } catch (error) {
227
- console.error("[GitHub] Error adding reaction:", error);
228
- return false;
229
- }
230
- }
231
- async function addIssueReaction(repo, issueNumber, reaction, installationId) {
232
- if (!isReactionsEnabled()) {
233
- console.log("[GitHub] Reactions not enabled, skipping");
234
- return false;
235
- }
236
- const token = await getInstallationToken(installationId);
237
- if (!token) {
238
- console.log("[GitHub] No installation token, skipping reaction");
239
- return false;
240
- }
241
- try {
242
- const response = await fetch(`https://api.github.com/repos/${repo}/issues/${issueNumber}/reactions`, {
243
- method: "POST",
244
- headers: {
245
- Accept: "application/vnd.github+json",
246
- Authorization: `Bearer ${token}`,
247
- "X-GitHub-Api-Version": "2022-11-28",
248
- "Content-Type": "application/json"
249
- },
250
- body: JSON.stringify({ content: reaction })
251
- });
252
- if (!response.ok) {
253
- const errorText = await response.text();
254
- console.error(`[GitHub] Failed to add issue reaction: ${response.status} ${errorText}`);
255
- return false;
256
- }
257
- console.log(`[GitHub] Added ${reaction} reaction to issue/PR #${issueNumber}`);
258
- return true;
259
- } catch (error) {
260
- console.error("[GitHub] Error adding issue reaction:", error);
261
- return false;
262
- }
263
- }
264
- async function addPullReviewCommentReaction(repo, commentId, reaction, installationId) {
265
- if (!isReactionsEnabled()) {
266
- console.log("[GitHub] Reactions not enabled, skipping");
267
- return false;
268
- }
269
- const token = await getInstallationToken(installationId);
270
- if (!token) {
271
- console.log("[GitHub] No installation token, skipping reaction");
272
- return false;
273
- }
274
- try {
275
- const response = await fetch(`https://api.github.com/repos/${repo}/pulls/comments/${commentId}/reactions`, {
276
- method: "POST",
277
- headers: {
278
- Accept: "application/vnd.github+json",
279
- Authorization: `Bearer ${token}`,
280
- "X-GitHub-Api-Version": "2022-11-28",
281
- "Content-Type": "application/json"
282
- },
283
- body: JSON.stringify({ content: reaction })
284
- });
285
- if (!response.ok) {
286
- const errorText = await response.text();
287
- console.error(`[GitHub] Failed to add PR review comment reaction: ${response.status} ${errorText}`);
288
- return false;
289
- }
290
- console.log(`[GitHub] Added ${reaction} reaction to PR review comment ${commentId}`);
291
- return true;
292
- } catch (error) {
293
- console.error("[GitHub] Error adding PR review comment reaction:", error);
294
- return false;
295
- }
296
- }
297
- async function addGraphQLReaction(nodeId, reaction, installationId) {
298
- if (!isReactionsEnabled()) {
299
- console.log("[GitHub] Reactions not enabled, skipping");
300
- return false;
301
- }
302
- const token = await getInstallationToken(installationId);
303
- if (!token) {
304
- console.log("[GitHub] No installation token, skipping GraphQL reaction");
305
- return false;
306
- }
307
- try {
308
- const response = await fetch("https://api.github.com/graphql", {
309
- method: "POST",
310
- headers: {
311
- Authorization: `Bearer ${token}`,
312
- "Content-Type": "application/json"
313
- },
314
- body: JSON.stringify({
315
- query: `mutation AddReaction($input: AddReactionInput!) {
316
- addReaction(input: $input) {
317
- reaction { content }
318
- }
319
- }`,
320
- variables: {
321
- input: { subjectId: nodeId, content: reaction }
322
- }
323
- })
324
- });
325
- if (!response.ok) {
326
- const errorText = await response.text();
327
- console.error(`[GitHub] GraphQL reaction failed: ${response.status} ${errorText}`);
328
- return false;
329
- }
330
- const data = await response.json();
331
- if (data.errors?.length) {
332
- console.error(`[GitHub] GraphQL reaction errors: ${JSON.stringify(data.errors)}`);
333
- return false;
334
- }
335
- console.log(`[GitHub] Added ${reaction} GraphQL reaction to node ${nodeId}`);
336
- return true;
337
- } catch (error) {
338
- console.error("[GitHub] Error adding GraphQL reaction:", error);
339
- return false;
340
- }
341
- }
342
- var init_reactions = __esm(() => {
343
- init_app();
344
- });
345
-
346
- // src/github/task-reactions.ts
347
- async function addEyesReactionOnTaskStart(task) {
348
- if (task.source !== "github" || task.vcsProvider !== "github")
349
- return;
350
- if (!task.vcsInstallationId)
351
- return;
352
- const installationId = task.vcsInstallationId;
353
- const repo = task.vcsRepo;
354
- if (!repo)
355
- return;
356
- try {
357
- switch (task.vcsEventType) {
358
- case "issue_comment": {
359
- if (task.vcsCommentId) {
360
- await addReaction(repo, task.vcsCommentId, "eyes", installationId);
361
- }
362
- break;
363
- }
364
- case "pull_request_review_comment": {
365
- if (task.vcsCommentId) {
366
- await addPullReviewCommentReaction(repo, task.vcsCommentId, "eyes", installationId);
367
- }
368
- break;
369
- }
370
- case "pull_request_review": {
371
- if (task.vcsNodeId) {
372
- await addGraphQLReaction(task.vcsNodeId, "EYES", installationId);
373
- }
374
- break;
375
- }
376
- case "pull_request":
377
- case "issues": {
378
- if (task.vcsNumber) {
379
- await addIssueReaction(repo, task.vcsNumber, "eyes", installationId);
380
- }
381
- break;
382
- }
383
- }
384
- } catch (error) {
385
- console.error("[GitHub] Failed to add eyes reaction on task start:", error);
386
- }
387
- }
388
- var init_task_reactions = __esm(() => {
389
- init_reactions();
390
- });
391
-
392
- // src/model-tiers.ts
393
- function parseModelTier(value) {
394
- if (!value)
395
- return;
396
- const normalized = value.trim().toLowerCase();
397
- return ModelTierSchema.safeParse(normalized).success ? normalized : LEGACY_MODEL_TO_TIER[normalized];
398
- }
399
- function splitLegacyModelAlias(input) {
400
- const explicitTier = parseModelTier(input.modelTier);
401
- const model = input.model?.trim();
402
- if (!model)
403
- return { modelTier: explicitTier };
404
- const legacyTier = parseModelTier(model);
405
- if (legacyTier && !explicitTier) {
406
- return { modelTier: legacyTier };
407
- }
408
- return {
409
- model,
410
- modelTier: explicitTier
411
- };
412
- }
413
- function parseTierMapJson(value) {
414
- if (!value)
415
- return {};
416
- try {
417
- const parsed = JSON.parse(value);
418
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
419
- return {};
420
- const result = {};
421
- for (const tier of MODEL_TIERS) {
422
- const model = parsed[tier];
423
- if (typeof model === "string" && model.trim())
424
- result[tier] = model.trim();
425
- }
426
- return result;
427
- } catch {
428
- return {};
429
- }
430
- }
431
- function resolveModelTier(opts) {
432
- const tier = parseModelTier(opts.tier);
433
- if (!tier)
434
- return;
435
- const env = opts.env ?? {};
436
- const jsonOverrides = parseTierMapJson(env.MODEL_TIER_MAP);
437
- const envKey = `MODEL_TIER_${tier.toUpperCase()}`;
438
- const directOverride = env[envKey]?.trim();
439
- if (directOverride)
440
- return directOverride;
441
- if (jsonOverrides[tier])
442
- return jsonOverrides[tier];
443
- return DEFAULT_MODEL_TIER_MAP[opts.harnessProvider]?.[tier];
444
- }
445
- function resolveTaskModelSelection(opts) {
446
- const model = opts.model?.trim();
447
- if (model)
448
- return { model, source: "model" };
449
- const tierModel = resolveModelTier({
450
- tier: opts.modelTier,
451
- harnessProvider: opts.harnessProvider,
452
- env: opts.env
453
- });
454
- if (tierModel)
455
- return { model: tierModel, source: "modelTier" };
456
- return { source: "none" };
457
- }
458
- var ModelTierSchema, MODEL_TIERS, LEGACY_MODEL_TO_TIER, DEFAULT_MODEL_TIER_MAP;
459
- var init_model_tiers = __esm(() => {
460
- init_zod();
461
- ModelTierSchema = exports_external.enum(["smol", "regular", "smart", "ultra"]);
462
- MODEL_TIERS = ModelTierSchema.options;
463
- LEGACY_MODEL_TO_TIER = {
464
- haiku: "smol",
465
- sonnet: "regular",
466
- opus: "smart",
467
- fable: "ultra"
468
- };
469
- DEFAULT_MODEL_TIER_MAP = {
470
- claude: {
471
- smol: "haiku",
472
- regular: "sonnet",
473
- smart: "opus",
474
- ultra: "fable"
475
- },
476
- "claude-managed": {
477
- smol: "claude-haiku-4-5",
478
- regular: "claude-sonnet-4-6",
479
- smart: "claude-opus-4-8",
480
- ultra: "claude-fable-5"
481
- },
482
- codex: {
483
- smol: "gpt-5.4-mini",
484
- regular: "gpt-5.4",
485
- smart: "gpt-5.5",
486
- ultra: "gpt-5.5"
487
- },
488
- pi: {
489
- smol: "openrouter/deepseek/deepseek-v4-flash",
490
- regular: "openrouter/deepseek/deepseek-v4-flash",
491
- smart: "openrouter/deepseek/deepseek-v4-pro",
492
- ultra: "openrouter/anthropic/claude-opus-4.8"
493
- },
494
- opencode: {
495
- smol: "openrouter/deepseek/deepseek-v4-flash",
496
- regular: "openrouter/deepseek/deepseek-v4-flash",
497
- smart: "openrouter/deepseek/deepseek-v4-pro",
498
- ultra: "openrouter/anthropic/claude-opus-4.8"
499
- },
500
- devin: {
501
- smol: "devin",
502
- regular: "devin",
503
- smart: "devin",
504
- ultra: "devin"
505
- }
506
- };
507
- });
508
-
509
- // src/workflows/template.ts
48
+ // src/utils/template.ts
510
49
  function interpolate(template, ctx) {
511
50
  const unresolved = [];
512
51
  const result = template.replace(/\{\{([^}]+)\}\}/g, (_match, path) => {
@@ -807,7 +346,8 @@ function track(options) {
807
346
  properties: {
808
347
  ...options.properties ?? {},
809
348
  is_cloud: cachedIsCloud,
810
- is_e2b: cachedIsE2b
349
+ is_e2b: cachedIsE2b,
350
+ swarmVersion: package_default.version
811
351
  },
812
352
  metadata: {
813
353
  transport: "https",
@@ -828,6 +368,7 @@ function track(options) {
828
368
  }
829
369
  var TELEMETRY_ENDPOINT = "https://proxy.desplega.sh/v1/events", PRODUCT = "agent-swarm", TIMEOUT_MS = 5000, installationId = null, source = "unknown", cachedIsCloud = false, cachedIsE2b = false, CLOUD_HOST_EXACT, CLOUD_HOST_SUFFIXES, telemetry;
830
370
  var init_telemetry = __esm(() => {
371
+ init_package();
831
372
  CLOUD_HOST_EXACT = new Set([
832
373
  "agent-swarm-mcp.desplega.sh",
833
374
  "agent-swarm.dev",
@@ -843,18 +384,140 @@ var init_telemetry = __esm(() => {
843
384
  },
844
385
  session(event, props) {
845
386
  track({ event: `session.${event}`, properties: props });
387
+ },
388
+ schedule(event, props) {
389
+ track({ event: `schedule.${event}`, properties: props });
390
+ },
391
+ workflow(event, props) {
392
+ track({ event: `workflow.${event}`, properties: props });
393
+ },
394
+ agent(event, props) {
395
+ track({ event: `agent.${event}`, properties: props });
396
+ },
397
+ compaction(event, props) {
398
+ track({ event: `compaction.${event}`, properties: props });
846
399
  }
847
400
  };
848
401
  });
849
402
 
850
403
  // src/types.ts
404
+ function parseModelTier(value) {
405
+ if (!value)
406
+ return;
407
+ const normalized = value.trim().toLowerCase();
408
+ return ModelTierSchema.safeParse(normalized).success ? normalized : LEGACY_MODEL_TO_TIER[normalized];
409
+ }
410
+ function splitLegacyModelAlias(input) {
411
+ const explicitTier = parseModelTier(input.modelTier);
412
+ const model = input.model?.trim();
413
+ if (!model)
414
+ return { modelTier: explicitTier };
415
+ const legacyTier = parseModelTier(model);
416
+ if (legacyTier && !explicitTier) {
417
+ return { modelTier: legacyTier };
418
+ }
419
+ return {
420
+ model,
421
+ modelTier: explicitTier
422
+ };
423
+ }
424
+ function parseTierMapJson(value) {
425
+ if (!value)
426
+ return {};
427
+ try {
428
+ const parsed = JSON.parse(value);
429
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
430
+ return {};
431
+ const result = {};
432
+ for (const tier of MODEL_TIERS) {
433
+ const model = parsed[tier];
434
+ if (typeof model === "string" && model.trim())
435
+ result[tier] = model.trim();
436
+ }
437
+ return result;
438
+ } catch {
439
+ return {};
440
+ }
441
+ }
442
+ function resolveModelTier(opts) {
443
+ const tier = parseModelTier(opts.tier);
444
+ if (!tier)
445
+ return;
446
+ const env = opts.env ?? {};
447
+ const jsonOverrides = parseTierMapJson(env.MODEL_TIER_MAP);
448
+ const envKey = `MODEL_TIER_${tier.toUpperCase()}`;
449
+ const directOverride = env[envKey]?.trim();
450
+ if (directOverride)
451
+ return directOverride;
452
+ if (jsonOverrides[tier])
453
+ return jsonOverrides[tier];
454
+ return DEFAULT_MODEL_TIER_MAP[opts.harnessProvider]?.[tier];
455
+ }
456
+ function resolveTaskModelSelection(opts) {
457
+ const model = opts.model?.trim();
458
+ if (model)
459
+ return { model, source: "model" };
460
+ const tierModel = resolveModelTier({
461
+ tier: opts.modelTier,
462
+ harnessProvider: opts.harnessProvider,
463
+ env: opts.env
464
+ });
465
+ if (tierModel)
466
+ return { model: tierModel, source: "modelTier" };
467
+ return { source: "none" };
468
+ }
851
469
  function isTerminalTaskStatus(status) {
852
470
  return TERMINAL_TASK_STATUSES.includes(status);
853
471
  }
854
- var AgentTaskStatusSchema, TERMINAL_TASK_STATUSES, InboxMessageStatusSchema, InboxMessageSchema, AgentTaskSourceSchema, ProviderNameSchema, FollowUpConfigSchema, AgentTaskSchema, TaskAttachmentKindSchema, attachmentCommonFields, AttachmentInputSchema, TaskAttachmentSchema, UserSchema, IdentityEventTypeSchema, InboxItemTypeSchema, InboxItemStatusSchema, InboxItemStateSchema, TaskTemplateKindSchema, TaskTemplateSchema, AgentStatusSchema, AgentSchema, AgentCredStatusLiveTestSchema, AgentLatestModelSchema, AgentBedrockStatusSchema, AgentCredStatusSchema, AgentWithTasksSchema, ChangeSourceSchema, VersionableFieldSchema, ContextVersionSchema, ChannelTypeSchema, ChannelSchema, ChannelMessageSchema, ServiceStatusSchema, ServiceSchema, AgentLogEventTypeSchema, ResumeReasonSchema, AgentLogSchema, SessionLogSchema, SessionCostSourceSchema, SessionCostSchema, EventCategorySchema, EventStatusSchema, EventSourceSchema, EventNameSchema, SwarmEventSchema, ScheduledTaskSchema, SwarmConfigScopeSchema, SwarmConfigSchema, RepoGuidelinesSchema, SwarmRepoSchema, AgentMemoryScopeSchema, AgentMemorySourceSchema, AgentMemorySchema, ActiveSessionSchema, RetryPolicySchema, ExecutorMetaSchema, ValidationResultSchema, StepValidationConfigSchema, SwarmScriptNodeConfigSchema, WorkflowNodeSchema, WorkflowEdgeSchema, WorkflowDefinitionSchema, WorkflowNodePatchSchema, WorkflowPatchSchema, TriggerConfigSchema, CooldownConfigSchema, InputValueSchema, WorkflowTemplateSchema, WorkflowSnapshotSchema, WorkflowSchema, WorkflowVersionSchema, PageContentTypeSchema, PageAuthModeSchema, PageSnapshotSchema, PageSchema, PageVersionSchema, MetricParamSchema, MetricVariableTypeSchema, MetricFormatSchema, MetricVisualizationSchema, MetricQuerySchema, MetricVariableSchema, MetricVizConfigSchema, MetricWidgetSchema, MetricDefinitionSchema, MetricSnapshotSchema, MetricSchema, MetricVersionSchema, WorkflowRunStatusSchema, WorkflowRunSchema, ScriptRunStatusSchema, TERMINAL_SCRIPT_RUN_STATUSES, ScriptRunKindSchema, ScriptRunSchema, ScriptRunListItemSchema, ScriptRunJournalEntrySchema, WorkflowRunStepStatusSchema, WorkflowRunStepSchema, WaitModeSchema, WaitStateStatusSchema, WaitStateRowSchema, PromptTemplateScopeSchema, PromptTemplateStateSchema, PromptTemplateSchema, PromptTemplateHistorySchema, ScriptScopeSchema, ScriptFsModeSchema, ScriptRecordSchema, ScriptVersionRecordSchema, SkillTypeSchema, SkillScopeSchema, SkillSchema, AgentSkillSchema, SkillWithInstallInfoSchema, SkillFileSchema, McpServerTransportSchema, McpServerScopeSchema, McpAuthMethodSchema, McpServerSchema, AgentMcpServerSchema, McpServerWithInstallInfoSchema, ContextSnapshotEventTypeSchema, ContextFormulaSchema, ContextSnapshotSchema, BudgetScopeSchema, BudgetSchema, PricingProviderSchema, PricingTokenClassSchema, PricingRowSchema, BudgetRefusalCauseSchema, BudgetRefusalNotificationSchema, BudgetRefusedTriggerSchema, KvValueTypeSchema, KV_NAME_REGEX, KvNamespaceSchema, KvKeySchema, KvEntrySchema;
472
+ var ModelTierSchema, MODEL_TIERS, LEGACY_MODEL_TO_TIER, DEFAULT_MODEL_TIER_MAP, AgentTaskStatusSchema, TERMINAL_TASK_STATUSES, InboxMessageStatusSchema, InboxMessageSchema, AgentTaskSourceSchema, ProviderNameSchema, FollowUpConfigSchema, AgentTaskSchema, TaskAttachmentKindSchema, attachmentCommonFields, AttachmentInputSchema, TaskAttachmentSchema, UserSchema, IdentityEventTypeSchema, InboxItemTypeSchema, InboxItemStatusSchema, InboxItemStateSchema, TaskTemplateKindSchema, TaskTemplateSchema, AgentStatusSchema, AgentSchema, AgentCredStatusLiveTestSchema, AgentLatestModelSchema, AgentBedrockStatusSchema, AgentCredStatusSchema, AgentWithTasksSchema, ChangeSourceSchema, VersionableFieldSchema, ContextVersionSchema, ChannelTypeSchema, ChannelSchema, ChannelMessageSchema, ServiceStatusSchema, ServiceSchema, AgentLogEventTypeSchema, ResumeReasonSchema, AgentLogSchema, SessionLogSchema, SessionCostSourceSchema, SessionCostSchema, EventCategorySchema, EventStatusSchema, EventSourceSchema, EventNameSchema, SwarmEventSchema, ScheduledTaskSchema, SwarmConfigScopeSchema, SwarmConfigSchema, RepoGuidelinesSchema, RepoHooksSchema, SwarmRepoSchema, AgentMemoryScopeSchema, AgentMemorySourceSchema, AgentMemorySchema, ActiveSessionSchema, RetryPolicySchema, ExecutorMetaSchema, ValidationResultSchema, StepValidationConfigSchema, SwarmScriptNodeConfigSchema, WorkflowNodeSchema, WorkflowEdgeSchema, WorkflowDefinitionSchema, WorkflowNodePatchSchema, WorkflowPatchSchema, TriggerConfigSchema, CooldownConfigSchema, InputValueSchema, WorkflowTemplateSchema, WorkflowSnapshotSchema, WorkflowSchema, WorkflowVersionSchema, PageContentTypeSchema, PageAuthModeSchema, PageSnapshotSchema, PageSchema, PageVersionSchema, MetricParamSchema, MetricVariableTypeSchema, MetricFormatSchema, MetricVisualizationSchema, MetricQuerySchema, MetricVariableSchema, MetricVizConfigSchema, MetricWidgetSchema, MetricDefinitionSchema, MetricSnapshotSchema, MetricSchema, MetricVersionSchema, WorkflowRunStatusSchema, WorkflowRunSchema, ScriptRunStatusSchema, TERMINAL_SCRIPT_RUN_STATUSES, ScriptRunKindSchema, ScriptRunSchema, ScriptRunListItemSchema, ScriptRunJournalEntrySchema, WorkflowRunStepStatusSchema, WorkflowRunStepSchema, WaitModeSchema, WaitStateStatusSchema, WaitStateRowSchema, PromptTemplateScopeSchema, PromptTemplateStateSchema, PromptTemplateSchema, PromptTemplateHistorySchema, ScriptScopeSchema, ScriptFsModeSchema, ScriptRecordSchema, ScriptVersionRecordSchema, SkillTypeSchema, SkillScopeSchema, SkillSchema, AgentSkillSchema, SkillWithInstallInfoSchema, SkillFileSchema, McpServerTransportSchema, McpServerScopeSchema, McpAuthMethodSchema, McpServerSchema, AgentMcpServerSchema, McpServerWithInstallInfoSchema, ContextSnapshotEventTypeSchema, ContextFormulaSchema, ContextSnapshotSchema, BudgetScopeSchema, BudgetSchema, PricingProviderSchema, PricingTokenClassSchema, PricingRowSchema, BudgetRefusalCauseSchema, BudgetRefusalNotificationSchema, BudgetRefusedTriggerSchema, KvValueTypeSchema, KV_NAME_REGEX, KvNamespaceSchema, KvKeySchema, KvEntrySchema;
855
473
  var init_types = __esm(() => {
856
474
  init_zod();
857
- init_model_tiers();
475
+ ModelTierSchema = _enum(["smol", "regular", "smart", "ultra"]);
476
+ MODEL_TIERS = ModelTierSchema.options;
477
+ LEGACY_MODEL_TO_TIER = {
478
+ haiku: "smol",
479
+ sonnet: "regular",
480
+ opus: "smart",
481
+ fable: "ultra"
482
+ };
483
+ DEFAULT_MODEL_TIER_MAP = {
484
+ claude: {
485
+ smol: "haiku",
486
+ regular: "sonnet",
487
+ smart: "opus",
488
+ ultra: "fable"
489
+ },
490
+ "claude-managed": {
491
+ smol: "claude-haiku-4-5",
492
+ regular: "claude-sonnet-4-6",
493
+ smart: "claude-opus-4-8",
494
+ ultra: "claude-fable-5"
495
+ },
496
+ codex: {
497
+ smol: "gpt-5.4-mini",
498
+ regular: "gpt-5.4",
499
+ smart: "gpt-5.5",
500
+ ultra: "gpt-5.5"
501
+ },
502
+ pi: {
503
+ smol: "openrouter/deepseek/deepseek-v4-flash",
504
+ regular: "openrouter/deepseek/deepseek-v4-flash",
505
+ smart: "openrouter/deepseek/deepseek-v4-pro",
506
+ ultra: "openrouter/anthropic/claude-opus-4.8"
507
+ },
508
+ opencode: {
509
+ smol: "openrouter/deepseek/deepseek-v4-flash",
510
+ regular: "openrouter/deepseek/deepseek-v4-flash",
511
+ smart: "openrouter/deepseek/deepseek-v4-pro",
512
+ ultra: "openrouter/anthropic/claude-opus-4.8"
513
+ },
514
+ devin: {
515
+ smol: "devin",
516
+ regular: "devin",
517
+ smart: "devin",
518
+ ultra: "devin"
519
+ }
520
+ };
858
521
  AgentTaskStatusSchema = _enum([
859
522
  "backlog",
860
523
  "unassigned",
@@ -1327,7 +990,8 @@ var init_types = __esm(() => {
1327
990
  "system.boot",
1328
991
  "system.migration",
1329
992
  "system.error",
1330
- "script.global_upsert"
993
+ "script.global_upsert",
994
+ "schedule.deleted"
1331
995
  ]);
1332
996
  SwarmEventSchema = object({
1333
997
  id: uuid(),
@@ -1397,6 +1061,9 @@ var init_types = __esm(() => {
1397
1061
  allowMerge: boolean().optional().default(false),
1398
1062
  review: array(string())
1399
1063
  });
1064
+ RepoHooksSchema = object({
1065
+ enabled: boolean().default(false)
1066
+ });
1400
1067
  SwarmRepoSchema = object({
1401
1068
  id: string().uuid(),
1402
1069
  url: string().min(1),
@@ -1404,6 +1071,7 @@ var init_types = __esm(() => {
1404
1071
  clonePath: string().min(1),
1405
1072
  defaultBranch: string().default("main"),
1406
1073
  autoClone: boolean().default(true),
1074
+ hooks: RepoHooksSchema.optional().default({ enabled: false }),
1407
1075
  guidelines: RepoGuidelinesSchema.nullable().optional(),
1408
1076
  createdAt: string(),
1409
1077
  lastUpdatedAt: string()
@@ -1419,6 +1087,7 @@ var init_types = __esm(() => {
1419
1087
  id: string().uuid(),
1420
1088
  agentId: string().uuid().nullable(),
1421
1089
  scope: AgentMemoryScopeSchema,
1090
+ key: string().nullable().optional(),
1422
1091
  name: string().min(1).max(500),
1423
1092
  content: string(),
1424
1093
  summary: string().nullable(),
@@ -1429,10 +1098,13 @@ var init_types = __esm(() => {
1429
1098
  totalChunks: number().int().min(1).default(1),
1430
1099
  tags: array(string()),
1431
1100
  createdAt: string(),
1101
+ updatedAt: string().nullable().optional(),
1432
1102
  accessedAt: string(),
1433
1103
  expiresAt: string().nullable().optional(),
1434
1104
  accessCount: number().int().min(0).default(0).optional(),
1435
- embeddingModel: string().nullable().optional()
1105
+ embeddingModel: string().nullable().optional(),
1106
+ contentHash: string().nullable().optional(),
1107
+ version: number().int().min(1).default(1).optional()
1436
1108
  });
1437
1109
  ActiveSessionSchema = object({
1438
1110
  id: uuid(),
@@ -3488,6 +3160,25 @@ var init_swarm_config_guard = __esm(() => {
3488
3160
  };
3489
3161
  });
3490
3162
 
3163
+ // src/be/task-lifecycle-events.ts
3164
+ function onTaskStarted(handler) {
3165
+ taskStartedHandlers.push(handler);
3166
+ }
3167
+ function emitTaskStarted(task) {
3168
+ for (const handler of taskStartedHandlers) {
3169
+ try {
3170
+ const result = handler(task);
3171
+ if (result && typeof result.catch === "function") {
3172
+ result.catch(() => {});
3173
+ }
3174
+ } catch {}
3175
+ }
3176
+ }
3177
+ var taskStartedHandlers;
3178
+ var init_task_lifecycle_events = __esm(() => {
3179
+ taskStartedHandlers = [];
3180
+ });
3181
+
3491
3182
  // src/prompts/defaults.ts
3492
3183
  function generateDefaultClaudeMd(agent) {
3493
3184
  const descSection = agent.description ? `${agent.description}
@@ -4100,6 +3791,18 @@ function emitTaskLifecycleTelemetryAfterCommit(event, props, verify) {
4100
3791
  telemetry.taskEvent(event, props);
4101
3792
  });
4102
3793
  }
3794
+ function taskContextForTelemetry(task) {
3795
+ const harnessVersion = task.harnessVariantMeta?.version;
3796
+ const context = {};
3797
+ if (task.provider)
3798
+ context.provider = task.provider;
3799
+ if (task.harnessVariant)
3800
+ context.harnessVariant = task.harnessVariant;
3801
+ if (typeof harnessVersion === "string" || typeof harnessVersion === "number") {
3802
+ context.harnessVersion = String(harnessVersion);
3803
+ }
3804
+ return context;
3805
+ }
4103
3806
  function isSqliteVecAvailable() {
4104
3807
  return sqliteVecAvailable;
4105
3808
  }
@@ -4702,7 +4405,7 @@ function startTask(taskId) {
4702
4405
  }
4703
4406
  const result = row ? rowToAgentTask(row) : null;
4704
4407
  if (result && oldTask.status !== "in_progress") {
4705
- addEyesReactionOnTaskStart(result).catch(() => {});
4408
+ emitTaskStarted(result);
4706
4409
  }
4707
4410
  return result;
4708
4411
  }
@@ -5118,6 +4821,8 @@ function completeTask(id, output) {
5118
4821
  if (row && oldTask) {
5119
4822
  emitTaskLifecycleTelemetryAfterCommit("completed", {
5120
4823
  taskId: id,
4824
+ source: oldTask.source,
4825
+ ...taskContextForTelemetry(oldTask),
5121
4826
  agentId: row.agentId ?? undefined,
5122
4827
  durationMs: row.createdAt ? Date.now() - new Date(row.createdAt).getTime() : undefined
5123
4828
  }, (task) => task?.status === "completed");
@@ -5157,6 +4862,8 @@ function failTask(id, reason) {
5157
4862
  if (row && oldTask) {
5158
4863
  emitTaskLifecycleTelemetryAfterCommit("failed", {
5159
4864
  taskId: id,
4865
+ source: oldTask.source,
4866
+ ...taskContextForTelemetry(oldTask),
5160
4867
  agentId: row.agentId ?? undefined,
5161
4868
  durationMs: row.createdAt ? Date.now() - new Date(row.createdAt).getTime() : undefined
5162
4869
  }, (task) => task?.status === "failed");
@@ -5250,6 +4957,14 @@ function supersedeTask(id, args) {
5250
4957
  WHERE id = ? AND status NOT IN ('completed', 'failed', 'cancelled', 'superseded')
5251
4958
  RETURNING *`).get(finishedAt, id);
5252
4959
  if (row && oldTask) {
4960
+ emitTaskLifecycleTelemetryAfterCommit("superseded", {
4961
+ taskId: id,
4962
+ source: oldTask.source,
4963
+ ...taskContextForTelemetry(oldTask),
4964
+ agentId: row.agentId ?? undefined,
4965
+ reason: args.reason,
4966
+ durationMs: oldTask.createdAt ? Date.now() - new Date(oldTask.createdAt).getTime() : undefined
4967
+ }, (task) => task?.status === "superseded");
5253
4968
  try {
5254
4969
  createLogEntry({
5255
4970
  eventType: "task_superseded",
@@ -5674,7 +5389,7 @@ function createTaskExtended(task, options) {
5674
5389
  emitTaskLifecycleTelemetryAfterCommit("created", {
5675
5390
  taskId: row.id,
5676
5391
  source: row.source,
5677
- tags: options?.tags ?? [],
5392
+ ...taskContextForTelemetry(rowToAgentTask(row)),
5678
5393
  hasParent: !!row.parentTaskId,
5679
5394
  priority: row.priority
5680
5395
  }, (task2) => task2 !== null);
@@ -5710,7 +5425,7 @@ function claimTask(taskId, agentId) {
5710
5425
  }
5711
5426
  const result = row ? rowToAgentTask(row) : null;
5712
5427
  if (result) {
5713
- addEyesReactionOnTaskStart(result).catch(() => {});
5428
+ emitTaskStarted(result);
5714
5429
  }
5715
5430
  return result;
5716
5431
  }
@@ -7044,6 +6759,7 @@ function rowToSwarmRepo(row) {
7044
6759
  clonePath: row.clonePath,
7045
6760
  defaultBranch: row.defaultBranch,
7046
6761
  autoClone: row.autoClone === 1,
6762
+ hooks: row.hooks ? JSON.parse(row.hooks) : { enabled: false },
7047
6763
  guidelines: row.guidelines ? JSON.parse(row.guidelines) : null,
7048
6764
  createdAt: row.createdAt,
7049
6765
  lastUpdatedAt: row.lastUpdatedAt
@@ -7079,10 +6795,11 @@ function getSwarmRepoByUrl(url) {
7079
6795
  function createSwarmRepo(data) {
7080
6796
  const id = crypto.randomUUID();
7081
6797
  const now = new Date().toISOString();
7082
- const clonePath = data.clonePath || `/workspace/repos/${data.name}`;
6798
+ const clonePath = data.clonePath || `/workspace/personal/repos/${data.name}`;
6799
+ const hooksJson = JSON.stringify(data.hooks ?? { enabled: true });
7083
6800
  const guidelinesJson = data.guidelines ? JSON.stringify(data.guidelines) : null;
7084
- const row = getDb().prepare(`INSERT INTO swarm_repos (id, url, name, clonePath, defaultBranch, autoClone, guidelines, createdAt, lastUpdatedAt)
7085
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`).get(id, data.url, data.name, clonePath, data.defaultBranch ?? "main", data.autoClone !== false ? 1 : 0, guidelinesJson, now, now);
6801
+ const row = getDb().prepare(`INSERT INTO swarm_repos (id, url, name, clonePath, defaultBranch, autoClone, hooks, guidelines, createdAt, lastUpdatedAt)
6802
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`).get(id, data.url, data.name, clonePath, data.defaultBranch ?? "main", data.autoClone !== false ? 1 : 0, hooksJson, guidelinesJson, now, now);
7086
6803
  if (!row)
7087
6804
  throw new Error("Failed to create repo");
7088
6805
  return rowToSwarmRepo(row);
@@ -7101,6 +6818,10 @@ function updateSwarmRepo(id, updates) {
7101
6818
  setClauses.push("autoClone = ?");
7102
6819
  params.push(updates.autoClone ? 1 : 0);
7103
6820
  }
6821
+ if (updates.hooks !== undefined) {
6822
+ setClauses.push("hooks = ?");
6823
+ params.push(updates.hooks ? JSON.stringify(updates.hooks) : null);
6824
+ }
7104
6825
  if (updates.guidelines !== undefined) {
7105
6826
  setClauses.push("guidelines = ?");
7106
6827
  params.push(updates.guidelines ? JSON.stringify(updates.guidelines) : null);
@@ -7422,6 +7143,22 @@ function getWorkflowRun(id) {
7422
7143
  const row = getDb().prepare("SELECT * FROM workflow_runs WHERE id = ?").get(id);
7423
7144
  return row ? rowToWorkflowRun(row) : null;
7424
7145
  }
7146
+ function emitWorkflowTerminalTelemetry(run) {
7147
+ if (run.status !== "completed" && run.status !== "failed")
7148
+ return;
7149
+ queueMicrotask(() => {
7150
+ const latest = getWorkflowRun(run.id);
7151
+ if (!latest || latest.status !== run.status)
7152
+ return;
7153
+ const steps = getWorkflowRunStepsByRunId(run.id);
7154
+ telemetry.workflow(run.status, {
7155
+ workflowId: run.workflowId,
7156
+ durationMs: run.startedAt ? Date.now() - new Date(run.startedAt).getTime() : undefined,
7157
+ stepsCompleted: steps.filter((step) => step.status === "completed").length,
7158
+ stepsFailed: steps.filter((step) => step.status === "failed").length
7159
+ });
7160
+ });
7161
+ }
7425
7162
  function updateWorkflowRun(id, data) {
7426
7163
  const updates = [];
7427
7164
  const params = [];
@@ -7447,7 +7184,13 @@ function updateWorkflowRun(id, data) {
7447
7184
  params.push(new Date().toISOString());
7448
7185
  params.push(id);
7449
7186
  const row = getDb().prepare(`UPDATE workflow_runs SET ${updates.join(", ")} WHERE id = ? RETURNING *`).get(...params);
7450
- return row ? rowToWorkflowRun(row) : null;
7187
+ if (!row)
7188
+ return null;
7189
+ const run = rowToWorkflowRun(row);
7190
+ if (data.status === "completed" || data.status === "failed") {
7191
+ emitWorkflowTerminalTelemetry(run);
7192
+ }
7193
+ return run;
7451
7194
  }
7452
7195
  function listWorkflowRuns(workflowId) {
7453
7196
  return getDb().prepare("SELECT * FROM workflow_runs WHERE workflowId = ? ORDER BY startedAt DESC").all(workflowId).map(rowToWorkflowRun);
@@ -9899,8 +9642,6 @@ var db = null, sqliteVecAvailable = false, VERSIONABLE_FIELDS, agentQueries, MAX
9899
9642
  var init_db = __esm(() => {
9900
9643
  init_provider_metadata();
9901
9644
  init_package();
9902
- init_task_reactions();
9903
- init_model_tiers();
9904
9645
  init_resolver();
9905
9646
  init_telemetry();
9906
9647
  init_types();
@@ -9912,6 +9653,7 @@ var init_db = __esm(() => {
9912
9653
  init_runner();
9913
9654
  init_seed_prompt_templates();
9914
9655
  init_swarm_config_guard();
9656
+ init_task_lifecycle_events();
9915
9657
  init_defaults();
9916
9658
  VERSIONABLE_FIELDS = [
9917
9659
  "soulMd",
@@ -10004,4 +9746,4 @@ var init_db = __esm(() => {
10004
9746
  };
10005
9747
  });
10006
9748
 
10007
- export { isGitHubEnabled, resetGitHub, initGitHub, verifyWebhookSignature, getInstallationToken, init_app, addReaction, addIssueReaction, init_reactions, ModelTierSchema, splitLegacyModelAlias, resolveTaskModelSelection, init_model_tiers, interpolate, deepInterpolate, init_template, registerTemplate, getTemplateDefinition, getAllTemplateDefinitions, init_registry, configureHttpResolver, resolveTemplate, resolveTemplateAsync, init_resolver, initTelemetry, telemetry, init_telemetry, AgentTaskStatusSchema, isTerminalTaskStatus, AgentTaskSourceSchema, ProviderNameSchema, FollowUpConfigSchema, AgentTaskSchema, AttachmentInputSchema, TaskAttachmentSchema, InboxItemTypeSchema, InboxItemStatusSchema, TaskTemplateKindSchema, AgentSchema, AgentLatestModelSchema, AgentCredStatusSchema, ChannelTypeSchema, ChannelSchema, ChannelMessageSchema, ServiceStatusSchema, ServiceSchema, ResumeReasonSchema, AgentLogSchema, EventCategorySchema, EventStatusSchema, EventSourceSchema, EventNameSchema, SwarmConfigScopeSchema, SwarmConfigSchema, RepoGuidelinesSchema, SwarmRepoSchema, AgentMemoryScopeSchema, AgentMemorySourceSchema, AgentMemorySchema, WorkflowDefinitionSchema, WorkflowNodePatchSchema, WorkflowPatchSchema, TriggerConfigSchema, CooldownConfigSchema, InputValueSchema, PageContentTypeSchema, PageAuthModeSchema, MetricDefinitionSchema, MetricVersionSchema, WorkflowRunStatusSchema, ScriptRunStatusSchema, TERMINAL_SCRIPT_RUN_STATUSES, PromptTemplateScopeSchema, PromptTemplateStateSchema, PromptTemplateSchema, PromptTemplateHistorySchema, ScriptScopeSchema, ScriptFsModeSchema, ContextSnapshotEventTypeSchema, ContextFormulaSchema, BudgetScopeSchema, BudgetSchema, PricingProviderSchema, PricingTokenClassSchema, PricingRowSchema, BudgetRefusalCauseSchema, BudgetRefusalNotificationSchema, KvValueTypeSchema, KvNamespaceSchema, KvKeySchema, KvEntrySchema, init_types, setRequestAuth, getRequestAuth, init_request_auth_context, encryptSecret, decryptSecret, getEncryptionKey, init_crypto, normalizeDateRequired, init_date_utils, init_session_templates, init_templates, init_templates2 as init_templates1, isReservedConfigKey, reservedKeyError, validateConfigValue, init_swarm_config_guard, generateDefaultClaudeMd, generateDefaultSoulMd, generateDefaultIdentityMd, generateDefaultToolsMd, init_defaults, isSqliteVecAvailable, initDb, getDb, closeDb, computeContentHash, createContextVersion, getLatestContextVersion, getContextVersion, getContextVersionHistory, agentQueries, updateAgentCredentialState, createAgent, getAgentById, getAllAgents, getLeadAgent, updateAgentStatus, updateAgentMaxTasks, updateAgentProvider, setAgentHarnessProvider, updateAgentCredStatus, listAgentsWithCredStatusByProvider, getAgentHarnessProviders, updateAgentActivity, MAX_EMPTY_POLLS, incrementEmptyPollCount, resetEmptyPollCount, shouldBlockPolling, deleteAgent, getActiveTaskCount, hasCapacity, getRemainingCapacity, updateAgentStatusFromCapacity, taskQueries, createTask, getPendingTaskForAgent, assignUnassignedTaskPending, startTask, getTaskById, markTaskSlackReplySent, setSlackMessageTracking, getChildTasks, hasNonTerminalResumeChild, hasNonTerminalRerouteDecisionChild, updateTaskClaudeSessionId, updateTaskVcs, getTasksByAgentId, getAgentCurrentTask, getTasksByStatus, findTaskByVcs, findTaskByGitHub, getAllTasks, getTasksCount, getTaskStats, getCompletedSlackTasks, getRecentlyFinishedWorkerTasks, markTasksNotified, resetTasksNotified, getInProgressSlackTasks, getInProgressTasksByContextKey, getLatestTaskByContextKey, getAgentWorkingOnThread, getLatestActiveTaskInThread, getMostRecentTaskInThread, findCompletedTaskInThread, findRecentCancelledTaskInThread, completeTask, failTask, cancelTask, supersedeTask, backfillSupersedeTaskResumeTaskId, pauseTask, resumeTask, getPausedTasksForAgent, getOrphanedInProgressTasksForAgent, resetOrphanedInProgressTasksForAgent, getRecentlyCancelledTasksForAgent, deleteTask, updateTaskProgress, insertTaskAttachment, getTaskAttachments, getAgentWithTasks, getAllAgentsWithTasks, logQueries, createLogEntry, getLogsByAgentId, getLogsByTaskId, getLogsByTaskIdChronological, getLogsByEventType, getAllLogs, findRecentSimilarTasks, createTaskExtended, claimTask, releaseTask, acceptTask, rejectTask, moveTaskToBacklog, moveTaskFromBacklog, releaseStaleReviewingTasks, getOfferedTasksForAgent, claimOfferedTask, getUnassignedTasksCount, getUnassignedTaskIds, checkDependencies, getDependentTasks, cascadeFailDependents, updateAgentProfile, updateAgentName, createChannel, getMessageById, getChannelById, getChannelByName, getAllChannels, deleteChannel, postMessage, getChannelMessages, updateReadState, getLastReadAt, getUnreadMessages, getMentionsForAgent, getInboxSummary, claimMentions, releaseMentionProcessing, releaseStaleMentionProcessing, createService, getServiceById, getServiceByAgentAndName, getServicesByAgentId, getAllServices, updateServiceStatus, deleteService, upsertService, deleteServicesByAgentId, sessionLogQueries, createSessionLogs, getSessionLogsByTaskId, getSessionLogsBySession, createSessionCost, getSessionCostsByTaskId, getSessionCostsByAgentId, getAllSessionCosts, getSessionCostsFiltered, getSessionCostSummary, getDashboardCostSummary, createInboxMessage, getInboxMessageById, getUnreadInboxMessages, claimInboxMessages, markInboxMessageRead, markInboxMessageResponded, markInboxMessageDelegated, releaseStaleProcessingInbox, getConcurrentContext, getScheduledTasks, getScheduledTaskById, getScheduledTaskByName, createScheduledTask, updateScheduledTask, deleteScheduledTask, getDueScheduledTasks, autoEncryptLegacyPlaintextSecrets, maskSecrets, getSwarmConfigs, getInjectableGlobalConfigs, getSwarmConfigById, getSwarmConfigLookupById, upsertSwarmConfig, deleteSwarmConfig, getResolvedConfig, getSwarmRepos, getSwarmRepoById, getSwarmRepoByName, getSwarmRepoByUrl, createSwarmRepo, updateSwarmRepo, deleteSwarmRepo, getAgentMailInboxMapping, getAgentMailInboxMappingsByAgent, getAllAgentMailInboxMappings, createAgentMailInboxMapping, deleteAgentMailInboxMapping, findTaskByAgentMailThread, insertActiveSession, deleteActiveSession, deleteActiveSessionById, getActiveSessions, heartbeatActiveSession, cleanupStaleSessions, cleanupAgentSessions, updateActiveSessionProviderSessionId, getActiveSessionForTask, reassociateSessionLogs, getStalledInProgressTasks, getStalePinnedResumes, failPendingResumeIfUnclaimed, getIdleWorkersWithCapacity, getUnassignedPoolTasks, getRecentFailedTasks, getRecentCompletedCount, getRecentFailedCount, createWorkflow, getWorkflow, listWorkflows, updateWorkflow, deleteWorkflow, getWorkflowsByScheduleId, createWorkflowRun, getWorkflowRun, updateWorkflowRun, listWorkflowRuns, createWorkflowRunStep, getWorkflowRunStep, updateWorkflowRunStep, getWorkflowRunStepsByRunId, getStuckWorkflowRuns, getLastSuccessfulRun, getLastRunStart, getRetryableSteps, getCompletedStepNodeIds, getTaskByWorkflowRunStepId, getStepByIdempotencyKey, getStepCountForNode, getLatestStepForNode, createWorkflowVersion, getWorkflowVersions, getWorkflowVersion, createPage, getPage, getPageBySlug, listPagesByAgent, listAllPages, countAllPages, countPagesByAgent, updatePage, deletePage, incrementPageViewCount, createPageVersion, getPageVersions, getPageVersion, createMetric, getMetric, getMetricBySlug, listMetricsByAgent, listAllMetrics, countAllMetrics, countMetricsByAgent, updateMetric, deleteMetric, createMetricVersion, getMetricVersions, getMetricVersion, getPromptTemplates, getPromptTemplateById, upsertPromptTemplate, deletePromptTemplate, resetPromptTemplateToDefault, getPromptTemplateHistory, resolvePromptTemplate, checkoutPromptTemplate, getAllChannelActivityCursors, getChannelActivityCursor, upsertChannelActivityCursor, createApprovalRequest, getApprovalRequestById, resolveApprovalRequest, updateApprovalRequestNotifications, listApprovalRequests, getStuckApprovalRuns, getApprovalRequestByStepId, getExpiredPendingApprovals, createWaitState, getWaitStateById, getWaitStateByStepId, getDueWaitStates, getPendingEventWaitNames, getPendingWaitsByEvent, resolveWaitState, getStuckWaitRuns, SKILL_FILE_LIMITS, normalizeSkillFilePath, createSkill, updateSkill, listSkillFileManifest, getSkillFiles, getSkillFile, upsertSkillFile, upsertSkillFiles, deleteSkillFile, deleteSkill, getSkillById, getSkillByName, listSkills, searchSkills, installSkill, getSystemDefaultSkills, installSystemDefaultSkillsForAgent, uninstallSkill, getAgentSkills, toggleAgentSkill, createMcpServer, updateMcpServer, deleteMcpServer, getMcpServerById, getMcpServerByName, listMcpServers, installMcpServer, uninstallMcpServer, getAgentMcpServers, createContextSnapshot, getContextSnapshotsByTaskId, getContextSnapshotsBySessionId, getContextSummaryByTaskId, getAvailableKeyIndices, recordKeyUsage, markKeyRateLimited, recordKeyRateLimitWindows, setApiKeyName, clearKeyRateLimit, getKeyStatuses, getKeyCostSummary, getUserById, getAllUsers, createUser, updateUser, deleteUser, listInboxState, upsertInboxState, listTaskTemplates, getRootTaskChain, listRecentSessions, countSessions, getBudget, getBudgets, upsertBudget, deleteBudget, getAllPricingRows, getPricingRows, getActivePricingRow, insertPricingRow, deletePricingRow, getDailySpendForAgent, getDailySpendGlobal, getDailySpendForUser, recordBudgetRefusalNotification, getBudgetRefusalNotification, getRecentBudgetRefusalNotifications, hasBudgetRefusalNotificationToday, setBudgetRefusalFollowUpTaskId, getLiveAgentCounts, getInstanceActivity, getSwarmMetrics, hasFirstCompletedTask, getKv, upsertKv, deleteKv, KvTypeCollisionError, incrKv, listKv, countKv, createScriptRun, recordInlineScriptRun, getScriptRun, getScriptRunByIdempotencyKey, listScriptRuns, countScriptRuns, countActiveScriptRuns, updateScriptRun, getRunningScriptRuns, getScriptRunJournalStep, upsertScriptRunJournalStep, listScriptRunJournalSteps, countScriptRunJournalSteps, countScriptRunJournalAgentTaskSteps, exports_db, init_db };
9749
+ export { interpolate, deepInterpolate, init_template, registerTemplate, getTemplateDefinition, getAllTemplateDefinitions, init_registry, configureHttpResolver, resolveTemplate, resolveTemplateAsync, init_resolver, initTelemetry, telemetry, init_telemetry, ModelTierSchema, splitLegacyModelAlias, resolveTaskModelSelection, AgentTaskStatusSchema, isTerminalTaskStatus, AgentTaskSourceSchema, ProviderNameSchema, FollowUpConfigSchema, AgentTaskSchema, AttachmentInputSchema, TaskAttachmentSchema, InboxItemTypeSchema, InboxItemStatusSchema, TaskTemplateKindSchema, AgentSchema, AgentLatestModelSchema, AgentCredStatusSchema, ChannelTypeSchema, ChannelSchema, ChannelMessageSchema, ServiceStatusSchema, ServiceSchema, ResumeReasonSchema, AgentLogSchema, EventCategorySchema, EventStatusSchema, EventSourceSchema, EventNameSchema, SwarmConfigScopeSchema, SwarmConfigSchema, RepoGuidelinesSchema, RepoHooksSchema, SwarmRepoSchema, AgentMemoryScopeSchema, AgentMemorySourceSchema, AgentMemorySchema, WorkflowDefinitionSchema, WorkflowNodePatchSchema, WorkflowPatchSchema, TriggerConfigSchema, CooldownConfigSchema, InputValueSchema, PageContentTypeSchema, PageAuthModeSchema, MetricDefinitionSchema, MetricVersionSchema, WorkflowRunStatusSchema, ScriptRunStatusSchema, TERMINAL_SCRIPT_RUN_STATUSES, PromptTemplateScopeSchema, PromptTemplateStateSchema, PromptTemplateSchema, PromptTemplateHistorySchema, ScriptScopeSchema, ScriptFsModeSchema, ContextSnapshotEventTypeSchema, ContextFormulaSchema, BudgetScopeSchema, BudgetSchema, PricingProviderSchema, PricingTokenClassSchema, PricingRowSchema, BudgetRefusalCauseSchema, BudgetRefusalNotificationSchema, KvValueTypeSchema, KvNamespaceSchema, KvKeySchema, KvEntrySchema, init_types, setRequestAuth, getRequestAuth, init_request_auth_context, encryptSecret, decryptSecret, getEncryptionKey, init_crypto, normalizeDateRequired, init_date_utils, init_session_templates, init_templates, init_templates2 as init_templates1, isReservedConfigKey, reservedKeyError, validateConfigValue, init_swarm_config_guard, onTaskStarted, init_task_lifecycle_events, generateDefaultClaudeMd, generateDefaultSoulMd, generateDefaultIdentityMd, generateDefaultToolsMd, init_defaults, isSqliteVecAvailable, initDb, getDb, closeDb, computeContentHash, createContextVersion, getLatestContextVersion, getContextVersion, getContextVersionHistory, agentQueries, updateAgentCredentialState, createAgent, getAgentById, getAllAgents, getLeadAgent, updateAgentStatus, updateAgentMaxTasks, updateAgentProvider, setAgentHarnessProvider, updateAgentCredStatus, listAgentsWithCredStatusByProvider, getAgentHarnessProviders, updateAgentActivity, MAX_EMPTY_POLLS, incrementEmptyPollCount, resetEmptyPollCount, shouldBlockPolling, deleteAgent, getActiveTaskCount, hasCapacity, getRemainingCapacity, updateAgentStatusFromCapacity, taskQueries, createTask, getPendingTaskForAgent, assignUnassignedTaskPending, startTask, getTaskById, markTaskSlackReplySent, setSlackMessageTracking, getChildTasks, hasNonTerminalResumeChild, hasNonTerminalRerouteDecisionChild, updateTaskClaudeSessionId, updateTaskVcs, getTasksByAgentId, getAgentCurrentTask, getTasksByStatus, findTaskByVcs, findTaskByGitHub, getAllTasks, getTasksCount, getTaskStats, getCompletedSlackTasks, getRecentlyFinishedWorkerTasks, markTasksNotified, resetTasksNotified, getInProgressSlackTasks, getInProgressTasksByContextKey, getLatestTaskByContextKey, getAgentWorkingOnThread, getLatestActiveTaskInThread, getMostRecentTaskInThread, findCompletedTaskInThread, findRecentCancelledTaskInThread, completeTask, failTask, cancelTask, supersedeTask, backfillSupersedeTaskResumeTaskId, pauseTask, resumeTask, getPausedTasksForAgent, getOrphanedInProgressTasksForAgent, resetOrphanedInProgressTasksForAgent, getRecentlyCancelledTasksForAgent, deleteTask, updateTaskProgress, insertTaskAttachment, getTaskAttachments, getAgentWithTasks, getAllAgentsWithTasks, logQueries, createLogEntry, getLogsByAgentId, getLogsByTaskId, getLogsByTaskIdChronological, getLogsByEventType, getAllLogs, findRecentSimilarTasks, createTaskExtended, claimTask, releaseTask, acceptTask, rejectTask, moveTaskToBacklog, moveTaskFromBacklog, releaseStaleReviewingTasks, getOfferedTasksForAgent, claimOfferedTask, getUnassignedTasksCount, getUnassignedTaskIds, checkDependencies, getDependentTasks, cascadeFailDependents, updateAgentProfile, updateAgentName, createChannel, getMessageById, getChannelById, getChannelByName, getAllChannels, deleteChannel, postMessage, getChannelMessages, updateReadState, getLastReadAt, getUnreadMessages, getMentionsForAgent, getInboxSummary, claimMentions, releaseMentionProcessing, releaseStaleMentionProcessing, createService, getServiceById, getServiceByAgentAndName, getServicesByAgentId, getAllServices, updateServiceStatus, deleteService, upsertService, deleteServicesByAgentId, sessionLogQueries, createSessionLogs, getSessionLogsByTaskId, getSessionLogsBySession, createSessionCost, getSessionCostsByTaskId, getSessionCostsByAgentId, getAllSessionCosts, getSessionCostsFiltered, getSessionCostSummary, getDashboardCostSummary, createInboxMessage, getInboxMessageById, getUnreadInboxMessages, claimInboxMessages, markInboxMessageRead, markInboxMessageResponded, markInboxMessageDelegated, releaseStaleProcessingInbox, getConcurrentContext, getScheduledTasks, getScheduledTaskById, getScheduledTaskByName, createScheduledTask, updateScheduledTask, deleteScheduledTask, getDueScheduledTasks, autoEncryptLegacyPlaintextSecrets, maskSecrets, getSwarmConfigs, getInjectableGlobalConfigs, getSwarmConfigById, getSwarmConfigLookupById, upsertSwarmConfig, deleteSwarmConfig, getResolvedConfig, getSwarmRepos, getSwarmRepoById, getSwarmRepoByName, getSwarmRepoByUrl, createSwarmRepo, updateSwarmRepo, deleteSwarmRepo, getAgentMailInboxMapping, getAgentMailInboxMappingsByAgent, getAllAgentMailInboxMappings, createAgentMailInboxMapping, deleteAgentMailInboxMapping, findTaskByAgentMailThread, insertActiveSession, deleteActiveSession, deleteActiveSessionById, getActiveSessions, heartbeatActiveSession, cleanupStaleSessions, cleanupAgentSessions, updateActiveSessionProviderSessionId, getActiveSessionForTask, reassociateSessionLogs, getStalledInProgressTasks, getStalePinnedResumes, failPendingResumeIfUnclaimed, getIdleWorkersWithCapacity, getUnassignedPoolTasks, getRecentFailedTasks, getRecentCompletedCount, getRecentFailedCount, createWorkflow, getWorkflow, listWorkflows, updateWorkflow, deleteWorkflow, getWorkflowsByScheduleId, createWorkflowRun, getWorkflowRun, updateWorkflowRun, listWorkflowRuns, createWorkflowRunStep, getWorkflowRunStep, updateWorkflowRunStep, getWorkflowRunStepsByRunId, getStuckWorkflowRuns, getLastSuccessfulRun, getLastRunStart, getRetryableSteps, getCompletedStepNodeIds, getTaskByWorkflowRunStepId, getStepByIdempotencyKey, getStepCountForNode, getLatestStepForNode, createWorkflowVersion, getWorkflowVersions, getWorkflowVersion, createPage, getPage, getPageBySlug, listPagesByAgent, listAllPages, countAllPages, countPagesByAgent, updatePage, deletePage, incrementPageViewCount, createPageVersion, getPageVersions, getPageVersion, createMetric, getMetric, getMetricBySlug, listMetricsByAgent, listAllMetrics, countAllMetrics, countMetricsByAgent, updateMetric, deleteMetric, createMetricVersion, getMetricVersions, getMetricVersion, getPromptTemplates, getPromptTemplateById, upsertPromptTemplate, deletePromptTemplate, resetPromptTemplateToDefault, getPromptTemplateHistory, resolvePromptTemplate, checkoutPromptTemplate, getAllChannelActivityCursors, getChannelActivityCursor, upsertChannelActivityCursor, createApprovalRequest, getApprovalRequestById, resolveApprovalRequest, updateApprovalRequestNotifications, listApprovalRequests, getStuckApprovalRuns, getApprovalRequestByStepId, getExpiredPendingApprovals, createWaitState, getWaitStateById, getWaitStateByStepId, getDueWaitStates, getPendingEventWaitNames, getPendingWaitsByEvent, resolveWaitState, getStuckWaitRuns, SKILL_FILE_LIMITS, normalizeSkillFilePath, createSkill, updateSkill, listSkillFileManifest, getSkillFiles, getSkillFile, upsertSkillFile, upsertSkillFiles, deleteSkillFile, deleteSkill, getSkillById, getSkillByName, listSkills, searchSkills, installSkill, getSystemDefaultSkills, installSystemDefaultSkillsForAgent, uninstallSkill, getAgentSkills, toggleAgentSkill, createMcpServer, updateMcpServer, deleteMcpServer, getMcpServerById, getMcpServerByName, listMcpServers, installMcpServer, uninstallMcpServer, getAgentMcpServers, createContextSnapshot, getContextSnapshotsByTaskId, getContextSnapshotsBySessionId, getContextSummaryByTaskId, getAvailableKeyIndices, recordKeyUsage, markKeyRateLimited, recordKeyRateLimitWindows, setApiKeyName, clearKeyRateLimit, getKeyStatuses, getKeyCostSummary, getUserById, getAllUsers, createUser, updateUser, deleteUser, listInboxState, upsertInboxState, listTaskTemplates, getRootTaskChain, listRecentSessions, countSessions, getBudget, getBudgets, upsertBudget, deleteBudget, getAllPricingRows, getPricingRows, getActivePricingRow, insertPricingRow, deletePricingRow, getDailySpendForAgent, getDailySpendGlobal, getDailySpendForUser, recordBudgetRefusalNotification, getBudgetRefusalNotification, getRecentBudgetRefusalNotifications, hasBudgetRefusalNotificationToday, setBudgetRefusalFollowUpTaskId, getLiveAgentCounts, getInstanceActivity, getSwarmMetrics, hasFirstCompletedTask, getKv, upsertKv, deleteKv, KvTypeCollisionError, incrKv, listKv, countKv, createScriptRun, recordInlineScriptRun, getScriptRun, getScriptRunByIdempotencyKey, listScriptRuns, countScriptRuns, countActiveScriptRuns, updateScriptRun, getRunningScriptRuns, getScriptRunJournalStep, upsertScriptRunJournalStep, listScriptRunJournalSteps, countScriptRunJournalSteps, countScriptRunJournalAgentTaskSteps, exports_db, init_db };