@jcode.labs/ragmir 2.16.2 → 2.17.1

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.
Files changed (102) hide show
  1. package/README.md +37 -172
  2. package/dist/access-log.d.ts +1 -0
  3. package/dist/access-log.d.ts.map +1 -1
  4. package/dist/access-log.js +57 -24
  5. package/dist/access-log.js.map +1 -1
  6. package/dist/cli.js +15 -1
  7. package/dist/cli.js.map +1 -1
  8. package/dist/client.d.ts +3 -3
  9. package/dist/client.d.ts.map +1 -1
  10. package/dist/client.js +4 -4
  11. package/dist/client.js.map +1 -1
  12. package/dist/config.js +6 -14
  13. package/dist/config.js.map +1 -1
  14. package/dist/context-resources.d.ts +3 -3
  15. package/dist/context-resources.d.ts.map +1 -1
  16. package/dist/context-resources.js +13 -4
  17. package/dist/context-resources.js.map +1 -1
  18. package/dist/destroy.d.ts.map +1 -1
  19. package/dist/destroy.js +10 -6
  20. package/dist/destroy.js.map +1 -1
  21. package/dist/doctor.d.ts +2 -2
  22. package/dist/doctor.d.ts.map +1 -1
  23. package/dist/doctor.js +11 -3
  24. package/dist/doctor.js.map +1 -1
  25. package/dist/embeddings.d.ts +4 -0
  26. package/dist/embeddings.d.ts.map +1 -1
  27. package/dist/embeddings.js +68 -9
  28. package/dist/embeddings.js.map +1 -1
  29. package/dist/evaluate.d.ts +5 -0
  30. package/dist/evaluate.d.ts.map +1 -1
  31. package/dist/evaluate.js +50 -9
  32. package/dist/evaluate.js.map +1 -1
  33. package/dist/files.d.ts +3 -10
  34. package/dist/files.d.ts.map +1 -1
  35. package/dist/files.js +49 -15
  36. package/dist/files.js.map +1 -1
  37. package/dist/index.d.ts +2 -1
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +1 -0
  40. package/dist/index.js.map +1 -1
  41. package/dist/ingest.d.ts +2 -2
  42. package/dist/ingest.d.ts.map +1 -1
  43. package/dist/ingest.js +356 -163
  44. package/dist/ingest.js.map +1 -1
  45. package/dist/ingestion-state.d.ts +53 -0
  46. package/dist/ingestion-state.d.ts.map +1 -0
  47. package/dist/ingestion-state.js +257 -0
  48. package/dist/ingestion-state.js.map +1 -0
  49. package/dist/mcp-output.d.ts +14 -0
  50. package/dist/mcp-output.d.ts.map +1 -1
  51. package/dist/mcp-output.js +121 -0
  52. package/dist/mcp-output.js.map +1 -1
  53. package/dist/mcp.d.ts +8 -0
  54. package/dist/mcp.d.ts.map +1 -1
  55. package/dist/mcp.js +362 -116
  56. package/dist/mcp.js.map +1 -1
  57. package/dist/ocr.d.ts.map +1 -1
  58. package/dist/ocr.js +6 -12
  59. package/dist/ocr.js.map +1 -1
  60. package/dist/operation.d.ts.map +1 -1
  61. package/dist/operation.js +3 -2
  62. package/dist/operation.js.map +1 -1
  63. package/dist/parsing.d.ts +1 -0
  64. package/dist/parsing.d.ts.map +1 -1
  65. package/dist/parsing.js +86 -27
  66. package/dist/parsing.js.map +1 -1
  67. package/dist/project-config-file.d.ts +11 -0
  68. package/dist/project-config-file.d.ts.map +1 -0
  69. package/dist/project-config-file.js +55 -0
  70. package/dist/project-config-file.js.map +1 -0
  71. package/dist/query.d.ts.map +1 -1
  72. package/dist/query.js +12 -4
  73. package/dist/query.js.map +1 -1
  74. package/dist/research.d.ts.map +1 -1
  75. package/dist/research.js +3 -2
  76. package/dist/research.js.map +1 -1
  77. package/dist/security.d.ts +2 -2
  78. package/dist/security.d.ts.map +1 -1
  79. package/dist/security.js +57 -21
  80. package/dist/security.js.map +1 -1
  81. package/dist/semantic-config.d.ts.map +1 -1
  82. package/dist/semantic-config.js +16 -20
  83. package/dist/semantic-config.js.map +1 -1
  84. package/dist/skill.d.ts +2 -13
  85. package/dist/skill.d.ts.map +1 -1
  86. package/dist/skill.js.map +1 -1
  87. package/dist/sources.d.ts.map +1 -1
  88. package/dist/sources.js +24 -40
  89. package/dist/sources.js.map +1 -1
  90. package/dist/store.d.ts +5 -0
  91. package/dist/store.d.ts.map +1 -1
  92. package/dist/store.js +45 -13
  93. package/dist/store.js.map +1 -1
  94. package/dist/types.d.ts +39 -3
  95. package/dist/types.d.ts.map +1 -1
  96. package/dist/version.d.ts +1 -1
  97. package/dist/version.js +1 -1
  98. package/package.json +7 -6
  99. package/skills/ragmir/SKILL.md +5 -3
  100. package/skills/ragmir-audio-summary/listening-style.md +11 -11
  101. package/skills/ragmir-audio-summary/narration-templates.md +22 -22
  102. package/skills/ragmir-audio-summary/split-lines.py +2 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jcode.labs/ragmir",
3
- "version": "2.16.2",
3
+ "version": "2.17.1",
4
4
  "description": "Confidential local RAG for coding agents, with offline cited retrieval through CLI, MCP, and TypeScript.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -77,8 +77,8 @@
77
77
  "zod": "^4.1.13"
78
78
  },
79
79
  "peerDependencies": {
80
- "@jcode.labs/ragmir-tts": "2.16.2",
81
- "@jcode.labs/ragmir-chat": "2.16.2"
80
+ "@jcode.labs/ragmir-chat": "2.17.1",
81
+ "@jcode.labs/ragmir-tts": "2.17.1"
82
82
  },
83
83
  "peerDependenciesMeta": {
84
84
  "@jcode.labs/ragmir-chat": {
@@ -94,14 +94,15 @@
94
94
  "publint": "^0.3.21",
95
95
  "typescript": "^5.9.3",
96
96
  "vitest": "^4.0.15",
97
- "@jcode.labs/ragmir-chat": "2.16.2",
98
- "@jcode.labs/ragmir-tts": "2.16.2"
97
+ "@jcode.labs/ragmir-chat": "2.17.1",
98
+ "@jcode.labs/ragmir-tts": "2.17.1"
99
99
  },
100
100
  "scripts": {
101
101
  "build": "tsc -p tsconfig.json",
102
102
  "check": "pnpm --filter @jcode.labs/ragmir-tts build && pnpm --filter @jcode.labs/ragmir-chat build && tsc -p tsconfig.json --noEmit",
103
103
  "mcp:smoke": "pnpm build && node scripts/mcp-smoke.mjs",
104
104
  "package:check": "publint",
105
- "test": "pnpm --filter @jcode.labs/ragmir-tts build && pnpm --filter @jcode.labs/ragmir-chat build && vitest run"
105
+ "test": "pnpm --filter @jcode.labs/ragmir-tts build && pnpm --filter @jcode.labs/ragmir-chat build && vitest run",
106
+ "test:coverage": "pnpm --filter @jcode.labs/ragmir-tts build && pnpm --filter @jcode.labs/ragmir-chat build && vitest run --coverage"
106
107
  }
107
108
  }
@@ -125,9 +125,11 @@ When a client cannot set `cwd`, set `RAGMIR_PROJECT_ROOT` for the server process
125
125
  when available. Use CLI commands when they are not.
126
126
 
127
127
  Prefer compact search, ask, or research output first. Call `ragmir_expand` with a returned citation
128
- only when the exact chunk or neighboring context is needed. Retrieval tools accept `maxBytes`, but
129
- the configured `mcpMaxOutputBytes` remains the hard ceiling. Inspect `_meta["ragmir/output"]` to see
130
- whether the response was compacted or truncated.
128
+ only when the exact chunk or neighboring context is needed. Search, ask, research, expansion, audit,
129
+ and evaluation accept `maxBytes`. Variable-size tool and resource JSON is bounded by the configured
130
+ `mcpMaxOutputBytes` and an absolute 1 MiB server ceiling. Inspect `_meta["ragmir/output"]` to see
131
+ whether the response was compacted or truncated. Pass `ragmir_evaluate` an existing
132
+ project-relative golden file; absolute paths and paths outside the base are rejected.
131
133
 
132
134
  When MCP resources are supported, read `ragmir://context` first for a bounded identity, readiness,
133
135
  freshness, coverage, and capability overview. Read `ragmir://sources` only when source coverage or
@@ -38,15 +38,15 @@ If the relevant material does not fill the budget, stop earlier. Padding makes a
38
38
 
39
39
  Punctuation is the only cue a TTS engine has for pausing. Use it deliberately.
40
40
 
41
- - **Comma** `,` — short micro-pause. Use it to separate clauses and ease breathing points.
42
- - **Period** `.` — full pause. End sentences here. Favour periods over commas when in doubt.
43
- - **Ellipsis** `…` — deliberate longer pause. Use it before the answer in an active-recall question,
41
+ - **Comma** `,`: short micro-pause. Use it to separate clauses and ease breathing points.
42
+ - **Period** `.`: full pause. End sentences here. Favour periods over commas when in doubt.
43
+ - **Ellipsis** `…`: deliberate longer pause. Use it before the answer in an active-recall question,
44
44
  so the listener gets a beat to think (about three seconds).
45
- - **Colon** `:` — read as a mild pause; acceptable when introducing a short enumeration spoken as
45
+ - **Colon** `:`: read as a mild pause; acceptable when introducing a short enumeration spoken as
46
46
  prose, but prefer rephrasing into a plain sentence.
47
- - **Semicolon** `;` — avoid. Engines hesitate inconsistently. Split into two sentences.
48
- - **Exclamation** `!` — avoid for TTS. It can trigger an unnatural spike in pitch.
49
- - **Question mark** `?` — use it for the active-recall questions; the engine raises intonation
47
+ - **Semicolon** `;`: avoid. Engines hesitate inconsistently. Split into two sentences.
48
+ - **Exclamation** `!`: avoid for TTS. It can trigger an unnatural spike in pitch.
49
+ - **Question mark** `?`: use it for the active-recall questions; the engine raises intonation
50
50
  naturally.
51
51
 
52
52
  ## Pronounceability
@@ -56,7 +56,7 @@ Anything the engine might misread must be rewritten for the ear.
56
56
  - **Acronyms**: expand on first use, then use the short form if it is pronounceable. "Le RGPD, le
57
57
  Règlement Général sur la Protection des Données, ..."
58
58
  - **Numbers**: write them the way they should be read. "1500" can read as "mille cinq cents" or
59
- "quinze cents" — write the intended form. For money, spell the currency: "douze mille euros".
59
+ "quinze cents". Write the intended form. For money, spell the currency: "douze mille euros".
60
60
  - **Symbols**: rewrite in words. `&` becomes "et", `%` becomes "pour cent", `->` becomes "mène à".
61
61
  - **Dates and times**: write them fully. "Le quinze mars deux mille vingt-cinq", not "2025-03-15".
62
62
  - **URLs, paths, code**: never read them aloud. Paraphrase: "le fichier de configuration du
@@ -65,7 +65,7 @@ Anything the engine might misread must be rewritten for the ear.
65
65
 
66
66
  ## Anti-Patterns
67
67
 
68
- Avoid these — they are the main causes of "imbuvable" audio.
68
+ Avoid these. They are the main causes of "imbuvable" audio.
69
69
 
70
70
  - **Jargon without setup.** If a technical term is needed, define it in one short clause first.
71
71
  - **Spoken bullet lists.** Enumerations read aloud are exhausting. Convert lists into flowing
@@ -79,8 +79,8 @@ Avoid these — they are the main causes of "imbuvable" audio.
79
79
 
80
80
  ## Language
81
81
 
82
- - Write the narration in the same language passed to `--lang` (`fr` default, `en`, `es`, `ja`, `th`,
83
- `zh`).
82
+ - Write the narration in the same language passed to `--lang` (`fr` by default; `en`, `es`, `ja`,
83
+ `th`, and `zh` are also supported).
84
84
  - Match the working language the user used when asking for the summary when it is one of the
85
85
  supported languages.
86
86
  - Keep numerals, units, and proper nouns pronounceable in the target language.
@@ -6,7 +6,7 @@ tables, SSML, or XML tags. The skeletons below only shape how you order and conn
6
6
  write the spoken text.
7
7
 
8
8
  Pick the format chosen in the skill, then fill the skeleton with the evidence that serves the user's
9
- intent. Drop anything that does not serve the intent — that is how you avoid superfluous data.
9
+ intent. Drop anything that does not serve the intent. That is how you avoid superfluous data.
10
10
 
11
11
  ## Format Selection Recap
12
12
 
@@ -24,11 +24,11 @@ Length follows relevant material. Never pad.
24
24
 
25
25
  Spoken-prose shape (write it as one flowing passage, not as headings):
26
26
 
27
- 1. **Hook + intent** — one sentence naming the subject and why the listener asked.
28
- 2. **Key idea** — the single thing to remember, stated up front (primacy).
29
- 3. **Evidence** — one short, plain-language reason or fact that supports it.
30
- 4. **Uncertainty / caveat** — one sentence if the evidence is partial or stale; omit only if solid.
31
- 5. **Recap + recall** — restate the key idea in other words, then ask one active-recall question,
27
+ 1. **Hook + intent**: one sentence naming the subject and why the listener asked.
28
+ 2. **Key idea**: the single thing to remember, stated up front (primacy).
29
+ 3. **Evidence**: one short, plain-language reason or fact that supports it.
30
+ 4. **Uncertainty / caveat**: one sentence if the evidence is partial or stale; omit only if solid.
31
+ 5. **Recap + recall**: restate the key idea in other words, then ask one active-recall question,
32
32
  pause with `…`, and give the answer.
33
33
 
34
34
  Abstract example (do not copy the words, follow the shape):
@@ -46,16 +46,16 @@ Abstract example (do not copy the words, follow the shape):
46
46
  The standard brief follows Barbara Minto's pyramid: answer first, then supporting points, then
47
47
  recap. Wrap it in a short Situation-Complication-Question-Answer opening.
48
48
 
49
- 1. **Situation** — one or two sentences framing the context the listener already shares.
50
- 2. **Complication** — the tension, change, or question that prompted the summary.
51
- 3. **Question** — the explicit question the summary answers.
52
- 4. **Answer (the key message)** — the one-to-three points to retain, stated first (primacy).
53
- 5. **Developed points** — each of the two-to-four points expanded in plain speech, grouped with
49
+ 1. **Situation**: one or two sentences framing the context the listener already shares.
50
+ 2. **Complication**: the tension, change, or question that prompted the summary.
51
+ 3. **Question**: the explicit question the summary answers.
52
+ 4. **Answer (the key message)**: the one-to-three points to retain, stated first (primacy).
53
+ 5. **Developed points**: each of the two-to-four points expanded in plain speech, grouped with
54
54
  signposting ("D'abord…, Ensuite…, Enfin…"). Proven facts only; separate from inference.
55
- 6. **Uncertainty, risks, decisions, missing documents** — a short passage on what is not yet
55
+ 6. **Uncertainty, risks, decisions, missing documents**: a short passage on what is not yet
56
56
  settled or needs action.
57
- 7. **Recap** — restate the two-to-four key points in compressed form (recency).
58
- 8. **Active recall** — two or three recall questions, each followed by a `…` pause and the answer.
57
+ 7. **Recap**: restate the two-to-four key points in compressed form (recency).
58
+ 8. **Active recall**: two or three recall questions, each followed by a `…` pause and the answer.
59
59
 
60
60
  Abstract example (shape only):
61
61
 
@@ -75,17 +75,17 @@ Abstract example (shape only):
75
75
  Use only when the material genuinely has several distinct facets. Each chapter is a self-contained
76
76
  mini-brief with its own mini-recap, so a listener can step away and come back.
77
77
 
78
- 1. **Promise** — what the whole audio covers and the three-to-five landmarks to listen for. State
78
+ 1. **Promise**: what the whole audio covers and the three-to-five landmarks to listen for. State
79
79
  the key message of the whole dossier up front.
80
- 2. **Chapter 1** — signpost the chapter ("Premier point: …"). Give its mini pyramid
80
+ 2. **Chapter 1**: signpost the chapter ("Premier point: …"). Give its mini pyramid
81
81
  (answer → evidence → caveat), then a one-sentence mini-recap.
82
- 3. **Chapter 2** — same shape, explicit transition ("Deuxième point: …").
82
+ 3. **Chapter 2**: same shape, explicit transition ("Deuxième point: …").
83
83
  4. **Continue** for each facet. Keep chapters balanced in length; merge thin ones.
84
- 5. **Global recap** — compress the key message of every chapter into one flowing passage (recency).
85
- 6. **Active recall** — three to five recall questions across the chapters, each with a `…` pause
84
+ 5. **Global recap**: compress the key message of every chapter into one flowing passage (recency).
85
+ 6. **Active recall**: three to five recall questions across the chapters, each with a `…` pause
86
86
  and the answer. Spread the questions across chapters, not only the last one.
87
87
 
88
- Transitions between chapters are essential in long audio — see the signposting catalogue below.
88
+ Transitions between chapters are essential in long audio. See the signposting catalogue below.
89
89
 
90
90
  Abstract shape:
91
91
 
@@ -117,7 +117,7 @@ transitions instead of lists or headings.
117
117
  | Recall question | "Question: …? … [answer]" |
118
118
 
119
119
  When enumerating, say the count first ("trois points") then speak each one with "D'abord / Ensuite /
120
- Enfin" — never read a literal list.
120
+ Enfin". Never read a literal list.
121
121
 
122
122
  ---
123
123
 
@@ -144,7 +144,7 @@ choice, no "est-ce que c'est X?" with the answer embedded).
144
144
  - After the question mark, insert `…` so the TTS pause gives the listener a beat to answer silently,
145
145
  then state the answer in the fewest words possible.
146
146
  - Do not reveal the answer inside the question. "Le préavis est-il de trente jours?" leaks the
147
- answer — prefer "Quelle est la durée du préavis?".
147
+ answer. Prefer "Quelle est la durée du préavis?".
148
148
 
149
149
  ---
150
150
 
@@ -5,7 +5,8 @@ Used to render long narrations sentence-by-sentence when an engine benefits from
5
5
  import re
6
6
  import sys
7
7
 
8
- raw = open(sys.argv[1], encoding="utf-8").read()
8
+ with open(sys.argv[1], encoding="utf-8") as source:
9
+ raw = source.read()
9
10
  text = re.sub(r"\s+", " ", raw).strip()
10
11
  for part in re.split(r"(?<=[.!?…])\s+", text):
11
12
  part = part.strip()