@vellumai/vellum-gateway 0.6.6 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ARCHITECTURE.md +10 -10
- package/Dockerfile +10 -8
- package/README.md +4 -8
- package/bun.lock +100 -70
- package/knip.json +6 -1
- package/package.json +8 -4
- package/scripts/test.sh +1 -1
- package/src/__tests__/auto-approve-thresholds.test.ts +23 -33
- package/src/__tests__/bash-risk-classifier.test.ts +221 -0
- package/src/__tests__/browser-relay-websocket.test.ts +0 -1
- package/src/__tests__/channel-verification-session-proxy.test.ts +0 -1
- package/src/__tests__/config.test.ts +0 -1
- package/src/__tests__/contacts-control-plane-proxy.test.ts +60 -1
- package/src/__tests__/credential-watcher-managed-bootstrap.test.ts +10 -56
- package/src/__tests__/credential-watcher.test.ts +11 -1
- package/src/__tests__/db-connection-isolation.test.ts +157 -0
- package/src/__tests__/fake-assistant-ipc.ts +39 -0
- package/src/__tests__/feature-flags-route.test.ts +5 -5
- package/src/__tests__/guardian-channel-actor-lookup.test.ts +47 -0
- package/src/__tests__/guardian-init-lockfile.test.ts +412 -375
- package/src/__tests__/ipc-contact-routes.test.ts +17 -4
- package/src/__tests__/ipc-feature-flag-routes.test.ts +1 -1
- package/src/__tests__/ipc-server-multi-client.test.ts +129 -0
- package/src/__tests__/ipc-socket-path.test.ts +66 -20
- package/src/__tests__/live-voice-websocket.test.ts +453 -0
- package/src/__tests__/load-guards.test.ts +0 -1
- package/src/__tests__/migration-teleport-gcs-proxy.test.ts +219 -0
- package/src/__tests__/nonbash-trust-rule-overrides.test.ts +501 -0
- package/src/__tests__/oauth-callback.test.ts +0 -1
- package/src/__tests__/push-schema-no-prompt.test.ts +76 -0
- package/src/__tests__/resolve-assistant.test.ts +0 -1
- package/src/__tests__/route-schema-guard.test.ts +3 -3
- package/src/__tests__/runtime-client.test.ts +103 -1
- package/src/__tests__/runtime-health-proxy.test.ts +0 -1
- package/src/__tests__/runtime-proxy-auth.test.ts +0 -1
- package/src/__tests__/runtime-proxy.test.ts +0 -1
- package/src/__tests__/schema.test.ts +0 -26
- package/src/__tests__/seed-trust-rules.test.ts +150 -0
- package/src/__tests__/slack-control-plane-proxy.test.ts +0 -1
- package/src/__tests__/slack-display-name.test.ts +66 -1
- package/src/__tests__/slack-normalize.test.ts +158 -4
- package/src/__tests__/slack-reaction-normalize.test.ts +0 -1
- package/src/__tests__/slack-socket-mode-thread-tracking.test.ts +630 -0
- package/src/__tests__/stt-stream-websocket.test.ts +0 -1
- package/src/__tests__/telegram-control-plane-proxy.test.ts +0 -1
- package/src/__tests__/telegram-send-attachments.test.ts +0 -1
- package/src/__tests__/telegram-webhook-handler.test.ts +0 -1
- package/src/__tests__/telegram-webhook-manager.test.ts +7 -13
- package/src/__tests__/text-verification-helpers.test.ts +136 -0
- package/src/__tests__/trust-rule-cache.test.ts +398 -0
- package/src/__tests__/trust-rule-store.test.ts +601 -0
- package/src/__tests__/trust-rules-routes.test.ts +373 -228
- package/src/__tests__/twilio-media-websocket.test.ts +0 -1
- package/src/__tests__/twilio-relay-websocket.test.ts +0 -1
- package/src/__tests__/twilio-webhooks.test.ts +0 -1
- package/src/__tests__/upstream-transport.test.ts +319 -0
- package/src/__tests__/whatsapp-download.test.ts +0 -1
- package/src/__tests__/whatsapp-webhook.test.ts +0 -1
- package/src/auth/capability-tokens.ts +248 -0
- package/src/auth/guardian-bootstrap.ts +575 -0
- package/src/auth/guardian-refresh.ts +300 -0
- package/src/auth/ipc-route-policy.ts +217 -0
- package/src/auth/token-exchange.ts +38 -0
- package/src/channels/types.ts +25 -2
- package/src/cli/enable-proxy.ts +0 -1
- package/src/config.ts +0 -7
- package/src/credential-reader.ts +5 -38
- package/src/credential-watcher.ts +9 -21
- package/src/db/assistant-db-proxy.ts +68 -0
- package/src/db/connection.ts +137 -14
- package/src/db/data-migrations/index.ts +6 -4
- package/src/db/data-migrations/m0002-actor-token-tables-to-gateway.ts +183 -0
- package/src/db/denial-reply-rate-limiter.ts +126 -0
- package/src/db/schema.ts +172 -4
- package/src/db/seed-trust-rules.ts +92 -0
- package/src/db/trust-rule-store.ts +339 -0
- package/src/email/register-callback.test.ts +6 -4
- package/src/email/register-callback.ts +1 -4
- package/src/feature-flag-registry.json +38 -46
- package/src/feature-flag-remote-store.ts +33 -2
- package/src/handlers/handle-inbound.ts +33 -0
- package/src/http/middleware/auth.ts +43 -0
- package/src/http/middleware/rate-limit.ts +0 -3
- package/src/http/routes/auto-approve-thresholds.ts +9 -23
- package/src/http/routes/brain-graph-proxy.ts +52 -61
- package/src/http/routes/browser-extension-pair.ts +455 -0
- package/src/http/routes/browser-relay-websocket.ts +18 -19
- package/src/http/routes/channel-readiness-proxy.ts +23 -67
- package/src/http/routes/channel-verification-session-proxy.test.ts +245 -0
- package/src/http/routes/channel-verification-session-proxy.ts +214 -136
- package/src/http/routes/contacts-control-plane-proxy.ts +41 -83
- package/src/http/routes/email-webhook.test.ts +0 -1
- package/src/http/routes/inbound-register.ts +197 -0
- package/src/http/routes/ipc-runtime-proxy.test.ts +516 -0
- package/src/http/routes/ipc-runtime-proxy.ts +294 -0
- package/src/http/routes/live-voice-websocket.ts +194 -0
- package/src/http/routes/log-export.test.ts +55 -45
- package/src/http/routes/log-export.ts +9 -43
- package/src/http/routes/mailgun-identity.ts +70 -0
- package/src/http/routes/mailgun-webhook.ts +71 -0
- package/src/http/routes/migration-proxy.ts +196 -133
- package/src/http/routes/migration-rollback-proxy.ts +15 -57
- package/src/http/routes/oauth-apps-proxy.ts +23 -67
- package/src/http/routes/oauth-providers-proxy.ts +23 -67
- package/src/http/routes/ps.ts +77 -0
- package/src/http/routes/resend-identity.ts +51 -0
- package/src/http/routes/resend-webhook.ts +63 -0
- package/src/http/routes/runtime-health-proxy.ts +22 -57
- package/src/http/routes/runtime-proxy.ts +32 -23
- package/src/http/routes/slack-control-plane-proxy.ts +24 -85
- package/src/http/routes/stt-stream-websocket.ts +12 -14
- package/src/http/routes/telegram-control-plane-proxy.ts +35 -73
- package/src/http/routes/telegram-webhook.test.ts +0 -1
- package/src/http/routes/telegram-webhook.ts +47 -22
- package/src/http/routes/trust-rules.suggest.test.ts +260 -0
- package/src/http/routes/trust-rules.ts +245 -189
- package/src/http/routes/twilio-control-plane-proxy.ts +37 -79
- package/src/http/routes/twilio-media-websocket.ts +9 -5
- package/src/http/routes/twilio-relay-websocket.ts +9 -5
- package/src/http/routes/twilio-voice-verify-callback.ts +282 -0
- package/src/http/routes/twilio-voice-webhook.test.ts +5 -1
- package/src/http/routes/twilio-voice-webhook.ts +37 -1
- package/src/http/routes/upgrade-broadcast-proxy.ts +15 -57
- package/src/http/routes/vercel-control-plane-proxy.ts +31 -69
- package/src/http/routes/whatsapp-webhook.test.ts +0 -1
- package/src/http/routes/workspace-commit-proxy.ts +15 -57
- package/src/index.ts +193 -126
- package/src/ipc/assistant-client.test.ts +290 -0
- package/src/ipc/assistant-client.ts +358 -0
- package/src/ipc/capability-token-handlers.ts +30 -0
- package/src/ipc/risk-classification-handlers.test.ts +646 -0
- package/src/ipc/risk-classification-handlers.ts +542 -0
- package/src/ipc/route-schema-cache.ts +162 -0
- package/src/ipc/server.ts +28 -35
- package/src/ipc/socket-path.ts +54 -28
- package/src/ipc/threshold-handlers.ts +36 -8
- package/src/pairing/approved-devices-store.ts +110 -0
- package/src/pairing/pairing-routes.ts +379 -0
- package/src/pairing/pairing-store.ts +218 -0
- package/src/post-assistant-ready.ts +74 -0
- package/src/remote-feature-flag-sync.ts +8 -5
- package/src/risk/arg-parser.test.ts +161 -0
- package/src/risk/arg-parser.ts +141 -0
- package/src/risk/bash-risk-classifier.test.ts +1717 -0
- package/src/risk/bash-risk-classifier.ts +1001 -0
- package/src/risk/command-registry/AGENTS.md +62 -0
- package/src/risk/command-registry/commands/7z.ts +9 -0
- package/src/risk/command-registry/commands/7za.ts +9 -0
- package/src/risk/command-registry/commands/R.ts +8 -0
- package/src/risk/command-registry/commands/Rscript.ts +8 -0
- package/src/risk/command-registry/commands/ack.ts +19 -0
- package/src/risk/command-registry/commands/adduser.ts +8 -0
- package/src/risk/command-registry/commands/ag.ts +19 -0
- package/src/risk/command-registry/commands/alias.ts +7 -0
- package/src/risk/command-registry/commands/ant.ts +8 -0
- package/src/risk/command-registry/commands/apk.ts +8 -0
- package/src/risk/command-registry/commands/apt-get.ts +8 -0
- package/src/risk/command-registry/commands/apt.ts +8 -0
- package/src/risk/command-registry/commands/assistant.ts +497 -0
- package/src/risk/command-registry/commands/at.ts +8 -0
- package/src/risk/command-registry/commands/awk.ts +20 -0
- package/src/risk/command-registry/commands/aws.ts +8 -0
- package/src/risk/command-registry/commands/az.ts +8 -0
- package/src/risk/command-registry/commands/b2sum.ts +8 -0
- package/src/risk/command-registry/commands/base64.ts +8 -0
- package/src/risk/command-registry/commands/basename.ts +9 -0
- package/src/risk/command-registry/commands/bash.ts +9 -0
- package/src/risk/command-registry/commands/bazel.ts +8 -0
- package/src/risk/command-registry/commands/brew.ts +30 -0
- package/src/risk/command-registry/commands/bun.ts +26 -0
- package/src/risk/command-registry/commands/bunx.ts +8 -0
- package/src/risk/command-registry/commands/bunzip2.ts +9 -0
- package/src/risk/command-registry/commands/bzip2.ts +9 -0
- package/src/risk/command-registry/commands/cal.ts +7 -0
- package/src/risk/command-registry/commands/cargo.ts +29 -0
- package/src/risk/command-registry/commands/cat.ts +18 -0
- package/src/risk/command-registry/commands/cd.ts +7 -0
- package/src/risk/command-registry/commands/chgrp.ts +10 -0
- package/src/risk/command-registry/commands/chmod.ts +11 -0
- package/src/risk/command-registry/commands/chown.ts +11 -0
- package/src/risk/command-registry/commands/chroot.ts +8 -0
- package/src/risk/command-registry/commands/cksum.ts +8 -0
- package/src/risk/command-registry/commands/cmake.ts +8 -0
- package/src/risk/command-registry/commands/cmp.ts +9 -0
- package/src/risk/command-registry/commands/column.ts +9 -0
- package/src/risk/command-registry/commands/comm.ts +9 -0
- package/src/risk/command-registry/commands/command.ts +17 -0
- package/src/risk/command-registry/commands/composer.ts +25 -0
- package/src/risk/command-registry/commands/cp.ts +24 -0
- package/src/risk/command-registry/commands/crontab.ts +8 -0
- package/src/risk/command-registry/commands/csplit.ts +9 -0
- package/src/risk/command-registry/commands/curl.ts +69 -0
- package/src/risk/command-registry/commands/cut.ts +9 -0
- package/src/risk/command-registry/commands/dash.ts +9 -0
- package/src/risk/command-registry/commands/date.ts +7 -0
- package/src/risk/command-registry/commands/dd.ts +8 -0
- package/src/risk/command-registry/commands/declare.ts +8 -0
- package/src/risk/command-registry/commands/defaults.ts +8 -0
- package/src/risk/command-registry/commands/deluser.ts +8 -0
- package/src/risk/command-registry/commands/deno.ts +8 -0
- package/src/risk/command-registry/commands/df.ts +10 -0
- package/src/risk/command-registry/commands/diff.ts +10 -0
- package/src/risk/command-registry/commands/dig.ts +7 -0
- package/src/risk/command-registry/commands/dir.ts +9 -0
- package/src/risk/command-registry/commands/dirname.ts +9 -0
- package/src/risk/command-registry/commands/dmesg.ts +15 -0
- package/src/risk/command-registry/commands/dnf.ts +8 -0
- package/src/risk/command-registry/commands/doas.ts +9 -0
- package/src/risk/command-registry/commands/docker.ts +215 -0
- package/src/risk/command-registry/commands/dos2unix.ts +9 -0
- package/src/risk/command-registry/commands/du.ts +10 -0
- package/src/risk/command-registry/commands/echo.ts +11 -0
- package/src/risk/command-registry/commands/egrep.ts +19 -0
- package/src/risk/command-registry/commands/env.ts +8 -0
- package/src/risk/command-registry/commands/eval.ts +8 -0
- package/src/risk/command-registry/commands/exec.ts +9 -0
- package/src/risk/command-registry/commands/expand.ts +9 -0
- package/src/risk/command-registry/commands/export.ts +7 -0
- package/src/risk/command-registry/commands/fd.ts +9 -0
- package/src/risk/command-registry/commands/fdisk.ts +8 -0
- package/src/risk/command-registry/commands/fgrep.ts +19 -0
- package/src/risk/command-registry/commands/file.ts +10 -0
- package/src/risk/command-registry/commands/find.ts +40 -0
- package/src/risk/command-registry/commands/firewall-cmd.ts +8 -0
- package/src/risk/command-registry/commands/fish.ts +9 -0
- package/src/risk/command-registry/commands/fmt.ts +9 -0
- package/src/risk/command-registry/commands/fold.ts +9 -0
- package/src/risk/command-registry/commands/free.ts +7 -0
- package/src/risk/command-registry/commands/ftp.ts +8 -0
- package/src/risk/command-registry/commands/gcloud.ts +8 -0
- package/src/risk/command-registry/commands/gem.ts +21 -0
- package/src/risk/command-registry/commands/gh.ts +65 -0
- package/src/risk/command-registry/commands/git.ts +249 -0
- package/src/risk/command-registry/commands/go.ts +38 -0
- package/src/risk/command-registry/commands/gradle.ts +8 -0
- package/src/risk/command-registry/commands/grep.ts +20 -0
- package/src/risk/command-registry/commands/groupadd.ts +8 -0
- package/src/risk/command-registry/commands/groupdel.ts +8 -0
- package/src/risk/command-registry/commands/groupmod.ts +8 -0
- package/src/risk/command-registry/commands/groups.ts +7 -0
- package/src/risk/command-registry/commands/gunzip.ts +10 -0
- package/src/risk/command-registry/commands/gzip.ts +10 -0
- package/src/risk/command-registry/commands/halt.ts +8 -0
- package/src/risk/command-registry/commands/head.ts +10 -0
- package/src/risk/command-registry/commands/helm.ts +40 -0
- package/src/risk/command-registry/commands/help.ts +7 -0
- package/src/risk/command-registry/commands/hexdump.ts +7 -0
- package/src/risk/command-registry/commands/hg.ts +33 -0
- package/src/risk/command-registry/commands/history.ts +7 -0
- package/src/risk/command-registry/commands/host.ts +7 -0
- package/src/risk/command-registry/commands/hostname.ts +7 -0
- package/src/risk/command-registry/commands/htop.ts +7 -0
- package/src/risk/command-registry/commands/http.ts +7 -0
- package/src/risk/command-registry/commands/iconv.ts +8 -0
- package/src/risk/command-registry/commands/id.ts +7 -0
- package/src/risk/command-registry/commands/ifconfig.ts +8 -0
- package/src/risk/command-registry/commands/info.ts +7 -0
- package/src/risk/command-registry/commands/install.ts +23 -0
- package/src/risk/command-registry/commands/ionice.ts +8 -0
- package/src/risk/command-registry/commands/iostat.ts +7 -0
- package/src/risk/command-registry/commands/ip.ts +8 -0
- package/src/risk/command-registry/commands/ip6tables.ts +8 -0
- package/src/risk/command-registry/commands/iptables.ts +8 -0
- package/src/risk/command-registry/commands/java.ts +16 -0
- package/src/risk/command-registry/commands/javac.ts +8 -0
- package/src/risk/command-registry/commands/join.ts +9 -0
- package/src/risk/command-registry/commands/jq.ts +9 -0
- package/src/risk/command-registry/commands/kill.ts +8 -0
- package/src/risk/command-registry/commands/killall.ts +8 -0
- package/src/risk/command-registry/commands/ksh.ts +9 -0
- package/src/risk/command-registry/commands/kubectl.ts +66 -0
- package/src/risk/command-registry/commands/last.ts +7 -0
- package/src/risk/command-registry/commands/launchctl.ts +8 -0
- package/src/risk/command-registry/commands/less.ts +10 -0
- package/src/risk/command-registry/commands/ln.ts +16 -0
- package/src/risk/command-registry/commands/locate.ts +7 -0
- package/src/risk/command-registry/commands/loginctl.ts +8 -0
- package/src/risk/command-registry/commands/ls.ts +10 -0
- package/src/risk/command-registry/commands/lsof.ts +7 -0
- package/src/risk/command-registry/commands/ltrace.ts +9 -0
- package/src/risk/command-registry/commands/lua.ts +16 -0
- package/src/risk/command-registry/commands/make.ts +8 -0
- package/src/risk/command-registry/commands/man.ts +7 -0
- package/src/risk/command-registry/commands/md5.ts +8 -0
- package/src/risk/command-registry/commands/md5sum.ts +8 -0
- package/src/risk/command-registry/commands/meson.ts +8 -0
- package/src/risk/command-registry/commands/mkdir.ts +10 -0
- package/src/risk/command-registry/commands/mkfs.ts +8 -0
- package/src/risk/command-registry/commands/mktemp.ts +9 -0
- package/src/risk/command-registry/commands/more.ts +10 -0
- package/src/risk/command-registry/commands/mount.ts +8 -0
- package/src/risk/command-registry/commands/mtr.ts +7 -0
- package/src/risk/command-registry/commands/mv.ts +18 -0
- package/src/risk/command-registry/commands/mvn.ts +8 -0
- package/src/risk/command-registry/commands/nc.ts +8 -0
- package/src/risk/command-registry/commands/netcat.ts +8 -0
- package/src/risk/command-registry/commands/netstat.ts +7 -0
- package/src/risk/command-registry/commands/networksetup.ts +8 -0
- package/src/risk/command-registry/commands/nft.ts +8 -0
- package/src/risk/command-registry/commands/nice.ts +8 -0
- package/src/risk/command-registry/commands/ninja.ts +8 -0
- package/src/risk/command-registry/commands/nl.ts +9 -0
- package/src/risk/command-registry/commands/nmap.ts +8 -0
- package/src/risk/command-registry/commands/nmcli.ts +8 -0
- package/src/risk/command-registry/commands/node.ts +22 -0
- package/src/risk/command-registry/commands/nohup.ts +8 -0
- package/src/risk/command-registry/commands/npm.ts +54 -0
- package/src/risk/command-registry/commands/npx.ts +8 -0
- package/src/risk/command-registry/commands/nslookup.ts +7 -0
- package/src/risk/command-registry/commands/od.ts +9 -0
- package/src/risk/command-registry/commands/openssl.ts +8 -0
- package/src/risk/command-registry/commands/pacman.ts +8 -0
- package/src/risk/command-registry/commands/parted.ts +8 -0
- package/src/risk/command-registry/commands/passwd.ts +8 -0
- package/src/risk/command-registry/commands/paste.ts +9 -0
- package/src/risk/command-registry/commands/perl.ts +16 -0
- package/src/risk/command-registry/commands/pgrep.ts +7 -0
- package/src/risk/command-registry/commands/php.ts +16 -0
- package/src/risk/command-registry/commands/ping.ts +7 -0
- package/src/risk/command-registry/commands/pip.ts +24 -0
- package/src/risk/command-registry/commands/pip3.ts +24 -0
- package/src/risk/command-registry/commands/pipx.ts +22 -0
- package/src/risk/command-registry/commands/pkill.ts +8 -0
- package/src/risk/command-registry/commands/plocate.ts +7 -0
- package/src/risk/command-registry/commands/pnpm.ts +37 -0
- package/src/risk/command-registry/commands/pnpx.ts +8 -0
- package/src/risk/command-registry/commands/poetry.ts +25 -0
- package/src/risk/command-registry/commands/popd.ts +7 -0
- package/src/risk/command-registry/commands/port.ts +8 -0
- package/src/risk/command-registry/commands/poweroff.ts +8 -0
- package/src/risk/command-registry/commands/powershell.ts +8 -0
- package/src/risk/command-registry/commands/pr.ts +9 -0
- package/src/risk/command-registry/commands/printenv.ts +7 -0
- package/src/risk/command-registry/commands/printf.ts +11 -0
- package/src/risk/command-registry/commands/ps.ts +7 -0
- package/src/risk/command-registry/commands/pstree.ts +7 -0
- package/src/risk/command-registry/commands/pushd.ts +7 -0
- package/src/risk/command-registry/commands/pwd.ts +11 -0
- package/src/risk/command-registry/commands/pwsh.ts +8 -0
- package/src/risk/command-registry/commands/python.ts +16 -0
- package/src/risk/command-registry/commands/python3.ts +16 -0
- package/src/risk/command-registry/commands/readlink.ts +10 -0
- package/src/risk/command-registry/commands/readonly.ts +8 -0
- package/src/risk/command-registry/commands/realpath.ts +9 -0
- package/src/risk/command-registry/commands/reboot.ts +8 -0
- package/src/risk/command-registry/commands/renice.ts +8 -0
- package/src/risk/command-registry/commands/rev.ts +8 -0
- package/src/risk/command-registry/commands/rg.ts +19 -0
- package/src/risk/command-registry/commands/rm.ts +42 -0
- package/src/risk/command-registry/commands/rmdir.ts +10 -0
- package/src/risk/command-registry/commands/route.ts +8 -0
- package/src/risk/command-registry/commands/rsync.ts +8 -0
- package/src/risk/command-registry/commands/ruby.ts +8 -0
- package/src/risk/command-registry/commands/scp.ts +8 -0
- package/src/risk/command-registry/commands/screen.ts +8 -0
- package/src/risk/command-registry/commands/sed.ts +29 -0
- package/src/risk/command-registry/commands/seq.ts +10 -0
- package/src/risk/command-registry/commands/service.ts +8 -0
- package/src/risk/command-registry/commands/set.ts +8 -0
- package/src/risk/command-registry/commands/sftp.ts +8 -0
- package/src/risk/command-registry/commands/sh.ts +9 -0
- package/src/risk/command-registry/commands/sha1sum.ts +8 -0
- package/src/risk/command-registry/commands/sha256sum.ts +8 -0
- package/src/risk/command-registry/commands/sha512sum.ts +8 -0
- package/src/risk/command-registry/commands/shred.ts +9 -0
- package/src/risk/command-registry/commands/shuf.ts +8 -0
- package/src/risk/command-registry/commands/shutdown.ts +8 -0
- package/src/risk/command-registry/commands/sleep.ts +10 -0
- package/src/risk/command-registry/commands/sort.ts +31 -0
- package/src/risk/command-registry/commands/source.ts +8 -0
- package/src/risk/command-registry/commands/split.ts +9 -0
- package/src/risk/command-registry/commands/ss.ts +7 -0
- package/src/risk/command-registry/commands/ssh-add.ts +8 -0
- package/src/risk/command-registry/commands/ssh-copy-id.ts +8 -0
- package/src/risk/command-registry/commands/ssh-keygen.ts +10 -0
- package/src/risk/command-registry/commands/ssh.ts +8 -0
- package/src/risk/command-registry/commands/stat.ts +10 -0
- package/src/risk/command-registry/commands/strace.ts +9 -0
- package/src/risk/command-registry/commands/strings.ts +9 -0
- package/src/risk/command-registry/commands/su.ts +8 -0
- package/src/risk/command-registry/commands/sudo.ts +9 -0
- package/src/risk/command-registry/commands/svn.ts +33 -0
- package/src/risk/command-registry/commands/sw_vers.ts +7 -0
- package/src/risk/command-registry/commands/swift.ts +23 -0
- package/src/risk/command-registry/commands/sysctl.ts +24 -0
- package/src/risk/command-registry/commands/systemctl.ts +8 -0
- package/src/risk/command-registry/commands/tail.ts +10 -0
- package/src/risk/command-registry/commands/tar.ts +48 -0
- package/src/risk/command-registry/commands/taskset.ts +8 -0
- package/src/risk/command-registry/commands/tcsh.ts +9 -0
- package/src/risk/command-registry/commands/tee.ts +10 -0
- package/src/risk/command-registry/commands/telnet.ts +8 -0
- package/src/risk/command-registry/commands/terraform.ts +34 -0
- package/src/risk/command-registry/commands/time.ts +8 -0
- package/src/risk/command-registry/commands/timeout.ts +9 -0
- package/src/risk/command-registry/commands/tmux.ts +8 -0
- package/src/risk/command-registry/commands/top.ts +7 -0
- package/src/risk/command-registry/commands/touch.ts +10 -0
- package/src/risk/command-registry/commands/tr.ts +11 -0
- package/src/risk/command-registry/commands/tracepath.ts +7 -0
- package/src/risk/command-registry/commands/traceroute.ts +7 -0
- package/src/risk/command-registry/commands/tree.ts +10 -0
- package/src/risk/command-registry/commands/truncate.ts +9 -0
- package/src/risk/command-registry/commands/ts-node.ts +8 -0
- package/src/risk/command-registry/commands/tsx.ts +8 -0
- package/src/risk/command-registry/commands/type.ts +7 -0
- package/src/risk/command-registry/commands/typeset.ts +8 -0
- package/src/risk/command-registry/commands/ufw.ts +8 -0
- package/src/risk/command-registry/commands/umask.ts +8 -0
- package/src/risk/command-registry/commands/umount.ts +8 -0
- package/src/risk/command-registry/commands/uname.ts +7 -0
- package/src/risk/command-registry/commands/unexpand.ts +9 -0
- package/src/risk/command-registry/commands/uniq.ts +9 -0
- package/src/risk/command-registry/commands/unix2dos.ts +9 -0
- package/src/risk/command-registry/commands/unlink.ts +9 -0
- package/src/risk/command-registry/commands/unset.ts +7 -0
- package/src/risk/command-registry/commands/unxz.ts +9 -0
- package/src/risk/command-registry/commands/unzip.ts +10 -0
- package/src/risk/command-registry/commands/unzstd.ts +9 -0
- package/src/risk/command-registry/commands/uptime.ts +7 -0
- package/src/risk/command-registry/commands/useradd.ts +8 -0
- package/src/risk/command-registry/commands/userdel.ts +8 -0
- package/src/risk/command-registry/commands/usermod.ts +8 -0
- package/src/risk/command-registry/commands/users.ts +7 -0
- package/src/risk/command-registry/commands/uv.ts +31 -0
- package/src/risk/command-registry/commands/vdir.ts +9 -0
- package/src/risk/command-registry/commands/visudo.ts +8 -0
- package/src/risk/command-registry/commands/vmstat.ts +7 -0
- package/src/risk/command-registry/commands/w.ts +7 -0
- package/src/risk/command-registry/commands/watch.ts +8 -0
- package/src/risk/command-registry/commands/wc.ts +10 -0
- package/src/risk/command-registry/commands/wget.ts +41 -0
- package/src/risk/command-registry/commands/where.ts +7 -0
- package/src/risk/command-registry/commands/whereis.ts +7 -0
- package/src/risk/command-registry/commands/which.ts +7 -0
- package/src/risk/command-registry/commands/who.ts +7 -0
- package/src/risk/command-registry/commands/whoami.ts +7 -0
- package/src/risk/command-registry/commands/wipefs.ts +8 -0
- package/src/risk/command-registry/commands/xargs.ts +9 -0
- package/src/risk/command-registry/commands/xxd.ts +7 -0
- package/src/risk/command-registry/commands/xz.ts +9 -0
- package/src/risk/command-registry/commands/yarn.ts +39 -0
- package/src/risk/command-registry/commands/yes.ts +10 -0
- package/src/risk/command-registry/commands/yq.ts +9 -0
- package/src/risk/command-registry/commands/yum.ts +8 -0
- package/src/risk/command-registry/commands/zip.ts +10 -0
- package/src/risk/command-registry/commands/zsh.ts +9 -0
- package/src/risk/command-registry/commands/zstd.ts +9 -0
- package/src/risk/command-registry/commands/zypper.ts +8 -0
- package/src/risk/command-registry/index.ts +617 -0
- package/src/risk/command-registry.test.ts +892 -0
- package/src/risk/directory-scope.test.ts +527 -0
- package/src/risk/directory-scope.ts +208 -0
- package/src/risk/file-risk-classifier.test.ts +600 -0
- package/src/risk/file-risk-classifier.ts +386 -0
- package/src/risk/project-boundary.test.ts +88 -0
- package/src/risk/project-boundary.ts +38 -0
- package/src/risk/risk-classifier-parity.test.ts +197 -0
- package/src/risk/risk-types.ts +350 -0
- package/src/risk/schedule-risk-classifier.test.ts +129 -0
- package/src/risk/schedule-risk-classifier.ts +115 -0
- package/src/risk/shell-identity.test.ts +235 -0
- package/src/risk/shell-identity.ts +296 -0
- package/src/risk/shell-parser-fuzz.test.ts +629 -0
- package/src/risk/shell-parser-property.test.ts +652 -0
- package/src/risk/shell-parser.test.ts +595 -0
- package/src/risk/shell-parser.ts +634 -0
- package/src/risk/skill-risk-classifier.test.ts +238 -0
- package/src/risk/skill-risk-classifier.ts +252 -0
- package/src/risk/trust-rule-cache.ts +138 -0
- package/src/risk/web-risk-classifier.test.ts +170 -0
- package/src/risk/web-risk-classifier.ts +124 -0
- package/src/runtime/client.ts +191 -95
- package/src/schema.ts +447 -426
- package/src/slack/normalize.test.ts +74 -0
- package/src/slack/normalize.ts +99 -32
- package/src/slack/socket-mode.ts +187 -17
- package/src/telegram/send.test.ts +1 -2
- package/src/telegram/send.ts +11 -1
- package/src/telegram/webhook-manager.ts +1 -4
- package/src/verification/binding-helpers.ts +107 -0
- package/src/verification/code-parsing.ts +44 -0
- package/src/verification/contact-helpers.ts +205 -0
- package/src/verification/identity-match.ts +68 -0
- package/src/verification/identity.ts +61 -0
- package/src/verification/rate-limit-helpers.ts +205 -0
- package/src/verification/reply-delivery.ts +109 -0
- package/src/verification/session-helpers.ts +164 -0
- package/src/verification/text-verification.ts +372 -0
- package/src/voice/verification.ts +456 -0
- package/src/webhook-pipeline.ts +4 -0
- package/src/whatsapp/send.ts +11 -1
- package/src/__tests__/cloud-oauth-token.test.ts +0 -224
- package/src/__tests__/slack-deliver-ratelimit.test.ts +0 -234
- package/src/__tests__/slack-deliver.test.ts +0 -1422
- package/src/__tests__/telegram-deliver-auth.test.ts +0 -508
- package/src/__tests__/telegram-only-default.test.ts +0 -133
- package/src/__tests__/trust-store.test.ts +0 -810
- package/src/http/middleware/deliver-auth.ts +0 -45
- package/src/http/routes/cloud-oauth-token.ts +0 -145
- package/src/http/routes/pairing-proxy.ts +0 -151
- package/src/http/routes/slack-deliver.ts +0 -1030
- package/src/http/routes/telegram-deliver.test.ts +0 -602
- package/src/http/routes/telegram-deliver.ts +0 -218
- package/src/http/routes/whatsapp-deliver.test.ts +0 -292
- package/src/http/routes/whatsapp-deliver.ts +0 -217
- package/src/trust-store.ts +0 -556
- package/src/util/strip-hop-by-hop.ts +0 -34
package/ARCHITECTURE.md
CHANGED
|
@@ -128,7 +128,7 @@ The assistant daemon does not read or distribute a feature-flag token. All featu
|
|
|
128
128
|
|
|
129
129
|
### Channel Verification Session Control-Plane Proxy
|
|
130
130
|
|
|
131
|
-
Channel verification session endpoints are exposed directly by the gateway and forwarded to runtime integration handlers
|
|
131
|
+
Channel verification session endpoints are exposed directly by the gateway and forwarded to runtime integration handlers for dedicated auth handling. This keeps assistant skills and user-facing tooling on gateway URLs only.
|
|
132
132
|
|
|
133
133
|
**Forwarded endpoints:**
|
|
134
134
|
|
|
@@ -158,7 +158,7 @@ The `/v1/guardian/refresh` endpoint is the only public ingress for rotating JWT
|
|
|
158
158
|
|
|
159
159
|
### Runtime Health Proxy
|
|
160
160
|
|
|
161
|
-
Runtime health is exposed directly by the gateway at `GET /v1/health` and forwarded to the runtime's `GET /v1/health` endpoint
|
|
161
|
+
Runtime health is exposed directly by the gateway at `GET /v1/health` and forwarded to the runtime's `GET /v1/health` endpoint for dedicated auth handling.
|
|
162
162
|
|
|
163
163
|
**Authentication boundary:**
|
|
164
164
|
|
|
@@ -175,7 +175,7 @@ Runtime health is exposed directly by the gateway at `GET /v1/health` and forwar
|
|
|
175
175
|
|
|
176
176
|
### Telegram + Contacts Control-Plane Proxies
|
|
177
177
|
|
|
178
|
-
Telegram integration setup/config endpoints and contacts/invites endpoints are also exposed directly by the gateway and forwarded to runtime handlers
|
|
178
|
+
Telegram integration setup/config endpoints and contacts/invites endpoints are also exposed directly by the gateway and forwarded to runtime handlers for dedicated auth handling.
|
|
179
179
|
|
|
180
180
|
**Forwarded Telegram endpoints:**
|
|
181
181
|
|
|
@@ -213,7 +213,7 @@ Telegram integration setup/config endpoints and contacts/invites endpoints are a
|
|
|
213
213
|
|
|
214
214
|
### Twilio Control-Plane Proxy
|
|
215
215
|
|
|
216
|
-
Twilio integration setup/config endpoints are exposed directly by the gateway and forwarded to runtime handlers
|
|
216
|
+
Twilio integration setup/config endpoints are exposed directly by the gateway and forwarded to runtime handlers for dedicated auth handling. This keeps skills and clients on gateway URLs exclusively.
|
|
217
217
|
|
|
218
218
|
**Forwarded endpoints:**
|
|
219
219
|
|
|
@@ -242,7 +242,7 @@ Twilio integration setup/config endpoints are exposed directly by the gateway an
|
|
|
242
242
|
|
|
243
243
|
### Channel Readiness Proxy
|
|
244
244
|
|
|
245
|
-
Channel readiness endpoints are exposed directly by the gateway and forwarded to runtime handlers
|
|
245
|
+
Channel readiness endpoints are exposed directly by the gateway and forwarded to runtime handlers for dedicated auth handling.
|
|
246
246
|
|
|
247
247
|
**Forwarded endpoints:**
|
|
248
248
|
|
|
@@ -332,7 +332,7 @@ The `/deliver/telegram` endpoint requires bearer auth unconditionally (fail-clos
|
|
|
332
332
|
|
|
333
333
|
### Channel Approval Flow
|
|
334
334
|
|
|
335
|
-
When the assistant requires tool-use confirmation during a channel session (e.g., Telegram), the approval flow intercepts the run and surfaces an interactive prompt to the user. This approval-aware path is always active when orchestrator + callback context are available. Guardian enforcement (fail-closed denial for unknown actors,
|
|
335
|
+
When the assistant requires tool-use confirmation during a channel session (e.g., Telegram), the approval flow intercepts the run and surfaces an interactive prompt to the user. This approval-aware path is always active when orchestrator + callback context are available. Guardian enforcement (fail-closed denial for unknown actors, explicit approval prompts for side effects, guardian-routed approval prompts) applies consistently to non-guardian/unverified actors.
|
|
336
336
|
|
|
337
337
|
**State machine:**
|
|
338
338
|
|
|
@@ -367,7 +367,7 @@ Runtime detects needs_confirmation
|
|
|
367
367
|
|
|
368
368
|
**Conversational approval turn:** When a text message arrives while an approval is pending (e.g., non-Telegram channels or user typing a reply instead of clicking a button), a **conversational approval turn** is run via `runApprovalConversationTurn()` from `approval-conversation-turn.ts`. The conversational engine uses LLM structured output (native `tool_use`) to classify user intent as: `keep_pending` (reply without deciding), `approve_once`, `approve_always`, or `reject`. Non-decision messages receive a natural assistant reply and the run stays pending — no reminder spam. The engine fails closed: any model failure returns `keep_pending` with a deterministic fallback asking the user to try again. Callback/button handling remains deterministic and unchanged. The `channelSupportsRichApprovalUI()` function determines whether to send the structured `promptText` (for rich channels like Telegram) or the `plainTextFallback` string (for all other channels). Currently only `telegram` is classified as a rich channel.
|
|
369
369
|
|
|
370
|
-
**Guardian-aware routing:** When a guardian binding exists for the channel, the approval flow resolves the sender's actor role (`guardian` vs `non-guardian`). Non-guardian actors have `
|
|
370
|
+
**Guardian-aware routing:** When a guardian binding exists for the channel, the approval flow resolves the sender's actor role (`guardian` vs `non-guardian`). Non-guardian actors have `forcePromptSideEffects` set on the session so all side-effect tools trigger approval prompts regardless of existing allow rules. Approval prompts for non-guardian actions are routed to the guardian's delivery chat (not the requester's chat), and a `channelGuardianApprovalRequest` record is created. When the guardian approves or denies, the decision is applied to the underlying run and the requester's chat is notified of the outcome. Guardian actors follow the standard approval flow. Guardian approval follow-ups also use the conversational engine with role-specific context; `approve_always` is downgraded to `approve_once` for guardian approvals since permanent allow-rules require guardian authority. All guardian state (bindings, challenges, approval requests) is scoped to the `(assistantId, channel)` pair -- the `assistantId` parameter flows through `handleChannelInbound`, `validateAndConsumeVerification`, `isGuardian`, `getGuardianBinding`, and `createApprovalRequest`.
|
|
371
371
|
|
|
372
372
|
**Proactive expiry sweep:** The runtime runs a periodic sweep every 60 seconds (`sweepExpiredGuardianApprovals`) that finds guardian approval requests past the 30-minute TTL, auto-denies the underlying runs, and notifies both the requester and guardian via the gateway's per-channel `/deliver/<channel>` endpoint. This ensures expired approvals are closed without waiting for follow-up traffic from either party. The sweep is started automatically whenever a run orchestrator is available.
|
|
373
373
|
|
|
@@ -489,10 +489,10 @@ This ordering ensures that ingress ACL decisions are finalized before any agent
|
|
|
489
489
|
|
|
490
490
|
#### Actor Role Resolution
|
|
491
491
|
|
|
492
|
-
When a message arrives on a channel, the runtime resolves the sender's role. Role _classification_ runs unconditionally. Guardian enforcement (`
|
|
492
|
+
When a message arrives on a channel, the runtime resolves the sender's role. Role _classification_ runs unconditionally. Guardian enforcement (`forcePromptSideEffects`, fail-closed denial, guardian approval routing) applies to non-guardian/unverified actors whenever orchestrator + callback context are available:
|
|
493
493
|
|
|
494
494
|
- **Guardian**: `actorExternalId` matches the binding's `guardianExternalUserId` (DB column) for the `(assistantId, channel)` pair. Self-approval is handled through the same approval-aware channel flow.
|
|
495
|
-
- **Non-guardian**: A known sender who is not the guardian. Side-effect tools are forced through the confirmation flow (`
|
|
495
|
+
- **Non-guardian**: A known sender who is not the guardian. Side-effect tools are forced through the confirmation flow (`forcePromptSideEffects`), and approval prompts are routed to the guardian's chat instead of the requester's chat.
|
|
496
496
|
- **Unverified channel**: No guardian binding exists for the channel, or `actorExternalId` is absent. Sensitive actions are auto-denied immediately (fail-closed). This prevents unverified senders from self-approving actions or bypassing guardian enforcement by omitting identity data.
|
|
497
497
|
|
|
498
498
|
#### Sensitive Action Gating (Non-Guardian Approval)
|
|
@@ -510,7 +510,7 @@ sequenceDiagram
|
|
|
510
510
|
NG->>TG: Message triggers tool use
|
|
511
511
|
TG->>GW: POST /webhooks/telegram
|
|
512
512
|
GW->>Daemon: POST /v1/channels/inbound (JWT auth)
|
|
513
|
-
Daemon->>Daemon: Detect non-guardian, set
|
|
513
|
+
Daemon->>Daemon: Detect non-guardian, set forcePromptSideEffects
|
|
514
514
|
Daemon->>Daemon: Tool needs confirmation → create GuardianApprovalRequest
|
|
515
515
|
Daemon->>GW: POST /deliver/telegram (approval prompt + inline keyboard)
|
|
516
516
|
GW->>Guardian: sendMessage (approval prompt)
|
package/Dockerfile
CHANGED
|
@@ -9,7 +9,13 @@ WORKDIR /app
|
|
|
9
9
|
COPY --from=bun /usr/local/bin/bun /usr/local/bin/bun
|
|
10
10
|
|
|
11
11
|
# Copy shared packages needed by gateway's repo-local dependencies
|
|
12
|
-
COPY packages/
|
|
12
|
+
COPY packages/assistant-client ./packages/assistant-client
|
|
13
|
+
COPY packages/ces-client ./packages/ces-client
|
|
14
|
+
COPY packages/service-contracts ./packages/service-contracts
|
|
15
|
+
COPY packages/slack-text ./packages/slack-text
|
|
16
|
+
|
|
17
|
+
# Install deps for shared packages that have their own file: dependencies.
|
|
18
|
+
RUN cd /app/packages/ces-client && bun install --frozen-lockfile
|
|
13
19
|
|
|
14
20
|
# Install gateway dependencies first for cache reuse
|
|
15
21
|
COPY gateway/package.json gateway/bun.lock ./gateway/
|
|
@@ -36,13 +42,9 @@ RUN groupadd --system --gid 1001 gateway && \
|
|
|
36
42
|
useradd --system --uid 1001 --gid gateway --create-home gateway
|
|
37
43
|
|
|
38
44
|
COPY --from=builder --chown=gateway:gateway /app/gateway /app
|
|
39
|
-
# `bun install` materializes
|
|
40
|
-
#
|
|
41
|
-
#
|
|
42
|
-
# the builder. Those absolute targets have to exist in the runner too, or
|
|
43
|
-
# every `@vellumai/ces-contracts[/…]` import resolves to a dangling link
|
|
44
|
-
# and the gateway crashes with "Cannot find module ..." at first use.
|
|
45
|
-
# Copy the sibling package into the runner so the symlinks resolve.
|
|
45
|
+
# `bun install` materializes repo-local file: dependencies as symlinks in
|
|
46
|
+
# node_modules pointing at absolute paths in the builder stage.
|
|
47
|
+
# Copy the sibling packages into the runner so the symlinks resolve.
|
|
46
48
|
COPY --from=builder --chown=gateway:gateway /app/packages /app/packages
|
|
47
49
|
|
|
48
50
|
RUN mkdir -p /gateway-security && chown gateway:gateway /gateway-security
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Vellum Gateway
|
|
2
2
|
|
|
3
|
-
Standalone service that serves as the public ingress boundary for all external webhooks and callbacks. It owns Telegram integration end-to-end, routes Twilio voice webhooks, handles OAuth callbacks, and
|
|
3
|
+
Standalone service that serves as the public ingress boundary for all external webhooks and callbacks. It owns Telegram integration end-to-end, routes Twilio voice webhooks, handles OAuth callbacks, and acts as an authenticated reverse proxy for the assistant runtime.
|
|
4
4
|
|
|
5
5
|
## Architecture
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@ Telegram → gateway/ → Assistant Runtime (/v1/assistants/:id/channels/inbound
|
|
|
10
10
|
Client → gateway/ (Bearer auth) → Assistant Runtime (any path)
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
The web app is **not** in the Telegram request path.
|
|
13
|
+
The web app is **not** in the Telegram request path. All non-Telegram requests that don't match a dedicated gateway route are forwarded to the assistant runtime with bearer token authentication.
|
|
14
14
|
|
|
15
15
|
For ingress and channel architecture details, see [`ARCHITECTURE.md`](ARCHITECTURE.md).
|
|
16
16
|
|
|
@@ -218,13 +218,9 @@ The gateway is the **sole public ingress point** for all external webhooks. The
|
|
|
218
218
|
|
|
219
219
|
When the ingress public base URL is configured (via `ingress.publicBaseUrl` in workspace config, read through `ConfigFileCache`), the gateway prioritizes it as the canonical URL for Twilio signature validation. If the signature only validates against the raw local request URL (fallback), a warning is logged indicating potential drift between the configured ingress URL and the actual webhook registration. The raw URL fallback is preserved for local-dev operability.
|
|
220
220
|
|
|
221
|
-
##
|
|
221
|
+
## Runtime Proxy
|
|
222
222
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
## Runtime Proxy Mode
|
|
226
|
-
|
|
227
|
-
When the runtime proxy is enabled (via workspace config), the gateway forwards all non-Telegram HTTP requests to the assistant runtime. This allows the gateway to serve as a single ingress point for both Telegram and API traffic.
|
|
223
|
+
The gateway acts as the single ingress point for all traffic. Dedicated gateway routes (webhooks, control-plane proxies, health checks) are matched first; any request that doesn't match a specific route is forwarded to the assistant runtime via a catch-all proxy.
|
|
228
224
|
|
|
229
225
|
### Auth behavior
|
|
230
226
|
|