@desplega.ai/agent-swarm 2.7.7 → 2.7.8
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-7b4vk3h5.js → acp-adapter-vg5hqkvj.js} +6 -6
- package/dist/{actions-3tt153af.js → actions-4m1ct4nh.js} +18 -18
- package/dist/{amp-adapter-njpts0yr.js → amp-adapter-txqh7eqj.js} +2 -2
- package/dist/{app-nky4378f.js → app-e00m45gn.js} +3 -3
- package/dist/{assistant-jnb669pa.js → assistant-gd08kr9e.js} +20 -20
- package/dist/boot-args-schema-tjrkpbvm.js +89 -0
- package/dist/{boot-reembed-9mgvaztt.js → boot-reembed-21hbck22.js} +1 -1
- package/dist/{boot-reembed-qs2djdej.js → boot-reembed-mdxd3wgp.js} +1 -1
- package/dist/{boot-scrub-sweep-yjpdj7s1.js → boot-scrub-sweep-qy0zr9t2.js} +3 -3
- package/dist/{boot-seeds-5cm6ambd.js → boot-seeds-n46eaxdv.js} +4 -4
- package/dist/{claude-adapter-fn287zmm.js → claude-adapter-j37w2eds.js} +6 -6
- package/dist/{claude-managed-adapter-dvs2xw5n.js → claude-managed-adapter-8jvcma9a.js} +3 -3
- package/dist/{claude-managed-setup-wtdz2mj2.js → claude-managed-setup-rzkjmgc1.js} +3 -3
- package/dist/{claude-sdk-session-x91kqyhm.js → claude-sdk-session-4k7w73t0.js} +7 -7
- package/dist/{cli-rtt8g4v9.js → cli-0ykgn1h5.js} +1 -1
- package/dist/{cli-5b456bpf.js → cli-1cxrbkk6.js} +2 -2
- package/dist/{cli-5jnhv72d.js → cli-269q28a1.js} +4 -2
- package/dist/{cli-k1nje3v3.js → cli-32m9eda8.js} +49 -37
- package/dist/{cli-35rsp8ye.js → cli-3e4snnzf.js} +1 -1
- package/dist/{cli-5zx699j9.js → cli-4t50yq3j.js} +2 -2
- package/dist/{cli-n6bv12jn.js → cli-5j0m12ns.js} +10 -3
- package/dist/{cli-dhar9qay.js → cli-5ja3b75e.js} +2 -2
- package/dist/{cli-g08zdaec.js → cli-66ww7fer.js} +1 -1
- package/dist/{cli-nmzhp1b5.js → cli-7axf41jq.js} +25 -14
- package/dist/{cli-gz6q4eve.js → cli-84rj785g.js} +5 -5
- package/dist/{cli-fyt2g4wd.js → cli-85gzce7b.js} +5 -5
- package/dist/{cli-3fg0bdcv.js → cli-8h0ayw8c.js} +1 -1
- package/dist/{cli-qghe0h66.js → cli-8rpcng8j.js} +2 -2
- package/dist/{cli-ws19768n.js → cli-8sdejs1f.js} +115 -51
- package/dist/{cli-8305gbq0.js → cli-9m8hdawy.js} +3 -3
- package/dist/{cli-excnnjg2.js → cli-ae0dnfee.js} +1 -1
- package/dist/{cli-e0kmphd6.js → cli-bb0mmdk8.js} +2 -2
- package/dist/{cli-1c6tzt8g.js → cli-bbw9wj9m.js} +8 -8
- package/dist/{cli-pjctyea3.js → cli-bshb7jas.js} +2 -2
- package/dist/{cli-08bmz9z9.js → cli-btfsp3mv.js} +3 -3
- package/dist/{cli-4zsenjhy.js → cli-c0kqky8y.js} +16 -3
- package/dist/{cli-tgrv9cjx.js → cli-dq8x79v8.js} +1 -1
- package/dist/{cli-ftyxyspd.js → cli-eqtfgfr6.js} +1 -1
- package/dist/{cli-ddaanqkd.js → cli-eyg1pa00.js} +3 -3
- package/dist/{cli-8sckt74b.js → cli-fyhr5h4s.js} +34 -12
- package/dist/{cli-q3tkegby.js → cli-fzachfnf.js} +1 -1
- package/dist/{cli-ayayvfg4.js → cli-ga786dzg.js} +13 -10
- package/dist/{cli-yyj3j5m4.js → cli-gazw7kpa.js} +2 -2
- package/dist/{cli-e46hg0xw.js → cli-gvx71kqv.js} +2 -2
- package/dist/{cli-pc6n7fre.js → cli-jdv6ypxs.js} +1 -1
- package/dist/{cli-cm5yqn35.js → cli-kf3pxxdg.js} +1 -0
- package/dist/{cli-6g0hb4cp.js → cli-kyr67fgx.js} +7 -7
- package/dist/{cli-95jzxcp3.js → cli-m0hmeqma.js} +2 -2
- package/dist/{cli-6pfd54vx.js → cli-msg9m2ny.js} +3 -1
- package/dist/{cli-afkqkrtw.js → cli-nbsf8yvn.js} +15 -3
- package/dist/{cli-tfyyvzx6.js → cli-njwac61j.js} +5 -0
- package/dist/{cli-vz22fyqv.js → cli-nn3ysbqk.js} +1 -1
- package/dist/{cli-m0da8j35.js → cli-p3vsj0d3.js} +5 -5
- package/dist/{cli-72v799xn.js → cli-ppjxh6ah.js} +3 -3
- package/dist/{cli-k899ehvh.js → cli-q4ebh7h7.js} +4 -4
- package/dist/{cli-75gkpjvw.js → cli-qd57hhhh.js} +2 -2
- package/dist/{cli-qh4d4tvk.js → cli-rjknb2ae.js} +4 -4
- package/dist/{cli-caj33vcq.js → cli-s4ss5g59.js} +1 -1
- package/dist/{cli-cb2a8pna.js → cli-sq4n7af4.js} +1 -1
- package/dist/{cli-vfym7wmz.js → cli-ssnjfg5p.js} +5 -5
- package/dist/{cli-je518txm.js → cli-t60ajbbp.js} +8 -8
- package/dist/{cli-adeegh7d.js → cli-tpksw2nr.js} +21 -17
- package/dist/{cli-wk5yrfwd.js → cli-w4xnbm46.js} +150 -58
- package/dist/{cli-k8196sh2.js → cli-wemma3jd.js} +8 -7
- package/dist/{cli-cppkf404.js → cli-xq9r2wtt.js} +45 -21
- package/dist/{cli-bfv7vdg6.js → cli-xr8908my.js} +11 -11
- package/dist/{cli-73jzwksr.js → cli-ycscb2ar.js} +4 -1
- package/dist/{cli-p82cnnjq.js → cli-yqefz277.js} +1 -1
- package/dist/{cli-jtjtabxe.js → cli-z1srzaf6.js} +11 -3
- package/dist/{cli-pq73h5mz.js → cli-z75yxkjh.js} +3 -3
- package/dist/{cli-e5bzrn01.js → cli-zkky4t5g.js} +1 -1
- package/dist/cli.js +17 -15
- package/dist/{codex-adapter-cf2yxe9m.js → codex-adapter-88z6psm4.js} +5 -5
- package/dist/{codex-hook-a0c6g6t6.js → codex-hook-fac6175r.js} +1 -1
- package/dist/{codex-login-y0pmff1c.js → codex-login-74wa4hmq.js} +1 -1
- package/dist/{codex-session-runner-6vfzdgbd.js → codex-session-runner-zwbcwzvx.js} +5 -5
- package/dist/{commands-t3mfy7vn.js → commands-7amxs716.js} +3 -3
- package/dist/{controller-q7xrbaz0.js → controller-5rkkc37m.js} +2 -2
- package/dist/{controllers-connect-c6nm70kg.js → controllers-connect-m7d4vxxb.js} +19 -19
- package/dist/{cursor-adapter-ftd81ga8.js → cursor-adapter-x1q18693.js} +1 -1
- package/dist/{db-vemtpmcc.js → db-athc68zt.js} +4 -2
- package/dist/{db-dk572x25.js → db-h2fsfve3.js} +3 -3
- package/dist/{dispatcher-kh7ecxh9.js → dispatcher-b1yz2bnn.js} +17 -17
- package/dist/{dsh-adapter-v8628r89.js → dsh-adapter-e33bkxq9.js} +1 -1
- package/dist/{easter-egg-3d-nenw4x63.js → easter-egg-3d-pv5qnzc8.js} +1 -1
- package/dist/{embedding-space-0jepb239.js → embedding-space-b4txbwrk.js} +6 -6
- package/dist/{embeddings-xxt49yxg.js → embeddings-m6zn6tad.js} +1 -1
- package/dist/{execute-1mhw6e4x.js → execute-68nwny8m.js} +1 -1
- package/dist/{external-channel-55v12e60.js → external-channel-gkckmhzh.js} +2 -2
- package/dist/{fx-adapter-bs8wqrk5.js → fx-adapter-m5jbgd5q.js} +7 -7
- package/dist/{grok-adapter-gpjqmkcq.js → grok-adapter-csvv7sac.js} +7 -7
- package/dist/handlers-8x5gfbzx.js +32 -0
- package/dist/{heartbeat-k42svnr0.js → heartbeat-6c2y3267.js} +20 -20
- package/dist/{hook-6nphweh0.js → hook-q5fv0jy2.js} +6 -6
- package/dist/{hook-114m7hap.js → hook-w0q2wcrv.js} +5 -5
- package/dist/{http-r8cc4wz7.js → http-bxat8dg3.js} +260 -120
- package/dist/{index-nh3wyqdt.js → index-bxrexmfy.js} +13 -13
- package/dist/{index-e3s8wmxy.js → index-cqhqpgrv.js} +1 -1
- package/dist/{index-fpk4bcd9.js → index-fm0czesf.js} +1 -1
- package/dist/index-hpfte8jd.js +33 -0
- package/dist/index-ncf7yb5s.js +30 -0
- package/dist/index-vte6dyeh.js +37 -0
- package/dist/{keepalive-x060nt9p.js → keepalive-qnt21cv0.js} +3 -3
- package/dist/lead-4bvftzm6.js +71 -0
- package/dist/{maintenance-2xxfexhf.js → maintenance-btdr68y4.js} +1 -1
- package/dist/{oauth-refresh-sweep-fckc4ar5.js → oauth-refresh-sweep-vczabeh4.js} +2 -2
- package/dist/{onboard-zc48j237.js → onboard-k33ezyq8.js} +2 -2
- package/dist/{opencode-adapter-r690h1cr.js → opencode-adapter-3dst2ka7.js} +5 -5
- package/dist/{otel-impl-r5xbh81q.js → otel-impl-13am7a65.js} +1 -1
- package/dist/{pi-mono-adapter-c7v8sdec.js → pi-mono-adapter-c53de1gd.js} +15 -9
- package/dist/{pricing-refresh-3pmre11v.js → pricing-refresh-9fcbnq3f.js} +3 -3
- package/dist/{rbac-roles-910mmkgz.js → rbac-roles-66j5h4y5.js} +5 -3
- package/dist/{rbac-roles-3vbshwsb.js → rbac-roles-gw0p9h3j.js} +2 -2
- package/dist/{render-v2-pxykkbab.js → render-v2-fg8bmdn4.js} +3 -3
- package/dist/{resume-adda0bwy.js → resume-1c8kr3nh.js} +6 -6
- package/dist/{runtime-fnbm7stk.js → runtime-tzf9j7tc.js} +1 -1
- package/dist/{session-access-2fvamrdc.js → session-access-d0atq10j.js} +7 -5
- package/dist/{session-source-backfill-08xvv0sm.js → session-source-backfill-0vscqmsa.js} +2 -2
- package/dist/{setup-1aqmvmh1.js → setup-tvfa7rwe.js} +1 -1
- package/dist/{virtual-modules-d2pjk9j1.js → virtual-modules-efxcp740.js} +2 -2
- package/dist/{work-objects-9s0yrm5j.js → work-objects-ks71xqeb.js} +20 -20
- package/dist/worker-e7v2bvm9.js +71 -0
- package/dist/{worker-follow-up-3q78fqmr.js → worker-follow-up-bfx0h9hg.js} +17 -17
- package/openapi.json +104 -24
- package/package.json +3 -1
- package/src/be/db/model-profiles.ts +1 -1
- package/src/be/db/session-tree.ts +9 -5
- package/src/be/db/session-visibility.ts +25 -9
- package/src/be/db/tasks/read.ts +11 -6
- package/src/be/db/tasks/write.ts +77 -7
- package/src/be/db-queries/tracker.ts +4 -2
- package/src/be/db.ts +49 -17
- package/src/be/migrations/271_subscription_usage_model.sql +30 -0
- package/src/be/model-validation.ts +19 -1
- package/src/be/rbac-roles.ts +21 -0
- package/src/be/runtime-pools/routing.ts +1 -1
- package/src/be/scripts/boot-args-schema.ts +95 -0
- package/src/be/scripts/extract-schema.ts +15 -10
- package/src/be/seed-scripts/catalog/boot-triage.inline.ts +1 -1
- package/src/be/seed-scripts/catalog/boot-triage.ts +1 -1
- package/src/be/seed-scripts/catalog/get-child-outputs.ts +1 -1
- package/src/be/seed-scripts/catalog/wait-for-task.ts +1 -1
- package/src/be/swarm-config-guard.ts +7 -0
- package/src/be/users.ts +6 -4
- package/src/commands/claude-managed-setup.ts +1 -1
- package/src/commands/runner.ts +26 -9
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/http/agents.ts +7 -1
- package/src/http/approval-requests.ts +30 -6
- package/src/http/codex-oauth-device.ts +2 -2
- package/src/http/index.ts +8 -0
- package/src/http/mcp-oauth.ts +6 -0
- package/src/http/mcp-servers.ts +8 -0
- package/src/http/models-catalog.ts +1 -1
- package/src/http/pages-public.ts +38 -1
- package/src/http/poll.ts +3 -4
- package/src/http/prompt-templates.ts +1 -1
- package/src/http/schedules.ts +4 -0
- package/src/http/script-runs.ts +6 -1
- package/src/http/session-access.ts +61 -6
- package/src/http/sessions.ts +23 -7
- package/src/http/tasks.ts +53 -9
- package/src/http/users.ts +30 -1
- package/src/http/utils.ts +2 -1
- package/src/http/workflows.ts +11 -7
- package/src/prompts/session-templates.ts +1 -0
- package/src/providers/acp-targets.ts +1 -1
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/codex-adapter.ts +9 -2
- package/src/providers/codex-oauth/device.ts +49 -15
- package/src/providers/codex-oauth/flow.ts +2 -1
- package/src/providers/pi-mono-adapter.ts +8 -0
- package/src/providers/pricing-sources.md +16 -1
- package/src/providers/swarm-events-shared.ts +15 -2
- package/src/rbac/legacy-policy.ts +1 -0
- package/src/rbac/permissions.ts +5 -0
- package/src/scheduler/deferred-task-waits.ts +9 -4
- package/src/scripts-runtime/extract-args-schema.ts +3 -1
- package/src/scripts-runtime/swarm-sdk.ts +1 -1
- package/src/scripts-runtime/types/swarm-extension.d.ts +29 -28
- package/src/server-user.ts +1 -1
- package/src/slack/ack.ts +48 -12
- package/src/slack/blocks.ts +1 -0
- package/src/slack/reaction-shortcode.ts +8 -2
- package/src/slack/render-v2.ts +30 -3
- package/src/slack/task-output.ts +4 -1
- package/src/slack/thread-buffer.ts +2 -2
- package/src/tasks/task-skip.ts +28 -0
- package/src/tasks/terminal-result-guard.ts +3 -2
- package/src/telemetry.ts +28 -1
- package/src/tests/agentmail-inbox-mapping.test.ts +73 -0
- package/src/tests/approval-requests.test.ts +58 -0
- package/src/tests/claude-managed-setup.test.ts +36 -0
- package/src/tests/codex-adapter.test.ts +2 -2
- package/src/tests/codex-oauth-device.test.ts +60 -0
- package/src/tests/codex-swarm-events.test.ts +43 -1
- package/src/tests/context-window.test.ts +14 -0
- package/src/tests/db-queries-tracker.test.ts +2 -1
- package/src/tests/db-task-read-contract.test.ts +1 -0
- package/src/tests/db-task-write-contract.test.ts +2 -0
- package/src/tests/deferred-task-wake.test.ts +7 -2
- package/src/tests/e2e-coverage-contract.test.ts +235 -0
- package/src/tests/empty-output-schema.test.ts +160 -0
- package/src/tests/env-flag.test.ts +1 -0
- package/src/tests/explicit-model-validation.test.ts +14 -0
- package/src/tests/http-api-integration.test.ts +2 -2
- package/src/tests/http-users.test.ts +63 -0
- package/src/tests/mcp-input-caps.test.ts +4 -3
- package/src/tests/merge-gate-detect-changes.test.ts +22 -0
- package/src/tests/pages-authed-mode.test.ts +13 -2
- package/src/tests/pi-mono-adapter.test.ts +39 -4
- package/src/tests/rbac-engine.test.ts +1 -0
- package/src/tests/runner-context-usage.test.ts +119 -0
- package/src/tests/script-connections.test.ts +2 -0
- package/src/tests/script-executor-quickjs.test.ts +2 -0
- package/src/tests/script-runs-http.test.ts +57 -0
- package/src/tests/scripts-boot-args-schema.test.ts +181 -0
- package/src/tests/scripts-runtime.test.ts +24 -0
- package/src/tests/sdk-store-progress-skipped.test.ts +155 -0
- package/src/tests/session-costs-model-key-normalize.test.ts +59 -0
- package/src/tests/session-sharing.test.ts +212 -2
- package/src/tests/slack-reaction-config.test.ts +1 -0
- package/src/tests/slack-render-v2.test.ts +73 -0
- package/src/tests/slack-skip-reaction.test.ts +203 -0
- package/src/tests/store-progress-skipped.test.ts +159 -0
- package/src/tests/subscription-usage-migration.test.ts +57 -0
- package/src/tests/swarm-config-reserved-keys.test.ts +3 -0
- package/src/tests/telemetry-endpoint-override.test.ts +27 -0
- package/src/tests/trigger-claiming.test.ts +2 -0
- package/src/tests/workflow-system-one-extraction.test.ts +29 -0
- package/src/tools/create-channel.ts +1 -1
- package/src/tools/defer-task.ts +1 -1
- package/src/tools/register-agentmail-inbox.ts +5 -0
- package/src/tools/repos/update-repo.ts +1 -1
- package/src/tools/request-human-input.ts +1 -1
- package/src/tools/send-task.ts +1 -1
- package/src/tools/store-progress.ts +39 -8
- package/src/tools/tracker/tracker-unlink.ts +2 -1
- package/src/tools/workflows/retry-workflow-run.ts +3 -0
- package/src/types.ts +11 -2
- package/src/utils/context-window.ts +6 -1
- package/src/utils/output-schema.ts +23 -0
- package/src/workflows/executors/system-one-providers.ts +25 -6
- package/src/workflows/recovery.ts +8 -4
- package/src/workflows/resume.ts +19 -0
- package/dist/handlers-zxmp1ta4.js +0 -32
- package/dist/index-a8phxqnk.js +0 -37
- package/dist/index-k6h00t4c.js +0 -30
- package/dist/index-xrz7te8h.js +0 -33
- package/dist/lead-956sd2yc.js +0 -71
- package/dist/worker-y15hy08h.js +0 -71
|
@@ -195,7 +195,7 @@ export default async function bootTriage(args: any, ctx: any) {
|
|
|
195
195
|
FROM agent_tasks c
|
|
196
196
|
WHERE c.parentTaskId = p.id
|
|
197
197
|
AND c.taskType = 'resume'
|
|
198
|
-
AND c.status NOT IN ('completed', 'failed', 'cancelled', 'superseded')
|
|
198
|
+
AND c.status NOT IN ('completed', 'failed', 'cancelled', 'superseded', 'skipped')
|
|
199
199
|
)
|
|
200
200
|
ORDER BY datetime(p.lastUpdatedAt) DESC
|
|
201
201
|
LIMIT 50`,
|
|
@@ -46,6 +46,6 @@ export default async function getChildOutputs(args: any, ctx: any) {
|
|
|
46
46
|
children,
|
|
47
47
|
allDone:
|
|
48
48
|
children.length > 0 &&
|
|
49
|
-
children.every((t: any) => ["completed", "failed", "cancelled"].includes(t.status)),
|
|
49
|
+
children.every((t: any) => ["completed", "failed", "cancelled", "skipped"].includes(t.status)),
|
|
50
50
|
};
|
|
51
51
|
}
|
|
@@ -23,7 +23,7 @@ export default async function waitForTask(args: any, ctx: any) {
|
|
|
23
23
|
const t: any = await ctx.swarm.task_get({ taskId });
|
|
24
24
|
const d = t?.data ?? t ?? {};
|
|
25
25
|
last = { status: d.status ?? null, output: d.output ?? null };
|
|
26
|
-
if (["completed", "failed", "cancelled"].includes(String(last.status))) {
|
|
26
|
+
if (["completed", "failed", "cancelled", "skipped"].includes(String(last.status))) {
|
|
27
27
|
return { done: true, ...last };
|
|
28
28
|
}
|
|
29
29
|
await new Promise((r) => setTimeout(r, 2000));
|
|
@@ -66,6 +66,12 @@ const RESERVED_KEYS = new Set([
|
|
|
66
66
|
"CORS_ALLOW_ANY_ORIGIN",
|
|
67
67
|
"EXTENSION_ALLOW_LEAD_ACTIVATION",
|
|
68
68
|
"CHAT_SDK_API_URL_OVERRIDES",
|
|
69
|
+
// Test knobs that redirect credential or telemetry traffic. Deployment env only: a
|
|
70
|
+
// config writer must not be able to point the Codex device login or the telemetry
|
|
71
|
+
// relay at a host of their choosing.
|
|
72
|
+
"CODEX_OAUTH_DEVICE_BASE_URL",
|
|
73
|
+
"DESPLEGA_TELEMETRY_ENDPOINT",
|
|
74
|
+
"CLOUDFLARE_API_BASE_URL",
|
|
69
75
|
]);
|
|
70
76
|
|
|
71
77
|
// Config keys the API server owns for its own use and must NEVER hand out over
|
|
@@ -568,6 +574,7 @@ const VALIDATED_KEYS: Record<string, ConfigValidator> = {
|
|
|
568
574
|
"SLACK_REACTION_STEERED",
|
|
569
575
|
"SLACK_REACTION_COMPLETED",
|
|
570
576
|
"SLACK_REACTION_FAILED",
|
|
577
|
+
"SLACK_REACTION_SKIPPED",
|
|
571
578
|
"SLACK_STATUS_ICON_COMPLETED",
|
|
572
579
|
]),
|
|
573
580
|
// Counts, minutes, and intervals: positive integers. Deliberately permissive
|
package/src/be/users.ts
CHANGED
|
@@ -213,15 +213,17 @@ function rowToEvent(row: IdentityEventRow): IdentityEvent {
|
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
/**
|
|
216
|
-
* Paginated event timeline for a user. `limit` is hard-capped at 200
|
|
217
|
-
*
|
|
218
|
-
*
|
|
216
|
+
* Paginated event timeline for a user. `limit` is hard-capped at 200 and a
|
|
217
|
+
* limit of 0 returns no events (negatives clamp to 0); `before` is a cursor on
|
|
218
|
+
* `createdAt` (ISO string) so the caller can keep paging by passing back the
|
|
219
|
+
* last event's `createdAt`.
|
|
219
220
|
*/
|
|
220
221
|
export async function listUserEvents(
|
|
221
222
|
userId: string,
|
|
222
223
|
opts: { limit?: number; before?: string } = {},
|
|
223
224
|
): Promise<IdentityEvent[]> {
|
|
224
|
-
const limit = Math.max(
|
|
225
|
+
const limit = Math.max(0, Math.min(opts.limit ?? 50, 200));
|
|
226
|
+
if (limit === 0) return [];
|
|
225
227
|
const before = opts.before;
|
|
226
228
|
const client = getDbClient();
|
|
227
229
|
if (before) {
|
|
@@ -125,7 +125,7 @@ Usage:
|
|
|
125
125
|
|
|
126
126
|
Options:
|
|
127
127
|
--api-url <url> Swarm API URL (default: MCP_BASE_URL or http://localhost:3013)
|
|
128
|
-
--api-key <key> Swarm API key
|
|
128
|
+
--api-key <key> Swarm API key (default: AGENT_SWARM_API_KEY or API_KEY, falling back to 123123)
|
|
129
129
|
--force Recreate agent + environment even if already configured
|
|
130
130
|
-h, --help Show this help
|
|
131
131
|
|
package/src/commands/runner.ts
CHANGED
|
@@ -91,6 +91,7 @@ import {
|
|
|
91
91
|
import { resolveCodexCreditsExhaustedCooldownMs } from "../utils/error-tracker.ts";
|
|
92
92
|
import { probeHarnessCliVersion, reportHarnessModelOutcome } from "../utils/harness-cli-version.ts";
|
|
93
93
|
import { resolveHarnessProvider } from "../utils/harness-provider.ts";
|
|
94
|
+
import { isEffectiveOutputSchema } from "../utils/output-schema.ts";
|
|
94
95
|
import { prettyPrintLine, prettyPrintStderr } from "../utils/pretty-print.ts";
|
|
95
96
|
import { terminateRegisteredProcessGroups } from "../utils/process-group.ts";
|
|
96
97
|
import { refreshRuntimeModelCatalog } from "../utils/runtime-model-catalog.ts";
|
|
@@ -1659,7 +1660,7 @@ export async function handleStructuredOutputFallback(
|
|
|
1659
1660
|
logs?: Array<{ eventType: string; newValue?: string; createdAt?: string }>;
|
|
1660
1661
|
};
|
|
1661
1662
|
|
|
1662
|
-
if (!taskData.outputSchema) {
|
|
1663
|
+
if (!isEffectiveOutputSchema(taskData.outputSchema)) {
|
|
1663
1664
|
// No structured output required — extract last progress as context
|
|
1664
1665
|
const lastProgressLog = (taskData.logs ?? [])
|
|
1665
1666
|
.filter((l) => l.eventType === "task_progress")
|
|
@@ -1748,7 +1749,7 @@ async function validateProviderOutputIfNeeded(
|
|
|
1748
1749
|
const taskData = (await taskRes.json()) as {
|
|
1749
1750
|
outputSchema?: Record<string, unknown>;
|
|
1750
1751
|
};
|
|
1751
|
-
if (!taskData.outputSchema
|
|
1752
|
+
if (!isEffectiveOutputSchema(taskData.outputSchema)) {
|
|
1752
1753
|
return { ok: true };
|
|
1753
1754
|
}
|
|
1754
1755
|
|
|
@@ -3776,12 +3777,13 @@ async function buildTaskOutputInstructions(
|
|
|
3776
3777
|
hasMcp: boolean,
|
|
3777
3778
|
): Promise<string> {
|
|
3778
3779
|
if (!hasMcp) return "";
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3780
|
+
// An empty `{}` schema means no schema; rendering it as a contract makes the
|
|
3781
|
+
// worker complete with the literal output "{}".
|
|
3782
|
+
const result = isEffectiveOutputSchema(outputSchema)
|
|
3783
|
+
? await resolveTemplateAsync("task.output.schema", {
|
|
3784
|
+
schema: JSON.stringify(outputSchema, null, 2),
|
|
3785
|
+
})
|
|
3786
|
+
: await resolveTemplateAsync("task.output.generic", {});
|
|
3785
3787
|
return result.text;
|
|
3786
3788
|
}
|
|
3787
3789
|
|
|
@@ -4643,6 +4645,7 @@ export async function spawnProviderProcess(
|
|
|
4643
4645
|
// Context usage throttle: max 1 snapshot per 30 seconds
|
|
4644
4646
|
let lastContextPostTime = 0;
|
|
4645
4647
|
const CONTEXT_THROTTLE_MS = 30_000;
|
|
4648
|
+
let latestContextWindow: number | undefined;
|
|
4646
4649
|
|
|
4647
4650
|
// Phase 10: accumulate per-turn output tokens across the session so progress
|
|
4648
4651
|
// snapshots carry a real `cumulativeOutputTokens` (was 0 until completion).
|
|
@@ -4901,6 +4904,14 @@ export async function spawnProviderProcess(
|
|
|
4901
4904
|
});
|
|
4902
4905
|
break;
|
|
4903
4906
|
case "context_usage": {
|
|
4907
|
+
// Observe every live window, including events whose HTTP post is throttled.
|
|
4908
|
+
if (
|
|
4909
|
+
event.contextTotalTokens != null &&
|
|
4910
|
+
Number.isFinite(event.contextTotalTokens) &&
|
|
4911
|
+
event.contextTotalTokens > 0
|
|
4912
|
+
) {
|
|
4913
|
+
latestContextWindow = event.contextTotalTokens;
|
|
4914
|
+
}
|
|
4904
4915
|
const now2 = Date.now();
|
|
4905
4916
|
if (now2 - lastContextPostTime >= CONTEXT_THROTTLE_MS) {
|
|
4906
4917
|
lastContextPostTime = now2;
|
|
@@ -4937,6 +4948,9 @@ export async function spawnProviderProcess(
|
|
|
4937
4948
|
break;
|
|
4938
4949
|
}
|
|
4939
4950
|
case "compaction": {
|
|
4951
|
+
if (Number.isFinite(event.contextTotalTokens) && event.contextTotalTokens > 0) {
|
|
4952
|
+
latestContextWindow = event.contextTotalTokens;
|
|
4953
|
+
}
|
|
4940
4954
|
// Always record compaction events (no throttle)
|
|
4941
4955
|
telemetry.compaction("triggered", {
|
|
4942
4956
|
compactTrigger: event.compactTrigger,
|
|
@@ -5112,7 +5126,10 @@ export async function spawnProviderProcess(
|
|
|
5112
5126
|
sessionId: opts.runnerSessionId,
|
|
5113
5127
|
cumulativeInputTokens: result.cost.inputTokens ?? 0,
|
|
5114
5128
|
cumulativeOutputTokens: result.cost.outputTokens ?? 0,
|
|
5115
|
-
contextTotalTokens: getContextWindowSize(
|
|
5129
|
+
contextTotalTokens: getContextWindowSize(
|
|
5130
|
+
result.cost.model || "default",
|
|
5131
|
+
latestContextWindow,
|
|
5132
|
+
),
|
|
5116
5133
|
}),
|
|
5117
5134
|
}).catch(() => {});
|
|
5118
5135
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// Generated by scripts/bundle-extension-types.ts. Do not edit.
|
|
2
2
|
// biome-ignore-all lint/suspicious/noTemplateCurlyInString: Type declarations contain literal template placeholders.
|
|
3
3
|
export const EXTENSION_TYPE_DEFINITIONS =
|
|
4
|
-
'// biome-ignore-all lint/suspicious/noConfusingVoidType: Extension handlers may explicitly return no result.\ndeclare module "swarm-extension" {\n export type CreateTaskOptions = {\n key?: string | undefined;\n agentId?: string | null | undefined;\n creatorAgentId?: string | undefined;\n source?:\n | "workflow"\n | "schedule"\n | "slack"\n | "agentmail"\n | "github"\n | "gitlab"\n | "azure-devops"\n | "bitbucket"\n | "linear"\n | "jira"\n | "mcp"\n | "api"\n | "ui"\n | "system"\n | "comb"\n | "chat"\n | undefined;\n routingReason?:\n | "skill"\n | "continuity"\n | "overflow"\n | "human_pinned"\n | "reroute_fault"\n | undefined;\n routingSource?: "declared" | "engine_default" | undefined;\n routingNote?: string | undefined;\n taskType?: string | undefined;\n tags?: string[] | undefined;\n priority?: number | undefined;\n dependsOn?: string[] | undefined;\n offeredTo?: string | undefined;\n status?: "draft" | "backlog" | "unassigned" | undefined;\n slackChannelId?: string | undefined;\n slackThreadTs?: string | undefined;\n slackTriggerMessageTs?: string | undefined;\n slackUserId?: string | undefined;\n overrideSlackContext?: boolean | undefined;\n vcsProvider?: "github" | "gitlab" | "azure-devops" | "bitbucket" | undefined;\n vcsRepo?: string | undefined;\n vcsEventType?: string | undefined;\n vcsNumber?: number | undefined;\n vcsCommentId?: number | undefined;\n vcsAuthor?: string | undefined;\n vcsUrl?: string | undefined;\n vcsInstallationId?: number | undefined;\n vcsNodeId?: string | undefined;\n agentmailInboxId?: string | undefined;\n agentmailMessageId?: string | undefined;\n agentmailThreadId?: string | undefined;\n mentionMessageId?: string | undefined;\n mentionChannelId?: string | undefined;\n dir?: string | undefined;\n parentTaskId?: string | undefined;\n model?: string | undefined;\n modelTier?: "smol" | "regular" | "smart" | "ultra" | undefined;\n effort?: "off" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;\n profile?: string | undefined;\n scheduleId?: string | undefined;\n workflowRunId?: string | undefined;\n workflowRunStepId?: string | undefined;\n sourceTaskId?: string | undefined;\n outputSchema?: Record<string, unknown> | undefined;\n inheritParentOutputSchema?: boolean | undefined;\n inheritParentRequester?: boolean | undefined;\n inheritParentRoutingAffinity?: boolean | undefined;\n inheritParentFollowUpConfig?: boolean | undefined;\n followUpConfig?:\n | {\n disabled?: boolean | undefined;\n onCompleted?: string | undefined;\n onFailed?: string | undefined;\n }\n | undefined;\n requestedByUserId?: string | undefined;\n contextKey?: string | undefined;\n bypassTrackerContextDedup?: boolean | undefined;\n routingAffinity?:\n | {\n capabilities: string[];\n sourceAgentId?: string | undefined;\n role?: string | undefined;\n harnessProvider?:\n | "claude"\n | "codex"\n | "pi"\n | "devin"\n | "claude-managed"\n | "opencode"\n | "acp"\n | "dsh"\n | "amp"\n | "cursor"\n | "grok"\n | "fx"\n | undefined;\n leadOnly?: boolean | undefined;\n }\n | undefined;\n };\n\n export type AgentTask = {\n id: string;\n key: string;\n agentId: string | null;\n task: string;\n status:\n | "draft"\n | "backlog"\n | "unassigned"\n | "offered"\n | "reviewing"\n | "pending"\n | "in_progress"\n | "paused"\n | "completed"\n | "failed"\n | "cancelled"\n | "superseded";\n source:\n | "workflow"\n | "schedule"\n | "slack"\n | "agentmail"\n | "github"\n | "gitlab"\n | "azure-devops"\n | "bitbucket"\n | "linear"\n | "jira"\n | "mcp"\n | "api"\n | "ui"\n | "system"\n | "comb"\n | "chat";\n tags: string[];\n priority: number;\n dependsOn: string[];\n createdAt: string;\n lastUpdatedAt: string;\n slackReplySent: boolean;\n wasPaused: boolean;\n creatorAgentId?: string | undefined;\n title?: string | undefined;\n routingReason?:\n | "skill"\n | "continuity"\n | "overflow"\n | "human_pinned"\n | "reroute_fault"\n | undefined;\n routingSource?: "declared" | "engine_default" | undefined;\n routingNote?: string | undefined;\n poolWakeAt?: string | undefined;\n taskType?: string | undefined;\n offeredTo?: string | undefined;\n offeredAt?: string | undefined;\n acceptedAt?: string | undefined;\n rejectionReason?: string | undefined;\n finishedAt?: string | undefined;\n notifiedAt?: string | undefined;\n failureReason?: string | undefined;\n output?: string | undefined;\n progress?: string | undefined;\n slackChannelId?: string | undefined;\n slackThreadTs?: string | undefined;\n slackTriggerMessageTs?: string | undefined;\n slackUserId?: string | undefined;\n slackProgressMessageTs?: string | undefined;\n slackTreeRootMessageTs?: string | undefined;\n vcsProvider?: "github" | "gitlab" | "azure-devops" | "bitbucket" | undefined;\n vcsRepo?: string | undefined;\n vcsEventType?: string | undefined;\n vcsNumber?: number | undefined;\n vcsCommentId?: number | undefined;\n vcsAuthor?: string | undefined;\n vcsUrl?: string | undefined;\n vcsInstallationId?: number | undefined;\n vcsNodeId?: string | undefined;\n agentmailInboxId?: string | undefined;\n agentmailMessageId?: string | undefined;\n agentmailThreadId?: string | undefined;\n mentionMessageId?: string | undefined;\n mentionChannelId?: string | undefined;\n dir?: string | undefined;\n parentTaskId?: string | undefined;\n claudeSessionId?: string | undefined;\n model?: string | undefined;\n modelTier?: "smol" | "regular" | "smart" | "ultra" | undefined;\n effort?: "off" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;\n resolvedModel?: string | undefined;\n modelSource?: string | undefined;\n modelAlias?: string | undefined;\n resolvedEffort?: "off" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;\n profile?: string | undefined;\n resolvedProfile?: string | undefined;\n scheduleId?: string | undefined;\n workflowRunId?: string | null | undefined;\n workflowRunStepId?: string | null | undefined;\n contextKey?: string | undefined;\n outputSchema?: Record<string, unknown> | undefined;\n followUpConfig?:\n | {\n disabled?: boolean | undefined;\n onCompleted?: string | undefined;\n onFailed?: string | undefined;\n }\n | undefined;\n deferredAt?: string | undefined;\n compactionCount?: number | undefined;\n peakContextPercent?: number | undefined;\n peakContextTokens?: number | undefined;\n contextWindowSize?: number | undefined;\n credentialKeySuffix?: string | undefined;\n credentialKeyType?: string | undefined;\n requestedByUserId?: string | undefined;\n swarmVersion?: string | undefined;\n provider?:\n | "claude"\n | "codex"\n | "pi"\n | "devin"\n | "claude-managed"\n | "opencode"\n | "acp"\n | "dsh"\n | "amp"\n | "cursor"\n | "grok"\n | "fx"\n | undefined;\n providerMeta?: Record<string, unknown> | undefined;\n harnessVariant?: string | undefined;\n harnessVariantMeta?: Record<string, unknown> | undefined;\n totalCostUsd?: number | undefined;\n routingAffinity?:\n | {\n capabilities: string[];\n sourceAgentId?: string | undefined;\n role?: string | undefined;\n harnessProvider?:\n | "claude"\n | "codex"\n | "pi"\n | "devin"\n | "claude-managed"\n | "opencode"\n | "acp"\n | "dsh"\n | "amp"\n | "cursor"\n | "grok"\n | "fx"\n | undefined;\n leadOnly?: boolean | undefined;\n }\n | undefined;\n routingAffinityInvalid?: boolean | undefined;\n };\n\n export type ActiveSession = {\n id: string;\n agentId: string;\n taskId: string | null;\n triggerType: string;\n inboxMessageId: string | null;\n taskDescription: string | null;\n runnerSessionId: string | null;\n providerSessionId: string | null;\n startedAt: string;\n lastHeartbeatAt: string;\n runtimeInstanceId?: string | null | undefined;\n };\n\n export type SteerMode = "steer" | "queue";\n\n export type SteeringSource = "script" | "slack" | "mcp" | "api" | "ui" | "chat";\n\n export type RequestInfo = {\n sessionId: string | undefined;\n agentId: string | undefined;\n runtimeInstanceId: string | undefined;\n sourceTaskId: string | undefined;\n contextKey: string | undefined;\n callOrigin: "mcp" | "extension" | "script-sdk";\n };\n\n import type { SwarmSdk } from "swarm-sdk";\n import type { z } from "zod";\n export type Runtime = "api" | "worker";\n export interface ExtensionScriptAsset {\n name: string;\n file: string;\n description: string;\n intent?: string;\n }\n export interface ExtensionScheduleAsset {\n name: string;\n description?: string;\n script: string;\n cronExpression?: string;\n intervalMs?: number;\n timezone?: string;\n args?: Record<string, unknown>;\n }\n export interface ExtensionWorkflowAsset {\n file: string;\n }\n export interface ExtensionSkillAsset {\n dir: string;\n }\n export interface ExtensionManifest {\n $schema?: string;\n name: string;\n description: string;\n version: string;\n runtime: Runtime;\n assets: {\n hooks: string;\n scripts?: readonly ExtensionScriptAsset[];\n schedules?: readonly ExtensionScheduleAsset[];\n workflows?: readonly ExtensionWorkflowAsset[];\n skills?: readonly ExtensionSkillAsset[];\n };\n homepage?: string;\n author?: string;\n }\n export interface HooksModule {\n default: SwarmExtension;\n config?: z.ZodTypeAny;\n }\n export interface ExtensionState {\n get<T = unknown>(key: string): Promise<T | null>;\n set<T>(key: string, value: T): Promise<void>;\n incr(key: string, by?: number): Promise<number>;\n del(key: string): Promise<void>;\n }\n export interface ExtensionLogger {\n debug(message: string, data?: unknown): void;\n info(message: string, data?: unknown): void;\n warn(message: string, data?: unknown): void;\n error(message: string, data?: unknown): void;\n }\n type ConfigFor<M extends ExtensionManifest> = M extends {\n config: infer C extends z.ZodTypeAny;\n }\n ? z.infer<C>\n : Record<string, unknown>;\n export interface ApiCtx<Config = Record<string, unknown>> {\n swarm: SwarmSdk;\n state: ExtensionState;\n config: Config;\n log: ExtensionLogger;\n signal: AbortSignal;\n event: {\n name: keyof SwarmEventMap;\n at: string;\n extension: {\n id: string;\n version: number;\n };\n };\n }\n export interface WorkerCtx<Config = Record<string, unknown>>\n extends Omit<ApiCtx<Config>, "swarm"> {\n swarm: SwarmSdk;\n worker: {\n agentId: string;\n taskId: string;\n harness: string;\n };\n }\n export type CtxFor<M extends ExtensionManifest> = M["runtime"] extends "api"\n ? ApiCtx<ConfigFor<M>>\n : WorkerCtx<ConfigFor<M>>;\n export type PreResult<Modify> =\n | void\n | {\n action: "continue";\n }\n | {\n action: "modify";\n data: Modify;\n }\n | {\n action: "block";\n reason: string;\n };\n export type TaskCreateOrigin =\n | "rest"\n | "app"\n | "mcp"\n | "slack"\n | "schedule"\n | "workflow"\n | "webhook"\n | "followUp"\n | `extension:${string}`;\n export interface TaskCreateEvent {\n options: CreateTaskOptions;\n description: string;\n origin: TaskCreateOrigin;\n requestInfo?: RequestInfo;\n /** Slack ingress metadata; not persisted or writable through modify. */\n slack?: {\n trigger: "mention" | "thread-buffer";\n messages: {\n ts: string;\n userId: string;\n text: string;\n }[];\n };\n }\n /** A pre.task.create hook blocked a task before it was created. */\n export interface TaskBlockedEvent {\n /** The extension that blocked, or whose model/agent rewrite was rejected. */\n extension: {\n id: string;\n name: string;\n };\n /** The scrubbed block reason. */\n reason: string;\n origin: TaskCreateOrigin;\n source?: AgentTask["source"];\n requester: {\n userId?: string;\n agentId?: string;\n slackUserId?: string;\n };\n context?: {\n contextKey?: string;\n scheduleId?: string;\n workflowRunId?: string;\n workflowRunStepId?: string;\n parentTaskId?: string;\n vcsRepo?: string;\n vcsNumber?: number;\n slackChannelId?: string;\n slackThreadTs?: string;\n };\n /** The original task description, scrubbed and cut to 500 characters. */\n description: string;\n }\n export type TaskCreateModify = Partial<\n Pick<\n CreateTaskOptions,\n | "agentId"\n | "creatorAgentId"\n | "source"\n | "taskType"\n | "tags"\n | "priority"\n | "dependsOn"\n | "offeredTo"\n | "vcsProvider"\n | "vcsRepo"\n | "vcsEventType"\n | "vcsNumber"\n | "vcsCommentId"\n | "vcsAuthor"\n | "vcsUrl"\n | "vcsInstallationId"\n | "vcsNodeId"\n | "agentmailInboxId"\n | "agentmailMessageId"\n | "agentmailThreadId"\n | "mentionMessageId"\n | "mentionChannelId"\n | "dir"\n | "model"\n | "modelTier"\n | "effort"\n | "outputSchema"\n | "followUpConfig"\n | "bypassTrackerContextDedup"\n >\n > & {\n description?: string;\n };\n export interface TaskFollowUpEvent {\n completedTask: AgentTask;\n status: "completed" | "failed";\n output?: string;\n failureReason?: string;\n workerAgentId: string;\n leadAgentId: string;\n summary: string;\n }\n export interface TaskSteerEvent {\n task: AgentTask;\n message: string;\n mode: SteerMode;\n source: SteeringSource;\n sender: {\n kind: "user" | "agent" | "system";\n userId?: string;\n agentId?: string;\n };\n messageTimestamps?: string[];\n /** Slack ingress metadata; not persisted or writable through modify. */\n slack?: {\n channelId: string;\n threadTs: string;\n userId?: string;\n };\n }\n export interface TaskSteerModify {\n message: string;\n }\n export type TaskFollowUpModify = Partial<\n Pick<CreateTaskOptions, "agentId" | "priority" | "followUpConfig">\n > & {\n description?: string;\n };\n export interface SlackRouteEvent {\n channelId: string;\n userId: string;\n text: string;\n threadTs?: string;\n botMentioned: boolean;\n threadContext?: {\n channelId: string;\n threadTs: string;\n };\n }\n export interface SlackRouteModify {\n target:\n | {\n kind: "agent";\n agentId: string;\n }\n | {\n kind: "lead";\n }\n | {\n kind: "broadcast";\n };\n }\n /** A Chat SDK message after its thread buffer flushed, before routing. */\n export interface ChatRouteEvent {\n /** Adapter name, such as `telegram` or `slack`. */\n adapter: string;\n channelId: string;\n /** The Chat SDK thread id, prefixed with the adapter name. */\n threadId: string;\n /** The first buffered sender. */\n userId: string;\n userName?: string;\n /** The buffered messages, joined. */\n text: string;\n /** True for an @mention and for a reply to one of the bot\'s messages. */\n botMentioned: boolean;\n isDirectMessage: boolean;\n /** Platform chat type, such as Telegram `private`, `group`, `supergroup` or `channel`. */\n chatType?: string;\n /** Set for a Telegram supergroup with topics. */\n isForum?: boolean;\n /** A buffered message replies to one of the bot\'s own messages. */\n replyToBot: boolean;\n /** Set when earlier swarm tasks exist in this thread. */\n threadContext?: {\n adapter: string;\n threadId: string;\n };\n }\n export interface ChatRouteModify {\n target:\n | {\n kind: "agent";\n agentId: string;\n }\n | {\n kind: "lead";\n }\n | {\n kind: "broadcast";\n }\n | {\n kind: "workflow";\n workflowId: string;\n };\n }\n export type HeartbeatClassification = "no-session" | "stale-session" | "fresh-stalled";\n export type HeartbeatAction = "supersede-resume" | "fail" | "record";\n export interface HeartbeatRemediateEvent {\n task: AgentTask;\n session?: ActiveSession;\n classification: HeartbeatClassification;\n proposedAction: HeartbeatAction;\n reason: string;\n taskAgeMs: number;\n sessionHeartbeatAgeMs?: number;\n }\n export interface HeartbeatRemediateModify {\n proposedAction: HeartbeatAction;\n }\n export interface ToolCallEvent {\n tool: string;\n args: unknown;\n requestInfo: RequestInfo;\n }\n export interface ToolCallModify {\n args: unknown;\n }\n export interface TaskEvent {\n task: AgentTask;\n }\n export interface TaskCompletedEvent extends TaskEvent {\n output: string;\n }\n export interface TaskFailedEvent extends TaskEvent {\n failureReason: string;\n }\n export interface TaskSupersededEvent extends TaskEvent {\n supersededBy: string;\n }\n export interface TaskProgressEvent extends TaskEvent {\n progress: string;\n }\n export interface SlackMessageEvent {\n channelId: string;\n userId: string;\n text: string;\n threadTs?: string;\n taskId?: string;\n }\n /** A Chat SDK message the swarm received or sent. */\n export interface ChatMessageEvent {\n adapter: string;\n channelId: string;\n threadId: string;\n /** The sender, for an inbound message. */\n userId?: string;\n text: string;\n direction: "inbound" | "outbound";\n taskId?: string;\n messageId?: string;\n }\n /**\n * A person answered an approval request. Fires for workflow and standalone\n * requests. Timeouts and cancellations do not emit it today.\n */\n export interface ApprovalResolvedEvent {\n requestId: string;\n status: "approved" | "rejected" | "timeout" | "cancelled";\n responses: Record<string, unknown> | null;\n /** Set when a workflow human-in-the-loop step asked. Absent for a standalone request. */\n workflowRunId?: string;\n workflowRunStepId?: string;\n /** The task whose agent asked, for a standalone request. */\n sourceTaskId?: string;\n }\n /** A task was refused because a daily spend budget is used up. */\n export interface TaskBudgetRefusedEvent extends TaskEvent {\n /** The agent the task was refused for. */\n agentId: string;\n /** Which budget refused it. The matching spend and budget fields are set. */\n cause: "agent" | "global" | "user";\n agentSpendUsd?: number;\n agentBudgetUsd?: number;\n globalSpendUsd?: number;\n globalBudgetUsd?: number;\n userSpendUsd?: number;\n userBudgetUsd?: number;\n /** ISO 8601 time the daily budget resets. */\n resetAt: string;\n }\n /** An inbound AgentMail message. */\n export interface EmailReceivedEvent {\n inboxId: string;\n /** The From header as sent. */\n from: string;\n subject: string;\n /** The text body, or the HTML when there is no text, cut to 500 characters with `...` appended. */\n body: string;\n threadId: string;\n messageId: string;\n }\n /** An inbound Kapso (WhatsApp) message. */\n export interface KapsoMessageEvent {\n phoneNumberId: string;\n conversationId?: string;\n messageId: string;\n from?: string;\n /** Kapso message type, such as `text` or `image`. */\n type?: string;\n /** The text, or a placeholder naming the type for a non-text message. */\n text: string;\n }\n export type VcsProvider = "github" | "gitlab" | "azure-devops" | "bitbucket";\n /**\n * The provider object the event is about, as the provider names it. GitLab\n * calls a pull request a merge request, and a comment a `note`.\n */\n export type VcsEventKind =\n | "pull_request"\n | "merge_request"\n | "issue"\n | "issue_comment"\n | "note"\n | "pull_request_review"\n | "pipeline";\n /**\n * A webhook event from a connected code host. `action` is the provider\'s own\n * value: `opened`, `closed`, `synchronize`, `merge`, `created`, `commented`, or,\n * for a pipeline, its status such as `success` or `failed`. Fields a kind does\n * not carry are absent.\n */\n export interface VcsEvent {\n provider: VcsProvider;\n kind: VcsEventKind;\n action: string;\n /** `owner/name` on GitHub and GitLab, `workspace/repo_slug` on Bitbucket, the repository URL on Azure DevOps. */\n repo: string;\n /** The PR, merge request, or issue number. Absent for a pipeline outside a merge request. */\n number?: number;\n title?: string;\n body?: string | null;\n /** Login of the user behind the event. Set for pull requests, merge requests, and Azure DevOps comments. */\n author?: string;\n url?: string;\n merged?: boolean;\n changedFiles?: number;\n /** The review verdict, on a pull request review. */\n reviewState?: string;\n }\n export interface ToolCallCompletedEvent extends ToolCallEvent {\n result: unknown;\n durationMs: number;\n }\n export interface SwarmEventMap {\n "pre.task.create": {\n event: TaskCreateEvent;\n modify: TaskCreateModify;\n result: PreResult<TaskCreateModify>;\n };\n "pre.task.followUp": {\n event: TaskFollowUpEvent;\n modify: TaskFollowUpModify;\n result: PreResult<TaskFollowUpModify>;\n };\n "pre.task.steer": {\n event: TaskSteerEvent;\n modify: TaskSteerModify;\n result: PreResult<TaskSteerModify>;\n };\n "pre.slack.route": {\n event: SlackRouteEvent;\n modify: SlackRouteModify;\n result: PreResult<SlackRouteModify>;\n };\n "pre.chat.route": {\n event: ChatRouteEvent;\n modify: ChatRouteModify;\n result: PreResult<ChatRouteModify>;\n };\n "pre.heartbeat.remediate": {\n event: HeartbeatRemediateEvent;\n modify: HeartbeatRemediateModify;\n result: PreResult<HeartbeatRemediateModify>;\n };\n "pre.tool.call": {\n event: ToolCallEvent;\n modify: ToolCallModify;\n result: PreResult<ToolCallModify>;\n };\n "post.task.created": {\n event: TaskEvent;\n modify: never;\n result: void;\n };\n "post.task.blocked": {\n event: TaskBlockedEvent;\n modify: never;\n result: void;\n };\n "post.task.completed": {\n event: TaskCompletedEvent;\n modify: never;\n result: void;\n };\n "post.task.failed": {\n event: TaskFailedEvent;\n modify: never;\n result: void;\n };\n "post.task.cancelled": {\n event: TaskEvent;\n modify: never;\n result: void;\n };\n "post.task.superseded": {\n event: TaskSupersededEvent;\n modify: never;\n result: void;\n };\n "post.task.progress": {\n event: TaskProgressEvent;\n modify: never;\n result: void;\n };\n "post.slack.message": {\n event: SlackMessageEvent;\n modify: never;\n result: void;\n };\n "post.chat.message": {\n event: ChatMessageEvent;\n modify: never;\n result: void;\n };\n "post.approval.resolved": {\n event: ApprovalResolvedEvent;\n modify: never;\n result: void;\n };\n "post.task.budgetRefused": {\n event: TaskBudgetRefusedEvent;\n modify: never;\n result: void;\n };\n "post.email.received": {\n event: EmailReceivedEvent;\n modify: never;\n result: void;\n };\n "post.kapso.message": {\n event: KapsoMessageEvent;\n modify: never;\n result: void;\n };\n "post.vcs.event": {\n event: VcsEvent;\n modify: never;\n result: void;\n };\n "post.tool.call": {\n event: ToolCallCompletedEvent;\n modify: never;\n result: void;\n };\n }\n export interface ExtensionApi<\n M extends ExtensionManifest = ExtensionManifest & {\n runtime: "api";\n },\n > {\n on<E extends keyof SwarmEventMap>(\n event: E,\n handler: (\n event: SwarmEventMap[E]["event"],\n ctx: CtxFor<M>,\n ) => Promise<SwarmEventMap[E]["result"]> | SwarmEventMap[E]["result"],\n opts?: {\n priority?: number;\n },\n ): void;\n }\n export type SwarmExtension<\n M extends ExtensionManifest = ExtensionManifest & {\n runtime: "api";\n },\n > = (api: ExtensionApi<M>) => void;\n export { block, modify } from "./contract-runtime";\n}\n';
|
|
4
|
+
'// biome-ignore-all lint/suspicious/noConfusingVoidType: Extension handlers may explicitly return no result.\ndeclare module "swarm-extension" {\n export type CreateTaskOptions = {\n key?: string | undefined;\n agentId?: string | null | undefined;\n creatorAgentId?: string | undefined;\n source?:\n | "chat"\n | "workflow"\n | "schedule"\n | "slack"\n | "agentmail"\n | "github"\n | "gitlab"\n | "azure-devops"\n | "bitbucket"\n | "linear"\n | "jira"\n | "mcp"\n | "api"\n | "ui"\n | "system"\n | "comb"\n | undefined;\n routingReason?:\n | "skill"\n | "continuity"\n | "overflow"\n | "human_pinned"\n | "reroute_fault"\n | undefined;\n routingSource?: "declared" | "engine_default" | undefined;\n routingNote?: string | undefined;\n taskType?: string | undefined;\n tags?: string[] | undefined;\n priority?: number | undefined;\n dependsOn?: string[] | undefined;\n offeredTo?: string | undefined;\n status?: "draft" | "backlog" | "unassigned" | undefined;\n slackChannelId?: string | undefined;\n slackThreadTs?: string | undefined;\n slackTriggerMessageTs?: string | undefined;\n slackUserId?: string | undefined;\n overrideSlackContext?: boolean | undefined;\n vcsProvider?: "github" | "gitlab" | "azure-devops" | "bitbucket" | undefined;\n vcsRepo?: string | undefined;\n vcsEventType?: string | undefined;\n vcsNumber?: number | undefined;\n vcsCommentId?: number | undefined;\n vcsAuthor?: string | undefined;\n vcsUrl?: string | undefined;\n vcsInstallationId?: number | undefined;\n vcsNodeId?: string | undefined;\n agentmailInboxId?: string | undefined;\n agentmailMessageId?: string | undefined;\n agentmailThreadId?: string | undefined;\n mentionMessageId?: string | undefined;\n mentionChannelId?: string | undefined;\n dir?: string | undefined;\n parentTaskId?: string | undefined;\n model?: string | undefined;\n modelTier?: "smol" | "regular" | "smart" | "ultra" | undefined;\n effort?: "low" | "medium" | "high" | "max" | "off" | "xhigh" | undefined;\n profile?: string | undefined;\n scheduleId?: string | undefined;\n workflowRunId?: string | undefined;\n workflowRunStepId?: string | undefined;\n sourceTaskId?: string | undefined;\n outputSchema?: Record<string, unknown> | undefined;\n inheritParentOutputSchema?: boolean | undefined;\n inheritParentRequester?: boolean | undefined;\n inheritParentRoutingAffinity?: boolean | undefined;\n inheritParentFollowUpConfig?: boolean | undefined;\n followUpConfig?:\n | {\n disabled?: boolean | undefined;\n onCompleted?: string | undefined;\n onFailed?: string | undefined;\n }\n | undefined;\n requestedByUserId?: string | undefined;\n contextKey?: string | undefined;\n bypassTrackerContextDedup?: boolean | undefined;\n routingAffinity?:\n | {\n capabilities: string[];\n sourceAgentId?: string | undefined;\n role?: string | undefined;\n harnessProvider?:\n | "pi"\n | "claude"\n | "claude-managed"\n | "codex"\n | "grok"\n | "fx"\n | "opencode"\n | "dsh"\n | "cursor"\n | "amp"\n | "devin"\n | "acp"\n | undefined;\n leadOnly?: boolean | undefined;\n }\n | undefined;\n };\n\n export type AgentTask = {\n id: string;\n key: string;\n agentId: string | null;\n task: string;\n status:\n | "skipped"\n | "draft"\n | "backlog"\n | "unassigned"\n | "offered"\n | "reviewing"\n | "pending"\n | "in_progress"\n | "paused"\n | "completed"\n | "failed"\n | "cancelled"\n | "superseded";\n source:\n | "chat"\n | "workflow"\n | "schedule"\n | "slack"\n | "agentmail"\n | "github"\n | "gitlab"\n | "azure-devops"\n | "bitbucket"\n | "linear"\n | "jira"\n | "mcp"\n | "api"\n | "ui"\n | "system"\n | "comb";\n tags: string[];\n priority: number;\n dependsOn: string[];\n createdAt: string;\n lastUpdatedAt: string;\n slackReplySent: boolean;\n wasPaused: boolean;\n creatorAgentId?: string | undefined;\n title?: string | undefined;\n routingReason?:\n | "skill"\n | "continuity"\n | "overflow"\n | "human_pinned"\n | "reroute_fault"\n | undefined;\n routingSource?: "declared" | "engine_default" | undefined;\n routingNote?: string | undefined;\n poolWakeAt?: string | undefined;\n taskType?: string | undefined;\n offeredTo?: string | undefined;\n offeredAt?: string | undefined;\n acceptedAt?: string | undefined;\n rejectionReason?: string | undefined;\n finishedAt?: string | undefined;\n notifiedAt?: string | undefined;\n failureReason?: string | undefined;\n output?: string | undefined;\n progress?: string | undefined;\n slackChannelId?: string | undefined;\n slackThreadTs?: string | undefined;\n slackTriggerMessageTs?: string | undefined;\n slackUserId?: string | undefined;\n slackProgressMessageTs?: string | undefined;\n slackTreeRootMessageTs?: string | undefined;\n vcsProvider?: "github" | "gitlab" | "azure-devops" | "bitbucket" | undefined;\n vcsRepo?: string | undefined;\n vcsEventType?: string | undefined;\n vcsNumber?: number | undefined;\n vcsCommentId?: number | undefined;\n vcsAuthor?: string | undefined;\n vcsUrl?: string | undefined;\n vcsInstallationId?: number | undefined;\n vcsNodeId?: string | undefined;\n agentmailInboxId?: string | undefined;\n agentmailMessageId?: string | undefined;\n agentmailThreadId?: string | undefined;\n mentionMessageId?: string | undefined;\n mentionChannelId?: string | undefined;\n dir?: string | undefined;\n parentTaskId?: string | undefined;\n claudeSessionId?: string | undefined;\n model?: string | undefined;\n modelTier?: "smol" | "regular" | "smart" | "ultra" | undefined;\n effort?: "low" | "medium" | "high" | "max" | "off" | "xhigh" | undefined;\n resolvedModel?: string | undefined;\n modelSource?: string | undefined;\n modelAlias?: string | undefined;\n resolvedEffort?: "low" | "medium" | "high" | "max" | "off" | "xhigh" | undefined;\n profile?: string | undefined;\n resolvedProfile?: string | undefined;\n scheduleId?: string | undefined;\n workflowRunId?: string | null | undefined;\n workflowRunStepId?: string | null | undefined;\n contextKey?: string | undefined;\n outputSchema?: Record<string, unknown> | undefined;\n followUpConfig?:\n | {\n disabled?: boolean | undefined;\n onCompleted?: string | undefined;\n onFailed?: string | undefined;\n }\n | undefined;\n deferredAt?: string | undefined;\n compactionCount?: number | undefined;\n peakContextPercent?: number | undefined;\n peakContextTokens?: number | undefined;\n contextWindowSize?: number | undefined;\n credentialKeySuffix?: string | undefined;\n credentialKeyType?: string | undefined;\n requestedByUserId?: string | undefined;\n swarmVersion?: string | undefined;\n provider?:\n | "pi"\n | "claude"\n | "claude-managed"\n | "codex"\n | "grok"\n | "fx"\n | "opencode"\n | "dsh"\n | "cursor"\n | "amp"\n | "devin"\n | "acp"\n | undefined;\n providerMeta?: Record<string, unknown> | undefined;\n harnessVariant?: string | undefined;\n harnessVariantMeta?: Record<string, unknown> | undefined;\n totalCostUsd?: number | undefined;\n routingAffinity?:\n | {\n capabilities: string[];\n sourceAgentId?: string | undefined;\n role?: string | undefined;\n harnessProvider?:\n | "pi"\n | "claude"\n | "claude-managed"\n | "codex"\n | "grok"\n | "fx"\n | "opencode"\n | "dsh"\n | "cursor"\n | "amp"\n | "devin"\n | "acp"\n | undefined;\n leadOnly?: boolean | undefined;\n }\n | undefined;\n routingAffinityInvalid?: boolean | undefined;\n };\n\n export type ActiveSession = {\n id: string;\n agentId: string;\n taskId: string | null;\n triggerType: string;\n inboxMessageId: string | null;\n taskDescription: string | null;\n runnerSessionId: string | null;\n providerSessionId: string | null;\n startedAt: string;\n lastHeartbeatAt: string;\n runtimeInstanceId?: string | null | undefined;\n };\n\n export type SteerMode = "steer" | "queue";\n\n export type SteeringSource = "chat" | "script" | "slack" | "mcp" | "api" | "ui";\n\n export type RequestInfo = {\n sessionId: string | undefined;\n agentId: string | undefined;\n runtimeInstanceId: string | undefined;\n sourceTaskId: string | undefined;\n contextKey: string | undefined;\n callOrigin: "mcp" | "extension" | "script-sdk";\n };\n\n import type { SwarmSdk } from "swarm-sdk";\n import type { z } from "zod";\n export type Runtime = "api" | "worker";\n export interface ExtensionScriptAsset {\n name: string;\n file: string;\n description: string;\n intent?: string;\n }\n export interface ExtensionScheduleAsset {\n name: string;\n description?: string;\n script: string;\n cronExpression?: string;\n intervalMs?: number;\n timezone?: string;\n args?: Record<string, unknown>;\n }\n export interface ExtensionWorkflowAsset {\n file: string;\n }\n export interface ExtensionSkillAsset {\n dir: string;\n }\n export interface ExtensionManifest {\n $schema?: string;\n name: string;\n description: string;\n version: string;\n runtime: Runtime;\n assets: {\n hooks: string;\n scripts?: readonly ExtensionScriptAsset[];\n schedules?: readonly ExtensionScheduleAsset[];\n workflows?: readonly ExtensionWorkflowAsset[];\n skills?: readonly ExtensionSkillAsset[];\n };\n homepage?: string;\n author?: string;\n }\n export interface HooksModule {\n default: SwarmExtension;\n config?: z.ZodTypeAny;\n }\n export interface ExtensionState {\n get<T = unknown>(key: string): Promise<T | null>;\n set<T>(key: string, value: T): Promise<void>;\n incr(key: string, by?: number): Promise<number>;\n del(key: string): Promise<void>;\n }\n export interface ExtensionLogger {\n debug(message: string, data?: unknown): void;\n info(message: string, data?: unknown): void;\n warn(message: string, data?: unknown): void;\n error(message: string, data?: unknown): void;\n }\n type ConfigFor<M extends ExtensionManifest> = M extends {\n config: infer C extends z.ZodTypeAny;\n }\n ? z.infer<C>\n : Record<string, unknown>;\n export interface ApiCtx<Config = Record<string, unknown>> {\n swarm: SwarmSdk;\n state: ExtensionState;\n config: Config;\n log: ExtensionLogger;\n signal: AbortSignal;\n event: {\n name: keyof SwarmEventMap;\n at: string;\n extension: {\n id: string;\n version: number;\n };\n };\n }\n export interface WorkerCtx<Config = Record<string, unknown>>\n extends Omit<ApiCtx<Config>, "swarm"> {\n swarm: SwarmSdk;\n worker: {\n agentId: string;\n taskId: string;\n harness: string;\n };\n }\n export type CtxFor<M extends ExtensionManifest> = M["runtime"] extends "api"\n ? ApiCtx<ConfigFor<M>>\n : WorkerCtx<ConfigFor<M>>;\n export type PreResult<Modify> =\n | void\n | {\n action: "continue";\n }\n | {\n action: "modify";\n data: Modify;\n }\n | {\n action: "block";\n reason: string;\n };\n export type TaskCreateOrigin =\n | "rest"\n | "app"\n | "mcp"\n | "slack"\n | "schedule"\n | "workflow"\n | "webhook"\n | "followUp"\n | `extension:${string}`;\n export interface TaskCreateEvent {\n options: CreateTaskOptions;\n description: string;\n origin: TaskCreateOrigin;\n requestInfo?: RequestInfo;\n /** Slack ingress metadata; not persisted or writable through modify. */\n slack?: {\n trigger: "mention" | "thread-buffer";\n messages: {\n ts: string;\n userId: string;\n text: string;\n }[];\n };\n }\n /** A pre.task.create hook blocked a task before it was created. */\n export interface TaskBlockedEvent {\n /** The extension that blocked, or whose model/agent rewrite was rejected. */\n extension: {\n id: string;\n name: string;\n };\n /** The scrubbed block reason. */\n reason: string;\n origin: TaskCreateOrigin;\n source?: AgentTask["source"];\n requester: {\n userId?: string;\n agentId?: string;\n slackUserId?: string;\n };\n context?: {\n contextKey?: string;\n scheduleId?: string;\n workflowRunId?: string;\n workflowRunStepId?: string;\n parentTaskId?: string;\n vcsRepo?: string;\n vcsNumber?: number;\n slackChannelId?: string;\n slackThreadTs?: string;\n };\n /** The original task description, scrubbed and cut to 500 characters. */\n description: string;\n }\n export type TaskCreateModify = Partial<\n Pick<\n CreateTaskOptions,\n | "agentId"\n | "creatorAgentId"\n | "source"\n | "taskType"\n | "tags"\n | "priority"\n | "dependsOn"\n | "offeredTo"\n | "vcsProvider"\n | "vcsRepo"\n | "vcsEventType"\n | "vcsNumber"\n | "vcsCommentId"\n | "vcsAuthor"\n | "vcsUrl"\n | "vcsInstallationId"\n | "vcsNodeId"\n | "agentmailInboxId"\n | "agentmailMessageId"\n | "agentmailThreadId"\n | "mentionMessageId"\n | "mentionChannelId"\n | "dir"\n | "model"\n | "modelTier"\n | "effort"\n | "outputSchema"\n | "followUpConfig"\n | "bypassTrackerContextDedup"\n >\n > & {\n description?: string;\n };\n export interface TaskFollowUpEvent {\n completedTask: AgentTask;\n status: "completed" | "failed";\n output?: string;\n failureReason?: string;\n workerAgentId: string;\n leadAgentId: string;\n summary: string;\n }\n export interface TaskSteerEvent {\n task: AgentTask;\n message: string;\n mode: SteerMode;\n source: SteeringSource;\n sender: {\n kind: "user" | "agent" | "system";\n userId?: string;\n agentId?: string;\n };\n messageTimestamps?: string[];\n /** Slack ingress metadata; not persisted or writable through modify. */\n slack?: {\n channelId: string;\n threadTs: string;\n userId?: string;\n };\n }\n export interface TaskSteerModify {\n message: string;\n }\n export type TaskFollowUpModify = Partial<\n Pick<CreateTaskOptions, "agentId" | "priority" | "followUpConfig">\n > & {\n description?: string;\n };\n export interface SlackRouteEvent {\n channelId: string;\n userId: string;\n text: string;\n threadTs?: string;\n botMentioned: boolean;\n threadContext?: {\n channelId: string;\n threadTs: string;\n };\n }\n export interface SlackRouteModify {\n target:\n | {\n kind: "agent";\n agentId: string;\n }\n | {\n kind: "lead";\n }\n | {\n kind: "broadcast";\n };\n }\n /** A Chat SDK message after its thread buffer flushed, before routing. */\n export interface ChatRouteEvent {\n /** Adapter name, such as `telegram` or `slack`. */\n adapter: string;\n channelId: string;\n /** The Chat SDK thread id, prefixed with the adapter name. */\n threadId: string;\n /** The first buffered sender. */\n userId: string;\n userName?: string;\n /** The buffered messages, joined. */\n text: string;\n /** True for an @mention and for a reply to one of the bot\'s messages. */\n botMentioned: boolean;\n isDirectMessage: boolean;\n /** Platform chat type, such as Telegram `private`, `group`, `supergroup` or `channel`. */\n chatType?: string;\n /** Set for a Telegram supergroup with topics. */\n isForum?: boolean;\n /** A buffered message replies to one of the bot\'s own messages. */\n replyToBot: boolean;\n /** Set when earlier swarm tasks exist in this thread. */\n threadContext?: {\n adapter: string;\n threadId: string;\n };\n }\n export interface ChatRouteModify {\n target:\n | {\n kind: "agent";\n agentId: string;\n }\n | {\n kind: "lead";\n }\n | {\n kind: "broadcast";\n }\n | {\n kind: "workflow";\n workflowId: string;\n };\n }\n export type HeartbeatClassification = "no-session" | "stale-session" | "fresh-stalled";\n export type HeartbeatAction = "supersede-resume" | "fail" | "record";\n export interface HeartbeatRemediateEvent {\n task: AgentTask;\n session?: ActiveSession;\n classification: HeartbeatClassification;\n proposedAction: HeartbeatAction;\n reason: string;\n taskAgeMs: number;\n sessionHeartbeatAgeMs?: number;\n }\n export interface HeartbeatRemediateModify {\n proposedAction: HeartbeatAction;\n }\n export interface ToolCallEvent {\n tool: string;\n args: unknown;\n requestInfo: RequestInfo;\n }\n export interface ToolCallModify {\n args: unknown;\n }\n export interface TaskEvent {\n task: AgentTask;\n }\n export interface TaskCompletedEvent extends TaskEvent {\n output: string;\n }\n export interface TaskFailedEvent extends TaskEvent {\n failureReason: string;\n }\n export interface TaskSupersededEvent extends TaskEvent {\n supersededBy: string;\n }\n export interface TaskProgressEvent extends TaskEvent {\n progress: string;\n }\n export interface SlackMessageEvent {\n channelId: string;\n userId: string;\n text: string;\n threadTs?: string;\n taskId?: string;\n }\n /** A Chat SDK message the swarm received or sent. */\n export interface ChatMessageEvent {\n adapter: string;\n channelId: string;\n threadId: string;\n /** The sender, for an inbound message. */\n userId?: string;\n text: string;\n direction: "inbound" | "outbound";\n taskId?: string;\n messageId?: string;\n }\n /**\n * A person answered an approval request. Fires for workflow and standalone\n * requests. Timeouts and cancellations do not emit it today.\n */\n export interface ApprovalResolvedEvent {\n requestId: string;\n status: "approved" | "rejected" | "timeout" | "cancelled";\n responses: Record<string, unknown> | null;\n /** Set when a workflow human-in-the-loop step asked. Absent for a standalone request. */\n workflowRunId?: string;\n workflowRunStepId?: string;\n /** The task whose agent asked, for a standalone request. */\n sourceTaskId?: string;\n }\n /** A task was refused because a daily spend budget is used up. */\n export interface TaskBudgetRefusedEvent extends TaskEvent {\n /** The agent the task was refused for. */\n agentId: string;\n /** Which budget refused it. The matching spend and budget fields are set. */\n cause: "agent" | "global" | "user";\n agentSpendUsd?: number;\n agentBudgetUsd?: number;\n globalSpendUsd?: number;\n globalBudgetUsd?: number;\n userSpendUsd?: number;\n userBudgetUsd?: number;\n /** ISO 8601 time the daily budget resets. */\n resetAt: string;\n }\n /** An inbound AgentMail message. */\n export interface EmailReceivedEvent {\n inboxId: string;\n /** The From header as sent. */\n from: string;\n subject: string;\n /** The text body, or the HTML when there is no text, cut to 500 characters with `...` appended. */\n body: string;\n threadId: string;\n messageId: string;\n }\n /** An inbound Kapso (WhatsApp) message. */\n export interface KapsoMessageEvent {\n phoneNumberId: string;\n conversationId?: string;\n messageId: string;\n from?: string;\n /** Kapso message type, such as `text` or `image`. */\n type?: string;\n /** The text, or a placeholder naming the type for a non-text message. */\n text: string;\n }\n export type VcsProvider = "github" | "gitlab" | "azure-devops" | "bitbucket";\n /**\n * The provider object the event is about, as the provider names it. GitLab\n * calls a pull request a merge request, and a comment a `note`.\n */\n export type VcsEventKind =\n | "pull_request"\n | "merge_request"\n | "issue"\n | "issue_comment"\n | "note"\n | "pull_request_review"\n | "pipeline";\n /**\n * A webhook event from a connected code host. `action` is the provider\'s own\n * value: `opened`, `closed`, `synchronize`, `merge`, `created`, `commented`, or,\n * for a pipeline, its status such as `success` or `failed`. Fields a kind does\n * not carry are absent.\n */\n export interface VcsEvent {\n provider: VcsProvider;\n kind: VcsEventKind;\n action: string;\n /** `owner/name` on GitHub and GitLab, `workspace/repo_slug` on Bitbucket, the repository URL on Azure DevOps. */\n repo: string;\n /** The PR, merge request, or issue number. Absent for a pipeline outside a merge request. */\n number?: number;\n title?: string;\n body?: string | null;\n /** Login of the user behind the event. Set for pull requests, merge requests, and Azure DevOps comments. */\n author?: string;\n url?: string;\n merged?: boolean;\n changedFiles?: number;\n /** The review verdict, on a pull request review. */\n reviewState?: string;\n }\n export interface ToolCallCompletedEvent extends ToolCallEvent {\n result: unknown;\n durationMs: number;\n }\n export interface SwarmEventMap {\n "pre.task.create": {\n event: TaskCreateEvent;\n modify: TaskCreateModify;\n result: PreResult<TaskCreateModify>;\n };\n "pre.task.followUp": {\n event: TaskFollowUpEvent;\n modify: TaskFollowUpModify;\n result: PreResult<TaskFollowUpModify>;\n };\n "pre.task.steer": {\n event: TaskSteerEvent;\n modify: TaskSteerModify;\n result: PreResult<TaskSteerModify>;\n };\n "pre.slack.route": {\n event: SlackRouteEvent;\n modify: SlackRouteModify;\n result: PreResult<SlackRouteModify>;\n };\n "pre.chat.route": {\n event: ChatRouteEvent;\n modify: ChatRouteModify;\n result: PreResult<ChatRouteModify>;\n };\n "pre.heartbeat.remediate": {\n event: HeartbeatRemediateEvent;\n modify: HeartbeatRemediateModify;\n result: PreResult<HeartbeatRemediateModify>;\n };\n "pre.tool.call": {\n event: ToolCallEvent;\n modify: ToolCallModify;\n result: PreResult<ToolCallModify>;\n };\n "post.task.created": {\n event: TaskEvent;\n modify: never;\n result: void;\n };\n "post.task.blocked": {\n event: TaskBlockedEvent;\n modify: never;\n result: void;\n };\n "post.task.completed": {\n event: TaskCompletedEvent;\n modify: never;\n result: void;\n };\n "post.task.failed": {\n event: TaskFailedEvent;\n modify: never;\n result: void;\n };\n "post.task.cancelled": {\n event: TaskEvent;\n modify: never;\n result: void;\n };\n "post.task.superseded": {\n event: TaskSupersededEvent;\n modify: never;\n result: void;\n };\n "post.task.progress": {\n event: TaskProgressEvent;\n modify: never;\n result: void;\n };\n "post.slack.message": {\n event: SlackMessageEvent;\n modify: never;\n result: void;\n };\n "post.chat.message": {\n event: ChatMessageEvent;\n modify: never;\n result: void;\n };\n "post.approval.resolved": {\n event: ApprovalResolvedEvent;\n modify: never;\n result: void;\n };\n "post.task.budgetRefused": {\n event: TaskBudgetRefusedEvent;\n modify: never;\n result: void;\n };\n "post.email.received": {\n event: EmailReceivedEvent;\n modify: never;\n result: void;\n };\n "post.kapso.message": {\n event: KapsoMessageEvent;\n modify: never;\n result: void;\n };\n "post.vcs.event": {\n event: VcsEvent;\n modify: never;\n result: void;\n };\n "post.tool.call": {\n event: ToolCallCompletedEvent;\n modify: never;\n result: void;\n };\n }\n export interface ExtensionApi<\n M extends ExtensionManifest = ExtensionManifest & {\n runtime: "api";\n },\n > {\n on<E extends keyof SwarmEventMap>(\n event: E,\n handler: (\n event: SwarmEventMap[E]["event"],\n ctx: CtxFor<M>,\n ) => Promise<SwarmEventMap[E]["result"]> | SwarmEventMap[E]["result"],\n opts?: {\n priority?: number;\n },\n ): void;\n }\n export type SwarmExtension<\n M extends ExtensionManifest = ExtensionManifest & {\n runtime: "api";\n },\n > = (api: ExtensionApi<M>) => void;\n export { block, modify } from "./contract-runtime";\n}\n';
|
package/src/http/agents.ts
CHANGED
|
@@ -556,7 +556,7 @@ const updateAgentProfileRoute = route({
|
|
|
556
556
|
profileSyncRejection: ProfileSyncRejectionSchema.optional(),
|
|
557
557
|
}),
|
|
558
558
|
},
|
|
559
|
-
404: { description: "Agent not found" },
|
|
559
|
+
404: { description: "Agent not found, or changedByAgentId names no agent" },
|
|
560
560
|
},
|
|
561
561
|
});
|
|
562
562
|
|
|
@@ -994,6 +994,12 @@ export async function handleAgentsRest(
|
|
|
994
994
|
return true;
|
|
995
995
|
}
|
|
996
996
|
|
|
997
|
+
// context_versions.changed_by_agent_id is a foreign key: answer 404 instead of a bare 500.
|
|
998
|
+
if (body.changedByAgentId && !(await getAgentById(body.changedByAgentId))) {
|
|
999
|
+
jsonError(res, "changed_by_agent_not_found", 404);
|
|
1000
|
+
return true;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
997
1003
|
// Build version metadata if provided
|
|
998
1004
|
const validChangeSources = ["self_edit", "lead_coaching", "api", "system", "session_sync"];
|
|
999
1005
|
const versionMeta =
|
|
@@ -74,8 +74,14 @@ const QuestionSchema = z.object({
|
|
|
74
74
|
),
|
|
75
75
|
});
|
|
76
76
|
|
|
77
|
-
/**
|
|
78
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Create input: `label` may be omitted on a config question (it defaults to the key), and
|
|
79
|
+
* `required` defaults to true like the request-human-input tool and the workflow node.
|
|
80
|
+
*/
|
|
81
|
+
const QuestionInputSchema = QuestionSchema.extend({
|
|
82
|
+
label: z.string().optional(),
|
|
83
|
+
required: z.boolean().default(true),
|
|
84
|
+
});
|
|
79
85
|
|
|
80
86
|
export type ApprovalQuestion = z.infer<typeof QuestionSchema>;
|
|
81
87
|
|
|
@@ -310,14 +316,32 @@ function hasRequiredResponse(question: ApprovalQuestion, response: unknown): boo
|
|
|
310
316
|
}
|
|
311
317
|
}
|
|
312
318
|
|
|
319
|
+
/** No answer given: absent, null, a blank string or an empty list. */
|
|
320
|
+
function isUnanswered(response: unknown): boolean {
|
|
321
|
+
return (
|
|
322
|
+
response === undefined ||
|
|
323
|
+
response === null ||
|
|
324
|
+
(typeof response === "string" && response.trim() === "") ||
|
|
325
|
+
(Array.isArray(response) && response.length === 0)
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Questions whose answer blocks the response: a required question without a valid answer,
|
|
331
|
+
* or an optional one that was answered with an invalid value. An unanswered optional
|
|
332
|
+
* question passes. Config answers are checked later by `parseConfigAnswer`.
|
|
333
|
+
*/
|
|
313
334
|
export function missingRequiredResponseIds(
|
|
314
335
|
questions: ApprovalQuestion[],
|
|
315
336
|
responses: Record<string, unknown>,
|
|
316
337
|
): string[] {
|
|
317
338
|
return questions
|
|
318
|
-
.filter(
|
|
319
|
-
|
|
320
|
-
|
|
339
|
+
.filter((question) => {
|
|
340
|
+
const response = responses[question.id];
|
|
341
|
+
if (hasRequiredResponse(question, response)) return false;
|
|
342
|
+
if (question.required) return true;
|
|
343
|
+
return question.type !== "config" && !isUnanswered(response);
|
|
344
|
+
})
|
|
321
345
|
.map((question) => question.id);
|
|
322
346
|
}
|
|
323
347
|
|
|
@@ -556,7 +580,7 @@ export async function handleApprovalRequests(
|
|
|
556
580
|
const questions = existing.questions as ApprovalQuestion[];
|
|
557
581
|
const missingRequired = missingRequiredResponseIds(questions, parsed.body.responses);
|
|
558
582
|
if (missingRequired.length > 0) {
|
|
559
|
-
jsonError(res, `
|
|
583
|
+
jsonError(res, `Responses missing or invalid: ${missingRequired.join(", ")}`, 400);
|
|
560
584
|
return true;
|
|
561
585
|
}
|
|
562
586
|
|
|
@@ -6,7 +6,7 @@ import { getCodexDeviceFlow, upsertCodexDeviceFlow } from "../be/db/codex-oauth-
|
|
|
6
6
|
import { updateOnboardingAiFromCodexDevice } from "../be/onboarding";
|
|
7
7
|
import { deriveCodexKeySuffix } from "../providers/codex-oauth/auth-json";
|
|
8
8
|
import {
|
|
9
|
-
|
|
9
|
+
codexDeviceVerificationUrl,
|
|
10
10
|
DeviceCodeNotEnabledError,
|
|
11
11
|
exchangeDeviceAuthorizationCode,
|
|
12
12
|
pollDeviceToken,
|
|
@@ -306,7 +306,7 @@ export async function handleCodexOAuthDevice(
|
|
|
306
306
|
startDeviceFlow.respond(res, 200, {
|
|
307
307
|
flowId,
|
|
308
308
|
userCode: device.userCode,
|
|
309
|
-
verificationUrl:
|
|
309
|
+
verificationUrl: codexDeviceVerificationUrl(),
|
|
310
310
|
intervalSeconds: device.intervalSeconds,
|
|
311
311
|
expiresAt: new Date(expiresAt).toISOString(),
|
|
312
312
|
});
|
package/src/http/index.ts
CHANGED
|
@@ -910,6 +910,14 @@ httpServer
|
|
|
910
910
|
console.error("[embedding-space] startup maintenance failed (non-fatal):", err);
|
|
911
911
|
});
|
|
912
912
|
|
|
913
|
+
// Normalize stored schema JSON so defaulted fields become optional.
|
|
914
|
+
// This repair never executes script source. It is idempotent and non-fatal.
|
|
915
|
+
import("../be/scripts/boot-args-schema")
|
|
916
|
+
.then(({ runBootArgsSchemaBackfill }) => runBootArgsSchemaBackfill())
|
|
917
|
+
.catch((err) => {
|
|
918
|
+
console.error("[boot-args-schema] startup backfill failed (non-fatal):", err);
|
|
919
|
+
});
|
|
920
|
+
|
|
913
921
|
// Versioned retro-sweep: once per SCRUBBER_RULES_VERSION, redact stored
|
|
914
922
|
// rows (logs, tasks, memory, events, workflow steps) that pre-date the
|
|
915
923
|
// current scrubber rules. Idempotent and resumable, tracked via seed_state.
|
package/src/http/mcp-oauth.ts
CHANGED
|
@@ -239,6 +239,10 @@ const metadataRoute = route({
|
|
|
239
239
|
},
|
|
240
240
|
400: { description: "MCP has no URL / invalid transport" },
|
|
241
241
|
404: { description: "MCP server not found" },
|
|
242
|
+
502: {
|
|
243
|
+
description:
|
|
244
|
+
"Metadata discovery failed: the protected-resource or authorization-server metadata could not be fetched or was refused by the egress guard",
|
|
245
|
+
},
|
|
242
246
|
},
|
|
243
247
|
});
|
|
244
248
|
|
|
@@ -347,6 +351,8 @@ const disconnectRoute = route({
|
|
|
347
351
|
path: "/api/mcp-oauth/{mcpServerId}",
|
|
348
352
|
pattern: ["api", "mcp-oauth", null],
|
|
349
353
|
summary: "Revoke and delete the OAuth token for an MCP server",
|
|
354
|
+
description:
|
|
355
|
+
"Idempotent: the connection row is kept with status revoked (its tokens are cleared) and the server returns to static auth, so a repeat call answers 200 and /status keeps returning the revoked token object.",
|
|
350
356
|
tags: ["MCP OAuth"],
|
|
351
357
|
auth: { apiKey: true },
|
|
352
358
|
params: z.object({ mcpServerId: z.string() }),
|
package/src/http/mcp-servers.ts
CHANGED
|
@@ -106,6 +106,10 @@ const createMcpServerRoute = route({
|
|
|
106
106
|
responses: {
|
|
107
107
|
201: { description: "MCP server created", schema: z.object({ server: McpServerSchema }) },
|
|
108
108
|
400: { description: "Validation error" },
|
|
109
|
+
409: {
|
|
110
|
+
description:
|
|
111
|
+
"A server with this name already exists in the same scope and owner (mcp_server_name_taken)",
|
|
112
|
+
},
|
|
109
113
|
},
|
|
110
114
|
rbac: { permission: "mcp-server.create.swarm" },
|
|
111
115
|
});
|
|
@@ -518,6 +522,10 @@ export async function handleMcpServers(
|
|
|
518
522
|
await emitMcpServerConnectedTelemetry();
|
|
519
523
|
createMcpServerRoute.respond(res, 201, { server });
|
|
520
524
|
} catch (err) {
|
|
525
|
+
if (err instanceof Error && err.message.includes("UNIQUE constraint")) {
|
|
526
|
+
jsonError(res, "mcp_server_name_taken", 409);
|
|
527
|
+
return true;
|
|
528
|
+
}
|
|
521
529
|
jsonError(res, err instanceof Error ? err.message : "Create failed", 400);
|
|
522
530
|
}
|
|
523
531
|
return true;
|
|
@@ -117,7 +117,7 @@ const getCatalog = route({
|
|
|
117
117
|
pattern: ["api", "models-catalog"],
|
|
118
118
|
summary: "Get the live model catalog for the picker-reachable providers",
|
|
119
119
|
description:
|
|
120
|
-
"Slim projection of the models.dev payload (
|
|
120
|
+
"Slim projection of the models.dev payload (the vendored models.dev snapshot, or the live fetch once one succeeds) plus the OpenAI-compatible registry providers; see the `providers` field for the live list. Refreshed server-side at boot and every 12h by the pricing-refresh loop. `source` is 'snapshot' with `updatedAt: null` until the first successful fetch (or when models.dev is unreachable), in which case the vendored snapshot is served instead.",
|
|
121
121
|
tags: ["Pricing"],
|
|
122
122
|
responses: {
|
|
123
123
|
200: {
|
package/src/http/pages-public.ts
CHANGED
|
@@ -43,7 +43,9 @@ import { getAppUrl, getConfiguredAppUrls, getLocalDevAppOrigins } from "../utils
|
|
|
43
43
|
import {
|
|
44
44
|
extractAndVerifyCookie,
|
|
45
45
|
isLocalDevPageRequest,
|
|
46
|
+
LEGACY_PAGE_SESSION_COOKIE,
|
|
46
47
|
pageSessionSetCookies,
|
|
48
|
+
verifyPageSession,
|
|
47
49
|
} from "../utils/page-session";
|
|
48
50
|
import { scrubSecrets } from "../utils/secret-scrubber";
|
|
49
51
|
import { route } from "./route-def";
|
|
@@ -377,7 +379,9 @@ function buildCsp(page: Page): string {
|
|
|
377
379
|
* payload names this page (the cookie is the proof once the user has
|
|
378
380
|
* successfully unlocked once). For password pages, when the cookie is
|
|
379
381
|
* absent/invalid the caller falls through to the `?key=` + Basic-auth
|
|
380
|
-
* resolution path; for authed pages the caller surfaces 401
|
|
382
|
+
* resolution path; for authed pages the caller surfaces 401 (403 when the
|
|
383
|
+
* request carries a valid session for a different page, see
|
|
384
|
+
* `hasSessionForOtherPage`).
|
|
381
385
|
*
|
|
382
386
|
* The caller passes the cookie payload (already verified by
|
|
383
387
|
* `extractAndVerifyCookie`, which ignores sessions for other pages) — `null`
|
|
@@ -417,6 +421,29 @@ function isAccessible(
|
|
|
417
421
|
};
|
|
418
422
|
}
|
|
419
423
|
|
|
424
|
+
/**
|
|
425
|
+
* True when the request carries a verified page-session cookie (per-page or
|
|
426
|
+
* legacy name) whose signed payload names a page other than `pageId`. Lets an
|
|
427
|
+
* authed page tell "your session is for another page" (403) from "no usable
|
|
428
|
+
* session" (401). Missing, tampered, or expired cookies never count.
|
|
429
|
+
*/
|
|
430
|
+
async function hasSessionForOtherPage(req: IncomingMessage, pageId: string): Promise<boolean> {
|
|
431
|
+
const header = req.headers.cookie;
|
|
432
|
+
if (!header) return false;
|
|
433
|
+
const pairs = (Array.isArray(header) ? header.join("; ") : header).split(";");
|
|
434
|
+
for (const pair of pairs) {
|
|
435
|
+
const eq = pair.indexOf("=");
|
|
436
|
+
if (eq === -1) continue;
|
|
437
|
+
const name = pair.slice(0, eq).trim();
|
|
438
|
+
if (name !== LEGACY_PAGE_SESSION_COOKIE && !name.startsWith(`${LEGACY_PAGE_SESSION_COOKIE}_`)) {
|
|
439
|
+
continue;
|
|
440
|
+
}
|
|
441
|
+
const payload = await verifyPageSession(pair.slice(eq + 1).trim());
|
|
442
|
+
if (payload && payload.pageId !== pageId) return true;
|
|
443
|
+
}
|
|
444
|
+
return false;
|
|
445
|
+
}
|
|
446
|
+
|
|
420
447
|
/**
|
|
421
448
|
* Extract a password candidate from the request. Order of precedence:
|
|
422
449
|
* 1. `?key=` query param (if present, returns it verbatim — empty string is
|
|
@@ -545,6 +572,16 @@ export async function handlePagesPublic(
|
|
|
545
572
|
return true;
|
|
546
573
|
}
|
|
547
574
|
} else {
|
|
575
|
+
// A valid session for ANOTHER page is a mismatch (403), not a missing session (401).
|
|
576
|
+
if (await hasSessionForOtherPage(req, page.id)) {
|
|
577
|
+
res.writeHead(403, { "Content-Type": "application/json" });
|
|
578
|
+
res.end(
|
|
579
|
+
JSON.stringify({
|
|
580
|
+
error: "page-session cookie does not match this page id; POST /api/pages/:id/launch",
|
|
581
|
+
}),
|
|
582
|
+
);
|
|
583
|
+
return true;
|
|
584
|
+
}
|
|
548
585
|
res.writeHead(access.status, { "Content-Type": "application/json" });
|
|
549
586
|
res.end(JSON.stringify({ error: scrubSecrets(access.reason) }));
|
|
550
587
|
return true;
|
package/src/http/poll.ts
CHANGED
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
getAgentById,
|
|
14
14
|
getAllChannelActivityCursors,
|
|
15
15
|
getDbClient,
|
|
16
|
-
getInboxSummary,
|
|
17
16
|
getOfferedTasksForAgent,
|
|
18
17
|
getPendingTaskForAgent,
|
|
19
18
|
getTaskAttachments,
|
|
@@ -524,12 +523,12 @@ export async function handlePoll(
|
|
|
524
523
|
// would instruct a missing tool and strand the claimed mentions.
|
|
525
524
|
const claimedChannels = hasCapability("messaging") ? await claimMentions(myAgentId) : [];
|
|
526
525
|
if (claimedChannels.length > 0) {
|
|
527
|
-
//
|
|
528
|
-
|
|
526
|
+
// Count what this claim took: the inbox summary no longer sees mentions already
|
|
527
|
+
// moved to "processing".
|
|
529
528
|
return {
|
|
530
529
|
trigger: {
|
|
531
530
|
type: "unread_mentions",
|
|
532
|
-
mentionsCount:
|
|
531
|
+
mentionsCount: claimedChannels.reduce((sum, c) => sum + c.mentionsCount, 0),
|
|
533
532
|
claimedChannels: claimedChannels.map((c) => c.channelId), // Include for tracking
|
|
534
533
|
},
|
|
535
534
|
};
|
|
@@ -366,7 +366,7 @@ export async function handlePromptTemplates(
|
|
|
366
366
|
checkoutRoute.respond(res, 200, { template: toPromptTemplateResponse(template) });
|
|
367
367
|
} catch (error) {
|
|
368
368
|
const message = error instanceof Error ? error.message : "Unknown error";
|
|
369
|
-
if (message.includes("not found")) {
|
|
369
|
+
if (message.includes("not found") || message.startsWith("No history entry")) {
|
|
370
370
|
jsonError(res, message, 404);
|
|
371
371
|
} else {
|
|
372
372
|
jsonError(res, message, 400);
|
package/src/http/schedules.ts
CHANGED
|
@@ -343,6 +343,10 @@ export async function handleSchedules(
|
|
|
343
343
|
);
|
|
344
344
|
return true;
|
|
345
345
|
}
|
|
346
|
+
if (!body.cronExpression && !body.intervalMs) {
|
|
347
|
+
jsonError(res, "Either cronExpression or intervalMs must be provided.", 400);
|
|
348
|
+
return true;
|
|
349
|
+
}
|
|
346
350
|
}
|
|
347
351
|
|
|
348
352
|
if (body.cronExpression) {
|
package/src/http/script-runs.ts
CHANGED
|
@@ -238,6 +238,8 @@ const postInternalStepRoute = route({
|
|
|
238
238
|
pattern: ["api", "internal", "script-runs", null, "steps"],
|
|
239
239
|
operationId: "script_runs_internal_step_create",
|
|
240
240
|
summary: "Write a script run journal step",
|
|
241
|
+
description:
|
|
242
|
+
"Write-once per stepKey; a replay keeps the first journal entry and still answers 201.",
|
|
241
243
|
tags: ["Script Runs"],
|
|
242
244
|
params: runIdParamsSchema,
|
|
243
245
|
body: journalStepBodySchema,
|
|
@@ -856,10 +858,13 @@ export async function handleScriptRuns(
|
|
|
856
858
|
agentTaskRoute.respond(res, 200, { taskId: latest.id, taskOutput: latest.output ?? null });
|
|
857
859
|
return true;
|
|
858
860
|
}
|
|
861
|
+
// A skipped step did not do its work, so it settles as a failure, the
|
|
862
|
+
// same way the workflow engine routes it.
|
|
859
863
|
if (
|
|
860
864
|
latest.status === "failed" ||
|
|
861
865
|
latest.status === "cancelled" ||
|
|
862
|
-
latest.status === "superseded"
|
|
866
|
+
latest.status === "superseded" ||
|
|
867
|
+
latest.status === "skipped"
|
|
863
868
|
) {
|
|
864
869
|
json(res, { error: `Agent task ${latest.status}`, taskId: latest.id }, 409);
|
|
865
870
|
return true;
|