@desplega.ai/agent-swarm 2.7.10 → 2.8.1
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-pdy3qsvg.js +15 -0
- package/dist/{actions-b8aqhrsg.js → actions-pwjpn0j6.js} +19 -20
- package/dist/{amp-adapter-4c165vgn.js → amp-adapter-cq9jgj6x.js} +2 -3
- package/dist/{app-m9khefrh.js → app-cnfffgwg.js} +3 -3
- package/dist/{assistant-rh4v3ntz.js → assistant-kpn317y1.js} +21 -22
- package/dist/{boot-args-schema-hwkc8bzv.js → boot-args-schema-pbbnhmc3.js} +1 -1
- package/dist/{boot-reembed-fdyk55h4.js → boot-reembed-9m0ysxma.js} +1 -1
- package/dist/{boot-reembed-5y6yw9sj.js → boot-reembed-majbn53m.js} +1 -1
- package/dist/{boot-scrub-sweep-r5r8kqsn.js → boot-scrub-sweep-app8g8ym.js} +3 -3
- package/dist/{boot-seeds-8f9zt5cm.js → boot-seeds-pbtmvcjm.js} +4 -5
- package/dist/{claude-adapter-s5df247c.js → claude-adapter-wn1g3qp5.js} +7 -8
- package/dist/{claude-managed-adapter-h74d06yz.js → claude-managed-adapter-jh6c523j.js} +3 -3
- package/dist/{claude-managed-setup-9gsmwzyx.js → claude-managed-setup-pd47nzch.js} +6 -6
- package/dist/{claude-sdk-session-dq1j4nz9.js → claude-sdk-session-3a2a6589.js} +9066 -8818
- package/dist/{cli-n5yexkdg.js → cli-0b4zam62.js} +1 -0
- package/dist/{cli-5wfz00be.js → cli-0jzra9ad.js} +2 -2
- package/dist/{cli-zjphdj1a.js → cli-0ntbxyaa.js} +40 -18
- package/dist/{cli-yz7v0sh4.js → cli-1xh9a7hn.js} +4 -6
- package/dist/{cli-eqtfgfr6.js → cli-2gxeg5gr.js} +1 -1
- package/dist/{cli-hfkwwy1h.js → cli-2zp0et3v.js} +21 -2
- package/dist/{cli-6m6b4bep.js → cli-3rkdne1h.js} +2 -2
- package/dist/{cli-mr97t7cc.js → cli-4r05hnqa.js} +263 -14
- package/dist/{cli-jc1g9ndz.js → cli-5j88qqa8.js} +10 -5
- package/dist/{cli-xfjrc279.js → cli-5mrq3ake.js} +48 -14
- package/dist/{cli-an1knn2k.js → cli-6mma83xa.js} +5 -5
- package/dist/{cli-tph5wt3y.js → cli-6wj7p986.js} +1 -1
- package/dist/{cli-t73cas91.js → cli-7349va39.js} +8100 -7620
- package/dist/{cli-5xcb8gxq.js → cli-7b8sbmag.js} +8 -8
- package/dist/{cli-3xj33nrx.js → cli-7cp6aa1q.js} +10 -3
- package/dist/{cli-mp9aa8g5.js → cli-7p1kvkck.js} +6 -6
- package/dist/{cli-j7d73g1y.js → cli-7w69ne2f.js} +3035 -354
- package/dist/{cli-cr14kftt.js → cli-89cqnasv.js} +3 -3
- package/dist/{cli-w3bk0dgv.js → cli-8aes17e4.js} +2 -2
- package/dist/{cli-7wz05bx3.js → cli-93k32c37.js} +468 -745
- package/dist/{cli-eqk5p56g.js → cli-9vhebtjz.js} +9 -9
- package/dist/{cli-td33w98c.js → cli-9wngrawf.js} +10 -10
- package/dist/cli-a3b239vq.js +242 -0
- package/dist/{cli-kx4c8j05.js → cli-b085njxz.js} +63 -19
- package/dist/{cli-8ewkreqd.js → cli-b5rs97a6.js} +7 -9
- package/dist/{cli-bxz823sz.js → cli-b8e9nb04.js} +1 -1
- package/dist/{cli-nj3x45rw.js → cli-bb431xey.js} +52 -43
- package/dist/{cli-36wdfzgn.js → cli-bsywb58a.js} +8 -8
- package/dist/{cli-18qt3few.js → cli-cyhbbd1z.js} +1 -1
- package/dist/{cli-eb2azq8n.js → cli-d3p5vwbk.js} +9 -9
- package/dist/{cli-2tsfpc70.js → cli-dy32zecz.js} +1 -1
- package/dist/{cli-rjyghzg4.js → cli-g70vxtjh.js} +2 -2
- package/dist/{cli-55bkx8hh.js → cli-gax7fk3t.js} +1 -1
- package/dist/{cli-jg24scat.js → cli-jcpr5smb.js} +3 -3
- package/dist/{cli-n07eecjs.js → cli-jywyhqws.js} +3 -3
- package/dist/{cli-38yww4e9.js → cli-k0615eh8.js} +8 -8
- package/dist/{cli-3xddv0rk.js → cli-k26bkr9t.js} +5 -7
- package/dist/{cli-xd5ebp64.js → cli-k93bq1wq.js} +3 -3
- package/dist/{cli-f2zenhja.js → cli-kc7v1nfv.js} +1 -1
- package/dist/{cli-x9exydey.js → cli-m4dqmnbp.js} +1 -1
- package/dist/{cli-gpwhbgx0.js → cli-m9s2qff2.js} +57 -25
- package/dist/{cli-ybjdc978.js → cli-mrt48bx7.js} +7 -4
- package/dist/{cli-ttbqe3q4.js → cli-p1w18yhx.js} +1 -1
- package/dist/{cli-h49ejvmc.js → cli-pcad4cb1.js} +1 -1
- package/dist/{cli-tmft5dz2.js → cli-qmqk2yc2.js} +1 -1
- package/dist/{cli-g1px1g2e.js → cli-re4raaj0.js} +1 -1
- package/dist/{cli-xbtq4d6s.js → cli-sn7rtnj4.js} +12 -8
- package/dist/{cli-n9abj89w.js → cli-syybb0p1.js} +8 -8
- package/dist/{cli-v2fwbnsk.js → cli-tacge1w0.js} +6 -6
- package/dist/{cli-pyrxt9gw.js → cli-tk7cjj8h.js} +1 -1
- package/dist/{cli-xvymtmv4.js → cli-tqegb8eq.js} +3 -3
- package/dist/{cli-kf3pxxdg.js → cli-v1dv1r37.js} +1 -1
- package/dist/{cli-z9cs5m0w.js → cli-vbh10fqa.js} +12 -12
- package/dist/{cli-3xcwp3z8.js → cli-vj75tyaw.js} +3 -3
- package/dist/{cli-xncjscpm.js → cli-vqptjbr7.js} +50 -24
- package/dist/{cli-q581b386.js → cli-wk18cm92.js} +5 -5
- package/dist/{cli-4vwxp550.js → cli-x1wa213s.js} +1 -1
- package/dist/{cli-n9ftpys4.js → cli-x6t50dmw.js} +7 -7
- package/dist/{cli-jrp1dt73.js → cli-xzm9vcfg.js} +1 -1
- package/dist/{cli-16phend6.js → cli-yn2bbre9.js} +1 -1
- package/dist/{cli-rt0ag4x1.js → cli-yncmerje.js} +5 -5
- package/dist/{cli-0m7rtm11.js → cli-zcsw143p.js} +1 -1
- package/dist/cli.js +18 -18
- package/dist/{codex-adapter-yr60sme6.js → codex-adapter-nha71q3n.js} +5 -6
- package/dist/{codex-hook-fac6175r.js → codex-hook-h3vk6xzr.js} +1 -1
- package/dist/{codex-session-runner-pch8x584.js → codex-session-runner-ak9x1k1h.js} +5 -6
- package/dist/{commands-phjfbkv0.js → commands-f587qpq8.js} +3 -3
- package/dist/{controller-jkx994pz.js → controller-hxx8wwy1.js} +2 -2
- package/dist/{controllers-connect-c4448kwa.js → controllers-connect-k5sg9m9h.js} +20 -21
- package/dist/{cursor-adapter-ndebqnm8.js → cursor-adapter-n5nc3mfe.js} +1 -2
- package/dist/{db-ef32tbfc.js → db-amm8w15a.js} +10 -2
- package/dist/{db-ez6egt6v.js → db-nzf8zb5z.js} +3 -3
- package/dist/{devin-adapter-z46ep5ph.js → devin-adapter-xedz98zv.js} +1 -1
- package/dist/{dispatcher-g3tt9hs9.js → dispatcher-89zrts8f.js} +18 -19
- package/dist/{dsh-adapter-tcyn3099.js → dsh-adapter-nrhbrjz8.js} +1 -2
- package/dist/{easter-egg-3d-e36hk5td.js → easter-egg-3d-533knw22.js} +1 -1
- package/dist/{embedding-space-4kyh5qqj.js → embedding-space-ezwenjmj.js} +6 -6
- package/dist/{embeddings-6a8v4a6t.js → embeddings-np74ht6g.js} +1 -1
- package/dist/{execute-3cbg0twf.js → execute-b3mrb1mv.js} +1 -1
- package/dist/{external-channel-se646snz.js → external-channel-z46yx9d7.js} +2 -2
- package/dist/{fx-adapter-yw795hqq.js → fx-adapter-3q12snn6.js} +7 -8
- package/dist/{grok-adapter-ttmcss2j.js → grok-adapter-ahb1w033.js} +7 -8
- package/dist/handlers-vbww69re.js +32 -0
- package/dist/heartbeat-dt9qw9c8.js +43 -0
- package/dist/{hook-hq93y5ej.js → hook-8k6fbz9b.js} +5 -5
- package/dist/{hook-g3nhexsy.js → hook-jgcgygex.js} +6 -6
- package/dist/{http-5a9p4h6y.js → http-haw4r8ne.js} +284 -142
- package/dist/{index-0eny15vj.js → index-2skqtd76.js} +2 -2
- package/dist/{index-6haqt3v5.js → index-4a0670yh.js} +8917 -8476
- package/dist/index-4xwaf5th.js +32 -0
- package/dist/{index-3c5pxbge.js → index-5gk12my8.js} +1 -1
- package/dist/{index-w7em4ktq.js → index-d6wkh8ar.js} +2 -2
- package/dist/index-f0hcrs8e.js +33 -0
- package/dist/{index-rvccek1w.js → index-gjwaqaq8.js} +5 -5
- package/dist/{index-e5pfbsys.js → index-hjhfk3ra.js} +3 -3
- package/dist/{index-1qw6f2dc.js → index-khe3gp0k.js} +4 -4
- package/dist/index-s4ewdma4.js +37 -0
- package/dist/{index-hgn3c961.js → index-tez78qj3.js} +979 -36
- package/dist/{index-s72rqgsx.js → index-tvfafeyy.js} +1 -1
- package/dist/{keepalive-1j4n4dmk.js → keepalive-xn6s7rmg.js} +3 -3
- package/dist/lead-6ygbfhbh.js +70 -0
- package/dist/{maintenance-dmghacy5.js → maintenance-vdts800b.js} +1 -1
- package/dist/{node-je82wjet.js → node-4c5jqxr3.js} +1 -1
- package/dist/{oauth-refresh-sweep-yy06c03c.js → oauth-refresh-sweep-094c8wfk.js} +2 -2
- package/dist/{onboard-52f9t5dm.js → onboard-v99eh56m.js} +3 -3
- package/dist/{opencode-adapter-krnh9jkn.js → opencode-adapter-dsagkhtw.js} +5 -6
- package/dist/{otel-impl-xjqz6wjj.js → otel-impl-q7yr9yp0.js} +1 -1
- package/dist/{pi-mono-adapter-dbxyp0qv.js → pi-mono-adapter-546cd1cc.js} +9 -9
- package/dist/{pricing-refresh-ctdr74pd.js → pricing-refresh-7dh2yase.js} +2 -3
- package/dist/{rbac-roles-ehv8s10n.js → rbac-roles-mdmc96p4.js} +3 -3
- package/dist/{rbac-roles-q0gr8eyj.js → rbac-roles-npbmdh77.js} +4 -6
- package/dist/{registry-hpjfmcfz.js → registry-32b1mft6.js} +1 -1
- package/dist/{render-v2-5b6chvcq.js → render-v2-twhhwmms.js} +3 -3
- package/dist/{resume-5a5d2845.js → resume-5gsrjd5e.js} +6 -6
- package/dist/{runtime-khxszyfp.js → runtime-1hv06jsn.js} +1 -1
- package/dist/{session-access-gj0bjhqg.js → session-access-m191x30x.js} +4 -4
- package/dist/{session-source-backfill-2sy0krfk.js → session-source-backfill-nt923ask.js} +2 -2
- package/dist/{setup-7ssfakk1.js → setup-wv467afy.js} +1 -1
- package/dist/{virtual-modules-pjj0knwf.js → virtual-modules-gazyapte.js} +3 -3
- package/dist/{work-objects-bf3syvhq.js → work-objects-8zkrpy13.js} +21 -22
- package/dist/{worker-follow-up-38xevga6.js → worker-follow-up-cecqszem.js} +18 -19
- package/dist/worker-mz5z7kj0.js +70 -0
- package/openapi.json +334 -7
- package/package.json +5 -5
- package/src/apps/definition.ts +11 -0
- package/src/apps/store.ts +28 -8
- package/src/be/db/model-profiles.ts +147 -38
- package/src/be/db/tasks/read.ts +5 -1
- package/src/be/db/workflow-run-definitions.ts +117 -0
- package/src/be/db.ts +24 -3
- package/src/be/memory/constants.ts +14 -1
- package/src/be/memory/key-paths.ts +8 -0
- package/src/be/memory/providers/sqlite-store.ts +160 -10
- package/src/be/memory/task-learning.ts +79 -14
- package/src/be/memory/types.ts +24 -1
- package/src/be/migrations/279_backfill_learning_expiry.sql +15 -0
- package/src/be/migrations/281_model_profiles_pr2.sql +28 -0
- package/src/be/migrations/283_workflow_run_definitions.sql +14 -0
- package/src/be/model-profile-check.ts +284 -0
- package/src/be/model-tier-resolution.ts +112 -12
- package/src/be/multi-runtime.ts +27 -0
- package/src/be/runtime-pools/routing.ts +52 -4
- package/src/be/scripts/typecheck.ts +1 -0
- package/src/be/seed-scripts/catalog/dreaming-learnings.ts +552 -0
- package/src/be/seed-scripts/catalog/dreaming-memtax-create.ts +389 -14
- package/src/be/seed-scripts/catalog/dreaming-memtax.ts +6 -3
- package/src/be/seed-scripts/index.ts +9 -0
- package/src/be/steering.ts +8 -2
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/commands/runner.ts +32 -1
- package/src/fs/provider.ts +17 -3
- package/src/heartbeat/heartbeat.ts +12 -1
- package/src/heartbeat/index.ts +1 -0
- package/src/http/agents.ts +56 -4
- package/src/http/apps.ts +3 -1
- package/src/http/config.ts +2 -6
- package/src/http/index.ts +2 -3
- package/src/http/model-profiles.ts +58 -10
- package/src/http/poll.ts +36 -3
- package/src/http/schedules.ts +42 -3
- package/src/http/tasks.ts +37 -12
- package/src/http/workflows.ts +15 -2
- package/src/prompts/session-templates.ts +1 -1
- package/src/providers/acp-targets.ts +11 -6
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/claude-sdk-session.ts +132 -23
- package/src/providers/codex-skill-resolver.ts +10 -4
- package/src/providers/cursor-adapter.ts +1 -1
- package/src/providers/devin-skill-resolver.ts +5 -5
- package/src/providers/dsh-adapter.ts +1 -1
- package/src/scheduler/schedule-task.ts +1 -0
- package/src/scripts-runtime/eval-harness.ts +14 -1
- package/src/scripts-runtime/executors/types.ts +3 -0
- package/src/scripts-runtime/sdk-allowlist.ts +1 -0
- package/src/scripts-runtime/swarm-sdk.ts +18 -1
- package/src/scripts-runtime/types/stdlib.d.ts +1 -0
- package/src/scripts-runtime/types/swarm-sdk.d.ts +1 -0
- package/src/server.ts +2 -0
- package/src/slack/app.ts +93 -0
- package/src/slack/inbound-dispatch.ts +18 -1
- package/src/slack/workspace-guard.ts +345 -0
- package/src/tasks/task-terminal-effects.ts +4 -0
- package/src/tasks/worker-follow-up.ts +102 -2
- package/src/tests/acp-adapter.test.ts +82 -0
- package/src/tests/apps-icon.test.ts +120 -0
- package/src/tests/chained-task-follow-up.test.ts +248 -0
- package/src/tests/check-pr-body.test.ts +40 -0
- package/src/tests/claude-sdk-lifecycle.test.ts +216 -1
- package/src/tests/claude-sdk-process.fixture.ts +57 -0
- package/src/tests/codex-skill-resolver.test.ts +31 -0
- package/src/tests/credentials-allowlist.test.ts +470 -0
- package/src/tests/db-task-read-contract.test.ts +5 -0
- package/src/tests/db-task-write-contract.test.ts +5 -0
- package/src/tests/deferred-wake-follow-up.test.ts +47 -0
- package/src/tests/docs-index-footprint.test.js +3 -3
- package/src/tests/dreaming-learnings.test.ts +1395 -0
- package/src/tests/dsh-adapter.test.ts +1 -1
- package/src/tests/explicit-model-validation.test.ts +2 -0
- package/src/tests/fs-provider.test.ts +42 -0
- package/src/tests/heartbeat.test.ts +28 -1
- package/src/tests/human-free-reclassify.test.ts +5 -1
- package/src/tests/list-endpoint-slimming.test.ts +17 -0
- package/src/tests/mcp-tools.test.ts +1 -1
- package/src/tests/migration-283-workflow-run-definitions.test.ts +69 -0
- package/src/tests/model-profile-check.test.ts +387 -0
- package/src/tests/model-profiles-api.test.ts +528 -1
- package/src/tests/profile-claim.test.ts +415 -3
- package/src/tests/profile-tier-alias.test.ts +382 -0
- package/src/tests/schedule-profile.test.ts +359 -0
- package/src/tests/script-connections.test.ts +6 -0
- package/src/tests/script-native-unawaited-drain.test.ts +167 -0
- package/src/tests/script-per-script-executor.test.ts +1 -0
- package/src/tests/scripts-sdk-bridge-tool-failure.test.ts +141 -0
- package/src/tests/seed-scripts.test.ts +2 -2
- package/src/tests/slack-inbound-receipts.test.ts +22 -2
- package/src/tests/slack-socket-ack.test.ts +16 -1
- package/src/tests/slack-workspace-guard.test.ts +905 -0
- package/src/tests/steering-core.test.ts +40 -0
- package/src/tests/store-progress-learning.test.ts +605 -20
- package/src/tests/tool-annotations.test.ts +1 -1
- package/src/tests/workflow-convergence.test.ts +46 -40
- package/src/tests/workflow-definition-pinning-recovery.test.ts +552 -0
- package/src/tests/workflow-definition-pinning.test.ts +645 -0
- package/src/tests/workflow-executors.test.ts +16 -7
- package/src/tests/workflow-foreach.test.ts +43 -20
- package/src/tests/workflow-notify-slack-ready.test.ts +161 -0
- package/src/tests/workflow-profile.test.ts +328 -0
- package/src/tools/app-upsert.ts +1 -1
- package/src/tools/memory-edit.ts +2 -1
- package/src/tools/model-profiles/check-model-profile.ts +63 -0
- package/src/tools/schedules/create-schedule.ts +45 -4
- package/src/tools/schedules/patch-schedule.ts +50 -4
- package/src/tools/schedules/update-schedule.ts +50 -4
- package/src/tools/script-run.ts +1 -1
- package/src/tools/send-task.ts +17 -2
- package/src/tools/store-progress.ts +15 -3
- package/src/tools/task-action.ts +9 -1
- package/src/tools/templates.ts +13 -0
- package/src/tools/tool-config.ts +2 -1
- package/src/tools/utils.ts +61 -4
- package/src/tools/workflows/create-workflow.ts +1 -1
- package/src/tools/workflows/retry-workflow-run.ts +1 -1
- package/src/tools/workflows/update-workflow.ts +10 -1
- package/src/types.ts +56 -1
- package/src/utils/credentials.ts +89 -12
- package/src/workflows/engine.ts +10 -1
- package/src/workflows/executors/agent-task.ts +21 -2
- package/src/workflows/executors/foreach.ts +4 -1
- package/src/workflows/executors/notify.ts +62 -6
- package/src/workflows/executors/sub-workflow.ts +1 -1
- package/src/workflows/executors/swarm-script.ts +4 -1
- package/src/workflows/foreach-driver.ts +8 -5
- package/src/workflows/limits.ts +2 -1
- package/src/workflows/model-validation.ts +27 -2
- package/src/workflows/patch-definition.ts +3 -1
- package/src/workflows/recovery.ts +6 -6
- package/src/workflows/resume.ts +9 -9
- package/src/workflows/retry-poller.ts +2 -2
- package/templates/skills/apps/SKILL.md +2 -0
- package/templates/skills/apps/content.md +2 -0
- package/templates/skills/code-quality/content.md +12 -0
- package/templates/skills/memory/content.md +8 -0
- package/templates/skills/scheduling/config.json +1 -1
- package/templates/skills/scheduling/content.md +2 -2
- package/templates/skills/swarm-docs/content.md +4 -0
- package/templates/skills/swarm-extensions/content.md +1 -1
- package/templates/skills/swarm-scripts/SKILL.md +2 -2
- package/templates/skills/swarm-scripts/content.md +2 -2
- package/templates/skills/work-on-task/SKILL.md +2 -0
- package/templates/skills/work-on-task/content.md +2 -0
- package/templates/workflows/dreaming/content.md +174 -7
- package/dist/acp-adapter-srfhs1s9.js +0 -16
- package/dist/cli-bzvs88tv.js +0 -339
- package/dist/cli-cyn9v8zr.js +0 -748
- package/dist/cli-ed6yqpf1.js +0 -779
- package/dist/handlers-17wha3ze.js +0 -33
- package/dist/heartbeat-gwewgdms.js +0 -42
- package/dist/index-8arwq8mw.js +0 -34
- package/dist/index-tpw054az.js +0 -38
- package/dist/index-waq75j2j.js +0 -31
- package/dist/lead-re73kdgc.js +0 -72
- package/dist/worker-r8mz7a65.js +0 -72
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
contextBoundNoteThreshold,
|
|
3
3
|
createContextBoundNote
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-xzm9vcfg.js";
|
|
5
5
|
import {
|
|
6
6
|
SessionErrorTracker
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-kc7v1nfv.js";
|
|
8
8
|
import {
|
|
9
9
|
summarizeSession
|
|
10
|
-
} from "./cli-
|
|
11
|
-
import {
|
|
12
|
-
resolveCodexPrompt
|
|
13
|
-
} from "./cli-jc1g9ndz.js";
|
|
10
|
+
} from "./cli-g70vxtjh.js";
|
|
14
11
|
import {
|
|
15
12
|
createSwarmEventHandler
|
|
16
13
|
} from "./cli-m5akxq8q.js";
|
|
@@ -29,6 +26,9 @@ import {
|
|
|
29
26
|
import {
|
|
30
27
|
hasCodexOAuthPoolSlots
|
|
31
28
|
} from "./cli-j4bwnpkm.js";
|
|
29
|
+
import {
|
|
30
|
+
resolveCodexPrompt
|
|
31
|
+
} from "./cli-5j88qqa8.js";
|
|
32
32
|
import {
|
|
33
33
|
CONTEXT_FORMULA,
|
|
34
34
|
computeContextUsedUnified,
|
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
import {
|
|
64
64
|
DEFAULT_MODEL_TIER_MAP,
|
|
65
65
|
init_types4
|
|
66
|
-
} from "./cli-
|
|
66
|
+
} from "./cli-2zp0et3v.js";
|
|
67
67
|
import {
|
|
68
68
|
isCodexRejectedAccessError,
|
|
69
69
|
init_codex_auth_failure
|
|
@@ -76,7 +76,7 @@ import {
|
|
|
76
76
|
init_src,
|
|
77
77
|
selectCredential,
|
|
78
78
|
init_credentials2
|
|
79
|
-
} from "./cli-
|
|
79
|
+
} from "./cli-5mrq3ake.js";
|
|
80
80
|
import {
|
|
81
81
|
runtimeCatalogModel,
|
|
82
82
|
init_runtime_model_catalog
|
|
@@ -84,7 +84,7 @@ import {
|
|
|
84
84
|
import {
|
|
85
85
|
init_package,
|
|
86
86
|
package_default
|
|
87
|
-
} from "./cli-
|
|
87
|
+
} from "./cli-yncmerje.js";
|
|
88
88
|
import {
|
|
89
89
|
isEnvFlagEnabled,
|
|
90
90
|
isSessionSummarySkipped,
|
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
contextBoundNoteThreshold,
|
|
3
3
|
createContextBoundNote
|
|
4
|
-
} from "./cli-
|
|
5
|
-
import {
|
|
6
|
-
resolveSlashSkillPrompt
|
|
7
|
-
} from "./cli-jc1g9ndz.js";
|
|
4
|
+
} from "./cli-xzm9vcfg.js";
|
|
8
5
|
import {
|
|
9
6
|
applyReasoningEffort
|
|
10
7
|
} from "./cli-jrzkw01m.js";
|
|
8
|
+
import {
|
|
9
|
+
resolveSlashSkillPrompt
|
|
10
|
+
} from "./cli-5j88qqa8.js";
|
|
11
11
|
import {
|
|
12
12
|
CONTEXT_FORMULA,
|
|
13
13
|
computeContextUsedUnified,
|
|
14
14
|
clampContextPercent,
|
|
15
15
|
init_context_window
|
|
16
16
|
} from "./cli-m88rpzkh.js";
|
|
17
|
-
import {
|
|
18
|
-
ampBillsCacheWrites,
|
|
19
|
-
resolveAmpModel,
|
|
20
|
-
init_amp_models
|
|
21
|
-
} from "./cli-ttbqe3q4.js";
|
|
22
17
|
import {
|
|
23
18
|
detachedProcessGroup,
|
|
24
19
|
registerProcessGroup,
|
|
@@ -32,6 +27,11 @@ import {
|
|
|
32
27
|
swarmRuntimeInstanceId,
|
|
33
28
|
init_multi_runtime2
|
|
34
29
|
} from "./cli-mdb054w3.js";
|
|
30
|
+
import {
|
|
31
|
+
ampBillsCacheWrites,
|
|
32
|
+
resolveAmpModel,
|
|
33
|
+
init_amp_models
|
|
34
|
+
} from "./cli-p1w18yhx.js";
|
|
35
35
|
import {
|
|
36
36
|
scrubSecrets,
|
|
37
37
|
registerVolatileSecret,
|
|
@@ -48,7 +48,7 @@ init_context_window();
|
|
|
48
48
|
init_multi_runtime2();
|
|
49
49
|
init_process_group();
|
|
50
50
|
init_secret_scrubber();
|
|
51
|
-
var AMP_PACKAGE = "@ampcode/cli@0.0.
|
|
51
|
+
var AMP_PACKAGE = "@ampcode/cli@0.0.1793851242-g61361b";
|
|
52
52
|
var AMP_MCP_SERVER_NAME = "agent-swarm";
|
|
53
53
|
var AMP_PLUGIN_MODE_KEY = "agent-swarm";
|
|
54
54
|
var AMP_LIVE_TEST_TIMEOUT_MS = 5000;
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getDbClient2,
|
|
3
|
+
buildModelsDevSeedRows,
|
|
4
|
+
init_seed_pricing,
|
|
5
|
+
buildCatalogEntries,
|
|
6
|
+
replaceModelCatalog,
|
|
7
|
+
touchModelCatalogCheckedAt,
|
|
8
|
+
countModelCatalog,
|
|
9
|
+
getModelCatalogMeta,
|
|
10
|
+
updateModelCatalogMeta,
|
|
11
|
+
expireMatchedOverlays,
|
|
12
|
+
applyOverlayPricingRows,
|
|
13
|
+
reloadModelsCatalog,
|
|
14
|
+
init_model_catalog_store,
|
|
15
|
+
createLogEntry2,
|
|
16
|
+
getActivePricingRow2,
|
|
17
|
+
insertPricingRow2,
|
|
18
|
+
init_db4
|
|
19
|
+
} from "./cli-7w69ne2f.js";
|
|
20
|
+
import {
|
|
21
|
+
scrubSecrets,
|
|
22
|
+
init_secret_scrubber
|
|
23
|
+
} from "./cli-d84byzn8.js";
|
|
24
|
+
import {
|
|
25
|
+
__esm
|
|
26
|
+
} from "./cli-242037k3.js";
|
|
27
|
+
|
|
28
|
+
// src/be/pricing-refresh.ts
|
|
29
|
+
function logPricingRefresh(message) {
|
|
30
|
+
console.log(scrubSecrets(`[pricing-refresh] ${message}`));
|
|
31
|
+
}
|
|
32
|
+
function logPricingRefreshError(message, err) {
|
|
33
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
34
|
+
console.warn(scrubSecrets(`[pricing-refresh] ${message}: ${detail}`));
|
|
35
|
+
}
|
|
36
|
+
async function insertChangedPricingRows(rows, now) {
|
|
37
|
+
return await getDbClient2().transaction(async () => {
|
|
38
|
+
let inserted = 0;
|
|
39
|
+
let unchanged = 0;
|
|
40
|
+
for (const row of rows) {
|
|
41
|
+
const existing = await getActivePricingRow2(row.provider, row.model, row.tokenClass, now);
|
|
42
|
+
if (existing?.pricePerMillionUsd === row.pricePerMillionUsd) {
|
|
43
|
+
unchanged += 1;
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
const input = {
|
|
47
|
+
...row,
|
|
48
|
+
effectiveFrom: now
|
|
49
|
+
};
|
|
50
|
+
await insertPricingRow2(input);
|
|
51
|
+
inserted += 1;
|
|
52
|
+
}
|
|
53
|
+
return { inserted, unchanged };
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
async function prunePricingHistory(keepLatest = 2) {
|
|
57
|
+
const result = await getDbClient2().run(`DELETE FROM pricing
|
|
58
|
+
WHERE rowid IN (
|
|
59
|
+
SELECT rowid
|
|
60
|
+
FROM (
|
|
61
|
+
SELECT
|
|
62
|
+
rowid,
|
|
63
|
+
ROW_NUMBER() OVER (
|
|
64
|
+
PARTITION BY provider, model, token_class
|
|
65
|
+
ORDER BY effective_from DESC
|
|
66
|
+
) AS rn
|
|
67
|
+
FROM pricing
|
|
68
|
+
)
|
|
69
|
+
WHERE rn > ?
|
|
70
|
+
)`, [keepLatest]);
|
|
71
|
+
return result.changes;
|
|
72
|
+
}
|
|
73
|
+
async function auditPricingRefresh(result) {
|
|
74
|
+
try {
|
|
75
|
+
await createLogEntry2({
|
|
76
|
+
eventType: "pricing.refresh",
|
|
77
|
+
newValue: `${result.status}: inserted=${result.inserted}; unchanged=${result.unchanged}; pruned=${result.pruned}`,
|
|
78
|
+
metadata: {
|
|
79
|
+
status: result.status,
|
|
80
|
+
candidateRows: result.candidateRows,
|
|
81
|
+
inserted: result.inserted,
|
|
82
|
+
unchanged: result.unchanged,
|
|
83
|
+
pruned: result.pruned,
|
|
84
|
+
etag: result.etag
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
} catch (err) {
|
|
88
|
+
logPricingRefreshError("audit log write failed", err);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
async function auditPricingRefreshFailure(err) {
|
|
92
|
+
try {
|
|
93
|
+
await createLogEntry2({
|
|
94
|
+
eventType: "pricing.refresh.failed",
|
|
95
|
+
newValue: scrubSecrets(err instanceof Error ? err.message : String(err))
|
|
96
|
+
});
|
|
97
|
+
} catch (auditErr) {
|
|
98
|
+
logPricingRefreshError("failure audit log write failed", auditErr);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
async function refreshPricingFromModelsDev(opts = {}) {
|
|
102
|
+
const fetchImpl = opts.fetchImpl ?? fetch;
|
|
103
|
+
const now = opts.now ?? Date.now();
|
|
104
|
+
const meta = await getModelCatalogMeta();
|
|
105
|
+
const catalogCount = await countModelCatalog();
|
|
106
|
+
const headers = {};
|
|
107
|
+
if (catalogCount > 0 && meta.etag)
|
|
108
|
+
headers["If-None-Match"] = meta.etag;
|
|
109
|
+
if (catalogCount > 0 && meta.lastModified)
|
|
110
|
+
headers["If-Modified-Since"] = meta.lastModified;
|
|
111
|
+
const response = await fetchImpl(MODELSDEV_API_URL, { headers });
|
|
112
|
+
if (response.status === 304) {
|
|
113
|
+
await touchModelCatalogCheckedAt(now);
|
|
114
|
+
await updateModelCatalogMeta({ lastCheckedAt: now });
|
|
115
|
+
await reloadModelsCatalog();
|
|
116
|
+
const result = {
|
|
117
|
+
status: "not_modified",
|
|
118
|
+
candidateRows: 0,
|
|
119
|
+
inserted: 0,
|
|
120
|
+
unchanged: 0,
|
|
121
|
+
pruned: 0,
|
|
122
|
+
etag: meta.etag ?? undefined,
|
|
123
|
+
added: [],
|
|
124
|
+
expiredOverlays: [],
|
|
125
|
+
catalogModels: catalogCount
|
|
126
|
+
};
|
|
127
|
+
await auditPricingRefresh(result);
|
|
128
|
+
logPricingRefresh("models.dev returned 304; pricing rows unchanged");
|
|
129
|
+
return result;
|
|
130
|
+
}
|
|
131
|
+
if (!response.ok) {
|
|
132
|
+
throw new Error(`models.dev returned HTTP ${response.status}`);
|
|
133
|
+
}
|
|
134
|
+
const cache = await response.json();
|
|
135
|
+
const etag = response.headers.get("etag");
|
|
136
|
+
const lastModified = response.headers.get("last-modified");
|
|
137
|
+
const entries = buildCatalogEntries(cache, now);
|
|
138
|
+
const added = await replaceModelCatalog(entries);
|
|
139
|
+
const rows = buildModelsDevSeedRows(cache);
|
|
140
|
+
const { inserted, unchanged } = await insertChangedPricingRows(rows, now);
|
|
141
|
+
const expiredOverlays = await expireMatchedOverlays();
|
|
142
|
+
const overlayInserted = await applyOverlayPricingRows(now);
|
|
143
|
+
const pruned = await prunePricingHistory(2);
|
|
144
|
+
await updateModelCatalogMeta({ etag, lastModified, lastFetchAt: now, lastCheckedAt: now });
|
|
145
|
+
await reloadModelsCatalog();
|
|
146
|
+
const result = {
|
|
147
|
+
status: "refreshed",
|
|
148
|
+
candidateRows: rows.length,
|
|
149
|
+
inserted: inserted + overlayInserted,
|
|
150
|
+
unchanged,
|
|
151
|
+
pruned,
|
|
152
|
+
etag: etag ?? undefined,
|
|
153
|
+
added,
|
|
154
|
+
expiredOverlays,
|
|
155
|
+
catalogModels: entries.length
|
|
156
|
+
};
|
|
157
|
+
await auditPricingRefresh(result);
|
|
158
|
+
logPricingRefresh(`refreshed ${rows.length} candidate row(s); inserted=${inserted}; unchanged=${unchanged}; pruned=${pruned}; catalog=${entries.length}; added=${added.length}; expiredOverlays=${expiredOverlays.length}`);
|
|
159
|
+
return result;
|
|
160
|
+
}
|
|
161
|
+
function refreshModelCatalog(opts = {}) {
|
|
162
|
+
if (refreshInFlight)
|
|
163
|
+
return refreshInFlight;
|
|
164
|
+
const run = runModelCatalogRefresh(opts).finally(() => {
|
|
165
|
+
if (refreshInFlight === run)
|
|
166
|
+
refreshInFlight = null;
|
|
167
|
+
});
|
|
168
|
+
refreshInFlight = run;
|
|
169
|
+
return run;
|
|
170
|
+
}
|
|
171
|
+
async function requestModelCatalogRefresh2(opts = {}) {
|
|
172
|
+
const now = opts.now ?? Date.now();
|
|
173
|
+
if (opts.force) {
|
|
174
|
+
const waitMs = lastForcedRefreshAt === null ? 0 : lastForcedRefreshAt + MODEL_CATALOG_FORCE_COOLDOWN_MS - now;
|
|
175
|
+
if (waitMs > 0) {
|
|
176
|
+
const meta = await getModelCatalogMeta().catch(() => null);
|
|
177
|
+
return {
|
|
178
|
+
status: "skipped-cooldown",
|
|
179
|
+
models: await countModelCatalog().catch(() => 0),
|
|
180
|
+
added: [],
|
|
181
|
+
checkedAt: meta?.lastCheckedAt ?? null,
|
|
182
|
+
retryAfterMs: waitMs
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
lastForcedRefreshAt = now;
|
|
186
|
+
}
|
|
187
|
+
return refreshModelCatalog({ ...opts, now });
|
|
188
|
+
}
|
|
189
|
+
async function runModelCatalogRefresh(opts = {}) {
|
|
190
|
+
const now = opts.now ?? Date.now();
|
|
191
|
+
try {
|
|
192
|
+
const meta = await getModelCatalogMeta();
|
|
193
|
+
const count = await countModelCatalog();
|
|
194
|
+
if (!opts.force && count > 0 && meta.lastCheckedAt !== null && now - meta.lastCheckedAt < MODEL_CATALOG_FRESH_MS) {
|
|
195
|
+
await reloadModelsCatalog();
|
|
196
|
+
return { status: "skipped-fresh", models: count, added: [], checkedAt: meta.lastCheckedAt };
|
|
197
|
+
}
|
|
198
|
+
const result = await refreshPricingFromModelsDev({ fetchImpl: opts.fetchImpl, now });
|
|
199
|
+
return {
|
|
200
|
+
status: result.status === "refreshed" ? "updated" : "not-modified",
|
|
201
|
+
models: result.catalogModels ?? await countModelCatalog(),
|
|
202
|
+
added: result.added ?? [],
|
|
203
|
+
checkedAt: now
|
|
204
|
+
};
|
|
205
|
+
} catch (err) {
|
|
206
|
+
logPricingRefreshError("model catalog refresh failed", err);
|
|
207
|
+
await auditPricingRefreshFailure(err);
|
|
208
|
+
const meta = await getModelCatalogMeta().catch(() => null);
|
|
209
|
+
return {
|
|
210
|
+
status: "error",
|
|
211
|
+
models: await countModelCatalog().catch(() => 0),
|
|
212
|
+
added: [],
|
|
213
|
+
checkedAt: meta?.lastCheckedAt ?? null,
|
|
214
|
+
error: scrubSecrets(err instanceof Error ? err.message : String(err))
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
async function runPricingRefreshSafely() {
|
|
219
|
+
await refreshModelCatalog();
|
|
220
|
+
}
|
|
221
|
+
function startPricingRefreshLoop2() {
|
|
222
|
+
if (refreshLoopStarted)
|
|
223
|
+
return;
|
|
224
|
+
refreshLoopStarted = true;
|
|
225
|
+
runPricingRefreshSafely();
|
|
226
|
+
const interval = setInterval(() => {
|
|
227
|
+
runPricingRefreshSafely();
|
|
228
|
+
}, PRICING_REFRESH_INTERVAL_MS);
|
|
229
|
+
interval.unref?.();
|
|
230
|
+
}
|
|
231
|
+
var MODELSDEV_API_URL = "https://models.dev/api.json", PRICING_REFRESH_INTERVAL_MS, MODEL_CATALOG_FRESH_MS, refreshLoopStarted = false, MODEL_CATALOG_FORCE_COOLDOWN_MS, refreshInFlight = null, lastForcedRefreshAt = null;
|
|
232
|
+
var init_pricing_refresh = __esm(() => {
|
|
233
|
+
init_secret_scrubber();
|
|
234
|
+
init_db4();
|
|
235
|
+
init_model_catalog_store();
|
|
236
|
+
init_seed_pricing();
|
|
237
|
+
PRICING_REFRESH_INTERVAL_MS = 12 * 60 * 60 * 1000;
|
|
238
|
+
MODEL_CATALOG_FRESH_MS = 4 * 60 * 60 * 1000;
|
|
239
|
+
MODEL_CATALOG_FORCE_COOLDOWN_MS = 60 * 1000;
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
export { requestModelCatalogRefresh2, startPricingRefreshLoop2, init_pricing_refresh };
|
|
@@ -16,6 +16,11 @@ import {
|
|
|
16
16
|
isPoolAffinityEnforcementEnabled2,
|
|
17
17
|
buildRoutingAffinityFromAgent2,
|
|
18
18
|
isAgentEligibleForTask2,
|
|
19
|
+
poolTaskRunsOnHarness,
|
|
20
|
+
init_model_validation2,
|
|
21
|
+
runtimeReadsRepoSecrets,
|
|
22
|
+
checkProfileForAgent,
|
|
23
|
+
init_model_profile_check,
|
|
19
24
|
rowToAgentTask,
|
|
20
25
|
getTaskById2,
|
|
21
26
|
hasNonTerminalResumeChild2,
|
|
@@ -65,27 +70,25 @@ import {
|
|
|
65
70
|
getStaleApprovalRequests2,
|
|
66
71
|
upsertKv2,
|
|
67
72
|
init_db4
|
|
68
|
-
} from "./cli-
|
|
73
|
+
} from "./cli-7w69ne2f.js";
|
|
69
74
|
import {
|
|
70
75
|
listRuntimePools2,
|
|
71
76
|
init_db2
|
|
72
|
-
} from "./cli-
|
|
77
|
+
} from "./cli-k93bq1wq.js";
|
|
73
78
|
import {
|
|
74
79
|
userHoldsOperatorGrantedRole2,
|
|
75
80
|
assertMayActOnOperatorGrantedTarget2,
|
|
76
81
|
init_rbac_roles
|
|
77
|
-
} from "./cli-
|
|
82
|
+
} from "./cli-1xh9a7hn.js";
|
|
78
83
|
import {
|
|
79
84
|
remediateStalledRuntime
|
|
80
|
-
} from "./cli-
|
|
85
|
+
} from "./cli-k0615eh8.js";
|
|
81
86
|
import {
|
|
82
87
|
repointTrackerSyncBySwarmId,
|
|
83
88
|
init_tracker,
|
|
84
89
|
isRuntimePoolWakeable,
|
|
85
90
|
isAgentReachable,
|
|
86
91
|
init_reachability,
|
|
87
|
-
poolTaskRunsOnHarness,
|
|
88
|
-
init_model_validation,
|
|
89
92
|
recoverIncompleteRuns,
|
|
90
93
|
init_recovery,
|
|
91
94
|
getExecutorRegistry2,
|
|
@@ -107,22 +110,23 @@ import {
|
|
|
107
110
|
init_approval_cancel,
|
|
108
111
|
canClaim,
|
|
109
112
|
init_budget_admission
|
|
110
|
-
} from "./cli-
|
|
113
|
+
} from "./cli-93k32c37.js";
|
|
111
114
|
import {
|
|
112
115
|
runScriptWithRunCredential,
|
|
113
116
|
init_run_credential,
|
|
114
117
|
runSavedScriptAsAgent,
|
|
115
118
|
init_run_saved
|
|
116
|
-
} from "./cli-
|
|
119
|
+
} from "./cli-0ntbxyaa.js";
|
|
117
120
|
import {
|
|
118
121
|
runtimeStaleThresholdMinutes,
|
|
119
122
|
countActiveRuntimeInstancesForAgent,
|
|
120
123
|
agentsWithLiveRuntime,
|
|
124
|
+
liveRuntimeAuthModes,
|
|
121
125
|
expireStaleRuntimeInstances,
|
|
122
126
|
init_multi_runtime,
|
|
123
127
|
createApprovalFollowUpTask,
|
|
124
128
|
init_approval_notifications
|
|
125
|
-
} from "./cli-
|
|
129
|
+
} from "./cli-vqptjbr7.js";
|
|
126
130
|
import {
|
|
127
131
|
isMultiRuntimeEnabled,
|
|
128
132
|
init_multi_runtime2
|
|
@@ -131,13 +135,13 @@ import {
|
|
|
131
135
|
recordIdentityEvent,
|
|
132
136
|
mintToken,
|
|
133
137
|
init_users
|
|
134
|
-
} from "./cli-
|
|
138
|
+
} from "./cli-re4raaj0.js";
|
|
135
139
|
import {
|
|
136
140
|
TERMINAL_TASK_STATUSES,
|
|
137
141
|
OPEN_TASK_STATUSES,
|
|
138
142
|
SUPERSEDED_WORKFLOW_TASK_REASON,
|
|
139
143
|
init_types4
|
|
140
|
-
} from "./cli-
|
|
144
|
+
} from "./cli-2zp0et3v.js";
|
|
141
145
|
import {
|
|
142
146
|
DEFAULT_OPENROUTER_BASE_URL,
|
|
143
147
|
getOpenRouterBaseUrl,
|
|
@@ -148,11 +152,11 @@ import {
|
|
|
148
152
|
init_registry3,
|
|
149
153
|
resolveTemplate,
|
|
150
154
|
init_resolver
|
|
151
|
-
} from "./cli-
|
|
155
|
+
} from "./cli-v1dv1r37.js";
|
|
152
156
|
import {
|
|
153
157
|
init_package,
|
|
154
158
|
package_default
|
|
155
|
-
} from "./cli-
|
|
159
|
+
} from "./cli-yncmerje.js";
|
|
156
160
|
import {
|
|
157
161
|
isEnvFlagEnabled,
|
|
158
162
|
init_env_flag
|
|
@@ -170,7 +174,8 @@ init_event_bus();
|
|
|
170
174
|
init_budget_admission();
|
|
171
175
|
init_db4();
|
|
172
176
|
init_read();
|
|
173
|
-
|
|
177
|
+
init_model_profile_check();
|
|
178
|
+
init_model_validation2();
|
|
174
179
|
init_multi_runtime();
|
|
175
180
|
init_db2();
|
|
176
181
|
init_reachability();
|
|
@@ -276,7 +281,42 @@ async function routePoolTasks(opts = {}) {
|
|
|
276
281
|
}
|
|
277
282
|
return (agent.maxTasks ?? 1) - count;
|
|
278
283
|
};
|
|
279
|
-
const
|
|
284
|
+
const runtimeAuthModes = withLiveRuntime === null ? null : await liveRuntimeAuthModes();
|
|
285
|
+
const secretViews = (agent, viaWake) => {
|
|
286
|
+
if (runtimeAuthModes === null)
|
|
287
|
+
return [true];
|
|
288
|
+
const tokenView = runtimeReadsRepoSecrets(agent);
|
|
289
|
+
const views = (runtimeAuthModes.get(agent.id) ?? []).map((runtimeToken) => runtimeToken ? tokenView : true);
|
|
290
|
+
if (viaWake || !views.length)
|
|
291
|
+
views.push(tokenView);
|
|
292
|
+
return [...new Set(views)];
|
|
293
|
+
};
|
|
294
|
+
const profileOk = new Map;
|
|
295
|
+
const passesProfileCheck = async (agent, task, viaWake) => {
|
|
296
|
+
if (!task.profile)
|
|
297
|
+
return true;
|
|
298
|
+
for (const includeRepoSecrets of secretViews(agent, viaWake)) {
|
|
299
|
+
const memoKey = JSON.stringify([
|
|
300
|
+
agent.id,
|
|
301
|
+
task.profile,
|
|
302
|
+
task.vcsRepo ?? null,
|
|
303
|
+
includeRepoSecrets
|
|
304
|
+
]);
|
|
305
|
+
let ok = profileOk.get(memoKey);
|
|
306
|
+
if (ok === undefined) {
|
|
307
|
+
const result = await checkProfileForAgent(agent.id, task.profile, {
|
|
308
|
+
vcsRepo: task.vcsRepo,
|
|
309
|
+
includeRepoSecrets
|
|
310
|
+
});
|
|
311
|
+
ok = result?.ok !== false;
|
|
312
|
+
profileOk.set(memoKey, ok);
|
|
313
|
+
}
|
|
314
|
+
if (!ok)
|
|
315
|
+
return false;
|
|
316
|
+
}
|
|
317
|
+
return true;
|
|
318
|
+
};
|
|
319
|
+
const eligible = async (agent, task, viaWake = false) => await headroom(agent) > 0 && isAgentEligibleForTask2(agent, task) && await poolTaskRunsOnHarness(task, agent.harnessProvider ?? agent.provider ?? null) && await passesProfileCheck(agent, task, viaWake);
|
|
280
320
|
const assigned = [];
|
|
281
321
|
const limit = nonnegativeEnv("HEARTBEAT_MAX_AUTO_ASSIGN", 5);
|
|
282
322
|
const batchSize = Number(process.env.HEARTBEAT_POOL_SCAN_BATCH_SIZE) || 50;
|
|
@@ -302,7 +342,7 @@ async function routePoolTasks(opts = {}) {
|
|
|
302
342
|
if (!worker && enabled && now.getTime() - Date.parse(task.createdAt) >= nonnegativeEnv("RUNTIME_WAKE_GRACE_SEC", 15) * 1000) {
|
|
303
343
|
const candidates = [];
|
|
304
344
|
for (const agent of wake) {
|
|
305
|
-
if (await eligible(agent, task))
|
|
345
|
+
if (await eligible(agent, task, true))
|
|
306
346
|
candidates.push({ agent, headroom: await headroom(agent) });
|
|
307
347
|
}
|
|
308
348
|
candidates.sort((a, b) => b.headroom - a.headroom || a.agent.name.localeCompare(b.agent.name));
|
|
@@ -530,7 +570,7 @@ async function deleteExpiredConnectorCodes(now = new Date) {
|
|
|
530
570
|
init_db4();
|
|
531
571
|
init_tracker();
|
|
532
572
|
init_event_loop_lag();
|
|
533
|
-
|
|
573
|
+
init_model_validation2();
|
|
534
574
|
init_multi_runtime();
|
|
535
575
|
init_reachability();
|
|
536
576
|
init_db3();
|
|
@@ -698,8 +738,12 @@ var SKIP_AUTO_RESUME_TYPES = new Set([
|
|
|
698
738
|
"heartbeat",
|
|
699
739
|
"reroute-decision"
|
|
700
740
|
]);
|
|
741
|
+
function parseHeartbeatIntervalMs2(raw) {
|
|
742
|
+
const value = Number(raw);
|
|
743
|
+
return Number.isInteger(value) && value > 0 ? value : 90000;
|
|
744
|
+
}
|
|
701
745
|
function defaultIntervalMs() {
|
|
702
|
-
return
|
|
746
|
+
return parseHeartbeatIntervalMs2(process.env.HEARTBEAT_INTERVAL_MS);
|
|
703
747
|
}
|
|
704
748
|
function stallThresholdMinutes() {
|
|
705
749
|
return Number(process.env.HEARTBEAT_STALL_THRESHOLD_MIN) || 30;
|
|
@@ -1901,4 +1945,4 @@ function stopHeartbeatChecklist() {
|
|
|
1901
1945
|
}
|
|
1902
1946
|
}
|
|
1903
1947
|
|
|
1904
|
-
export { startPoolRouting, stopPoolRouting, INVITE_CODE_TTL_MS, DEFAULT_CONNECTOR_CODE_LABEL, DEFAULT_INVITE_CODE_LABEL, createConnectorCode, exchangeConnectorCode, deleteUnusedInviteCodes, remediateTaskForDeadRuntime2, getBootEpochMs2, runRebootSweep2, getRebootAffectedTasks2, checkHeartbeatChecklist2, runHeartbeatSweep2, startHeartbeat2, stopHeartbeat2 };
|
|
1948
|
+
export { startPoolRouting, stopPoolRouting, INVITE_CODE_TTL_MS, DEFAULT_CONNECTOR_CODE_LABEL, DEFAULT_INVITE_CODE_LABEL, createConnectorCode, exchangeConnectorCode, deleteUnusedInviteCodes, parseHeartbeatIntervalMs2, remediateTaskForDeadRuntime2, getBootEpochMs2, runRebootSweep2, getRebootAffectedTasks2, checkHeartbeatChecklist2, runHeartbeatSweep2, startHeartbeat2, stopHeartbeat2 };
|
|
@@ -4,6 +4,9 @@ import {
|
|
|
4
4
|
isOperatorAuth,
|
|
5
5
|
init_request_auth_context,
|
|
6
6
|
getDbClient2,
|
|
7
|
+
isRbacEnabled,
|
|
8
|
+
can,
|
|
9
|
+
init_rbac,
|
|
7
10
|
getActiveTaskCount2,
|
|
8
11
|
getTaskById2,
|
|
9
12
|
getAgentCurrentTask2,
|
|
@@ -11,22 +14,17 @@ import {
|
|
|
11
14
|
init_active_sessions,
|
|
12
15
|
getSteeringMessageById2,
|
|
13
16
|
init_db4
|
|
14
|
-
} from "./cli-
|
|
17
|
+
} from "./cli-7w69ne2f.js";
|
|
15
18
|
import {
|
|
16
19
|
userHoldsExplicitVerb2,
|
|
17
20
|
getUserGrant2,
|
|
18
21
|
init_rbac_roles
|
|
19
|
-
} from "./cli-
|
|
20
|
-
import {
|
|
21
|
-
isRbacEnabled,
|
|
22
|
-
can,
|
|
23
|
-
init_rbac
|
|
24
|
-
} from "./cli-cyn9v8zr.js";
|
|
22
|
+
} from "./cli-1xh9a7hn.js";
|
|
25
23
|
import {
|
|
26
24
|
findUserById,
|
|
27
25
|
findUserByExternalId,
|
|
28
26
|
init_users
|
|
29
|
-
} from "./cli-
|
|
27
|
+
} from "./cli-re4raaj0.js";
|
|
30
28
|
import {
|
|
31
29
|
init_zod
|
|
32
30
|
} from "./cli-zcfpsfzf.js";
|
|
@@ -504,7 +502,7 @@ function route(def) {
|
|
|
504
502
|
try {
|
|
505
503
|
const rawBody = def.body ? await parseBody(req, def.maxBodyBytes) : undefined;
|
|
506
504
|
if (def.session && "bodyTaskIds" in def.session) {
|
|
507
|
-
const { bodySessionDenial } = await import("./session-access-
|
|
505
|
+
const { bodySessionDenial } = await import("./session-access-m191x30x.js");
|
|
508
506
|
const denial = await bodySessionDenial(req, def.session.bodyTaskIds(rawBody));
|
|
509
507
|
if (denial) {
|
|
510
508
|
jsonError(res, denial, 403);
|