@fonlan/dsh-gitmemo 0.1.2 → 0.1.4

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/lib/index.js CHANGED
@@ -61,6 +61,10 @@ const SEARCH_HIT = {
61
61
  function textBlock(text) {
62
62
  return [{ type: "text", text }];
63
63
  }
64
+ /** Treat blank optional adapter values as omitted without weakening engine validation. */
65
+ function blankToUndefined(value) {
66
+ return value !== undefined && value.trim().length === 0 ? undefined : value;
67
+ }
64
68
  /** Register every model-facing tool. */
65
69
  function registerMemTools(ctx, config) {
66
70
  void config;
@@ -211,10 +215,10 @@ function registerMemTools(ctx, config) {
211
215
  return await memo.write({
212
216
  title: args.title,
213
217
  content: args.content,
214
- contentFile: args.content_file,
215
- file: args.file,
218
+ contentFile: blankToUndefined(args.content_file),
219
+ file: blankToUndefined(args.file),
216
220
  body: args.body,
217
- bodyFile: args.body_file
221
+ bodyFile: blankToUndefined(args.body_file)
218
222
  });
219
223
  },
220
224
  presentCall: (args) => ({
package/lib/mem.js CHANGED
@@ -118,6 +118,10 @@ function normalizeEntryFile(file, memDir, baseDir) {
118
118
  }
119
119
  return "entries/" + normalized;
120
120
  }
121
+ /** Treat blank optional path arguments as omitted. */
122
+ function blankToUndefined(value) {
123
+ return value !== undefined && value.trim().length === 0 ? undefined : value;
124
+ }
121
125
  /** Reject paths that could escape the memory repo. */
122
126
  function isSafeEntryPath(file) {
123
127
  if (file.startsWith("/") || file.includes("../") || file.endsWith("/..") || file.includes("\\") || file.includes(":")) {
@@ -425,7 +429,11 @@ export class GitMemo {
425
429
  */
426
430
  async write(options) {
427
431
  await ensureInit(this.memDir, this.config.gitTimeoutMs);
428
- const { title, content, contentFile, file, body, bodyFile } = options;
432
+ const { title, content } = options;
433
+ const contentFile = blankToUndefined(options.contentFile);
434
+ const file = blankToUndefined(options.file);
435
+ const body = options.body;
436
+ const bodyFile = blankToUndefined(options.bodyFile);
429
437
  if (title === undefined || title.trim().length === 0) {
430
438
  throw new Error("gitmemo: write requires --title");
431
439
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fonlan/dsh-gitmemo",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Git-backed long-term memory for DeepSeek Harness: a local .mem git repo with mem_search / mem_read / mem_write / mem_delete tools, auto-managed by the agent with zero manual steps.",
5
5
  "author": "fonlan",
6
6
  "publishConfig": {