@phren/cli 0.3.44 → 0.3.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.
@@ -29,7 +29,7 @@ import { resolveFilePath } from "./file-resolve.js";
29
29
  import { storeRoute } from "./memory-store.js";
30
30
  import { memoryForFiles, memorySearch, PROJECT_MEMORY_ROUTE, projectMemory, saveFinding, tasksForBranch, completeProjectTask } from "./project-memory.js";
31
31
  import { PROJECT_GIT_ROUTE, projectGit } from "./project-git.js";
32
- import { liveBackground, markBackground, paneRecord, recordTitle } from "./session-activity.js";
32
+ import { liveBackground, markBackground, paneRecord, recordTitle, replyExcerpt } from "./session-activity.js";
33
33
  import { paneAccountField, paneChatState, panes, rpc, servers, snapshot, validateTarget, workspaceSnapshot } from "./herdr.js";
34
34
  import { locateProject } from "./locate.js";
35
35
  import { gitStatus } from "./git.js";
@@ -210,6 +210,10 @@ export function workspacesReader(ctx) {
210
210
  return;
211
211
  Object.assign(tab, stall);
212
212
  tab.title = title;
213
+ // What a finished turn said last; a row still working (background work) has no last word yet.
214
+ const reply = tab.agentStatus === "working" ? undefined : replyExcerpt(record);
215
+ if (reply)
216
+ tab.lastReply = reply;
213
217
  }));
214
218
  // Separate bounded queues: a stalled git/model/step read cannot prevent
215
219
  // the child tree from reaching the phone. Apply each answer as it arrives.
@@ -72,6 +72,16 @@ export declare function liveBackground(record: TurnRecord | undefined, readFinal
72
72
  * sits on a tab with a live turn.
73
73
  */
74
74
  export declare function markBackground(tab: Json, count: number | undefined): void;
75
+ /** How much of a turn's last reply a session row carries. */
76
+ export declare const REPLY_EXCERPT_CHARS = 240;
77
+ /**
78
+ * The ended turn's last reply as one short line for a session row
79
+ * (`lastReply`): what the agent said before it stopped, so a waiting row can
80
+ * say what it waits for. Markdown emphasis, headings and code fences are
81
+ * dropped and whitespace collapsed. Undefined while a turn runs (its prompt
82
+ * is newer than the Stop) or when the Stop carried no reply.
83
+ */
84
+ export declare function replyExcerpt(record: TurnRecord | undefined): string | undefined;
75
85
  /** A tab or workspace label worth showing as a name: not empty, not Herdr's bare numbering, not an id. */
76
86
  export declare function meaningfulLabel(value: unknown): string | undefined;
77
87
  /** A terminal title without the spinner or status glyphs around it, nor the
@@ -122,6 +122,31 @@ export function markBackground(tab, count) {
122
122
  else if (typeof tab.backgroundTasks === "number")
123
123
  tab.backgroundTasks = Math.max(tab.backgroundTasks, count);
124
124
  }
125
+ /** How much of a turn's last reply a session row carries. */
126
+ export const REPLY_EXCERPT_CHARS = 240;
127
+ /**
128
+ * The ended turn's last reply as one short line for a session row
129
+ * (`lastReply`): what the agent said before it stopped, so a waiting row can
130
+ * say what it waits for. Markdown emphasis, headings and code fences are
131
+ * dropped and whitespace collapsed. Undefined while a turn runs (its prompt
132
+ * is newer than the Stop) or when the Stop carried no reply.
133
+ */
134
+ export function replyExcerpt(record) {
135
+ if (!record)
136
+ return undefined;
137
+ const phase = turnPhase(record);
138
+ if (phase.phase !== "ended" || !phase.reply)
139
+ return undefined;
140
+ const line = phase.reply
141
+ .replace(/```[\s\S]*?(```|$)/g, " ")
142
+ .replace(/(^|\n)\s*(#{1,6}|>|[-*+]|\d+\.)\s+/g, "$1")
143
+ .replace(/(\*\*|__|\*|`)/g, "")
144
+ .replace(/\s+/g, " ")
145
+ .trim();
146
+ if (!line)
147
+ return undefined;
148
+ return line.length > REPLY_EXCERPT_CHARS ? `${line.slice(0, REPLY_EXCERPT_CHARS - 1).trimEnd()}…` : line;
149
+ }
125
150
  /** A tab or workspace label worth showing as a name: not empty, not Herdr's bare numbering, not an id. */
126
151
  export function meaningfulLabel(value) {
127
152
  if (typeof value !== "string")
@@ -29611,6 +29611,14 @@ function markBackground(tab, count2) {
29611
29611
  tab.backgroundTasks = count2;
29612
29612
  } else if (typeof tab.backgroundTasks === "number") tab.backgroundTasks = Math.max(tab.backgroundTasks, count2);
29613
29613
  }
29614
+ function replyExcerpt(record4) {
29615
+ if (!record4) return void 0;
29616
+ const phase = turnPhase(record4);
29617
+ if (phase.phase !== "ended" || !phase.reply) return void 0;
29618
+ const line = phase.reply.replace(/```[\s\S]*?(```|$)/g, " ").replace(/(^|\n)\s*(#{1,6}|>|[-*+]|\d+\.)\s+/g, "$1").replace(/(\*\*|__|\*|`)/g, "").replace(/\s+/g, " ").trim();
29619
+ if (!line) return void 0;
29620
+ return line.length > REPLY_EXCERPT_CHARS ? `${line.slice(0, REPLY_EXCERPT_CHARS - 1).trimEnd()}\u2026` : line;
29621
+ }
29614
29622
  function meaningfulLabel(value2) {
29615
29623
  if (typeof value2 !== "string") return void 0;
29616
29624
  const text5 = value2.trim();
@@ -29639,7 +29647,7 @@ async function recordTitle(record4, input2) {
29639
29647
  const dispatch2 = record4?.dispatch;
29640
29648
  return sessionTitle({ ...input2, dispatched: !!dispatch2, dispatchLabel: dispatch2 ? await briefLabel(dispatch2) : void 0 });
29641
29649
  }
29642
- var BACKGROUND_STALE_MS, GLYPHS_AROUND;
29650
+ var BACKGROUND_STALE_MS, REPLY_EXCERPT_CHARS, GLYPHS_AROUND;
29643
29651
  var init_session_activity = __esm({
29644
29652
  "src/bridge/session-activity.ts"() {
29645
29653
  "use strict";
@@ -29647,6 +29655,7 @@ var init_session_activity = __esm({
29647
29655
  init_protocol();
29648
29656
  init_turn_records();
29649
29657
  BACKGROUND_STALE_MS = 2 * 60 * 60 * 1e3;
29658
+ REPLY_EXCERPT_CHARS = 240;
29650
29659
  GLYPHS_AROUND = /^[\u2800-\u28ff\u2700-\u27bf\u25a0-\u25ff\u23f0-\u23ff\u2022\u00b7\u2219\u22c5\u2605\u2606\s]+|[\s\u2800-\u28ff\u2700-\u27bf\u25a0-\u25ff\u23f0-\u23ff\u2022\u00b7\u2219\u22c5\u2605\u2606]+$/gu;
29651
29660
  }
29652
29661
  });
@@ -37852,7 +37861,7 @@ var init_package_metadata = __esm({
37852
37861
  __dirname = path37.dirname(fileURLToPath2(import.meta.url));
37853
37862
  ROOT = path37.join(__dirname, "..");
37854
37863
  PACKAGE_JSON_PATH = path37.join(ROOT, "package.json");
37855
- BUNDLED_VERSION = true ? "0.3.44" : "0.0.0";
37864
+ BUNDLED_VERSION = true ? "0.3.45" : "0.0.0";
37856
37865
  PACKAGE_JSON = readPackageJson();
37857
37866
  PACKAGE_NAME = PACKAGE_JSON.name || "phren";
37858
37867
  VERSION = PACKAGE_JSON.version || BUNDLED_VERSION;
@@ -73153,6 +73162,8 @@ function workspacesReader(ctx) {
73153
73162
  if (expired) return;
73154
73163
  Object.assign(tab, stall);
73155
73164
  tab.title = title2;
73165
+ const reply = tab.agentStatus === "working" ? void 0 : replyExcerpt(record4);
73166
+ if (reply) tab.lastReply = reply;
73156
73167
  }));
73157
73168
  const eachTab = (read) => {
73158
73169
  let next = 0;
@@ -75661,7 +75672,7 @@ async function main() {
75661
75672
  return askpass2(args[1]);
75662
75673
  }
75663
75674
  const { runBridge: runBridge2 } = await Promise.resolve().then(() => (init_command(), command_exports));
75664
- return runBridge2(args, "0.3.44");
75675
+ return runBridge2(args, "0.3.45");
75665
75676
  }
75666
75677
  main().then((code) => {
75667
75678
  process.exitCode = code;
package/dist/link/link.js CHANGED
@@ -200,7 +200,12 @@ function symlinkFile(src, dest, managedRoot) {
200
200
  const resolvedTarget = path.resolve(path.dirname(dest), currentTarget);
201
201
  if (resolvedTarget === path.resolve(src))
202
202
  return true;
203
- if (!isManagedSymlink(dest, managedRoot)) {
203
+ // A dangling link into the retired ~/.cortex store is ours too: nothing
204
+ // else can resolve it, and leaving it fails doctor on every machine
205
+ // that predates the rename.
206
+ const legacyDangling = !fs.existsSync(dest)
207
+ && resolvedTarget.split(path.sep).includes(".cortex");
208
+ if (!legacyDangling && !isManagedSymlink(dest, managedRoot)) {
204
209
  log(` preserve existing symlink: ${dest}`);
205
210
  return false;
206
211
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phren/cli",
3
- "version": "0.3.44",
3
+ "version": "0.3.45",
4
4
  "description": "Knowledge layer for AI agents - CLI, MCP server, and data layer",
5
5
  "type": "module",
6
6
  "bin": {