@desplega.ai/agent-swarm 2.5.1 → 2.5.3

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 (197) hide show
  1. package/dist/{acp-adapter-7g6bpwbk.js → acp-adapter-gr2fcyyj.js} +3 -3
  2. package/dist/{actions-w8xd014k.js → actions-wv766ghf.js} +18 -18
  3. package/dist/{amp-adapter-z4qvhacj.js → amp-adapter-speb906t.js} +3 -3
  4. package/dist/{app-nndcvftq.js → app-ag29n14f.js} +3 -3
  5. package/dist/{assistant-hjmqyscx.js → assistant-3x8bz3eg.js} +19 -19
  6. package/dist/{boot-reembed-r8rhf9h8.js → boot-reembed-5b3d2eea.js} +1 -1
  7. package/dist/{boot-reembed-vwcj2y5d.js → boot-reembed-jsmfrpzf.js} +1 -1
  8. package/dist/{boot-scrub-sweep-fr9q36ne.js → boot-scrub-sweep-s73gerxy.js} +2 -2
  9. package/dist/{boot-seeds-9jqwnegq.js → boot-seeds-5zmax2wr.js} +4 -4
  10. package/dist/{claude-adapter-2f8b85df.js → claude-adapter-hswdnm3t.js} +3 -3
  11. package/dist/{claude-managed-adapter-gt6pa35d.js → claude-managed-adapter-cvbzj1h6.js} +2 -2
  12. package/dist/{claude-managed-setup-c3hp36ph.js → claude-managed-setup-3k8m3hhc.js} +2 -2
  13. package/dist/{claude-sdk-session-05kat8rv.js → claude-sdk-session-fkbyk66x.js} +6905 -6855
  14. package/dist/{cli-y3zyaee5.js → cli-1fc85mvt.js} +5 -5
  15. package/dist/{cli-v2g93k4v.js → cli-210xd1f4.js} +4 -4
  16. package/dist/{cli-sn1vbtg2.js → cli-25j01dpj.js} +3 -3
  17. package/dist/{cli-n6kmqngw.js → cli-35gtk1p6.js} +1 -1
  18. package/dist/{cli-r9fy0ddc.js → cli-3ngdk5te.js} +1 -1
  19. package/dist/{cli-z63a269p.js → cli-40jsnrjm.js} +2 -2
  20. package/dist/{cli-ba8ne1es.js → cli-4rvr7zfx.js} +10 -0
  21. package/dist/{cli-qfm6my86.js → cli-502eqv93.js} +1 -1
  22. package/dist/{cli-xd4eqtr2.js → cli-6n8axjv1.js} +1 -1
  23. package/dist/{cli-hadv0725.js → cli-8s5wx3nz.js} +2 -2
  24. package/dist/{cli-z2dv25mf.js → cli-99xgw26r.js} +116 -5
  25. package/dist/{cli-jpxsrxcb.js → cli-9s05422w.js} +1 -1
  26. package/dist/{cli-kcsd1ez8.js → cli-aecdcr77.js} +343 -325
  27. package/dist/{cli-w9etnnxk.js → cli-bf8ma3f1.js} +120 -50
  28. package/dist/{cli-e9btqw4y.js → cli-ce0ak9ms.js} +18 -13
  29. package/dist/{cli-nj12tn2c.js → cli-e2ar4bp1.js} +71 -20
  30. package/dist/{cli-gwcf52gz.js → cli-e8jyq7d8.js} +11 -7
  31. package/dist/{cli-rngde2jv.js → cli-egjggehm.js} +1 -1
  32. package/dist/{cli-qfjm4gvt.js → cli-ewm3pwbq.js} +2 -2
  33. package/dist/{cli-9mm5ade4.js → cli-fsdprwrg.js} +1 -1
  34. package/dist/{cli-3ee5z0q0.js → cli-fzcn3d87.js} +1 -1
  35. package/dist/{cli-eym3jg7w.js → cli-gpsz7g88.js} +6 -6
  36. package/dist/{cli-cwyafhw1.js → cli-hcpj2xqz.js} +1 -1
  37. package/dist/{cli-j1eghqfm.js → cli-hhxjnjzs.js} +1 -1
  38. package/dist/{cli-pyy4c9ch.js → cli-jjznk3f7.js} +881 -232
  39. package/dist/{cli-q9pzwxvk.js → cli-kxawjrxg.js} +222 -37
  40. package/dist/{cli-rh5smt8t.js → cli-mz9afxxf.js} +14 -3
  41. package/dist/{cli-mz2ygeyq.js → cli-n45mr7zh.js} +2 -2
  42. package/dist/{cli-fes51ya2.js → cli-p0rzjkya.js} +2 -2
  43. package/dist/{cli-3qv8naq8.js → cli-p6zs9h4y.js} +827 -107
  44. package/dist/{cli-mq7kg1b1.js → cli-p9rafdrb.js} +41 -6
  45. package/dist/{cli-cah5detr.js → cli-qgf8emrn.js} +5 -5
  46. package/dist/{cli-2wba1ac9.js → cli-qzme5949.js} +26 -26
  47. package/dist/{cli-znvq0k3t.js → cli-s49hpn37.js} +2 -2
  48. package/dist/{cli-xc65x52q.js → cli-s53vp709.js} +1 -1
  49. package/dist/{cli-0jy85zz4.js → cli-svrj71pg.js} +18 -16
  50. package/dist/{cli-1dp1zj04.js → cli-vwn81jbs.js} +3 -3
  51. package/dist/{cli-ajqhxtnz.js → cli-w1zwctj2.js} +1 -1
  52. package/dist/{cli-22rmcjkg.js → cli-y561h5a9.js} +7 -6
  53. package/dist/{cli-2jg61wab.js → cli-z21whrrg.js} +15 -15
  54. package/dist/cli.js +19 -18
  55. package/dist/{codex-adapter-p4ptwar5.js → codex-adapter-n8ka66vf.js} +2 -2
  56. package/dist/{codex-session-runner-964c7dnk.js → codex-session-runner-fsebts37.js} +1 -1
  57. package/dist/{commands-mbvhbrcy.js → commands-t04rt2pc.js} +2 -2
  58. package/dist/{controller-gnq1k1mf.js → controller-rgna04r2.js} +2 -2
  59. package/dist/{controllers-connect-6dkm71tg.js → controllers-connect-bqm1rtft.js} +20 -20
  60. package/dist/{cursor-adapter-yq5xgfcg.js → cursor-adapter-swr2k95y.js} +1 -1
  61. package/dist/{db-88wcymxt.js → db-24ck09xy.js} +1 -1
  62. package/dist/{db-af9y8nkf.js → db-a4m7haw0.js} +3 -3
  63. package/dist/{dispatcher-606ydx5v.js → dispatcher-nwf9ss0q.js} +17 -17
  64. package/dist/{dsh-adapter-tvhc4k2d.js → dsh-adapter-kpdnhjst.js} +2 -2
  65. package/dist/{external-channel-y8q5z8z2.js → external-channel-j1e2p34p.js} +2 -2
  66. package/dist/{grok-adapter-39aha52t.js → grok-adapter-qtjz0whk.js} +4 -4
  67. package/dist/{handlers-rk9dqech.js → handlers-19xr6dnz.js} +20 -20
  68. package/dist/{heartbeat-jfe9zfjr.js → heartbeat-vtesda5d.js} +20 -20
  69. package/dist/{hook-b1mez1m8.js → hook-8wqaszda.js} +1 -1
  70. package/dist/{hook-ffevzed1.js → hook-b2hhj6rd.js} +1 -1
  71. package/dist/{http-d5b44f1r.js → http-mxcqhhcs.js} +3020 -2463
  72. package/dist/{index-5en23s5z.js → index-1r8wfpzs.js} +1 -1
  73. package/dist/{index-cbxkmfc5.js → index-9pn1pfkf.js} +1 -1
  74. package/dist/{index-mj46rk9k.js → index-kw2mmat7.js} +20 -20
  75. package/dist/{index-nq8hhv28.js → index-n1vbvta9.js} +19 -10
  76. package/dist/{index-6srwvd5b.js → index-p4xfz37z.js} +1 -1
  77. package/dist/{index-d2qeem97.js → index-spwxjgay.js} +17 -17
  78. package/dist/{index-4q3vj1yr.js → index-srg522m6.js} +17 -17
  79. package/dist/{keepalive-wsby1btq.js → keepalive-dsd8rtgx.js} +3 -3
  80. package/dist/{lead-paa141j6.js → lead-zyerk1x2.js} +30 -30
  81. package/dist/{maintenance-vnshcyv9.js → maintenance-jqmqwnet.js} +1 -1
  82. package/dist/{oauth-refresh-sweep-d6sqn5np.js → oauth-refresh-sweep-q2c3bnvm.js} +2 -2
  83. package/dist/{onboard-nr4xhpzy.js → onboard-w4yd7s8t.js} +2 -2
  84. package/dist/{opencode-adapter-e56086m1.js → opencode-adapter-9tppvxar.js} +2 -2
  85. package/dist/{otel-impl-ytn9wyv9.js → otel-impl-f36byzbd.js} +1 -1
  86. package/dist/{pricing-refresh-pva04zee.js → pricing-refresh-xvak5p4v.js} +3 -3
  87. package/dist/{rbac-roles-7rc1q3g4.js → rbac-roles-682k2mt5.js} +12 -2
  88. package/dist/rbac-roles-gfn30fb8.js +26 -0
  89. package/dist/{render-v2-pyfsg9zk.js → render-v2-hgytz8nn.js} +3 -3
  90. package/dist/{resume-phj8xhqr.js → resume-2dvq348g.js} +7 -5
  91. package/dist/{session-access-jzx2z9h5.js → session-access-7f21ekq9.js} +4 -4
  92. package/dist/{setup-rfg0f0sg.js → setup-epffxtbk.js} +1 -1
  93. package/dist/{work-objects-44z2yjg8.js → work-objects-xz1a5rqk.js} +20 -20
  94. package/dist/{worker-zsfqzxhm.js → worker-42t8emjt.js} +30 -30
  95. package/openapi.json +3163 -2114
  96. package/package.json +7 -6
  97. package/src/be/approval-config-question.ts +389 -0
  98. package/src/be/automation-preflight.ts +37 -3
  99. package/src/be/db/session-tree.ts +158 -13
  100. package/src/be/db/session-visibility.ts +31 -0
  101. package/src/be/db/skill-search.ts +87 -0
  102. package/src/be/db/tasks/read.ts +47 -7
  103. package/src/be/db/workflow-runs.ts +54 -7
  104. package/src/be/db.ts +27 -5
  105. package/src/be/migrations/233_script_run_session_tokens.sql +8 -0
  106. package/src/be/migrations/235_chat_relay_defer.sql +86 -0
  107. package/src/be/migrations/237_session_inbox_cleanup.sql +75 -0
  108. package/src/be/migrations/239_skills_fts.sql +40 -0
  109. package/src/be/migrations/240_workflow_run_parent_step_attempt.sql +37 -0
  110. package/src/be/migrations/241_skills_meta_fts.sql +39 -0
  111. package/src/be/rbac-roles.ts +138 -0
  112. package/src/be/scripts/run-credential.ts +64 -0
  113. package/src/be/scripts/run-saved.ts +3 -2
  114. package/src/be/swarm-config-guard.ts +23 -0
  115. package/src/be/users.ts +28 -4
  116. package/src/extensions/catalog.generated.json +4 -4
  117. package/src/http/all-routes.ts +1 -0
  118. package/src/http/approval-requests.ts +254 -43
  119. package/src/http/config.ts +22 -37
  120. package/src/http/index.ts +2 -0
  121. package/src/http/schedules.ts +26 -0
  122. package/src/http/scripts.ts +2 -2
  123. package/src/http/sessions.ts +118 -2
  124. package/src/http/user-roles.ts +173 -0
  125. package/src/http/users.ts +9 -0
  126. package/src/http/x.ts +2 -2
  127. package/src/integrations/chat-sdk/commands.ts +14 -1
  128. package/src/integrations/chat-sdk/inbound.ts +42 -6
  129. package/src/integrations/chat-sdk/outbound.ts +35 -10
  130. package/src/integrations/chat-sdk/reactions.ts +107 -0
  131. package/src/integrations/chat-sdk/relay.ts +75 -7
  132. package/src/integrations/chat-sdk/thread-buffer.ts +2 -0
  133. package/src/integrations/reaction-events.ts +20 -0
  134. package/src/providers/amp-adapter.ts +1 -1
  135. package/src/providers/dsh-adapter.ts +1 -1
  136. package/src/rbac/legacy-policy.ts +3 -0
  137. package/src/rbac/permissions.ts +8 -0
  138. package/src/scheduler/schedule-task.ts +44 -3
  139. package/src/scheduler/scheduler.ts +4 -4
  140. package/src/scripts-runtime/loader.ts +8 -1
  141. package/src/slack/ack.ts +2 -1
  142. package/src/slack/reaction-shortcode.ts +4 -7
  143. package/src/tasks/worker-follow-up.ts +30 -0
  144. package/src/tests/approval-config-question.test.ts +702 -0
  145. package/src/tests/approval-requests-notifications.test.ts +189 -0
  146. package/src/tests/chat-sdk-commands.test.ts +12 -0
  147. package/src/tests/chat-sdk-inbound.test.ts +183 -9
  148. package/src/tests/chat-sdk-outbound-files.test.ts +9 -2
  149. package/src/tests/chat-sdk-relay.test.ts +361 -10
  150. package/src/tests/chat-sdk-tools.test.ts +104 -0
  151. package/src/tests/docs-index-footprint.test.js +3 -3
  152. package/src/tests/dsh-adapter.test.ts +1 -1
  153. package/src/tests/entrypoint-gitlab-credential-helper.test.ts +273 -0
  154. package/src/tests/extensions-example-comms-adherence-gate.test.ts +321 -12
  155. package/src/tests/http-users.test.ts +38 -0
  156. package/src/tests/list-endpoint-slimming.test.ts +33 -0
  157. package/src/tests/migration-237-session-inbox-cleanup.test.ts +136 -0
  158. package/src/tests/migration-240-workflow-run-parent-step-attempt.test.ts +55 -0
  159. package/src/tests/rbac-engine.test.ts +2 -0
  160. package/src/tests/rbac-roles.test.ts +10 -0
  161. package/src/tests/schedule-http-triage-tools.test.ts +44 -0
  162. package/src/tests/script-api-credential.test.ts +173 -0
  163. package/src/tests/script-connections.test.ts +10 -0
  164. package/src/tests/script-run-config-scope.test.ts +120 -0
  165. package/src/tests/script-run-token.test.ts +75 -0
  166. package/src/tests/scripts-http.test.ts +19 -0
  167. package/src/tests/sessions-tree.test.ts +410 -1
  168. package/src/tests/skill-search-long-content.test.ts +193 -0
  169. package/src/tests/skill-search.test.ts +173 -22
  170. package/src/tests/user-roles-http.test.ts +204 -0
  171. package/src/tests/workflow-hitl-dynamic-questions.test.ts +1 -1
  172. package/src/tests/workflow-sub-workflow.test.ts +538 -1
  173. package/src/tools/chat-reply.ts +2 -0
  174. package/src/tools/request-human-input.ts +27 -5
  175. package/src/tools/schedules/patch-schedule.ts +18 -0
  176. package/src/tools/schedules/update-schedule.ts +18 -0
  177. package/src/types.ts +23 -0
  178. package/src/workflows/approval-notifications.ts +221 -0
  179. package/src/workflows/checkpoint.ts +69 -35
  180. package/src/workflows/engine.ts +234 -87
  181. package/src/workflows/executors/base.ts +6 -0
  182. package/src/workflows/executors/human-in-the-loop.ts +36 -173
  183. package/src/workflows/executors/sub-workflow.ts +45 -16
  184. package/src/workflows/executors/swarm-script.ts +2 -2
  185. package/src/workflows/recovery.ts +63 -1
  186. package/src/workflows/resume.ts +60 -21
  187. package/src/workflows/retry-poller.ts +25 -4
  188. package/templates/extensions/comms-adherence-gate/README.md +38 -13
  189. package/templates/extensions/comms-adherence-gate/hooks.ts +272 -69
  190. package/templates/extensions/comms-adherence-gate/manifest.json +2 -2
  191. package/templates/schedules/weekly-harness-upgrade-check/content.md +1 -1
  192. package/templates/skills/code-quality/content.md +1 -1
  193. package/templates/skills/turso-interaction/content.md +1 -1
  194. package/templates/skills/workflow-iterate/content.md +8 -1
  195. package/dist/rbac-roles-ff1ffmec.js +0 -12
  196. /package/dist/{cli-stxdrqs2.js → cli-avdvgcay.js} +0 -0
  197. /package/dist/{pi-mono-adapter-tzps8f38.js → pi-mono-adapter-tqsge1ay.js} +0 -0
@@ -349,46 +349,124 @@ class ParseError extends Error {
349
349
  super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
350
350
  }
351
351
  }
352
+ var LF = 10;
353
+ var CR = 13;
354
+ var SPACE = 32;
352
355
  function noop(_arg) {}
353
- function createParser(callbacks) {
354
- if (typeof callbacks == "function")
355
- throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");
356
- const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks;
357
- let incompleteLine = "", isFirstChunk = true, id, data = "", eventType = "";
358
- function feed(newChunk) {
359
- const chunk = isFirstChunk ? newChunk.replace(/^\xEF\xBB\xBF/, "") : newChunk, [complete, incomplete] = splitLines(`${incompleteLine}${chunk}`);
360
- for (const line of complete)
361
- parseLine(line);
362
- incompleteLine = incomplete, isFirstChunk = false;
363
- }
364
- function parseLine(line) {
365
- if (line === "") {
356
+ function createParser(config) {
357
+ if (typeof config == "function")
358
+ throw new TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");
359
+ const { onEvent = noop, onError = noop, onRetry = noop, onComment, maxBufferSize } = config, pendingFragments = [];
360
+ let pendingFragmentsLength = 0, isFirstChunk = true, id, data = "", dataLines = 0, eventType, terminated = false;
361
+ function feed(chunk) {
362
+ if (terminated)
363
+ throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");
364
+ if (isFirstChunk && (isFirstChunk = false, chunk.charCodeAt(0) === 239 && chunk.charCodeAt(1) === 187 && chunk.charCodeAt(2) === 191 && (chunk = chunk.slice(3))), pendingFragments.length === 0) {
365
+ const trailing2 = processLines(chunk);
366
+ trailing2 !== "" && (pendingFragments.push(trailing2), pendingFragmentsLength = trailing2.length), checkBufferSize();
367
+ return;
368
+ }
369
+ if (chunk.indexOf(`
370
+ `) === -1 && chunk.indexOf("\r") === -1) {
371
+ pendingFragments.push(chunk), pendingFragmentsLength += chunk.length, checkBufferSize();
372
+ return;
373
+ }
374
+ pendingFragments.push(chunk);
375
+ const input = pendingFragments.join("");
376
+ pendingFragments.length = 0, pendingFragmentsLength = 0;
377
+ const trailing = processLines(input);
378
+ trailing !== "" && (pendingFragments.push(trailing), pendingFragmentsLength = trailing.length), checkBufferSize();
379
+ }
380
+ function checkBufferSize() {
381
+ maxBufferSize !== undefined && (pendingFragmentsLength + data.length <= maxBufferSize || (terminated = true, pendingFragments.length = 0, pendingFragmentsLength = 0, id = undefined, data = "", dataLines = 0, eventType = undefined, onError(new ParseError(`Buffered data exceeded max buffer size of ${maxBufferSize} characters`, {
382
+ type: "max-buffer-size-exceeded"
383
+ }))));
384
+ }
385
+ function processLines(chunk) {
386
+ let searchIndex = 0;
387
+ if (chunk.indexOf("\r") === -1) {
388
+ let lfIndex = chunk.indexOf(`
389
+ `, searchIndex);
390
+ for (;lfIndex !== -1; ) {
391
+ if (searchIndex === lfIndex) {
392
+ dataLines > 0 && onEvent({ id, event: eventType, data }), id = undefined, data = "", dataLines = 0, eventType = undefined, searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
393
+ `, searchIndex);
394
+ continue;
395
+ }
396
+ const firstCharCode = chunk.charCodeAt(searchIndex);
397
+ if (isDataPrefix(chunk, searchIndex, firstCharCode)) {
398
+ const valueStart = chunk.charCodeAt(searchIndex + 5) === SPACE ? searchIndex + 6 : searchIndex + 5, value = chunk.slice(valueStart, lfIndex);
399
+ if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF) {
400
+ onEvent({ id, event: eventType, data: value }), id = undefined, data = "", eventType = undefined, searchIndex = lfIndex + 2, lfIndex = chunk.indexOf(`
401
+ `, searchIndex);
402
+ continue;
403
+ }
404
+ data = dataLines === 0 ? value : `${data}
405
+ ${value}`, dataLines++;
406
+ } else
407
+ isEventPrefix(chunk, searchIndex, firstCharCode) ? eventType = chunk.slice(chunk.charCodeAt(searchIndex + 6) === SPACE ? searchIndex + 7 : searchIndex + 6, lfIndex) || undefined : parseLine(chunk, searchIndex, lfIndex);
408
+ searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
409
+ `, searchIndex);
410
+ }
411
+ return chunk.slice(searchIndex);
412
+ }
413
+ for (;searchIndex < chunk.length; ) {
414
+ const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
415
+ `, searchIndex);
416
+ let lineEnd = -1;
417
+ if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = crIndex < lfIndex ? crIndex : lfIndex : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1)
418
+ break;
419
+ parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) === CR && chunk.charCodeAt(searchIndex) === LF && searchIndex++;
420
+ }
421
+ return chunk.slice(searchIndex);
422
+ }
423
+ function parseLine(chunk, start, end) {
424
+ if (start === end) {
366
425
  dispatchEvent();
367
426
  return;
368
427
  }
369
- if (line.startsWith(":")) {
370
- onComment && onComment(line.slice(line.startsWith(": ") ? 2 : 1));
428
+ const firstCharCode = chunk.charCodeAt(start);
429
+ if (isDataPrefix(chunk, start, firstCharCode)) {
430
+ const valueStart = chunk.charCodeAt(start + 5) === SPACE ? start + 6 : start + 5, value2 = chunk.slice(valueStart, end);
431
+ data = dataLines === 0 ? value2 : `${data}
432
+ ${value2}`, dataLines++;
433
+ return;
434
+ }
435
+ if (isEventPrefix(chunk, start, firstCharCode)) {
436
+ eventType = chunk.slice(chunk.charCodeAt(start + 6) === SPACE ? start + 7 : start + 6, end) || undefined;
437
+ return;
438
+ }
439
+ if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
440
+ const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE ? start + 4 : start + 3, end);
441
+ value2.includes("\x00") || (id = value2);
442
+ return;
443
+ }
444
+ if (firstCharCode === 58) {
445
+ if (onComment) {
446
+ const line2 = chunk.slice(start, end);
447
+ onComment(line2.slice(chunk.charCodeAt(start + 1) === SPACE ? 2 : 1));
448
+ }
371
449
  return;
372
450
  }
373
- const fieldSeparatorIndex = line.indexOf(":");
374
- if (fieldSeparatorIndex !== -1) {
375
- const field = line.slice(0, fieldSeparatorIndex), offset = line[fieldSeparatorIndex + 1] === " " ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
376
- processField(field, value, line);
451
+ const line = chunk.slice(start, end), fieldSeparatorIndex = line.indexOf(":");
452
+ if (fieldSeparatorIndex === -1) {
453
+ processField(line, "", line);
377
454
  return;
378
455
  }
379
- processField(line, "", line);
456
+ const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
457
+ processField(field, value, line);
380
458
  }
381
459
  function processField(field, value, line) {
382
460
  switch (field) {
383
461
  case "event":
384
- eventType = value;
462
+ eventType = value || undefined;
385
463
  break;
386
464
  case "data":
387
- data = `${data}${value}
388
- `;
465
+ data = dataLines === 0 ? value : `${data}
466
+ ${value}`, dataLines++;
389
467
  break;
390
468
  case "id":
391
- id = value.includes("\x00") ? undefined : value;
469
+ value.includes("\x00") || (id = value);
392
470
  break;
393
471
  case "retry":
394
472
  /^\d+$/.test(value) ? onRetry(parseInt(value, 10)) : onError(new ParseError(`Invalid \`retry\` value: "${value}"`, {
@@ -403,40 +481,31 @@ function createParser(callbacks) {
403
481
  }
404
482
  }
405
483
  function dispatchEvent() {
406
- data.length > 0 && onEvent({
484
+ dataLines > 0 && onEvent({
407
485
  id,
408
- event: eventType || undefined,
409
- data: data.endsWith(`
410
- `) ? data.slice(0, -1) : data
411
- }), id = undefined, data = "", eventType = "";
486
+ event: eventType,
487
+ data
488
+ }), id = undefined, data = "", dataLines = 0, eventType = undefined;
412
489
  }
413
490
  function reset(options = {}) {
414
- incompleteLine && options.consume && parseLine(incompleteLine), isFirstChunk = true, id = undefined, data = "", eventType = "", incompleteLine = "";
491
+ if (options.consume && pendingFragments.length > 0) {
492
+ const incompleteLine = pendingFragments.join("");
493
+ parseLine(incompleteLine, 0, incompleteLine.length);
494
+ }
495
+ isFirstChunk = true, id = undefined, data = "", dataLines = 0, eventType = undefined, pendingFragments.length = 0, pendingFragmentsLength = 0, terminated = false;
415
496
  }
416
497
  return { feed, reset };
417
498
  }
418
- function splitLines(chunk) {
419
- const lines = [];
420
- let incompleteLine = "", searchIndex = 0;
421
- for (;searchIndex < chunk.length; ) {
422
- const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
423
- `, searchIndex);
424
- let lineEnd = -1;
425
- if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = Math.min(crIndex, lfIndex) : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1) {
426
- incompleteLine = chunk.slice(searchIndex);
427
- break;
428
- } else {
429
- const line = chunk.slice(searchIndex, lineEnd);
430
- lines.push(line), searchIndex = lineEnd + 1, chunk[searchIndex - 1] === "\r" && chunk[searchIndex] === `
431
- ` && searchIndex++;
432
- }
433
- }
434
- return [lines, incompleteLine];
499
+ function isDataPrefix(chunk, i, firstCharCode) {
500
+ return firstCharCode === 100 && chunk.charCodeAt(i + 1) === 97 && chunk.charCodeAt(i + 2) === 116 && chunk.charCodeAt(i + 3) === 97 && chunk.charCodeAt(i + 4) === 58;
501
+ }
502
+ function isEventPrefix(chunk, i, firstCharCode) {
503
+ return firstCharCode === 101 && chunk.charCodeAt(i + 1) === 118 && chunk.charCodeAt(i + 2) === 101 && chunk.charCodeAt(i + 3) === 110 && chunk.charCodeAt(i + 4) === 116 && chunk.charCodeAt(i + 5) === 58;
435
504
  }
436
505
 
437
506
  // node_modules/eventsource-parser/dist/stream.js
438
507
  class EventSourceParserStream extends TransformStream {
439
- constructor({ onError, onRetry, onComment } = {}) {
508
+ constructor({ onError, onRetry, onComment, maxBufferSize } = {}) {
440
509
  let parser;
441
510
  super({
442
511
  start(controller) {
@@ -445,10 +514,11 @@ class EventSourceParserStream extends TransformStream {
445
514
  controller.enqueue(event);
446
515
  },
447
516
  onError(error) {
448
- onError === "terminate" ? controller.error(error) : typeof onError == "function" && onError(error);
517
+ typeof onError == "function" && onError(error), (onError === "terminate" || error.type === "max-buffer-size-exceeded") && controller.error(error);
449
518
  },
450
519
  onRetry,
451
- onComment
520
+ onComment,
521
+ maxBufferSize
452
522
  });
453
523
  },
454
524
  transform(chunk) {
@@ -47,10 +47,10 @@ import {
47
47
  checkDependencies2,
48
48
  emitBuiltInIntegrationConnectedOnce2,
49
49
  init_db3
50
- } from "./cli-q9pzwxvk.js";
50
+ } from "./cli-kxawjrxg.js";
51
51
  import {
52
52
  getChannelBlockReason2
53
- } from "./cli-xc65x52q.js";
53
+ } from "./cli-s53vp709.js";
54
54
  import {
55
55
  require_dist5,
56
56
  require_axios,
@@ -67,7 +67,7 @@ import {
67
67
  import {
68
68
  isTerminalTaskStatus,
69
69
  init_types
70
- } from "./cli-rh5smt8t.js";
70
+ } from "./cli-mz9afxxf.js";
71
71
  import {
72
72
  taskAttachmentDisplayUrl,
73
73
  init_task_attachment_links
@@ -6197,6 +6197,11 @@ init_db3();
6197
6197
  // src/slack/ack.ts
6198
6198
  init_db3();
6199
6199
 
6200
+ // src/integrations/reaction-events.ts
6201
+ function terminalReactionEvent(status) {
6202
+ return status === "completed" ? "completed" : "failed";
6203
+ }
6204
+
6200
6205
  // src/otel.ts
6201
6206
  function otelConfigured() {
6202
6207
  return Boolean(process.env.OTEL_EXPORTER_OTLP_ENDPOINT);
@@ -6235,7 +6240,7 @@ async function initOtel(serviceRole = process.env.AGENT_ROLE || "api") {
6235
6240
  return;
6236
6241
  initialized = true;
6237
6242
  try {
6238
- const impl = await import("./otel-impl-ytn9wyv9.js");
6243
+ const impl = await import("./otel-impl-f36byzbd.js");
6239
6244
  await impl.boot(serviceRole, {
6240
6245
  exportConsoleLogs: serviceRole === "api" && isApiLogExportEnabled()
6241
6246
  });
@@ -6392,7 +6397,7 @@ async function finalizeSlackMessageReaction(client, channel, timestamp, outcome,
6392
6397
  await addReaction(client, channel, timestamp, outcome, event);
6393
6398
  }
6394
6399
  function terminalReactionChoice(task) {
6395
- const event = task.status === "completed" ? "completed" : "failed";
6400
+ const event = terminalReactionEvent(task.status);
6396
6401
  return { name: reactionName(event), event };
6397
6402
  }
6398
6403
  async function finalizeSlackSteerReactions(tasks, reactionFor) {
@@ -10080,17 +10085,17 @@ async function initSlackApp2() {
10080
10085
  });
10081
10086
  initialized2 = true;
10082
10087
  app.use(slackInboundOutcomeMiddleware());
10083
- const { registerMessageHandler } = await import("./handlers-rk9dqech.js");
10084
- const { registerCommandHandler } = await import("./commands-mbvhbrcy.js");
10085
- const { registerActionHandlers } = await import("./actions-w8xd014k.js");
10086
- const { registerWorkObjectHandlers } = await import("./work-objects-44z2yjg8.js");
10088
+ const { registerMessageHandler } = await import("./handlers-19xr6dnz.js");
10089
+ const { registerCommandHandler } = await import("./commands-t04rt2pc.js");
10090
+ const { registerActionHandlers } = await import("./actions-wv766ghf.js");
10091
+ const { registerWorkObjectHandlers } = await import("./work-objects-xz1a5rqk.js");
10087
10092
  registerMessageHandler(app);
10088
10093
  registerCommandHandler(app);
10089
10094
  registerActionHandlers(app);
10090
10095
  registerWorkObjectHandlers(app);
10091
- const { createAssistant } = await import("./assistant-hjmqyscx.js");
10096
+ const { createAssistant } = await import("./assistant-3x8bz3eg.js");
10092
10097
  app.assistant(createAssistant());
10093
- const { isBlockExternalEnabled, scanExternalChannelsOnBoot } = await import("./external-channel-y8q5z8z2.js");
10098
+ const { isBlockExternalEnabled, scanExternalChannelsOnBoot } = await import("./external-channel-j1e2p34p.js");
10094
10099
  if (isBlockExternalEnabled()) {
10095
10100
  scanExternalChannelsOnBoot(app.client).catch((error) => {
10096
10101
  console.error("[Slack] External channel boot scan failed:", error);
@@ -10103,7 +10108,7 @@ async function startSlackApp2() {
10103
10108
  await initSlackApp2();
10104
10109
  }
10105
10110
  if (app) {
10106
- const { isSlackRenderV2Enabled } = await import("./render-v2-pyfsg9zk.js");
10111
+ const { isSlackRenderV2Enabled } = await import("./render-v2-hgytz8nn.js");
10107
10112
  if (isSlackRenderV2Enabled())
10108
10113
  await ensureSlackRenderV2Activation2();
10109
10114
  await app.start();
@@ -10126,4 +10131,4 @@ async function stopSlackApp2() {
10126
10131
  initialized2 = false;
10127
10132
  }
10128
10133
 
10129
- export { require_dist4, getSlackConnectionState, noteSlackInboundSideEffect, ignoreSlackInbound, reportSlackInboundFailure, isAdmittedSlackDelivery, getSlackInboundDiagnostics, isPollTracingEnabled, initOtel, withSpan2, startSpan2, withSpanContext2, withRemoteContext2, injectTraceContext2, recordSessionCost2, recordDbRetentionSweep2, recordDbRetentionStatement2, slackTaskOutput, ackSlackMessage, getTaskLink, getTaskUrl, markdownToSlack, buildMrkdwnSectionBlocks, buildCaptionBlock, buildCancelledBlocks, buildBufferFlushBlocks, buildTreeBlocks, taskCitationIssues, stripInvalidTaskCitations, taskCitationSourceGroups, renderTaskCitations, taskCitationWarnings, MAX_TASK_CITATIONS, CitationInputSchema, TaskCitationSchema, upsertTaskCitations, getTaskCitations, getTaskCitationsForTasks, hasTaskCitationCheckRefusal, initialize, ensure, getAgentDisplayName, getAgentEmoji, markSlackSessionProcessing, isSlackRenderV2Enabled2, ensureSlackThreadTree2, processSlackRenderV22, registerTreeMessage, getSlackApp2, initSlackApp2, startSlackApp2, stopSlackApp2 };
10134
+ export { require_dist4, getSlackConnectionState, noteSlackInboundSideEffect, ignoreSlackInbound, reportSlackInboundFailure, isAdmittedSlackDelivery, getSlackInboundDiagnostics, terminalReactionEvent, isPollTracingEnabled, initOtel, withSpan2, startSpan2, withSpanContext2, withRemoteContext2, injectTraceContext2, recordSessionCost2, recordDbRetentionSweep2, recordDbRetentionStatement2, slackTaskOutput, ackSlackMessage, getTaskLink, getTaskUrl, markdownToSlack, buildMrkdwnSectionBlocks, buildCaptionBlock, buildCancelledBlocks, buildBufferFlushBlocks, buildTreeBlocks, taskCitationIssues, stripInvalidTaskCitations, taskCitationSourceGroups, renderTaskCitations, taskCitationWarnings, MAX_TASK_CITATIONS, CitationInputSchema, TaskCitationSchema, upsertTaskCitations, getTaskCitations, getTaskCitationsForTasks, hasTaskCitationCheckRefusal, initialize, ensure, getAgentDisplayName, getAgentEmoji, markSlackSessionProcessing, isSlackRenderV2Enabled2, ensureSlackThreadTree2, processSlackRenderV22, registerTreeMessage, getSlackApp2, initSlackApp2, startSlackApp2, stopSlackApp2 };
@@ -22,7 +22,7 @@ import {
22
22
  getPendingWaitsByEvent2,
23
23
  resolveWaitState2,
24
24
  init_db3
25
- } from "./cli-q9pzwxvk.js";
25
+ } from "./cli-kxawjrxg.js";
26
26
  import {
27
27
  BaseExecutor,
28
28
  postApprovalCancellationUpdates,
@@ -35,6 +35,7 @@ import {
35
35
  findWorkflowReadinessProblems,
36
36
  formatReadinessProblems,
37
37
  startWorkflowExecution2,
38
+ ParentStepNotCurrentError,
38
39
  failRunOnUnreadableReplay,
39
40
  walkGraph,
40
41
  hasRunningStep,
@@ -48,7 +49,7 @@ import {
48
49
  stepFailureMode,
49
50
  getNextTargets,
50
51
  getSuccessors
51
- } from "./cli-pyy4c9ch.js";
52
+ } from "./cli-jjznk3f7.js";
52
53
  import {
53
54
  workflowEventBus2,
54
55
  init_event_bus
@@ -57,7 +58,7 @@ import {
57
58
  RetryPolicySchema,
58
59
  SUPERSEDED_WORKFLOW_TASK_REASON,
59
60
  init_types
60
- } from "./cli-rh5smt8t.js";
61
+ } from "./cli-mz9afxxf.js";
61
62
  import {
62
63
  init_zod
63
64
  } from "./cli-4chz1hye.js";
@@ -98,6 +99,7 @@ function shapeApprovalResolution(registry, definition, nodeId, parkedOutput, app
98
99
  // src/workflows/resume.ts
99
100
  init_db3();
100
101
  init_workflow_runs();
102
+ init_types();
101
103
  init_secret_scrubber();
102
104
  init_event_bus();
103
105
 
@@ -120,7 +122,10 @@ function childRunOutcome(child) {
120
122
  return null;
121
123
  if (child.status !== "completed") {
122
124
  const reason = child.error ? `: ${child.error}` : "";
123
- return { error: `Child workflow run ${child.id} ${child.status}${reason}` };
125
+ return {
126
+ error: `Child workflow run ${child.id} ${child.status}${reason}`,
127
+ retryable: child.status === "failed"
128
+ };
124
129
  }
125
130
  const outputs = {};
126
131
  for (const [key, value] of Object.entries(child.context ?? {})) {
@@ -142,10 +147,11 @@ class SubWorkflowExecutor extends BaseExecutor {
142
147
  }
143
148
  async execute(config, _context, meta) {
144
149
  const { db } = this.deps;
145
- const existingId = await getChildWorkflowRunId(meta.stepId);
150
+ const attempt = (await db.getWorkflowRunStep(meta.stepId))?.retryCount ?? 0;
151
+ const existingId = await getChildWorkflowRunId(meta.stepId, attempt);
146
152
  const existing = existingId ? await db.getWorkflowRun(existingId) : null;
147
153
  if (existing)
148
- return this.settle(existing);
154
+ return this.settle(existing, config.workflowId);
149
155
  const lineage = await getWorkflowRunLineage(meta.runId, MAX_SUB_WORKFLOW_DEPTH);
150
156
  if (lineage.length > MAX_SUB_WORKFLOW_DEPTH) {
151
157
  return {
@@ -165,16 +171,30 @@ class SubWorkflowExecutor extends BaseExecutor {
165
171
  if (!workflow.enabled) {
166
172
  return { status: "failed", error: `Workflow ${config.workflowId} is disabled` };
167
173
  }
168
- const childRunId = await startWorkflowExecution2(workflow, config.inputs ?? {}, this.registry, {
169
- requestedByUserId: meta.requestedByUserId,
170
- parentStepId: meta.stepId
171
- });
174
+ let childRunId;
175
+ try {
176
+ childRunId = await startWorkflowExecution2(workflow, config.inputs ?? {}, this.registry, {
177
+ requestedByUserId: meta.requestedByUserId,
178
+ parentStepId: meta.stepId,
179
+ parentStepAttempt: attempt
180
+ });
181
+ } catch (err) {
182
+ if (err instanceof ParentStepNotCurrentError)
183
+ return { status: "failed", error: err.message };
184
+ throw err;
185
+ }
172
186
  const child = await db.getWorkflowRun(childRunId);
173
187
  if (!child)
174
188
  return { status: "failed", error: `Child workflow run ${childRunId} not found` };
175
- return this.settle(child);
189
+ return this.settle(child, config.workflowId);
176
190
  }
177
- settle(child) {
191
+ settle(child, workflowId) {
192
+ if (child.workflowId !== workflowId) {
193
+ return {
194
+ status: "failed",
195
+ error: `Child workflow run ${child.id} runs workflow ${child.workflowId}, not ${workflowId}`
196
+ };
197
+ }
178
198
  const outcome = childRunOutcome(child);
179
199
  if (!outcome) {
180
200
  return {
@@ -184,8 +204,9 @@ class SubWorkflowExecutor extends BaseExecutor {
184
204
  correlationId: child.id
185
205
  };
186
206
  }
187
- if ("error" in outcome)
188
- return { status: "failed", error: outcome.error };
207
+ if ("error" in outcome) {
208
+ return { status: "failed", error: outcome.error, retryable: outcome.retryable };
209
+ }
189
210
  return { status: "success", output: outcome.output, nextPort: "success" };
190
211
  }
191
212
  }
@@ -1050,11 +1071,6 @@ async function resumeFromChildRun2(parentStepId, registry) {
1050
1071
  const step = await getWorkflowRunStep2(parentStepId);
1051
1072
  if (!step || step.status !== "waiting" || step.nodeType !== "sub-workflow")
1052
1073
  return false;
1053
- const childId = await getChildWorkflowRunId(parentStepId);
1054
- const child = childId ? await getWorkflowRun2(childId) : null;
1055
- const outcome = child ? childRunOutcome(child) : { error: `Child workflow run of step ${parentStepId} was deleted` };
1056
- if (!outcome)
1057
- return false;
1058
1074
  let claimed = false;
1059
1075
  await failClosedOnUnreadableReplay(step.runId, step.id, async () => {
1060
1076
  const run = await getWorkflowRun2(step.runId);
@@ -1064,7 +1080,30 @@ async function resumeFromChildRun2(parentStepId, registry) {
1064
1080
  if (!workflow)
1065
1081
  return;
1066
1082
  const ctx = run.context ?? {};
1067
- const routing = "error" in outcome ? await failStepAndRunIfWaiting(workflow.definition, step.id, run.id, outcome.error, undefined, { ctx, registry }) : await checkpointPortStepAndResolveSuccessors(workflow.definition, run.id, step.id, step.nodeId, outcome.output, "success", ctx, registry);
1083
+ const routing = await getDbClient2().transaction(async () => {
1084
+ const current = await getWorkflowRunStep2(step.id);
1085
+ if (!current || current.status !== "waiting")
1086
+ return null;
1087
+ const childId = await getChildWorkflowRunId(step.id, current.retryCount);
1088
+ const child = childId ? await getWorkflowRun2(childId) : null;
1089
+ const outcome = child ? childRunOutcome(child) : { error: `Child workflow run of step ${parentStepId} was deleted`, retryable: false };
1090
+ if (!outcome)
1091
+ return null;
1092
+ if ("error" in outcome && outcome.retryable) {
1093
+ const policy = childStepRetryPolicy(workflow.definition, step.nodeId);
1094
+ if (policy && current.retryCount < policy.maxRetries) {
1095
+ await checkpointStepFailure(run.id, step.id, outcome.error, current.retryCount, policy);
1096
+ return CHILD_RETRY_SCHEDULED;
1097
+ }
1098
+ }
1099
+ return "error" in outcome ? await failStepAndRunIfWaiting(workflow.definition, step.id, run.id, outcome.error, undefined, { ctx, registry }) : await checkpointPortStepAndResolveSuccessors(workflow.definition, run.id, step.id, step.nodeId, outcome.output, "success", ctx, registry);
1100
+ });
1101
+ if (!routing)
1102
+ return;
1103
+ if (routing === CHILD_RETRY_SCHEDULED) {
1104
+ claimed = true;
1105
+ return;
1106
+ }
1068
1107
  if (!routing.claimed || routing.runFailed) {
1069
1108
  claimed = routing.claimed;
1070
1109
  return;
@@ -1079,6 +1118,18 @@ async function resumeFromChildRun2(parentStepId, registry) {
1079
1118
  });
1080
1119
  return claimed;
1081
1120
  }
1121
+ var CHILD_RETRY_SCHEDULED = {
1122
+ claimed: true,
1123
+ runFailed: false,
1124
+ successors: []
1125
+ };
1126
+ function childStepRetryPolicy(def, nodeId) {
1127
+ const node = def.nodes.find((candidate) => candidate.id === nodeId);
1128
+ if (!node?.retry)
1129
+ return null;
1130
+ const parsed = RetryPolicySchema.safeParse(node.retry);
1131
+ return parsed.success ? parsed.data : null;
1132
+ }
1082
1133
  var FIRED_PAYLOAD_BYTE_CAP = 64 * 1024;
1083
1134
  function capPayload(payload) {
1084
1135
  if (payload === undefined || payload === null)
@@ -5,7 +5,7 @@ import {
5
5
  validateRuntimeTokenTtlHours,
6
6
  init_swarm_config_guard,
7
7
  init_db3
8
- } from "./cli-q9pzwxvk.js";
8
+ } from "./cli-kxawjrxg.js";
9
9
  import {
10
10
  registerVolatileSecret,
11
11
  unregisterVolatileSecret,
@@ -282,7 +282,10 @@ function runtimeTokenTtlMs() {
282
282
  async function mintRuntimeToken(agentId, runtimeId, ttlMs = runtimeTokenTtlMs()) {
283
283
  return await insertSessionToken(agentId, null, runtimeId, ttlMs);
284
284
  }
285
- async function insertSessionToken(agentId, taskId, runtimeId, ttlMs, parentRuntimeId = null, expiresAtCeiling, controllerId = null, parentTokenId = null) {
285
+ async function mintScriptRunToken(agentId, ttlMs) {
286
+ return await insertSessionToken(agentId, null, null, ttlMs, null, undefined, null, null, true);
287
+ }
288
+ async function insertSessionToken(agentId, taskId, runtimeId, ttlMs, parentRuntimeId = null, expiresAtCeiling, controllerId = null, parentTokenId = null, scriptRun = false) {
286
289
  const plaintext = `${SESSION_TOKEN_PREFIX}${base62(randomBytes(24))}`;
287
290
  const tokenId = randomUUID().replace(/-/g, "");
288
291
  const hash = sha256Hex(plaintext);
@@ -290,8 +293,8 @@ async function insertSessionToken(agentId, taskId, runtimeId, ttlMs, parentRunti
290
293
  const now = new Date;
291
294
  const expiresAt = new Date(Math.min(now.getTime() + ttlMs, expiresAtCeiling ? Date.parse(expiresAtCeiling) : Infinity)).toISOString();
292
295
  await getDbClient2().run(`INSERT INTO session_tokens
293
- (id, tokenHash, tokenPreview, agentId, taskId, runtimeId, parentRuntimeId, expiresAt, createdAt, controllerId, parentTokenId)
294
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
296
+ (id, tokenHash, tokenPreview, agentId, taskId, runtimeId, parentRuntimeId, expiresAt, createdAt, controllerId, parentTokenId, scriptRun)
297
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
295
298
  tokenId,
296
299
  hash,
297
300
  preview,
@@ -302,7 +305,8 @@ async function insertSessionToken(agentId, taskId, runtimeId, ttlMs, parentRunti
302
305
  expiresAt,
303
306
  now.toISOString(),
304
307
  controllerId,
305
- parentTokenId
308
+ parentTokenId,
309
+ scriptRun ? 1 : 0
306
310
  ]);
307
311
  return { tokenId, plaintext };
308
312
  }
@@ -426,7 +430,7 @@ async function resolveSessionToken(plaintext, options = {}) {
426
430
  function fingerprintApiKey(rawKey) {
427
431
  return `op:${sha256Hex(rawKey).slice(0, 16)}`;
428
432
  }
429
- var TOKEN_PREFIX = "aswt_", SESSION_TOKEN_PREFIX = "aseph_", InvalidRuntimeTokenError, AGENT_TOKEN_BINDING = "taskId IS NULL AND runtimeId IS NULL AND controllerId IS NULL AND parentRuntimeId IS NULL", AGENT_TOKEN_NO_EXPIRY = "9999-12-31T23:59:59.999Z", AGENT_TOKEN_DEFAULT_TTL_MS = null, AgentTokenExistsError;
433
+ var TOKEN_PREFIX = "aswt_", SESSION_TOKEN_PREFIX = "aseph_", InvalidRuntimeTokenError, AGENT_TOKEN_BINDING = "taskId IS NULL AND runtimeId IS NULL AND controllerId IS NULL AND parentRuntimeId IS NULL AND scriptRun = 0", AGENT_TOKEN_NO_EXPIRY = "9999-12-31T23:59:59.999Z", AGENT_TOKEN_DEFAULT_TTL_MS = null, AgentTokenExistsError;
430
434
  var init_users = __esm(() => {
431
435
  init_telemetry_identity();
432
436
  init_secret_scrubber();
@@ -445,4 +449,4 @@ var init_users = __esm(() => {
445
449
  };
446
450
  });
447
451
 
448
- export { registerSessionTokenConnection, closeSessionTokenConnections, init_session_token_connections, findUserById, findUserByExternalId, findUserByEmail, findUsersByName, getUserIdentities, listUserEvents, listUserTokens, recordIdentityEvent, findOrCreateUserByEmail, linkIdentity, unlinkIdentity, mintToken, revokeToken, resolveUserByToken, InvalidRuntimeTokenError, mintSessionToken, mintRuntimeToken, insertSessionToken, revokeSessionToken, revokeRuntimeTokensForRuntime, AgentTokenExistsError, mintAgentToken, rotateAgentToken, revokeAgentTokens, resolveSessionToken, fingerprintApiKey, init_users };
452
+ export { registerSessionTokenConnection, closeSessionTokenConnections, init_session_token_connections, findUserById, findUserByExternalId, findUserByEmail, findUsersByName, getUserIdentities, listUserEvents, listUserTokens, recordIdentityEvent, findOrCreateUserByEmail, linkIdentity, unlinkIdentity, mintToken, revokeToken, resolveUserByToken, InvalidRuntimeTokenError, mintSessionToken, mintRuntimeToken, mintScriptRunToken, insertSessionToken, revokeSessionToken, revokeRuntimeTokensForRuntime, AgentTokenExistsError, mintAgentToken, rotateAgentToken, revokeAgentTokens, resolveSessionToken, fingerprintApiKey, init_users };
@@ -9,7 +9,7 @@ import {
9
9
  acquireOAuthRefreshLock,
10
10
  releaseOAuthRefreshLock,
11
11
  init_oauth
12
- } from "./cli-q9pzwxvk.js";
12
+ } from "./cli-kxawjrxg.js";
13
13
  import {
14
14
  scrubSecrets,
15
15
  registerVolatileSecret,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runStopHookSessionSummarySubprocess
3
- } from "./cli-ajqhxtnz.js";
3
+ } from "./cli-w1zwctj2.js";
4
4
  import {
5
5
  CONTEXT_FORMULA,
6
6
  getContextWindowSize,
@@ -1236,7 +1236,7 @@ class ClaudeAdapter2 {
1236
1236
  if (transport === "sdk" && isClaudeBridgeEffective(sourceEnv)) {
1237
1237
  throw new Error("CLAUDE_TRANSPORT=sdk cannot run with an effective Claude Bridge configuration. Select CLI transport or disable the bridge.");
1238
1238
  }
1239
- const claudeSdk = transport === "sdk" ? await import("./claude-sdk-session-05kat8rv.js") : undefined;
1239
+ const claudeSdk = transport === "sdk" ? await import("./claude-sdk-session-fkbyk66x.js") : undefined;
1240
1240
  claudeSdk?.validateClaudeSdkAdditionalArgs([
1241
1241
  ...claudeBinaryArgv.slice(1),
1242
1242
  ...config.additionalArgs ?? []
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getDb2,
3
3
  init_db3
4
- } from "./cli-q9pzwxvk.js";
4
+ } from "./cli-kxawjrxg.js";
5
5
  import {
6
6
  openAICompatibleProviderIds,
7
7
  withRegistryCatalogSections,
@@ -2,7 +2,7 @@ import {
2
2
  isGrokOpenRouterModel,
3
3
  grokTargetProfile,
4
4
  ACPAdapter2
5
- } from "./cli-hadv0725.js";
5
+ } from "./cli-8s5wx3nz.js";
6
6
  import {
7
7
  getOpenRouterBaseUrl,
8
8
  getOpenRouterAttributionHeaders,
@@ -10,7 +10,7 @@ import {
10
10
  getMostRecentTaskInThread2,
11
11
  reactionName,
12
12
  init_db3
13
- } from "./cli-q9pzwxvk.js";
13
+ } from "./cli-kxawjrxg.js";
14
14
  import {
15
15
  TaskCreationBlockedError,
16
16
  buildEffectiveText,
@@ -23,7 +23,7 @@ import {
23
23
  extractTaskFromMessage,
24
24
  extractSlackMessageText,
25
25
  dispatchPre2
26
- } from "./cli-kcsd1ez8.js";
26
+ } from "./cli-aecdcr77.js";
27
27
  import {
28
28
  noteSlackInboundSideEffect,
29
29
  ignoreSlackInbound,
@@ -34,14 +34,14 @@ import {
34
34
  isSlackRenderV2Enabled2,
35
35
  ensureSlackThreadTree2,
36
36
  registerTreeMessage
37
- } from "./cli-e9btqw4y.js";
37
+ } from "./cli-ce0ak9ms.js";
38
38
  import {
39
39
  isBlockExternalEnabled2,
40
40
  invalidateChannelExternality2,
41
41
  getChannelBlockReason2,
42
42
  shouldBlockChannel2,
43
43
  leaveExternalChannel2
44
- } from "./cli-xc65x52q.js";
44
+ } from "./cli-s53vp709.js";
45
45
  import {
46
46
  workflowEventBus2,
47
47
  init_event_bus
@@ -50,7 +50,7 @@ import {
50
50
  enrichSlackUserEmail,
51
51
  resolveSlackUserId,
52
52
  rewriteSlackMentions
53
- } from "./cli-sn1vbtg2.js";
53
+ } from "./cli-25j01dpj.js";
54
54
  import {
55
55
  wasEventSeen,
56
56
  requestSlackThreadSteering,
@@ -58,7 +58,7 @@ import {
58
58
  bufferThreadMessage,
59
59
  getBufferMessageCount,
60
60
  instantFlush
61
- } from "./cli-cah5detr.js";
61
+ } from "./cli-qgf8emrn.js";
62
62
  import {
63
63
  resolveTemplate,
64
64
  init_resolver
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  normalizeOrgWebsite,
6
6
  init_org_website
7
- } from "./cli-q9pzwxvk.js";
7
+ } from "./cli-kxawjrxg.js";
8
8
 
9
9
  // src/utils/lead-monitor-channels.ts
10
10
  function isLeadChannelMonitoringEnabled(env = process.env) {