tabby-agentdeck 1.2.3 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,7 +11,12 @@ const { mailboxRoot } = await import('./agentdeck-runtime.cjs').then(m => m.defa
11
11
  const root = mailboxRoot()
12
12
  const tab = process.env.AGENTDECK_TAB || ''
13
13
  let identity
14
- const mode = process.argv[2]
14
+ const mode = process.argv[2]
15
+ // Bound the whole hook, including multiple requests and trickling responses.
16
+ if (mode === '--hook') {
17
+ const deadline = Number(process.env.AGENTDECK_HOOK_DEADLINE) || Date.now() + 1000
18
+ setTimeout(() => process.exit(0), Math.max(1, Math.min(1000, deadline - Date.now()))).unref()
19
+ }
15
20
  function credentials () {
16
21
  if (identity) return identity
17
22
  if (!/^[a-zA-Z0-9_-]+$/.test(tab)) throw new Error('Start this MCP server inside an AgentDeck session')
@@ -446,9 +446,39 @@ Write-HookDiag 'tcp-sent'
446
446
  Write-AgentDeckHookTrace 'tcp_end'
447
447
  if ($mailContext) {
448
448
  Write-AgentDeckHookTrace 'mailbox_begin'
449
- & node (Join-Path $PSScriptRoot 'agentdeck-mailbox.mjs') --hook $targetId ([string]$hook.hook_event_name) 2>$null
450
- Write-HookDiag "mailbox-done exit=$LASTEXITCODE"
451
- Write-AgentDeckHookTrace 'mailbox_end' @{ exit_code = $LASTEXITCODE }
449
+ $mailProcess = New-Object System.Diagnostics.Process
450
+ try {
451
+ $mailProcess.StartInfo.FileName = (Get-Command node -CommandType Application -ErrorAction Stop | Select-Object -First 1).Source
452
+ $mailProcess.StartInfo.Arguments = '"' + (Join-Path $PSScriptRoot 'agentdeck-mailbox.mjs') + '" --hook "' + $targetId + '" "' + [string]$hook.hook_event_name + '"'
453
+ $mailProcess.StartInfo.UseShellExecute = $false
454
+ $mailProcess.StartInfo.CreateNoWindow = $true
455
+ $mailProcess.StartInfo.RedirectStandardOutput = $true
456
+ $mailProcess.StartInfo.RedirectStandardError = $true
457
+ $mailProcess.StartInfo.StandardOutputEncoding = New-Object System.Text.UTF8Encoding($false)
458
+ $mailProcess.StartInfo.EnvironmentVariables['AGENTDECK_HOOK_DEADLINE'] = [string]([DateTimeOffset]::UtcNow.ToUnixTimeMilliseconds() + 1000)
459
+ $mailBudget = [System.Diagnostics.Stopwatch]::StartNew()
460
+ [void]$mailProcess.Start()
461
+ $mailOutput = $mailProcess.StandardOutput.ReadToEndAsync()
462
+ $mailError = $mailProcess.StandardError.ReadToEndAsync()
463
+ if (-not $mailProcess.WaitForExit([Math]::Max(0, 1500 - [int]$mailBudget.ElapsedMilliseconds))) {
464
+ try { $mailProcess.Kill() } catch { }
465
+ Write-HookDiag 'mailbox-timeout budget=1500ms'
466
+ Write-AgentDeckHookTrace 'mailbox_timeout' @{ budget_ms = 1500 }
467
+ } else {
468
+ # Process exit and redirected pipe completion are separate notifications.
469
+ # Drain the pipe within the remaining budget instead of dropping a valid reply.
470
+ $mailDrained = $mailOutput.Wait([Math]::Max(0, 1500 - [int]$mailBudget.ElapsedMilliseconds))
471
+ if ($mailProcess.ExitCode -eq 0 -and $mailDrained) {
472
+ $mailText = $mailOutput.Result
473
+ if ($mailText) { [Console]::Out.Write($mailText) }
474
+ }
475
+ Write-AgentDeckHookTrace 'mailbox_end' @{ exit_code = $mailProcess.ExitCode }
476
+ }
477
+ } catch {
478
+ Write-AgentDeckHookTrace 'mailbox_error' @{} $_
479
+ } finally {
480
+ $mailProcess.Dispose()
481
+ }
452
482
  }
453
483
  Write-HookDiag 'end'
454
484
  exit 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tabby-agentdeck",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "Run AI coding agents side by side in Tabby with fixed tab numbers, cross-session messaging, live status, file previews, agent-friendly hotkeys and image paste",
5
5
  "keywords": [
6
6
  "tabby-plugin",
@@ -18,8 +18,8 @@
18
18
  "build:release": "node tools/sync-version.js && webpack --mode production --env release",
19
19
  "prepack": "npm run build:release && node tools/check-release.js",
20
20
  "watch": "webpack --progress --color --watch",
21
- "test": "npm run test:existing && npm run test:codex && npm run test:accounts && node test/sidebarI18n.cjs && node test/accountSession.cjs && npm run test:sessions && npm run test:storage && npm run test:performance && npm run test:hook-trace",
22
- "test:hook-trace": "node test/hookTrace.cjs",
21
+ "test": "npm run test:existing && npm run test:codex && npm run test:accounts && node test/sidebarI18n.cjs && node test/accountSession.cjs && node test/accountRefreshPolicy.cjs && node test/accountRefreshClient.cjs && npm run test:sessions && npm run test:storage && npm run test:performance && npm run test:hook-trace",
22
+ "test:hook-trace": "node test/hookTrace.cjs && node test/mailboxDeadline.cjs",
23
23
  "test:performance": "node test/performance.cjs",
24
24
  "test:storage": "tsc src/storagePaths.ts src/accounts.ts src/storageSettings.ts src/runtimeMigration.ts --outDir .tmp --module commonjs --target es2019 --skipLibCheck --esModuleInterop && node test/storagePaths.cjs && node test/storageSettings.cjs && node test/runtimePaths.cjs",
25
25
  "test:sessions": "tsc src/sessionSearch.ts src/sessionMailbox.ts src/sessionSlots.ts --outDir .tmp --module commonjs --target es2019 --skipLibCheck --esModuleInterop && node test/sessionSearch.cjs && node test/sessionCommunication.cjs && node test/mailboxBridge.cjs",