agent-relay 1.1.0 → 1.2.3
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/.gitattributes +3 -0
- package/.nvmrc +1 -0
- package/.trajectories/completed/2026-01/traj_1dviorhnkcb5.json +65 -0
- package/.trajectories/completed/2026-01/traj_1dviorhnkcb5.md +37 -0
- package/.trajectories/completed/2026-01/traj_1k5if5snst2e.json +65 -0
- package/.trajectories/completed/2026-01/traj_1k5if5snst2e.md +37 -0
- package/.trajectories/completed/2026-01/traj_1rp3rges5811.json +49 -0
- package/.trajectories/completed/2026-01/traj_1rp3rges5811.md +31 -0
- package/.trajectories/completed/2026-01/traj_22bhyulruouw.json +113 -0
- package/.trajectories/completed/2026-01/traj_22bhyulruouw.md +57 -0
- package/.trajectories/completed/2026-01/traj_2dao7ddgnta0.json +53 -0
- package/.trajectories/completed/2026-01/traj_2dao7ddgnta0.md +32 -0
- package/.trajectories/completed/2026-01/traj_3t0440mjeunc.json +26 -0
- package/.trajectories/completed/2026-01/traj_3t0440mjeunc.md +6 -0
- package/.trajectories/completed/2026-01/traj_45x9494d9xnr.json +47 -0
- package/.trajectories/completed/2026-01/traj_45x9494d9xnr.md +32 -0
- package/.trajectories/completed/2026-01/traj_4aa0bb77s4nh.json +53 -0
- package/.trajectories/completed/2026-01/traj_4aa0bb77s4nh.md +32 -0
- package/.trajectories/completed/2026-01/traj_5lhmzq8rxpqv.json +59 -0
- package/.trajectories/completed/2026-01/traj_5lhmzq8rxpqv.md +33 -0
- package/.trajectories/completed/2026-01/traj_5vr4e9erb1fs.json +53 -0
- package/.trajectories/completed/2026-01/traj_5vr4e9erb1fs.md +32 -0
- package/.trajectories/completed/2026-01/traj_6fgiwdoklvym.json +48 -0
- package/.trajectories/completed/2026-01/traj_6fgiwdoklvym.md +24 -0
- package/.trajectories/completed/2026-01/traj_7ludwvz45veh.json +209 -0
- package/.trajectories/completed/2026-01/traj_7ludwvz45veh.md +97 -0
- package/.trajectories/completed/2026-01/traj_9921cuhel0pj.json +48 -0
- package/.trajectories/completed/2026-01/traj_9921cuhel0pj.md +24 -0
- package/.trajectories/completed/2026-01/traj_ajs7zqfux4wc.json +49 -0
- package/.trajectories/completed/2026-01/traj_ajs7zqfux4wc.md +23 -0
- package/.trajectories/completed/2026-01/traj_cvtqhlwcq9s0.json +53 -0
- package/.trajectories/completed/2026-01/traj_cvtqhlwcq9s0.md +32 -0
- package/.trajectories/completed/2026-01/traj_cxofprm2m2en.json +49 -0
- package/.trajectories/completed/2026-01/traj_cxofprm2m2en.md +31 -0
- package/.trajectories/completed/2026-01/traj_d2hhz3k0vrhn.json +26 -0
- package/.trajectories/completed/2026-01/traj_d2hhz3k0vrhn.md +6 -0
- package/.trajectories/completed/2026-01/traj_dfuvww9pege5.json +59 -0
- package/.trajectories/completed/2026-01/traj_dfuvww9pege5.md +37 -0
- package/.trajectories/completed/2026-01/traj_g0fisy9h51mf.json +77 -0
- package/.trajectories/completed/2026-01/traj_g0fisy9h51mf.md +42 -0
- package/.trajectories/completed/2026-01/traj_gjdre5voouod.json +53 -0
- package/.trajectories/completed/2026-01/traj_gjdre5voouod.md +32 -0
- package/.trajectories/completed/2026-01/traj_gtlyqtta3x8l.json +25 -0
- package/.trajectories/completed/2026-01/traj_gtlyqtta3x8l.md +15 -0
- package/.trajectories/completed/2026-01/traj_h4xijiuip3w4.json +101 -0
- package/.trajectories/completed/2026-01/traj_h4xijiuip3w4.md +44 -0
- package/.trajectories/completed/2026-01/traj_hhxte7w4gjjx.json +22 -0
- package/.trajectories/completed/2026-01/traj_hhxte7w4gjjx.md +5 -0
- package/.trajectories/completed/2026-01/traj_hpungyhoj6v5.json +53 -0
- package/.trajectories/completed/2026-01/traj_hpungyhoj6v5.md +32 -0
- package/.trajectories/completed/2026-01/traj_m2xkjv0w2sq7.json +25 -0
- package/.trajectories/completed/2026-01/traj_m2xkjv0w2sq7.md +15 -0
- package/.trajectories/completed/2026-01/traj_noq5zbvnrdvz.json +53 -0
- package/.trajectories/completed/2026-01/traj_noq5zbvnrdvz.md +32 -0
- package/.trajectories/completed/2026-01/traj_ntbs6ppopf46.json +53 -0
- package/.trajectories/completed/2026-01/traj_ntbs6ppopf46.md +32 -0
- package/.trajectories/completed/2026-01/traj_ozd98si6a7ns.json +48 -0
- package/.trajectories/completed/2026-01/traj_ozd98si6a7ns.md +24 -0
- package/.trajectories/completed/2026-01/traj_prdza7a5cxp5.json +53 -0
- package/.trajectories/completed/2026-01/traj_prdza7a5cxp5.md +32 -0
- package/.trajectories/completed/2026-01/traj_qb3twvvywfwi.json +77 -0
- package/.trajectories/completed/2026-01/traj_qb3twvvywfwi.md +42 -0
- package/.trajectories/completed/2026-01/traj_qft54mi7nfor.json +53 -0
- package/.trajectories/completed/2026-01/traj_qft54mi7nfor.md +32 -0
- package/.trajectories/completed/2026-01/traj_qx9uhf8whhxo.json +83 -0
- package/.trajectories/completed/2026-01/traj_qx9uhf8whhxo.md +47 -0
- package/.trajectories/completed/2026-01/traj_rd9toccj18a0.json +59 -0
- package/.trajectories/completed/2026-01/traj_rd9toccj18a0.md +37 -0
- package/.trajectories/completed/2026-01/traj_rt4fiw3ecp50.json +48 -0
- package/.trajectories/completed/2026-01/traj_rt4fiw3ecp50.md +16 -0
- package/.trajectories/completed/2026-01/traj_st8j35b0hrlc.json +59 -0
- package/.trajectories/completed/2026-01/traj_st8j35b0hrlc.md +37 -0
- package/.trajectories/completed/2026-01/traj_t1yy8m7hbuxp.json +53 -0
- package/.trajectories/completed/2026-01/traj_t1yy8m7hbuxp.md +32 -0
- package/.trajectories/completed/2026-01/traj_tmux_orchestrator_analysis.json +84 -0
- package/.trajectories/completed/2026-01/traj_tmux_orchestrator_analysis.md +109 -0
- package/.trajectories/completed/2026-01/traj_u9n9eqasw16k.json +53 -0
- package/.trajectories/completed/2026-01/traj_u9n9eqasw16k.md +32 -0
- package/.trajectories/completed/2026-01/traj_v87hypnongqx.json +71 -0
- package/.trajectories/completed/2026-01/traj_v87hypnongqx.md +42 -0
- package/.trajectories/completed/2026-01/traj_wkp2fgzdyinb.json +53 -0
- package/.trajectories/completed/2026-01/traj_wkp2fgzdyinb.md +32 -0
- package/.trajectories/completed/2026-01/traj_x14t8w8rn7xg.json +20 -0
- package/.trajectories/completed/2026-01/traj_x14t8w8rn7xg.md +6 -0
- package/.trajectories/completed/2026-01/traj_xnwbznkvv8ua.json +175 -0
- package/.trajectories/completed/2026-01/traj_xnwbznkvv8ua.md +82 -0
- package/.trajectories/completed/2026-01/traj_ysjc8zaeqtd3.json +47 -0
- package/.trajectories/completed/2026-01/traj_ysjc8zaeqtd3.md +32 -0
- package/.trajectories/completed/2026-01/traj_yvdadtvdgnz3.json +59 -0
- package/.trajectories/completed/2026-01/traj_yvdadtvdgnz3.md +37 -0
- package/.trajectories/completed/2026-01/traj_z0vcw1wrzide.json +53 -0
- package/.trajectories/completed/2026-01/traj_z0vcw1wrzide.md +32 -0
- package/.trajectories/index.json +314 -0
- package/ARCHITECTURE.md +1245 -0
- package/README.md +1 -1
- package/TESTING.md +278 -0
- package/deploy/init-db.sql +5 -0
- package/deploy/scripts/setup-fly-workspaces.sh +69 -0
- package/deploy/scripts/setup-railway.sh +75 -0
- package/deploy/workspace/entrypoint-browser.sh +118 -0
- package/deploy/workspace/entrypoint.sh +348 -0
- package/deploy/workspace/git-credential-relay +111 -0
- package/dist/bridge/spawner.d.ts +53 -0
- package/dist/bridge/spawner.js +203 -19
- package/dist/bridge/types.d.ts +12 -0
- package/dist/cli/index.js +618 -5
- package/dist/cloud/api/auth.d.ts +3 -2
- package/dist/cloud/api/auth.js +10 -98
- package/dist/cloud/api/billing.js +30 -9
- package/dist/cloud/api/cli-pty-runner.d.ts +54 -0
- package/dist/cloud/api/cli-pty-runner.js +119 -0
- package/dist/cloud/api/codex-auth-helper.d.ts +15 -0
- package/dist/cloud/api/codex-auth-helper.js +100 -0
- package/dist/cloud/api/generic-webhooks.d.ts +8 -0
- package/dist/cloud/api/generic-webhooks.js +129 -0
- package/dist/cloud/api/git.d.ts +8 -0
- package/dist/cloud/api/git.js +152 -0
- package/dist/cloud/api/github-app.d.ts +11 -0
- package/dist/cloud/api/github-app.js +189 -0
- package/dist/cloud/api/middleware/planLimits.d.ts +7 -0
- package/dist/cloud/api/middleware/planLimits.js +39 -1
- package/dist/cloud/api/monitoring.d.ts +11 -0
- package/dist/cloud/api/monitoring.js +578 -0
- package/dist/cloud/api/nango-auth.d.ts +9 -0
- package/dist/cloud/api/nango-auth.js +377 -0
- package/dist/cloud/api/onboarding.d.ts +8 -1
- package/dist/cloud/api/onboarding.js +313 -119
- package/dist/cloud/api/policy.d.ts +8 -0
- package/dist/cloud/api/policy.js +229 -0
- package/dist/cloud/api/providers.js +114 -42
- package/dist/cloud/api/repos.d.ts +1 -0
- package/dist/cloud/api/repos.js +186 -0
- package/dist/cloud/api/test-helpers.d.ts +10 -0
- package/dist/cloud/api/test-helpers.js +575 -0
- package/dist/cloud/api/webhooks.d.ts +8 -0
- package/dist/cloud/api/webhooks.js +645 -0
- package/dist/cloud/api/workspaces.js +320 -12
- package/dist/cloud/billing/plans.js +32 -19
- package/dist/cloud/billing/types.d.ts +9 -3
- package/dist/cloud/config.d.ts +9 -2
- package/dist/cloud/config.js +13 -4
- package/dist/cloud/db/drizzle.d.ts +84 -1
- package/dist/cloud/db/drizzle.js +470 -0
- package/dist/cloud/db/index.d.ts +9 -4
- package/dist/cloud/db/index.js +11 -3
- package/dist/cloud/db/schema.d.ts +3283 -556
- package/dist/cloud/db/schema.js +314 -1
- package/dist/cloud/index.d.ts +1 -0
- package/dist/cloud/index.js +2 -0
- package/dist/cloud/provisioner/index.d.ts +56 -0
- package/dist/cloud/provisioner/index.js +676 -34
- package/dist/cloud/server.d.ts +1 -0
- package/dist/cloud/server.js +362 -13
- package/dist/cloud/services/auto-scaler.d.ts +152 -0
- package/dist/cloud/services/auto-scaler.js +439 -0
- package/dist/cloud/services/capacity-manager.d.ts +148 -0
- package/dist/cloud/services/capacity-manager.js +449 -0
- package/dist/cloud/services/ci-agent-spawner.d.ts +49 -0
- package/dist/cloud/services/ci-agent-spawner.js +373 -0
- package/dist/cloud/services/index.d.ts +12 -0
- package/dist/cloud/services/index.js +15 -0
- package/dist/cloud/services/mention-handler.d.ts +65 -0
- package/dist/cloud/services/mention-handler.js +405 -0
- package/dist/cloud/services/nango.d.ts +186 -0
- package/dist/cloud/services/nango.js +344 -0
- package/dist/cloud/services/persistence.d.ts +131 -0
- package/dist/cloud/services/persistence.js +200 -0
- package/dist/cloud/services/planLimits.d.ts +37 -0
- package/dist/cloud/services/planLimits.js +86 -5
- package/dist/cloud/services/scaling-orchestrator.d.ts +159 -0
- package/dist/cloud/services/scaling-orchestrator.js +502 -0
- package/dist/cloud/services/scaling-policy.d.ts +121 -0
- package/dist/cloud/services/scaling-policy.js +415 -0
- package/dist/cloud/vault/index.js +1 -1
- package/dist/cloud/webhooks/index.d.ts +24 -0
- package/dist/cloud/webhooks/index.js +29 -0
- package/dist/cloud/webhooks/parsers/github.d.ts +8 -0
- package/dist/cloud/webhooks/parsers/github.js +234 -0
- package/dist/cloud/webhooks/parsers/index.d.ts +23 -0
- package/dist/cloud/webhooks/parsers/index.js +30 -0
- package/dist/cloud/webhooks/parsers/linear.d.ts +9 -0
- package/dist/cloud/webhooks/parsers/linear.js +258 -0
- package/dist/cloud/webhooks/parsers/slack.d.ts +9 -0
- package/dist/cloud/webhooks/parsers/slack.js +214 -0
- package/dist/cloud/webhooks/responders/github.d.ts +8 -0
- package/dist/cloud/webhooks/responders/github.js +73 -0
- package/dist/cloud/webhooks/responders/index.d.ts +23 -0
- package/dist/cloud/webhooks/responders/index.js +30 -0
- package/dist/cloud/webhooks/responders/linear.d.ts +9 -0
- package/dist/cloud/webhooks/responders/linear.js +149 -0
- package/dist/cloud/webhooks/responders/slack.d.ts +20 -0
- package/dist/cloud/webhooks/responders/slack.js +178 -0
- package/dist/cloud/webhooks/router.d.ts +25 -0
- package/dist/cloud/webhooks/router.js +504 -0
- package/dist/cloud/webhooks/rules-engine.d.ts +24 -0
- package/dist/cloud/webhooks/rules-engine.js +287 -0
- package/dist/cloud/webhooks/types.d.ts +186 -0
- package/dist/cloud/webhooks/types.js +8 -0
- package/dist/continuity/formatter.d.ts +51 -0
- package/dist/continuity/formatter.js +313 -0
- package/dist/continuity/handoff-store.d.ts +67 -0
- package/dist/continuity/handoff-store.js +472 -0
- package/dist/continuity/index.d.ts +45 -0
- package/dist/continuity/index.js +48 -0
- package/dist/continuity/ledger-store.d.ts +110 -0
- package/dist/continuity/ledger-store.js +500 -0
- package/dist/continuity/manager.d.ts +178 -0
- package/dist/continuity/manager.js +562 -0
- package/dist/continuity/parser.d.ts +76 -0
- package/dist/continuity/parser.js +579 -0
- package/dist/continuity/types.d.ts +180 -0
- package/dist/continuity/types.js +9 -0
- package/dist/daemon/agent-manager.d.ts +27 -0
- package/dist/daemon/agent-manager.js +107 -6
- package/dist/daemon/agent-registry.d.ts +32 -0
- package/dist/daemon/agent-registry.js +42 -2
- package/dist/daemon/api.d.ts +12 -0
- package/dist/daemon/api.js +131 -2
- package/dist/daemon/cli-auth.d.ts +67 -0
- package/dist/daemon/cli-auth.js +537 -0
- package/dist/daemon/cloud-sync.js +9 -7
- package/dist/daemon/orchestrator.js +30 -0
- package/dist/daemon/router.d.ts +5 -0
- package/dist/daemon/router.js +78 -26
- package/dist/daemon/server.d.ts +5 -0
- package/dist/daemon/server.js +9 -1
- package/dist/daemon/services/browser-testing.d.ts +88 -0
- package/dist/daemon/services/browser-testing.js +244 -0
- package/dist/daemon/services/container-spawner.d.ts +135 -0
- package/dist/daemon/services/container-spawner.js +313 -0
- package/dist/daemon/types.d.ts +5 -1
- package/dist/dashboard/out/404.html +1 -1
- package/dist/dashboard/out/_next/static/chunks/116-2502180def231162.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/282-980c2eb8fff20123.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/699-3b1cd6618a45d259.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/724-2dae7627550ab88f.js +9 -0
- package/dist/dashboard/out/_next/static/chunks/766-1f2dd8cb7f766b0b.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/app/onboarding/page-3fdfa60e53f2810d.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/app/page-e6381e5a6e1fbcfd.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/connect-repos/page-3538dfe0ffe984b8.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/history/{page-b6edd4dde8d08194.js → page-abb9ab2d329f56e9.js} +1 -1
- package/dist/dashboard/out/_next/static/chunks/app/layout-c0d118c0f92d969c.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/login/page-c22d080201cbd9fb.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/metrics/page-67a3e98d9a43a6ed.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/page-77e9c65420a06cfb.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/pricing/page-b08ed1c34d14434a.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/providers/page-e88bc117ef7671c3.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/signup/page-68d34f50baa8ab6b.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/e868780c-48e5f147c90a3a41.js +18 -0
- package/dist/dashboard/out/_next/static/chunks/{main-app-5d692157a8eb1fd9.js → main-app-6e8e8d3ef4e0192a.js} +1 -1
- package/dist/dashboard/out/_next/static/chunks/{main-c2f423b9c9f4591b.js → main-ed4e1fb6f29c34cf.js} +1 -1
- package/dist/dashboard/out/_next/static/chunks/webpack-1cdd8ed57114d5e1.js +1 -0
- package/dist/dashboard/out/_next/static/css/29852f26181969a0.css +1 -0
- package/dist/dashboard/out/_next/static/css/7c3ae9e8617d42a5.css +1 -0
- package/dist/dashboard/out/app/onboarding.html +1 -0
- package/dist/dashboard/out/app/onboarding.txt +7 -0
- package/dist/dashboard/out/app.html +1 -14
- package/dist/dashboard/out/app.txt +2 -2
- package/dist/dashboard/out/connect-repos.html +1 -0
- package/dist/dashboard/out/connect-repos.txt +7 -0
- package/dist/dashboard/out/history.html +1 -1
- package/dist/dashboard/out/history.txt +2 -2
- package/dist/dashboard/out/index.html +1 -1
- package/dist/dashboard/out/index.txt +2 -2
- package/dist/dashboard/out/login.html +6 -0
- package/dist/dashboard/out/login.txt +7 -0
- package/dist/dashboard/out/metrics.html +1 -1
- package/dist/dashboard/out/metrics.txt +2 -2
- package/dist/dashboard/out/pricing.html +3 -3
- package/dist/dashboard/out/pricing.txt +2 -2
- package/dist/dashboard/out/providers.html +1 -0
- package/dist/dashboard/out/providers.txt +7 -0
- package/dist/dashboard/out/signup.html +6 -0
- package/dist/dashboard/out/signup.txt +7 -0
- package/dist/dashboard-server/server.js +1308 -8
- package/dist/hooks/emitter.d.ts +40 -0
- package/dist/hooks/emitter.js +63 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.js +3 -0
- package/dist/hooks/registry.d.ts +173 -0
- package/dist/hooks/registry.js +476 -0
- package/dist/hooks/trajectory-hooks.d.ts +52 -0
- package/dist/hooks/trajectory-hooks.js +183 -0
- package/dist/hooks/types.d.ts +141 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/memory/adapters/index.d.ts +8 -0
- package/dist/memory/adapters/index.js +8 -0
- package/dist/memory/adapters/inmemory.d.ts +59 -0
- package/dist/memory/adapters/inmemory.js +195 -0
- package/dist/memory/adapters/supermemory.d.ts +71 -0
- package/dist/memory/adapters/supermemory.js +338 -0
- package/dist/memory/factory.d.ts +48 -0
- package/dist/memory/factory.js +143 -0
- package/dist/memory/index.d.ts +32 -0
- package/dist/memory/index.js +32 -0
- package/dist/memory/memory-hooks.d.ts +60 -0
- package/dist/memory/memory-hooks.js +313 -0
- package/dist/memory/service.d.ts +49 -0
- package/dist/memory/service.js +146 -0
- package/dist/memory/types.d.ts +195 -0
- package/dist/memory/types.js +8 -0
- package/dist/policy/agent-policy.d.ts +225 -0
- package/dist/policy/agent-policy.js +665 -0
- package/dist/policy/cloud-policy-fetcher.d.ts +12 -0
- package/dist/policy/cloud-policy-fetcher.js +64 -0
- package/dist/resiliency/crash-insights.d.ts +156 -0
- package/dist/resiliency/crash-insights.js +492 -0
- package/dist/resiliency/gossip-health.d.ts +137 -0
- package/dist/resiliency/gossip-health.js +241 -0
- package/dist/resiliency/index.d.ts +5 -0
- package/dist/resiliency/index.js +5 -0
- package/dist/resiliency/leader-watchdog.d.ts +109 -0
- package/dist/resiliency/leader-watchdog.js +189 -0
- package/dist/resiliency/memory-monitor.d.ts +172 -0
- package/dist/resiliency/memory-monitor.js +593 -0
- package/dist/resiliency/stateless-lead.d.ts +149 -0
- package/dist/resiliency/stateless-lead.js +308 -0
- package/dist/resiliency/supervisor.d.ts +38 -0
- package/dist/resiliency/supervisor.js +122 -0
- package/dist/shared/cli-auth-config.d.ts +91 -0
- package/dist/shared/cli-auth-config.js +264 -0
- package/dist/storage/adapter.d.ts +1 -1
- package/dist/trajectory/config.d.ts +84 -0
- package/dist/trajectory/config.js +163 -0
- package/dist/trajectory/index.d.ts +8 -0
- package/dist/trajectory/index.js +8 -0
- package/dist/trajectory/integration.d.ts +292 -0
- package/dist/trajectory/integration.js +834 -0
- package/dist/utils/logger.js +1 -1
- package/dist/utils/project-namespace.d.ts +24 -0
- package/dist/utils/project-namespace.js +84 -0
- package/dist/wrapper/parser.d.ts +10 -0
- package/dist/wrapper/parser.js +100 -33
- package/dist/wrapper/pty-wrapper.d.ts +197 -16
- package/dist/wrapper/pty-wrapper.js +943 -106
- package/dist/wrapper/shared.d.ts +165 -0
- package/dist/wrapper/shared.js +270 -0
- package/dist/wrapper/tmux-wrapper.d.ts +73 -11
- package/dist/wrapper/tmux-wrapper.js +541 -120
- package/package.json +16 -16
- package/scripts/postinstall.js +60 -0
- package/test-push.txt +1 -0
- package/bin/tmux +0 -0
- package/dist/bridge/config.d.ts.map +0 -1
- package/dist/bridge/config.js.map +0 -1
- package/dist/bridge/index.d.ts.map +0 -1
- package/dist/bridge/index.js.map +0 -1
- package/dist/bridge/multi-project-client.d.ts.map +0 -1
- package/dist/bridge/multi-project-client.js.map +0 -1
- package/dist/bridge/shadow-cli.d.ts.map +0 -1
- package/dist/bridge/shadow-cli.js.map +0 -1
- package/dist/bridge/shadow-config.d.ts.map +0 -1
- package/dist/bridge/shadow-config.js.map +0 -1
- package/dist/bridge/spawner.d.ts.map +0 -1
- package/dist/bridge/spawner.js.map +0 -1
- package/dist/bridge/teams-config.d.ts.map +0 -1
- package/dist/bridge/teams-config.js.map +0 -1
- package/dist/bridge/types.d.ts.map +0 -1
- package/dist/bridge/types.js.map +0 -1
- package/dist/bridge/utils.d.ts.map +0 -1
- package/dist/bridge/utils.js.map +0 -1
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js.map +0 -1
- package/dist/cloud/api/auth.d.ts.map +0 -1
- package/dist/cloud/api/auth.js.map +0 -1
- package/dist/cloud/api/billing.d.ts.map +0 -1
- package/dist/cloud/api/billing.js.map +0 -1
- package/dist/cloud/api/coordinators.d.ts.map +0 -1
- package/dist/cloud/api/coordinators.js.map +0 -1
- package/dist/cloud/api/daemons.d.ts.map +0 -1
- package/dist/cloud/api/daemons.js.map +0 -1
- package/dist/cloud/api/middleware/planLimits.d.ts.map +0 -1
- package/dist/cloud/api/middleware/planLimits.js.map +0 -1
- package/dist/cloud/api/onboarding.d.ts.map +0 -1
- package/dist/cloud/api/onboarding.js.map +0 -1
- package/dist/cloud/api/providers.d.ts.map +0 -1
- package/dist/cloud/api/providers.js.map +0 -1
- package/dist/cloud/api/repos.d.ts.map +0 -1
- package/dist/cloud/api/repos.js.map +0 -1
- package/dist/cloud/api/teams.d.ts.map +0 -1
- package/dist/cloud/api/teams.js.map +0 -1
- package/dist/cloud/api/usage.d.ts.map +0 -1
- package/dist/cloud/api/usage.js.map +0 -1
- package/dist/cloud/api/workspaces.d.ts.map +0 -1
- package/dist/cloud/api/workspaces.js.map +0 -1
- package/dist/cloud/billing/index.d.ts.map +0 -1
- package/dist/cloud/billing/index.js.map +0 -1
- package/dist/cloud/billing/plans.d.ts.map +0 -1
- package/dist/cloud/billing/plans.js.map +0 -1
- package/dist/cloud/billing/service.d.ts.map +0 -1
- package/dist/cloud/billing/service.js.map +0 -1
- package/dist/cloud/billing/types.d.ts.map +0 -1
- package/dist/cloud/billing/types.js.map +0 -1
- package/dist/cloud/config.d.ts.map +0 -1
- package/dist/cloud/config.js.map +0 -1
- package/dist/cloud/db/drizzle.d.ts.map +0 -1
- package/dist/cloud/db/drizzle.js.map +0 -1
- package/dist/cloud/db/index.d.ts.map +0 -1
- package/dist/cloud/db/index.js.map +0 -1
- package/dist/cloud/db/schema.d.ts.map +0 -1
- package/dist/cloud/db/schema.js.map +0 -1
- package/dist/cloud/index.d.ts.map +0 -1
- package/dist/cloud/index.js.map +0 -1
- package/dist/cloud/provisioner/index.d.ts.map +0 -1
- package/dist/cloud/provisioner/index.js.map +0 -1
- package/dist/cloud/server.d.ts.map +0 -1
- package/dist/cloud/server.js.map +0 -1
- package/dist/cloud/services/coordinator.d.ts.map +0 -1
- package/dist/cloud/services/coordinator.js.map +0 -1
- package/dist/cloud/services/planLimits.d.ts.map +0 -1
- package/dist/cloud/services/planLimits.js.map +0 -1
- package/dist/cloud/vault/index.d.ts.map +0 -1
- package/dist/cloud/vault/index.js.map +0 -1
- package/dist/daemon/agent-manager.d.ts.map +0 -1
- package/dist/daemon/agent-manager.js.map +0 -1
- package/dist/daemon/agent-registry.d.ts.map +0 -1
- package/dist/daemon/agent-registry.js.map +0 -1
- package/dist/daemon/api.d.ts.map +0 -1
- package/dist/daemon/api.js.map +0 -1
- package/dist/daemon/auth.d.ts.map +0 -1
- package/dist/daemon/auth.js.map +0 -1
- package/dist/daemon/cloud-sync.d.ts.map +0 -1
- package/dist/daemon/cloud-sync.js.map +0 -1
- package/dist/daemon/connection.d.ts.map +0 -1
- package/dist/daemon/connection.js.map +0 -1
- package/dist/daemon/index.d.ts.map +0 -1
- package/dist/daemon/index.js.map +0 -1
- package/dist/daemon/orchestrator.d.ts.map +0 -1
- package/dist/daemon/orchestrator.js.map +0 -1
- package/dist/daemon/registry.d.ts.map +0 -1
- package/dist/daemon/registry.js.map +0 -1
- package/dist/daemon/router.d.ts.map +0 -1
- package/dist/daemon/router.js.map +0 -1
- package/dist/daemon/server.d.ts.map +0 -1
- package/dist/daemon/server.js.map +0 -1
- package/dist/daemon/types.d.ts.map +0 -1
- package/dist/daemon/types.js.map +0 -1
- package/dist/daemon/workspace-manager.d.ts.map +0 -1
- package/dist/daemon/workspace-manager.js.map +0 -1
- package/dist/dashboard/out/_next/static/chunks/693-7b3301d8f6bc5014.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/713-f78477eb185f1f4d.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/766-e53e1cfe39b0b5b5.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/900-037c64bfd797fb2a.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/app/page-e3d9e1f4466b9bae.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/layout-2433bb48965f4333.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/metrics/page-e68825a81db67ba1.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/page-cc108bf68c8a657f.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/pricing/page-d80e03a5297f95b6.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/webpack-a5acc2831d094776.js +0 -1
- package/dist/dashboard/out/_next/static/css/79b80143647a07d7.css +0 -1
- package/dist/dashboard/out/_next/static/css/8cf277370ad48cfe.css +0 -1
- package/dist/dashboard-server/metrics.d.ts.map +0 -1
- package/dist/dashboard-server/metrics.js.map +0 -1
- package/dist/dashboard-server/needs-attention.d.ts.map +0 -1
- package/dist/dashboard-server/needs-attention.js.map +0 -1
- package/dist/dashboard-server/server.d.ts.map +0 -1
- package/dist/dashboard-server/server.js.map +0 -1
- package/dist/dashboard-server/start.d.ts.map +0 -1
- package/dist/dashboard-server/start.js.map +0 -1
- package/dist/hooks/inbox-check/hook.d.ts.map +0 -1
- package/dist/hooks/inbox-check/hook.js.map +0 -1
- package/dist/hooks/inbox-check/index.d.ts.map +0 -1
- package/dist/hooks/inbox-check/index.js.map +0 -1
- package/dist/hooks/inbox-check/types.d.ts.map +0 -1
- package/dist/hooks/inbox-check/types.js.map +0 -1
- package/dist/hooks/inbox-check/utils.d.ts.map +0 -1
- package/dist/hooks/inbox-check/utils.js.map +0 -1
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/types.d.ts.map +0 -1
- package/dist/hooks/types.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/protocol/framing.d.ts.map +0 -1
- package/dist/protocol/framing.js.map +0 -1
- package/dist/protocol/index.d.ts.map +0 -1
- package/dist/protocol/index.js.map +0 -1
- package/dist/protocol/types.d.ts.map +0 -1
- package/dist/protocol/types.js.map +0 -1
- package/dist/resiliency/context-persistence.d.ts.map +0 -1
- package/dist/resiliency/context-persistence.js.map +0 -1
- package/dist/resiliency/health-monitor.d.ts.map +0 -1
- package/dist/resiliency/health-monitor.js.map +0 -1
- package/dist/resiliency/index.d.ts.map +0 -1
- package/dist/resiliency/index.js.map +0 -1
- package/dist/resiliency/logger.d.ts.map +0 -1
- package/dist/resiliency/logger.js.map +0 -1
- package/dist/resiliency/metrics.d.ts.map +0 -1
- package/dist/resiliency/metrics.js.map +0 -1
- package/dist/resiliency/provider-context.d.ts.map +0 -1
- package/dist/resiliency/provider-context.js.map +0 -1
- package/dist/resiliency/supervisor.d.ts.map +0 -1
- package/dist/resiliency/supervisor.js.map +0 -1
- package/dist/state/agent-state.d.ts.map +0 -1
- package/dist/state/agent-state.js.map +0 -1
- package/dist/storage/adapter.d.ts.map +0 -1
- package/dist/storage/adapter.js.map +0 -1
- package/dist/storage/sqlite-adapter.d.ts.map +0 -1
- package/dist/storage/sqlite-adapter.js.map +0 -1
- package/dist/utils/agent-config.d.ts.map +0 -1
- package/dist/utils/agent-config.js.map +0 -1
- package/dist/utils/command-resolver.d.ts.map +0 -1
- package/dist/utils/command-resolver.js.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/name-generator.d.ts.map +0 -1
- package/dist/utils/name-generator.js.map +0 -1
- package/dist/utils/project-namespace.d.ts.map +0 -1
- package/dist/utils/project-namespace.js.map +0 -1
- package/dist/utils/tmux-resolver.d.ts.map +0 -1
- package/dist/utils/tmux-resolver.js.map +0 -1
- package/dist/utils/update-checker.d.ts.map +0 -1
- package/dist/utils/update-checker.js.map +0 -1
- package/dist/wrapper/client.d.ts.map +0 -1
- package/dist/wrapper/client.js.map +0 -1
- package/dist/wrapper/inbox.d.ts.map +0 -1
- package/dist/wrapper/inbox.js.map +0 -1
- package/dist/wrapper/index.d.ts.map +0 -1
- package/dist/wrapper/index.js.map +0 -1
- package/dist/wrapper/parser.d.ts.map +0 -1
- package/dist/wrapper/parser.js.map +0 -1
- package/dist/wrapper/pty-wrapper.d.ts.map +0 -1
- package/dist/wrapper/pty-wrapper.js.map +0 -1
- package/dist/wrapper/tmux-wrapper.d.ts.map +0 -1
- package/dist/wrapper/tmux-wrapper.js.map +0 -1
- package/docs/AGENTS.md +0 -513
- package/docs/ARCHITECTURE_DECISIONS.md +0 -175
- package/docs/CHANGELOG.md +0 -11
- package/docs/CLI-SIMPLIFICATION-COMPLETE.md +0 -48
- package/docs/CLOUD-ARCHITECTURE.md +0 -652
- package/docs/CLOUD-ONBOARDING-DESIGN.md +0 -1983
- package/docs/COMPETITIVE_ANALYSIS.md +0 -897
- package/docs/CONTRIBUTING.md +0 -151
- package/docs/DESIGN_BRIDGE_STAFFING.md +0 -878
- package/docs/DESIGN_V2.md +0 -1079
- package/docs/INTEGRATION-GUIDE.md +0 -926
- package/docs/MONETIZATION.md +0 -1679
- package/docs/PROPOSAL-trajectories.md +0 -1582
- package/docs/PROTOCOL.md +0 -325
- package/docs/SCALING_ANALYSIS.md +0 -280
- package/docs/TESTING_PRESENCE_FEATURES.md +0 -327
- package/docs/TMUX_IMPLEMENTATION_NOTES.md +0 -364
- package/docs/TMUX_IMPROVEMENTS.md +0 -968
- package/docs/agent-relay-snippet.md +0 -168
- package/docs/competitive-analysis-mcp-agent-mail.md +0 -389
- package/docs/dashboard-v2-plan.md +0 -179
- package/docs/guides/CLOUD.md +0 -236
- package/docs/guides/LOCAL.md +0 -535
- package/docs/guides/SELF-HOSTED.md +0 -494
- package/docs/proposals/shadow-as-subagent.md +0 -765
- package/docs/proposals/slack-bot-integration.md +0 -1457
- package/docs/removable-code-analysis.md +0 -24
- package/scripts/dev/PUBLIC_RELEASE_PLAN.md +0 -88
- package/scripts/dev/dev-team-setup.sh +0 -431
- package/scripts/e2e-test.sh +0 -119
- package/scripts/games/game-protocol.md +0 -79
- package/scripts/games/hearts-setup.sh +0 -264
- package/scripts/tictactoe-setup.sh +0 -181
- /package/dist/dashboard/out/_next/static/chunks/{117-b2cd8d6485aacf2b.js → 117-f7b8ab0809342e77.js} +0 -0
- /package/dist/dashboard/out/_next/static/chunks/{648-8f3f26864ce515e5.js → 648-5cc6e1921389a58a.js} +0 -0
- /package/dist/dashboard/out/_next/static/chunks/app/_not-found/{page-0b990dbb71d72a98.js → page-53b8a69f76db17d0.js} +0 -0
- /package/dist/dashboard/out/_next/static/chunks/{fd9d1056-bf46c09eb57e019c.js → fd9d1056-609918ca7b6280bb.js} +0 -0
- /package/dist/dashboard/out/_next/static/{6HHWb2ZmnJ4OSm0zUP7h4 → wPgKJtcOmTFLpUncDg16A}/_buildManifest.js +0 -0
- /package/dist/dashboard/out/_next/static/{6HHWb2ZmnJ4OSm0zUP7h4 → wPgKJtcOmTFLpUncDg16A}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Webhook Rules Engine
|
|
3
|
+
*
|
|
4
|
+
* Matches normalized events against configured rules and determines actions to take.
|
|
5
|
+
*/
|
|
6
|
+
import type { NormalizedEvent, WebhookRule, WebhookAction } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Check if a rule matches an event
|
|
9
|
+
*/
|
|
10
|
+
export declare function matchesRule(rule: WebhookRule, event: NormalizedEvent): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Find all matching rules for an event, sorted by priority
|
|
13
|
+
*/
|
|
14
|
+
export declare function findMatchingRules(rules: WebhookRule[], event: NormalizedEvent): WebhookRule[];
|
|
15
|
+
/**
|
|
16
|
+
* Resolve template variables in action configuration
|
|
17
|
+
* Supports: ${event.field}, ${event.field.subfield}
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveActionTemplate(action: WebhookAction, event: NormalizedEvent): WebhookAction;
|
|
20
|
+
/**
|
|
21
|
+
* Default rules for common patterns
|
|
22
|
+
*/
|
|
23
|
+
export declare const defaultRules: WebhookRule[];
|
|
24
|
+
//# sourceMappingURL=rules-engine.d.ts.map
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Webhook Rules Engine
|
|
3
|
+
*
|
|
4
|
+
* Matches normalized events against configured rules and determines actions to take.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Simple JSONPath-like evaluator for conditions
|
|
8
|
+
* Supports: $.field, $.field.subfield, comparisons (==, !=, in, contains)
|
|
9
|
+
*/
|
|
10
|
+
function evaluateCondition(condition, event) {
|
|
11
|
+
if (!condition || condition.trim() === '')
|
|
12
|
+
return true;
|
|
13
|
+
try {
|
|
14
|
+
// Parse condition: $.path operator value
|
|
15
|
+
// Note: >= and <= must come before > and < in the alternation to match correctly
|
|
16
|
+
const conditionPattern = /^\$\.([a-zA-Z0-9_.]+)\s*(==|!=|>=|<=|>|<|in|contains)\s*(.+)$/;
|
|
17
|
+
const match = condition.match(conditionPattern);
|
|
18
|
+
if (!match) {
|
|
19
|
+
console.warn(`[rules-engine] Invalid condition format: ${condition}`);
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
const [, path, operator, rawValue] = match;
|
|
23
|
+
const value = rawValue.trim();
|
|
24
|
+
// Get the value from the event
|
|
25
|
+
const eventValue = getValueByPath(event, path);
|
|
26
|
+
// Parse the comparison value
|
|
27
|
+
let compareValue;
|
|
28
|
+
if (value.startsWith('[') && value.endsWith(']')) {
|
|
29
|
+
// Array literal
|
|
30
|
+
compareValue = JSON.parse(value);
|
|
31
|
+
}
|
|
32
|
+
else if (value.startsWith('"') && value.endsWith('"')) {
|
|
33
|
+
// String literal
|
|
34
|
+
compareValue = value.slice(1, -1);
|
|
35
|
+
}
|
|
36
|
+
else if (value === 'true') {
|
|
37
|
+
compareValue = true;
|
|
38
|
+
}
|
|
39
|
+
else if (value === 'false') {
|
|
40
|
+
compareValue = false;
|
|
41
|
+
}
|
|
42
|
+
else if (value === 'null') {
|
|
43
|
+
compareValue = null;
|
|
44
|
+
}
|
|
45
|
+
else if (!isNaN(Number(value))) {
|
|
46
|
+
compareValue = Number(value);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
// Treat as string
|
|
50
|
+
compareValue = value;
|
|
51
|
+
}
|
|
52
|
+
switch (operator) {
|
|
53
|
+
case '==':
|
|
54
|
+
// Handle null/undefined equivalence
|
|
55
|
+
if (compareValue === null) {
|
|
56
|
+
return eventValue === null || eventValue === undefined;
|
|
57
|
+
}
|
|
58
|
+
return eventValue === compareValue;
|
|
59
|
+
case '!=':
|
|
60
|
+
return eventValue !== compareValue;
|
|
61
|
+
case 'in':
|
|
62
|
+
return Array.isArray(compareValue) && compareValue.includes(eventValue);
|
|
63
|
+
case 'contains':
|
|
64
|
+
if (Array.isArray(eventValue)) {
|
|
65
|
+
return eventValue.includes(compareValue);
|
|
66
|
+
}
|
|
67
|
+
if (typeof eventValue === 'string' && typeof compareValue === 'string') {
|
|
68
|
+
return eventValue.includes(compareValue);
|
|
69
|
+
}
|
|
70
|
+
return false;
|
|
71
|
+
case '>':
|
|
72
|
+
return typeof eventValue === 'number' && typeof compareValue === 'number' && eventValue > compareValue;
|
|
73
|
+
case '<':
|
|
74
|
+
return typeof eventValue === 'number' && typeof compareValue === 'number' && eventValue < compareValue;
|
|
75
|
+
case '>=':
|
|
76
|
+
return typeof eventValue === 'number' && typeof compareValue === 'number' && eventValue >= compareValue;
|
|
77
|
+
case '<=':
|
|
78
|
+
return typeof eventValue === 'number' && typeof compareValue === 'number' && eventValue <= compareValue;
|
|
79
|
+
default:
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
console.error(`[rules-engine] Error evaluating condition: ${condition}`, error);
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Get a value from an object by dot-separated path
|
|
90
|
+
*/
|
|
91
|
+
function getValueByPath(obj, path) {
|
|
92
|
+
const parts = path.split('.');
|
|
93
|
+
let current = obj;
|
|
94
|
+
for (const part of parts) {
|
|
95
|
+
if (current === null || current === undefined)
|
|
96
|
+
return undefined;
|
|
97
|
+
if (typeof current !== 'object')
|
|
98
|
+
return undefined;
|
|
99
|
+
current = current[part];
|
|
100
|
+
}
|
|
101
|
+
return current;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Check if a rule matches an event
|
|
105
|
+
*/
|
|
106
|
+
export function matchesRule(rule, event) {
|
|
107
|
+
// Check if rule is enabled
|
|
108
|
+
if (!rule.enabled)
|
|
109
|
+
return false;
|
|
110
|
+
// Check source match
|
|
111
|
+
if (rule.source !== '*' && rule.source !== event.source) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
// Check event type match
|
|
115
|
+
if (rule.eventType !== '*' && rule.eventType !== event.type) {
|
|
116
|
+
// Support wildcard prefix matching (e.g., 'ci_*' matches 'ci_failure')
|
|
117
|
+
if (rule.eventType.endsWith('*')) {
|
|
118
|
+
const prefix = rule.eventType.slice(0, -1);
|
|
119
|
+
if (!event.type.startsWith(prefix)) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// Check condition if present
|
|
128
|
+
if (rule.condition && !evaluateCondition(rule.condition, event)) {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Find all matching rules for an event, sorted by priority
|
|
135
|
+
*/
|
|
136
|
+
export function findMatchingRules(rules, event) {
|
|
137
|
+
return rules
|
|
138
|
+
.filter(rule => matchesRule(rule, event))
|
|
139
|
+
.sort((a, b) => a.priority - b.priority);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Resolve template variables in action configuration
|
|
143
|
+
* Supports: ${event.field}, ${event.field.subfield}
|
|
144
|
+
*/
|
|
145
|
+
export function resolveActionTemplate(action, event) {
|
|
146
|
+
const resolvedAction = { ...action };
|
|
147
|
+
// Resolve agentType if it references an event field
|
|
148
|
+
if (resolvedAction.agentType?.startsWith('$.')) {
|
|
149
|
+
const path = resolvedAction.agentType.slice(2);
|
|
150
|
+
const value = getValueByPath(event, path);
|
|
151
|
+
if (typeof value === 'string') {
|
|
152
|
+
resolvedAction.agentType = value;
|
|
153
|
+
}
|
|
154
|
+
else if (Array.isArray(value) && value.length > 0) {
|
|
155
|
+
// Use first mentioned agent
|
|
156
|
+
resolvedAction.agentType = String(value[0]);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// Resolve prompt template references
|
|
160
|
+
if (resolvedAction.prompt?.startsWith('${') && resolvedAction.prompt?.endsWith('}')) {
|
|
161
|
+
const path = resolvedAction.prompt.slice(2, -1);
|
|
162
|
+
const value = getValueByPath(event, path);
|
|
163
|
+
if (typeof value === 'string') {
|
|
164
|
+
resolvedAction.prompt = value;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return resolvedAction;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Default rules for common patterns
|
|
171
|
+
*/
|
|
172
|
+
export const defaultRules = [
|
|
173
|
+
// CI Failures
|
|
174
|
+
{
|
|
175
|
+
id: 'ci-failure',
|
|
176
|
+
name: 'CI Failure Handler',
|
|
177
|
+
enabled: true,
|
|
178
|
+
source: 'github',
|
|
179
|
+
eventType: 'ci_failure',
|
|
180
|
+
action: {
|
|
181
|
+
type: 'spawn_agent',
|
|
182
|
+
agentType: 'ci-fix',
|
|
183
|
+
prompt: 'ci-failure',
|
|
184
|
+
},
|
|
185
|
+
priority: 10,
|
|
186
|
+
},
|
|
187
|
+
// GitHub Mentions
|
|
188
|
+
{
|
|
189
|
+
id: 'github-mention',
|
|
190
|
+
name: 'GitHub Mention Handler',
|
|
191
|
+
enabled: true,
|
|
192
|
+
source: 'github',
|
|
193
|
+
eventType: 'mention',
|
|
194
|
+
action: {
|
|
195
|
+
type: 'spawn_agent',
|
|
196
|
+
agentType: '$.mentions', // Use first mentioned agent
|
|
197
|
+
prompt: 'mention',
|
|
198
|
+
},
|
|
199
|
+
priority: 20,
|
|
200
|
+
},
|
|
201
|
+
// GitHub Issues
|
|
202
|
+
{
|
|
203
|
+
id: 'github-issue',
|
|
204
|
+
name: 'GitHub Issue Handler',
|
|
205
|
+
enabled: true,
|
|
206
|
+
source: 'github',
|
|
207
|
+
eventType: 'issue_created',
|
|
208
|
+
condition: '$.priority in ["critical", "high"]',
|
|
209
|
+
action: {
|
|
210
|
+
type: 'spawn_agent',
|
|
211
|
+
agentType: 'developer',
|
|
212
|
+
prompt: 'issue',
|
|
213
|
+
},
|
|
214
|
+
priority: 30,
|
|
215
|
+
},
|
|
216
|
+
// Linear Issues
|
|
217
|
+
{
|
|
218
|
+
id: 'linear-issue',
|
|
219
|
+
name: 'Linear Issue Handler',
|
|
220
|
+
enabled: true,
|
|
221
|
+
source: 'linear',
|
|
222
|
+
eventType: 'issue_created',
|
|
223
|
+
action: {
|
|
224
|
+
type: 'spawn_agent',
|
|
225
|
+
agentType: 'developer',
|
|
226
|
+
prompt: 'linear-issue',
|
|
227
|
+
},
|
|
228
|
+
priority: 20,
|
|
229
|
+
},
|
|
230
|
+
// Linear Mentions
|
|
231
|
+
{
|
|
232
|
+
id: 'linear-mention',
|
|
233
|
+
name: 'Linear Mention Handler',
|
|
234
|
+
enabled: true,
|
|
235
|
+
source: 'linear',
|
|
236
|
+
eventType: 'mention',
|
|
237
|
+
action: {
|
|
238
|
+
type: 'spawn_agent',
|
|
239
|
+
agentType: '$.mentions',
|
|
240
|
+
prompt: 'mention',
|
|
241
|
+
},
|
|
242
|
+
priority: 20,
|
|
243
|
+
},
|
|
244
|
+
// Slack App Mentions
|
|
245
|
+
{
|
|
246
|
+
id: 'slack-mention',
|
|
247
|
+
name: 'Slack App Mention Handler',
|
|
248
|
+
enabled: true,
|
|
249
|
+
source: 'slack',
|
|
250
|
+
eventType: 'mention',
|
|
251
|
+
action: {
|
|
252
|
+
type: 'spawn_agent',
|
|
253
|
+
agentType: '$.mentions',
|
|
254
|
+
prompt: 'slack-request',
|
|
255
|
+
},
|
|
256
|
+
priority: 20,
|
|
257
|
+
},
|
|
258
|
+
// Linear Issue Assignments (native integration)
|
|
259
|
+
{
|
|
260
|
+
id: 'linear-assignment',
|
|
261
|
+
name: 'Linear Issue Assignment Handler',
|
|
262
|
+
enabled: true,
|
|
263
|
+
source: 'linear',
|
|
264
|
+
eventType: 'issue_assigned',
|
|
265
|
+
action: {
|
|
266
|
+
type: 'spawn_agent',
|
|
267
|
+
agentType: '$.mentions', // Use the assigned agent type
|
|
268
|
+
prompt: 'linear-issue',
|
|
269
|
+
},
|
|
270
|
+
priority: 15,
|
|
271
|
+
},
|
|
272
|
+
// GitHub Issue Assignments
|
|
273
|
+
{
|
|
274
|
+
id: 'github-assignment',
|
|
275
|
+
name: 'GitHub Issue Assignment Handler',
|
|
276
|
+
enabled: true,
|
|
277
|
+
source: 'github',
|
|
278
|
+
eventType: 'issue_assigned',
|
|
279
|
+
action: {
|
|
280
|
+
type: 'spawn_agent',
|
|
281
|
+
agentType: '$.mentions',
|
|
282
|
+
prompt: 'issue',
|
|
283
|
+
},
|
|
284
|
+
priority: 15,
|
|
285
|
+
},
|
|
286
|
+
];
|
|
287
|
+
//# sourceMappingURL=rules-engine.js.map
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic Webhook System - Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Defines the core types for a configurable webhook system
|
|
5
|
+
* that can handle events from any source (GitHub, GitLab, Linear, Slack, etc.)
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Normalized event format that all parsers produce
|
|
9
|
+
*/
|
|
10
|
+
export interface NormalizedEvent {
|
|
11
|
+
/** Unique event ID */
|
|
12
|
+
id: string;
|
|
13
|
+
/** Source system (github, gitlab, linear, slack, etc.) */
|
|
14
|
+
source: string;
|
|
15
|
+
/** Event type (e.g., 'ci_failure', 'mention', 'issue_created') */
|
|
16
|
+
type: string;
|
|
17
|
+
/** Timestamp of the event */
|
|
18
|
+
timestamp: Date;
|
|
19
|
+
/** Actor who triggered the event */
|
|
20
|
+
actor: {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
email?: string;
|
|
24
|
+
};
|
|
25
|
+
/** Repository or project context */
|
|
26
|
+
context: {
|
|
27
|
+
/** Full name (e.g., 'owner/repo' or project ID) */
|
|
28
|
+
name: string;
|
|
29
|
+
/** URL to the repository/project */
|
|
30
|
+
url?: string;
|
|
31
|
+
};
|
|
32
|
+
/** The item this event relates to (issue, PR, ticket, message) */
|
|
33
|
+
item?: {
|
|
34
|
+
type: 'issue' | 'pull_request' | 'ticket' | 'message' | 'comment' | 'check';
|
|
35
|
+
id: string | number;
|
|
36
|
+
number?: number;
|
|
37
|
+
title?: string;
|
|
38
|
+
body?: string;
|
|
39
|
+
url?: string;
|
|
40
|
+
state?: string;
|
|
41
|
+
};
|
|
42
|
+
/** Mentioned agents or users */
|
|
43
|
+
mentions: string[];
|
|
44
|
+
/** Labels, tags, or categories */
|
|
45
|
+
labels: string[];
|
|
46
|
+
/** Priority level if applicable */
|
|
47
|
+
priority?: 'critical' | 'high' | 'medium' | 'low';
|
|
48
|
+
/** Additional source-specific data */
|
|
49
|
+
metadata: Record<string, unknown>;
|
|
50
|
+
/** Raw payload for debugging */
|
|
51
|
+
rawPayload: unknown;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Action to take in response to an event
|
|
55
|
+
*/
|
|
56
|
+
export interface WebhookAction {
|
|
57
|
+
type: 'spawn_agent' | 'message_agent' | 'post_comment' | 'create_issue' | 'custom';
|
|
58
|
+
/** Agent type or name to spawn/message */
|
|
59
|
+
agentType?: string;
|
|
60
|
+
/** Prompt template name or inline prompt */
|
|
61
|
+
prompt?: string;
|
|
62
|
+
/** Additional action-specific config */
|
|
63
|
+
config?: Record<string, unknown>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Signature verification configuration
|
|
67
|
+
*/
|
|
68
|
+
export interface SignatureConfig {
|
|
69
|
+
/** Header containing the signature */
|
|
70
|
+
header: string;
|
|
71
|
+
/** Algorithm to use for verification */
|
|
72
|
+
algorithm: 'sha256' | 'sha1' | 'token' | 'slack-v0' | 'none';
|
|
73
|
+
/** Environment variable containing the secret */
|
|
74
|
+
secretEnvVar: string;
|
|
75
|
+
/** Optional prefix to strip from signature (e.g., 'sha256=') */
|
|
76
|
+
signaturePrefix?: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Webhook source configuration
|
|
80
|
+
*/
|
|
81
|
+
export interface WebhookSourceConfig {
|
|
82
|
+
/** Source identifier */
|
|
83
|
+
id: string;
|
|
84
|
+
/** Display name */
|
|
85
|
+
name: string;
|
|
86
|
+
/** Whether this source is enabled */
|
|
87
|
+
enabled: boolean;
|
|
88
|
+
/** Signature verification config */
|
|
89
|
+
signature: SignatureConfig;
|
|
90
|
+
/** Parser to use for this source */
|
|
91
|
+
parser: string;
|
|
92
|
+
/** Responder to use for sending responses */
|
|
93
|
+
responder: string;
|
|
94
|
+
/** Parser-specific configuration */
|
|
95
|
+
parserConfig?: Record<string, unknown>;
|
|
96
|
+
/** Responder-specific configuration */
|
|
97
|
+
responderConfig?: Record<string, unknown>;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Event routing rule
|
|
101
|
+
*/
|
|
102
|
+
export interface WebhookRule {
|
|
103
|
+
/** Rule identifier */
|
|
104
|
+
id: string;
|
|
105
|
+
/** Display name */
|
|
106
|
+
name: string;
|
|
107
|
+
/** Whether this rule is enabled */
|
|
108
|
+
enabled: boolean;
|
|
109
|
+
/** Source to match (* for any) */
|
|
110
|
+
source: string;
|
|
111
|
+
/** Event type to match (* for any) */
|
|
112
|
+
eventType: string;
|
|
113
|
+
/** JSONPath condition (optional) */
|
|
114
|
+
condition?: string;
|
|
115
|
+
/** Action to take when matched */
|
|
116
|
+
action: WebhookAction;
|
|
117
|
+
/** Priority (lower = higher priority) */
|
|
118
|
+
priority: number;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Complete webhook configuration
|
|
122
|
+
*/
|
|
123
|
+
export interface WebhookConfig {
|
|
124
|
+
sources: Record<string, WebhookSourceConfig>;
|
|
125
|
+
rules: WebhookRule[];
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Parser interface - transforms source-specific payloads to normalized events
|
|
129
|
+
*/
|
|
130
|
+
export interface WebhookParser {
|
|
131
|
+
/** Parser identifier */
|
|
132
|
+
id: string;
|
|
133
|
+
/** Parse raw payload into normalized event(s) */
|
|
134
|
+
parse(payload: unknown, headers: Record<string, string | string[] | undefined>, config?: Record<string, unknown>): NormalizedEvent[];
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Response to send back to the source system
|
|
138
|
+
*/
|
|
139
|
+
export interface WebhookResponse {
|
|
140
|
+
/** Type of response */
|
|
141
|
+
type: 'comment' | 'message' | 'reaction' | 'status';
|
|
142
|
+
/** Target (issue number, channel ID, etc.) */
|
|
143
|
+
target: string | number;
|
|
144
|
+
/** Response body/content */
|
|
145
|
+
body: string;
|
|
146
|
+
/** Additional response metadata */
|
|
147
|
+
metadata?: Record<string, unknown>;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Responder interface - sends responses back to source systems
|
|
151
|
+
*/
|
|
152
|
+
export interface WebhookResponder {
|
|
153
|
+
/** Responder identifier */
|
|
154
|
+
id: string;
|
|
155
|
+
/** Send a response to the source system */
|
|
156
|
+
respond(event: NormalizedEvent, response: WebhookResponse, config?: Record<string, unknown>): Promise<{
|
|
157
|
+
success: boolean;
|
|
158
|
+
id?: string;
|
|
159
|
+
url?: string;
|
|
160
|
+
error?: string;
|
|
161
|
+
}>;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Result of processing a webhook
|
|
165
|
+
*/
|
|
166
|
+
export interface WebhookResult {
|
|
167
|
+
success: boolean;
|
|
168
|
+
eventId: string;
|
|
169
|
+
source: string;
|
|
170
|
+
eventType: string;
|
|
171
|
+
matchedRules: string[];
|
|
172
|
+
actions: Array<{
|
|
173
|
+
ruleId: string;
|
|
174
|
+
action: WebhookAction;
|
|
175
|
+
success: boolean;
|
|
176
|
+
error?: string;
|
|
177
|
+
}>;
|
|
178
|
+
responses: Array<{
|
|
179
|
+
type: string;
|
|
180
|
+
success: boolean;
|
|
181
|
+
id?: string;
|
|
182
|
+
url?: string;
|
|
183
|
+
error?: string;
|
|
184
|
+
}>;
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context Formatter
|
|
3
|
+
*
|
|
4
|
+
* Formats ledgers, handoffs, and learnings into markdown
|
|
5
|
+
* for injection into agent context.
|
|
6
|
+
*/
|
|
7
|
+
import type { Ledger, Handoff, StartupContext, FileRef, Decision } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Format options for context injection
|
|
10
|
+
*/
|
|
11
|
+
export interface FormatOptions {
|
|
12
|
+
/** Maximum length of the formatted context */
|
|
13
|
+
maxLength?: number;
|
|
14
|
+
/** Include file references */
|
|
15
|
+
includeFiles?: boolean;
|
|
16
|
+
/** Include decisions */
|
|
17
|
+
includeDecisions?: boolean;
|
|
18
|
+
/** Include learnings */
|
|
19
|
+
includeLearnings?: boolean;
|
|
20
|
+
/** Compact mode (less verbose) */
|
|
21
|
+
compact?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Format a startup context for injection
|
|
25
|
+
*/
|
|
26
|
+
export declare function formatStartupContext(context: Omit<StartupContext, 'formatted'>, options?: FormatOptions): string;
|
|
27
|
+
/**
|
|
28
|
+
* Format a ledger for context injection
|
|
29
|
+
*/
|
|
30
|
+
export declare function formatLedger(ledger: Ledger, options?: FormatOptions): string;
|
|
31
|
+
/**
|
|
32
|
+
* Format a handoff for context injection
|
|
33
|
+
*/
|
|
34
|
+
export declare function formatHandoff(handoff: Handoff, options?: FormatOptions): string;
|
|
35
|
+
/**
|
|
36
|
+
* Format a search result summary
|
|
37
|
+
*/
|
|
38
|
+
export declare function formatSearchResults(handoffs: Handoff[], query: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* Format a brief status summary (for status line / dashboard)
|
|
41
|
+
*/
|
|
42
|
+
export declare function formatBriefStatus(ledger: Ledger | null, handoff: Handoff | null): string;
|
|
43
|
+
/**
|
|
44
|
+
* Format file references for injection
|
|
45
|
+
*/
|
|
46
|
+
export declare function formatFileRefs(files: FileRef[]): string;
|
|
47
|
+
/**
|
|
48
|
+
* Format decisions for injection
|
|
49
|
+
*/
|
|
50
|
+
export declare function formatDecisions(decisions: Decision[]): string;
|
|
51
|
+
//# sourceMappingURL=formatter.d.ts.map
|