@kdonev/termscape 0.1.3 → 0.1.5

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 (102) hide show
  1. package/README.md +32 -3
  2. package/dist/agents/polling.d.ts +31 -0
  3. package/dist/agents/polling.d.ts.map +1 -0
  4. package/dist/agents/polling.js +65 -0
  5. package/dist/agents/polling.js.map +1 -0
  6. package/dist/agents/profiles.d.ts +18 -3
  7. package/dist/agents/profiles.d.ts.map +1 -1
  8. package/dist/agents/profiles.js +86 -0
  9. package/dist/agents/profiles.js.map +1 -1
  10. package/dist/agents/shares.d.ts +32 -0
  11. package/dist/agents/shares.d.ts.map +1 -0
  12. package/dist/agents/shares.js +46 -0
  13. package/dist/agents/shares.js.map +1 -0
  14. package/dist/agents/wiring.d.ts +8 -0
  15. package/dist/agents/wiring.d.ts.map +1 -1
  16. package/dist/agents/wiring.js +87 -10
  17. package/dist/agents/wiring.js.map +1 -1
  18. package/dist/cli-args.d.ts +61 -0
  19. package/dist/cli-args.d.ts.map +1 -0
  20. package/dist/cli-args.js +35 -0
  21. package/dist/cli-args.js.map +1 -0
  22. package/dist/cli.js +10 -17
  23. package/dist/cli.js.map +1 -1
  24. package/dist/db/migrations.d.ts.map +1 -1
  25. package/dist/db/migrations.js +48 -0
  26. package/dist/db/migrations.js.map +1 -1
  27. package/dist/db/store.d.ts +14 -1
  28. package/dist/db/store.d.ts.map +1 -1
  29. package/dist/db/store.js +61 -0
  30. package/dist/db/store.js.map +1 -1
  31. package/dist/debug.d.ts +11 -0
  32. package/dist/debug.d.ts.map +1 -0
  33. package/dist/debug.js +45 -0
  34. package/dist/debug.js.map +1 -0
  35. package/dist/folders.d.ts +33 -0
  36. package/dist/folders.d.ts.map +1 -0
  37. package/dist/folders.js +88 -0
  38. package/dist/folders.js.map +1 -0
  39. package/dist/hub.d.ts +128 -3
  40. package/dist/hub.d.ts.map +1 -1
  41. package/dist/hub.js +495 -41
  42. package/dist/hub.js.map +1 -1
  43. package/dist/hub.tgz +0 -0
  44. package/dist/mcp/server.d.ts +2 -0
  45. package/dist/mcp/server.d.ts.map +1 -1
  46. package/dist/mcp/server.js +38 -5
  47. package/dist/mcp/server.js.map +1 -1
  48. package/dist/protocol/domain.d.ts +74 -0
  49. package/dist/protocol/domain.d.ts.map +1 -1
  50. package/dist/protocol/domain.js +58 -0
  51. package/dist/protocol/domain.js.map +1 -1
  52. package/dist/protocol/index.d.ts +1 -0
  53. package/dist/protocol/index.d.ts.map +1 -1
  54. package/dist/protocol/index.js +1 -0
  55. package/dist/protocol/index.js.map +1 -1
  56. package/dist/protocol/mcp-tools.d.ts +4 -0
  57. package/dist/protocol/mcp-tools.d.ts.map +1 -1
  58. package/dist/protocol/mcp-tools.js +16 -2
  59. package/dist/protocol/mcp-tools.js.map +1 -1
  60. package/dist/protocol/mouse.d.ts +54 -0
  61. package/dist/protocol/mouse.d.ts.map +1 -0
  62. package/dist/protocol/mouse.js +187 -0
  63. package/dist/protocol/mouse.js.map +1 -0
  64. package/dist/protocol/peer.d.ts +42 -1
  65. package/dist/protocol/peer.d.ts.map +1 -1
  66. package/dist/protocol/peer.js +57 -2
  67. package/dist/protocol/peer.js.map +1 -1
  68. package/dist/protocol/ws.d.ts +115 -2
  69. package/dist/protocol/ws.d.ts.map +1 -1
  70. package/dist/protocol/ws.js +71 -1
  71. package/dist/protocol/ws.js.map +1 -1
  72. package/dist/remote/deployer.d.ts.map +1 -1
  73. package/dist/remote/deployer.js +5 -1
  74. package/dist/remote/deployer.js.map +1 -1
  75. package/dist/remote/join-script.d.ts.map +1 -1
  76. package/dist/remote/join-script.js +156 -31
  77. package/dist/remote/join-script.js.map +1 -1
  78. package/dist/remote/peer-serve.d.ts +19 -2
  79. package/dist/remote/peer-serve.d.ts.map +1 -1
  80. package/dist/remote/peer-serve.js +87 -6
  81. package/dist/remote/peer-serve.js.map +1 -1
  82. package/dist/remote/registry.d.ts +10 -0
  83. package/dist/remote/registry.d.ts.map +1 -1
  84. package/dist/remote/registry.js +31 -5
  85. package/dist/remote/registry.js.map +1 -1
  86. package/dist/server.d.ts.map +1 -1
  87. package/dist/server.js +262 -12
  88. package/dist/server.js.map +1 -1
  89. package/dist/session/manager.d.ts +23 -0
  90. package/dist/session/manager.d.ts.map +1 -1
  91. package/dist/session/manager.js +42 -0
  92. package/dist/session/manager.js.map +1 -1
  93. package/dist/session/pty.d.ts +1 -1
  94. package/dist/session/pty.d.ts.map +1 -1
  95. package/dist/session/pty.js +14 -0
  96. package/dist/session/pty.js.map +1 -1
  97. package/package.json +1 -1
  98. package/web/assets/index-Z03Ta4g3.js +111 -0
  99. package/web/assets/index-u_uCiaPD.css +1 -0
  100. package/web/index.html +2 -2
  101. package/web/assets/index-CHlXyCCd.css +0 -1
  102. package/web/assets/index-DTl8am-O.js +0 -111
@@ -307,8 +307,20 @@ fi
307
307
 
308
308
  # --- join -------------------------------------------------------------------
309
309
  step 4/4 "connecting to $HUB_URL"
310
+ # --opt=value, not --opt value, and it is not a style choice: an enrollment
311
+ # token is base64url, whose alphabet includes '-', so one token in sixty-four
312
+ # begins with a dash. Node's parseArgs runs in strict mode and refuses a
313
+ # separate argument that looks like another option, which made roughly 1.5% of
314
+ # joins die with ERR_PARSE_ARGS_INVALID_OPTION_VALUE after the install had
315
+ # already finished. The '=' form has no such ambiguity.
316
+ #
317
+ # Still nohup with stdout redirected, unlike the PowerShell half, which had to
318
+ # stop doing that to keep the hub attached to a console. That fix is for a
319
+ # Windows problem and only a Windows problem: a pty here is a pty whether or
320
+ # not the process that opened it has a controlling terminal, so detaching
321
+ # costs nothing and the daemon behaviour is worth more.
310
322
  TERMSCAPE_HOME="$HOME_DIR" nohup "$NODE_BIN" "$HOME_DIR/hub/dist/cli.js" \\
311
- --headless --port 0 --join "$HUB_URL" --join-token "$JOIN_TOKEN" \\
323
+ --headless --port 0 --join="$HUB_URL" --join-token="$JOIN_TOKEN" \\
312
324
  >"$HOME_DIR/hub.log" 2>&1 &
313
325
  HUB_PID=$!
314
326
 
@@ -436,45 +448,135 @@ function Invoke-Ticking($label, $exe, $argString, $log) {
436
448
  return $p.ExitCode
437
449
  }
438
450
 
439
- # A hub from an earlier join is still running and still holds its own install
440
- # open. On Windows a loaded .node cannot be deleted at all, so without this the
441
- # whole re-join dies on an access-denied removing better-sqlite3. It also stops
442
- # this machine appearing twice on the canvas.
451
+ # A hub from an earlier join is still running, and Windows never kills a
452
+ # process's children with it: force-killing only node.exe left every terminal
453
+ # it opened - the ConPTY conhost.exe and the shell or agent inside it - still
454
+ # holding the install directory open, so Remove-Item failed with "something
455
+ # still has a file open there" even though the hub itself was gone. This walks
456
+ # the whole tree instead: the hub's own pid (or pids), everything descended
457
+ # from them, and anything else with a handle on $hubDir, however it got there.
443
458
  function Stop-RunningHub($hubDir) {
444
459
  $pidFile = Join-Path $HomeDir 'hub.pid'
445
- $targets = @()
460
+
461
+ # One snapshot: walking a tree against a process list that can change under
462
+ # us would either miss a child or, worse, follow a pid that has already been
463
+ # recycled into something unrelated.
464
+ $all = @(Get-CimInstance Win32_Process -ErrorAction SilentlyContinue)
465
+ $byPid = @{}
466
+ $byParent = @{}
467
+ # CIM hands pids back as UInt32, and a hashtable never matches a UInt32 key
468
+ # against the Int32 read from hub.pid - so every key is an [int].
469
+ foreach ($proc in $all) {
470
+ $byPid[[int]$proc.ProcessId] = $proc
471
+ $pp = [int]$proc.ParentProcessId
472
+ if ($byParent.ContainsKey($pp)) { $byParent[$pp] += $proc } else { $byParent[$pp] = @($proc) }
473
+ }
474
+
475
+ # Root pids: the hub recorded in hub.pid, even if it is no longer running -
476
+ # its orphans still carry it as their ParentProcessId - plus the existing
477
+ # fallback for a hub that predates the pid file or lost it: a node.exe still
478
+ # pointing at this install.
479
+ $roots = @()
446
480
 
447
481
  if (Test-Path $pidFile) {
448
482
  $recorded = (Get-Content $pidFile -Raw).Trim()
449
483
  if ($recorded -match '^\\d+$') {
450
- $p = Get-Process -Id ([int]$recorded) -ErrorAction SilentlyContinue
451
- if ($p) { $targets += $p }
484
+ $rpid = [int]$recorded
485
+ if ($byPid.ContainsKey($rpid)) {
486
+ $roots += @{ Pid = $rpid; Since = $byPid[$rpid].CreationDate }
487
+ } else {
488
+ # The hub is already dead, so there is no CreationDate to anchor the
489
+ # pid-reuse guard below on. The pid file's own write time stands in
490
+ # for it instead - a few seconds early, since the hub wrote the file
491
+ # before it went on to start anything.
492
+ $since = $null
493
+ try { $since = (Get-Item $pidFile).LastWriteTime.AddSeconds(-5) } catch {}
494
+ $roots += @{ Pid = $rpid; Since = $since }
495
+ }
452
496
  }
453
497
  }
454
498
 
455
- # A hub predating the pid file, or one whose file was lost: find it by the
456
- # install it was started from.
457
- if (-not $targets) {
458
- $targets = @(Get-CimInstance Win32_Process -Filter "Name='node.exe'" -ErrorAction SilentlyContinue |
459
- Where-Object {
460
- $_.CommandLine -and
461
- ($_.CommandLine -like "*$hubDir*" -or $_.CommandLine -like "*$HomeDir*")
462
- } |
463
- ForEach-Object { Get-Process -Id $_.ProcessId -ErrorAction SilentlyContinue })
499
+ # Only when hub.pid names no live hub, as before: an agent CLI started by a
500
+ # hub on this same machine carries ~/.termscape/run/... on its command line,
501
+ # and matching it here would kill its whole tree.
502
+ $liveRoot = @($roots | Where-Object { $byPid.ContainsKey($_.Pid) }).Count -gt 0
503
+ $seenRoots = @($roots | ForEach-Object { $_.Pid })
504
+ foreach ($proc in $all) {
505
+ if ($liveRoot) { break }
506
+ if ($proc.Name -ne 'node.exe' -or -not $proc.CommandLine) { continue }
507
+ if ($seenRoots -contains [int]$proc.ProcessId) { continue }
508
+ if ($proc.CommandLine -like "*$hubDir*" -or $proc.CommandLine -like "*$HomeDir*") {
509
+ $roots += @{ Pid = [int]$proc.ProcessId; Since = $proc.CreationDate }
510
+ }
464
511
  }
465
512
 
466
- foreach ($p in $targets) {
467
- Note "stopping the hub already running here (pid $($p.Id))"
468
- try {
469
- $p.CloseMainWindow() | Out-Null
470
- Stop-Process -Id $p.Id -Force -ErrorAction Stop
471
- $p.WaitForExit(10000) | Out-Null
472
- } catch {
473
- Note "could not stop pid $($p.Id): $($_.Exception.Message)"
513
+ # Walk descendants breadth-first. $order records the discovery order so
514
+ # roots - enqueued first - end up last once it is reversed below, which is
515
+ # what puts every descendant ahead of the root that started it without
516
+ # having to track depth explicitly.
517
+ $victims = @{}
518
+ $order = New-Object System.Collections.Generic.List[int]
519
+ $frontier = New-Object System.Collections.Generic.Queue[object]
520
+ foreach ($r in $roots) { $frontier.Enqueue($r) }
521
+
522
+ while ($frontier.Count -gt 0) {
523
+ $cur = $frontier.Dequeue()
524
+ if ($cur.Pid -eq $PID -or $victims.ContainsKey($cur.Pid)) { continue }
525
+ $victims[$cur.Pid] = $true
526
+ $order.Add($cur.Pid)
527
+ $children = $byParent[$cur.Pid]
528
+ if (-not $children) { continue }
529
+ foreach ($child in $children) {
530
+ $cpid = [int]$child.ProcessId
531
+ if ($cpid -eq $PID -or $victims.ContainsKey($cpid)) { continue }
532
+ # Pid reuse guard: a child counts only if Windows created it at or
533
+ # after its parent (or the parent is dead and $cur.Since is the pid
534
+ # file's write time standing in for that, from above).
535
+ if ($cur.Since -and $child.CreationDate -and $child.CreationDate -lt $cur.Since) { continue }
536
+ $frontier.Enqueue(@{ Pid = $cpid; Since = $child.CreationDate })
537
+ }
538
+ }
539
+
540
+ # Anything with a handle open inside the install folder, whatever its
541
+ # parent - this is what catches node-pty's bundled OpenConsole.exe if it is
542
+ # ever enabled, and an orphan from a hub that started before the pid file
543
+ # existed at all.
544
+ foreach ($proc in $all) {
545
+ $spid = [int]$proc.ProcessId
546
+ if ($spid -eq $PID -or $victims.ContainsKey($spid)) { continue }
547
+ if ($proc.ExecutablePath -like "*$hubDir*" -or $proc.CommandLine -like "*$hubDir*") {
548
+ $victims[$spid] = $true
549
+ $order.Add($spid)
474
550
  }
475
551
  }
476
- # Windows releases the file handles a moment after the process goes.
477
- if ($targets) { Start-Sleep -Milliseconds 750 }
552
+
553
+ if ($order.Count -gt 0) {
554
+ $rootPids = @($roots | ForEach-Object { $_.Pid })
555
+ $childCount = $order.Count - $rootPids.Count
556
+ if ($rootPids.Count -gt 0 -and $childCount -gt 0) {
557
+ $plural = if ($childCount -eq 1) { '' } else { 'es' }
558
+ Note "stopping the hub already running here (pid $($rootPids -join ', ')) and its $childCount terminal process$plural"
559
+ } elseif ($rootPids.Count -gt 0) {
560
+ Note "stopping the hub already running here (pid $($rootPids -join ', '))"
561
+ } else {
562
+ # No live root and no dead one recorded either - only stray processes
563
+ # still pointing at this folder, from step 4's sweep.
564
+ $plural = if ($order.Count -eq 1) { '' } else { 'es' }
565
+ Note "stopping $($order.Count) leftover process$plural from an earlier hub"
566
+ }
567
+
568
+ $order.Reverse()
569
+ foreach ($vpid in $order) {
570
+ $proc = Get-Process -Id $vpid -ErrorAction SilentlyContinue
571
+ if (-not $proc) { continue }
572
+ try { $proc.CloseMainWindow() | Out-Null } catch {}
573
+ Stop-Process -Id $vpid -Force -ErrorAction SilentlyContinue
574
+ try { $proc.WaitForExit(10000) | Out-Null } catch {}
575
+ }
576
+ # Windows releases the file handles a moment after the processes go.
577
+ Start-Sleep -Milliseconds 750
578
+ }
579
+
478
580
  Remove-Item $pidFile -Force -ErrorAction SilentlyContinue
479
581
  }
480
582
 
@@ -586,9 +688,26 @@ if (Test-Path $hubDir) {
586
688
  try {
587
689
  Remove-Item -Recurse -Force $hubDir
588
690
  } catch {
589
- Fail ("Could not replace the previous install at $hubDir - something still has a file open there." + [Environment]::NewLine +
590
- "A hub from an earlier join is probably still running. Close it and re-run this command." + [Environment]::NewLine +
591
- $_.Exception.Message)
691
+ # A late child can still turn up during the first sweep, and Windows
692
+ # releases handles a moment after the process holding them goes - so one
693
+ # more sweep and a short wait usually finishes what the first one missed.
694
+ Stop-RunningHub $hubDir
695
+ Start-Sleep -Seconds 1
696
+ try {
697
+ Remove-Item -Recurse -Force $hubDir
698
+ } catch {
699
+ # Captured first: the pipelines below rebind $_.
700
+ $removeError = $_.Exception.Message
701
+ $holders = @(Get-CimInstance Win32_Process -ErrorAction SilentlyContinue |
702
+ Where-Object { $_.ExecutablePath -like "*$hubDir*" -or $_.CommandLine -like "*$hubDir*" })
703
+ $holderText = 'something'
704
+ if ($holders) {
705
+ $holderText = ($holders | ForEach-Object { "$($_.Name) (pid $($_.ProcessId))" }) -join ', '
706
+ }
707
+ Fail ("Could not replace the previous install at $hubDir - $holderText still has a file open there." + [Environment]::NewLine +
708
+ "Close it and re-run this command." + [Environment]::NewLine +
709
+ $removeError)
710
+ }
592
711
  }
593
712
  }
594
713
  New-Item -ItemType Directory -Force -Path $hubDir | Out-Null
@@ -673,10 +792,16 @@ Pop-Location
673
792
  Step '4/4' "connecting to $HubUrl"
674
793
  $hubLog = Join-Path $HomeDir 'hub.log'
675
794
  $env:TERMSCAPE_HOME = $HomeDir
795
+ # Two things here are deliberate and neither is obvious.
796
+ #
676
797
  # cli.js is named absolutely so this hub is findable in the process list by
677
798
  # the install it came from - which is how a later re-join knows what to stop.
799
+ #
800
+ # --opt=value rather than two arguments: a base64url token may begin with a
801
+ # dash, and Node's strict parseArgs refuses a separate value that looks like
802
+ # an option. See the POSIX half for what that cost.
678
803
  $cliArgs = '"' + (Join-Path $hubDir 'dist/cli.js') + '"' +
679
- ' --headless --port 0 --join "' + $HubUrl + '" --join-token "' + $JoinToken + '"'
804
+ ' --headless --port 0 --join="' + $HubUrl + '" --join-token="' + $JoinToken + '"'
680
805
  $hubProc = Start-Process -FilePath $NodeExe -ArgumentList $cliArgs -PassThru \`
681
806
  -WorkingDirectory $hubDir -RedirectStandardOutput $hubLog \`
682
807
  -RedirectStandardError (Join-Path $HomeDir 'hub.err.log') -WindowStyle Hidden
@@ -1 +1 @@
1
- {"version":3,"file":"join-script.js","sourceRoot":"","sources":["../../src/remote/join-script.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,kFAAkF;AAClF,SAAS,EAAE,CAAC,CAAS;IACnB,OAAO,IAAI,CA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAue3B,CAAC;AACF,CAAC"}
@@ -1,6 +1,14 @@
1
1
  import { type PeerAgent, type PeerRelayAsk } from '../protocol/index.js';
2
2
  import type { WebSocket } from 'ws';
3
3
  import type { Hub } from '../hub.js';
4
+ /**
5
+ * A relayed spawn waits for a real PTY to start, possibly on a third machine
6
+ * the canvas still has to reach — longer than any other ask gets. No deadlock
7
+ * from holding it open that long: when the canvas turns this into a
8
+ * `startSession` frame down the same socket, this hub's own message handler
9
+ * serves that independently of the relay awaiting its result.
10
+ */
11
+ export declare const SPAWN_RELAY_TIMEOUT_MS = 60000;
4
12
  /**
5
13
  * The link back to the canvas, as the rest of this hub needs it. Separated
6
14
  * from the serving machinery because a hub that owns a canvas has no uplink at
@@ -11,8 +19,17 @@ export interface Uplink {
11
19
  readonly attached: boolean;
12
20
  /** Agents the canvas has told us about. Never this hub's own. */
13
21
  agents(): PeerAgent[];
14
- /** Ask the canvas to act on an address we cannot resolve ourselves. */
15
- ask<T>(ask: PeerRelayAsk): Promise<T>;
22
+ /**
23
+ * What the canvas calls this machine, or null before its first `directory`
24
+ * has arrived. This hub holds no row for itself — only the canvas does —
25
+ * so this is the only way it can answer `host: 'local'`/`'self'` about its
26
+ * own agents, or recognise a spawn_agent `host` naming itself.
27
+ */
28
+ hostLabel(): string | null;
29
+ /** Ask the canvas to act on something we cannot resolve ourselves. */
30
+ ask<T>(ask: PeerRelayAsk, opts?: {
31
+ timeoutMs?: number;
32
+ }): Promise<T>;
16
33
  }
17
34
  export interface PeerServer extends Uplink {
18
35
  /** Wire one accepted or dialled socket into this hub. */
@@ -1 +1 @@
1
- {"version":3,"file":"peer-serve.d.ts","sourceRoot":"","sources":["../../src/remote/peer-serve.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,YAAY,EAIlB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAuBrC;;;;GAIG;AACH,MAAM,WAAW,MAAM;IACrB,mDAAmD;IACnD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,iEAAiE;IACjE,MAAM,IAAI,SAAS,EAAE,CAAC;IACtB,uEAAuE;IACvE,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,UAAW,SAAQ,MAAM;IACxC,yDAAyD;IACzD,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAC/D,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,GAAG,UAAU,CAmS1E"}
1
+ {"version":3,"file":"peer-serve.d.ts","sourceRoot":"","sources":["../../src/remote/peer-serve.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,YAAY,EAQlB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAwBrC;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,QAAS,CAAC;AAE7C;;;;GAIG;AACH,MAAM,WAAW,MAAM;IACrB,mDAAmD;IACnD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,iEAAiE;IACjE,MAAM,IAAI,SAAS,EAAE,CAAC;IACtB;;;;;OAKG;IACH,SAAS,IAAI,MAAM,GAAG,IAAI,CAAC;IAC3B,sEAAsE;IACtE,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CACtE;AAED,MAAM,WAAW,UAAW,SAAQ,MAAM;IACxC,yDAAyD;IACzD,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAC/D,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,GAAG,UAAU,CAmX1E"}
@@ -1,6 +1,9 @@
1
1
  import { randomUUID } from 'node:crypto';
2
- import { PeerRequest, PEER_SCHEMA_VERSION, } from '../protocol/index.js';
2
+ import { homedir } from 'node:os';
3
+ import { PeerRequest, PEER_SCHEMA_VERSION, describeInput, describeLatin1, describeModeChanges, describeSnapshotModes, } from '../protocol/index.js';
3
4
  import { HUB_VERSION } from '../hub.js';
5
+ import { debug, debugOn } from '../debug.js';
6
+ import { checkFolder } from '../folders.js';
4
7
  /**
5
8
  * The answering half of the hub-to-hub link: it serves requests about *this*
6
9
  * hub's sessions and pushes its state changes.
@@ -19,6 +22,14 @@ import { HUB_VERSION } from '../hub.js';
19
22
  */
20
23
  /** How long a relayed ask waits for the canvas to report what happened. */
21
24
  const RELAY_TIMEOUT_MS = 15_000;
25
+ /**
26
+ * A relayed spawn waits for a real PTY to start, possibly on a third machine
27
+ * the canvas still has to reach — longer than any other ask gets. No deadlock
28
+ * from holding it open that long: when the canvas turns this into a
29
+ * `startSession` frame down the same socket, this hub's own message handler
30
+ * serves that independently of the relay awaiting its result.
31
+ */
32
+ export const SPAWN_RELAY_TIMEOUT_MS = 60_000;
22
33
  export function createPeerServer(hub, clientToken) {
23
34
  const sockets = new Set();
24
35
  /** Which addresses each peer asked to stream output for. */
@@ -29,6 +40,8 @@ export function createPeerServer(hub, clientToken) {
29
40
  * cannot linger here.
30
41
  */
31
42
  let directory = [];
43
+ /** What the canvas calls this machine, from the same `directory` frame. */
44
+ let youAre = null;
32
45
  /** Asks sent to the canvas and still waiting for their answer. */
33
46
  const relays = new Map();
34
47
  const send = (ws, msg) => {
@@ -60,6 +73,15 @@ export function createPeerServer(hub, clientToken) {
60
73
  const s = hub.sessions.get(sessionId);
61
74
  if (!s)
62
75
  return;
76
+ // Logged before the attachment check, deliberately: a program that turned
77
+ // mouse tracking on while no canvas was watching still turned it on, and
78
+ // a trace that only shows what was forwarded cannot tell that from a
79
+ // program that never asked.
80
+ if (debugOn('output')) {
81
+ const modes = describeModeChanges(chunk);
82
+ if (modes)
83
+ debug('output', `${s.address} program set ${modes}`);
84
+ }
63
85
  for (const ws of sockets) {
64
86
  if (attached.get(ws)?.has(s.address)) {
65
87
  send(ws, { t: 'output', address: s.address, data: chunk });
@@ -119,6 +141,8 @@ export function createPeerServer(hub, clientToken) {
119
141
  // Replaced wholesale: this is the canvas's whole view, minus our
120
142
  // own agents, and a merge would keep agents it has dropped.
121
143
  directory = req.agents;
144
+ if (req.youAre !== undefined)
145
+ youAre = req.youAre;
122
146
  return ok({ agents: req.agents.length });
123
147
  case 'relayResult': {
124
148
  const p = relays.get(req.relayId);
@@ -152,8 +176,17 @@ export function createPeerServer(hub, clientToken) {
152
176
  }
153
177
  case 'startSession': {
154
178
  let ws = hub.store.getWorkspaceByName(req.workspaceName);
155
- if (!ws)
156
- ws = hub.createWorkspace(req.workspaceName, req.rootPath, null);
179
+ if (!ws) {
180
+ // Resolved against this machine's home, never its cwd — which
181
+ // the join installer leaves at the hub's own install directory
182
+ // (join-script.ts), not anywhere a person would mean by a
183
+ // relative workspace root. Doing it here, before
184
+ // createWorkspace, means a bad root fails with the real reason
185
+ // instead of being glued under the wrong base and reported as
186
+ // one indecipherable path.
187
+ const { path } = checkFolder(req.rootPath, { base: homedir() });
188
+ ws = hub.createWorkspace(req.workspaceName, path, null);
189
+ }
157
190
  // `profile` is an agent id here, not a template: the canvas
158
191
  // resolved the template on its own side precisely because the two
159
192
  // machines do not share config. The model and effort arrive as
@@ -213,8 +246,22 @@ export function createPeerServer(hub, clientToken) {
213
246
  const t = hub.sessions.getByAddress(req.address);
214
247
  if (t) {
215
248
  const snap = hub.sessions.snapshotForAttach(t.id);
216
- if (snap)
249
+ if (snap) {
250
+ // What the canvas's window will be holding the moment it
251
+ // opens. The serializer replays the tracking mode but not the
252
+ // encoding one, so a snapshot can restore `?1003h` without
253
+ // `?1006h` and leave the window sending X10 reports to a
254
+ // program that had been getting SGR.
255
+ debug('attach', `attach ${req.address} ${snap.cols}x${snap.rows} ` +
256
+ `snapshot restores: ${describeSnapshotModes(snap.serialized)}`);
217
257
  send(socket, { t: 'output', address: req.address, data: snap.serialized });
258
+ }
259
+ else {
260
+ debug('attach', `attach ${req.address}, no snapshot`);
261
+ }
262
+ }
263
+ else {
264
+ debug('attach', `attach ${req.address} REFUSED: no such agent here`);
218
265
  }
219
266
  return ok({ attached: req.address });
220
267
  }
@@ -223,6 +270,25 @@ export function createPeerServer(hub, clientToken) {
223
270
  return ok({ detached: req.address });
224
271
  case 'input': {
225
272
  const t = hub.sessions.getByAddress(req.address);
273
+ /*
274
+ * The far end of a remote wheel, and the last place it can be
275
+ * lost quietly.
276
+ *
277
+ * `req.id` is the id the canvas minted for this request, so this
278
+ * line and the canvas's `hub -> peer` line are the same event
279
+ * seen from both machines. If the canvas logged the send and this
280
+ * never appears, the loss is on the link; if this appears with a
281
+ * different byte count or a doubled coordinate, the loss is the
282
+ * encoding.
283
+ */
284
+ if (debugOn('input')) {
285
+ const what = req.encoding === 'binary'
286
+ ? describeLatin1(req.data)
287
+ : describeInput(Buffer.from(req.data, 'utf8'));
288
+ debug('input', `peer -> pty ${req.id} ${req.address} ` +
289
+ `encoding=${req.encoding ?? 'utf8(default)'} ` +
290
+ `${t ? `session=${t.id}` : 'NO SUCH AGENT'}: ${what}`);
291
+ }
226
292
  if (!t)
227
293
  return err(`no agent at address "${req.address}"`);
228
294
  // `binary` carries bytes one per code unit; anything else, including
@@ -237,11 +303,21 @@ export function createPeerServer(hub, clientToken) {
237
303
  }
238
304
  case 'resize': {
239
305
  const t = hub.sessions.getByAddress(req.address);
306
+ debug('attach', `resize ${req.address} -> ${req.cols}x${req.rows}` +
307
+ (t ? '' : ' REFUSED: no such agent here'));
240
308
  if (!t)
241
309
  return err(`no agent at address "${req.address}"`);
242
310
  hub.sessions.resize(t.id, req.cols, req.rows);
243
311
  return ok({ ok: true });
244
312
  }
313
+ case 'checkFolder':
314
+ // A throw here is already turned into `err` by the catch below,
315
+ // which is what lets the Add/Edit-workspace dialog on the canvas
316
+ // show the real reason — "does not exist", "not a folder", or the
317
+ // wrong-platform message — instead of a guess made on a machine
318
+ // that cannot see this one's filesystem. `homedir()`, never
319
+ // `cwd()`: the same reasoning as `startSession` above.
320
+ return ok(checkFolder(req.path, { base: homedir() }));
245
321
  }
246
322
  }
247
323
  catch (e) {
@@ -255,6 +331,8 @@ export function createPeerServer(hub, clientToken) {
255
331
  // otherwise sit there until the timeout for no reason.
256
332
  if (sockets.size === 0) {
257
333
  directory = [];
334
+ // Not `youAre`: a link drop is not the canvas renaming this machine,
335
+ // and the next reconnect gets a fresh `directory` anyway.
258
336
  for (const [, p] of relays) {
259
337
  clearTimeout(p.timer);
260
338
  p.reject(new Error('the link to the canvas closed'));
@@ -274,12 +352,15 @@ export function createPeerServer(hub, clientToken) {
274
352
  agents() {
275
353
  return sockets.size > 0 ? directory : [];
276
354
  },
355
+ hostLabel() {
356
+ return youAre;
357
+ },
277
358
  /**
278
359
  * Hand something to the canvas to do. Only the canvas knows where every
279
360
  * address on it lives, so this is the only way an agent here reaches one
280
361
  * anywhere else — including on the machine the canvas itself runs on.
281
362
  */
282
- ask(ask) {
363
+ ask(ask, opts = {}) {
283
364
  const socket = [...sockets].find((ws) => ws.readyState === ws.OPEN);
284
365
  if (!socket)
285
366
  return Promise.reject(new Error('not attached to a canvas'));
@@ -288,7 +369,7 @@ export function createPeerServer(hub, clientToken) {
288
369
  const timer = setTimeout(() => {
289
370
  relays.delete(relayId);
290
371
  reject(new Error('the canvas did not answer'));
291
- }, RELAY_TIMEOUT_MS);
372
+ }, opts.timeoutMs ?? RELAY_TIMEOUT_MS);
292
373
  relays.set(relayId, { resolve: (v) => resolve(v), reject, timer });
293
374
  send(socket, { t: 'relay', relayId, ask });
294
375
  });
@@ -1 +1 @@
1
- {"version":3,"file":"peer-serve.js","sourceRoot":"","sources":["../../src/remote/peer-serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,WAAW,EACX,mBAAmB,GAMpB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC;;;;;;;;;;;;;;;GAeG;AAEH,2EAA2E;AAC3E,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAwBhC,MAAM,UAAU,gBAAgB,CAAC,GAAQ,EAAE,WAAmB;IAC5D,MAAM,OAAO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MAAM,CAAC,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC,CAAC;YAE1E,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;YAC7B,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBACxC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;oBAC5B,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;oBACvB,MAAM,CAAC,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC,CAAC;gBACjD,CAAC,EAAE,IAAI,CAAC,SAAS,IAAI,gBAAgB,CAAC,CAAC;gBACvC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAM,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;gBACxE,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;YAC7C,CAAC,CAAC,CAAC;QACL,CAAC;QAED,QAAQ;YACN,KAAK,MAAM,EAAE,IAAI,OAAO,EAAE,CAAC;gBACzB,IAAI,CAAC;oBACH,EAAE,CAAC,SAAS,EAAE,CAAC;gBACjB,CAAC;gBAAC,MAAM,CAAC;oBACP,gBAAgB;gBAClB,CAAC;YACH,CAAC;YACD,OAAO,CAAC,KAAK,EAAE,CAAC;YAChB,QAAQ,CAAC,KAAK,EAAE,CAAC;QACnB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -168,5 +168,15 @@ export declare class PeerRegistry extends EventEmitter {
168
168
  requestShutdown(hostId: string): Promise<boolean>;
169
169
  stopSession(address: string): Promise<void>;
170
170
  readScreen(address: string, lines?: number): Promise<unknown>;
171
+ /**
172
+ * Ask a peer whether a folder makes sense there, before a workspace
173
+ * pointing at it is created. Only that machine can resolve a path in its
174
+ * own platform's flavour and stat the result, so this is the
175
+ * Add/Edit-workspace dialog's pre-flight for a remote workspace, the same
176
+ * guard `startSession` uses for reachability.
177
+ */
178
+ checkFolder(hostId: string, path: string): Promise<{
179
+ path: string;
180
+ }>;
171
181
  }
172
182
  //# sourceMappingURL=registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/remote/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,KAAK,EACV,gBAAgB,EAChB,IAAI,EACJ,SAAS,EAET,OAAO,EACP,UAAU,EACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,KAAK,EAAE,SAAS,IAAI,QAAQ,EAAE,MAAM,IAAI,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACnC,CAAC,EAAE,OAAO,EACV,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,GAChD,OAAO,CAMT;AAED;;;;;;;GAOG;AACH,qBAAa,YAAa,SAAQ,YAAY;IA6B1C,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IApCpC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqC;IAC3D,mEAAmE;IACnE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2C;IAClE;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAyC;IACtE;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA0C;IAClE;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA0C;gBAG/C,KAAK,EAAE,KAAK,EACZ,UAAU,E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OAKG;IACG,YAAY,CAChB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE;QACH,aAAa,EAAE,MAAM,CAAC;QACtB,QAAQ,EAAE,MAAM,CAAC;QACjB,qEAAqE;QACrE,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;KACjC,GACA,OAAO,CAAC,OAAO,CAAC;IAwCnB;;;OAGG;IACG,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAYjD,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM3C,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAMnE;;;;;;OAMG;IACG,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAM3E"}
@@ -165,9 +165,12 @@ export class PeerRegistry extends EventEmitter {
165
165
  peer.on('output', (address, data) => {
166
166
  this.emit('output', address, data);
167
167
  });
168
- // An agent over there acting on an address its own hub cannot resolve.
169
- // We do it — we are the only hub that knows where every address on this
170
- // canvas lives — and the answer goes back over the same link.
168
+ // An agent over there acting on something its own hub cannot resolve.
169
+ // We do it — we are the only hub that knows what every machine on this
170
+ // canvas is and where every address on it lives — and the answer goes
171
+ // back over the same link. `host.id` travels with it so the handler can
172
+ // mark `you` and apply the `local` alias for a caller that is not on this
173
+ // machine at all.
171
174
  peer.on('relay', (relayId, ask) => {
172
175
  this.emit('relay', ask, (ok, result, error) => {
173
176
  void peer
@@ -177,7 +180,7 @@ export class PeerRegistry extends EventEmitter {
177
180
  // relay timeout is what tells its agent, and there is nothing
178
181
  // useful to do about it here.
179
182
  });
180
- });
183
+ }, host.id);
181
184
  });
182
185
  this.peers.set(host.id, peer);
183
186
  this.remote.set(host.id, new Map());
@@ -284,8 +287,16 @@ export class PeerRegistry extends EventEmitter {
284
287
  for (const [hostId, peer] of this.peers) {
285
288
  if (!peer.connected)
286
289
  continue;
290
+ const host = this.store.listHosts().find((h) => h.id === hostId);
287
291
  void peer
288
- .request({ t: 'directory', id: randomUUID(), agents: forHost(hostId) })
292
+ .request({
293
+ t: 'directory',
294
+ id: randomUUID(),
295
+ agents: forHost(hostId),
296
+ // What that host is called, so it can answer for itself without a
297
+ // row of its own — only the canvas holds one.
298
+ youAre: host?.label,
299
+ })
289
300
  .catch(() => {
290
301
  // A host that dropped mid-announce gets the current directory when
291
302
  // it reconnects, which is the same thing a moment later.
@@ -479,5 +490,20 @@ export class PeerRegistry extends EventEmitter {
479
490
  throw new Error(`no agent at address "${address}"`);
480
491
  return found.peer.request({ t: 'readScreen', id: randomUUID(), address, lines });
481
492
  }
493
+ /**
494
+ * Ask a peer whether a folder makes sense there, before a workspace
495
+ * pointing at it is created. Only that machine can resolve a path in its
496
+ * own platform's flavour and stat the result, so this is the
497
+ * Add/Edit-workspace dialog's pre-flight for a remote workspace, the same
498
+ * guard `startSession` uses for reachability.
499
+ */
500
+ async checkFolder(hostId, path) {
501
+ const peer = this.peers.get(hostId);
502
+ if (!peer)
503
+ throw new Error(`host ${hostId} is not connected`);
504
+ if (!peer.connected)
505
+ throw new Error(`host ${hostId} is not connected`);
506
+ return peer.request({ t: 'checkFolder', id: randomUUID(), path });
507
+ }
482
508
  }
483
509
  //# sourceMappingURL=registry.js.map