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
package/dist/daemon/router.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { v4 as uuid } from 'uuid';
|
|
6
6
|
import { PROTOCOL_VERSION, } from '../protocol/types.js';
|
|
7
|
+
import { routerLog } from '../utils/logger.js';
|
|
7
8
|
const DEFAULT_DELIVERY_OPTIONS = {
|
|
8
9
|
ackTimeoutMs: 5000,
|
|
9
10
|
maxAttempts: 5,
|
|
@@ -130,7 +131,7 @@ export class Router {
|
|
|
130
131
|
shadows.push(relationship);
|
|
131
132
|
// Set reverse lookup
|
|
132
133
|
this.primaryByShadow.set(shadowAgent, primaryAgent);
|
|
133
|
-
|
|
134
|
+
routerLog.info(`Shadow bound: ${shadowAgent} -> ${primaryAgent}`, { speakOn: relationship.speakOn });
|
|
134
135
|
}
|
|
135
136
|
/**
|
|
136
137
|
* Unbind a shadow agent from its primary.
|
|
@@ -152,7 +153,7 @@ export class Router {
|
|
|
152
153
|
}
|
|
153
154
|
// Remove reverse lookup
|
|
154
155
|
this.primaryByShadow.delete(shadowAgent);
|
|
155
|
-
|
|
156
|
+
routerLog.info(`Shadow unbound: ${shadowAgent} from ${primaryAgent}`);
|
|
156
157
|
}
|
|
157
158
|
/**
|
|
158
159
|
* Get all shadows for a primary agent.
|
|
@@ -207,7 +208,7 @@ export class Router {
|
|
|
207
208
|
const sent = target.send(deliver);
|
|
208
209
|
if (sent) {
|
|
209
210
|
this.trackDelivery(target, deliver);
|
|
210
|
-
|
|
211
|
+
routerLog.debug(`Shadow trigger ${trigger} sent to ${shadow.shadowAgent}`, { primary: primaryAgent });
|
|
211
212
|
// Set processing state for triggered shadows - they're expected to respond
|
|
212
213
|
this.setProcessing(shadow.shadowAgent, deliver.id);
|
|
213
214
|
}
|
|
@@ -234,7 +235,7 @@ export class Router {
|
|
|
234
235
|
route(from, envelope) {
|
|
235
236
|
const senderName = from.agentName;
|
|
236
237
|
if (!senderName) {
|
|
237
|
-
|
|
238
|
+
routerLog.warn('Dropping message - sender has no name');
|
|
238
239
|
return;
|
|
239
240
|
}
|
|
240
241
|
// Agent is responding - clear their processing state
|
|
@@ -242,7 +243,7 @@ export class Router {
|
|
|
242
243
|
this.registry?.recordSend(senderName);
|
|
243
244
|
const to = envelope.to;
|
|
244
245
|
const topic = envelope.topic;
|
|
245
|
-
|
|
246
|
+
routerLog.debug(`${senderName} -> ${to}`, { preview: envelope.payload.body?.substring(0, 50) });
|
|
246
247
|
if (to === '*') {
|
|
247
248
|
// Broadcast to all (except sender)
|
|
248
249
|
this.broadcast(senderName, envelope, topic);
|
|
@@ -298,7 +299,7 @@ export class Router {
|
|
|
298
299
|
const sent = target.send(deliver);
|
|
299
300
|
if (sent) {
|
|
300
301
|
this.trackDelivery(target, deliver);
|
|
301
|
-
|
|
302
|
+
routerLog.debug(`Shadow copy to ${shadow.shadowAgent}`, { direction, primary: primaryAgent });
|
|
302
303
|
// Note: Don't set processing state for shadow copies - shadow stays passive
|
|
303
304
|
}
|
|
304
305
|
}
|
|
@@ -312,15 +313,15 @@ export class Router {
|
|
|
312
313
|
if (!target) {
|
|
313
314
|
const remoteAgent = this.crossMachineHandler?.isRemoteAgent(to);
|
|
314
315
|
if (remoteAgent) {
|
|
315
|
-
|
|
316
|
+
routerLog.info(`Routing to remote agent: ${to}`, { daemonName: remoteAgent.daemonName });
|
|
316
317
|
return this.sendToRemoteAgent(from, to, envelope, remoteAgent);
|
|
317
318
|
}
|
|
318
|
-
|
|
319
|
+
routerLog.warn(`Target "${to}" not found`, { availableAgents: Array.from(this.agents.keys()) });
|
|
319
320
|
return false;
|
|
320
321
|
}
|
|
321
322
|
const deliver = this.createDeliverEnvelope(from, to, envelope, target);
|
|
322
323
|
const sent = target.send(deliver);
|
|
323
|
-
|
|
324
|
+
routerLog.debug(`Delivered to ${to}`, { success: sent });
|
|
324
325
|
this.persistDeliverEnvelope(deliver);
|
|
325
326
|
if (sent) {
|
|
326
327
|
this.trackDelivery(target, deliver);
|
|
@@ -335,7 +336,7 @@ export class Router {
|
|
|
335
336
|
*/
|
|
336
337
|
sendToRemoteAgent(from, to, envelope, remoteAgent) {
|
|
337
338
|
if (!this.crossMachineHandler) {
|
|
338
|
-
|
|
339
|
+
routerLog.warn('Cross-machine handler not available');
|
|
339
340
|
return false;
|
|
340
341
|
}
|
|
341
342
|
// Send asynchronously via cloud
|
|
@@ -347,7 +348,7 @@ export class Router {
|
|
|
347
348
|
originalId: envelope.id,
|
|
348
349
|
}).then((sent) => {
|
|
349
350
|
if (sent) {
|
|
350
|
-
|
|
351
|
+
routerLog.info(`Cross-machine message sent to ${to}`, { daemonName: remoteAgent.daemonName });
|
|
351
352
|
// Persist as cross-machine message
|
|
352
353
|
this.storage?.saveMessage({
|
|
353
354
|
id: envelope.id || `cross-${Date.now()}`,
|
|
@@ -367,13 +368,13 @@ export class Router {
|
|
|
367
368
|
status: 'unread',
|
|
368
369
|
is_urgent: false,
|
|
369
370
|
is_broadcast: false,
|
|
370
|
-
}).catch(err =>
|
|
371
|
+
}).catch(err => routerLog.error('Failed to persist cross-machine message', { error: String(err) }));
|
|
371
372
|
}
|
|
372
373
|
else {
|
|
373
|
-
|
|
374
|
+
routerLog.error(`Failed to send cross-machine message to ${to}`);
|
|
374
375
|
}
|
|
375
376
|
}).catch(err => {
|
|
376
|
-
|
|
377
|
+
routerLog.error('Cross-machine send error', { error: String(err) });
|
|
377
378
|
});
|
|
378
379
|
// Return true immediately - message is queued
|
|
379
380
|
return true;
|
|
@@ -449,7 +450,7 @@ export class Router {
|
|
|
449
450
|
is_urgent: false,
|
|
450
451
|
is_broadcast: isBroadcast || envelope.to === '*',
|
|
451
452
|
}).catch((err) => {
|
|
452
|
-
|
|
453
|
+
routerLog.error('Failed to persist message', { error: String(err) });
|
|
453
454
|
});
|
|
454
455
|
}
|
|
455
456
|
/**
|
|
@@ -498,14 +499,14 @@ export class Router {
|
|
|
498
499
|
this.clearProcessing(agentName);
|
|
499
500
|
const timer = setTimeout(() => {
|
|
500
501
|
this.clearProcessing(agentName);
|
|
501
|
-
|
|
502
|
+
routerLog.warn(`Processing timeout for ${agentName}`);
|
|
502
503
|
}, Router.PROCESSING_TIMEOUT_MS);
|
|
503
504
|
this.processingAgents.set(agentName, {
|
|
504
505
|
startedAt: Date.now(),
|
|
505
506
|
messageId,
|
|
506
507
|
timer,
|
|
507
508
|
});
|
|
508
|
-
|
|
509
|
+
routerLog.debug(`${agentName} started processing`, { messageId });
|
|
509
510
|
this.onProcessingStateChange?.();
|
|
510
511
|
}
|
|
511
512
|
/**
|
|
@@ -518,7 +519,7 @@ export class Router {
|
|
|
518
519
|
clearTimeout(state.timer);
|
|
519
520
|
}
|
|
520
521
|
this.processingAgents.delete(agentName);
|
|
521
|
-
|
|
522
|
+
routerLog.debug(`${agentName} finished processing`);
|
|
522
523
|
this.onProcessingStateChange?.();
|
|
523
524
|
}
|
|
524
525
|
}
|
|
@@ -540,10 +541,10 @@ export class Router {
|
|
|
540
541
|
const statusUpdate = this.storage?.updateMessageStatus?.(ackId, 'acked');
|
|
541
542
|
if (statusUpdate instanceof Promise) {
|
|
542
543
|
statusUpdate.catch(err => {
|
|
543
|
-
|
|
544
|
+
routerLog.error('Failed to record ACK status', { error: String(err) });
|
|
544
545
|
});
|
|
545
546
|
}
|
|
546
|
-
|
|
547
|
+
routerLog.debug(`ACK received for ${ackId}`);
|
|
547
548
|
}
|
|
548
549
|
/**
|
|
549
550
|
* Clear pending deliveries for a connection (e.g., on disconnect).
|
|
@@ -578,32 +579,83 @@ export class Router {
|
|
|
578
579
|
const now = Date.now();
|
|
579
580
|
const elapsed = now - pending.firstSentAt;
|
|
580
581
|
if (elapsed > this.deliveryOptions.deliveryTtlMs) {
|
|
581
|
-
|
|
582
|
+
routerLog.warn(`Dropping ${deliverId} after TTL`, { ttlMs: this.deliveryOptions.deliveryTtlMs });
|
|
582
583
|
this.pendingDeliveries.delete(deliverId);
|
|
584
|
+
// Mark message as failed in storage
|
|
585
|
+
const statusUpdate = this.storage?.updateMessageStatus?.(deliverId, 'failed');
|
|
586
|
+
if (statusUpdate instanceof Promise) {
|
|
587
|
+
statusUpdate.catch(err => {
|
|
588
|
+
routerLog.error(`Failed to update status for ${deliverId}`, { error: String(err) });
|
|
589
|
+
});
|
|
590
|
+
}
|
|
583
591
|
return;
|
|
584
592
|
}
|
|
585
593
|
if (pending.attempts >= this.deliveryOptions.maxAttempts) {
|
|
586
|
-
|
|
594
|
+
routerLog.warn(`Dropping ${deliverId} after max attempts`, { maxAttempts: this.deliveryOptions.maxAttempts });
|
|
587
595
|
this.pendingDeliveries.delete(deliverId);
|
|
596
|
+
// Mark message as failed in storage
|
|
597
|
+
const statusUpdate = this.storage?.updateMessageStatus?.(deliverId, 'failed');
|
|
598
|
+
if (statusUpdate instanceof Promise) {
|
|
599
|
+
statusUpdate.catch(err => {
|
|
600
|
+
routerLog.error(`Failed to update status for ${deliverId}`, { error: String(err) });
|
|
601
|
+
});
|
|
602
|
+
}
|
|
588
603
|
return;
|
|
589
604
|
}
|
|
590
605
|
const target = this.connections.get(pending.connectionId);
|
|
591
606
|
if (!target) {
|
|
592
|
-
|
|
607
|
+
routerLog.warn(`Dropping ${deliverId} - connection unavailable`);
|
|
593
608
|
this.pendingDeliveries.delete(deliverId);
|
|
609
|
+
// Mark message as failed in storage
|
|
610
|
+
const statusUpdate = this.storage?.updateMessageStatus?.(deliverId, 'failed');
|
|
611
|
+
if (statusUpdate instanceof Promise) {
|
|
612
|
+
statusUpdate.catch(err => {
|
|
613
|
+
routerLog.error(`Failed to update status for ${deliverId}`, { error: String(err) });
|
|
614
|
+
});
|
|
615
|
+
}
|
|
594
616
|
return;
|
|
595
617
|
}
|
|
596
618
|
pending.attempts++;
|
|
597
619
|
const sent = target.send(pending.envelope);
|
|
598
620
|
if (!sent) {
|
|
599
|
-
|
|
621
|
+
routerLog.warn(`Retry failed for ${deliverId}`, { attempt: pending.attempts });
|
|
600
622
|
}
|
|
601
623
|
else {
|
|
602
|
-
|
|
624
|
+
routerLog.debug(`Retried ${deliverId}`, { attempt: pending.attempts });
|
|
603
625
|
}
|
|
604
626
|
pending.timer = this.scheduleRetry(deliverId);
|
|
605
627
|
}, this.deliveryOptions.ackTimeoutMs);
|
|
606
628
|
}
|
|
629
|
+
/**
|
|
630
|
+
* Broadcast a system message to all connected agents.
|
|
631
|
+
* Used for system notifications like agent death announcements.
|
|
632
|
+
*/
|
|
633
|
+
broadcastSystemMessage(message, data) {
|
|
634
|
+
const envelope = {
|
|
635
|
+
v: PROTOCOL_VERSION,
|
|
636
|
+
type: 'SEND',
|
|
637
|
+
id: uuid(),
|
|
638
|
+
ts: Date.now(),
|
|
639
|
+
from: '_system',
|
|
640
|
+
to: '*',
|
|
641
|
+
payload: {
|
|
642
|
+
kind: 'message',
|
|
643
|
+
body: message,
|
|
644
|
+
data: {
|
|
645
|
+
...data,
|
|
646
|
+
_isSystemMessage: true,
|
|
647
|
+
},
|
|
648
|
+
},
|
|
649
|
+
};
|
|
650
|
+
// Broadcast to all agents
|
|
651
|
+
for (const [agentName, connection] of this.agents.entries()) {
|
|
652
|
+
const deliver = this.createDeliverEnvelope('_system', agentName, envelope, connection);
|
|
653
|
+
const sent = connection.send(deliver);
|
|
654
|
+
if (sent) {
|
|
655
|
+
routerLog.debug(`System broadcast sent to ${agentName}`);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
}
|
|
607
659
|
/**
|
|
608
660
|
* Replay any pending (unacked) messages for a resumed session.
|
|
609
661
|
*/
|
|
@@ -614,7 +666,7 @@ export class Router {
|
|
|
614
666
|
const pending = await this.storage.getPendingMessagesForSession(connection.agentName, connection.sessionId);
|
|
615
667
|
if (!pending.length)
|
|
616
668
|
return;
|
|
617
|
-
|
|
669
|
+
routerLog.info(`Replaying ${pending.length} messages to ${connection.agentName}`);
|
|
618
670
|
for (const msg of pending) {
|
|
619
671
|
const deliver = {
|
|
620
672
|
v: PROTOCOL_VERSION,
|
package/dist/daemon/server.d.ts
CHANGED
|
@@ -99,6 +99,11 @@ export declare class Daemon {
|
|
|
99
99
|
* Get list of connected agents.
|
|
100
100
|
*/
|
|
101
101
|
getAgents(): string[];
|
|
102
|
+
/**
|
|
103
|
+
* Broadcast a system message to all connected agents.
|
|
104
|
+
* Used for system notifications like agent death announcements.
|
|
105
|
+
*/
|
|
106
|
+
broadcastSystemMessage(message: string, data?: Record<string, unknown>): void;
|
|
102
107
|
/**
|
|
103
108
|
* Get connection count.
|
|
104
109
|
*/
|
package/dist/daemon/server.js
CHANGED
|
@@ -14,6 +14,7 @@ import { getProjectPaths } from '../utils/project-namespace.js';
|
|
|
14
14
|
import { AgentRegistry } from './agent-registry.js';
|
|
15
15
|
import { daemonLog as log } from '../utils/logger.js';
|
|
16
16
|
import { getCloudSync } from './cloud-sync.js';
|
|
17
|
+
import { v4 as uuid } from 'uuid';
|
|
17
18
|
export const DEFAULT_SOCKET_PATH = '/tmp/agent-relay.sock';
|
|
18
19
|
export const DEFAULT_DAEMON_CONFIG = {
|
|
19
20
|
...DEFAULT_CONFIG,
|
|
@@ -232,7 +233,7 @@ export class Daemon {
|
|
|
232
233
|
const envelope = {
|
|
233
234
|
v: 1,
|
|
234
235
|
type: 'SEND',
|
|
235
|
-
id:
|
|
236
|
+
id: uuid(),
|
|
236
237
|
ts: Date.now(),
|
|
237
238
|
from: `${msg.from.daemonName}:${msg.from.agent}`,
|
|
238
239
|
to: msg.to,
|
|
@@ -512,6 +513,13 @@ export class Daemon {
|
|
|
512
513
|
getAgents() {
|
|
513
514
|
return this.router.getAgents();
|
|
514
515
|
}
|
|
516
|
+
/**
|
|
517
|
+
* Broadcast a system message to all connected agents.
|
|
518
|
+
* Used for system notifications like agent death announcements.
|
|
519
|
+
*/
|
|
520
|
+
broadcastSystemMessage(message, data) {
|
|
521
|
+
this.router.broadcastSystemMessage(message, data);
|
|
522
|
+
}
|
|
515
523
|
/**
|
|
516
524
|
* Get connection count.
|
|
517
525
|
*/
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser Testing Service
|
|
3
|
+
*
|
|
4
|
+
* Provides browser automation capabilities for agents running in the workspace.
|
|
5
|
+
* Uses Playwright for browser control and Xvfb for headless display.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Screenshot capture
|
|
9
|
+
* - Browser automation via Playwright
|
|
10
|
+
* - Visual regression testing
|
|
11
|
+
* - PDF generation
|
|
12
|
+
*/
|
|
13
|
+
export interface ScreenshotOptions {
|
|
14
|
+
/** Output path for screenshot (default: /tmp/screenshot-{timestamp}.png) */
|
|
15
|
+
outputPath?: string;
|
|
16
|
+
/** Full page screenshot */
|
|
17
|
+
fullPage?: boolean;
|
|
18
|
+
/** Clip region */
|
|
19
|
+
clip?: {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface BrowserTestOptions {
|
|
27
|
+
/** Browser to use (chromium, firefox, webkit) */
|
|
28
|
+
browser?: 'chromium' | 'firefox' | 'webkit';
|
|
29
|
+
/** Headless mode (default: true in container, false with VNC) */
|
|
30
|
+
headless?: boolean;
|
|
31
|
+
/** Viewport size */
|
|
32
|
+
viewport?: {
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
};
|
|
36
|
+
/** Timeout in ms */
|
|
37
|
+
timeout?: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Check if browser testing is available
|
|
41
|
+
*/
|
|
42
|
+
export declare function isBrowserTestingAvailable(): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Take a screenshot of the current display
|
|
45
|
+
*/
|
|
46
|
+
export declare function takeDisplayScreenshot(options?: ScreenshotOptions): Promise<string>;
|
|
47
|
+
/**
|
|
48
|
+
* Run a Playwright test file
|
|
49
|
+
*/
|
|
50
|
+
export declare function runPlaywrightTest(testFile: string, options?: BrowserTestOptions): Promise<{
|
|
51
|
+
success: boolean;
|
|
52
|
+
output: string;
|
|
53
|
+
screenshots: string[];
|
|
54
|
+
}>;
|
|
55
|
+
/**
|
|
56
|
+
* Launch a browser and navigate to a URL
|
|
57
|
+
* Returns the browser PID for later control
|
|
58
|
+
*/
|
|
59
|
+
export declare function launchBrowser(url: string, options?: {
|
|
60
|
+
browser?: 'chromium' | 'firefox';
|
|
61
|
+
}): Promise<{
|
|
62
|
+
pid: number;
|
|
63
|
+
}>;
|
|
64
|
+
/**
|
|
65
|
+
* Generate a Playwright test file from a description
|
|
66
|
+
*/
|
|
67
|
+
export declare function generatePlaywrightTest(name: string, steps: Array<{
|
|
68
|
+
action: 'goto' | 'click' | 'fill' | 'screenshot' | 'wait';
|
|
69
|
+
target?: string;
|
|
70
|
+
value?: string;
|
|
71
|
+
}>): string;
|
|
72
|
+
/**
|
|
73
|
+
* Run inline Playwright script
|
|
74
|
+
*/
|
|
75
|
+
export declare function runPlaywrightScript(script: string, options?: BrowserTestOptions): Promise<{
|
|
76
|
+
success: boolean;
|
|
77
|
+
output: string;
|
|
78
|
+
result?: unknown;
|
|
79
|
+
}>;
|
|
80
|
+
/**
|
|
81
|
+
* Get VNC connection info
|
|
82
|
+
*/
|
|
83
|
+
export declare function getVNCInfo(): {
|
|
84
|
+
available: boolean;
|
|
85
|
+
vncUrl?: string;
|
|
86
|
+
noVncUrl?: string;
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=browser-testing.d.ts.map
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser Testing Service
|
|
3
|
+
*
|
|
4
|
+
* Provides browser automation capabilities for agents running in the workspace.
|
|
5
|
+
* Uses Playwright for browser control and Xvfb for headless display.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Screenshot capture
|
|
9
|
+
* - Browser automation via Playwright
|
|
10
|
+
* - Visual regression testing
|
|
11
|
+
* - PDF generation
|
|
12
|
+
*/
|
|
13
|
+
import { spawn, execSync } from 'child_process';
|
|
14
|
+
import { existsSync, writeFileSync, mkdirSync } from 'fs';
|
|
15
|
+
import { join } from 'path';
|
|
16
|
+
/**
|
|
17
|
+
* Check if browser testing is available
|
|
18
|
+
*/
|
|
19
|
+
export function isBrowserTestingAvailable() {
|
|
20
|
+
try {
|
|
21
|
+
// Check if DISPLAY is set (Xvfb running)
|
|
22
|
+
if (!process.env.DISPLAY) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
// Check if Playwright is installed
|
|
26
|
+
execSync('npx playwright --version', { stdio: 'pipe' });
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Take a screenshot of the current display
|
|
35
|
+
*/
|
|
36
|
+
export async function takeDisplayScreenshot(options = {}) {
|
|
37
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
38
|
+
const outputPath = options.outputPath || `/tmp/screenshot-${timestamp}.png`;
|
|
39
|
+
// Ensure output directory exists
|
|
40
|
+
const dir = join(outputPath, '..');
|
|
41
|
+
if (!existsSync(dir)) {
|
|
42
|
+
mkdirSync(dir, { recursive: true });
|
|
43
|
+
}
|
|
44
|
+
return new Promise((resolve, reject) => {
|
|
45
|
+
const args = [outputPath];
|
|
46
|
+
if (options.fullPage) {
|
|
47
|
+
args.unshift('-u'); // Capture including window decorations
|
|
48
|
+
}
|
|
49
|
+
const proc = spawn('scrot', args, {
|
|
50
|
+
env: { ...process.env, DISPLAY: process.env.DISPLAY || ':99' },
|
|
51
|
+
});
|
|
52
|
+
proc.on('close', (code) => {
|
|
53
|
+
if (code === 0) {
|
|
54
|
+
resolve(outputPath);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
reject(new Error(`Screenshot failed with code ${code}`));
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
proc.on('error', reject);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Run a Playwright test file
|
|
65
|
+
*/
|
|
66
|
+
export async function runPlaywrightTest(testFile, options = {}) {
|
|
67
|
+
const browser = options.browser || 'chromium';
|
|
68
|
+
const timeout = options.timeout || 30000;
|
|
69
|
+
return new Promise((resolve) => {
|
|
70
|
+
const args = ['playwright', 'test', testFile, `--project=${browser}`];
|
|
71
|
+
if (options.headless !== false) {
|
|
72
|
+
args.push('--headed=false');
|
|
73
|
+
}
|
|
74
|
+
const proc = spawn('npx', args, {
|
|
75
|
+
env: {
|
|
76
|
+
...process.env,
|
|
77
|
+
DISPLAY: process.env.DISPLAY || ':99',
|
|
78
|
+
PLAYWRIGHT_BROWSERS_PATH: '/ms-playwright',
|
|
79
|
+
},
|
|
80
|
+
timeout,
|
|
81
|
+
});
|
|
82
|
+
let output = '';
|
|
83
|
+
const screenshots = [];
|
|
84
|
+
proc.stdout.on('data', (data) => {
|
|
85
|
+
output += data.toString();
|
|
86
|
+
// Parse screenshot paths from output
|
|
87
|
+
const matches = data.toString().match(/Screenshot saved: (.+\.png)/g);
|
|
88
|
+
if (matches) {
|
|
89
|
+
screenshots.push(...matches.map((m) => m.replace('Screenshot saved: ', '')));
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
proc.stderr.on('data', (data) => {
|
|
93
|
+
output += data.toString();
|
|
94
|
+
});
|
|
95
|
+
proc.on('close', (code) => {
|
|
96
|
+
resolve({
|
|
97
|
+
success: code === 0,
|
|
98
|
+
output,
|
|
99
|
+
screenshots,
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
proc.on('error', (err) => {
|
|
103
|
+
resolve({
|
|
104
|
+
success: false,
|
|
105
|
+
output: err.message,
|
|
106
|
+
screenshots: [],
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Launch a browser and navigate to a URL
|
|
113
|
+
* Returns the browser PID for later control
|
|
114
|
+
*/
|
|
115
|
+
export async function launchBrowser(url, options = {}) {
|
|
116
|
+
const browser = options.browser || 'chromium';
|
|
117
|
+
const command = browser === 'firefox' ? 'firefox' : 'chromium';
|
|
118
|
+
return new Promise((resolve, reject) => {
|
|
119
|
+
const args = browser === 'chromium'
|
|
120
|
+
? ['--no-sandbox', '--disable-gpu', '--start-maximized', url]
|
|
121
|
+
: ['--new-window', url];
|
|
122
|
+
const proc = spawn(command, args, {
|
|
123
|
+
env: { ...process.env, DISPLAY: process.env.DISPLAY || ':99' },
|
|
124
|
+
detached: true,
|
|
125
|
+
stdio: 'ignore',
|
|
126
|
+
});
|
|
127
|
+
proc.unref();
|
|
128
|
+
// Give browser time to start
|
|
129
|
+
setTimeout(() => {
|
|
130
|
+
if (proc.pid) {
|
|
131
|
+
resolve({ pid: proc.pid });
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
reject(new Error('Failed to launch browser'));
|
|
135
|
+
}
|
|
136
|
+
}, 1000);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Generate a Playwright test file from a description
|
|
141
|
+
*/
|
|
142
|
+
export function generatePlaywrightTest(name, steps) {
|
|
143
|
+
const testCode = `
|
|
144
|
+
import { test, expect } from '@playwright/test';
|
|
145
|
+
|
|
146
|
+
test('${name}', async ({ page }) => {
|
|
147
|
+
${steps
|
|
148
|
+
.map((step) => {
|
|
149
|
+
switch (step.action) {
|
|
150
|
+
case 'goto':
|
|
151
|
+
return ` await page.goto('${step.target}');`;
|
|
152
|
+
case 'click':
|
|
153
|
+
return ` await page.click('${step.target}');`;
|
|
154
|
+
case 'fill':
|
|
155
|
+
return ` await page.fill('${step.target}', '${step.value}');`;
|
|
156
|
+
case 'screenshot':
|
|
157
|
+
return ` await page.screenshot({ path: '${step.target || 'screenshot.png'}' });`;
|
|
158
|
+
case 'wait':
|
|
159
|
+
return ` await page.waitForTimeout(${step.value || 1000});`;
|
|
160
|
+
default:
|
|
161
|
+
return ` // Unknown action: ${step.action}`;
|
|
162
|
+
}
|
|
163
|
+
})
|
|
164
|
+
.join('\n')}
|
|
165
|
+
});
|
|
166
|
+
`.trim();
|
|
167
|
+
return testCode;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Run inline Playwright script
|
|
171
|
+
*/
|
|
172
|
+
export async function runPlaywrightScript(script, options = {}) {
|
|
173
|
+
const tempDir = '/tmp/playwright-scripts';
|
|
174
|
+
if (!existsSync(tempDir)) {
|
|
175
|
+
mkdirSync(tempDir, { recursive: true });
|
|
176
|
+
}
|
|
177
|
+
const scriptPath = join(tempDir, `script-${Date.now()}.mjs`);
|
|
178
|
+
// Wrap script with Playwright imports and browser launch
|
|
179
|
+
const wrappedScript = `
|
|
180
|
+
import { chromium, firefox, webkit } from 'playwright';
|
|
181
|
+
|
|
182
|
+
async function run() {
|
|
183
|
+
const browser = await ${options.browser || 'chromium'}.launch({
|
|
184
|
+
headless: ${options.headless !== false},
|
|
185
|
+
});
|
|
186
|
+
const context = await browser.newContext({
|
|
187
|
+
viewport: ${JSON.stringify(options.viewport || { width: 1920, height: 1080 })},
|
|
188
|
+
});
|
|
189
|
+
const page = await context.newPage();
|
|
190
|
+
|
|
191
|
+
try {
|
|
192
|
+
${script}
|
|
193
|
+
} finally {
|
|
194
|
+
await browser.close();
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
run().catch(console.error);
|
|
199
|
+
`;
|
|
200
|
+
writeFileSync(scriptPath, wrappedScript);
|
|
201
|
+
return new Promise((resolve) => {
|
|
202
|
+
const proc = spawn('node', [scriptPath], {
|
|
203
|
+
env: {
|
|
204
|
+
...process.env,
|
|
205
|
+
DISPLAY: process.env.DISPLAY || ':99',
|
|
206
|
+
},
|
|
207
|
+
timeout: options.timeout || 30000,
|
|
208
|
+
});
|
|
209
|
+
let output = '';
|
|
210
|
+
proc.stdout.on('data', (data) => {
|
|
211
|
+
output += data.toString();
|
|
212
|
+
});
|
|
213
|
+
proc.stderr.on('data', (data) => {
|
|
214
|
+
output += data.toString();
|
|
215
|
+
});
|
|
216
|
+
proc.on('close', (code) => {
|
|
217
|
+
resolve({
|
|
218
|
+
success: code === 0,
|
|
219
|
+
output,
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
proc.on('error', (err) => {
|
|
223
|
+
resolve({
|
|
224
|
+
success: false,
|
|
225
|
+
output: err.message,
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Get VNC connection info
|
|
232
|
+
*/
|
|
233
|
+
export function getVNCInfo() {
|
|
234
|
+
const vncEnabled = process.env.VNC_ENABLED !== 'false';
|
|
235
|
+
const vncPort = process.env.VNC_PORT || '5900';
|
|
236
|
+
const noVncPort = process.env.NOVNC_PORT || '6080';
|
|
237
|
+
const hostname = process.env.HOSTNAME || 'localhost';
|
|
238
|
+
return {
|
|
239
|
+
available: vncEnabled,
|
|
240
|
+
vncUrl: vncEnabled ? `vnc://${hostname}:${vncPort}` : undefined,
|
|
241
|
+
noVncUrl: vncEnabled ? `http://${hostname}:${noVncPort}/vnc.html` : undefined,
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
//# sourceMappingURL=browser-testing.js.map
|