@desplega.ai/agent-swarm 1.156.0 → 1.158.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.
- package/dist/{acp-adapter-c1msptrw.js → acp-adapter-xaq4n6pc.js} +1 -1
- package/dist/{actions-wd41qtdc.js → actions-p9hz5yat.js} +15 -15
- package/dist/{app-tz2qrnah.js → app-g26wdcz6.js} +4 -4
- package/dist/{artifact-td4q4dch.js → artifact-3v5t9jtg.js} +1 -1
- package/dist/{assistant-c3q1zj2t.js → assistant-wydfqkb3.js} +16 -16
- package/dist/{boot-reembed-0be1krkm.js → boot-reembed-g5ckg9yb.js} +6 -6
- package/dist/{boot-reembed-r00j03f3.js → boot-reembed-se8zmdcp.js} +5 -5
- package/dist/{boot-scrub-logs-9j4hd0vw.js → boot-scrub-logs-wfxqan61.js} +3 -3
- package/dist/{seed-pricing-ncgxz1r2.js → boot-seeds-s3q01xj3.js} +10 -10
- package/dist/{claude-adapter-112w28qc.js → claude-adapter-tv2x4f36.js} +7 -7
- package/dist/{claude-managed-adapter-ea2aga6w.js → claude-managed-adapter-41b2s7fd.js} +2 -2
- package/dist/{claude-sdk-session-k7pb5kfz.js → claude-sdk-session-t442qz6f.js} +8 -8
- package/dist/{cli-e781c6f9.js → cli-0xjkj1j7.js} +1 -0
- package/dist/{cli-58rgvkt4.js → cli-1hkrch3k.js} +2 -2
- package/dist/{cli-mx3bzbv8.js → cli-20cj37vt.js} +1968 -44
- package/dist/{cli-h0wdadsx.js → cli-4198qc9v.js} +7 -3
- package/dist/{cli-24w39x6n.js → cli-47m6dkd3.js} +362 -126
- package/dist/{cli-90x9ewbz.js → cli-53sz8gkz.js} +1 -1
- package/dist/{cli-005pze6s.js → cli-5d10vd2m.js} +1 -1
- package/dist/{cli-08n8jxcw.js → cli-65hjmev5.js} +57 -17
- package/dist/{cli-scwq51gn.js → cli-68w09sjw.js} +7 -1
- package/dist/{cli-7j2098n5.js → cli-7gtvvpbh.js} +4 -4
- package/dist/{cli-b05d7szr.js → cli-7s3syk22.js} +18 -11
- package/dist/{cli-9w4ex8vh.js → cli-8qmme6vd.js} +2 -2
- package/dist/{cli-28wkjpdp.js → cli-987hg0aa.js} +2 -2
- package/dist/{cli-7pgcpcrg.js → cli-9httdpyq.js} +1 -1
- package/dist/{cli-jk26c1sz.js → cli-aky8tctm.js} +26 -93
- package/dist/{cli-865swy5p.js → cli-c07r9a2m.js} +3 -2
- package/dist/{cli-nyqza443.js → cli-fgqxwrpv.js} +291 -12
- package/dist/{cli-9pyah9c4.js → cli-ftfvggzx.js} +633 -166
- package/dist/{cli-ytxs7mn1.js → cli-g8djp6qe.js} +17 -0
- package/dist/{cli-avkd6mqv.js → cli-h967nb6r.js} +551 -0
- package/dist/{cli-y8bfxjtw.js → cli-j55n64b6.js} +23 -22
- package/dist/{cli-7vj52450.js → cli-j57qkrpq.js} +86 -28
- package/dist/{cli-tjmghmm5.js → cli-q67y4wzm.js} +6 -3
- package/dist/{cli-n6zq3kbd.js → cli-rj19hc34.js} +1 -1
- package/dist/{cli-tp0d7vzb.js → cli-rjehvrts.js} +4 -4
- package/dist/{cli-s8hpxeg4.js → cli-rqz8qbw7.js} +245 -75
- package/dist/{cli-p37sg0a9.js → cli-s8eet254.js} +1 -1
- package/dist/cli-t1ze64h3.js +811 -0
- package/dist/{cli-hc2fkhdv.js → cli-ws6rqycm.js} +3 -2
- package/dist/{cli-t1cd3mhp.js → cli-wscdvcqz.js} +13 -5
- package/dist/{cli-xa4j64zh.js → cli-x24pshtq.js} +5 -5
- package/dist/{cli-nbp6m6gp.js → cli-xberxa1r.js} +51 -26
- package/dist/{cli-szcyv1mm.js → cli-xhaeg2nc.js} +1 -1
- package/dist/cli.js +30 -16
- package/dist/{codex-adapter-g4tj1f2g.js → codex-adapter-cnm8wk11.js} +5 -5
- package/dist/{codex-session-runner-ad8ha7zt.js → codex-session-runner-gfg547zj.js} +5 -5
- package/dist/{commands-z3gd8ppc.js → commands-e3bn0p75.js} +3 -3
- package/dist/{db-bezm97r9.js → db-03v9kzr2.js} +17 -3
- package/dist/{dispatcher-a97hc33y.js → dispatcher-nrmg8yht.js} +14 -14
- package/dist/{dsh-adapter-1dwg97zv.js → dsh-adapter-k03nfqa6.js} +2 -2
- package/dist/{handlers-wtdy1x02.js → handlers-aqcedbyb.js} +17 -17
- package/dist/{hook-7edgmzng.js → hook-7vkskkre.js} +19 -11
- package/dist/{hook-fvs58a5b.js → hook-ybvmrmhq.js} +4 -4
- package/dist/{http-phnf93hp.js → http-2eqa8t24.js} +432 -195
- package/dist/{index-7x131mmf.js → index-1yks3qcr.js} +14 -14
- package/dist/{index-1fktvwxc.js → index-a3vn96n8.js} +31 -28
- package/dist/{index-yp8rasxk.js → index-c6zsv1bd.js} +5 -5
- package/dist/{index-50jxgw0d.js → index-chgdkq36.js} +14 -14
- package/dist/{index-7jwk7nsm.js → index-x71bvq0p.js} +15 -15
- package/dist/{keepalive-nnz07ebd.js → keepalive-vtkf5n99.js} +5 -5
- package/dist/{lead-mg7qcgww.js → lead-h3sp357x.js} +26 -26
- package/dist/{maintenance-ywmnqrpx.js → maintenance-jzeqtk3q.js} +6 -6
- package/dist/{oauth-refresh-sweep-c63sqfs1.js → oauth-refresh-sweep-qp3dzmdp.js} +4 -4
- package/dist/{onboard-2zj8sqkq.js → onboard-tmsp0qbz.js} +278 -81
- package/dist/{opencode-adapter-z64xjzec.js → opencode-adapter-x6x2da1z.js} +3 -3
- package/dist/{otel-impl-jgdfm26f.js → otel-impl-9mz73q65.js} +416 -301
- package/dist/{pi-mono-adapter-2b7mw16r.js → pi-mono-adapter-m6dvv0dz.js} +2 -2
- package/dist/{pricing-refresh-3whntb69.js → pricing-refresh-v1cbr9te.js} +5 -5
- package/dist/{rbac-roles-3zptcc3p.js → rbac-roles-c9wqz83x.js} +4 -4
- package/dist/{render-v2-dbvpyysc.js → render-v2-gryrh9h8.js} +4 -4
- package/dist/{setup-qwx0j8z9.js → setup-q9720bt6.js} +2 -2
- package/dist/{virtual-modules-8qheft18.js → virtual-modules-3htpgn8x.js} +1 -1
- package/dist/{work-objects-sjbcmvep.js → work-objects-b76x7deb.js} +17 -17
- package/dist/{worker-xezqdkb7.js → worker-6vrxbv41.js} +26 -26
- package/openapi.json +1626 -629
- package/package.json +3 -2
- package/src/apps/catalog.generated.json +229 -0
- package/src/apps/page-validator.ts +71 -16
- package/src/apps/row-store.ts +66 -11
- package/src/apps/sync.ts +59 -17
- package/src/artifact-sdk/browser-sdk.ts +436 -2
- package/src/be/approval-sweeps.ts +109 -0
- package/src/be/boot-seeds.ts +40 -0
- package/src/be/chunking.ts +1 -1
- package/src/be/db/agents.ts +20 -0
- package/src/be/db/approvals.ts +78 -0
- package/src/be/db/tasks/read.ts +197 -39
- package/src/be/db/tasks/write.ts +41 -9
- package/src/be/db-client.ts +107 -48
- package/src/be/db.ts +219 -76
- package/src/be/events.ts +33 -1
- package/src/be/memory/graph-expansion.ts +10 -3
- package/src/be/memory/providers/sqlite-store.ts +55 -13
- package/src/be/memory/raters/retrieval.ts +5 -2
- package/src/be/memory/reranker.ts +26 -2
- package/src/be/memory/types.ts +2 -0
- package/src/be/migrations/166_approval_request_auto_cancellation.sql +9 -0
- package/src/be/migrations/171_memory_retrieval_relevance.sql +8 -0
- package/src/be/migrations/175_workflow_runs_list_index.sql +11 -0
- package/src/be/migrations/177_events_event_agent_created_index.sql +11 -0
- package/src/be/models-catalog.ts +2 -0
- package/src/be/modelsdev-cache.json +1857 -0
- package/src/be/modelsdev-cache.ts +14 -1
- package/src/be/pricing-normalize.ts +2 -0
- package/src/be/scripts/typecheck.ts +1 -0
- package/src/be/seed-pricing.ts +3 -1
- package/src/be/seed-skills/bundled-files.generated.json +1 -1
- package/src/be/steering.ts +53 -3
- package/src/be/swarm-config-guard.ts +3 -0
- package/src/be/task-citations.ts +29 -0
- package/src/cli.tsx +14 -1
- package/src/commands/onboard/compose-generator.ts +8 -3
- package/src/commands/onboard/container-engine.ts +220 -0
- package/src/commands/onboard/manifest.ts +1 -0
- package/src/commands/onboard/steps/health-check.tsx +4 -1
- package/src/commands/onboard/steps/prereq-check.tsx +50 -54
- package/src/commands/onboard/steps/start.tsx +31 -16
- package/src/commands/onboard/types.ts +7 -2
- package/src/commands/onboard.tsx +39 -4
- package/src/commands/profile-sync.ts +79 -26
- package/src/commands/runner.ts +8 -1
- package/src/extensions/catalog.generated.json +17 -0
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/heartbeat/heartbeat.ts +263 -103
- package/src/hooks/hook.ts +21 -12
- package/src/http/agents.ts +35 -0
- package/src/http/approval-requests.ts +136 -64
- package/src/http/apps.ts +14 -3
- package/src/http/config.ts +15 -1
- package/src/http/events.ts +62 -2
- package/src/http/index.ts +6 -4
- package/src/http/memory.ts +21 -7
- package/src/http/schedules.ts +1 -1
- package/src/http/session-data.ts +9 -4
- package/src/http/sessions.ts +25 -18
- package/src/http/stats.ts +19 -7
- package/src/http/status.ts +11 -1
- package/src/http/tasks.ts +40 -8
- package/src/http/webhooks.ts +67 -46
- package/src/http/workflows.ts +15 -20
- package/src/linear/outbound.ts +37 -15
- package/src/otel-impl.ts +151 -1
- package/src/otel.ts +14 -3
- package/src/prompts/memories.ts +19 -2
- package/src/providers/claude-managed-models.ts +8 -0
- package/src/providers/codex-agents-md.ts +140 -17
- package/src/providers/modelsdev-reasoning.json +551 -0
- package/src/rbac/legacy-policy.ts +16 -0
- package/src/rbac/permissions.ts +4 -0
- package/src/scheduler/deferred-task-waits.ts +28 -0
- package/src/scheduler/schedule-task.ts +3 -0
- package/src/scheduler/scheduler.ts +14 -0
- package/src/scripts-runtime/sdk-allowlist.ts +1 -0
- package/src/scripts-runtime/swarm-sdk.ts +9 -0
- package/src/scripts-runtime/types/stdlib.d.ts +1 -0
- package/src/scripts-runtime/types/swarm-extension.d.ts +1 -0
- package/src/scripts-runtime/types/swarm-sdk.d.ts +1 -0
- package/src/server.ts +12 -7
- package/src/slack/app.ts +35 -4
- package/src/slack/connection-state.ts +17 -0
- package/src/tasks/context-key.ts +1 -0
- package/src/tasks/worker-follow-up.ts +6 -2
- package/src/tests/agent-task-activity.test.ts +74 -0
- package/src/tests/agents-list-model-display.test.ts +6 -1
- package/src/tests/approval-auto-cancellation-migration.test.ts +104 -0
- package/src/tests/approval-requests.test.ts +395 -0
- package/src/tests/approval-sweeps-config.test.ts +47 -0
- package/src/tests/approval-sweeps.test.ts +508 -0
- package/src/tests/apps-kibo-blocks.test.ts +77 -0
- package/src/tests/apps-spike.test.ts +56 -1
- package/src/tests/apps-sync-engine.test.ts +20 -9
- package/src/tests/boot-seeds.test.ts +170 -0
- package/src/tests/cancel-approval-request-tool.test.ts +115 -0
- package/src/tests/claude-managed-adapter.test.ts +6 -0
- package/src/tests/codex-adapter.test.ts +126 -1
- package/src/tests/config-key-filter.test.ts +80 -0
- package/src/tests/context-window.test.ts +1 -0
- package/src/tests/db-client-busy-retry.test.ts +96 -0
- package/src/tests/db-client.test.ts +60 -1
- package/src/tests/db-task-read-contract.test.ts +10 -0
- package/src/tests/db-task-write-contract.test.ts +9 -0
- package/src/tests/deferred-schedule-reaper.test.ts +193 -0
- package/src/tests/docs-index-footprint.test.js +3 -3
- package/src/tests/events-http.test.ts +103 -0
- package/src/tests/extensions-catalog.test.ts +22 -17
- package/src/tests/extensions-pre-task.test.ts +107 -0
- package/src/tests/fixtures/kibo-blocks-definition.json.txt +105 -0
- package/src/tests/follow-up-config-inheritance.test.ts +260 -0
- package/src/tests/heartbeat-orphan-resume.test.ts +84 -0
- package/src/tests/heartbeat-reboot-live.test.ts +95 -0
- package/src/tests/heartbeat-stall-cas.test.ts +80 -0
- package/src/tests/heartbeat.test.ts +99 -3
- package/src/tests/hook-mcp-config.test.ts +29 -0
- package/src/tests/http-api-integration.test.ts +16 -2
- package/src/tests/kv-storage.test.ts +62 -0
- package/src/tests/linear-outbound-sync.test.ts +120 -5
- package/src/tests/list-endpoint-slimming.test.ts +91 -0
- package/src/tests/memory-graph-organic-route.test.ts +155 -0
- package/src/tests/memory-http-recall-gating.test.ts +14 -4
- package/src/tests/memory-hybrid.test.ts +161 -1
- package/src/tests/memory-prompt-recall-crowdout.test.ts +297 -0
- package/src/tests/memory.test.ts +22 -0
- package/src/tests/onboard-container-engine.test.ts +240 -0
- package/src/tests/otel-event-loop-and-logs.test.ts +99 -0
- package/src/tests/pricing-routes.test.ts +14 -0
- package/src/tests/profile-sync-warning.test.ts +8 -4
- package/src/tests/promote-draft-task-route.test.ts +19 -0
- package/src/tests/provider-registration.test.ts +296 -42
- package/src/tests/rbac-engine.test.ts +30 -0
- package/src/tests/reasoning-effort.test.ts +8 -0
- package/src/tests/script-connections.test.ts +7 -0
- package/src/tests/sdk-allowlist.test.ts +39 -0
- package/src/tests/session-costs-model-key-normalize.test.ts +1 -0
- package/src/tests/sessions-detail-batch.test.ts +250 -0
- package/src/tests/sessions.test.ts +118 -0
- package/src/tests/slack-config.test.ts +22 -0
- package/src/tests/sonnet-5-5-registry.test.ts +44 -0
- package/src/tests/status.test.ts +36 -1
- package/src/tests/swarm-diff.test.ts +316 -10
- package/src/tests/task-completion-idempotency.test.ts +2 -1
- package/src/tests/tasks-requested-by-filter.test.ts +3 -1
- package/src/tests/tool-annotations.test.ts +1 -1
- package/src/tests/ui-list-slim-projections.test.ts +158 -0
- package/src/tests/webhooks-task-blocked.test.ts +127 -0
- package/src/tests/workflow-approval-recovery.test.ts +203 -0
- package/src/tests/workflow-hitl-routing.test.ts +22 -1
- package/src/tests/workflow-hitl-slack-card.test.ts +52 -0
- package/src/tests/workflow-http-v2.test.ts +99 -8
- package/src/tests/workflow-retry-validation.test.ts +56 -0
- package/src/tests/workflow-tla-races.test.ts +389 -0
- package/src/tests/workflow-validation-port-routing.test.ts +113 -1
- package/src/tools/cancel-approval-request.ts +57 -0
- package/src/tools/memory-search.ts +1 -0
- package/src/tools/request-human-input.ts +4 -2
- package/src/tools/schedules/list-schedules.ts +4 -2
- package/src/tools/send-task.ts +4 -0
- package/src/tools/templates.ts +19 -0
- package/src/tools/tool-config.ts +2 -1
- package/src/tools/workflows/list-workflow-runs.ts +1 -0
- package/src/types.ts +38 -0
- package/src/utils/context-window.ts +1 -0
- package/src/workflows/approval-cancel.ts +152 -0
- package/src/workflows/approval-notifications.ts +84 -0
- package/src/workflows/checkpoint.ts +10 -5
- package/src/workflows/definition.ts +21 -0
- package/src/workflows/engine.ts +152 -21
- package/src/workflows/executors/human-in-the-loop.ts +1 -1
- package/src/workflows/recovery.ts +100 -45
- package/src/workflows/resume.ts +49 -18
- package/src/workflows/retry-poller.ts +71 -21
- package/templates/extensions/README.md +1 -0
- package/templates/extensions/github-sender-allowlist/README.md +18 -0
- package/templates/extensions/github-sender-allowlist/hooks.ts +55 -0
- package/templates/extensions/github-sender-allowlist/manifest.json +8 -0
- package/templates/skills/apps/content.md +20 -1
- package/templates/skills/code-quality/content.md +26 -1
- package/templates/skills/pages/content.md +16 -4
- package/templates/skills/pages/files/examples/multiplayer-board.html +3 -12
- package/templates/skills/scheduling/content.md +1 -1
- package/dist/cli-2daksqps.js +0 -378
- package/dist/rbac-roles-3zw68x72.js +0 -37
|
@@ -18,22 +18,20 @@ import {
|
|
|
18
18
|
getOpenRouterBaseUrl
|
|
19
19
|
} from "./cli-3dpj7atn.js";
|
|
20
20
|
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
import {
|
|
24
|
-
seedPricingFromModelsDev
|
|
25
|
-
} from "./cli-t1cd3mhp.js";
|
|
26
|
-
import {
|
|
27
|
-
ensureRbacSeedsSynced,
|
|
21
|
+
ensurePricingSeeded,
|
|
22
|
+
ensureRbacSeeded,
|
|
28
23
|
getUserGrant
|
|
29
|
-
} from "./cli-
|
|
24
|
+
} from "./cli-aky8tctm.js";
|
|
30
25
|
import {
|
|
31
26
|
can,
|
|
32
27
|
decideAdmission,
|
|
33
28
|
grantLeadEquivalence,
|
|
34
29
|
isRbacEnabled,
|
|
35
30
|
revokeLeadEquivalence
|
|
36
|
-
} from "./cli-
|
|
31
|
+
} from "./cli-g8djp6qe.js";
|
|
32
|
+
import {
|
|
33
|
+
startPricingRefreshLoop
|
|
34
|
+
} from "./cli-ws6rqycm.js";
|
|
37
35
|
import {
|
|
38
36
|
AppDefinitionSchema,
|
|
39
37
|
AppElementsSchema,
|
|
@@ -87,6 +85,7 @@ import {
|
|
|
87
85
|
refreshScriptConnection,
|
|
88
86
|
require_dist as require_dist2,
|
|
89
87
|
resolveSyncRunAs,
|
|
88
|
+
resolveValidationPort,
|
|
90
89
|
restoreScratchScriptLastUsedIfUnchanged,
|
|
91
90
|
runSavedScriptAsAgent,
|
|
92
91
|
runScript,
|
|
@@ -103,7 +102,7 @@ import {
|
|
|
103
102
|
validateDefinition,
|
|
104
103
|
validateScriptImports,
|
|
105
104
|
writeBareImportShim
|
|
106
|
-
} from "./cli-
|
|
105
|
+
} from "./cli-fgqxwrpv.js";
|
|
107
106
|
import {
|
|
108
107
|
detachedProcessGroup,
|
|
109
108
|
registerProcessGroup,
|
|
@@ -114,7 +113,7 @@ import {
|
|
|
114
113
|
} from "./cli-f14fvzag.js";
|
|
115
114
|
import {
|
|
116
115
|
embedScript
|
|
117
|
-
} from "./cli-
|
|
116
|
+
} from "./cli-987hg0aa.js";
|
|
118
117
|
import {
|
|
119
118
|
buildAuthorizationUrl,
|
|
120
119
|
createOAuthApp,
|
|
@@ -129,7 +128,7 @@ import {
|
|
|
129
128
|
listAuthorizationsForApp,
|
|
130
129
|
onAuthorizationRefreshed,
|
|
131
130
|
upsertOAuthApp
|
|
132
|
-
} from "./cli-
|
|
131
|
+
} from "./cli-53sz8gkz.js";
|
|
133
132
|
import {
|
|
134
133
|
AgentFsProvider,
|
|
135
134
|
getFileStorageProvider,
|
|
@@ -146,7 +145,7 @@ import {
|
|
|
146
145
|
isGraphExpansionEnabled,
|
|
147
146
|
rerank,
|
|
148
147
|
rowToCandidate
|
|
149
|
-
} from "./cli-
|
|
148
|
+
} from "./cli-65hjmev5.js";
|
|
150
149
|
import {
|
|
151
150
|
ZodFirstPartyTypeKind,
|
|
152
151
|
objectType
|
|
@@ -176,7 +175,7 @@ import {
|
|
|
176
175
|
taskCitationWarnings,
|
|
177
176
|
upsertTaskCitations,
|
|
178
177
|
withSpan
|
|
179
|
-
} from "./cli-
|
|
178
|
+
} from "./cli-j57qkrpq.js";
|
|
180
179
|
import {
|
|
181
180
|
init_task_attachment_links,
|
|
182
181
|
taskAttachmentDisplayUrl,
|
|
@@ -194,6 +193,7 @@ import {
|
|
|
194
193
|
beginRequestAuthScope,
|
|
195
194
|
buildJiraContextKey,
|
|
196
195
|
buildRoutingAffinityFromAgent,
|
|
196
|
+
cancelApprovalRequestById,
|
|
197
197
|
cancelPendingApprovalRequestsForRun,
|
|
198
198
|
cancelTask,
|
|
199
199
|
checkDependencies,
|
|
@@ -263,6 +263,7 @@ import {
|
|
|
263
263
|
getAllUsers,
|
|
264
264
|
getAppVersion,
|
|
265
265
|
getAppVersions,
|
|
266
|
+
getApprovalRequestById,
|
|
266
267
|
getBudget,
|
|
267
268
|
getChannelById,
|
|
268
269
|
getChannelByName,
|
|
@@ -270,6 +271,7 @@ import {
|
|
|
270
271
|
getCompletedStepNodeIds,
|
|
271
272
|
getContextVersion,
|
|
272
273
|
getContextVersionHistory,
|
|
274
|
+
getCurrentStepForNode,
|
|
273
275
|
getDailySpendForAgent,
|
|
274
276
|
getDailySpendForUser,
|
|
275
277
|
getDailySpendGlobal,
|
|
@@ -372,6 +374,7 @@ import {
|
|
|
372
374
|
isInternalConfigKey,
|
|
373
375
|
isReservedConfigKey,
|
|
374
376
|
isSteeringEnabled,
|
|
377
|
+
kvPrefixUpperBound,
|
|
375
378
|
linearContextKey,
|
|
376
379
|
listCancelledApprovalRequestsForRun,
|
|
377
380
|
listKv,
|
|
@@ -442,7 +445,7 @@ import {
|
|
|
442
445
|
upsertSwarmConfig,
|
|
443
446
|
validateConfigValue,
|
|
444
447
|
workflowContextKey
|
|
445
|
-
} from "./cli-
|
|
448
|
+
} from "./cli-47m6dkd3.js";
|
|
446
449
|
import {
|
|
447
450
|
$OpenAPIRegistry,
|
|
448
451
|
$OpenApiGeneratorV31,
|
|
@@ -482,6 +485,7 @@ import {
|
|
|
482
485
|
SteerModeSchema,
|
|
483
486
|
SteerOutcomeSchema,
|
|
484
487
|
SwarmConfigScopeSchema,
|
|
488
|
+
TERMINAL_TASK_STATUSES,
|
|
485
489
|
TriggerConfigSchema,
|
|
486
490
|
WorkflowDefinitionSchema,
|
|
487
491
|
WorkflowNodePatchSchema,
|
|
@@ -497,7 +501,7 @@ import {
|
|
|
497
501
|
normalizeAssetKey,
|
|
498
502
|
parseAssetKey,
|
|
499
503
|
splitLegacyModelAlias
|
|
500
|
-
} from "./cli-
|
|
504
|
+
} from "./cli-4198qc9v.js";
|
|
501
505
|
import {
|
|
502
506
|
generateDefaultClaudeMd,
|
|
503
507
|
generateDefaultIdentityMd,
|
|
@@ -580,7 +584,7 @@ import {
|
|
|
580
584
|
import {
|
|
581
585
|
init_package,
|
|
582
586
|
package_default
|
|
583
|
-
} from "./cli-
|
|
587
|
+
} from "./cli-c07r9a2m.js";
|
|
584
588
|
import {
|
|
585
589
|
init_secret_scrubber,
|
|
586
590
|
isSensitiveKey,
|
|
@@ -14319,7 +14323,7 @@ async function notifyAutomationPreflightFailure(preflight) {
|
|
|
14319
14323
|
return;
|
|
14320
14324
|
}
|
|
14321
14325
|
try {
|
|
14322
|
-
const { getSlackApp: getSlackApp2 } = await import("./app-
|
|
14326
|
+
const { getSlackApp: getSlackApp2 } = await import("./app-g26wdcz6.js");
|
|
14323
14327
|
const app = getSlackApp2();
|
|
14324
14328
|
if (!app) {
|
|
14325
14329
|
console.warn("[Automation Preflight] Slack not available, cannot send notification");
|
|
@@ -14643,10 +14647,15 @@ async function checkpointStepFailure(runId, stepId, error, retryCount, retryPoli
|
|
|
14643
14647
|
});
|
|
14644
14648
|
const markRunFailed = options?.markRunFailed ?? true;
|
|
14645
14649
|
if (markRunFailed) {
|
|
14646
|
-
await
|
|
14647
|
-
|
|
14648
|
-
|
|
14649
|
-
|
|
14650
|
+
await getDbClient().transaction(async () => {
|
|
14651
|
+
const run = await getWorkflowRun(runId);
|
|
14652
|
+
if (run?.status !== "running" && run?.status !== "waiting")
|
|
14653
|
+
return;
|
|
14654
|
+
await updateWorkflowRun(runId, {
|
|
14655
|
+
status: "failed",
|
|
14656
|
+
error: `Step failed: ${error}`,
|
|
14657
|
+
finishedAt: now
|
|
14658
|
+
});
|
|
14650
14659
|
});
|
|
14651
14660
|
}
|
|
14652
14661
|
return { shouldRetry: false };
|
|
@@ -15170,19 +15179,30 @@ async function startWorkflowExecution(workflow, triggerData, registry, options =
|
|
|
15170
15179
|
return runId;
|
|
15171
15180
|
}
|
|
15172
15181
|
var activeWalks = new Map;
|
|
15182
|
+
var executingSteps = new Set;
|
|
15173
15183
|
function isWorkflowRunActive(runId) {
|
|
15174
15184
|
return activeWalks.has(runId);
|
|
15175
15185
|
}
|
|
15176
|
-
|
|
15186
|
+
function holdWorkflowRun(runId) {
|
|
15177
15187
|
activeWalks.set(runId, (activeWalks.get(runId) ?? 0) + 1);
|
|
15178
|
-
|
|
15179
|
-
|
|
15180
|
-
|
|
15188
|
+
let released = false;
|
|
15189
|
+
return () => {
|
|
15190
|
+
if (released)
|
|
15191
|
+
return;
|
|
15192
|
+
released = true;
|
|
15181
15193
|
const remaining = activeWalks.get(runId) - 1;
|
|
15182
15194
|
if (remaining === 0)
|
|
15183
15195
|
activeWalks.delete(runId);
|
|
15184
15196
|
else
|
|
15185
15197
|
activeWalks.set(runId, remaining);
|
|
15198
|
+
};
|
|
15199
|
+
}
|
|
15200
|
+
async function walkGraph(def, runId, ctx, startNodes, registry, workflowId, secretKeys = new Set, options = {}) {
|
|
15201
|
+
const release = holdWorkflowRun(runId);
|
|
15202
|
+
try {
|
|
15203
|
+
await walkGraphOwned(def, runId, ctx, startNodes, registry, workflowId, secretKeys, options);
|
|
15204
|
+
} finally {
|
|
15205
|
+
release();
|
|
15186
15206
|
}
|
|
15187
15207
|
}
|
|
15188
15208
|
async function walkGraphOwned(def, runId, ctx, startNodes, registry, workflowId, secretKeys = new Set, options = {}) {
|
|
@@ -15215,12 +15235,13 @@ async function walkGraphOwned(def, runId, ctx, startNodes, registry, workflowId,
|
|
|
15215
15235
|
activeEdges.add(`${step.nodeId}→${succ.id}`);
|
|
15216
15236
|
}
|
|
15217
15237
|
}
|
|
15238
|
+
const awaited = awaitedNodeIds(allSteps, activeEdges);
|
|
15218
15239
|
let pendingNodes = startNodes.filter((n) => {
|
|
15219
15240
|
const preds = getAllPredecessors(def, n.id);
|
|
15220
15241
|
if (preds.length === 0) {
|
|
15221
15242
|
return !completedNodeIds.has(n.id);
|
|
15222
15243
|
}
|
|
15223
|
-
const activePreds = preds.filter((predId) => activeEdges.has(`${predId}→${n.id}`));
|
|
15244
|
+
const activePreds = preds.filter((predId) => activeEdges.has(`${predId}→${n.id}`) || awaited.has(predId));
|
|
15224
15245
|
const predsToCheck = activePreds.length > 0 ? activePreds : preds;
|
|
15225
15246
|
return predsToCheck.every((p) => completedNodeIds.has(p));
|
|
15226
15247
|
});
|
|
@@ -15264,11 +15285,24 @@ async function walkGraphOwned(def, runId, ctx, startNodes, registry, workflowId,
|
|
|
15264
15285
|
if (hasWaiting)
|
|
15265
15286
|
return;
|
|
15266
15287
|
const readyNext = [];
|
|
15288
|
+
const batchSteps = nextBatch.size > 0 ? await getWorkflowRunStepsByRunId(runId) : [];
|
|
15289
|
+
const batchAwaited = awaitedNodeIds(batchSteps, activeEdges);
|
|
15290
|
+
const batchLatest = latestStepByNode(batchSteps);
|
|
15267
15291
|
for (const [nodeId, node] of nextBatch) {
|
|
15268
15292
|
if (executedInThisWalk.has(nodeId))
|
|
15269
15293
|
continue;
|
|
15270
15294
|
const allPreds = getAllPredecessors(def, nodeId);
|
|
15271
|
-
const
|
|
15295
|
+
for (const predId of allPreds) {
|
|
15296
|
+
if (completedNodeIds.has(predId))
|
|
15297
|
+
continue;
|
|
15298
|
+
const latest = batchLatest.get(predId);
|
|
15299
|
+
if (latest?.status !== "completed")
|
|
15300
|
+
continue;
|
|
15301
|
+
completedNodeIds.add(predId);
|
|
15302
|
+
if (latest.output !== undefined)
|
|
15303
|
+
ctx[predId] = latest.output;
|
|
15304
|
+
}
|
|
15305
|
+
const activePreds = allPreds.filter((predId) => activeEdges.has(`${predId}→${nodeId}`) || batchAwaited.has(predId));
|
|
15272
15306
|
const allActivePredsCompleted = activePreds.every((p) => completedNodeIds.has(p));
|
|
15273
15307
|
if (allActivePredsCompleted) {
|
|
15274
15308
|
readyNext.push(node);
|
|
@@ -15281,6 +15315,8 @@ async function walkGraphOwned(def, runId, ctx, startNodes, registry, workflowId,
|
|
|
15281
15315
|
if (!run || run.status !== "running")
|
|
15282
15316
|
return;
|
|
15283
15317
|
const finalSteps = await getWorkflowRunStepsByRunId(runId);
|
|
15318
|
+
if (hasRunningStep(finalSteps))
|
|
15319
|
+
return;
|
|
15284
15320
|
const hasWaitingSteps = finalSteps.some((s) => s.status === "waiting");
|
|
15285
15321
|
const hasPendingRetries = finalSteps.some((s) => s.status === "failed" && s.nextRetryAt != null);
|
|
15286
15322
|
const failedSteps = finalSteps.filter((s) => s.status === "failed" && s.nextRetryAt == null);
|
|
@@ -15315,6 +15351,33 @@ async function walkGraphOwned(def, runId, ctx, startNodes, registry, workflowId,
|
|
|
15315
15351
|
}
|
|
15316
15352
|
});
|
|
15317
15353
|
}
|
|
15354
|
+
function latestStepByNode(steps) {
|
|
15355
|
+
const latest = new Map;
|
|
15356
|
+
for (const step of steps)
|
|
15357
|
+
latest.set(step.nodeId, step);
|
|
15358
|
+
return latest;
|
|
15359
|
+
}
|
|
15360
|
+
function awaitedNodeIds(steps, activeEdges) {
|
|
15361
|
+
const latest = latestStepByNode(steps);
|
|
15362
|
+
const awaited = new Set;
|
|
15363
|
+
for (const [nodeId, step] of latest) {
|
|
15364
|
+
if (step.status === "running" || step.status === "waiting")
|
|
15365
|
+
awaited.add(nodeId);
|
|
15366
|
+
}
|
|
15367
|
+
for (const edge of activeEdges) {
|
|
15368
|
+
const target = edge.slice(edge.indexOf("→") + 1);
|
|
15369
|
+
if (!latest.has(target))
|
|
15370
|
+
awaited.add(target);
|
|
15371
|
+
}
|
|
15372
|
+
return awaited;
|
|
15373
|
+
}
|
|
15374
|
+
function hasRunningStep(steps) {
|
|
15375
|
+
for (const step of latestStepByNode(steps).values()) {
|
|
15376
|
+
if (step.status === "running")
|
|
15377
|
+
return true;
|
|
15378
|
+
}
|
|
15379
|
+
return false;
|
|
15380
|
+
}
|
|
15318
15381
|
async function rehydrateCompletedStepOutputs(def, runId, ctx, registry) {
|
|
15319
15382
|
const completedNodeIds = new Set(await getCompletedStepNodeIds(runId));
|
|
15320
15383
|
const latestSteps = new Map;
|
|
@@ -15352,23 +15415,30 @@ function getAllPredecessors(def, nodeId) {
|
|
|
15352
15415
|
return preds;
|
|
15353
15416
|
}
|
|
15354
15417
|
async function executeStep(def, runId, ctx, node, registry, workflowId, secretKeys = new Set, options = {}) {
|
|
15355
|
-
|
|
15418
|
+
let claimedStepId;
|
|
15419
|
+
const claimStep = async () => {
|
|
15356
15420
|
const run = await getWorkflowRun(runId);
|
|
15357
15421
|
if (!run || run.status !== "running" && run.status !== "waiting") {
|
|
15358
15422
|
return { halted: true };
|
|
15359
15423
|
}
|
|
15424
|
+
if (node.type !== "foreach") {
|
|
15425
|
+
const current = await getCurrentStepForNode(runId, node.id, getAllPredecessors(def, node.id));
|
|
15426
|
+
if (current && (current.status !== "running" || executingSteps.has(current.id))) {
|
|
15427
|
+
return { current };
|
|
15428
|
+
}
|
|
15429
|
+
}
|
|
15360
15430
|
const iteration = await getStepCountForNode(runId, node.id);
|
|
15361
15431
|
const idempotencyKey = `${runId}:${node.id}:${iteration}`;
|
|
15362
|
-
const
|
|
15363
|
-
if (
|
|
15364
|
-
return { existingStep
|
|
15432
|
+
const existingStep = await getStepByIdempotencyKey(idempotencyKey);
|
|
15433
|
+
if (existingStep && (existingStep.status === "completed" || existingStep.status === "waiting")) {
|
|
15434
|
+
return { existingStep, stepId: existingStep.id, deduped: true };
|
|
15365
15435
|
}
|
|
15366
15436
|
const latestForeachStep = node.type === "foreach" ? await getLatestStepForNode(runId, node.id) : undefined;
|
|
15367
15437
|
const reusableForeachStep = latestForeachStep && !FOREACH_TERMINAL_STEP_STATUSES.has(latestForeachStep.status) ? latestForeachStep : undefined;
|
|
15368
|
-
const
|
|
15438
|
+
const stepId = reusableForeachStep?.id ?? crypto.randomUUID();
|
|
15369
15439
|
if (!reusableForeachStep) {
|
|
15370
15440
|
await createWorkflowRunStep({
|
|
15371
|
-
id:
|
|
15441
|
+
id: stepId,
|
|
15372
15442
|
runId,
|
|
15373
15443
|
nodeId: node.id,
|
|
15374
15444
|
nodeType: node.type,
|
|
@@ -15376,20 +15446,38 @@ async function executeStep(def, runId, ctx, node, registry, workflowId, secretKe
|
|
|
15376
15446
|
idempotencyKey
|
|
15377
15447
|
});
|
|
15378
15448
|
}
|
|
15379
|
-
|
|
15449
|
+
claimedStepId = stepId;
|
|
15450
|
+
executingSteps.add(stepId);
|
|
15451
|
+
return { existingStep, stepId, deduped: false };
|
|
15452
|
+
};
|
|
15453
|
+
const dedup = await getDbClient().transaction(claimStep).catch((err) => {
|
|
15454
|
+
if (claimedStepId)
|
|
15455
|
+
executingSteps.delete(claimedStepId);
|
|
15456
|
+
throw err;
|
|
15380
15457
|
});
|
|
15381
15458
|
if ("halted" in dedup)
|
|
15382
15459
|
return { outcome: "completed", successors: [] };
|
|
15460
|
+
if ("current" in dedup && dedup.current) {
|
|
15461
|
+
if (dedup.current.status !== "completed")
|
|
15462
|
+
return { outcome: "waiting", successors: [] };
|
|
15463
|
+
ctx[node.id] = dedup.current.output;
|
|
15464
|
+
return { outcome: "completed", successors: [] };
|
|
15465
|
+
}
|
|
15383
15466
|
if (dedup.deduped && dedup.existingStep) {
|
|
15384
15467
|
if (dedup.existingStep.status === "completed") {
|
|
15385
15468
|
ctx[node.id] = dedup.existingStep.output;
|
|
15386
|
-
const
|
|
15387
|
-
return { outcome: "completed", successors
|
|
15469
|
+
const successors = getSuccessors(def, node.id);
|
|
15470
|
+
return { outcome: "completed", successors };
|
|
15388
15471
|
}
|
|
15389
15472
|
return { outcome: "waiting", successors: [] };
|
|
15390
15473
|
}
|
|
15391
|
-
|
|
15392
|
-
|
|
15474
|
+
try {
|
|
15475
|
+
return await runClaimedStep(def, runId, ctx, node, registry, dedup.existingStep, dedup.stepId, workflowId, options);
|
|
15476
|
+
} finally {
|
|
15477
|
+
executingSteps.delete(dedup.stepId);
|
|
15478
|
+
}
|
|
15479
|
+
}
|
|
15480
|
+
async function runClaimedStep(def, runId, ctx, node, registry, existingStep, stepId, workflowId, options = {}) {
|
|
15393
15481
|
const executor = registry.get(node.type);
|
|
15394
15482
|
const interpolationCtx = buildNodeInterpolationCtx(node, ctx);
|
|
15395
15483
|
if (node.inputSchema) {
|
|
@@ -15493,9 +15581,7 @@ async function executeStep(def, runId, ctx, node, registry, workflowId, secretKe
|
|
|
15493
15581
|
return { outcome: "completed", successors: [] };
|
|
15494
15582
|
}
|
|
15495
15583
|
}
|
|
15496
|
-
|
|
15497
|
-
result.nextPort = validationResult.passed ? "pass" : "fail";
|
|
15498
|
-
}
|
|
15584
|
+
result.nextPort = resolveValidationPort(node.next, result.nextPort, validationResult?.passed);
|
|
15499
15585
|
await checkpointStep(runId, stepId, node.id, result, ctx);
|
|
15500
15586
|
const successors = result.nextPort ? getSuccessors(def, node.id, result.nextPort) : getSuccessors(def, node.id);
|
|
15501
15587
|
return { outcome: "completed", successors };
|
|
@@ -15656,6 +15742,8 @@ init_secret_scrubber();
|
|
|
15656
15742
|
|
|
15657
15743
|
// src/workflows/approval-notifications.ts
|
|
15658
15744
|
init_db();
|
|
15745
|
+
init_resolver();
|
|
15746
|
+
init_types();
|
|
15659
15747
|
init_secret_scrubber();
|
|
15660
15748
|
async function postApprovalCancellationUpdates(approvals, reason, client = getSlackApp()?.client) {
|
|
15661
15749
|
if (!client)
|
|
@@ -15689,6 +15777,60 @@ async function postApprovalCancellationUpdates(approvals, reason, client = getSl
|
|
|
15689
15777
|
}
|
|
15690
15778
|
}
|
|
15691
15779
|
}
|
|
15780
|
+
async function createApprovalFollowUpTask(request, templateEventType) {
|
|
15781
|
+
if (request.workflowRunId || !request.sourceTaskId)
|
|
15782
|
+
return false;
|
|
15783
|
+
const sourceTask = await getTaskById(request.sourceTaskId);
|
|
15784
|
+
if (!sourceTask)
|
|
15785
|
+
return false;
|
|
15786
|
+
if (templateEventType === "hitl.timeout" && TERMINAL_TASK_STATUSES.includes(sourceTask.status)) {
|
|
15787
|
+
return false;
|
|
15788
|
+
}
|
|
15789
|
+
const { text: taskText } = templateEventType === "hitl.follow_up" ? resolveTemplate("hitl.follow_up", {
|
|
15790
|
+
request_id: request.id,
|
|
15791
|
+
title: request.title,
|
|
15792
|
+
status: request.status,
|
|
15793
|
+
responses: formatResponses(request.questions, request.responses ?? {})
|
|
15794
|
+
}) : resolveTemplate("hitl.timeout", {
|
|
15795
|
+
request_id: request.id,
|
|
15796
|
+
title: request.title,
|
|
15797
|
+
expires_at: request.expiresAt ?? "",
|
|
15798
|
+
reason: request.resolutionReason ?? ""
|
|
15799
|
+
});
|
|
15800
|
+
await createTaskExtended(taskText, {
|
|
15801
|
+
agentId: sourceTask.agentId,
|
|
15802
|
+
routingReason: sourceTask.agentId ? "continuity" : undefined,
|
|
15803
|
+
routingSource: sourceTask.agentId ? "engine_default" : undefined,
|
|
15804
|
+
parentTaskId: request.sourceTaskId,
|
|
15805
|
+
source: "system",
|
|
15806
|
+
taskType: "hitl-follow-up",
|
|
15807
|
+
tags: ["hitl", "follow-up"],
|
|
15808
|
+
slackChannelId: sourceTask.slackChannelId ?? undefined,
|
|
15809
|
+
slackThreadTs: sourceTask.slackThreadTs ?? undefined,
|
|
15810
|
+
slackUserId: sourceTask.slackUserId ?? undefined
|
|
15811
|
+
});
|
|
15812
|
+
return true;
|
|
15813
|
+
}
|
|
15814
|
+
function formatResponses(questions, responses) {
|
|
15815
|
+
return questions.map((q) => {
|
|
15816
|
+
const answer = responses[q.id];
|
|
15817
|
+
let answerText;
|
|
15818
|
+
if (answer == null) {
|
|
15819
|
+
answerText = "(no answer)";
|
|
15820
|
+
} else if (q.type === "approval") {
|
|
15821
|
+
const a = answer;
|
|
15822
|
+
answerText = a.approved ? "Approved" : "Rejected";
|
|
15823
|
+
if (a.comment)
|
|
15824
|
+
answerText += ` — ${a.comment}`;
|
|
15825
|
+
} else if (typeof answer === "object") {
|
|
15826
|
+
answerText = JSON.stringify(answer);
|
|
15827
|
+
} else {
|
|
15828
|
+
answerText = String(answer);
|
|
15829
|
+
}
|
|
15830
|
+
return `- ${q.label}: ${answerText}`;
|
|
15831
|
+
}).join(`
|
|
15832
|
+
`);
|
|
15833
|
+
}
|
|
15692
15834
|
|
|
15693
15835
|
// src/workflows/resume.ts
|
|
15694
15836
|
init_event_bus();
|
|
@@ -16166,6 +16308,12 @@ async function resumeFromTaskCompletion(event, registry) {
|
|
|
16166
16308
|
async function finalizeOrWait(runId) {
|
|
16167
16309
|
await getDbClient().transaction(async () => {
|
|
16168
16310
|
const steps = await getWorkflowRunStepsByRunId(runId);
|
|
16311
|
+
if (hasRunningStep(steps)) {
|
|
16312
|
+
const run = await getWorkflowRun(runId);
|
|
16313
|
+
if (run?.status === "waiting")
|
|
16314
|
+
await updateWorkflowRun(runId, { status: "running" });
|
|
16315
|
+
return;
|
|
16316
|
+
}
|
|
16169
16317
|
const hasWaiting = steps.some((s) => s.status === "waiting");
|
|
16170
16318
|
if (hasWaiting) {
|
|
16171
16319
|
await updateWorkflowRun(runId, { status: "waiting" });
|
|
@@ -16253,27 +16401,19 @@ async function retryFailedRun(runId, registry) {
|
|
|
16253
16401
|
});
|
|
16254
16402
|
if (!claimed)
|
|
16255
16403
|
throw new Error("Run is not in failed state");
|
|
16256
|
-
const
|
|
16404
|
+
const liveNodeIds = new Set(steps.filter((s) => s.status === "running" || s.status === "waiting").map((s) => s.nodeId));
|
|
16405
|
+
const readyNodes = findReadyNodes(workflow.definition, completedNodeIds, activeEdges).filter((n) => n.id === failedNode.id || !liveNodeIds.has(n.id));
|
|
16257
16406
|
const nodesToRun = !shouldRetryFailedNode || readyNodes.some((n) => n.id === failedNode.id) ? readyNodes : [failedNode, ...readyNodes];
|
|
16258
16407
|
const secretKeys = getSecretInputKeys(workflow.input);
|
|
16259
16408
|
await walkGraph(workflow.definition, runId, ctx, nodesToRun, registry, workflow.id, secretKeys);
|
|
16260
16409
|
}
|
|
16261
|
-
async function
|
|
16262
|
-
const run = await getWorkflowRun(runId);
|
|
16263
|
-
if (!run)
|
|
16264
|
-
throw new Error("Workflow run not found");
|
|
16410
|
+
async function cancelWorkflowRunRows(runId, cancelReason) {
|
|
16265
16411
|
const terminalStatuses = ["completed", "failed", "cancelled", "skipped"];
|
|
16266
|
-
if (terminalStatuses.includes(run.status) && run.status !== "cancelled") {
|
|
16267
|
-
throw new Error(`Cannot cancel run in '${run.status}' state`);
|
|
16268
|
-
}
|
|
16269
16412
|
const now = new Date().toISOString();
|
|
16270
|
-
|
|
16271
|
-
let applied = false;
|
|
16272
|
-
await getDbClient().transaction(async () => {
|
|
16413
|
+
return await getDbClient().transaction(async () => {
|
|
16273
16414
|
const current = await getWorkflowRun(runId);
|
|
16274
16415
|
if (!current || terminalStatuses.includes(current.status))
|
|
16275
|
-
return;
|
|
16276
|
-
applied = true;
|
|
16416
|
+
return false;
|
|
16277
16417
|
const steps = await getWorkflowRunStepsByRunId(runId);
|
|
16278
16418
|
for (const step of steps) {
|
|
16279
16419
|
if (terminalStatuses.includes(step.status))
|
|
@@ -16294,7 +16434,19 @@ async function cancelWorkflowRun(runId, reason) {
|
|
|
16294
16434
|
error: cancelReason,
|
|
16295
16435
|
finishedAt: now
|
|
16296
16436
|
});
|
|
16437
|
+
return true;
|
|
16297
16438
|
});
|
|
16439
|
+
}
|
|
16440
|
+
async function cancelWorkflowRun(runId, reason) {
|
|
16441
|
+
const run = await getWorkflowRun(runId);
|
|
16442
|
+
if (!run)
|
|
16443
|
+
throw new Error("Workflow run not found");
|
|
16444
|
+
const terminalStatuses = ["completed", "failed", "cancelled", "skipped"];
|
|
16445
|
+
if (terminalStatuses.includes(run.status) && run.status !== "cancelled") {
|
|
16446
|
+
throw new Error(`Cannot cancel run in '${run.status}' state`);
|
|
16447
|
+
}
|
|
16448
|
+
const cancelReason = reason ?? "Cancelled by user";
|
|
16449
|
+
const applied = await cancelWorkflowRunRows(runId, cancelReason);
|
|
16298
16450
|
const cancelledApprovals = await listCancelledApprovalRequestsForRun(runId);
|
|
16299
16451
|
const latestRun = await getWorkflowRun(runId);
|
|
16300
16452
|
if (!applied && latestRun?.status !== "cancelled") {
|
|
@@ -16313,6 +16465,10 @@ async function resumeFromApprovalResolution(event, registry) {
|
|
|
16313
16465
|
if (!workflow)
|
|
16314
16466
|
return;
|
|
16315
16467
|
const ctx = run.context ?? {};
|
|
16468
|
+
if (event.status === "cancelled") {
|
|
16469
|
+
console.warn(`[workflows] approval ${event.requestId} is cancelled; step ${event.workflowRunStepId} stays waiting for the run cancel path`);
|
|
16470
|
+
return;
|
|
16471
|
+
}
|
|
16316
16472
|
const nextPort = event.status === "timeout" ? "timeout" : event.status === "rejected" ? "rejected" : "approved";
|
|
16317
16473
|
const stepOutput = {
|
|
16318
16474
|
requestId: event.requestId,
|
|
@@ -16507,15 +16663,13 @@ async function recoverRunningRuns(registry) {
|
|
|
16507
16663
|
const completedNodeIds = new Set(await getCompletedStepNodeIds(runId));
|
|
16508
16664
|
const ctx = run.context ?? {};
|
|
16509
16665
|
const { activeEdges } = await loadCompletedStepRouting(workflow.definition, runId, completedNodeIds);
|
|
16510
|
-
const
|
|
16666
|
+
const retryPending = retryPendingNodeIds(await getWorkflowRunStepsByRunId(runId));
|
|
16667
|
+
const readyNodes = findReadyNodes(workflow.definition, completedNodeIds, activeEdges).filter((node) => !retryPending.has(node.id));
|
|
16511
16668
|
if (isWorkflowRunActive(runId))
|
|
16512
16669
|
continue;
|
|
16513
16670
|
if (readyNodes.length === 0) {
|
|
16514
|
-
await
|
|
16515
|
-
|
|
16516
|
-
context: ctx,
|
|
16517
|
-
finishedAt: new Date().toISOString()
|
|
16518
|
-
});
|
|
16671
|
+
if (!await completeIfSettled(runId, ctx))
|
|
16672
|
+
continue;
|
|
16519
16673
|
} else {
|
|
16520
16674
|
const secretKeys = getSecretInputKeys(workflow.input);
|
|
16521
16675
|
await walkGraph(workflow.definition, runId, ctx, readyNodes, registry, workflow.id, secretKeys);
|
|
@@ -16527,6 +16681,38 @@ async function recoverRunningRuns(registry) {
|
|
|
16527
16681
|
}
|
|
16528
16682
|
return recovered;
|
|
16529
16683
|
}
|
|
16684
|
+
function retryPendingNodeIds(steps) {
|
|
16685
|
+
const nodeIds = new Set;
|
|
16686
|
+
for (const step of steps) {
|
|
16687
|
+
if (step.status === "failed" && step.nextRetryAt != null)
|
|
16688
|
+
nodeIds.add(step.nodeId);
|
|
16689
|
+
}
|
|
16690
|
+
return nodeIds;
|
|
16691
|
+
}
|
|
16692
|
+
async function completeIfSettled(runId, ctx) {
|
|
16693
|
+
return getDbClient().transaction(async () => {
|
|
16694
|
+
const run = await getWorkflowRun(runId);
|
|
16695
|
+
if (run?.status !== "running")
|
|
16696
|
+
return false;
|
|
16697
|
+
const steps = await getWorkflowRunStepsByRunId(runId);
|
|
16698
|
+
if (retryPendingNodeIds(steps).size > 0)
|
|
16699
|
+
return false;
|
|
16700
|
+
const latest = new Map;
|
|
16701
|
+
for (const step of steps)
|
|
16702
|
+
latest.set(step.nodeId, step);
|
|
16703
|
+
for (const step of latest.values()) {
|
|
16704
|
+
if (step.status === "running" || step.status === "waiting" || step.status === "pending") {
|
|
16705
|
+
return false;
|
|
16706
|
+
}
|
|
16707
|
+
}
|
|
16708
|
+
await updateWorkflowRun(runId, {
|
|
16709
|
+
status: "completed",
|
|
16710
|
+
context: ctx,
|
|
16711
|
+
finishedAt: new Date().toISOString()
|
|
16712
|
+
});
|
|
16713
|
+
return true;
|
|
16714
|
+
});
|
|
16715
|
+
}
|
|
16530
16716
|
async function recoverWaitingRuns(registry) {
|
|
16531
16717
|
const stuckRuns = await getStuckWorkflowRuns();
|
|
16532
16718
|
let recovered = 0;
|
|
@@ -16589,24 +16775,28 @@ async function recoverApprovalWaitingRuns(registry) {
|
|
|
16589
16775
|
const workflow = await getWorkflow(stuck.workflowId);
|
|
16590
16776
|
if (!run || !workflow)
|
|
16591
16777
|
continue;
|
|
16592
|
-
let approvalStatus = stuck.approvalStatus;
|
|
16593
|
-
let responses = stuck.approvalResponses ? JSON.parse(stuck.approvalResponses) : null;
|
|
16594
|
-
if (approvalStatus === "pending" && stuck.expiresAt) {
|
|
16595
|
-
await resolveApprovalRequest(stuck.approvalId, {
|
|
16596
|
-
status: "timeout"
|
|
16597
|
-
});
|
|
16598
|
-
approvalStatus = "timeout";
|
|
16599
|
-
responses = null;
|
|
16600
|
-
}
|
|
16601
|
-
const nextPort = approvalStatus === "timeout" ? "timeout" : approvalStatus === "rejected" ? "rejected" : "approved";
|
|
16602
16778
|
const ctx = run.context ?? {};
|
|
16603
|
-
const
|
|
16604
|
-
|
|
16605
|
-
|
|
16606
|
-
|
|
16607
|
-
|
|
16608
|
-
|
|
16609
|
-
|
|
16779
|
+
const routing = await getDbClient().transaction(async () => {
|
|
16780
|
+
if (stuck.approvalStatus === "pending" && stuck.expiresAt) {
|
|
16781
|
+
await resolveApprovalRequest(stuck.approvalId, {
|
|
16782
|
+
status: "timeout",
|
|
16783
|
+
resolutionReason: `Timed out: no answer before ${stuck.expiresAt}`
|
|
16784
|
+
});
|
|
16785
|
+
}
|
|
16786
|
+
const approval = await getApprovalRequestById(stuck.approvalId);
|
|
16787
|
+
const approvalStatus = approval?.status;
|
|
16788
|
+
if (approvalStatus !== "approved" && approvalStatus !== "rejected" && approvalStatus !== "timeout") {
|
|
16789
|
+
return null;
|
|
16790
|
+
}
|
|
16791
|
+
const nextPort = approvalStatus === "timeout" ? "timeout" : approvalStatus === "rejected" ? "rejected" : "approved";
|
|
16792
|
+
const stepOutput = {
|
|
16793
|
+
requestId: stuck.approvalId,
|
|
16794
|
+
status: approvalStatus,
|
|
16795
|
+
responses: approval?.responses ?? null
|
|
16796
|
+
};
|
|
16797
|
+
return await checkpointPortStepAndResolveSuccessors(workflow.definition, stuck.runId, stuck.stepId, stuck.nodeId, stepOutput, nextPort, ctx);
|
|
16798
|
+
});
|
|
16799
|
+
if (!routing?.claimed)
|
|
16610
16800
|
continue;
|
|
16611
16801
|
if (routing.successors.length > 0) {
|
|
16612
16802
|
const secretKeys = getSecretInputKeys(workflow.input);
|
|
@@ -16665,6 +16855,7 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
16665
16855
|
try {
|
|
16666
16856
|
const retryableSteps = await getRetryableSteps();
|
|
16667
16857
|
for (const step of retryableSteps) {
|
|
16858
|
+
let release;
|
|
16668
16859
|
try {
|
|
16669
16860
|
const run = await getWorkflowRun(step.runId);
|
|
16670
16861
|
if (!run)
|
|
@@ -16676,17 +16867,9 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
16676
16867
|
if (!node)
|
|
16677
16868
|
continue;
|
|
16678
16869
|
console.log(`[workflows] Retrying step ${step.nodeId} (attempt ${step.retryCount}) for run ${step.runId}`);
|
|
16679
|
-
|
|
16680
|
-
|
|
16681
|
-
|
|
16682
|
-
error: undefined
|
|
16683
|
-
});
|
|
16684
|
-
}
|
|
16685
|
-
await updateWorkflowRunStep(step.id, {
|
|
16686
|
-
status: "running",
|
|
16687
|
-
error: undefined,
|
|
16688
|
-
nextRetryAt: undefined
|
|
16689
|
-
});
|
|
16870
|
+
release = holdWorkflowRun(run.id);
|
|
16871
|
+
if (!await claimRetry(run.id, step.id))
|
|
16872
|
+
continue;
|
|
16690
16873
|
const ctx = run.context ?? {};
|
|
16691
16874
|
if (!("run" in ctx))
|
|
16692
16875
|
ctx.run = { id: run.id };
|
|
@@ -16722,6 +16905,7 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
16722
16905
|
if (!waiting)
|
|
16723
16906
|
continue;
|
|
16724
16907
|
} else {
|
|
16908
|
+
let validationPassed;
|
|
16725
16909
|
if (node.validation) {
|
|
16726
16910
|
const validationResult = await runStepValidation(registry, node, result.output, ctx, meta);
|
|
16727
16911
|
if (validationResult.outcome === "halt") {
|
|
@@ -16738,18 +16922,16 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
16738
16922
|
await checkpointStepFailure(run.id, step.id, "Validation failed, retrying", step.retryCount, retryPolicy);
|
|
16739
16923
|
continue;
|
|
16740
16924
|
}
|
|
16925
|
+
validationPassed = validationResult.passed;
|
|
16741
16926
|
}
|
|
16927
|
+
result.nextPort = resolveValidationPort(node.next, result.nextPort, validationPassed);
|
|
16742
16928
|
await checkpointStep(run.id, step.id, step.nodeId, result, ctx);
|
|
16743
16929
|
const port = result.nextPort || "default";
|
|
16744
16930
|
const successors = getSuccessors(workflow.definition, step.nodeId, port);
|
|
16745
16931
|
if (successors.length > 0) {
|
|
16746
16932
|
await walkGraph(workflow.definition, run.id, ctx, successors, registry, workflow.id);
|
|
16747
16933
|
} else {
|
|
16748
|
-
await
|
|
16749
|
-
status: "completed",
|
|
16750
|
-
context: ctx,
|
|
16751
|
-
finishedAt: new Date().toISOString()
|
|
16752
|
-
});
|
|
16934
|
+
await completeRunIfSettled(run.id, ctx);
|
|
16753
16935
|
}
|
|
16754
16936
|
}
|
|
16755
16937
|
} catch (err) {
|
|
@@ -16759,6 +16941,8 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
16759
16941
|
}
|
|
16760
16942
|
} catch (err) {
|
|
16761
16943
|
console.error(`[workflows] Retry failed for step ${step.id}:`, err);
|
|
16944
|
+
} finally {
|
|
16945
|
+
release?.();
|
|
16762
16946
|
}
|
|
16763
16947
|
}
|
|
16764
16948
|
} catch (err) {
|
|
@@ -16768,6 +16952,40 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
16768
16952
|
}
|
|
16769
16953
|
pollerTimeout = setTimeout(poll, intervalMs);
|
|
16770
16954
|
}
|
|
16955
|
+
async function claimRetry(runId, stepId) {
|
|
16956
|
+
return getDbClient().transaction(async () => {
|
|
16957
|
+
const run = await getWorkflowRun(runId);
|
|
16958
|
+
if (!run || !RETRYABLE_RUN_STATUSES.has(run.status))
|
|
16959
|
+
return false;
|
|
16960
|
+
const claimed = await getDbClient().get(`UPDATE workflow_run_steps
|
|
16961
|
+
SET status = 'running', nextRetryAt = NULL
|
|
16962
|
+
WHERE id = ? AND runId = ? AND status = 'failed' AND nextRetryAt IS NOT NULL
|
|
16963
|
+
RETURNING id`, [stepId, runId]);
|
|
16964
|
+
if (!claimed)
|
|
16965
|
+
return false;
|
|
16966
|
+
if (run.status === "failed") {
|
|
16967
|
+
await updateWorkflowRun(runId, { status: "running", error: undefined });
|
|
16968
|
+
}
|
|
16969
|
+
return true;
|
|
16970
|
+
});
|
|
16971
|
+
}
|
|
16972
|
+
async function completeRunIfSettled(runId, ctx) {
|
|
16973
|
+
await getDbClient().transaction(async () => {
|
|
16974
|
+
const run = await getWorkflowRun(runId);
|
|
16975
|
+
if (!run || run.status !== "running" && run.status !== "waiting")
|
|
16976
|
+
return;
|
|
16977
|
+
const steps = await getWorkflowRunStepsByRunId(runId);
|
|
16978
|
+
const live = steps.some((s) => s.status === "running" || s.status === "waiting" || s.status === "failed" && s.nextRetryAt != null);
|
|
16979
|
+
if (live)
|
|
16980
|
+
return;
|
|
16981
|
+
await updateWorkflowRun(runId, {
|
|
16982
|
+
status: "completed",
|
|
16983
|
+
context: ctx,
|
|
16984
|
+
finishedAt: new Date().toISOString()
|
|
16985
|
+
});
|
|
16986
|
+
});
|
|
16987
|
+
}
|
|
16988
|
+
var RETRYABLE_RUN_STATUSES = new Set(["running", "waiting", "failed"]);
|
|
16771
16989
|
function stopRetryPoller() {
|
|
16772
16990
|
if (pollerTimeout !== null) {
|
|
16773
16991
|
clearTimeout(pollerTimeout);
|
|
@@ -17394,7 +17612,8 @@ async function prepareStandaloneScheduleTask(schedule, extraTags = []) {
|
|
|
17394
17612
|
source: "schedule",
|
|
17395
17613
|
requestedByUserId: schedule.createdBy,
|
|
17396
17614
|
contextKey: scheduleContextKey({ scheduleId: schedule.id }),
|
|
17397
|
-
parentTaskId: schedule.parentTaskId
|
|
17615
|
+
parentTaskId: schedule.parentTaskId,
|
|
17616
|
+
inheritParentFollowUpConfig: schedule.taskType === "deferred" && !!schedule.parentTaskId
|
|
17398
17617
|
}, { origin: "schedule" });
|
|
17399
17618
|
}
|
|
17400
17619
|
async function createStandaloneScheduleTask(schedule, extraTags = [], prepared) {
|
|
@@ -17549,6 +17768,18 @@ async function reconcileDeferredTaskWaits(taskId) {
|
|
|
17549
17768
|
}
|
|
17550
17769
|
}
|
|
17551
17770
|
}
|
|
17771
|
+
var SPENT_DEFERRED_SCHEDULE_RETENTION_MS = 30 * 24 * 60 * 60 * 1000;
|
|
17772
|
+
async function reapSpentDeferredSchedules(now = new Date) {
|
|
17773
|
+
const cutoff = new Date(now.getTime() - SPENT_DEFERRED_SCHEDULE_RETENTION_MS).toISOString();
|
|
17774
|
+
const result = await getDbClient().run(`DELETE FROM scheduled_tasks
|
|
17775
|
+
WHERE taskType = 'deferred' AND scheduleType = 'one_time' AND enabled = 0
|
|
17776
|
+
AND lastRunAt IS NOT NULL AND lastRunAt < ?
|
|
17777
|
+
AND NOT EXISTS (
|
|
17778
|
+
SELECT 1 FROM deferred_task_waits w
|
|
17779
|
+
WHERE w.scheduleId = scheduled_tasks.id AND w.status = 'pending'
|
|
17780
|
+
)`, [cutoff]);
|
|
17781
|
+
return result.changes;
|
|
17782
|
+
}
|
|
17552
17783
|
function onTaskEvent(payload) {
|
|
17553
17784
|
if (!payload || typeof payload !== "object" || !("taskId" in payload) || typeof payload.taskId !== "string")
|
|
17554
17785
|
return;
|
|
@@ -17577,6 +17808,8 @@ function stopDeferredTaskWaits() {
|
|
|
17577
17808
|
var schedulerInterval = null;
|
|
17578
17809
|
var schedulerRun = null;
|
|
17579
17810
|
var isProcessing = false;
|
|
17811
|
+
var lastDeferredReapAt = 0;
|
|
17812
|
+
var DEFERRED_REAP_INTERVAL_MS = 60 * 60 * 1000;
|
|
17580
17813
|
var executorRegistry = null;
|
|
17581
17814
|
function resolveExecutorRegistry() {
|
|
17582
17815
|
if (executorRegistry)
|
|
@@ -17889,6 +18122,16 @@ async function processSchedules() {
|
|
|
17889
18122
|
console.error(`[Scheduler] Error executing "${schedule.name}":`, err);
|
|
17890
18123
|
}
|
|
17891
18124
|
}
|
|
18125
|
+
if (Date.now() - lastDeferredReapAt >= DEFERRED_REAP_INTERVAL_MS) {
|
|
18126
|
+
lastDeferredReapAt = Date.now();
|
|
18127
|
+
try {
|
|
18128
|
+
const reaped = await reapSpentDeferredSchedules();
|
|
18129
|
+
if (reaped)
|
|
18130
|
+
console.log(`[Scheduler] Reaped ${reaped} spent deferral schedule(s)`);
|
|
18131
|
+
} catch (err) {
|
|
18132
|
+
console.error("[Scheduler] Deferral schedule reap failed:", err);
|
|
18133
|
+
}
|
|
18134
|
+
}
|
|
17892
18135
|
} finally {
|
|
17893
18136
|
isProcessing = false;
|
|
17894
18137
|
}
|
|
@@ -27749,7 +27992,7 @@ async function notifySlack(text) {
|
|
|
27749
27992
|
return;
|
|
27750
27993
|
}
|
|
27751
27994
|
try {
|
|
27752
|
-
const { getSlackApp: getSlackApp2 } = await import("./app-
|
|
27995
|
+
const { getSlackApp: getSlackApp2 } = await import("./app-g26wdcz6.js");
|
|
27753
27996
|
const app = getSlackApp2();
|
|
27754
27997
|
if (!app) {
|
|
27755
27998
|
console.warn("[Jira webhook keepalive] Slack not available, cannot send notification");
|
|
@@ -27820,7 +28063,7 @@ async function deleteJiraWebhook(webhookId) {
|
|
|
27820
28063
|
console.log(`[Jira webhook keepalive] Deleted webhook id=${webhookId}`);
|
|
27821
28064
|
}
|
|
27822
28065
|
async function overwriteWebhookIds(next) {
|
|
27823
|
-
const { getDbClient: getDbClient2 } = await import("./db-
|
|
28066
|
+
const { getDbClient: getDbClient2 } = await import("./db-03v9kzr2.js");
|
|
27824
28067
|
await getDbClient2().transaction(async (tx) => {
|
|
27825
28068
|
const row = await tx.get("SELECT metadata FROM oauth_apps WHERE provider = 'jira'");
|
|
27826
28069
|
if (!row) {
|
|
@@ -100299,6 +100542,19 @@ async function handleTaskProgress(data) {
|
|
|
100299
100542
|
console.error(`[Linear Outbound] Failed to post progress action for task ${taskId}:`, err);
|
|
100300
100543
|
});
|
|
100301
100544
|
}
|
|
100545
|
+
var LINEAR_BODY_MAX = 30000;
|
|
100546
|
+
function formatLinearOutcomeBody(text, taskId) {
|
|
100547
|
+
if (text.length <= LINEAR_BODY_MAX)
|
|
100548
|
+
return text;
|
|
100549
|
+
const dashboardUrl = (process.env.SWARM_DASHBOARD_URL || process.env.APP_URL)?.replace(/\/+$/, "");
|
|
100550
|
+
const where = dashboardUrl ? `${dashboardUrl}/tasks/${taskId}` : `swarm task \`${taskId}\``;
|
|
100551
|
+
const note = (shown2) => `
|
|
100552
|
+
|
|
100553
|
+
---
|
|
100554
|
+
_Truncated: showing ${shown2} of ${text.length} characters. Full text: ${where}_`;
|
|
100555
|
+
const shown = LINEAR_BODY_MAX - note(LINEAR_BODY_MAX).length;
|
|
100556
|
+
return `${text.slice(0, shown).trimEnd()}${note(shown)}`;
|
|
100557
|
+
}
|
|
100302
100558
|
async function handleTaskCompleted2(data) {
|
|
100303
100559
|
const { taskId, output } = data;
|
|
100304
100560
|
if (!taskId)
|
|
@@ -100309,11 +100565,7 @@ async function handleTaskCompleted2(data) {
|
|
|
100309
100565
|
if (shouldSkipForLoopPrevention2(sync))
|
|
100310
100566
|
return;
|
|
100311
100567
|
const sessionId = taskSessionMap.get(taskId);
|
|
100312
|
-
const body = output ?
|
|
100313
|
-
|
|
100314
|
-
+++ Output
|
|
100315
|
-
${output.slice(0, 2000)}
|
|
100316
|
-
+++` : "Task completed.";
|
|
100568
|
+
const body = output?.trim() ? formatLinearOutcomeBody(output, taskId) : "Task completed.";
|
|
100317
100569
|
if (sessionId) {
|
|
100318
100570
|
endAgentSession(sessionId, body, "response").catch((err) => {
|
|
100319
100571
|
console.error(`[Linear Outbound] Failed to end AgentSession for task ${taskId}:`, err);
|
|
@@ -100329,12 +100581,7 @@ ${output.slice(0, 2000)}
|
|
|
100329
100581
|
console.log("[Linear Outbound] No Linear client available, skipping sync for", taskId);
|
|
100330
100582
|
return;
|
|
100331
100583
|
}
|
|
100332
|
-
|
|
100333
|
-
|
|
100334
|
-
+++ Output
|
|
100335
|
-
${output.slice(0, 2000)}
|
|
100336
|
-
+++` : "Task completed by swarm agent.";
|
|
100337
|
-
await client.createComment({ issueId: sync.externalId, body: comment });
|
|
100584
|
+
await client.createComment({ issueId: sync.externalId, body });
|
|
100338
100585
|
console.log(`[Linear Outbound] Posted completion comment for task ${taskId}`);
|
|
100339
100586
|
} catch (error) {
|
|
100340
100587
|
console.error(`[Linear Outbound] Failed to sync task completion for ${taskId}:`, error instanceof Error ? error.message : error);
|
|
@@ -100355,11 +100602,9 @@ async function handleTaskFailed2(data) {
|
|
|
100355
100602
|
if (shouldSkipForLoopPrevention2(sync))
|
|
100356
100603
|
return;
|
|
100357
100604
|
const sessionId = taskSessionMap.get(taskId);
|
|
100358
|
-
const body = failureReason ? `Task failed.
|
|
100605
|
+
const body = failureReason?.trim() ? formatLinearOutcomeBody(`Task failed.
|
|
100359
100606
|
|
|
100360
|
-
|
|
100361
|
-
${failureReason.slice(0, 2000)}
|
|
100362
|
-
+++` : "Task failed.";
|
|
100607
|
+
${failureReason}`, taskId) : "Task failed.";
|
|
100363
100608
|
if (sessionId) {
|
|
100364
100609
|
endAgentSession(sessionId, body, "error").catch((err) => {
|
|
100365
100610
|
console.error(`[Linear Outbound] Failed to end AgentSession for task ${taskId}:`, err);
|
|
@@ -100375,12 +100620,7 @@ ${failureReason.slice(0, 2000)}
|
|
|
100375
100620
|
console.log("[Linear Outbound] No Linear client available, skipping sync for", taskId);
|
|
100376
100621
|
return;
|
|
100377
100622
|
}
|
|
100378
|
-
|
|
100379
|
-
|
|
100380
|
-
+++ Error Details
|
|
100381
|
-
${failureReason.slice(0, 2000)}
|
|
100382
|
-
+++` : "Task failed.";
|
|
100383
|
-
await client.createComment({ issueId: sync.externalId, body: comment });
|
|
100623
|
+
await client.createComment({ issueId: sync.externalId, body });
|
|
100384
100624
|
console.log(`[Linear Outbound] Posted failure comment for task ${taskId}`);
|
|
100385
100625
|
} catch (error) {
|
|
100386
100626
|
console.error(`[Linear Outbound] Failed to sync task failure for ${taskId}:`, error instanceof Error ? error.message : error);
|
|
@@ -101555,7 +101795,7 @@ async function reloadGlobalConfigsAndIntegrations() {
|
|
|
101555
101795
|
return runWithoutRequestAuth(() => reloadGlobalConfigsAndIntegrationsInner());
|
|
101556
101796
|
}
|
|
101557
101797
|
async function reloadGlobalConfigsAndIntegrationsInner() {
|
|
101558
|
-
const { getEmbeddingProvider: getEmbeddingProvider2, resetEmbeddingProvider } = await import("./index-
|
|
101798
|
+
const { getEmbeddingProvider: getEmbeddingProvider2, resetEmbeddingProvider } = await import("./index-c6zsv1bd.js");
|
|
101559
101799
|
const wasEmbeddingsConfigured = getEmbeddingProvider2().isConfigured();
|
|
101560
101800
|
const updated = await loadGlobalConfigsIntoEnv(true);
|
|
101561
101801
|
await stopSlackApp();
|
|
@@ -101568,10 +101808,10 @@ async function reloadGlobalConfigsAndIntegrationsInner() {
|
|
|
101568
101808
|
integrations.push("embeddings");
|
|
101569
101809
|
}
|
|
101570
101810
|
if (!wasEmbeddingsConfigured && isEmbeddingsConfigured) {
|
|
101571
|
-
import("./boot-reembed-
|
|
101811
|
+
import("./boot-reembed-se8zmdcp.js").then(({ runBootReembed }) => runBootReembed()).catch((err) => {
|
|
101572
101812
|
console.error("[config-reload] memory backfill failed (non-fatal):", err);
|
|
101573
101813
|
});
|
|
101574
|
-
import("./boot-reembed-
|
|
101814
|
+
import("./boot-reembed-g5ckg9yb.js").then(({ runBootReembedScripts }) => runBootReembedScripts()).catch((err) => {
|
|
101575
101815
|
console.error("[config-reload] script backfill failed (non-fatal):", err);
|
|
101576
101816
|
});
|
|
101577
101817
|
}
|
|
@@ -102384,7 +102624,7 @@ function setPreloadedTools(server, names) {
|
|
|
102384
102624
|
async function applyPreToolCall(name, args, requestInfo, inputSchema) {
|
|
102385
102625
|
if (requestInfo.callOrigin !== "mcp")
|
|
102386
102626
|
return { args };
|
|
102387
|
-
const dispatcher = await import("./dispatcher-
|
|
102627
|
+
const dispatcher = await import("./dispatcher-nrmg8yht.js");
|
|
102388
102628
|
const result = await dispatcher.dispatchPre("pre.tool.call", { tool: name, args, requestInfo }, inputSchema ? {
|
|
102389
102629
|
validateModify: async (data) => {
|
|
102390
102630
|
const schema = normalizeObjectSchema(inputSchema) ?? inputSchema;
|
|
@@ -102607,6 +102847,7 @@ init_secret_scrubber();
|
|
|
102607
102847
|
|
|
102608
102848
|
// src/apps/row-store.ts
|
|
102609
102849
|
init_db();
|
|
102850
|
+
init_db_client();
|
|
102610
102851
|
class AppRowValidationError extends Error {
|
|
102611
102852
|
issues;
|
|
102612
102853
|
constructor(issues) {
|
|
@@ -102624,6 +102865,9 @@ class AppRowAppNotFoundError extends Error {
|
|
|
102624
102865
|
}
|
|
102625
102866
|
var mutationChains = new Map;
|
|
102626
102867
|
var lastCreatedAtMs = 0;
|
|
102868
|
+
function yieldToEventLoop() {
|
|
102869
|
+
return new Promise((resolve) => setImmediate(resolve));
|
|
102870
|
+
}
|
|
102627
102871
|
function appsNamespace(appId2) {
|
|
102628
102872
|
return `apps:${appId2}`;
|
|
102629
102873
|
}
|
|
@@ -102816,11 +103060,12 @@ async function getAppRow(appId2, model, rowId) {
|
|
|
102816
103060
|
}
|
|
102817
103061
|
return entry.value;
|
|
102818
103062
|
}
|
|
102819
|
-
async function listAppRows(appId2, model) {
|
|
103063
|
+
async function listAppRows(appId2, model, equals = []) {
|
|
102820
103064
|
const entries = await listKv(appsNamespace(appId2), {
|
|
102821
103065
|
prefix: `${model}/row/`,
|
|
102822
103066
|
limit: 1e5,
|
|
102823
|
-
offset: 0
|
|
103067
|
+
offset: 0,
|
|
103068
|
+
jsonFieldEquals: equals.filter((filter) => !/["\\]/.test(filter.column)).map((filter) => ({ field: filter.column, value: filter.value }))
|
|
102824
103069
|
});
|
|
102825
103070
|
return entries.map((entry) => entry.value).filter((value) => typeof value === "object" && value !== null && !Array.isArray(value));
|
|
102826
103071
|
}
|
|
@@ -102829,18 +103074,32 @@ async function listAllAppRowsForMigrationUnlocked(appId2, model) {
|
|
|
102829
103074
|
const rows = [];
|
|
102830
103075
|
const namespace2 = appsNamespace(appId2);
|
|
102831
103076
|
const prefix = `${model}/row/`;
|
|
102832
|
-
|
|
103077
|
+
const upper = kvPrefixUpperBound(prefix);
|
|
103078
|
+
let afterKey = "";
|
|
102833
103079
|
while (true) {
|
|
102834
|
-
const
|
|
102835
|
-
|
|
102836
|
-
|
|
103080
|
+
const page = await getDbClient().query(`SELECT key, value, value_type FROM kv_entries
|
|
103081
|
+
WHERE namespace = ? AND key >= ? AND key < ? AND key > ?
|
|
103082
|
+
AND (expires_at IS NULL OR expires_at > ?)
|
|
103083
|
+
ORDER BY key
|
|
103084
|
+
LIMIT ?`, [namespace2, prefix, upper, afterKey, Date.now(), MIGRATION_KV_BATCH_SIZE]);
|
|
103085
|
+
for (const entry of page) {
|
|
103086
|
+
if (entry.value_type !== "json")
|
|
103087
|
+
continue;
|
|
103088
|
+
let value;
|
|
103089
|
+
try {
|
|
103090
|
+
value = JSON.parse(entry.value);
|
|
103091
|
+
} catch {
|
|
103092
|
+
continue;
|
|
103093
|
+
}
|
|
102837
103094
|
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
102838
103095
|
rows.push(value);
|
|
102839
103096
|
}
|
|
102840
103097
|
}
|
|
102841
|
-
if (
|
|
103098
|
+
if (page.length < MIGRATION_KV_BATCH_SIZE)
|
|
102842
103099
|
return rows;
|
|
102843
|
-
|
|
103100
|
+
afterKey = page[page.length - 1].key;
|
|
103101
|
+
if (!isInTransaction())
|
|
103102
|
+
await yieldToEventLoop();
|
|
102844
103103
|
}
|
|
102845
103104
|
}
|
|
102846
103105
|
function patchAppRow(appId2, model, _definition, rowId, values, options = {}) {
|
|
@@ -102938,14 +103197,16 @@ function deleteAppRow(appId2, model, _definition, rowId) {
|
|
|
102938
103197
|
return true;
|
|
102939
103198
|
});
|
|
102940
103199
|
}
|
|
103200
|
+
var PURGE_BATCH_SIZE = 1000;
|
|
102941
103201
|
async function purgeNamespace(appId2) {
|
|
102942
103202
|
const namespace2 = appsNamespace(appId2);
|
|
102943
103203
|
while (true) {
|
|
102944
|
-
const
|
|
102945
|
-
|
|
103204
|
+
const result = await getDbClient().run(`DELETE FROM kv_entries
|
|
103205
|
+
WHERE namespace = ?
|
|
103206
|
+
AND key IN (SELECT key FROM kv_entries WHERE namespace = ? ORDER BY key LIMIT ?)`, [namespace2, namespace2, PURGE_BATCH_SIZE]);
|
|
103207
|
+
if (result.changes === 0)
|
|
102946
103208
|
return;
|
|
102947
|
-
|
|
102948
|
-
await deleteKv(namespace2, entry.key);
|
|
103209
|
+
await yieldToEventLoop();
|
|
102949
103210
|
}
|
|
102950
103211
|
}
|
|
102951
103212
|
function purgeAppRows(appId2, models, afterPurge) {
|
|
@@ -103294,6 +103555,30 @@ function pairFingerprint(model, sourceName, source) {
|
|
|
103294
103555
|
}));
|
|
103295
103556
|
return JSON.stringify({ source, bindings });
|
|
103296
103557
|
}
|
|
103558
|
+
var RECONCILE_CHUNK_SIZE = 200;
|
|
103559
|
+
async function writeInChunks(items, counts, write) {
|
|
103560
|
+
for (let start = 0;start < items.length; start += RECONCILE_CHUNK_SIZE) {
|
|
103561
|
+
const chunk = items.slice(start, start + RECONCILE_CHUNK_SIZE);
|
|
103562
|
+
const tally = await getDbClient().transaction(async () => {
|
|
103563
|
+
const chunkTally = {
|
|
103564
|
+
created: 0,
|
|
103565
|
+
updated: 0,
|
|
103566
|
+
refreshed: 0,
|
|
103567
|
+
unchanged: 0,
|
|
103568
|
+
markedStale: 0
|
|
103569
|
+
};
|
|
103570
|
+
for (const item of chunk)
|
|
103571
|
+
await write(item, chunkTally);
|
|
103572
|
+
return chunkTally;
|
|
103573
|
+
});
|
|
103574
|
+
counts.created += tally.created;
|
|
103575
|
+
counts.updated += tally.updated;
|
|
103576
|
+
counts.refreshed += tally.refreshed;
|
|
103577
|
+
counts.unchanged += tally.unchanged;
|
|
103578
|
+
counts.markedStale += tally.markedStale;
|
|
103579
|
+
await yieldToEventLoop();
|
|
103580
|
+
}
|
|
103581
|
+
}
|
|
103297
103582
|
function reconcile(args) {
|
|
103298
103583
|
const { appId: appId2, model, sourceName, joinKey, pull, warnings, counts } = args;
|
|
103299
103584
|
return withMutationLock(appId2, model, async () => {
|
|
@@ -103320,7 +103605,7 @@ function reconcile(args) {
|
|
|
103320
103605
|
const now = new Date().toISOString();
|
|
103321
103606
|
const actor = `sync:${sourceName}`;
|
|
103322
103607
|
const seen = new Set;
|
|
103323
|
-
|
|
103608
|
+
await writeInChunks(pull.records, counts, async (record3, tally) => {
|
|
103324
103609
|
if (seen.has(record3.key)) {
|
|
103325
103610
|
warn(warnings, `source returned duplicate key "${record3.key}"; the last record wins`);
|
|
103326
103611
|
}
|
|
@@ -103335,8 +103620,8 @@ function reconcile(args) {
|
|
|
103335
103620
|
actor
|
|
103336
103621
|
});
|
|
103337
103622
|
mine.set(record3.key, created);
|
|
103338
|
-
|
|
103339
|
-
|
|
103623
|
+
tally.created += 1;
|
|
103624
|
+
return;
|
|
103340
103625
|
}
|
|
103341
103626
|
const differs = Object.entries(values).some(([name, value]) => !sameValue(existing[name], value));
|
|
103342
103627
|
const updated = await patchAppRowUnlocked(appId2, model, modelDef, existing.id, values, {
|
|
@@ -103347,14 +103632,14 @@ function reconcile(args) {
|
|
|
103347
103632
|
});
|
|
103348
103633
|
if (!updated) {
|
|
103349
103634
|
warn(warnings, `row "${existing.id}" vanished before it could be updated`);
|
|
103350
|
-
|
|
103635
|
+
return;
|
|
103351
103636
|
}
|
|
103352
103637
|
mine.set(record3.key, updated);
|
|
103353
103638
|
if (differs)
|
|
103354
|
-
|
|
103639
|
+
tally.updated += 1;
|
|
103355
103640
|
else
|
|
103356
|
-
|
|
103357
|
-
}
|
|
103641
|
+
tally.refreshed += 1;
|
|
103642
|
+
});
|
|
103358
103643
|
const unseen = [...mine.entries()].filter(([key]) => !seen.has(key)).map(([, row]) => row).concat(unkeyed);
|
|
103359
103644
|
if (!pull.complete) {
|
|
103360
103645
|
counts.staleSweepSkipped = true;
|
|
@@ -103362,10 +103647,10 @@ function reconcile(args) {
|
|
|
103362
103647
|
warn(warnings, "pull reported an incomplete window; stale sweep skipped");
|
|
103363
103648
|
return;
|
|
103364
103649
|
}
|
|
103365
|
-
|
|
103650
|
+
await writeInChunks(unseen, counts, async (row, tally) => {
|
|
103366
103651
|
if (row.stale === true) {
|
|
103367
|
-
|
|
103368
|
-
|
|
103652
|
+
tally.unchanged += 1;
|
|
103653
|
+
return;
|
|
103369
103654
|
}
|
|
103370
103655
|
await patchAppRowUnlocked(appId2, model, modelDef, row.id, {}, {
|
|
103371
103656
|
allowSourceManaged: true,
|
|
@@ -103376,8 +103661,8 @@ function reconcile(args) {
|
|
|
103376
103661
|
stale: true
|
|
103377
103662
|
}
|
|
103378
103663
|
});
|
|
103379
|
-
|
|
103380
|
-
}
|
|
103664
|
+
tally.markedStale += 1;
|
|
103665
|
+
});
|
|
103381
103666
|
});
|
|
103382
103667
|
}
|
|
103383
103668
|
var inFlight = new Map;
|
|
@@ -105537,7 +105822,7 @@ async function handleApps(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
105537
105822
|
json(res, { error: "invalid row query", issues }, 400);
|
|
105538
105823
|
return true;
|
|
105539
105824
|
}
|
|
105540
|
-
const rows = (await listAppRows(parsed.params.id, parsed.params.model)).filter((row) => filters.every((filter) => rowValue(row, filter.column) === filter.value));
|
|
105825
|
+
const rows = (await listAppRows(parsed.params.id, parsed.params.model, filters.flatMap((filter) => typeof filter.value === "string" || typeof filter.value === "number" || typeof filter.value === "boolean" ? [{ column: filter.column, value: filter.value }] : []))).filter((row) => filters.every((filter) => rowValue(row, filter.column) === filter.value));
|
|
105541
105826
|
const sortRaw = parsed.query.sort;
|
|
105542
105827
|
if (sortRaw) {
|
|
105543
105828
|
const [column, dir, extra] = sortRaw.split(":");
|
|
@@ -106693,6 +106978,148 @@ var registerAppUpsertTool = (server) => {
|
|
|
106693
106978
|
});
|
|
106694
106979
|
};
|
|
106695
106980
|
|
|
106981
|
+
// src/tools/cancel-approval-request.ts
|
|
106982
|
+
init_zod();
|
|
106983
|
+
init_db();
|
|
106984
|
+
|
|
106985
|
+
// src/workflows/approval-cancel.ts
|
|
106986
|
+
init_db();
|
|
106987
|
+
var LIVE_RUN_STATUSES = new Set(["running", "waiting"]);
|
|
106988
|
+
async function cancelApprovalRequest(input) {
|
|
106989
|
+
const finalReason = input.reason ?? "Cancelled through the API";
|
|
106990
|
+
let authorized = false;
|
|
106991
|
+
for (let attempt = 0;attempt < 3; attempt++) {
|
|
106992
|
+
const existing = await getApprovalRequestById(input.id);
|
|
106993
|
+
if (!existing)
|
|
106994
|
+
return { ok: false, status: 404, message: "Approval request not found" };
|
|
106995
|
+
if (existing.status === "cancelled") {
|
|
106996
|
+
return { ok: true, request: existing, alreadyCancelled: true, runCancelled: false };
|
|
106997
|
+
}
|
|
106998
|
+
if (existing.status !== "pending") {
|
|
106999
|
+
return {
|
|
107000
|
+
ok: false,
|
|
107001
|
+
status: 409,
|
|
107002
|
+
message: `Approval request already resolved with status: ${existing.status}`
|
|
107003
|
+
};
|
|
107004
|
+
}
|
|
107005
|
+
if (!authorized) {
|
|
107006
|
+
const ownerAgentId = existing.sourceTaskId ? (await getTaskById(existing.sourceTaskId))?.agentId ?? null : null;
|
|
107007
|
+
const decision = can({
|
|
107008
|
+
principal: input.principal,
|
|
107009
|
+
verb: "approval.cancel.any",
|
|
107010
|
+
resource: { kind: "owned", ownerAgentId },
|
|
107011
|
+
source: input.source ?? "http"
|
|
107012
|
+
});
|
|
107013
|
+
if (!decision.allow)
|
|
107014
|
+
return { ok: false, status: 403, message: decision.reason };
|
|
107015
|
+
authorized = true;
|
|
107016
|
+
}
|
|
107017
|
+
const result = await cancelApprovalRequestAndRun(input.id, {
|
|
107018
|
+
reason: finalReason,
|
|
107019
|
+
resolvedBy: input.resolvedBy
|
|
107020
|
+
});
|
|
107021
|
+
if (!result)
|
|
107022
|
+
continue;
|
|
107023
|
+
if ("timedOut" in result) {
|
|
107024
|
+
return {
|
|
107025
|
+
ok: false,
|
|
107026
|
+
status: 409,
|
|
107027
|
+
message: `Approval request expired at ${result.timedOut.expiresAt}`
|
|
107028
|
+
};
|
|
107029
|
+
}
|
|
107030
|
+
return {
|
|
107031
|
+
ok: true,
|
|
107032
|
+
request: result.request,
|
|
107033
|
+
alreadyCancelled: false,
|
|
107034
|
+
runCancelled: result.runCancelled
|
|
107035
|
+
};
|
|
107036
|
+
}
|
|
107037
|
+
return { ok: false, status: 409, message: "Approval request changed during cancellation" };
|
|
107038
|
+
}
|
|
107039
|
+
async function cancelApprovalRequestAndRun(id, data) {
|
|
107040
|
+
const client = getDbClient();
|
|
107041
|
+
return await client.transaction(async () => {
|
|
107042
|
+
const current = await getApprovalRequestById(id);
|
|
107043
|
+
if (current?.status === "pending" && current.expiresAt && new Date(current.expiresAt) < new Date) {
|
|
107044
|
+
const timedOut = await resolveApprovalRequest(id, {
|
|
107045
|
+
status: "timeout",
|
|
107046
|
+
resolutionReason: `Timed out: the cancellation arrived after the deadline ${current.expiresAt}`
|
|
107047
|
+
});
|
|
107048
|
+
if (!timedOut)
|
|
107049
|
+
return null;
|
|
107050
|
+
await createApprovalFollowUpTask(timedOut, "hitl.timeout");
|
|
107051
|
+
return { timedOut };
|
|
107052
|
+
}
|
|
107053
|
+
const request = await cancelApprovalRequestById(id, {
|
|
107054
|
+
reason: data.reason,
|
|
107055
|
+
resolvedBy: data.resolvedBy
|
|
107056
|
+
});
|
|
107057
|
+
if (!request)
|
|
107058
|
+
return null;
|
|
107059
|
+
let runCancelled = false;
|
|
107060
|
+
const runId = request.workflowRunId;
|
|
107061
|
+
if (runId) {
|
|
107062
|
+
const run = await getWorkflowRun(runId);
|
|
107063
|
+
if (run && LIVE_RUN_STATUSES.has(run.status)) {
|
|
107064
|
+
runCancelled = await cancelWorkflowRunRows(runId, data.reason);
|
|
107065
|
+
}
|
|
107066
|
+
}
|
|
107067
|
+
const slackReason = data.slackReason ?? data.reason;
|
|
107068
|
+
client.afterCommit(async () => {
|
|
107069
|
+
await postApprovalCancellationUpdates([request], slackReason);
|
|
107070
|
+
if (runCancelled && runId) {
|
|
107071
|
+
const others = (await listCancelledApprovalRequestsForRun(runId)).filter((row) => row.id !== request.id);
|
|
107072
|
+
await postApprovalCancellationUpdates(others, data.reason);
|
|
107073
|
+
}
|
|
107074
|
+
});
|
|
107075
|
+
return { request, runCancelled };
|
|
107076
|
+
});
|
|
107077
|
+
}
|
|
107078
|
+
|
|
107079
|
+
// src/tools/cancel-approval-request.ts
|
|
107080
|
+
var cancelApprovalRequestInputSchema = object({
|
|
107081
|
+
requestId: uuid().describe("The ID of the approval request to cancel."),
|
|
107082
|
+
reason: string().max(500).optional().describe("Reason for cancellation.")
|
|
107083
|
+
});
|
|
107084
|
+
var cancelApprovalRequestOutputSchema = swarmToolOutputSchema({
|
|
107085
|
+
yourAgentId: string().optional(),
|
|
107086
|
+
approvalRequest: looseObject({}).optional(),
|
|
107087
|
+
alreadyCancelled: boolean().optional(),
|
|
107088
|
+
runCancelled: boolean().optional()
|
|
107089
|
+
});
|
|
107090
|
+
var registerCancelApprovalRequestTool = (server) => {
|
|
107091
|
+
createToolRegistrar(server)("cancel-approval-request", {
|
|
107092
|
+
title: "Cancel approval request",
|
|
107093
|
+
description: "Cancel a pending approval request by id. Allowed for a lead agent, or for the agent that owns the request's source task. If the request gates a running or waiting workflow run, that run is cancelled too. A request whose explicit timeout passed is already 'timeout' and cannot be cancelled.",
|
|
107094
|
+
annotations: { destructiveHint: true },
|
|
107095
|
+
inputSchema: cancelApprovalRequestInputSchema,
|
|
107096
|
+
outputSchema: cancelApprovalRequestOutputSchema
|
|
107097
|
+
}, async ({ requestId, reason }, info) => {
|
|
107098
|
+
if (!info.agentId) {
|
|
107099
|
+
return toolErr('Agent ID not found. Set the "X-Agent-ID" header.');
|
|
107100
|
+
}
|
|
107101
|
+
const agent = await getAgentById(info.agentId);
|
|
107102
|
+
const result = await cancelApprovalRequest({
|
|
107103
|
+
id: requestId,
|
|
107104
|
+
reason,
|
|
107105
|
+
principal: { kind: "agent", agentId: info.agentId, isLead: agent?.isLead ?? false },
|
|
107106
|
+
resolvedBy: info.agentId,
|
|
107107
|
+
source: "mcp"
|
|
107108
|
+
});
|
|
107109
|
+
if (!result.ok) {
|
|
107110
|
+
return toolErr(result.message, { data: { yourAgentId: info.agentId } });
|
|
107111
|
+
}
|
|
107112
|
+
const data = {
|
|
107113
|
+
yourAgentId: info.agentId,
|
|
107114
|
+
approvalRequest: result.request,
|
|
107115
|
+
alreadyCancelled: result.alreadyCancelled,
|
|
107116
|
+
runCancelled: result.runCancelled
|
|
107117
|
+
};
|
|
107118
|
+
const message = result.alreadyCancelled ? `Approval request "${requestId}" was already cancelled.` : `Approval request "${requestId}" cancelled${result.runCancelled ? ", and its workflow run with it" : ""}.`;
|
|
107119
|
+
return toolOk(message, { data, details: JSON.stringify(data, null, 2) });
|
|
107120
|
+
});
|
|
107121
|
+
};
|
|
107122
|
+
|
|
106696
107123
|
// src/tools/cancel-task.ts
|
|
106697
107124
|
init_zod();
|
|
106698
107125
|
init_db();
|
|
@@ -108436,8 +108863,8 @@ async function recordRetrievals(taskId, agentId, results, sessionId, extras) {
|
|
|
108436
108863
|
if (!taskId || results.length === 0)
|
|
108437
108864
|
return;
|
|
108438
108865
|
const insertSql = `INSERT INTO memory_retrieval
|
|
108439
|
-
(id, taskId, agentId, sessionId, memoryId, similarity, retrievedAt, contextKey, intent, eventType, retrievalId, rank, retrievalSource)
|
|
108440
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`;
|
|
108866
|
+
(id, taskId, agentId, sessionId, memoryId, similarity, retrievedAt, contextKey, intent, eventType, retrievalId, rank, retrievalSource, relevance)
|
|
108867
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`;
|
|
108441
108868
|
const now = new Date().toISOString();
|
|
108442
108869
|
const retrievalId = crypto.randomUUID();
|
|
108443
108870
|
const contextKey = extras?.contextKey ?? null;
|
|
@@ -108458,7 +108885,8 @@ async function recordRetrievals(taskId, agentId, results, sessionId, extras) {
|
|
|
108458
108885
|
eventType,
|
|
108459
108886
|
retrievalId,
|
|
108460
108887
|
rank,
|
|
108461
|
-
r.retrievalSource ?? null
|
|
108888
|
+
r.retrievalSource ?? null,
|
|
108889
|
+
r.relevance ?? null
|
|
108462
108890
|
]);
|
|
108463
108891
|
}
|
|
108464
108892
|
});
|
|
@@ -109025,6 +109453,7 @@ async function createResumeFollowUp(args) {
|
|
|
109025
109453
|
tags,
|
|
109026
109454
|
priority,
|
|
109027
109455
|
parentTaskId: parent.id,
|
|
109456
|
+
inheritParentFollowUpConfig: true,
|
|
109028
109457
|
routingAffinity
|
|
109029
109458
|
});
|
|
109030
109459
|
if (authorizationDecision) {
|
|
@@ -112455,6 +112884,7 @@ async function expandCandidatesWithGraph(candidates, agentId, options = {}) {
|
|
|
112455
112884
|
neighbors.set(row.id, {
|
|
112456
112885
|
...rowToCandidate(row, similarity),
|
|
112457
112886
|
retrievalSource: "graph",
|
|
112887
|
+
graphParentId: parent.id,
|
|
112458
112888
|
recencyDecayApplied: false
|
|
112459
112889
|
});
|
|
112460
112890
|
}
|
|
@@ -112468,7 +112898,9 @@ async function expandCandidatesWithGraph(candidates, agentId, options = {}) {
|
|
|
112468
112898
|
for (const neighbor of ranked) {
|
|
112469
112899
|
const existingIndex = indexById.get(neighbor.id);
|
|
112470
112900
|
if (existingIndex !== undefined) {
|
|
112471
|
-
|
|
112901
|
+
const parent = parentById.get(neighbor.graphParentId);
|
|
112902
|
+
const graphScore = Math.min(computeScore(neighbor, now), computeScore(parent, now));
|
|
112903
|
+
if (graphScore > computeScore(result[existingIndex], now)) {
|
|
112472
112904
|
result[existingIndex] = neighbor;
|
|
112473
112905
|
}
|
|
112474
112906
|
continue;
|
|
@@ -112556,6 +112988,7 @@ var registerMemorySearchTool = (server) => {
|
|
|
112556
112988
|
await recordRetrievals(requestInfo.sourceTaskId, requestInfo.agentId, ranked.map((r) => ({
|
|
112557
112989
|
memoryId: r.id,
|
|
112558
112990
|
similarity: r.similarity,
|
|
112991
|
+
relevance: r.rawSimilarity,
|
|
112559
112992
|
retrievalSource: r.retrievalSource
|
|
112560
112993
|
})), requestInfo.sessionId, { intent, contextKey: requestInfo.contextKey, eventType: "search" });
|
|
112561
112994
|
} catch (err) {
|
|
@@ -112745,9 +113178,9 @@ function hardSplit(text) {
|
|
|
112745
113178
|
while (start < text.length) {
|
|
112746
113179
|
const end = Math.min(start + MAX_CHUNK_SIZE, text.length);
|
|
112747
113180
|
chunks.push(text.slice(start, end).trim());
|
|
112748
|
-
|
|
112749
|
-
if (start >= text.length - MIN_CHUNK_SIZE)
|
|
113181
|
+
if (end === text.length)
|
|
112750
113182
|
break;
|
|
113183
|
+
start = end - CHUNK_OVERLAP;
|
|
112751
113184
|
}
|
|
112752
113185
|
return chunks.filter((c) => c.length > 0);
|
|
112753
113186
|
}
|
|
@@ -114389,11 +114822,11 @@ var registerRequestHumanInputTool = (server) => {
|
|
|
114389
114822
|
createToolRegistrar(server)("request-human-input", {
|
|
114390
114823
|
title: "Request human input",
|
|
114391
114824
|
annotations: { destructiveHint: false },
|
|
114392
|
-
description: "Create an approval request
|
|
114825
|
+
description: "Create an approval request and return at once with the request id and URL. The answer arrives later as a hitl-follow-up task. " + "Supports multiple question types: approval (yes/no), text, single-select, " + "multi-select, and boolean. Returns the request ID and URL for the human to respond.",
|
|
114393
114826
|
inputSchema: object({
|
|
114394
114827
|
title: string().min(1).describe("Title of the approval request"),
|
|
114395
114828
|
questions: array(QuestionSchema).min(1).describe("Questions to ask the human"),
|
|
114396
|
-
timeoutSeconds: number().int().min(1).optional().describe("
|
|
114829
|
+
timeoutSeconds: number().int().min(1).optional().describe("Seconds until the request expires. After that the request becomes 'timeout' and you get a hitl-follow-up task. A request with no timeout is cancelled after APPROVAL_REQUEST_AUTO_CANCELLATION_DAYS days (default 7).")
|
|
114397
114830
|
}),
|
|
114398
114831
|
outputSchema: swarmToolOutputSchema({
|
|
114399
114832
|
yourAgentId: string().optional(),
|
|
@@ -121229,6 +121662,10 @@ async function getEventsFiltered(filters) {
|
|
|
121229
121662
|
conditions.push("event = ?");
|
|
121230
121663
|
params2.push(filters.event);
|
|
121231
121664
|
}
|
|
121665
|
+
if (filters.events && filters.events.length > 0) {
|
|
121666
|
+
conditions.push(`event IN (${filters.events.map(() => "?").join(", ")})`);
|
|
121667
|
+
params2.push(...filters.events);
|
|
121668
|
+
}
|
|
121232
121669
|
if (filters.status) {
|
|
121233
121670
|
conditions.push("status = ?");
|
|
121234
121671
|
params2.push(filters.status);
|
|
@@ -121261,8 +121698,24 @@ async function getEventsFiltered(filters) {
|
|
|
121261
121698
|
conditions.push("createdAt <= ?");
|
|
121262
121699
|
params2.push(filters.until);
|
|
121263
121700
|
}
|
|
121264
|
-
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
121265
121701
|
const limit = filters.limit ?? 100;
|
|
121702
|
+
if (filters.latestPerDataField) {
|
|
121703
|
+
const lookups = [];
|
|
121704
|
+
const lookupParams = [];
|
|
121705
|
+
for (const event of filters.latestPerDataField.events) {
|
|
121706
|
+
for (const field of filters.latestPerDataField.dataFields) {
|
|
121707
|
+
const where2 = [...conditions, "event = ?", "json_extract(data, '$.field') = ?"];
|
|
121708
|
+
lookups.push(`SELECT * FROM (SELECT * FROM events WHERE ${where2.join(" AND ")} ORDER BY createdAt DESC LIMIT 1)`);
|
|
121709
|
+
lookupParams.push(...params2, event, field);
|
|
121710
|
+
}
|
|
121711
|
+
}
|
|
121712
|
+
if (lookups.length === 0)
|
|
121713
|
+
return [];
|
|
121714
|
+
const sql2 = `${lookups.join(" UNION ALL ")} ORDER BY createdAt DESC LIMIT ?`;
|
|
121715
|
+
const rows2 = await getDbClient().query(sql2, [...lookupParams, limit]);
|
|
121716
|
+
return rows2.map(rowToSwarmEvent);
|
|
121717
|
+
}
|
|
121718
|
+
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
121266
121719
|
params2.push(limit);
|
|
121267
121720
|
const sql = `SELECT * FROM events ${where} ORDER BY createdAt DESC LIMIT ?`;
|
|
121268
121721
|
const rows = await getDbClient().query(sql, params2);
|
|
@@ -121377,8 +121830,8 @@ var registerListSchedulesTool = (server) => {
|
|
|
121377
121830
|
keyPrefix: AssetKeySchema.optional().describe("Filter by namespace subtree."),
|
|
121378
121831
|
scheduleType: _enum(["recurring", "one_time"]).optional().describe("Filter by schedule type"),
|
|
121379
121832
|
hideCompleted: boolean().default(true).optional().describe("Hide completed one-time schedules (default: true)"),
|
|
121380
|
-
consecutiveErrorsMin: number().int().min(0).optional().describe("Only return schedules with at least this many consecutive errors."),
|
|
121381
|
-
lastRunStatus: _enum(["failed", "succeeded"]).optional().describe("Filter by derived last
|
|
121833
|
+
consecutiveErrorsMin: number().int().min(0).optional().describe("Only return schedules with at least this many consecutive dispatch errors (the scheduler failed to create the task, workflow run, or script run). Does not count spawned tasks that later failed; for those use get-tasks with scheduleId and status failed."),
|
|
121834
|
+
lastRunStatus: _enum(["failed", "succeeded"]).optional().describe("Filter by derived last dispatch status. `failed` means consecutiveErrors > 0 (the last dispatch attempt errored); `succeeded` means lastRunAt is set and consecutiveErrors is 0. Reflects dispatch only, not the outcome of spawned tasks; for those use get-tasks with scheduleId and status failed."),
|
|
121382
121835
|
includeFull: boolean().optional().describe("Return the full `taskTemplate` instead of a short `taskTemplatePreview`. Default false.")
|
|
121383
121836
|
}),
|
|
121384
121837
|
outputSchema: swarmToolOutputSchema({
|
|
@@ -122975,6 +123428,7 @@ async function sendTaskHandler(ctx, {
|
|
|
122975
123428
|
slackUserId,
|
|
122976
123429
|
overrideSlackContext,
|
|
122977
123430
|
followUpConfig,
|
|
123431
|
+
inheritParentFollowUpConfig: taskType === "resume",
|
|
122978
123432
|
outputSchema,
|
|
122979
123433
|
routingReason: effectiveRoutingReason,
|
|
122980
123434
|
routingSource: effectiveRoutingSource,
|
|
@@ -128079,7 +128533,8 @@ async function listWorkflowRunsHandler({
|
|
|
128079
128533
|
const { runs, page } = await listWorkflowRunsPage(workflowId, {
|
|
128080
128534
|
status,
|
|
128081
128535
|
limit,
|
|
128082
|
-
offset
|
|
128536
|
+
offset,
|
|
128537
|
+
includeContext
|
|
128083
128538
|
});
|
|
128084
128539
|
const resultRuns = includeContext ? runs : runs.map(slimRun);
|
|
128085
128540
|
return toolOk(`Found ${runs.length} run(s) at offset ${page.offset} (${page.total} total).`, {
|
|
@@ -128561,10 +129016,10 @@ async function createServer(opts = {}) {
|
|
|
128561
129016
|
await loadGlobalConfigsIntoEnv(true);
|
|
128562
129017
|
const hasCapability2 = (cap) => opts.fullSurface === true || getCapabilities().has(cap);
|
|
128563
129018
|
initDb(process.env.DATABASE_PATH);
|
|
128564
|
-
|
|
129019
|
+
ensurePricingSeeded();
|
|
128565
129020
|
startPricingRefreshLoop();
|
|
128566
129021
|
try {
|
|
128567
|
-
|
|
129022
|
+
ensureRbacSeeded();
|
|
128568
129023
|
} catch (err) {
|
|
128569
129024
|
console.error("[startup] Failed to sync RBAC seed rows:", err);
|
|
128570
129025
|
if (isRbacEnabled())
|
|
@@ -128703,6 +129158,7 @@ async function createServer(opts = {}) {
|
|
|
128703
129158
|
registerRetryWorkflowRunTool(server);
|
|
128704
129159
|
registerCancelWorkflowRunTool(server);
|
|
128705
129160
|
registerRequestHumanInputTool(server);
|
|
129161
|
+
registerCancelApprovalRequestTool(server);
|
|
128706
129162
|
}
|
|
128707
129163
|
if (hasCapability2("skills")) {
|
|
128708
129164
|
registerSkillCreateTool(server);
|
|
@@ -128929,7 +129385,8 @@ var SDK_TOOL_NAME_MAP = {
|
|
|
128929
129385
|
page_create: "create_page",
|
|
128930
129386
|
page_delete: "delete-page",
|
|
128931
129387
|
metric_create: "create_metric",
|
|
128932
|
-
request_humanInput: "request-human-input"
|
|
129388
|
+
request_humanInput: "request-human-input",
|
|
129389
|
+
approval_cancel: "cancel-approval-request"
|
|
128933
129390
|
};
|
|
128934
129391
|
var SDK_ALLOWLIST = Object.keys(SDK_TOOL_NAME_MAP);
|
|
128935
129392
|
var MCP_TOOL_NAMES = new Set(Object.values(SDK_TOOL_NAME_MAP));
|
|
@@ -129273,6 +129730,16 @@ function bridgeRequestFor(name, args2) {
|
|
|
129273
129730
|
throw new Error("task_cancel requires string `taskId`");
|
|
129274
129731
|
return { method: "POST", path: `/api/tasks/${encodeURIComponent(taskId)}/cancel` };
|
|
129275
129732
|
}
|
|
129733
|
+
case "approval_cancel": {
|
|
129734
|
+
const requestId = typeof body.requestId === "string" ? body.requestId : undefined;
|
|
129735
|
+
if (!requestId)
|
|
129736
|
+
throw new Error("approval_cancel requires string `requestId`");
|
|
129737
|
+
return {
|
|
129738
|
+
method: "POST",
|
|
129739
|
+
path: `/api/approval-requests/${encodeURIComponent(requestId)}/cancel`,
|
|
129740
|
+
body: { reason: body.reason }
|
|
129741
|
+
};
|
|
129742
|
+
}
|
|
129276
129743
|
case "kv_get":
|
|
129277
129744
|
case "kv_getOrNull":
|
|
129278
129745
|
return { method: "GET", path: kvPath(body) };
|
|
@@ -131341,7 +131808,7 @@ class HumanInTheLoopExecutor extends BaseExecutor {
|
|
|
131341
131808
|
}
|
|
131342
131809
|
if (notification.channel === "slack") {
|
|
131343
131810
|
try {
|
|
131344
|
-
const { getSlackApp: getSlackApp2 } = await import("./app-
|
|
131811
|
+
const { getSlackApp: getSlackApp2 } = await import("./app-g26wdcz6.js");
|
|
131345
131812
|
const slackApp = getSlackApp2();
|
|
131346
131813
|
if (!slackApp) {
|
|
131347
131814
|
console.warn("[HITL] Slack not initialized — cannot send notification");
|
|
@@ -131355,7 +131822,7 @@ class HumanInTheLoopExecutor extends BaseExecutor {
|
|
|
131355
131822
|
elements: [
|
|
131356
131823
|
{
|
|
131357
131824
|
type: "mrkdwn",
|
|
131358
|
-
text: `⏱ Timeout: ${formatTimeout(config.timeout.seconds)} —
|
|
131825
|
+
text: `⏱ Timeout: ${formatTimeout(config.timeout.seconds)} — times out if not responded`
|
|
131359
131826
|
}
|
|
131360
131827
|
]
|
|
131361
131828
|
}
|
|
@@ -131470,7 +131937,7 @@ class NotifyExecutor extends BaseExecutor {
|
|
|
131470
131937
|
}
|
|
131471
131938
|
}
|
|
131472
131939
|
case "slack": {
|
|
131473
|
-
const { getSlackApp: getSlackApp2 } = await import("./app-
|
|
131940
|
+
const { getSlackApp: getSlackApp2 } = await import("./app-g26wdcz6.js");
|
|
131474
131941
|
const app = getSlackApp2();
|
|
131475
131942
|
if (!app) {
|
|
131476
131943
|
return {
|
|
@@ -132294,4 +132761,4 @@ async function initWorkflows() {
|
|
|
132294
132761
|
logOpenWebhookTriggers();
|
|
132295
132762
|
}
|
|
132296
132763
|
|
|
132297
|
-
export { DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, isJSONRPCErrorResponse, JSONRPCMessageSchema, isInitializeRequest, McpServer, isGitHubEnabled, initGitHub, verifyWebhookSignature, isAgentMailEnabled, initAgentMail, verifyAgentMailWebhook, findUserById, findUserByExternalId, getUserIdentities, listUserEvents, listUserTokens, recordIdentityEvent, findOrCreateUserByEmail, linkIdentity, unlinkIdentity, mintToken, revokeToken, resolveUserByToken, mintSessionToken, revokeSessionToken, fingerprintApiKey, resolveIdentity, renderIdentity, createAdditiveBuffer, referencedBundlePaths, skillDirs, TaskCreationBlockedError, recordUnmappedIdentity, MAX_TASK_ATTACHMENT_BYTES, recordTaskAttachmentUpload, buildEffectiveText, bufferedFileFailures, fetchSlackFiles, createSlackTaskWithFiles, notifySlackFileFailures, hasOtherUserMention, broadcastMatches, routeMessage, extractTaskFromMessage, extractSlackMessageText, automationIntegrationFixUrl, preflightAutomation, getAutomationSetupStates, listEnabledAutomationPreflightInputs, validateJsonSchema, TriggerSchemaError, startWorkflowExecution, setupWorkflowResumeListener, retryFailedRun, cancelWorkflowRun, resumeWaitState, initWaitBusSubscriptions, subscribeWaitToBus, recoverIncompleteRuns, startRetryPoller, stopRetryPoller, validateTemplateVariables, instantiateTemplate, handleWebhookTrigger, logOpenWebhookTriggers, handleEventTrigger, handleScheduleTrigger, verifyHmacSignature, WebhookError, snapshotWorkflow, snapshotAndUpdateWorkflow, startWaitPoller, stopWaitPoller, RawLlmConfigSchema, RawLlmOutputSchema, executeRawLlm, getExecutorRegistry, initWorkflows, dispatchScheduleTarget, calculateNextRun, startScheduler, stopScheduler, runScheduleNow, parseSkillContent, ExtensionAssetConflictError, ExtensionOwnershipError, getExtensionFiles, getExtensionById, getExtensionByName, listExtensions, listExtensionVersions, updateExtensionMeta, listExtensionRuns, SDK_ALLOWLIST, mcpToolNameForSdkMethod, mcpOverflowAuthError, toolErr, createToolRegistrar, warnIfCorsAllowsAnyOrigin, isOriginAllowedForCredentials, allowedCredentialRedirect, setCorsHeaders, parseQueryParams, getPathSegments, wireHttpSpanLifecycle, safeRequestUrlForLog, agentWithCapacity, parseBody, BODY_TOO_LARGE, enforceContentLengthCap, json, jsonError, triggerSchemaErrorResponse, deriveApiBaseUrl, httpServerSemconvAttributes, runtimeInstanceHeader, describeRequestRoute, route, handleMcpBridge, Redacted, SCRIPT_SDK_RESPONSE_LIMIT_BYTES, readScriptSdkJsonResponse, ExtensionConfigError, ExtensionLifecycleError, setExtensionLoopbackBaseUrl, enableExtension, disableExtension, activateVersion, ExtensionAssetsInvalidError, installExtensionWithAssets, uninstallExtension, reloadExtension, loadEnabledExtensions, stopExtensionRuntime, ExtensionAbortedError, isRegistered, isExtensionAgentId, getExtensionBridgeToken, resolveBridgeCallOrigin, extensionIdForAgent, runContext, registerLoaded, unregister, listRegistered, dispatchPre, dispatchPost, createTaskWithSiblingAwareness, isInboxAllowed, isSenderAllowed, handleMessageReceived, AGENT_MAX_TASKS_CONFIG_KEY, reconcileAgentMaxTasksPolicy, resetAgentMaxTasksMirror, upsertSwarmConfigWithPolicyMirror, runtimeStaleThresholdMinutes, upsertRuntimeInstance, getRuntimeInstanceById, touchRuntimeInstance, countActiveRuntimeInstancesForAgent, listRuntimeInstancesForAgent, setRuntimeCredentialReady, reconcileAgentStatusFromRuntimes, agentsWithLiveRuntime, expireStaleRuntimeInstances, enqueueAuditRow, enqueueAdmissionRow, flushAuditBuffer, startAuditWriter, stopAuditWriter, startAuditGc, stopAuditGc, handlePullRequest, handleIssue, handleComment, handlePullRequestReview, handleCheckRun, handleCheckSuite, handleWorkflowRun, isGitLabEnabled, initGitLab, verifyGitLabWebhook, handleMergeRequest, handleIssue2 as handleIssue1, handleNote, handlePipeline, repointTrackerSyncBySwarmId, getJiraMetadata, updateJiraMetadata, clearJiraMetadata, registerJiraWebhook, deleteJiraWebhook, isJiraEnabled, initJira, handleJiraWebhook, handleAgentSessionEvent, handleIssueUpdate, handleIssueDelete, handleAgentSessionPrompted, isLinearEnabled, initLinear, parseCookieHeader, extractAndVerifyCookie, issuePageSessionCookie, resolveHttpRequestAuth, loadGlobalConfigsIntoEnv, reloadGlobalConfigsAndIntegrations, scheduleIntegrationsReload, handleCore, userCtx, resolveTaskAuditUserId, resolveHttpAuditUserId, resolveHttpFavoriteOwner, handleApps, getUserCommsPrefs, getTaskDetailsInputSchema, getTaskDetailsOutputSchema, getTaskDetailsHandler, cancelTaskInputSchema, cancelTaskOutputSchema, cancelTaskHandler, executeReadOnlyQuery, assertSelectOnlyQuery, handleDbQuery, snapshotMetric, AssetKeyAuthorizationError, authorizeAssetKeyWrite, snapshotPage, assertOAuthAppUrlsSafe, assertOAuthEgressUrlSafe, listOAuthPresets, listOAuthPresetIds, getOAuthPreset, hydrateOAuthAppFromPreset, scopedResourceScopeIdSchema, resolveScopedResourceId, dedupeMemoryDocumentIds, recordMemoryAccesses, recordRetrievals, ExplicitSelfDuplicateError, applyRating, shouldPersistAutomaticTaskMemory, REBOOT_RETRY_PIN_TAG, getPinCandidateAgent, resolveLeadOnlyRecoveryAssignment, getResumeGeneration, getNextResumeGeneration, createWorkerTaskFollowUp, createResumeFollowUp, createRerouteDecisionTask, createPoolStarvationDecisionTask, guardTerminalTaskResultWrite, getTasksInputSchema, getTasksOutputSchema, getTasksHandler, reservedNamespaceError, reservedRoomKeyError, refreshLinks, canReadMemory, getLinksForMemory, expandCandidatesWithGraph, indexMemoryContent, markKapsoMessageRead, sendKapsoReaction, getKapsoConfig, getKapsoNumberMapping, markKapsoMessageSeen, resolveRoomNamespace, roomRequestInfo, authorizeRoomNamespace, RoomOperationSchema, removeAwarenessStates, roomTopic, decodeRoomSnapshot, roomView, getRoom, changeRoom, applyRoomUpdate, resetRoom, sweepRooms, closeRooms, removeNamespaceRooms, createEvent, createEventsBatch, getEventCountsFiltered, getEventsFiltered, mergeScheduleTiming, validateRecurringTiming, checkOutputSchemaShape, sendTaskOutputSchema, sendTaskHandler, steerTaskUserInputSchema, steerTaskOutputSchema, steerTaskHandler, canClaim, emitBudgetRefusalSideEffects, taskActionInputSchema, taskActionOutputSchema, taskActionHandler, patchWorkflowDefinition, resolveScriptsOnlyMode, ALL_CAPABILITIES, hasCapability, getEnabledCapabilities, createServer };
|
|
132764
|
+
export { DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, isJSONRPCErrorResponse, JSONRPCMessageSchema, isInitializeRequest, McpServer, isGitHubEnabled, initGitHub, verifyWebhookSignature, isAgentMailEnabled, initAgentMail, verifyAgentMailWebhook, findUserById, findUserByExternalId, getUserIdentities, listUserEvents, listUserTokens, recordIdentityEvent, findOrCreateUserByEmail, linkIdentity, unlinkIdentity, mintToken, revokeToken, resolveUserByToken, mintSessionToken, revokeSessionToken, fingerprintApiKey, resolveIdentity, renderIdentity, createAdditiveBuffer, referencedBundlePaths, skillDirs, TaskCreationBlockedError, recordUnmappedIdentity, MAX_TASK_ATTACHMENT_BYTES, recordTaskAttachmentUpload, buildEffectiveText, bufferedFileFailures, fetchSlackFiles, createSlackTaskWithFiles, notifySlackFileFailures, hasOtherUserMention, broadcastMatches, routeMessage, extractTaskFromMessage, extractSlackMessageText, automationIntegrationFixUrl, preflightAutomation, getAutomationSetupStates, listEnabledAutomationPreflightInputs, validateJsonSchema, TriggerSchemaError, startWorkflowExecution, createApprovalFollowUpTask, setupWorkflowResumeListener, retryFailedRun, cancelWorkflowRun, resumeWaitState, initWaitBusSubscriptions, subscribeWaitToBus, recoverIncompleteRuns, startRetryPoller, stopRetryPoller, validateTemplateVariables, instantiateTemplate, handleWebhookTrigger, logOpenWebhookTriggers, handleEventTrigger, handleScheduleTrigger, verifyHmacSignature, WebhookError, snapshotWorkflow, snapshotAndUpdateWorkflow, startWaitPoller, stopWaitPoller, RawLlmConfigSchema, RawLlmOutputSchema, executeRawLlm, getExecutorRegistry, initWorkflows, dispatchScheduleTarget, calculateNextRun, startScheduler, stopScheduler, runScheduleNow, parseSkillContent, ExtensionAssetConflictError, ExtensionOwnershipError, getExtensionFiles, getExtensionById, getExtensionByName, listExtensions, listExtensionVersions, updateExtensionMeta, listExtensionRuns, SDK_ALLOWLIST, mcpToolNameForSdkMethod, mcpOverflowAuthError, toolErr, createToolRegistrar, warnIfCorsAllowsAnyOrigin, isOriginAllowedForCredentials, allowedCredentialRedirect, setCorsHeaders, parseQueryParams, getPathSegments, wireHttpSpanLifecycle, safeRequestUrlForLog, agentWithCapacity, parseBody, BODY_TOO_LARGE, enforceContentLengthCap, json, jsonError, triggerSchemaErrorResponse, deriveApiBaseUrl, httpServerSemconvAttributes, runtimeInstanceHeader, describeRequestRoute, route, handleMcpBridge, Redacted, SCRIPT_SDK_RESPONSE_LIMIT_BYTES, readScriptSdkJsonResponse, ExtensionConfigError, ExtensionLifecycleError, setExtensionLoopbackBaseUrl, enableExtension, disableExtension, activateVersion, ExtensionAssetsInvalidError, installExtensionWithAssets, uninstallExtension, reloadExtension, loadEnabledExtensions, stopExtensionRuntime, ExtensionAbortedError, isRegistered, isExtensionAgentId, getExtensionBridgeToken, resolveBridgeCallOrigin, extensionIdForAgent, runContext, registerLoaded, unregister, listRegistered, dispatchPre, dispatchPost, createTaskWithSiblingAwareness, isInboxAllowed, isSenderAllowed, handleMessageReceived, AGENT_MAX_TASKS_CONFIG_KEY, reconcileAgentMaxTasksPolicy, resetAgentMaxTasksMirror, upsertSwarmConfigWithPolicyMirror, runtimeStaleThresholdMinutes, upsertRuntimeInstance, getRuntimeInstanceById, touchRuntimeInstance, countActiveRuntimeInstancesForAgent, listRuntimeInstancesForAgent, setRuntimeCredentialReady, reconcileAgentStatusFromRuntimes, agentsWithLiveRuntime, expireStaleRuntimeInstances, enqueueAuditRow, enqueueAdmissionRow, flushAuditBuffer, startAuditWriter, stopAuditWriter, startAuditGc, stopAuditGc, handlePullRequest, handleIssue, handleComment, handlePullRequestReview, handleCheckRun, handleCheckSuite, handleWorkflowRun, isGitLabEnabled, initGitLab, verifyGitLabWebhook, handleMergeRequest, handleIssue2 as handleIssue1, handleNote, handlePipeline, repointTrackerSyncBySwarmId, getJiraMetadata, updateJiraMetadata, clearJiraMetadata, registerJiraWebhook, deleteJiraWebhook, isJiraEnabled, initJira, handleJiraWebhook, handleAgentSessionEvent, handleIssueUpdate, handleIssueDelete, handleAgentSessionPrompted, isLinearEnabled, initLinear, parseCookieHeader, extractAndVerifyCookie, issuePageSessionCookie, resolveHttpRequestAuth, loadGlobalConfigsIntoEnv, reloadGlobalConfigsAndIntegrations, scheduleIntegrationsReload, handleCore, userCtx, resolveTaskAuditUserId, resolveHttpAuditUserId, resolveHttpFavoriteOwner, handleApps, cancelApprovalRequest, cancelApprovalRequestAndRun, getUserCommsPrefs, getTaskDetailsInputSchema, getTaskDetailsOutputSchema, getTaskDetailsHandler, cancelTaskInputSchema, cancelTaskOutputSchema, cancelTaskHandler, executeReadOnlyQuery, assertSelectOnlyQuery, handleDbQuery, snapshotMetric, AssetKeyAuthorizationError, authorizeAssetKeyWrite, snapshotPage, assertOAuthAppUrlsSafe, assertOAuthEgressUrlSafe, listOAuthPresets, listOAuthPresetIds, getOAuthPreset, hydrateOAuthAppFromPreset, scopedResourceScopeIdSchema, resolveScopedResourceId, dedupeMemoryDocumentIds, recordMemoryAccesses, recordRetrievals, ExplicitSelfDuplicateError, applyRating, shouldPersistAutomaticTaskMemory, REBOOT_RETRY_PIN_TAG, getPinCandidateAgent, resolveLeadOnlyRecoveryAssignment, getResumeGeneration, getNextResumeGeneration, createWorkerTaskFollowUp, createResumeFollowUp, createRerouteDecisionTask, createPoolStarvationDecisionTask, guardTerminalTaskResultWrite, getTasksInputSchema, getTasksOutputSchema, getTasksHandler, reservedNamespaceError, reservedRoomKeyError, refreshLinks, canReadMemory, getLinksForMemory, expandCandidatesWithGraph, indexMemoryContent, markKapsoMessageRead, sendKapsoReaction, getKapsoConfig, getKapsoNumberMapping, markKapsoMessageSeen, resolveRoomNamespace, roomRequestInfo, authorizeRoomNamespace, RoomOperationSchema, removeAwarenessStates, roomTopic, decodeRoomSnapshot, roomView, getRoom, changeRoom, applyRoomUpdate, resetRoom, sweepRooms, closeRooms, removeNamespaceRooms, createEvent, createEventsBatch, getEventCountsFiltered, getEventsFiltered, mergeScheduleTiming, validateRecurringTiming, checkOutputSchemaShape, sendTaskOutputSchema, sendTaskHandler, steerTaskUserInputSchema, steerTaskOutputSchema, steerTaskHandler, canClaim, emitBudgetRefusalSideEffects, taskActionInputSchema, taskActionOutputSchema, taskActionHandler, patchWorkflowDefinition, resolveScriptsOnlyMode, ALL_CAPABILITIES, hasCapability, getEnabledCapabilities, createServer };
|