@desplega.ai/agent-swarm 2.0.0 → 2.1.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-sj2g0m84.js → acp-adapter-kr4abrsk.js} +10 -10
- package/dist/{actions-fegk44gr.js → actions-eh4g6w2r.js} +27 -27
- package/dist/{amp-adapter-ad8ft89x.js → amp-adapter-7h7wdt8q.js} +5 -5
- package/dist/{app-kfvgbvzy.js → app-7k8s9w5p.js} +9 -9
- package/dist/{assistant-z7zdy9ja.js → assistant-wswt2y7p.js} +28 -28
- package/dist/{boot-reembed-j8xa181e.js → boot-reembed-9apm9qw6.js} +7 -7
- package/dist/{boot-reembed-5c2z0mbe.js → boot-reembed-whzbdthj.js} +7 -7
- package/dist/{boot-scrub-sweep-hnkn3rgt.js → boot-scrub-sweep-ndzmvmgt.js} +8 -8
- package/dist/{boot-seeds-kwjq4d2z.js → boot-seeds-e9sta0yt.js} +13 -11
- package/dist/{claude-adapter-9vmvpvgd.js → claude-adapter-4mqd3r6r.js} +11 -11
- package/dist/{claude-managed-adapter-k9qae05j.js → claude-managed-adapter-9wswb52m.js} +3 -3
- package/dist/{claude-managed-setup-q54zx5q2.js → claude-managed-setup-tpe1effx.js} +4 -4
- package/dist/{claude-sdk-session-9jye6cxr.js → claude-sdk-session-q49ghmh9.js} +10340 -10197
- package/dist/{cli-ke896fcf.js → cli-01xvj1rq.js} +10 -10
- package/dist/{cli-tr4sxp68.js → cli-035vekcw.js} +2 -2
- package/dist/{cli-z5jjpaxw.js → cli-0pd8hzhc.js} +3 -3
- package/dist/{cli-n5vwg842.js → cli-0veb92a3.js} +6 -1
- package/dist/{cli-wayw93nt.js → cli-10jesr25.js} +3 -3
- package/dist/{cli-se8w6wny.js → cli-1y7yywmj.js} +1 -1
- package/dist/{cli-v1yb0rqb.js → cli-20krdhz5.js} +47 -19
- package/dist/{cli-d5f9ed5c.js → cli-29rja109.js} +39 -20
- package/dist/{cli-apx87jne.js → cli-2pwa0q4d.js} +15 -4
- package/dist/{cli-ee9gtz70.js → cli-4mengw46.js} +348 -25
- package/dist/{cli-03gedhng.js → cli-5twdke5x.js} +6 -6
- package/dist/{cli-6razj6t4.js → cli-711vwbxn.js} +2 -2
- package/dist/{cli-s2sp957d.js → cli-78vv7446.js} +1 -1
- package/dist/{cli-3fbmmawm.js → cli-7n6s5man.js} +4 -4
- package/dist/{cli-hnhtk6cj.js → cli-8wwxw8a3.js} +1 -1
- package/dist/{cli-hnmhtzvh.js → cli-9jzdj90z.js} +2 -0
- package/dist/{cli-skxvvpap.js → cli-cvv9k0hh.js} +28 -25
- package/dist/{cli-74ahz61x.js → cli-d9286m9h.js} +2 -2
- package/dist/{cli-4jxm2qtz.js → cli-gxzkg1de.js} +28 -16
- package/dist/{cli-zkpks3r3.js → cli-h1arqn31.js} +1 -1
- package/dist/{cli-r62a35ea.js → cli-hqr88ew6.js} +1 -1
- package/dist/{cli-ra0xzggj.js → cli-j67mh2vg.js} +2 -2
- package/dist/{cli-29jc5q7w.js → cli-ksphgh48.js} +2 -2
- package/dist/{cli-eejsgvm4.js → cli-mgz4nbgg.js} +4 -4
- package/dist/{cli-vatyhshy.js → cli-mz5as5ha.js} +4 -4
- package/dist/{cli-f7kr7svz.js → cli-n8ndw8j7.js} +2 -2
- package/dist/{cli-1e4b6bzh.js → cli-naqzr17j.js} +7 -7
- package/dist/{cli-q0ke1yww.js → cli-nm1p8jfr.js} +6 -6
- package/dist/{cli-m50t4309.js → cli-p3zbc1rw.js} +5 -5
- package/dist/{cli-cgtksawx.js → cli-pe05f8yk.js} +23 -3
- package/dist/{cli-vdach5a9.js → cli-qmzsbkvy.js} +4 -4
- package/dist/{cli-n3hzg89b.js → cli-qnm4e9e4.js} +57 -579
- package/dist/{cli-s4setq91.js → cli-qqy4q48b.js} +3 -3
- package/dist/{cli-k382tshb.js → cli-r35rw5de.js} +8 -7
- package/dist/{cli-k3dp5tpf.js → cli-r610p9bs.js} +2 -2
- package/dist/{cli-e6mpjhed.js → cli-rc6pf5kv.js} +1 -1
- package/dist/{cli-3dj8k4vy.js → cli-rdxm77k3.js} +1 -1
- package/dist/{cli-tqaazemc.js → cli-s69nfyeh.js} +1 -1
- package/dist/{cli-6jyj59nb.js → cli-sawv63e8.js} +2 -2
- package/dist/{cli-q50942rs.js → cli-sg19gbf0.js} +1 -1
- package/dist/{cli-p1x85d2t.js → cli-shk7r5cs.js} +12 -9
- package/dist/{cli-przpmdgr.js → cli-sksetb2q.js} +11 -1
- package/dist/{cli-d2qr7aj4.js → cli-t02z59f2.js} +1 -1
- package/dist/{cli-j0pfptdp.js → cli-v7g551te.js} +39 -43
- package/dist/{cli-bzszjf2p.js → cli-vgqzp4em.js} +519 -126
- package/dist/cli-wfnemr1t.js +86 -0
- package/dist/{cli-ne236afy.js → cli-wms6x9db.js} +8 -8
- package/dist/{cli-5hkm7whv.js → cli-x1r545x8.js} +1 -1
- package/dist/{cli-kt6zqg0e.js → cli-xczsgshn.js} +2 -2
- package/dist/{cli-ef1hg1wv.js → cli-y3167wt1.js} +430 -238
- package/dist/{cli-tsde1hdr.js → cli-yjmqpxt3.js} +12 -11
- package/dist/{cli-9nfx44eh.js → cli-z780ec7c.js} +1 -1
- package/dist/{cli-r2pnvj8g.js → cli-zm9t2vde.js} +2 -2
- package/dist/cli.js +24 -23
- package/dist/{codex-adapter-y81sssk0.js → codex-adapter-4z16v9n0.js} +8 -8
- package/dist/{codex-login-f2rcfpp9.js → codex-login-pkepy2j1.js} +2 -2
- package/dist/{codex-session-runner-8vx4j6a9.js → codex-session-runner-rvms9y2x.js} +8 -8
- package/dist/{commands-kcpvpcrr.js → commands-2a9rtyat.js} +8 -8
- package/dist/{controller-ywrmt6yd.js → controller-3k3madbn.js} +4 -4
- package/dist/{controllers-connect-kwpvj3rf.js → controllers-connect-v9yn8zb9.js} +30 -30
- package/dist/{cursor-adapter-cehv1qns.js → cursor-adapter-98gbhyzn.js} +4 -4
- package/dist/{db-ww5d7jq3.js → db-eywwsnjw.js} +9 -7
- package/dist/{db-k8ankj20.js → db-ncypk9np.js} +9 -9
- package/dist/{devin-adapter-x1022qb1.js → devin-adapter-zeq8b9gz.js} +2 -2
- package/dist/{dispatcher-e8gq5m68.js → dispatcher-w94kc575.js} +26 -26
- package/dist/{docker-ff6y1190.js → docker-b1e4cqab.js} +2 -2
- package/dist/{dsh-adapter-3epjm3af.js → dsh-adapter-47ztej36.js} +4 -4
- package/dist/{e2b-8ygwhg0f.js → e2b-bbt8ey45.js} +3 -3
- package/dist/{e2b-swhnpw3n.js → e2b-dp804sen.js} +3 -3
- package/dist/{event-bus-6axnngdj.js → event-bus-j2jdg3qb.js} +2 -2
- package/dist/{external-channel-h3359cwn.js → external-channel-zrkg8ar9.js} +8 -8
- package/dist/{grok-adapter-0d4x7gkx.js → grok-adapter-s9ncp9vy.js} +11 -11
- package/dist/{handlers-an1gzv21.js → handlers-kqftvjgw.js} +29 -29
- package/dist/{heartbeat-6dakeb61.js → heartbeat-9q96p8v9.js} +31 -31
- package/dist/{hook-6v6cv6d5.js → hook-56qe10dp.js} +7 -7
- package/dist/{hook-sa5xye4y.js → hook-yy6rw42k.js} +8 -8
- package/dist/{http-r7f3eky0.js → http-r2dnb8f8.js} +963 -75
- package/dist/{index-7ep4gzdk.js → index-3gtmkhc6.js} +26 -26
- package/dist/{index-v1v6n7hg.js → index-3k5hkz7r.js} +31 -31
- package/dist/{index-rmpw9a8q.js → index-5e101240.js} +26 -26
- package/dist/{index-s2wxgzr0.js → index-5wyfjc2c.js} +392 -15
- package/dist/{index-zk96aq1k.js → index-vxvhxxbn.js} +7 -7
- package/dist/{keepalive-be9vwy5h.js → keepalive-psj6j54c.js} +9 -9
- package/dist/{lead-0861cwrf.js → lead-hajz4688.js} +43 -43
- package/dist/{maintenance-mzzgc8bn.js → maintenance-ps02sb5m.js} +7 -7
- package/dist/{node-mn1zs7an.js → node-mwb5r697.js} +1 -1
- package/dist/{oauth-refresh-sweep-cpdnfwdj.js → oauth-refresh-sweep-0284h93b.js} +8 -8
- package/dist/{onboard-fh8qs4r3.js → onboard-rbf6bg01.js} +2 -2
- package/dist/{opencode-adapter-nm42wwj8.js → opencode-adapter-13dcatgq.js} +8 -8
- package/dist/{otel-impl-x6c1c9g4.js → otel-impl-zvqcbhp7.js} +2 -2
- package/dist/{pi-mono-adapter-9n2ya240.js → pi-mono-adapter-xxy47q4v.js} +7 -7
- package/dist/{pricing-refresh-qb0rv0ap.js → pricing-refresh-kefx9v3t.js} +9 -9
- package/dist/{rbac-roles-1gzdwbh1.js → rbac-roles-3m36rxm2.js} +8 -8
- package/dist/{rbac-roles-3mraey52.js → rbac-roles-z76xv0hq.js} +9 -9
- package/dist/{render-v2-agpa45zz.js → render-v2-wz73bs25.js} +9 -9
- package/dist/{resume-x0ydy9s9.js → resume-k4wzge8w.js} +14 -14
- package/dist/{setup-as9ga0d6.js → setup-2fp2pypp.js} +2 -2
- package/dist/{work-objects-y5g1y7ev.js → work-objects-6k0ywz3m.js} +29 -29
- package/dist/{worker-860c3e38.js → worker-5v3rxsdh.js} +43 -43
- package/dist/{x-m477fr0h.js → x-4mtdeym1.js} +2 -2
- package/openapi.json +777 -6
- package/package.json +8 -7
- package/src/agentmail/handlers.ts +21 -11
- package/src/apps/definition.ts +16 -0
- package/src/azure-devops/api.ts +52 -2
- package/src/azure-devops/boards-sync.ts +50 -20
- package/src/azure-devops/index.ts +1 -0
- package/src/azure-devops/outbound.ts +95 -0
- package/src/be/boot-seeds.ts +11 -0
- package/src/be/db/model-profiles.ts +315 -0
- package/src/be/db/tasks/read.ts +7 -0
- package/src/be/db.ts +53 -47
- package/src/be/migrations/219_relabel_pi_context_compactions.sql +22 -0
- package/src/be/migrations/220_model_profiles.sql +137 -0
- package/src/be/model-tier-resolution.ts +145 -11
- package/src/be/model-validation.ts +8 -1
- package/src/be/scripts/typecheck.ts +12 -0
- package/src/be/secret-registry.ts +6 -2
- package/src/be/seed-model-profiles.ts +41 -0
- package/src/be/seed-scripts/catalog/heartbeat-jev-gate.ts +368 -0
- package/src/be/seed-scripts/index.ts +9 -0
- package/src/be/swarm-config-guard.ts +1 -0
- package/src/commands/runner.ts +3 -17
- package/src/extensions/catalog.generated.json +17 -0
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/extensions/loader.ts +10 -5
- package/src/heartbeat/heartbeat.ts +2 -1
- package/src/http/agents.ts +49 -2
- package/src/http/all-routes.ts +1 -0
- package/src/http/apps.ts +30 -3
- package/src/http/config.ts +26 -2
- package/src/http/core.ts +4 -0
- package/src/http/index.ts +11 -1
- package/src/http/model-profiles.ts +303 -0
- package/src/http/pages-public.ts +11 -5
- package/src/http/poll.ts +16 -5
- package/src/http/script-runs.ts +1 -1
- package/src/http/scripts.ts +25 -2
- package/src/http/tasks.ts +18 -0
- package/src/http/webhooks.ts +1 -2
- package/src/pages/feedback-overlay.ts +65 -6
- package/src/providers/acp-targets.ts +1 -1
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/dsh-adapter.ts +1 -1
- package/src/providers/pi-mono-extension.ts +17 -3
- package/src/providers/reasoning-effort.ts +10 -0
- package/src/rbac/legacy-policy.ts +8 -0
- package/src/rbac/permissions.ts +5 -0
- package/src/scheduler/deferred-task-waits.ts +18 -5
- package/src/scheduler/scheduler.ts +7 -1
- package/src/scripts-runtime/executors/quickjs-prelude.ts +75 -6
- package/src/scripts-runtime/executors/quickjs-runner.ts +85 -8
- package/src/scripts-runtime/executors/quickjs-web-shims.ts +1041 -0
- package/src/scripts-runtime/extract-args-schema.ts +9 -8
- package/src/scripts-runtime/quickjs-compat.ts +464 -0
- package/src/scripts-runtime/sdk-allowlist.ts +4 -0
- package/src/scripts-runtime/types/stdlib.d.ts +12 -0
- package/src/scripts-runtime/types/swarm-extension.d.ts +3 -0
- package/src/scripts-runtime/types/swarm-sdk.d.ts +12 -0
- package/src/server.ts +10 -1
- package/src/slack/blocks.ts +4 -2
- package/src/slack/reaction-shortcode.ts +14 -0
- package/src/slack/render-v2.ts +12 -7
- package/src/slack/responses.ts +5 -4
- package/src/slack/thread-buffer.ts +41 -22
- package/src/tasks/worker-follow-up.ts +11 -2
- package/src/tests/agentmail-filters.test.ts +47 -0
- package/src/tests/apps-spike2.test.ts +35 -0
- package/src/tests/azure-devops-outbound.test.ts +420 -0
- package/src/tests/db-task-read-contract.test.ts +2 -0
- package/src/tests/db-task-write-contract.test.ts +1 -0
- package/src/tests/deferred-task-wake.test.ts +78 -1
- package/src/tests/docs-index-footprint.test.js +2 -2
- package/src/tests/dsh-adapter.test.ts +1 -1
- package/src/tests/env-flag.test.ts +1 -0
- package/src/tests/extensions-catalog.test.ts +1 -0
- package/src/tests/extensions-example-comms-adherence-gate.test.ts +413 -0
- package/src/tests/extensions-loader.test.ts +15 -0
- package/src/tests/heartbeat-jev-gate-credentials.test.ts +168 -0
- package/src/tests/heartbeat-jev-gate.test.ts +385 -0
- package/src/tests/model-profile-backcompat.test.ts +327 -0
- package/src/tests/model-profile-providers.test.ts +302 -0
- package/src/tests/model-profile-runtime-secrets.test.ts +223 -0
- package/src/tests/model-profiles-api.test.ts +614 -0
- package/src/tests/pages-feedback-keys.test.ts +121 -0
- package/src/tests/pages-feedback.test.ts +3 -0
- package/src/tests/pi-context-compaction.test.ts +193 -0
- package/src/tests/profile-claim.test.ts +269 -0
- package/src/tests/quickjs-compat.test.ts +213 -0
- package/src/tests/rbac-engine.test.ts +21 -0
- package/src/tests/script-connections.test.ts +4 -0
- package/src/tests/script-executor-conformance.test.ts +252 -1
- package/src/tests/script-executor-quickjs.test.ts +96 -0
- package/src/tests/script-runs-http.test.ts +89 -0
- package/src/tests/scripts-http.test.ts +16 -0
- package/src/tests/secret-scrubber.test.ts +10 -0
- package/src/tests/seed-model-profiles.test.ts +174 -0
- package/src/tests/seed-scripts.test.ts +2 -2
- package/src/tests/skill-invocations.test.ts +4 -2
- package/src/tests/slack-blocks.test.ts +36 -0
- package/src/tests/slack-inline-output.test.ts +14 -0
- package/src/tests/slack-reaction-config.test.ts +20 -0
- package/src/tests/slack-render-v2.test.ts +37 -0
- package/src/tests/slack-thread-buffer.test.ts +98 -1
- package/src/tests/workflow-llm.test.ts +61 -0
- package/src/tools/model-profiles/list-model-profiles.ts +54 -0
- package/src/tools/request-human-input.ts +11 -3
- package/src/tools/script-apis.ts +5 -1
- package/src/tools/script-upsert.ts +4 -1
- package/src/tools/send-task.ts +24 -1
- package/src/tools/system-one-decide.ts +104 -0
- package/src/tools/task-action.ts +22 -1
- package/src/tools/tool-config.ts +6 -0
- package/src/types.ts +36 -1
- package/src/utils/secret-scrubber.ts +19 -12
- package/src/utils/vcs-repo-match.ts +29 -0
- package/src/workflows/executors/raw-llm.ts +8 -3
- package/src/workflows/executors/system-one-decision.ts +21 -11
- package/src/workflows/executors/workflow-llm.ts +22 -0
- package/src/workflows/index.ts +21 -12
- package/templates/extensions/README.md +1 -0
- package/templates/extensions/comms-adherence-gate/README.md +88 -0
- package/templates/extensions/comms-adherence-gate/hooks.ts +489 -0
- package/templates/extensions/comms-adherence-gate/manifest.json +8 -0
- package/dist/cli-5t4f29ez.js +0 -33
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ALL_TOOLS,
|
|
3
3
|
init_tool_config
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-9jzdj90z.js";
|
|
5
5
|
import {
|
|
6
6
|
AgentAvatarSchema,
|
|
7
7
|
CreateTaskOptionsSchema,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
normalizeAssetKey,
|
|
23
23
|
parseAssetKey,
|
|
24
24
|
parseModelTier
|
|
25
|
-
} from "./cli-
|
|
25
|
+
} from "./cli-pe05f8yk.js";
|
|
26
26
|
import {
|
|
27
27
|
IdentityFieldBudgetError,
|
|
28
28
|
checkIdentityFieldBudget,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
init_profile_sync,
|
|
37
37
|
matchesDefaultClaudeMd,
|
|
38
38
|
matchesDefaultIdentityMd
|
|
39
|
-
} from "./cli-
|
|
39
|
+
} from "./cli-78vv7446.js";
|
|
40
40
|
import {
|
|
41
41
|
init_config,
|
|
42
42
|
isSlackConfigured
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
import {
|
|
49
49
|
deriveProviderFromKeyType,
|
|
50
50
|
init_credentials
|
|
51
|
-
} from "./cli-
|
|
51
|
+
} from "./cli-x1r545x8.js";
|
|
52
52
|
import {
|
|
53
53
|
init_templates
|
|
54
54
|
} from "./cli-mvzyxwg3.js";
|
|
@@ -97,7 +97,7 @@ import {
|
|
|
97
97
|
import {
|
|
98
98
|
init_package,
|
|
99
99
|
package_default
|
|
100
|
-
} from "./cli-
|
|
100
|
+
} from "./cli-r35rw5de.js";
|
|
101
101
|
import {
|
|
102
102
|
init_bus,
|
|
103
103
|
realtimeBus
|
|
@@ -112,7 +112,7 @@ import {
|
|
|
112
112
|
registerVolatileSecret,
|
|
113
113
|
scrubObject,
|
|
114
114
|
scrubSecrets
|
|
115
|
-
} from "./cli-
|
|
115
|
+
} from "./cli-shk7r5cs.js";
|
|
116
116
|
import {
|
|
117
117
|
harnessModelMismatch,
|
|
118
118
|
init_src,
|
|
@@ -12442,7 +12442,7 @@ var init_runtime = __esm(() => {
|
|
|
12442
12442
|
// src/telemetry-identity.ts
|
|
12443
12443
|
async function loadUserRole(userId) {
|
|
12444
12444
|
try {
|
|
12445
|
-
const { getUserGrant } = await import("./rbac-roles-
|
|
12445
|
+
const { getUserGrant } = await import("./rbac-roles-z76xv0hq.js");
|
|
12446
12446
|
const grant = await getUserGrant(userId);
|
|
12447
12447
|
const role = grant.grantsAll ? "admin" : "member";
|
|
12448
12448
|
if (roleCache.size >= ROLE_CACHE_LIMIT) {
|
|
@@ -13234,198 +13234,24 @@ var init_context_versions = __esm(() => {
|
|
|
13234
13234
|
init_runtime();
|
|
13235
13235
|
});
|
|
13236
13236
|
|
|
13237
|
-
// src/
|
|
13238
|
-
function
|
|
13239
|
-
return
|
|
13240
|
-
WHEN ${HUMAN_FREE_BASE_SQL} THEN 1
|
|
13241
|
-
WHEN ${parentFlag} = 1 AND ${UNATTRIBUTED_SQL} THEN 1
|
|
13242
|
-
ELSE 0
|
|
13243
|
-
END`;
|
|
13244
|
-
}
|
|
13245
|
-
function carriesHumanFreeTag(tagsJson) {
|
|
13246
|
-
const haystack = (tagsJson ?? "[]").toLowerCase();
|
|
13247
|
-
return HUMAN_FREE_TAGS.some((tag) => haystack.includes(`"${tag}"`));
|
|
13248
|
-
}
|
|
13249
|
-
function tagWriteChangesHumanFree(previousTagsJson, nextTagsJson) {
|
|
13250
|
-
return carriesHumanFreeTag(previousTagsJson) !== carriesHumanFreeTag(nextTagsJson);
|
|
13251
|
-
}
|
|
13252
|
-
async function classifyTaskHumanFree(input) {
|
|
13253
|
-
const row = await getDbClient().get(`WITH task(taskType, tags, source, requestedByUserId, requestedByUserIdInherited, parentTaskId, workflowRunId) AS (
|
|
13254
|
-
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
13255
|
-
)
|
|
13256
|
-
SELECT ${humanFreeCase("parent.isHumanFree")} AS humanFree
|
|
13257
|
-
FROM task
|
|
13258
|
-
LEFT JOIN agent_tasks parent ON parent.id = task.parentTaskId`, [
|
|
13259
|
-
input.taskType ?? null,
|
|
13260
|
-
input.tags ?? null,
|
|
13261
|
-
input.source ?? null,
|
|
13262
|
-
input.requestedByUserId ?? null,
|
|
13263
|
-
input.requestedByUserIdInherited ? 1 : 0,
|
|
13264
|
-
input.parentTaskId ?? null,
|
|
13265
|
-
input.workflowRunId ?? null
|
|
13266
|
-
]);
|
|
13267
|
-
return row?.humanFree === 1;
|
|
13268
|
-
}
|
|
13269
|
-
function setHumanFreeQueueListener(listener) {
|
|
13270
|
-
queueListener = listener;
|
|
13271
|
-
}
|
|
13272
|
-
async function enqueueHumanFreeWork(taskIds, scope, hops) {
|
|
13273
|
-
if (taskIds.length === 0)
|
|
13274
|
-
return;
|
|
13275
|
-
if (hops > HUMAN_FREE_MAX_CONTINUATION_HOPS) {
|
|
13276
|
-
console.error(`[human-free] dropping ${taskIds.length} ${scope} continuation(s) past ${HUMAN_FREE_MAX_CONTINUATION_HOPS} hops; the task graph likely has a parent cycle`);
|
|
13277
|
-
return;
|
|
13278
|
-
}
|
|
13279
|
-
await getDbClient().run(`INSERT INTO human_free_reclassify_queue (taskId, scope, afterRowid, hops)
|
|
13280
|
-
SELECT value, ?, 0, ? FROM json_each(?) WHERE true
|
|
13281
|
-
ON CONFLICT (taskId, scope) DO UPDATE SET
|
|
13282
|
-
afterRowid = 0,
|
|
13283
|
-
hops = MAX(hops, excluded.hops)`, [scope, hops, JSON.stringify(taskIds)]);
|
|
13284
|
-
getDbClient().afterCommit(() => queueListener?.());
|
|
13285
|
-
}
|
|
13286
|
-
async function reclassifyBatch(seedTaskIds, batchSize, hops) {
|
|
13287
|
-
const client = getDbClient();
|
|
13288
|
-
const affected = (await client.query(`WITH RECURSIVE affected(id) AS (
|
|
13289
|
-
SELECT value FROM json_each(?)
|
|
13290
|
-
|
|
13291
|
-
UNION
|
|
13292
|
-
|
|
13293
|
-
SELECT task.id
|
|
13294
|
-
FROM affected
|
|
13295
|
-
JOIN agent_tasks task ON task.parentTaskId = affected.id
|
|
13296
|
-
LIMIT ?
|
|
13297
|
-
)
|
|
13298
|
-
SELECT id FROM affected`, [JSON.stringify(seedTaskIds), batchSize])).map((row) => row.id);
|
|
13299
|
-
const result = await client.run(`WITH RECURSIVE affected(id) AS (
|
|
13300
|
-
SELECT value FROM json_each(?)
|
|
13301
|
-
),
|
|
13302
|
-
free(id) AS (
|
|
13303
|
-
SELECT task.id
|
|
13304
|
-
FROM agent_tasks task
|
|
13305
|
-
LEFT JOIN agent_tasks parent ON parent.id = task.parentTaskId
|
|
13306
|
-
WHERE task.id IN (SELECT id FROM affected)
|
|
13307
|
-
AND (
|
|
13308
|
-
${HUMAN_FREE_BASE_SQL}
|
|
13309
|
-
OR (
|
|
13310
|
-
parent.isHumanFree = 1
|
|
13311
|
-
AND parent.id NOT IN (SELECT id FROM affected)
|
|
13312
|
-
AND ${UNATTRIBUTED_SQL}
|
|
13313
|
-
)
|
|
13314
|
-
)
|
|
13315
|
-
|
|
13316
|
-
UNION
|
|
13317
|
-
|
|
13318
|
-
SELECT task.id
|
|
13319
|
-
FROM free
|
|
13320
|
-
JOIN agent_tasks task ON task.parentTaskId = free.id
|
|
13321
|
-
WHERE +task.id IN (SELECT id FROM affected)
|
|
13322
|
-
AND ${UNATTRIBUTED_SQL}
|
|
13323
|
-
)
|
|
13324
|
-
UPDATE agent_tasks
|
|
13325
|
-
SET isHumanFree = CASE WHEN id IN (SELECT id FROM free) THEN 1 ELSE 0 END
|
|
13326
|
-
WHERE id IN (SELECT id FROM affected)
|
|
13327
|
-
AND isHumanFree != CASE WHEN id IN (SELECT id FROM free) THEN 1 ELSE 0 END`, [JSON.stringify(affected)]);
|
|
13328
|
-
if (affected.length >= batchSize) {
|
|
13329
|
-
const unfinished = await client.query(`WITH batch(id) AS (
|
|
13330
|
-
SELECT value FROM json_each(?)
|
|
13331
|
-
)
|
|
13332
|
-
SELECT batch.id
|
|
13333
|
-
FROM batch
|
|
13334
|
-
WHERE EXISTS (
|
|
13335
|
-
SELECT 1
|
|
13336
|
-
FROM agent_tasks child
|
|
13337
|
-
WHERE child.parentTaskId = batch.id
|
|
13338
|
-
AND child.id NOT IN (SELECT id FROM batch)
|
|
13339
|
-
)`, [JSON.stringify(affected)]);
|
|
13340
|
-
await enqueueHumanFreeWork(unfinished.map((row) => row.id), "children", hops);
|
|
13341
|
-
}
|
|
13342
|
-
return result.changes;
|
|
13343
|
-
}
|
|
13344
|
-
async function reclassifyTaskHumanFree(seedTaskIds, options = {}) {
|
|
13345
|
-
const batchSize = options.batchSize ?? HUMAN_FREE_RECLASSIFY_BATCH;
|
|
13346
|
-
const seeds = [...new Set(seedTaskIds)];
|
|
13347
|
-
if (seeds.length === 0)
|
|
13348
|
-
return 0;
|
|
13349
|
-
await enqueueHumanFreeWork(seeds.slice(batchSize), "self", 1);
|
|
13350
|
-
return await reclassifyBatch(seeds.slice(0, batchSize), batchSize, 1);
|
|
13351
|
-
}
|
|
13352
|
-
async function drainOneBatch(batchSize) {
|
|
13353
|
-
return await getDbClient().transaction(async (tx) => {
|
|
13354
|
-
const head = await tx.get("SELECT * FROM human_free_reclassify_queue ORDER BY seq LIMIT 1");
|
|
13355
|
-
if (!head)
|
|
13356
|
-
return null;
|
|
13357
|
-
if (head.scope === "self") {
|
|
13358
|
-
const rows = await tx.query("SELECT * FROM human_free_reclassify_queue WHERE scope = 'self' ORDER BY seq LIMIT ?", [batchSize]);
|
|
13359
|
-
const seeds = rows.map((row) => row.taskId);
|
|
13360
|
-
const hops = Math.max(...rows.map((row) => row.hops)) + 1;
|
|
13361
|
-
await tx.run("DELETE FROM human_free_reclassify_queue WHERE seq IN (SELECT value FROM json_each(?))", [JSON.stringify(rows.map((row) => row.seq))]);
|
|
13362
|
-
return await reclassifyBatch(seeds, batchSize, hops);
|
|
13363
|
-
}
|
|
13364
|
-
const page = await tx.query(`SELECT id, rowid AS position
|
|
13365
|
-
FROM agent_tasks
|
|
13366
|
-
WHERE parentTaskId = ? AND rowid > ?
|
|
13367
|
-
ORDER BY rowid
|
|
13368
|
-
LIMIT ?`, [head.taskId, head.afterRowid, batchSize]);
|
|
13369
|
-
if (page.length < batchSize) {
|
|
13370
|
-
await tx.run("DELETE FROM human_free_reclassify_queue WHERE seq = ?", [head.seq]);
|
|
13371
|
-
} else {
|
|
13372
|
-
await tx.run("UPDATE human_free_reclassify_queue SET afterRowid = ? WHERE seq = ?", [
|
|
13373
|
-
page[page.length - 1]?.position ?? head.afterRowid,
|
|
13374
|
-
head.seq
|
|
13375
|
-
]);
|
|
13376
|
-
}
|
|
13377
|
-
if (page.length === 0)
|
|
13378
|
-
return 0;
|
|
13379
|
-
return await reclassifyBatch(page.map((row) => row.id), batchSize, head.hops + 1);
|
|
13380
|
-
});
|
|
13237
|
+
// src/utils/vcs-repo-match.ts
|
|
13238
|
+
function normalizeVcsRepo(vcsRepo) {
|
|
13239
|
+
return vcsRepo.trim().replace(/\/+$/, "").replace(/\.git$/, "");
|
|
13381
13240
|
}
|
|
13382
|
-
|
|
13383
|
-
const
|
|
13384
|
-
return
|
|
13241
|
+
function vcsRepoName(vcsRepo) {
|
|
13242
|
+
const requested = normalizeVcsRepo(vcsRepo);
|
|
13243
|
+
return requested.split("/").pop() || requested;
|
|
13385
13244
|
}
|
|
13386
|
-
|
|
13387
|
-
const
|
|
13388
|
-
const
|
|
13389
|
-
|
|
13390
|
-
|
|
13391
|
-
|
|
13392
|
-
|
|
13393
|
-
|
|
13394
|
-
break;
|
|
13395
|
-
batches += 1;
|
|
13396
|
-
changed += batchChanged;
|
|
13397
|
-
}
|
|
13398
|
-
return { batches, changed, remaining: await pendingHumanFreeReclassifications() };
|
|
13245
|
+
function vcsRepoUrlMatches(url, vcsRepo) {
|
|
13246
|
+
const requested = normalizeVcsRepo(vcsRepo);
|
|
13247
|
+
const normalized = normalizeVcsRepo(url);
|
|
13248
|
+
if (normalized === requested)
|
|
13249
|
+
return true;
|
|
13250
|
+
if (requested.includes(":"))
|
|
13251
|
+
return false;
|
|
13252
|
+
return normalized.endsWith(`/${requested}`) || normalized.endsWith(`:${requested}`);
|
|
13399
13253
|
}
|
|
13400
|
-
var
|
|
13401
|
-
var init_human_free = __esm(() => {
|
|
13402
|
-
init_runtime();
|
|
13403
|
-
HUMAN_FREE_TAGS = ["heartbeat"];
|
|
13404
|
-
HUMAN_FREE_TAG_SQL = HUMAN_FREE_TAGS.map((tag) => `COALESCE(task.tags, '[]') LIKE '%"${tag}"%'`).join(`
|
|
13405
|
-
OR `);
|
|
13406
|
-
HUMAN_FREE_BASE_SQL = `(
|
|
13407
|
-
COALESCE(task.taskType, '') IN ('heartbeat', 'heartbeat-checklist', 'boot-triage')
|
|
13408
|
-
OR ${HUMAN_FREE_TAG_SQL}
|
|
13409
|
-
OR (COALESCE(task.source, '') = 'schedule' AND task.requestedByUserId IS NULL)
|
|
13410
|
-
OR (
|
|
13411
|
-
task.parentTaskId IS NULL
|
|
13412
|
-
AND COALESCE(task.source, '') = 'workflow'
|
|
13413
|
-
AND task.requestedByUserId IS NULL
|
|
13414
|
-
AND EXISTS (
|
|
13415
|
-
SELECT 1
|
|
13416
|
-
FROM workflow_runs run
|
|
13417
|
-
WHERE run.id = task.workflowRunId
|
|
13418
|
-
AND run.triggerType = 'schedule'
|
|
13419
|
-
AND run.created_by IS NULL
|
|
13420
|
-
)
|
|
13421
|
-
)
|
|
13422
|
-
OR (
|
|
13423
|
-
COALESCE(task.source, '') = 'system'
|
|
13424
|
-
AND parent.id IS NOT NULL
|
|
13425
|
-
AND parent.requestedByUserId IS NULL
|
|
13426
|
-
)
|
|
13427
|
-
)`;
|
|
13428
|
-
});
|
|
13254
|
+
var init_vcs_repo_match = () => {};
|
|
13429
13255
|
|
|
13430
13256
|
// src/utils/provider-metadata.ts
|
|
13431
13257
|
function parseProviderMeta(rawProvider, rawMeta) {
|
|
@@ -13526,6 +13352,8 @@ function rowToAgentTask(row) {
|
|
|
13526
13352
|
modelAlias: row.modelAlias ?? undefined,
|
|
13527
13353
|
effort: ReasoningEffortSchema.safeParse(row.effort).success ? row.effort : undefined,
|
|
13528
13354
|
resolvedEffort: ReasoningEffortSchema.safeParse(row.resolvedEffort).success ? row.resolvedEffort : undefined,
|
|
13355
|
+
profile: row.profile ?? undefined,
|
|
13356
|
+
resolvedProfile: row.resolvedProfile ?? undefined,
|
|
13529
13357
|
scheduleId: row.scheduleId ?? undefined,
|
|
13530
13358
|
workflowRunId: row.workflowRunId ?? undefined,
|
|
13531
13359
|
workflowRunStepId: row.workflowRunStepId ?? undefined,
|
|
@@ -14269,7 +14097,7 @@ async function findRecentCancelledTaskInThread(channelId, threadTs, windowMinute
|
|
|
14269
14097
|
LIMIT 1`, [channelId, threadTs, since]);
|
|
14270
14098
|
return row ? rowToAgentTask(row) : null;
|
|
14271
14099
|
}
|
|
14272
|
-
var dependencies2, TASK_PREVIEW_LENGTH = 300, TASK_PREVIEW_BYTES, TASK_PREVIEW_SQL, taskPreviewDecoder, LIST_COLUMNS, NEVER_STARTED_TASK_STATUSES, findTaskByGitHub, CHAT_RELAY_ELIGIBLE_SQL = `(obligation.last_attempt_at IS NULL
|
|
14100
|
+
var dependencies2, TASK_PREVIEW_LENGTH = 300, TASK_PREVIEW_BYTES, TASK_PREVIEW_SQL, taskPreviewDecoder, LIST_COLUMNS, SUPERSEDED_RESUME_REPAIR_WINDOW_MS, NEVER_STARTED_TASK_STATUSES, findTaskByGitHub, CHAT_RELAY_ELIGIBLE_SQL = `(obligation.last_attempt_at IS NULL
|
|
14273
14101
|
OR (julianday(?) - julianday(obligation.last_attempt_at)) * 86400000.0 >=
|
|
14274
14102
|
CASE WHEN obligation.attempt_count >= 8 THEN 600000
|
|
14275
14103
|
ELSE 3000 * (1 << obligation.attempt_count) END)`, LINEAR_TRACKER_CONTEXT_KEY_PREFIX = "task:trackers:linear:";
|
|
@@ -14299,6 +14127,7 @@ var init_read = __esm(() => {
|
|
|
14299
14127
|
agent_tasks.title, agent_tasks.status, agent_tasks.createdAt, agent_tasks.lastUpdatedAt,
|
|
14300
14128
|
agent_tasks.finishedAt, agent_tasks.peakContextTokens`
|
|
14301
14129
|
};
|
|
14130
|
+
SUPERSEDED_RESUME_REPAIR_WINDOW_MS = 24 * 60 * 60 * 1000;
|
|
14302
14131
|
NEVER_STARTED_TASK_STATUSES = [
|
|
14303
14132
|
"draft",
|
|
14304
14133
|
"backlog",
|
|
@@ -14310,6 +14139,355 @@ var init_read = __esm(() => {
|
|
|
14310
14139
|
findTaskByGitHub = findTaskByVcs;
|
|
14311
14140
|
});
|
|
14312
14141
|
|
|
14142
|
+
// src/be/db/model-profiles.ts
|
|
14143
|
+
function rowToModelProfile(row) {
|
|
14144
|
+
return {
|
|
14145
|
+
id: row.id,
|
|
14146
|
+
name: row.name,
|
|
14147
|
+
harness: ProviderNameSchema.parse(row.harness),
|
|
14148
|
+
model: row.model,
|
|
14149
|
+
effort: ReasoningEffortSchema.safeParse(row.effort).success ? row.effort : null,
|
|
14150
|
+
allowCustomModel: row.allowCustomModel === 1,
|
|
14151
|
+
description: row.description,
|
|
14152
|
+
seededFrom: row.seededFrom,
|
|
14153
|
+
createdAt: row.createdAt,
|
|
14154
|
+
lastUpdatedAt: row.lastUpdatedAt
|
|
14155
|
+
};
|
|
14156
|
+
}
|
|
14157
|
+
async function listModelProfiles(filter = {}) {
|
|
14158
|
+
const rows = filter.harness ? await getDbClient().query("SELECT * FROM model_profiles WHERE harness = ? ORDER BY harness, name", [filter.harness]) : await getDbClient().query("SELECT * FROM model_profiles ORDER BY harness, name");
|
|
14159
|
+
return rows.map(rowToModelProfile);
|
|
14160
|
+
}
|
|
14161
|
+
async function getModelProfileByName(name) {
|
|
14162
|
+
const row = await getDbClient().get("SELECT * FROM model_profiles WHERE name = ?", [name.trim()]);
|
|
14163
|
+
return row ? rowToModelProfile(row) : null;
|
|
14164
|
+
}
|
|
14165
|
+
async function createModelProfile(input, audit = {}) {
|
|
14166
|
+
const now = new Date().toISOString();
|
|
14167
|
+
const row = await getDbClient().get(`INSERT INTO model_profiles
|
|
14168
|
+
(id, name, harness, model, effort, allowCustomModel, description, seededFrom, createdAt, lastUpdatedAt, created_by, updated_by)
|
|
14169
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
14170
|
+
ON CONFLICT(name) DO NOTHING
|
|
14171
|
+
RETURNING *`, [
|
|
14172
|
+
crypto.randomUUID(),
|
|
14173
|
+
input.name,
|
|
14174
|
+
input.harness,
|
|
14175
|
+
input.model,
|
|
14176
|
+
input.effort ?? null,
|
|
14177
|
+
input.allowCustomModel ? 1 : 0,
|
|
14178
|
+
input.description ?? null,
|
|
14179
|
+
input.seededFrom ?? null,
|
|
14180
|
+
now,
|
|
14181
|
+
now,
|
|
14182
|
+
audit.userId ?? null,
|
|
14183
|
+
audit.userId ?? null
|
|
14184
|
+
]);
|
|
14185
|
+
return row ? rowToModelProfile(row) : null;
|
|
14186
|
+
}
|
|
14187
|
+
async function updateModelProfile(name, patch, audit = {}) {
|
|
14188
|
+
const sets = [];
|
|
14189
|
+
const params = [];
|
|
14190
|
+
if (patch.model !== undefined) {
|
|
14191
|
+
sets.push("model = ?");
|
|
14192
|
+
params.push(patch.model);
|
|
14193
|
+
}
|
|
14194
|
+
if (patch.effort !== undefined) {
|
|
14195
|
+
sets.push("effort = ?");
|
|
14196
|
+
params.push(patch.effort);
|
|
14197
|
+
}
|
|
14198
|
+
if (patch.allowCustomModel !== undefined) {
|
|
14199
|
+
sets.push("allowCustomModel = ?");
|
|
14200
|
+
params.push(patch.allowCustomModel ? 1 : 0);
|
|
14201
|
+
}
|
|
14202
|
+
if (patch.description !== undefined) {
|
|
14203
|
+
sets.push("description = ?");
|
|
14204
|
+
params.push(patch.description);
|
|
14205
|
+
}
|
|
14206
|
+
sets.push("lastUpdatedAt = ?", "updated_by = ?");
|
|
14207
|
+
params.push(new Date().toISOString(), audit.userId ?? null);
|
|
14208
|
+
const row = await getDbClient().get(`UPDATE model_profiles SET ${sets.join(", ")} WHERE name = ? RETURNING *`, [...params, name]);
|
|
14209
|
+
return row ? rowToModelProfile(row) : null;
|
|
14210
|
+
}
|
|
14211
|
+
function repairWindowStart() {
|
|
14212
|
+
return new Date(Date.now() - SUPERSEDED_RESUME_REPAIR_WINDOW_MS).toISOString();
|
|
14213
|
+
}
|
|
14214
|
+
async function modelProfileReferences(name) {
|
|
14215
|
+
const agents = await getDbClient().query("SELECT scopeId FROM swarm_config WHERE scope = 'agent' AND key = ? AND value = ?", [MODEL_PROFILE_CONFIG_KEY, name]);
|
|
14216
|
+
const tasks = await getDbClient().get(`SELECT COUNT(*) AS n FROM agent_tasks t WHERE t.profile = ? AND ${TASK_HOLDS_PROFILE_SQL}`, [name, repairWindowStart()]);
|
|
14217
|
+
return { agentIds: agents.map((a) => a.scopeId), openTaskCount: tasks?.n ?? 0 };
|
|
14218
|
+
}
|
|
14219
|
+
function modelProfileRefError(error2) {
|
|
14220
|
+
const message = error2 instanceof Error ? error2.message : "";
|
|
14221
|
+
return message.includes("model-profile-missing:") ? "missing" : null;
|
|
14222
|
+
}
|
|
14223
|
+
async function deleteModelProfile(name) {
|
|
14224
|
+
const row = await getDbClient().get(`DELETE FROM model_profiles
|
|
14225
|
+
WHERE name = ?
|
|
14226
|
+
AND NOT EXISTS (
|
|
14227
|
+
SELECT 1 FROM agent_tasks t
|
|
14228
|
+
WHERE t.profile = model_profiles.name AND ${TASK_HOLDS_PROFILE_SQL})
|
|
14229
|
+
AND NOT EXISTS (
|
|
14230
|
+
SELECT 1 FROM swarm_config
|
|
14231
|
+
WHERE scope = 'agent' AND key = ? AND trim(value) = model_profiles.name)
|
|
14232
|
+
RETURNING id`, [name, repairWindowStart(), MODEL_PROFILE_CONFIG_KEY]);
|
|
14233
|
+
if (row)
|
|
14234
|
+
return "deleted";
|
|
14235
|
+
return await getModelProfileByName(name) ? "in-use" : "missing";
|
|
14236
|
+
}
|
|
14237
|
+
async function getAgentDefaultProfileName(agentId) {
|
|
14238
|
+
const row = await getDbClient().get("SELECT value FROM swarm_config WHERE scope = 'agent' AND scopeId = ? AND key = ?", [agentId, MODEL_PROFILE_CONFIG_KEY]);
|
|
14239
|
+
return row?.value.trim() || null;
|
|
14240
|
+
}
|
|
14241
|
+
async function repoModelOverrideKeys(vcsRepo, { includeSecrets = true } = {}) {
|
|
14242
|
+
if (!vcsRepo?.trim())
|
|
14243
|
+
return new Set;
|
|
14244
|
+
const repos = await getDbClient().query("SELECT id, url FROM swarm_repos WHERE name = ? ORDER BY name ASC", [vcsRepoName(vcsRepo)]);
|
|
14245
|
+
const repo = repos.find((r) => vcsRepoUrlMatches(r.url, vcsRepo));
|
|
14246
|
+
if (!repo)
|
|
14247
|
+
return new Set;
|
|
14248
|
+
const rows = await getDbClient().query(`SELECT key FROM swarm_config
|
|
14249
|
+
WHERE scope = 'repo' AND scopeId = ? AND key IN ('MODEL_OVERRIDE', 'REASONING_EFFORT_OVERRIDE')
|
|
14250
|
+
${includeSecrets ? "" : "AND isSecret = 0"}`, [repo.id]);
|
|
14251
|
+
return new Set(rows.map((row) => row.key));
|
|
14252
|
+
}
|
|
14253
|
+
async function taskProfileError(check) {
|
|
14254
|
+
const name = check.profile?.trim();
|
|
14255
|
+
if (!name)
|
|
14256
|
+
return null;
|
|
14257
|
+
if (check.model?.trim() || check.modelTier?.trim()) {
|
|
14258
|
+
return "Pass `profile`, or `model`/`modelTier`, not both.";
|
|
14259
|
+
}
|
|
14260
|
+
const profile = await getModelProfileByName(name);
|
|
14261
|
+
if (!profile) {
|
|
14262
|
+
return `Unknown model profile "${name}". List profiles with list-model-profiles.`;
|
|
14263
|
+
}
|
|
14264
|
+
if (!check.agentId)
|
|
14265
|
+
return null;
|
|
14266
|
+
const agent = await getDbClient().get("SELECT COALESCE(harness_provider, provider) AS harness FROM agents WHERE id = ?", [check.agentId]);
|
|
14267
|
+
if (agent?.harness && agent.harness !== profile.harness) {
|
|
14268
|
+
return `Model profile "${name}" runs on the ${profile.harness} harness; the target agent runs ${agent.harness}.`;
|
|
14269
|
+
}
|
|
14270
|
+
return null;
|
|
14271
|
+
}
|
|
14272
|
+
function effectiveOverride(row) {
|
|
14273
|
+
if (!row)
|
|
14274
|
+
return null;
|
|
14275
|
+
return row.exportToEnv === 0 ? "\x00withheld" : row.value;
|
|
14276
|
+
}
|
|
14277
|
+
async function clearAgentModelProfileOnOverrideChange(agentId, key, before, after) {
|
|
14278
|
+
if (key !== "MODEL_OVERRIDE" && key !== "REASONING_EFFORT_OVERRIDE")
|
|
14279
|
+
return;
|
|
14280
|
+
if (effectiveOverride(before) === effectiveOverride(after))
|
|
14281
|
+
return;
|
|
14282
|
+
await getDbClient().run("DELETE FROM swarm_config WHERE scope = 'agent' AND scopeId = ? AND key = ?", [agentId, MODEL_PROFILE_CONFIG_KEY]);
|
|
14283
|
+
}
|
|
14284
|
+
var MODEL_PROFILE_CONFIG_KEY = "MODEL_PROFILE", TASK_HOLDS_PROFILE_SQL = `(
|
|
14285
|
+
t.status NOT IN ('completed', 'failed', 'cancelled', 'superseded')
|
|
14286
|
+
OR (t.status = 'superseded'
|
|
14287
|
+
AND t.workflowRunStepId IS NULL
|
|
14288
|
+
AND (t.finishedAt IS NULL OR t.finishedAt > ?)
|
|
14289
|
+
AND NOT EXISTS (
|
|
14290
|
+
SELECT 1 FROM agent_tasks c WHERE c.parentTaskId = t.id AND c.taskType = 'resume')))`;
|
|
14291
|
+
var init_model_profiles = __esm(() => {
|
|
14292
|
+
init_types();
|
|
14293
|
+
init_vcs_repo_match();
|
|
14294
|
+
init_runtime();
|
|
14295
|
+
init_read();
|
|
14296
|
+
});
|
|
14297
|
+
|
|
14298
|
+
// src/be/db/tasks/human-free.ts
|
|
14299
|
+
function humanFreeCase(parentFlag) {
|
|
14300
|
+
return `CASE
|
|
14301
|
+
WHEN ${HUMAN_FREE_BASE_SQL} THEN 1
|
|
14302
|
+
WHEN ${parentFlag} = 1 AND ${UNATTRIBUTED_SQL} THEN 1
|
|
14303
|
+
ELSE 0
|
|
14304
|
+
END`;
|
|
14305
|
+
}
|
|
14306
|
+
function carriesHumanFreeTag(tagsJson) {
|
|
14307
|
+
const haystack = (tagsJson ?? "[]").toLowerCase();
|
|
14308
|
+
return HUMAN_FREE_TAGS.some((tag) => haystack.includes(`"${tag}"`));
|
|
14309
|
+
}
|
|
14310
|
+
function tagWriteChangesHumanFree(previousTagsJson, nextTagsJson) {
|
|
14311
|
+
return carriesHumanFreeTag(previousTagsJson) !== carriesHumanFreeTag(nextTagsJson);
|
|
14312
|
+
}
|
|
14313
|
+
async function classifyTaskHumanFree(input) {
|
|
14314
|
+
const row = await getDbClient().get(`WITH task(taskType, tags, source, requestedByUserId, requestedByUserIdInherited, parentTaskId, workflowRunId) AS (
|
|
14315
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
14316
|
+
)
|
|
14317
|
+
SELECT ${humanFreeCase("parent.isHumanFree")} AS humanFree
|
|
14318
|
+
FROM task
|
|
14319
|
+
LEFT JOIN agent_tasks parent ON parent.id = task.parentTaskId`, [
|
|
14320
|
+
input.taskType ?? null,
|
|
14321
|
+
input.tags ?? null,
|
|
14322
|
+
input.source ?? null,
|
|
14323
|
+
input.requestedByUserId ?? null,
|
|
14324
|
+
input.requestedByUserIdInherited ? 1 : 0,
|
|
14325
|
+
input.parentTaskId ?? null,
|
|
14326
|
+
input.workflowRunId ?? null
|
|
14327
|
+
]);
|
|
14328
|
+
return row?.humanFree === 1;
|
|
14329
|
+
}
|
|
14330
|
+
function setHumanFreeQueueListener(listener) {
|
|
14331
|
+
queueListener = listener;
|
|
14332
|
+
}
|
|
14333
|
+
async function enqueueHumanFreeWork(taskIds, scope, hops) {
|
|
14334
|
+
if (taskIds.length === 0)
|
|
14335
|
+
return;
|
|
14336
|
+
if (hops > HUMAN_FREE_MAX_CONTINUATION_HOPS) {
|
|
14337
|
+
console.error(`[human-free] dropping ${taskIds.length} ${scope} continuation(s) past ${HUMAN_FREE_MAX_CONTINUATION_HOPS} hops; the task graph likely has a parent cycle`);
|
|
14338
|
+
return;
|
|
14339
|
+
}
|
|
14340
|
+
await getDbClient().run(`INSERT INTO human_free_reclassify_queue (taskId, scope, afterRowid, hops)
|
|
14341
|
+
SELECT value, ?, 0, ? FROM json_each(?) WHERE true
|
|
14342
|
+
ON CONFLICT (taskId, scope) DO UPDATE SET
|
|
14343
|
+
afterRowid = 0,
|
|
14344
|
+
hops = MAX(hops, excluded.hops)`, [scope, hops, JSON.stringify(taskIds)]);
|
|
14345
|
+
getDbClient().afterCommit(() => queueListener?.());
|
|
14346
|
+
}
|
|
14347
|
+
async function reclassifyBatch(seedTaskIds, batchSize, hops) {
|
|
14348
|
+
const client = getDbClient();
|
|
14349
|
+
const affected = (await client.query(`WITH RECURSIVE affected(id) AS (
|
|
14350
|
+
SELECT value FROM json_each(?)
|
|
14351
|
+
|
|
14352
|
+
UNION
|
|
14353
|
+
|
|
14354
|
+
SELECT task.id
|
|
14355
|
+
FROM affected
|
|
14356
|
+
JOIN agent_tasks task ON task.parentTaskId = affected.id
|
|
14357
|
+
LIMIT ?
|
|
14358
|
+
)
|
|
14359
|
+
SELECT id FROM affected`, [JSON.stringify(seedTaskIds), batchSize])).map((row) => row.id);
|
|
14360
|
+
const result = await client.run(`WITH RECURSIVE affected(id) AS (
|
|
14361
|
+
SELECT value FROM json_each(?)
|
|
14362
|
+
),
|
|
14363
|
+
free(id) AS (
|
|
14364
|
+
SELECT task.id
|
|
14365
|
+
FROM agent_tasks task
|
|
14366
|
+
LEFT JOIN agent_tasks parent ON parent.id = task.parentTaskId
|
|
14367
|
+
WHERE task.id IN (SELECT id FROM affected)
|
|
14368
|
+
AND (
|
|
14369
|
+
${HUMAN_FREE_BASE_SQL}
|
|
14370
|
+
OR (
|
|
14371
|
+
parent.isHumanFree = 1
|
|
14372
|
+
AND parent.id NOT IN (SELECT id FROM affected)
|
|
14373
|
+
AND ${UNATTRIBUTED_SQL}
|
|
14374
|
+
)
|
|
14375
|
+
)
|
|
14376
|
+
|
|
14377
|
+
UNION
|
|
14378
|
+
|
|
14379
|
+
SELECT task.id
|
|
14380
|
+
FROM free
|
|
14381
|
+
JOIN agent_tasks task ON task.parentTaskId = free.id
|
|
14382
|
+
WHERE +task.id IN (SELECT id FROM affected)
|
|
14383
|
+
AND ${UNATTRIBUTED_SQL}
|
|
14384
|
+
)
|
|
14385
|
+
UPDATE agent_tasks
|
|
14386
|
+
SET isHumanFree = CASE WHEN id IN (SELECT id FROM free) THEN 1 ELSE 0 END
|
|
14387
|
+
WHERE id IN (SELECT id FROM affected)
|
|
14388
|
+
AND isHumanFree != CASE WHEN id IN (SELECT id FROM free) THEN 1 ELSE 0 END`, [JSON.stringify(affected)]);
|
|
14389
|
+
if (affected.length >= batchSize) {
|
|
14390
|
+
const unfinished = await client.query(`WITH batch(id) AS (
|
|
14391
|
+
SELECT value FROM json_each(?)
|
|
14392
|
+
)
|
|
14393
|
+
SELECT batch.id
|
|
14394
|
+
FROM batch
|
|
14395
|
+
WHERE EXISTS (
|
|
14396
|
+
SELECT 1
|
|
14397
|
+
FROM agent_tasks child
|
|
14398
|
+
WHERE child.parentTaskId = batch.id
|
|
14399
|
+
AND child.id NOT IN (SELECT id FROM batch)
|
|
14400
|
+
)`, [JSON.stringify(affected)]);
|
|
14401
|
+
await enqueueHumanFreeWork(unfinished.map((row) => row.id), "children", hops);
|
|
14402
|
+
}
|
|
14403
|
+
return result.changes;
|
|
14404
|
+
}
|
|
14405
|
+
async function reclassifyTaskHumanFree(seedTaskIds, options = {}) {
|
|
14406
|
+
const batchSize = options.batchSize ?? HUMAN_FREE_RECLASSIFY_BATCH;
|
|
14407
|
+
const seeds = [...new Set(seedTaskIds)];
|
|
14408
|
+
if (seeds.length === 0)
|
|
14409
|
+
return 0;
|
|
14410
|
+
await enqueueHumanFreeWork(seeds.slice(batchSize), "self", 1);
|
|
14411
|
+
return await reclassifyBatch(seeds.slice(0, batchSize), batchSize, 1);
|
|
14412
|
+
}
|
|
14413
|
+
async function drainOneBatch(batchSize) {
|
|
14414
|
+
return await getDbClient().transaction(async (tx) => {
|
|
14415
|
+
const head = await tx.get("SELECT * FROM human_free_reclassify_queue ORDER BY seq LIMIT 1");
|
|
14416
|
+
if (!head)
|
|
14417
|
+
return null;
|
|
14418
|
+
if (head.scope === "self") {
|
|
14419
|
+
const rows = await tx.query("SELECT * FROM human_free_reclassify_queue WHERE scope = 'self' ORDER BY seq LIMIT ?", [batchSize]);
|
|
14420
|
+
const seeds = rows.map((row) => row.taskId);
|
|
14421
|
+
const hops = Math.max(...rows.map((row) => row.hops)) + 1;
|
|
14422
|
+
await tx.run("DELETE FROM human_free_reclassify_queue WHERE seq IN (SELECT value FROM json_each(?))", [JSON.stringify(rows.map((row) => row.seq))]);
|
|
14423
|
+
return await reclassifyBatch(seeds, batchSize, hops);
|
|
14424
|
+
}
|
|
14425
|
+
const page = await tx.query(`SELECT id, rowid AS position
|
|
14426
|
+
FROM agent_tasks
|
|
14427
|
+
WHERE parentTaskId = ? AND rowid > ?
|
|
14428
|
+
ORDER BY rowid
|
|
14429
|
+
LIMIT ?`, [head.taskId, head.afterRowid, batchSize]);
|
|
14430
|
+
if (page.length < batchSize) {
|
|
14431
|
+
await tx.run("DELETE FROM human_free_reclassify_queue WHERE seq = ?", [head.seq]);
|
|
14432
|
+
} else {
|
|
14433
|
+
await tx.run("UPDATE human_free_reclassify_queue SET afterRowid = ? WHERE seq = ?", [
|
|
14434
|
+
page[page.length - 1]?.position ?? head.afterRowid,
|
|
14435
|
+
head.seq
|
|
14436
|
+
]);
|
|
14437
|
+
}
|
|
14438
|
+
if (page.length === 0)
|
|
14439
|
+
return 0;
|
|
14440
|
+
return await reclassifyBatch(page.map((row) => row.id), batchSize, head.hops + 1);
|
|
14441
|
+
});
|
|
14442
|
+
}
|
|
14443
|
+
async function pendingHumanFreeReclassifications() {
|
|
14444
|
+
const row = await getDbClient().get("SELECT COUNT(*) AS count FROM human_free_reclassify_queue");
|
|
14445
|
+
return row?.count ?? 0;
|
|
14446
|
+
}
|
|
14447
|
+
async function drainHumanFreeReclassifyQueue(options = {}) {
|
|
14448
|
+
const batchSize = options.batchSize ?? HUMAN_FREE_RECLASSIFY_BATCH;
|
|
14449
|
+
const maxBatches = options.maxBatches ?? Number.POSITIVE_INFINITY;
|
|
14450
|
+
let batches = 0;
|
|
14451
|
+
let changed = 0;
|
|
14452
|
+
while (batches < maxBatches) {
|
|
14453
|
+
const batchChanged = await drainOneBatch(batchSize);
|
|
14454
|
+
if (batchChanged === null)
|
|
14455
|
+
break;
|
|
14456
|
+
batches += 1;
|
|
14457
|
+
changed += batchChanged;
|
|
14458
|
+
}
|
|
14459
|
+
return { batches, changed, remaining: await pendingHumanFreeReclassifications() };
|
|
14460
|
+
}
|
|
14461
|
+
var HUMAN_FREE_TAGS, HUMAN_FREE_TAG_SQL, HUMAN_FREE_BASE_SQL, UNATTRIBUTED_SQL = "(task.requestedByUserId IS NULL OR task.requestedByUserIdInherited = 1)", HUMAN_FREE_RECLASSIFY_BATCH = 500, HUMAN_FREE_MAX_CONTINUATION_HOPS = 1e4, queueListener;
|
|
14462
|
+
var init_human_free = __esm(() => {
|
|
14463
|
+
init_runtime();
|
|
14464
|
+
HUMAN_FREE_TAGS = ["heartbeat"];
|
|
14465
|
+
HUMAN_FREE_TAG_SQL = HUMAN_FREE_TAGS.map((tag) => `COALESCE(task.tags, '[]') LIKE '%"${tag}"%'`).join(`
|
|
14466
|
+
OR `);
|
|
14467
|
+
HUMAN_FREE_BASE_SQL = `(
|
|
14468
|
+
COALESCE(task.taskType, '') IN ('heartbeat', 'heartbeat-checklist', 'boot-triage')
|
|
14469
|
+
OR ${HUMAN_FREE_TAG_SQL}
|
|
14470
|
+
OR (COALESCE(task.source, '') = 'schedule' AND task.requestedByUserId IS NULL)
|
|
14471
|
+
OR (
|
|
14472
|
+
task.parentTaskId IS NULL
|
|
14473
|
+
AND COALESCE(task.source, '') = 'workflow'
|
|
14474
|
+
AND task.requestedByUserId IS NULL
|
|
14475
|
+
AND EXISTS (
|
|
14476
|
+
SELECT 1
|
|
14477
|
+
FROM workflow_runs run
|
|
14478
|
+
WHERE run.id = task.workflowRunId
|
|
14479
|
+
AND run.triggerType = 'schedule'
|
|
14480
|
+
AND run.created_by IS NULL
|
|
14481
|
+
)
|
|
14482
|
+
)
|
|
14483
|
+
OR (
|
|
14484
|
+
COALESCE(task.source, '') = 'system'
|
|
14485
|
+
AND parent.id IS NOT NULL
|
|
14486
|
+
AND parent.requestedByUserId IS NULL
|
|
14487
|
+
)
|
|
14488
|
+
)`;
|
|
14489
|
+
});
|
|
14490
|
+
|
|
14313
14491
|
// src/be/task-lifecycle-events.ts
|
|
14314
14492
|
function onTaskStarted(handler) {
|
|
14315
14493
|
taskStartedHandlers.push(handler);
|
|
@@ -14632,7 +14810,7 @@ async function completeTask(id, output, options) {
|
|
|
14632
14810
|
});
|
|
14633
14811
|
} catch {}
|
|
14634
14812
|
getDbClient().afterCommit(() => {
|
|
14635
|
-
import("./event-bus-
|
|
14813
|
+
import("./event-bus-j2jdg3qb.js").then(({ workflowEventBus }) => {
|
|
14636
14814
|
workflowEventBus.emit("task.completed", {
|
|
14637
14815
|
taskId: id,
|
|
14638
14816
|
output: scrubbedOutput,
|
|
@@ -14687,7 +14865,7 @@ async function failTask(id, reason, opts = {}) {
|
|
|
14687
14865
|
});
|
|
14688
14866
|
} catch {}
|
|
14689
14867
|
getDbClient().afterCommit(() => {
|
|
14690
|
-
import("./event-bus-
|
|
14868
|
+
import("./event-bus-j2jdg3qb.js").then(({ workflowEventBus }) => {
|
|
14691
14869
|
workflowEventBus.emit("task.failed", {
|
|
14692
14870
|
taskId: id,
|
|
14693
14871
|
failureReason: scrubbedReason,
|
|
@@ -14769,7 +14947,7 @@ async function cancelTask(id, reason) {
|
|
|
14769
14947
|
});
|
|
14770
14948
|
} catch {}
|
|
14771
14949
|
getDbClient().afterCommit(() => {
|
|
14772
|
-
import("./event-bus-
|
|
14950
|
+
import("./event-bus-j2jdg3qb.js").then(({ workflowEventBus }) => {
|
|
14773
14951
|
workflowEventBus.emit("task.cancelled", {
|
|
14774
14952
|
taskId: id,
|
|
14775
14953
|
agentId: row.agentId,
|
|
@@ -14826,7 +15004,7 @@ async function supersedeTask(id, args) {
|
|
|
14826
15004
|
});
|
|
14827
15005
|
} catch {}
|
|
14828
15006
|
getDbClient().afterCommit(() => {
|
|
14829
|
-
import("./event-bus-
|
|
15007
|
+
import("./event-bus-j2jdg3qb.js").then(({ workflowEventBus }) => {
|
|
14830
15008
|
workflowEventBus.emit("task.superseded", {
|
|
14831
15009
|
taskId: id,
|
|
14832
15010
|
reason: args.reason,
|
|
@@ -15038,7 +15216,7 @@ async function updateTaskProgress(id, progress) {
|
|
|
15038
15216
|
});
|
|
15039
15217
|
} catch {}
|
|
15040
15218
|
getDbClient().afterCommit(() => {
|
|
15041
|
-
import("./event-bus-
|
|
15219
|
+
import("./event-bus-j2jdg3qb.js").then(({ workflowEventBus }) => {
|
|
15042
15220
|
workflowEventBus.emit("task.progress", {
|
|
15043
15221
|
taskId: id,
|
|
15044
15222
|
progress: scrubbedProgress,
|
|
@@ -15109,7 +15287,7 @@ function emitChildRunFinished(childRunId, parentStepId, status) {
|
|
|
15109
15287
|
}
|
|
15110
15288
|
function emitAfterCommit(childRunId, parentStepId) {
|
|
15111
15289
|
getDbClient().afterCommit(() => {
|
|
15112
|
-
import("./event-bus-
|
|
15290
|
+
import("./event-bus-j2jdg3qb.js").then(({ workflowEventBus }) => {
|
|
15113
15291
|
workflowEventBus.emit("workflow.child.finished", { childRunId, parentStepId });
|
|
15114
15292
|
}).catch((err) => console.error("[db] workflow.child.finished event not emitted:", scrubSecrets(err instanceof Error ? err.message : String(err))));
|
|
15115
15293
|
});
|
|
@@ -15321,7 +15499,11 @@ function reactionName(event) {
|
|
|
15321
15499
|
const normalized = normalizeSlackReactionShortcode(raw);
|
|
15322
15500
|
return normalized ?? SLACK_REACTION_DEFAULTS[event];
|
|
15323
15501
|
}
|
|
15324
|
-
|
|
15502
|
+
function completedStatusIcon() {
|
|
15503
|
+
const normalized = normalizeSlackReactionShortcode(process.env[SLACK_STATUS_ICON_COMPLETED_KEY]);
|
|
15504
|
+
return normalized ? `:${normalized}:` : SLACK_STATUS_ICON_COMPLETED_DEFAULT;
|
|
15505
|
+
}
|
|
15506
|
+
var SLACK_REACTION_DEFAULTS, SLACK_REACTION_CONFIG_KEYS, SLACK_REACTION_SHORTCODE_PATTERN, SLACK_STATUS_ICON_COMPLETED_KEY = "SLACK_STATUS_ICON_COMPLETED", SLACK_STATUS_ICON_COMPLETED_DEFAULT = "✅";
|
|
15325
15507
|
var init_reaction_shortcode = __esm(() => {
|
|
15326
15508
|
SLACK_REACTION_DEFAULTS = {
|
|
15327
15509
|
accepted: "eyes",
|
|
@@ -15744,7 +15926,8 @@ var init_swarm_config_guard = __esm(() => {
|
|
|
15744
15926
|
"SLACK_REACTION_NOW",
|
|
15745
15927
|
"SLACK_REACTION_STEERED",
|
|
15746
15928
|
"SLACK_REACTION_COMPLETED",
|
|
15747
|
-
"SLACK_REACTION_FAILED"
|
|
15929
|
+
"SLACK_REACTION_FAILED",
|
|
15930
|
+
"SLACK_STATUS_ICON_COMPLETED"
|
|
15748
15931
|
]),
|
|
15749
15932
|
...integerValidators([
|
|
15750
15933
|
"HEARTBEAT_INTERVAL_MS",
|
|
@@ -16954,9 +17137,13 @@ function encodedForms(value) {
|
|
|
16954
17137
|
function registerStoredSecret(value, name) {
|
|
16955
17138
|
if (!value)
|
|
16956
17139
|
return;
|
|
16957
|
-
|
|
16958
|
-
|
|
16959
|
-
|
|
17140
|
+
for (const candidate of new Set([value, value.trim()])) {
|
|
17141
|
+
if (!candidate)
|
|
17142
|
+
continue;
|
|
17143
|
+
registerVolatileSecret(candidate, name);
|
|
17144
|
+
for (const form of encodedForms(candidate))
|
|
17145
|
+
registerVolatileSecret(form, name);
|
|
17146
|
+
}
|
|
16960
17147
|
}
|
|
16961
17148
|
async function loadSecretRegistry() {
|
|
16962
17149
|
const result = {
|
|
@@ -16995,7 +17182,7 @@ async function loadSecretRegistry() {
|
|
|
16995
17182
|
result.failed += 1;
|
|
16996
17183
|
}
|
|
16997
17184
|
try {
|
|
16998
|
-
const { loadRuntimeControllerSecrets } = await import("./db-
|
|
17185
|
+
const { loadRuntimeControllerSecrets } = await import("./db-ncypk9np.js");
|
|
16999
17186
|
const loaded = await loadRuntimeControllerSecrets();
|
|
17000
17187
|
result.runtimeController = loaded.count;
|
|
17001
17188
|
result.failed += loaded.failed;
|
|
@@ -17290,6 +17477,7 @@ __export(exports_db, {
|
|
|
17290
17477
|
ReservedAgentRoleError: () => ReservedAgentRoleError,
|
|
17291
17478
|
SESSION_ACTIVITY_REFRESH_MIN_INTERVAL_MS: () => SESSION_ACTIVITY_REFRESH_MIN_INTERVAL_MS,
|
|
17292
17479
|
SKILL_FILE_LIMITS: () => SKILL_FILE_LIMITS,
|
|
17480
|
+
SUPERSEDED_RESUME_REPAIR_WINDOW_MS: () => SUPERSEDED_RESUME_REPAIR_WINDOW_MS,
|
|
17293
17481
|
UNATTRIBUTED_USER_ID: () => UNATTRIBUTED_USER_ID,
|
|
17294
17482
|
__resetSqliteVecExtensionPathCacheForTests: () => __resetSqliteVecExtensionPathCacheForTests,
|
|
17295
17483
|
abandonSlackOutcomeDelivery: () => abandonSlackOutcomeDelivery,
|
|
@@ -19195,9 +19383,9 @@ async function createTaskExtended(task, options) {
|
|
|
19195
19383
|
vcsProvider, vcsRepo, vcsEventType, vcsNumber, vcsCommentId, vcsAuthor, vcsUrl,
|
|
19196
19384
|
vcsInstallationId, vcsNodeId,
|
|
19197
19385
|
agentmailInboxId, agentmailMessageId, agentmailThreadId,
|
|
19198
|
-
mentionMessageId, mentionChannelId, dir, parentTaskId, model, modelTier, effort, scheduleId,
|
|
19386
|
+
mentionMessageId, mentionChannelId, dir, parentTaskId, model, modelTier, effort, profile, scheduleId,
|
|
19199
19387
|
workflowRunId, workflowRunStepId, outputSchema, followUpConfig, requestedByUserId, requestedByUserIdInherited, contextKey, routingAffinity, swarmVersion, createdAt, lastUpdatedAt, created_by, updated_by, isHumanFree
|
|
19200
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`, [
|
|
19388
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`, [
|
|
19201
19389
|
id,
|
|
19202
19390
|
assetKey,
|
|
19203
19391
|
options?.agentId ?? null,
|
|
@@ -19237,6 +19425,7 @@ async function createTaskExtended(task, options) {
|
|
|
19237
19425
|
options?.model ?? null,
|
|
19238
19426
|
options?.modelTier ?? null,
|
|
19239
19427
|
options?.effort ?? null,
|
|
19428
|
+
options?.profile?.trim() || null,
|
|
19240
19429
|
options?.scheduleId ?? null,
|
|
19241
19430
|
options?.workflowRunId ?? null,
|
|
19242
19431
|
options?.workflowRunStepId ?? null,
|
|
@@ -19302,7 +19491,7 @@ async function createTaskExtended(task, options) {
|
|
|
19302
19491
|
priority: row.priority
|
|
19303
19492
|
}, (task2) => task2 !== null, row.requestedByUserId);
|
|
19304
19493
|
getDbClient().afterCommit(() => {
|
|
19305
|
-
import("./event-bus-
|
|
19494
|
+
import("./event-bus-j2jdg3qb.js").then(({ workflowEventBus }) => {
|
|
19306
19495
|
workflowEventBus.emit("task.created", {
|
|
19307
19496
|
taskId: row.id,
|
|
19308
19497
|
task: row.task,
|
|
@@ -19384,7 +19573,7 @@ async function releaseTask(taskId, wakeSnapshot) {
|
|
|
19384
19573
|
} catch {}
|
|
19385
19574
|
if (isRuntimePoolsEnabled() && !wakeSnapshot)
|
|
19386
19575
|
getDbClient().afterCommit(() => {
|
|
19387
|
-
import("./event-bus-
|
|
19576
|
+
import("./event-bus-j2jdg3qb.js").then(({ workflowEventBus }) => workflowEventBus.emit("task.unassigned", { taskId })).catch((error2) => console.error("[db] Routing event failed:", scrubSecrets(String(error2))));
|
|
19388
19577
|
});
|
|
19389
19578
|
}
|
|
19390
19579
|
return row ? rowToAgentTask(row) : null;
|
|
@@ -19454,7 +19643,7 @@ async function rejectTask(taskId, agentId, reason) {
|
|
|
19454
19643
|
} catch {}
|
|
19455
19644
|
if (isRuntimePoolsEnabled())
|
|
19456
19645
|
getDbClient().afterCommit(() => {
|
|
19457
|
-
import("./event-bus-
|
|
19646
|
+
import("./event-bus-j2jdg3qb.js").then(({ workflowEventBus }) => workflowEventBus.emit("task.unassigned", { taskId })).catch((error2) => console.error("[db] Routing event failed:", scrubSecrets(String(error2))));
|
|
19458
19647
|
});
|
|
19459
19648
|
}
|
|
19460
19649
|
return row ? rowToAgentTask(row) : null;
|
|
@@ -21296,27 +21485,22 @@ async function upsertSwarmConfig(data) {
|
|
|
21296
21485
|
const storedValue = data.isSecret ? encryptSecret(data.value, getEncryptionKey()) : data.value;
|
|
21297
21486
|
const encryptedFlag = data.isSecret ? 1 : 0;
|
|
21298
21487
|
const row = await getDbClient().transaction(async () => {
|
|
21299
|
-
const existing = scopeId === null ? await getDbClient().get("SELECT
|
|
21300
|
-
|
|
21301
|
-
|
|
21302
|
-
|
|
21303
|
-
|
|
21304
|
-
|
|
21305
|
-
|
|
21306
|
-
|
|
21307
|
-
|
|
21308
|
-
|
|
21309
|
-
|
|
21310
|
-
|
|
21311
|
-
|
|
21312
|
-
|
|
21313
|
-
|
|
21314
|
-
|
|
21315
|
-
const id = crypto.randomUUID();
|
|
21316
|
-
const exportToEnv = restricted ? 0 : data.exportToEnv ?? defaultExportToEnv(data.key) ? 1 : 0;
|
|
21317
|
-
return await getDbClient().get(`INSERT INTO swarm_config (id, scope, scopeId, key, value, isSecret, envPath, description, createdAt, lastUpdatedAt, encrypted, exportToEnv)
|
|
21318
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`, [
|
|
21319
|
-
id,
|
|
21488
|
+
const existing = scopeId === null ? await getDbClient().get("SELECT * FROM swarm_config WHERE scope = ? AND scopeId IS NULL AND key = ?", [data.scope, data.key]) : await getDbClient().get("SELECT * FROM swarm_config WHERE scope = ? AND scopeId = ? AND key = ?", [data.scope, scopeId, data.key]);
|
|
21489
|
+
const written = existing ? await getDbClient().get(`UPDATE swarm_config SET value = ?, isSecret = ?, envPath = ?, description = ?, encrypted = ?, lastUpdatedAt = ?,
|
|
21490
|
+
exportToEnv = CASE WHEN ? THEN 0 ELSE COALESCE(?, exportToEnv) END
|
|
21491
|
+
WHERE id = ? RETURNING *`, [
|
|
21492
|
+
storedValue,
|
|
21493
|
+
isSecret,
|
|
21494
|
+
envPath,
|
|
21495
|
+
description,
|
|
21496
|
+
encryptedFlag,
|
|
21497
|
+
now,
|
|
21498
|
+
restricted ? 1 : 0,
|
|
21499
|
+
data.exportToEnv === undefined ? null : data.exportToEnv ? 1 : 0,
|
|
21500
|
+
existing.id
|
|
21501
|
+
]) : await getDbClient().get(`INSERT INTO swarm_config (id, scope, scopeId, key, value, isSecret, envPath, description, createdAt, lastUpdatedAt, encrypted, exportToEnv)
|
|
21502
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`, [
|
|
21503
|
+
crypto.randomUUID(),
|
|
21320
21504
|
data.scope,
|
|
21321
21505
|
scopeId,
|
|
21322
21506
|
data.key,
|
|
@@ -21327,8 +21511,12 @@ async function upsertSwarmConfig(data) {
|
|
|
21327
21511
|
now,
|
|
21328
21512
|
now,
|
|
21329
21513
|
encryptedFlag,
|
|
21330
|
-
exportToEnv
|
|
21514
|
+
restricted ? 0 : data.exportToEnv ?? defaultExportToEnv(data.key) ? 1 : 0
|
|
21331
21515
|
]);
|
|
21516
|
+
if (data.scope === "agent" && scopeId) {
|
|
21517
|
+
await clearAgentModelProfileOnOverrideChange(scopeId, data.key, existing, written);
|
|
21518
|
+
}
|
|
21519
|
+
return written;
|
|
21332
21520
|
});
|
|
21333
21521
|
if (!row)
|
|
21334
21522
|
throw new Error("Failed to upsert swarm config");
|
|
@@ -21358,7 +21546,10 @@ async function emitBuiltInIntegrationConnectedOnce(provider) {
|
|
|
21358
21546
|
} catch {}
|
|
21359
21547
|
}
|
|
21360
21548
|
async function deleteSwarmConfig(id) {
|
|
21361
|
-
const row = await getDbClient().get("DELETE FROM swarm_config WHERE id = ? RETURNING
|
|
21549
|
+
const row = await getDbClient().get("DELETE FROM swarm_config WHERE id = ? RETURNING *", [id]);
|
|
21550
|
+
if (row?.scope === "agent" && row.scopeId) {
|
|
21551
|
+
await clearAgentModelProfileOnOverrideChange(row.scopeId, row.key, row, null);
|
|
21552
|
+
}
|
|
21362
21553
|
if (row)
|
|
21363
21554
|
getDbClient().afterCommit(() => publishWorkerConfigNudge(row.scope, row.scopeId));
|
|
21364
21555
|
return row !== null;
|
|
@@ -25417,6 +25608,7 @@ var init_db2 = __esm(() => {
|
|
|
25417
25608
|
init_agents();
|
|
25418
25609
|
init_approvals();
|
|
25419
25610
|
init_context_versions();
|
|
25611
|
+
init_model_profiles();
|
|
25420
25612
|
init_runtime();
|
|
25421
25613
|
init_human_free();
|
|
25422
25614
|
init_read();
|
|
@@ -26610,4 +26802,4 @@ function getMemoryStore() {
|
|
|
26610
26802
|
var embeddingProvider2 = null, memoryStore = null;
|
|
26611
26803
|
var init_memory = () => {};
|
|
26612
26804
|
|
|
26613
|
-
export { slackContextKey, chatSdkContextKey, chatThreadOfContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, azureDevOpsContextKey, azureDevOpsWorkItemContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, init_context_key, checkSlackRoutingCoherence, init_slack_routing, init_catalog, catalog_default, mapTriggerSurface, init_telemetry_context, TELEMETRY_PROXY_ORIGIN, normalizeOrgWebsite, orgLogoUrl, isFilledOrgLogoUrl, init_org_website, beginRequestAuthScope, setRequestAuth, getRequestAuth, getCurrentRequestAuth, runWithoutRequestAuth, getCurrentRequestUserId, init_request_auth_context, setTelemetryIngestObserver, isTelemetryEnabled, _resolveIntegrationType, _resolveIntegrationProvider, initTelemetry, setTelemetryRoleResolver, isTelemetryReady, track, trackRelayed, telemetry, emitIntegrationConnected, init_telemetry, auditAssetKeys, init_asset_key_audit, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, DEFAULT_CREDENTIAL_BINDINGS, init_credential_broker, encryptSecret, decryptSecret, getEncryptionKey, init_crypto, isInTransaction, init_db_client, breaksJsonValidity, scrubJsonValue, init_scrub_json, sealJson, init_sealed_json, getPromptTemplateDefaultDrift, init_default_drift, init_templates2 as init_templates, init_templates3 as init_templates1, isSqliteVecAvailable, resolveSqliteVecExtensionPath, __resetSqliteVecExtensionPathCacheForTests, initDb, getDb, closeDb, getDbClient, init_runtime, cachedUserRole, configureOrgDomainPersistence, recomputeOrgDomain, scheduleOrgDomainRecompute, init_telemetry_identity, resolveTriggerSurface, emitTaskTelemetry, init_telemetry_trigger, CODEX_AUTH_WATCH_NAMESPACE, codexAuthBenchMarkerKey, isCodexAuthFailureReason, init_codex_auth_failure, isEnvExportRestrictedKey, init_config_env_export, MASKED_SECRET_VALUE, init_config_secrets, HeartbeatExpiryError, init_heartbeat_expiry, isRuntimePoolsEnabled, init_runtime_pools_flag, normalizeDate, normalizeDateRequired, init_date_utils, rowToAgent, updateAgentCredentialState, updateAgentCredentialMissing, createAgent, getAgentById, EXTENSION_AGENT_ROLE, NOT_EXTENSION_AGENT_SQL, isExtensionAgent, extensionAgentAssignmentError, ReservedAgentRoleError, reservedRoleViolation, ExtensionAgentAssignmentError, getAllAgents, getAgentStatusCounts, getLeadAgent, updateAgentStatus, updateAgentMaxTasks, updateAgentProvider, setAgentHarnessProvider, updateAgentCredStatus, listAgentsWithCredStatusByProvider, getAgentHarnessProviders, updateAgentActivity, MAX_EMPTY_POLLS, incrementEmptyPollCount, resetEmptyPollCount, shouldBlockPolling, deleteAgent, getActiveTaskCount, hasCapacity, getRemainingCapacity, updateAgentStatusFromCapacity, isPoolAffinityEnforcementEnabled, buildRoutingAffinityFromAgent, isAgentEligibleForTask, getAgentDailyTaskCounts, init_agents, listApprovalRequestSummaries, getPendingApprovalVoteState, recordApprovalVotes, computeContentHash, createContextVersion, getLatestContextVersion, getContextVersion, getContextVersionHistory, setHumanFreeQueueListener, drainHumanFreeReclassifyQueue, init_human_free, rowToAgentTask, getTaskById, getChildTasks, hasNonTerminalResumeChild, getSupersededTasksWithoutResume, getSupersededTasksWithUnsettledDependents, hasNonTerminalRerouteDecisionChild, getTasksByAgentId, getAgentCurrentTask, getTasksByStatus, findTaskByVcs, findTaskByGitHub, getAllTasks, getTasksCount, getTaskStats, getCompletedSlackTasks, getPendingSlackRelayTasks, markSlackRelayAttempted, markSlackRelayDelivered, markFinalizedSlackRelaysDelivered, getPendingChatRelayTasks, giveUpStaleChatRelays, markChatRelayAttempted, recordChatRelayError, markChatRelayDelivered, markChatRelayGivenUp, getRecentlyFinishedWorkerTasks, markTasksNotified, resetTasksNotified, getInProgressSlackTasks, getSlackTasksMissingTree, getInProgressTasksByContextKey, isLinearTrackerContextKey, findExistingLinearTrackerContextWork, getLatestTaskByContextKey, getLatestScriptRunStepTaskByContextKey, getAgentWorkingOnThread, getLatestActiveTaskInThread, getLatestLeadTaskInThread, getAgentWorkingOnContextKey, getLatestActiveTaskByContextKey, getLatestLeadTaskByContextKey, getMostRecentTaskInThread, findCompletedTaskInThread, findRecentCancelledTaskInThread, init_read, onTaskStarted, init_task_lifecycle_events, channelTopic, addWorkerSubscription, removeWorkerSubscription, listSubscribedWorkerAgents, init_channels, publishWorkerNudge, init_worker_nudges, createTask, getPendingTaskForAgent, assignUnassignedTaskPending, startTask, updateTaskClaudeSessionId, recordTaskProviderIfUnset, updateTaskTitle, completeTask, failTask, overwriteTerminalTaskResultText, cancelTask, supersedeTask, settleSupersededTaskDependents, backfillSupersedeTaskResumeTaskId, pauseTask, resumeTask, getPausedTasksForAgent, getOrphanedInProgressTasksForAgent, resetOrphanedInProgressTasksForAgent, getRecentlyCancelledTasksForAgent, deleteTask, updateTaskProgress, getChildWorkflowRunId, getWorkflowRunParent, getWorkflowRunLineage, getSettledChildRunParentSteps, init_workflow_runs, CHAT_SDK_ADAPTER_NAMES, CHAT_SDK_ADAPTER_SCHEMAS, ChatSdkAdaptersDraftSchema, firstIssueText, isAdapterEntryEnabled, init_schema, resolveQuickJSPoolSize, init_quickjs_pool_config, SLACK_REACTION_DEFAULTS, SLACK_REACTION_CONFIG_KEYS, reactionName, init_reaction_shortcode, API_DRAINING_HEADER, API_DRAIN_MAX_MS_LIMIT, isApiDrainingResponse, init_api_drain, parseEnabledTools, init_enabled_tools, parseTaskToolManifest, CHAT_TASK_ONLY_TOOLS, isChatSdkTask, selectTaskTools, init_task_tool_manifest, tierConfigKey, init_model_tier_keys, isApiOnlyConfigKey, isInternalConfigKey, internalConfigKeyError, isReservedConfigKey, reservedKeyError, MAX_DB_RETENTION_DAYS, DB_RETENTION_TUNING_BOUNDS, validateRuntimeTokenTtlHours, validateControllerTokenTtlDays, validateControllerGraceSec, validateConfigValue, validateExportToEnv, init_swarm_config_guard, getDefaultAuthorizationIdForProvider, getOAuthApp, getOAuthAppById, getOAuthAppIdByProvider, createOAuthApp, updateOAuthAppById, upsertOAuthApp, listAuthorizationsForApp, getAuthorizationById, upsertAuthorization, updateAuthorizationTokens, updateAuthorizationIdentity, deleteAuthorizationById, deleteAuthorizationsForApp, createOAuthPending, consumeOAuthPending, gcOAuthPending, markAuthorizationRefreshFailed, getOAuthTokens, listAuthorizationSweepRows, listKeepAliveAuthorizations, deleteOAuthTokens, acquireOAuthRefreshLock, releaseOAuthRefreshLock, init_oauth, OpenAI, init_openai, CANDIDATE_SET_MULTIPLIER, isGraphExpansionEnabled, EMBEDDING_DIMENSIONS, init_constants, LONGTERM_ROOT, MEMORY_KEY_PATTERN, MEMORY_KEY_PATTERN_MESSAGE, MEMORY_KEY_MAX_LENGTH, isLongtermKey, longtermKeyError, isConsolidatedKey, consolidatedKeyMessage, resolveStoreKey, init_key_paths, computeScore, rerank, init_reranker, rowToCandidate, init_sqlite_store, getEmbeddingProvider, resetEmbeddingProvider, getMemoryStore, init_memory, embeddingProvider, embedScript, searchScripts, reembedAllScripts, init_embeddings2 as init_embeddings, upsertScriptByName, getScript, getScriptById, getScriptVersion, listScripts, listScriptVersions, deleteScript, touchScratchScriptLastUsed, restoreScratchScriptLastUsedIfUnchanged, createScriptApi, listScriptApisForScript, getScriptApiById, getScriptApiSecret, updateScriptApi, rotateScriptApiSecret, deleteScriptApi, recordScriptApiUsage, init_db, oauthSecretName, registerStoredSecret, loadSecretRegistry, init_secret_registry, SteeringRequestError, isSteeringEnabled2 as isSteeringEnabled, getTaskSteeringFields, getTaskSteeringFieldsForTasks, promotePendingSteeringForTask, markSteeringUndeliverable, requestSteering, init_steering, WorkflowReplayStateError, init_workflow_replay, SESSION_ACTIVITY_REFRESH_MIN_INTERVAL_MS, refreshActiveSessionOnActivity, recordKeySeatMismatch, getScriptRunExecutionArgs, getSlackRenderV2ActivatedAt, ensureSlackRenderV2Activation, getSlackDelegationActivatedAt, ensureSlackDelegationActivation, isPendingSlackMessage, isSettledSlackMessage, recordSlackMessage, reserveSlackMessage, bindSlackMessageTimestamp, updateSlackMessageRecord, markSlackTreeRendered, deleteSlackMessageRecord, getSlackTreeMessage, getSlackTreeMessageByThread, getSlackOutcomeMessage, getResolvableDeferralOutcomes, markSlackDeferralResolved, noteSlackOutcomeDeliveryFailure, abandonSlackOutcomeDelivery, getSlackTreeMessages, getSlackMessageByChannelTs, getSlackTasksInThread, listSlackThreadsAwaitingHuman, isSlackThreadAwaitingHuman, markTaskSlackReplySent, setSlackMessageTracking, updateTaskVcs, insertTaskAttachment, recordTaskPullRequestAttachments, getAssetKeyMappingByProvider, upsertAssetKeyMapping, getAssetKeyMapping, listAssetSummaries, moveAssetKey, deleteTaskAttachment, replaceTaskAttachment, getTaskAttachments, createSteeringMessage, getSteeringMessagesForTask, getSteeringMessageById, getPendingSteeringForTask, getPendingSteeringForAgent, markSteeringDelivered, markSteeringHandled, markSteeringPromoted, cancelPendingSteeringForTask, hasPendingSteering, getAgentWithTasks, getAllAgentsWithTasks, createLogEntry, getLogsByAgentId, getLogsByTaskId, getLogsByTaskIdAndEventType, getLogsByTaskIdChronological, getLogsByEventType, getAllLogs, findRecentSimilarTasks, createTaskExtended, claimTask, releaseTask, acceptTask, rejectTask, moveTaskToBacklog, moveTaskFromBacklog, promoteDraftTask, refreshDraftTaskLease, promoteAbandonedDraftTasks, releaseStaleReviewingTasks, releaseStaleOfferedTasksForOfflineAgents, getOfferedTasksForAgent, claimOfferedTask, getUnassignedTasksCount, getUnassignedTaskIds, getUnassignedTaskIdsForAgent, checkDependencies, getDependentTasks, cascadeFailDependents, updateAgentProfile, updateAgentName, createChannel, getMessageById, getChannelById, getChannelByName, getAllChannels, deleteChannel, postMessage, getChannelMessages, updateReadState, getLastReadAt, getUnreadMessages, getMentionsForAgent, getInboxSummary, claimMentions, releaseMentionProcessing, releaseStaleMentionProcessing, createService, getServiceById, getServiceByAgentAndName, getServicesByAgentId, getAllServices, updateServiceStatus, deleteService, upsertService, deleteServicesByAgentId, createSessionLogs, getSessionLogsByTaskId, getSessionLogsBySession, createSessionCost, getSessionCostsByTaskId, getSessionCostsByAgentId, getAllSessionCosts, getSessionCostsFiltered, UNATTRIBUTED_USER_ID, getSessionCostSummary, getAttributionByPerson, getDashboardCostSummary, createInboxMessage, getInboxMessageById, getUnreadInboxMessages, claimInboxMessages, markInboxMessageRead, markInboxMessageResponded, markInboxMessageDelegated, releaseStaleProcessingInbox, getConcurrentContext, getScheduledTasks, getScheduledTaskById, getScheduledTaskByName, createScheduledTask, updateScheduledTask, deleteScheduledTask, getDueScheduledTasks, autoEncryptLegacyPlaintextSecrets, maskSecrets, getSwarmConfigs, getInjectableGlobalConfigs, getSwarmConfigById, getSwarmConfigLookupById, upsertSwarmConfig, emitBuiltInIntegrationConnectedOnce, deleteSwarmConfig, deleteSwarmConfigByKey, getResolvedConfig, getSwarmRepos, getSwarmRepoById, getSwarmRepoByName, getSwarmRepoByUrl, createSwarmRepo, updateSwarmRepo, deleteSwarmRepo, getAgentMailInboxMapping, getAgentMailInboxMappingsByAgent, getAllAgentMailInboxMappings, createAgentMailInboxMapping, deleteAgentMailInboxMapping, findTaskByAgentMailThread, insertActiveSession, deleteActiveSession, deleteActiveSessionById, getActiveSessions, heartbeatActiveSession, cleanupStaleSessions, cleanupAgentSessions, updateActiveSessionProviderSessionId, getActiveSessionForTask, reassociateSessionLogs, getStalledInProgressTasks, getStalePinnedResumes, failPendingResumeIfUnclaimed, getIdleWorkersWithCapacity, getUnassignedPoolTasks, getStaleUnassignedAffinityTasks, getRecentFailedTasks, getRecentCompletedCount, getRecentFailedCount, createWorkflow, getWorkflow, listWorkflows, updateWorkflow, deleteWorkflow, getWorkflowsByScheduleId, createWorkflowRun, getWorkflowRun, updateWorkflowRun, listWorkflowRuns, countWorkflowRuns, listWorkflowRunsPage, createWorkflowRunStep, getWorkflowRunStep, updateWorkflowRunStep, getWorkflowRunStepsByRunId, getStuckWorkflowRuns, getLastSuccessfulRun, getLastRunStart, getRetryableSteps, getCompletedStepNodeIds, getTaskByWorkflowRunStepId, detachTaskFromWorkflowRunStep, getStepByIdempotencyKey, getStepCountForNode, getLatestStepForNode, getCurrentStepForNode, createWorkflowVersion, getWorkflowVersions, getWorkflowVersion, createAppVersion, getAppVersions, getAppVersion, createPage, getPage, getPageBySlug, getLatestPageBySlug, listPagesByAgent, listAllPages, countAllPages, countPagesByAgent, updatePage, deletePage, incrementPageViewCount, createPageVersion, getPageVersions, getPageVersion, createMetric, getMetric, getMetricBySlug, listMetricsByAgent, listAllMetrics, countAllMetrics, countMetricsByAgent, updateMetric, deleteMetric, createMetricVersion, getMetricVersions, getMetricVersion, getPromptTemplates, getPromptTemplateById, upsertPromptTemplate, deletePromptTemplate, resetPromptTemplateToDefault, getPromptTemplateHistory, resolvePromptTemplate, checkoutPromptTemplate, getAllChannelActivityCursors, getChannelActivityCursor, upsertChannelActivityCursor, createApprovalRequest, getApprovalRequestById, resolveApprovalRequest, cancelApprovalRequestById, cancelPendingApprovalRequestsForRun, listCancelledApprovalRequestsForRun, listCancelledApprovalRequestsForStep, claimApprovalCancellationNotification, completeApprovalCancellationNotificationClaim, releaseApprovalCancellationNotificationClaim, updateApprovalRequestNotifications, listApprovalRequests, getStuckApprovalRuns, getApprovalRequestByStepId, getExpiredPendingApprovals, getStaleApprovalRequests, createWaitState, getWaitStateById, getWaitStateByStepId, getDueWaitStates, getPendingEventWaitNames, getPendingWaitsByEvent, resolveWaitState, getStuckWaitRuns, SKILL_FILE_LIMITS, normalizeSkillFilePath, createSkill, updateSkill, listSkillFileManifest, getSkillFiles, getSkillFile, upsertSkillFile, upsertSkillFiles, deleteSkillFile, deleteSkill, getSkillById, getSkillByName, listSkills, searchSkills, installSkill, getSystemDefaultSkills, installSystemDefaultSkillsForAgent, uninstallSkill, getAgentSkills, toggleAgentSkill, createMcpServer, emitMcpServerConnectedTelemetry, updateMcpServer, deleteMcpServer, getMcpServerById, getMcpServerByName, listMcpServers, installMcpServer, uninstallMcpServer, getAgentMcpServers, createContextSnapshot, getContextSnapshotsByTaskId, getContextSnapshotsBySessionId, getContextSummaryByTaskId, getAvailableKeyIndices, recordKeyUsage, setApiKeyPlan, markKeyRateLimited, recordKeyAuthFailure, recordKeyRateLimitWindows, setApiKeyName, clearKeyRateLimit, getKeyStatuses, getKeyCostSummary, getUserById, getAllUsers, createUser, updateUser, deleteUser, listInboxState, upsertInboxState, listFavorites, listUserFavorites, getFavoriteItemIdSet, setFavorite, setUserFavorite, withFavoriteFlags, listTaskTemplates, getRootTaskChain, listRecentSessions, countSessions, getBudget, getBudgets, upsertBudget, deleteBudget, getAllPricingRows, getPricingRows, getActivePricingRow, insertPricingRow, deletePricingRow, getDailySpendForAgent, getDailySpendGlobal, getDailySpendForUser, recordBudgetRefusalNotification, getBudgetRefusalNotification, getRecentBudgetRefusalNotifications, hasBudgetRefusalNotificationToday, setBudgetRefusalFollowUpTaskId, getLiveAgentCounts, getReadyAgentCounts, getInstanceActivity, getSwarmMetrics, hasFirstCompletedTask, getKv, sweepExpiredKv, sweepExpiredKvPrefix, upsertKv, claimKv, deleteKv, KvTypeCollisionError, incrKv, kvPrefixUpperBound, listKv, countKv, createScriptRun, recordInlineScriptRun, getScriptRun, getScriptRunByIdempotencyKey, listScriptRuns, countScriptRuns, countActiveScriptRuns, updateScriptRun, updateScriptRunIfNotTerminal, updateScriptRunIfRunning, getRunningScriptRuns, getScriptRunJournalStep, upsertScriptRunJournalStep, listScriptRunJournalSteps, countScriptRunJournalSteps, countScriptRunJournalAgentTaskSteps, exports_db, init_db2 as init_db1 };
|
|
26805
|
+
export { slackContextKey, chatSdkContextKey, chatThreadOfContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, azureDevOpsContextKey, azureDevOpsWorkItemContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, init_context_key, checkSlackRoutingCoherence, init_slack_routing, init_catalog, catalog_default, mapTriggerSurface, init_telemetry_context, TELEMETRY_PROXY_ORIGIN, normalizeOrgWebsite, orgLogoUrl, isFilledOrgLogoUrl, init_org_website, beginRequestAuthScope, setRequestAuth, getRequestAuth, getCurrentRequestAuth, runWithoutRequestAuth, getCurrentRequestUserId, init_request_auth_context, setTelemetryIngestObserver, isTelemetryEnabled, _resolveIntegrationType, _resolveIntegrationProvider, initTelemetry, setTelemetryRoleResolver, isTelemetryReady, track, trackRelayed, telemetry, emitIntegrationConnected, init_telemetry, auditAssetKeys, init_asset_key_audit, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, DEFAULT_CREDENTIAL_BINDINGS, init_credential_broker, encryptSecret, decryptSecret, getEncryptionKey, init_crypto, isInTransaction, init_db_client, breaksJsonValidity, scrubJsonValue, init_scrub_json, sealJson, init_sealed_json, getPromptTemplateDefaultDrift, init_default_drift, init_templates2 as init_templates, init_templates3 as init_templates1, isSqliteVecAvailable, resolveSqliteVecExtensionPath, __resetSqliteVecExtensionPathCacheForTests, initDb, getDb, closeDb, getDbClient, init_runtime, cachedUserRole, configureOrgDomainPersistence, recomputeOrgDomain, scheduleOrgDomainRecompute, init_telemetry_identity, resolveTriggerSurface, emitTaskTelemetry, init_telemetry_trigger, CODEX_AUTH_WATCH_NAMESPACE, codexAuthBenchMarkerKey, isCodexAuthFailureReason, init_codex_auth_failure, isEnvExportRestrictedKey, init_config_env_export, MASKED_SECRET_VALUE, init_config_secrets, HeartbeatExpiryError, init_heartbeat_expiry, isRuntimePoolsEnabled, init_runtime_pools_flag, normalizeDate, normalizeDateRequired, init_date_utils, rowToAgent, updateAgentCredentialState, updateAgentCredentialMissing, createAgent, getAgentById, EXTENSION_AGENT_ROLE, NOT_EXTENSION_AGENT_SQL, isExtensionAgent, extensionAgentAssignmentError, ReservedAgentRoleError, reservedRoleViolation, ExtensionAgentAssignmentError, getAllAgents, getAgentStatusCounts, getLeadAgent, updateAgentStatus, updateAgentMaxTasks, updateAgentProvider, setAgentHarnessProvider, updateAgentCredStatus, listAgentsWithCredStatusByProvider, getAgentHarnessProviders, updateAgentActivity, MAX_EMPTY_POLLS, incrementEmptyPollCount, resetEmptyPollCount, shouldBlockPolling, deleteAgent, getActiveTaskCount, hasCapacity, getRemainingCapacity, updateAgentStatusFromCapacity, isPoolAffinityEnforcementEnabled, buildRoutingAffinityFromAgent, isAgentEligibleForTask, getAgentDailyTaskCounts, init_agents, listApprovalRequestSummaries, getPendingApprovalVoteState, recordApprovalVotes, computeContentHash, createContextVersion, getLatestContextVersion, getContextVersion, getContextVersionHistory, vcsRepoName, vcsRepoUrlMatches, init_vcs_repo_match, rowToAgentTask, getTaskById, getChildTasks, hasNonTerminalResumeChild, SUPERSEDED_RESUME_REPAIR_WINDOW_MS, getSupersededTasksWithoutResume, getSupersededTasksWithUnsettledDependents, hasNonTerminalRerouteDecisionChild, getTasksByAgentId, getAgentCurrentTask, getTasksByStatus, findTaskByVcs, findTaskByGitHub, getAllTasks, getTasksCount, getTaskStats, getCompletedSlackTasks, getPendingSlackRelayTasks, markSlackRelayAttempted, markSlackRelayDelivered, markFinalizedSlackRelaysDelivered, getPendingChatRelayTasks, giveUpStaleChatRelays, markChatRelayAttempted, recordChatRelayError, markChatRelayDelivered, markChatRelayGivenUp, getRecentlyFinishedWorkerTasks, markTasksNotified, resetTasksNotified, getInProgressSlackTasks, getSlackTasksMissingTree, getInProgressTasksByContextKey, isLinearTrackerContextKey, findExistingLinearTrackerContextWork, getLatestTaskByContextKey, getLatestScriptRunStepTaskByContextKey, getAgentWorkingOnThread, getLatestActiveTaskInThread, getLatestLeadTaskInThread, getAgentWorkingOnContextKey, getLatestActiveTaskByContextKey, getLatestLeadTaskByContextKey, getMostRecentTaskInThread, findCompletedTaskInThread, findRecentCancelledTaskInThread, init_read, MODEL_PROFILE_CONFIG_KEY, listModelProfiles, getModelProfileByName, createModelProfile, updateModelProfile, modelProfileReferences, modelProfileRefError, deleteModelProfile, getAgentDefaultProfileName, repoModelOverrideKeys, taskProfileError, init_model_profiles, setHumanFreeQueueListener, drainHumanFreeReclassifyQueue, init_human_free, onTaskStarted, init_task_lifecycle_events, channelTopic, addWorkerSubscription, removeWorkerSubscription, listSubscribedWorkerAgents, init_channels, publishWorkerNudge, init_worker_nudges, createTask, getPendingTaskForAgent, assignUnassignedTaskPending, startTask, updateTaskClaudeSessionId, recordTaskProviderIfUnset, updateTaskTitle, completeTask, failTask, overwriteTerminalTaskResultText, cancelTask, supersedeTask, settleSupersededTaskDependents, backfillSupersedeTaskResumeTaskId, pauseTask, resumeTask, getPausedTasksForAgent, getOrphanedInProgressTasksForAgent, resetOrphanedInProgressTasksForAgent, getRecentlyCancelledTasksForAgent, deleteTask, updateTaskProgress, getChildWorkflowRunId, getWorkflowRunParent, getWorkflowRunLineage, getSettledChildRunParentSteps, init_workflow_runs, CHAT_SDK_ADAPTER_NAMES, CHAT_SDK_ADAPTER_SCHEMAS, ChatSdkAdaptersDraftSchema, firstIssueText, isAdapterEntryEnabled, init_schema, resolveQuickJSPoolSize, init_quickjs_pool_config, SLACK_REACTION_DEFAULTS, SLACK_REACTION_CONFIG_KEYS, reactionName, completedStatusIcon, init_reaction_shortcode, API_DRAINING_HEADER, API_DRAIN_MAX_MS_LIMIT, isApiDrainingResponse, init_api_drain, parseEnabledTools, init_enabled_tools, parseTaskToolManifest, CHAT_TASK_ONLY_TOOLS, isChatSdkTask, selectTaskTools, init_task_tool_manifest, tierConfigKey, init_model_tier_keys, isApiOnlyConfigKey, isInternalConfigKey, internalConfigKeyError, isReservedConfigKey, reservedKeyError, MAX_DB_RETENTION_DAYS, DB_RETENTION_TUNING_BOUNDS, validateRuntimeTokenTtlHours, validateControllerTokenTtlDays, validateControllerGraceSec, validateConfigValue, validateExportToEnv, init_swarm_config_guard, getDefaultAuthorizationIdForProvider, getOAuthApp, getOAuthAppById, getOAuthAppIdByProvider, createOAuthApp, updateOAuthAppById, upsertOAuthApp, listAuthorizationsForApp, getAuthorizationById, upsertAuthorization, updateAuthorizationTokens, updateAuthorizationIdentity, deleteAuthorizationById, deleteAuthorizationsForApp, createOAuthPending, consumeOAuthPending, gcOAuthPending, markAuthorizationRefreshFailed, getOAuthTokens, listAuthorizationSweepRows, listKeepAliveAuthorizations, deleteOAuthTokens, acquireOAuthRefreshLock, releaseOAuthRefreshLock, init_oauth, OpenAI, init_openai, CANDIDATE_SET_MULTIPLIER, isGraphExpansionEnabled, EMBEDDING_DIMENSIONS, init_constants, LONGTERM_ROOT, MEMORY_KEY_PATTERN, MEMORY_KEY_PATTERN_MESSAGE, MEMORY_KEY_MAX_LENGTH, isLongtermKey, longtermKeyError, isConsolidatedKey, consolidatedKeyMessage, resolveStoreKey, init_key_paths, computeScore, rerank, init_reranker, rowToCandidate, init_sqlite_store, getEmbeddingProvider, resetEmbeddingProvider, getMemoryStore, init_memory, embeddingProvider, embedScript, searchScripts, reembedAllScripts, init_embeddings2 as init_embeddings, upsertScriptByName, getScript, getScriptById, getScriptVersion, listScripts, listScriptVersions, deleteScript, touchScratchScriptLastUsed, restoreScratchScriptLastUsedIfUnchanged, createScriptApi, listScriptApisForScript, getScriptApiById, getScriptApiSecret, updateScriptApi, rotateScriptApiSecret, deleteScriptApi, recordScriptApiUsage, init_db, oauthSecretName, registerStoredSecret, loadSecretRegistry, init_secret_registry, SteeringRequestError, isSteeringEnabled2 as isSteeringEnabled, getTaskSteeringFields, getTaskSteeringFieldsForTasks, promotePendingSteeringForTask, markSteeringUndeliverable, requestSteering, init_steering, WorkflowReplayStateError, init_workflow_replay, SESSION_ACTIVITY_REFRESH_MIN_INTERVAL_MS, refreshActiveSessionOnActivity, recordKeySeatMismatch, getScriptRunExecutionArgs, getSlackRenderV2ActivatedAt, ensureSlackRenderV2Activation, getSlackDelegationActivatedAt, ensureSlackDelegationActivation, isPendingSlackMessage, isSettledSlackMessage, recordSlackMessage, reserveSlackMessage, bindSlackMessageTimestamp, updateSlackMessageRecord, markSlackTreeRendered, deleteSlackMessageRecord, getSlackTreeMessage, getSlackTreeMessageByThread, getSlackOutcomeMessage, getResolvableDeferralOutcomes, markSlackDeferralResolved, noteSlackOutcomeDeliveryFailure, abandonSlackOutcomeDelivery, getSlackTreeMessages, getSlackMessageByChannelTs, getSlackTasksInThread, listSlackThreadsAwaitingHuman, isSlackThreadAwaitingHuman, markTaskSlackReplySent, setSlackMessageTracking, updateTaskVcs, insertTaskAttachment, recordTaskPullRequestAttachments, getAssetKeyMappingByProvider, upsertAssetKeyMapping, getAssetKeyMapping, listAssetSummaries, moveAssetKey, deleteTaskAttachment, replaceTaskAttachment, getTaskAttachments, createSteeringMessage, getSteeringMessagesForTask, getSteeringMessageById, getPendingSteeringForTask, getPendingSteeringForAgent, markSteeringDelivered, markSteeringHandled, markSteeringPromoted, cancelPendingSteeringForTask, hasPendingSteering, getAgentWithTasks, getAllAgentsWithTasks, createLogEntry, getLogsByAgentId, getLogsByTaskId, getLogsByTaskIdAndEventType, getLogsByTaskIdChronological, getLogsByEventType, getAllLogs, findRecentSimilarTasks, createTaskExtended, claimTask, releaseTask, acceptTask, rejectTask, moveTaskToBacklog, moveTaskFromBacklog, promoteDraftTask, refreshDraftTaskLease, promoteAbandonedDraftTasks, releaseStaleReviewingTasks, releaseStaleOfferedTasksForOfflineAgents, getOfferedTasksForAgent, claimOfferedTask, getUnassignedTasksCount, getUnassignedTaskIds, getUnassignedTaskIdsForAgent, checkDependencies, getDependentTasks, cascadeFailDependents, updateAgentProfile, updateAgentName, createChannel, getMessageById, getChannelById, getChannelByName, getAllChannels, deleteChannel, postMessage, getChannelMessages, updateReadState, getLastReadAt, getUnreadMessages, getMentionsForAgent, getInboxSummary, claimMentions, releaseMentionProcessing, releaseStaleMentionProcessing, createService, getServiceById, getServiceByAgentAndName, getServicesByAgentId, getAllServices, updateServiceStatus, deleteService, upsertService, deleteServicesByAgentId, createSessionLogs, getSessionLogsByTaskId, getSessionLogsBySession, createSessionCost, getSessionCostsByTaskId, getSessionCostsByAgentId, getAllSessionCosts, getSessionCostsFiltered, UNATTRIBUTED_USER_ID, getSessionCostSummary, getAttributionByPerson, getDashboardCostSummary, createInboxMessage, getInboxMessageById, getUnreadInboxMessages, claimInboxMessages, markInboxMessageRead, markInboxMessageResponded, markInboxMessageDelegated, releaseStaleProcessingInbox, getConcurrentContext, getScheduledTasks, getScheduledTaskById, getScheduledTaskByName, createScheduledTask, updateScheduledTask, deleteScheduledTask, getDueScheduledTasks, autoEncryptLegacyPlaintextSecrets, maskSecrets, getSwarmConfigs, getInjectableGlobalConfigs, getSwarmConfigById, getSwarmConfigLookupById, upsertSwarmConfig, emitBuiltInIntegrationConnectedOnce, deleteSwarmConfig, deleteSwarmConfigByKey, getResolvedConfig, getSwarmRepos, getSwarmRepoById, getSwarmRepoByName, getSwarmRepoByUrl, createSwarmRepo, updateSwarmRepo, deleteSwarmRepo, getAgentMailInboxMapping, getAgentMailInboxMappingsByAgent, getAllAgentMailInboxMappings, createAgentMailInboxMapping, deleteAgentMailInboxMapping, findTaskByAgentMailThread, insertActiveSession, deleteActiveSession, deleteActiveSessionById, getActiveSessions, heartbeatActiveSession, cleanupStaleSessions, cleanupAgentSessions, updateActiveSessionProviderSessionId, getActiveSessionForTask, reassociateSessionLogs, getStalledInProgressTasks, getStalePinnedResumes, failPendingResumeIfUnclaimed, getIdleWorkersWithCapacity, getUnassignedPoolTasks, getStaleUnassignedAffinityTasks, getRecentFailedTasks, getRecentCompletedCount, getRecentFailedCount, createWorkflow, getWorkflow, listWorkflows, updateWorkflow, deleteWorkflow, getWorkflowsByScheduleId, createWorkflowRun, getWorkflowRun, updateWorkflowRun, listWorkflowRuns, countWorkflowRuns, listWorkflowRunsPage, createWorkflowRunStep, getWorkflowRunStep, updateWorkflowRunStep, getWorkflowRunStepsByRunId, getStuckWorkflowRuns, getLastSuccessfulRun, getLastRunStart, getRetryableSteps, getCompletedStepNodeIds, getTaskByWorkflowRunStepId, detachTaskFromWorkflowRunStep, getStepByIdempotencyKey, getStepCountForNode, getLatestStepForNode, getCurrentStepForNode, createWorkflowVersion, getWorkflowVersions, getWorkflowVersion, createAppVersion, getAppVersions, getAppVersion, createPage, getPage, getPageBySlug, getLatestPageBySlug, listPagesByAgent, listAllPages, countAllPages, countPagesByAgent, updatePage, deletePage, incrementPageViewCount, createPageVersion, getPageVersions, getPageVersion, createMetric, getMetric, getMetricBySlug, listMetricsByAgent, listAllMetrics, countAllMetrics, countMetricsByAgent, updateMetric, deleteMetric, createMetricVersion, getMetricVersions, getMetricVersion, getPromptTemplates, getPromptTemplateById, upsertPromptTemplate, deletePromptTemplate, resetPromptTemplateToDefault, getPromptTemplateHistory, resolvePromptTemplate, checkoutPromptTemplate, getAllChannelActivityCursors, getChannelActivityCursor, upsertChannelActivityCursor, createApprovalRequest, getApprovalRequestById, resolveApprovalRequest, cancelApprovalRequestById, cancelPendingApprovalRequestsForRun, listCancelledApprovalRequestsForRun, listCancelledApprovalRequestsForStep, claimApprovalCancellationNotification, completeApprovalCancellationNotificationClaim, releaseApprovalCancellationNotificationClaim, updateApprovalRequestNotifications, listApprovalRequests, getStuckApprovalRuns, getApprovalRequestByStepId, getExpiredPendingApprovals, getStaleApprovalRequests, createWaitState, getWaitStateById, getWaitStateByStepId, getDueWaitStates, getPendingEventWaitNames, getPendingWaitsByEvent, resolveWaitState, getStuckWaitRuns, SKILL_FILE_LIMITS, normalizeSkillFilePath, createSkill, updateSkill, listSkillFileManifest, getSkillFiles, getSkillFile, upsertSkillFile, upsertSkillFiles, deleteSkillFile, deleteSkill, getSkillById, getSkillByName, listSkills, searchSkills, installSkill, getSystemDefaultSkills, installSystemDefaultSkillsForAgent, uninstallSkill, getAgentSkills, toggleAgentSkill, createMcpServer, emitMcpServerConnectedTelemetry, updateMcpServer, deleteMcpServer, getMcpServerById, getMcpServerByName, listMcpServers, installMcpServer, uninstallMcpServer, getAgentMcpServers, createContextSnapshot, getContextSnapshotsByTaskId, getContextSnapshotsBySessionId, getContextSummaryByTaskId, getAvailableKeyIndices, recordKeyUsage, setApiKeyPlan, markKeyRateLimited, recordKeyAuthFailure, recordKeyRateLimitWindows, setApiKeyName, clearKeyRateLimit, getKeyStatuses, getKeyCostSummary, getUserById, getAllUsers, createUser, updateUser, deleteUser, listInboxState, upsertInboxState, listFavorites, listUserFavorites, getFavoriteItemIdSet, setFavorite, setUserFavorite, withFavoriteFlags, listTaskTemplates, getRootTaskChain, listRecentSessions, countSessions, getBudget, getBudgets, upsertBudget, deleteBudget, getAllPricingRows, getPricingRows, getActivePricingRow, insertPricingRow, deletePricingRow, getDailySpendForAgent, getDailySpendGlobal, getDailySpendForUser, recordBudgetRefusalNotification, getBudgetRefusalNotification, getRecentBudgetRefusalNotifications, hasBudgetRefusalNotificationToday, setBudgetRefusalFollowUpTaskId, getLiveAgentCounts, getReadyAgentCounts, getInstanceActivity, getSwarmMetrics, hasFirstCompletedTask, getKv, sweepExpiredKv, sweepExpiredKvPrefix, upsertKv, claimKv, deleteKv, KvTypeCollisionError, incrKv, kvPrefixUpperBound, listKv, countKv, createScriptRun, recordInlineScriptRun, getScriptRun, getScriptRunByIdempotencyKey, listScriptRuns, countScriptRuns, countActiveScriptRuns, updateScriptRun, updateScriptRunIfNotTerminal, updateScriptRunIfRunning, getRunningScriptRuns, getScriptRunJournalStep, upsertScriptRunJournalStep, listScriptRunJournalSteps, countScriptRunJournalSteps, countScriptRunJournalAgentTaskSteps, exports_db, init_db2 as init_db1 };
|