agent-relay 2.0.11 → 2.0.13

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.
Files changed (115) hide show
  1. package/bin/relay-pty-darwin-arm64 +0 -0
  2. package/bin/relay-pty-darwin-x64 +0 -0
  3. package/bin/relay-pty-linux-x64 +0 -0
  4. package/dist/dashboard/out/404.html +1 -1
  5. package/dist/dashboard/out/_next/static/chunks/320-23e5ffe6aa7eb934.js +1 -0
  6. package/{packages/dashboard/ui-dist/_next/static/css/99c2552394077586.css → dist/dashboard/out/_next/static/css/605dd4e30c91986f.css} +1 -1
  7. package/dist/dashboard/out/app/onboarding.html +1 -1
  8. package/dist/dashboard/out/app/onboarding.txt +1 -1
  9. package/dist/dashboard/out/app.html +1 -1
  10. package/dist/dashboard/out/app.txt +2 -2
  11. package/dist/dashboard/out/cloud/link.html +1 -1
  12. package/dist/dashboard/out/cloud/link.txt +1 -1
  13. package/dist/dashboard/out/connect-repos.html +1 -1
  14. package/dist/dashboard/out/connect-repos.txt +1 -1
  15. package/dist/dashboard/out/history.html +1 -1
  16. package/dist/dashboard/out/history.txt +1 -1
  17. package/dist/dashboard/out/index.html +1 -1
  18. package/dist/dashboard/out/index.txt +2 -2
  19. package/dist/dashboard/out/login.html +2 -2
  20. package/dist/dashboard/out/login.txt +1 -1
  21. package/dist/dashboard/out/metrics.html +1 -1
  22. package/dist/dashboard/out/metrics.txt +1 -1
  23. package/dist/dashboard/out/pricing.html +2 -2
  24. package/dist/dashboard/out/pricing.txt +1 -1
  25. package/dist/dashboard/out/providers/setup/claude.html +1 -1
  26. package/dist/dashboard/out/providers/setup/claude.txt +1 -1
  27. package/dist/dashboard/out/providers/setup/codex.html +1 -1
  28. package/dist/dashboard/out/providers/setup/codex.txt +1 -1
  29. package/dist/dashboard/out/providers/setup/cursor.html +1 -1
  30. package/dist/dashboard/out/providers/setup/cursor.txt +1 -1
  31. package/dist/dashboard/out/providers.html +1 -1
  32. package/dist/dashboard/out/providers.txt +1 -1
  33. package/dist/dashboard/out/signup.html +2 -2
  34. package/dist/dashboard/out/signup.txt +1 -1
  35. package/package.json +15 -15
  36. package/packages/api-types/package.json +1 -1
  37. package/packages/bridge/dist/spawner.js +25 -71
  38. package/packages/bridge/package.json +7 -7
  39. package/packages/cloud/dist/api/cli-pty-runner.js +4 -25
  40. package/packages/cloud/dist/api/provider-env.d.ts +12 -0
  41. package/packages/cloud/dist/api/provider-env.js +66 -0
  42. package/packages/cloud/dist/api/providers.js +12 -2
  43. package/packages/cloud/package.json +6 -6
  44. package/packages/config/package.json +2 -2
  45. package/packages/continuity/package.json +1 -1
  46. package/packages/daemon/dist/cli-auth.js +4 -25
  47. package/packages/daemon/package.json +12 -12
  48. package/packages/dashboard/dist/server.js +32 -0
  49. package/packages/dashboard/package.json +12 -12
  50. package/packages/dashboard/ui/react-components/settings/WorkspaceSettingsPanel.tsx +44 -3
  51. package/packages/dashboard/ui-dist/404.html +1 -1
  52. package/packages/dashboard/ui-dist/_next/static/chunks/320-23e5ffe6aa7eb934.js +1 -0
  53. package/{dist/dashboard/out/_next/static/css/99c2552394077586.css → packages/dashboard/ui-dist/_next/static/css/605dd4e30c91986f.css} +1 -1
  54. package/packages/dashboard/ui-dist/app/onboarding.html +1 -1
  55. package/packages/dashboard/ui-dist/app/onboarding.txt +1 -1
  56. package/packages/dashboard/ui-dist/app.html +1 -1
  57. package/packages/dashboard/ui-dist/app.txt +2 -2
  58. package/packages/dashboard/ui-dist/cloud/link.html +1 -1
  59. package/packages/dashboard/ui-dist/cloud/link.txt +1 -1
  60. package/packages/dashboard/ui-dist/connect-repos.html +1 -1
  61. package/packages/dashboard/ui-dist/connect-repos.txt +1 -1
  62. package/packages/dashboard/ui-dist/history.html +1 -1
  63. package/packages/dashboard/ui-dist/history.txt +1 -1
  64. package/packages/dashboard/ui-dist/index.html +1 -1
  65. package/packages/dashboard/ui-dist/index.txt +2 -2
  66. package/packages/dashboard/ui-dist/login.html +2 -2
  67. package/packages/dashboard/ui-dist/login.txt +1 -1
  68. package/packages/dashboard/ui-dist/metrics.html +1 -1
  69. package/packages/dashboard/ui-dist/metrics.txt +1 -1
  70. package/packages/dashboard/ui-dist/pricing.html +2 -2
  71. package/packages/dashboard/ui-dist/pricing.txt +1 -1
  72. package/packages/dashboard/ui-dist/providers/setup/claude.html +1 -1
  73. package/packages/dashboard/ui-dist/providers/setup/claude.txt +1 -1
  74. package/packages/dashboard/ui-dist/providers/setup/codex.html +1 -1
  75. package/packages/dashboard/ui-dist/providers/setup/codex.txt +1 -1
  76. package/packages/dashboard/ui-dist/providers/setup/cursor.html +1 -1
  77. package/packages/dashboard/ui-dist/providers/setup/cursor.txt +1 -1
  78. package/packages/dashboard/ui-dist/providers.html +1 -1
  79. package/packages/dashboard/ui-dist/providers.txt +1 -1
  80. package/packages/dashboard/ui-dist/signup.html +2 -2
  81. package/packages/dashboard/ui-dist/signup.txt +1 -1
  82. package/packages/dashboard-server/package.json +12 -12
  83. package/packages/hooks/package.json +4 -4
  84. package/packages/mcp/package.json +2 -2
  85. package/packages/memory/package.json +2 -2
  86. package/packages/policy/package.json +2 -2
  87. package/packages/protocol/package.json +1 -1
  88. package/packages/resiliency/package.json +1 -1
  89. package/packages/sdk/package.json +2 -2
  90. package/packages/spawner/package.json +1 -1
  91. package/packages/state/package.json +1 -1
  92. package/packages/storage/package.json +2 -2
  93. package/packages/telemetry/package.json +1 -1
  94. package/packages/trajectory/package.json +2 -2
  95. package/packages/user-directory/dist/user-directory.d.ts +17 -0
  96. package/packages/user-directory/dist/user-directory.js +73 -0
  97. package/packages/user-directory/package.json +2 -2
  98. package/packages/utils/dist/index.d.ts +1 -0
  99. package/packages/utils/dist/index.js +1 -0
  100. package/packages/utils/dist/relay-pty-path.d.ts +44 -0
  101. package/packages/utils/dist/relay-pty-path.js +127 -0
  102. package/packages/utils/package.json +6 -1
  103. package/packages/wrapper/dist/relay-pty-orchestrator.d.ts +1 -0
  104. package/packages/wrapper/dist/relay-pty-orchestrator.js +71 -32
  105. package/packages/wrapper/package.json +6 -6
  106. package/dist/dashboard/out/_next/static/chunks/320-22ebe7be58cf982a.js +0 -1
  107. package/packages/dashboard/ui-dist/_next/static/chunks/320-22ebe7be58cf982a.js +0 -1
  108. /package/dist/dashboard/out/_next/static/{N2nFek-KCN321ZAghmjge → Fa21F5wPUusvLUxj67gGm}/_buildManifest.js +0 -0
  109. /package/dist/dashboard/out/_next/static/{N2nFek-KCN321ZAghmjge → Fa21F5wPUusvLUxj67gGm}/_ssgManifest.js +0 -0
  110. /package/packages/dashboard/ui-dist/_next/static/{59SiFCGkIPHj5xnvI-Hkn → Fa21F5wPUusvLUxj67gGm}/_buildManifest.js +0 -0
  111. /package/packages/dashboard/ui-dist/_next/static/{59SiFCGkIPHj5xnvI-Hkn → Fa21F5wPUusvLUxj67gGm}/_ssgManifest.js +0 -0
  112. /package/packages/dashboard/ui-dist/_next/static/{N2nFek-KCN321ZAghmjge → coRjSO5QkUdvCiJRCqxfi}/_buildManifest.js +0 -0
  113. /package/packages/dashboard/ui-dist/_next/static/{N2nFek-KCN321ZAghmjge → coRjSO5QkUdvCiJRCqxfi}/_ssgManifest.js +0 -0
  114. /package/packages/dashboard/ui-dist/_next/static/{eWYFV8hKU_42BNS8Dj84s → yKnlyfJx-NzAy4kPAGkMr}/_buildManifest.js +0 -0
  115. /package/packages/dashboard/ui-dist/_next/static/{eWYFV8hKU_42BNS8Dj84s → yKnlyfJx-NzAy4kPAGkMr}/_ssgManifest.js +0 -0
@@ -19,7 +19,7 @@ import { spawn } from 'node:child_process';
19
19
  import { createConnection } from 'node:net';
20
20
  import { createHash } from 'node:crypto';
21
21
  import { join, dirname } from 'node:path';
22
- import { existsSync, unlinkSync, mkdirSync, symlinkSync, lstatSync, rmSync, watch, readdirSync } from 'node:fs';
22
+ import { existsSync, unlinkSync, mkdirSync, symlinkSync, lstatSync, rmSync, watch, readdirSync, readlinkSync } from 'node:fs';
23
23
  import { getProjectPaths } from '@agent-relay/config/project-namespace';
24
24
  import { fileURLToPath } from 'node:url';
25
25
  // Get the directory where this module is located
@@ -27,6 +27,7 @@ const __filename = fileURLToPath(import.meta.url);
27
27
  const __dirname = dirname(__filename);
28
28
  import { BaseWrapper } from './base-wrapper.js';
29
29
  import { parseSummaryWithDetails, parseSessionEndFromOutput } from './parser.js';
30
+ import { findRelayPtyBinary as findRelayPtyBinaryUtil } from '@agent-relay/utils/relay-pty-path';
30
31
  import { stripAnsi, sleep, buildInjectionString, verifyInjection, INJECTION_CONSTANTS, AdaptiveThrottle, } from './shared.js';
31
32
  import { getMemoryMonitor, formatBytes, getCgroupManager, } from '@agent-relay/resiliency';
32
33
  // ============================================================================
@@ -238,22 +239,82 @@ export class RelayPtyOrchestrator extends BaseWrapper {
238
239
  if (!existsSync(linkParent)) {
239
240
  mkdirSync(linkParent, { recursive: true });
240
241
  }
241
- if (existsSync(linkPath)) {
242
+ // Remove existing path if it exists (file, symlink, or directory)
243
+ // Use lstatSync instead of existsSync to detect broken symlinks
244
+ // (existsSync returns false for broken symlinks, but the symlink itself still exists)
245
+ let pathExists = false;
246
+ try {
247
+ lstatSync(linkPath);
248
+ pathExists = true;
249
+ }
250
+ catch {
251
+ // Path doesn't exist at all - proceed to create symlink
252
+ }
253
+ if (pathExists) {
242
254
  try {
243
255
  const stats = lstatSync(linkPath);
244
- if (stats.isSymbolicLink() || stats.isFile()) {
256
+ if (stats.isSymbolicLink()) {
257
+ // Handle both valid and broken symlinks
258
+ try {
259
+ const currentTarget = readlinkSync(linkPath);
260
+ if (currentTarget === targetPath) {
261
+ // Symlink already points to correct target, no need to recreate
262
+ this.log(` Symlink already exists and is correct: ${linkPath} -> ${targetPath}`);
263
+ return;
264
+ }
265
+ }
266
+ catch {
267
+ // Broken symlink (target doesn't exist) - remove it
268
+ this.log(` Removing broken symlink: ${linkPath}`);
269
+ }
270
+ unlinkSync(linkPath);
271
+ }
272
+ else if (stats.isFile()) {
245
273
  unlinkSync(linkPath);
246
274
  }
247
275
  else if (stats.isDirectory()) {
276
+ // Force remove directory - this is critical for fixing existing directories
248
277
  rmSync(linkPath, { recursive: true, force: true });
278
+ // Verify removal succeeded using lstatSync to catch broken symlinks
279
+ try {
280
+ lstatSync(linkPath);
281
+ throw new Error(`Failed to remove existing directory: ${linkPath}`);
282
+ }
283
+ catch (err) {
284
+ if (err.code !== 'ENOENT') {
285
+ throw err; // Re-throw if it's not a "doesn't exist" error
286
+ }
287
+ // Path successfully removed
288
+ }
249
289
  }
250
290
  }
251
- catch {
252
- // Ignore cleanup errors
291
+ catch (err) {
292
+ // Log cleanup errors instead of silently ignoring them
293
+ this.logError(` Failed to clean up existing path ${linkPath}: ${err.message}`);
294
+ throw err; // Re-throw to prevent symlink creation on failed cleanup
295
+ }
296
+ }
297
+ // Create the symlink
298
+ try {
299
+ symlinkSync(targetPath, linkPath);
300
+ // Verify symlink was created correctly
301
+ if (!existsSync(linkPath)) {
302
+ throw new Error(`Symlink creation failed: ${linkPath}`);
303
+ }
304
+ const verifyStats = lstatSync(linkPath);
305
+ if (!verifyStats.isSymbolicLink()) {
306
+ throw new Error(`Created path is not a symlink: ${linkPath}`);
307
+ }
308
+ const verifyTarget = readlinkSync(linkPath);
309
+ if (verifyTarget !== targetPath) {
310
+ throw new Error(`Symlink points to wrong target: expected ${targetPath}, got ${verifyTarget}`);
253
311
  }
312
+ this.log(` Created symlink: ${linkPath} -> ${targetPath}`);
313
+ }
314
+ catch (err) {
315
+ this.logError(` Failed to create symlink ${linkPath} -> ${targetPath}: ${err.message}`);
316
+ throw err;
254
317
  }
255
- symlinkSync(targetPath, linkPath);
256
- this.log(` Created symlink: ${linkPath} -> ${targetPath}`);
257
318
  };
258
319
  // In workspace mode, create symlinks so agents can use canonical path
259
320
  if (this._workspaceId) {
@@ -388,37 +449,15 @@ export class RelayPtyOrchestrator extends BaseWrapper {
388
449
  // =========================================================================
389
450
  /**
390
451
  * Find the relay-pty binary
452
+ * Uses shared utility from @agent-relay/utils
391
453
  */
392
454
  findRelayPtyBinary() {
393
455
  // Check config path first
394
456
  if (this.config.relayPtyPath && existsSync(this.config.relayPtyPath)) {
395
457
  return this.config.relayPtyPath;
396
458
  }
397
- // Get the project root (three levels up from packages/wrapper/dist/)
398
- // packages/wrapper/dist/ -> packages/wrapper -> packages -> project root
399
- const projectRoot = join(__dirname, '..', '..', '..');
400
- // Check common locations (ordered by priority)
401
- const candidates = [
402
- // Primary: installed by postinstall from platform-specific binary
403
- join(projectRoot, 'bin', 'relay-pty'),
404
- // Development: local Rust build
405
- join(projectRoot, 'relay-pty', 'target', 'release', 'relay-pty'),
406
- join(projectRoot, 'relay-pty', 'target', 'debug', 'relay-pty'),
407
- // Local build in cwd (for development)
408
- join(process.cwd(), 'relay-pty', 'target', 'release', 'relay-pty'),
409
- join(process.cwd(), 'relay-pty', 'target', 'debug', 'relay-pty'),
410
- // Installed globally
411
- '/usr/local/bin/relay-pty',
412
- // In node_modules (when installed as dependency)
413
- join(process.cwd(), 'node_modules', 'agent-relay', 'bin', 'relay-pty'),
414
- join(process.cwd(), 'node_modules', '.bin', 'relay-pty'),
415
- ];
416
- for (const candidate of candidates) {
417
- if (existsSync(candidate)) {
418
- return candidate;
419
- }
420
- }
421
- return null;
459
+ // Use shared utility with current module's __dirname
460
+ return findRelayPtyBinaryUtil(__dirname);
422
461
  }
423
462
  /**
424
463
  * Spawn the relay-pty process
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-relay/wrapper",
3
- "version": "2.0.11",
3
+ "version": "2.0.13",
4
4
  "description": "CLI agent wrappers for Agent Relay - tmux, pty integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -30,11 +30,11 @@
30
30
  "clean": "rm -rf dist"
31
31
  },
32
32
  "dependencies": {
33
- "@agent-relay/api-types": "2.0.11",
34
- "@agent-relay/protocol": "2.0.11",
35
- "@agent-relay/config": "2.0.11",
36
- "@agent-relay/continuity": "2.0.11",
37
- "@agent-relay/resiliency": "2.0.11"
33
+ "@agent-relay/api-types": "2.0.13",
34
+ "@agent-relay/protocol": "2.0.13",
35
+ "@agent-relay/config": "2.0.13",
36
+ "@agent-relay/continuity": "2.0.13",
37
+ "@agent-relay/resiliency": "2.0.13"
38
38
  },
39
39
  "devDependencies": {
40
40
  "typescript": "^5.9.3",