@phren/cli 0.3.21 → 0.3.22

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.
@@ -110,7 +110,10 @@ export async function storeBlob(store, sha) {
110
110
  throw new BridgeError(400, "Invalid blob sha.");
111
111
  if ((await git(store, ["cat-file", "-t", sha]).catch(() => "")).trim() !== "blob")
112
112
  throw new BridgeError(404, "Unknown blob.");
113
- const { stdout } = await exec("git", ["-C", store, "cat-file", "blob", sha], { encoding: "buffer", maxBuffer: MAX_FILE * 4 });
113
+ const size = Number((await git(store, ["cat-file", "-s", sha])).trim());
114
+ if (size > MAX_FILE)
115
+ throw new BridgeError(413, "This store file exceeds the phone's 4 MiB limit. Archive or shorten it on the computer, then sync again.", { code: "store-file-too-large", size, limit: MAX_FILE });
116
+ const { stdout } = await exec("git", ["-C", store, "cat-file", "blob", sha], { encoding: "buffer", maxBuffer: MAX_FILE, timeout: 60_000 });
114
117
  return { sha, encoding: "base64", content: stdout.toString("base64") };
115
118
  }
116
119
  /** Resolve a store-relative path, refusing escapes, .git and symlinked parents. */
@@ -25352,7 +25352,7 @@ var init_package_metadata = __esm({
25352
25352
  __dirname = path15.dirname(fileURLToPath2(import.meta.url));
25353
25353
  ROOT = path15.join(__dirname, "..");
25354
25354
  PACKAGE_JSON_PATH = path15.join(ROOT, "package.json");
25355
- BUNDLED_VERSION = true ? "0.3.21" : "0.0.0";
25355
+ BUNDLED_VERSION = true ? "0.3.22" : "0.0.0";
25356
25356
  PACKAGE_JSON = readPackageJson();
25357
25357
  PACKAGE_NAME = PACKAGE_JSON.name || "phren";
25358
25358
  VERSION = PACKAGE_JSON.version || BUNDLED_VERSION;
@@ -57520,7 +57520,13 @@ async function storeTree(store, sha) {
57520
57520
  async function storeBlob(store, sha) {
57521
57521
  if (!SHA.test(sha)) throw new BridgeError(400, "Invalid blob sha.");
57522
57522
  if ((await git5(store, ["cat-file", "-t", sha]).catch(() => "")).trim() !== "blob") throw new BridgeError(404, "Unknown blob.");
57523
- const { stdout } = await exec19("git", ["-C", store, "cat-file", "blob", sha], { encoding: "buffer", maxBuffer: MAX_FILE * 4 });
57523
+ const size = Number((await git5(store, ["cat-file", "-s", sha])).trim());
57524
+ if (size > MAX_FILE) throw new BridgeError(
57525
+ 413,
57526
+ "This store file exceeds the phone's 4 MiB limit. Archive or shorten it on the computer, then sync again.",
57527
+ { code: "store-file-too-large", size, limit: MAX_FILE }
57528
+ );
57529
+ const { stdout } = await exec19("git", ["-C", store, "cat-file", "blob", sha], { encoding: "buffer", maxBuffer: MAX_FILE, timeout: 6e4 });
57524
57530
  return { sha, encoding: "base64", content: stdout.toString("base64") };
57525
57531
  }
57526
57532
  async function storeFile(store, relative3) {
@@ -60944,7 +60950,7 @@ async function readSecret(prompt) {
60944
60950
  // src/bridge/hook-main.ts
60945
60951
  init_utils_helpers();
60946
60952
  Object.assign(process.env, nonInteractiveGitEnv());
60947
- runBridge(process.argv.slice(2), "0.3.21").then((code) => {
60953
+ runBridge(process.argv.slice(2), "0.3.22").then((code) => {
60948
60954
  process.exitCode = code;
60949
60955
  }).catch((error62) => {
60950
60956
  console.error(error62 instanceof Error ? error62.message : "Phren Hook failed.");
@@ -635,8 +635,13 @@ export function updateTask(phrenPath, project, match, updates) {
635
635
  if (updates.context) {
636
636
  if (updates.replace_context || !item.context)
637
637
  item.context = updates.context;
638
- else
638
+ // Agents sometimes send the existing context with their new note. Do
639
+ // not append the complete history to itself on every such update.
640
+ else if (updates.context.startsWith(`${item.context}; `))
641
+ item.context = updates.context;
642
+ else if (updates.context !== item.context && !item.context.endsWith(`; ${updates.context}`)) {
639
643
  item.context = `${item.context}; ${updates.context}`;
644
+ }
640
645
  changes.push("context updated");
641
646
  }
642
647
  if (updates.unlink_github) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phren/cli",
3
- "version": "0.3.21",
3
+ "version": "0.3.22",
4
4
  "description": "Knowledge layer for AI agents - CLI, MCP server, and data layer",
5
5
  "type": "module",
6
6
  "bin": {