@phren/cli 0.3.6 → 0.3.7

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.
@@ -173,7 +173,14 @@ export function opencodePermissionDialog(ansi) {
173
173
  // Lines pushed far right are OpenCode's status column, not the question.
174
174
  const body = plain.slice(header + 1, row).map(content)
175
175
  .filter(line => line.trim() && !/^\s{24,}/.test(line)).map(line => line.trim());
176
- const title = ["Permission required", ...body].join("\n").slice(0, 4_000);
176
+ // "← Access external directory ~/apps" is what it asks; a "Patterns" list
177
+ // under it is what it applies to, one "- " line each.
178
+ const [asks, ...rest] = body;
179
+ const title = (asks?.replace(/^[←→]\s*/, "") || "Permission required").slice(0, 4_000);
180
+ const patterns = rest.indexOf("Patterns");
181
+ const details = patterns < 0 ? rest
182
+ : [...rest.slice(0, patterns), ...rest.slice(patterns + 1).map(line => line.replace(/^-\s+/, ""))];
183
+ const detail = details.join("\n").slice(0, 4_000);
177
184
  const backgrounds = OPENCODE_OPTIONS.map(label => {
178
185
  const at = raw[row].indexOf(label);
179
186
  if (at < 0)
@@ -183,7 +190,7 @@ export function opencodePermissionDialog(ansi) {
183
190
  });
184
191
  const unique = backgrounds.flatMap((background, index) => background !== undefined && backgrounds.filter(other => other === background).length === 1 ? [index] : []);
185
192
  const selected = unique.length === 1 && backgrounds.every(background => background !== undefined) ? unique[0] : undefined;
186
- return { choice: { title, options: [{ label: "Allow once", key: "1", hasKey: false }, { label: "Reject", key: "Escape", hasKey: true }],
193
+ return { choice: { title, ...(detail ? { body: detail } : {}), options: [{ label: "Allow once", key: "1", hasKey: false }, { label: "Reject", key: "Escape", hasKey: true }],
187
194
  ...(selected === 0 ? { highlightedIndex: 0 } : {}) }, ...(selected !== undefined ? { selected } : {}) };
188
195
  }
189
196
  /** The pane's last non-empty line is a password read: sudo's "[sudo] password
@@ -1,4 +1,5 @@
1
1
  import { type Json } from "./protocol.js";
2
- /** Copilot's transcript reader: public message, tool and usage events, with
3
- * optional reasoning fields dropped. */
2
+ /** Copilot's transcript reader: public message, tool and usage events, and
3
+ * the reasoning summary Copilot itself prints under "Thought for Ns". Its
4
+ * encrypted and opaque reasoning stays out. */
4
5
  export declare function visibleCopilotEvent(raw: Json): Json | undefined;
@@ -1,14 +1,33 @@
1
1
  import { object } from "./protocol.js";
2
- /** Copilot's transcript reader: public message, tool and usage events, with
3
- * optional reasoning fields dropped. */
2
+ /** Copilot's transcript reader: public message, tool and usage events, and
3
+ * the reasoning summary Copilot itself prints under "Thought for Ns". Its
4
+ * encrypted and opaque reasoning stays out. */
4
5
  export function visibleCopilotEvent(raw) {
5
- if (raw.agentId || raw.ephemeral || !["user.message", "assistant.message", "assistant.message_delta", "tool.execution_start", "tool.execution_complete", "assistant.turn_start", "assistant.turn_end", "session.idle", "abort", "session.error", "session.usage_info", "assistant.usage"].includes(String(raw.type)))
6
+ if (raw.agentId || raw.ephemeral)
7
+ return undefined;
8
+ // What a skill loaded: Copilot answers the `skill` call with only "Skill
9
+ // loaded", then writes the SKILL.md it put in context as `skill.invoked`.
10
+ if (raw.type === "skill.invoked") {
11
+ const data = object(raw.data);
12
+ if (typeof data.name !== "string" || typeof data.content !== "string")
13
+ return undefined;
14
+ return { type: raw.type, timestamp: raw.timestamp, data: { name: data.name.slice(0, 200), content: data.content.slice(0, 65_536),
15
+ ...(typeof data.description === "string" ? { description: data.description.slice(0, 1_000) } : {}) } };
16
+ }
17
+ if (!["user.message", "assistant.message", "assistant.message_delta", "tool.execution_start", "tool.execution_complete", "assistant.turn_start", "assistant.turn_end", "session.idle", "abort", "session.error", "session.usage_info", "assistant.usage"].includes(String(raw.type)))
6
18
  return undefined;
7
19
  const data = object(raw.data);
8
- // Copilot includes optional reasoning beside the public message in some
9
- // versions. Export only the fields used by public text/tool/usage readers.
20
+ // Copilot writes its reasoning beside the message three ways: the summary
21
+ // its terminal shows (`reasoningText`), and encrypted/opaque copies for the
22
+ // model (`encryptedContent`, `reasoningOpaque`, `reasoningBlocks`). Only the
23
+ // summary the person already sees in the terminal is exported.
10
24
  // `phase` marks Copilot 1.0.87's final answer (it writes no session.idle);
11
25
  // `success` is false on a failed tool run.
12
- const allowed = ["content", "source", "messageId", "deltaContent", "toolName", "toolCallId", "arguments", "result", "error", "success", "phase", "aborted", "inputTokens", "outputTokens", "cacheReadTokens"];
13
- return { type: raw.type, timestamp: raw.timestamp, data: Object.fromEntries(Object.entries(data).filter(([key]) => allowed.includes(key))) };
26
+ const allowed = ["content", "source", "messageId", "deltaContent", "toolName", "toolCallId", "arguments", "result", "error", "success", "phase", "aborted", "reasoningText", "mcpServerName", "mcpToolName", "inputTokens", "outputTokens", "cacheReadTokens"];
27
+ return { type: raw.type, timestamp: raw.timestamp, data: Object.fromEntries(Object.entries(data)
28
+ // The MCP server and tool a call went to (`phren` + `get_tasks` for the
29
+ // `phren-get_tasks` tool), so the phone draws the server's own card.
30
+ .filter(([key, value]) => allowed.includes(key) && (key !== "reasoningText" || (raw.type === "assistant.message" && typeof value === "string"))
31
+ && (!["mcpServerName", "mcpToolName"].includes(key) || (typeof value === "string" && value.length <= 200)))
32
+ .map(([key, value]) => [key, key === "reasoningText" ? String(value).slice(0, 8_000) : value])) };
14
33
  }
@@ -22258,10 +22258,20 @@ var init_transcript_codex = __esm({
22258
22258
 
22259
22259
  // src/bridge/transcript-copilot.ts
22260
22260
  function visibleCopilotEvent(raw) {
22261
- if (raw.agentId || raw.ephemeral || !["user.message", "assistant.message", "assistant.message_delta", "tool.execution_start", "tool.execution_complete", "assistant.turn_start", "assistant.turn_end", "session.idle", "abort", "session.error", "session.usage_info", "assistant.usage"].includes(String(raw.type))) return void 0;
22261
+ if (raw.agentId || raw.ephemeral) return void 0;
22262
+ if (raw.type === "skill.invoked") {
22263
+ const data2 = object2(raw.data);
22264
+ if (typeof data2.name !== "string" || typeof data2.content !== "string") return void 0;
22265
+ return { type: raw.type, timestamp: raw.timestamp, data: {
22266
+ name: data2.name.slice(0, 200),
22267
+ content: data2.content.slice(0, 65536),
22268
+ ...typeof data2.description === "string" ? { description: data2.description.slice(0, 1e3) } : {}
22269
+ } };
22270
+ }
22271
+ if (!["user.message", "assistant.message", "assistant.message_delta", "tool.execution_start", "tool.execution_complete", "assistant.turn_start", "assistant.turn_end", "session.idle", "abort", "session.error", "session.usage_info", "assistant.usage"].includes(String(raw.type))) return void 0;
22262
22272
  const data = object2(raw.data);
22263
- const allowed = ["content", "source", "messageId", "deltaContent", "toolName", "toolCallId", "arguments", "result", "error", "success", "phase", "aborted", "inputTokens", "outputTokens", "cacheReadTokens"];
22264
- return { type: raw.type, timestamp: raw.timestamp, data: Object.fromEntries(Object.entries(data).filter(([key2]) => allowed.includes(key2))) };
22273
+ const allowed = ["content", "source", "messageId", "deltaContent", "toolName", "toolCallId", "arguments", "result", "error", "success", "phase", "aborted", "reasoningText", "mcpServerName", "mcpToolName", "inputTokens", "outputTokens", "cacheReadTokens"];
22274
+ return { type: raw.type, timestamp: raw.timestamp, data: Object.fromEntries(Object.entries(data).filter(([key2, value2]) => allowed.includes(key2) && (key2 !== "reasoningText" || raw.type === "assistant.message" && typeof value2 === "string") && (!["mcpServerName", "mcpToolName"].includes(key2) || typeof value2 === "string" && value2.length <= 200)).map(([key2, value2]) => [key2, key2 === "reasoningText" ? String(value2).slice(0, 8e3) : value2])) };
22265
22275
  }
22266
22276
  var init_transcript_copilot = __esm({
22267
22277
  "src/bridge/transcript-copilot.ts"() {
@@ -28307,7 +28317,7 @@ var init_package_metadata = __esm({
28307
28317
  __dirname = path24.dirname(fileURLToPath2(import.meta.url));
28308
28318
  ROOT = path24.join(__dirname, "..");
28309
28319
  PACKAGE_JSON_PATH = path24.join(ROOT, "package.json");
28310
- BUNDLED_VERSION = true ? "0.3.6" : "0.0.0";
28320
+ BUNDLED_VERSION = true ? "0.3.7" : "0.0.0";
28311
28321
  PACKAGE_JSON = readPackageJson();
28312
28322
  PACKAGE_NAME = PACKAGE_JSON.name || "phren";
28313
28323
  VERSION = PACKAGE_JSON.version || BUNDLED_VERSION;
@@ -32641,7 +32651,11 @@ function opencodePermissionDialog(ansi) {
32641
32651
  const row = plain2.findIndex((line, index2) => index2 > header2 && OPENCODE_OPTIONS.every((label2) => line.includes(label2)));
32642
32652
  if (row < 0 || row - header2 > 24) return void 0;
32643
32653
  const body2 = plain2.slice(header2 + 1, row).map(content).filter((line) => line.trim() && !/^\s{24,}/.test(line)).map((line) => line.trim());
32644
- const title = ["Permission required", ...body2].join("\n").slice(0, 4e3);
32654
+ const [asks, ...rest] = body2;
32655
+ const title = (asks?.replace(/^[←→]\s*/, "") || "Permission required").slice(0, 4e3);
32656
+ const patterns = rest.indexOf("Patterns");
32657
+ const details = patterns < 0 ? rest : [...rest.slice(0, patterns), ...rest.slice(patterns + 1).map((line) => line.replace(/^-\s+/, ""))];
32658
+ const detail = details.join("\n").slice(0, 4e3);
32645
32659
  const backgrounds = OPENCODE_OPTIONS.map((label2) => {
32646
32660
  const at = raw[row].indexOf(label2);
32647
32661
  if (at < 0) return void 0;
@@ -32652,6 +32666,7 @@ function opencodePermissionDialog(ansi) {
32652
32666
  const selected = unique.length === 1 && backgrounds.every((background) => background !== void 0) ? unique[0] : void 0;
32653
32667
  return { choice: {
32654
32668
  title,
32669
+ ...detail ? { body: detail } : {},
32655
32670
  options: [{ label: "Allow once", key: "1", hasKey: false }, { label: "Reject", key: "Escape", hasKey: true }],
32656
32671
  ...selected === 0 ? { highlightedIndex: 0 } : {}
32657
32672
  }, ...selected !== void 0 ? { selected } : {} };
@@ -50515,7 +50530,7 @@ async function readSecret(prompt) {
50515
50530
  // src/bridge/hook-main.ts
50516
50531
  init_utils_helpers();
50517
50532
  Object.assign(process.env, nonInteractiveGitEnv());
50518
- runBridge(process.argv.slice(2), "0.3.6").then((code) => {
50533
+ runBridge(process.argv.slice(2), "0.3.7").then((code) => {
50519
50534
  process.exitCode = code;
50520
50535
  }).catch((error62) => {
50521
50536
  console.error(error62 instanceof Error ? error62.message : "Phren Hook failed.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phren/cli",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "description": "Knowledge layer for AI agents - CLI, MCP server, and data layer",
5
5
  "type": "module",
6
6
  "bin": {