@ekkos/cli 1.0.5 → 1.0.7
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
|
|
@@ -110,6 +110,37 @@ if ($queryLower -match '(sql|query|supabase|prisma|database|table|column|select
|
|
|
110
110
|
$skillReminders += "SCHEMA REQUIRED: Call ekkOS_GetSchema for correct field names"
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
# ═══════════════════════════════════════════════════════════════════════════
|
|
114
|
+
# SESSION NAME - Resolve early so it's available for all downstream use
|
|
115
|
+
# ═══════════════════════════════════════════════════════════════════════════
|
|
116
|
+
function Convert-UuidToWords {
|
|
117
|
+
param([string]$uuid)
|
|
118
|
+
|
|
119
|
+
if (-not $script:SessionWords) { Load-SessionWords }
|
|
120
|
+
if (-not $script:SessionWords) { return "unknown-session" }
|
|
121
|
+
|
|
122
|
+
$adjectives = $script:SessionWords.adjectives
|
|
123
|
+
$nouns = $script:SessionWords.nouns
|
|
124
|
+
$verbs = $script:SessionWords.verbs
|
|
125
|
+
|
|
126
|
+
if (-not $adjectives -or -not $nouns -or -not $verbs) { return "unknown-session" }
|
|
127
|
+
if (-not $uuid -or $uuid -eq "unknown") { return "unknown-session" }
|
|
128
|
+
|
|
129
|
+
$clean = $uuid -replace "-", ""
|
|
130
|
+
if ($clean.Length -lt 6) { return "unknown-session" }
|
|
131
|
+
|
|
132
|
+
try {
|
|
133
|
+
$a = [Convert]::ToInt32($clean.Substring(0,2), 16) % $adjectives.Length
|
|
134
|
+
$n = [Convert]::ToInt32($clean.Substring(2,2), 16) % $nouns.Length
|
|
135
|
+
$an = [Convert]::ToInt32($clean.Substring(4,2), 16) % $verbs.Length
|
|
136
|
+
return "$($adjectives[$a])-$($nouns[$n])-$($verbs[$an])"
|
|
137
|
+
} catch {
|
|
138
|
+
return "unknown-session"
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
$sessionName = Convert-UuidToWords $rawSessionId
|
|
143
|
+
|
|
113
144
|
# ═══════════════════════════════════════════════════════════════════════════
|
|
114
145
|
# TURN TRACKING & STATE MANAGEMENT
|
|
115
146
|
# ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -194,47 +225,6 @@ if (Test-Path $configFile) {
|
|
|
194
225
|
} catch {}
|
|
195
226
|
}
|
|
196
227
|
|
|
197
|
-
# ═══════════════════════════════════════════════════════════════════════════
|
|
198
|
-
# SESSION NAME (UUID to words) - Uses external session-words.json
|
|
199
|
-
# ═══════════════════════════════════════════════════════════════════════════
|
|
200
|
-
function Convert-UuidToWords {
|
|
201
|
-
param([string]$uuid)
|
|
202
|
-
|
|
203
|
-
# Load session words if not already loaded
|
|
204
|
-
if (-not $script:SessionWords) {
|
|
205
|
-
Load-SessionWords
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
# Handle missing session words gracefully
|
|
209
|
-
if (-not $script:SessionWords) {
|
|
210
|
-
return "unknown-session"
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
$adjectives = $script:SessionWords.adjectives
|
|
214
|
-
$nouns = $script:SessionWords.nouns
|
|
215
|
-
$verbs = $script:SessionWords.verbs
|
|
216
|
-
|
|
217
|
-
if (-not $adjectives -or -not $nouns -or -not $verbs) {
|
|
218
|
-
return "unknown-session"
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
if (-not $uuid -or $uuid -eq "unknown") { return "unknown-session" }
|
|
222
|
-
|
|
223
|
-
$clean = $uuid -replace "-", ""
|
|
224
|
-
if ($clean.Length -lt 6) { return "unknown-session" }
|
|
225
|
-
|
|
226
|
-
try {
|
|
227
|
-
$a = [Convert]::ToInt32($clean.Substring(0,2), 16) % $adjectives.Length
|
|
228
|
-
$n = [Convert]::ToInt32($clean.Substring(2,2), 16) % $nouns.Length
|
|
229
|
-
$an = [Convert]::ToInt32($clean.Substring(4,2), 16) % $verbs.Length
|
|
230
|
-
|
|
231
|
-
return "$($adjectives[$a])-$($nouns[$n])-$($verbs[$an])"
|
|
232
|
-
} catch {
|
|
233
|
-
return "unknown-session"
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
$sessionName = Convert-UuidToWords $rawSessionId
|
|
238
228
|
$timestamp = (Get-Date).ToString("yyyy-MM-dd hh:mm:ss tt") + " EST"
|
|
239
229
|
|
|
240
230
|
# ═══════════════════════════════════════════════════════════════════════════
|