praana 0.5.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/LICENSE +21 -0
- package/README.md +124 -0
- package/bin/praana.js +17 -0
- package/bin/pran.js +17 -0
- package/dist/app-banner.d.ts +11 -0
- package/dist/app-banner.js +161 -0
- package/dist/app-controller.d.ts +44 -0
- package/dist/app-controller.js +143 -0
- package/dist/app-identity.d.ts +18 -0
- package/dist/app-identity.js +52 -0
- package/dist/auto-compact.d.ts +16 -0
- package/dist/auto-compact.js +101 -0
- package/dist/cli-args.d.ts +14 -0
- package/dist/cli-args.js +69 -0
- package/dist/compile-classic.d.ts +21 -0
- package/dist/compile-classic.js +106 -0
- package/dist/compiler.d.ts +75 -0
- package/dist/compiler.js +406 -0
- package/dist/config.d.ts +3 -0
- package/dist/config.js +433 -0
- package/dist/context-engine/activity-log.d.ts +9 -0
- package/dist/context-engine/activity-log.js +109 -0
- package/dist/context-engine/artifact-store.d.ts +32 -0
- package/dist/context-engine/artifact-store.js +272 -0
- package/dist/context-engine/bm25.d.ts +3 -0
- package/dist/context-engine/bm25.js +32 -0
- package/dist/context-engine/checkpoint.d.ts +34 -0
- package/dist/context-engine/checkpoint.js +430 -0
- package/dist/context-engine/classify.d.ts +3 -0
- package/dist/context-engine/classify.js +60 -0
- package/dist/context-engine/db.d.ts +73 -0
- package/dist/context-engine/db.js +505 -0
- package/dist/context-engine/distiller.d.ts +30 -0
- package/dist/context-engine/distiller.js +67 -0
- package/dist/context-engine/engine-compiler.d.ts +23 -0
- package/dist/context-engine/engine-compiler.js +297 -0
- package/dist/context-engine/error-tracker.d.ts +21 -0
- package/dist/context-engine/error-tracker.js +74 -0
- package/dist/context-engine/event-lineage.d.ts +26 -0
- package/dist/context-engine/event-lineage.js +120 -0
- package/dist/context-engine/extraction.d.ts +26 -0
- package/dist/context-engine/extraction.js +83 -0
- package/dist/context-engine/index.d.ts +82 -0
- package/dist/context-engine/index.js +238 -0
- package/dist/context-engine/scoring.d.ts +13 -0
- package/dist/context-engine/scoring.js +47 -0
- package/dist/context-engine/state-snapshot.d.ts +8 -0
- package/dist/context-engine/state-snapshot.js +50 -0
- package/dist/context-engine/summarize.d.ts +6 -0
- package/dist/context-engine/summarize.js +32 -0
- package/dist/context-engine/telemetry.d.ts +25 -0
- package/dist/context-engine/telemetry.js +64 -0
- package/dist/context-engine/turn-digest.d.ts +50 -0
- package/dist/context-engine/turn-digest.js +250 -0
- package/dist/context-engine/turn-ledger.d.ts +18 -0
- package/dist/context-engine/turn-ledger.js +184 -0
- package/dist/context-engine/turn-recorder.d.ts +24 -0
- package/dist/context-engine/turn-recorder.js +88 -0
- package/dist/context-engine/types.d.ts +201 -0
- package/dist/context-engine/types.js +4 -0
- package/dist/context-pressure.d.ts +19 -0
- package/dist/context-pressure.js +36 -0
- package/dist/distillers/generic.d.ts +14 -0
- package/dist/distillers/generic.js +93 -0
- package/dist/distillers/git-diff.d.ts +8 -0
- package/dist/distillers/git-diff.js +119 -0
- package/dist/distillers/index.d.ts +2 -0
- package/dist/distillers/index.js +16 -0
- package/dist/distillers/npm-test.d.ts +8 -0
- package/dist/distillers/npm-test.js +50 -0
- package/dist/distillers/rg-results.d.ts +8 -0
- package/dist/distillers/rg-results.js +28 -0
- package/dist/distillers/tsc-errors.d.ts +8 -0
- package/dist/distillers/tsc-errors.js +52 -0
- package/dist/event-log.d.ts +56 -0
- package/dist/event-log.js +214 -0
- package/dist/llm.d.ts +29 -0
- package/dist/llm.js +155 -0
- package/dist/logger.d.ts +94 -0
- package/dist/logger.js +287 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +54 -0
- package/dist/memory/confidence.d.ts +7 -0
- package/dist/memory/confidence.js +37 -0
- package/dist/memory/consolidation.d.ts +26 -0
- package/dist/memory/consolidation.js +166 -0
- package/dist/memory/db.d.ts +40 -0
- package/dist/memory/db.js +283 -0
- package/dist/memory/dedup.d.ts +6 -0
- package/dist/memory/dedup.js +50 -0
- package/dist/memory/embedder-factory.d.ts +3 -0
- package/dist/memory/embedder-factory.js +81 -0
- package/dist/memory/embeddings.d.ts +15 -0
- package/dist/memory/embeddings.js +67 -0
- package/dist/memory/index.d.ts +9 -0
- package/dist/memory/index.js +11 -0
- package/dist/memory/ollama-summarizer.d.ts +19 -0
- package/dist/memory/ollama-summarizer.js +72 -0
- package/dist/memory/openai-summarizer.d.ts +21 -0
- package/dist/memory/openai-summarizer.js +51 -0
- package/dist/memory/store.d.ts +61 -0
- package/dist/memory/store.js +502 -0
- package/dist/memory/summarizer-factory.d.ts +3 -0
- package/dist/memory/summarizer-factory.js +69 -0
- package/dist/memory/summarizer.d.ts +4 -0
- package/dist/memory/summarizer.js +112 -0
- package/dist/memory/types.d.ts +87 -0
- package/dist/memory/types.js +17 -0
- package/dist/model-context.d.ts +15 -0
- package/dist/model-context.js +212 -0
- package/dist/project-detector.d.ts +37 -0
- package/dist/project-detector.js +604 -0
- package/dist/render.d.ts +15 -0
- package/dist/render.js +46 -0
- package/dist/session.d.ts +118 -0
- package/dist/session.js +809 -0
- package/dist/skills/index.d.ts +69 -0
- package/dist/skills/index.js +885 -0
- package/dist/skills/types.d.ts +93 -0
- package/dist/skills/types.js +8 -0
- package/dist/slash-commands.d.ts +14 -0
- package/dist/slash-commands.js +301 -0
- package/dist/state-graph.d.ts +38 -0
- package/dist/state-graph.js +255 -0
- package/dist/status-bar.d.ts +54 -0
- package/dist/status-bar.js +184 -0
- package/dist/thinking-display.d.ts +21 -0
- package/dist/thinking-display.js +37 -0
- package/dist/tool-summary.d.ts +4 -0
- package/dist/tool-summary.js +67 -0
- package/dist/tools/index.d.ts +925 -0
- package/dist/tools/index.js +86 -0
- package/dist/tools/knowledge.d.ts +140 -0
- package/dist/tools/knowledge.js +260 -0
- package/dist/tools/memory.d.ts +39 -0
- package/dist/tools/memory.js +300 -0
- package/dist/tools/search-code.d.ts +134 -0
- package/dist/tools/search-code.js +390 -0
- package/dist/tools/system.d.ts +16 -0
- package/dist/tools/system.js +499 -0
- package/dist/tools/tool-def.d.ts +6 -0
- package/dist/tools/tool-def.js +3 -0
- package/dist/turn-control.d.ts +51 -0
- package/dist/turn-control.js +210 -0
- package/dist/turn.d.ts +20 -0
- package/dist/turn.js +624 -0
- package/dist/types.d.ts +233 -0
- package/dist/types.js +4 -0
- package/dist/ui/readline-ui.d.ts +2 -0
- package/dist/ui/readline-ui.js +176 -0
- package/dist/ui/tui/app.d.ts +13 -0
- package/dist/ui/tui/app.js +270 -0
- package/dist/ui/tui/busy-indicator.d.ts +2 -0
- package/dist/ui/tui/busy-indicator.js +13 -0
- package/dist/ui/tui/components/gutter-rule.d.ts +5 -0
- package/dist/ui/tui/components/gutter-rule.js +9 -0
- package/dist/ui/tui/components/inline-tool-row.d.ts +10 -0
- package/dist/ui/tui/components/inline-tool-row.js +8 -0
- package/dist/ui/tui/components/prompt-input.d.ts +20 -0
- package/dist/ui/tui/components/prompt-input.js +120 -0
- package/dist/ui/tui/components/system-line.d.ts +5 -0
- package/dist/ui/tui/components/system-line.js +6 -0
- package/dist/ui/tui/components/thinking-block.d.ts +11 -0
- package/dist/ui/tui/components/thinking-block.js +31 -0
- package/dist/ui/tui/components/toast-line.d.ts +4 -0
- package/dist/ui/tui/components/toast-line.js +8 -0
- package/dist/ui/tui/components/tool-result-line.d.ts +5 -0
- package/dist/ui/tui/components/tool-result-line.js +6 -0
- package/dist/ui/tui/components/turn-footer.d.ts +5 -0
- package/dist/ui/tui/components/turn-footer.js +7 -0
- package/dist/ui/tui/components/user-block.d.ts +6 -0
- package/dist/ui/tui/components/user-block.js +6 -0
- package/dist/ui/tui/logo-banner.d.ts +5 -0
- package/dist/ui/tui/logo-banner.js +8 -0
- package/dist/ui/tui/markdown-render.d.ts +16 -0
- package/dist/ui/tui/markdown-render.js +218 -0
- package/dist/ui/tui/palette.d.ts +12 -0
- package/dist/ui/tui/palette.js +13 -0
- package/dist/ui/tui/reasoning-summary.d.ts +12 -0
- package/dist/ui/tui/reasoning-summary.js +27 -0
- package/dist/ui/tui/reducer.d.ts +92 -0
- package/dist/ui/tui/reducer.js +260 -0
- package/dist/ui/tui/run.d.ts +3 -0
- package/dist/ui/tui/run.js +40 -0
- package/dist/ui/tui/sink.d.ts +4 -0
- package/dist/ui/tui/sink.js +89 -0
- package/dist/ui/tui/status-bar-view.d.ts +5 -0
- package/dist/ui/tui/status-bar-view.js +44 -0
- package/dist/ui/tui/terminal-height.d.ts +12 -0
- package/dist/ui/tui/terminal-height.js +20 -0
- package/dist/ui/tui/terminal-width.d.ts +2 -0
- package/dist/ui/tui/terminal-width.js +5 -0
- package/dist/ui/tui/tool-display.d.ts +23 -0
- package/dist/ui/tui/tool-display.js +217 -0
- package/dist/ui/tui/transcript-line.d.ts +12 -0
- package/dist/ui/tui/transcript-line.js +43 -0
- package/dist/ui/tui/transcript-replay.d.ts +12 -0
- package/dist/ui/tui/transcript-replay.js +117 -0
- package/dist/ui-events.d.ts +39 -0
- package/dist/ui-events.js +33 -0
- package/dist/ui.d.ts +77 -0
- package/dist/ui.js +179 -0
- package/package.json +73 -0
- package/praana.config.example.toml +231 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { CompileMetrics } from "./compiler.js";
|
|
2
|
+
import type { PraanaConfig, SkillRecord } from "./types.js";
|
|
3
|
+
import { SkillRuntime } from "./skills/index.js";
|
|
4
|
+
import { EventLog } from "./event-log.js";
|
|
5
|
+
import { StateGraph } from "./state-graph.js";
|
|
6
|
+
import { MemoryStore, type SessionEvent } from "./memory/index.js";
|
|
7
|
+
import { buildProjectContext } from "./project-detector.js";
|
|
8
|
+
import { ContextEngine } from "./context-engine/index.js";
|
|
9
|
+
import type { CompileScoreRecord, PressureMode } from "./context-engine/types.js";
|
|
10
|
+
import { type PraanaLogger } from "./logger.js";
|
|
11
|
+
export declare class Session {
|
|
12
|
+
id: string;
|
|
13
|
+
cwd: string;
|
|
14
|
+
config: PraanaConfig;
|
|
15
|
+
eventLog: EventLog;
|
|
16
|
+
stateGraph: StateGraph;
|
|
17
|
+
memoryStore: MemoryStore | null;
|
|
18
|
+
memoryEnabled: boolean;
|
|
19
|
+
incognito: boolean;
|
|
20
|
+
digest: string | null;
|
|
21
|
+
agentsContext: string | null;
|
|
22
|
+
projectContext: string | null;
|
|
23
|
+
skills: SkillRecord[];
|
|
24
|
+
skillRuntime: SkillRuntime | null;
|
|
25
|
+
contextEngine: ContextEngine | null;
|
|
26
|
+
debug: boolean;
|
|
27
|
+
private ended;
|
|
28
|
+
private readonly startedAt;
|
|
29
|
+
private turnCount;
|
|
30
|
+
private modelOverride;
|
|
31
|
+
private modelContextWindow;
|
|
32
|
+
private modelContextWindowFor;
|
|
33
|
+
private lastCompileMetrics;
|
|
34
|
+
private lastCompileScoreRecords;
|
|
35
|
+
private lastPressureMode;
|
|
36
|
+
private lastPressureRatio;
|
|
37
|
+
private sessionInputTokens;
|
|
38
|
+
private sessionOutputTokens;
|
|
39
|
+
private lastUserInput;
|
|
40
|
+
private compactionArmed;
|
|
41
|
+
private sessionLogger;
|
|
42
|
+
private noticeCapture?;
|
|
43
|
+
private constructor();
|
|
44
|
+
static createNew(id: string, cwd: string, config: PraanaConfig): Session;
|
|
45
|
+
static create(cwd: string, config?: PraanaConfig, opts?: {
|
|
46
|
+
incognito?: boolean;
|
|
47
|
+
captureNotice?: (line: string) => void;
|
|
48
|
+
}): Promise<Session>;
|
|
49
|
+
static resume(sessionId: string, cwd: string, config?: PraanaConfig, opts?: {
|
|
50
|
+
captureNotice?: (line: string) => void;
|
|
51
|
+
}): Promise<Session>;
|
|
52
|
+
isContextEngineEnabled(): boolean;
|
|
53
|
+
getTurnCount(): number;
|
|
54
|
+
incrementTurn(): void;
|
|
55
|
+
clearState(): void;
|
|
56
|
+
getStartedAt(): number;
|
|
57
|
+
getUptimeMs(): number;
|
|
58
|
+
getActiveModelId(): string;
|
|
59
|
+
getLogger(): PraanaLogger;
|
|
60
|
+
initLogger(): Promise<void>;
|
|
61
|
+
getContextWindowTokens(modelId?: string): number;
|
|
62
|
+
refreshModelContextWindow(modelId?: string): Promise<number>;
|
|
63
|
+
ensureModelContextWindow(modelId?: string): Promise<number>;
|
|
64
|
+
setModelOverride(model: string | null): void;
|
|
65
|
+
getModelOverride(): string | null;
|
|
66
|
+
isIncognito(): boolean;
|
|
67
|
+
recordInputTokens(count: number): void;
|
|
68
|
+
recordOutputTokens(count: number): void;
|
|
69
|
+
getInputTokens(): number;
|
|
70
|
+
getOutputTokens(): number;
|
|
71
|
+
setIncognito(enabled: boolean): Promise<void>;
|
|
72
|
+
get promptDir(): string;
|
|
73
|
+
getMemoryDbPath(): string | null;
|
|
74
|
+
getRepoRoot(): string;
|
|
75
|
+
setLastCompileMetrics(metrics: CompileMetrics): void;
|
|
76
|
+
getLastCompileMetrics(): CompileMetrics | null;
|
|
77
|
+
setLastCompileScoreRecords(records: CompileScoreRecord[], pressureMode: PressureMode, pressureRatio: number): void;
|
|
78
|
+
getLastCompileScoreRecords(): CompileScoreRecord[];
|
|
79
|
+
getCompileScoreRecord(unitId: string): CompileScoreRecord | undefined;
|
|
80
|
+
getLastPressureMode(): PressureMode;
|
|
81
|
+
getLastPressureRatio(): number;
|
|
82
|
+
setLastUserInput(input: string): void;
|
|
83
|
+
getLastUserInput(): string;
|
|
84
|
+
isCompactionArmed(): boolean;
|
|
85
|
+
setCompactionArmed(armed: boolean): void;
|
|
86
|
+
getMemoryStats(): {
|
|
87
|
+
total: number;
|
|
88
|
+
active: number;
|
|
89
|
+
soft: number;
|
|
90
|
+
hard: number;
|
|
91
|
+
byKind: Record<string, number>;
|
|
92
|
+
};
|
|
93
|
+
getPersistentMemoryEntryCount(): number | null;
|
|
94
|
+
getSessionSummary(): {
|
|
95
|
+
turns: number;
|
|
96
|
+
stateObjects: number;
|
|
97
|
+
memoriesStored: number;
|
|
98
|
+
};
|
|
99
|
+
/** Build a transcript of user/agent/tool events for the summarizer. */
|
|
100
|
+
getTranscriptEvents(): SessionEvent[];
|
|
101
|
+
end(reason: "clean" | "aborted" | "error", events?: SessionEvent[], opts?: {
|
|
102
|
+
memoryTimeoutMs?: number;
|
|
103
|
+
}): Promise<void>;
|
|
104
|
+
private initMemoryStore;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Load project context from AGENTS.md / CLAUDE.md files.
|
|
108
|
+
*
|
|
109
|
+
* Load order (all non-empty results are merged):
|
|
110
|
+
* 1. ~/.praana/AGENTS.md (or legacy ~/.aria/AGENTS.md) — global personal instructions
|
|
111
|
+
* 2. <git root>/AGENTS.md — project-wide context
|
|
112
|
+
* 3. <cwd>/AGENTS.md — subdirectory context (if cwd ≠ git root)
|
|
113
|
+
* 4. CLAUDE.md fallback — if no AGENTS.md found at project root
|
|
114
|
+
*
|
|
115
|
+
* Combined content is capped at ~4000 tokens (16000 chars).
|
|
116
|
+
*/
|
|
117
|
+
export declare function loadAgentsContext(cwd: string): string | null;
|
|
118
|
+
export { buildProjectContext };
|