@autorag/librarian 2.10.6 → 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 (86) hide show
  1. package/NOTICE +14 -0
  2. package/README.md +52 -10
  3. package/dist/agent/agent.d.ts +70 -2
  4. package/dist/agent/answer-citations.d.ts +34 -2
  5. package/dist/agent/answer-guidelines.d.ts +24 -3
  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/mcp-client.d.ts +27 -0
  17. package/dist/agent/permission-gate.d.ts +78 -0
  18. package/dist/agent/permission-judgment.d.ts +72 -0
  19. package/dist/agent/permission-paths.d.ts +23 -0
  20. package/dist/agent/pi-session.d.ts +8 -0
  21. package/dist/agent/query-routing.d.ts +14 -17
  22. package/dist/agent/search-documents.d.ts +1 -1
  23. package/dist/agent/search-progress.d.ts +96 -0
  24. package/dist/agent/self-config.d.ts +2 -0
  25. package/dist/agent/user-requests.d.ts +52 -0
  26. package/dist/agent/welcome-header.d.ts +35 -0
  27. package/dist/automation/config.d.ts +48 -0
  28. package/dist/automation/daemon.d.ts +31 -0
  29. package/dist/automation/dispatch.d.ts +13 -0
  30. package/dist/automation/run-agent.d.ts +22 -0
  31. package/dist/automation/run.d.ts +32 -0
  32. package/dist/automation/service.d.ts +61 -0
  33. package/dist/cli/commands/automate.d.ts +2 -0
  34. package/dist/cli/commands/setup.d.ts +2 -0
  35. package/dist/cli/config.d.ts +21 -0
  36. package/dist/cli/index.d.ts +1 -1
  37. package/dist/cli/index.js +26740 -21094
  38. package/dist/cli/open-target.d.ts +9 -0
  39. package/dist/cli/setup.d.ts +21 -0
  40. package/dist/convert/cli.d.ts +77 -0
  41. package/dist/convert/index.d.ts +4 -0
  42. package/dist/convert/installer.d.ts +84 -0
  43. package/dist/convert/matrix.d.ts +27 -0
  44. package/dist/convert/relate.d.ts +30 -0
  45. package/dist/core.js +32095 -27288
  46. package/dist/datasource/connector-timeouts.d.ts +6 -2
  47. package/dist/datasource/crawler-types.d.ts +1 -1
  48. package/dist/datasource/errors.d.ts +1 -1
  49. package/dist/datasource/index.d.ts +2 -1
  50. package/dist/datasource/skills/factory.d.ts +3 -0
  51. package/dist/datasource/skills/hister/client.d.ts +83 -0
  52. package/dist/datasource/skills/hister/embedding.d.ts +64 -0
  53. package/dist/datasource/skills/hister/index.d.ts +2 -0
  54. package/dist/datasource/skills/hister/setup.d.ts +87 -0
  55. package/dist/datasource/skills/hister/skill.d.ts +63 -0
  56. package/dist/datasource/skills/lazykatok/types.d.ts +2 -2
  57. package/dist/datasource/skills/mailcrawl/types.d.ts +1 -1
  58. package/dist/datasource/skills/obsidian/index.d.ts +4 -6
  59. package/dist/datasource/skills/obsidian/methods.d.ts +13 -17
  60. package/dist/datasource/skills/obsidian/paths.d.ts +24 -24
  61. package/dist/datasource/skills/obsidian/skill.d.ts +10 -15
  62. package/dist/datasource/skills/obsidian/staging.d.ts +50 -0
  63. package/dist/datasource/skills/obsidian/vault-index.d.ts +44 -0
  64. package/dist/dupey/cli.d.ts +18 -0
  65. package/dist/index.d.ts +1 -0
  66. package/dist/index.js +32263 -27429
  67. package/dist/mcp/index.js +32149 -27342
  68. package/dist/minsync/installer.d.ts +1 -1
  69. package/dist/minsync/workspace-lock.d.ts +7 -0
  70. package/dist/process/terminate-tree.d.ts +4 -5
  71. package/dist/profiles/agent-factory.d.ts +60 -0
  72. package/dist/profiles/automation-profiles.d.ts +25 -0
  73. package/dist/profiles/loop-guard.d.ts +23 -0
  74. package/dist/profiles/retrieval-tools.d.ts +24 -0
  75. package/dist/profiles/session-model.d.ts +69 -0
  76. package/dist/profiles.d.ts +13 -0
  77. package/dist/profiles.js +34739 -0
  78. package/dist/retrieval/rerank.d.ts +6 -0
  79. package/licenses/hister-AGPL-3.0-notice.txt +47 -0
  80. package/package.json +9 -3
  81. package/skills/autorag/SKILL.md +79 -5
  82. package/skills/autorag-doctor/SKILL.md +5 -4
  83. package/skills/autorag-lite-setup/SKILL.md +23 -5
  84. package/skills/autorag-setup/SKILL.md +68 -7
  85. package/dist/datasource/skills/obsidian/client.d.ts +0 -15
  86. package/dist/datasource/skills/obsidian/types.d.ts +0 -92
@@ -0,0 +1,9 @@
1
+ import { spawn } from "node:child_process";
2
+ type SpawnFn = typeof spawn;
3
+ /**
4
+ * Open what a clicked TUI citation points at. A local file goes to Dazzi
5
+ * (`dazzi <path>` shows it in its folder); when Dazzi is not installed or
6
+ * refuses, and for web links, the platform's default opener takes over.
7
+ */
8
+ export declare function openCitationTarget(url: string, spawnFn?: SpawnFn): void;
9
+ export {};
@@ -1,3 +1,5 @@
1
+ import { type ResolvedFileeBinary, type ResolveFileeBinaryOptions } from "../convert/index.js";
2
+ import { type HisterServiceDeps, type HisterSetupReport } from "../datasource/skills/hister/setup.js";
1
3
  import { type EmbeddingBackend, type ManagedEmbedder } from "../embedding/index.js";
2
4
  import { type FileLockHandle } from "../filesystem/file-lock.js";
3
5
  export type SetupDatasourceState = "configured" | "skipped" | "blocked";
@@ -15,12 +17,25 @@ export interface SetupEmbeddingReport {
15
17
  /** Why no embedding backend is available. */
16
18
  readonly reason?: string;
17
19
  }
20
+ export type SetupFileeState = "installed" | "cached" | "path" | "configured" | "skipped" | "failed";
21
+ /** The Filee command line behind `convert_files`; setup installs it unless the operator opted out. */
22
+ export interface SetupFileeReport {
23
+ readonly state: SetupFileeState;
24
+ readonly path?: string;
25
+ readonly reason?: string;
26
+ }
18
27
  export interface SetupReport {
19
28
  readonly ok: boolean;
20
29
  readonly mode: "semantic" | "bm25";
21
30
  readonly embedding: SetupEmbeddingReport;
22
31
  readonly datasources: readonly SetupDatasourceReport[];
23
32
  readonly remediation?: string;
33
+ /** One entry per configured `hister` datasource; absent when none is configured. */
34
+ readonly hister?: HisterSetupReport;
35
+ /** Every configured `hister` datasource, when there is more than one. */
36
+ readonly histers?: readonly HisterSetupReport[];
37
+ /** Present on every run; `skipped` when `filee.enabled` or `filee.autoInstall` is false. */
38
+ readonly filee?: SetupFileeReport;
24
39
  readonly changed: boolean;
25
40
  }
26
41
  export interface SetupDeps {
@@ -30,9 +45,15 @@ export interface SetupDeps {
30
45
  readonly pathExists?: (path: string) => boolean;
31
46
  readonly executable?: (name: string) => string | undefined;
32
47
  readonly acquireLock?: (path: string) => FileLockHandle;
48
+ /** Hister's config path, health, restart and reindex; defaults to the real programs. */
49
+ readonly hister?: HisterServiceDeps;
50
+ /** Finds or installs filee-cli; defaults to the pinned release download. */
51
+ readonly filee?: (options: Pick<ResolveFileeBinaryOptions, "executable" | "autoInstall">) => Promise<ResolvedFileeBinary>;
33
52
  }
34
53
  export declare function runSetup(options: {
35
54
  configPath: string;
36
55
  workspacePath: string;
56
+ /** Write Hister's `semantic_search` to the shared embedding model (and restart/reindex it). Off by default. */
57
+ syncHister?: boolean;
37
58
  deps?: SetupDeps;
38
59
  }): Promise<SetupReport>;
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Conversions can legitimately take a long time (video transcodes, big PDFs,
3
+ * HWP → PDF), so the default budget is generous. Callers may lower it per call.
4
+ */
5
+ export declare const DEFAULT_FILEE_TIMEOUT_MS: number;
6
+ export interface FileeConvertRequest {
7
+ /** Files, folders or wildcards. Relative paths are resolved against `cwd`. Any location is allowed. */
8
+ readonly inputs: readonly string[];
9
+ /** Target format id or extension (`pdf`, `docx`, `webp`, `mp3`, ...). See {@link listFileeFormats}. */
10
+ readonly to: string;
11
+ /** Save here instead of next to each source. */
12
+ readonly outputDir?: string;
13
+ /** Include sub folders of folder inputs. */
14
+ readonly recursive?: boolean;
15
+ /** 1-100, for lossy image formats. */
16
+ readonly quality?: number;
17
+ /** Replace an existing output file. Without it (and without `skipExisting`) a number is added to the new name. */
18
+ readonly overwrite?: boolean;
19
+ /** Leave an existing output file alone. */
20
+ readonly skipExisting?: boolean;
21
+ /** Give the output the modified time of its source. */
22
+ readonly keepDates?: boolean;
23
+ }
24
+ export interface FileeFileResult {
25
+ readonly source: string;
26
+ readonly state: "done" | "skipped" | "failed" | "cancelled" | (string & {});
27
+ readonly outputs: readonly string[];
28
+ readonly error?: string;
29
+ readonly notice?: string;
30
+ }
31
+ export interface FileeConvertResult {
32
+ readonly preset: string;
33
+ readonly target: string;
34
+ readonly converted: number;
35
+ readonly skipped: number;
36
+ readonly failed: number;
37
+ readonly files: readonly FileeFileResult[];
38
+ }
39
+ export interface FileeCliRun {
40
+ readonly stdout: string;
41
+ readonly stderr: string;
42
+ readonly exitCode: number;
43
+ }
44
+ export interface FileeCliOptions {
45
+ /** Path to `filee` (or `filee-cli`). Default: found on PATH. */
46
+ readonly executable?: string;
47
+ readonly cwd?: string;
48
+ readonly timeoutMs?: number;
49
+ readonly signal?: AbortSignal;
50
+ /**
51
+ * Folder for Filee's settings and downloaded engines (`FILEE_DATA_DIR`), so a
52
+ * run neither reads nor writes the user's own Filee app settings.
53
+ */
54
+ readonly dataDir?: string;
55
+ /** `false` never downloads filee-cli when none is found. Default true. See `resolveFileeOptions`. */
56
+ readonly autoInstall?: boolean;
57
+ /** Test seam: replaces the spawn. */
58
+ readonly run?: (args: readonly string[]) => Promise<FileeCliRun>;
59
+ }
60
+ export declare class FileeCliError extends Error {
61
+ constructor(message: string);
62
+ }
63
+ /**
64
+ * Convert files with the `filee` command. Exit 0 (all converted) and 1 (some
65
+ * failed) both return the per-file report; wrong arguments, an unknown format,
66
+ * a missing input and "nothing to convert" throw {@link FileeCliError}.
67
+ */
68
+ export declare function convertWithFilee(request: FileeConvertRequest, options?: FileeCliOptions): Promise<FileeConvertResult>;
69
+ /** `filee formats [format]`: every format, or what one format converts to. */
70
+ export declare function listFileeFormats(format?: string, options?: FileeCliOptions): Promise<string>;
71
+ /**
72
+ * Find the Filee command line on `PATH`. POSIX installs link it as `filee`
73
+ * (or leave `filee-cli`). On Windows the PATH entry is the `cli\filee.cmd`
74
+ * shim, which Node cannot spawn directly; its target is `filee-cli.exe` one
75
+ * folder up. `filee.exe` is the tray app, never the command line.
76
+ */
77
+ export declare function resolveFileeExecutable(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): string | undefined;
@@ -0,0 +1,4 @@
1
+ export * from "./cli.js";
2
+ export * from "./installer.js";
3
+ export * from "./matrix.js";
4
+ export * from "./relate.js";
@@ -0,0 +1,84 @@
1
+ import { type FileeCliOptions } from "./cli.js";
2
+ /**
3
+ * filee-cli is NomaDamas' CLI-only redistribution of KnifeLemon/Filee
4
+ * (MIT, https://github.com/NomaDamas/filee-cli). It is a self-contained .NET
5
+ * program that must run as a separate process, so AutoRAG downloads the pinned
6
+ * release archive, checks its SHA-256, and unpacks it under
7
+ * `<AUTORAG_HOME>/tools/filee-cli/<version>/`. Nothing is linked or bundled.
8
+ * Filee's own engines (FFmpeg, Pandoc, LibreOffice, ...) are fetched by
9
+ * filee-cli itself on first use.
10
+ */
11
+ export declare const FILEE_CLI_VERSION = "2.0.0-2";
12
+ export interface FileeCliAsset {
13
+ readonly name: string;
14
+ readonly url: string;
15
+ readonly sha256: string;
16
+ }
17
+ /** SHA-256 values come from the release's `SHA256SUMS`. Keyed by `<platform>-<arch>`. */
18
+ export declare const FILEE_CLI_ASSETS: Readonly<Record<string, FileeCliAsset>>;
19
+ export declare class FileeInstallError extends Error {
20
+ constructor(message: string);
21
+ }
22
+ export declare function selectFileeAsset(platform: NodeJS.Platform, arch: NodeJS.Architecture, assets?: Readonly<Record<string, FileeCliAsset>>): FileeCliAsset;
23
+ export declare function fileeBinaryName(platform?: NodeJS.Platform): string;
24
+ export interface EnsureFileeBinaryOptions {
25
+ /** AutoRAG home; the install lives at `<home>/tools/filee-cli/<version>/`. Default: the resolved AutoRAG home. */
26
+ readonly home?: string;
27
+ readonly platform?: NodeJS.Platform;
28
+ readonly arch?: NodeJS.Architecture;
29
+ /** Test seam: pinned assets. */
30
+ readonly assets?: Readonly<Record<string, FileeCliAsset>>;
31
+ /** Test seam: fetch `url` into `destination`. */
32
+ readonly download?: (url: string, destination: string) => Promise<void>;
33
+ /** Test seam: unpack `archive` into `directory`. */
34
+ readonly extract?: (archive: string, directory: string) => Promise<void>;
35
+ }
36
+ export interface InstalledFileeBinary {
37
+ readonly binaryPath: string;
38
+ readonly source: "installed" | "cached";
39
+ }
40
+ /**
41
+ * Make sure the pinned filee-cli is unpacked in the AutoRAG home. Idempotent;
42
+ * concurrent callers in one process share a single install, and concurrent
43
+ * processes race on an atomic rename (the loser discards its copy).
44
+ */
45
+ export declare function ensureFileeBinary(options?: EnsureFileeBinaryOptions): Promise<InstalledFileeBinary>;
46
+ export interface ResolveFileeBinaryOptions {
47
+ readonly home?: string;
48
+ /** `filee.binaryPath` from config. */
49
+ readonly executable?: string;
50
+ readonly env?: NodeJS.ProcessEnv;
51
+ /** `false` never downloads. Default true. */
52
+ readonly autoInstall?: boolean;
53
+ readonly installer?: Omit<EnsureFileeBinaryOptions, "home">;
54
+ }
55
+ export interface ResolvedFileeBinary {
56
+ readonly path: string;
57
+ readonly source: "configured" | "path" | "installed" | "cached";
58
+ }
59
+ /**
60
+ * Where the Filee command line comes from, in order: the configured path, a
61
+ * `filee`/`filee-cli` on PATH, then the managed copy (installed on demand).
62
+ */
63
+ export declare function resolveFileeBinary(options?: ResolveFileeBinaryOptions): Promise<ResolvedFileeBinary>;
64
+ /**
65
+ * Fill in `executable` for a conversion call: the configured path, a PATH
66
+ * install, or the managed copy (downloaded on first use unless `autoInstall`
67
+ * is false). Options that already carry a `run` seam are returned unchanged.
68
+ */
69
+ export declare function resolveFileeOptions(options: FileeCliOptions, deps?: Pick<ResolveFileeBinaryOptions, "home" | "env" | "installer">): Promise<FileeCliOptions>;
70
+ export type WarmFileeOutcome = {
71
+ readonly state: ResolvedFileeBinary["source"];
72
+ readonly path: string;
73
+ } | {
74
+ readonly state: "skipped";
75
+ } | {
76
+ readonly state: "failed";
77
+ readonly reason: string;
78
+ };
79
+ /**
80
+ * Start-of-session prefetch so the first `convert_files` call does not wait for
81
+ * an 85 MB download. Never throws: a failure here resurfaces, with its reason,
82
+ * on the first real conversion.
83
+ */
84
+ export declare function warmFileeBinary(options: FileeCliOptions | false, deps?: Pick<ResolveFileeBinaryOptions, "home" | "env" | "installer">): Promise<WarmFileeOutcome>;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * What `filee-cli` can convert, grouped so the model can plan any conversion
3
+ * without a tool call. Generated from `filee-cli formats <format>` for every
4
+ * source format (v2.0.0); `test/live-e2e/filee-matrix.test.ts` re-checks every
5
+ * claim against the real binary, so a Filee upgrade that changes a route fails
6
+ * there instead of silently misleading the model.
7
+ *
8
+ * A route `source family -> group` means EVERY format in the source family can
9
+ * become EVERY format in the group (a format never converts to itself). Some
10
+ * targets need an engine that Filee downloads on first use (LibreOffice, Pandoc,
11
+ * Ghostscript, FFmpeg, calibre); the guide says so instead of listing them apart.
12
+ */
13
+ export declare const SOURCE_FAMILIES: Readonly<Record<string, readonly string[]>>;
14
+ export declare const TARGET_GROUPS: Readonly<Record<string, readonly string[]>>;
15
+ export declare const ROUTES: Readonly<Record<string, {
16
+ readonly groups: readonly string[];
17
+ readonly formats: readonly string[];
18
+ }>>;
19
+ /** Every format in `family`, or undefined for an unknown family. */
20
+ export declare function familyMembers(family: string): readonly string[] | undefined;
21
+ /** Every target a source family can reach: its groups expanded, plus its single formats. */
22
+ export declare function reachableTargets(family: string): readonly string[];
23
+ /**
24
+ * Compact conversion guide for the system prompt: families, target groups, the
25
+ * route table, and the rules that decide whether a chain is needed.
26
+ */
27
+ export declare function renderConversionGuide(): string;
@@ -0,0 +1,30 @@
1
+ import { type DupeyCliOptions, type DupeyCompareResult } from "../dupey/index.js";
2
+ import { type FileeCliOptions, type FileeConvertRequest, type FileeConvertResult } from "./cli.js";
3
+ /** What `dupey scan` would say about a converted copy and its source. */
4
+ export type ConvertedCopyRelation = DupeyCompareResult | {
5
+ readonly relation: "unavailable";
6
+ readonly reason: string;
7
+ };
8
+ export interface ConvertedCopyLink {
9
+ readonly source: string;
10
+ readonly output: string;
11
+ readonly dupey: ConvertedCopyRelation;
12
+ }
13
+ export interface ConvertAndRelateResult {
14
+ readonly result: FileeConvertResult;
15
+ /** One entry per output file written by a successful conversion. Empty when dupey is disabled. */
16
+ readonly links: readonly ConvertedCopyLink[];
17
+ }
18
+ export interface ConvertAndRelateOptions {
19
+ readonly filee?: FileeCliOptions;
20
+ /** `false` skips the duplicate-family check. */
21
+ readonly dupey?: DupeyCliOptions | false;
22
+ }
23
+ /**
24
+ * Convert, then ask dupey whether each output is a duplicate-family member of
25
+ * its source. A converted copy has the same text in another format, which is
26
+ * exactly what dupey's families describe; the comparison uses dupey's own
27
+ * thresholds so it agrees with a later `dupey scan` of the directory.
28
+ * A dupey that cannot run never fails the conversion.
29
+ */
30
+ export declare function convertAndRelate(request: FileeConvertRequest, options?: ConvertAndRelateOptions): Promise<ConvertAndRelateResult>;