@autorag/librarian 2.12.0 → 2.13.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.
- package/README.md +8 -3
- package/dist/agent/agent.d.ts +84 -44
- package/dist/agent/answer-guidelines.d.ts +18 -1
- package/dist/agent/current-date.d.ts +10 -0
- package/dist/agent/datasource-skill.d.ts +2 -2
- package/dist/agent/environment-prompt.d.ts +20 -0
- package/dist/agent/evidence-ledger.d.ts +4 -2
- package/dist/agent/location-claims.d.ts +14 -0
- package/dist/agent/packaged-skill.d.ts +19 -0
- package/dist/agent/query-routing.d.ts +80 -26
- package/dist/agent/results.d.ts +10 -2
- package/dist/agent/search-documents.d.ts +6 -1
- package/dist/agent/self-config.d.ts +4 -4
- package/dist/agent/skill-invocation.d.ts +17 -0
- package/dist/agent/user-requests.d.ts +2 -2
- package/dist/cli/commands/evidence.d.ts +2 -0
- package/dist/cli/index.js +10572 -9994
- package/dist/cli/setup.d.ts +2 -0
- package/dist/core.js +21531 -21024
- package/dist/datasource/crawler-skill.d.ts +1 -0
- package/dist/datasource/index.d.ts +1 -1
- package/dist/datasource/sidecar/methods.d.ts +8 -1
- package/dist/datasource/skills/clawgallery/skill.d.ts +4 -0
- package/dist/datasource/skills/discrawl/skill.d.ts +5 -0
- package/dist/datasource/skills/factory.d.ts +5 -1
- package/dist/datasource/skills/lazykatok/index.d.ts +1 -1
- package/dist/datasource/skills/lazykatok/methods.d.ts +5 -5
- package/dist/datasource/skills/lazykatok/skill.d.ts +1 -0
- package/dist/datasource/skills/mailcrawl/skill.d.ts +1 -0
- package/dist/index.js +21621 -21063
- package/dist/mcp/index.js +21618 -21061
- package/dist/memory/memory.d.ts +4 -1
- package/dist/mirror/atomic-write.d.ts +16 -1
- package/dist/mirror/sync.d.ts +2 -0
- package/dist/profiles.js +11311 -10804
- package/dist/retrieval/chunk-location.d.ts +28 -0
- package/dist/retrieval/fallback.d.ts +24 -0
- package/dist/retrieval/index.d.ts +1 -0
- package/dist/retrieval/types.d.ts +16 -0
- package/internal-skills/organize/SKILL.md +43 -0
- package/package.json +2 -1
- package/skills/autorag/SKILL.md +18 -7
- package/skills/autorag-setup/SKILL.md +7 -5
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Where a retrieved chunk sits inside its parsed document. Every field is measured, never model-written. */
|
|
2
|
+
export interface ChunkLocation {
|
|
3
|
+
/** 1-based first line of the chunk in the parsed document. */
|
|
4
|
+
readonly lineStart: number;
|
|
5
|
+
/** 1-based last line of the chunk in the parsed document. */
|
|
6
|
+
readonly lineEnd: number;
|
|
7
|
+
/** Nearest article or heading line at or before the chunk's first line. */
|
|
8
|
+
readonly section?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Find `chunk` in `document` by its non-blank lines (compared trimmed, so
|
|
12
|
+
* indentation and blank-line differences between the chunker's output and the
|
|
13
|
+
* file do not matter) and report the 1-based line range plus the section it
|
|
14
|
+
* sits in.
|
|
15
|
+
*
|
|
16
|
+
* Returns undefined unless the chunk matches exactly one place: a chunk the
|
|
17
|
+
* chunker rewrote (table flattening) or one that occurs twice has no single
|
|
18
|
+
* correct line, and reporting a guess would be worse than reporting nothing.
|
|
19
|
+
*/
|
|
20
|
+
export declare function locateChunk(document: string, chunk: string): ChunkLocation | undefined;
|
|
21
|
+
/** One stable text form of a location, for tool output the model reads. Undefined when nothing is known. */
|
|
22
|
+
export declare function describeLocation(location: {
|
|
23
|
+
readonly lineStart?: number;
|
|
24
|
+
readonly lineEnd?: number;
|
|
25
|
+
readonly section?: string;
|
|
26
|
+
}): string | undefined;
|
|
27
|
+
/** ` (lines 7-8, section "…")` for a retrieval result whose backend measured a location; empty otherwise. */
|
|
28
|
+
export declare function locationSuffix(metadata: Readonly<Record<string, unknown>>): string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { RetrievalMethod, RetrievalMethodDescriptor, RetrievalOptions, RetrievalResult } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* One logical retrieval method that prefers its primary and degrades to a
|
|
4
|
+
* fallback only when the primary cannot run.
|
|
5
|
+
*
|
|
6
|
+
* Datasources used to register a hybrid method next to its lexical and semantic
|
|
7
|
+
* components and let the merger reconcile them. That ran the same backend
|
|
8
|
+
* several times and let the merger count a hybrid and its own component as
|
|
9
|
+
* independent corroboration. Registering one chain instead means the pipeline
|
|
10
|
+
* sees a single method per datasource: the hybrid when it works, a component
|
|
11
|
+
* only when it does not.
|
|
12
|
+
*
|
|
13
|
+
* The chain reports the primary's descriptor, so selection, diagnostics and
|
|
14
|
+
* surface grouping behave as if the primary were registered alone. A primary
|
|
15
|
+
* that answers with no hits is an answer, not a failure: the fallback is not
|
|
16
|
+
* consulted, because a lexical-only retry cannot find what a hybrid missed.
|
|
17
|
+
*/
|
|
18
|
+
export declare class FallbackRetrievalMethod implements RetrievalMethod {
|
|
19
|
+
private readonly primary;
|
|
20
|
+
private readonly fallbacks;
|
|
21
|
+
constructor(primary: RetrievalMethod, fallbacks: readonly RetrievalMethod[]);
|
|
22
|
+
describe(): RetrievalMethodDescriptor;
|
|
23
|
+
retrieve(query: string, options: RetrievalOptions): Promise<RetrievalResult[]>;
|
|
24
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { bm25Scores, tokenize } from "./bm25.js";
|
|
2
2
|
export { RetrievalEngine, type RetrievalEngineOptions } from "./engine.js";
|
|
3
|
+
export { FallbackRetrievalMethod } from "./fallback.js";
|
|
3
4
|
export type { MergeOptions } from "./merger.js";
|
|
4
5
|
export { ParallelRetriever, ResultMerger } from "./merger.js";
|
|
5
6
|
export { RetrievalMethodRegistry } from "./registry.js";
|
|
@@ -14,11 +14,27 @@ export interface RetrievalMethodDescriptor {
|
|
|
14
14
|
datasourceId?: string;
|
|
15
15
|
tags?: readonly string[];
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* A fallback chain answered with a fallback because its primary method failed. `reason` is the primary's
|
|
19
|
+
* error verbatim, so the degraded surface can be reported like any other skipped method.
|
|
20
|
+
*/
|
|
21
|
+
export interface RetrievalFallbackEvent {
|
|
22
|
+
/** Name of the primary method that failed. */
|
|
23
|
+
method: string;
|
|
24
|
+
/** Name of the fallback that answered instead. */
|
|
25
|
+
fallback: string;
|
|
26
|
+
reason: string;
|
|
27
|
+
}
|
|
17
28
|
export interface RetrievalOptions {
|
|
18
29
|
topK?: number;
|
|
19
30
|
scope?: string;
|
|
20
31
|
filters?: Record<string, unknown>;
|
|
21
32
|
signal?: AbortSignal;
|
|
33
|
+
/**
|
|
34
|
+
* Owned by the retrieval pipeline, not by callers: invoked when a method answered through a fallback.
|
|
35
|
+
* Methods that wrap another method must not forward it.
|
|
36
|
+
*/
|
|
37
|
+
onFallback?: (event: RetrievalFallbackEvent) => void;
|
|
22
38
|
}
|
|
23
39
|
export interface RetrievalMethod {
|
|
24
40
|
describe(): RetrievalMethodDescriptor;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: organize
|
|
3
|
+
description: Rules for acting on files and folders on disk — sort, move, copy, bulk-rename, rename by content, convert formats, create folder structures, or move to the trash. Plan every target path before changing anything, never overwrite or permanently delete, confirm with a listing, and report every change as old path → new path.
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Organizing files and folders
|
|
8
|
+
|
|
9
|
+
Use this skill when the user asks you to act on files or folders — tidy or sort
|
|
10
|
+
a folder, move or copy files into folders, bulk or pattern rename, rename files
|
|
11
|
+
according to what their content says, convert formats, create folder
|
|
12
|
+
structures, archive, or move files to the trash. This is a file-organization
|
|
13
|
+
task, not a document search: the answer is the change on disk, not information
|
|
14
|
+
found in the files.
|
|
15
|
+
|
|
16
|
+
## How to do it
|
|
17
|
+
|
|
18
|
+
- Work with `bash` (`ls`, `mkdir`, `mv`, `cp`, and a bounded `find`). Read a
|
|
19
|
+
file (with `read` or `bash`) only when its content decides the new name or
|
|
20
|
+
folder, then carry the change out with `bash` or the file tools.
|
|
21
|
+
- Use the converter tools for format conversions, the duplicate scan when the
|
|
22
|
+
request is about duplicates, and the file-name discovery tools to locate
|
|
23
|
+
files by name.
|
|
24
|
+
- Do **not** search document contents, the user's datasources, or the web in
|
|
25
|
+
this turn: content retrieval and the web tools are not part of this task. The
|
|
26
|
+
turn prompt lists the exact tools to use and the ones to leave alone.
|
|
27
|
+
|
|
28
|
+
## Rules
|
|
29
|
+
|
|
30
|
+
- **Plan first.** List what you found, decide every target path, and check that
|
|
31
|
+
no two targets share a name and that no target already exists before you move
|
|
32
|
+
anything. Never overwrite an existing file.
|
|
33
|
+
- **Touch only what the request names.** When the request does not name a
|
|
34
|
+
folder, ask which one instead of guessing, unless the conversation already
|
|
35
|
+
says.
|
|
36
|
+
- **Never delete permanently** — no `rm`, `rmdir`, `unlink`, `find -delete`,
|
|
37
|
+
`shred`, or PowerShell `Remove-Item`. Move what must go to the OS trash
|
|
38
|
+
instead (macOS `/usr/bin/trash`, Linux `gio trash`, Windows Recycle Bin).
|
|
39
|
+
- **Confirm afterwards.** List the destination folder to check the changes
|
|
40
|
+
really happened.
|
|
41
|
+
- **Finish with a report**, as your final message and with no tool call: every
|
|
42
|
+
change as old path → new path (one per line), what you skipped and why, and
|
|
43
|
+
anything that still needs the user. Write in the language of the request.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autorag/librarian",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.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": {
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"files": [
|
|
32
32
|
"dist",
|
|
33
33
|
"skills",
|
|
34
|
+
"internal-skills",
|
|
34
35
|
"README.md",
|
|
35
36
|
"NOTICE",
|
|
36
37
|
"licenses",
|
package/skills/autorag/SKILL.md
CHANGED
|
@@ -123,14 +123,21 @@ autorag evidence <sessionId> --result 1 --json
|
|
|
123
123
|
```
|
|
124
124
|
|
|
125
125
|
The response includes the original source, retrieval method, stable evidence
|
|
126
|
-
ID, raw excerpt/content, and any available `chunkIndex`, `lineNumber
|
|
127
|
-
`
|
|
126
|
+
ID, raw excerpt/content, and any available `chunkIndex`, `lineNumber` and
|
|
127
|
+
`lineEnd` (the chunk's line range in the parsed document), `section` (the
|
|
128
|
+
article or heading it sits in), `retrievalResultId`, and metadata. Omit `--result` to inspect every result in
|
|
128
129
|
the session. Prefer this command whenever the caller wants detailed chunk text
|
|
129
130
|
rather than only the curated summary.
|
|
130
131
|
|
|
131
132
|
- `--scope` narrows datasource retrieval to a requested sub-path (ordinary
|
|
132
133
|
per-query filtering).
|
|
133
134
|
- `--json` is required for programmatic consumption.
|
|
135
|
+
- Each search result carries `locations` (`lineStart`, `lineEnd`, `section`)
|
|
136
|
+
when the harness measured where its evidence sits in the parsed document. Quote
|
|
137
|
+
those, not line numbers or counts written in the answer prose; a
|
|
138
|
+
`line-reference-unverified` diagnostic (with `--debug`) flags prose line
|
|
139
|
+
numbers no cited evidence covers. Locations are absent for chunks the chunker
|
|
140
|
+
rewrote (such as flattened tables).
|
|
134
141
|
- `--debug` is required for `sessionId` and diagnostics in search output.
|
|
135
142
|
- `autorag evidence` is the detailed source/chunk inspection path.
|
|
136
143
|
|
|
@@ -152,13 +159,17 @@ default, OpenRouter), Jev first routes the question:
|
|
|
152
159
|
verification, and reports every change as old path → new path.
|
|
153
160
|
- Anything else that needs no retrieval (commit, push, open a PR, run a build)
|
|
154
161
|
is carried out in one tool turn the same way.
|
|
155
|
-
- Private-data questions use local search
|
|
156
|
-
|
|
162
|
+
- Private-data questions use local search. Questions about public facts that may
|
|
163
|
+
be recent or have changed can use the public web: Jev picks the web in the
|
|
164
|
+
same check as the registered connections, one web search runs per search
|
|
165
|
+
query before the fast answer, and the fast phase may also call `web_search`
|
|
166
|
+
itself when the baseline lacks the answer.
|
|
157
167
|
- A multi-part question is split into up to five parallel search queries.
|
|
158
168
|
- On local search, Jev also picks which registered datasources (Slack,
|
|
159
|
-
Discord, KakaoTalk, email, ...) to search before the fast answer
|
|
160
|
-
|
|
161
|
-
their
|
|
169
|
+
Discord, KakaoTalk, email, ...) to search before the fast answer — and
|
|
170
|
+
whether to search the public web — from each description and where similar
|
|
171
|
+
past questions were answered; their hits are reranked together with local
|
|
172
|
+
file evidence.
|
|
162
173
|
|
|
163
174
|
After the fast answer, Jev ends the run if the answer is complete and
|
|
164
175
|
evidence-backed. So `results` may come straight from the fast answer, with no
|
|
@@ -239,11 +239,13 @@ 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
|
|
243
|
-
|
|
244
|
-
sorting files and folders), `extra` (any other action that needs no
|
|
245
|
-
retrieval, such as committing code), or the `config`
|
|
246
|
-
|
|
242
|
+
local search (everything needing more information),
|
|
243
|
+
`organize` (moving, renaming, converting, or
|
|
244
|
+
sorting files and folders), `extra` (a knowledge answer, or any other action that needs no
|
|
245
|
+
retrieval, such as committing code: one turn with every tool), or the `config`
|
|
246
|
+
branch, and decides
|
|
247
|
+
whether to decompose it. A non-local branch only wins above a 0.75 confidence
|
|
248
|
+
floor; anything weaker stays on local search. On
|
|
247
249
|
local search it also decides, per registered datasource, whether to search
|
|
248
250
|
it before the fast answer, using each datasource's `description` and where
|
|
249
251
|
similar past questions were answered (retrieval memory). When setting up a
|