@desplega.ai/agent-swarm 1.112.0 → 1.114.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/{actions-eckb4g8r.js → actions-bm8vdxys.js} +7 -8
- package/dist/{app-b05sgm02.js → app-bhwdxmvp.js} +5 -5
- package/dist/{assistant-7255sbyw.js → assistant-15mp2apr.js} +18 -17
- package/dist/{boot-reembed-y1bt3ttn.js → boot-reembed-awr2179r.js} +6 -6
- package/dist/{boot-reembed-yv7awg4y.js → boot-reembed-b9sbk87z.js} +5 -5
- package/dist/{boot-scrub-logs-ddyaeqar.js → boot-scrub-logs-c1zsaw9m.js} +4 -4
- package/dist/{claude-adapter-mma9a1yr.js → claude-adapter-2k45y7p7.js} +2 -2
- package/dist/{claude-managed-adapter-pv2nbqy4.js → claude-managed-adapter-kysmkz89.js} +2 -2
- package/dist/cli-0kgcv878.js +344 -0
- package/dist/cli-0pygq9r1.js +429 -0
- package/dist/{cli-7xkwgkrs.js → cli-113wmegp.js} +90 -3
- package/dist/{cli-7ga43spr.js → cli-1yjrbg1f.js} +1 -1
- package/dist/{cli-56s4ehzw.js → cli-2t4e4ayk.js} +1 -1
- package/dist/{cli-0c3n0eba.js → cli-312v3c41.js} +1 -1
- package/dist/{cli-ceewqajw.js → cli-46b6kc7f.js} +5 -5
- package/dist/cli-49j095n9.js +393 -0
- package/dist/{cli-h9jx5mag.js → cli-5afkmcfj.js} +10 -7
- package/dist/{cli-76d1vtvq.js → cli-5ktc9fd4.js} +1 -1
- package/dist/cli-7rgh0w0k.js +262 -0
- package/dist/{cli-9cy6nc5m.js → cli-8fjwym53.js} +1 -1
- package/dist/{cli-tg0f2wmz.js → cli-a6tzw6vq.js} +175 -28
- package/dist/{cli-q21d49ac.js → cli-bw80ck94.js} +1 -1
- package/dist/{cli-709t753c.js → cli-byjcad11.js} +2 -2
- package/dist/{cli-15598a4k.js → cli-e2xbxmhd.js} +1808 -302
- package/dist/{cli-6wscj9z0.js → cli-e7306swv.js} +14 -14
- package/dist/{cli-8f0dwca2.js → cli-f5pzfvwb.js} +6 -5
- package/dist/{cli-s9pj3c7z.js → cli-f9n2jg31.js} +2 -2
- package/dist/{cli-dcfyyh3t.js → cli-ftyf58xj.js} +2 -2
- package/dist/{cli-hm27prrc.js → cli-hq39e630.js} +5 -5
- package/dist/{cli-a5e8n5hg.js → cli-hvg05qwm.js} +1 -1
- package/dist/cli-jkhwmmgg.js +136 -0
- package/dist/{cli-951w7c79.js → cli-jzwtn8rm.js} +136 -21
- package/dist/{cli-rp8pca98.js → cli-k6h2zkw3.js} +1 -1
- package/dist/{cli-3r5y6ayj.js → cli-pnfyyp6h.js} +1240 -335
- package/dist/{cli-94vzr3nq.js → cli-q1z5d5ss.js} +13 -7
- package/dist/{cli-pt7c7qxz.js → cli-q4e2x252.js} +3 -3
- package/dist/{cli-tch0ypp6.js → cli-r3mtrrzp.js} +16 -16
- package/dist/{cli-ywez6yps.js → cli-sq7f72d6.js} +1 -1
- package/dist/{cli-r1btc895.js → cli-w3nq88yc.js} +2 -2
- package/dist/{cli-30d2ct3k.js → cli-w4wk3kx6.js} +12 -7
- package/dist/{cli-anrj584m.js → cli-xz9aq0rf.js} +1 -1
- package/dist/{cli-tp7e60s3.js → cli-zmmp2r79.js} +22 -9
- package/dist/cli.js +35 -17
- package/dist/{codex-adapter-5cmy858w.js → codex-adapter-4z8m9mb5.js} +9 -9
- package/dist/{codex-session-runner-46q8mrba.js → codex-session-runner-rbct46dg.js} +9 -9
- package/dist/{commands-14g7taf4.js → commands-zk4d6esf.js} +4 -4
- package/dist/{db-3tge4jrn.js → db-stn16jp2.js} +4 -4
- package/dist/{handlers-sy64egg6.js → handlers-gshprvpf.js} +16 -30
- package/dist/{hook-rnkzw8vp.js → hook-amzx9tap.js} +7 -7
- package/dist/{http-xx9xptcs.js → http-6g0hfzax.js} +1977 -786
- package/dist/{index-wz1ea15p.js → index-2dgfj9av.js} +3 -3
- package/dist/{index-ha8e9xn2.js → index-df8fmphk.js} +55 -17
- package/dist/{index-zfx5p959.js → index-f03rnnrs.js} +13 -10
- package/dist/{index-3wr6v2mm.js → index-jbm7qcqk.js} +12 -9
- package/dist/{index-ykvs43z4.js → index-t2snazez.js} +4 -4
- package/dist/{index-brma88d4.js → index-ty42rxw9.js} +14 -11
- package/dist/{keepalive-rbz05zad.js → keepalive-pm6g2wpw.js} +7 -6
- package/dist/{lead-s790v7r0.js → lead-h79fzpzw.js} +33 -29
- package/dist/{maintenance-420rmadb.js → maintenance-433zndy1.js} +6 -6
- package/dist/{mistral-conversations-26yrnbf1.js → mistral-conversations-7gqnz2wt.js} +7 -7
- package/dist/oauth-refresh-sweep-mjsbmsk2.js +114 -0
- package/dist/{onboard-jgqamqnw.js → onboard-vdr9hc3f.js} +2 -2
- package/dist/{otel-zjd9zaxs.js → otel-g299k41b.js} +2 -2
- package/dist/{otel-impl-ch3n3783.js → otel-impl-yswd0fty.js} +1 -1
- package/dist/{pi-mono-adapter-kxjxpfgy.js → pi-mono-adapter-vbrvg1p8.js} +16 -108
- package/dist/{pricing-refresh-rmtrby6h.js → pricing-refresh-2kk2ap9b.js} +6 -6
- package/dist/rbac-roles-2wgh9b5t.js +276 -0
- package/dist/rbac-roles-xdc5208b.js +28 -0
- package/dist/{seed-pricing-1szjzfj1.js → seed-pricing-m9h69d2t.js} +5 -5
- package/dist/{setup-8jfzkyzv.js → setup-eynkvafa.js} +2 -2
- package/dist/{worker-40vq0pm8.js → worker-136q8dc2.js} +33 -29
- package/openapi.json +1634 -20
- package/package.json +6 -5
- package/src/agentmail/handlers.ts +16 -6
- package/src/agentmail/templates.ts +25 -5
- package/src/be/audit-user.ts +28 -4
- package/src/be/db-queries/oauth.ts +42 -0
- package/src/be/db.ts +104 -11
- package/src/be/identity.ts +79 -0
- package/src/be/mcp-proxy.ts +132 -0
- package/src/be/memory/providers/sqlite-store.ts +5 -1
- package/src/be/migrations/108_rbac_permission_audit.sql +26 -0
- package/src/be/migrations/109_rbac_roles.sql +79 -0
- package/src/be/migrations/111_oauth_credential_bindings.sql +6 -0
- package/src/be/migrations/112_script_connections_graphql.sql +96 -0
- package/src/be/oauth-credential-bindings.ts +35 -0
- package/src/be/oauth-refresh-sweep.ts +159 -0
- package/src/be/rbac-audit.ts +246 -0
- package/src/be/rbac-roles.ts +417 -0
- package/src/be/script-connections.ts +456 -37
- package/src/be/script-credential-broker.ts +29 -3
- package/src/be/scripts/typecheck.ts +40 -7
- package/src/be/users.ts +24 -0
- package/src/cli.tsx +17 -0
- package/src/github/handlers.ts +10 -9
- package/src/github/templates.ts +45 -9
- package/src/gitlab/handlers.ts +20 -8
- package/src/gitlab/templates.ts +18 -6
- package/src/http/all-routes.ts +61 -0
- package/src/http/approval-requests.ts +12 -0
- package/src/http/config.ts +98 -9
- package/src/http/core.ts +30 -3
- package/src/http/favorites.ts +5 -0
- package/src/http/fs.ts +27 -7
- package/src/http/index.ts +50 -0
- package/src/http/kv.ts +21 -4
- package/src/http/mcp-oauth.ts +2 -0
- package/src/http/mcp-servers.ts +6 -3
- package/src/http/oauth-generic.ts +105 -0
- package/src/http/poll.ts +13 -1
- package/src/http/route-def.ts +9 -0
- package/src/http/schedules.ts +56 -22
- package/src/http/script-connection-proxy.ts +116 -0
- package/src/http/script-connections.ts +1657 -0
- package/src/http/scripts.ts +54 -7
- package/src/http/tasks.ts +16 -14
- package/src/http/workflows.ts +13 -2
- package/src/http/x.ts +6 -2
- package/src/integrations/kapso/inbound.ts +23 -6
- package/src/jira/sync.ts +111 -17
- package/src/jira/templates.ts +10 -2
- package/src/mcp-client/http-client.ts +194 -0
- package/src/oauth/app-validation.ts +16 -0
- package/src/oauth/ensure-token.ts +69 -14
- package/src/oauth/mcp-wrapper.ts +15 -0
- package/src/oauth/wrapper.ts +48 -20
- package/src/prompts/base-prompt.ts +7 -6
- package/src/prompts/session-templates.ts +38 -11
- package/src/providers/pi-mono-mcp-client.ts +2 -133
- package/src/rbac/admission.ts +44 -0
- package/src/rbac/can.ts +44 -0
- package/src/rbac/index.ts +15 -0
- package/src/rbac/legacy-policy.ts +188 -0
- package/src/rbac/permissions.ts +194 -0
- package/src/rbac/types.ts +45 -0
- package/src/scheduler/scheduler.ts +9 -1
- package/src/scripts-runtime/api-client.ts +70 -14
- package/src/scripts-runtime/api-types.ts +38 -6
- package/src/scripts-runtime/credential-broker/default-bindings.ts +1 -0
- package/src/scripts-runtime/credential-broker/types.ts +8 -0
- package/src/scripts-runtime/ctx.ts +11 -1
- package/src/scripts-runtime/eval-harness.ts +5 -1
- package/src/scripts-runtime/executors/types.ts +2 -1
- package/src/scripts-runtime/loader.ts +3 -1
- package/src/scripts-runtime/mcp-client.ts +87 -0
- package/src/scripts-runtime/sdk-allowlist.ts +2 -0
- package/src/scripts-runtime/swarm-sdk.ts +81 -0
- package/src/scripts-runtime/types/stdlib.d.ts +24 -2
- package/src/scripts-runtime/types/swarm-sdk.d.ts +26 -2
- package/src/server.ts +14 -0
- package/src/slack/assistant.ts +14 -6
- package/src/slack/enrich.ts +17 -0
- package/src/slack/handlers.ts +8 -22
- package/src/slack/thread-buffer.ts +6 -3
- package/src/stdio.ts +43 -0
- package/src/tests/agentmail-handlers.test.ts +32 -3
- package/src/tests/approval-requests.test.ts +61 -0
- package/src/tests/audit-user.test.ts +47 -1
- package/src/tests/base-prompt.test.ts +7 -4
- package/src/tests/credential-broker.test.ts +5 -2
- package/src/tests/delete-page-tool.test.ts +197 -0
- package/src/tests/github-handlers.test.ts +28 -2
- package/src/tests/gitlab-handlers.test.ts +125 -0
- package/src/tests/harness-provider-resolution.test.ts +5 -0
- package/src/tests/http-api-integration.test.ts +8 -1
- package/src/tests/identity.test.ts +117 -0
- package/src/tests/jira-sync.test.ts +99 -1
- package/src/tests/kapso-inbound.test.ts +7 -0
- package/src/tests/mcp-tools-user.test.ts +60 -6
- package/src/tests/oauth-credential-bindings.test.ts +490 -0
- package/src/tests/oauth-refresh-sweep.test.ts +160 -0
- package/src/tests/prompt-template-remaining.test.ts +2 -2
- package/src/tests/prompt-template-session.test.ts +21 -8
- package/src/tests/rbac-admission-e2e.test.ts +241 -0
- package/src/tests/rbac-admission.test.ts +433 -0
- package/src/tests/rbac-audit.test.ts +345 -0
- package/src/tests/rbac-charact-http.test.ts +272 -0
- package/src/tests/rbac-charact-misc-tools.test.ts +428 -0
- package/src/tests/rbac-charact-skills.test.ts +492 -0
- package/src/tests/rbac-charact-slack.test.ts +283 -0
- package/src/tests/rbac-e2e-helpers.ts +308 -0
- package/src/tests/rbac-engine.test.ts +474 -0
- package/src/tests/rbac-lifecycle-e2e.test.ts +262 -0
- package/src/tests/rbac-roles.test.ts +326 -0
- package/src/tests/rbac-wire-e2e.test.ts +574 -0
- package/src/tests/schedule-http-triage-tools.test.ts +121 -0
- package/src/tests/schedule-target-type.test.ts +50 -0
- package/src/tests/scheduled-tasks.test.ts +74 -0
- package/src/tests/script-connections-http.test.ts +1158 -0
- package/src/tests/script-connections-mcp.test.ts +894 -0
- package/src/tests/script-connections.test.ts +727 -5
- package/src/tests/scripts-external-api.test.ts +49 -1
- package/src/tests/scripts-http.test.ts +56 -7
- package/src/tests/scripts-runtime-secret-egress.test.ts +1 -0
- package/src/tests/scripts-runtime.test.ts +104 -0
- package/src/tests/slack-identity-resolution.test.ts +37 -3
- package/src/tests/slack-thread-buffer.test.ts +28 -0
- package/src/tests/swarm-config-reserved-keys.test.ts +17 -0
- package/src/tests/tool-annotations.test.ts +2 -0
- package/src/tests/update-schedule-mcp-tool.test.ts +57 -0
- package/src/tests/user-token-rest-auth.test.ts +30 -1
- package/src/tests/workflow-http-v2.test.ts +80 -0
- package/src/tests/workflow-swarm-script.test.ts +44 -0
- package/src/tests/workflow-triggers-v2.test.ts +300 -1
- package/src/tools/cancel-task.ts +13 -3
- package/src/tools/context-diff.ts +12 -1
- package/src/tools/context-history.ts +12 -1
- package/src/tools/credential-bindings/tool.ts +289 -19
- package/src/tools/delete-channel.ts +12 -1
- package/src/tools/delete-page.ts +145 -0
- package/src/tools/get-task-details.ts +1 -1
- package/src/tools/inject-learning.ts +12 -1
- package/src/tools/kv/kv-delete.ts +3 -18
- package/src/tools/kv/kv-incr.ts +3 -18
- package/src/tools/kv/kv-set.ts +3 -20
- package/src/tools/kv/kv-write-auth.ts +40 -0
- package/src/tools/manage-user.ts +12 -1
- package/src/tools/mcp-servers/mcp-server-create.ts +12 -1
- package/src/tools/mcp-servers/mcp-server-delete.ts +19 -5
- package/src/tools/mcp-servers/mcp-server-install.ts +12 -1
- package/src/tools/mcp-servers/mcp-server-uninstall.ts +12 -1
- package/src/tools/mcp-servers/mcp-server-update.ts +12 -1
- package/src/tools/memory-delete.ts +12 -4
- package/src/tools/register-kapso-number.ts +23 -2
- package/src/tools/request-human-input.ts +2 -0
- package/src/tools/resolve-user.ts +77 -27
- package/src/tools/schedules/create-schedule.ts +4 -3
- package/src/tools/schedules/index.ts +1 -0
- package/src/tools/schedules/list-schedules.ts +36 -2
- package/src/tools/schedules/patch-schedule.ts +405 -0
- package/src/tools/schedules/update-schedule.ts +2 -2
- package/src/tools/script-connections/tool.ts +287 -32
- package/src/tools/skills/skill-create.ts +12 -1
- package/src/tools/skills/skill-delete.ts +12 -1
- package/src/tools/skills/skill-install-remote.ts +12 -1
- package/src/tools/skills/skill-install.ts +12 -1
- package/src/tools/skills/skill-uninstall.ts +12 -1
- package/src/tools/skills/skill-update.ts +25 -2
- package/src/tools/slack-delete.ts +8 -1
- package/src/tools/slack-post.ts +8 -1
- package/src/tools/slack-read.ts +8 -1
- package/src/tools/slack-start-thread.ts +8 -1
- package/src/tools/slack-update.ts +8 -1
- package/src/tools/slack-upload-file.ts +8 -1
- package/src/tools/swarm-config/delete-config.ts +28 -1
- package/src/tools/swarm-config/get-config.ts +32 -5
- package/src/tools/swarm-config/list-config.ts +31 -5
- package/src/tools/swarm-config/set-config.ts +38 -1
- package/src/tools/task-action.ts +1 -1
- package/src/tools/task-tool-ctx.ts +19 -3
- package/src/tools/templates.ts +5 -1
- package/src/tools/tool-config.ts +4 -2
- package/src/tools/update-profile.ts +8 -1
- package/src/tools/workflows/create-workflow.ts +8 -1
- package/src/tools/workflows/list-workflows.ts +14 -2
- package/src/tools/workflows/update-workflow.ts +11 -2
- package/src/types.ts +63 -6
- package/src/utils/scoped-resource.ts +25 -0
- package/src/workflows/executors/human-in-the-loop.ts +1 -0
- package/src/workflows/executors/swarm-script.ts +7 -1
- package/src/workflows/triggers.ts +146 -18
- package/templates/skills/swarm-scripts/SKILL.md +4 -9
- package/templates/skills/swarm-scripts/content.md +45 -9
- package/dist/cli-52tbq17n.js +0 -771
- package/dist/cli-9p0qhead.js +0 -43
- package/dist/{anthropic-messages-8nc6r2dw.js → anthropic-messages-kq3pjhbp.js} +6 -6
- package/dist/{azure-openai-responses-6yfzw3qw.js → azure-openai-responses-gm1ejtmn.js} +7 -7
- package/dist/{cli-vbraamxr.js → cli-6b4wwmm8.js} +9 -9
- package/dist/{cli-2fc97xm5.js → cli-ggy8c7tk.js} +3 -3
- package/dist/{cli-2r7s8jhp.js → cli-sznberje.js} +3 -3
- package/dist/{google-generative-ai-vfq6ymz9.js → google-generative-ai-hyrra2jm.js} +3 -3
- package/dist/{google-vertex-mj5y5rfj.js → google-vertex-8bs2pzgn.js} +3 -3
- package/dist/{openai-codex-responses-8h6kvfv8.js → openai-codex-responses-3nkvje79.js} +4 -4
- package/dist/{openai-completions-x6kjnqjd.js → openai-completions-0asftkwg.js} +11 -11
- package/dist/{openai-responses-7jwyz3ds.js → openai-responses-pmatek45.js} +10 -10
package/README.md
CHANGED
|
@@ -129,7 +129,7 @@ Check [our templates](https://templates.agent-swarm.dev) for a quick start.
|
|
|
129
129
|
- **Scheduled & recurring tasks** — cron-based automation for standing work, with schedules that can target agent tasks, workflows, or catalog scripts. [Scheduling →](https://docs.agent-swarm.dev/docs/concepts/scheduling)
|
|
130
130
|
- **Durable script workflows** — launch background script runs, inspect their journals, and track them from the dashboard when a one-shot `script-run` is too small. [Guide →](https://docs.agent-swarm.dev/docs/guides/script-workflow-runs)
|
|
131
131
|
- **Scripts as external APIs** — expose a saved script as a public `POST /api/x/script/<id>` endpoint with optional bearer auth, typed input validation, and per-endpoint usage tracking. [Guide →](https://docs.agent-swarm.dev/docs/guides/scripts-external-apis)
|
|
132
|
-
- **Typed script API connections** — lead-managed OpenAPI
|
|
132
|
+
- **Typed script API connections** — lead-managed OpenAPI, GraphQL, and MCP connections generate `ctx.api.*` / `ctx.mcp.*` clients for scripts, with credential bindings and OAuth-backed auth kept server-side. [Guide →](https://docs.agent-swarm.dev/docs/guides/script-connections)
|
|
133
133
|
- **E2B-backed eval harness** — run a scenario × harness-config matrix against real swarm stacks, capture transcripts/artifacts, and grade outcomes with deterministic checks plus LLM or agentic judges. [Guide →](https://docs.agent-swarm.dev/docs/guides/evals-harness)
|
|
134
134
|
- **Harness & LLM agnostic** — run with Claude Code, Claude Bridge, OpenAI Codex, pi-mono (Anthropic, OpenRouter, or Amazon Bedrock), Devin, Claude Managed Agents, raw LLMs, or opencode. Tasks, schedules, and workflow agent-task nodes can use portable `modelTier` intent (`smol`, `regular`, `smart`, `ultra`), and operators can set per-agent reasoning effort (`off` → `xhigh`) without changing task payloads. [Harness config →](https://docs.agent-swarm.dev/docs/guides/harness-configuration) · [Add a new provider →](https://docs.agent-swarm.dev/docs/guides/harness-providers)
|
|
135
135
|
- **OpenTelemetry traces plus OTLP cost/token metrics** — export API + worker traces and finalized session cost/token counters through the same OTLP pipeline for dashboarding in SigNoz, Datadog, Tempo, or another compatible backend. [Observability →](https://docs.agent-swarm.dev/docs/guides/observability-opentelemetry)
|
|
@@ -137,7 +137,7 @@ Check [our templates](https://templates.agent-swarm.dev) for a quick start.
|
|
|
137
137
|
- **Skills & MCP servers** — reusable procedural knowledge, bundled skill reference files, and per-agent MCP servers with scope cascade. [MCP tools →](https://docs.agent-swarm.dev/docs/reference/mcp-tools)
|
|
138
138
|
- **External tool-router access** — the `x` command and `swarm_x` MCP tool let humans and agents execute approved third-party routes such as Composio without baking bespoke MCP servers first. [CLI →](https://docs.agent-swarm.dev/docs/reference/cli) · [Composio →](https://docs.agent-swarm.dev/docs/integrations/composio)
|
|
139
139
|
- **Config-driven metrics dashboards** — define read-only SQL widgets, version them, and render them in the dashboard without shipping custom frontend code. [Metrics API →](https://docs.agent-swarm.dev/docs/api-reference/stats)
|
|
140
|
-
- **DB-backed pages** — agents publish HTML or JSON pages (reports, dashboards, action specs) via
|
|
140
|
+
- **DB-backed pages** — agents publish HTML or JSON pages (reports, dashboards, action specs) via `create_page`, remove stale pages with `delete-page`, and share them with public / authed / password modes, version history, view counters, diff helpers, and PDF export. [MCP tools → Pages](https://docs.agent-swarm.dev/docs/reference/mcp-tools#pages-tools)
|
|
141
141
|
- **KV store** — Redis-like namespaced key/value store with auto-scoped context (Slack thread / PR / Linear issue / page). [MCP tools → KV](https://docs.agent-swarm.dev/docs/reference/mcp-tools#kv-tools)
|
|
142
142
|
- **Real-time dashboard + task attachments** — monitor agents, tasks, and inter-agent chat, create tasks with uploaded files from the sessions composer, and preview task attachments inline above session prompts. [app.agent-swarm.dev →](https://app.agent-swarm.dev)
|
|
143
143
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveSlackUserId
|
|
3
|
-
} from "./cli-
|
|
4
|
-
import"./cli-
|
|
5
|
-
import"./cli-7xkwgkrs.js";
|
|
3
|
+
} from "./cli-w4wk3kx6.js";
|
|
4
|
+
import"./cli-113wmegp.js";
|
|
6
5
|
import {
|
|
7
6
|
buildCancelledBlocks,
|
|
8
7
|
getTaskLink
|
|
@@ -11,7 +10,7 @@ import"./cli-wspgs9bt.js";
|
|
|
11
10
|
import {
|
|
12
11
|
createTaskWithSiblingAwareness,
|
|
13
12
|
slackContextKey
|
|
14
|
-
} from "./cli-
|
|
13
|
+
} from "./cli-312v3c41.js";
|
|
15
14
|
import"./cli-dh55d5fg.js";
|
|
16
15
|
import {
|
|
17
16
|
cancelTask,
|
|
@@ -19,11 +18,11 @@ import {
|
|
|
19
18
|
getLeadAgent,
|
|
20
19
|
getTaskById,
|
|
21
20
|
init_db
|
|
22
|
-
} from "./cli-
|
|
21
|
+
} from "./cli-jzwtn8rm.js";
|
|
23
22
|
import"./cli-z2zcxes1.js";
|
|
24
|
-
import"./cli-
|
|
25
|
-
import"./cli-
|
|
26
|
-
import"./cli-
|
|
23
|
+
import"./cli-bw80ck94.js";
|
|
24
|
+
import"./cli-xz9aq0rf.js";
|
|
25
|
+
import"./cli-f5pzfvwb.js";
|
|
27
26
|
import"./cli-4j2mrzag.js";
|
|
28
27
|
import"./cli-p9swy5t3.js";
|
|
29
28
|
|
|
@@ -3,17 +3,17 @@ import {
|
|
|
3
3
|
initSlackApp,
|
|
4
4
|
startSlackApp,
|
|
5
5
|
stopSlackApp
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-hq39e630.js";
|
|
7
7
|
import"./cli-rkndnn90.js";
|
|
8
8
|
import"./cli-b0p7rfnd.js";
|
|
9
9
|
import"./cli-6xd0bvf8.js";
|
|
10
10
|
import"./cli-wspgs9bt.js";
|
|
11
11
|
import"./cli-dh55d5fg.js";
|
|
12
|
-
import"./cli-
|
|
12
|
+
import"./cli-jzwtn8rm.js";
|
|
13
13
|
import"./cli-z2zcxes1.js";
|
|
14
|
-
import"./cli-
|
|
15
|
-
import"./cli-
|
|
16
|
-
import"./cli-
|
|
14
|
+
import"./cli-bw80ck94.js";
|
|
15
|
+
import"./cli-xz9aq0rf.js";
|
|
16
|
+
import"./cli-f5pzfvwb.js";
|
|
17
17
|
import"./cli-4j2mrzag.js";
|
|
18
18
|
import"./cli-e15jhafb.js";
|
|
19
19
|
import"./cli-7wmybrt5.js";
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
2
|
bufferThreadMessage,
|
|
3
3
|
wasEventSeen
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-5afkmcfj.js";
|
|
5
5
|
import {
|
|
6
6
|
hasOtherUserMention
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-5ktc9fd4.js";
|
|
8
8
|
import {
|
|
9
9
|
require_dist
|
|
10
|
-
} from "./cli-
|
|
10
|
+
} from "./cli-hq39e630.js";
|
|
11
11
|
import"./cli-rkndnn90.js";
|
|
12
12
|
import"./cli-b0p7rfnd.js";
|
|
13
13
|
import {
|
|
14
|
-
resolveSlackUserId
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import"./cli-
|
|
14
|
+
resolveSlackUserId,
|
|
15
|
+
rewriteSlackMentions
|
|
16
|
+
} from "./cli-w4wk3kx6.js";
|
|
17
|
+
import"./cli-113wmegp.js";
|
|
18
18
|
import"./cli-6xd0bvf8.js";
|
|
19
19
|
import"./cli-wspgs9bt.js";
|
|
20
20
|
import {
|
|
21
21
|
createTaskWithSiblingAwareness,
|
|
22
22
|
slackContextKey
|
|
23
|
-
} from "./cli-
|
|
23
|
+
} from "./cli-312v3c41.js";
|
|
24
24
|
import"./cli-dh55d5fg.js";
|
|
25
25
|
import {
|
|
26
26
|
getAgentWorkingOnThread,
|
|
@@ -29,11 +29,11 @@ import {
|
|
|
29
29
|
init_db,
|
|
30
30
|
init_resolver,
|
|
31
31
|
resolveTemplate
|
|
32
|
-
} from "./cli-
|
|
32
|
+
} from "./cli-jzwtn8rm.js";
|
|
33
33
|
import"./cli-z2zcxes1.js";
|
|
34
|
-
import"./cli-
|
|
35
|
-
import"./cli-
|
|
36
|
-
import"./cli-
|
|
34
|
+
import"./cli-bw80ck94.js";
|
|
35
|
+
import"./cli-xz9aq0rf.js";
|
|
36
|
+
import"./cli-f5pzfvwb.js";
|
|
37
37
|
import"./cli-4j2mrzag.js";
|
|
38
38
|
import"./cli-e15jhafb.js";
|
|
39
39
|
import"./cli-7wmybrt5.js";
|
|
@@ -95,6 +95,7 @@ function createAssistant() {
|
|
|
95
95
|
const channelId = message.channel;
|
|
96
96
|
const messageText = msg.text || "";
|
|
97
97
|
const userId = msg.user || "";
|
|
98
|
+
const renderedMessageText = rewriteSlackMentions(messageText);
|
|
98
99
|
if (!cachedBotUserId) {
|
|
99
100
|
try {
|
|
100
101
|
const authResult = await client.auth.test();
|
|
@@ -122,7 +123,7 @@ function createAssistant() {
|
|
|
122
123
|
return;
|
|
123
124
|
}
|
|
124
125
|
const latestTask = getMostRecentTaskInThread(channelId, threadTs);
|
|
125
|
-
createTaskWithSiblingAwareness(
|
|
126
|
+
createTaskWithSiblingAwareness(renderedMessageText, {
|
|
126
127
|
agentId: workingAgent.id,
|
|
127
128
|
source: "slack",
|
|
128
129
|
slackChannelId: channelId,
|
|
@@ -136,8 +137,8 @@ function createAssistant() {
|
|
|
136
137
|
return;
|
|
137
138
|
}
|
|
138
139
|
await safeSetStatus("Processing your request...");
|
|
139
|
-
if (
|
|
140
|
-
const title =
|
|
140
|
+
if (renderedMessageText) {
|
|
141
|
+
const title = renderedMessageText.length > 50 ? `${renderedMessageText.slice(0, 47)}...` : renderedMessageText;
|
|
141
142
|
await safeSetTitle(title);
|
|
142
143
|
}
|
|
143
144
|
const ctx = await getThreadContext();
|
|
@@ -146,7 +147,7 @@ function createAssistant() {
|
|
|
146
147
|
[User is viewing channel <#${ctx.channel_id}>]` : "";
|
|
147
148
|
const lead = getLeadAgent();
|
|
148
149
|
if (!lead) {
|
|
149
|
-
createTaskWithSiblingAwareness(
|
|
150
|
+
createTaskWithSiblingAwareness(renderedMessageText + channelContext, {
|
|
150
151
|
source: "slack",
|
|
151
152
|
slackChannelId: channelId,
|
|
152
153
|
slackThreadTs: threadTs,
|
|
@@ -158,7 +159,7 @@ function createAssistant() {
|
|
|
158
159
|
await say(offlineResult.text);
|
|
159
160
|
return;
|
|
160
161
|
}
|
|
161
|
-
createTaskWithSiblingAwareness(
|
|
162
|
+
createTaskWithSiblingAwareness(renderedMessageText + channelContext, {
|
|
162
163
|
agentId: lead.id,
|
|
163
164
|
source: "slack",
|
|
164
165
|
slackChannelId: channelId,
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
embedScript,
|
|
3
3
|
embeddingProvider
|
|
4
|
-
} from "./cli-
|
|
5
|
-
import"./cli-
|
|
4
|
+
} from "./cli-f9n2jg31.js";
|
|
5
|
+
import"./cli-byjcad11.js";
|
|
6
6
|
import"./cli-q25ejbyn.js";
|
|
7
7
|
import {
|
|
8
8
|
getDb,
|
|
9
9
|
init_db
|
|
10
|
-
} from "./cli-
|
|
10
|
+
} from "./cli-jzwtn8rm.js";
|
|
11
11
|
import"./cli-z2zcxes1.js";
|
|
12
|
-
import"./cli-
|
|
13
|
-
import"./cli-
|
|
14
|
-
import"./cli-
|
|
12
|
+
import"./cli-bw80ck94.js";
|
|
13
|
+
import"./cli-xz9aq0rf.js";
|
|
14
|
+
import"./cli-f5pzfvwb.js";
|
|
15
15
|
import"./cli-4j2mrzag.js";
|
|
16
16
|
import"./cli-p9swy5t3.js";
|
|
17
17
|
|
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
getEmbeddingProvider,
|
|
4
4
|
getMemoryStore,
|
|
5
5
|
init_constants
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-byjcad11.js";
|
|
7
7
|
import"./cli-q25ejbyn.js";
|
|
8
8
|
import {
|
|
9
9
|
getDb,
|
|
10
10
|
init_db
|
|
11
|
-
} from "./cli-
|
|
11
|
+
} from "./cli-jzwtn8rm.js";
|
|
12
12
|
import"./cli-z2zcxes1.js";
|
|
13
|
-
import"./cli-
|
|
14
|
-
import"./cli-
|
|
15
|
-
import"./cli-
|
|
13
|
+
import"./cli-bw80ck94.js";
|
|
14
|
+
import"./cli-xz9aq0rf.js";
|
|
15
|
+
import"./cli-f5pzfvwb.js";
|
|
16
16
|
import"./cli-4j2mrzag.js";
|
|
17
17
|
import"./cli-p9swy5t3.js";
|
|
18
18
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getDb,
|
|
3
3
|
init_db
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-jzwtn8rm.js";
|
|
5
5
|
import"./cli-z2zcxes1.js";
|
|
6
|
-
import"./cli-
|
|
7
|
-
import"./cli-
|
|
8
|
-
import"./cli-
|
|
6
|
+
import"./cli-bw80ck94.js";
|
|
7
|
+
import"./cli-xz9aq0rf.js";
|
|
8
|
+
import"./cli-f5pzfvwb.js";
|
|
9
9
|
import {
|
|
10
10
|
init_secret_scrubber,
|
|
11
11
|
scrubSecrets
|
|
@@ -12,9 +12,9 @@ import {
|
|
|
12
12
|
resolveClaudeBinary,
|
|
13
13
|
resolveClaudeBinaryArgv,
|
|
14
14
|
resolveClaudeBridgeEnabled
|
|
15
|
-
} from "./cli-
|
|
16
|
-
import"./cli-psrqtw2m.js";
|
|
15
|
+
} from "./cli-ggy8c7tk.js";
|
|
17
16
|
import"./cli-tng3131n.js";
|
|
17
|
+
import"./cli-psrqtw2m.js";
|
|
18
18
|
import"./cli-zm7njwzd.js";
|
|
19
19
|
import"./cli-tghre7g6.js";
|
|
20
20
|
import"./cli-tkmm5nf9.js";
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
checkClaudeManagedCredentials,
|
|
4
4
|
composeManagedUserMessage,
|
|
5
5
|
normalizeRepoUrl
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-sznberje.js";
|
|
7
7
|
import"./cli-07er7wrs.js";
|
|
8
|
-
import"./cli-yv9dttkh.js";
|
|
9
8
|
import"./cli-d6n0thxw.js";
|
|
9
|
+
import"./cli-yv9dttkh.js";
|
|
10
10
|
import"./cli-gz9sbyk3.js";
|
|
11
11
|
import"./cli-tghre7g6.js";
|
|
12
12
|
import"./cli-4j2mrzag.js";
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_zod
|
|
3
|
+
} from "./cli-bw80ck94.js";
|
|
4
|
+
import {
|
|
5
|
+
_enum
|
|
6
|
+
} from "./cli-xz9aq0rf.js";
|
|
7
|
+
|
|
8
|
+
// src/rbac/permissions.ts
|
|
9
|
+
init_zod();
|
|
10
|
+
var PERMISSIONS = {
|
|
11
|
+
"user.manage": {
|
|
12
|
+
description: "Create, update, or deactivate user profiles.",
|
|
13
|
+
namespace: "user"
|
|
14
|
+
},
|
|
15
|
+
"agent.profile.update.any": {
|
|
16
|
+
description: "Update another agent's profile.",
|
|
17
|
+
namespace: "agent"
|
|
18
|
+
},
|
|
19
|
+
"agent.context.read.any": {
|
|
20
|
+
description: "View or diff another agent's context history.",
|
|
21
|
+
namespace: "agent"
|
|
22
|
+
},
|
|
23
|
+
"task.cancel.any": {
|
|
24
|
+
description: "Cancel any task (beyond tasks the caller created).",
|
|
25
|
+
namespace: "task"
|
|
26
|
+
},
|
|
27
|
+
"task.read.own": {
|
|
28
|
+
description: "Read details of a task the principal requested.",
|
|
29
|
+
namespace: "task"
|
|
30
|
+
},
|
|
31
|
+
"task.cancel.own": {
|
|
32
|
+
description: "Cancel a task the principal requested.",
|
|
33
|
+
namespace: "task"
|
|
34
|
+
},
|
|
35
|
+
"task.action.own": {
|
|
36
|
+
description: "Run actions (follow-up, retry, ...) on a task the principal requested.",
|
|
37
|
+
namespace: "task"
|
|
38
|
+
},
|
|
39
|
+
"task.fs.mutate": {
|
|
40
|
+
description: "Mutate a task's filesystem artifacts and attachments.",
|
|
41
|
+
namespace: "task"
|
|
42
|
+
},
|
|
43
|
+
"memory.learning.inject": {
|
|
44
|
+
description: "Inject a learning into another agent's memory.",
|
|
45
|
+
namespace: "memory"
|
|
46
|
+
},
|
|
47
|
+
"memory.delete.any": {
|
|
48
|
+
description: "Delete a memory entry (own entries, or swarm-scoped entries as lead).",
|
|
49
|
+
namespace: "memory"
|
|
50
|
+
},
|
|
51
|
+
"channel.delete": {
|
|
52
|
+
description: "Delete a Slack channel.",
|
|
53
|
+
namespace: "channel"
|
|
54
|
+
},
|
|
55
|
+
"integration.kapso.manage": {
|
|
56
|
+
description: "Register or unregister a Kapso inbound number.",
|
|
57
|
+
namespace: "integration"
|
|
58
|
+
},
|
|
59
|
+
"integration.slack.post": {
|
|
60
|
+
description: "Post to a direct Slack channel.",
|
|
61
|
+
namespace: "integration"
|
|
62
|
+
},
|
|
63
|
+
"integration.slack.read": {
|
|
64
|
+
description: "Read a direct Slack channel.",
|
|
65
|
+
namespace: "integration"
|
|
66
|
+
},
|
|
67
|
+
"integration.slack.thread.start": {
|
|
68
|
+
description: "Start a thread in a direct Slack channel.",
|
|
69
|
+
namespace: "integration"
|
|
70
|
+
},
|
|
71
|
+
"integration.slack.upload": {
|
|
72
|
+
description: "Upload a file to a direct Slack channel.",
|
|
73
|
+
namespace: "integration"
|
|
74
|
+
},
|
|
75
|
+
"integration.slack.delete": {
|
|
76
|
+
description: "Delete a Slack message.",
|
|
77
|
+
namespace: "integration"
|
|
78
|
+
},
|
|
79
|
+
"integration.slack.update": {
|
|
80
|
+
description: "Update (edit) a Slack message.",
|
|
81
|
+
namespace: "integration"
|
|
82
|
+
},
|
|
83
|
+
"credential-binding.manage": {
|
|
84
|
+
description: "Manage script credential bindings.",
|
|
85
|
+
namespace: "credential-binding"
|
|
86
|
+
},
|
|
87
|
+
"script-connection.manage": {
|
|
88
|
+
description: "Manage script connections.",
|
|
89
|
+
namespace: "script-connection"
|
|
90
|
+
},
|
|
91
|
+
"script-connection.invoke": {
|
|
92
|
+
description: "Invoke a script MCP connection through the server-side proxy.",
|
|
93
|
+
namespace: "script-connection"
|
|
94
|
+
},
|
|
95
|
+
"config.credential-bindings.write": {
|
|
96
|
+
description: "Write the SCRIPT_CREDENTIAL_BINDINGS swarm-config key.",
|
|
97
|
+
namespace: "config"
|
|
98
|
+
},
|
|
99
|
+
"config.write.any": {
|
|
100
|
+
description: "Write any swarm-config key.",
|
|
101
|
+
namespace: "config"
|
|
102
|
+
},
|
|
103
|
+
"config.delete.any": {
|
|
104
|
+
description: "Delete any swarm-config entry.",
|
|
105
|
+
namespace: "config"
|
|
106
|
+
},
|
|
107
|
+
"config.read.secrets": {
|
|
108
|
+
description: "Read unmasked secret config values.",
|
|
109
|
+
namespace: "config"
|
|
110
|
+
},
|
|
111
|
+
"skill.create.swarm": {
|
|
112
|
+
description: "Create a swarm-scoped skill.",
|
|
113
|
+
namespace: "skill"
|
|
114
|
+
},
|
|
115
|
+
"skill.install.any": {
|
|
116
|
+
description: "Install a skill for another agent.",
|
|
117
|
+
namespace: "skill"
|
|
118
|
+
},
|
|
119
|
+
"skill.install.global": {
|
|
120
|
+
description: "Install a remote/global skill.",
|
|
121
|
+
namespace: "skill"
|
|
122
|
+
},
|
|
123
|
+
"skill.uninstall.any": {
|
|
124
|
+
description: "Uninstall a skill for another agent.",
|
|
125
|
+
namespace: "skill"
|
|
126
|
+
},
|
|
127
|
+
"skill.update.any": {
|
|
128
|
+
description: "Update a skill the caller does not own.",
|
|
129
|
+
namespace: "skill"
|
|
130
|
+
},
|
|
131
|
+
"skill.promote.swarm": {
|
|
132
|
+
description: "Promote a skill to swarm scope (skill-approval path).",
|
|
133
|
+
namespace: "skill"
|
|
134
|
+
},
|
|
135
|
+
"skill.delete.any": {
|
|
136
|
+
description: "Delete a skill the caller does not own.",
|
|
137
|
+
namespace: "skill"
|
|
138
|
+
},
|
|
139
|
+
"mcp-server.create.swarm": {
|
|
140
|
+
description: "Create a swarm- or global-scoped MCP server.",
|
|
141
|
+
namespace: "mcp-server"
|
|
142
|
+
},
|
|
143
|
+
"mcp-server.install.any": {
|
|
144
|
+
description: "Install an MCP server for another agent.",
|
|
145
|
+
namespace: "mcp-server"
|
|
146
|
+
},
|
|
147
|
+
"mcp-server.uninstall.any": {
|
|
148
|
+
description: "Uninstall an MCP server for another agent.",
|
|
149
|
+
namespace: "mcp-server"
|
|
150
|
+
},
|
|
151
|
+
"mcp-server.delete.any": {
|
|
152
|
+
description: "Delete an MCP server the caller does not own.",
|
|
153
|
+
namespace: "mcp-server"
|
|
154
|
+
},
|
|
155
|
+
"mcp-server.update.any": {
|
|
156
|
+
description: "Update an MCP server the caller does not own.",
|
|
157
|
+
namespace: "mcp-server"
|
|
158
|
+
},
|
|
159
|
+
"mcp-oauth.authorize.any": {
|
|
160
|
+
description: "Start an MCP-server OAuth authorize flow for a caller-supplied user scope.",
|
|
161
|
+
namespace: "mcp-oauth"
|
|
162
|
+
},
|
|
163
|
+
"kv.write.any": {
|
|
164
|
+
description: "Write another agent's task:agent: KV namespace.",
|
|
165
|
+
namespace: "kv"
|
|
166
|
+
},
|
|
167
|
+
"page.delete.any": {
|
|
168
|
+
description: "Delete a page the caller does not own.",
|
|
169
|
+
namespace: "page"
|
|
170
|
+
},
|
|
171
|
+
"script.global.write": {
|
|
172
|
+
description: "Create or update a global-scope script.",
|
|
173
|
+
namespace: "script"
|
|
174
|
+
},
|
|
175
|
+
"script.global.delete": {
|
|
176
|
+
description: "Delete a global-scope script.",
|
|
177
|
+
namespace: "script"
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
var PERMISSION_VERBS = Object.keys(PERMISSIONS);
|
|
181
|
+
var PermissionVerbSchema = _enum(PERMISSION_VERBS);
|
|
182
|
+
|
|
183
|
+
// src/rbac/admission.ts
|
|
184
|
+
function isRbacEnabled() {
|
|
185
|
+
return process.env.RBAC_ENABLED === "true";
|
|
186
|
+
}
|
|
187
|
+
function decideAdmission(input) {
|
|
188
|
+
if (input.grant.grantsAll) {
|
|
189
|
+
return { allow: true };
|
|
190
|
+
}
|
|
191
|
+
if (input.rbac && "permission" in input.rbac) {
|
|
192
|
+
const verb = input.rbac.permission;
|
|
193
|
+
if (input.grant.verbs.has(verb)) {
|
|
194
|
+
return { allow: true, verb };
|
|
195
|
+
}
|
|
196
|
+
return { allow: false, reason: `admission: missing permission '${verb}'`, verb };
|
|
197
|
+
}
|
|
198
|
+
const method = input.method.toUpperCase();
|
|
199
|
+
if (method === "GET" || method === "HEAD") {
|
|
200
|
+
return { allow: true };
|
|
201
|
+
}
|
|
202
|
+
return { allow: false, reason: "admission: route has no permission verb (operator-only)" };
|
|
203
|
+
}
|
|
204
|
+
// src/rbac/legacy-policy.ts
|
|
205
|
+
var leadOnly = {
|
|
206
|
+
name: "lead-only",
|
|
207
|
+
denyReason: "requires lead agent",
|
|
208
|
+
evaluate: (principal) => principal.kind === "agent" && principal.isLead
|
|
209
|
+
};
|
|
210
|
+
var leadOrTaskCreator = {
|
|
211
|
+
name: "lead-or-task-creator",
|
|
212
|
+
denyReason: "requires lead agent or task creator",
|
|
213
|
+
evaluate: (principal, resource) => {
|
|
214
|
+
if (principal.kind !== "agent")
|
|
215
|
+
return false;
|
|
216
|
+
if (principal.isLead)
|
|
217
|
+
return true;
|
|
218
|
+
return resource?.kind === "task" && resource.creatorAgentId != null && resource.creatorAgentId === principal.agentId;
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
var leadOrResourceOwner = {
|
|
222
|
+
name: "lead-or-resource-owner",
|
|
223
|
+
denyReason: "requires lead agent or resource owner",
|
|
224
|
+
evaluate: (principal, resource) => {
|
|
225
|
+
if (principal.kind !== "agent")
|
|
226
|
+
return false;
|
|
227
|
+
if (principal.isLead)
|
|
228
|
+
return true;
|
|
229
|
+
return resource?.kind === "owned" && resource.ownerAgentId != null && resource.ownerAgentId === principal.agentId;
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
var leadOrOwnNamespace = {
|
|
233
|
+
name: "lead-or-own-namespace",
|
|
234
|
+
denyReason: "requires lead agent or your own task:agent: namespace",
|
|
235
|
+
evaluate: (principal, resource) => {
|
|
236
|
+
if (principal.kind !== "agent")
|
|
237
|
+
return false;
|
|
238
|
+
if (principal.isLead)
|
|
239
|
+
return true;
|
|
240
|
+
return principal.agentId !== "" && resource?.kind === "kv-namespace" && resource.namespace === `task:agent:${principal.agentId}`;
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
var anyAuthenticated = {
|
|
244
|
+
name: "any-authenticated",
|
|
245
|
+
denyReason: "requires an authenticated principal",
|
|
246
|
+
evaluate: () => true
|
|
247
|
+
};
|
|
248
|
+
var requesterOwnsTask = {
|
|
249
|
+
name: "requester-owns-task",
|
|
250
|
+
denyReason: "not the task requester",
|
|
251
|
+
evaluate: (principal, resource) => {
|
|
252
|
+
if (principal.kind !== "user")
|
|
253
|
+
return true;
|
|
254
|
+
return resource?.kind === "task" && resource.requestedByUserId === principal.userId;
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
var memoryOwnerOrLeadSwarm = {
|
|
258
|
+
name: "memory-owner-or-lead-swarm",
|
|
259
|
+
denyReason: "requires memory owner, or lead agent for swarm-scoped memories",
|
|
260
|
+
evaluate: (principal, resource) => {
|
|
261
|
+
if (principal.kind !== "agent" || resource?.kind !== "owned")
|
|
262
|
+
return false;
|
|
263
|
+
if (resource.ownerAgentId != null && resource.ownerAgentId === principal.agentId)
|
|
264
|
+
return true;
|
|
265
|
+
return principal.isLead && resource.scope === "swarm";
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
var taskFsMutate = {
|
|
269
|
+
name: "operator-or-user-or-lead-or-task-owner",
|
|
270
|
+
denyReason: "requires operator, user, lead agent, task assignee, or task creator",
|
|
271
|
+
evaluate: (principal, resource) => {
|
|
272
|
+
if (principal.kind === "operator" || principal.kind === "user")
|
|
273
|
+
return true;
|
|
274
|
+
if (principal.isLead)
|
|
275
|
+
return true;
|
|
276
|
+
if (resource?.kind !== "task")
|
|
277
|
+
return false;
|
|
278
|
+
return resource.agentId != null && resource.agentId === principal.agentId || resource.creatorAgentId != null && resource.creatorAgentId === principal.agentId;
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
var LEGACY_POLICY = {
|
|
282
|
+
"user.manage": leadOnly,
|
|
283
|
+
"agent.profile.update.any": leadOnly,
|
|
284
|
+
"agent.context.read.any": leadOnly,
|
|
285
|
+
"task.cancel.any": leadOrTaskCreator,
|
|
286
|
+
"task.read.own": requesterOwnsTask,
|
|
287
|
+
"task.cancel.own": requesterOwnsTask,
|
|
288
|
+
"task.action.own": requesterOwnsTask,
|
|
289
|
+
"task.fs.mutate": taskFsMutate,
|
|
290
|
+
"memory.learning.inject": leadOnly,
|
|
291
|
+
"memory.delete.any": memoryOwnerOrLeadSwarm,
|
|
292
|
+
"channel.delete": leadOnly,
|
|
293
|
+
"integration.kapso.manage": leadOnly,
|
|
294
|
+
"integration.slack.post": leadOnly,
|
|
295
|
+
"integration.slack.read": leadOnly,
|
|
296
|
+
"integration.slack.thread.start": leadOnly,
|
|
297
|
+
"integration.slack.upload": leadOnly,
|
|
298
|
+
"integration.slack.delete": leadOnly,
|
|
299
|
+
"integration.slack.update": leadOnly,
|
|
300
|
+
"credential-binding.manage": leadOnly,
|
|
301
|
+
"script-connection.manage": leadOnly,
|
|
302
|
+
"script-connection.invoke": anyAuthenticated,
|
|
303
|
+
"config.credential-bindings.write": leadOnly,
|
|
304
|
+
"config.write.any": leadOnly,
|
|
305
|
+
"config.delete.any": leadOnly,
|
|
306
|
+
"config.read.secrets": leadOnly,
|
|
307
|
+
"skill.create.swarm": leadOnly,
|
|
308
|
+
"skill.install.any": leadOnly,
|
|
309
|
+
"skill.install.global": leadOnly,
|
|
310
|
+
"skill.uninstall.any": leadOnly,
|
|
311
|
+
"skill.update.any": leadOrResourceOwner,
|
|
312
|
+
"skill.promote.swarm": leadOnly,
|
|
313
|
+
"skill.delete.any": leadOrResourceOwner,
|
|
314
|
+
"mcp-server.create.swarm": leadOnly,
|
|
315
|
+
"mcp-server.install.any": leadOnly,
|
|
316
|
+
"mcp-server.uninstall.any": leadOnly,
|
|
317
|
+
"mcp-server.delete.any": leadOrResourceOwner,
|
|
318
|
+
"mcp-server.update.any": leadOrResourceOwner,
|
|
319
|
+
"mcp-oauth.authorize.any": anyAuthenticated,
|
|
320
|
+
"kv.write.any": leadOrOwnNamespace,
|
|
321
|
+
"page.delete.any": leadOrResourceOwner,
|
|
322
|
+
"script.global.write": leadOnly,
|
|
323
|
+
"script.global.delete": leadOnly
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
// src/rbac/can.ts
|
|
327
|
+
var auditSink = null;
|
|
328
|
+
function setAuditSink(fn) {
|
|
329
|
+
auditSink = fn;
|
|
330
|
+
}
|
|
331
|
+
function clearAuditSink() {
|
|
332
|
+
auditSink = null;
|
|
333
|
+
}
|
|
334
|
+
function can(check) {
|
|
335
|
+
const rule = LEGACY_POLICY[check.verb];
|
|
336
|
+
const decision = rule.evaluate(check.principal, check.resource) ? { allow: true } : { allow: false, reason: rule.denyReason, missing: check.verb };
|
|
337
|
+
if (auditSink) {
|
|
338
|
+
try {
|
|
339
|
+
auditSink(check, decision);
|
|
340
|
+
} catch {}
|
|
341
|
+
}
|
|
342
|
+
return decision;
|
|
343
|
+
}
|
|
344
|
+
export { isRbacEnabled, decideAdmission, setAuditSink, clearAuditSink, can, PermissionVerbSchema };
|