@autorag/librarian 2.11.0 → 2.12.0

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 (60) hide show
  1. package/NOTICE +6 -0
  2. package/README.md +7 -4
  3. package/dist/agent/agent.d.ts +64 -1
  4. package/dist/agent/answer-citations.d.ts +34 -2
  5. package/dist/agent/answer-guidelines.d.ts +2 -2
  6. package/dist/agent/ask-user.d.ts +8 -0
  7. package/dist/agent/automation-tool.d.ts +45 -0
  8. package/dist/agent/citation-links.d.ts +23 -0
  9. package/dist/agent/citation-numbers.d.ts +68 -0
  10. package/dist/agent/citation-relevance.d.ts +37 -0
  11. package/dist/agent/conversation-queries.d.ts +31 -0
  12. package/dist/agent/convert-tool.d.ts +28 -0
  13. package/dist/agent/evidence-persistence.d.ts +17 -11
  14. package/dist/agent/index.d.ts +1 -0
  15. package/dist/agent/intent-tracing.d.ts +33 -0
  16. package/dist/agent/permission-gate.d.ts +78 -0
  17. package/dist/agent/permission-judgment.d.ts +72 -0
  18. package/dist/agent/permission-paths.d.ts +23 -0
  19. package/dist/agent/query-routing.d.ts +14 -17
  20. package/dist/agent/search-documents.d.ts +1 -1
  21. package/dist/agent/self-config.d.ts +2 -0
  22. package/dist/agent/user-requests.d.ts +52 -0
  23. package/dist/automation/config.d.ts +48 -0
  24. package/dist/automation/daemon.d.ts +31 -0
  25. package/dist/automation/dispatch.d.ts +13 -0
  26. package/dist/automation/run-agent.d.ts +22 -0
  27. package/dist/automation/run.d.ts +32 -0
  28. package/dist/automation/service.d.ts +61 -0
  29. package/dist/cli/commands/automate.d.ts +2 -0
  30. package/dist/cli/config.d.ts +21 -0
  31. package/dist/cli/index.d.ts +1 -1
  32. package/dist/cli/index.js +8336 -4254
  33. package/dist/cli/open-target.d.ts +9 -0
  34. package/dist/cli/setup.d.ts +12 -0
  35. package/dist/convert/cli.d.ts +77 -0
  36. package/dist/convert/index.d.ts +4 -0
  37. package/dist/convert/installer.d.ts +84 -0
  38. package/dist/convert/matrix.d.ts +27 -0
  39. package/dist/convert/relate.d.ts +30 -0
  40. package/dist/core.js +32002 -28171
  41. package/dist/datasource/connector-timeouts.d.ts +6 -2
  42. package/dist/datasource/crawler-types.d.ts +1 -1
  43. package/dist/datasource/skills/lazykatok/types.d.ts +2 -2
  44. package/dist/datasource/skills/mailcrawl/types.d.ts +1 -1
  45. package/dist/dupey/cli.d.ts +18 -0
  46. package/dist/index.d.ts +1 -0
  47. package/dist/index.js +32047 -28192
  48. package/dist/mcp/index.js +32054 -28223
  49. package/dist/minsync/installer.d.ts +1 -1
  50. package/dist/profiles/agent-factory.d.ts +60 -0
  51. package/dist/profiles/automation-profiles.d.ts +25 -0
  52. package/dist/profiles/loop-guard.d.ts +23 -0
  53. package/dist/profiles/retrieval-tools.d.ts +24 -0
  54. package/dist/profiles/session-model.d.ts +69 -0
  55. package/dist/profiles.d.ts +13 -0
  56. package/dist/profiles.js +34739 -0
  57. package/dist/retrieval/rerank.d.ts +6 -0
  58. package/package.json +8 -2
  59. package/skills/autorag/SKILL.md +73 -2
  60. package/skills/autorag-setup/SKILL.md +8 -4
@@ -33,6 +33,12 @@ export declare const DEFAULT_DAZZI_RERANK_MODEL = "qwen/qwen3-reranker-8b";
33
33
  export declare const DEFAULT_RERANK_TIMEOUT_MS = 60000;
34
34
  /** Default number of merged chunks kept after reranking. */
35
35
  export declare const DEFAULT_RERANK_TOP_N = 25;
36
+ /**
37
+ * Longest document, in UTF-16 units, sent to a reranker. The hosted Dazzi
38
+ * reranker rejects a document of 131,072 characters or more with HTTP 400 and
39
+ * fails the whole request; 131,000 stays under that with a small margin.
40
+ */
41
+ export declare const RERANK_MAX_DOCUMENT_CHARS = 131000;
36
42
  /** Rerank providers {@link createReranker} can build. */
37
43
  export declare const SUPPORTED_RERANK_PROVIDERS: readonly string[];
38
44
  /** Default wire model for a rerank provider. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autorag/librarian",
3
- "version": "2.11.0",
3
+ "version": "2.12.0",
4
4
  "description": "Personal librarian agent for office work on the Pi framework, with pluggable retrieval methods",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -18,6 +18,10 @@
18
18
  "./core": {
19
19
  "types": "./dist/core.d.ts",
20
20
  "default": "./dist/core.js"
21
+ },
22
+ "./profiles": {
23
+ "types": "./dist/profiles.d.ts",
24
+ "default": "./dist/profiles.js"
21
25
  }
22
26
  },
23
27
  "bin": {
@@ -36,7 +40,7 @@
36
40
  "access": "public"
37
41
  },
38
42
  "scripts": {
39
- "build": "bun build src/index.ts src/core.ts src/cli/index.ts src/mcp/index.ts src/parser/parse-worker.ts --outdir dist --target node --packages external && tsc -p tsconfig.build.json && node scripts/fixup-dts.mjs",
43
+ "build": "bun build src/index.ts src/core.ts src/profiles.ts src/cli/index.ts src/mcp/index.ts src/parser/parse-worker.ts --outdir dist --target node --packages external && tsc -p tsconfig.build.json && node scripts/fixup-dts.mjs",
40
44
  "prepublishOnly": "bun run typecheck && bun run build",
41
45
  "prepare": "bun run build",
42
46
  "test": "node scripts/run-test-files.mjs",
@@ -56,6 +60,7 @@
56
60
  "@earendil-works/pi-tui": "1.2.0",
57
61
  "@llblab/pi-telegram": "0.57.2",
58
62
  "@modelcontextprotocol/server": "^2.3.1",
63
+ "@parcel/watcher": "2.6.0",
59
64
  "chardet": "^2.2.0",
60
65
  "discord.js": "14.27.0",
61
66
  "fast-xml-parser": "^5.11.2",
@@ -65,6 +70,7 @@
65
70
  "kordoc": "^4.21.30",
66
71
  "mailparser": "^3.9.38",
67
72
  "pdfjs-dist": "^6.4.299",
73
+ "pi-ask-user": "0.17.0",
68
74
  "pi-discord-remote": "0.2.4",
69
75
  "puppeteer-core": "^25.13.0",
70
76
  "slides-grab": "^1.5.2",
@@ -45,6 +45,34 @@ near/contains families require human review. Exact duplicate exclusion during
45
45
  refresh is enabled by default and can be disabled with
46
46
  `"excludeExactDuplicates": false` in `config.json`.
47
47
 
48
+ ### Converting files
49
+
50
+ The `convert_files` and `list_file_conversions` Agent tools run the
51
+ [Filee](https://github.com/KnifeLemon/Filee) command line to convert local
52
+ files offline: documents, spreadsheets, slides, HWP/HWPX, images, e-books,
53
+ archives, audio, video, data, and subtitles. They work on any path the user
54
+ names, not only the configured roots. This is the one exception to the
55
+ "never write source files" rule above: a conversion writes a new file and
56
+ never touches its source. An existing output name gets a number added unless
57
+ the user asks to replace it, in which case pass `overwrite: true`. Never
58
+ delete the source unless the user asked.
59
+
60
+ Each converted file is checked with `dupey compare` against its source, using
61
+ dupey's own thresholds, so the report says whether a later scan will group
62
+ them: `exact` (same canonical text, for example DOCX to HWPX), `near` (same
63
+ document in another format, for example Markdown to TXT), `different` (text
64
+ differs, typically layout formats such as PDF), `unsupported` (dupey cannot
65
+ read the format, for example HTML or images), or `unavailable` (dupey not
66
+ installed). The command line is `filee.binaryPath` if set, else a `filee`/`filee-cli`
67
+ on `PATH`, else the pinned [filee-cli](https://github.com/NomaDamas/filee-cli)
68
+ release that `autorag setup` (or the first conversion) downloads into
69
+ `<AUTORAG_HOME>/tools/filee-cli/`; `"filee": { "autoInstall": false }` forbids that
70
+ download. The system prompt carries the conversion map (which format family
71
+ converts to which, and the two-step chain when no direct route exists), so plan
72
+ from it instead of probing. `"filee": { "enabled": false }` in `config.json` removes both
73
+ tools; `filee.timeoutMs` (default 30 minutes) and `filee.dataDir` (Filee's
74
+ own settings and engines, `FILEE_DATA_DIR`) tune them.
75
+
48
76
  ### Excluding local files from the index
49
77
 
50
78
  `"excludePaths"` in `config.json` lists files or folders (absolute, or relative
@@ -83,7 +111,10 @@ autorag search "what were the key findings in the Q3 report" --top-k 5 --json --
83
111
  only `answer` plus `results`. Every
84
112
  bracketed `[n]` citation in `answer` resolves to a `results[].number` of the
85
113
  same response; an unmatched citation is removed and reported as a
86
- `citation-without-result` diagnostic.
114
+ `citation-without-result` diagnostic. Within one conversation (an interactive
115
+ session, including a resumed one), a source keeps the `number` it was first
116
+ shown with and a new source gets the next unused number, so `results[].number`
117
+ can skip numbers and need not start at 1 on a later turn.
87
118
 
88
119
  To inspect the exact persisted evidence behind numbered results, use:
89
120
 
@@ -116,7 +147,13 @@ default, OpenRouter), Jev first routes the question:
116
147
  datasources) is handled by the agent itself: it loads the setup skill, edits
117
148
  the active config, verifies it, and reports what changed. The running agent
118
149
  keeps its startup model; changes apply to the next `autorag` launch.
119
- - Private-data questions use local search; public current facts use web search.
150
+ - A request to act on files or folders (move, bulk rename, rename by content,
151
+ convert, sort) is carried out in one tool turn with no retrieval and no
152
+ verification, and reports every change as old path → new path.
153
+ - Anything else that needs no retrieval (commit, push, open a PR, run a build)
154
+ is carried out in one tool turn the same way.
155
+ - Private-data questions use local search; the agent decides on web search
156
+ after the fast answer.
120
157
  - A multi-part question is split into up to five parallel search queries.
121
158
  - On local search, Jev also picks which registered datasources (Slack,
122
159
  Discord, KakaoTalk, email, ...) to search before the fast answer, from each
@@ -145,8 +182,42 @@ autorag index rebuild --yes --json
145
182
  autorag index reset --method parsed --yes --json
146
183
  autorag memory inspect --json
147
184
  autorag tui
185
+ autorag automate status --json
186
+ autorag automate install --json
187
+ autorag automate uninstall --json
188
+ autorag automate run invoice --event create:/path/to/file.pdf --json
189
+ autorag automate daemon
190
+ ```
191
+
192
+ File-triggered automations live in `~/.autorag/automations.json` (`automations`
193
+ array of `{ id, paths, events, include, exclude, run | agent, appendFiles, debounceMs, timeoutMs }`).
194
+ Edit `automations.json` directly to add or change rules; matched `[{ type, path }]`
195
+ events are piped on stdin to `run`. Use `autorag automate install` to register
196
+ the background daemon with launchd, `systemd --user`, or Windows Task Scheduler.
197
+
198
+ A rule runs exactly one of `run` (a command) or `agent` (an AI agent started in
199
+ the daemon on each batch of changes):
200
+
201
+ ```json
202
+ { "id": "inbox-triage", "paths": ["~/Downloads"], "include": ["**/*.pdf"],
203
+ "agent": { "profile": "file-triage", "task": "Summarize each new PDF.",
204
+ "retrieval": { "searchAll": true, "datasources": ["kakao"] } } }
148
205
  ```
149
206
 
207
+ `agent.profile` names a profile defined in code: `file-triage` (reads, lists and
208
+ searches files; changes nothing) or `file-organizer` (also `bash`, `edit`,
209
+ `write`). A rule never carries a prompt or a tool list, so the rules file cannot
210
+ grant an agent more than its profile has. `retrieval` optionally adds
211
+ `search_all_documents` and one `search_datasource_<id>` per listed datasource.
212
+ Retrieval memory is never connected to an automation agent.
213
+
214
+ Every agent run gets a loop guard appended to its system prompt, naming the
215
+ rule's folders, file types and events, and forbidding any change that would
216
+ fire the rule again, editing the rules file, and running `autorag automate`. At
217
+ most one agent run is in flight across all rules, and an agent rule is
218
+ disabled after 6 runs within 60 seconds (command rules: 20). The run's final
219
+ reply is the `stdout` of its log entry.
220
+
150
221
  Prefer a full refresh so parsed mirrors, MinSync, Jikji, configured
151
222
  datasources, and (on Windows) the bundled Everything file-name index stay
152
223
  aligned. `--method` accepts
@@ -201,7 +201,7 @@ resolves in order:
201
201
 
202
202
  1. A configured remote endpoint (`minSync.embedder`), used for everything; no
203
203
  daemon is started and no local model is loaded.
204
- 2. A running `minsync serve` daemon (loopback only; MinSync 0.4.11+).
204
+ 2. A running `minsync serve` daemon (loopback only; MinSync 0.4.12+).
205
205
  AutoRAG never starts it: run `minsync serve --idle-timeout 0` yourself, as
206
206
  a launchd/systemd service (see `docs/minsync-setup.md`), or press
207
207
  Ctrl+Shift+E in `autorag tui`. `autorag setup` only reports whether it is
@@ -239,9 +239,11 @@ fast and multi-part questions thorough.
239
239
  - **Jev** (`jev`, default `{ "backend": "dazzi" }` when signed in to Dazzi
240
240
  Models, else `{ "backend": "openrouter" }`; model `jev-1.13` on Dazzi,
241
241
  `typesafe/jev-1.13` on OpenRouter) runs before the fast answer. It routes each question to
242
- local search, web search, a direct answer (general knowledge or small
243
- talk skips retrieval entirely), or the `config` branch, and decides whether
244
- to decompose it. On
242
+ local search, a direct answer (general knowledge or small
243
+ talk skips retrieval entirely), `organize` (moving, renaming, converting, or
244
+ sorting files and folders), `extra` (any other action that needs no
245
+ retrieval, such as committing code), or the `config` branch, and decides
246
+ whether to decompose it. On
245
247
  local search it also decides, per registered datasource, whether to search
246
248
  it before the fast answer, using each datasource's `description` and where
247
249
  similar past questions were answered (retrieval memory). When setting up a
@@ -540,6 +542,8 @@ is set up.
540
542
  - `AUTORAG_MEMORY_PATH`
541
543
  - `AUTORAG_MODEL_PROVIDER`
542
544
  - `AUTORAG_MODEL_ID`
545
+ - `AUTORAG_PERMISSION_MODE` (`auto` default for the TUI, `full` for `autorag search` and a TUI with a chat bridge, `ask`, `full`; config key `permissionMode`; with `auto` Jev checks the agent's
546
+ file-changing calls and asks the user only when it will not approve, `ask` asks about every one, `full` never asks)
543
547
 
544
548
  ## Completion condition
545
549