@ekkos/cli 1.0.34 → 1.0.36

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 (44) hide show
  1. package/dist/capture/jsonl-rewriter.js +72 -7
  2. package/dist/commands/dashboard.js +186 -557
  3. package/dist/commands/init.js +3 -15
  4. package/dist/commands/run.js +222 -256
  5. package/dist/commands/setup.js +0 -47
  6. package/dist/commands/swarm-dashboard.js +4 -13
  7. package/dist/deploy/instructions.d.ts +2 -5
  8. package/dist/deploy/instructions.js +8 -11
  9. package/dist/deploy/settings.js +21 -15
  10. package/dist/deploy/skills.d.ts +0 -8
  11. package/dist/deploy/skills.js +0 -26
  12. package/dist/index.js +2 -2
  13. package/dist/lib/usage-parser.js +1 -2
  14. package/dist/utils/platform.d.ts +0 -3
  15. package/dist/utils/platform.js +1 -4
  16. package/dist/utils/session-binding.d.ts +1 -1
  17. package/dist/utils/session-binding.js +2 -3
  18. package/package.json +1 -1
  19. package/templates/agents/README.md +182 -0
  20. package/templates/agents/code-reviewer.md +166 -0
  21. package/templates/agents/debug-detective.md +169 -0
  22. package/templates/agents/ekkOS_Vercel.md +99 -0
  23. package/templates/agents/extension-manager.md +229 -0
  24. package/templates/agents/git-companion.md +185 -0
  25. package/templates/agents/github-test-agent.md +321 -0
  26. package/templates/agents/railway-manager.md +179 -0
  27. package/templates/hooks/assistant-response.ps1 +26 -94
  28. package/templates/hooks/lib/count-tokens.cjs +0 -0
  29. package/templates/hooks/lib/ekkos-reminders.sh +0 -0
  30. package/templates/hooks/session-start.ps1 +224 -61
  31. package/templates/hooks/session-start.sh +1 -1
  32. package/templates/hooks/stop.ps1 +249 -103
  33. package/templates/hooks/stop.sh +1 -1
  34. package/templates/hooks/user-prompt-submit.ps1 +519 -129
  35. package/templates/hooks/user-prompt-submit.sh +2 -2
  36. package/templates/plan-template.md +0 -0
  37. package/templates/spec-template.md +0 -0
  38. package/templates/windsurf-hooks/before-submit-prompt.sh +238 -0
  39. package/templates/windsurf-hooks/install.sh +0 -0
  40. package/templates/windsurf-hooks/lib/contract.sh +0 -0
  41. package/templates/windsurf-hooks/post-cascade-response.sh +0 -0
  42. package/templates/windsurf-hooks/pre-user-prompt.sh +0 -0
  43. package/templates/windsurf-skills/ekkos-memory/SKILL.md +219 -0
  44. package/README.md +0 -57
@@ -283,8 +283,9 @@ function truncateToolResult(line) {
283
283
  return line;
284
284
  }
285
285
  }
286
- // Local eviction debug store (best-effort forensic log)
286
+ // Evicted content store (for retrieval by ccDNA)
287
287
  const EVICTED_STORE = path.join(os.homedir(), '.ekkos', 'evicted-context.jsonl');
288
+ const EKKOS_CAPTURE_ENDPOINT = 'https://mcp.ekkos.dev/api/v1/context/evict';
288
289
  const EKKOS_API_URL = process.env.EKKOS_API_URL || 'https://mcp.ekkos.dev';
289
290
  /**
290
291
  * Evict messages using the Handshake Protocol (two-phase commit)
@@ -405,16 +406,80 @@ async function isHandshakeEvictionAvailable() {
405
406
  }
406
407
  return (0, eviction_client_js_1.checkEvictionHealth)(EKKOS_API_URL, authToken);
407
408
  }
409
+ /**
410
+ * Send evicted content to ekkOS cloud for later retrieval (async, non-blocking)
411
+ */
412
+ async function captureEvictedToCloud(lines, sessionId) {
413
+ try {
414
+ // Get auth token from environment
415
+ const authToken = process.env.EKKOS_AUTH_TOKEN || process.env.SUPABASE_AUTH_TOKEN;
416
+ if (!authToken) {
417
+ debugLog('CLOUD_CAPTURE_SKIP', 'No auth token available');
418
+ return;
419
+ }
420
+ // Parse messages from JSONL lines
421
+ const messages = [];
422
+ for (const line of lines) {
423
+ try {
424
+ const parsed = JSON.parse(line);
425
+ if (parsed.message) {
426
+ messages.push({
427
+ role: parsed.message.role || 'unknown',
428
+ content: parsed.message.content,
429
+ });
430
+ }
431
+ }
432
+ catch {
433
+ // Skip unparseable lines
434
+ }
435
+ }
436
+ if (messages.length === 0)
437
+ return;
438
+ // Estimate tokens (rough: 1 token ≈ 4 chars)
439
+ const totalChars = lines.reduce((sum, l) => sum + l.length, 0);
440
+ const estimatedTokens = Math.ceil(totalChars / 4);
441
+ const payload = {
442
+ session_id: sessionId || 'unknown',
443
+ chunk_index: Date.now(), // Use timestamp as unique chunk index
444
+ messages,
445
+ token_count: estimatedTokens,
446
+ eviction_reason: 'sliding_window',
447
+ };
448
+ // Non-blocking fetch - don't await, let it happen in background
449
+ // 10s timeout to prevent lingering connections from burning resources
450
+ fetch(EKKOS_CAPTURE_ENDPOINT, {
451
+ method: 'POST',
452
+ headers: {
453
+ 'Content-Type': 'application/json',
454
+ 'Authorization': `Bearer ${authToken}`,
455
+ },
456
+ body: JSON.stringify(payload),
457
+ signal: AbortSignal.timeout(10000),
458
+ }).then(res => {
459
+ if (res.ok) {
460
+ debugLog('CLOUD_CAPTURE_OK', `Sent ${messages.length} msgs to cloud`);
461
+ }
462
+ else {
463
+ debugLog('CLOUD_CAPTURE_FAIL', `HTTP ${res.status}`);
464
+ }
465
+ }).catch(err => {
466
+ debugLog('CLOUD_CAPTURE_ERROR', err.message);
467
+ });
468
+ }
469
+ catch (err) {
470
+ debugLog('CLOUD_CAPTURE_ERROR', err.message);
471
+ }
472
+ }
408
473
  /**
409
474
  * Save evicted content for later retrieval
410
475
  * Now supports handshake eviction when available
411
476
  *
412
477
  * @param lines - JSONL lines being evicted
413
- * @param _sessionId - Session ID (reserved for future diagnostics)
414
- * @param _sessionName - Session name (reserved for future diagnostics)
415
- * @param _indices - Original indices of evicted lines (reserved for future diagnostics)
478
+ * @param sessionId - Session ID (for legacy capture)
479
+ * @param sessionName - Session name (for handshake eviction)
480
+ * @param indices - Original indices of evicted lines
416
481
  */
417
- function saveEvictedContent(lines, _sessionId, _sessionName, _indices) {
482
+ function saveEvictedContent(lines, sessionId, sessionName, indices) {
418
483
  if (lines.length === 0)
419
484
  return;
420
485
  try {
@@ -451,8 +516,8 @@ function saveEvictedContent(lines, _sessionId, _sessionName, _indices) {
451
516
  const entries = content.split('\n').filter(l => l.trim());
452
517
  fs.writeFileSync(EVICTED_STORE, entries.slice(-100).join('\n') + '\n');
453
518
  }
454
- // No direct cloud capture here. Proxy/R2 handshake owns remote persistence.
455
- // Keep this local file only for operator debugging.
519
+ // Send to cloud for cross-session retrieval (non-blocking)
520
+ captureEvictedToCloud(lines, sessionId);
456
521
  }
457
522
  catch {
458
523
  // Silent fail