@phren/cli 0.0.57 → 0.0.58
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/dist/capabilities/cli.d.ts +2 -0
- package/dist/capabilities/index.d.ts +7 -0
- package/dist/capabilities/mcp.d.ts +2 -0
- package/dist/capabilities/types.d.ts +12 -0
- package/dist/capabilities/vscode.d.ts +2 -0
- package/dist/capabilities/web-ui.d.ts +2 -0
- package/dist/cli/actions.d.ts +16 -0
- package/dist/cli/cli.d.ts +3 -0
- package/dist/cli/config.d.ts +24 -0
- package/dist/cli/extract.d.ts +22 -0
- package/dist/cli/govern.d.ts +11 -0
- package/dist/cli/graph.d.ts +15 -0
- package/dist/cli/hooks-citations.d.ts +8 -0
- package/dist/cli/hooks-context.d.ts +34 -0
- package/dist/cli/hooks-globs.d.ts +2 -0
- package/dist/cli/hooks-output.d.ts +2 -0
- package/dist/cli/hooks-session.d.ts +38 -0
- package/dist/cli/hooks.d.ts +12 -0
- package/dist/cli/namespaces.d.ts +11 -0
- package/dist/cli/ops.d.ts +5 -0
- package/dist/cli/search.d.ts +38 -0
- package/dist/cli/team.d.ts +1 -0
- package/dist/cli-hooks-git.d.ts +35 -0
- package/dist/cli-hooks-prompt.d.ts +18 -0
- package/dist/cli-hooks-session-handlers.d.ts +3 -0
- package/dist/cli-hooks-stop.d.ts +11 -0
- package/dist/content/archive.d.ts +13 -0
- package/dist/content/citation.d.ts +50 -0
- package/dist/content/dedup.d.ts +55 -0
- package/dist/content/learning.d.ts +29 -0
- package/dist/content/metadata.d.ts +107 -0
- package/dist/content/validate.d.ts +70 -0
- package/dist/core/finding.d.ts +25 -0
- package/dist/core/project.d.ts +16 -0
- package/dist/core/search.d.ts +13 -0
- package/dist/data/access.d.ts +83 -0
- package/dist/data/tasks.d.ts +89 -0
- package/dist/embedding.d.ts +54 -0
- package/dist/entrypoint.d.ts +1 -0
- package/dist/finding/context.d.ts +8 -0
- package/dist/finding/impact.d.ts +11 -0
- package/dist/finding/journal.d.ts +40 -0
- package/dist/finding/lifecycle.d.ts +40 -0
- package/dist/governance/audit.d.ts +1 -0
- package/dist/governance/locks.d.ts +3 -0
- package/dist/governance/policy.d.ts +109 -0
- package/dist/governance/rbac.d.ts +25 -0
- package/dist/governance/scores.d.ts +12 -0
- package/dist/hooks.d.ts +59 -0
- package/dist/index-query.d.ts +33 -0
- package/dist/index.d.ts +2 -0
- package/dist/init/config.d.ts +43 -0
- package/dist/init/init-configure.d.ts +21 -0
- package/dist/init/init-hooks-mode.d.ts +1 -0
- package/dist/init/init-mcp-mode.d.ts +1 -0
- package/dist/init/init-uninstall.d.ts +3 -0
- package/dist/init/init-walkthrough.d.ts +61 -0
- package/dist/init/init.d.ts +84 -0
- package/dist/init/preferences.d.ts +28 -0
- package/dist/init/setup.d.ts +86 -0
- package/dist/init/shared.d.ts +13 -0
- package/dist/init-bootstrap.d.ts +5 -0
- package/dist/init-detect.d.ts +8 -0
- package/dist/init-env.d.ts +6 -0
- package/dist/init-fresh.d.ts +10 -0
- package/dist/init-hooks.d.ts +5 -0
- package/dist/init-mcp.d.ts +8 -0
- package/dist/init-modes.d.ts +4 -0
- package/dist/init-npm.d.ts +10 -0
- package/dist/init-project-local.d.ts +2 -0
- package/dist/init-semantic.d.ts +4 -0
- package/dist/init-types.d.ts +59 -0
- package/dist/init-uninstall.d.ts +3 -0
- package/dist/init-update.d.ts +10 -0
- package/dist/init-walkthrough.d.ts +55 -0
- package/dist/link/checksums.d.ts +8 -0
- package/dist/link/context.d.ts +7 -0
- package/dist/link/doctor.d.ts +2 -0
- package/dist/link/link.d.ts +29 -0
- package/dist/link/skills.d.ts +47 -0
- package/dist/logger.d.ts +9 -0
- package/dist/machine-identity.d.ts +4 -0
- package/dist/package-metadata.d.ts +4 -0
- package/dist/phren-art.d.ts +26 -0
- package/dist/phren-core.d.ts +64 -0
- package/dist/phren-dotenv.d.ts +2 -0
- package/dist/phren-paths.d.ts +60 -0
- package/dist/proactivity.d.ts +13 -0
- package/dist/profile-store.d.ts +34 -0
- package/dist/project-config.d.ts +60 -0
- package/dist/project-locator.d.ts +1 -0
- package/dist/project-topics.d.ts +122 -0
- package/dist/provider-adapters.d.ts +34 -0
- package/dist/query-correlation.d.ts +31 -0
- package/dist/runtime-profile.d.ts +6 -0
- package/dist/session/checkpoints.d.ts +25 -0
- package/dist/session/utils.d.ts +43 -0
- package/dist/shared/content.d.ts +7 -0
- package/dist/shared/data-utils.d.ts +8 -0
- package/dist/shared/embedding-cache.d.ts +30 -0
- package/dist/shared/fragment-graph.d.ts +60 -0
- package/dist/shared/governance.d.ts +4 -0
- package/dist/shared/index.d.ts +29 -0
- package/dist/shared/ollama.d.ts +28 -0
- package/dist/shared/process.d.ts +17 -0
- package/dist/shared/retrieval.d.ts +84 -0
- package/dist/shared/search-fallback.d.ts +23 -0
- package/dist/shared/sqljs.d.ts +5 -0
- package/dist/shared/stemmer.d.ts +5 -0
- package/dist/shared/vector-index.d.ts +18 -0
- package/dist/shared.d.ts +9 -0
- package/dist/shell/entry.d.ts +26 -0
- package/dist/shell/input.d.ts +57 -0
- package/dist/shell/palette.d.ts +13 -0
- package/dist/shell/render-api.d.ts +29 -0
- package/dist/shell/render.d.ts +50 -0
- package/dist/shell/shell.d.ts +61 -0
- package/dist/shell/state-store.d.ts +14 -0
- package/dist/shell/types.d.ts +29 -0
- package/dist/shell/view-list.d.ts +5 -0
- package/dist/shell/view.d.ts +34 -0
- package/dist/skill/files.d.ts +5 -0
- package/dist/skill/registry.d.ts +55 -0
- package/dist/skill/state.d.ts +3 -0
- package/dist/startup-embedding.d.ts +15 -0
- package/dist/status.d.ts +1 -0
- package/dist/store-registry.d.ts +60 -0
- package/dist/store-routing.d.ts +37 -0
- package/dist/task/github.d.ts +22 -0
- package/dist/task/hygiene.d.ts +13 -0
- package/dist/task/lifecycle.d.ts +26 -0
- package/dist/telemetry.d.ts +10 -0
- package/dist/test-global-setup.d.ts +14 -0
- package/dist/tool-registry.d.ts +14 -0
- package/dist/tools/config.d.ts +3 -0
- package/dist/tools/data.d.ts +3 -0
- package/dist/tools/extract-facts.d.ts +17 -0
- package/dist/tools/extract.d.ts +3 -0
- package/dist/tools/finding.d.ts +3 -0
- package/dist/tools/graph.d.ts +3 -0
- package/dist/tools/hooks.d.ts +3 -0
- package/dist/tools/memory.d.ts +3 -0
- package/dist/tools/ops.d.ts +3 -0
- package/dist/tools/search.d.ts +8 -0
- package/dist/tools/session.d.ts +44 -0
- package/dist/tools/skills.d.ts +3 -0
- package/dist/tools/tasks.d.ts +3 -0
- package/dist/tools/types.d.ts +50 -0
- package/dist/ui/assets.d.ts +2 -0
- package/dist/ui/data.d.ts +113 -0
- package/dist/ui/graph.d.ts +1 -0
- package/dist/ui/memory-ui.d.ts +4 -0
- package/dist/ui/page.d.ts +2 -0
- package/dist/ui/scripts.d.ts +17 -0
- package/dist/ui/server.d.ts +17 -0
- package/dist/ui/styles.d.ts +4 -0
- package/dist/update.d.ts +9 -0
- package/dist/utils-fts.d.ts +12 -0
- package/dist/utils-fts.js +450 -0
- package/dist/utils-helpers.d.ts +12 -0
- package/dist/utils-helpers.js +80 -0
- package/dist/utils-paths.d.ts +3 -0
- package/dist/utils-paths.js +61 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +8 -587
- package/package.json +45 -11
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
export interface ProjectTopic {
|
|
2
|
+
slug: string;
|
|
3
|
+
label: string;
|
|
4
|
+
description: string;
|
|
5
|
+
keywords: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface BuiltinTopic {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
keywords: string[];
|
|
11
|
+
}
|
|
12
|
+
export type ProjectTopicSource = "default" | "custom";
|
|
13
|
+
export interface ProjectTopicDocInfo {
|
|
14
|
+
slug: string;
|
|
15
|
+
label: string;
|
|
16
|
+
file: string;
|
|
17
|
+
path: string;
|
|
18
|
+
exists: boolean;
|
|
19
|
+
autoManaged: boolean;
|
|
20
|
+
entryCount: number;
|
|
21
|
+
lastModified: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ProjectReferenceDocInfo {
|
|
24
|
+
file: string;
|
|
25
|
+
path: string;
|
|
26
|
+
title: string;
|
|
27
|
+
autoManaged: boolean;
|
|
28
|
+
entryCount: number;
|
|
29
|
+
lastModified: string;
|
|
30
|
+
}
|
|
31
|
+
export interface LegacyTopicDocInfo extends ProjectReferenceDocInfo {
|
|
32
|
+
slug: string;
|
|
33
|
+
eligible: boolean;
|
|
34
|
+
reason?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface ProjectTopicSuggestion {
|
|
37
|
+
slug: string;
|
|
38
|
+
label: string;
|
|
39
|
+
description: string;
|
|
40
|
+
keywords: string[];
|
|
41
|
+
source: "builtin" | "heuristic" | "pinned";
|
|
42
|
+
reason: string;
|
|
43
|
+
confidence: number;
|
|
44
|
+
}
|
|
45
|
+
export interface ProjectTopicsResponse {
|
|
46
|
+
source: ProjectTopicSource;
|
|
47
|
+
topics: ProjectTopic[];
|
|
48
|
+
suggestions: ProjectTopicSuggestion[];
|
|
49
|
+
pinnedTopics: ProjectTopic[];
|
|
50
|
+
legacyDocs: LegacyTopicDocInfo[];
|
|
51
|
+
topicDocs: ProjectTopicDocInfo[];
|
|
52
|
+
}
|
|
53
|
+
export interface ReferenceListResponse {
|
|
54
|
+
topicDocs: ProjectTopicDocInfo[];
|
|
55
|
+
otherDocs: ProjectReferenceDocInfo[];
|
|
56
|
+
}
|
|
57
|
+
export interface ReclassifyTopicsResult {
|
|
58
|
+
movedFiles: number;
|
|
59
|
+
movedEntries: number;
|
|
60
|
+
skipped: Array<{
|
|
61
|
+
file: string;
|
|
62
|
+
reason: string;
|
|
63
|
+
}>;
|
|
64
|
+
}
|
|
65
|
+
declare const DOMAIN_TOPICS: Record<string, ProjectTopic[]>;
|
|
66
|
+
export declare function topicReferencePath(phrenPath: string, project: string, slug: string): string | null;
|
|
67
|
+
export declare function normalizeBuiltinTopicDomain(domain?: string): keyof typeof DOMAIN_TOPICS;
|
|
68
|
+
export declare function getBuiltinTopicConfig(domain?: string): BuiltinTopic[];
|
|
69
|
+
export declare function getBuiltinTopics(phrenPath?: string, project?: string): ProjectTopic[];
|
|
70
|
+
export declare function readProjectTopics(phrenPath: string, project: string): {
|
|
71
|
+
source: ProjectTopicSource;
|
|
72
|
+
topics: ProjectTopic[];
|
|
73
|
+
domain?: string;
|
|
74
|
+
};
|
|
75
|
+
export declare function pinProjectTopicSuggestion(phrenPath: string, project: string, topic: ProjectTopic): {
|
|
76
|
+
ok: true;
|
|
77
|
+
pinnedTopics: ProjectTopic[];
|
|
78
|
+
} | {
|
|
79
|
+
ok: false;
|
|
80
|
+
error: string;
|
|
81
|
+
};
|
|
82
|
+
export declare function unpinProjectTopicSuggestion(phrenPath: string, project: string, slug: string): {
|
|
83
|
+
ok: true;
|
|
84
|
+
pinnedTopics: ProjectTopic[];
|
|
85
|
+
} | {
|
|
86
|
+
ok: false;
|
|
87
|
+
error: string;
|
|
88
|
+
};
|
|
89
|
+
export declare function writeProjectTopics(phrenPath: string, project: string, topics: ProjectTopic[]): {
|
|
90
|
+
ok: true;
|
|
91
|
+
topics: ProjectTopic[];
|
|
92
|
+
} | {
|
|
93
|
+
ok: false;
|
|
94
|
+
error: string;
|
|
95
|
+
};
|
|
96
|
+
export declare function classifyTopicForText(text: string, topics: ProjectTopic[]): ProjectTopic;
|
|
97
|
+
export declare function appendArchivedEntriesToTopicDoc(filePath: string, project: string, topic: ProjectTopic, entries: Array<{
|
|
98
|
+
date: string;
|
|
99
|
+
bullet: string;
|
|
100
|
+
citation?: string;
|
|
101
|
+
}>): void;
|
|
102
|
+
export declare function ensureTopicReferenceDoc(phrenPath: string, project: string, topic: ProjectTopic): {
|
|
103
|
+
ok: true;
|
|
104
|
+
path: string;
|
|
105
|
+
} | {
|
|
106
|
+
ok: false;
|
|
107
|
+
error: string;
|
|
108
|
+
};
|
|
109
|
+
export declare function listProjectReferenceDocs(phrenPath: string, project: string, topics?: ProjectTopic[]): ReferenceListResponse;
|
|
110
|
+
export declare function suggestTopics(phrenPath: string, project: string, topics?: ProjectTopic[]): ProjectTopicSuggestion[];
|
|
111
|
+
/** @internal Exported for tests. */
|
|
112
|
+
export declare const suggestProjectTopics: typeof suggestTopics;
|
|
113
|
+
export declare function getProjectTopicsResponse(phrenPath: string, project: string): ProjectTopicsResponse;
|
|
114
|
+
export declare function readReferenceContent(phrenPath: string, project: string, file: string): {
|
|
115
|
+
ok: true;
|
|
116
|
+
content: string;
|
|
117
|
+
} | {
|
|
118
|
+
ok: false;
|
|
119
|
+
error: string;
|
|
120
|
+
};
|
|
121
|
+
export declare function reclassifyLegacyTopicDocs(phrenPath: string, project: string): ReclassifyTopicsResult;
|
|
122
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type HookToolName = "claude" | "copilot" | "cursor" | "codex";
|
|
2
|
+
export declare const HOOK_TOOL_NAMES: readonly ["claude", "copilot", "cursor", "codex"];
|
|
3
|
+
export type McpRootKey = "mcpServers" | "servers";
|
|
4
|
+
type CommandExistsFn = (cmd: string) => boolean;
|
|
5
|
+
export declare function hookConfigPath(tool: HookToolName, phrenPath?: string | undefined): string;
|
|
6
|
+
export declare function hookConfigPaths(phrenPath: string): Record<HookToolName, string>;
|
|
7
|
+
export declare function hookConfigRoots(phrenPath: string): string[];
|
|
8
|
+
export declare function vscodeMcpCandidates(env?: NodeJS.ProcessEnv): string[];
|
|
9
|
+
export declare function probeVsCodeConfig(commandExists: CommandExistsFn, env?: NodeJS.ProcessEnv): {
|
|
10
|
+
targetDir: string | null;
|
|
11
|
+
installed: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare function cursorMcpCandidates(env?: NodeJS.ProcessEnv): string[];
|
|
14
|
+
export declare function resolveCursorMcpConfig(commandExists: CommandExistsFn, env?: NodeJS.ProcessEnv): {
|
|
15
|
+
installed: boolean;
|
|
16
|
+
existing: string | null;
|
|
17
|
+
target: string;
|
|
18
|
+
};
|
|
19
|
+
export declare function copilotMcpCandidates(env?: NodeJS.ProcessEnv): string[];
|
|
20
|
+
export declare function resolveCopilotMcpConfig(commandExists: CommandExistsFn, env?: NodeJS.ProcessEnv): {
|
|
21
|
+
installed: boolean;
|
|
22
|
+
existing: string | null;
|
|
23
|
+
cliConfig: string;
|
|
24
|
+
hasCliDir: boolean;
|
|
25
|
+
};
|
|
26
|
+
export declare function codexJsonCandidates(phrenPath: string, env?: NodeJS.ProcessEnv): string[];
|
|
27
|
+
export declare function resolveCodexMcpConfig(phrenPath: string, commandExists: CommandExistsFn, env?: NodeJS.ProcessEnv): {
|
|
28
|
+
installed: boolean;
|
|
29
|
+
tomlPath: string;
|
|
30
|
+
existingJson: string | null;
|
|
31
|
+
preferToml: boolean;
|
|
32
|
+
jsonCandidates: string[];
|
|
33
|
+
};
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { SelectedSnippet } from "./shared/retrieval.js";
|
|
2
|
+
export interface CorrelationEntry {
|
|
3
|
+
timestamp: string;
|
|
4
|
+
keywords: string;
|
|
5
|
+
project: string;
|
|
6
|
+
filename: string;
|
|
7
|
+
sessionId?: string;
|
|
8
|
+
helpful?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Check if query correlation feature is enabled via env var.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isQueryCorrelationEnabled(): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Log query-to-finding correlations after snippet selection.
|
|
16
|
+
* Called from handleHookPrompt after selectSnippets.
|
|
17
|
+
*/
|
|
18
|
+
export declare function logCorrelations(phrenPath: string, keywords: string, selected: SelectedSnippet[], sessionId?: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* Mark correlations from a session as "helpful" when positive feedback is received.
|
|
21
|
+
* This retroactively stamps entries so that future correlation lookups weight them higher.
|
|
22
|
+
*/
|
|
23
|
+
export declare function markCorrelationsHelpful(phrenPath: string, sessionId: string, docKey: string): void;
|
|
24
|
+
/**
|
|
25
|
+
* Find documents that historically correlate with the given query keywords.
|
|
26
|
+
* Returns doc keys (project/filename) sorted by correlation strength.
|
|
27
|
+
*
|
|
28
|
+
* Only looks at the last RECENT_WINDOW entries for performance.
|
|
29
|
+
* Entries marked "helpful" get a 2x weight boost.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getCorrelatedDocs(phrenPath: string, keywords: string, limit?: number): string[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the effective runtime profile for user-facing entrypoints.
|
|
3
|
+
* Explicit env selection is strict. Implicit selection is best-effort via
|
|
4
|
+
* machines.yaml / profiles and falls back to an unscoped view during early setup.
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolveRuntimeProfile(phrenPath: string, requestedProfile?: string | undefined): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface TaskCheckpoint {
|
|
2
|
+
project: string;
|
|
3
|
+
taskId: string;
|
|
4
|
+
taskText?: string;
|
|
5
|
+
taskLine: string;
|
|
6
|
+
sessionId?: string;
|
|
7
|
+
createdAt: string;
|
|
8
|
+
resumptionHint: {
|
|
9
|
+
lastAttempt: string;
|
|
10
|
+
nextStep: string;
|
|
11
|
+
};
|
|
12
|
+
gitStatus: string;
|
|
13
|
+
editedFiles: string[];
|
|
14
|
+
failingTests: string[];
|
|
15
|
+
}
|
|
16
|
+
export declare function checkpointPath(phrenPath: string, project: string, taskId: string): string;
|
|
17
|
+
export declare function writeTaskCheckpoint(phrenPath: string, checkpoint: TaskCheckpoint): void;
|
|
18
|
+
export declare function listTaskCheckpoints(phrenPath: string, project?: string): TaskCheckpoint[];
|
|
19
|
+
export declare function clearTaskCheckpoint(phrenPath: string, args: {
|
|
20
|
+
project: string;
|
|
21
|
+
taskId?: string;
|
|
22
|
+
stableId?: string;
|
|
23
|
+
positionalId?: string;
|
|
24
|
+
taskLine?: string;
|
|
25
|
+
}): number;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Write JSON to a file atomically using temp-file + rename.
|
|
3
|
+
* Ensures the parent directory exists before writing.
|
|
4
|
+
*/
|
|
5
|
+
export declare function atomicWriteJson(filePath: string, data: unknown): void;
|
|
6
|
+
export interface SessionState {
|
|
7
|
+
sessionId: string;
|
|
8
|
+
project?: string;
|
|
9
|
+
agentScope?: string;
|
|
10
|
+
startedAt: string;
|
|
11
|
+
endedAt?: string;
|
|
12
|
+
summary?: string;
|
|
13
|
+
findingsAdded: number;
|
|
14
|
+
tasksCompleted: number;
|
|
15
|
+
/** When true, this session was created by a lifecycle hook, not an explicit MCP call. */
|
|
16
|
+
hookCreated?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function sessionsDir(phrenPath: string): string;
|
|
19
|
+
export declare function sessionFileForId(phrenPath: string, sessionId: string): string;
|
|
20
|
+
export declare function readSessionStateFile(file: string): SessionState | null;
|
|
21
|
+
export declare function writeSessionStateFile(file: string, state: SessionState): void;
|
|
22
|
+
/**
|
|
23
|
+
* Log an error to stderr when PHREN_DEBUG is enabled.
|
|
24
|
+
* Centralises the repeated `if (PHREN_DEBUG) stderr.write(...)` pattern.
|
|
25
|
+
*/
|
|
26
|
+
export declare function debugError(scope: string, err: unknown): void;
|
|
27
|
+
interface SessionFileEntry<T> {
|
|
28
|
+
fullPath: string;
|
|
29
|
+
data: T;
|
|
30
|
+
mtimeMs: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Enumerate all `session-*.json` files under `dir`, parse each one via `parse`,
|
|
34
|
+
* and keep entries where `filter` returns true.
|
|
35
|
+
*
|
|
36
|
+
* Returns an array of `{ fullPath, data, mtimeMs }` sorted newest-mtime-first.
|
|
37
|
+
* `includeMtime` controls whether `fs.statSync` is called (some callers don't need it).
|
|
38
|
+
*/
|
|
39
|
+
export declare function scanSessionFiles<T>(dir: string, parse: (filePath: string) => T | null, filter: (data: T, fullPath: string) => boolean, opts?: {
|
|
40
|
+
includeMtime?: boolean;
|
|
41
|
+
errorScope?: string;
|
|
42
|
+
}): SessionFileEntry<T>[];
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { type ConsolidationNeeded, type ConsolidationStatus, checkConsolidationNeeded, validateFindingsFormat, stripTaskDoneSection, validateTaskFormat, extractConflictVersions, mergeFindings, mergeTask, autoMergeConflicts, } from "../content/validate.js";
|
|
2
|
+
export { filterTrustedFindings, filterTrustedFindingsDetailed, } from "../content/citation.js";
|
|
3
|
+
export { scanForSecrets, resolveCoref, isDuplicateFinding, detectConflicts, extractDynamicEntities, checkSemanticDedup, checkSemanticConflicts, } from "../content/dedup.js";
|
|
4
|
+
export { countActiveFindings, autoArchiveToReference, } from "../content/archive.js";
|
|
5
|
+
export { upsertCanonical, addFindingToFile, addFindingsToFile, autoDetectFindingType, type AddFindingResult, } from "../content/learning.js";
|
|
6
|
+
export { FINDING_LIFECYCLE_STATUSES, FINDING_TYPE_DECAY, extractFindingType, parseFindingLifecycle, buildLifecycleComments, isInactiveFindingLine, type FindingLifecycleStatus, type FindingLifecycleMetadata, } from "../finding/lifecycle.js";
|
|
7
|
+
export { METADATA_REGEX, parseStatus, parseStatusField, parseSupersession, parseSupersedesRef, parseContradiction, parseAllContradictions, parseFindingId, parseCreatedDate, isCitationLine, isArchiveStart, isArchiveEnd, stripLifecycleMetadata, stripRelationMetadata, stripAllMetadata, stripComments, addMetadata, } from "../content/metadata.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type PhrenResult } from "../shared.js";
|
|
2
|
+
export declare function withSafeLock<T>(filePath: string, fn: () => PhrenResult<T>): PhrenResult<T>;
|
|
3
|
+
/**
|
|
4
|
+
* Recursively walk a directory and return paths of files matching an optional filter.
|
|
5
|
+
* Defaults to `.md` files only. Uses an iterative stack to avoid recursion limits.
|
|
6
|
+
*/
|
|
7
|
+
export declare function walkDirectory(root: string, filter?: (name: string) => boolean): string[];
|
|
8
|
+
export declare function ensureProject(phrenPath: string, project: string): PhrenResult<string>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface EmbeddingCoverage {
|
|
2
|
+
total: number;
|
|
3
|
+
embedded: number;
|
|
4
|
+
missing: number;
|
|
5
|
+
pct: number;
|
|
6
|
+
missingPct: number;
|
|
7
|
+
state: "empty" | "cold" | "warming" | "warm";
|
|
8
|
+
}
|
|
9
|
+
export declare class EmbeddingCache {
|
|
10
|
+
private phrenPath;
|
|
11
|
+
private cache;
|
|
12
|
+
private dirty;
|
|
13
|
+
private dirtyUpserts;
|
|
14
|
+
private dirtyDeletes;
|
|
15
|
+
constructor(phrenPath: string);
|
|
16
|
+
load(): Promise<void>;
|
|
17
|
+
get(docPath: string, model: string): number[] | null;
|
|
18
|
+
set(docPath: string, model: string, vec: number[]): void;
|
|
19
|
+
delete(docPath: string): void;
|
|
20
|
+
flush(): Promise<void>;
|
|
21
|
+
getAllEntries(): Array<{
|
|
22
|
+
path: string;
|
|
23
|
+
vec: number[];
|
|
24
|
+
model: string;
|
|
25
|
+
}>;
|
|
26
|
+
size(): number;
|
|
27
|
+
coverage(allPaths: string[]): EmbeddingCoverage;
|
|
28
|
+
}
|
|
29
|
+
export declare function formatEmbeddingCoverage(coverage: EmbeddingCoverage): string;
|
|
30
|
+
export declare function getEmbeddingCache(phrenPath: string): EmbeddingCache;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { SqlJsDatabase } from "./index.js";
|
|
2
|
+
/** @internal Exported for tests. */
|
|
3
|
+
export declare function escapeRegex(s: string): string;
|
|
4
|
+
/** Escape SQL LIKE wildcard characters so user input is treated literally.
|
|
5
|
+
* @internal Exported for tests. */
|
|
6
|
+
export declare function escapeLike(s: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Log fragment resolution misses to .runtime/fragment-misses.jsonl.
|
|
9
|
+
*
|
|
10
|
+
* Judgment criteria — what's worth capturing vs noise:
|
|
11
|
+
* - Worth capturing: repeated lookups for the same fragment name (indicates a gap
|
|
12
|
+
* in the fragment graph that the user keeps hitting), fragment names that look like
|
|
13
|
+
* real library/tool names (not random query fragments).
|
|
14
|
+
* - Noise: single one-off lookups for short generic terms, lookups that fail
|
|
15
|
+
* because the query was malformed. We filter these by requiring name.length > 2.
|
|
16
|
+
*
|
|
17
|
+
* Gated by PHREN_DEBUG (or PHREN_DEBUG for compat) to avoid disk writes for
|
|
18
|
+
* regular users. The miss log is append-only JSONL so downstream tooling can
|
|
19
|
+
* detect repeated patterns (e.g. "fragment X was looked up 5 times but never
|
|
20
|
+
* found" -> suggest adding it).
|
|
21
|
+
*/
|
|
22
|
+
export declare function logFragmentMiss(phrenPath: string, name: string, context: string, project?: string): void;
|
|
23
|
+
/**
|
|
24
|
+
* Lightweight synchronous fragment extraction from text — regex only, no DB writes.
|
|
25
|
+
* Used by add_finding to surface detected fragments in the MCP response without
|
|
26
|
+
* requiring a DB reference in the write path. Full DB linking happens on the next
|
|
27
|
+
* index rebuild, which is triggered automatically after every add_finding call via
|
|
28
|
+
* updateFileInIndex -> extractAndLinkFragments.
|
|
29
|
+
*/
|
|
30
|
+
export declare function extractFragmentNames(content: string): string[];
|
|
31
|
+
/**
|
|
32
|
+
* Ensure the global_entities cross-project index table exists.
|
|
33
|
+
* Called during buildIndex to enable cross-project fragment queries.
|
|
34
|
+
*/
|
|
35
|
+
export declare function ensureGlobalEntitiesTable(db: SqlJsDatabase): void;
|
|
36
|
+
/**
|
|
37
|
+
* Prime CLAUDE.md fragments per project for a single build pass.
|
|
38
|
+
* During an active build, extractAndLinkFragments resolves user fragments from this
|
|
39
|
+
* in-memory map and avoids per-file sync stat/read calls.
|
|
40
|
+
*/
|
|
41
|
+
export declare function beginUserFragmentBuildCache(phrenPath: string, projects: Iterable<string>): void;
|
|
42
|
+
/** End a build-scoped cache created by beginUserFragmentBuildCache(). */
|
|
43
|
+
export declare function endUserFragmentBuildCache(phrenPath: string): void;
|
|
44
|
+
export declare function extractAndLinkFragments(db: SqlJsDatabase, content: string, sourceDoc: string, phrenPath?: string): void;
|
|
45
|
+
/**
|
|
46
|
+
* Query related fragments for a given name.
|
|
47
|
+
*/
|
|
48
|
+
export declare function queryFragmentLinks(db: SqlJsDatabase, name: string): {
|
|
49
|
+
related: string[];
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Query cross-project fragment relationships.
|
|
53
|
+
* Returns projects and docs that share fragments with the given query.
|
|
54
|
+
*/
|
|
55
|
+
export declare function queryCrossProjectFragments(db: SqlJsDatabase, fragmentName: string, excludeProject?: string): Array<{
|
|
56
|
+
fragment: string;
|
|
57
|
+
project: string;
|
|
58
|
+
docKey: string;
|
|
59
|
+
}>;
|
|
60
|
+
export declare function getFragmentBoostDocs(db: SqlJsDatabase, query: string): Set<string>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type SqlJsDatabase } from "../index-query.js";
|
|
2
|
+
export { porterStem } from "./stemmer.js";
|
|
3
|
+
export { cosineFallback } from "./search-fallback.js";
|
|
4
|
+
export { queryFragmentLinks, getFragmentBoostDocs, ensureGlobalEntitiesTable, queryCrossProjectFragments, logFragmentMiss, extractFragmentNames, } from "./fragment-graph.js";
|
|
5
|
+
export { buildSourceDocKey, decodeFiniteNumber, decodeStringRow, extractSnippet, getDocSourceKey, normalizeMemoryId, queryDocBySourceKey, queryDocRows, queryRows, rowToDoc, rowToDocWithRowid, } from "../index-query.js";
|
|
6
|
+
export type { SqlValue, DbRow, DocRow, SqlJsDatabase } from "../index-query.js";
|
|
7
|
+
export declare function classifyFile(filename: string, relPath: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Resolve `@import shared/file.md` directives in document content.
|
|
10
|
+
* The import path is resolved relative to the phren root (e.g. `shared/foo.md` -> `~/.phren/global/shared/foo.md`).
|
|
11
|
+
* Circular imports are detected and skipped. Depth is capped to prevent runaway recursion.
|
|
12
|
+
*/
|
|
13
|
+
/** @internal Exported for tests. */
|
|
14
|
+
export declare function resolveImports(content: string, phrenPath: string): string;
|
|
15
|
+
export declare function listIndexedDocumentPaths(phrenPath: string, profile?: string): string[];
|
|
16
|
+
export declare function normalizeIndexedContent(content: string, type: string, phrenPath: string, maxChars?: number): string;
|
|
17
|
+
/**
|
|
18
|
+
* Incrementally update a single file in the FTS index.
|
|
19
|
+
* Deletes the old record for the file, re-reads and re-inserts it.
|
|
20
|
+
* Touches the sentinel file to invalidate caches.
|
|
21
|
+
*/
|
|
22
|
+
export declare function updateFileInIndex(db: SqlJsDatabase, filePath: string, phrenPath: string): void;
|
|
23
|
+
export declare function buildIndex(phrenPath: string, profile?: string): Promise<SqlJsDatabase>;
|
|
24
|
+
/** Find the FTS cache file for a specific phrenPath+profile. Returns exists + size. */
|
|
25
|
+
export declare function findFtsCacheForPath(phrenPath: string, profile?: string): {
|
|
26
|
+
exists: boolean;
|
|
27
|
+
sizeBytes?: number;
|
|
28
|
+
};
|
|
29
|
+
export declare function detectProject(phrenPath: string, cwd: string, profile?: string): string | null;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** @internal Exported for tests. */
|
|
2
|
+
export declare function prepareEmbeddingInput(text: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* Cloud embedding API support (Item 6).
|
|
5
|
+
* Set PHREN_EMBEDDING_API_URL to an OpenAI-compatible /embeddings endpoint.
|
|
6
|
+
* Set PHREN_EMBEDDING_API_KEY for the Authorization: Bearer header.
|
|
7
|
+
* When set, cloud embedding takes priority over Ollama.
|
|
8
|
+
*
|
|
9
|
+
* Example (OpenAI):
|
|
10
|
+
* PHREN_EMBEDDING_API_URL=https://api.openai.com/v1
|
|
11
|
+
* PHREN_EMBEDDING_API_KEY=sk-...
|
|
12
|
+
* PHREN_EMBEDDING_MODEL=text-embedding-3-small
|
|
13
|
+
*/
|
|
14
|
+
export declare function getCloudEmbeddingUrl(): string | null;
|
|
15
|
+
export declare function getOllamaUrl(): string | null;
|
|
16
|
+
export declare function getEmbeddingModel(): string;
|
|
17
|
+
export declare function getExtractModel(): string;
|
|
18
|
+
export declare function checkOllamaAvailable(url?: string): Promise<boolean>;
|
|
19
|
+
export declare function checkModelAvailable(model?: string, url?: string): Promise<boolean>;
|
|
20
|
+
export declare function embedText(text: string, model?: string, url?: string): Promise<number[] | null>;
|
|
21
|
+
export declare function generateText(prompt: string, model?: string, url?: string): Promise<string | null>;
|
|
22
|
+
export type OllamaStatus = "ready" | "no_model" | "not_running" | "disabled";
|
|
23
|
+
/**
|
|
24
|
+
* Probe Ollama availability and model readiness in one call.
|
|
25
|
+
* Returns a status enum so callers can branch on it without repeating the check logic.
|
|
26
|
+
*/
|
|
27
|
+
export declare function checkOllamaStatus(): Promise<OllamaStatus>;
|
|
28
|
+
export { cosineSimilarity } from "../embedding.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared process helpers for spawning detached child processes.
|
|
3
|
+
*/
|
|
4
|
+
import { type ChildProcess } from "child_process";
|
|
5
|
+
export interface SpawnDetachedChildOptions {
|
|
6
|
+
phrenPath: string;
|
|
7
|
+
logFd?: number;
|
|
8
|
+
cwd?: string;
|
|
9
|
+
extraEnv?: Record<string, string>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Spawn a detached child process with the standard phren environment.
|
|
13
|
+
* When logFd is provided, stdout/stderr are redirected to that fd.
|
|
14
|
+
* When omitted, all stdio is ignored.
|
|
15
|
+
* Returns the ChildProcess so callers can attach `.unref()` or `.on("exit", ...)`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function spawnDetachedChild(args: string[], opts: SpawnDetachedChildOptions): ChildProcess;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { type RetentionPolicy } from "./governance.js";
|
|
2
|
+
import { type DocRow, type SqlJsDatabase } from "./index.js";
|
|
3
|
+
import type { GitContext } from "../cli/hooks-session.js";
|
|
4
|
+
export type { GitContext } from "../cli/hooks-session.js";
|
|
5
|
+
export declare function detectTaskIntent(prompt: string): "debug" | "review" | "build" | "docs" | "skill" | "general";
|
|
6
|
+
export declare function fileRelevanceBoost(filePath: string, changedFiles: Set<string>): number;
|
|
7
|
+
export declare function branchMatchBoost(content: string, branch: string | undefined): number;
|
|
8
|
+
/**
|
|
9
|
+
* Item 4: Reciprocal Rank Fusion — merges ranked result lists from multiple search tiers.
|
|
10
|
+
* Documents appearing in multiple tiers get a higher combined score.
|
|
11
|
+
* Formula: score(d) = Σ 1/(k + rank_i) for each tier i containing d, where k=60 (standard).
|
|
12
|
+
*/
|
|
13
|
+
/** @internal Exported for tests. */
|
|
14
|
+
export declare function rrfMerge(tiers: DocRow[][], k?: number): DocRow[];
|
|
15
|
+
/** @internal Exported for tests. */
|
|
16
|
+
export declare function shouldRunVectorExpansion(rows: DocRow[] | null, prompt: string, desiredResults?: number): boolean;
|
|
17
|
+
declare function approximateTokens(text: string): number;
|
|
18
|
+
export declare function filterTaskByPriority(items: string[], allowedPriorities?: string[]): string[];
|
|
19
|
+
export declare function searchDocuments(db: SqlJsDatabase, safeQuery: string, prompt: string, keywords: string, detectedProject: string | null, searchAllProjects?: boolean, phrenPath?: string): DocRow[] | null;
|
|
20
|
+
/**
|
|
21
|
+
* Async variant of searchDocuments that also runs real vector search (Tier 3)
|
|
22
|
+
* when cloud embeddings (PHREN_EMBEDDING_API_URL) or Ollama are available.
|
|
23
|
+
* Falls back to the sync result if vector search is unavailable or fails.
|
|
24
|
+
*/
|
|
25
|
+
export declare function searchDocumentsAsync(db: SqlJsDatabase, safeQuery: string, prompt: string, keywords: string, detectedProject: string | null, searchAllProjects?: boolean, phrenPath?: string): Promise<DocRow[] | null>;
|
|
26
|
+
export interface SearchKnowledgeRowsOptions {
|
|
27
|
+
query: string;
|
|
28
|
+
maxResults: number;
|
|
29
|
+
fetchLimit?: number;
|
|
30
|
+
filterProject?: string | null;
|
|
31
|
+
filterType?: string | null;
|
|
32
|
+
phrenPath: string;
|
|
33
|
+
}
|
|
34
|
+
export interface SearchKnowledgeRowsResult {
|
|
35
|
+
safeQuery: string;
|
|
36
|
+
rows: DocRow[] | null;
|
|
37
|
+
usedFallback: boolean;
|
|
38
|
+
}
|
|
39
|
+
export declare function searchKnowledgeRows(db: SqlJsDatabase, options: SearchKnowledgeRowsOptions): Promise<SearchKnowledgeRowsResult>;
|
|
40
|
+
export interface FederatedDocRow extends DocRow {
|
|
41
|
+
/** The phren store path this result came from (undefined = local store). */
|
|
42
|
+
federationSource?: string;
|
|
43
|
+
/** Human-readable store name from the registry. */
|
|
44
|
+
storeName?: string;
|
|
45
|
+
/** Immutable store ID from the registry. */
|
|
46
|
+
storeId?: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Search additional phren stores defined in the store registry (or PHREN_FEDERATION_PATHS).
|
|
50
|
+
* Returns an array of results tagged with their source store. Read-only — no mutations.
|
|
51
|
+
*/
|
|
52
|
+
export declare function searchFederatedStores(localPhrenPath: string, options: Omit<SearchKnowledgeRowsOptions, "phrenPath">): Promise<FederatedDocRow[]>;
|
|
53
|
+
export type TrustFilterQueueItem = {
|
|
54
|
+
project: string;
|
|
55
|
+
section: "Stale" | "Conflicts";
|
|
56
|
+
items: string[];
|
|
57
|
+
};
|
|
58
|
+
export type TrustFilterResult = {
|
|
59
|
+
rows: DocRow[];
|
|
60
|
+
queueItems: TrustFilterQueueItem[];
|
|
61
|
+
auditEntries: string[];
|
|
62
|
+
};
|
|
63
|
+
/** Apply trust filter to rows. Returns filtered rows plus any queue/audit items to be written
|
|
64
|
+
* by the caller — retrieval itself should remain side-effect-free. */
|
|
65
|
+
export declare function applyTrustFilter(rows: DocRow[], ttlDays: number, minConfidence: number, decay: Partial<RetentionPolicy["decay"]>, phrenPath?: string): TrustFilterResult;
|
|
66
|
+
/** Item 3: Recency boost for findings. Recent findings rank higher. Accepts pre-computed date string. */
|
|
67
|
+
export declare function recencyBoost(docType: string, latestDate: string): number;
|
|
68
|
+
export declare function rankResults(rows: DocRow[], intent: string, gitCtx: GitContext | null, detectedProject: string | null, phrenPathLocal: string, db: SqlJsDatabase, cwd?: string, query?: string, opts?: {
|
|
69
|
+
filterType?: string | null;
|
|
70
|
+
skipTaskFilter?: boolean;
|
|
71
|
+
}): DocRow[];
|
|
72
|
+
export interface SelectedSnippet {
|
|
73
|
+
doc: DocRow;
|
|
74
|
+
snippet: string;
|
|
75
|
+
key: string;
|
|
76
|
+
}
|
|
77
|
+
/** Mark snippet lines with stale citations (cited file missing or line content changed).
|
|
78
|
+
* @internal Exported for tests. */
|
|
79
|
+
export declare function markStaleCitations(snippet: string): string;
|
|
80
|
+
export declare function selectSnippets(rows: DocRow[], keywords: string, tokenBudget: number, lineBudget: number, charBudget: number): {
|
|
81
|
+
selected: SelectedSnippet[];
|
|
82
|
+
usedTokens: number;
|
|
83
|
+
};
|
|
84
|
+
export { approximateTokens };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { SqlJsDatabase, DocRow } from "./index.js";
|
|
2
|
+
/** @internal Exported for tests. */
|
|
3
|
+
export declare function deriveVectorDocIdentity(phrenPath: string, fullPath: string): {
|
|
4
|
+
project: string;
|
|
5
|
+
filename: string;
|
|
6
|
+
relFile: string;
|
|
7
|
+
};
|
|
8
|
+
/** Invalidate the DF cache. Call after a full index rebuild. */
|
|
9
|
+
export declare function invalidateDfCache(): void;
|
|
10
|
+
export declare function deterministicSeed(text: string): number;
|
|
11
|
+
/**
|
|
12
|
+
* Cosine fallback search: when FTS5 returns fewer than COSINE_FALLBACK_THRESHOLD results,
|
|
13
|
+
* load all docs and rank by TF-IDF cosine similarity.
|
|
14
|
+
* Only activated when PHREN_FEATURE_HYBRID_SEARCH=1 and corpus size <= COSINE_MAX_CORPUS.
|
|
15
|
+
* Returns DocRow[] ranked by similarity (threshold > COSINE_SIMILARITY_MIN), excluding already-found rowids.
|
|
16
|
+
*/
|
|
17
|
+
export declare function cosineFallback(db: SqlJsDatabase, query: string, excludeRowids: Set<number>, limit: number): DocRow[];
|
|
18
|
+
/**
|
|
19
|
+
* Vector-based semantic search fallback using pre-computed Ollama embeddings.
|
|
20
|
+
* Only runs when Ollama is configured (PHREN_OLLAMA_URL is set or defaults).
|
|
21
|
+
* Returns DocRow[] sorted by cosine similarity, above 0.5 threshold.
|
|
22
|
+
*/
|
|
23
|
+
export declare function vectorFallback(phrenPath: string, query: string, excludePaths: Set<string>, limit: number, project?: string | null): Promise<DocRow[]>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface EmbeddingEntryLike {
|
|
2
|
+
path: string;
|
|
3
|
+
model: string;
|
|
4
|
+
vec: number[];
|
|
5
|
+
}
|
|
6
|
+
declare class PersistentVectorIndex {
|
|
7
|
+
private phrenPath;
|
|
8
|
+
private loaded;
|
|
9
|
+
private source;
|
|
10
|
+
private models;
|
|
11
|
+
constructor(phrenPath: string);
|
|
12
|
+
private loadFromDisk;
|
|
13
|
+
private saveToDisk;
|
|
14
|
+
ensure(entries: EmbeddingEntryLike[]): void;
|
|
15
|
+
query(model: string, queryVec: number[], limit: number, eligiblePaths?: Set<string>): string[];
|
|
16
|
+
}
|
|
17
|
+
export declare function getPersistentVectorIndex(phrenPath: string): PersistentVectorIndex;
|
|
18
|
+
export {};
|
package/dist/shared.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type { HookToolName } from "./provider-adapters.js";
|
|
2
|
+
export { HOOK_TOOL_NAMES, hookConfigPath } from "./provider-adapters.js";
|
|
3
|
+
export { EXEC_TIMEOUT_MS, EXEC_TIMEOUT_QUICK_MS, PhrenError, type PhrenErrorCode, type PhrenResult, phrenOk, phrenErr, forwardErr, parsePhrenErrorCode, isRecord, withDefaults, FINDING_TYPES, type FindingType, FINDING_TAGS, type FindingTag, KNOWN_OBSERVATION_TAGS, DOC_TYPES, type DocType, capCache, RESERVED_PROJECT_DIR_NAMES, } from "./phren-core.js";
|
|
4
|
+
export { ROOT_MANIFEST_FILENAME, type InstallMode, type SyncMode, type PhrenRootManifest, type InstallContext, homeDir, homePath, expandHomePath, defaultPhrenPath, rootManifestPath, readRootManifest, writeRootManifest, resolveInstallContext, findNearestPhrenPath, isProjectLocalMode, runtimeDir, tryUnlink, sessionsDir, runtimeFile, installPreferencesFile, runtimeHealthFile, shellStateFile, sessionMetricsFile, memoryScoresFile, memoryUsageLogFile, sessionMarker, debugLog, appendIndexEvent, resolveFindingsPath, findPhrenPath, ensurePhrenPath, findPhrenPathWithArg, normalizeProjectNameForCreate, findProjectNameCaseInsensitive, findArchivedProjectNameCaseInsensitive, getProjectDirs, collectNativeMemoryFiles, computePhrenLiveStateToken, getPhrenPath, qualityMarkers, atomicWriteText, } from "./phren-paths.js";
|
|
5
|
+
export { PROACTIVITY_LEVELS, type ProactivityLevel, getProactivityLevel, getProactivityLevelForFindings, getProactivityLevelForTask, hasExplicitFindingSignal, hasExplicitTaskSignal, hasExecutionIntent, hasDiscoveryIntent, shouldAutoCaptureFindingsForLevel, shouldAutoCaptureTaskForLevel, } from "./proactivity.js";
|
|
6
|
+
export declare function normalizeMemoryScope(scope?: string | null): string | undefined;
|
|
7
|
+
export declare function isMemoryScopeVisible(itemScope: string | undefined, activeScope?: string): boolean;
|
|
8
|
+
export declare function impactLogFile(phrenPath: string): string;
|
|
9
|
+
export declare function appendAuditLog(phrenPath: string, event: string, details: string): void;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shell entry point: wires PhrenShell to stdin/stdout.
|
|
3
|
+
* Extracted from shell.ts to keep the orchestrator under 300 lines.
|
|
4
|
+
*/
|
|
5
|
+
interface LiveStateHost {
|
|
6
|
+
invalidateSubsectionsCache(): void;
|
|
7
|
+
setMessage(message: string): void;
|
|
8
|
+
}
|
|
9
|
+
interface StartupIntroPlan {
|
|
10
|
+
mode: "always" | "once-per-version" | "off";
|
|
11
|
+
variant: "full" | "final-frame" | "skip";
|
|
12
|
+
holdForKeypress: boolean;
|
|
13
|
+
dwellMs: number;
|
|
14
|
+
markSeen: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function resolveStartupIntroPlan(phrenPath: string, version?: string): StartupIntroPlan;
|
|
17
|
+
export declare function startLiveStatePoller({ phrenPath, shell, repaint, isExiting, intervalMs, computeToken, }: {
|
|
18
|
+
phrenPath: string;
|
|
19
|
+
shell: LiveStateHost;
|
|
20
|
+
repaint: () => Promise<void>;
|
|
21
|
+
isExiting?: () => boolean;
|
|
22
|
+
intervalMs?: number;
|
|
23
|
+
computeToken?: (phrenPath: string) => string;
|
|
24
|
+
}): () => void;
|
|
25
|
+
export declare function startShell(phrenPath: string, profile: string): Promise<void>;
|
|
26
|
+
export {};
|