agent-relay 2.0.0 → 2.0.4
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/deploy/workspace/entrypoint.sh +4 -0
- package/dist/dashboard/out/404.html +1 -1
- package/dist/dashboard/out/app/onboarding.html +1 -1
- package/dist/dashboard/out/app/onboarding.txt +1 -1
- package/dist/dashboard/out/app.html +1 -1
- package/dist/dashboard/out/app.txt +1 -1
- package/dist/dashboard/out/cloud/link.html +1 -1
- package/dist/dashboard/out/cloud/link.txt +1 -1
- package/dist/dashboard/out/connect-repos.html +1 -1
- package/dist/dashboard/out/connect-repos.txt +1 -1
- package/dist/dashboard/out/history.html +1 -1
- package/dist/dashboard/out/history.txt +1 -1
- package/dist/dashboard/out/index.html +1 -1
- package/dist/dashboard/out/index.txt +1 -1
- package/dist/dashboard/out/login.html +1 -1
- package/dist/dashboard/out/login.txt +1 -1
- package/dist/dashboard/out/metrics.html +1 -1
- package/dist/dashboard/out/metrics.txt +1 -1
- package/dist/dashboard/out/pricing.html +1 -1
- package/dist/dashboard/out/pricing.txt +1 -1
- package/dist/dashboard/out/providers/setup/claude.html +1 -1
- package/dist/dashboard/out/providers/setup/claude.txt +1 -1
- package/dist/dashboard/out/providers/setup/codex.html +1 -1
- package/dist/dashboard/out/providers/setup/codex.txt +1 -1
- package/dist/dashboard/out/providers/setup/cursor.html +1 -1
- package/dist/dashboard/out/providers/setup/cursor.txt +1 -1
- package/dist/dashboard/out/providers.html +1 -1
- package/dist/dashboard/out/providers.txt +1 -1
- package/dist/dashboard/out/signup.html +1 -1
- package/dist/dashboard/out/signup.txt +1 -1
- package/dist/src/cli/index.js +7 -5
- package/package.json +10 -10
- package/packages/api-types/package.json +1 -1
- package/packages/bridge/dist/spawner.js +3 -1
- package/packages/bridge/package.json +12 -7
- package/packages/cloud/package.json +11 -6
- package/packages/config/dist/project-namespace.d.ts +4 -0
- package/packages/config/dist/project-namespace.js +8 -0
- package/packages/config/dist/relay-config.d.ts +14 -6
- package/packages/config/dist/relay-config.js +14 -6
- package/packages/config/package.json +7 -2
- package/packages/continuity/package.json +6 -1
- package/packages/daemon/package.json +16 -11
- package/packages/dashboard/dist/server.js +89 -17
- package/packages/dashboard/package.json +14 -22
- package/packages/dashboard/ui/react-components/SpawnModal.tsx +119 -29
- package/packages/dashboard/ui-dist/404.html +1 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/677-7323947c23b35979.js +1 -0
- package/packages/dashboard/ui-dist/app/onboarding.html +1 -1
- package/packages/dashboard/ui-dist/app/onboarding.txt +1 -1
- package/packages/dashboard/ui-dist/app.html +1 -1
- package/packages/dashboard/ui-dist/app.txt +1 -1
- package/packages/dashboard/ui-dist/cloud/link.html +1 -1
- package/packages/dashboard/ui-dist/cloud/link.txt +1 -1
- package/packages/dashboard/ui-dist/connect-repos.html +1 -1
- package/packages/dashboard/ui-dist/connect-repos.txt +1 -1
- package/packages/dashboard/ui-dist/history.html +1 -1
- package/packages/dashboard/ui-dist/history.txt +1 -1
- package/packages/dashboard/ui-dist/index.html +1 -1
- package/packages/dashboard/ui-dist/index.txt +1 -1
- package/packages/dashboard/ui-dist/login.html +1 -1
- package/packages/dashboard/ui-dist/login.txt +1 -1
- package/packages/dashboard/ui-dist/metrics.html +1 -1
- package/packages/dashboard/ui-dist/metrics.txt +1 -1
- package/packages/dashboard/ui-dist/pricing.html +1 -1
- package/packages/dashboard/ui-dist/pricing.txt +1 -1
- package/packages/dashboard/ui-dist/providers/setup/claude.html +1 -1
- package/packages/dashboard/ui-dist/providers/setup/claude.txt +1 -1
- package/packages/dashboard/ui-dist/providers/setup/codex.html +1 -1
- package/packages/dashboard/ui-dist/providers/setup/codex.txt +1 -1
- package/packages/dashboard/ui-dist/providers/setup/cursor.html +1 -1
- package/packages/dashboard/ui-dist/providers/setup/cursor.txt +1 -1
- package/packages/dashboard/ui-dist/providers.html +1 -1
- package/packages/dashboard/ui-dist/providers.txt +1 -1
- package/packages/dashboard/ui-dist/signup.html +1 -1
- package/packages/dashboard/ui-dist/signup.txt +1 -1
- package/packages/dashboard-server/package.json +18 -12
- package/packages/hooks/package.json +9 -4
- package/packages/mcp/README.md +135 -19
- package/packages/mcp/dist/cloud.js +50 -1
- package/packages/mcp/package.json +1 -1
- package/packages/memory/package.json +7 -2
- package/packages/policy/package.json +7 -2
- package/packages/protocol/package.json +6 -1
- package/packages/resiliency/package.json +6 -1
- package/packages/sdk/README.md +160 -43
- package/packages/sdk/dist/client.d.ts +99 -3
- package/packages/sdk/dist/client.js +113 -6
- package/packages/sdk/dist/discovery.d.ts +29 -0
- package/packages/sdk/dist/discovery.js +126 -0
- package/packages/sdk/dist/index.d.ts +1 -0
- package/packages/sdk/dist/index.js +2 -0
- package/packages/sdk/dist/standalone.js +1 -0
- package/packages/sdk/package.json +2 -2
- package/packages/spawner/package.json +2 -2
- package/packages/state/package.json +6 -1
- package/packages/storage/package.json +7 -2
- package/packages/trajectory/package.json +7 -2
- package/packages/user-directory/package.json +7 -2
- package/packages/utils/package.json +6 -1
- package/packages/wrapper/dist/base-wrapper.d.ts +25 -1
- package/packages/wrapper/dist/base-wrapper.js +44 -2
- package/packages/wrapper/dist/relay-pty-orchestrator.d.ts +2 -0
- package/packages/wrapper/dist/relay-pty-orchestrator.js +55 -10
- package/packages/wrapper/dist/shared.d.ts +25 -0
- package/packages/wrapper/dist/shared.js +40 -0
- package/packages/wrapper/dist/tmux-wrapper.d.ts +7 -0
- package/packages/wrapper/dist/tmux-wrapper.js +62 -9
- package/packages/wrapper/package.json +7 -7
- package/.turbo/cache/013415461711937f-meta.json +0 -1
- package/.turbo/cache/013415461711937f.tar.zst +0 -0
- package/.turbo/cache/0562b1ff326acd6d-meta.json +0 -1
- package/.turbo/cache/0562b1ff326acd6d.tar.zst +0 -0
- package/.turbo/cache/0b46e0e17254882f-meta.json +0 -1
- package/.turbo/cache/0b46e0e17254882f.tar.zst +0 -0
- package/.turbo/cache/3799eda981d53d14-meta.json +0 -1
- package/.turbo/cache/3799eda981d53d14.tar.zst +0 -0
- package/.turbo/cache/47e9d8f404ed064d-meta.json +0 -1
- package/.turbo/cache/47e9d8f404ed064d.tar.zst +0 -0
- package/.turbo/cache/4cde1d1e5b298099-meta.json +0 -1
- package/.turbo/cache/4cde1d1e5b298099.tar.zst +0 -0
- package/.turbo/cache/538eea955c0936ef-meta.json +0 -1
- package/.turbo/cache/538eea955c0936ef.tar.zst +0 -0
- package/.turbo/cache/5dceac7f229f5d5d-meta.json +0 -1
- package/.turbo/cache/5dceac7f229f5d5d.tar.zst +0 -0
- package/.turbo/cache/64c15b201819367d-meta.json +0 -1
- package/.turbo/cache/64c15b201819367d.tar.zst +0 -0
- package/.turbo/cache/6d6a21a05efca434-meta.json +0 -1
- package/.turbo/cache/6d6a21a05efca434.tar.zst +0 -0
- package/.turbo/cache/7562610cb03ec040-meta.json +0 -1
- package/.turbo/cache/7562610cb03ec040.tar.zst +0 -0
- package/.turbo/cache/81a2456e17af4d7f-meta.json +0 -1
- package/.turbo/cache/81a2456e17af4d7f.tar.zst +0 -0
- package/.turbo/cache/823fc2a7b12f724c-meta.json +0 -1
- package/.turbo/cache/823fc2a7b12f724c.tar.zst +0 -0
- package/.turbo/cache/9daad16a073d1f91-meta.json +0 -1
- package/.turbo/cache/9daad16a073d1f91.tar.zst +0 -0
- package/.turbo/cache/b81ccbab0a606b60-meta.json +0 -1
- package/.turbo/cache/b81ccbab0a606b60.tar.zst +0 -0
- package/.turbo/cache/cf98487988bfcf91-meta.json +0 -1
- package/.turbo/cache/cf98487988bfcf91.tar.zst +0 -0
- package/.turbo/cache/cfdf7c57dca71f27-meta.json +0 -1
- package/.turbo/cache/cfdf7c57dca71f27.tar.zst +0 -0
- package/.turbo/cache/d3063ef43811b1e5-meta.json +0 -1
- package/.turbo/cache/d3063ef43811b1e5.tar.zst +0 -0
- package/.turbo/cache/de28892eb7678e65-meta.json +0 -1
- package/.turbo/cache/de28892eb7678e65.tar.zst +0 -0
- package/.turbo/cache/ec29adce408132ba-meta.json +0 -1
- package/.turbo/cache/ec29adce408132ba.tar.zst +0 -0
- package/.turbo/cache/f70450d8d305f172-meta.json +0 -1
- package/.turbo/cache/f70450d8d305f172.tar.zst +0 -0
- package/.turbo/cache/fe384d5d6b7a983a-meta.json +0 -1
- package/.turbo/cache/fe384d5d6b7a983a.tar.zst +0 -0
- package/bin/relay-pty +0 -0
- package/packages/dashboard/ui/.next/BUILD_ID +0 -1
- package/packages/dashboard/ui/.next/app-build-manifest.json +0 -135
- package/packages/dashboard/ui/.next/app-path-routes-manifest.json +0 -1
- package/packages/dashboard/ui/.next/build-manifest.json +0 -32
- package/packages/dashboard/ui/.next/cache/config.json +0 -7
- package/packages/dashboard/ui/.next/cache/eslint/.cache_1asv1h5 +0 -1
- package/packages/dashboard/ui/.next/cache/webpack/client-production/0.pack +0 -0
- package/packages/dashboard/ui/.next/cache/webpack/client-production/index.pack +0 -0
- package/packages/dashboard/ui/.next/cache/webpack/edge-server-production/0.pack +0 -0
- package/packages/dashboard/ui/.next/cache/webpack/edge-server-production/index.pack +0 -0
- package/packages/dashboard/ui/.next/cache/webpack/server-production/0.pack +0 -0
- package/packages/dashboard/ui/.next/cache/webpack/server-production/index.pack +0 -0
- package/packages/dashboard/ui/.next/export-detail.json +0 -1
- package/packages/dashboard/ui/.next/export-marker.json +0 -1
- package/packages/dashboard/ui/.next/images-manifest.json +0 -1
- package/packages/dashboard/ui/.next/next-minimal-server.js.nft.json +0 -1
- package/packages/dashboard/ui/.next/next-server.js.nft.json +0 -1
- package/packages/dashboard/ui/.next/package.json +0 -1
- package/packages/dashboard/ui/.next/prerender-manifest.json +0 -1
- package/packages/dashboard/ui/.next/react-loadable-manifest.json +0 -1970
- package/packages/dashboard/ui/.next/required-server-files.json +0 -1
- package/packages/dashboard/ui/.next/routes-manifest.json +0 -1
- package/packages/dashboard/ui/.next/server/app/_not-found/page.js +0 -1
- package/packages/dashboard/ui/.next/server/app/_not-found/page.js.nft.json +0 -1
- package/packages/dashboard/ui/.next/server/app/_not-found/page_client-reference-manifest.js +0 -1
- package/packages/dashboard/ui/.next/server/app/_not-found.html +0 -1
- package/packages/dashboard/ui/.next/server/app/_not-found.meta +0 -6
- package/packages/dashboard/ui/.next/server/app/_not-found.rsc +0 -9
- package/packages/dashboard/ui/.next/server/app/app/onboarding/page.js +0 -6
- package/packages/dashboard/ui/.next/server/app/app/onboarding/page.js.nft.json +0 -1
- package/packages/dashboard/ui/.next/server/app/app/onboarding/page_client-reference-manifest.js +0 -1
- package/packages/dashboard/ui/.next/server/app/app/onboarding.html +0 -1
- package/packages/dashboard/ui/.next/server/app/app/onboarding.meta +0 -5
- package/packages/dashboard/ui/.next/server/app/app/onboarding.rsc +0 -7
- package/packages/dashboard/ui/.next/server/app/app/page.js +0 -436
- package/packages/dashboard/ui/.next/server/app/app/page.js.nft.json +0 -1
- package/packages/dashboard/ui/.next/server/app/app/page_client-reference-manifest.js +0 -1
- package/packages/dashboard/ui/.next/server/app/app.html +0 -1
- package/packages/dashboard/ui/.next/server/app/app.meta +0 -5
- package/packages/dashboard/ui/.next/server/app/app.rsc +0 -7
- package/packages/dashboard/ui/.next/server/app/apple-icon.png/route.js +0 -12
- package/packages/dashboard/ui/.next/server/app/apple-icon.png/route.js.nft.json +0 -1
- package/packages/dashboard/ui/.next/server/app/apple-icon.png.body +0 -0
- package/packages/dashboard/ui/.next/server/app/apple-icon.png.meta +0 -1
- package/packages/dashboard/ui/.next/server/app/cloud/link/page.js +0 -1
- package/packages/dashboard/ui/.next/server/app/cloud/link/page.js.nft.json +0 -1
- package/packages/dashboard/ui/.next/server/app/cloud/link/page_client-reference-manifest.js +0 -1
- package/packages/dashboard/ui/.next/server/app/cloud/link.html +0 -1
- package/packages/dashboard/ui/.next/server/app/cloud/link.meta +0 -5
- package/packages/dashboard/ui/.next/server/app/cloud/link.rsc +0 -7
- package/packages/dashboard/ui/.next/server/app/connect-repos/page.js +0 -6
- package/packages/dashboard/ui/.next/server/app/connect-repos/page.js.nft.json +0 -1
- package/packages/dashboard/ui/.next/server/app/connect-repos/page_client-reference-manifest.js +0 -1
- package/packages/dashboard/ui/.next/server/app/connect-repos.html +0 -1
- package/packages/dashboard/ui/.next/server/app/connect-repos.meta +0 -5
- package/packages/dashboard/ui/.next/server/app/connect-repos.rsc +0 -7
- package/packages/dashboard/ui/.next/server/app/history/page.js +0 -1
- package/packages/dashboard/ui/.next/server/app/history/page.js.nft.json +0 -1
- package/packages/dashboard/ui/.next/server/app/history/page_client-reference-manifest.js +0 -1
- package/packages/dashboard/ui/.next/server/app/history.html +0 -1
- package/packages/dashboard/ui/.next/server/app/history.meta +0 -5
- package/packages/dashboard/ui/.next/server/app/history.rsc +0 -7
- package/packages/dashboard/ui/.next/server/app/index.html +0 -1
- package/packages/dashboard/ui/.next/server/app/index.meta +0 -5
- package/packages/dashboard/ui/.next/server/app/index.rsc +0 -7
- package/packages/dashboard/ui/.next/server/app/login/page.js +0 -6
- package/packages/dashboard/ui/.next/server/app/login/page.js.nft.json +0 -1
- package/packages/dashboard/ui/.next/server/app/login/page_client-reference-manifest.js +0 -1
- package/packages/dashboard/ui/.next/server/app/login.html +0 -5
- package/packages/dashboard/ui/.next/server/app/login.meta +0 -5
- package/packages/dashboard/ui/.next/server/app/login.rsc +0 -7
- package/packages/dashboard/ui/.next/server/app/metrics/page.js +0 -1
- package/packages/dashboard/ui/.next/server/app/metrics/page.js.nft.json +0 -1
- package/packages/dashboard/ui/.next/server/app/metrics/page_client-reference-manifest.js +0 -1
- package/packages/dashboard/ui/.next/server/app/metrics.html +0 -1
- package/packages/dashboard/ui/.next/server/app/metrics.meta +0 -5
- package/packages/dashboard/ui/.next/server/app/metrics.rsc +0 -7
- package/packages/dashboard/ui/.next/server/app/page.js +0 -1
- package/packages/dashboard/ui/.next/server/app/page.js.nft.json +0 -1
- package/packages/dashboard/ui/.next/server/app/page_client-reference-manifest.js +0 -1
- package/packages/dashboard/ui/.next/server/app/pricing/page.js +0 -5
- package/packages/dashboard/ui/.next/server/app/pricing/page.js.nft.json +0 -1
- package/packages/dashboard/ui/.next/server/app/pricing/page_client-reference-manifest.js +0 -1
- package/packages/dashboard/ui/.next/server/app/pricing.html +0 -13
- package/packages/dashboard/ui/.next/server/app/pricing.meta +0 -5
- package/packages/dashboard/ui/.next/server/app/pricing.rsc +0 -7
- package/packages/dashboard/ui/.next/server/app/providers/page.js +0 -2
- package/packages/dashboard/ui/.next/server/app/providers/page.js.nft.json +0 -1
- package/packages/dashboard/ui/.next/server/app/providers/page_client-reference-manifest.js +0 -1
- package/packages/dashboard/ui/.next/server/app/providers/setup/[provider]/page.js +0 -1
- package/packages/dashboard/ui/.next/server/app/providers/setup/[provider]/page.js.nft.json +0 -1
- package/packages/dashboard/ui/.next/server/app/providers/setup/[provider]/page_client-reference-manifest.js +0 -1
- package/packages/dashboard/ui/.next/server/app/providers/setup/claude.html +0 -1
- package/packages/dashboard/ui/.next/server/app/providers/setup/claude.meta +0 -5
- package/packages/dashboard/ui/.next/server/app/providers/setup/claude.rsc +0 -8
- package/packages/dashboard/ui/.next/server/app/providers/setup/codex.html +0 -1
- package/packages/dashboard/ui/.next/server/app/providers/setup/codex.meta +0 -5
- package/packages/dashboard/ui/.next/server/app/providers/setup/codex.rsc +0 -8
- package/packages/dashboard/ui/.next/server/app/providers/setup/cursor.html +0 -1
- package/packages/dashboard/ui/.next/server/app/providers/setup/cursor.meta +0 -5
- package/packages/dashboard/ui/.next/server/app/providers/setup/cursor.rsc +0 -8
- package/packages/dashboard/ui/.next/server/app/providers.html +0 -1
- package/packages/dashboard/ui/.next/server/app/providers.meta +0 -5
- package/packages/dashboard/ui/.next/server/app/providers.rsc +0 -7
- package/packages/dashboard/ui/.next/server/app/signup/page.js +0 -6
- package/packages/dashboard/ui/.next/server/app/signup/page.js.nft.json +0 -1
- package/packages/dashboard/ui/.next/server/app/signup/page_client-reference-manifest.js +0 -1
- package/packages/dashboard/ui/.next/server/app/signup.html +0 -6
- package/packages/dashboard/ui/.next/server/app/signup.meta +0 -5
- package/packages/dashboard/ui/.next/server/app/signup.rsc +0 -7
- package/packages/dashboard/ui/.next/server/app-paths-manifest.json +0 -16
- package/packages/dashboard/ui/.next/server/chunks/190.js +0 -1
- package/packages/dashboard/ui/.next/server/chunks/205.js +0 -1
- package/packages/dashboard/ui/.next/server/chunks/251.js +0 -9
- package/packages/dashboard/ui/.next/server/chunks/288.js +0 -1
- package/packages/dashboard/ui/.next/server/chunks/434.js +0 -1
- package/packages/dashboard/ui/.next/server/chunks/471.js +0 -2
- package/packages/dashboard/ui/.next/server/chunks/621.js +0 -1
- package/packages/dashboard/ui/.next/server/chunks/680.js +0 -5
- package/packages/dashboard/ui/.next/server/chunks/682.js +0 -6
- package/packages/dashboard/ui/.next/server/chunks/684.js +0 -1
- package/packages/dashboard/ui/.next/server/chunks/71.js +0 -196
- package/packages/dashboard/ui/.next/server/chunks/711.js +0 -1
- package/packages/dashboard/ui/.next/server/chunks/90.js +0 -17
- package/packages/dashboard/ui/.next/server/chunks/948.js +0 -2
- package/packages/dashboard/ui/.next/server/chunks/font-manifest.json +0 -1
- package/packages/dashboard/ui/.next/server/font-manifest.json +0 -1
- package/packages/dashboard/ui/.next/server/functions-config-manifest.json +0 -1
- package/packages/dashboard/ui/.next/server/interception-route-rewrite-manifest.js +0 -1
- package/packages/dashboard/ui/.next/server/middleware-build-manifest.js +0 -1
- package/packages/dashboard/ui/.next/server/middleware-manifest.json +0 -6
- package/packages/dashboard/ui/.next/server/middleware-react-loadable-manifest.js +0 -1
- package/packages/dashboard/ui/.next/server/next-font-manifest.js +0 -1
- package/packages/dashboard/ui/.next/server/next-font-manifest.json +0 -1
- package/packages/dashboard/ui/.next/server/pages/404.html +0 -1
- package/packages/dashboard/ui/.next/server/pages/500.html +0 -1
- package/packages/dashboard/ui/.next/server/pages/_app.js +0 -1
- package/packages/dashboard/ui/.next/server/pages/_app.js.nft.json +0 -1
- package/packages/dashboard/ui/.next/server/pages/_document.js +0 -1
- package/packages/dashboard/ui/.next/server/pages/_document.js.nft.json +0 -1
- package/packages/dashboard/ui/.next/server/pages/_error.js +0 -1
- package/packages/dashboard/ui/.next/server/pages/_error.js.nft.json +0 -1
- package/packages/dashboard/ui/.next/server/pages-manifest.json +0 -1
- package/packages/dashboard/ui/.next/server/server-reference-manifest.js +0 -1
- package/packages/dashboard/ui/.next/server/server-reference-manifest.json +0 -1
- package/packages/dashboard/ui/.next/server/webpack-runtime.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/116-a883fca163f3a5bc.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/117-c8afed19e821a35d.js +0 -2
- package/packages/dashboard/ui/.next/static/chunks/282-980c2eb8fff20123.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/532-bace199897eeab37.js +0 -9
- package/packages/dashboard/ui/.next/static/chunks/631-af51bad94027527a.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/648-acb2ff9f77cbfbd3.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/677-30e60cb0b47875b6.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/766-2aea80818f7eb0d8.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/83-4f08122d4e7e79a6.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/847-f1f467060f32afff.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/891-5cb1513eeb97a891.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/app/_not-found/page-60501fddbafba9dc.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/app/app/onboarding/page-9914652442f7e4fb.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/app/app/page-44813aa26ad19681.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/app/cloud/link/page-fa1d5842aa90e8a6.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/app/connect-repos/page-113060009ef35bc2.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/app/history/page-9965d2483011b846.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/app/layout-6b91e33784c20610.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/app/login/page-a0ca6f7ca6a100b8.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/app/metrics/page-1e37ef8e73940b40.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/app/page-7993778218818ace.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/app/pricing/page-9db3ebdfa567a7c9.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/app/providers/page-bcf46064ac4474ce.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/app/providers/setup/[provider]/page-4dbe33f0f7691b7c.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/app/signup/page-1ede2205b58649ca.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/e868780c-48e5f147c90a3a41.js +0 -18
- package/packages/dashboard/ui/.next/static/chunks/fd9d1056-609918ca7b6280bb.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/framework-f66176bb897dc684.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/main-5a40a5ae29646e1b.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/main-app-fdbeb09028f57c9f.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/pages/_app-72b849fbd24ac258.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/pages/_error-7ba65e1336b92748.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/polyfills-42372ed130431b0a.js +0 -1
- package/packages/dashboard/ui/.next/static/chunks/webpack-1cdd8ed57114d5e1.js +0 -1
- package/packages/dashboard/ui/.next/static/css/4034f236dd1a3178.css +0 -1
- package/packages/dashboard/ui/.next/static/css/99c2552394077586.css +0 -1
- package/packages/dashboard/ui/.next/trace +0 -63
- package/packages/dashboard/ui/.next/types/app/app/onboarding/page.ts +0 -79
- package/packages/dashboard/ui/.next/types/app/app/page.ts +0 -79
- package/packages/dashboard/ui/.next/types/app/cloud/link/page.ts +0 -79
- package/packages/dashboard/ui/.next/types/app/connect-repos/page.ts +0 -79
- package/packages/dashboard/ui/.next/types/app/history/page.ts +0 -79
- package/packages/dashboard/ui/.next/types/app/layout.ts +0 -79
- package/packages/dashboard/ui/.next/types/app/login/page.ts +0 -79
- package/packages/dashboard/ui/.next/types/app/metrics/page.ts +0 -79
- package/packages/dashboard/ui/.next/types/app/page.ts +0 -79
- package/packages/dashboard/ui/.next/types/app/pricing/page.ts +0 -79
- package/packages/dashboard/ui/.next/types/app/providers/page.ts +0 -79
- package/packages/dashboard/ui/.next/types/app/providers/setup/[provider]/page.ts +0 -79
- package/packages/dashboard/ui/.next/types/app/signup/page.ts +0 -79
- package/packages/dashboard/ui/.next/types/package.json +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/677-30e60cb0b47875b6.js +0 -1
- /package/dist/dashboard/out/_next/static/{ZCFjHbkF8yDKS2md3lVgb → 72btMIJ64BCAB4UgVkpaq}/_buildManifest.js +0 -0
- /package/dist/dashboard/out/_next/static/{ZCFjHbkF8yDKS2md3lVgb → 72btMIJ64BCAB4UgVkpaq}/_ssgManifest.js +0 -0
- /package/packages/dashboard/ui-dist/_next/static/{HR7W9z1PPVPFqUboUVZFZ → 0AsOfRemPXJmtynCKT-rx}/_buildManifest.js +0 -0
- /package/packages/dashboard/ui-dist/_next/static/{HR7W9z1PPVPFqUboUVZFZ → 0AsOfRemPXJmtynCKT-rx}/_ssgManifest.js +0 -0
- /package/packages/dashboard/ui-dist/_next/static/{ZCFjHbkF8yDKS2md3lVgb → 72btMIJ64BCAB4UgVkpaq}/_buildManifest.js +0 -0
- /package/packages/dashboard/ui-dist/_next/static/{ZCFjHbkF8yDKS2md3lVgb → 72btMIJ64BCAB4UgVkpaq}/_ssgManifest.js +0 -0
- /package/packages/dashboard/{ui/.next/static/HR7W9z1PPVPFqUboUVZFZ → ui-dist/_next/static/clUN2n0bz9HCjKI0qlOxU}/_buildManifest.js +0 -0
- /package/packages/dashboard/{ui/.next/static/HR7W9z1PPVPFqUboUVZFZ → ui-dist/_next/static/clUN2n0bz9HCjKI0qlOxU}/_ssgManifest.js +0 -0
package/packages/sdk/README.md
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
# @agent-relay/sdk
|
|
2
2
|
|
|
3
|
-
Dead simple agent-to-agent communication.
|
|
3
|
+
Dead simple agent-to-agent communication for AI agent systems.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @agent-relay/sdk
|
|
8
|
+
npm install @agent-relay/sdk
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Quick Start
|
|
12
12
|
|
|
13
|
+
### Standalone (In-Process Daemon)
|
|
14
|
+
|
|
13
15
|
```typescript
|
|
14
16
|
import { createRelay } from '@agent-relay/sdk';
|
|
15
17
|
|
|
@@ -32,9 +34,7 @@ alice.sendMessage('Bob', 'Hello!');
|
|
|
32
34
|
await relay.stop();
|
|
33
35
|
```
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
## Even Simpler: Two Agents
|
|
37
|
+
### Two-Agent Shortcut
|
|
38
38
|
|
|
39
39
|
```typescript
|
|
40
40
|
import { createPair } from '@agent-relay/sdk';
|
|
@@ -47,56 +47,163 @@ alice.sendMessage('bob', 'Hey!');
|
|
|
47
47
|
await stop();
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
### With External Daemon
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|---------|-------------|
|
|
54
|
-
| **Zero config** | Just import and go |
|
|
55
|
-
| **Auto-reconnect** | Handles disconnections automatically |
|
|
56
|
-
| **Message deduplication** | No duplicate deliveries |
|
|
57
|
-
| **Sync messaging** | Wait for acknowledgment |
|
|
58
|
-
| **Broadcast** | Send to all agents with `*` |
|
|
59
|
-
| **Channels** | Group messaging with `#channel` |
|
|
52
|
+
If you're running `agent-relay up` separately:
|
|
60
53
|
|
|
61
|
-
|
|
54
|
+
```typescript
|
|
55
|
+
import { RelayClient } from '@agent-relay/sdk';
|
|
56
|
+
|
|
57
|
+
// Socket path is auto-discovered from your project's .agent-relay/relay.sock
|
|
58
|
+
const client = new RelayClient({ agentName: 'MyAgent' });
|
|
62
59
|
|
|
63
|
-
|
|
60
|
+
await client.connect();
|
|
61
|
+
client.sendMessage('OtherAgent', 'Hello!');
|
|
62
|
+
```
|
|
64
63
|
|
|
65
|
-
|
|
64
|
+
## Socket Discovery
|
|
65
|
+
|
|
66
|
+
The SDK automatically discovers the daemon socket in this order:
|
|
67
|
+
|
|
68
|
+
1. `RELAY_SOCKET` environment variable
|
|
69
|
+
2. Cloud workspace socket (if `WORKSPACE_ID` is set)
|
|
70
|
+
3. **Project-local socket** (`{projectRoot}/.agent-relay/relay.sock`)
|
|
71
|
+
4. Legacy fallback (`/tmp/agent-relay.sock`)
|
|
72
|
+
|
|
73
|
+
You can also use the discovery API directly:
|
|
66
74
|
|
|
67
75
|
```typescript
|
|
68
|
-
|
|
69
|
-
socketPath: '/tmp/my-relay.sock', // Optional custom socket
|
|
70
|
-
quiet: true, // Suppress logs (default: true)
|
|
71
|
-
});
|
|
76
|
+
import { discoverSocket, getDefaultSocketPath } from '@agent-relay/sdk';
|
|
72
77
|
|
|
73
|
-
//
|
|
74
|
-
const
|
|
78
|
+
// Get detailed discovery info
|
|
79
|
+
const { socketPath, projectId, source } = discoverSocket();
|
|
80
|
+
console.log(`Using socket: ${socketPath} (source: ${source})`);
|
|
75
81
|
|
|
76
|
-
//
|
|
77
|
-
|
|
82
|
+
// Or just get the path
|
|
83
|
+
const socketPath = getDefaultSocketPath();
|
|
78
84
|
```
|
|
79
85
|
|
|
80
|
-
|
|
86
|
+
## Integration Guide (for Libraries like AgentSwarm)
|
|
81
87
|
|
|
82
|
-
|
|
88
|
+
If you're building a library that integrates with Agent Relay:
|
|
89
|
+
|
|
90
|
+
### Option 1: Use the SDK Client (Recommended)
|
|
83
91
|
|
|
84
92
|
```typescript
|
|
85
|
-
|
|
93
|
+
import { RelayClient, discoverSocket } from '@agent-relay/sdk';
|
|
94
|
+
|
|
95
|
+
class MyAgentOrchestrator {
|
|
96
|
+
private client: RelayClient;
|
|
97
|
+
|
|
98
|
+
async connect(agentName: string) {
|
|
99
|
+
// Auto-discovers socket path
|
|
100
|
+
this.client = new RelayClient({
|
|
101
|
+
agentName,
|
|
102
|
+
reconnect: true, // Auto-reconnect on disconnect
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
await this.client.connect();
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async sendTask(to: string, task: string) {
|
|
109
|
+
return this.client.sendMessage(to, task);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
async waitForResponse(to: string, message: string, timeoutMs = 30000) {
|
|
113
|
+
return this.client.sendAndWait(to, message, { timeoutMs });
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
onMessage(handler: (from: string, body: string) => void) {
|
|
117
|
+
this.client.onMessage = (from, payload) => {
|
|
118
|
+
handler(from, payload.body);
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
}
|
|
86
122
|
```
|
|
87
123
|
|
|
88
|
-
###
|
|
124
|
+
### Option 2: Use MCP Simple API (If Using MCP)
|
|
89
125
|
|
|
90
|
-
|
|
126
|
+
If your agents use MCP, the `@agent-relay/mcp` package has an even simpler API:
|
|
91
127
|
|
|
92
128
|
```typescript
|
|
129
|
+
import { createTools } from '@agent-relay/mcp';
|
|
130
|
+
|
|
131
|
+
const tools = createTools('Orchestrator');
|
|
132
|
+
|
|
133
|
+
// Send messages
|
|
134
|
+
await tools.send('Worker1', 'Run the test suite');
|
|
135
|
+
|
|
136
|
+
// Spawn workers
|
|
137
|
+
await tools.spawn({
|
|
138
|
+
name: 'Worker1',
|
|
139
|
+
cli: 'claude',
|
|
140
|
+
task: 'Run tests and report results',
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
// Check messages
|
|
144
|
+
const messages = await tools.inbox();
|
|
145
|
+
|
|
146
|
+
// List online agents
|
|
147
|
+
const agents = await tools.who();
|
|
148
|
+
|
|
149
|
+
// Release workers
|
|
150
|
+
await tools.release('Worker1');
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Option 3: HTTP API (For Non-Node Environments)
|
|
154
|
+
|
|
155
|
+
If the daemon is running with dashboard, use the HTTP API:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# Spawn an agent
|
|
159
|
+
curl -X POST http://localhost:3888/api/spawn \
|
|
160
|
+
-H 'Content-Type: application/json' \
|
|
161
|
+
-d '{"name": "Worker1", "cli": "claude", "task": "Run tests"}'
|
|
162
|
+
|
|
163
|
+
# List agents
|
|
164
|
+
curl http://localhost:3888/api/spawned
|
|
165
|
+
|
|
166
|
+
# Release an agent
|
|
167
|
+
curl -X DELETE http://localhost:3888/api/spawned/Worker1
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Features
|
|
171
|
+
|
|
172
|
+
| Feature | Description |
|
|
173
|
+
|---------|-------------|
|
|
174
|
+
| **Auto-discovery** | Finds daemon socket automatically |
|
|
175
|
+
| **Auto-reconnect** | Handles disconnections automatically |
|
|
176
|
+
| **Message deduplication** | No duplicate deliveries |
|
|
177
|
+
| **Sync messaging** | Wait for acknowledgment |
|
|
178
|
+
| **Broadcast** | Send to all agents with `*` |
|
|
179
|
+
| **Channels** | Group messaging with `#channel` |
|
|
180
|
+
|
|
181
|
+
## API Reference
|
|
182
|
+
|
|
183
|
+
### RelayClient
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
import { RelayClient } from '@agent-relay/sdk';
|
|
187
|
+
|
|
188
|
+
const client = new RelayClient({
|
|
189
|
+
agentName: 'MyAgent', // Required: your agent's name
|
|
190
|
+
socketPath: '/custom/path', // Optional: override auto-discovery
|
|
191
|
+
reconnect: true, // Optional: auto-reconnect (default: true)
|
|
192
|
+
quiet: false, // Optional: suppress logs (default: false)
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
// Connect to daemon
|
|
196
|
+
await client.connect();
|
|
197
|
+
|
|
93
198
|
// Send messages
|
|
94
199
|
client.sendMessage('OtherAgent', 'Hello!');
|
|
95
200
|
client.sendMessage('#general', 'Channel message');
|
|
96
201
|
client.sendMessage('*', 'Broadcast to everyone');
|
|
97
202
|
|
|
98
203
|
// Wait for acknowledgment
|
|
99
|
-
const ack = await client.sendAndWait('OtherAgent', 'Important message'
|
|
204
|
+
const ack = await client.sendAndWait('OtherAgent', 'Important message', {
|
|
205
|
+
timeoutMs: 30000,
|
|
206
|
+
});
|
|
100
207
|
|
|
101
208
|
// Receive messages
|
|
102
209
|
client.onMessage = (from, payload, messageId, meta, originalTo) => {
|
|
@@ -117,23 +224,20 @@ client.onStateChange = (state) => {
|
|
|
117
224
|
client.disconnect();
|
|
118
225
|
```
|
|
119
226
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
If you're running `agent-relay up` separately (e.g., for the dashboard), use the client directly:
|
|
227
|
+
### Socket Discovery
|
|
123
228
|
|
|
124
229
|
```typescript
|
|
125
|
-
import {
|
|
230
|
+
import { discoverSocket, getDefaultSocketPath } from '@agent-relay/sdk';
|
|
126
231
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
});
|
|
232
|
+
// Get full discovery result
|
|
233
|
+
const result = discoverSocket();
|
|
234
|
+
// { socketPath: string, projectId: string, source: 'env' | 'cloud' | 'project' | 'legacy' }
|
|
131
235
|
|
|
132
|
-
|
|
133
|
-
|
|
236
|
+
// Get just the path
|
|
237
|
+
const socketPath = getDefaultSocketPath();
|
|
134
238
|
```
|
|
135
239
|
|
|
136
|
-
|
|
240
|
+
### Channels
|
|
137
241
|
|
|
138
242
|
```typescript
|
|
139
243
|
// Join a channel
|
|
@@ -151,7 +255,7 @@ client.onChannelMessage = (from, channel, body, envelope) => {
|
|
|
151
255
|
client.leaveChannel('#general');
|
|
152
256
|
```
|
|
153
257
|
|
|
154
|
-
|
|
258
|
+
### Shadow Agents
|
|
155
259
|
|
|
156
260
|
Monitor another agent's communication:
|
|
157
261
|
|
|
@@ -166,6 +270,19 @@ client.bindAsShadow('PrimaryAgent', {
|
|
|
166
270
|
client.unbindAsShadow('PrimaryAgent');
|
|
167
271
|
```
|
|
168
272
|
|
|
273
|
+
## Environment Variables
|
|
274
|
+
|
|
275
|
+
| Variable | Description |
|
|
276
|
+
|----------|-------------|
|
|
277
|
+
| `RELAY_SOCKET` | Override daemon socket path |
|
|
278
|
+
| `RELAY_PROJECT` | Override project name |
|
|
279
|
+
| `WORKSPACE_ID` | Cloud workspace ID (auto-detects cloud socket) |
|
|
280
|
+
|
|
281
|
+
## Requirements
|
|
282
|
+
|
|
283
|
+
- Node.js 18+
|
|
284
|
+
- Agent Relay daemon running (`agent-relay up`)
|
|
285
|
+
|
|
169
286
|
## License
|
|
170
287
|
|
|
171
288
|
MIT
|
|
@@ -45,7 +45,39 @@ export interface ClientConfig {
|
|
|
45
45
|
reconnectMaxDelayMs: number;
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
|
-
* RelayClient
|
|
48
|
+
* RelayClient - Agent-to-agent communication client for Agent Relay.
|
|
49
|
+
*
|
|
50
|
+
* The client automatically discovers the daemon socket path. You only need to provide
|
|
51
|
+
* your agent name. Use `connect()` to establish a connection, then send/receive messages.
|
|
52
|
+
*
|
|
53
|
+
* @example Basic Usage
|
|
54
|
+
* ```typescript
|
|
55
|
+
* import { RelayClient } from '@agent-relay/sdk';
|
|
56
|
+
*
|
|
57
|
+
* const client = new RelayClient({ agentName: 'MyAgent' });
|
|
58
|
+
* await client.connect();
|
|
59
|
+
*
|
|
60
|
+
* // Send messages
|
|
61
|
+
* client.sendMessage('OtherAgent', 'Hello!');
|
|
62
|
+
* client.sendMessage('#general', 'Channel message');
|
|
63
|
+
* client.sendMessage('*', 'Broadcast');
|
|
64
|
+
*
|
|
65
|
+
* // Receive messages
|
|
66
|
+
* client.onMessage = (from, payload) => {
|
|
67
|
+
* console.log(`${from}: ${payload.body}`);
|
|
68
|
+
* };
|
|
69
|
+
*
|
|
70
|
+
* // Disconnect when done
|
|
71
|
+
* client.disconnect();
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* @example Wait for Response
|
|
75
|
+
* ```typescript
|
|
76
|
+
* const response = await client.sendAndWait('Worker', 'Do this task', {
|
|
77
|
+
* timeoutMs: 30000,
|
|
78
|
+
* });
|
|
79
|
+
* console.log(`Worker replied: ${response.content}`);
|
|
80
|
+
* ```
|
|
49
81
|
*/
|
|
50
82
|
export declare class RelayClient {
|
|
51
83
|
private config;
|
|
@@ -62,12 +94,32 @@ export declare class RelayClient {
|
|
|
62
94
|
private writeQueue;
|
|
63
95
|
private writeScheduled;
|
|
64
96
|
private pendingSyncAcks;
|
|
97
|
+
/**
|
|
98
|
+
* Callback for receiving direct messages.
|
|
99
|
+
* @param from - Name of the sending agent
|
|
100
|
+
* @param payload - Message payload containing body, kind, and optional data
|
|
101
|
+
* @param messageId - Unique message identifier
|
|
102
|
+
* @param meta - Optional metadata (sync info, etc.)
|
|
103
|
+
* @param originalTo - Original recipient (useful for detecting broadcasts when originalTo='*')
|
|
104
|
+
*/
|
|
65
105
|
onMessage?: (from: string, payload: SendPayload, messageId: string, meta?: SendMeta, originalTo?: string) => void;
|
|
66
106
|
/**
|
|
67
107
|
* Callback for channel messages.
|
|
108
|
+
* @param from - Name of the sending agent
|
|
109
|
+
* @param channel - Channel name (e.g., '#general')
|
|
110
|
+
* @param body - Message body text
|
|
111
|
+
* @param envelope - Full message envelope with metadata
|
|
68
112
|
*/
|
|
69
113
|
onChannelMessage?: (from: string, channel: string, body: string, envelope: Envelope<ChannelMessagePayload>) => void;
|
|
114
|
+
/**
|
|
115
|
+
* Callback for connection state changes.
|
|
116
|
+
* @param state - New connection state: 'DISCONNECTED' | 'CONNECTING' | 'HANDSHAKING' | 'READY' | 'BACKOFF'
|
|
117
|
+
*/
|
|
70
118
|
onStateChange?: (state: ClientState) => void;
|
|
119
|
+
/**
|
|
120
|
+
* Callback for errors.
|
|
121
|
+
* @param error - The error that occurred
|
|
122
|
+
*/
|
|
71
123
|
onError?: (error: Error) => void;
|
|
72
124
|
constructor(config?: Partial<ClientConfig>);
|
|
73
125
|
get state(): ClientState;
|
|
@@ -86,7 +138,30 @@ export declare class RelayClient {
|
|
|
86
138
|
*/
|
|
87
139
|
destroy(): void;
|
|
88
140
|
/**
|
|
89
|
-
* Send a message to another agent.
|
|
141
|
+
* Send a message to another agent, channel, or broadcast.
|
|
142
|
+
*
|
|
143
|
+
* @param to - Recipient: agent name, '#channel', or '*' for broadcast
|
|
144
|
+
* @param body - Message content
|
|
145
|
+
* @param kind - Message type (default: 'message')
|
|
146
|
+
* @param data - Optional structured data to include
|
|
147
|
+
* @param thread - Optional thread ID for conversation threading
|
|
148
|
+
* @param meta - Optional metadata (sync info, etc.)
|
|
149
|
+
* @returns true if message was queued, false if not connected
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```typescript
|
|
153
|
+
* // Direct message
|
|
154
|
+
* client.sendMessage('Worker1', 'Start the task');
|
|
155
|
+
*
|
|
156
|
+
* // Channel message
|
|
157
|
+
* client.sendMessage('#general', 'Team update');
|
|
158
|
+
*
|
|
159
|
+
* // Broadcast to all agents
|
|
160
|
+
* client.sendMessage('*', 'System announcement');
|
|
161
|
+
*
|
|
162
|
+
* // With structured data
|
|
163
|
+
* client.sendMessage('Worker1', 'Process this', 'task', { priority: 'high' });
|
|
164
|
+
* ```
|
|
90
165
|
*/
|
|
91
166
|
sendMessage(to: string, body: string, kind?: PayloadKind, data?: Record<string, unknown>, thread?: string, meta?: SendMeta): boolean;
|
|
92
167
|
/**
|
|
@@ -94,7 +169,28 @@ export declare class RelayClient {
|
|
|
94
169
|
*/
|
|
95
170
|
sendAck(payload: AckPayload): boolean;
|
|
96
171
|
/**
|
|
97
|
-
* Send a message and wait for
|
|
172
|
+
* Send a message and wait for acknowledgment response.
|
|
173
|
+
*
|
|
174
|
+
* This is useful for request-response patterns where you need to wait for
|
|
175
|
+
* the recipient to process your message and reply.
|
|
176
|
+
*
|
|
177
|
+
* @param to - Recipient agent name
|
|
178
|
+
* @param body - Message content
|
|
179
|
+
* @param options - Options including timeout, thread, etc.
|
|
180
|
+
* @returns Promise that resolves with the ACK payload when recipient responds
|
|
181
|
+
* @throws Error if client not ready or timeout exceeded
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```typescript
|
|
185
|
+
* try {
|
|
186
|
+
* const response = await client.sendAndWait('Worker', 'Process this task', {
|
|
187
|
+
* timeoutMs: 30000, // 30 second timeout
|
|
188
|
+
* });
|
|
189
|
+
* console.log('Worker responded:', response);
|
|
190
|
+
* } catch (err) {
|
|
191
|
+
* console.error('Worker did not respond in time');
|
|
192
|
+
* }
|
|
193
|
+
* ```
|
|
98
194
|
*/
|
|
99
195
|
sendAndWait(to: string, body: string, options?: SyncOptions): Promise<AckPayload>;
|
|
100
196
|
/**
|
|
@@ -6,11 +6,19 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import net from 'node:net';
|
|
8
8
|
import { randomUUID } from 'node:crypto';
|
|
9
|
+
import { getDefaultSocketPath } from './discovery.js';
|
|
9
10
|
import { PROTOCOL_VERSION, } from './protocol/types.js';
|
|
10
11
|
import { encodeFrameLegacy, FrameParser } from './protocol/framing.js';
|
|
11
|
-
|
|
12
|
+
// Socket path is discovered lazily to allow environment to be set up first
|
|
13
|
+
let _discoveredSocketPath = null;
|
|
14
|
+
function getDiscoveredSocketPath() {
|
|
15
|
+
if (_discoveredSocketPath === null) {
|
|
16
|
+
_discoveredSocketPath = getDefaultSocketPath();
|
|
17
|
+
}
|
|
18
|
+
return _discoveredSocketPath;
|
|
19
|
+
}
|
|
12
20
|
const DEFAULT_CLIENT_CONFIG = {
|
|
13
|
-
socketPath:
|
|
21
|
+
socketPath: '', // Will be set in constructor if not provided
|
|
14
22
|
agentName: 'agent',
|
|
15
23
|
cli: undefined,
|
|
16
24
|
quiet: false,
|
|
@@ -56,7 +64,39 @@ class CircularDedupeCache {
|
|
|
56
64
|
}
|
|
57
65
|
}
|
|
58
66
|
/**
|
|
59
|
-
* RelayClient
|
|
67
|
+
* RelayClient - Agent-to-agent communication client for Agent Relay.
|
|
68
|
+
*
|
|
69
|
+
* The client automatically discovers the daemon socket path. You only need to provide
|
|
70
|
+
* your agent name. Use `connect()` to establish a connection, then send/receive messages.
|
|
71
|
+
*
|
|
72
|
+
* @example Basic Usage
|
|
73
|
+
* ```typescript
|
|
74
|
+
* import { RelayClient } from '@agent-relay/sdk';
|
|
75
|
+
*
|
|
76
|
+
* const client = new RelayClient({ agentName: 'MyAgent' });
|
|
77
|
+
* await client.connect();
|
|
78
|
+
*
|
|
79
|
+
* // Send messages
|
|
80
|
+
* client.sendMessage('OtherAgent', 'Hello!');
|
|
81
|
+
* client.sendMessage('#general', 'Channel message');
|
|
82
|
+
* client.sendMessage('*', 'Broadcast');
|
|
83
|
+
*
|
|
84
|
+
* // Receive messages
|
|
85
|
+
* client.onMessage = (from, payload) => {
|
|
86
|
+
* console.log(`${from}: ${payload.body}`);
|
|
87
|
+
* };
|
|
88
|
+
*
|
|
89
|
+
* // Disconnect when done
|
|
90
|
+
* client.disconnect();
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @example Wait for Response
|
|
94
|
+
* ```typescript
|
|
95
|
+
* const response = await client.sendAndWait('Worker', 'Do this task', {
|
|
96
|
+
* timeoutMs: 30000,
|
|
97
|
+
* });
|
|
98
|
+
* console.log(`Worker replied: ${response.content}`);
|
|
99
|
+
* ```
|
|
60
100
|
*/
|
|
61
101
|
export class RelayClient {
|
|
62
102
|
config;
|
|
@@ -73,16 +113,39 @@ export class RelayClient {
|
|
|
73
113
|
writeQueue = [];
|
|
74
114
|
writeScheduled = false;
|
|
75
115
|
pendingSyncAcks = new Map();
|
|
76
|
-
|
|
116
|
+
/**
|
|
117
|
+
* Callback for receiving direct messages.
|
|
118
|
+
* @param from - Name of the sending agent
|
|
119
|
+
* @param payload - Message payload containing body, kind, and optional data
|
|
120
|
+
* @param messageId - Unique message identifier
|
|
121
|
+
* @param meta - Optional metadata (sync info, etc.)
|
|
122
|
+
* @param originalTo - Original recipient (useful for detecting broadcasts when originalTo='*')
|
|
123
|
+
*/
|
|
77
124
|
onMessage;
|
|
78
125
|
/**
|
|
79
126
|
* Callback for channel messages.
|
|
127
|
+
* @param from - Name of the sending agent
|
|
128
|
+
* @param channel - Channel name (e.g., '#general')
|
|
129
|
+
* @param body - Message body text
|
|
130
|
+
* @param envelope - Full message envelope with metadata
|
|
80
131
|
*/
|
|
81
132
|
onChannelMessage;
|
|
133
|
+
/**
|
|
134
|
+
* Callback for connection state changes.
|
|
135
|
+
* @param state - New connection state: 'DISCONNECTED' | 'CONNECTING' | 'HANDSHAKING' | 'READY' | 'BACKOFF'
|
|
136
|
+
*/
|
|
82
137
|
onStateChange;
|
|
138
|
+
/**
|
|
139
|
+
* Callback for errors.
|
|
140
|
+
* @param error - The error that occurred
|
|
141
|
+
*/
|
|
83
142
|
onError;
|
|
84
143
|
constructor(config = {}) {
|
|
85
144
|
this.config = { ...DEFAULT_CLIENT_CONFIG, ...config };
|
|
145
|
+
// Use discovered socket path if not explicitly provided
|
|
146
|
+
if (!this.config.socketPath) {
|
|
147
|
+
this.config.socketPath = getDiscoveredSocketPath();
|
|
148
|
+
}
|
|
86
149
|
this.parser = new FrameParser();
|
|
87
150
|
this.parser.setLegacyMode(true);
|
|
88
151
|
this.reconnectDelay = this.config.reconnectDelayMs;
|
|
@@ -177,7 +240,30 @@ export class RelayClient {
|
|
|
177
240
|
this.disconnect();
|
|
178
241
|
}
|
|
179
242
|
/**
|
|
180
|
-
* Send a message to another agent.
|
|
243
|
+
* Send a message to another agent, channel, or broadcast.
|
|
244
|
+
*
|
|
245
|
+
* @param to - Recipient: agent name, '#channel', or '*' for broadcast
|
|
246
|
+
* @param body - Message content
|
|
247
|
+
* @param kind - Message type (default: 'message')
|
|
248
|
+
* @param data - Optional structured data to include
|
|
249
|
+
* @param thread - Optional thread ID for conversation threading
|
|
250
|
+
* @param meta - Optional metadata (sync info, etc.)
|
|
251
|
+
* @returns true if message was queued, false if not connected
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* ```typescript
|
|
255
|
+
* // Direct message
|
|
256
|
+
* client.sendMessage('Worker1', 'Start the task');
|
|
257
|
+
*
|
|
258
|
+
* // Channel message
|
|
259
|
+
* client.sendMessage('#general', 'Team update');
|
|
260
|
+
*
|
|
261
|
+
* // Broadcast to all agents
|
|
262
|
+
* client.sendMessage('*', 'System announcement');
|
|
263
|
+
*
|
|
264
|
+
* // With structured data
|
|
265
|
+
* client.sendMessage('Worker1', 'Process this', 'task', { priority: 'high' });
|
|
266
|
+
* ```
|
|
181
267
|
*/
|
|
182
268
|
sendMessage(to, body, kind = 'message', data, thread, meta) {
|
|
183
269
|
if (this._state !== 'READY') {
|
|
@@ -216,7 +302,28 @@ export class RelayClient {
|
|
|
216
302
|
return this.send(envelope);
|
|
217
303
|
}
|
|
218
304
|
/**
|
|
219
|
-
* Send a message and wait for
|
|
305
|
+
* Send a message and wait for acknowledgment response.
|
|
306
|
+
*
|
|
307
|
+
* This is useful for request-response patterns where you need to wait for
|
|
308
|
+
* the recipient to process your message and reply.
|
|
309
|
+
*
|
|
310
|
+
* @param to - Recipient agent name
|
|
311
|
+
* @param body - Message content
|
|
312
|
+
* @param options - Options including timeout, thread, etc.
|
|
313
|
+
* @returns Promise that resolves with the ACK payload when recipient responds
|
|
314
|
+
* @throws Error if client not ready or timeout exceeded
|
|
315
|
+
*
|
|
316
|
+
* @example
|
|
317
|
+
* ```typescript
|
|
318
|
+
* try {
|
|
319
|
+
* const response = await client.sendAndWait('Worker', 'Process this task', {
|
|
320
|
+
* timeoutMs: 30000, // 30 second timeout
|
|
321
|
+
* });
|
|
322
|
+
* console.log('Worker responded:', response);
|
|
323
|
+
* } catch (err) {
|
|
324
|
+
* console.error('Worker did not respond in time');
|
|
325
|
+
* }
|
|
326
|
+
* ```
|
|
220
327
|
*/
|
|
221
328
|
async sendAndWait(to, body, options = {}) {
|
|
222
329
|
if (this._state !== 'READY') {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Socket Discovery for Agent Relay SDK
|
|
3
|
+
*
|
|
4
|
+
* Discovers the daemon socket path for local development and cloud environments.
|
|
5
|
+
*/
|
|
6
|
+
export interface DiscoveryResult {
|
|
7
|
+
socketPath: string;
|
|
8
|
+
projectId: string;
|
|
9
|
+
source: 'env' | 'cloud' | 'project' | 'legacy';
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Discover the relay daemon socket path.
|
|
13
|
+
*
|
|
14
|
+
* Discovery order:
|
|
15
|
+
* 1. RELAY_SOCKET environment variable (explicit override)
|
|
16
|
+
* 2. Cloud workspace socket (if WORKSPACE_ID is set)
|
|
17
|
+
* 3. Project-local socket ({projectRoot}/.agent-relay/relay.sock)
|
|
18
|
+
* 4. Legacy fallback (/tmp/agent-relay.sock)
|
|
19
|
+
*
|
|
20
|
+
* @param cwd - Working directory to start search from (default: process.cwd())
|
|
21
|
+
* @returns Discovery result with socket path and metadata
|
|
22
|
+
*/
|
|
23
|
+
export declare function discoverSocket(cwd?: string): DiscoveryResult;
|
|
24
|
+
/**
|
|
25
|
+
* Get the default socket path using discovery.
|
|
26
|
+
* Convenience function that returns just the path.
|
|
27
|
+
*/
|
|
28
|
+
export declare function getDefaultSocketPath(cwd?: string): string;
|
|
29
|
+
//# sourceMappingURL=discovery.d.ts.map
|