arkaos 2.10.0 → 2.11.0
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/README.md +318 -107
- package/VERSION +1 -1
- package/config/hooks/cwd-changed.ps1 +144 -0
- package/config/hooks/post-tool-use.ps1 +347 -0
- package/config/hooks/post-tool-use.sh +6 -6
- package/config/hooks/pre-compact.ps1 +238 -0
- package/config/hooks/pre-compact.sh +10 -6
- package/config/hooks/session-start.ps1 +109 -0
- package/config/hooks/session-start.sh +1 -1
- package/config/hooks/user-prompt-submit.ps1 +287 -0
- package/config/hooks/user-prompt-submit.sh +5 -2
- package/config/statusline.ps1 +160 -0
- package/core/cognition/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/cognition/capture/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/cognition/capture/__pycache__/collector.cpython-313.pyc +0 -0
- package/core/cognition/capture/__pycache__/store.cpython-313.pyc +0 -0
- package/core/cognition/insights/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/cognition/insights/__pycache__/store.cpython-313.pyc +0 -0
- package/core/cognition/memory/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/cognition/memory/__pycache__/obsidian.cpython-313.pyc +0 -0
- package/core/cognition/memory/__pycache__/schemas.cpython-313.pyc +0 -0
- package/core/cognition/memory/__pycache__/vector.cpython-313.pyc +0 -0
- package/core/cognition/memory/__pycache__/writer.cpython-313.pyc +0 -0
- package/core/cognition/research/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/cognition/research/__pycache__/profiler.cpython-313.pyc +0 -0
- package/core/cognition/scheduler/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/cognition/scheduler/__pycache__/cli.cpython-313.pyc +0 -0
- package/core/cognition/scheduler/__pycache__/daemon.cpython-313.pyc +0 -0
- package/core/cognition/scheduler/__pycache__/platform.cpython-313.pyc +0 -0
- package/core/cognition/scheduler/daemon.py +77 -21
- package/core/cognition/scheduler/platform.py +43 -12
- package/core/knowledge/__pycache__/vector_store.cpython-313.pyc +0 -0
- package/core/knowledge/vector_store.py +50 -25
- package/core/synapse/__pycache__/layers.cpython-313.pyc +0 -0
- package/core/synapse/layers.py +2 -2
- package/installer/adapters/claude-code.js +72 -45
- package/installer/cli.js +19 -6
- package/installer/doctor.js +130 -18
- package/installer/index.js +592 -149
- package/installer/platform.js +20 -0
- package/installer/prompts.js +109 -5
- package/installer/python-resolver.js +251 -0
- package/installer/update.js +497 -62
- package/package.json +1 -1
- package/pyproject.toml +2 -2
- package/scripts/start-dashboard.ps1 +271 -0
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
# ============================================================================
|
|
2
|
+
# ArkaOS Dashboard - Start FastAPI + Nuxt servers (Windows / PowerShell 5.1+)
|
|
3
|
+
#
|
|
4
|
+
# Port of scripts/start-dashboard.sh. Same contract:
|
|
5
|
+
# - Finds free TCP ports starting from ARKAOS_DASHBOARD_UI_PORT (default 3333).
|
|
6
|
+
# - Stops any previously-started dashboard processes recorded in the PID file.
|
|
7
|
+
# - Launches the FastAPI backend (scripts/dashboard-api.py) as a background
|
|
8
|
+
# process with logs redirected to %USERPROFILE%\.arkaos\api.log.
|
|
9
|
+
# - Waits up to ~10 s for the API health endpoint.
|
|
10
|
+
# - Launches the Nuxt frontend in whichever mode is available: pre-built
|
|
11
|
+
# .output, existing node_modules (dev mode), or install-then-dev.
|
|
12
|
+
# - Records the child PIDs and ports, prints a summary, and opens the
|
|
13
|
+
# browser at the UI URL.
|
|
14
|
+
#
|
|
15
|
+
# Pure ASCII source on purpose (PS 5.1 reads source as ANSI by default).
|
|
16
|
+
# Box-drawing characters for the summary are built from [char] codes.
|
|
17
|
+
# ============================================================================
|
|
18
|
+
|
|
19
|
+
$ErrorActionPreference = 'Stop'
|
|
20
|
+
[Console]::OutputEncoding = [System.Text.UTF8Encoding]::new($false)
|
|
21
|
+
|
|
22
|
+
# --- Paths -----------------------------------------------------------------
|
|
23
|
+
if ($env:ARKAOS_ROOT) {
|
|
24
|
+
$arkaosRoot = $env:ARKAOS_ROOT
|
|
25
|
+
} else {
|
|
26
|
+
$arkaosRoot = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
|
|
27
|
+
}
|
|
28
|
+
$dashboardDir = Join-Path $arkaosRoot 'dashboard'
|
|
29
|
+
$arkaosHome = Join-Path $env:USERPROFILE '.arkaos'
|
|
30
|
+
$pidFile = Join-Path $arkaosHome 'dashboard.pid'
|
|
31
|
+
$portFile = Join-Path $arkaosHome 'dashboard.ports'
|
|
32
|
+
$apiLog = Join-Path $arkaosHome 'api.log'
|
|
33
|
+
|
|
34
|
+
$null = New-Item -ItemType Directory -Force -Path $arkaosHome -ErrorAction SilentlyContinue
|
|
35
|
+
|
|
36
|
+
# --- Kill existing dashboard processes -------------------------------------
|
|
37
|
+
if (Test-Path -LiteralPath $pidFile) {
|
|
38
|
+
try {
|
|
39
|
+
$existingPids = Get-Content -LiteralPath $pidFile -Encoding ASCII -ErrorAction SilentlyContinue
|
|
40
|
+
foreach ($line in $existingPids) {
|
|
41
|
+
$pidValue = 0
|
|
42
|
+
if ([int]::TryParse($line.Trim(), [ref]$pidValue) -and $pidValue -gt 0) {
|
|
43
|
+
try { Stop-Process -Id $pidValue -Force -ErrorAction SilentlyContinue } catch { }
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
} catch { }
|
|
47
|
+
Remove-Item -LiteralPath $pidFile, $portFile -Force -ErrorAction SilentlyContinue
|
|
48
|
+
Start-Sleep -Seconds 1
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
# --- Find an available TCP port --------------------------------------------
|
|
52
|
+
# Windows-native port probe: try to bind a TcpListener on loopback. If the
|
|
53
|
+
# bind succeeds the port is free; otherwise increment and retry. No reliance
|
|
54
|
+
# on lsof / Get-NetTCPConnection (the former does not exist on Windows, the
|
|
55
|
+
# latter requires the NetTCPIP module and is slower for a spin loop).
|
|
56
|
+
function Find-Port([int]$start) {
|
|
57
|
+
$port = $start
|
|
58
|
+
while ($true) {
|
|
59
|
+
$listener = $null
|
|
60
|
+
try {
|
|
61
|
+
$listener = [System.Net.Sockets.TcpListener]::new([System.Net.IPAddress]::Loopback, $port)
|
|
62
|
+
$listener.Start()
|
|
63
|
+
return $port
|
|
64
|
+
} catch {
|
|
65
|
+
$port++
|
|
66
|
+
if ($port -gt 65535) {
|
|
67
|
+
throw "No free port available above $start"
|
|
68
|
+
}
|
|
69
|
+
} finally {
|
|
70
|
+
if ($listener) { try { $listener.Stop() } catch { } }
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
$defaultUi = if ($env:ARKAOS_DASHBOARD_UI_PORT) { [int]$env:ARKAOS_DASHBOARD_UI_PORT } else { 3333 }
|
|
76
|
+
$uiPort = Find-Port $defaultUi
|
|
77
|
+
|
|
78
|
+
$defaultApi = if ($env:ARKAOS_DASHBOARD_API_PORT) { [int]$env:ARKAOS_DASHBOARD_API_PORT } else { $uiPort + 1 }
|
|
79
|
+
$apiPort = Find-Port $defaultApi
|
|
80
|
+
|
|
81
|
+
Write-Host ''
|
|
82
|
+
Write-Host ' ArkaOS Dashboard'
|
|
83
|
+
Write-Host ' -----------------'
|
|
84
|
+
|
|
85
|
+
# --- Locate Python ---------------------------------------------------------
|
|
86
|
+
# Prefer the ArkaOS venv python recorded in the install manifest so the
|
|
87
|
+
# dashboard API runs against the same interpreter the installer uses.
|
|
88
|
+
function Find-Python {
|
|
89
|
+
$manifest = Join-Path $arkaosHome 'install-manifest.json'
|
|
90
|
+
if (Test-Path -LiteralPath $manifest) {
|
|
91
|
+
try {
|
|
92
|
+
$m = Get-Content -Raw -LiteralPath $manifest -Encoding UTF8 | ConvertFrom-Json
|
|
93
|
+
if ($m.pythonCmd -and (Test-Path -LiteralPath $m.pythonCmd)) {
|
|
94
|
+
return $m.pythonCmd
|
|
95
|
+
}
|
|
96
|
+
} catch { }
|
|
97
|
+
}
|
|
98
|
+
$venvPy = Join-Path $arkaosHome 'venv\Scripts\python.exe'
|
|
99
|
+
if (Test-Path -LiteralPath $venvPy) { return $venvPy }
|
|
100
|
+
foreach ($cmd in 'python','python3','py') {
|
|
101
|
+
$found = Get-Command $cmd -ErrorAction SilentlyContinue
|
|
102
|
+
if ($found) { return $found.Source }
|
|
103
|
+
}
|
|
104
|
+
return $null
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
$python = Find-Python
|
|
108
|
+
if (-not $python) {
|
|
109
|
+
Write-Host ' Error: no usable Python interpreter found.' -ForegroundColor Red
|
|
110
|
+
Write-Host ' Install Python 3.11+ and rerun.' -ForegroundColor DarkGray
|
|
111
|
+
exit 1
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
# --- Start FastAPI backend -------------------------------------------------
|
|
115
|
+
Write-Host " Starting API on :$apiPort..."
|
|
116
|
+
$dashboardApi = Join-Path $arkaosRoot 'scripts\dashboard-api.py'
|
|
117
|
+
|
|
118
|
+
# Start-Process inherits the parent's environment, so setting ARKAOS_ROOT
|
|
119
|
+
# here is enough to pass it to the child.
|
|
120
|
+
$savedArkaosRoot = $env:ARKAOS_ROOT
|
|
121
|
+
$env:ARKAOS_ROOT = $arkaosRoot
|
|
122
|
+
try {
|
|
123
|
+
$apiProc = Start-Process -FilePath $python `
|
|
124
|
+
-ArgumentList @($dashboardApi, '--port', "$apiPort") `
|
|
125
|
+
-WorkingDirectory $arkaosRoot `
|
|
126
|
+
-RedirectStandardOutput $apiLog `
|
|
127
|
+
-RedirectStandardError $apiLog `
|
|
128
|
+
-NoNewWindow `
|
|
129
|
+
-PassThru
|
|
130
|
+
} finally {
|
|
131
|
+
$env:ARKAOS_ROOT = $savedArkaosRoot
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
# --- Health check (up to ~10s) --------------------------------------------
|
|
135
|
+
$apiReady = $false
|
|
136
|
+
for ($i = 0; $i -lt 20; $i++) {
|
|
137
|
+
Start-Sleep -Milliseconds 500
|
|
138
|
+
if ($apiProc.HasExited) { break }
|
|
139
|
+
try {
|
|
140
|
+
$resp = Invoke-WebRequest `
|
|
141
|
+
-Uri "http://localhost:$apiPort/api/overview" `
|
|
142
|
+
-UseBasicParsing `
|
|
143
|
+
-TimeoutSec 1 `
|
|
144
|
+
-ErrorAction Stop
|
|
145
|
+
if ($resp.StatusCode -ge 200 -and $resp.StatusCode -lt 500) {
|
|
146
|
+
$apiReady = $true
|
|
147
|
+
break
|
|
148
|
+
}
|
|
149
|
+
} catch { }
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if ($apiReady) {
|
|
153
|
+
Write-Host " API: http://localhost:$apiPort" -ForegroundColor Green
|
|
154
|
+
} else {
|
|
155
|
+
Write-Host " ! API may still be starting (check log: $apiLog)" -ForegroundColor Yellow
|
|
156
|
+
if (Test-Path -LiteralPath $apiLog) {
|
|
157
|
+
try {
|
|
158
|
+
$lastError = (Get-Content -LiteralPath $apiLog -Tail 3 -ErrorAction SilentlyContinue | Select-Object -First 1)
|
|
159
|
+
if ($lastError) {
|
|
160
|
+
Write-Host " Last error: $lastError" -ForegroundColor DarkGray
|
|
161
|
+
}
|
|
162
|
+
} catch { }
|
|
163
|
+
}
|
|
164
|
+
# Do not exit - API may still be loading; continue with the UI.
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
# --- Start Nuxt frontend ---------------------------------------------------
|
|
168
|
+
$uiProc = $null
|
|
169
|
+
$nuxtOutput = Join-Path $dashboardDir '.output'
|
|
170
|
+
$nuxtNodeModules = Join-Path $dashboardDir 'node_modules'
|
|
171
|
+
$nuxtServer = Join-Path $nuxtOutput 'server\index.mjs'
|
|
172
|
+
|
|
173
|
+
function Start-NuxtDev {
|
|
174
|
+
param([int]$Port, [int]$ApiPort, [string]$WorkingDir)
|
|
175
|
+
# `npx nuxt dev --port <n>` works from cmd.exe; PowerShell resolves npx
|
|
176
|
+
# via the npx.cmd shim installed with Node.js.
|
|
177
|
+
$savedApi = $env:NUXT_PUBLIC_API_BASE
|
|
178
|
+
$env:NUXT_PUBLIC_API_BASE = "http://localhost:$ApiPort"
|
|
179
|
+
try {
|
|
180
|
+
return Start-Process -FilePath 'npx' `
|
|
181
|
+
-ArgumentList @('nuxt','dev','--port',"$Port") `
|
|
182
|
+
-WorkingDirectory $WorkingDir `
|
|
183
|
+
-NoNewWindow `
|
|
184
|
+
-PassThru
|
|
185
|
+
} finally {
|
|
186
|
+
$env:NUXT_PUBLIC_API_BASE = $savedApi
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (Test-Path -LiteralPath $nuxtServer) {
|
|
191
|
+
Write-Host " Starting UI on :$uiPort..."
|
|
192
|
+
$savedPort = $env:PORT
|
|
193
|
+
$savedApi = $env:NUXT_PUBLIC_API_BASE
|
|
194
|
+
$env:PORT = "$uiPort"
|
|
195
|
+
$env:NUXT_PUBLIC_API_BASE = "http://localhost:$apiPort"
|
|
196
|
+
try {
|
|
197
|
+
$uiProc = Start-Process -FilePath 'node' `
|
|
198
|
+
-ArgumentList @($nuxtServer) `
|
|
199
|
+
-WorkingDirectory $dashboardDir `
|
|
200
|
+
-NoNewWindow `
|
|
201
|
+
-PassThru
|
|
202
|
+
} finally {
|
|
203
|
+
$env:PORT = $savedPort
|
|
204
|
+
$env:NUXT_PUBLIC_API_BASE = $savedApi
|
|
205
|
+
}
|
|
206
|
+
} elseif (Test-Path -LiteralPath $nuxtNodeModules) {
|
|
207
|
+
Write-Host " Starting UI (dev) on :$uiPort..."
|
|
208
|
+
$uiProc = Start-NuxtDev -Port $uiPort -ApiPort $apiPort -WorkingDir $dashboardDir
|
|
209
|
+
} else {
|
|
210
|
+
# Auto-install and start
|
|
211
|
+
Write-Host ' Installing dashboard dependencies...'
|
|
212
|
+
$installer = if (Get-Command pnpm -ErrorAction SilentlyContinue) { 'pnpm' } else { 'npm' }
|
|
213
|
+
try {
|
|
214
|
+
Start-Process -FilePath $installer `
|
|
215
|
+
-ArgumentList @('install','--silent') `
|
|
216
|
+
-WorkingDirectory $dashboardDir `
|
|
217
|
+
-NoNewWindow `
|
|
218
|
+
-Wait `
|
|
219
|
+
-PassThru | Out-Null
|
|
220
|
+
} catch {
|
|
221
|
+
Write-Host " ! Dashboard install failed ($installer). API-only mode." -ForegroundColor Yellow
|
|
222
|
+
}
|
|
223
|
+
if (Test-Path -LiteralPath $nuxtNodeModules) {
|
|
224
|
+
Write-Host " Starting UI (dev) on :$uiPort..."
|
|
225
|
+
$uiProc = Start-NuxtDev -Port $uiPort -ApiPort $apiPort -WorkingDir $dashboardDir
|
|
226
|
+
} else {
|
|
227
|
+
Write-Host ' ! Dashboard install did not create node_modules. API-only mode.' -ForegroundColor Yellow
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
# --- Save state ------------------------------------------------------------
|
|
232
|
+
# PID file and port file are plain ASCII so other scripts (npx arkaos
|
|
233
|
+
# dashboard stop, bash readers) can parse them identically to the .sh
|
|
234
|
+
# version.
|
|
235
|
+
$pidLines = @()
|
|
236
|
+
if ($apiProc) { $pidLines += [string]$apiProc.Id }
|
|
237
|
+
if ($uiProc) { $pidLines += [string]$uiProc.Id }
|
|
238
|
+
[System.IO.File]::WriteAllText($pidFile, ($pidLines -join [Environment]::NewLine), [System.Text.ASCIIEncoding]::new())
|
|
239
|
+
|
|
240
|
+
$portLines = @("API_PORT=$apiPort")
|
|
241
|
+
if ($uiProc) { $portLines += "UI_PORT=$uiPort" }
|
|
242
|
+
[System.IO.File]::WriteAllText($portFile, ($portLines -join [Environment]::NewLine), [System.Text.ASCIIEncoding]::new())
|
|
243
|
+
|
|
244
|
+
# --- Print summary box -----------------------------------------------------
|
|
245
|
+
$tl = [char]0x250C; $tr = [char]0x2510
|
|
246
|
+
$bl = [char]0x2514; $br = [char]0x2518
|
|
247
|
+
$h = [char]0x2500; $v = [char]0x2502
|
|
248
|
+
$width = 38
|
|
249
|
+
$bar = [string]$h * $width
|
|
250
|
+
|
|
251
|
+
Write-Host ''
|
|
252
|
+
Write-Host (" $tl$bar$tr")
|
|
253
|
+
Write-Host (" $v API: http://localhost:$apiPort" + (' ' * ($width - 23 - "$apiPort".Length)) + "$v")
|
|
254
|
+
if ($uiProc) {
|
|
255
|
+
Write-Host (" $v UI: http://localhost:$uiPort" + (' ' * ($width - 23 - "$uiPort".Length)) + "$v")
|
|
256
|
+
}
|
|
257
|
+
Write-Host (" $bl$bar$br")
|
|
258
|
+
Write-Host ''
|
|
259
|
+
Write-Host ' Stop: npx arkaos dashboard stop'
|
|
260
|
+
Write-Host " or: Stop-Process -Id (Get-Content '$pidFile')"
|
|
261
|
+
Write-Host ''
|
|
262
|
+
|
|
263
|
+
# --- Open the browser at the UI URL ----------------------------------------
|
|
264
|
+
if ($uiProc) {
|
|
265
|
+
Start-Sleep -Seconds 5
|
|
266
|
+
try {
|
|
267
|
+
Start-Process "http://localhost:$uiPort" | Out-Null
|
|
268
|
+
} catch {
|
|
269
|
+
# Silent: user can click the link in the terminal instead.
|
|
270
|
+
}
|
|
271
|
+
}
|