arkaos 4.3.5 → 4.4.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.
Files changed (113) hide show
  1. package/VERSION +1 -1
  2. package/arka/SKILL.md +1 -1
  3. package/bin/arka-claude +35 -4
  4. package/bin/arka-py +22 -7
  5. package/config/hooks/_lib/arka_python.ps1 +31 -0
  6. package/config/hooks/_lib/arka_python.sh +38 -0
  7. package/config/hooks/post-tool-use.ps1 +8 -0
  8. package/config/hooks/post-tool-use.sh +11 -5
  9. package/config/hooks/pre-tool-use.ps1 +11 -6
  10. package/config/hooks/pre-tool-use.sh +11 -6
  11. package/config/hooks/session-start.ps1 +10 -0
  12. package/config/hooks/session-start.sh +5 -0
  13. package/config/hooks/stop.ps1 +9 -1
  14. package/config/hooks/stop.sh +11 -5
  15. package/config/hooks/user-prompt-submit.ps1 +18 -0
  16. package/config/hooks/user-prompt-submit.sh +11 -5
  17. package/core/cognition/scheduler/__pycache__/daemon.cpython-313.pyc +0 -0
  18. package/core/cognition/scheduler/daemon.py +7 -3
  19. package/core/forge/__pycache__/orchestrator.cpython-313.pyc +0 -0
  20. package/core/forge/orchestrator.py +2 -1
  21. package/core/hooks/__pycache__/_shared.cpython-313.pyc +0 -0
  22. package/core/hooks/__pycache__/_shared.cpython-314.pyc +0 -0
  23. package/core/hooks/__pycache__/stop.cpython-313.pyc +0 -0
  24. package/core/hooks/__pycache__/stop.cpython-314.pyc +0 -0
  25. package/core/hooks/__pycache__/user_prompt_submit.cpython-313.pyc +0 -0
  26. package/core/hooks/_shared.py +29 -9
  27. package/core/hooks/stop.py +4 -3
  28. package/core/hooks/user_prompt_submit.py +5 -4
  29. package/core/knowledge/__pycache__/indexer.cpython-313.pyc +0 -0
  30. package/core/knowledge/__pycache__/vector_store.cpython-313.pyc +0 -0
  31. package/core/knowledge/indexer.py +1 -1
  32. package/core/knowledge/vector_store.py +10 -3
  33. package/core/runtime/__pycache__/model_router.cpython-312.pyc +0 -0
  34. package/core/runtime/__pycache__/model_router.cpython-314.pyc +0 -0
  35. package/core/runtime/__pycache__/model_routing_check.cpython-313.pyc +0 -0
  36. package/core/runtime/__pycache__/model_routing_context.cpython-313.pyc +0 -0
  37. package/core/runtime/__pycache__/native_usage.cpython-313.pyc +0 -0
  38. package/core/runtime/__pycache__/native_usage.cpython-314.pyc +0 -0
  39. package/core/runtime/gateway/__init__.py +28 -0
  40. package/core/runtime/gateway/__main__.py +30 -0
  41. package/core/runtime/gateway/__pycache__/__init__.cpython-312.pyc +0 -0
  42. package/core/runtime/gateway/__pycache__/__init__.cpython-313.pyc +0 -0
  43. package/core/runtime/gateway/__pycache__/__init__.cpython-314.pyc +0 -0
  44. package/core/runtime/gateway/__pycache__/__main__.cpython-313.pyc +0 -0
  45. package/core/runtime/gateway/__pycache__/litellm_config.cpython-312.pyc +0 -0
  46. package/core/runtime/gateway/__pycache__/litellm_config.cpython-313.pyc +0 -0
  47. package/core/runtime/gateway/__pycache__/litellm_config.cpython-314.pyc +0 -0
  48. package/core/runtime/gateway/litellm_config.py +205 -0
  49. package/core/runtime/model_routing_check.py +71 -0
  50. package/core/runtime/model_routing_context.py +22 -1
  51. package/core/runtime/native_usage.py +2 -1
  52. package/core/shared/__pycache__/temp_paths.cpython-313.pyc +0 -0
  53. package/core/shared/__pycache__/temp_paths.cpython-314.pyc +0 -0
  54. package/core/shared/temp_paths.py +40 -0
  55. package/core/synapse/__pycache__/kb_cache.cpython-313.pyc +0 -0
  56. package/core/synapse/__pycache__/kb_cache.cpython-314.pyc +0 -0
  57. package/core/synapse/kb_cache.py +3 -2
  58. package/core/sync/__pycache__/agent_provisioner.cpython-313.pyc +0 -0
  59. package/core/sync/__pycache__/ai_mcp_decider.cpython-313.pyc +0 -0
  60. package/core/sync/__pycache__/content_syncer.cpython-313.pyc +0 -0
  61. package/core/sync/__pycache__/descriptor_syncer.cpython-313.pyc +0 -0
  62. package/core/sync/__pycache__/discovery.cpython-313.pyc +0 -0
  63. package/core/sync/__pycache__/engine.cpython-313.pyc +0 -0
  64. package/core/sync/__pycache__/manifest.cpython-313.pyc +0 -0
  65. package/core/sync/__pycache__/mcp_optimizer.cpython-313.pyc +0 -0
  66. package/core/sync/__pycache__/mcp_syncer.cpython-313.pyc +0 -0
  67. package/core/sync/__pycache__/policy_loader.cpython-313.pyc +0 -0
  68. package/core/sync/__pycache__/reporter.cpython-313.pyc +0 -0
  69. package/core/sync/__pycache__/settings_syncer.cpython-313.pyc +0 -0
  70. package/core/sync/agent_provisioner.py +5 -5
  71. package/core/sync/ai_mcp_decider.py +2 -2
  72. package/core/sync/content_syncer.py +14 -14
  73. package/core/sync/descriptor_syncer.py +2 -2
  74. package/core/sync/discovery.py +4 -4
  75. package/core/sync/engine.py +4 -4
  76. package/core/sync/manifest.py +1 -1
  77. package/core/sync/mcp_optimizer.py +5 -5
  78. package/core/sync/mcp_syncer.py +3 -3
  79. package/core/sync/policy_loader.py +1 -1
  80. package/core/sync/reporter.py +1 -1
  81. package/core/sync/settings_syncer.py +2 -2
  82. package/core/terminal/__pycache__/session.cpython-313.pyc +0 -0
  83. package/core/terminal/__pycache__/session_windows.cpython-313.pyc +0 -0
  84. package/core/terminal/session.py +66 -11
  85. package/core/terminal/session_windows.py +211 -0
  86. package/core/workflow/__pycache__/flow_authorization.cpython-313.pyc +0 -0
  87. package/core/workflow/__pycache__/flow_authorization.cpython-314.pyc +0 -0
  88. package/core/workflow/__pycache__/flow_enforcer.cpython-313.pyc +0 -0
  89. package/core/workflow/__pycache__/flow_enforcer.cpython-314.pyc +0 -0
  90. package/core/workflow/__pycache__/marker_cache.cpython-313.pyc +0 -0
  91. package/core/workflow/__pycache__/marker_cache.cpython-314.pyc +0 -0
  92. package/core/workflow/__pycache__/research_gate.cpython-313.pyc +0 -0
  93. package/core/workflow/__pycache__/research_gate.cpython-314.pyc +0 -0
  94. package/core/workflow/flow_authorization.py +2 -1
  95. package/core/workflow/flow_enforcer.py +2 -1
  96. package/core/workflow/marker_cache.py +2 -1
  97. package/core/workflow/research_gate.py +2 -1
  98. package/dashboard/app/pages/index.vue +6 -1
  99. package/installer/cli.js +5 -4
  100. package/installer/core-snapshot.js +53 -0
  101. package/installer/doctor.js +8 -3
  102. package/installer/index.js +29 -6
  103. package/installer/migrate.js +7 -4
  104. package/installer/update.js +13 -0
  105. package/package.json +1 -1
  106. package/pyproject.toml +8 -1
  107. package/scripts/__pycache__/dashboard-api.cpython-313.pyc +0 -0
  108. package/scripts/__pycache__/synapse-bridge.cpython-313.pyc +0 -0
  109. package/scripts/dashboard-api.py +69 -33
  110. package/scripts/gateway-ensure.sh +93 -0
  111. package/scripts/knowledge-index.py +35 -2
  112. package/scripts/start-dashboard.ps1 +34 -14
  113. package/scripts/synapse-bridge.py +3 -1
@@ -30,6 +30,7 @@ $arkaosHome = Join-Path $env:USERPROFILE '.arkaos'
30
30
  $pidFile = Join-Path $arkaosHome 'dashboard.pid'
31
31
  $portFile = Join-Path $arkaosHome 'dashboard.ports'
32
32
  $apiLog = Join-Path $arkaosHome 'api.log'
33
+ $apiErrLog = Join-Path $arkaosHome 'api.err.log'
33
34
 
34
35
  $null = New-Item -ItemType Directory -Force -Path $arkaosHome -ErrorAction SilentlyContinue
35
36
 
@@ -132,7 +133,7 @@ try {
132
133
  -ArgumentList @($dashboardApi, '--port', "$apiPort") `
133
134
  -WorkingDirectory $arkaosRoot `
134
135
  -RedirectStandardOutput $apiLog `
135
- -RedirectStandardError $apiLog `
136
+ -RedirectStandardError $apiErrLog `
136
137
  -NoNewWindow `
137
138
  -PassThru
138
139
  } finally {
@@ -160,10 +161,10 @@ for ($i = 0; $i -lt 20; $i++) {
160
161
  if ($apiReady) {
161
162
  Write-Host " API: http://localhost:$apiPort" -ForegroundColor Green
162
163
  } else {
163
- Write-Host " ! API may still be starting (check log: $apiLog)" -ForegroundColor Yellow
164
- if (Test-Path -LiteralPath $apiLog) {
164
+ Write-Host " ! API may still be starting (check log: $apiErrLog)" -ForegroundColor Yellow
165
+ if (Test-Path -LiteralPath $apiErrLog) {
165
166
  try {
166
- $lastError = (Get-Content -LiteralPath $apiLog -Tail 3 -ErrorAction SilentlyContinue | Select-Object -First 1)
167
+ $lastError = (Get-Content -LiteralPath $apiErrLog -Tail 3 -ErrorAction SilentlyContinue | Select-Object -First 1)
167
168
  if ($lastError) {
168
169
  Write-Host " Last error: $lastError" -ForegroundColor DarkGray
169
170
  }
@@ -180,11 +181,23 @@ $nuxtServer = Join-Path $nuxtOutput 'server\index.mjs'
180
181
 
181
182
  function Start-NuxtDev {
182
183
  param([int]$Port, [int]$ApiPort, [string]$WorkingDir)
183
- # `npx nuxt dev --port <n>` works from cmd.exe; PowerShell resolves npx
184
- # via the npx.cmd shim installed with Node.js.
184
+ # Launch node directly against the Nuxt CLI entry. The 'npx' shim is a
185
+ # .cmd on Windows, which Start-Process -NoNewWindow cannot exec ("%1 is
186
+ # not a valid Win32 application"), and wrapping it in cmd.exe yields a
187
+ # process tree that dies with the launcher. A direct node.exe child
188
+ # detaches cleanly and survives, like the API process.
185
189
  $savedApi = $env:NUXT_PUBLIC_API_BASE
186
190
  $env:NUXT_PUBLIC_API_BASE = "http://localhost:$ApiPort"
187
191
  try {
192
+ $nuxtBin = Join-Path $WorkingDir 'node_modules\nuxt\bin\nuxt.mjs'
193
+ if (Test-Path -LiteralPath $nuxtBin) {
194
+ return Start-Process -FilePath 'node' `
195
+ -ArgumentList @($nuxtBin,'dev','--port',"$Port") `
196
+ -WorkingDirectory $WorkingDir `
197
+ -NoNewWindow `
198
+ -PassThru
199
+ }
200
+ # Fallback (non-Windows or missing local bin): the npx shim is fine.
188
201
  return Start-Process -FilePath 'npx' `
189
202
  -ArgumentList @('nuxt','dev','--port',"$Port") `
190
203
  -WorkingDirectory $WorkingDir `
@@ -215,18 +228,25 @@ if (Test-Path -LiteralPath $nuxtServer) {
215
228
  Write-Host " Starting UI (dev) on :$uiPort..."
216
229
  $uiProc = Start-NuxtDev -Port $uiPort -ApiPort $apiPort -WorkingDir $dashboardDir
217
230
  } else {
218
- # Auto-install and start
219
- Write-Host ' Installing dashboard dependencies...'
220
- $installer = if (Get-Command pnpm -ErrorAction SilentlyContinue) { 'pnpm' } else { 'npm' }
231
+ # Auto-install and start. The dashboard pins pnpm (package.json
232
+ # packageManager) — npm's flat node_modules layout breaks Nuxt 4's
233
+ # server-entry resolution ("No entry found in rollupOptions.input"), so
234
+ # install with the pinned pnpm via corepack (always shipped with Node).
235
+ # corepack/pnpm are .cmd shims that Start-Process -NoNewWindow cannot
236
+ # exec directly on Windows, so route through cmd.exe.
237
+ Write-Host ' Installing dashboard dependencies (pnpm via corepack)...'
238
+ $savedPrompt = $env:COREPACK_ENABLE_DOWNLOAD_PROMPT
239
+ $env:COREPACK_ENABLE_DOWNLOAD_PROMPT = '0'
221
240
  try {
222
- Start-Process -FilePath $installer `
223
- -ArgumentList @('install','--silent') `
241
+ Start-Process -FilePath $env:ComSpec `
242
+ -ArgumentList @('/c','corepack','pnpm','install') `
224
243
  -WorkingDirectory $dashboardDir `
225
244
  -NoNewWindow `
226
- -Wait `
227
- -PassThru | Out-Null
245
+ -Wait | Out-Null
228
246
  } catch {
229
- Write-Host " ! Dashboard install failed ($installer). API-only mode." -ForegroundColor Yellow
247
+ Write-Host " ! Dashboard install failed. API-only mode." -ForegroundColor Yellow
248
+ } finally {
249
+ $env:COREPACK_ENABLE_DOWNLOAD_PROMPT = $savedPrompt
230
250
  }
231
251
  if (Test-Path -LiteralPath $nuxtNodeModules) {
232
252
  Write-Host " Starting UI (dev) on :$uiPort..."
@@ -24,12 +24,14 @@ from typing import Any
24
24
  ARKAOS_ROOT = Path(os.environ.get("ARKAOS_ROOT", Path(__file__).resolve().parent.parent))
25
25
  sys.path.insert(0, str(ARKAOS_ROOT))
26
26
 
27
+ from core.shared.temp_paths import arkaos_temp_dir # noqa: E402
28
+
27
29
  # Layer tags carrying the actually-injected KB counts (ground truth for
28
30
  # reconciling the model's self-reported `[arka:meta] kb=N`). The optional
29
31
  # ` degraded=keyword` suffix (RAG honesty, PR-3 v4.1) must still count.
30
32
  _KB_CONTEXT_TAG_RE = re.compile(r"\[kb-context:(\d+)[^\]]*\]")
31
33
  _KNOWLEDGE_TAG_RE = re.compile(r"\[knowledge:(\d+) chunks?[^\]]*\]")
32
- _KB_INJECTED_DIR = Path("/tmp/arkaos-kb-injected")
34
+ _KB_INJECTED_DIR = arkaos_temp_dir("arkaos-kb-injected")
33
35
 
34
36
 
35
37
  def _count_injected_kb(result: Any) -> tuple[int, int]: