@fonlan/dsh-gitmemo 0.1.1 → 0.1.3

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/README.md CHANGED
@@ -26,7 +26,7 @@ work. Git is the only dependency, and no manual memory commands are ever needed.
26
26
  | `mem_init` | Initialize the `.mem` repository (all other tools auto-initialize) |
27
27
  | `mem_search` | Search memories: `keywords` (comma-separated), `skip` (pagination), `mode` (`and` / `or` / `auto` — AND first, OR fallback). Returns up to 20 hits as `hash\|title\|date` |
28
28
  | `mem_read` | Read one memory entry by commit hash (full markdown) |
29
- | `mem_write` | Store a task outcome: `title` + `content` (or `content_file` / `file`), optional `body` / `body_file`. Commits `.mem/entries/<timestamp>-<slug>.md` and aligns the `.mem` branch |
29
+ | `mem_write` | Store a task outcome: `title` + `content` (or `content_file` / `file`), optional inline `body` (commit body; engine API still supports `body_file`). Commits `.mem/entries/<timestamp>-<slug>.md` and aligns the `.mem` branch |
30
30
  | `mem_delete` | Delete a memory entry by commit hash (then redo and rewrite) |
31
31
  | Always-on rules section | The complete workflow rules (gitmemo's `agents-template.md` equivalent) are injected into **every** session's system prompt — no skill load needed |
32
32
  | Session-start injection | On every new **root** agent session, the N most recent memory titles (`hash\|title\|date`) are automatically injected into that session's system prompt, so prior-session context is visible before any tool call; subagents are skipped and the lookup never creates `.mem` |
package/README.zh.md CHANGED
@@ -26,7 +26,7 @@ markdown 条目存入项目根目录的本地 **`.mem`** Git 仓库,并在开
26
26
  | `mem_init` | 初始化 `.mem` 仓库(其余工具都会自动初始化) |
27
27
  | `mem_search` | 搜索记忆:`keywords`(逗号分隔)、`skip`(分页)、`mode`(`and` / `or` / `auto`,auto 先 AND 后 OR 兜底)。每次最多返回 20 条 `hash\|title\|date` |
28
28
  | `mem_read` | 按提交哈希读取一条记忆的完整 markdown |
29
- | `mem_write` | 存储任务结论:`title` + `content`(或 `content_file` / `file`),可选 `body` / `body_file`。提交为 `.mem/entries/<时间戳>-<slug>.md` 并对齐 `.mem` 分支 |
29
+ | `mem_write` | 存储任务结论:`title` + `content`(或 `content_file` / `file`),可选内联 `body`(commit body;引擎 API 仍支持 `body_file`)。提交为 `.mem/entries/<时间戳>-<slug>.md` 并对齐 `.mem` 分支 |
30
30
  | `mem_delete` | 按提交哈希删除记忆条目(然后重做并重写) |
31
31
  | 常驻规则片段 | 完整工作流规则(相当于 gitmemo 的 `agents-template.md`)注入**每个**会话的系统提示词——无需加载技能即可生效 |
32
32
  | 会话开始注入 | 每个新**根** Agent 会话开始时,自动把最近 N 条记忆标题(`hash\|title\|date`)注入该系统提示词,跨会话上下文在调用任何工具前即可见;子代理被跳过,且该查询只读、绝不创建 `.mem` |
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;
@@ -187,11 +191,7 @@ function registerMemTools(ctx, config) {
187
191
  },
188
192
  body: {
189
193
  type: "string",
190
- description: "Optional commit body: 1-3 sentence summary + metadata. Not memory content."
191
- },
192
- body_file: {
193
- type: "string",
194
- description: "Path to a file holding the commit body (alternative to body)."
194
+ description: "Optional commit body: 1-3 sentence summary + metadata, passed inline. Not memory content."
195
195
  }
196
196
  },
197
197
  output: {
@@ -206,15 +206,19 @@ function registerMemTools(ctx, config) {
206
206
  render: (_args, value) => textBlock("OK: " + value.hash + "|" + value.file)
207
207
  },
208
208
  isConcurrencySafe: () => false,
209
- async execute(args, exec) {
209
+ async execute(
210
+ // body_file is not model-facing anymore (removed from parameters above);
211
+ // it is still accepted here so legacy logged calls / direct dispatches map
212
+ // without breaking, and the engine still guards body vs body_file.
213
+ args, exec) {
210
214
  const memo = engineFor(exec, 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
@@ -430,7 +430,7 @@ export class GitMemo {
430
430
  throw new Error("gitmemo: write requires --title");
431
431
  }
432
432
  if (body !== undefined && bodyFile !== undefined)
433
- throw new Error("gitmemo: use only one of body or bodyFile");
433
+ throw new Error("gitmemo: use only one of body or body_file — pass the commit body inline via body and omit body_file");
434
434
  if (content !== undefined && contentFile !== undefined)
435
435
  throw new Error("gitmemo: use only one of content or contentFile");
436
436
  // Resolve optional payload paths against the engine root when relative.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fonlan/dsh-gitmemo",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
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": {