@phren/cli 0.1.34 → 0.1.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.
- package/dist/capabilities/web-ui.js +1 -1
- package/dist/cli/hooks.js +7 -3
- package/dist/cli/session-background.js +5 -6
- package/dist/cli/session-tool-hook.js +2 -0
- package/dist/cli-registry.js +11 -0
- package/dist/data/access.js +26 -1
- package/dist/finding/impact.js +4 -0
- package/dist/generated/memory-ui-graph.browser.js +5688 -294
- package/dist/hooks.d.ts +9 -0
- package/dist/hooks.js +17 -1
- package/dist/index.js +36 -32
- package/dist/init/config.js +2 -2
- package/dist/init/init-configure.js +13 -0
- package/dist/link/doctor.js +14 -1
- package/dist/link/skills.js +1 -1
- package/dist/logger.js +19 -0
- package/dist/memory-ui-graph.runtime.js +5688 -294
- package/dist/phren-paths.d.ts +6 -0
- package/dist/phren-paths.js +17 -0
- package/dist/shared/index.d.ts +14 -0
- package/dist/shared/index.js +73 -0
- package/dist/ui/data.d.ts +5 -0
- package/dist/ui/data.js +46 -7
- package/dist/ui/graph-chrome.d.ts +1 -0
- package/dist/ui/graph-chrome.js +163 -0
- package/dist/ui/graph.js +1 -1
- package/dist/ui/page.js +3 -0
- package/dist/ui/scripts.js +126 -19
- package/dist/ui/server.js +34 -2
- package/package.json +3 -4
package/dist/phren-paths.d.ts
CHANGED
|
@@ -47,6 +47,12 @@ export declare function sessionMarker(phrenPath: string, name: string): string;
|
|
|
47
47
|
export declare function debugLog(msg: string): void;
|
|
48
48
|
/** Always-on structured error log (no PHREN_DEBUG gate). */
|
|
49
49
|
export declare function errorLog(tool: string, msg: string): void;
|
|
50
|
+
/**
|
|
51
|
+
* Truncate an append-only .jsonl to its last `keepLines` lines once it exceeds
|
|
52
|
+
* `maxBytes`. Best-effort: any IO error (including ENOENT) is ignored so callers
|
|
53
|
+
* never fail on rotation.
|
|
54
|
+
*/
|
|
55
|
+
export declare function rotateJsonlIfLarge(filePath: string, maxBytes?: number, keepLines?: number): void;
|
|
50
56
|
export declare function appendIndexEvent(phrenPath: string, event: Record<string, unknown>): void;
|
|
51
57
|
/** Resolve the canonical findings file for a project directory. */
|
|
52
58
|
export declare function resolveFindingsPath(projectDir: string): string | undefined;
|
package/dist/phren-paths.js
CHANGED
|
@@ -307,9 +307,26 @@ export function errorLog(tool, msg) {
|
|
|
307
307
|
// Logging must never throw
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
|
+
/**
|
|
311
|
+
* Truncate an append-only .jsonl to its last `keepLines` lines once it exceeds
|
|
312
|
+
* `maxBytes`. Best-effort: any IO error (including ENOENT) is ignored so callers
|
|
313
|
+
* never fail on rotation.
|
|
314
|
+
*/
|
|
315
|
+
export function rotateJsonlIfLarge(filePath, maxBytes = 2_000_000, keepLines = 2000) {
|
|
316
|
+
try {
|
|
317
|
+
if (fs.statSync(filePath).size <= maxBytes)
|
|
318
|
+
return;
|
|
319
|
+
const lines = fs.readFileSync(filePath, "utf-8").split("\n");
|
|
320
|
+
fs.writeFileSync(filePath, lines.slice(-keepLines).join("\n"));
|
|
321
|
+
}
|
|
322
|
+
catch {
|
|
323
|
+
// no file yet or IO error — nothing to rotate
|
|
324
|
+
}
|
|
325
|
+
}
|
|
310
326
|
export function appendIndexEvent(phrenPath, event) {
|
|
311
327
|
try {
|
|
312
328
|
const file = runtimeFile(phrenPath, "index-events.jsonl");
|
|
329
|
+
rotateJsonlIfLarge(file);
|
|
313
330
|
fs.appendFileSync(file, JSON.stringify({ at: new Date().toISOString(), ...event }) + "\n");
|
|
314
331
|
}
|
|
315
332
|
catch (err) {
|
package/dist/shared/index.d.ts
CHANGED
|
@@ -23,6 +23,20 @@ export declare function normalizeIndexedContent(content: string, type: string, p
|
|
|
23
23
|
*/
|
|
24
24
|
export declare function updateFileInIndex(db: SqlJsDatabase, filePath: string, phrenPath: string): void;
|
|
25
25
|
export declare function buildIndex(phrenPath: string, profile?: string): Promise<SqlJsDatabase>;
|
|
26
|
+
/**
|
|
27
|
+
* Non-blocking index loader for the UserPromptSubmit / PostToolUse hooks.
|
|
28
|
+
* Unlike buildIndex(), this NEVER blocks a hook on a 2-12s rebuild:
|
|
29
|
+
* - exact stat-hash cache hit → serve it immediately (fast path);
|
|
30
|
+
* - miss but a usable (possibly stale) cache exists → serve the stale snapshot
|
|
31
|
+
* now and kick a *detached* `background-reindex` (deduped by the rebuild
|
|
32
|
+
* lock) so the next prompt gets fresh results. A single prompt's context may
|
|
33
|
+
* lag one write — far better than freezing the prompt;
|
|
34
|
+
* - cold start (no cache at all) → block once on a full build so the very first
|
|
35
|
+
* prompt isn't empty.
|
|
36
|
+
* Freshness stays correct over time: an edit bumps mtime → new stat-hash → this
|
|
37
|
+
* misses → a rebuild is scheduled → the following prompt hits the new cache.
|
|
38
|
+
*/
|
|
39
|
+
export declare function loadIndexForHook(phrenPath: string, profile?: string): Promise<SqlJsDatabase>;
|
|
26
40
|
/** Find the FTS cache file for a specific phrenPath+profile. Returns exists + size. */
|
|
27
41
|
export declare function findFtsCacheForPath(phrenPath: string, profile?: string): {
|
|
28
42
|
exists: boolean;
|
package/dist/shared/index.js
CHANGED
|
@@ -71,6 +71,7 @@ import { logger } from "../logger.js";
|
|
|
71
71
|
import { formatActorAttribution, parseSourceComment } from "../content/citation.js";
|
|
72
72
|
import { beginUserFragmentBuildCache, endUserFragmentBuildCache, extractAndLinkFragments, ensureGlobalEntitiesTable, } from "./fragment-graph.js";
|
|
73
73
|
import { bootstrapSqlJs } from "./sqljs.js";
|
|
74
|
+
import { spawnDetachedChild } from "./process.js";
|
|
74
75
|
import { getProjectOwnershipMode, getProjectSourcePath, readProjectConfig } from "../project-config.js";
|
|
75
76
|
import { buildSourceDocKey, decodeStringRow, getDocSourceKey, queryDocRows, queryRows, } from "../index-query.js";
|
|
76
77
|
import { classifyTopicForText, readProjectTopics, } from "../project-topics.js";
|
|
@@ -1433,6 +1434,78 @@ export async function buildIndex(phrenPath, profile) {
|
|
|
1433
1434
|
_lastBuildKey = buildKey;
|
|
1434
1435
|
return db;
|
|
1435
1436
|
}
|
|
1437
|
+
/** Resolve the per-user FTS cache directory (os.tmpdir()/phren-fts-<uid>). */
|
|
1438
|
+
function ftsCacheDir() {
|
|
1439
|
+
let userSuffix;
|
|
1440
|
+
try {
|
|
1441
|
+
userSuffix = String(os.userInfo().uid);
|
|
1442
|
+
}
|
|
1443
|
+
catch (err) {
|
|
1444
|
+
logger.debug("ftsCacheDir userInfo", errorMessage(err));
|
|
1445
|
+
userSuffix = crypto.createHash("sha1").update(homeDir()).digest("hex").slice(0, 12);
|
|
1446
|
+
}
|
|
1447
|
+
return path.join(os.tmpdir(), `phren-fts-${userSuffix}`);
|
|
1448
|
+
}
|
|
1449
|
+
/**
|
|
1450
|
+
* Non-blocking index loader for the UserPromptSubmit / PostToolUse hooks.
|
|
1451
|
+
* Unlike buildIndex(), this NEVER blocks a hook on a 2-12s rebuild:
|
|
1452
|
+
* - exact stat-hash cache hit → serve it immediately (fast path);
|
|
1453
|
+
* - miss but a usable (possibly stale) cache exists → serve the stale snapshot
|
|
1454
|
+
* now and kick a *detached* `background-reindex` (deduped by the rebuild
|
|
1455
|
+
* lock) so the next prompt gets fresh results. A single prompt's context may
|
|
1456
|
+
* lag one write — far better than freezing the prompt;
|
|
1457
|
+
* - cold start (no cache at all) → block once on a full build so the very first
|
|
1458
|
+
* prompt isn't empty.
|
|
1459
|
+
* Freshness stays correct over time: an edit bumps mtime → new stat-hash → this
|
|
1460
|
+
* misses → a rebuild is scheduled → the following prompt hits the new cache.
|
|
1461
|
+
*/
|
|
1462
|
+
export async function loadIndexForHook(phrenPath, profile) {
|
|
1463
|
+
const cacheDir = ftsCacheDir();
|
|
1464
|
+
const globResult = globAllFiles(phrenPath, profile);
|
|
1465
|
+
const hash = computePhrenHash(phrenPath, profile, globResult.filePaths);
|
|
1466
|
+
const cacheFile = path.join(cacheDir, `${hash}.db`);
|
|
1467
|
+
const SQL = await bootstrapSqlJs();
|
|
1468
|
+
// Fast path: exact stat-hash hit (no file changed mtime/size since the build).
|
|
1469
|
+
if (fs.existsSync(cacheFile)) {
|
|
1470
|
+
try {
|
|
1471
|
+
const db = new SQL.Database(fs.readFileSync(cacheFile));
|
|
1472
|
+
const docCount = db.exec("SELECT COUNT(*) FROM docs")?.[0]?.values?.[0]?.[0] ?? 0;
|
|
1473
|
+
if (docCount > 0) {
|
|
1474
|
+
appendIndexEvent(phrenPath, { event: "build_index", cache: "hit", hash: hash.slice(0, 12), elapsedMs: 0, profile: profile || "" });
|
|
1475
|
+
return db;
|
|
1476
|
+
}
|
|
1477
|
+
db.close();
|
|
1478
|
+
}
|
|
1479
|
+
catch (err) {
|
|
1480
|
+
debugLog(`loadIndexForHook fast-path load failed: ${errorMessage(err)}`);
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
// Miss. Serve stale immediately if any cache exists; else cold-build once.
|
|
1484
|
+
let hasStale = false;
|
|
1485
|
+
try {
|
|
1486
|
+
hasStale = fs.existsSync(cacheDir) && fs.readdirSync(cacheDir).some(f => f.endsWith(".db"));
|
|
1487
|
+
}
|
|
1488
|
+
catch (err) {
|
|
1489
|
+
logger.debug("loadIndexForHook staleScan", errorMessage(err));
|
|
1490
|
+
}
|
|
1491
|
+
if (!hasStale) {
|
|
1492
|
+
return buildIndex(phrenPath, profile);
|
|
1493
|
+
}
|
|
1494
|
+
// Schedule a detached rebuild for next time (rebuild lock dedups concurrent hooks).
|
|
1495
|
+
if (!isRebuildLockHeld(phrenPath)) {
|
|
1496
|
+
const entry = process.argv[1];
|
|
1497
|
+
if (entry && /index\.(c?js|mjs|ts)$/.test(entry) && fs.existsSync(entry)) {
|
|
1498
|
+
try {
|
|
1499
|
+
spawnDetachedChild([entry, "background-reindex"], { phrenPath }).unref();
|
|
1500
|
+
debugLog(`loadIndexForHook: scheduled detached background-reindex (stat-hash miss ${hash.slice(0, 8)})`);
|
|
1501
|
+
}
|
|
1502
|
+
catch (err) {
|
|
1503
|
+
debugLog(`loadIndexForHook: detached reindex spawn failed: ${errorMessage(err)}`);
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
return loadIndexSnapshotOrEmpty(phrenPath, profile);
|
|
1508
|
+
}
|
|
1436
1509
|
async function _buildIndexGuarded(phrenPath, profile) {
|
|
1437
1510
|
const lockTarget = runtimeFile(phrenPath, "index-rebuild");
|
|
1438
1511
|
if (isRebuildLockHeld(phrenPath)) {
|
package/dist/ui/data.d.ts
CHANGED
|
@@ -24,6 +24,11 @@ interface GraphNode {
|
|
|
24
24
|
scoreKeys?: string[];
|
|
25
25
|
topicSlug?: string;
|
|
26
26
|
topicLabel?: string;
|
|
27
|
+
/** Findings only: the `## YYYY-MM-DD` heading the entry sits under. */
|
|
28
|
+
date?: string;
|
|
29
|
+
/** Project nodes only: real per-project totals for tooltips/labels. */
|
|
30
|
+
findingCount?: number;
|
|
31
|
+
taskCount?: number;
|
|
27
32
|
}
|
|
28
33
|
interface GraphDocRef {
|
|
29
34
|
doc: string;
|
package/dist/ui/data.js
CHANGED
|
@@ -185,6 +185,19 @@ export async function buildGraph(phrenPath, profile, focusProject, existingDb) {
|
|
|
185
185
|
const topicMetaMap = new Map();
|
|
186
186
|
// Track which project nodes have already been pushed (same name may appear in multiple stores)
|
|
187
187
|
const addedProjectNodeIds = new Set();
|
|
188
|
+
// Project nodes by name so per-project finding/task totals can be stamped after the scans
|
|
189
|
+
const projectNodeByName = new Map();
|
|
190
|
+
// Finding ids are content hashes, so duplicate-text bullets collide — every
|
|
191
|
+
// id-keyed map downstream (renderer, selection, removal) then conflates the
|
|
192
|
+
// twins. Salt repeat occurrences deterministically (file order); the FIRST
|
|
193
|
+
// occurrence keeps the canonical id so findingNodeIdForLine / lookup-event
|
|
194
|
+
// targeting stays in lockstep.
|
|
195
|
+
const usedFindingIds = new Map();
|
|
196
|
+
const uniqueFindingId = (id) => {
|
|
197
|
+
const seen = usedFindingIds.get(id) || 0;
|
|
198
|
+
usedFindingIds.set(id, seen + 1);
|
|
199
|
+
return seen === 0 ? id : `${id}-${seen + 1}`;
|
|
200
|
+
};
|
|
188
201
|
for (const { storePath, project } of storeProjects) {
|
|
189
202
|
// Load dynamic topics for this project
|
|
190
203
|
const { topics: projectTopics } = readProjectTopics(storePath, project);
|
|
@@ -198,7 +211,7 @@ export async function buildGraph(phrenPath, profile, focusProject, existingDb) {
|
|
|
198
211
|
if (!fs.existsSync(findingsPath)) {
|
|
199
212
|
if (!addedProjectNodeIds.has(project)) {
|
|
200
213
|
addedProjectNodeIds.add(project);
|
|
201
|
-
|
|
214
|
+
const projectNode = {
|
|
202
215
|
id: project,
|
|
203
216
|
label: project,
|
|
204
217
|
fullLabel: project,
|
|
@@ -207,13 +220,17 @@ export async function buildGraph(phrenPath, profile, focusProject, existingDb) {
|
|
|
207
220
|
project,
|
|
208
221
|
store: storeName,
|
|
209
222
|
tagged: false,
|
|
210
|
-
|
|
223
|
+
findingCount: 0,
|
|
224
|
+
taskCount: 0,
|
|
225
|
+
};
|
|
226
|
+
nodes.push(projectNode);
|
|
227
|
+
projectNodeByName.set(project, projectNode);
|
|
211
228
|
}
|
|
212
229
|
continue;
|
|
213
230
|
}
|
|
214
231
|
if (!addedProjectNodeIds.has(project)) {
|
|
215
232
|
addedProjectNodeIds.add(project);
|
|
216
|
-
|
|
233
|
+
const projectNode = {
|
|
217
234
|
id: project,
|
|
218
235
|
label: project,
|
|
219
236
|
fullLabel: project,
|
|
@@ -222,7 +239,11 @@ export async function buildGraph(phrenPath, profile, focusProject, existingDb) {
|
|
|
222
239
|
project,
|
|
223
240
|
store: storeName,
|
|
224
241
|
tagged: false,
|
|
225
|
-
|
|
242
|
+
findingCount: 0,
|
|
243
|
+
taskCount: 0,
|
|
244
|
+
};
|
|
245
|
+
nodes.push(projectNode);
|
|
246
|
+
projectNodeByName.set(project, projectNode);
|
|
226
247
|
}
|
|
227
248
|
const content = fs.readFileSync(findingsPath, "utf8");
|
|
228
249
|
const lines = content.split("\n");
|
|
@@ -235,8 +256,15 @@ export async function buildGraph(phrenPath, profile, focusProject, existingDb) {
|
|
|
235
256
|
// Support heading-based findings: ## topic / ### title / paragraph
|
|
236
257
|
let currentHeadingTag;
|
|
237
258
|
let _currentHeadingTitle;
|
|
259
|
+
// FINDINGS.md groups entries under `## YYYY-MM-DD` date headings
|
|
260
|
+
let currentDate;
|
|
238
261
|
for (let lineIdx = 0; lineIdx < lines.length; lineIdx++) {
|
|
239
262
|
const line = lines[lineIdx];
|
|
263
|
+
const dateMatch = line.match(/^##\s+(\d{4}-\d{2}-\d{2})\s*$/);
|
|
264
|
+
if (dateMatch) {
|
|
265
|
+
currentDate = dateMatch[1];
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
240
268
|
// Track heading context for heading-based findings
|
|
241
269
|
const h2Match = line.match(/^##\s+([a-z_-]+)\s*$/i);
|
|
242
270
|
if (h2Match) {
|
|
@@ -264,7 +292,7 @@ export async function buildGraph(phrenPath, profile, focusProject, existingDb) {
|
|
|
264
292
|
continue;
|
|
265
293
|
const topic = classifyTopicForText(`[${currentHeadingTag}] ${text}`, projectTopics);
|
|
266
294
|
const scoreKey = entryScoreKey(project, FINDINGS_FILENAME, `[${currentHeadingTag}] ${text}`);
|
|
267
|
-
const nodeId = findingStableId(scoreKey);
|
|
295
|
+
const nodeId = uniqueFindingId(findingStableId(scoreKey));
|
|
268
296
|
taggedCount++;
|
|
269
297
|
nodes.push({
|
|
270
298
|
id: nodeId,
|
|
@@ -280,6 +308,7 @@ export async function buildGraph(phrenPath, profile, focusProject, existingDb) {
|
|
|
280
308
|
refDocs: [{ doc: `${project}/FINDINGS.md`, project, scoreKey }],
|
|
281
309
|
topicSlug: topic.slug,
|
|
282
310
|
topicLabel: topic.label,
|
|
311
|
+
date: currentDate,
|
|
283
312
|
});
|
|
284
313
|
links.push({ source: project, target: nodeId });
|
|
285
314
|
for (const other of exactProjectMentions(text, projectSet, project)) {
|
|
@@ -299,7 +328,7 @@ export async function buildGraph(phrenPath, profile, focusProject, existingDb) {
|
|
|
299
328
|
// Classify the finding using the project's topic system
|
|
300
329
|
const topic = classifyTopicForText(`[${tag}] ${text}`, projectTopics);
|
|
301
330
|
const scoreKey = entryScoreKey(project, FINDINGS_FILENAME, `[${tag}] ${text}`);
|
|
302
|
-
const nodeId = findingStableId(scoreKey);
|
|
331
|
+
const nodeId = uniqueFindingId(findingStableId(scoreKey));
|
|
303
332
|
taggedCount++;
|
|
304
333
|
nodes.push({
|
|
305
334
|
id: nodeId,
|
|
@@ -315,6 +344,7 @@ export async function buildGraph(phrenPath, profile, focusProject, existingDb) {
|
|
|
315
344
|
refDocs: [{ doc: `${project}/FINDINGS.md`, project, scoreKey }],
|
|
316
345
|
topicSlug: topic.slug,
|
|
317
346
|
topicLabel: topic.label,
|
|
347
|
+
date: currentDate,
|
|
318
348
|
});
|
|
319
349
|
links.push({ source: project, target: nodeId });
|
|
320
350
|
for (const other of exactProjectMentions(text, projectSet, project)) {
|
|
@@ -334,7 +364,7 @@ export async function buildGraph(phrenPath, profile, focusProject, existingDb) {
|
|
|
334
364
|
// Classify using dynamic topics
|
|
335
365
|
const topic = classifyTopicForText(text, projectTopics);
|
|
336
366
|
const scoreKey = entryScoreKey(project, FINDINGS_FILENAME, text);
|
|
337
|
-
const nodeId = findingStableId(scoreKey);
|
|
367
|
+
const nodeId = uniqueFindingId(findingStableId(scoreKey));
|
|
338
368
|
untaggedAdded++;
|
|
339
369
|
nodes.push({
|
|
340
370
|
id: nodeId,
|
|
@@ -350,9 +380,14 @@ export async function buildGraph(phrenPath, profile, focusProject, existingDb) {
|
|
|
350
380
|
refDocs: [{ doc: `${project}/FINDINGS.md`, project, scoreKey }],
|
|
351
381
|
topicSlug: topic.slug,
|
|
352
382
|
topicLabel: topic.label,
|
|
383
|
+
date: currentDate,
|
|
353
384
|
});
|
|
354
385
|
links.push({ source: project, target: nodeId });
|
|
355
386
|
}
|
|
387
|
+
const projectNode = projectNodeByName.get(project);
|
|
388
|
+
if (projectNode) {
|
|
389
|
+
projectNode.findingCount = (projectNode.findingCount || 0) + taggedCount + untaggedAdded;
|
|
390
|
+
}
|
|
356
391
|
}
|
|
357
392
|
// ── Tasks ──────────────────────────────────────────────────────────
|
|
358
393
|
try {
|
|
@@ -391,6 +426,10 @@ export async function buildGraph(phrenPath, profile, focusProject, existingDb) {
|
|
|
391
426
|
taskCount++;
|
|
392
427
|
}
|
|
393
428
|
}
|
|
429
|
+
const projectNode = projectNodeByName.get(project);
|
|
430
|
+
if (projectNode) {
|
|
431
|
+
projectNode.taskCount = (projectNode.taskCount || 0) + taskCount;
|
|
432
|
+
}
|
|
394
433
|
}
|
|
395
434
|
}
|
|
396
435
|
catch {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const GRAPH_HUD_STYLES = "\n/* \u2500\u2500 Full-bleed graph tab \u2014 total dark immersion (header included) \u2500\u2500 */\nbody:has(#tab-graph.active) { background: #04050b; }\nbody:has(#tab-graph.active) .main { max-width: none; padding: 0; }\nbody:has(#tab-graph.active) .header {\n background: rgba(5, 6, 13, 0.92);\n border-bottom: 1px solid rgba(103, 232, 249, 0.12);\n backdrop-filter: blur(10px);\n -webkit-backdrop-filter: blur(10px);\n}\nbody:has(#tab-graph.active) .header .nav-item { color: #7f8db8; }\nbody:has(#tab-graph.active) .header .nav-item.active { color: #67e8f9; }\nbody:has(#tab-graph.active) .header .brand-name,\nbody:has(#tab-graph.active) .header-brand { color: #dbe6ff; }\n#tab-graph .graph-container {\n background: #04050b;\n border: none;\n border-radius: 0;\n position: relative;\n overflow: hidden;\n}\n#tab-graph #graph-canvas {\n height: calc(100vh - 64px);\n min-height: 520px;\n}\n\n/* \u2500\u2500 Overlay chrome \u2014 compact HUD clustered top-right (GraphRAG) \u2500\u2500\u2500\u2500 */\n#tab-graph .graph-filters {\n background: transparent;\n border: none;\n box-shadow: none;\n padding: 0;\n left: auto;\n right: 60px;\n width: min(560px, 60%);\n z-index: 10;\n}\n#tab-graph .graph-controls { z-index: 10; }\n#tab-graph .graph-controls button {\n width: 34px;\n height: 34px;\n border-radius: 8px;\n border: 1px solid rgba(103, 232, 249, 0.2);\n background: rgba(8, 10, 22, 0.85);\n color: #9fb2e8;\n font: 700 13px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n cursor: pointer;\n transition: border-color 0.15s ease, color 0.15s ease;\n}\n#tab-graph .graph-controls button:hover {\n border-color: rgba(103, 232, 249, 0.55);\n color: #e6f6ff;\n}\n\n/* \u2500\u2500 Docked dossier \u2014 left side, compact (GraphRAG inspector) \u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n#graph-node-popover.phren-docked {\n left: 16px !important;\n right: auto !important;\n top: 68px !important;\n bottom: 16px;\n width: 340px;\n max-width: min(360px, calc(100% - 32px));\n pointer-events: none;\n z-index: 12;\n}\n/* GraphRAG-style stats row + relationships in the inspector */\n.phren-dossier-stats {\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n border: 1px solid rgba(103, 232, 249, 0.16);\n border-radius: 8px;\n overflow: hidden;\n margin: 12px 0 4px;\n}\n.phren-dossier-stats > div {\n padding: 8px 10px;\n border-right: 1px solid rgba(103, 232, 249, 0.12);\n}\n.phren-dossier-stats > div:last-child { border-right: 0; }\n.phren-dossier-stats .k {\n font: 700 8.5px/1.4 ui-monospace, Menlo, monospace;\n letter-spacing: 0.12em; color: #6b76a0; text-transform: uppercase;\n}\n.phren-dossier-stats .v {\n font: 700 14px/1.2 ui-monospace, Menlo, monospace; color: #67e8f9; margin-top: 3px;\n}\n.phren-rel-row {\n display: flex; align-items: baseline; justify-content: space-between; gap: 10px;\n padding: 7px 0; border-bottom: 1px solid rgba(120, 150, 220, 0.08); cursor: pointer;\n}\n.phren-rel-row:last-child { border-bottom: 0; }\n.phren-rel-row .n { font-size: 12px; color: #d6e2ff; overflow: hidden; text-overflow: ellipsis; }\n.phren-rel-row .n small { display: block; color: #6b76a0; font-size: 10px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.phren-rel-row .w { font: 600 11px/1.4 ui-monospace, Menlo, monospace; color: #67e8f9; font-variant-numeric: tabular-nums; }\n.phren-rel-row:hover .n { color: #eaf2ff; }\n#graph-node-popover.phren-docked #graph-node-popover-card {\n --surface: #0a0d1e;\n --surface-raised: rgba(22, 27, 52, 0.9);\n --surface-sunken: rgba(5, 6, 15, 0.92);\n --ink: #dbe4ff;\n --muted: #8b96c9;\n --border: rgba(103, 232, 249, 0.2);\n --accent: #67e8f9;\n --accent-dim: rgba(103, 232, 249, 0.12);\n height: 100%;\n overflow: auto;\n pointer-events: auto;\n background: rgba(8, 10, 22, 0.92);\n border: 1px solid rgba(103, 232, 249, 0.22);\n box-shadow: 0 16px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(103, 232, 249, 0.05);\n border-radius: 12px;\n color: #dbe4ff;\n backdrop-filter: blur(14px);\n -webkit-backdrop-filter: blur(14px);\n}\n#graph-node-popover.phren-docked .phren-dossier-kind {\n font: 700 10px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n color: #67e8f9;\n letter-spacing: 0.16em;\n text-transform: uppercase;\n}\n#graph-node-popover.phren-docked #graph-node-popover-card { padding: 14px 15px; }\n#graph-node-popover.phren-docked .phren-dossier-text {\n white-space: pre-wrap;\n line-height: 1.6;\n font-size: 13px;\n color: #dde6fb;\n}\n.phren-dossier-section {\n font: 700 9.5px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n color: #67e8f9;\n letter-spacing: 0.14em;\n text-transform: uppercase;\n margin-top: 4px;\n}\n.phren-dossier-nav {\n display: inline-flex;\n align-items: center;\n gap: 10px;\n font: 600 11px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n color: #8b96c9;\n}\n.phren-dossier-nav button {\n width: 28px;\n height: 28px;\n border-radius: 6px;\n border: 1px solid rgba(103, 232, 249, 0.2);\n background: rgba(12, 15, 30, 0.9);\n color: #9fb2e8;\n font-size: 14px;\n line-height: 1;\n cursor: pointer;\n transition: border-color 0.15s ease, color 0.15s ease;\n}\n.phren-dossier-nav button:hover {\n border-color: rgba(103, 232, 249, 0.55);\n color: #e6f6ff;\n}\n";
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// Holographic chrome for the Graph tab. Appended LAST in the page <style>
|
|
2
|
+
// block so it wins the cascade over the base styles. The graph canvas is
|
|
3
|
+
// immersive-dark in BOTH app themes (the 3D scene is always a dark void —
|
|
4
|
+
// a light chrome ring around it read as unfinished).
|
|
5
|
+
export const GRAPH_HUD_STYLES = `
|
|
6
|
+
/* ── Full-bleed graph tab — total dark immersion (header included) ── */
|
|
7
|
+
body:has(#tab-graph.active) { background: #04050b; }
|
|
8
|
+
body:has(#tab-graph.active) .main { max-width: none; padding: 0; }
|
|
9
|
+
body:has(#tab-graph.active) .header {
|
|
10
|
+
background: rgba(5, 6, 13, 0.92);
|
|
11
|
+
border-bottom: 1px solid rgba(103, 232, 249, 0.12);
|
|
12
|
+
backdrop-filter: blur(10px);
|
|
13
|
+
-webkit-backdrop-filter: blur(10px);
|
|
14
|
+
}
|
|
15
|
+
body:has(#tab-graph.active) .header .nav-item { color: #7f8db8; }
|
|
16
|
+
body:has(#tab-graph.active) .header .nav-item.active { color: #67e8f9; }
|
|
17
|
+
body:has(#tab-graph.active) .header .brand-name,
|
|
18
|
+
body:has(#tab-graph.active) .header-brand { color: #dbe6ff; }
|
|
19
|
+
#tab-graph .graph-container {
|
|
20
|
+
background: #04050b;
|
|
21
|
+
border: none;
|
|
22
|
+
border-radius: 0;
|
|
23
|
+
position: relative;
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
}
|
|
26
|
+
#tab-graph #graph-canvas {
|
|
27
|
+
height: calc(100vh - 64px);
|
|
28
|
+
min-height: 520px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* ── Overlay chrome — compact HUD clustered top-right (GraphRAG) ──── */
|
|
32
|
+
#tab-graph .graph-filters {
|
|
33
|
+
background: transparent;
|
|
34
|
+
border: none;
|
|
35
|
+
box-shadow: none;
|
|
36
|
+
padding: 0;
|
|
37
|
+
left: auto;
|
|
38
|
+
right: 60px;
|
|
39
|
+
width: min(560px, 60%);
|
|
40
|
+
z-index: 10;
|
|
41
|
+
}
|
|
42
|
+
#tab-graph .graph-controls { z-index: 10; }
|
|
43
|
+
#tab-graph .graph-controls button {
|
|
44
|
+
width: 34px;
|
|
45
|
+
height: 34px;
|
|
46
|
+
border-radius: 8px;
|
|
47
|
+
border: 1px solid rgba(103, 232, 249, 0.2);
|
|
48
|
+
background: rgba(8, 10, 22, 0.85);
|
|
49
|
+
color: #9fb2e8;
|
|
50
|
+
font: 700 13px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
transition: border-color 0.15s ease, color 0.15s ease;
|
|
53
|
+
}
|
|
54
|
+
#tab-graph .graph-controls button:hover {
|
|
55
|
+
border-color: rgba(103, 232, 249, 0.55);
|
|
56
|
+
color: #e6f6ff;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* ── Docked dossier — left side, compact (GraphRAG inspector) ─────── */
|
|
60
|
+
#graph-node-popover.phren-docked {
|
|
61
|
+
left: 16px !important;
|
|
62
|
+
right: auto !important;
|
|
63
|
+
top: 68px !important;
|
|
64
|
+
bottom: 16px;
|
|
65
|
+
width: 340px;
|
|
66
|
+
max-width: min(360px, calc(100% - 32px));
|
|
67
|
+
pointer-events: none;
|
|
68
|
+
z-index: 12;
|
|
69
|
+
}
|
|
70
|
+
/* GraphRAG-style stats row + relationships in the inspector */
|
|
71
|
+
.phren-dossier-stats {
|
|
72
|
+
display: grid;
|
|
73
|
+
grid-template-columns: repeat(3, 1fr);
|
|
74
|
+
border: 1px solid rgba(103, 232, 249, 0.16);
|
|
75
|
+
border-radius: 8px;
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
margin: 12px 0 4px;
|
|
78
|
+
}
|
|
79
|
+
.phren-dossier-stats > div {
|
|
80
|
+
padding: 8px 10px;
|
|
81
|
+
border-right: 1px solid rgba(103, 232, 249, 0.12);
|
|
82
|
+
}
|
|
83
|
+
.phren-dossier-stats > div:last-child { border-right: 0; }
|
|
84
|
+
.phren-dossier-stats .k {
|
|
85
|
+
font: 700 8.5px/1.4 ui-monospace, Menlo, monospace;
|
|
86
|
+
letter-spacing: 0.12em; color: #6b76a0; text-transform: uppercase;
|
|
87
|
+
}
|
|
88
|
+
.phren-dossier-stats .v {
|
|
89
|
+
font: 700 14px/1.2 ui-monospace, Menlo, monospace; color: #67e8f9; margin-top: 3px;
|
|
90
|
+
}
|
|
91
|
+
.phren-rel-row {
|
|
92
|
+
display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
|
|
93
|
+
padding: 7px 0; border-bottom: 1px solid rgba(120, 150, 220, 0.08); cursor: pointer;
|
|
94
|
+
}
|
|
95
|
+
.phren-rel-row:last-child { border-bottom: 0; }
|
|
96
|
+
.phren-rel-row .n { font-size: 12px; color: #d6e2ff; overflow: hidden; text-overflow: ellipsis; }
|
|
97
|
+
.phren-rel-row .n small { display: block; color: #6b76a0; font-size: 10px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
98
|
+
.phren-rel-row .w { font: 600 11px/1.4 ui-monospace, Menlo, monospace; color: #67e8f9; font-variant-numeric: tabular-nums; }
|
|
99
|
+
.phren-rel-row:hover .n { color: #eaf2ff; }
|
|
100
|
+
#graph-node-popover.phren-docked #graph-node-popover-card {
|
|
101
|
+
--surface: #0a0d1e;
|
|
102
|
+
--surface-raised: rgba(22, 27, 52, 0.9);
|
|
103
|
+
--surface-sunken: rgba(5, 6, 15, 0.92);
|
|
104
|
+
--ink: #dbe4ff;
|
|
105
|
+
--muted: #8b96c9;
|
|
106
|
+
--border: rgba(103, 232, 249, 0.2);
|
|
107
|
+
--accent: #67e8f9;
|
|
108
|
+
--accent-dim: rgba(103, 232, 249, 0.12);
|
|
109
|
+
height: 100%;
|
|
110
|
+
overflow: auto;
|
|
111
|
+
pointer-events: auto;
|
|
112
|
+
background: rgba(8, 10, 22, 0.92);
|
|
113
|
+
border: 1px solid rgba(103, 232, 249, 0.22);
|
|
114
|
+
box-shadow: 0 16px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(103, 232, 249, 0.05);
|
|
115
|
+
border-radius: 12px;
|
|
116
|
+
color: #dbe4ff;
|
|
117
|
+
backdrop-filter: blur(14px);
|
|
118
|
+
-webkit-backdrop-filter: blur(14px);
|
|
119
|
+
}
|
|
120
|
+
#graph-node-popover.phren-docked .phren-dossier-kind {
|
|
121
|
+
font: 700 10px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
122
|
+
color: #67e8f9;
|
|
123
|
+
letter-spacing: 0.16em;
|
|
124
|
+
text-transform: uppercase;
|
|
125
|
+
}
|
|
126
|
+
#graph-node-popover.phren-docked #graph-node-popover-card { padding: 14px 15px; }
|
|
127
|
+
#graph-node-popover.phren-docked .phren-dossier-text {
|
|
128
|
+
white-space: pre-wrap;
|
|
129
|
+
line-height: 1.6;
|
|
130
|
+
font-size: 13px;
|
|
131
|
+
color: #dde6fb;
|
|
132
|
+
}
|
|
133
|
+
.phren-dossier-section {
|
|
134
|
+
font: 700 9.5px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
135
|
+
color: #67e8f9;
|
|
136
|
+
letter-spacing: 0.14em;
|
|
137
|
+
text-transform: uppercase;
|
|
138
|
+
margin-top: 4px;
|
|
139
|
+
}
|
|
140
|
+
.phren-dossier-nav {
|
|
141
|
+
display: inline-flex;
|
|
142
|
+
align-items: center;
|
|
143
|
+
gap: 10px;
|
|
144
|
+
font: 600 11px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
145
|
+
color: #8b96c9;
|
|
146
|
+
}
|
|
147
|
+
.phren-dossier-nav button {
|
|
148
|
+
width: 28px;
|
|
149
|
+
height: 28px;
|
|
150
|
+
border-radius: 6px;
|
|
151
|
+
border: 1px solid rgba(103, 232, 249, 0.2);
|
|
152
|
+
background: rgba(12, 15, 30, 0.9);
|
|
153
|
+
color: #9fb2e8;
|
|
154
|
+
font-size: 14px;
|
|
155
|
+
line-height: 1;
|
|
156
|
+
cursor: pointer;
|
|
157
|
+
transition: border-color 0.15s ease, color 0.15s ease;
|
|
158
|
+
}
|
|
159
|
+
.phren-dossier-nav button:hover {
|
|
160
|
+
border-color: rgba(103, 232, 249, 0.55);
|
|
161
|
+
color: #e6f6ff;
|
|
162
|
+
}
|
|
163
|
+
`;
|
package/dist/ui/graph.js
CHANGED
|
@@ -26,7 +26,7 @@ export function renderGraphScript() {
|
|
|
26
26
|
}
|
|
27
27
|
return `
|
|
28
28
|
(function() {
|
|
29
|
-
console.error('[phrenGraph] Bundled
|
|
29
|
+
console.error('[phrenGraph] Bundled graph renderer asset not found. Run "npm run build" in the phren repo root.');
|
|
30
30
|
window.phrenGraph = window.phrenGraph || {
|
|
31
31
|
__renderer: 'missing',
|
|
32
32
|
mount: function() {},
|
package/dist/ui/page.js
CHANGED
|
@@ -2,6 +2,7 @@ import { WEB_UI_STYLES, renderWebUiScript } from "./assets.js";
|
|
|
2
2
|
import { renderGraphScript } from "./graph.js";
|
|
3
3
|
import { LAYOUT_VIEWPORT_STYLES, PROJECT_REFERENCE_UI_STYLES, REVIEW_UI_STYLES, SETTINGS_TAB_UI_STYLES, TASK_UI_STYLES } from "./styles.js";
|
|
4
4
|
import { PHREN_DEEP_VOID_STYLES } from "./deep-void.js";
|
|
5
|
+
import { GRAPH_HUD_STYLES } from "./graph-chrome.js";
|
|
5
6
|
import { renderSharedWebUiHelpers, renderSkillUiEnhancementScript, renderProfileSwitcherScript, renderProjectReferenceEnhancementScript, renderTasksAndSettingsScript, renderReviewQueueKeyboardScript, renderSearchScript, renderEventWiringScript, renderGraphHostScript, renderActivityStreamScript, renderGraphWalkScript, } from "./scripts.js";
|
|
6
7
|
function h(s) {
|
|
7
8
|
return s
|
|
@@ -20,6 +21,7 @@ export function renderWebUiPage(_phrenPath, authToken, nonce) {
|
|
|
20
21
|
<link rel="preconnect" href="https://fonts.bunny.net" />
|
|
21
22
|
<link href="https://fonts.bunny.net/css?family=inter:400,500,600,700|space-grotesk:400,500,600,700|jetbrains-mono:400,500,700&display=swap" rel="stylesheet" />
|
|
22
23
|
<title>phren</title>
|
|
24
|
+
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='15' fill='%2312122a'/%3E%3Ccircle cx='16' cy='16' r='8' fill='%237c6bf5'/%3E%3Ccircle cx='13' cy='13' r='3' fill='%23a99cfa'/%3E%3C/svg%3E" />
|
|
23
25
|
<style>
|
|
24
26
|
${WEB_UI_STYLES}
|
|
25
27
|
${PROJECT_REFERENCE_UI_STYLES}
|
|
@@ -28,6 +30,7 @@ ${TASK_UI_STYLES}
|
|
|
28
30
|
${REVIEW_UI_STYLES}
|
|
29
31
|
${PHREN_DEEP_VOID_STYLES}
|
|
30
32
|
${LAYOUT_VIEWPORT_STYLES}
|
|
33
|
+
${GRAPH_HUD_STYLES}
|
|
31
34
|
</style>
|
|
32
35
|
</head>
|
|
33
36
|
<body>
|