@ekkos/cli 0.2.18 → 0.3.3
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/LICENSE +21 -0
- package/dist/capture/eviction-client.d.ts +139 -0
- package/dist/capture/eviction-client.js +454 -0
- package/dist/capture/index.d.ts +2 -0
- package/dist/capture/index.js +2 -0
- package/dist/capture/jsonl-rewriter.d.ts +96 -0
- package/dist/capture/jsonl-rewriter.js +1369 -0
- package/dist/capture/transcript-repair.d.ts +50 -0
- package/dist/capture/transcript-repair.js +308 -0
- package/dist/commands/doctor.js +23 -1
- package/dist/commands/run.d.ts +2 -0
- package/dist/commands/run.js +1229 -293
- package/dist/commands/usage.d.ts +7 -0
- package/dist/commands/usage.js +214 -0
- package/dist/cron/index.d.ts +7 -0
- package/dist/cron/index.js +13 -0
- package/dist/cron/promoter.d.ts +70 -0
- package/dist/cron/promoter.js +403 -0
- package/dist/index.js +24 -3
- package/dist/lib/usage-monitor.d.ts +47 -0
- package/dist/lib/usage-monitor.js +124 -0
- package/dist/lib/usage-parser.d.ts +72 -0
- package/dist/lib/usage-parser.js +238 -0
- package/dist/restore/RestoreOrchestrator.d.ts +4 -0
- package/dist/restore/RestoreOrchestrator.js +118 -30
- package/package.json +12 -12
- package/templates/cursor-hooks/after-agent-response.sh +0 -0
- package/templates/cursor-hooks/before-submit-prompt.sh +0 -0
- package/templates/cursor-hooks/stop.sh +0 -0
- package/templates/ekkos-manifest.json +2 -2
- package/templates/hooks/assistant-response.sh +0 -0
- package/templates/hooks/session-start.sh +0 -0
- package/templates/plan-template.md +0 -0
- package/templates/spec-template.md +0 -0
- package/templates/agents/README.md +0 -182
- package/templates/agents/code-reviewer.md +0 -166
- package/templates/agents/debug-detective.md +0 -169
- package/templates/agents/ekkOS_Vercel.md +0 -99
- package/templates/agents/extension-manager.md +0 -229
- package/templates/agents/git-companion.md +0 -185
- package/templates/agents/github-test-agent.md +0 -321
- package/templates/agents/railway-manager.md +0 -215
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSONL Sliding Window - Maximize Context for New Work
|
|
3
|
+
*
|
|
4
|
+
* Progressive eviction - always stay lean:
|
|
5
|
+
* - 60%+: trim junk (streaming chunks only)
|
|
6
|
+
* - 65%+: trim metadata (snapshots, system) + truncate tool_results
|
|
7
|
+
* - 70%+: trim tools (results, calls)
|
|
8
|
+
* - 80%+: emergency dump to 50%
|
|
9
|
+
*
|
|
10
|
+
* THINKING BLOCKS: Preserved (priority 6) - contain valuable reasoning
|
|
11
|
+
* Safety: Last 50 lines are NEVER evicted (recent work protection)
|
|
12
|
+
*
|
|
13
|
+
* PROXY MODE (EKKOS_PROXY_MODE=1):
|
|
14
|
+
* When API proxy is enabled, eviction happens at the API level before
|
|
15
|
+
* requests reach Anthropic. In this mode, JSONL rewriter only does
|
|
16
|
+
* junk cleanup (continuousClean) - no threshold-based eviction.
|
|
17
|
+
* This prevents duplicate eviction from two sources.
|
|
18
|
+
*/
|
|
19
|
+
import { type HandshakeEvictionResult } from './eviction-client.js';
|
|
20
|
+
interface HandshakeEvictionContext {
|
|
21
|
+
sessionId: string;
|
|
22
|
+
sessionName: string;
|
|
23
|
+
userId?: string;
|
|
24
|
+
tenantId?: string;
|
|
25
|
+
projectPath?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Result of the eviction flow (sync or async)
|
|
29
|
+
*/
|
|
30
|
+
export interface EvictionResult {
|
|
31
|
+
success: boolean;
|
|
32
|
+
evicted: number;
|
|
33
|
+
truncated: number;
|
|
34
|
+
newPercent: number;
|
|
35
|
+
handshakeUsed?: boolean;
|
|
36
|
+
evictionId?: string;
|
|
37
|
+
error?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Evict messages using the Handshake Protocol (two-phase commit)
|
|
41
|
+
*
|
|
42
|
+
* CRITICAL: Returns success ONLY after R2 confirms backup.
|
|
43
|
+
* Caller must NOT delete locally until this returns success=true.
|
|
44
|
+
*
|
|
45
|
+
* @returns result with clientNonce for confirm phase, or error
|
|
46
|
+
*/
|
|
47
|
+
export declare function evictWithHandshake(lines: string[], indices: number[], context: HandshakeEvictionContext): Promise<HandshakeEvictionResult>;
|
|
48
|
+
/**
|
|
49
|
+
* Complete the handshake by confirming local deletion
|
|
50
|
+
* Call this AFTER successfully deleting from local JSONL
|
|
51
|
+
*/
|
|
52
|
+
export declare function confirmLocalEviction(evictionId: string, clientNonce: string, deletedCount: number): Promise<boolean>;
|
|
53
|
+
/**
|
|
54
|
+
* Check if handshake eviction is available (proxy reachable)
|
|
55
|
+
*/
|
|
56
|
+
export declare function isHandshakeEvictionAvailable(): Promise<boolean>;
|
|
57
|
+
export declare function evictToTarget(filePath: string, currentPercent: number, sessionId?: string, sessionName?: string): {
|
|
58
|
+
success: boolean;
|
|
59
|
+
evicted: number;
|
|
60
|
+
truncated: number;
|
|
61
|
+
newPercent: number;
|
|
62
|
+
};
|
|
63
|
+
export declare function needsEviction(percent: number): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Async eviction with proper two-phase commit handshake.
|
|
66
|
+
* Use this instead of evictToTarget when async context is available.
|
|
67
|
+
*
|
|
68
|
+
* @returns Promise<EvictionResult>
|
|
69
|
+
*/
|
|
70
|
+
export declare function evictToTargetAsync(filePath: string, currentPercent: number, sessionId?: string, sessionName?: string): Promise<EvictionResult>;
|
|
71
|
+
/**
|
|
72
|
+
* Continuous clean - run every turn, remove junk regardless of threshold
|
|
73
|
+
* Removes: thinking blocks, streaming chunks, old file-history-snapshots
|
|
74
|
+
*/
|
|
75
|
+
export declare function continuousClean(filePath: string): {
|
|
76
|
+
cleaned: number;
|
|
77
|
+
};
|
|
78
|
+
export declare function emergencyEvict(filePath: string): {
|
|
79
|
+
success: boolean;
|
|
80
|
+
evicted: number;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Get eviction stats
|
|
84
|
+
*/
|
|
85
|
+
export declare function getEvictionStats(): {
|
|
86
|
+
entries: number;
|
|
87
|
+
lastEviction?: string;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Get evicted content for retrieval (used by ccDNA)
|
|
91
|
+
*/
|
|
92
|
+
export declare function getEvictedContent(limit?: number): Array<{
|
|
93
|
+
timestamp: string;
|
|
94
|
+
content: string[];
|
|
95
|
+
}>;
|
|
96
|
+
export {};
|