@ekkos/cli 1.0.6 → 1.0.8
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/package.json
CHANGED
package/templates/hooks/stop.ps1
CHANGED
|
@@ -110,6 +110,41 @@ if ($rawSessionId -eq "unknown" -and (Test-Path $sessionFile)) {
|
|
|
110
110
|
|
|
111
111
|
$sessionName = Convert-UuidToWords $rawSessionId
|
|
112
112
|
|
|
113
|
+
# ═══════════════════════════════════════════════════════════════════════════
|
|
114
|
+
# SESSION BINDING: Bridge _pending → real session name for proxy eviction
|
|
115
|
+
# Windows has no PTY so run.ts can't detect the session name. The stop hook
|
|
116
|
+
# is the first place we have a confirmed session name, so we bind here.
|
|
117
|
+
# Mac does this in stop.sh (lines 171-179). Logic is identical.
|
|
118
|
+
# ═══════════════════════════════════════════════════════════════════════════
|
|
119
|
+
$configFile = Join-Path $EkkosConfigDir "config.json"
|
|
120
|
+
if ((Test-Path $configFile) -and $sessionName -ne "unknown-session") {
|
|
121
|
+
try {
|
|
122
|
+
$config = Get-Content $configFile -Raw | ConvertFrom-Json
|
|
123
|
+
$userId = $config.userId
|
|
124
|
+
$authToken = if ($config.hookApiKey) { $config.hookApiKey } else { $config.apiKey }
|
|
125
|
+
|
|
126
|
+
if ($userId -and $authToken) {
|
|
127
|
+
$projectPath = (Get-Location).Path
|
|
128
|
+
$pendingSession = if ($env:EKKOS_PENDING_SESSION) { $env:EKKOS_PENDING_SESSION } else { "_pending" }
|
|
129
|
+
|
|
130
|
+
$bindBody = @{
|
|
131
|
+
userId = $userId
|
|
132
|
+
realSession = $sessionName
|
|
133
|
+
projectPath = $projectPath
|
|
134
|
+
pendingSession = $pendingSession
|
|
135
|
+
} | ConvertTo-Json
|
|
136
|
+
|
|
137
|
+
Start-Job -ScriptBlock {
|
|
138
|
+
param($body, $token)
|
|
139
|
+
Invoke-RestMethod -Uri "https://proxy.ekkos.dev/proxy/session/bind" `
|
|
140
|
+
-Method POST `
|
|
141
|
+
-Headers @{ "Content-Type" = "application/json" } `
|
|
142
|
+
-Body $body -ErrorAction SilentlyContinue | Out-Null
|
|
143
|
+
} -ArgumentList $bindBody, $authToken | Out-Null
|
|
144
|
+
}
|
|
145
|
+
} catch {}
|
|
146
|
+
}
|
|
147
|
+
|
|
113
148
|
# ═══════════════════════════════════════════════════════════════════════════
|
|
114
149
|
# LOCAL CACHE: ACK turn to mark as synced
|
|
115
150
|
# Per v1.2 ADDENDUM: Pass instanceId for namespacing
|
|
@@ -141,6 +141,39 @@ function Convert-UuidToWords {
|
|
|
141
141
|
|
|
142
142
|
$sessionName = Convert-UuidToWords $rawSessionId
|
|
143
143
|
|
|
144
|
+
# ═══════════════════════════════════════════════════════════════════════════
|
|
145
|
+
# PROXY SESSION BIND: _pending → real session name (fires every turn)
|
|
146
|
+
# Mirrors bash user-prompt-submit.sh lines 319-338.
|
|
147
|
+
# No PTY on Windows so run.ts can't detect session name — hook must bind it.
|
|
148
|
+
# ═══════════════════════════════════════════════════════════════════════════
|
|
149
|
+
if ($sessionName -ne "unknown-session" -and $rawSessionId -ne "unknown") {
|
|
150
|
+
$configFile = Join-Path $EkkosConfigDir "config.json"
|
|
151
|
+
if (Test-Path $configFile) {
|
|
152
|
+
try {
|
|
153
|
+
$config = Get-Content $configFile -Raw | ConvertFrom-Json
|
|
154
|
+
$userId = $config.userId
|
|
155
|
+
if ($userId) {
|
|
156
|
+
$projectPath = if ($env:PWD) { $env:PWD } else { (Get-Location).Path }
|
|
157
|
+
$pendingSession = if ($env:EKKOS_PENDING_SESSION) { $env:EKKOS_PENDING_SESSION } else { "_pending" }
|
|
158
|
+
$bindBody = @{
|
|
159
|
+
userId = $userId
|
|
160
|
+
realSession = $sessionName
|
|
161
|
+
projectPath = $projectPath
|
|
162
|
+
pendingSession = $pendingSession
|
|
163
|
+
} | ConvertTo-Json -Compress
|
|
164
|
+
|
|
165
|
+
Start-Job -ScriptBlock {
|
|
166
|
+
param($body)
|
|
167
|
+
Invoke-RestMethod -Uri "https://proxy.ekkos.dev/proxy/session/bind" `
|
|
168
|
+
-Method POST `
|
|
169
|
+
-Headers @{ "Content-Type" = "application/json" } `
|
|
170
|
+
-Body $body -ErrorAction SilentlyContinue | Out-Null
|
|
171
|
+
} -ArgumentList $bindBody | Out-Null
|
|
172
|
+
}
|
|
173
|
+
} catch {}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
144
177
|
# ═══════════════════════════════════════════════════════════════════════════
|
|
145
178
|
# TURN TRACKING & STATE MANAGEMENT
|
|
146
179
|
# ═══════════════════════════════════════════════════════════════════════════
|