vibe-usage-cli 0.0.0-stage → 0.1.1

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 (114) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +275 -2
  3. package/build/cli.js +197 -0
  4. package/build/core/claude-processes.d.ts +51 -0
  5. package/build/core/claude-processes.js +288 -0
  6. package/build/core/claude-profile.d.ts +2 -0
  7. package/build/core/claude-profile.js +146 -0
  8. package/build/core/claude-renew.d.ts +12 -0
  9. package/build/core/claude-renew.js +79 -0
  10. package/build/core/continuity.d.ts +90 -0
  11. package/build/core/continuity.js +1244 -0
  12. package/build/core/diagnostics.d.ts +25 -0
  13. package/build/core/diagnostics.js +229 -0
  14. package/build/core/environment.d.ts +12 -0
  15. package/build/core/environment.js +25 -0
  16. package/build/core/errors.d.ts +23 -0
  17. package/build/core/errors.js +48 -0
  18. package/build/core/files.d.ts +20 -0
  19. package/build/core/files.js +136 -0
  20. package/build/core/glance.d.ts +25 -0
  21. package/build/core/glance.js +107 -0
  22. package/build/core/handover.d.ts +61 -0
  23. package/build/core/handover.js +333 -0
  24. package/build/core/history.d.ts +19 -0
  25. package/build/core/history.js +134 -0
  26. package/build/core/launch.d.ts +78 -0
  27. package/build/core/launch.js +256 -0
  28. package/build/core/measurements.d.ts +11 -0
  29. package/build/core/measurements.js +75 -0
  30. package/build/core/model-families.d.ts +12 -0
  31. package/build/core/model-families.js +61 -0
  32. package/build/core/model.d.ts +32 -0
  33. package/build/core/model.js +86 -0
  34. package/build/core/models.d.ts +25 -0
  35. package/build/core/models.js +164 -0
  36. package/build/core/redact.d.ts +2 -0
  37. package/build/core/redact.js +64 -0
  38. package/build/core/selection.d.ts +65 -0
  39. package/build/core/selection.js +173 -0
  40. package/build/core/service.d.ts +35 -0
  41. package/build/core/service.js +484 -0
  42. package/build/core/sessions.d.ts +87 -0
  43. package/build/core/sessions.js +868 -0
  44. package/build/core/settings.d.ts +16 -0
  45. package/build/core/settings.js +377 -0
  46. package/build/core/tray-icon.d.ts +5 -0
  47. package/build/core/tray-icon.js +91 -0
  48. package/build/core/updater.d.ts +29 -0
  49. package/build/core/updater.js +88 -0
  50. package/build/core/updates.d.ts +5 -0
  51. package/build/core/updates.js +29 -0
  52. package/build/launchers/discover-antigravity.ps1 +68 -0
  53. package/build/launchers/terminal.ps1 +78 -0
  54. package/build/main/main.js +587 -0
  55. package/build/providers/antigravity.d.ts +48 -0
  56. package/build/providers/antigravity.js +463 -0
  57. package/build/providers/claude-keychain.d.ts +13 -0
  58. package/build/providers/claude-keychain.js +42 -0
  59. package/build/providers/claude.d.ts +33 -0
  60. package/build/providers/claude.js +218 -0
  61. package/build/providers/codex.d.ts +21 -0
  62. package/build/providers/codex.js +221 -0
  63. package/build/providers/common.d.ts +63 -0
  64. package/build/providers/common.js +294 -0
  65. package/build/providers/cursor.d.ts +14 -0
  66. package/build/providers/cursor.js +141 -0
  67. package/build/providers/profiles.d.ts +10 -0
  68. package/build/providers/profiles.js +69 -0
  69. package/build/providers/tls-trust.d.ts +7 -0
  70. package/build/providers/tls-trust.js +29 -0
  71. package/build/providers/types.d.ts +19 -0
  72. package/build/providers/types.js +1 -0
  73. package/build/shared/account-state.d.ts +19 -0
  74. package/build/shared/account-state.js +75 -0
  75. package/build/shared/catalog.d.ts +85 -0
  76. package/build/shared/catalog.js +125 -0
  77. package/build/shared/format.d.ts +40 -0
  78. package/build/shared/format.js +134 -0
  79. package/build/shared/i18n/index.d.ts +12 -0
  80. package/build/shared/i18n/index.js +40 -0
  81. package/build/shared/i18n/locales/de.d.ts +2 -0
  82. package/build/shared/i18n/locales/de.js +328 -0
  83. package/build/shared/i18n/locales/en.d.ts +328 -0
  84. package/build/shared/i18n/locales/en.js +330 -0
  85. package/build/shared/i18n/locales/es.d.ts +2 -0
  86. package/build/shared/i18n/locales/es.js +328 -0
  87. package/build/shared/i18n/locales/fr.d.ts +2 -0
  88. package/build/shared/i18n/locales/fr.js +328 -0
  89. package/build/shared/i18n/locales/it.d.ts +2 -0
  90. package/build/shared/i18n/locales/it.js +327 -0
  91. package/build/shared/i18n/locales/ja.d.ts +2 -0
  92. package/build/shared/i18n/locales/ja.js +322 -0
  93. package/build/shared/i18n/locales/ko.d.ts +2 -0
  94. package/build/shared/i18n/locales/ko.js +322 -0
  95. package/build/shared/i18n/locales/nl.d.ts +2 -0
  96. package/build/shared/i18n/locales/nl.js +327 -0
  97. package/build/shared/i18n/locales/pl.d.ts +2 -0
  98. package/build/shared/i18n/locales/pl.js +332 -0
  99. package/build/shared/i18n/locales/pt.d.ts +2 -0
  100. package/build/shared/i18n/locales/pt.js +328 -0
  101. package/build/shared/i18n/locales/ru.d.ts +2 -0
  102. package/build/shared/i18n/locales/ru.js +331 -0
  103. package/build/shared/i18n/locales/tr.d.ts +2 -0
  104. package/build/shared/i18n/locales/tr.js +322 -0
  105. package/build/shared/i18n/locales/zh.d.ts +2 -0
  106. package/build/shared/i18n/locales/zh.js +322 -0
  107. package/build/shared/i18n/messages.d.ts +10 -0
  108. package/build/shared/i18n/messages.js +1 -0
  109. package/build/shared/ipc.d.ts +138 -0
  110. package/build/shared/ipc.js +2 -0
  111. package/build/shared/tsconfig.tsbuildinfo +1 -0
  112. package/build/shared/types.d.ts +205 -0
  113. package/build/shared/types.js +1 -0
  114. package/package.json +144 -4
@@ -0,0 +1,68 @@
1
+ # Internal transport only. Stdout includes a CSRF capability and must be consumed
2
+ # in memory by the main process. Do not invoke this script in a visible console.
3
+ # Windows PowerShell 5 compatible; no application or network request is started.
4
+ [CmdletBinding()]
5
+ param()
6
+
7
+ $ErrorActionPreference = 'Stop'
8
+ $ProgressPreference = 'SilentlyContinue'
9
+ [Console]::OutputEncoding = New-Object System.Text.UTF8Encoding($false)
10
+ $result = [ordered]@{ outcome = 'app_closed'; servers = @() }
11
+
12
+ try {
13
+ $currentIdentity = [Security.Principal.WindowsIdentity]::GetCurrent()
14
+ $currentSid = $currentIdentity.User.Value
15
+ if ([string]::IsNullOrWhiteSpace($currentSid)) { throw 'identity-unavailable' }
16
+ $programs = Join-Path $env:LOCALAPPDATA 'Programs'
17
+ $appServer = Join-Path $programs 'Antigravity\resources\bin\language_server.exe'
18
+ $ideRoot = (Join-Path $programs 'Antigravity IDE\resources\app\extensions\antigravity\bin') + '\'
19
+ $processes = @(Get-CimInstance Win32_Process -Filter "Name LIKE 'language_server%' OR Name LIKE 'language-server%'")
20
+ $servers = New-Object System.Collections.Generic.List[object]
21
+ $candidateFound = $false
22
+ foreach ($entry in $processes) {
23
+ if ($servers.Count -ge 4) { break }
24
+ $executable = [string]$entry.ExecutablePath
25
+ if ([string]::IsNullOrWhiteSpace($executable)) { continue }
26
+ $isApp = [string]::Equals($executable, $appServer, [StringComparison]::OrdinalIgnoreCase)
27
+ $isIDE = $executable.StartsWith($ideRoot, [StringComparison]::OrdinalIgnoreCase) -and
28
+ [IO.Path]::GetFileName($executable) -match '^language[-_]server(?:[-_][a-zA-Z0-9]+)*\.exe$'
29
+ if (-not $isApp -and -not $isIDE) { continue }
30
+ # A matching installation path alone does not establish ownership.
31
+ # Never inspect another Windows user's CSRF capability or sockets.
32
+ $owner = Invoke-CimMethod -InputObject $entry -MethodName GetOwnerSid -ErrorAction SilentlyContinue
33
+ if ($null -eq $owner -or $owner.ReturnValue -ne 0 -or
34
+ -not [string]::Equals([string]$owner.Sid, $currentSid, [StringComparison]::Ordinal)) { continue }
35
+ $candidateFound = $true
36
+ $match = [regex]::Match([string]$entry.CommandLine, '(?:^|\s)--csrf_token(?:=|\s+)(?:"([^"\r\n]+)"|([^\s]+))')
37
+ if (-not $match.Success) { continue }
38
+ $csrfToken = if ($match.Groups[1].Success) { $match.Groups[1].Value } else { $match.Groups[2].Value }
39
+ if ($csrfToken.Length -gt 512 -or $csrfToken -match '[\x00-\x20\x7f]') { continue }
40
+ $ports = @(Get-NetTCPConnection -State Listen -OwningProcess $entry.ProcessId -ErrorAction SilentlyContinue |
41
+ Where-Object { $_.LocalAddress -in @('127.0.0.1', '0.0.0.0') } |
42
+ Select-Object -ExpandProperty LocalPort -Unique | Sort-Object | Select-Object -First 4)
43
+ if ($ports.Count -eq 0) { continue }
44
+ # Recheck identity after querying sockets so a recycled PID cannot inherit
45
+ # this server's capability. Only this exact process's listening ports pass.
46
+ $current = Get-CimInstance Win32_Process -Filter ('ProcessId = ' + [int]$entry.ProcessId)
47
+ if ($null -eq $current -or $current.CreationDate -ne $entry.CreationDate -or
48
+ -not [string]::Equals([string]$current.ExecutablePath, $executable, [StringComparison]::OrdinalIgnoreCase)) { continue }
49
+ $servers.Add([pscustomobject]@{ pid = [int]$entry.ProcessId; csrfToken = $csrfToken; ports = @($ports) })
50
+ }
51
+ $result.servers = @($servers.ToArray())
52
+ if ($servers.Count -gt 0) { $result.outcome = 'success' }
53
+ elseif ($candidateFound) { $result.outcome = 'local_service_unavailable' }
54
+ } catch {
55
+ $result.outcome = 'local_service_unavailable'
56
+ $result.servers = @()
57
+ } finally {
58
+ $csrfToken = $null
59
+ $match = $null
60
+ $entry = $null
61
+ $current = $null
62
+ $processes = $null
63
+ $owner = $null
64
+ $currentSid = $null
65
+ if ($null -ne $currentIdentity) { $currentIdentity.Dispose() }
66
+ $currentIdentity = $null
67
+ }
68
+ [Console]::WriteLine(($result | ConvertTo-Json -Depth 5 -Compress))
@@ -0,0 +1,78 @@
1
+ # Runs one command-line tool in this (new, visible) console window.
2
+ # Arguments arrive as base64-encoded, NUL-separated UTF-8 so that no shell ever re-parses
3
+ # them (NUL cannot occur inside a process argument). The environment is prepared by the
4
+ # caller. Windows PowerShell 5 compatible.
5
+ #
6
+ # With -Handoff, the tab stays with the session: when the tool exits and the app has written
7
+ # the next command to that file (the session moved to another account), it runs here too.
8
+ param(
9
+ [Parameter(Mandatory = $true)][string]$WorkingDirectory,
10
+ [Parameter(Mandatory = $true)][string]$Executable,
11
+ [string]$Title,
12
+ [string]$ArgumentsBase64,
13
+ [string]$Handoff,
14
+ [switch]$NewWindow
15
+ )
16
+ $ErrorActionPreference = 'Stop'
17
+ # Each argument quoted the way CommandLineToArgvW reads it back: backslashes doubled before a
18
+ # quote and at the end, the quote escaped. Windows PowerShell does not do this itself (it joins
19
+ # -ArgumentList with spaces, and runs `& tool @args` without escaping quotes inside an
20
+ # argument, which would let a prompt's quotes split it into options), so every command line
21
+ # this script starts is built here.
22
+ function ConvertTo-ArgumentList([string[]]$Values) {
23
+ @($Values | ForEach-Object { '"' + (($_ -replace '(\\*)"', '$1$1\"') -replace '(\\+)$', '$1$1') + '"' })
24
+ }
25
+ # The app starts this hidden, without a console a tool could use; Start-Process opens this
26
+ # script again in a new, visible console window.
27
+ if ($NewWindow) {
28
+ $relaunch = @('-NoLogo', '-NoProfile', '-NoExit', '-ExecutionPolicy', 'Bypass', '-File', $PSCommandPath)
29
+ foreach ($name in 'WorkingDirectory', 'Executable', 'Title', 'ArgumentsBase64', 'Handoff') {
30
+ $value = Get-Variable -Name $name -ValueOnly
31
+ if ($value) { $relaunch += "-$name", $value }
32
+ }
33
+ $quoted = ConvertTo-ArgumentList $relaunch
34
+ $powershell = Join-Path $PSHOME 'powershell.exe'
35
+ # With Windows Terminal, the tool opens as a tab of the window last used rather than as a
36
+ # window of its own, so several sessions continued at once stay together. Windows Terminal
37
+ # reads `;` as the end of a command, so it is escaped. Its `wt.exe` alias lives in the
38
+ # WindowsApps folder, which is not always on PATH.
39
+ $terminal = (Get-Command 'wt.exe' -CommandType Application -ErrorAction SilentlyContinue | Select-Object -First 1).Source
40
+ $alias = if ($env:LOCALAPPDATA) { Join-Path $env:LOCALAPPDATA 'Microsoft\WindowsApps\wt.exe' }
41
+ if (-not $terminal -and $alias -and (Test-Path -LiteralPath $alias)) { $terminal = $alias }
42
+ if ($terminal) {
43
+ $tab = @('-w', '0', 'new-tab', ('"' + $powershell + '"')) + $quoted
44
+ Start-Process -FilePath $terminal -ArgumentList (($tab | ForEach-Object { $_ -replace ';', '\;' }) -join ' ')
45
+ } else {
46
+ Start-Process -FilePath $powershell -ArgumentList ($quoted -join ' ')
47
+ }
48
+ exit
49
+ }
50
+ while ($true) {
51
+ Set-Location -LiteralPath $WorkingDirectory
52
+ if ($Title) {
53
+ $Host.UI.RawUI.WindowTitle = $Title
54
+ Write-Host $Title
55
+ }
56
+ [string[]]$arguments = @()
57
+ if ($ArgumentsBase64) {
58
+ $arguments = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($ArgumentsBase64)).Split([char]0)
59
+ }
60
+ # Started with the command line built above, in this console, and waited for.
61
+ $start = New-Object System.Diagnostics.ProcessStartInfo
62
+ $start.FileName = $Executable
63
+ $start.Arguments = (ConvertTo-ArgumentList $arguments) -join ' '
64
+ $start.WorkingDirectory = $WorkingDirectory
65
+ $start.UseShellExecute = $false
66
+ $tool = [System.Diagnostics.Process]::Start($start)
67
+ $tool.WaitForExit()
68
+ if (-not $Handoff -or -not (Test-Path -LiteralPath $Handoff)) { break }
69
+ # The next command, taken once: the file is removed before it runs.
70
+ $next = Get-Content -LiteralPath $Handoff -Raw -Encoding UTF8 | ConvertFrom-Json
71
+ Remove-Item -LiteralPath $Handoff -Force
72
+ foreach ($name in @($next.unset)) { if ($name) { Remove-Item -LiteralPath "Env:$name" -ErrorAction SilentlyContinue } }
73
+ if ($next.set) { foreach ($entry in $next.set.PSObject.Properties) { Set-Item -LiteralPath "Env:$($entry.Name)" -Value $entry.Value } }
74
+ $WorkingDirectory = $next.workingDirectory
75
+ $Executable = $next.executable
76
+ $Title = $next.title
77
+ $ArgumentsBase64 = $next.argumentsBase64
78
+ }