@phren/cli 0.1.32 → 0.1.33

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.
Files changed (71) hide show
  1. package/dist/capabilities/cli.js +2 -2
  2. package/dist/cli/config-access.d.ts +1 -0
  3. package/dist/cli/config-access.js +59 -0
  4. package/dist/cli/config-llm.d.ts +1 -0
  5. package/dist/cli/config-llm.js +60 -0
  6. package/dist/cli/config-policy.d.ts +11 -0
  7. package/dist/cli/config-policy.js +328 -0
  8. package/dist/cli/config-proactivity.d.ts +15 -0
  9. package/dist/cli/config-proactivity.js +129 -0
  10. package/dist/cli/config-shared.d.ts +6 -0
  11. package/dist/cli/config-shared.js +23 -0
  12. package/dist/cli/config-synonyms.d.ts +1 -0
  13. package/dist/cli/config-synonyms.js +60 -0
  14. package/dist/cli/config.d.ts +6 -24
  15. package/dist/cli/config.js +13 -670
  16. package/dist/finding-graph-id.d.ts +15 -0
  17. package/dist/finding-graph-id.js +58 -0
  18. package/dist/generated/memory-ui-graph.browser.js +15 -15
  19. package/dist/governance/activity.d.ts +36 -0
  20. package/dist/governance/activity.js +83 -0
  21. package/dist/governance/rbac.d.ts +17 -0
  22. package/dist/governance/rbac.js +37 -1
  23. package/dist/memory-ui-graph.runtime.js +15 -15
  24. package/dist/phren-paths.d.ts +6 -0
  25. package/dist/phren-paths.js +8 -0
  26. package/dist/shared/governance.d.ts +1 -0
  27. package/dist/shared/governance.js +1 -0
  28. package/dist/shared.d.ts +1 -1
  29. package/dist/shared.js +1 -1
  30. package/dist/tools/config.js +39 -2
  31. package/dist/tools/search.js +28 -1
  32. package/dist/ui/data.d.ts +2 -0
  33. package/dist/ui/data.js +8 -3
  34. package/dist/ui/graph.js +2 -0
  35. package/dist/ui/page.js +45 -2
  36. package/dist/ui/scripts.d.ts +13 -0
  37. package/dist/ui/scripts.js +229 -2
  38. package/dist/ui/server.js +165 -1
  39. package/dist/ui/styles.d.ts +1 -0
  40. package/dist/ui/styles.js +38 -0
  41. package/package.json +1 -1
  42. package/dist/cli-hooks-prompt.d.ts +0 -18
  43. package/dist/cli-hooks-prompt.js +0 -359
  44. package/dist/cli-hooks-session-handlers.d.ts +0 -3
  45. package/dist/cli-hooks-session-handlers.js +0 -356
  46. package/dist/cli-hooks-stop.d.ts +0 -11
  47. package/dist/cli-hooks-stop.js +0 -584
  48. package/dist/init-bootstrap.d.ts +0 -5
  49. package/dist/init-bootstrap.js +0 -21
  50. package/dist/init-detect.d.ts +0 -8
  51. package/dist/init-detect.js +0 -38
  52. package/dist/init-env.d.ts +0 -6
  53. package/dist/init-env.js +0 -114
  54. package/dist/init-fresh.d.ts +0 -10
  55. package/dist/init-fresh.js +0 -234
  56. package/dist/init-hooks.d.ts +0 -5
  57. package/dist/init-hooks.js +0 -26
  58. package/dist/init-mcp.d.ts +0 -8
  59. package/dist/init-mcp.js +0 -65
  60. package/dist/init-modes.d.ts +0 -4
  61. package/dist/init-modes.js +0 -135
  62. package/dist/init-npm.d.ts +0 -10
  63. package/dist/init-npm.js +0 -37
  64. package/dist/init-project-local.d.ts +0 -2
  65. package/dist/init-project-local.js +0 -99
  66. package/dist/init-semantic.d.ts +0 -4
  67. package/dist/init-semantic.js +0 -48
  68. package/dist/init-types.d.ts +0 -59
  69. package/dist/init-types.js +0 -1
  70. package/dist/init-update.d.ts +0 -10
  71. package/dist/init-update.js +0 -96
package/dist/ui/server.js CHANGED
@@ -10,10 +10,12 @@ import { getNonPrimaryStores, subscribeStoreProjects, unsubscribeStoreProjects }
10
10
  import { editFinding, readReviewQueue, removeFinding, readFindings, addFinding as addFindingStore, readTasksAcrossProjects, addTask as addTaskStore, completeTask as completeTaskStore, removeTask as removeTaskStore, updateTask as updateTaskStore, TASKS_FILENAME, FINDINGS_FILENAME, } from "../data/access.js";
11
11
  import { isValidProjectName, errorMessage, queueFilePath, safeProjectPath } from "../utils.js";
12
12
  import { readInstallPreferences, writeInstallPreferences, writeGovernanceInstallPreferences } from "../init/preferences.js";
13
- import { buildGraph, collectProjectsForUI, collectSkillsForUI, getHooksData, isAllowedSkillPath, readSyncSnapshot, recentAccepted, recentUsage, } from "./data.js";
13
+ import { buildGraph, collectProjectsForUI, collectSkillsForUI, getHooksData, isAllowedSkillPath, readSyncSnapshot, recentAccepted, recentLookups, recentUsage, } from "./data.js";
14
+ import { lookupEventsLogFile } from "../shared.js";
14
15
  import { CONSOLIDATION_ENTRY_THRESHOLD } from "../content/validate.js";
15
16
  import { ensureTopicReferenceDoc, getProjectTopicsResponse, listProjectReferenceDocs, pinProjectTopicSuggestion, readReferenceContent, reclassifyLegacyTopicDocs, unpinProjectTopicSuggestion, writeProjectTopics, } from "../project-topics.js";
16
17
  import { getWorkflowPolicy, updateWorkflowPolicy, mergeConfig, getRetentionPolicy, getProjectConfigOverrides, getIndexPolicy, updateIndexPolicy, VALID_TASK_MODES } from "../governance/policy.js";
18
+ import { setAccessRoles, ACCESS_ROLE_KEYS } from "../governance/rbac.js";
17
19
  import { readProjectConfig, updateProjectConfigOverrides } from "../project-config.js";
18
20
  import { buildConfigView } from "../config/resolve.js";
19
21
  import { CONFIG_DOMAINS } from "../config/schema.js";
@@ -372,6 +374,101 @@ function handleGetReviewQueue(res, ctx) {
372
374
  function handleGetReviewActivity(res, ctx) {
373
375
  jsonOk(res, { accepted: recentAccepted(ctx.phrenPath), usage: recentUsage(ctx.phrenPath) });
374
376
  }
377
+ /** Initial snapshot of recent memory lookups (newest first) for the Activity feed. */
378
+ function handleGetLookups(res, ctx) {
379
+ jsonOk(res, { ok: true, lookups: recentLookups(ctx.phrenPath, 40) });
380
+ }
381
+ /**
382
+ * Server-Sent Events stream of memory lookups. The server tails
383
+ * .runtime/lookup-events.jsonl and pushes each newly appended event to the
384
+ * browser, so the Activity tab lights up in real time as phren lands on
385
+ * memories. A short poll loop reads only appended bytes (robust across
386
+ * platforms vs. fs.watch); delivery to the client is push-based via SSE.
387
+ */
388
+ function handleLookupStream(req, res, ctx) {
389
+ res.writeHead(200, {
390
+ "Content-Type": "text/event-stream; charset=utf-8",
391
+ "Cache-Control": "no-cache, no-transform",
392
+ Connection: "keep-alive",
393
+ "X-Accel-Buffering": "no",
394
+ });
395
+ res.write("retry: 3000\n\n");
396
+ const logPath = lookupEventsLogFile(ctx.phrenPath);
397
+ // Start from the current end of the file so we only stream events that happen
398
+ // after the client connects (the initial snapshot comes from /api/lookups).
399
+ let offset = 0;
400
+ try {
401
+ offset = fs.existsSync(logPath) ? fs.statSync(logPath).size : 0;
402
+ }
403
+ catch {
404
+ offset = 0;
405
+ }
406
+ let carry = "";
407
+ const flushNew = () => {
408
+ let size;
409
+ try {
410
+ if (!fs.existsSync(logPath))
411
+ return;
412
+ size = fs.statSync(logPath).size;
413
+ }
414
+ catch {
415
+ return;
416
+ }
417
+ if (size < offset) {
418
+ offset = 0;
419
+ carry = "";
420
+ } // file rotated/truncated
421
+ if (size <= offset)
422
+ return;
423
+ let chunk = "";
424
+ try {
425
+ const fd = fs.openSync(logPath, "r");
426
+ try {
427
+ const buf = Buffer.alloc(size - offset);
428
+ fs.readSync(fd, buf, 0, buf.length, offset);
429
+ chunk = buf.toString("utf8");
430
+ }
431
+ finally {
432
+ fs.closeSync(fd);
433
+ }
434
+ }
435
+ catch {
436
+ return;
437
+ }
438
+ offset = size;
439
+ const lines = (carry + chunk).split("\n");
440
+ carry = lines.pop() ?? "";
441
+ for (const line of lines) {
442
+ const trimmed = line.trim();
443
+ if (!trimmed)
444
+ continue;
445
+ try {
446
+ JSON.parse(trimmed); // validate before forwarding
447
+ res.write(`data: ${trimmed}\n\n`);
448
+ }
449
+ catch {
450
+ // skip malformed lines
451
+ }
452
+ }
453
+ };
454
+ const pollTimer = setInterval(flushNew, 1000);
455
+ const heartbeat = setInterval(() => {
456
+ try {
457
+ res.write(": ping\n\n");
458
+ }
459
+ catch { /* connection gone */ }
460
+ }, 25000);
461
+ const cleanup = () => {
462
+ clearInterval(pollTimer);
463
+ clearInterval(heartbeat);
464
+ try {
465
+ res.end();
466
+ }
467
+ catch { /* already closed */ }
468
+ };
469
+ req.on("close", cleanup);
470
+ req.on("error", cleanup);
471
+ }
375
472
  function handleGetProjectContent(res, url, ctx) {
376
473
  const qs = parseQs(url);
377
474
  const project = String(qs.project || "");
@@ -869,6 +966,30 @@ function handlePostSettingsIndexPolicy(req, res, url, ctx) {
869
966
  jsonOk(res, result.ok ? { ok: true, indexPolicy: result.data } : { ok: false, error: result.error });
870
967
  });
871
968
  }
969
+ function handlePostSettingsAccess(req, res, url, ctx) {
970
+ withPostBody(req, res, url, ctx, (parsed) => {
971
+ const project = String(parsed.project || "").trim();
972
+ if (project && !isValidProjectName(project))
973
+ return jsonErr(res, "Invalid project name", 400);
974
+ const toList = (v) => (Array.isArray(v) ? v : String(v ?? "").split(","))
975
+ .map((s) => String(s).trim())
976
+ .filter(Boolean);
977
+ const patch = {};
978
+ for (const role of ACCESS_ROLE_KEYS) {
979
+ if (Object.prototype.hasOwnProperty.call(parsed, role))
980
+ patch[role] = toList(parsed[role]);
981
+ }
982
+ if (!Object.keys(patch).length)
983
+ return jsonErr(res, "Provide at least one of: admins, contributors, readers");
984
+ try {
985
+ const written = setAccessRoles(ctx.phrenPath, patch, project || undefined);
986
+ jsonOk(res, { ok: true, access: written });
987
+ }
988
+ catch (err) {
989
+ jsonErr(res, errorMessage(err));
990
+ }
991
+ });
992
+ }
872
993
  function handlePostSettingsMcpEnabled(req, res, url, ctx) {
873
994
  withPostBody(req, res, url, ctx, (parsed) => {
874
995
  const enabled = String(parsed.enabled || "").toLowerCase() === "true";
@@ -964,6 +1085,28 @@ function handlePostSettingsProjectOverrides(req, res, url, ctx) {
964
1085
  return jsonErr(res, result.error || "Failed to update retention policy", 500);
965
1086
  return jsonOk(res, { ok: true, retentionPolicy: result.data });
966
1087
  }
1088
+ else if (field.startsWith("decay.")) {
1089
+ const { updateRetentionPolicy } = require("../governance/policy.js");
1090
+ const point = field.slice("decay.".length);
1091
+ let updateData = {};
1092
+ if (!clearField) {
1093
+ const num = parseFloat(value);
1094
+ if (!Number.isFinite(num) || num < 0 || num > 1)
1095
+ throw new Error("Invalid value for " + field + " (must be 0-1)");
1096
+ updateData = { decay: { [point]: num } };
1097
+ }
1098
+ const result = updateRetentionPolicy(ctx.phrenPath, updateData);
1099
+ if (!result.ok)
1100
+ return jsonErr(res, result.error || "Failed to update retention policy", 500);
1101
+ return jsonOk(res, { ok: true, retentionPolicy: result.data });
1102
+ }
1103
+ else if (field === "riskySections") {
1104
+ const sections = (clearField ? [] : value.split(",").map((s) => s.trim()).filter(Boolean));
1105
+ const result = updateWorkflowPolicy(ctx.phrenPath, { riskySections: sections });
1106
+ if (!result.ok)
1107
+ return jsonErr(res, result.error || "Failed to update workflow policy", 500);
1108
+ return jsonOk(res, { ok: true, workflowPolicy: result.data });
1109
+ }
967
1110
  else if (NUMERIC_WORKFLOW_FIELDS.includes(field)) {
968
1111
  const { updateWorkflowPolicy } = require("../governance/policy.js");
969
1112
  let updateData = {};
@@ -1005,6 +1148,14 @@ function handlePostSettingsProjectOverrides(req, res, url, ctx) {
1005
1148
  if (next.retentionPolicy)
1006
1149
  delete next.retentionPolicy[field];
1007
1150
  }
1151
+ else if (field.startsWith("decay.")) {
1152
+ if (next.retentionPolicy?.decay)
1153
+ delete next.retentionPolicy.decay[field.slice("decay.".length)];
1154
+ }
1155
+ else if (field === "riskySections") {
1156
+ if (next.workflowPolicy)
1157
+ delete next.workflowPolicy.riskySections;
1158
+ }
1008
1159
  else if (NUMERIC_WORKFLOW_FIELDS.includes(field)) {
1009
1160
  if (next.workflowPolicy)
1010
1161
  delete next.workflowPolicy[field];
@@ -1022,6 +1173,16 @@ function handlePostSettingsProjectOverrides(req, res, url, ctx) {
1022
1173
  throw new Error(`Invalid numeric value for ${field}`);
1023
1174
  next.retentionPolicy = { ...next.retentionPolicy, [field]: num };
1024
1175
  }
1176
+ else if (field.startsWith("decay.")) {
1177
+ const num = parseFloat(value);
1178
+ if (!Number.isFinite(num) || num < 0 || num > 1)
1179
+ throw new Error(`Invalid value for ${field} (must be 0-1)`);
1180
+ next.retentionPolicy = { ...next.retentionPolicy, decay: { ...next.retentionPolicy?.decay, [field.slice("decay.".length)]: num } };
1181
+ }
1182
+ else if (field === "riskySections") {
1183
+ const sections = value.split(",").map((s) => s.trim()).filter(Boolean);
1184
+ next.workflowPolicy = { ...next.workflowPolicy, riskySections: sections };
1185
+ }
1025
1186
  else if (NUMERIC_WORKFLOW_FIELDS.includes(field)) {
1026
1187
  const num = parseFloat(value);
1027
1188
  if (!Number.isFinite(num) || num < 0 || num > 1)
@@ -1110,6 +1271,8 @@ export function createWebUiHttpServer(phrenPath, renderPage, profile, opts) {
1110
1271
  case "/api/runtime-health": return handleGetRuntimeHealth(res, ctx);
1111
1272
  case "/api/review-queue": return handleGetReviewQueue(res, ctx);
1112
1273
  case "/api/review-activity": return handleGetReviewActivity(res, ctx);
1274
+ case "/api/lookups": return handleGetLookups(res, ctx);
1275
+ case "/api/lookups/stream": return handleLookupStream(req, res, ctx);
1113
1276
  case "/api/project-topics": return handleGetProjectTopics(res, url, ctx);
1114
1277
  case "/api/project-reference-list": return handleGetProjectReferenceList(res, url, ctx);
1115
1278
  case "/api/project-reference-content": return handleGetProjectReferenceContent(res, url, ctx);
@@ -1161,6 +1324,7 @@ export function createWebUiHttpServer(phrenPath, renderPage, profile, opts) {
1161
1324
  case "/api/settings/auto-capture": return handlePostSettingsAutoCapture(req, res, url, ctx);
1162
1325
  case "/api/settings/mcp-enabled": return handlePostSettingsMcpEnabled(req, res, url, ctx);
1163
1326
  case "/api/settings/index-policy": return handlePostSettingsIndexPolicy(req, res, url, ctx);
1327
+ case "/api/settings/access": return handlePostSettingsAccess(req, res, url, ctx);
1164
1328
  case "/api/settings/project-overrides": return handlePostSettingsProjectOverrides(req, res, url, ctx);
1165
1329
  }
1166
1330
  // Prefix-matched write routes
@@ -2,3 +2,4 @@ export declare const PROJECT_REFERENCE_UI_STYLES = "\n .project-reference-shell
2
2
  export declare const SETTINGS_TAB_UI_STYLES = "\n .settings-shell {\n display: flex;\n flex-direction: column;\n gap: 18px;\n }\n .settings-section {\n border: 1px solid var(--border);\n border-radius: var(--radius);\n background: var(--surface);\n box-shadow: var(--shadow);\n overflow: hidden;\n }\n .settings-section-findings { border-top: 3px solid color-mix(in srgb, var(--accent) 60%, var(--border)); }\n .settings-section-behavior { border-top: 3px solid color-mix(in srgb, var(--blue) 45%, var(--border)); }\n .settings-section-integrations { border-top: 3px solid color-mix(in srgb, var(--purple) 45%, var(--border)); }\n .settings-section-header {\n padding: 16px 18px 12px;\n border-bottom: 1px solid var(--border-light);\n background: var(--surface);\n }\n .settings-section-header h3 {\n margin: 0;\n font-size: var(--text-md);\n font-weight: 700;\n letter-spacing: -0.02em;\n color: var(--ink);\n }\n .settings-section-header p {\n margin: 6px 0 0;\n color: var(--muted);\n font-size: var(--text-sm);\n line-height: 1.5;\n }\n .settings-section-body {\n padding: 18px;\n display: flex;\n flex-direction: column;\n gap: 16px;\n }\n .settings-control {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 12px;\n border: 1px solid var(--border-light);\n border-radius: var(--radius-sm);\n background: var(--surface-raised);\n }\n .settings-control-primary {\n background: color-mix(in srgb, var(--accent) 4%, var(--surface-raised));\n border-color: color-mix(in srgb, var(--accent) 18%, var(--border));\n }\n .settings-control-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n }\n .settings-control-label {\n font-size: var(--text-base);\n font-weight: 600;\n color: var(--ink-secondary);\n }\n .settings-control-note {\n color: var(--muted);\n font-size: var(--text-sm);\n line-height: 1.5;\n }\n .settings-control-value {\n color: var(--ink-secondary);\n font-size: var(--text-base);\n font-weight: 600;\n }\n .settings-chip-row {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n }\n .settings-chip {\n border: 1px solid var(--border);\n background: transparent;\n color: var(--ink-secondary);\n border-radius: 999px;\n padding: 6px 12px;\n cursor: pointer;\n font-size: var(--text-sm);\n font-family: var(--font);\n font-weight: 600;\n transition: background .15s, border-color .15s, color .15s;\n }\n .settings-chip:hover {\n border-color: var(--accent);\n color: var(--ink);\n }\n .settings-chip.active {\n border-color: var(--accent);\n background: var(--accent);\n color: #fff;\n }\n .settings-chip.readonly {\n cursor: default;\n opacity: 0.92;\n }\n .settings-chip.readonly:hover {\n border-color: var(--border);\n color: var(--ink-secondary);\n }\n .settings-chip.active.readonly:hover {\n border-color: var(--accent);\n color: #fff;\n }\n .settings-status-inline {\n min-height: 18px;\n font-size: var(--text-sm);\n color: var(--muted);\n }\n .settings-status-inline.ok { color: var(--success); }\n .settings-status-inline.err { color: var(--danger); }\n .settings-integrations-table {\n width: 100%;\n border-collapse: collapse;\n }\n .settings-integrations-table th,\n .settings-integrations-table td {\n text-align: left;\n padding: 10px 8px;\n border-bottom: 1px solid var(--border-light);\n font-size: var(--text-sm);\n vertical-align: middle;\n }\n .settings-integrations-table th {\n color: var(--muted);\n font-weight: 650;\n letter-spacing: 0.02em;\n text-transform: uppercase;\n font-size: var(--text-xs);\n }\n .settings-integrations-table tr:last-child td { border-bottom: none; }\n .settings-tool {\n display: flex;\n align-items: center;\n gap: 8px;\n font-weight: 600;\n color: var(--ink-secondary);\n text-transform: capitalize;\n }\n .settings-indicator {\n width: 9px;\n height: 9px;\n border-radius: 50%;\n display: inline-block;\n margin-right: 6px;\n }\n .settings-indicator.on { background: var(--success); }\n .settings-indicator.off { background: var(--danger); }\n";
3
3
  export declare const TASK_UI_STYLES = "\n /* \u2500\u2500 Task Manager Styles \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n .task-toolbar {\n display: flex;\n align-items: center;\n gap: 12px;\n margin-bottom: 20px;\n flex-wrap: wrap;\n }\n .task-filter-select {\n border: 1px solid var(--border);\n border-radius: var(--radius-sm);\n padding: 8px 12px;\n background: var(--surface);\n color: var(--ink);\n font-size: var(--text-sm);\n font-family: var(--font);\n cursor: pointer;\n transition: border-color 0.15s;\n }\n .task-filter-select:hover { border-color: var(--accent); }\n .task-filter-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }\n .task-count-label {\n font-size: var(--text-sm);\n color: var(--muted);\n margin-left: auto;\n font-weight: 500;\n }\n\n .task-empty-state {\n padding: 60px 40px;\n text-align: center;\n color: var(--muted);\n }\n\n .task-add-bar {\n display: flex;\n gap: 10px;\n margin-bottom: 20px;\n align-items: center;\n }\n .task-add-input {\n flex: 1;\n padding: 10px 14px;\n border: 1px solid var(--border);\n border-radius: var(--radius-sm);\n background: var(--surface);\n color: var(--ink);\n font-size: var(--text-base);\n font-family: var(--font);\n transition: border-color 0.15s, box-shadow 0.15s;\n }\n .task-add-input:focus {\n outline: none;\n border-color: var(--accent);\n box-shadow: 0 0 0 3px var(--accent-dim);\n }\n .task-add-input::placeholder { color: var(--muted); opacity: 0.6; }\n .task-add-btn {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 10px 18px;\n border: none;\n border-radius: var(--radius-sm);\n background: var(--accent);\n color: #fff;\n cursor: pointer;\n font-size: var(--text-sm);\n font-weight: 600;\n font-family: var(--font);\n transition: background 0.15s, transform 0.1s;\n white-space: nowrap;\n }\n .task-add-btn:hover { background: var(--accent-hover); }\n .task-add-btn:active { transform: scale(0.97); }\n\n .task-section-group { margin-bottom: 24px; }\n .task-section-header {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: var(--text-xs);\n font-weight: 700;\n color: var(--muted);\n text-transform: uppercase;\n letter-spacing: 0.06em;\n margin-bottom: 8px;\n padding: 0 4px;\n }\n .task-section-count {\n font-weight: 500;\n color: var(--muted);\n font-size: var(--text-xs);\n opacity: 0.7;\n }\n\n .task-list {\n display: flex;\n flex-direction: column;\n gap: 2px;\n border: 1px solid var(--border);\n border-radius: var(--radius);\n background: var(--surface);\n overflow: hidden;\n }\n\n .task-row {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 10px 14px;\n border-bottom: 1px solid var(--border-light);\n transition: background 0.1s;\n cursor: default;\n position: relative;\n }\n .task-row:last-child { border-bottom: none; }\n .task-row:hover { background: var(--surface-raised); }\n .task-row:hover .task-row-actions { opacity: 1; pointer-events: auto; }\n\n .task-row-priority {\n width: 4px;\n height: 24px;\n border-radius: 2px;\n flex-shrink: 0;\n }\n .task-row-priority-high { background: #ef4444; }\n .task-row-priority-medium { background: #f59e0b; }\n .task-row-priority-low { background: #9ca3af; }\n .task-row-priority-none { background: transparent; }\n\n .task-row-content {\n flex: 1;\n min-width: 0;\n display: flex;\n align-items: center;\n gap: 8px;\n }\n .task-row-text {\n font-size: var(--text-base);\n color: var(--ink);\n line-height: 1.4;\n word-break: break-word;\n }\n .task-row-done .task-row-text {\n text-decoration: line-through;\n opacity: 0.5;\n }\n .task-row-context {\n font-size: var(--text-xs);\n color: var(--muted);\n font-style: italic;\n margin-top: 2px;\n }\n\n .task-row-meta {\n display: flex;\n align-items: center;\n gap: 6px;\n flex-shrink: 0;\n }\n\n .task-priority-badge {\n display: inline-block;\n padding: 1px 7px;\n border-radius: 999px;\n font-size: 10px;\n font-weight: 600;\n text-transform: capitalize;\n }\n .task-priority-high { background: #ef444418; color: #ef4444; }\n .task-priority-medium { background: #f59e0b18; color: #f59e0b; }\n .task-priority-low { background: #6b728018; color: #6b7280; }\n\n .task-project-badge {\n display: inline-block;\n padding: 2px 8px;\n border-radius: var(--radius-sm);\n font-size: 10px;\n font-weight: 500;\n background: var(--accent-dim);\n color: var(--accent);\n }\n\n .task-pin-indicator {\n color: var(--accent);\n display: inline-flex;\n align-items: center;\n }\n\n .task-github-badge {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 2px 8px;\n border-radius: var(--radius-sm);\n font-size: 10px;\n font-weight: 500;\n background: var(--surface-sunken);\n color: var(--ink-secondary);\n text-decoration: none;\n transition: background 0.15s;\n }\n .task-github-badge:hover { background: var(--accent-dim); color: var(--accent); }\n\n .task-row-actions {\n display: flex;\n align-items: center;\n gap: 4px;\n opacity: 0;\n pointer-events: none;\n transition: opacity 0.15s;\n flex-shrink: 0;\n }\n .task-action-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border: 1px solid var(--border);\n border-radius: var(--radius-sm);\n background: var(--surface);\n color: var(--muted);\n cursor: pointer;\n font-size: 12px;\n font-family: var(--font);\n transition: all 0.15s;\n padding: 0;\n }\n .task-action-btn:hover {\n border-color: var(--accent);\n color: var(--accent);\n background: var(--accent-dim);\n }\n .task-action-btn.task-action-complete:hover {\n border-color: var(--success);\n color: var(--success);\n background: var(--success-dim);\n }\n .task-action-btn.task-action-delete:hover {\n border-color: var(--danger);\n color: var(--danger);\n background: var(--danger-dim);\n }\n\n .task-done-section { margin-top: 24px; }\n .task-done-toggle {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 10px 4px;\n background: none;\n border: none;\n color: var(--muted);\n font-size: var(--text-xs);\n font-weight: 700;\n font-family: var(--font);\n cursor: pointer;\n text-transform: uppercase;\n letter-spacing: 0.06em;\n transition: color 0.15s;\n }\n .task-done-toggle:hover { color: var(--ink-secondary); }\n .task-toggle-arrow {\n font-size: 10px;\n transition: transform 0.2s;\n }\n .task-done-list { padding-top: 4px; }\n\n /* \u2500\u2500 Task Summary Bar \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n .task-summary-bar {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 10px 14px;\n background: var(--surface-sunken, var(--surface));\n border: 1px solid var(--border);\n border-radius: var(--radius);\n margin-bottom: 16px;\n flex-wrap: wrap;\n font-size: var(--text-sm);\n }\n .task-summary-total {\n font-weight: 600;\n color: var(--ink);\n font-size: var(--text-base);\n }\n .task-summary-pill {\n display: inline-flex;\n align-items: center;\n padding: 2px 8px;\n border-radius: 999px;\n font-size: 11px;\n font-weight: 600;\n }\n .task-summary-high { background: #ef444422; color: #ef4444; }\n .task-summary-medium { background: #f59e0b22; color: #f59e0b; }\n .task-summary-low { background: #6b728022; color: #6b7280; }\n .task-summary-projects {\n display: flex;\n gap: 6px;\n align-items: center;\n }\n .task-summary-project {\n font-size: 11px;\n color: var(--muted);\n padding: 1px 6px;\n border: 1px solid var(--border);\n border-radius: var(--radius-sm);\n }\n\n /* \u2500\u2500 Task Session Badge \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n .task-session-badge {\n display: inline-block;\n padding: 1px 6px;\n border-radius: var(--radius-sm);\n font-size: 10px;\n font-family: var(--mono, monospace);\n background: var(--surface-sunken, var(--surface));\n color: var(--muted);\n border: 1px solid var(--border);\n }\n";
4
4
  export declare const REVIEW_UI_STYLES = "\n /* \u2500\u2500 Review Toolbar \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n .review-toolbar {\n display: flex;\n align-items: center;\n gap: 10px;\n margin-bottom: 16px;\n flex-wrap: wrap;\n }\n .review-flagged-toggle {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n font-size: var(--text-sm);\n font-weight: 500;\n color: var(--ink-secondary);\n cursor: pointer;\n user-select: none;\n }\n .review-flagged-toggle input[type=\"checkbox\"] {\n width: 14px;\n height: 14px;\n cursor: pointer;\n accent-color: var(--accent);\n }\n .review-sync-dot {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 22px;\n height: 22px;\n flex-shrink: 0;\n }\n .review-sync-indicator {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n background: var(--success);\n display: inline-block;\n transition: background 0.3s;\n }\n .review-sync-indicator.syncing {\n background: var(--warning);\n animation: ledPulse 1.2s infinite;\n }\n .review-sync-indicator.error {\n background: var(--danger);\n }\n /* \u2500\u2500 Review Card Highlight (keyboard shortcuts) \u2500\u2500\u2500\u2500 */\n .review-card-highlight {\n border: 2px solid var(--blue) !important;\n box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.08), var(--shadow) !important;\n background: color-mix(in srgb, var(--surface) 98%, var(--blue)) !important;\n }\n";
5
+ export declare const LAYOUT_VIEWPORT_STYLES = "\n /* Graph: fill the available viewport height instead of forcing 800px\n (which overflowed laptop-height screens), and frame it as a panel. */\n #graph-canvas {\n height: calc(100vh - 110px);\n min-height: 420px;\n }\n .graph-container {\n position: relative;\n border: 1px solid var(--border);\n border-radius: 10px;\n overflow: hidden;\n }\n\n /* Header nav: shrink and scroll internally on narrow widths so the header\n never pushes the page wider than the viewport. */\n .nav {\n min-width: 0;\n flex: 0 1 auto;\n overflow-x: auto;\n overflow-y: hidden;\n scrollbar-width: none;\n -ms-overflow-style: none;\n }\n .nav::-webkit-scrollbar { display: none; }\n .nav-item { flex: 0 0 auto; white-space: nowrap; }\n\n @media (max-width: 900px) {\n #graph-canvas { height: calc(100vh - 92px); min-height: 360px; }\n .header { gap: 12px; }\n .nav-item { padding: 0 12px; }\n }\n";
package/dist/ui/styles.js CHANGED
@@ -662,3 +662,41 @@ export const REVIEW_UI_STYLES = `
662
662
  background: color-mix(in srgb, var(--surface) 98%, var(--blue)) !important;
663
663
  }
664
664
  `;
665
+ /*
666
+ * Viewport refinements — appended LAST in the page <style> so these win the
667
+ * cascade over the base WEB_UI_STYLES. Keeps the layout fitting the viewport
668
+ * across desktop, laptop, and narrow widths without horizontal page scroll.
669
+ */
670
+ export const LAYOUT_VIEWPORT_STYLES = `
671
+ /* Graph: fill the available viewport height instead of forcing 800px
672
+ (which overflowed laptop-height screens), and frame it as a panel. */
673
+ #graph-canvas {
674
+ height: calc(100vh - 110px);
675
+ min-height: 420px;
676
+ }
677
+ .graph-container {
678
+ position: relative;
679
+ border: 1px solid var(--border);
680
+ border-radius: 10px;
681
+ overflow: hidden;
682
+ }
683
+
684
+ /* Header nav: shrink and scroll internally on narrow widths so the header
685
+ never pushes the page wider than the viewport. */
686
+ .nav {
687
+ min-width: 0;
688
+ flex: 0 1 auto;
689
+ overflow-x: auto;
690
+ overflow-y: hidden;
691
+ scrollbar-width: none;
692
+ -ms-overflow-style: none;
693
+ }
694
+ .nav::-webkit-scrollbar { display: none; }
695
+ .nav-item { flex: 0 0 auto; white-space: nowrap; }
696
+
697
+ @media (max-width: 900px) {
698
+ #graph-canvas { height: calc(100vh - 92px); min-height: 360px; }
699
+ .header { gap: 12px; }
700
+ .nav-item { padding: 0 12px; }
701
+ }
702
+ `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phren/cli",
3
- "version": "0.1.32",
3
+ "version": "0.1.33",
4
4
  "description": "Knowledge layer for AI agents — CLI, MCP server, and data layer",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,18 +0,0 @@
1
- export declare function handleHookContext(): Promise<void>;
2
- export declare function handleHookTool(): Promise<void>;
3
- interface LearningCandidate {
4
- text: string;
5
- confidence: number;
6
- explicit?: boolean;
7
- }
8
- export declare function filterToolFindingsForProactivity(candidates: Array<{
9
- text: string;
10
- confidence: number;
11
- explicit?: boolean;
12
- }>, level?: "high" | "medium" | "low"): Array<{
13
- text: string;
14
- confidence: number;
15
- explicit?: boolean;
16
- }>;
17
- export declare function extractToolFindings(toolName: string, input: Record<string, unknown>, responseStr: string, toolResponse?: unknown): LearningCandidate[];
18
- export {};