agent-relay 1.5.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cursor/mcp.json +11 -0
- package/.gitleaks.toml +26 -0
- package/.mcp.json +11 -0
- package/.nvmrc +1 -1
- package/.turbo/cache/013415461711937f-meta.json +1 -0
- package/.turbo/cache/013415461711937f.tar.zst +0 -0
- package/.turbo/cache/0562b1ff326acd6d-meta.json +1 -0
- package/.turbo/cache/0562b1ff326acd6d.tar.zst +0 -0
- package/.turbo/cache/0b46e0e17254882f-meta.json +1 -0
- package/.turbo/cache/0b46e0e17254882f.tar.zst +0 -0
- package/.turbo/cache/3799eda981d53d14-meta.json +1 -0
- package/.turbo/cache/3799eda981d53d14.tar.zst +0 -0
- package/.turbo/cache/47e9d8f404ed064d-meta.json +1 -0
- package/.turbo/cache/47e9d8f404ed064d.tar.zst +0 -0
- package/.turbo/cache/4cde1d1e5b298099-meta.json +1 -0
- package/.turbo/cache/4cde1d1e5b298099.tar.zst +0 -0
- package/.turbo/cache/538eea955c0936ef-meta.json +1 -0
- package/.turbo/cache/538eea955c0936ef.tar.zst +0 -0
- package/.turbo/cache/5dceac7f229f5d5d-meta.json +1 -0
- package/.turbo/cache/5dceac7f229f5d5d.tar.zst +0 -0
- package/.turbo/cache/64c15b201819367d-meta.json +1 -0
- package/.turbo/cache/64c15b201819367d.tar.zst +0 -0
- package/.turbo/cache/6d6a21a05efca434-meta.json +1 -0
- package/.turbo/cache/6d6a21a05efca434.tar.zst +0 -0
- package/.turbo/cache/7562610cb03ec040-meta.json +1 -0
- package/.turbo/cache/7562610cb03ec040.tar.zst +0 -0
- package/.turbo/cache/81a2456e17af4d7f-meta.json +1 -0
- package/.turbo/cache/81a2456e17af4d7f.tar.zst +0 -0
- package/.turbo/cache/823fc2a7b12f724c-meta.json +1 -0
- package/.turbo/cache/823fc2a7b12f724c.tar.zst +0 -0
- package/.turbo/cache/9daad16a073d1f91-meta.json +1 -0
- package/.turbo/cache/9daad16a073d1f91.tar.zst +0 -0
- package/.turbo/cache/b81ccbab0a606b60-meta.json +1 -0
- package/.turbo/cache/b81ccbab0a606b60.tar.zst +0 -0
- package/.turbo/cache/cf98487988bfcf91-meta.json +1 -0
- package/.turbo/cache/cf98487988bfcf91.tar.zst +0 -0
- package/.turbo/cache/cfdf7c57dca71f27-meta.json +1 -0
- package/.turbo/cache/cfdf7c57dca71f27.tar.zst +0 -0
- package/.turbo/cache/d3063ef43811b1e5-meta.json +1 -0
- package/.turbo/cache/d3063ef43811b1e5.tar.zst +0 -0
- package/.turbo/cache/de28892eb7678e65-meta.json +1 -0
- package/.turbo/cache/de28892eb7678e65.tar.zst +0 -0
- package/.turbo/cache/ec29adce408132ba-meta.json +1 -0
- package/.turbo/cache/ec29adce408132ba.tar.zst +0 -0
- package/.turbo/cache/f70450d8d305f172-meta.json +1 -0
- package/.turbo/cache/f70450d8d305f172.tar.zst +0 -0
- package/.turbo/cache/fe384d5d6b7a983a-meta.json +1 -0
- package/.turbo/cache/fe384d5d6b7a983a.tar.zst +0 -0
- package/ARCHITECTURE.md +10 -10
- package/CHANGELOG.md +38 -0
- package/LICENSE +185 -17
- package/README.md +43 -5
- package/SESSION_HANDOFF.md +67 -0
- package/bin/relay-pty +0 -0
- package/bin/relay-pty-darwin-arm64 +0 -0
- package/bin/relay-pty-darwin-x64 +0 -0
- package/bin/relay-pty-linux-x64 +0 -0
- package/deploy/workspace/entrypoint.sh +79 -11
- package/deploy/workspace/git-credential-relay +152 -27
- package/deploy/workspace/git-credential-relay.test.sh +230 -0
- package/dist/dashboard/out/404.html +1 -1
- package/dist/dashboard/out/_next/static/chunks/116-a883fca163f3a5bc.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/320-900169c942e31422.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/631-af51bad94027527a.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/766-2aea80818f7eb0d8.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/891-5cb1513eeb97a891.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/app/page-2e525b1dcc790967.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/page-4e64923d73c35bc9.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/providers/page-e65a0010da6ea5be.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/providers/setup/[provider]/page-84161c802b020a1f.js +1 -0
- package/dist/dashboard/out/_next/static/css/99c2552394077586.css +1 -0
- 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 +2 -2
- package/dist/dashboard/out/cloud/link.html +1 -1
- package/dist/dashboard/out/cloud/link.txt +2 -2
- 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 +2 -2
- package/dist/dashboard/out/index.html +1 -1
- package/dist/dashboard/out/index.txt +2 -2
- package/dist/dashboard/out/login.html +2 -2
- package/dist/dashboard/out/login.txt +1 -1
- 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/setup/claude.html +1 -1
- package/dist/dashboard/out/providers/setup/claude.txt +2 -2
- package/dist/dashboard/out/providers/setup/codex.html +1 -1
- package/dist/dashboard/out/providers/setup/codex.txt +2 -2
- package/dist/dashboard/out/providers/setup/cursor.html +1 -0
- package/dist/dashboard/out/providers/setup/cursor.txt +8 -0
- package/dist/dashboard/out/providers.html +1 -1
- package/dist/dashboard/out/providers.txt +2 -2
- package/dist/dashboard/out/signup.html +2 -2
- package/dist/dashboard/out/signup.txt +1 -1
- package/dist/src/bridge/index.d.ts +8 -0
- package/dist/src/bridge/index.js +8 -0
- package/dist/src/cli/index.js +3089 -0
- package/dist/src/cloud/index.d.ts +8 -0
- package/dist/src/cloud/index.js +8 -0
- package/dist/src/config/relay-config.d.ts +5 -0
- package/dist/src/config/relay-config.js +5 -0
- package/dist/src/continuity/index.d.ts +5 -0
- package/dist/src/continuity/index.js +5 -0
- package/dist/src/daemon/index.d.ts +8 -0
- package/dist/src/daemon/index.js +9 -0
- package/dist/src/dashboard-server/index.d.ts +8 -0
- package/dist/src/dashboard-server/index.js +8 -0
- package/dist/src/hooks/index.d.ts +10 -0
- package/dist/src/hooks/index.js +10 -0
- package/dist/src/index.d.ts +13 -0
- package/dist/src/index.js +16 -0
- package/dist/src/memory/index.d.ts +5 -0
- package/dist/src/memory/index.js +5 -0
- package/dist/src/policy/index.d.ts +5 -0
- package/dist/src/policy/index.js +5 -0
- package/dist/src/protocol/index.d.ts +8 -0
- package/dist/src/protocol/index.js +8 -0
- package/dist/src/resiliency/index.d.ts +5 -0
- package/dist/src/resiliency/index.js +5 -0
- package/dist/src/shared/cli-auth-config.d.ts +5 -0
- package/dist/src/shared/cli-auth-config.js +5 -0
- package/dist/src/state/index.d.ts +5 -0
- package/dist/src/state/index.js +5 -0
- package/dist/src/storage/index.d.ts +8 -0
- package/dist/src/storage/index.js +8 -0
- package/dist/src/trajectory/index.d.ts +5 -0
- package/dist/src/trajectory/index.js +5 -0
- package/dist/src/utils/index.d.ts +5 -0
- package/dist/src/utils/index.js +5 -0
- package/dist/src/wrapper/index.d.ts +8 -0
- package/dist/src/wrapper/index.js +11 -0
- package/package.json +65 -19
- package/packages/api-types/dist/index.d.ts +21 -0
- package/packages/api-types/dist/index.js +22 -0
- package/packages/api-types/dist/schemas/agent.d.ts +259 -0
- package/packages/api-types/dist/schemas/agent.js +102 -0
- package/packages/api-types/dist/schemas/api.d.ts +290 -0
- package/packages/api-types/dist/schemas/api.js +162 -0
- package/packages/api-types/dist/schemas/decision.d.ts +230 -0
- package/packages/api-types/dist/schemas/decision.js +104 -0
- package/packages/api-types/dist/schemas/fleet.d.ts +615 -0
- package/packages/api-types/dist/schemas/fleet.js +71 -0
- package/packages/api-types/dist/schemas/history.d.ts +180 -0
- package/packages/api-types/dist/schemas/history.js +72 -0
- package/packages/api-types/dist/schemas/index.d.ts +14 -0
- package/packages/api-types/dist/schemas/index.js +22 -0
- package/packages/api-types/dist/schemas/message.d.ts +456 -0
- package/packages/api-types/dist/schemas/message.js +88 -0
- package/packages/api-types/dist/schemas/session.d.ts +60 -0
- package/packages/api-types/dist/schemas/session.js +36 -0
- package/packages/api-types/dist/schemas/task.d.ts +111 -0
- package/packages/api-types/dist/schemas/task.js +64 -0
- package/packages/api-types/package.json +61 -0
- package/packages/api-types/scripts/generate-openapi.ts +106 -0
- package/packages/bridge/dist/index.d.ts +8 -0
- package/packages/bridge/dist/index.js +9 -0
- package/packages/bridge/dist/multi-project-client.d.ts +99 -0
- package/packages/bridge/dist/multi-project-client.js +389 -0
- package/packages/bridge/dist/shadow-cli.js +75 -0
- package/packages/bridge/dist/spawner.d.ts +210 -0
- package/packages/bridge/dist/spawner.js +1276 -0
- package/packages/bridge/dist/types.d.ts +131 -0
- package/packages/bridge/dist/utils.d.ts +15 -0
- package/packages/bridge/dist/utils.js +60 -0
- package/packages/bridge/package.json +40 -0
- package/packages/cloud/dist/api/admin.js +225 -0
- package/packages/cloud/dist/api/billing.js +564 -0
- package/packages/cloud/dist/api/cli-pty-runner.d.ts +53 -0
- package/packages/cloud/dist/api/cli-pty-runner.js +193 -0
- package/packages/cloud/dist/api/codex-auth-helper.js +327 -0
- package/packages/cloud/dist/api/consensus.js +261 -0
- package/packages/cloud/dist/api/coordinators.js +750 -0
- package/packages/cloud/dist/api/daemons.js +535 -0
- package/packages/cloud/dist/api/generic-webhooks.js +129 -0
- package/packages/cloud/dist/api/github-app.js +223 -0
- package/packages/cloud/dist/api/monitoring.js +578 -0
- package/packages/cloud/dist/api/nango-auth.js +674 -0
- package/packages/cloud/dist/api/onboarding.d.ts +15 -0
- package/packages/cloud/dist/api/onboarding.js +679 -0
- package/packages/cloud/dist/api/policy.js +229 -0
- package/packages/cloud/dist/api/provider-env.d.ts +14 -0
- package/packages/cloud/dist/api/provider-env.js +75 -0
- package/packages/cloud/dist/api/providers.js +564 -0
- package/packages/cloud/dist/api/repos.js +577 -0
- package/packages/cloud/dist/api/sessions.d.ts +11 -0
- package/packages/cloud/dist/api/sessions.js +302 -0
- package/packages/cloud/dist/api/teams.js +281 -0
- package/packages/cloud/dist/api/test-helpers.js +745 -0
- package/packages/cloud/dist/api/workspaces.js +1799 -0
- package/packages/cloud/dist/billing/plans.js +245 -0
- package/packages/cloud/dist/config.d.ts +5 -0
- package/packages/cloud/dist/config.js +5 -0
- package/packages/cloud/dist/db/drizzle.d.ts +256 -0
- package/packages/cloud/dist/db/drizzle.js +1286 -0
- package/packages/cloud/dist/db/schema.d.ts +4873 -0
- package/packages/cloud/dist/db/schema.js +620 -0
- package/packages/cloud/dist/index.d.ts +11 -0
- package/packages/cloud/dist/index.js +38 -0
- package/packages/cloud/dist/provisioner/index.d.ts +207 -0
- package/packages/cloud/dist/provisioner/index.js +2114 -0
- package/packages/cloud/dist/server.js +1924 -0
- package/packages/cloud/dist/services/index.d.ts +17 -0
- package/packages/cloud/dist/services/index.js +25 -0
- package/packages/cloud/dist/services/intro-expiration.d.ts +60 -0
- package/packages/cloud/dist/services/intro-expiration.js +252 -0
- package/packages/cloud/dist/services/nango.d.ts +201 -0
- package/packages/cloud/dist/services/nango.js +392 -0
- package/packages/cloud/dist/services/persistence.d.ts +131 -0
- package/packages/cloud/dist/shims/consensus.d.ts +23 -0
- package/packages/cloud/dist/shims/consensus.js +5 -0
- package/packages/cloud/package.json +55 -0
- package/packages/config/dist/bridge-config.d.ts +52 -0
- package/packages/config/dist/bridge-config.js +143 -0
- package/packages/config/dist/bridge-utils.d.ts +30 -0
- package/packages/config/dist/bridge-utils.js +54 -0
- package/packages/config/dist/cli-auth-config.js +391 -0
- package/packages/config/dist/cloud-config.d.ts +75 -0
- package/packages/config/dist/cloud-config.js +109 -0
- package/packages/config/dist/index.d.ts +13 -0
- package/packages/config/dist/index.js +13 -0
- package/packages/config/dist/project-namespace.d.ts +73 -0
- package/packages/config/dist/project-namespace.js +280 -0
- package/packages/config/dist/relay-config.d.ts +25 -0
- package/packages/config/dist/relay-config.js +25 -0
- package/packages/config/dist/relay-file-writer.d.ts +200 -0
- package/packages/config/dist/relay-file-writer.js +407 -0
- package/packages/config/dist/schemas.d.ts +672 -0
- package/packages/config/dist/schemas.js +180 -0
- package/packages/config/dist/shadow-config.d.ts +87 -0
- package/packages/config/dist/trajectory-config.d.ts +102 -0
- package/packages/config/dist/trajectory-config.js +185 -0
- package/packages/config/package.json +98 -0
- package/packages/continuity/dist/index.d.ts +9 -0
- package/packages/continuity/dist/index.js +9 -0
- package/packages/continuity/dist/types.d.ts +180 -0
- package/packages/continuity/dist/types.js +2 -0
- package/packages/continuity/package.json +32 -0
- package/packages/daemon/dist/agent-manager.d.ts +134 -0
- package/packages/daemon/dist/agent-manager.js +578 -0
- package/packages/daemon/dist/agent-registry.js +213 -0
- package/packages/daemon/dist/api.d.ts +106 -0
- package/packages/daemon/dist/api.js +876 -0
- package/packages/daemon/dist/channel-membership-store.d.ts +55 -0
- package/packages/daemon/dist/channel-membership-store.js +176 -0
- package/packages/daemon/dist/cli-auth.d.ts +89 -0
- package/packages/daemon/dist/cli-auth.js +792 -0
- package/packages/daemon/dist/cloud-sync.d.ts +150 -0
- package/packages/daemon/dist/cloud-sync.js +446 -0
- package/packages/daemon/dist/connection.d.ts +130 -0
- package/packages/daemon/dist/connection.js +438 -0
- package/packages/daemon/dist/consensus-integration.js +371 -0
- package/packages/daemon/dist/delivery-tracker.d.ts +34 -0
- package/packages/daemon/dist/delivery-tracker.js +104 -0
- package/packages/daemon/dist/enhanced-features.d.ts +118 -0
- package/packages/daemon/dist/enhanced-features.js +176 -0
- package/packages/daemon/dist/index.d.ts +31 -0
- package/packages/daemon/dist/index.js +37 -0
- package/packages/daemon/dist/migrations/index.d.ts +73 -0
- package/packages/daemon/dist/migrations/index.js +241 -0
- package/packages/daemon/dist/orchestrator.d.ts +217 -0
- package/packages/daemon/dist/orchestrator.js +1143 -0
- package/packages/daemon/dist/relay-ledger.d.ts +261 -0
- package/packages/daemon/dist/relay-ledger.js +532 -0
- package/packages/daemon/dist/relay-watchdog.d.ts +125 -0
- package/packages/daemon/dist/relay-watchdog.js +611 -0
- package/packages/daemon/dist/repo-manager.js +384 -0
- package/packages/daemon/dist/router.d.ts +370 -0
- package/packages/daemon/dist/router.js +1437 -0
- package/packages/daemon/dist/server.d.ts +174 -0
- package/packages/daemon/dist/server.js +1001 -0
- package/packages/daemon/dist/spawn-manager.d.ts +78 -0
- package/packages/daemon/dist/spawn-manager.js +165 -0
- package/packages/daemon/dist/sync-queue.d.ts +116 -0
- package/packages/daemon/dist/sync-queue.js +361 -0
- package/packages/daemon/dist/types.d.ts +133 -0
- package/packages/daemon/dist/workspace-manager.js +314 -0
- package/packages/daemon/package.json +52 -0
- package/packages/dashboard/README.md +48 -0
- package/packages/dashboard/dist/health-worker-manager.d.ts +62 -0
- package/packages/dashboard/dist/health-worker-manager.js +144 -0
- package/packages/dashboard/dist/health-worker.d.ts +9 -0
- package/packages/dashboard/dist/health-worker.js +79 -0
- package/packages/dashboard/dist/index.d.ts +20 -0
- package/packages/dashboard/dist/index.js +19 -0
- package/packages/dashboard/dist/metrics.d.ts +105 -0
- package/packages/dashboard/dist/metrics.js +193 -0
- package/packages/dashboard/dist/needs-attention.d.ts +24 -0
- package/packages/dashboard/dist/needs-attention.js +78 -0
- package/packages/dashboard/dist/server.d.ts +25 -0
- package/packages/dashboard/dist/server.js +5107 -0
- package/packages/dashboard/dist/start.d.ts +6 -0
- package/packages/dashboard/dist/start.js +13 -0
- package/packages/dashboard/dist/types/threading.d.ts +8 -0
- package/packages/dashboard/dist/types/threading.js +2 -0
- package/packages/dashboard/dist/user-bridge.d.ts +154 -0
- package/packages/dashboard/dist/user-bridge.js +372 -0
- package/packages/dashboard/package.json +72 -0
- package/packages/dashboard/ui/.next/BUILD_ID +1 -0
- package/packages/dashboard/ui/.next/app-build-manifest.json +135 -0
- package/packages/dashboard/ui/.next/app-path-routes-manifest.json +1 -0
- package/packages/dashboard/ui/.next/build-manifest.json +32 -0
- package/packages/dashboard/ui/.next/cache/config.json +7 -0
- package/packages/dashboard/ui/.next/cache/eslint/.cache_1asv1h5 +1 -0
- 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 +1 -0
- package/packages/dashboard/ui/.next/export-marker.json +1 -0
- package/packages/dashboard/ui/.next/images-manifest.json +1 -0
- package/packages/dashboard/ui/.next/next-minimal-server.js.nft.json +1 -0
- package/packages/dashboard/ui/.next/next-server.js.nft.json +1 -0
- package/packages/dashboard/ui/.next/package.json +1 -0
- package/packages/dashboard/ui/.next/prerender-manifest.json +1 -0
- package/packages/dashboard/ui/.next/react-loadable-manifest.json +1970 -0
- package/packages/dashboard/ui/.next/required-server-files.json +1 -0
- package/packages/dashboard/ui/.next/routes-manifest.json +1 -0
- package/packages/dashboard/ui/.next/server/app/_not-found/page.js +1 -0
- package/packages/dashboard/ui/.next/server/app/_not-found/page.js.nft.json +1 -0
- package/packages/dashboard/ui/.next/server/app/_not-found/page_client-reference-manifest.js +1 -0
- package/packages/dashboard/ui/.next/server/app/_not-found.html +1 -0
- package/packages/dashboard/ui/.next/server/app/_not-found.meta +6 -0
- package/packages/dashboard/ui/.next/server/app/_not-found.rsc +9 -0
- package/packages/dashboard/ui/.next/server/app/app/onboarding/page.js +6 -0
- package/packages/dashboard/ui/.next/server/app/app/onboarding/page.js.nft.json +1 -0
- package/packages/dashboard/ui/.next/server/app/app/onboarding/page_client-reference-manifest.js +1 -0
- package/packages/dashboard/ui/.next/server/app/app/onboarding.html +1 -0
- package/packages/dashboard/ui/.next/server/app/app/onboarding.meta +5 -0
- package/packages/dashboard/ui/.next/server/app/app/onboarding.rsc +7 -0
- package/packages/dashboard/ui/.next/server/app/app/page.js +436 -0
- package/packages/dashboard/ui/.next/server/app/app/page.js.nft.json +1 -0
- package/packages/dashboard/ui/.next/server/app/app/page_client-reference-manifest.js +1 -0
- package/packages/dashboard/ui/.next/server/app/app.html +1 -0
- package/packages/dashboard/ui/.next/server/app/app.meta +5 -0
- package/packages/dashboard/ui/.next/server/app/app.rsc +7 -0
- package/packages/dashboard/ui/.next/server/app/apple-icon.png/route.js +12 -0
- package/packages/dashboard/ui/.next/server/app/apple-icon.png/route.js.nft.json +1 -0
- package/packages/dashboard/ui/.next/server/app/apple-icon.png.body +0 -0
- package/packages/dashboard/ui/.next/server/app/apple-icon.png.meta +1 -0
- package/packages/dashboard/ui/.next/server/app/cloud/link/page.js +1 -0
- package/packages/dashboard/ui/.next/server/app/cloud/link/page.js.nft.json +1 -0
- package/packages/dashboard/ui/.next/server/app/cloud/link/page_client-reference-manifest.js +1 -0
- package/packages/dashboard/ui/.next/server/app/cloud/link.html +1 -0
- package/packages/dashboard/ui/.next/server/app/cloud/link.meta +5 -0
- package/packages/dashboard/ui/.next/server/app/cloud/link.rsc +7 -0
- package/packages/dashboard/ui/.next/server/app/connect-repos/page.js +6 -0
- package/packages/dashboard/ui/.next/server/app/connect-repos/page.js.nft.json +1 -0
- package/packages/dashboard/ui/.next/server/app/connect-repos/page_client-reference-manifest.js +1 -0
- package/packages/dashboard/ui/.next/server/app/connect-repos.html +1 -0
- package/packages/dashboard/ui/.next/server/app/connect-repos.meta +5 -0
- package/packages/dashboard/ui/.next/server/app/connect-repos.rsc +7 -0
- package/packages/dashboard/ui/.next/server/app/history/page.js +1 -0
- package/packages/dashboard/ui/.next/server/app/history/page.js.nft.json +1 -0
- package/packages/dashboard/ui/.next/server/app/history/page_client-reference-manifest.js +1 -0
- package/packages/dashboard/ui/.next/server/app/history.html +1 -0
- package/packages/dashboard/ui/.next/server/app/history.meta +5 -0
- package/packages/dashboard/ui/.next/server/app/history.rsc +7 -0
- package/packages/dashboard/ui/.next/server/app/index.html +1 -0
- package/packages/dashboard/ui/.next/server/app/index.meta +5 -0
- package/packages/dashboard/ui/.next/server/app/index.rsc +7 -0
- package/packages/dashboard/ui/.next/server/app/login/page.js +6 -0
- package/packages/dashboard/ui/.next/server/app/login/page.js.nft.json +1 -0
- package/packages/dashboard/ui/.next/server/app/login/page_client-reference-manifest.js +1 -0
- package/packages/dashboard/ui/.next/server/app/login.html +5 -0
- package/packages/dashboard/ui/.next/server/app/login.meta +5 -0
- package/packages/dashboard/ui/.next/server/app/login.rsc +7 -0
- package/packages/dashboard/ui/.next/server/app/metrics/page.js +1 -0
- package/packages/dashboard/ui/.next/server/app/metrics/page.js.nft.json +1 -0
- package/packages/dashboard/ui/.next/server/app/metrics/page_client-reference-manifest.js +1 -0
- package/packages/dashboard/ui/.next/server/app/metrics.html +1 -0
- package/packages/dashboard/ui/.next/server/app/metrics.meta +5 -0
- package/packages/dashboard/ui/.next/server/app/metrics.rsc +7 -0
- package/packages/dashboard/ui/.next/server/app/page.js +1 -0
- package/packages/dashboard/ui/.next/server/app/page.js.nft.json +1 -0
- package/packages/dashboard/ui/.next/server/app/page_client-reference-manifest.js +1 -0
- package/packages/dashboard/ui/.next/server/app/pricing/page.js +5 -0
- package/packages/dashboard/ui/.next/server/app/pricing/page.js.nft.json +1 -0
- package/packages/dashboard/ui/.next/server/app/pricing/page_client-reference-manifest.js +1 -0
- package/packages/dashboard/ui/.next/server/app/pricing.html +13 -0
- package/packages/dashboard/ui/.next/server/app/pricing.meta +5 -0
- package/packages/dashboard/ui/.next/server/app/pricing.rsc +7 -0
- package/packages/dashboard/ui/.next/server/app/providers/page.js +2 -0
- package/packages/dashboard/ui/.next/server/app/providers/page.js.nft.json +1 -0
- package/packages/dashboard/ui/.next/server/app/providers/page_client-reference-manifest.js +1 -0
- package/packages/dashboard/ui/.next/server/app/providers/setup/[provider]/page.js +1 -0
- package/packages/dashboard/ui/.next/server/app/providers/setup/[provider]/page.js.nft.json +1 -0
- package/packages/dashboard/ui/.next/server/app/providers/setup/[provider]/page_client-reference-manifest.js +1 -0
- package/packages/dashboard/ui/.next/server/app/providers/setup/claude.html +1 -0
- package/packages/dashboard/ui/.next/server/app/providers/setup/claude.meta +5 -0
- package/packages/dashboard/ui/.next/server/app/providers/setup/claude.rsc +8 -0
- package/packages/dashboard/ui/.next/server/app/providers/setup/codex.html +1 -0
- package/packages/dashboard/ui/.next/server/app/providers/setup/codex.meta +5 -0
- package/packages/dashboard/ui/.next/server/app/providers/setup/codex.rsc +8 -0
- package/packages/dashboard/ui/.next/server/app/providers/setup/cursor.html +1 -0
- package/packages/dashboard/ui/.next/server/app/providers/setup/cursor.meta +5 -0
- package/packages/dashboard/ui/.next/server/app/providers/setup/cursor.rsc +8 -0
- package/packages/dashboard/ui/.next/server/app/providers.html +1 -0
- package/packages/dashboard/ui/.next/server/app/providers.meta +5 -0
- package/packages/dashboard/ui/.next/server/app/providers.rsc +7 -0
- package/packages/dashboard/ui/.next/server/app/signup/page.js +6 -0
- package/packages/dashboard/ui/.next/server/app/signup/page.js.nft.json +1 -0
- package/packages/dashboard/ui/.next/server/app/signup/page_client-reference-manifest.js +1 -0
- package/packages/dashboard/ui/.next/server/app/signup.html +6 -0
- package/packages/dashboard/ui/.next/server/app/signup.meta +5 -0
- package/packages/dashboard/ui/.next/server/app/signup.rsc +7 -0
- package/packages/dashboard/ui/.next/server/app-paths-manifest.json +16 -0
- package/packages/dashboard/ui/.next/server/chunks/190.js +1 -0
- package/packages/dashboard/ui/.next/server/chunks/205.js +1 -0
- package/packages/dashboard/ui/.next/server/chunks/251.js +9 -0
- package/packages/dashboard/ui/.next/server/chunks/288.js +1 -0
- package/packages/dashboard/ui/.next/server/chunks/434.js +1 -0
- package/packages/dashboard/ui/.next/server/chunks/471.js +2 -0
- package/packages/dashboard/ui/.next/server/chunks/621.js +1 -0
- package/packages/dashboard/ui/.next/server/chunks/680.js +5 -0
- package/packages/dashboard/ui/.next/server/chunks/682.js +6 -0
- package/packages/dashboard/ui/.next/server/chunks/684.js +1 -0
- package/packages/dashboard/ui/.next/server/chunks/71.js +196 -0
- package/packages/dashboard/ui/.next/server/chunks/711.js +1 -0
- package/packages/dashboard/ui/.next/server/chunks/90.js +17 -0
- package/packages/dashboard/ui/.next/server/chunks/948.js +2 -0
- package/packages/dashboard/ui/.next/server/chunks/font-manifest.json +1 -0
- package/packages/dashboard/ui/.next/server/font-manifest.json +1 -0
- package/packages/dashboard/ui/.next/server/functions-config-manifest.json +1 -0
- package/packages/dashboard/ui/.next/server/interception-route-rewrite-manifest.js +1 -0
- package/packages/dashboard/ui/.next/server/middleware-build-manifest.js +1 -0
- package/packages/dashboard/ui/.next/server/middleware-manifest.json +6 -0
- package/packages/dashboard/ui/.next/server/middleware-react-loadable-manifest.js +1 -0
- package/packages/dashboard/ui/.next/server/next-font-manifest.js +1 -0
- package/packages/dashboard/ui/.next/server/next-font-manifest.json +1 -0
- package/packages/dashboard/ui/.next/server/pages/404.html +1 -0
- package/packages/dashboard/ui/.next/server/pages/500.html +1 -0
- package/packages/dashboard/ui/.next/server/pages/_app.js +1 -0
- package/packages/dashboard/ui/.next/server/pages/_app.js.nft.json +1 -0
- package/packages/dashboard/ui/.next/server/pages/_document.js +1 -0
- package/packages/dashboard/ui/.next/server/pages/_document.js.nft.json +1 -0
- package/packages/dashboard/ui/.next/server/pages/_error.js +1 -0
- package/packages/dashboard/ui/.next/server/pages/_error.js.nft.json +1 -0
- package/packages/dashboard/ui/.next/server/pages-manifest.json +1 -0
- package/packages/dashboard/ui/.next/server/server-reference-manifest.js +1 -0
- package/packages/dashboard/ui/.next/server/server-reference-manifest.json +1 -0
- package/packages/dashboard/ui/.next/server/webpack-runtime.js +1 -0
- package/packages/dashboard/ui/.next/static/HR7W9z1PPVPFqUboUVZFZ/_buildManifest.js +1 -0
- package/packages/dashboard/ui/.next/static/HR7W9z1PPVPFqUboUVZFZ/_ssgManifest.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/116-a883fca163f3a5bc.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/117-c8afed19e821a35d.js +2 -0
- package/packages/dashboard/ui/.next/static/chunks/282-980c2eb8fff20123.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/532-bace199897eeab37.js +9 -0
- package/packages/dashboard/ui/.next/static/chunks/631-af51bad94027527a.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/648-acb2ff9f77cbfbd3.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/677-30e60cb0b47875b6.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/766-2aea80818f7eb0d8.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/83-4f08122d4e7e79a6.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/847-f1f467060f32afff.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/891-5cb1513eeb97a891.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/app/_not-found/page-60501fddbafba9dc.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/app/app/onboarding/page-9914652442f7e4fb.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/app/app/page-44813aa26ad19681.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/app/cloud/link/page-fa1d5842aa90e8a6.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/app/connect-repos/page-113060009ef35bc2.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/app/history/page-9965d2483011b846.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/app/layout-6b91e33784c20610.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/app/login/page-a0ca6f7ca6a100b8.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/app/metrics/page-1e37ef8e73940b40.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/app/page-7993778218818ace.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/app/pricing/page-9db3ebdfa567a7c9.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/app/providers/page-bcf46064ac4474ce.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/app/providers/setup/[provider]/page-4dbe33f0f7691b7c.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/app/signup/page-1ede2205b58649ca.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/e868780c-48e5f147c90a3a41.js +18 -0
- package/packages/dashboard/ui/.next/static/chunks/fd9d1056-609918ca7b6280bb.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/framework-f66176bb897dc684.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/main-5a40a5ae29646e1b.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/main-app-fdbeb09028f57c9f.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/pages/_app-72b849fbd24ac258.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/pages/_error-7ba65e1336b92748.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
- package/packages/dashboard/ui/.next/static/chunks/webpack-1cdd8ed57114d5e1.js +1 -0
- package/packages/dashboard/ui/.next/static/css/4034f236dd1a3178.css +1 -0
- package/packages/dashboard/ui/.next/static/css/99c2552394077586.css +1 -0
- package/packages/dashboard/ui/.next/trace +63 -0
- package/packages/dashboard/ui/.next/types/app/app/onboarding/page.ts +79 -0
- package/packages/dashboard/ui/.next/types/app/app/page.ts +79 -0
- package/packages/dashboard/ui/.next/types/app/cloud/link/page.ts +79 -0
- package/packages/dashboard/ui/.next/types/app/connect-repos/page.ts +79 -0
- package/packages/dashboard/ui/.next/types/app/history/page.ts +79 -0
- package/packages/dashboard/ui/.next/types/app/layout.ts +79 -0
- package/packages/dashboard/ui/.next/types/app/login/page.ts +79 -0
- package/packages/dashboard/ui/.next/types/app/metrics/page.ts +79 -0
- package/packages/dashboard/ui/.next/types/app/page.ts +79 -0
- package/packages/dashboard/ui/.next/types/app/pricing/page.ts +79 -0
- package/packages/dashboard/ui/.next/types/app/providers/page.ts +79 -0
- package/packages/dashboard/ui/.next/types/app/providers/setup/[provider]/page.ts +79 -0
- package/packages/dashboard/ui/.next/types/app/signup/page.ts +79 -0
- package/packages/dashboard/ui/.next/types/package.json +1 -0
- package/packages/dashboard/ui/app/app/onboarding/page.tsx +394 -0
- package/packages/dashboard/ui/app/app/page.tsx +667 -0
- package/packages/dashboard/ui/app/apple-icon.png +0 -0
- package/packages/dashboard/ui/app/cloud/link/page.tsx +464 -0
- package/packages/dashboard/ui/app/connect-repos/page.tsx +410 -0
- package/packages/dashboard/ui/app/favicon.png +0 -0
- package/packages/dashboard/ui/app/globals.css +59 -0
- package/packages/dashboard/ui/app/history/page.tsx +658 -0
- package/packages/dashboard/ui/app/layout.tsx +25 -0
- package/packages/dashboard/ui/app/login/page.tsx +280 -0
- package/packages/dashboard/ui/app/metrics/page.tsx +751 -0
- package/packages/dashboard/ui/app/page.tsx +59 -0
- package/packages/dashboard/ui/app/pricing/page.tsx +7 -0
- package/packages/dashboard/ui/app/providers/page.tsx +193 -0
- package/packages/dashboard/ui/app/providers/setup/[provider]/ProviderSetupClient.tsx +148 -0
- package/packages/dashboard/ui/app/providers/setup/[provider]/constants.ts +35 -0
- package/packages/dashboard/ui/app/providers/setup/[provider]/page.tsx +42 -0
- package/packages/dashboard/ui/app/signup/page.tsx +343 -0
- package/packages/dashboard/ui/index.ts +49 -0
- package/packages/dashboard/ui/landing/LandingPage.tsx +713 -0
- package/packages/dashboard/ui/landing/PricingPage.tsx +559 -0
- package/packages/dashboard/ui/landing/index.ts +6 -0
- package/packages/dashboard/ui/landing/styles.css +2850 -0
- package/packages/dashboard/ui/lib/agent-merge.ts +35 -0
- package/packages/dashboard/ui/lib/api.ts +1155 -0
- package/packages/dashboard/ui/lib/cloudApi.ts +876 -0
- package/packages/dashboard/ui/lib/colors.ts +218 -0
- package/packages/dashboard/ui/lib/hierarchy.ts +242 -0
- package/packages/dashboard/ui/lib/stuckDetection.ts +142 -0
- package/packages/dashboard/ui/next-env.d.ts +5 -0
- package/packages/dashboard/ui/next.config.js +41 -0
- package/packages/dashboard/ui/package-lock.json +2882 -0
- package/packages/dashboard/ui/package.json +33 -0
- package/packages/dashboard/ui/postcss.config.js +5 -0
- package/packages/dashboard/ui/react-components/ActivityFeed.tsx +216 -0
- package/packages/dashboard/ui/react-components/AddWorkspaceModal.tsx +170 -0
- package/packages/dashboard/ui/react-components/AgentCard.tsx +587 -0
- package/packages/dashboard/ui/react-components/AgentList.tsx +411 -0
- package/packages/dashboard/ui/react-components/AgentProfilePanel.tsx +564 -0
- package/packages/dashboard/ui/react-components/App.tsx +3447 -0
- package/packages/dashboard/ui/react-components/BillingPanel.tsx +922 -0
- package/packages/dashboard/ui/react-components/BillingResult.tsx +447 -0
- package/packages/dashboard/ui/react-components/BroadcastComposer.tsx +690 -0
- package/packages/dashboard/ui/react-components/ChannelAdminPanel.tsx +773 -0
- package/packages/dashboard/ui/react-components/ChannelBrowser.tsx +385 -0
- package/packages/dashboard/ui/react-components/ChannelChat.tsx +307 -0
- package/packages/dashboard/ui/react-components/ChannelSidebar.tsx +399 -0
- package/packages/dashboard/ui/react-components/CloudSessionProvider.tsx +130 -0
- package/packages/dashboard/ui/react-components/CommandPalette.tsx +815 -0
- package/packages/dashboard/ui/react-components/ConfirmationDialog.tsx +133 -0
- package/packages/dashboard/ui/react-components/ConversationHistory.tsx +518 -0
- package/packages/dashboard/ui/react-components/CoordinatorPanel.tsx +944 -0
- package/packages/dashboard/ui/react-components/DecisionQueue.tsx +717 -0
- package/packages/dashboard/ui/react-components/DirectMessageView.tsx +164 -0
- package/packages/dashboard/ui/react-components/FileAutocomplete.tsx +368 -0
- package/packages/dashboard/ui/react-components/FleetOverview.tsx +278 -0
- package/packages/dashboard/ui/react-components/LogViewer.tsx +310 -0
- package/packages/dashboard/ui/react-components/LogViewerPanel.tsx +482 -0
- package/packages/dashboard/ui/react-components/Logo.tsx +284 -0
- package/packages/dashboard/ui/react-components/MentionAutocomplete.tsx +384 -0
- package/packages/dashboard/ui/react-components/MessageList.tsx +649 -0
- package/packages/dashboard/ui/react-components/MessageSenderName.tsx +91 -0
- package/packages/dashboard/ui/react-components/MessageStatusIndicator.tsx +142 -0
- package/packages/dashboard/ui/react-components/NewConversationModal.tsx +400 -0
- package/packages/dashboard/ui/react-components/NotificationToast.tsx +488 -0
- package/packages/dashboard/ui/react-components/OnlineUsersIndicator.tsx +164 -0
- package/packages/dashboard/ui/react-components/Pagination.tsx +124 -0
- package/packages/dashboard/ui/react-components/PricingPlans.tsx +386 -0
- package/packages/dashboard/ui/react-components/ProjectList.tsx +625 -0
- package/packages/dashboard/ui/react-components/ProviderAuthFlow.tsx +843 -0
- package/packages/dashboard/ui/react-components/ProviderConnectionList.tsx +363 -0
- package/packages/dashboard/ui/react-components/ProvisioningProgress.tsx +730 -0
- package/packages/dashboard/ui/react-components/RepoAccessPanel.tsx +392 -0
- package/packages/dashboard/ui/react-components/ServerCard.tsx +202 -0
- package/packages/dashboard/ui/react-components/SessionExpiredModal.tsx +128 -0
- package/packages/dashboard/ui/react-components/SpawnModal.tsx +704 -0
- package/packages/dashboard/ui/react-components/TaskAssignmentUI.tsx +375 -0
- package/packages/dashboard/ui/react-components/TerminalProviderSetup.tsx +608 -0
- package/packages/dashboard/ui/react-components/ThemeProvider.tsx +325 -0
- package/packages/dashboard/ui/react-components/ThinkingIndicator.tsx +231 -0
- package/packages/dashboard/ui/react-components/ThreadList.tsx +198 -0
- package/packages/dashboard/ui/react-components/ThreadPanel.tsx +346 -0
- package/packages/dashboard/ui/react-components/TrajectoryViewer.tsx +698 -0
- package/packages/dashboard/ui/react-components/TypingIndicator.tsx +69 -0
- package/packages/dashboard/ui/react-components/UsageBanner.tsx +231 -0
- package/packages/dashboard/ui/react-components/UserProfilePanel.tsx +233 -0
- package/packages/dashboard/ui/react-components/WorkspaceContext.tsx +107 -0
- package/packages/dashboard/ui/react-components/WorkspaceSelector.tsx +234 -0
- package/packages/dashboard/ui/react-components/WorkspaceStatusIndicator.tsx +370 -0
- package/packages/dashboard/ui/react-components/XTermInteractive.tsx +510 -0
- package/packages/dashboard/ui/react-components/XTermLogViewer.tsx +719 -0
- package/packages/dashboard/ui/react-components/channels/ChannelDialogs.tsx +1411 -0
- package/packages/dashboard/ui/react-components/channels/ChannelHeader.tsx +317 -0
- package/packages/dashboard/ui/react-components/channels/ChannelMessageList.tsx +463 -0
- package/packages/dashboard/ui/react-components/channels/ChannelViewV1.tsx +146 -0
- package/packages/dashboard/ui/react-components/channels/MessageInput.tsx +288 -0
- package/packages/dashboard/ui/react-components/channels/SearchInput.tsx +172 -0
- package/packages/dashboard/ui/react-components/channels/SearchResults.tsx +336 -0
- package/packages/dashboard/ui/react-components/channels/api.ts +697 -0
- package/packages/dashboard/ui/react-components/channels/index.ts +76 -0
- package/packages/dashboard/ui/react-components/channels/mockApi.ts +344 -0
- package/packages/dashboard/ui/react-components/channels/types.ts +566 -0
- package/packages/dashboard/ui/react-components/hooks/index.ts +57 -0
- package/packages/dashboard/ui/react-components/hooks/useAgentLogs.ts +394 -0
- package/packages/dashboard/ui/react-components/hooks/useAgents.ts +127 -0
- package/packages/dashboard/ui/react-components/hooks/useBroadcastDedup.ts +86 -0
- package/packages/dashboard/ui/react-components/hooks/useChannelAdmin.ts +329 -0
- package/packages/dashboard/ui/react-components/hooks/useChannelBrowser.ts +239 -0
- package/packages/dashboard/ui/react-components/hooks/useChannelCommands.ts +138 -0
- package/packages/dashboard/ui/react-components/hooks/useChannels.ts +328 -0
- package/packages/dashboard/ui/react-components/hooks/useDebounce.ts +29 -0
- package/packages/dashboard/ui/react-components/hooks/useDirectMessage.ts +141 -0
- package/packages/dashboard/ui/react-components/hooks/useMessages.ts +309 -0
- package/packages/dashboard/ui/react-components/hooks/useOrchestrator.ts +364 -0
- package/packages/dashboard/ui/react-components/hooks/usePinnedAgents.ts +140 -0
- package/packages/dashboard/ui/react-components/hooks/usePresence.ts +340 -0
- package/packages/dashboard/ui/react-components/hooks/useRecentRepos.ts +130 -0
- package/packages/dashboard/ui/react-components/hooks/useSession.ts +209 -0
- package/packages/dashboard/ui/react-components/hooks/useTrajectory.ts +265 -0
- package/packages/dashboard/ui/react-components/hooks/useWebSocket.ts +169 -0
- package/packages/dashboard/ui/react-components/hooks/useWorkspaceMembers.ts +120 -0
- package/packages/dashboard/ui/react-components/hooks/useWorkspaceRepos.ts +73 -0
- package/packages/dashboard/ui/react-components/hooks/useWorkspaceStatus.ts +237 -0
- package/packages/dashboard/ui/react-components/index.ts +81 -0
- package/packages/dashboard/ui/react-components/layout/Header.tsx +355 -0
- package/packages/dashboard/ui/react-components/layout/RepoContextHeader.tsx +361 -0
- package/packages/dashboard/ui/react-components/layout/Sidebar.archive.test.tsx +126 -0
- package/packages/dashboard/ui/react-components/layout/Sidebar.test.tsx +691 -0
- package/packages/dashboard/ui/react-components/layout/Sidebar.tsx +930 -0
- package/packages/dashboard/ui/react-components/layout/index.ts +7 -0
- package/packages/dashboard/ui/react-components/settings/BillingSettingsPanel.tsx +564 -0
- package/packages/dashboard/ui/react-components/settings/SettingsPage.tsx +544 -0
- package/packages/dashboard/ui/react-components/settings/TeamSettingsPanel.tsx +560 -0
- package/packages/dashboard/ui/react-components/settings/WorkspaceSettingsPanel.tsx +1329 -0
- package/packages/dashboard/ui/react-components/settings/index.ts +11 -0
- package/packages/dashboard/ui/react-components/settings/types.ts +53 -0
- package/packages/dashboard/ui/react-components/utils/messageFormatting.tsx +370 -0
- package/packages/dashboard/ui/tailwind.config.js +148 -0
- package/packages/dashboard/ui/types/index.ts +304 -0
- package/packages/dashboard/ui/types/threading.ts +7 -0
- package/packages/dashboard/ui-dist/404.html +1 -0
- package/packages/dashboard/ui-dist/_next/static/HR7W9z1PPVPFqUboUVZFZ/_buildManifest.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/HR7W9z1PPVPFqUboUVZFZ/_ssgManifest.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/ZCFjHbkF8yDKS2md3lVgb/_buildManifest.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/ZCFjHbkF8yDKS2md3lVgb/_ssgManifest.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/116-a883fca163f3a5bc.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/117-c8afed19e821a35d.js +2 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/282-980c2eb8fff20123.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/320-900169c942e31422.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/532-bace199897eeab37.js +9 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/631-af51bad94027527a.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/648-acb2ff9f77cbfbd3.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/677-30e60cb0b47875b6.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/766-2aea80818f7eb0d8.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/83-4f08122d4e7e79a6.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/847-f1f467060f32afff.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/891-5cb1513eeb97a891.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/app/_not-found/page-60501fddbafba9dc.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/app/app/onboarding/page-9914652442f7e4fb.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/app/app/onboarding/page-f746f29e01fffc43.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/app/app/page-2e525b1dcc790967.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/app/app/page-44813aa26ad19681.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/app/cloud/link/page-5011ae044b90449d.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/app/cloud/link/page-fa1d5842aa90e8a6.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/app/connect-repos/page-03ac6f35a6654ea6.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/app/connect-repos/page-113060009ef35bc2.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/app/history/page-9965d2483011b846.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/app/history/page-b2ce7c96ed0931da.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/app/layout-6b91e33784c20610.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/app/layout-c0d118c0f92d969c.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/app/login/page-6ec54eee75877971.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/app/login/page-a0ca6f7ca6a100b8.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/app/metrics/page-1e37ef8e73940b40.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/app/metrics/page-bf2cb1e5915bc92d.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/app/page-4e64923d73c35bc9.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/app/page-7993778218818ace.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/app/pricing/page-0efa024c28ba4597.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/app/pricing/page-9db3ebdfa567a7c9.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/app/providers/page-bcf46064ac4474ce.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/app/providers/page-e65a0010da6ea5be.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/app/providers/setup/[provider]/page-4dbe33f0f7691b7c.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/app/providers/setup/[provider]/page-84161c802b020a1f.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/app/signup/page-18a4665665f6be11.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/app/signup/page-1ede2205b58649ca.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/e868780c-48e5f147c90a3a41.js +18 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/fd9d1056-609918ca7b6280bb.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/framework-f66176bb897dc684.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/main-5a40a5ae29646e1b.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/main-app-6e8e8d3ef4e0192a.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/main-app-fdbeb09028f57c9f.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/pages/_app-72b849fbd24ac258.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/pages/_error-7ba65e1336b92748.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/chunks/webpack-1cdd8ed57114d5e1.js +1 -0
- package/packages/dashboard/ui-dist/_next/static/css/4034f236dd1a3178.css +1 -0
- package/packages/dashboard/ui-dist/_next/static/css/99c2552394077586.css +1 -0
- package/packages/dashboard/ui-dist/alt-logos/agent-relay-logo-128.png +0 -0
- package/packages/dashboard/ui-dist/alt-logos/agent-relay-logo-256.png +0 -0
- package/packages/dashboard/ui-dist/alt-logos/agent-relay-logo-32.png +0 -0
- package/packages/dashboard/ui-dist/alt-logos/agent-relay-logo-512.png +0 -0
- package/packages/dashboard/ui-dist/alt-logos/agent-relay-logo-64.png +0 -0
- package/packages/dashboard/ui-dist/alt-logos/agent-relay-logo.svg +45 -0
- package/packages/dashboard/ui-dist/alt-logos/logo.svg +38 -0
- package/packages/dashboard/ui-dist/alt-logos/monogram-logo-128.png +0 -0
- package/packages/dashboard/ui-dist/alt-logos/monogram-logo-256.png +0 -0
- package/packages/dashboard/ui-dist/alt-logos/monogram-logo-32.png +0 -0
- package/packages/dashboard/ui-dist/alt-logos/monogram-logo-512.png +0 -0
- package/packages/dashboard/ui-dist/alt-logos/monogram-logo-64.png +0 -0
- package/packages/dashboard/ui-dist/alt-logos/monogram-logo.svg +38 -0
- package/packages/dashboard/ui-dist/app/onboarding.html +1 -0
- package/packages/dashboard/ui-dist/app/onboarding.txt +7 -0
- package/packages/dashboard/ui-dist/app.html +1 -0
- package/packages/dashboard/ui-dist/app.txt +7 -0
- package/packages/dashboard/ui-dist/apple-icon.png +0 -0
- package/packages/dashboard/ui-dist/cloud/link.html +1 -0
- package/packages/dashboard/ui-dist/cloud/link.txt +7 -0
- package/packages/dashboard/ui-dist/connect-repos.html +1 -0
- package/packages/dashboard/ui-dist/connect-repos.txt +7 -0
- package/packages/dashboard/ui-dist/history.html +1 -0
- package/packages/dashboard/ui-dist/history.txt +7 -0
- package/packages/dashboard/ui-dist/index.html +1 -0
- package/packages/dashboard/ui-dist/index.txt +7 -0
- package/packages/dashboard/ui-dist/login.html +5 -0
- package/packages/dashboard/ui-dist/login.txt +7 -0
- package/packages/dashboard/ui-dist/metrics.html +1 -0
- package/packages/dashboard/ui-dist/metrics.txt +7 -0
- package/packages/dashboard/ui-dist/pricing.html +13 -0
- package/packages/dashboard/ui-dist/pricing.txt +7 -0
- package/packages/dashboard/ui-dist/providers/setup/claude.html +1 -0
- package/packages/dashboard/ui-dist/providers/setup/claude.txt +8 -0
- package/packages/dashboard/ui-dist/providers/setup/codex.html +1 -0
- package/packages/dashboard/ui-dist/providers/setup/codex.txt +8 -0
- package/packages/dashboard/ui-dist/providers/setup/cursor.html +1 -0
- package/packages/dashboard/ui-dist/providers/setup/cursor.txt +8 -0
- package/packages/dashboard/ui-dist/providers.html +1 -0
- package/packages/dashboard/ui-dist/providers.txt +7 -0
- package/packages/dashboard/ui-dist/signup.html +6 -0
- package/packages/dashboard/ui-dist/signup.txt +7 -0
- package/packages/dashboard-server/dist/health-worker-manager.d.ts +62 -0
- package/packages/dashboard-server/dist/health-worker-manager.js +144 -0
- package/packages/dashboard-server/dist/health-worker.d.ts +9 -0
- package/packages/dashboard-server/dist/health-worker.js +79 -0
- package/packages/dashboard-server/dist/index.d.ts +18 -0
- package/packages/dashboard-server/dist/index.js +17 -0
- package/packages/dashboard-server/dist/server.d.ts +25 -0
- package/packages/dashboard-server/dist/server.js +5099 -0
- package/packages/dashboard-server/dist/start.js +13 -0
- package/packages/dashboard-server/dist/types/threading.d.ts +8 -0
- package/packages/dashboard-server/dist/types/threading.js +2 -0
- package/packages/dashboard-server/dist/user-bridge.d.ts +154 -0
- package/packages/dashboard-server/dist/user-bridge.js +372 -0
- package/packages/dashboard-server/package.json +49 -0
- package/packages/hooks/dist/browser.d.ts +2 -0
- package/packages/hooks/dist/browser.js +3 -0
- package/packages/hooks/dist/index.d.ts +11 -0
- package/packages/hooks/dist/index.js +11 -0
- package/packages/hooks/dist/registry.js +476 -0
- package/packages/hooks/dist/trajectory-hooks.js +183 -0
- package/packages/hooks/dist/types.d.ts +285 -0
- package/packages/hooks/dist/types.js +10 -0
- package/packages/hooks/package.json +52 -0
- package/packages/mcp/LICENSE +190 -0
- package/packages/mcp/README.md +214 -0
- package/packages/mcp/SPEC.md +1922 -0
- package/packages/mcp/STAFFING_PLAN.md +294 -0
- package/packages/mcp/dist/bin.d.ts +12 -0
- package/packages/mcp/dist/bin.js +127 -0
- package/packages/mcp/dist/client.d.ts +68 -0
- package/packages/mcp/dist/client.js +115 -0
- package/packages/mcp/dist/cloud.d.ts +108 -0
- package/packages/mcp/dist/cloud.js +279 -0
- package/packages/mcp/dist/errors.d.ts +27 -0
- package/packages/mcp/dist/errors.js +48 -0
- package/packages/mcp/dist/index.d.ts +10 -0
- package/packages/mcp/dist/index.js +16 -0
- package/packages/mcp/dist/install-cli.d.ts +35 -0
- package/packages/mcp/dist/install-cli.js +157 -0
- package/packages/mcp/dist/install.d.ts +101 -0
- package/packages/mcp/dist/install.js +398 -0
- package/packages/mcp/dist/prompts/index.d.ts +2 -0
- package/packages/mcp/dist/prompts/index.js +2 -0
- package/packages/mcp/dist/prompts/protocol.d.ts +11 -0
- package/packages/mcp/dist/prompts/protocol.js +168 -0
- package/packages/mcp/dist/resources/agents.d.ts +11 -0
- package/packages/mcp/dist/resources/agents.js +17 -0
- package/packages/mcp/dist/resources/inbox.d.ts +11 -0
- package/packages/mcp/dist/resources/inbox.js +17 -0
- package/packages/mcp/dist/resources/index.d.ts +4 -0
- package/packages/mcp/dist/resources/index.js +4 -0
- package/packages/mcp/dist/resources/project.d.ts +11 -0
- package/packages/mcp/dist/resources/project.js +21 -0
- package/packages/mcp/dist/server.d.ts +19 -0
- package/packages/mcp/dist/server.js +215 -0
- package/packages/mcp/dist/simple.d.ts +173 -0
- package/packages/mcp/dist/simple.js +120 -0
- package/packages/mcp/dist/tools/index.d.ts +10 -0
- package/packages/mcp/dist/tools/index.js +10 -0
- package/packages/mcp/dist/tools/relay-health.d.ts +23 -0
- package/packages/mcp/dist/tools/relay-health.js +138 -0
- package/packages/mcp/dist/tools/relay-inbox.d.ts +26 -0
- package/packages/mcp/dist/tools/relay-inbox.js +58 -0
- package/packages/mcp/dist/tools/relay-logs.d.ts +20 -0
- package/packages/mcp/dist/tools/relay-logs.js +88 -0
- package/packages/mcp/dist/tools/relay-metrics.d.ts +20 -0
- package/packages/mcp/dist/tools/relay-metrics.js +135 -0
- package/packages/mcp/dist/tools/relay-release.d.ts +20 -0
- package/packages/mcp/dist/tools/relay-release.js +44 -0
- package/packages/mcp/dist/tools/relay-send.d.ts +29 -0
- package/packages/mcp/dist/tools/relay-send.js +71 -0
- package/packages/mcp/dist/tools/relay-spawn.d.ts +36 -0
- package/packages/mcp/dist/tools/relay-spawn.js +73 -0
- package/packages/mcp/dist/tools/relay-status.d.ts +11 -0
- package/packages/mcp/dist/tools/relay-status.js +43 -0
- package/packages/mcp/dist/tools/relay-who.d.ts +20 -0
- package/packages/mcp/dist/tools/relay-who.js +47 -0
- package/packages/mcp/package.json +69 -0
- package/packages/memory/dist/memory-hooks.d.ts +60 -0
- package/packages/memory/package.json +35 -0
- package/packages/policy/dist/agent-policy.js +665 -0
- package/packages/policy/dist/index.d.ts +12 -0
- package/packages/policy/dist/index.js +12 -0
- package/packages/policy/package.json +35 -0
- package/packages/protocol/dist/channels.d.ts +137 -0
- package/packages/protocol/dist/channels.js +154 -0
- package/packages/protocol/dist/framing.d.ts +80 -0
- package/packages/protocol/dist/framing.js +206 -0
- package/packages/protocol/dist/index.d.ts +5 -0
- package/packages/protocol/dist/index.js +5 -0
- package/packages/protocol/dist/relay-pty-schemas.d.ts +258 -0
- package/packages/protocol/dist/types.d.ts +341 -0
- package/packages/protocol/dist/types.js +8 -0
- package/packages/protocol/package.json +56 -0
- package/packages/resiliency/dist/memory-monitor.js +599 -0
- package/packages/resiliency/dist/provider-context.d.ts +100 -0
- package/packages/resiliency/package.json +33 -0
- package/packages/sdk/README.md +171 -0
- package/packages/sdk/dist/client.d.ts +181 -0
- package/packages/sdk/dist/client.js +695 -0
- package/packages/sdk/dist/index.d.ts +32 -0
- package/packages/sdk/dist/index.js +36 -0
- package/packages/sdk/dist/protocol/framing.d.ts +80 -0
- package/packages/sdk/dist/protocol/framing.js +206 -0
- package/packages/sdk/dist/protocol/index.d.ts +6 -0
- package/packages/sdk/dist/protocol/index.js +6 -0
- package/packages/sdk/dist/protocol/types.d.ts +341 -0
- package/packages/sdk/dist/protocol/types.js +8 -0
- package/packages/sdk/dist/standalone.d.ts +87 -0
- package/packages/sdk/dist/standalone.js +126 -0
- package/packages/sdk/package.json +80 -0
- package/packages/spawner/API.md +256 -0
- package/packages/spawner/dist/index.d.ts +8 -0
- package/packages/spawner/dist/index.js +8 -0
- package/packages/spawner/dist/types.d.ts +552 -0
- package/packages/spawner/dist/types.js +193 -0
- package/packages/spawner/package.json +47 -0
- package/packages/state/dist/agent-state.js +120 -0
- package/packages/state/dist/index.d.ts +8 -0
- package/packages/state/dist/index.js +8 -0
- package/packages/state/package.json +32 -0
- package/packages/storage/dist/adapter.d.ts +156 -0
- package/packages/storage/dist/batched-sqlite-adapter.d.ts +75 -0
- package/packages/storage/dist/batched-sqlite-adapter.js +189 -0
- package/packages/storage/dist/index.d.ts +5 -0
- package/packages/storage/dist/index.js +6 -0
- package/packages/storage/dist/sqlite-adapter.d.ts +113 -0
- package/packages/storage/dist/sqlite-adapter.js +752 -0
- package/packages/storage/package.json +69 -0
- package/packages/trajectory/dist/index.d.ts +2 -0
- package/packages/trajectory/dist/index.js +2 -0
- package/packages/trajectory/dist/integration.js +987 -0
- package/packages/trajectory/package.json +35 -0
- package/packages/user-directory/dist/index.d.ts +7 -0
- package/packages/user-directory/dist/index.js +7 -0
- package/packages/user-directory/dist/user-directory.d.ts +121 -0
- package/packages/user-directory/dist/user-directory.js +267 -0
- package/packages/user-directory/package.json +35 -0
- package/packages/utils/dist/command-resolver.js +80 -0
- package/packages/utils/dist/error-tracking.d.ts +103 -0
- package/packages/utils/dist/error-tracking.js +149 -0
- package/packages/utils/dist/index.d.ts +9 -0
- package/packages/utils/dist/index.js +9 -0
- package/packages/utils/dist/model-mapping.d.ts +28 -0
- package/packages/utils/dist/model-mapping.js +55 -0
- package/packages/utils/package.json +75 -0
- package/packages/wrapper/dist/__fixtures__/claude-outputs.d.ts +49 -0
- package/packages/wrapper/dist/__fixtures__/claude-outputs.js +443 -0
- package/packages/wrapper/dist/__fixtures__/codex-outputs.d.ts +9 -0
- package/packages/wrapper/dist/__fixtures__/codex-outputs.js +94 -0
- package/packages/wrapper/dist/__fixtures__/gemini-outputs.d.ts +19 -0
- package/packages/wrapper/dist/__fixtures__/gemini-outputs.js +144 -0
- package/packages/wrapper/dist/__fixtures__/index.d.ts +68 -0
- package/packages/wrapper/dist/__fixtures__/index.js +44 -0
- package/packages/wrapper/dist/base-wrapper.d.ts +225 -0
- package/packages/wrapper/dist/base-wrapper.js +572 -0
- package/packages/wrapper/dist/client.d.ts +254 -0
- package/packages/wrapper/dist/client.js +801 -0
- package/packages/wrapper/dist/id-generator.d.ts +35 -0
- package/packages/wrapper/dist/id-generator.js +60 -0
- package/packages/wrapper/dist/idle-detector.d.ts +110 -0
- package/packages/wrapper/dist/idle-detector.js +304 -0
- package/packages/wrapper/dist/index.d.ts +37 -0
- package/packages/wrapper/dist/index.js +47 -0
- package/packages/wrapper/dist/parser.d.ts +236 -0
- package/packages/wrapper/dist/parser.js +1238 -0
- package/packages/wrapper/dist/relay-pty-orchestrator.d.ts +407 -0
- package/packages/wrapper/dist/relay-pty-orchestrator.js +1885 -0
- package/packages/wrapper/dist/shared.d.ts +201 -0
- package/packages/wrapper/dist/shared.js +341 -0
- package/packages/wrapper/dist/stuck-detector.d.ts +161 -0
- package/packages/wrapper/dist/stuck-detector.js +402 -0
- package/packages/wrapper/dist/tmux-wrapper.d.ts +345 -0
- package/packages/wrapper/dist/tmux-wrapper.js +1747 -0
- package/packages/wrapper/dist/trajectory-integration.d.ts +292 -0
- package/packages/wrapper/dist/trajectory-integration.js +979 -0
- package/packages/wrapper/dist/wrapper-types.d.ts +41 -0
- package/packages/wrapper/dist/wrapper-types.js +7 -0
- package/packages/wrapper/package.json +63 -0
- package/scripts/setup-stripe-products.ts +312 -0
- package/scripts/stress-test-orchestrator-integration.mts +1366 -0
- package/scripts/stress-test-orchestrator.mjs +584 -0
- package/scripts/stress-test-relay-pty.sh +452 -0
- package/scripts/verify-schema.js +1 -1
- package/turbo.json +37 -0
- package/dist/bridge/config.d.ts +0 -41
- package/dist/bridge/config.js +0 -143
- package/dist/bridge/index.d.ts +0 -10
- package/dist/bridge/index.js +0 -10
- package/dist/bridge/multi-project-client.d.ts +0 -99
- package/dist/bridge/multi-project-client.js +0 -389
- package/dist/bridge/shadow-cli.js +0 -75
- package/dist/bridge/shadow-config.d.ts +0 -87
- package/dist/bridge/spawner.d.ts +0 -167
- package/dist/bridge/spawner.js +0 -858
- package/dist/bridge/types.d.ts +0 -129
- package/dist/bridge/utils.d.ts +0 -30
- package/dist/bridge/utils.js +0 -54
- package/dist/cli/index.js +0 -2781
- package/dist/cloud/api/admin.js +0 -225
- package/dist/cloud/api/billing.js +0 -564
- package/dist/cloud/api/cli-pty-runner.d.ts +0 -54
- package/dist/cloud/api/cli-pty-runner.js +0 -119
- package/dist/cloud/api/codex-auth-helper.js +0 -327
- package/dist/cloud/api/consensus.js +0 -259
- package/dist/cloud/api/coordinators.js +0 -749
- package/dist/cloud/api/daemons.js +0 -535
- package/dist/cloud/api/generic-webhooks.js +0 -129
- package/dist/cloud/api/github-app.js +0 -223
- package/dist/cloud/api/monitoring.js +0 -578
- package/dist/cloud/api/nango-auth.js +0 -658
- package/dist/cloud/api/onboarding.d.ts +0 -15
- package/dist/cloud/api/onboarding.js +0 -666
- package/dist/cloud/api/policy.js +0 -229
- package/dist/cloud/api/provider-env.d.ts +0 -5
- package/dist/cloud/api/provider-env.js +0 -27
- package/dist/cloud/api/providers.js +0 -511
- package/dist/cloud/api/repos.js +0 -576
- package/dist/cloud/api/teams.js +0 -279
- package/dist/cloud/api/test-helpers.js +0 -745
- package/dist/cloud/api/workspaces.js +0 -1783
- package/dist/cloud/billing/plans.js +0 -245
- package/dist/cloud/config.d.ts +0 -75
- package/dist/cloud/config.js +0 -109
- package/dist/cloud/db/drizzle.d.ts +0 -246
- package/dist/cloud/db/drizzle.js +0 -1249
- package/dist/cloud/db/schema.d.ts +0 -4854
- package/dist/cloud/db/schema.js +0 -610
- package/dist/cloud/index.d.ts +0 -11
- package/dist/cloud/index.js +0 -38
- package/dist/cloud/provisioner/index.d.ts +0 -207
- package/dist/cloud/provisioner/index.js +0 -2069
- package/dist/cloud/server.js +0 -1599
- package/dist/cloud/services/index.d.ts +0 -17
- package/dist/cloud/services/index.js +0 -25
- package/dist/cloud/services/intro-expiration.d.ts +0 -55
- package/dist/cloud/services/intro-expiration.js +0 -211
- package/dist/cloud/services/nango.d.ts +0 -199
- package/dist/cloud/services/nango.js +0 -382
- package/dist/cloud/services/persistence.d.ts +0 -131
- package/dist/config/relay-config.d.ts +0 -23
- package/dist/config/relay-config.js +0 -23
- package/dist/continuity/index.d.ts +0 -45
- package/dist/continuity/index.js +0 -48
- package/dist/continuity/types.d.ts +0 -180
- package/dist/continuity/types.js +0 -9
- package/dist/daemon/agent-manager.d.ts +0 -134
- package/dist/daemon/agent-manager.js +0 -564
- package/dist/daemon/agent-registry.js +0 -213
- package/dist/daemon/api.d.ts +0 -83
- package/dist/daemon/api.js +0 -780
- package/dist/daemon/channel-membership-store.d.ts +0 -48
- package/dist/daemon/channel-membership-store.js +0 -149
- package/dist/daemon/cli-auth.d.ts +0 -82
- package/dist/daemon/cli-auth.js +0 -700
- package/dist/daemon/cloud-sync.d.ts +0 -150
- package/dist/daemon/cloud-sync.js +0 -424
- package/dist/daemon/connection.d.ts +0 -130
- package/dist/daemon/connection.js +0 -438
- package/dist/daemon/consensus-integration.js +0 -371
- package/dist/daemon/delivery-tracker.d.ts +0 -34
- package/dist/daemon/delivery-tracker.js +0 -104
- package/dist/daemon/enhanced-features.d.ts +0 -118
- package/dist/daemon/enhanced-features.js +0 -178
- package/dist/daemon/index.d.ts +0 -14
- package/dist/daemon/index.js +0 -17
- package/dist/daemon/orchestrator.d.ts +0 -157
- package/dist/daemon/orchestrator.js +0 -792
- package/dist/daemon/repo-manager.js +0 -384
- package/dist/daemon/router.d.ts +0 -332
- package/dist/daemon/router.js +0 -1259
- package/dist/daemon/server.d.ts +0 -148
- package/dist/daemon/server.js +0 -773
- package/dist/daemon/services/browser-testing.d.ts +0 -88
- package/dist/daemon/services/browser-testing.js +0 -244
- package/dist/daemon/services/container-spawner.d.ts +0 -135
- package/dist/daemon/services/container-spawner.js +0 -313
- package/dist/daemon/sync-queue.d.ts +0 -116
- package/dist/daemon/sync-queue.js +0 -361
- package/dist/daemon/types.d.ts +0 -131
- package/dist/daemon/user-directory.d.ts +0 -111
- package/dist/daemon/user-directory.js +0 -233
- package/dist/daemon/workspace-manager.js +0 -314
- package/dist/dashboard/out/_next/static/chunks/116-eacf84a131b80db9.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/64-f4268c2ac6f4d7d4.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/766-aa7c8c9900ff5f53.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/891-a024fbe4b619cf6f.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/app/page-ffad986adfcc8b31.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/page-671037943b2f2e43.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/providers/page-57cbd738c6a73859.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/providers/setup/[provider]/page-5ab0854472b402b0.js +0 -1
- package/dist/dashboard/out/_next/static/css/8f9ed310f454e5a5.css +0 -1
- package/dist/dashboard-server/server.d.ts +0 -15
- package/dist/dashboard-server/server.js +0 -4799
- package/dist/dashboard-server/start.js +0 -13
- package/dist/dashboard-server/user-bridge.d.ts +0 -138
- package/dist/dashboard-server/user-bridge.js +0 -348
- package/dist/hooks/index.d.ts +0 -10
- package/dist/hooks/index.js +0 -10
- package/dist/hooks/registry.js +0 -476
- package/dist/hooks/trajectory-hooks.js +0 -183
- package/dist/hooks/types.d.ts +0 -284
- package/dist/hooks/types.js +0 -8
- package/dist/index.d.ts +0 -13
- package/dist/index.js +0 -16
- package/dist/memory/memory-hooks.d.ts +0 -60
- package/dist/policy/agent-policy.js +0 -665
- package/dist/protocol/channels.d.ts +0 -211
- package/dist/protocol/channels.js +0 -154
- package/dist/protocol/framing.d.ts +0 -94
- package/dist/protocol/framing.js +0 -240
- package/dist/protocol/index.d.ts +0 -4
- package/dist/protocol/index.js +0 -4
- package/dist/protocol/relay-pty-schemas.d.ts +0 -209
- package/dist/protocol/types.d.ts +0 -168
- package/dist/protocol/types.js +0 -6
- package/dist/resiliency/memory-monitor.js +0 -593
- package/dist/resiliency/provider-context.d.ts +0 -100
- package/dist/shared/cli-auth-config.js +0 -320
- package/dist/state/agent-state.js +0 -120
- package/dist/storage/adapter.d.ts +0 -154
- package/dist/storage/batched-sqlite-adapter.d.ts +0 -71
- package/dist/storage/batched-sqlite-adapter.js +0 -183
- package/dist/storage/sqlite-adapter.d.ts +0 -107
- package/dist/storage/sqlite-adapter.js +0 -717
- package/dist/trajectory/config.d.ts +0 -102
- package/dist/trajectory/config.js +0 -185
- package/dist/trajectory/index.d.ts +0 -8
- package/dist/trajectory/index.js +0 -8
- package/dist/trajectory/integration.js +0 -987
- package/dist/utils/command-resolver.js +0 -76
- package/dist/utils/index.d.ts +0 -4
- package/dist/utils/index.js +0 -4
- package/dist/utils/project-namespace.d.ts +0 -70
- package/dist/utils/project-namespace.js +0 -216
- package/dist/wrapper/base-wrapper.d.ts +0 -217
- package/dist/wrapper/base-wrapper.js +0 -538
- package/dist/wrapper/client.d.ts +0 -199
- package/dist/wrapper/client.js +0 -677
- package/dist/wrapper/idle-detector.d.ts +0 -102
- package/dist/wrapper/idle-detector.js +0 -279
- package/dist/wrapper/index.d.ts +0 -4
- package/dist/wrapper/index.js +0 -7
- package/dist/wrapper/parser.d.ts +0 -230
- package/dist/wrapper/parser.js +0 -1178
- package/dist/wrapper/pty-wrapper.d.ts +0 -343
- package/dist/wrapper/pty-wrapper.js +0 -1593
- package/dist/wrapper/relay-pty-orchestrator.d.ts +0 -272
- package/dist/wrapper/relay-pty-orchestrator.js +0 -1023
- package/dist/wrapper/shared.d.ts +0 -165
- package/dist/wrapper/shared.js +0 -290
- package/dist/wrapper/stuck-detector.d.ts +0 -101
- package/dist/wrapper/stuck-detector.js +0 -228
- package/dist/wrapper/tmux-wrapper.d.ts +0 -344
- package/dist/wrapper/tmux-wrapper.js +0 -1711
- /package/dist/dashboard/out/_next/static/{GJBDsC7hXtM9tz8MXWjHf → ZCFjHbkF8yDKS2md3lVgb}/_buildManifest.js +0 -0
- /package/dist/dashboard/out/_next/static/{GJBDsC7hXtM9tz8MXWjHf → ZCFjHbkF8yDKS2md3lVgb}/_ssgManifest.js +0 -0
- /package/dist/dashboard/out/_next/static/chunks/app/cloud/link/{page-cfeb437f08a12ed9.js → page-5011ae044b90449d.js} +0 -0
- /package/dist/dashboard/out/_next/static/chunks/app/history/{page-240f91e8b06ba8ac.js → page-b2ce7c96ed0931da.js} +0 -0
- /package/dist/dashboard/out/_next/static/chunks/app/metrics/{page-82938ab8fcf44694.js → page-bf2cb1e5915bc92d.js} +0 -0
- /package/dist/{cli → src/cli}/index.d.ts +0 -0
- /package/dist/{health-worker-manager.d.ts → src/health-worker-manager.d.ts} +0 -0
- /package/dist/{health-worker-manager.js → src/health-worker-manager.js} +0 -0
- /package/dist/{health-worker.d.ts → src/health-worker.d.ts} +0 -0
- /package/dist/{health-worker.js → src/health-worker.js} +0 -0
- /package/{dist/bridge → packages/bridge/dist}/shadow-cli.d.ts +0 -0
- /package/{dist/bridge → packages/bridge/dist}/types.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/api/admin.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/api/auth.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/api/auth.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/api/billing.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/api/codex-auth-helper.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/api/consensus.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/api/coordinators.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/api/daemons.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/api/generic-webhooks.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/api/git.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/api/git.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/api/github-app.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/api/middleware/planLimits.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/api/middleware/planLimits.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/api/monitoring.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/api/nango-auth.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/api/policy.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/api/providers.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/api/repos.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/api/teams.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/api/test-helpers.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/api/usage.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/api/usage.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/api/webhooks.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/api/webhooks.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/api/workspaces.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/billing/index.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/billing/index.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/billing/plans.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/billing/service.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/billing/service.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/billing/types.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/billing/types.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/db/bulk-ingest.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/db/bulk-ingest.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/db/index.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/db/index.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/server.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/services/auto-scaler.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/services/auto-scaler.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/services/capacity-manager.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/services/capacity-manager.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/services/ci-agent-spawner.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/services/ci-agent-spawner.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/services/cloud-message-bus.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/services/cloud-message-bus.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/services/compute-enforcement.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/services/compute-enforcement.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/services/coordinator.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/services/coordinator.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/services/mention-handler.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/services/mention-handler.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/services/persistence.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/services/planLimits.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/services/planLimits.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/services/presence-registry.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/services/presence-registry.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/services/scaling-orchestrator.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/services/scaling-orchestrator.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/services/scaling-policy.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/services/scaling-policy.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/services/ssh-security.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/services/ssh-security.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/services/workspace-keepalive.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/services/workspace-keepalive.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/webhooks/index.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/webhooks/index.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/webhooks/parsers/github.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/webhooks/parsers/github.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/webhooks/parsers/index.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/webhooks/parsers/index.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/webhooks/parsers/linear.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/webhooks/parsers/linear.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/webhooks/parsers/slack.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/webhooks/parsers/slack.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/webhooks/responders/github.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/webhooks/responders/github.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/webhooks/responders/index.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/webhooks/responders/index.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/webhooks/responders/linear.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/webhooks/responders/linear.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/webhooks/responders/slack.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/webhooks/responders/slack.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/webhooks/router.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/webhooks/router.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/webhooks/rules-engine.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/webhooks/rules-engine.js +0 -0
- /package/{dist/cloud → packages/cloud/dist}/webhooks/types.d.ts +0 -0
- /package/{dist/cloud → packages/cloud/dist}/webhooks/types.js +0 -0
- /package/{dist/utils → packages/config/dist}/agent-config.d.ts +0 -0
- /package/{dist/utils → packages/config/dist}/agent-config.js +0 -0
- /package/{dist/shared → packages/config/dist}/cli-auth-config.d.ts +0 -0
- /package/{dist/bridge → packages/config/dist}/shadow-config.js +0 -0
- /package/{dist/bridge → packages/config/dist}/teams-config.d.ts +0 -0
- /package/{dist/bridge → packages/config/dist}/teams-config.js +0 -0
- /package/{dist/continuity → packages/continuity/dist}/formatter.d.ts +0 -0
- /package/{dist/continuity → packages/continuity/dist}/formatter.js +0 -0
- /package/{dist/continuity → packages/continuity/dist}/handoff-store.d.ts +0 -0
- /package/{dist/continuity → packages/continuity/dist}/handoff-store.js +0 -0
- /package/{dist/continuity → packages/continuity/dist}/ledger-store.d.ts +0 -0
- /package/{dist/continuity → packages/continuity/dist}/ledger-store.js +0 -0
- /package/{dist/continuity → packages/continuity/dist}/manager.d.ts +0 -0
- /package/{dist/continuity → packages/continuity/dist}/manager.js +0 -0
- /package/{dist/continuity → packages/continuity/dist}/parser.d.ts +0 -0
- /package/{dist/continuity → packages/continuity/dist}/parser.js +0 -0
- /package/{dist/daemon → packages/daemon/dist}/agent-registry.d.ts +0 -0
- /package/{dist/daemon → packages/daemon/dist}/agent-signing.d.ts +0 -0
- /package/{dist/daemon → packages/daemon/dist}/agent-signing.js +0 -0
- /package/{dist/daemon → packages/daemon/dist}/auth.d.ts +0 -0
- /package/{dist/daemon → packages/daemon/dist}/auth.js +0 -0
- /package/{dist/daemon → packages/daemon/dist}/consensus-integration.d.ts +0 -0
- /package/{dist/daemon → packages/daemon/dist}/consensus.d.ts +0 -0
- /package/{dist/daemon → packages/daemon/dist}/consensus.js +0 -0
- /package/{dist/daemon → packages/daemon/dist}/rate-limiter.d.ts +0 -0
- /package/{dist/daemon → packages/daemon/dist}/rate-limiter.js +0 -0
- /package/{dist/daemon → packages/daemon/dist}/registry.d.ts +0 -0
- /package/{dist/daemon → packages/daemon/dist}/registry.js +0 -0
- /package/{dist/daemon → packages/daemon/dist}/repo-manager.d.ts +0 -0
- /package/{dist/daemon → packages/daemon/dist}/types.js +0 -0
- /package/{dist/daemon → packages/daemon/dist}/workspace-manager.d.ts +0 -0
- /package/{dist/dashboard-server → packages/dashboard-server/dist}/metrics.d.ts +0 -0
- /package/{dist/dashboard-server → packages/dashboard-server/dist}/metrics.js +0 -0
- /package/{dist/dashboard-server → packages/dashboard-server/dist}/needs-attention.d.ts +0 -0
- /package/{dist/dashboard-server → packages/dashboard-server/dist}/needs-attention.js +0 -0
- /package/{dist/dashboard-server → packages/dashboard-server/dist}/start.d.ts +0 -0
- /package/{dist/hooks → packages/hooks/dist}/emitter.d.ts +0 -0
- /package/{dist/hooks → packages/hooks/dist}/emitter.js +0 -0
- /package/{dist/hooks → packages/hooks/dist}/inbox-check/hook.d.ts +0 -0
- /package/{dist/hooks → packages/hooks/dist}/inbox-check/hook.js +0 -0
- /package/{dist/hooks → packages/hooks/dist}/inbox-check/index.d.ts +0 -0
- /package/{dist/hooks → packages/hooks/dist}/inbox-check/index.js +0 -0
- /package/{dist/hooks → packages/hooks/dist}/inbox-check/types.d.ts +0 -0
- /package/{dist/hooks → packages/hooks/dist}/inbox-check/types.js +0 -0
- /package/{dist/hooks → packages/hooks/dist}/inbox-check/utils.d.ts +0 -0
- /package/{dist/hooks → packages/hooks/dist}/inbox-check/utils.js +0 -0
- /package/{dist/hooks → packages/hooks/dist}/registry.d.ts +0 -0
- /package/{dist/hooks → packages/hooks/dist}/trajectory-hooks.d.ts +0 -0
- /package/{dist/memory → packages/memory/dist}/adapters/index.d.ts +0 -0
- /package/{dist/memory → packages/memory/dist}/adapters/index.js +0 -0
- /package/{dist/memory → packages/memory/dist}/adapters/inmemory.d.ts +0 -0
- /package/{dist/memory → packages/memory/dist}/adapters/inmemory.js +0 -0
- /package/{dist/memory → packages/memory/dist}/adapters/supermemory.d.ts +0 -0
- /package/{dist/memory → packages/memory/dist}/adapters/supermemory.js +0 -0
- /package/{dist/memory → packages/memory/dist}/context-compaction.d.ts +0 -0
- /package/{dist/memory → packages/memory/dist}/context-compaction.js +0 -0
- /package/{dist/memory → packages/memory/dist}/factory.d.ts +0 -0
- /package/{dist/memory → packages/memory/dist}/factory.js +0 -0
- /package/{dist/memory → packages/memory/dist}/index.d.ts +0 -0
- /package/{dist/memory → packages/memory/dist}/index.js +0 -0
- /package/{dist/memory → packages/memory/dist}/memory-hooks.js +0 -0
- /package/{dist/memory → packages/memory/dist}/service.d.ts +0 -0
- /package/{dist/memory → packages/memory/dist}/service.js +0 -0
- /package/{dist/memory → packages/memory/dist}/types.d.ts +0 -0
- /package/{dist/memory → packages/memory/dist}/types.js +0 -0
- /package/{dist/policy → packages/policy/dist}/agent-policy.d.ts +0 -0
- /package/{dist/policy → packages/policy/dist}/cloud-policy-fetcher.d.ts +0 -0
- /package/{dist/policy → packages/policy/dist}/cloud-policy-fetcher.js +0 -0
- /package/{dist/utils → packages/protocol/dist}/id-generator.d.ts +0 -0
- /package/{dist/utils → packages/protocol/dist}/id-generator.js +0 -0
- /package/{dist/protocol → packages/protocol/dist}/relay-pty-schemas.js +0 -0
- /package/{dist/resiliency → packages/resiliency/dist}/context-persistence.d.ts +0 -0
- /package/{dist/resiliency → packages/resiliency/dist}/context-persistence.js +0 -0
- /package/{dist/resiliency → packages/resiliency/dist}/crash-insights.d.ts +0 -0
- /package/{dist/resiliency → packages/resiliency/dist}/crash-insights.js +0 -0
- /package/{dist/resiliency → packages/resiliency/dist}/gossip-health.d.ts +0 -0
- /package/{dist/resiliency → packages/resiliency/dist}/gossip-health.js +0 -0
- /package/{dist/resiliency → packages/resiliency/dist}/health-monitor.d.ts +0 -0
- /package/{dist/resiliency → packages/resiliency/dist}/health-monitor.js +0 -0
- /package/{dist/resiliency → packages/resiliency/dist}/index.d.ts +0 -0
- /package/{dist/resiliency → packages/resiliency/dist}/index.js +0 -0
- /package/{dist/resiliency → packages/resiliency/dist}/leader-watchdog.d.ts +0 -0
- /package/{dist/resiliency → packages/resiliency/dist}/leader-watchdog.js +0 -0
- /package/{dist/resiliency → packages/resiliency/dist}/logger.d.ts +0 -0
- /package/{dist/resiliency → packages/resiliency/dist}/logger.js +0 -0
- /package/{dist/resiliency → packages/resiliency/dist}/memory-monitor.d.ts +0 -0
- /package/{dist/resiliency → packages/resiliency/dist}/metrics.d.ts +0 -0
- /package/{dist/resiliency → packages/resiliency/dist}/metrics.js +0 -0
- /package/{dist/resiliency → packages/resiliency/dist}/provider-context.js +0 -0
- /package/{dist/resiliency → packages/resiliency/dist}/stateless-lead.d.ts +0 -0
- /package/{dist/resiliency → packages/resiliency/dist}/stateless-lead.js +0 -0
- /package/{dist/resiliency → packages/resiliency/dist}/supervisor.d.ts +0 -0
- /package/{dist/resiliency → packages/resiliency/dist}/supervisor.js +0 -0
- /package/{dist/state → packages/state/dist}/agent-state.d.ts +0 -0
- /package/{dist/storage → packages/storage/dist}/adapter.js +0 -0
- /package/{dist/storage → packages/storage/dist}/dead-letter-queue.d.ts +0 -0
- /package/{dist/storage → packages/storage/dist}/dead-letter-queue.js +0 -0
- /package/{dist/storage → packages/storage/dist}/dlq-adapter.d.ts +0 -0
- /package/{dist/storage → packages/storage/dist}/dlq-adapter.js +0 -0
- /package/{dist/trajectory → packages/trajectory/dist}/integration.d.ts +0 -0
- /package/{dist/utils → packages/utils/dist}/command-resolver.d.ts +0 -0
- /package/{dist/utils → packages/utils/dist}/git-remote.d.ts +0 -0
- /package/{dist/utils → packages/utils/dist}/git-remote.js +0 -0
- /package/{dist/utils → packages/utils/dist}/logger.d.ts +0 -0
- /package/{dist/utils → packages/utils/dist}/logger.js +0 -0
- /package/{dist/utils → packages/utils/dist}/name-generator.d.ts +0 -0
- /package/{dist/utils → packages/utils/dist}/name-generator.js +0 -0
- /package/{dist/utils → packages/utils/dist}/precompiled-patterns.d.ts +0 -0
- /package/{dist/utils → packages/utils/dist}/precompiled-patterns.js +0 -0
- /package/{dist/utils → packages/utils/dist}/update-checker.d.ts +0 -0
- /package/{dist/utils → packages/utils/dist}/update-checker.js +0 -0
- /package/{dist/wrapper → packages/wrapper/dist}/auth-detection.d.ts +0 -0
- /package/{dist/wrapper → packages/wrapper/dist}/auth-detection.js +0 -0
- /package/{dist/wrapper → packages/wrapper/dist}/inbox.d.ts +0 -0
- /package/{dist/wrapper → packages/wrapper/dist}/inbox.js +0 -0
- /package/{dist/wrapper → packages/wrapper/dist}/prompt-composer.d.ts +0 -0
- /package/{dist/wrapper → packages/wrapper/dist}/prompt-composer.js +0 -0
- /package/{dist/utils → packages/wrapper/dist}/tmux-resolver.d.ts +0 -0
- /package/{dist/utils → packages/wrapper/dist}/tmux-resolver.js +0 -0
|
@@ -1,1593 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PtyWrapper - Node-PTY based wrapper for spawned workers
|
|
3
|
-
*
|
|
4
|
-
* Unlike TmuxWrapper which provides interactive terminal access,
|
|
5
|
-
* PtyWrapper runs agents headlessly with output capture for logs.
|
|
6
|
-
* Used for spawned workers that don't need direct user interaction.
|
|
7
|
-
*
|
|
8
|
-
* Extends BaseWrapper for shared message handling, spawn/release,
|
|
9
|
-
* and continuity integration.
|
|
10
|
-
*/
|
|
11
|
-
import * as pty from 'node-pty';
|
|
12
|
-
import fs from 'node:fs';
|
|
13
|
-
import path from 'node:path';
|
|
14
|
-
import { BaseWrapper } from './base-wrapper.js';
|
|
15
|
-
import { parseSummaryWithDetails, parseSessionEndFromOutput, isPlaceholderTarget } from './parser.js';
|
|
16
|
-
import { getProjectPaths } from '../utils/project-namespace.js';
|
|
17
|
-
import { getTrailEnvVars } from '../trajectory/integration.js';
|
|
18
|
-
import { findAgentConfig } from '../utils/agent-config.js';
|
|
19
|
-
import { HookRegistry, createTrajectoryHooks } from '../hooks/index.js';
|
|
20
|
-
import { parseContinuityCommand, hasContinuityCommand } from '../continuity/index.js';
|
|
21
|
-
import { INJECTION_CONSTANTS, stripAnsi, sleep, buildInjectionString, injectWithRetry as sharedInjectWithRetry, CLI_QUIRKS, } from './shared.js';
|
|
22
|
-
import { detectProviderAuthRevocation } from './auth-detection.js';
|
|
23
|
-
/** Maximum lines to keep in output buffer */
|
|
24
|
-
const MAX_BUFFER_LINES = 10000;
|
|
25
|
-
export class PtyWrapper extends BaseWrapper {
|
|
26
|
-
// Override config with PtyWrapper-specific type
|
|
27
|
-
config;
|
|
28
|
-
// PTY-specific state
|
|
29
|
-
ptyProcess;
|
|
30
|
-
outputBuffer = [];
|
|
31
|
-
rawBuffer = '';
|
|
32
|
-
readyForMessages = false;
|
|
33
|
-
lastOutputTime = 0;
|
|
34
|
-
logFilePath;
|
|
35
|
-
logStream;
|
|
36
|
-
acceptedPrompts = new Set(); // Track which prompts have been accepted
|
|
37
|
-
hookRegistry;
|
|
38
|
-
sessionStartTime = Date.now();
|
|
39
|
-
inThinkingBlock = false; // Track if inside <thinking>...</thinking>
|
|
40
|
-
lastSummaryTime = Date.now(); // Track when last summary was output
|
|
41
|
-
outputsSinceSummary = 0; // Count outputs since last summary
|
|
42
|
-
detectedTask; // Auto-detected task from agent config
|
|
43
|
-
instructionsInjected = false; // Track if init instructions have been injected
|
|
44
|
-
continuityInjected = false; // Track if continuity context has been injected
|
|
45
|
-
recentLogChunks = new Map(); // Dedup log streaming (hash -> timestamp)
|
|
46
|
-
static LOG_DEDUP_WINDOW_MS = 500; // Window for considering logs as duplicates
|
|
47
|
-
static LOG_DEDUP_MAX_SIZE = 100; // Max entries in dedup map
|
|
48
|
-
lastParsedLength = 0; // Track last parsed position to avoid re-parsing entire buffer
|
|
49
|
-
lastContinuityParsedLength = 0; // Same for continuity commands
|
|
50
|
-
// Auth revocation detection state
|
|
51
|
-
authRevoked = false;
|
|
52
|
-
lastAuthCheck = 0;
|
|
53
|
-
AUTH_CHECK_INTERVAL = 5000; // Check every 5 seconds max
|
|
54
|
-
constructor(config) {
|
|
55
|
-
super(config);
|
|
56
|
-
this.config = config;
|
|
57
|
-
// Auto-detect agent role from .claude/agents/ or .openagents/ if task not provided
|
|
58
|
-
let detectedTask = config.task;
|
|
59
|
-
if (!detectedTask) {
|
|
60
|
-
const agentConfig = findAgentConfig(config.name, config.cwd);
|
|
61
|
-
if (agentConfig?.description) {
|
|
62
|
-
detectedTask = agentConfig.description;
|
|
63
|
-
// Use stderr for consistency with TmuxWrapper's logStderr pattern
|
|
64
|
-
process.stderr.write(`[pty:${config.name}] Auto-detected role: ${detectedTask.substring(0, 60)}...\n`);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
// Store detected task for use in hook registry
|
|
68
|
-
this.detectedTask = detectedTask;
|
|
69
|
-
// Initialize hook registry (PTY-specific)
|
|
70
|
-
const projectPaths = getProjectPaths();
|
|
71
|
-
this.hookRegistry = new HookRegistry({
|
|
72
|
-
agentName: config.name,
|
|
73
|
-
workingDir: config.cwd ?? process.cwd(),
|
|
74
|
-
projectId: projectPaths.projectId,
|
|
75
|
-
task: this.detectedTask,
|
|
76
|
-
env: config.env,
|
|
77
|
-
inject: (text) => this.write(text + '\r'),
|
|
78
|
-
send: async (to, body) => {
|
|
79
|
-
this.client.sendMessage(to, body, 'message');
|
|
80
|
-
},
|
|
81
|
-
});
|
|
82
|
-
// Register trajectory hooks if enabled (default: true if task provided or auto-detected)
|
|
83
|
-
const enableTrajectory = config.trajectoryTracking ?? !!this.detectedTask;
|
|
84
|
-
if (enableTrajectory) {
|
|
85
|
-
const trajectoryHooks = createTrajectoryHooks({
|
|
86
|
-
projectId: projectPaths.projectId,
|
|
87
|
-
agentName: config.name,
|
|
88
|
-
});
|
|
89
|
-
this.hookRegistry.registerLifecycleHooks(trajectoryHooks);
|
|
90
|
-
}
|
|
91
|
-
// Register custom hooks if provided
|
|
92
|
-
if (config.hooks) {
|
|
93
|
-
this.hookRegistry.registerLifecycleHooks(config.hooks);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
// =========================================================================
|
|
97
|
-
// Abstract method implementations (required by BaseWrapper)
|
|
98
|
-
// =========================================================================
|
|
99
|
-
/**
|
|
100
|
-
* Inject content into the PTY process.
|
|
101
|
-
* Used by BaseWrapper for message injection.
|
|
102
|
-
*/
|
|
103
|
-
async performInjection(content) {
|
|
104
|
-
if (this.ptyProcess && this.running) {
|
|
105
|
-
this.ptyProcess.write(content);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Get cleaned output buffer for command parsing.
|
|
110
|
-
* Strips ANSI codes and returns raw buffer content.
|
|
111
|
-
*/
|
|
112
|
-
getCleanOutput() {
|
|
113
|
-
return stripAnsi(this.rawBuffer);
|
|
114
|
-
}
|
|
115
|
-
// =========================================================================
|
|
116
|
-
// Lifecycle methods
|
|
117
|
-
// =========================================================================
|
|
118
|
-
/**
|
|
119
|
-
* Start the agent process
|
|
120
|
-
*/
|
|
121
|
-
async start() {
|
|
122
|
-
if (this.running)
|
|
123
|
-
return;
|
|
124
|
-
// Set up log file if logsDir is provided
|
|
125
|
-
if (this.config.logsDir) {
|
|
126
|
-
try {
|
|
127
|
-
fs.mkdirSync(this.config.logsDir, { recursive: true });
|
|
128
|
-
this.logFilePath = path.join(this.config.logsDir, `${this.config.name}.log`);
|
|
129
|
-
this.logStream = fs.createWriteStream(this.logFilePath, { flags: 'a' });
|
|
130
|
-
this.logStream.write(`\n--- Worker ${this.config.name} started at ${new Date().toISOString()} ---\n`);
|
|
131
|
-
}
|
|
132
|
-
catch (err) {
|
|
133
|
-
console.error(`[pty:${this.config.name}] Failed to create log file: ${err.message}`);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
// Connect to relay daemon
|
|
137
|
-
const socketPath = this.config.socketPath ?? 'DEFAULT';
|
|
138
|
-
console.log(`[pty:${this.config.name}] Connecting to relay daemon at: ${socketPath}`);
|
|
139
|
-
try {
|
|
140
|
-
await this.client.connect();
|
|
141
|
-
console.log(`[pty:${this.config.name}] Relay connected (state: ${this.client.state})`);
|
|
142
|
-
// If this is a shadow agent, bind to the primary after connecting
|
|
143
|
-
if (this.config.shadowOf) {
|
|
144
|
-
const speakOn = this.config.shadowSpeakOn ?? ['EXPLICIT_ASK'];
|
|
145
|
-
const bound = this.client.bindAsShadow(this.config.shadowOf, { speakOn });
|
|
146
|
-
if (bound) {
|
|
147
|
-
console.log(`[pty:${this.config.name}] Bound as shadow of ${this.config.shadowOf} (speakOn: ${speakOn.join(', ')})`);
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
console.error(`[pty:${this.config.name}] Failed to bind as shadow of ${this.config.shadowOf}`);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
catch (err) {
|
|
155
|
-
console.error(`[pty:${this.config.name}] Relay connect failed: ${err.message}`);
|
|
156
|
-
console.error(`[pty:${this.config.name}] Relay client state: ${this.client.state}`);
|
|
157
|
-
}
|
|
158
|
-
// Build command args
|
|
159
|
-
const args = this.config.args ?? [];
|
|
160
|
-
const cwd = this.config.cwd ?? process.cwd();
|
|
161
|
-
// Log spawn details for debugging
|
|
162
|
-
console.log(`[pty:${this.config.name}] Spawning: ${this.config.command} ${args.join(' ')}`);
|
|
163
|
-
console.log(`[pty:${this.config.name}] CWD: ${cwd}`);
|
|
164
|
-
// Get trail environment variables
|
|
165
|
-
const projectPaths = getProjectPaths();
|
|
166
|
-
const trailEnvVars = getTrailEnvVars(projectPaths.projectId, this.config.name, projectPaths.dataDir);
|
|
167
|
-
// Spawn the process with error handling
|
|
168
|
-
try {
|
|
169
|
-
this.ptyProcess = pty.spawn(this.config.command, args, {
|
|
170
|
-
name: 'xterm-256color',
|
|
171
|
-
cols: 120,
|
|
172
|
-
rows: 40,
|
|
173
|
-
cwd,
|
|
174
|
-
env: {
|
|
175
|
-
...process.env,
|
|
176
|
-
...this.config.env,
|
|
177
|
-
...trailEnvVars,
|
|
178
|
-
AGENT_RELAY_NAME: this.config.name,
|
|
179
|
-
TERM: 'xterm-256color',
|
|
180
|
-
},
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
catch (spawnError) {
|
|
184
|
-
console.error(`[pty:${this.config.name}] Failed to spawn process:`, spawnError.message);
|
|
185
|
-
console.error(`[pty:${this.config.name}] Command: ${this.config.command}`);
|
|
186
|
-
console.error(`[pty:${this.config.name}] Args: ${args.join(' ')}`);
|
|
187
|
-
throw spawnError;
|
|
188
|
-
}
|
|
189
|
-
this.running = true;
|
|
190
|
-
this.sessionStartTime = Date.now();
|
|
191
|
-
// Set PID for idle detector (enables process state inspection on Linux)
|
|
192
|
-
if (this.ptyProcess.pid) {
|
|
193
|
-
this.setIdleDetectorPid(this.ptyProcess.pid);
|
|
194
|
-
console.log(`[pty:${this.config.name}] Idle detector initialized with PID ${this.ptyProcess.pid}`);
|
|
195
|
-
}
|
|
196
|
-
this.startStuckDetection();
|
|
197
|
-
// Skip hooks and continuity in interactive mode - user handles all prompts directly
|
|
198
|
-
if (!this.config.interactive) {
|
|
199
|
-
// Dispatch session start hook (handles trajectory initialization)
|
|
200
|
-
this.hookRegistry.dispatchSessionStart().catch(err => {
|
|
201
|
-
console.error(`[pty:${this.config.name}] Session start hook error:`, err);
|
|
202
|
-
});
|
|
203
|
-
// Initialize continuity and get agentId, then inject context
|
|
204
|
-
this.initializeAgentId()
|
|
205
|
-
.then(() => this.injectContinuityContext())
|
|
206
|
-
.catch(err => {
|
|
207
|
-
console.error(`[pty:${this.config.name}] Agent ID/continuity initialization error:`, err);
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
// Capture output
|
|
211
|
-
this.ptyProcess.onData((data) => {
|
|
212
|
-
this.handleOutput(data);
|
|
213
|
-
});
|
|
214
|
-
// Handle exit
|
|
215
|
-
this.ptyProcess.onExit(({ exitCode }) => {
|
|
216
|
-
this.running = false;
|
|
217
|
-
this.stopStuckDetection();
|
|
218
|
-
this.emit('exit', exitCode);
|
|
219
|
-
this.config.onExit?.(exitCode);
|
|
220
|
-
this.client.destroy();
|
|
221
|
-
});
|
|
222
|
-
// Wait for agent to be idle before injecting instructions
|
|
223
|
-
// This replaces the fixed 2-second delay with actual readiness detection
|
|
224
|
-
this.waitForAgentReady().then(() => {
|
|
225
|
-
if (!this.config.interactive) {
|
|
226
|
-
this.injectInstructions();
|
|
227
|
-
}
|
|
228
|
-
this.readyForMessages = true;
|
|
229
|
-
console.log(`[pty:${this.config.name}] Agent ready for messages (queueLen=${this.messageQueue.length}, interactive=${this.config.interactive})`);
|
|
230
|
-
// Process any messages that arrived while waiting (skip in interactive mode)
|
|
231
|
-
if (!this.config.interactive) {
|
|
232
|
-
this.processMessageQueue();
|
|
233
|
-
}
|
|
234
|
-
}).catch(err => {
|
|
235
|
-
console.error(`[pty:${this.config.name}] Failed to wait for agent ready:`, err);
|
|
236
|
-
// Fall back to marking ready anyway to avoid blocking forever
|
|
237
|
-
this.readyForMessages = true;
|
|
238
|
-
console.log(`[pty:${this.config.name}] Agent ready for messages (fallback, queueLen=${this.messageQueue.length})`);
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Wait for the agent to be ready for input.
|
|
243
|
-
* Uses idle detection instead of a fixed delay.
|
|
244
|
-
*/
|
|
245
|
-
async waitForAgentReady() {
|
|
246
|
-
// Minimum wait to ensure the CLI process has started
|
|
247
|
-
await sleep(500);
|
|
248
|
-
// Wait for agent to become idle (CLI fully initialized)
|
|
249
|
-
const result = await this.waitForIdleState(10000, 200);
|
|
250
|
-
if (result.isIdle) {
|
|
251
|
-
console.log(`[pty:${this.config.name}] Agent ready (confidence: ${(result.confidence * 100).toFixed(0)}%)`);
|
|
252
|
-
}
|
|
253
|
-
else {
|
|
254
|
-
console.warn(`[pty:${this.config.name}] Agent readiness timeout, proceeding anyway`);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
// Note: initializeAgentId() and getAgentId() are inherited from BaseWrapper
|
|
258
|
-
/**
|
|
259
|
-
* Inject continuity context from previous session.
|
|
260
|
-
* Called after agent ID initialization to restore state from ledger.
|
|
261
|
-
*/
|
|
262
|
-
async injectContinuityContext() {
|
|
263
|
-
if (!this.continuity || !this.running)
|
|
264
|
-
return;
|
|
265
|
-
// Guard: Only inject once per session
|
|
266
|
-
if (this.continuityInjected) {
|
|
267
|
-
console.log(`[pty:${this.config.name}] Continuity context already injected, skipping`);
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
this.continuityInjected = true;
|
|
271
|
-
try {
|
|
272
|
-
const context = await this.continuity.getStartupContext(this.config.name);
|
|
273
|
-
// Skip if no meaningful context (empty ledger or just boilerplate)
|
|
274
|
-
if (!context?.formatted || context.formatted.length < 50) {
|
|
275
|
-
console.log(`[pty:${this.config.name}] Skipping continuity injection (no meaningful context)`);
|
|
276
|
-
return;
|
|
277
|
-
}
|
|
278
|
-
if (context?.formatted) {
|
|
279
|
-
// Build context notification similar to TmuxWrapper
|
|
280
|
-
const taskInfo = context.ledger?.currentTask
|
|
281
|
-
? `Task: ${context.ledger.currentTask.slice(0, 50)}`
|
|
282
|
-
: '';
|
|
283
|
-
const handoffInfo = context.handoff
|
|
284
|
-
? `Last handoff: ${context.handoff.createdAt.toISOString().split('T')[0]}`
|
|
285
|
-
: '';
|
|
286
|
-
const statusParts = [taskInfo, handoffInfo].filter(Boolean).join(' | ');
|
|
287
|
-
const notification = `[Continuity] Previous session context loaded.${statusParts ? ` ${statusParts}` : ''}\n\n${context.formatted}`;
|
|
288
|
-
// Queue continuity context directly to messageQueue with 'system' as sender
|
|
289
|
-
// This avoids creating confusing "Agent -> Agent" self-messages in the dashboard
|
|
290
|
-
// Fix for Lead communication issue: continuity checkpoints were creating self-messages
|
|
291
|
-
this.messageQueue.push({
|
|
292
|
-
from: 'system',
|
|
293
|
-
body: notification,
|
|
294
|
-
messageId: `continuity-startup-${Date.now()}`,
|
|
295
|
-
thread: 'continuity-context',
|
|
296
|
-
});
|
|
297
|
-
this.processMessageQueue();
|
|
298
|
-
const mode = context.handoff ? 'resume' : 'continue';
|
|
299
|
-
console.log(`[pty:${this.config.name}] Continuity context injected (${mode})`);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
catch (err) {
|
|
303
|
-
console.error(`[pty:${this.config.name}] Failed to inject continuity context: ${err.message}`);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Parse ->continuity: commands from output and handle them.
|
|
308
|
-
*
|
|
309
|
-
* Supported commands:
|
|
310
|
-
* ->continuity:save <<<...>>> - Save session state to ledger
|
|
311
|
-
* ->continuity:load - Request context injection
|
|
312
|
-
* ->continuity:search "query" - Search past handoffs
|
|
313
|
-
* ->continuity:uncertain "..." - Mark item as uncertain
|
|
314
|
-
* ->continuity:handoff <<<...>>> - Create explicit handoff
|
|
315
|
-
*/
|
|
316
|
-
/**
|
|
317
|
-
* Parse continuity commands from output.
|
|
318
|
-
* Overrides BaseWrapper to use client.sendMessage instead of queuing.
|
|
319
|
-
*/
|
|
320
|
-
async parseContinuityCommands(content) {
|
|
321
|
-
if (!this.continuity)
|
|
322
|
-
return;
|
|
323
|
-
if (!hasContinuityCommand(content))
|
|
324
|
-
return;
|
|
325
|
-
const command = parseContinuityCommand(content);
|
|
326
|
-
if (!command)
|
|
327
|
-
return;
|
|
328
|
-
// Deduplication: use type + content hash for all commands
|
|
329
|
-
// Fixed: content-less commands (like load) now use static hash to prevent infinite loops
|
|
330
|
-
const cmdHash = `${command.type}:${command.content || command.query || command.item || 'no-content'}`;
|
|
331
|
-
if (this.processedContinuityCommands.has(cmdHash))
|
|
332
|
-
return;
|
|
333
|
-
this.processedContinuityCommands.add(cmdHash);
|
|
334
|
-
// Limit dedup set size
|
|
335
|
-
if (this.processedContinuityCommands.size > 100) {
|
|
336
|
-
const oldest = this.processedContinuityCommands.values().next().value;
|
|
337
|
-
if (oldest)
|
|
338
|
-
this.processedContinuityCommands.delete(oldest);
|
|
339
|
-
}
|
|
340
|
-
try {
|
|
341
|
-
const response = await this.continuity.handleCommand(this.config.name, command);
|
|
342
|
-
if (response) {
|
|
343
|
-
// Inject response via relay message to self
|
|
344
|
-
this.client.sendMessage(this.config.name, response, 'message', undefined, 'continuity-response');
|
|
345
|
-
console.log(`[pty:${this.config.name}] Continuity command handled: ${command.type}`);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
catch (err) {
|
|
349
|
-
console.error(`[pty:${this.config.name}] Continuity command error: ${err.message}`);
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* Handle output from the process
|
|
354
|
-
*/
|
|
355
|
-
handleOutput(data) {
|
|
356
|
-
// Track output timing for stability checks
|
|
357
|
-
this.lastOutputTime = Date.now();
|
|
358
|
-
// Feed output to idle detector for robust idle detection
|
|
359
|
-
this.feedIdleDetectorOutput(data);
|
|
360
|
-
// Append to raw buffer
|
|
361
|
-
this.rawBuffer += data;
|
|
362
|
-
// Write to log file if available
|
|
363
|
-
if (this.logStream) {
|
|
364
|
-
this.logStream.write(data);
|
|
365
|
-
}
|
|
366
|
-
// Emit for external listeners
|
|
367
|
-
this.emit('output', data);
|
|
368
|
-
// Stream to daemon for dashboard log viewing (if connected)
|
|
369
|
-
// Filter out Claude's extended thinking blocks before streaming
|
|
370
|
-
// Also deduplicate to prevent terminal redraws from causing duplicate log entries
|
|
371
|
-
if (this.config.streamLogs !== false && this.client.state === 'READY') {
|
|
372
|
-
const filteredData = this.filterThinkingBlocks(data);
|
|
373
|
-
if (filteredData && !this.isDuplicateLogChunk(filteredData)) {
|
|
374
|
-
this.client.sendLog(filteredData);
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
// Auto-accept Claude's first-run prompt for --dangerously-skip-permissions
|
|
378
|
-
// The prompt shows: "2. Yes, I accept" - we send "2" to accept
|
|
379
|
-
this.handleAutoAcceptPrompts(data);
|
|
380
|
-
// Handle terminal escape sequences that require responses (e.g., cursor position query)
|
|
381
|
-
this.handleTerminalEscapeSequences(data);
|
|
382
|
-
// Store in line buffer for logs
|
|
383
|
-
const lines = data.split('\n');
|
|
384
|
-
for (const line of lines) {
|
|
385
|
-
if (line.trim()) {
|
|
386
|
-
this.outputBuffer.push(line);
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
// Trim buffer if too large
|
|
390
|
-
while (this.outputBuffer.length > MAX_BUFFER_LINES) {
|
|
391
|
-
this.outputBuffer.shift();
|
|
392
|
-
}
|
|
393
|
-
// Parse for relay commands
|
|
394
|
-
this.parseRelayCommands();
|
|
395
|
-
// Dispatch output hook (handles phase detection, etc.)
|
|
396
|
-
// Skip in interactive mode - no hooks should inject content
|
|
397
|
-
const cleanData = stripAnsi(data);
|
|
398
|
-
if (!this.config.interactive) {
|
|
399
|
-
this.hookRegistry.dispatchOutput(cleanData, data).catch(err => {
|
|
400
|
-
console.error(`[pty:${this.config.name}] Output hook error:`, err);
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
// Check for [[SUMMARY]] and [[SESSION_END]] blocks and emit events
|
|
404
|
-
// This allows cloud services to handle persistence without hardcoding storage
|
|
405
|
-
const cleanContent = stripAnsi(this.rawBuffer);
|
|
406
|
-
this.checkForSummaryAndEmit(cleanContent);
|
|
407
|
-
this.checkForSessionEndAndEmit(cleanContent);
|
|
408
|
-
// Check for auth revocation patterns
|
|
409
|
-
this.checkAuthRevocation(cleanContent);
|
|
410
|
-
// Parse for continuity commands (->continuity:save, ->continuity:load, etc.)
|
|
411
|
-
// Use rawBuffer (accumulated content) not immediate chunk, since multi-line
|
|
412
|
-
// fenced commands like ->continuity:save <<<...>>> span multiple output events
|
|
413
|
-
// Optimization: Only parse new content with lookback for incomplete fenced commands
|
|
414
|
-
// Skip in interactive mode - no continuity features needed
|
|
415
|
-
if (!this.config.interactive && cleanContent.length > this.lastContinuityParsedLength) {
|
|
416
|
-
const lookbackStart = Math.max(0, this.lastContinuityParsedLength - 500);
|
|
417
|
-
const contentToParse = cleanContent.substring(lookbackStart);
|
|
418
|
-
// Join continuation lines for multi-line fenced commands
|
|
419
|
-
const joinedContent = this.joinContinuationLines(contentToParse);
|
|
420
|
-
this.parseContinuityCommands(joinedContent).catch(err => {
|
|
421
|
-
console.error(`[pty:${this.config.name}] Continuity command parsing error:`, err);
|
|
422
|
-
});
|
|
423
|
-
this.lastContinuityParsedLength = cleanContent.length;
|
|
424
|
-
}
|
|
425
|
-
// Track outputs and potentially remind about summaries
|
|
426
|
-
this.trackOutputAndRemind(data);
|
|
427
|
-
}
|
|
428
|
-
/**
|
|
429
|
-
* Filter Claude's extended thinking blocks from output.
|
|
430
|
-
* Thinking blocks are wrapped in <thinking>...</thinking> tags and should
|
|
431
|
-
* not be streamed to the dashboard or stored in output buffers.
|
|
432
|
-
*
|
|
433
|
-
* This method tracks state across calls to handle multi-line thinking blocks.
|
|
434
|
-
*/
|
|
435
|
-
filterThinkingBlocks(data) {
|
|
436
|
-
const THINKING_START = /<thinking>/;
|
|
437
|
-
const THINKING_END = /<\/thinking>/;
|
|
438
|
-
const lines = data.split('\n');
|
|
439
|
-
const outputLines = [];
|
|
440
|
-
for (const line of lines) {
|
|
441
|
-
// If in thinking block, check for end
|
|
442
|
-
if (this.inThinkingBlock) {
|
|
443
|
-
if (THINKING_END.test(line)) {
|
|
444
|
-
this.inThinkingBlock = false;
|
|
445
|
-
// If there's content after </thinking> on the same line, keep it
|
|
446
|
-
const afterEnd = line.split('</thinking>')[1];
|
|
447
|
-
if (afterEnd && afterEnd.trim()) {
|
|
448
|
-
outputLines.push(afterEnd);
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
// Skip this line - inside thinking block
|
|
452
|
-
continue;
|
|
453
|
-
}
|
|
454
|
-
// Check for thinking start
|
|
455
|
-
if (THINKING_START.test(line)) {
|
|
456
|
-
this.inThinkingBlock = true;
|
|
457
|
-
// Check if it ends on the same line
|
|
458
|
-
if (THINKING_END.test(line)) {
|
|
459
|
-
this.inThinkingBlock = false;
|
|
460
|
-
}
|
|
461
|
-
// Keep content before <thinking> if any
|
|
462
|
-
const beforeStart = line.split('<thinking>')[0];
|
|
463
|
-
if (beforeStart && beforeStart.trim()) {
|
|
464
|
-
outputLines.push(beforeStart);
|
|
465
|
-
}
|
|
466
|
-
continue;
|
|
467
|
-
}
|
|
468
|
-
// Normal line - keep it
|
|
469
|
-
outputLines.push(line);
|
|
470
|
-
}
|
|
471
|
-
return outputLines.join('\n');
|
|
472
|
-
}
|
|
473
|
-
/**
|
|
474
|
-
* Check if a log chunk is a duplicate (recently streamed).
|
|
475
|
-
* Prevents terminal redraws from causing duplicate log entries in the dashboard.
|
|
476
|
-
*
|
|
477
|
-
* Uses content normalization and time-based deduplication:
|
|
478
|
-
* - Strips whitespace and normalizes content for comparison
|
|
479
|
-
* - Considers chunks with same normalized content within LOG_DEDUP_WINDOW_MS as duplicates
|
|
480
|
-
* - Cleans up old entries to prevent memory growth
|
|
481
|
-
*/
|
|
482
|
-
isDuplicateLogChunk(data) {
|
|
483
|
-
// Normalize: strip excessive whitespace, limit to first 200 chars for hash
|
|
484
|
-
// This helps catch redraws that might have slight formatting differences
|
|
485
|
-
const normalized = stripAnsi(data).replace(/\s+/g, ' ').trim().substring(0, 200);
|
|
486
|
-
// Very short chunks (likely control chars or partial output) - allow through
|
|
487
|
-
if (normalized.length < 10) {
|
|
488
|
-
return false;
|
|
489
|
-
}
|
|
490
|
-
// Simple hash using string as key
|
|
491
|
-
const hash = normalized;
|
|
492
|
-
const now = Date.now();
|
|
493
|
-
// Check if this chunk was recently streamed
|
|
494
|
-
const lastSeen = this.recentLogChunks.get(hash);
|
|
495
|
-
if (lastSeen && (now - lastSeen) < PtyWrapper.LOG_DEDUP_WINDOW_MS) {
|
|
496
|
-
return true; // Duplicate
|
|
497
|
-
}
|
|
498
|
-
// Record this chunk
|
|
499
|
-
this.recentLogChunks.set(hash, now);
|
|
500
|
-
// Cleanup: remove old entries if map is getting large
|
|
501
|
-
if (this.recentLogChunks.size > PtyWrapper.LOG_DEDUP_MAX_SIZE) {
|
|
502
|
-
const cutoff = now - PtyWrapper.LOG_DEDUP_WINDOW_MS * 2;
|
|
503
|
-
for (const [key, timestamp] of this.recentLogChunks) {
|
|
504
|
-
if (timestamp < cutoff) {
|
|
505
|
-
this.recentLogChunks.delete(key);
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
return false; // Not a duplicate
|
|
510
|
-
}
|
|
511
|
-
/**
|
|
512
|
-
* Auto-accept Claude's first-run prompts
|
|
513
|
-
* Handles multiple prompts in sequence:
|
|
514
|
-
* 1. --dangerously-skip-permissions acceptance ("Yes, I accept")
|
|
515
|
-
* 2. Trust directory prompt ("Yes, I trust this folder")
|
|
516
|
-
* 3. "Ready to code here?" permission prompt ("Yes, continue")
|
|
517
|
-
*
|
|
518
|
-
* Uses a Set to track which prompts have been accepted, allowing
|
|
519
|
-
* multiple different prompts to be handled in sequence.
|
|
520
|
-
*/
|
|
521
|
-
handleAutoAcceptPrompts(data) {
|
|
522
|
-
if (!this.ptyProcess || !this.running)
|
|
523
|
-
return;
|
|
524
|
-
// Skip auto-accept in interactive mode - user responds to prompts directly
|
|
525
|
-
if (this.config.interactive)
|
|
526
|
-
return;
|
|
527
|
-
const cleanData = stripAnsi(data);
|
|
528
|
-
// Check for the permission acceptance prompt (--dangerously-skip-permissions)
|
|
529
|
-
// Pattern: "2. Yes, I accept" in the output
|
|
530
|
-
if (!this.acceptedPrompts.has('permission') &&
|
|
531
|
-
cleanData.includes('Yes, I accept') && cleanData.includes('No, exit')) {
|
|
532
|
-
console.log(`[pty:${this.config.name}] Detected permission prompt, auto-accepting...`);
|
|
533
|
-
this.acceptedPrompts.add('permission');
|
|
534
|
-
// Send "2" to select "Yes, I accept" and Enter to confirm
|
|
535
|
-
setTimeout(() => {
|
|
536
|
-
if (this.ptyProcess && this.running) {
|
|
537
|
-
this.ptyProcess.write('2');
|
|
538
|
-
}
|
|
539
|
-
}, 100);
|
|
540
|
-
return;
|
|
541
|
-
}
|
|
542
|
-
// Check for the trust directory prompt
|
|
543
|
-
// Pattern: "1. Yes, I trust this folder" with "No, exit"
|
|
544
|
-
if (!this.acceptedPrompts.has('trust') &&
|
|
545
|
-
(cleanData.includes('trust this folder') || cleanData.includes('safety check'))
|
|
546
|
-
&& cleanData.includes('No, exit')) {
|
|
547
|
-
console.log(`[pty:${this.config.name}] Detected trust directory prompt, auto-accepting...`);
|
|
548
|
-
this.acceptedPrompts.add('trust');
|
|
549
|
-
// Send Enter to accept first option (already selected)
|
|
550
|
-
setTimeout(() => {
|
|
551
|
-
if (this.ptyProcess && this.running) {
|
|
552
|
-
this.ptyProcess.write('\r');
|
|
553
|
-
}
|
|
554
|
-
}, 300);
|
|
555
|
-
return;
|
|
556
|
-
}
|
|
557
|
-
// Check for "Ready to code here?" permission prompt
|
|
558
|
-
// Pattern: "Yes, continue" with "No, exit" and "Ready to code here?"
|
|
559
|
-
// This prompt asks for permission to work with files in the workspace
|
|
560
|
-
if (!this.acceptedPrompts.has('ready-to-code') &&
|
|
561
|
-
cleanData.includes('Yes, continue') && cleanData.includes('No, exit')
|
|
562
|
-
&& (cleanData.includes('Ready to code here') || cleanData.includes('permission to work with your files'))) {
|
|
563
|
-
console.log(`[pty:${this.config.name}] Detected "Ready to code here?" prompt, auto-accepting...`);
|
|
564
|
-
this.acceptedPrompts.add('ready-to-code');
|
|
565
|
-
// Send Enter to accept first option (already selected with ❯)
|
|
566
|
-
setTimeout(() => {
|
|
567
|
-
if (this.ptyProcess && this.running) {
|
|
568
|
-
this.ptyProcess.write('\r');
|
|
569
|
-
}
|
|
570
|
-
}, 300);
|
|
571
|
-
return;
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
/**
|
|
575
|
-
* Handle terminal escape sequences that require responses.
|
|
576
|
-
*
|
|
577
|
-
* Some CLI tools (like Codex) query terminal capabilities and expect responses.
|
|
578
|
-
* Without proper responses, they timeout and crash.
|
|
579
|
-
*
|
|
580
|
-
* Supported sequences:
|
|
581
|
-
* - CSI 6 n (DSR - Device Status Report for cursor position)
|
|
582
|
-
* Response: CSI row ; col R (we report position 1;1)
|
|
583
|
-
*/
|
|
584
|
-
handleTerminalEscapeSequences(data) {
|
|
585
|
-
if (!this.ptyProcess || !this.running)
|
|
586
|
-
return;
|
|
587
|
-
// Check for cursor position query: ESC [ 6 n
|
|
588
|
-
// This can appear as \x1b[6n or \x1b[?6n
|
|
589
|
-
// eslint-disable-next-line no-control-regex
|
|
590
|
-
if (/\x1b\[\??6n/.test(data)) {
|
|
591
|
-
// Respond with cursor at position (1, 1)
|
|
592
|
-
// Format: ESC [ row ; col R
|
|
593
|
-
const response = '\x1b[1;1R';
|
|
594
|
-
// Small delay to ensure the query has been fully processed
|
|
595
|
-
setTimeout(() => {
|
|
596
|
-
if (this.ptyProcess && this.running) {
|
|
597
|
-
this.ptyProcess.write(response);
|
|
598
|
-
}
|
|
599
|
-
}, 10);
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
/**
|
|
603
|
-
* Parse relay commands from output.
|
|
604
|
-
* Handles both single-line and multi-line (fenced) formats.
|
|
605
|
-
* Deduplication via sentMessageHashes.
|
|
606
|
-
*
|
|
607
|
-
* Optimization: Only parses new content since last parse to avoid O(n²) behavior.
|
|
608
|
-
* Uses lookback buffer for incomplete fenced messages that span output chunks.
|
|
609
|
-
*/
|
|
610
|
-
parseRelayCommands() {
|
|
611
|
-
const cleanContent = stripAnsi(this.rawBuffer);
|
|
612
|
-
// Skip if no new content
|
|
613
|
-
if (cleanContent.length <= this.lastParsedLength)
|
|
614
|
-
return;
|
|
615
|
-
// For fenced messages, need some lookback for incomplete fences that span chunks
|
|
616
|
-
// 500 chars is enough to capture most relay message headers
|
|
617
|
-
const lookbackStart = Math.max(0, this.lastParsedLength - 500);
|
|
618
|
-
const contentToParse = cleanContent.substring(lookbackStart);
|
|
619
|
-
// Debug: Check if content contains relay pattern
|
|
620
|
-
if (contentToParse.includes('->relay:')) {
|
|
621
|
-
const relayLines = contentToParse.split('\n').filter(l => l.includes('->relay:'));
|
|
622
|
-
console.log(`[pty:${this.config.name}] [RELAY-DEBUG] Found ${relayLines.length} lines with ->relay: pattern`);
|
|
623
|
-
relayLines.slice(0, 3).forEach((line, i) => {
|
|
624
|
-
console.log(`[pty:${this.config.name}] [RELAY-DEBUG] Line ${i}: "${line.substring(0, 80)}..."`);
|
|
625
|
-
});
|
|
626
|
-
}
|
|
627
|
-
// First, try to find fenced multi-line messages: ->relay:Target <<<\n...\n>>>
|
|
628
|
-
this.parseFencedMessages(contentToParse);
|
|
629
|
-
// Then parse single-line messages
|
|
630
|
-
this.parseSingleLineMessages(contentToParse);
|
|
631
|
-
// Parse spawn/release commands
|
|
632
|
-
this.parseSpawnReleaseCommands(contentToParse);
|
|
633
|
-
// Update parsed position
|
|
634
|
-
this.lastParsedLength = cleanContent.length;
|
|
635
|
-
}
|
|
636
|
-
/**
|
|
637
|
-
* Parse fenced multi-line messages: ->relay:Target [thread:xxx] <<<\n...\n>>>
|
|
638
|
-
*/
|
|
639
|
-
parseFencedMessages(content) {
|
|
640
|
-
// Pattern: ->relay:Target [thread:xxx] <<< (with content on same or following lines until >>>)
|
|
641
|
-
// Thread is optional, can be [thread:id] or [thread:project:id] for cross-project
|
|
642
|
-
const escapedPrefix = this.relayPrefix.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
643
|
-
const fenceStartPattern = new RegExp(`${escapedPrefix}(\\S+)(?:\\s+\\[thread:(?:([\\w-]+):)?([\\w-]+)\\])?\\s*<<<`, 'g');
|
|
644
|
-
// Debug: Log if content contains relay prefix with fenced syntax
|
|
645
|
-
if (content.includes(this.relayPrefix) && content.includes('<<<')) {
|
|
646
|
-
console.error(`[pty:${this.config.name}] parseFencedMessages: Found relay+<<< in content`);
|
|
647
|
-
}
|
|
648
|
-
let match;
|
|
649
|
-
while ((match = fenceStartPattern.exec(content)) !== null) {
|
|
650
|
-
const target = match[1];
|
|
651
|
-
console.error(`[pty:${this.config.name}] parseFencedMessages: MATCHED target=${target}`);
|
|
652
|
-
const threadProject = match[2]; // Optional: project part of thread
|
|
653
|
-
const threadId = match[3]; // Thread ID
|
|
654
|
-
const startIdx = match.index + match[0].length;
|
|
655
|
-
// Skip spawn/release commands - they are handled by parseSpawnReleaseCommands
|
|
656
|
-
if (/^spawn$/i.test(target) || /^release$/i.test(target)) {
|
|
657
|
-
continue;
|
|
658
|
-
}
|
|
659
|
-
// Skip placeholder targets (documentation examples like "AgentName", "Lead", etc.)
|
|
660
|
-
if (isPlaceholderTarget(target)) {
|
|
661
|
-
console.error(`[pty-wrapper] Filtered fenced message - placeholder target: ${target}`);
|
|
662
|
-
continue;
|
|
663
|
-
}
|
|
664
|
-
// Find the closing >>>
|
|
665
|
-
const endIdx = content.indexOf('>>>', startIdx);
|
|
666
|
-
if (endIdx === -1)
|
|
667
|
-
continue;
|
|
668
|
-
// Extract the body between <<< and >>>
|
|
669
|
-
const body = content.substring(startIdx, endIdx).trim();
|
|
670
|
-
if (!body)
|
|
671
|
-
continue;
|
|
672
|
-
// Parse target for cross-project syntax
|
|
673
|
-
const colonIdx = target.indexOf(':');
|
|
674
|
-
let to = target;
|
|
675
|
-
let project;
|
|
676
|
-
if (colonIdx > 0 && colonIdx < target.length - 1) {
|
|
677
|
-
project = target.substring(0, colonIdx);
|
|
678
|
-
to = target.substring(colonIdx + 1);
|
|
679
|
-
}
|
|
680
|
-
// Skip placeholder targets after parsing cross-project syntax
|
|
681
|
-
if (isPlaceholderTarget(to)) {
|
|
682
|
-
console.error(`[pty-wrapper] Filtered fenced message - placeholder target after cross-project parse: ${to}`);
|
|
683
|
-
continue;
|
|
684
|
-
}
|
|
685
|
-
this.sendRelayCommand({
|
|
686
|
-
to,
|
|
687
|
-
kind: 'message',
|
|
688
|
-
body,
|
|
689
|
-
project,
|
|
690
|
-
thread: threadId || undefined,
|
|
691
|
-
threadProject: threadProject || undefined,
|
|
692
|
-
raw: match[0],
|
|
693
|
-
});
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
/**
|
|
697
|
-
* Parse single-line messages (no fenced format)
|
|
698
|
-
* Format: ->relay:Target [thread:xxx] message body
|
|
699
|
-
*/
|
|
700
|
-
parseSingleLineMessages(content) {
|
|
701
|
-
const lines = content.split('\n');
|
|
702
|
-
for (const line of lines) {
|
|
703
|
-
// Skip lines that are part of fenced messages
|
|
704
|
-
if (line.includes('<<<') || line.includes('>>>'))
|
|
705
|
-
continue;
|
|
706
|
-
// Find the relay prefix in the line
|
|
707
|
-
const prefixIdx = line.indexOf(this.relayPrefix);
|
|
708
|
-
if (prefixIdx === -1)
|
|
709
|
-
continue;
|
|
710
|
-
// Skip spawn/release commands - they are handled by parseSpawnReleaseCommands
|
|
711
|
-
const afterPrefixForCheck = line.substring(prefixIdx + this.relayPrefix.length);
|
|
712
|
-
if (/^spawn\s+/i.test(afterPrefixForCheck) || /^release\s+/i.test(afterPrefixForCheck)) {
|
|
713
|
-
continue;
|
|
714
|
-
}
|
|
715
|
-
// Extract everything after the prefix
|
|
716
|
-
const afterPrefix = line.substring(prefixIdx + this.relayPrefix.length);
|
|
717
|
-
// Pattern: Target [thread:project:id] body or Target [thread:id] body or Target body
|
|
718
|
-
// Thread is optional, can include project prefix
|
|
719
|
-
const targetMatch = afterPrefix.match(/^(\S+)(?:\s+\[thread:(?:([\w-]+):)?([\w-]+)\])?\s+(.+)$/);
|
|
720
|
-
if (!targetMatch) {
|
|
721
|
-
// Fallback: try simpler pattern without thread
|
|
722
|
-
const simpleMatch = afterPrefix.match(/^(\S+)\s+(.+)$/);
|
|
723
|
-
if (!simpleMatch)
|
|
724
|
-
continue;
|
|
725
|
-
const [, target, body] = simpleMatch;
|
|
726
|
-
if (!body)
|
|
727
|
-
continue;
|
|
728
|
-
// Skip placeholder targets (documentation examples)
|
|
729
|
-
if (isPlaceholderTarget(target)) {
|
|
730
|
-
console.error(`[pty-wrapper] Filtered single-line message - placeholder target: ${target}`);
|
|
731
|
-
continue;
|
|
732
|
-
}
|
|
733
|
-
// Parse target for cross-project syntax
|
|
734
|
-
const colonIdx = target.indexOf(':');
|
|
735
|
-
let to = target;
|
|
736
|
-
let project;
|
|
737
|
-
if (colonIdx > 0 && colonIdx < target.length - 1) {
|
|
738
|
-
project = target.substring(0, colonIdx);
|
|
739
|
-
to = target.substring(colonIdx + 1);
|
|
740
|
-
}
|
|
741
|
-
// Skip placeholder targets after parsing cross-project syntax
|
|
742
|
-
if (isPlaceholderTarget(to)) {
|
|
743
|
-
console.error(`[pty-wrapper] Filtered single-line message - placeholder target after cross-project parse: ${to}`);
|
|
744
|
-
continue;
|
|
745
|
-
}
|
|
746
|
-
this.sendRelayCommand({
|
|
747
|
-
to,
|
|
748
|
-
kind: 'message',
|
|
749
|
-
body,
|
|
750
|
-
project,
|
|
751
|
-
raw: line,
|
|
752
|
-
});
|
|
753
|
-
continue;
|
|
754
|
-
}
|
|
755
|
-
const [, target, threadProject, threadId, body] = targetMatch;
|
|
756
|
-
if (!body)
|
|
757
|
-
continue;
|
|
758
|
-
// Skip placeholder targets (documentation examples)
|
|
759
|
-
if (isPlaceholderTarget(target)) {
|
|
760
|
-
console.error(`[pty-wrapper] Filtered single-line message - placeholder target: ${target}`);
|
|
761
|
-
continue;
|
|
762
|
-
}
|
|
763
|
-
// Parse target for cross-project syntax
|
|
764
|
-
const colonIdx = target.indexOf(':');
|
|
765
|
-
let to = target;
|
|
766
|
-
let project;
|
|
767
|
-
if (colonIdx > 0 && colonIdx < target.length - 1) {
|
|
768
|
-
project = target.substring(0, colonIdx);
|
|
769
|
-
to = target.substring(colonIdx + 1);
|
|
770
|
-
}
|
|
771
|
-
// Skip placeholder targets after parsing cross-project syntax
|
|
772
|
-
if (isPlaceholderTarget(to)) {
|
|
773
|
-
console.error(`[pty-wrapper] Filtered single-line message - placeholder target after cross-project parse: ${to}`);
|
|
774
|
-
continue;
|
|
775
|
-
}
|
|
776
|
-
this.sendRelayCommand({
|
|
777
|
-
to,
|
|
778
|
-
kind: 'message',
|
|
779
|
-
body,
|
|
780
|
-
project,
|
|
781
|
-
thread: threadId || undefined,
|
|
782
|
-
threadProject: threadProject || undefined,
|
|
783
|
-
raw: line,
|
|
784
|
-
});
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
/**
|
|
788
|
-
* Send relay command to daemon.
|
|
789
|
-
* Extends BaseWrapper to add PTY-specific logging and hook dispatch.
|
|
790
|
-
*/
|
|
791
|
-
sendRelayCommand(cmd) {
|
|
792
|
-
// Check if this message would be sent (before BaseWrapper deduplicates)
|
|
793
|
-
const msgHash = `${cmd.to}:${cmd.body.substring(0, 100)}`;
|
|
794
|
-
const wouldSend = !this.sentMessageHashes.has(msgHash) && this.client.state === 'READY';
|
|
795
|
-
// Call base class to handle deduplication and actual send
|
|
796
|
-
super.sendRelayCommand(cmd);
|
|
797
|
-
// PTY-specific: Dispatch message sent hook if the message was sent
|
|
798
|
-
if (wouldSend && this.sentMessageHashes.has(msgHash)) {
|
|
799
|
-
this.hookRegistry.dispatchMessageSent(cmd.to, cmd.body, cmd.thread).catch(err => {
|
|
800
|
-
console.error(`[pty:${this.config.name}] Message sent hook error:`, err);
|
|
801
|
-
});
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
/** Valid CLI types for spawn commands */
|
|
805
|
-
static VALID_CLI_TYPES = new Set([
|
|
806
|
-
'claude', 'codex', 'gemini', 'droid', 'aider', 'cursor', 'cline', 'opencode',
|
|
807
|
-
]);
|
|
808
|
-
/** Validate agent name format (PascalCase, alphanumeric, 2-30 chars) */
|
|
809
|
-
isValidAgentName(name) {
|
|
810
|
-
// Must start with uppercase letter, contain only alphanumeric chars
|
|
811
|
-
// Length 2-30 characters
|
|
812
|
-
return /^[A-Z][a-zA-Z0-9]{1,29}$/.test(name);
|
|
813
|
-
}
|
|
814
|
-
/** Validate CLI type */
|
|
815
|
-
isValidCliType(cli) {
|
|
816
|
-
return PtyWrapper.VALID_CLI_TYPES.has(cli.toLowerCase());
|
|
817
|
-
}
|
|
818
|
-
/**
|
|
819
|
-
* Parse spawn/release commands from output
|
|
820
|
-
* Uses string-based parsing for robustness with PTY output.
|
|
821
|
-
* Supports two formats:
|
|
822
|
-
* Single-line: ->relay:spawn WorkerName cli "task description"
|
|
823
|
-
* Multi-line (fenced): ->relay:spawn WorkerName cli <<<
|
|
824
|
-
* task description here
|
|
825
|
-
* can span multiple lines>>>
|
|
826
|
-
* Delegates to dashboard API if dashboardPort is set (for nested spawns).
|
|
827
|
-
*
|
|
828
|
-
* STRICT VALIDATION:
|
|
829
|
-
* - Command must be at start of line (after whitespace)
|
|
830
|
-
* - Agent name must be PascalCase (e.g., Backend, Frontend, Worker1)
|
|
831
|
-
* - CLI must be a known type (claude, codex, gemini, etc.)
|
|
832
|
-
*
|
|
833
|
-
* Overrides BaseWrapper to add PTY-specific validation and logging.
|
|
834
|
-
*/
|
|
835
|
-
parseSpawnReleaseCommands(content) {
|
|
836
|
-
// Need either API port or callbacks to handle spawn/release
|
|
837
|
-
// Also check allowSpawn config - spawned workers should not spawn other agents
|
|
838
|
-
const spawnAllowed = this.config.allowSpawn !== false;
|
|
839
|
-
const canSpawn = spawnAllowed && (this.config.dashboardPort || this.config.onSpawn);
|
|
840
|
-
const canRelease = this.config.dashboardPort || this.config.onRelease;
|
|
841
|
-
// Debug: always log spawn detection for debugging
|
|
842
|
-
if (content.includes('->relay:spawn')) {
|
|
843
|
-
console.log(`[pty:${this.config.name}] [SPAWN-DEBUG] Spawn pattern detected in content`);
|
|
844
|
-
console.log(`[pty:${this.config.name}] [SPAWN-DEBUG] canSpawn=${canSpawn} (allowSpawn=${spawnAllowed}, dashboardPort=${this.config.dashboardPort}, hasOnSpawn=${!!this.config.onSpawn})`);
|
|
845
|
-
// Log the actual lines containing spawn
|
|
846
|
-
const spawnLines = content.split('\n').filter(l => l.includes('->relay:spawn'));
|
|
847
|
-
spawnLines.forEach((line, i) => {
|
|
848
|
-
console.log(`[pty:${this.config.name}] [SPAWN-DEBUG] Line ${i}: "${line.substring(0, 100)}"`);
|
|
849
|
-
});
|
|
850
|
-
}
|
|
851
|
-
// Debug: always log release detection for debugging
|
|
852
|
-
if (content.includes('->relay:release')) {
|
|
853
|
-
console.log(`[pty:${this.config.name}] [RELEASE-DEBUG] Release pattern detected in content`);
|
|
854
|
-
console.log(`[pty:${this.config.name}] [RELEASE-DEBUG] canRelease=${canRelease} (dashboardPort=${this.config.dashboardPort}, hasOnRelease=${!!this.config.onRelease})`);
|
|
855
|
-
}
|
|
856
|
-
if (!canSpawn && !canRelease)
|
|
857
|
-
return;
|
|
858
|
-
const lines = content.split('\n');
|
|
859
|
-
const spawnPrefix = '->relay:spawn';
|
|
860
|
-
const releasePrefix = '->relay:release';
|
|
861
|
-
for (const line of lines) {
|
|
862
|
-
let trimmed = line.trim();
|
|
863
|
-
// Strip bullet/prompt prefixes but PRESERVE the ->relay: pattern
|
|
864
|
-
// Look for ->relay: in the line and only strip what comes before it
|
|
865
|
-
const relayIdx = trimmed.indexOf('->relay:');
|
|
866
|
-
if (relayIdx > 0) {
|
|
867
|
-
// There's content before ->relay: - check if it's just prefix chars
|
|
868
|
-
const beforeRelay = trimmed.substring(0, relayIdx);
|
|
869
|
-
// Only strip if the prefix is just bullets/prompts/whitespace
|
|
870
|
-
if (/^[\s●•◦‣⁃⏺◆◇○□■│┃┆┇┊┋╎╏✦→➜›»$%#*]+$/.test(beforeRelay)) {
|
|
871
|
-
const originalTrimmed = trimmed;
|
|
872
|
-
trimmed = trimmed.substring(relayIdx);
|
|
873
|
-
console.log(`[pty:${this.config.name}] [SPAWN-DEBUG] Stripped prefix: "${originalTrimmed.substring(0, 60)}" -> "${trimmed.substring(0, 60)}"`);
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
// Skip escaped commands: \->relay:spawn should not trigger
|
|
877
|
-
if (trimmed.includes('\\->relay:')) {
|
|
878
|
-
continue;
|
|
879
|
-
}
|
|
880
|
-
// If we're in fenced spawn mode, accumulate lines until we see >>>
|
|
881
|
-
if (this.pendingFencedSpawn) {
|
|
882
|
-
const closeIdx = trimmed.indexOf('>>>');
|
|
883
|
-
if (closeIdx !== -1) {
|
|
884
|
-
// Add content before >>> to task
|
|
885
|
-
const contentBeforeClose = trimmed.substring(0, closeIdx);
|
|
886
|
-
if (contentBeforeClose) {
|
|
887
|
-
this.pendingFencedSpawn.taskLines.push(contentBeforeClose);
|
|
888
|
-
}
|
|
889
|
-
// Execute the spawn with accumulated task
|
|
890
|
-
const { name, cli, taskLines } = this.pendingFencedSpawn;
|
|
891
|
-
const taskStr = taskLines.join('\n').trim();
|
|
892
|
-
const spawnKey = `${name}:${cli}`;
|
|
893
|
-
if (!this.processedSpawnCommands.has(spawnKey)) {
|
|
894
|
-
this.processedSpawnCommands.add(spawnKey);
|
|
895
|
-
console.log(`[pty:${this.config.name}] Spawn command (fenced): ${name} (${cli}) - "${taskStr.substring(0, 50)}..."`);
|
|
896
|
-
this.executeSpawn(name, cli, taskStr);
|
|
897
|
-
}
|
|
898
|
-
this.pendingFencedSpawn = null;
|
|
899
|
-
}
|
|
900
|
-
else {
|
|
901
|
-
// Accumulate line as part of task
|
|
902
|
-
this.pendingFencedSpawn.taskLines.push(line);
|
|
903
|
-
}
|
|
904
|
-
continue;
|
|
905
|
-
}
|
|
906
|
-
// Check for fenced spawn start: ->relay:spawn Name [cli] <<<
|
|
907
|
-
// STRICT: Must be at start of line (after whitespace)
|
|
908
|
-
if (canSpawn && trimmed.startsWith(spawnPrefix)) {
|
|
909
|
-
const afterSpawn = trimmed.substring(spawnPrefix.length).trim();
|
|
910
|
-
console.log(`[pty:${this.config.name}] [SPAWN-DEBUG] Detected spawn prefix, afterSpawn: "${afterSpawn.substring(0, 60)}"`);
|
|
911
|
-
// Check for fenced format: Name [cli] <<< (CLI optional, defaults to 'claude')
|
|
912
|
-
const fencedMatch = afterSpawn.match(/^(\S+)(?:\s+(\S+))?\s+<<<(.*)$/);
|
|
913
|
-
console.log(`[pty:${this.config.name}] [SPAWN-DEBUG] Fenced match result: ${fencedMatch ? 'MATCHED' : 'NO MATCH'}`);
|
|
914
|
-
if (fencedMatch) {
|
|
915
|
-
const [, name, cliOrUndefined, inlineContent] = fencedMatch;
|
|
916
|
-
let cli = cliOrUndefined || 'claude';
|
|
917
|
-
// STRICT: Validate agent name (PascalCase) and CLI type
|
|
918
|
-
if (!this.isValidAgentName(name)) {
|
|
919
|
-
console.warn(`[pty:${this.config.name}] Invalid agent name format, skipping: name=${name} (must be PascalCase)`);
|
|
920
|
-
continue;
|
|
921
|
-
}
|
|
922
|
-
if (!this.isValidCliType(cli)) {
|
|
923
|
-
console.warn(`[pty:${this.config.name}] Unknown CLI type, using default: cli=${cli}`);
|
|
924
|
-
cli = 'claude';
|
|
925
|
-
}
|
|
926
|
-
// Check if fence closes on same line
|
|
927
|
-
const inlineCloseIdx = inlineContent.indexOf('>>>');
|
|
928
|
-
if (inlineCloseIdx !== -1) {
|
|
929
|
-
// Single line fenced: extract task between <<< and >>>
|
|
930
|
-
const taskStr = inlineContent.substring(0, inlineCloseIdx).trim();
|
|
931
|
-
const spawnKey = `${name}:${cli}`;
|
|
932
|
-
if (!this.processedSpawnCommands.has(spawnKey)) {
|
|
933
|
-
this.processedSpawnCommands.add(spawnKey);
|
|
934
|
-
console.log(`[pty:${this.config.name}] Spawn command (fenced): ${name} (${cli}) - "${taskStr.substring(0, 50)}..."`);
|
|
935
|
-
this.executeSpawn(name, cli, taskStr);
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
else {
|
|
939
|
-
// Start multi-line fenced mode - but only if not already processed
|
|
940
|
-
const spawnKey = `${name}:${cli}`;
|
|
941
|
-
if (this.processedSpawnCommands.has(spawnKey)) {
|
|
942
|
-
// Already processed this spawn, skip the fenced capture
|
|
943
|
-
continue;
|
|
944
|
-
}
|
|
945
|
-
this.pendingFencedSpawn = {
|
|
946
|
-
name,
|
|
947
|
-
cli,
|
|
948
|
-
taskLines: inlineContent.trim() ? [inlineContent.trim()] : [],
|
|
949
|
-
};
|
|
950
|
-
console.log(`[pty:${this.config.name}] Starting fenced spawn capture: ${name} (${cli})`);
|
|
951
|
-
}
|
|
952
|
-
continue;
|
|
953
|
-
}
|
|
954
|
-
// Parse single-line format: WorkerName [cli] [task]
|
|
955
|
-
// CLI defaults to 'claude' if not provided
|
|
956
|
-
const parts = afterSpawn.split(/\s+/);
|
|
957
|
-
if (parts.length >= 1) {
|
|
958
|
-
const name = parts[0];
|
|
959
|
-
// CLI is optional - defaults to 'claude'
|
|
960
|
-
let cli = parts[1] || 'claude';
|
|
961
|
-
// Task is everything after cli (if cli was provided) or after name (if cli was omitted)
|
|
962
|
-
let task = '';
|
|
963
|
-
const taskStartIndex = parts[1] ? 2 : 1;
|
|
964
|
-
if (parts.length > taskStartIndex) {
|
|
965
|
-
const taskPart = parts.slice(taskStartIndex).join(' ');
|
|
966
|
-
// Remove surrounding quotes if present
|
|
967
|
-
const quoteMatch = taskPart.match(/^["'](.*)["']$/);
|
|
968
|
-
task = quoteMatch ? quoteMatch[1] : taskPart;
|
|
969
|
-
}
|
|
970
|
-
if (name) {
|
|
971
|
-
// STRICT: Validate agent name (PascalCase) and CLI type
|
|
972
|
-
if (!this.isValidAgentName(name)) {
|
|
973
|
-
// Don't log warning for documentation text - just silently skip
|
|
974
|
-
continue;
|
|
975
|
-
}
|
|
976
|
-
if (!this.isValidCliType(cli)) {
|
|
977
|
-
// Default CLI 'claude' should always be valid, but validate anyway
|
|
978
|
-
console.warn(`[pty:${this.config.name}] Unknown CLI type, using default: cli=${cli}, defaulting to 'claude'`);
|
|
979
|
-
cli = 'claude';
|
|
980
|
-
}
|
|
981
|
-
const spawnKey = `${name}:${cli}`;
|
|
982
|
-
if (!this.processedSpawnCommands.has(spawnKey)) {
|
|
983
|
-
this.processedSpawnCommands.add(spawnKey);
|
|
984
|
-
this.executeSpawn(name, cli, task);
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
continue;
|
|
989
|
-
}
|
|
990
|
-
// Check for release command
|
|
991
|
-
// STRICT: Must be at start of line (after whitespace)
|
|
992
|
-
if (trimmed.startsWith(releasePrefix)) {
|
|
993
|
-
console.log(`[pty:${this.config.name}] [RELEASE-DEBUG] Release prefix detected, canRelease=${canRelease}`);
|
|
994
|
-
if (canRelease) {
|
|
995
|
-
const afterRelease = trimmed.substring(releasePrefix.length).trim();
|
|
996
|
-
const name = afterRelease.split(/\s+/)[0];
|
|
997
|
-
console.log(`[pty:${this.config.name}] [RELEASE-DEBUG] Parsed name: ${name}, isValidName=${name ? this.isValidAgentName(name) : false}, alreadyProcessed=${this.processedReleaseCommands.has(name)}`);
|
|
998
|
-
// STRICT: Validate agent name format
|
|
999
|
-
if (name && this.isValidAgentName(name) && !this.processedReleaseCommands.has(name)) {
|
|
1000
|
-
this.processedReleaseCommands.add(name);
|
|
1001
|
-
this.executeRelease(name);
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
/**
|
|
1008
|
-
* Execute spawn via API or callback.
|
|
1009
|
-
* After spawning, waits for the agent to come online and sends the task via relay.
|
|
1010
|
-
*/
|
|
1011
|
-
async executeSpawn(name, cli, task) {
|
|
1012
|
-
console.log(`[pty:${this.config.name}] [SPAWN-DEBUG] executeSpawn called: name=${name}, cli=${cli}, task="${task.substring(0, 50)}..."`);
|
|
1013
|
-
console.log(`[pty:${this.config.name}] [SPAWN-DEBUG] dashboardPort=${this.config.dashboardPort}, hasOnSpawn=${!!this.config.onSpawn}`);
|
|
1014
|
-
let spawned = false;
|
|
1015
|
-
if (this.config.dashboardPort) {
|
|
1016
|
-
// Use dashboard API for spawning (works from spawned agents)
|
|
1017
|
-
try {
|
|
1018
|
-
const response = await fetch(`http://localhost:${this.config.dashboardPort}/api/spawn`, {
|
|
1019
|
-
method: 'POST',
|
|
1020
|
-
headers: { 'Content-Type': 'application/json' },
|
|
1021
|
-
body: JSON.stringify({ name, cli }), // No task - we send it after agent is online
|
|
1022
|
-
});
|
|
1023
|
-
const result = await response.json();
|
|
1024
|
-
if (result.success) {
|
|
1025
|
-
console.log(`[pty:${this.config.name}] Spawned ${name} via API`);
|
|
1026
|
-
spawned = true;
|
|
1027
|
-
}
|
|
1028
|
-
else {
|
|
1029
|
-
console.error(`[pty:${this.config.name}] Spawn failed: ${result.error}`);
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
catch (err) {
|
|
1033
|
-
console.error(`[pty:${this.config.name}] Spawn API call failed: ${err.message}`);
|
|
1034
|
-
}
|
|
1035
|
-
}
|
|
1036
|
-
else if (this.config.onSpawn) {
|
|
1037
|
-
// Fall back to callback
|
|
1038
|
-
try {
|
|
1039
|
-
await this.config.onSpawn(name, cli, task);
|
|
1040
|
-
spawned = true;
|
|
1041
|
-
}
|
|
1042
|
-
catch (err) {
|
|
1043
|
-
console.error(`[pty:${this.config.name}] Spawn failed: ${err.message}`);
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1046
|
-
// If spawn succeeded and we have a task, wait for agent to come online and send it
|
|
1047
|
-
if (spawned && task && task.trim() && this.config.dashboardPort) {
|
|
1048
|
-
await this.waitAndSendTask(name, task);
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
/**
|
|
1052
|
-
* Wait for a spawned agent to come online, then send the task via relay.
|
|
1053
|
-
* Uses the wrapper's own relay client so the message comes "from" this agent,
|
|
1054
|
-
* not from the dashboard's relay client.
|
|
1055
|
-
*/
|
|
1056
|
-
async waitAndSendTask(agentName, task) {
|
|
1057
|
-
const maxWaitMs = 30000;
|
|
1058
|
-
const pollIntervalMs = 500;
|
|
1059
|
-
const startTime = Date.now();
|
|
1060
|
-
console.log(`[pty:${this.config.name}] Waiting for ${agentName} to come online...`);
|
|
1061
|
-
// Poll for agent to be online using dedicated status endpoint
|
|
1062
|
-
while (Date.now() - startTime < maxWaitMs) {
|
|
1063
|
-
try {
|
|
1064
|
-
const response = await fetch(`http://localhost:${this.config.dashboardPort}/api/agents/${encodeURIComponent(agentName)}/online`);
|
|
1065
|
-
const data = await response.json();
|
|
1066
|
-
if (data.online) {
|
|
1067
|
-
console.log(`[pty:${this.config.name}] ${agentName} is online, sending task...`);
|
|
1068
|
-
// Send task directly via our relay client (not dashboard API)
|
|
1069
|
-
// This ensures the message comes "from" this agent, not from _DashboardUI
|
|
1070
|
-
if (this.client.state === 'READY') {
|
|
1071
|
-
const sent = this.client.sendMessage(agentName, task, 'message');
|
|
1072
|
-
if (sent) {
|
|
1073
|
-
console.log(`[pty:${this.config.name}] Task sent to ${agentName}`);
|
|
1074
|
-
}
|
|
1075
|
-
else {
|
|
1076
|
-
console.error(`[pty:${this.config.name}] Failed to send task to ${agentName}: sendMessage returned false`);
|
|
1077
|
-
}
|
|
1078
|
-
}
|
|
1079
|
-
else {
|
|
1080
|
-
console.error(`[pty:${this.config.name}] Failed to send task to ${agentName}: relay client not ready (state: ${this.client.state})`);
|
|
1081
|
-
}
|
|
1082
|
-
return;
|
|
1083
|
-
}
|
|
1084
|
-
}
|
|
1085
|
-
catch (err) {
|
|
1086
|
-
// Ignore poll errors, keep trying
|
|
1087
|
-
}
|
|
1088
|
-
await sleep(pollIntervalMs);
|
|
1089
|
-
}
|
|
1090
|
-
console.error(`[pty:${this.config.name}] Timeout waiting for ${agentName} to come online`);
|
|
1091
|
-
}
|
|
1092
|
-
/**
|
|
1093
|
-
* Execute release via API or callback.
|
|
1094
|
-
* Overrides BaseWrapper to add PTY-specific logging and API path.
|
|
1095
|
-
*/
|
|
1096
|
-
async executeRelease(name) {
|
|
1097
|
-
if (this.config.dashboardPort) {
|
|
1098
|
-
// Use dashboard API for releasing
|
|
1099
|
-
try {
|
|
1100
|
-
const response = await fetch(`http://localhost:${this.config.dashboardPort}/api/spawned/${encodeURIComponent(name)}`, {
|
|
1101
|
-
method: 'DELETE',
|
|
1102
|
-
});
|
|
1103
|
-
const result = await response.json();
|
|
1104
|
-
if (result.success) {
|
|
1105
|
-
console.log(`[pty:${this.config.name}] Released ${name} via API`);
|
|
1106
|
-
}
|
|
1107
|
-
else {
|
|
1108
|
-
console.error(`[pty:${this.config.name}] Release failed: ${result.error}`);
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
catch (err) {
|
|
1112
|
-
console.error(`[pty:${this.config.name}] Release API call failed: ${err.message}`);
|
|
1113
|
-
}
|
|
1114
|
-
}
|
|
1115
|
-
else if (this.config.onRelease) {
|
|
1116
|
-
// Fall back to callback
|
|
1117
|
-
try {
|
|
1118
|
-
await this.config.onRelease(name);
|
|
1119
|
-
}
|
|
1120
|
-
catch (err) {
|
|
1121
|
-
console.error(`[pty:${this.config.name}] Release failed: ${err.message}`);
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
/**
|
|
1126
|
-
* Handle incoming message from relay.
|
|
1127
|
-
* Extends BaseWrapper to add PTY-specific behavior.
|
|
1128
|
-
*/
|
|
1129
|
-
handleIncomingMessage(from, payload, messageId, meta, originalTo) {
|
|
1130
|
-
const bodyPreview = payload.body.substring(0, 50).replace(/\n/g, '\\n');
|
|
1131
|
-
console.log(`[pty:${this.config.name}] Message received from ${from}: "${bodyPreview}..." (readyForMessages=${this.readyForMessages}, queueLen=${this.messageQueue.length})`);
|
|
1132
|
-
// Call base class to handle deduplication and queuing
|
|
1133
|
-
super.handleIncomingMessage(from, payload, messageId, meta, originalTo);
|
|
1134
|
-
// PTY-specific: Process the message queue immediately
|
|
1135
|
-
this.processMessageQueue();
|
|
1136
|
-
// PTY-specific: Dispatch message received hook
|
|
1137
|
-
this.hookRegistry.dispatchMessageReceived(from, payload.body, messageId).catch(err => {
|
|
1138
|
-
console.error(`[pty:${this.config.name}] Message received hook error:`, err);
|
|
1139
|
-
});
|
|
1140
|
-
}
|
|
1141
|
-
/**
|
|
1142
|
-
* Handle incoming channel message from relay.
|
|
1143
|
-
* Extends BaseWrapper to add PTY-specific queue processing.
|
|
1144
|
-
*/
|
|
1145
|
-
handleIncomingChannelMessage(from, channel, body, envelope) {
|
|
1146
|
-
// Call base class to handle deduplication and queuing
|
|
1147
|
-
super.handleIncomingChannelMessage(from, channel, body, envelope);
|
|
1148
|
-
// PTY-specific: Process the message queue immediately
|
|
1149
|
-
this.processMessageQueue();
|
|
1150
|
-
// PTY-specific: Dispatch message received hook with channel info
|
|
1151
|
-
this.hookRegistry.dispatchMessageReceived(from, body, envelope.id).catch(err => {
|
|
1152
|
-
console.error(`[pty:${this.config.name}] Channel message received hook error:`, err);
|
|
1153
|
-
});
|
|
1154
|
-
}
|
|
1155
|
-
/**
|
|
1156
|
-
* Wait for output to stabilize before injection.
|
|
1157
|
-
* Uses UniversalIdleDetector (from BaseWrapper) for robust cross-CLI idle detection.
|
|
1158
|
-
* Returns true if agent is idle and ready for input.
|
|
1159
|
-
*/
|
|
1160
|
-
async waitForOutputStable() {
|
|
1161
|
-
const result = await this.waitForIdleState(INJECTION_CONSTANTS.STABILITY_TIMEOUT_MS, INJECTION_CONSTANTS.STABILITY_POLL_MS);
|
|
1162
|
-
if (result.isIdle) {
|
|
1163
|
-
console.log(`[pty:${this.config.name}] Idle detected (confidence: ${(result.confidence * 100).toFixed(0)}%)`);
|
|
1164
|
-
return true;
|
|
1165
|
-
}
|
|
1166
|
-
// Timeout - return true anyway to avoid blocking forever
|
|
1167
|
-
console.warn(`[pty:${this.config.name}] Stability timeout, proceeding with injection`);
|
|
1168
|
-
return true;
|
|
1169
|
-
}
|
|
1170
|
-
/**
|
|
1171
|
-
* Check if the agent process is still alive and responsive.
|
|
1172
|
-
*/
|
|
1173
|
-
isAgentAlive() {
|
|
1174
|
-
return this.running && this.ptyProcess !== undefined;
|
|
1175
|
-
}
|
|
1176
|
-
/**
|
|
1177
|
-
* Process queued messages with reliability improvements:
|
|
1178
|
-
* 1. Wait for output stability before injection
|
|
1179
|
-
* 2. Verify injection appeared in output
|
|
1180
|
-
* 3. Retry with backoff on failure
|
|
1181
|
-
* 4. Fall back to logging on complete failure
|
|
1182
|
-
*
|
|
1183
|
-
* Uses shared injection logic with PTY-specific callbacks.
|
|
1184
|
-
*/
|
|
1185
|
-
async processMessageQueue() {
|
|
1186
|
-
// Wait until instructions have been injected and agent is ready
|
|
1187
|
-
if (!this.readyForMessages)
|
|
1188
|
-
return;
|
|
1189
|
-
if (this.isInjecting || this.messageQueue.length === 0)
|
|
1190
|
-
return;
|
|
1191
|
-
// Health check: is agent still alive?
|
|
1192
|
-
if (!this.isAgentAlive()) {
|
|
1193
|
-
console.error(`[pty:${this.config.name}] Agent not alive, cannot inject messages`);
|
|
1194
|
-
return;
|
|
1195
|
-
}
|
|
1196
|
-
this.isInjecting = true;
|
|
1197
|
-
const msg = this.messageQueue.shift();
|
|
1198
|
-
if (!msg) {
|
|
1199
|
-
this.isInjecting = false;
|
|
1200
|
-
return;
|
|
1201
|
-
}
|
|
1202
|
-
const bodyPreview = msg.body.substring(0, 50).replace(/\n/g, '\\n');
|
|
1203
|
-
console.log(`[pty:${this.config.name}] Processing message from ${msg.from}: "${bodyPreview}..." (remaining=${this.messageQueue.length})`);
|
|
1204
|
-
try {
|
|
1205
|
-
// Wait for output to stabilize before injecting
|
|
1206
|
-
await this.waitForOutputStable();
|
|
1207
|
-
// For Gemini: check if at shell prompt, skip injection to avoid shell execution
|
|
1208
|
-
if (this.cliType === 'gemini') {
|
|
1209
|
-
const recentOutput = this.rawBuffer.slice(-200);
|
|
1210
|
-
const lastLine = recentOutput.split('\n').filter(l => l.trim()).pop() || '';
|
|
1211
|
-
if (CLI_QUIRKS.isShellPrompt(lastLine)) {
|
|
1212
|
-
console.log(`[pty:${this.config.name}] Gemini at shell prompt, re-queuing message`);
|
|
1213
|
-
this.messageQueue.unshift(msg);
|
|
1214
|
-
this.isInjecting = false;
|
|
1215
|
-
setTimeout(() => this.processMessageQueue(), 2000);
|
|
1216
|
-
return;
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
// Build injection string using shared utility
|
|
1220
|
-
let injection = buildInjectionString(msg);
|
|
1221
|
-
// Gemini-specific: wrap in backticks to prevent shell keyword interpretation
|
|
1222
|
-
if (this.cliType === 'gemini') {
|
|
1223
|
-
// Extract the message body part and wrap it
|
|
1224
|
-
const colonIdx = injection.indexOf(': ');
|
|
1225
|
-
if (colonIdx > 0) {
|
|
1226
|
-
const prefix = injection.substring(0, colonIdx + 2);
|
|
1227
|
-
const body = injection.substring(colonIdx + 2);
|
|
1228
|
-
injection = prefix + CLI_QUIRKS.wrapForGemini(body);
|
|
1229
|
-
}
|
|
1230
|
-
}
|
|
1231
|
-
const shortId = msg.messageId.substring(0, 8);
|
|
1232
|
-
// Create callbacks for shared injection logic
|
|
1233
|
-
const callbacks = {
|
|
1234
|
-
getOutput: async () => {
|
|
1235
|
-
// Look at last 2000 chars to avoid scanning entire buffer
|
|
1236
|
-
return this.rawBuffer.slice(-2000);
|
|
1237
|
-
},
|
|
1238
|
-
performInjection: async (inj) => {
|
|
1239
|
-
if (!this.ptyProcess || !this.running) {
|
|
1240
|
-
throw new Error('PTY process not running');
|
|
1241
|
-
}
|
|
1242
|
-
// Use bracketed paste mode for CLIs that support it (claude, codex, gemini)
|
|
1243
|
-
// This prevents interleaving with CLI output and ensures clean input
|
|
1244
|
-
const useBracketedPaste = this.cliType === 'claude' || this.cliType === 'codex' || this.cliType === 'gemini';
|
|
1245
|
-
if (useBracketedPaste) {
|
|
1246
|
-
// Bracketed paste: \x1b[200~ starts paste, \x1b[201~ ends paste
|
|
1247
|
-
this.ptyProcess.write('\x1b[200~' + inj + '\x1b[201~');
|
|
1248
|
-
}
|
|
1249
|
-
else {
|
|
1250
|
-
this.ptyProcess.write(inj);
|
|
1251
|
-
}
|
|
1252
|
-
// Wait longer for CLI to process the pasted content before sending Enter.
|
|
1253
|
-
// The standard 50ms delay is too short for CLIs like Claude that need time
|
|
1254
|
-
// to process bracketed paste content before accepting Enter.
|
|
1255
|
-
await sleep(200);
|
|
1256
|
-
// Send Enter key - use \r for PTY (carriage return)
|
|
1257
|
-
this.ptyProcess.write('\r');
|
|
1258
|
-
},
|
|
1259
|
-
log: (message) => console.log(`[pty:${this.config.name}] ${message}`),
|
|
1260
|
-
logError: (message) => console.error(`[pty:${this.config.name}] ${message}`),
|
|
1261
|
-
getMetrics: () => this.injectionMetrics,
|
|
1262
|
-
// Skip verification for PTY-based injection - CLIs don't echo input back
|
|
1263
|
-
// so verification will always fail. Trust that pty.write() succeeds.
|
|
1264
|
-
skipVerification: true,
|
|
1265
|
-
};
|
|
1266
|
-
// Inject with retry and verification using shared logic
|
|
1267
|
-
const result = await sharedInjectWithRetry(injection, shortId, msg.from, callbacks);
|
|
1268
|
-
if (!result.success) {
|
|
1269
|
-
// Log the failed message for debugging/recovery
|
|
1270
|
-
console.error(`[pty:${this.config.name}] Message delivery failed after ${result.attempts} attempts: ` +
|
|
1271
|
-
`from=${msg.from} id=${shortId}`);
|
|
1272
|
-
// Emit event for external monitoring (e.g., dashboard)
|
|
1273
|
-
this.emit('injection-failed', {
|
|
1274
|
-
messageId: msg.messageId,
|
|
1275
|
-
from: msg.from,
|
|
1276
|
-
attempts: result.attempts,
|
|
1277
|
-
});
|
|
1278
|
-
}
|
|
1279
|
-
}
|
|
1280
|
-
catch (err) {
|
|
1281
|
-
console.error(`[pty:${this.config.name}] Injection failed: ${err.message}`);
|
|
1282
|
-
}
|
|
1283
|
-
finally {
|
|
1284
|
-
this.isInjecting = false;
|
|
1285
|
-
// Process next message if any
|
|
1286
|
-
if (this.messageQueue.length > 0) {
|
|
1287
|
-
setTimeout(() => this.processMessageQueue(), INJECTION_CONSTANTS.QUEUE_PROCESS_DELAY_MS);
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
/**
|
|
1292
|
-
* Queue minimal agent identity notification as the first message.
|
|
1293
|
-
*
|
|
1294
|
-
* Full protocol instructions are in ~/.claude/CLAUDE.md (set up by entrypoint.sh).
|
|
1295
|
-
* We only inject a brief identity message here to let the agent know its name
|
|
1296
|
-
* and that it's connected to the relay.
|
|
1297
|
-
*/
|
|
1298
|
-
injectInstructions() {
|
|
1299
|
-
if (!this.running)
|
|
1300
|
-
return;
|
|
1301
|
-
if (this.config.skipInstructions)
|
|
1302
|
-
return;
|
|
1303
|
-
// Guard: Only inject once per session
|
|
1304
|
-
if (this.instructionsInjected) {
|
|
1305
|
-
console.log(`[pty:${this.config.name}] Init instructions already injected, skipping`);
|
|
1306
|
-
return;
|
|
1307
|
-
}
|
|
1308
|
-
this.instructionsInjected = true;
|
|
1309
|
-
// Minimal notification - full protocol is in ~/.claude/CLAUDE.md
|
|
1310
|
-
const notification = `You are agent "${this.config.name}" connected to Agent Relay. See CLAUDE.md for the messaging protocol. ACK messages, do work, send DONE when complete.`;
|
|
1311
|
-
// Queue as first message from "system" - will be injected when CLI is ready
|
|
1312
|
-
this.messageQueue.unshift({
|
|
1313
|
-
from: 'system',
|
|
1314
|
-
body: notification,
|
|
1315
|
-
messageId: `init-${Date.now()}`,
|
|
1316
|
-
});
|
|
1317
|
-
}
|
|
1318
|
-
/**
|
|
1319
|
-
* Write directly to the PTY
|
|
1320
|
-
*/
|
|
1321
|
-
write(data) {
|
|
1322
|
-
if (this.ptyProcess && this.running) {
|
|
1323
|
-
this.ptyProcess.write(data);
|
|
1324
|
-
}
|
|
1325
|
-
}
|
|
1326
|
-
/**
|
|
1327
|
-
* Get captured output lines
|
|
1328
|
-
*/
|
|
1329
|
-
getOutput(limit) {
|
|
1330
|
-
if (limit && limit > 0) {
|
|
1331
|
-
return this.outputBuffer.slice(-limit);
|
|
1332
|
-
}
|
|
1333
|
-
return [...this.outputBuffer];
|
|
1334
|
-
}
|
|
1335
|
-
/**
|
|
1336
|
-
* Get raw output buffer
|
|
1337
|
-
*/
|
|
1338
|
-
getRawOutput() {
|
|
1339
|
-
return this.rawBuffer;
|
|
1340
|
-
}
|
|
1341
|
-
/**
|
|
1342
|
-
* Stop the agent process
|
|
1343
|
-
*/
|
|
1344
|
-
async stop() {
|
|
1345
|
-
if (!this.running)
|
|
1346
|
-
return;
|
|
1347
|
-
this.running = false;
|
|
1348
|
-
this.stopStuckDetection();
|
|
1349
|
-
// Auto-save continuity state before stopping
|
|
1350
|
-
// Pass sessionEndData to populate handoff (fixes empty handoff issue)
|
|
1351
|
-
if (this.continuity) {
|
|
1352
|
-
try {
|
|
1353
|
-
await this.continuity.autoSave(this.config.name, 'session_end', this.sessionEndData);
|
|
1354
|
-
}
|
|
1355
|
-
catch (err) {
|
|
1356
|
-
console.error(`[pty:${this.config.name}] Continuity auto-save failed:`, err);
|
|
1357
|
-
}
|
|
1358
|
-
}
|
|
1359
|
-
// Dispatch session end hook (handles trajectory completion)
|
|
1360
|
-
try {
|
|
1361
|
-
await this.hookRegistry.dispatchSessionEnd(0, true);
|
|
1362
|
-
}
|
|
1363
|
-
catch (err) {
|
|
1364
|
-
console.error(`[pty:${this.config.name}] Session end hook error:`, err);
|
|
1365
|
-
}
|
|
1366
|
-
if (this.ptyProcess) {
|
|
1367
|
-
// Try graceful termination first
|
|
1368
|
-
this.ptyProcess.write('\x03'); // Ctrl+C
|
|
1369
|
-
await sleep(1000);
|
|
1370
|
-
if (this.ptyProcess) {
|
|
1371
|
-
this.ptyProcess.kill();
|
|
1372
|
-
}
|
|
1373
|
-
}
|
|
1374
|
-
this.closeLogStream();
|
|
1375
|
-
this.client.destroy();
|
|
1376
|
-
this.hookRegistry.destroy();
|
|
1377
|
-
}
|
|
1378
|
-
/**
|
|
1379
|
-
* Kill the process immediately
|
|
1380
|
-
*/
|
|
1381
|
-
async kill() {
|
|
1382
|
-
this.running = false;
|
|
1383
|
-
// Auto-save continuity state before killing (with timeout to avoid hanging)
|
|
1384
|
-
// Pass sessionEndData if available (may have been parsed before kill)
|
|
1385
|
-
if (this.continuity) {
|
|
1386
|
-
try {
|
|
1387
|
-
await Promise.race([
|
|
1388
|
-
this.continuity.autoSave(this.config.name, 'crash', this.sessionEndData),
|
|
1389
|
-
sleep(2000), // 2s timeout for crash saves
|
|
1390
|
-
]);
|
|
1391
|
-
}
|
|
1392
|
-
catch (err) {
|
|
1393
|
-
console.error(`[pty:${this.config.name}] Continuity auto-save failed:`, err);
|
|
1394
|
-
}
|
|
1395
|
-
}
|
|
1396
|
-
// Dispatch session end hook (forced termination, with timeout)
|
|
1397
|
-
try {
|
|
1398
|
-
await Promise.race([
|
|
1399
|
-
this.hookRegistry.dispatchSessionEnd(undefined, false),
|
|
1400
|
-
sleep(1000), // 1s timeout for hooks on kill
|
|
1401
|
-
]);
|
|
1402
|
-
}
|
|
1403
|
-
catch (err) {
|
|
1404
|
-
console.error(`[pty:${this.config.name}] Session end hook error:`, err);
|
|
1405
|
-
}
|
|
1406
|
-
if (this.ptyProcess) {
|
|
1407
|
-
this.ptyProcess.kill();
|
|
1408
|
-
}
|
|
1409
|
-
this.closeLogStream();
|
|
1410
|
-
this.client.destroy();
|
|
1411
|
-
this.hookRegistry.destroy();
|
|
1412
|
-
}
|
|
1413
|
-
/**
|
|
1414
|
-
* Close the log file stream
|
|
1415
|
-
*/
|
|
1416
|
-
closeLogStream() {
|
|
1417
|
-
if (this.logStream) {
|
|
1418
|
-
this.logStream.write(`\n--- Worker ${this.config.name} stopped at ${new Date().toISOString()} ---\n`);
|
|
1419
|
-
this.logStream.end();
|
|
1420
|
-
this.logStream = undefined;
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
get pid() {
|
|
1424
|
-
return this.ptyProcess?.pid;
|
|
1425
|
-
}
|
|
1426
|
-
get logPath() {
|
|
1427
|
-
return this.logFilePath;
|
|
1428
|
-
}
|
|
1429
|
-
/**
|
|
1430
|
-
* Track significant outputs and inject summary reminder if needed.
|
|
1431
|
-
* Works with any CLI (Claude, Gemini, Codex, etc.)
|
|
1432
|
-
*/
|
|
1433
|
-
trackOutputAndRemind(data) {
|
|
1434
|
-
// Skip in interactive mode - user handles all prompts directly
|
|
1435
|
-
if (this.config.interactive)
|
|
1436
|
-
return;
|
|
1437
|
-
// Disabled if config.summaryReminder === false or env RELAY_SUMMARY_REMINDER_ENABLED=false
|
|
1438
|
-
if (this.config.summaryReminder === false)
|
|
1439
|
-
return;
|
|
1440
|
-
if (process.env.RELAY_SUMMARY_REMINDER_ENABLED === 'false')
|
|
1441
|
-
return;
|
|
1442
|
-
const config = this.config.summaryReminder ?? {};
|
|
1443
|
-
// Env vars take precedence over config, config takes precedence over defaults
|
|
1444
|
-
const intervalMinutes = process.env.RELAY_SUMMARY_INTERVAL_MINUTES
|
|
1445
|
-
? parseInt(process.env.RELAY_SUMMARY_INTERVAL_MINUTES, 10)
|
|
1446
|
-
: (config.intervalMinutes ?? 15);
|
|
1447
|
-
const minOutputs = process.env.RELAY_SUMMARY_MIN_OUTPUTS
|
|
1448
|
-
? parseInt(process.env.RELAY_SUMMARY_MIN_OUTPUTS, 10)
|
|
1449
|
-
: (config.minOutputs ?? 50);
|
|
1450
|
-
// Only count "significant" outputs (more than just whitespace/control chars)
|
|
1451
|
-
const cleanData = stripAnsi(data).trim();
|
|
1452
|
-
if (cleanData.length > 20) {
|
|
1453
|
-
this.outputsSinceSummary++;
|
|
1454
|
-
}
|
|
1455
|
-
// Check if we should remind
|
|
1456
|
-
const minutesSinceSummary = (Date.now() - this.lastSummaryTime) / (1000 * 60);
|
|
1457
|
-
const shouldRemind = minutesSinceSummary >= intervalMinutes &&
|
|
1458
|
-
this.outputsSinceSummary >= minOutputs;
|
|
1459
|
-
if (shouldRemind && this.running && this.ptyProcess) {
|
|
1460
|
-
// Reset counters before injecting (prevent spam)
|
|
1461
|
-
this.lastSummaryTime = Date.now();
|
|
1462
|
-
this.outputsSinceSummary = 0;
|
|
1463
|
-
// Inject reminder as a relay-style message
|
|
1464
|
-
// IMPORTANT: Must be single-line - embedded newlines cause the message to span
|
|
1465
|
-
// multiple lines in the CLI input buffer, and the final Enter only submits
|
|
1466
|
-
// the last (empty) line. Regular relay messages are also single-line (see buildInjectionString).
|
|
1467
|
-
const reminder = `[Agent Relay] It's been ${Math.round(minutesSinceSummary)} minutes. Please output a [[SUMMARY]] block to checkpoint your progress: [[SUMMARY]]{"currentTask": "...", "completedTasks": [...], "context": "..."}[[/SUMMARY]]`;
|
|
1468
|
-
// Delay slightly to not interrupt current output, then write + Enter
|
|
1469
|
-
setTimeout(async () => {
|
|
1470
|
-
if (this.ptyProcess && this.running) {
|
|
1471
|
-
this.ptyProcess.write(reminder);
|
|
1472
|
-
await sleep(INJECTION_CONSTANTS.ENTER_DELAY_MS);
|
|
1473
|
-
this.ptyProcess.write('\r');
|
|
1474
|
-
}
|
|
1475
|
-
}, 1000);
|
|
1476
|
-
}
|
|
1477
|
-
}
|
|
1478
|
-
/**
|
|
1479
|
-
* Check for [[SUMMARY]] blocks and emit 'summary' event.
|
|
1480
|
-
* Allows cloud services to persist summaries without hardcoding storage.
|
|
1481
|
-
* Also updates the local continuity ledger for session recovery.
|
|
1482
|
-
*/
|
|
1483
|
-
checkForSummaryAndEmit(content) {
|
|
1484
|
-
const result = parseSummaryWithDetails(content);
|
|
1485
|
-
// No SUMMARY block found
|
|
1486
|
-
if (!result.found)
|
|
1487
|
-
return;
|
|
1488
|
-
// Dedup based on raw content - prevents repeated event emissions for same summary
|
|
1489
|
-
if (result.rawContent === this.lastSummaryRawContent)
|
|
1490
|
-
return;
|
|
1491
|
-
this.lastSummaryRawContent = result.rawContent || '';
|
|
1492
|
-
// Reset reminder counters on any summary (even invalid JSON)
|
|
1493
|
-
this.lastSummaryTime = Date.now();
|
|
1494
|
-
this.outputsSinceSummary = 0;
|
|
1495
|
-
// Invalid JSON - log warning
|
|
1496
|
-
if (!result.valid) {
|
|
1497
|
-
console.warn(`[pty:${this.config.name}] Invalid JSON in SUMMARY block`);
|
|
1498
|
-
return;
|
|
1499
|
-
}
|
|
1500
|
-
const summary = result.summary;
|
|
1501
|
-
// Save to local continuity ledger for session recovery
|
|
1502
|
-
// This ensures the ledger has actual data instead of placeholders
|
|
1503
|
-
if (this.continuity) {
|
|
1504
|
-
this.saveSummaryToLedger(summary).catch(err => {
|
|
1505
|
-
console.error(`[pty:${this.config.name}] Failed to save summary to ledger:`, err);
|
|
1506
|
-
});
|
|
1507
|
-
}
|
|
1508
|
-
// Emit event for external handlers (cloud services, dashboard, etc.)
|
|
1509
|
-
this.emit('summary', {
|
|
1510
|
-
agentName: this.config.name,
|
|
1511
|
-
summary,
|
|
1512
|
-
});
|
|
1513
|
-
}
|
|
1514
|
-
// Note: saveSummaryToLedger() is inherited from BaseWrapper
|
|
1515
|
-
/**
|
|
1516
|
-
* Check for [[SESSION_END]] blocks and emit 'session-end' event.
|
|
1517
|
-
* Allows cloud services to handle session closure without hardcoding storage.
|
|
1518
|
-
* Also stores the data for use in autoSave to populate handoff.
|
|
1519
|
-
*/
|
|
1520
|
-
checkForSessionEndAndEmit(content) {
|
|
1521
|
-
if (this.sessionEndProcessed)
|
|
1522
|
-
return; // Only emit once per session
|
|
1523
|
-
const sessionEnd = parseSessionEndFromOutput(content);
|
|
1524
|
-
if (!sessionEnd)
|
|
1525
|
-
return;
|
|
1526
|
-
this.sessionEndProcessed = true;
|
|
1527
|
-
// Store SESSION_END data for use in autoSave (fixes empty handoff issue)
|
|
1528
|
-
this.sessionEndData = sessionEnd;
|
|
1529
|
-
// Emit event for external handlers
|
|
1530
|
-
this.emit('session-end', {
|
|
1531
|
-
agentName: this.config.name,
|
|
1532
|
-
marker: sessionEnd,
|
|
1533
|
-
});
|
|
1534
|
-
}
|
|
1535
|
-
/**
|
|
1536
|
-
* Check for auth revocation patterns in output.
|
|
1537
|
-
* Detects when the CLI's OAuth session has been revoked (e.g., user logged in elsewhere).
|
|
1538
|
-
* Emits 'auth_revoked' event and sends notification to relay daemon.
|
|
1539
|
-
*/
|
|
1540
|
-
checkAuthRevocation(output) {
|
|
1541
|
-
// Only check once - auth revocation is a terminal state
|
|
1542
|
-
if (this.authRevoked)
|
|
1543
|
-
return;
|
|
1544
|
-
// Throttle checks to avoid performance impact
|
|
1545
|
-
const now = Date.now();
|
|
1546
|
-
if (now - this.lastAuthCheck < this.AUTH_CHECK_INTERVAL)
|
|
1547
|
-
return;
|
|
1548
|
-
this.lastAuthCheck = now;
|
|
1549
|
-
// Determine provider from config
|
|
1550
|
-
const provider = this.config.command || this.cliType || 'claude';
|
|
1551
|
-
// Check for auth revocation patterns
|
|
1552
|
-
const result = detectProviderAuthRevocation(output, provider);
|
|
1553
|
-
if (result.detected && result.confidence !== 'low') {
|
|
1554
|
-
this.authRevoked = true;
|
|
1555
|
-
console.error(`[pty:${this.config.name}] Auth revocation detected: ` +
|
|
1556
|
-
`pattern="${result.pattern}" confidence=${result.confidence} ` +
|
|
1557
|
-
`message="${result.message}"`);
|
|
1558
|
-
// Send notification to relay daemon via system channel
|
|
1559
|
-
if (this.client.state === 'READY') {
|
|
1560
|
-
const authPayload = JSON.stringify({
|
|
1561
|
-
type: 'auth_revoked',
|
|
1562
|
-
agent: this.config.name,
|
|
1563
|
-
provider,
|
|
1564
|
-
message: result.message,
|
|
1565
|
-
confidence: result.confidence,
|
|
1566
|
-
timestamp: new Date().toISOString(),
|
|
1567
|
-
});
|
|
1568
|
-
this.client.sendMessage('#system', authPayload, 'message');
|
|
1569
|
-
}
|
|
1570
|
-
// Emit event for external handlers (cloud services, dashboard)
|
|
1571
|
-
this.emit('auth_revoked', {
|
|
1572
|
-
agentName: this.config.name,
|
|
1573
|
-
provider,
|
|
1574
|
-
message: result.message,
|
|
1575
|
-
confidence: result.confidence,
|
|
1576
|
-
});
|
|
1577
|
-
}
|
|
1578
|
-
}
|
|
1579
|
-
/**
|
|
1580
|
-
* Reset auth state (e.g., after re-authentication)
|
|
1581
|
-
*/
|
|
1582
|
-
resetAuthState() {
|
|
1583
|
-
this.authRevoked = false;
|
|
1584
|
-
this.lastAuthCheck = 0;
|
|
1585
|
-
}
|
|
1586
|
-
/**
|
|
1587
|
-
* Check if auth has been revoked
|
|
1588
|
-
*/
|
|
1589
|
-
isAuthRevoked() {
|
|
1590
|
-
return this.authRevoked;
|
|
1591
|
-
}
|
|
1592
|
-
}
|
|
1593
|
-
//# sourceMappingURL=pty-wrapper.js.map
|