@phren/cli 0.1.42 → 0.1.45
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.js +1 -1
- package/dist/capabilities/mcp.js +1 -1
- package/dist/capabilities/vscode.js +3 -3
- package/dist/capabilities/web-ui.js +29 -29
- package/dist/cli/actions.d.ts +1 -1
- package/dist/cli/actions.js +7 -2
- package/dist/cli/config-proactivity.d.ts +6 -6
- package/dist/cli/hooks-output.js +15 -6
- package/dist/cli/hooks.d.ts +1 -1
- package/dist/cli/hooks.js +16 -5
- package/dist/cli/session-stop.d.ts +1 -1
- package/dist/cli/session-tool-hook.d.ts +1 -1
- package/dist/cli-registry.js +1 -1
- package/dist/data/access.js +2 -1
- package/dist/generated/memory-ui-graph.browser.js +481 -318
- package/dist/governance/locks.js +6 -0
- package/dist/governance/scores.d.ts +9 -1
- package/dist/governance/scores.js +12 -1
- package/dist/graph-core/index.d.ts +2 -0
- package/dist/graph-core/index.js +2 -0
- package/dist/graph-core/model.d.ts +84 -0
- package/dist/graph-core/model.js +355 -0
- package/dist/graph-core/types.d.ts +110 -0
- package/dist/graph-core/types.js +43 -0
- package/dist/index.js +4 -1
- package/dist/init/init-uninstall.d.ts +1 -0
- package/dist/init/init-uninstall.js +13 -3
- package/dist/init/setup.js +11 -4
- package/dist/link/context.js +2 -1
- package/dist/link/link.js +3 -2
- package/dist/link/skills.js +2 -1
- package/dist/memory-ui-graph.runtime.js +481 -318
- package/dist/phren-core.d.ts +16 -0
- package/dist/phren-core.js +21 -0
- package/dist/phren-paths.js +8 -4
- package/dist/profile-store.d.ts +2 -0
- package/dist/profile-store.js +16 -19
- package/dist/project-config.js +2 -1
- package/dist/shared/fragment-graph.js +7 -2
- package/dist/shared/index.js +1 -1
- package/dist/shared/retrieval.d.ts +38 -0
- package/dist/shared/retrieval.js +62 -4
- package/dist/shell/entry.d.ts +10 -2
- package/dist/shell/entry.js +128 -97
- package/dist/shell/graph/canvas.d.ts +64 -0
- package/dist/shell/graph/canvas.js +256 -0
- package/dist/shell/graph/controller.d.ts +164 -0
- package/dist/shell/graph/controller.js +645 -0
- package/dist/shell/graph/glyphs.d.ts +12 -0
- package/dist/shell/graph/glyphs.js +31 -0
- package/dist/shell/graph/graph-view.d.ts +12 -0
- package/dist/shell/graph/graph-view.js +408 -0
- package/dist/shell/graph/layout.d.ts +68 -0
- package/dist/shell/graph/layout.js +267 -0
- package/dist/shell/input.d.ts +4 -1
- package/dist/shell/input.js +28 -5
- package/dist/shell/intro.d.ts +37 -0
- package/dist/shell/intro.js +82 -0
- package/dist/shell/keys.d.ts +36 -0
- package/dist/shell/keys.js +107 -0
- package/dist/shell/logo-fx.d.ts +35 -0
- package/dist/shell/logo-fx.js +128 -0
- package/dist/shell/render.d.ts +34 -1
- package/dist/shell/render.js +220 -66
- package/dist/shell/shell.d.ts +13 -1
- package/dist/shell/shell.js +61 -10
- package/dist/shell/startup.d.ts +37 -0
- package/dist/shell/startup.js +105 -0
- package/dist/shell/state-store.d.ts +1 -1
- package/dist/shell/state-store.js +1 -1
- package/dist/shell/types.js +1 -0
- package/dist/shell/view.d.ts +3 -0
- package/dist/shell/view.js +26 -4
- package/dist/store-registry.d.ts +13 -0
- package/dist/store-registry.js +109 -37
- package/dist/test-global-setup.d.ts +1 -0
- package/dist/test-global-setup.js +22 -0
- package/dist/tool-registry.js +1 -0
- package/dist/tools/memory.js +12 -5
- package/dist/tools/ops.js +1 -1
- package/dist/ui/data.d.ts +15 -7
- package/dist/ui/data.js +102 -3
- package/dist/utils-fts.js +2 -1
- package/dist/utils-helpers.d.ts +1 -0
- package/dist/utils-helpers.js +6 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/package.json +38 -7
- package/starter/global/skills/phren-consolidate/SKILL.md +152 -0
- package/starter/global/skills/phren-discover/SKILL.md +175 -0
- package/starter/global/skills/phren-init/SKILL.md +216 -0
- package/starter/global/skills/phren-profiles/SKILL.md +121 -0
- package/starter/global/skills/phren-sync/SKILL.md +261 -0
- package/dist/init-uninstall.d.ts +0 -3
- package/dist/init-uninstall.js +0 -514
- package/dist/init-walkthrough.d.ts +0 -55
- package/dist/init-walkthrough.js +0 -524
package/dist/capabilities/cli.js
CHANGED
package/dist/capabilities/mcp.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const vscodeManifest = {
|
|
2
2
|
surface: "vscode",
|
|
3
|
-
version: "0.1.
|
|
3
|
+
version: "0.1.42",
|
|
4
4
|
actions: {
|
|
5
5
|
// Finding management
|
|
6
6
|
"finding.add": { implemented: true, handler: "extension.ts:phren.addFinding" },
|
|
@@ -24,8 +24,8 @@ export const vscodeManifest = {
|
|
|
24
24
|
"hook.errors": { implemented: false, reason: "Hook errors not exposed in VS Code" },
|
|
25
25
|
// Search
|
|
26
26
|
"search.fts": { implemented: true, handler: "searchQuickPick.ts:showSearchQuickPick" },
|
|
27
|
-
"search.fragment": { implemented:
|
|
28
|
-
"search.related_docs": { implemented:
|
|
27
|
+
"search.fragment": { implemented: false, reason: "search_fragments is never called from the extension (no client method exists)" },
|
|
28
|
+
"search.related_docs": { implemented: false, reason: "get_related_docs is never called from the extension (no client method exists)" },
|
|
29
29
|
"search.history": { implemented: true, handler: "searchQuickPick.ts:searchHistory (in-memory)" },
|
|
30
30
|
// Graph
|
|
31
31
|
"graph.read": { implemented: true, handler: "graphWebview.ts:showGraphWebview" },
|
|
@@ -1,58 +1,58 @@
|
|
|
1
1
|
export const webUiManifest = {
|
|
2
2
|
surface: "web-ui",
|
|
3
|
-
version: "0.1.
|
|
3
|
+
version: "0.1.42",
|
|
4
4
|
actions: {
|
|
5
5
|
// Finding management
|
|
6
|
-
"finding.add": { implemented:
|
|
7
|
-
"finding.remove": { implemented:
|
|
8
|
-
"finding.list": { implemented: true, handler: "
|
|
6
|
+
"finding.add": { implemented: true, handler: "ui/server.ts:POST /api/findings/<project>" },
|
|
7
|
+
"finding.remove": { implemented: true, handler: "ui/server.ts:DELETE /api/findings/<project>" },
|
|
8
|
+
"finding.list": { implemented: true, handler: "ui/server.ts:/api/findings/<project> + /api/project-content" },
|
|
9
9
|
"finding.filter_by_date": { implemented: false, reason: "No date filter in web UI API" },
|
|
10
|
-
"finding.pin": { implemented: false, reason: "
|
|
10
|
+
"finding.pin": { implemented: false, reason: "Pinning to truths.md is CLI/MCP-only" },
|
|
11
11
|
// Task management
|
|
12
|
-
"task.add": { implemented:
|
|
13
|
-
"task.complete": { implemented:
|
|
14
|
-
"task.remove": { implemented:
|
|
15
|
-
"task.update": { implemented:
|
|
16
|
-
"task.list": { implemented: true, handler: "
|
|
17
|
-
"task.pin": { implemented: false, reason: "No task pinning in web UI" },
|
|
18
|
-
"task.github_link": { implemented: false, reason: "
|
|
12
|
+
"task.add": { implemented: true, handler: "ui/server.ts:POST /api/tasks/add" },
|
|
13
|
+
"task.complete": { implemented: true, handler: "ui/server.ts:POST /api/tasks/complete" },
|
|
14
|
+
"task.remove": { implemented: true, handler: "ui/server.ts:POST /api/tasks/remove" },
|
|
15
|
+
"task.update": { implemented: true, handler: "ui/server.ts:POST /api/tasks/update" },
|
|
16
|
+
"task.list": { implemented: true, handler: "ui/server.ts:/api/tasks" },
|
|
17
|
+
"task.pin": { implemented: false, reason: "No task pinning in web UI (pinned flag is displayed read-only)" },
|
|
18
|
+
"task.github_link": { implemented: false, reason: "Issue links display in the task list; creating them is MCP/VS Code-only" },
|
|
19
19
|
// Hook management
|
|
20
|
-
"hook.list": { implemented: true, handler: "
|
|
21
|
-
"hook.toggle": { implemented: true, handler: "
|
|
20
|
+
"hook.list": { implemented: true, handler: "ui/server.ts:/api/hooks" },
|
|
21
|
+
"hook.toggle": { implemented: true, handler: "ui/server.ts:POST /api/hook-toggle" },
|
|
22
22
|
"hook.toggle_per_project": { implemented: false, reason: "Per-project hook toggle not exposed in web UI" },
|
|
23
23
|
"hook.custom_crud": { implemented: false, reason: "Custom hooks CRUD not exposed in web UI" },
|
|
24
24
|
"hook.errors": { implemented: false, reason: "Hook errors not exposed in web UI" },
|
|
25
25
|
// Search
|
|
26
|
-
"search.fts": { implemented: true, handler: "
|
|
26
|
+
"search.fts": { implemented: true, handler: "ui/server.ts:/api/search" },
|
|
27
27
|
"search.fragment": { implemented: false, reason: "No fragment search in web UI" },
|
|
28
28
|
"search.related_docs": { implemented: false, reason: "No related docs in web UI" },
|
|
29
29
|
"search.history": { implemented: false, reason: "No search history in web UI" },
|
|
30
30
|
// Graph
|
|
31
|
-
"graph.read": { implemented: true, handler: "
|
|
32
|
-
"graph.visualize": { implemented: true, handler: "
|
|
31
|
+
"graph.read": { implemented: true, handler: "ui/server.ts:/api/graph" },
|
|
32
|
+
"graph.visualize": { implemented: true, handler: "ui/graph.ts:graph tab (browser/graph bundle — store>project>finding cages, Three.js / 3d-force-graph, CSS2D labels)" },
|
|
33
33
|
"graph.link_findings": { implemented: false, reason: "No link findings action in web UI" },
|
|
34
34
|
// Config
|
|
35
|
-
"config.get": { implemented: true, handler: "
|
|
36
|
-
"config.set": { implemented: true, handler: "
|
|
35
|
+
"config.get": { implemented: true, handler: "ui/server.ts:/api/settings + /api/config" },
|
|
36
|
+
"config.set": { implemented: true, handler: "ui/server.ts:POST /api/settings/* (workflow policy, task mode, proactivity, finding sensitivity, index policy, auto-capture, mcp-enabled, project overrides, RBAC via /api/settings/access)" },
|
|
37
37
|
// Health / Sync / Session
|
|
38
|
-
"health.check": { implemented: true, handler: "
|
|
38
|
+
"health.check": { implemented: true, handler: "ui/server.ts:/api/runtime-health" },
|
|
39
39
|
"health.doctor_fix": { implemented: false, reason: "Doctor --fix is CLI-only" },
|
|
40
|
-
"health.sync": { implemented: true, handler: "
|
|
40
|
+
"health.sync": { implemented: true, handler: "ui/server.ts:POST /api/sync" },
|
|
41
41
|
"session.start": { implemented: false, reason: "Session lifecycle is not web UI driven" },
|
|
42
42
|
"session.end": { implemented: false, reason: "Session lifecycle is not web UI driven" },
|
|
43
43
|
// Skill management
|
|
44
|
-
"skill.list": { implemented: true, handler: "
|
|
45
|
-
"skill.read": { implemented: true, handler: "
|
|
46
|
-
"skill.enable": { implemented: true, handler: "
|
|
47
|
-
"skill.write": { implemented: true, handler: "
|
|
44
|
+
"skill.list": { implemented: true, handler: "ui/server.ts:/api/skills" },
|
|
45
|
+
"skill.read": { implemented: true, handler: "ui/server.ts:/api/skill-content" },
|
|
46
|
+
"skill.enable": { implemented: true, handler: "ui/server.ts:POST /api/skill-toggle" },
|
|
47
|
+
"skill.write": { implemented: true, handler: "ui/server.ts:POST /api/skill-save" },
|
|
48
48
|
// Project management
|
|
49
|
-
"project.list": { implemented: true, handler: "
|
|
49
|
+
"project.list": { implemented: true, handler: "ui/server.ts:/api/projects" },
|
|
50
50
|
"project.manage": { implemented: false, reason: "No archive/unarchive in web UI" },
|
|
51
|
-
"project.summary": { implemented: true, handler: "
|
|
51
|
+
"project.summary": { implemented: true, handler: "ui/server.ts:/api/project-content" },
|
|
52
52
|
"export.project": { implemented: false, reason: "Export/import not exposed in web UI" },
|
|
53
53
|
"import.project": { implemented: false, reason: "Export/import not exposed in web UI" },
|
|
54
54
|
// Profile / Machine
|
|
55
|
-
"profile.switch": { implemented:
|
|
56
|
-
"profile.list": { implemented:
|
|
55
|
+
"profile.switch": { implemented: true, handler: "ui/server.ts:POST /api/profile" },
|
|
56
|
+
"profile.list": { implemented: true, handler: "ui/server.ts:/api/profiles" },
|
|
57
57
|
},
|
|
58
58
|
};
|
package/dist/cli/actions.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare function handleDoctor(args: string[]): Promise<void>;
|
|
|
9
9
|
export declare function handleStatus(): Promise<void>;
|
|
10
10
|
export declare function handleQualityFeedback(args: string[]): Promise<void>;
|
|
11
11
|
export declare function handleMemoryUi(args: string[]): Promise<void>;
|
|
12
|
-
export declare function handleShell(
|
|
12
|
+
export declare function handleShell(args: string[], profile: string): Promise<void>;
|
|
13
13
|
export declare function handleUpdate(args: string[]): Promise<void>;
|
|
14
14
|
export declare function handleReview(args: string[]): Promise<void>;
|
|
15
15
|
export declare function handleConsolidationStatus(args: string[]): Promise<void>;
|
package/dist/cli/actions.js
CHANGED
|
@@ -303,8 +303,13 @@ export async function handleMemoryUi(args) {
|
|
|
303
303
|
allowPortFallback: !portRequested,
|
|
304
304
|
});
|
|
305
305
|
}
|
|
306
|
-
export async function handleShell(
|
|
307
|
-
|
|
306
|
+
export async function handleShell(args, profile) {
|
|
307
|
+
const phrenPath = getPhrenPath();
|
|
308
|
+
const { parseShellArgs, resolveShellStartup } = await import("../shell/startup.js");
|
|
309
|
+
const { startup, warnings } = resolveShellStartup(parseShellArgs(args), { phrenPath, profile });
|
|
310
|
+
if (warnings.length)
|
|
311
|
+
startup.notice = warnings.join(" ");
|
|
312
|
+
await startShell(phrenPath, profile, startup);
|
|
308
313
|
}
|
|
309
314
|
export async function handleUpdate(args) {
|
|
310
315
|
const result = await runPhrenUpdate({ refreshStarter: args.includes("--refresh-starter") });
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export declare function buildProactivitySnapshot(phrenPath: string): {
|
|
2
2
|
path: string;
|
|
3
3
|
configured: {
|
|
4
|
-
proactivity: "high" | "
|
|
5
|
-
proactivityFindings: "high" | "
|
|
6
|
-
proactivityTask: "high" | "
|
|
4
|
+
proactivity: "high" | "low" | "medium" | null;
|
|
5
|
+
proactivityFindings: "high" | "low" | "medium" | null;
|
|
6
|
+
proactivityTask: "high" | "low" | "medium" | null;
|
|
7
7
|
};
|
|
8
8
|
effective: {
|
|
9
|
-
proactivity: "high" | "
|
|
10
|
-
proactivityFindings: "high" | "
|
|
11
|
-
proactivityTask: "high" | "
|
|
9
|
+
proactivity: "high" | "low" | "medium";
|
|
10
|
+
proactivityFindings: "high" | "low" | "medium";
|
|
11
|
+
proactivityTask: "high" | "low" | "medium";
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
14
|
export declare function handleConfigProactivity(subcommand: "proactivity" | "proactivity.findings" | "proactivity.tasks", args: string[]): void;
|
package/dist/cli/hooks-output.js
CHANGED
|
@@ -3,7 +3,7 @@ import { getDocSourceKey, } from "../shared/index.js";
|
|
|
3
3
|
import { logImpact, extractFindingIdsFromSnippet, } from "../finding/impact.js";
|
|
4
4
|
import { isFeatureEnabled, errorMessage } from "../utils.js";
|
|
5
5
|
import { annotateStale } from "./hooks-citations.js";
|
|
6
|
-
import { approximateTokens, fileRelevanceBoost, branchMatchBoost } from "../shared/retrieval.js";
|
|
6
|
+
import { approximateTokens, fileRelevanceBoost, branchMatchBoost, SNIPPET_OVERHEAD_TOKENS } from "../shared/retrieval.js";
|
|
7
7
|
import { logger } from "../logger.js";
|
|
8
8
|
// ── Progressive disclosure helpers ────────────────────────────────────────────
|
|
9
9
|
function buildOneLiner(snippet) {
|
|
@@ -17,10 +17,13 @@ function buildOneLiner(snippet) {
|
|
|
17
17
|
}
|
|
18
18
|
function buildCompactIndex(selected, phrenPathLocal) {
|
|
19
19
|
const lines = [];
|
|
20
|
-
for (const { doc, snippet } of selected) {
|
|
20
|
+
for (const { doc, snippet, key } of selected) {
|
|
21
21
|
const id = `mem:${getDocSourceKey(doc, phrenPathLocal)}`;
|
|
22
22
|
const summary = buildOneLiner(snippet);
|
|
23
|
-
|
|
23
|
+
// The fb: key rides here too. memory_feedback's description promises it
|
|
24
|
+
// appears in injected headers without qualification, and this path renders
|
|
25
|
+
// instead of the full one whenever progressive disclosure is enabled.
|
|
26
|
+
lines.push(`[${id}] fb:${key} ${doc.type}: ${summary}`);
|
|
24
27
|
}
|
|
25
28
|
return lines;
|
|
26
29
|
}
|
|
@@ -78,14 +81,15 @@ export function buildHookOutput(selected, usedTokens, intent, gitCtx, detectedPr
|
|
|
78
81
|
let totalTokens = 36; // base overhead
|
|
79
82
|
const keep = ordered.map(() => true);
|
|
80
83
|
for (let i = 0; i < ordered.length; i++) {
|
|
81
|
-
|
|
84
|
+
// 24 ≈ header line ([source key] (type) fb:key) + blank separator.
|
|
85
|
+
totalTokens += approximateTokens(ordered[i].snippet) + SNIPPET_OVERHEAD_TOKENS;
|
|
82
86
|
}
|
|
83
87
|
// Trim from the middle (indices 1..N-2) if over budget
|
|
84
88
|
if (totalTokens > tokenBudget) {
|
|
85
89
|
for (let i = ordered.length - 2; i >= 1; i--) {
|
|
86
90
|
if (totalTokens <= tokenBudget)
|
|
87
91
|
break;
|
|
88
|
-
totalTokens -= approximateTokens(ordered[i].snippet) +
|
|
92
|
+
totalTokens -= approximateTokens(ordered[i].snippet) + SNIPPET_OVERHEAD_TOKENS;
|
|
89
93
|
keep[i] = false;
|
|
90
94
|
}
|
|
91
95
|
ordered = ordered.filter((_, i) => keep[i]);
|
|
@@ -109,7 +113,12 @@ export function buildHookOutput(selected, usedTokens, intent, gitCtx, detectedPr
|
|
|
109
113
|
catch (err) {
|
|
110
114
|
logger.debug("hooks-output", `injectContext recordRetrievalOrdered: ${errorMessage(err)}`);
|
|
111
115
|
}
|
|
112
|
-
|
|
116
|
+
// `fb:` is the memory_feedback handle. The tool scores entryScoreKey
|
|
117
|
+
// (project/filename:digest) — NOT the mem: source key and NOT an fid —
|
|
118
|
+
// and this header was the only place the injection pipeline had the
|
|
119
|
+
// key in hand; before it was printed here, the feedback loop was
|
|
120
|
+
// built, wired into ranking, and unreachable.
|
|
121
|
+
parts.push(`[${getDocSourceKey(doc, phrenPathLocal)}] (${doc.type}) fb:${key}`);
|
|
113
122
|
parts.push(annotateStale(snippet));
|
|
114
123
|
parts.push("");
|
|
115
124
|
}
|
package/dist/cli/hooks.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { parseCitations, validateCitation, annotateStale, clearCitationValidCache, type ParsedCitation, } from "./hooks-citations.js";
|
|
2
2
|
export { getProjectGlobBoost, clearProjectGlobCache, } from "./hooks-globs.js";
|
|
3
|
-
export { detectTaskIntent, filterTaskByPriority, searchDocuments, applyTrustFilter, rankResults, selectSnippets, type SelectedSnippet, } from "../shared/retrieval.js";
|
|
3
|
+
export { detectTaskIntent, filterTaskByPriority, searchDocuments, applyTrustFilter, rankResults, applyRelevanceFloor, DEFAULT_MIN_QUERY_RELEVANCE, selectSnippets, type SelectedSnippet, } from "../shared/retrieval.js";
|
|
4
4
|
export { buildHookOutput, } from "./hooks-output.js";
|
|
5
5
|
export { handleHookSessionStart, handleHookStop, handleBackgroundSync, handleHookContext, handleHookTool, trackSessionMetrics, filterConversationInsightsForProactivity, extractToolFindings, filterToolFindingsForProactivity, resolveSubprocessArgs, } from "./hooks-session.js";
|
|
6
6
|
export interface HookPromptInput {
|
package/dist/cli/hooks.js
CHANGED
|
@@ -9,7 +9,7 @@ import { mergeConfig, } from "../shared/governance.js";
|
|
|
9
9
|
import { loadIndexForHook, detectProject, } from "../shared/index.js";
|
|
10
10
|
import { isProjectHookEnabled } from "../project-config.js";
|
|
11
11
|
import { checkConsolidationNeeded, } from "../shared/content.js";
|
|
12
|
-
import { buildRobustFtsQuery, extractKeywordEntries, isFeatureEnabled, clampInt, errorMessage, } from "../utils.js";
|
|
12
|
+
import { buildRobustFtsQuery, extractKeywordEntries, isFeatureEnabled, clampInt, clampFloat, errorMessage, } from "../utils.js";
|
|
13
13
|
import { getHooksEnabledPreference } from "../init/init.js";
|
|
14
14
|
import { logger } from "../logger.js";
|
|
15
15
|
import { isToolHookEnabled, runPrePromptHooks } from "../hooks.js";
|
|
@@ -25,16 +25,16 @@ export { parseCitations, validateCitation, annotateStale, clearCitationValidCach
|
|
|
25
25
|
// Globs
|
|
26
26
|
export { getProjectGlobBoost, clearProjectGlobCache, } from "./hooks-globs.js";
|
|
27
27
|
// Retrieval
|
|
28
|
-
export { detectTaskIntent, filterTaskByPriority, searchDocuments, applyTrustFilter, rankResults, selectSnippets, } from "../shared/retrieval.js";
|
|
28
|
+
export { detectTaskIntent, filterTaskByPriority, searchDocuments, applyTrustFilter, rankResults, applyRelevanceFloor, DEFAULT_MIN_QUERY_RELEVANCE, selectSnippets, } from "../shared/retrieval.js";
|
|
29
29
|
// Output
|
|
30
30
|
export { buildHookOutput, } from "./hooks-output.js";
|
|
31
31
|
// Session
|
|
32
32
|
export { handleHookSessionStart, handleHookStop, handleBackgroundSync, handleHookContext, handleHookTool, trackSessionMetrics, filterConversationInsightsForProactivity, extractToolFindings, filterToolFindingsForProactivity, resolveSubprocessArgs, } from "./hooks-session.js";
|
|
33
33
|
// ── Imports for the orchestrator ─────────────────────────────────────────────
|
|
34
|
-
import { searchDocumentsAsync, applyTrustFilter, rankResults, selectSnippets, detectTaskIntent, } from "../shared/retrieval.js";
|
|
34
|
+
import { searchDocumentsAsync, applyTrustFilter, rankResults, applyRelevanceFloor, DEFAULT_MIN_QUERY_RELEVANCE, selectSnippets, detectTaskIntent, } from "../shared/retrieval.js";
|
|
35
35
|
import { buildHookOutput } from "./hooks-output.js";
|
|
36
36
|
import { getGitContext, trackSessionMetrics, } from "./hooks-session.js";
|
|
37
|
-
import { approximateTokens } from "../shared/retrieval.js";
|
|
37
|
+
import { approximateTokens, SNIPPET_OVERHEAD_TOKENS } from "../shared/retrieval.js";
|
|
38
38
|
import { resolveRuntimeProfile } from "../runtime-profile.js";
|
|
39
39
|
import { handleTaskPromptLifecycle } from "../task/lifecycle.js";
|
|
40
40
|
// Auto-learn from prompts was removed — it learned conversational noise ("bro", "idk", typos)
|
|
@@ -172,6 +172,17 @@ export async function handleHookPrompt() {
|
|
|
172
172
|
const tRank0 = Date.now();
|
|
173
173
|
rows = rankResults(rows, intent, gitCtx, detectedProject, getPhrenPath(), db, cwd, keywords);
|
|
174
174
|
stage.rankMs = Date.now() - tRank0;
|
|
175
|
+
if (!rows.length)
|
|
176
|
+
process.exit(0);
|
|
177
|
+
// Relevance floor: inject signal or nothing. Ranking scores on priors too,
|
|
178
|
+
// so a doc can rank well with no real tie to this prompt — drop those rather
|
|
179
|
+
// than pad to a quota with noise (env PHREN_MIN_QUERY_RELEVANCE=0 disables).
|
|
180
|
+
const relevanceFloor = clampFloat(process.env.PHREN_MIN_QUERY_RELEVANCE, DEFAULT_MIN_QUERY_RELEVANCE, 0, 1);
|
|
181
|
+
const preFloorCount = rows.length;
|
|
182
|
+
rows = applyRelevanceFloor(rows, keywords, gitCtx, detectedProject, relevanceFloor);
|
|
183
|
+
if (rows.length !== preFloorCount) {
|
|
184
|
+
debugLog(`relevance-floor: ${preFloorCount} -> ${rows.length} rows (floor=${relevanceFloor})`);
|
|
185
|
+
}
|
|
175
186
|
if (!rows.length)
|
|
176
187
|
process.exit(0);
|
|
177
188
|
let safeTokenBudget = clampInt(process.env.PHREN_CONTEXT_TOKEN_BUDGET, 550, 180, 10000);
|
|
@@ -206,7 +217,7 @@ export async function handleHookPrompt() {
|
|
|
206
217
|
const kept = [];
|
|
207
218
|
let runningTokens = 36;
|
|
208
219
|
for (const s of sorted) {
|
|
209
|
-
const est = approximateTokens(s.snippet) +
|
|
220
|
+
const est = approximateTokens(s.snippet) + SNIPPET_OVERHEAD_TOKENS;
|
|
210
221
|
if (runningTokens + est <= maxInjectTokens) {
|
|
211
222
|
kept.push(s);
|
|
212
223
|
runningTokens += est;
|
|
@@ -4,7 +4,7 @@ import { type PushStatus, type SyncStatus } from "../shared/governance.js";
|
|
|
4
4
|
* Returns lines that contain insight-signal words and look like actionable knowledge.
|
|
5
5
|
*/
|
|
6
6
|
export declare function extractConversationInsights(text: string): string[];
|
|
7
|
-
export declare function filterConversationInsightsForProactivity(insights: string[], level?: "high" | "
|
|
7
|
+
export declare function filterConversationInsightsForProactivity(insights: string[], level?: "high" | "low" | "medium"): string[];
|
|
8
8
|
/**
|
|
9
9
|
* Build the `lastSync` patch for a sync attempt, carrying the failure streak
|
|
10
10
|
* forward. Success resets the counter and stamps `lastSuccessfulPushAt`;
|
|
@@ -8,7 +8,7 @@ export declare function filterToolFindingsForProactivity(candidates: Array<{
|
|
|
8
8
|
text: string;
|
|
9
9
|
confidence: number;
|
|
10
10
|
explicit?: boolean;
|
|
11
|
-
}>, level?: "high" | "
|
|
11
|
+
}>, level?: "high" | "low" | "medium"): Array<{
|
|
12
12
|
text: string;
|
|
13
13
|
confidence: number;
|
|
14
14
|
explicit?: boolean;
|
package/dist/cli-registry.js
CHANGED
|
@@ -226,7 +226,7 @@ export const REGISTRY = [
|
|
|
226
226
|
{
|
|
227
227
|
name: "shell",
|
|
228
228
|
topic: "core",
|
|
229
|
-
usage: "phren shell",
|
|
229
|
+
usage: "phren shell [--view <view>] [--project <name>] [--here]",
|
|
230
230
|
summary: "Interactive memory shell",
|
|
231
231
|
featured: true,
|
|
232
232
|
run: async (args, ctx) => {
|
package/dist/data/access.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import * as fs from "fs";
|
|
5
5
|
import * as path from "path";
|
|
6
6
|
import * as yaml from "js-yaml";
|
|
7
|
+
import { loadYamlDocument } from "../phren-core.js";
|
|
7
8
|
import { appendAuditLog, phrenErr, PhrenError, phrenOk, forwardErr, getProjectDirs, isRecord, } from "../shared.js";
|
|
8
9
|
import { normalizeQueueEntryText, } from "../shared/governance.js";
|
|
9
10
|
import { addFindingToFile, } from "../shared/content.js";
|
|
@@ -111,7 +112,7 @@ function validateAggregateQueueProfile(phrenPath, profile) {
|
|
|
111
112
|
}
|
|
112
113
|
let data;
|
|
113
114
|
try {
|
|
114
|
-
data =
|
|
115
|
+
data = loadYamlDocument(fs.readFileSync(profilePath, "utf-8"), (text) => yaml.load(text, { schema: yaml.CORE_SCHEMA }));
|
|
115
116
|
}
|
|
116
117
|
catch {
|
|
117
118
|
return phrenErr(`Malformed profile YAML: ${profilePath}`, PhrenError.MALFORMED_YAML);
|