@autorag/librarian 2.10.5 → 2.11.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/NOTICE +14 -9
- package/README.md +65 -25
- package/dist/agent/agent.d.ts +51 -49
- package/dist/agent/answer-guidelines.d.ts +22 -1
- package/dist/agent/context-token-guard.d.ts +11 -0
- package/dist/agent/discord-remote.d.ts +30 -0
- package/dist/agent/embedding-controls.d.ts +22 -0
- package/dist/agent/index.d.ts +1 -2
- package/dist/agent/mcp-client.d.ts +27 -0
- package/dist/agent/pi-session.d.ts +8 -1
- package/dist/agent/query-decomposition.d.ts +1 -1
- package/dist/agent/search-documents.d.ts +2 -2
- package/dist/agent/search-progress.d.ts +96 -0
- package/dist/agent/system-prompt.d.ts +1 -1
- package/dist/agent/welcome-header.d.ts +35 -0
- package/dist/cli/commands/models.d.ts +0 -14
- package/dist/cli/commands/search.d.ts +3 -4
- package/dist/cli/commands/setup.d.ts +2 -0
- package/dist/cli/config.d.ts +7 -19
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +16364 -18337
- package/dist/cli/setup.d.ts +22 -36
- package/dist/cloud/config.d.ts +3 -3
- package/dist/core.js +7372 -9206
- package/dist/datasource/embedding-env.d.ts +29 -0
- package/dist/datasource/errors.d.ts +1 -1
- package/dist/datasource/index.d.ts +2 -1
- package/dist/datasource/sidecar/config.d.ts +3 -0
- package/dist/datasource/sidecar/index.d.ts +1 -1
- package/dist/datasource/skills/discrawl/client.d.ts +1 -0
- package/dist/datasource/skills/discrawl/embedding.d.ts +17 -0
- package/dist/datasource/skills/discrawl/types.d.ts +11 -3
- package/dist/datasource/skills/factory.d.ts +17 -1
- package/dist/datasource/skills/github-gist/semantic.d.ts +5 -5
- package/dist/datasource/skills/github-gist/skill.d.ts +2 -3
- package/dist/datasource/skills/hister/client.d.ts +83 -0
- package/dist/datasource/skills/hister/embedding.d.ts +64 -0
- package/dist/datasource/skills/hister/index.d.ts +2 -0
- package/dist/datasource/skills/hister/setup.d.ts +87 -0
- package/dist/datasource/skills/hister/skill.d.ts +63 -0
- package/dist/datasource/skills/lazykatok/types.d.ts +9 -1
- package/dist/datasource/skills/mailcrawl/types.d.ts +9 -1
- package/dist/datasource/skills/obsidian/index.d.ts +4 -6
- package/dist/datasource/skills/obsidian/methods.d.ts +13 -17
- package/dist/datasource/skills/obsidian/paths.d.ts +24 -24
- package/dist/datasource/skills/obsidian/skill.d.ts +10 -15
- package/dist/datasource/skills/obsidian/staging.d.ts +50 -0
- package/dist/datasource/skills/obsidian/vault-index.d.ts +44 -0
- package/dist/embedding/daemon.d.ts +57 -0
- package/dist/embedding/embedder.d.ts +59 -0
- package/dist/embedding/http-embedder.d.ts +28 -0
- package/dist/embedding/in-process.d.ts +19 -0
- package/dist/embedding/index.d.ts +28 -0
- package/dist/embedding/managed.d.ts +44 -0
- package/dist/embedding/prefixes.d.ts +18 -0
- package/dist/embedding/settings.d.ts +9 -0
- package/dist/index.js +7465 -9298
- package/dist/mcp/index.js +7460 -9294
- package/dist/memory/context.d.ts +1 -1
- package/dist/memory/similar-queries.d.ts +1 -1
- package/dist/minsync/binary.d.ts +21 -0
- package/dist/minsync/client.d.ts +11 -10
- package/dist/minsync/index.d.ts +1 -1
- package/dist/minsync/installer.d.ts +1 -1
- package/dist/minsync/method.d.ts +3 -11
- package/dist/minsync/process.d.ts +1 -0
- package/dist/minsync/types.d.ts +0 -2
- package/dist/minsync/workspace-lock.d.ts +7 -0
- package/dist/process/terminate-tree.d.ts +4 -5
- package/dist/retrieval/rerank.d.ts +10 -3
- package/licenses/hister-AGPL-3.0-notice.txt +47 -0
- package/package.json +4 -4
- package/skills/autorag/SKILL.md +9 -11
- package/skills/autorag-doctor/SKILL.md +50 -29
- package/skills/autorag-lite-setup/SKILL.md +31 -13
- package/skills/autorag-setup/SKILL.md +99 -26
- package/dist/agent/peer-target-tool.d.ts +0 -19
- package/dist/agent/query-peer-tool.d.ts +0 -51
- package/dist/cli/commands/gateway.d.ts +0 -7
- package/dist/cli/commands/p2p-policy.d.ts +0 -2
- package/dist/cli/commands/p2p.d.ts +0 -7
- package/dist/cli/commands/serve.d.ts +0 -19
- package/dist/datasource/skills/obsidian/client.d.ts +0 -15
- package/dist/datasource/skills/obsidian/types.d.ts +0 -92
- package/dist/embedding-runtime/cache.d.ts +0 -30
- package/dist/embedding-runtime/gateway-embedder.d.ts +0 -41
- package/dist/embedding-runtime/gateway.d.ts +0 -27
- package/dist/embedding-runtime/index.d.ts +0 -120
- package/dist/embedding-runtime/manifest.d.ts +0 -20
- package/dist/embedding-runtime/supervisor.d.ts +0 -74
- package/dist/embedding-runtime/types.d.ts +0 -70
- package/dist/p2p/approval-store.d.ts +0 -32
- package/dist/p2p/egress-gate.d.ts +0 -22
- package/dist/p2p/file-sharing.d.ts +0 -33
- package/dist/p2p/injection-classifier.d.ts +0 -33
- package/dist/p2p/injection-gate.d.ts +0 -37
- package/dist/p2p/pii-gate.d.ts +0 -47
- package/dist/p2p/policy-filter.d.ts +0 -15
- package/dist/p2p/policy.d.ts +0 -77
- package/dist/p2p/simplex-query-store.d.ts +0 -44
- package/dist/p2p/simplex-server.d.ts +0 -115
- package/dist/p2p/simplex-transport.d.ts +0 -62
- package/dist/p2p/wire.d.ts +0 -39
- package/licenses/embedding-assets.json +0 -85
- package/licenses/llama.cpp-MIT.txt +0 -21
- package/licenses/qwen3-embedding-notice.txt +0 -13
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { EmbedderEndpoint, ManagedEmbedder } from "../embedding/embedder.js";
|
|
2
|
+
/**
|
|
3
|
+
* Pointing an external CLI that embeds for itself (mailcrawl, lazykatok) at the same backend as the rest of
|
|
4
|
+
* AutoRAG. The CLI keeps ownership of its archive and vector store; AutoRAG only tells it where the vectors
|
|
5
|
+
* come from, through the environment variables the CLI documents. A remote key travels as the value of the
|
|
6
|
+
* variable the operator's `minSync.embedder.apiKeyEnv` names, to that one child only.
|
|
7
|
+
*/
|
|
8
|
+
/** An endpoint whose vector length is known; the CLIs require it up front. */
|
|
9
|
+
export interface ResolvedEmbeddingEndpoint extends EmbedderEndpoint {
|
|
10
|
+
readonly dimension: number;
|
|
11
|
+
}
|
|
12
|
+
export type EmbeddingEndpointSource = () => Promise<ResolvedEmbeddingEndpoint | undefined>;
|
|
13
|
+
/**
|
|
14
|
+
* The shared embedder as an endpoint source. Probes only: it never starts a daemon. `undefined` means the
|
|
15
|
+
* embedder would run in-process, which an external CLI cannot reach.
|
|
16
|
+
*/
|
|
17
|
+
export declare function embeddingEndpointSource(embedder: ManagedEmbedder): EmbeddingEndpointSource;
|
|
18
|
+
/**
|
|
19
|
+
* mailcrawl's `openai` and `tei` providers (0.2.2+). Identity is provider + model + dimension, so moving a
|
|
20
|
+
* server keeps its vectors, while switching backend rebuilds the index on the next `mailcrawl index`.
|
|
21
|
+
* mailcrawl accepts a non-loopback endpoint only over https with an explicit opt-in, which is set here
|
|
22
|
+
* because the operator configured that remote themselves.
|
|
23
|
+
*/
|
|
24
|
+
export declare function mailcrawlEmbeddingEnv(endpoint: ResolvedEmbeddingEndpoint, parentEnv?: NodeJS.ProcessEnv): Record<string, string>;
|
|
25
|
+
/**
|
|
26
|
+
* lazykatok's OpenAI-compatible embedder (0.3.3+). It speaks `POST /v1/embeddings` only, so a TEI endpoint
|
|
27
|
+
* cannot be offered and lazykatok keeps its own embedder, as discrawl does.
|
|
28
|
+
*/
|
|
29
|
+
export declare function lazykatokEmbeddingEnv(endpoint: ResolvedEmbeddingEndpoint, parentEnv?: NodeJS.ProcessEnv): Record<string, string> | undefined;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* pipeline reports the surface as unsearched and hands the operator the CLI's
|
|
7
7
|
* own words: failure kind, exit status, and stderr verbatim.
|
|
8
8
|
*/
|
|
9
|
-
/** The failure payload every datasource CLI client returns (lazykatok, discrawl,
|
|
9
|
+
/** The failure payload every datasource CLI client returns (lazykatok, discrawl, mailcrawl, …). */
|
|
10
10
|
export interface DatasourceCliFailure {
|
|
11
11
|
readonly reason: string;
|
|
12
12
|
readonly stderr?: string;
|
|
@@ -10,13 +10,14 @@ export { CLOUD_DRIVE_SKILL_DEFINITION, CloudDriveSkill, type CloudDriveSkillOpti
|
|
|
10
10
|
export { DEFAULT_DISCRAWL_EMBEDDING_MODEL, DEFAULT_DISCRAWL_MODE, DiscrawlClient, type DiscrawlFailureReason, DiscrawlFtsMethod, DiscrawlHybridMethod, type DiscrawlOptions, type DiscrawlSearchHit, type DiscrawlSearchMode, type DiscrawlSearchOptions, type DiscrawlSearchResult, DiscrawlSemanticMethod, DiscrawlSkill, type DiscrawlSkillClient, type DiscrawlSkillOptions, ENGLISH_ONLY_EMBEDDING_MODELS, } from "./skills/discrawl/index.js";
|
|
11
11
|
export { BUILTIN_DATASOURCE_SKILL_NAMES, type BuildDatasourceSkillsResult, buildDatasourceSkills, type DatasourceSkillConfig, type DatasourcesConfig, } from "./skills/factory.js";
|
|
12
12
|
export { GitHubConnector, type GitHubConnectorOptions, GitHubSkill, type GitHubSkillOptions, } from "./skills/github/index.js";
|
|
13
|
+
export { HISTER_SKILL_TYPE, HisterClient, type HisterClientOptions, HisterSkill, type HisterSkillOptions, } from "./skills/hister/index.js";
|
|
13
14
|
export { LarkClient, type LarkClientOptions, LarkSkill, type LarkSkillOptions } from "./skills/lark/index.js";
|
|
14
15
|
export type { LazykatokFailureReason, LazykatokHit, LazykatokOptions, LazykatokSearchMode, LazykatokSearchOptions, LazykatokSearchResult, LazykatokSkillClient, LazykatokSkillOptions, } from "./skills/lazykatok/index.js";
|
|
15
16
|
export { LazykatokBm25Method, LazykatokClient, LazykatokSemanticMethod, LazykatokSkill, } from "./skills/lazykatok/index.js";
|
|
16
17
|
export { MailExportConnector, type MailExportConnectorOptions, MailExportSkill, type MailExportSkillOptions, } from "./skills/mail-export/index.js";
|
|
17
18
|
export { MAILCRAWL_MODES, MailcrawlClient, type MailcrawlFailure, type MailcrawlFailureReason, type MailcrawlIndexInfo, MailcrawlMethod, type MailcrawlOptions, type MailcrawlSearchHit, type MailcrawlSearchMode, type MailcrawlSearchResult, MailcrawlSkill, type MailcrawlSyncInfo, type MailcrawlSyncResult, } from "./skills/mailcrawl/index.js";
|
|
18
19
|
export { NotcrawlClient, type NotcrawlOptions, NotionSkill, type NotionSkillOptions, } from "./skills/notion/index.js";
|
|
19
|
-
export { ObsidianBm25Method,
|
|
20
|
+
export { ObsidianBm25Method, type ObsidianMethodOptions, ObsidianSemanticMethod, ObsidianSkill, type ObsidianSkillOptions, } from "./skills/obsidian/index.js";
|
|
20
21
|
export { RssConnector, type RssConnectorOptions, type RssFeedConfig, RssSkill, type RssSkillOptions, } from "./skills/rss/index.js";
|
|
21
22
|
export { SlackSkill, type SlackSkillOptions, SlacrawlClient, type SlacrawlOptions, } from "./skills/slack/index.js";
|
|
22
23
|
export { SpotlightConnector, type SpotlightConnectorOptions, SpotlightSkill, type SpotlightSkillOptions, } from "./skills/spotlight/index.js";
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* The sidecar's own database always lives under the AutoRAG workspace, one file
|
|
13
13
|
* per datasource instance, never next to (or inside) the crawler's archive.
|
|
14
14
|
*/
|
|
15
|
+
import type { Embedder } from "../../embedding/embedder.js";
|
|
15
16
|
import type { CrawlerDescriptor } from "./descriptors.js";
|
|
16
17
|
import type { CrawlerSidecarOptions } from "./index.js";
|
|
17
18
|
export interface ResolveSidecarInput {
|
|
@@ -22,5 +23,7 @@ export interface ResolveSidecarInput {
|
|
|
22
23
|
readonly instanceId: string;
|
|
23
24
|
/** Where the crawler keeps its archive when the user did not say. */
|
|
24
25
|
readonly defaultCrawlerDb: string;
|
|
26
|
+
/** The embedder shared with the rest of AutoRAG. Without one the sidecar is lexical-only. */
|
|
27
|
+
readonly embedder?: Embedder;
|
|
25
28
|
}
|
|
26
29
|
export declare function resolveSidecarOptions(input: ResolveSidecarInput): CrawlerSidecarOptions | undefined;
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* Everything crawler-specific lives in a {@link CrawlerDescriptor}; this file
|
|
12
12
|
* is shared by every crawler.
|
|
13
13
|
*/
|
|
14
|
-
import type { Embedder } from "../../embedding
|
|
14
|
+
import type { Embedder } from "../../embedding/embedder.js";
|
|
15
15
|
import type { CrawlerDescriptor } from "./descriptors.js";
|
|
16
16
|
export interface SidecarHit {
|
|
17
17
|
readonly key: string;
|
|
@@ -13,6 +13,7 @@ export declare class DiscrawlClient {
|
|
|
13
13
|
private readonly options;
|
|
14
14
|
constructor(options?: DiscrawlOptions);
|
|
15
15
|
configureEmbeddings(runtime: DiscrawlEmbeddingRuntime): Promise<DiscrawlEmbeddingConfigResult>;
|
|
16
|
+
private resolveRuntime;
|
|
16
17
|
prepareEmbeddings(): Promise<boolean>;
|
|
17
18
|
metadata(signal?: AbortSignal): Promise<DiscrawlMetadataResult>;
|
|
18
19
|
doctor(signal?: AbortSignal): Promise<DiscrawlDoctorResult>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { EmbedderEndpoint } from "../../../embedding/embedder.js";
|
|
2
|
+
import type { DiscrawlEmbeddingRuntime } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* discrawl keeps `openai_compatible` embeddings off ("requires API key env ...") unless the variable its
|
|
5
|
+
* config names is non-empty, while `minsync serve` has no authentication and ignores the value. For the
|
|
6
|
+
* local daemon AutoRAG therefore names a variable of its own and supplies this fixed, non-secret placeholder
|
|
7
|
+
* to the discrawl child only. It is never a credential and never read from the operator's environment.
|
|
8
|
+
*/
|
|
9
|
+
export declare const LOCAL_EMBEDDING_KEY_ENV = "AUTORAG_LOCAL_EMBEDDING_KEY";
|
|
10
|
+
export declare const LOCAL_EMBEDDING_KEY_PLACEHOLDER = "local";
|
|
11
|
+
/**
|
|
12
|
+
* What discrawl's own `[search.embeddings]` section should say so that it embeds through the same backend
|
|
13
|
+
* as the rest of AutoRAG. discrawl speaks OpenAI `POST {base_url}/embeddings` only (its provider name is
|
|
14
|
+
* `openai_compatible`, with an underscore), so a TEI endpoint cannot be offered and discrawl keeps its own
|
|
15
|
+
* configuration. A remote key travels as the name of an environment variable, never as a value.
|
|
16
|
+
*/
|
|
17
|
+
export declare function discrawlEmbeddingRuntimeFor(endpoint: EmbedderEndpoint | undefined): DiscrawlEmbeddingRuntime | undefined;
|
|
@@ -43,7 +43,12 @@ export interface DiscrawlEmbeddingRuntime {
|
|
|
43
43
|
readonly provider: string;
|
|
44
44
|
readonly model: string;
|
|
45
45
|
readonly baseUrl: string;
|
|
46
|
-
|
|
46
|
+
/** Omitted when the endpoint's dimension is not known; discrawl infers it from the first response. */
|
|
47
|
+
readonly dimensions?: number;
|
|
48
|
+
/** Name of the environment variable that holds the bearer token (remote endpoints). Never the token. */
|
|
49
|
+
readonly apiKeyEnv?: string;
|
|
50
|
+
/** A non-secret placeholder for a keyless local daemon, passed to the child only. Never set for a remote endpoint. */
|
|
51
|
+
readonly apiKeyValue?: string;
|
|
47
52
|
readonly identity?: string;
|
|
48
53
|
}
|
|
49
54
|
export interface DiscrawlEmbeddingConfigResult {
|
|
@@ -78,8 +83,11 @@ export interface DiscrawlOptions {
|
|
|
78
83
|
readonly guildId?: string;
|
|
79
84
|
/** Embedding provider understood by the native discrawl configuration. */
|
|
80
85
|
readonly embeddingProvider?: string;
|
|
81
|
-
/**
|
|
82
|
-
|
|
86
|
+
/**
|
|
87
|
+
* Where discrawl should embed, written into a managed workspace config. A function is evaluated on each
|
|
88
|
+
* `prepareEmbeddings`, because the endpoint of a `minsync serve` daemon exists only while it runs.
|
|
89
|
+
*/
|
|
90
|
+
readonly embeddingRuntime?: DiscrawlEmbeddingRuntime | (() => Promise<DiscrawlEmbeddingRuntime | undefined>);
|
|
83
91
|
/**
|
|
84
92
|
* Embedding model understood by the native discrawl configuration.
|
|
85
93
|
* English-only models are accepted but reported through a diagnostic.
|
|
@@ -7,8 +7,11 @@
|
|
|
7
7
|
* configuration path. Unknown skill names and disabled entries are skipped
|
|
8
8
|
* and reported so setup surfaces actionable (but path-opaque) feedback.
|
|
9
9
|
*/
|
|
10
|
+
import type { Embedder } from "../../embedding/embedder.js";
|
|
11
|
+
import type { EmbeddingEndpointSource } from "../embedding-env.js";
|
|
10
12
|
import type { DatasourceSkill } from "../types.js";
|
|
11
13
|
import { type DiscrawlEmbeddingRuntime } from "./discrawl/index.js";
|
|
14
|
+
import { type ObsidianMinSyncOptions } from "./obsidian/index.js";
|
|
12
15
|
/** One configured datasource entry (the trusted `datasources.<name>` value). */
|
|
13
16
|
export interface DatasourceSkillConfig {
|
|
14
17
|
readonly enabled?: boolean;
|
|
@@ -34,6 +37,19 @@ export interface BuildDatasourceSkillsResult {
|
|
|
34
37
|
/** Names that were configured but not recognized. */
|
|
35
38
|
readonly unknown: readonly string[];
|
|
36
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* What the shared embedding backend gives a datasource. AutoRAG-owned semantic stores (chat sidecars, the
|
|
42
|
+
* gist vector index) call the `embedder`; an external CLI that embeds for itself (discrawl) is pointed at the
|
|
43
|
+
* same backend through `discrawl`.
|
|
44
|
+
*/
|
|
45
|
+
export interface DatasourceEmbeddingOptions {
|
|
46
|
+
readonly embedder?: Embedder;
|
|
47
|
+
readonly discrawl?: DiscrawlEmbeddingRuntime | (() => Promise<DiscrawlEmbeddingRuntime | undefined>);
|
|
48
|
+
/** For CLIs that embed for themselves through env (mailcrawl, lazykatok): where the shared backend is. */
|
|
49
|
+
readonly cliEndpoint?: EmbeddingEndpointSource;
|
|
50
|
+
/** MinSync binary, embedder and chunking shared with the local-file index; vault indexes run on it too. */
|
|
51
|
+
readonly minSync?: ObsidianMinSyncOptions;
|
|
52
|
+
}
|
|
37
53
|
/** Skill names this factory can build. */
|
|
38
54
|
export declare const BUILTIN_DATASOURCE_SKILL_NAMES: readonly string[];
|
|
39
55
|
/**
|
|
@@ -42,4 +58,4 @@ export declare const BUILTIN_DATASOURCE_SKILL_NAMES: readonly string[];
|
|
|
42
58
|
* collected in `unknown` (never thrown) so callers can surface setup
|
|
43
59
|
* feedback without failing agent construction.
|
|
44
60
|
*/
|
|
45
|
-
export declare function buildDatasourceSkills(config: DatasourcesConfig | undefined, workspaceRoot?: string,
|
|
61
|
+
export declare function buildDatasourceSkills(config: DatasourcesConfig | undefined, workspaceRoot?: string, embedding?: DatasourceEmbeddingOptions): BuildDatasourceSkillsResult;
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* A small persisted vector sidecar (`vectors.json`) mirrors the chunk store:
|
|
5
5
|
* entries are keyed by chunk id with a content hash so unchanged chunks are
|
|
6
6
|
* never re-embedded, removed chunks are pruned, and an embedding-identity
|
|
7
|
-
* change (provider/model/dimension) forces a full re-embed. The
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* change (provider/model/dimension) forces a full re-embed. The embedder is
|
|
8
|
+
* the one AutoRAG shares with every consumer (MinSync's daemon or in-process
|
|
9
|
+
* engine, or the configured remote endpoint). Every failure degrades —
|
|
10
|
+
* indexing stays lexical-only and retrieval returns [].
|
|
11
11
|
*/
|
|
12
|
-
import type { Embedder } from "../../../embedding
|
|
12
|
+
import type { Embedder } from "../../../embedding/embedder.js";
|
|
13
13
|
import type { RetrievalMethod, RetrievalMethodDescriptor, RetrievalOptions, RetrievalResult } from "../../../retrieval/types.js";
|
|
14
14
|
import type { DatasourceChunkStore, StoredChunk } from "../../chunk-store.js";
|
|
15
15
|
export interface GistSemanticSyncOk {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* through the loopback embedding gateway. Embedding failures degrade to a
|
|
8
8
|
* `semantic-unavailable` warning — indexing and lexical retrieval continue.
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
10
|
+
import type { Embedder } from "../../../embedding/embedder.js";
|
|
11
11
|
import type { RetrievalMethod } from "../../../retrieval/types.js";
|
|
12
12
|
import { ConnectorDatasourceSkill, type ConnectorSkillDefinition, type ConnectorSkillOptions } from "../../connector-skill.js";
|
|
13
13
|
import type { DatasourceIndexOptions, DatasourceIndexResult } from "../../types.js";
|
|
@@ -17,9 +17,8 @@ export declare function gistDatasourceDir(workspaceRoot: string, skillName: stri
|
|
|
17
17
|
export interface GitHubGistSemanticOptions {
|
|
18
18
|
/** Set false to run lexical-only. Default true. */
|
|
19
19
|
readonly enabled?: boolean;
|
|
20
|
-
/**
|
|
20
|
+
/** The embedder shared with the rest of AutoRAG. Without one the gist index is lexical-only. */
|
|
21
21
|
readonly embedder?: Embedder;
|
|
22
|
-
readonly embedderOptions?: GatewayEmbedderOptions;
|
|
23
22
|
/** Vector sidecar path override; defaults under `.autorag/datasources/…`. */
|
|
24
23
|
readonly statePath?: string;
|
|
25
24
|
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP client for a running Hister server (https://github.com/asciimoo/hister, AGPL-3.0).
|
|
3
|
+
*
|
|
4
|
+
* Hister is a separate program. AutoRAG never links, embeds, copies, or modifies its code: this file speaks
|
|
5
|
+
* Hister's public `GET /search` and `GET /api/config` JSON endpoints over HTTP, exactly like Hister's own
|
|
6
|
+
* `hister search` CLI. Hister owns its index, its browser-extension capture, its credentials, and its embeddings.
|
|
7
|
+
*/
|
|
8
|
+
export interface HisterClientOptions {
|
|
9
|
+
/** Hister server, default `http://127.0.0.1:4433`. */
|
|
10
|
+
readonly baseUrl?: string;
|
|
11
|
+
/** Name of the environment variable holding Hister's `app.access_token`. The token itself is never configured. */
|
|
12
|
+
readonly tokenEnv?: string;
|
|
13
|
+
readonly timeoutMs?: number;
|
|
14
|
+
readonly fetchImpl?: typeof fetch;
|
|
15
|
+
readonly env?: Readonly<Record<string, string | undefined>>;
|
|
16
|
+
}
|
|
17
|
+
export interface HisterHit {
|
|
18
|
+
readonly url: string;
|
|
19
|
+
readonly domain: string;
|
|
20
|
+
readonly title: string;
|
|
21
|
+
/** Highlighted-mark-free snippet (or the matched semantic chunk). */
|
|
22
|
+
readonly snippet: string;
|
|
23
|
+
readonly score: number;
|
|
24
|
+
/** Epoch ms of the last visit/update. */
|
|
25
|
+
readonly updatedAt: number | undefined;
|
|
26
|
+
readonly addedAt: number | undefined;
|
|
27
|
+
readonly language: string | undefined;
|
|
28
|
+
readonly description: string | undefined;
|
|
29
|
+
}
|
|
30
|
+
export type HisterFailureKind = "unavailable" | "auth" | "http" | "invalid-output" | "semantic-disabled";
|
|
31
|
+
export interface HisterFailure {
|
|
32
|
+
readonly ok: false;
|
|
33
|
+
readonly kind: HisterFailureKind;
|
|
34
|
+
/** Verbatim: HTTP status and body, or the connection error. */
|
|
35
|
+
readonly message: string;
|
|
36
|
+
}
|
|
37
|
+
export type HisterResult<T> = {
|
|
38
|
+
readonly ok: true;
|
|
39
|
+
readonly value: T;
|
|
40
|
+
} | HisterFailure;
|
|
41
|
+
export interface HisterSearchOptions {
|
|
42
|
+
readonly topK?: number;
|
|
43
|
+
readonly signal?: AbortSignal;
|
|
44
|
+
/** Restrict to one domain (exact match, Hister `domain:`). */
|
|
45
|
+
readonly domain?: string;
|
|
46
|
+
}
|
|
47
|
+
export declare class HisterClient {
|
|
48
|
+
readonly baseUrl: string;
|
|
49
|
+
private readonly tokenEnv;
|
|
50
|
+
private readonly timeoutMs;
|
|
51
|
+
private readonly fetchImpl;
|
|
52
|
+
private readonly env;
|
|
53
|
+
constructor(options?: HisterClientOptions);
|
|
54
|
+
/** Lexical search over web pages only. */
|
|
55
|
+
searchLexical(query: string, options?: HisterSearchOptions): Promise<HisterResult<readonly HisterHit[]>>;
|
|
56
|
+
/**
|
|
57
|
+
* Semantic search. Hister embeds the query itself through the endpoint the operator configured on the server;
|
|
58
|
+
* AutoRAG sends only the question text. `semantic_hits` carry the matched chunk and similarity.
|
|
59
|
+
*/
|
|
60
|
+
searchSemantic(query: string, options?: HisterSearchOptions): Promise<HisterResult<readonly HisterHit[]>>;
|
|
61
|
+
/** Count documents matching a Hister query. */
|
|
62
|
+
count(text: string, signal?: AbortSignal): Promise<HisterResult<number>>;
|
|
63
|
+
/** Reachability and authentication probe. Returns Hister's `/api/config` body. */
|
|
64
|
+
config(signal?: AbortSignal): Promise<HisterResult<Record<string, unknown>>>;
|
|
65
|
+
private search;
|
|
66
|
+
private request;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Wrap a free-text question as a Hister query confined to web pages.
|
|
70
|
+
*
|
|
71
|
+
* Hister ANDs bare terms, so a natural-language question would match almost nothing. Plain words become one
|
|
72
|
+
* alternation group `(a|b|c)`. That pipe is Hister's only OR: the word `OR` is not an operator there, it is searched
|
|
73
|
+
* as the literal English word, which matches most English pages. Hister's own syntax (quoted phrases,
|
|
74
|
+
* `field:value`, wildcards, negation) passes through untouched, and a query using any of it is sent with its plain
|
|
75
|
+
* words ANDed, exactly as written. A `sort:` directive is hoisted out of the group because Hister only honours it at
|
|
76
|
+
* the top level.
|
|
77
|
+
*/
|
|
78
|
+
export declare function buildWebQuery(question: string, domain?: string): string | undefined;
|
|
79
|
+
/** Hister snippets carry `<mark>` highlights and HTML entities; the model reads plain text. */
|
|
80
|
+
export declare function plainSnippet(snippet: string): string;
|
|
81
|
+
/** Stable, opaque id for one page: the same URL always maps to the same chunk id. */
|
|
82
|
+
export declare function pageId(url: string): string;
|
|
83
|
+
export declare function isLoopback(hostname: string): boolean;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sharing AutoRAG's embedding backend with Hister.
|
|
3
|
+
*
|
|
4
|
+
* Hister keeps its own vector store and embeds with whatever `semantic_search` in its config.yml names, so the
|
|
5
|
+
* only way the two can use one model is to copy the shared endpoint (the `minsync serve` daemon by default) into
|
|
6
|
+
* that block. Mismatched models are not an error anywhere: the vectors simply do not line up and results degrade
|
|
7
|
+
* silently. This module derives the block from {@link ResolvedEmbeddingEndpoint}, reads what Hister currently has,
|
|
8
|
+
* and rewrites only the six keys involved. Hister itself is never modified; its config.yml is its documented
|
|
9
|
+
* interface.
|
|
10
|
+
*
|
|
11
|
+
* `yaml` is a dev dependency of this package, so the file is edited line by line. Only the `semantic_search`
|
|
12
|
+
* block's own keys are touched and every other byte is preserved; the tests compare the result with a real YAML
|
|
13
|
+
* parser.
|
|
14
|
+
*/
|
|
15
|
+
import type { ResolvedEmbeddingEndpoint } from "../../embedding-env.js";
|
|
16
|
+
/** The `semantic_search` keys that must agree with the shared embedding backend. */
|
|
17
|
+
export interface HisterSemanticSettings {
|
|
18
|
+
readonly enable: boolean;
|
|
19
|
+
readonly embedding_endpoint: string;
|
|
20
|
+
readonly embedding_model: string;
|
|
21
|
+
readonly dimensions: number;
|
|
22
|
+
readonly query_prefix: string;
|
|
23
|
+
readonly document_prefix: string;
|
|
24
|
+
}
|
|
25
|
+
export type HisterSemanticKey = keyof HisterSemanticSettings;
|
|
26
|
+
/**
|
|
27
|
+
* What Hister uses when its config does not say (v0.20.0 `config.go`): semantic search off, an Ollama endpoint, and
|
|
28
|
+
* a `query: ` prefix. Used only to report a missing key; the apply step always writes every key.
|
|
29
|
+
*/
|
|
30
|
+
export declare const HISTER_SEMANTIC_DEFAULTS: HisterSemanticSettings;
|
|
31
|
+
export type DeriveResult = {
|
|
32
|
+
readonly ok: true;
|
|
33
|
+
readonly settings: HisterSemanticSettings;
|
|
34
|
+
} | {
|
|
35
|
+
readonly ok: false;
|
|
36
|
+
readonly reason: string;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* The settings that make Hister embed exactly like AutoRAG does. Refuses what Hister cannot do faithfully:
|
|
40
|
+
* - a TEI endpoint (Hister only calls the OpenAI `/v1/embeddings` route);
|
|
41
|
+
* - a remote endpoint (browsing text would leave the machine, and Hister's config would have to hold the key).
|
|
42
|
+
*/
|
|
43
|
+
export declare function deriveHisterSemanticSettings(endpoint: ResolvedEmbeddingEndpoint): DeriveResult;
|
|
44
|
+
export declare function differingSemanticKeys(current: HisterSemanticSettings, wanted: HisterSemanticSettings): readonly HisterSemanticKey[];
|
|
45
|
+
export declare function reindexRequired(changed: readonly HisterSemanticKey[]): boolean;
|
|
46
|
+
export type ReadResult = {
|
|
47
|
+
readonly ok: true;
|
|
48
|
+
readonly settings: HisterSemanticSettings;
|
|
49
|
+
/** Keys the file sets itself; the rest are Hister's defaults. */
|
|
50
|
+
readonly explicit: readonly HisterSemanticKey[];
|
|
51
|
+
} | {
|
|
52
|
+
readonly ok: false;
|
|
53
|
+
readonly reason: string;
|
|
54
|
+
};
|
|
55
|
+
export declare function readHisterSemanticSettings(text: string): ReadResult;
|
|
56
|
+
export type ApplyResult = {
|
|
57
|
+
readonly ok: true;
|
|
58
|
+
readonly text: string;
|
|
59
|
+
} | {
|
|
60
|
+
readonly ok: false;
|
|
61
|
+
readonly reason: string;
|
|
62
|
+
};
|
|
63
|
+
/** Set every {@link KEYS} entry inside `semantic_search`, creating the block when it is absent. */
|
|
64
|
+
export declare function applyHisterSemanticSettings(text: string, settings: HisterSemanticSettings): ApplyResult;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { buildWebQuery, HisterClient, type HisterClientOptions, type HisterFailure, type HisterFailureKind, type HisterHit, type HisterResult, type HisterSearchOptions, pageId, } from "./client.js";
|
|
2
|
+
export { HISTER_SKILL_TYPE, HisterSkill, type HisterSkillOptions } from "./skill.js";
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `autorag setup` support for the Hister datasource: is Hister installed and running, and does it embed with the
|
|
3
|
+
* same model as the rest of AutoRAG?
|
|
4
|
+
*
|
|
5
|
+
* Detection never writes anything. Writing Hister's config and restarting its service only happen when the operator
|
|
6
|
+
* passes `--sync-hister`, because that file and that login item belong to Hister and its operator. Hister is never
|
|
7
|
+
* modified; this only edits its documented config.yml, keeps a backup first, and restarts the service the same way
|
|
8
|
+
* the operator would.
|
|
9
|
+
*/
|
|
10
|
+
import type { ManagedEmbedder } from "../../../embedding/embedder.js";
|
|
11
|
+
import { type HisterSemanticKey } from "./embedding.js";
|
|
12
|
+
export interface HisterSetupEmbedding {
|
|
13
|
+
/** Hister's config already matches the shared embedding backend. */
|
|
14
|
+
readonly inSync: boolean;
|
|
15
|
+
/** `semantic_search` keys that differ from the shared backend, sorted. */
|
|
16
|
+
readonly differs: readonly HisterSemanticKey[];
|
|
17
|
+
/** Hister's config file was rewritten by this run. */
|
|
18
|
+
readonly applied: boolean;
|
|
19
|
+
/** Hister must be restarted to read the new config (it was not, or could not be). */
|
|
20
|
+
readonly restartRequired?: boolean;
|
|
21
|
+
/** Existing pages must be re-embedded (`hister reindex`) and that was not done. */
|
|
22
|
+
readonly reindexRequired?: boolean;
|
|
23
|
+
readonly reason?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface HisterSetupReport {
|
|
26
|
+
readonly datasource: string;
|
|
27
|
+
readonly installed: boolean;
|
|
28
|
+
readonly running?: boolean;
|
|
29
|
+
readonly configPath?: string;
|
|
30
|
+
readonly embedding?: HisterSetupEmbedding;
|
|
31
|
+
readonly reason?: string;
|
|
32
|
+
/** What the operator (or an agent) should run next. */
|
|
33
|
+
readonly remediation?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface HisterServiceDeps {
|
|
36
|
+
/** Hister's config.yml path, or undefined when it cannot be determined. */
|
|
37
|
+
readonly configPath?: () => string | undefined;
|
|
38
|
+
/** `GET /api/config` against the datasource's baseUrl. */
|
|
39
|
+
readonly health?: (baseUrl: string) => Promise<{
|
|
40
|
+
readonly reachable: boolean;
|
|
41
|
+
readonly semanticEnabled?: boolean;
|
|
42
|
+
readonly reason?: string;
|
|
43
|
+
}>;
|
|
44
|
+
/** Restart the Hister service. Omitted means the operator must do it. */
|
|
45
|
+
readonly restart?: () => Promise<{
|
|
46
|
+
readonly ok: boolean;
|
|
47
|
+
readonly reason?: string;
|
|
48
|
+
}>;
|
|
49
|
+
/** `hister reindex` against the running server. Omitted means the operator must do it. */
|
|
50
|
+
readonly reindex?: (baseUrl: string) => Promise<{
|
|
51
|
+
readonly ok: boolean;
|
|
52
|
+
readonly reason?: string;
|
|
53
|
+
}>;
|
|
54
|
+
readonly now?: () => number;
|
|
55
|
+
/** Pause between polls while a restarted server comes up. Tests replace it. */
|
|
56
|
+
readonly sleep?: (ms: number) => Promise<void>;
|
|
57
|
+
/** How long to wait for a restarted server before giving up on the reindex. Default 30s. */
|
|
58
|
+
readonly waitMs?: number;
|
|
59
|
+
}
|
|
60
|
+
interface HisterEntry {
|
|
61
|
+
readonly name: string;
|
|
62
|
+
readonly baseUrl: string;
|
|
63
|
+
readonly semantic: boolean;
|
|
64
|
+
readonly tokenEnv?: string;
|
|
65
|
+
}
|
|
66
|
+
/** The first configured `hister` datasource (by template `type` or by name), with its connector options. */
|
|
67
|
+
export declare function findHisterEntries(raw: Record<string, unknown>): readonly HisterEntry[];
|
|
68
|
+
/** Where Hister reads its config on this platform, in the order Hister itself searches (docs/configuration). */
|
|
69
|
+
export declare function defaultHisterConfigPath(env: NodeJS.ProcessEnv, exists?: (path: string) => boolean, platform?: NodeJS.Platform, home?: string): string | undefined;
|
|
70
|
+
/** The real service deps. Restart is only offered where a service manager is known: Homebrew on macOS/Linux. */
|
|
71
|
+
export declare function systemHisterDeps(env: NodeJS.ProcessEnv, hister: string | undefined): HisterServiceDeps;
|
|
72
|
+
/**
|
|
73
|
+
* Probe Hister for every configured `hister` datasource. Writes only when `sync` is true, and then only Hister's own
|
|
74
|
+
* config.yml (after a backup), followed by the service restart and reindex the change needs.
|
|
75
|
+
*/
|
|
76
|
+
export declare function setupHister(options: {
|
|
77
|
+
readonly entries: readonly HisterEntry[];
|
|
78
|
+
readonly embedder: ManagedEmbedder;
|
|
79
|
+
readonly executable: (name: string) => string | undefined;
|
|
80
|
+
readonly deps: HisterServiceDeps;
|
|
81
|
+
readonly sync: boolean;
|
|
82
|
+
readonly assertLockOwned?: () => void;
|
|
83
|
+
}): Promise<{
|
|
84
|
+
readonly reports: readonly HisterSetupReport[];
|
|
85
|
+
readonly changed: boolean;
|
|
86
|
+
}>;
|
|
87
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser web-history datasource backed by a running Hister server.
|
|
3
|
+
*
|
|
4
|
+
* Hister (https://github.com/asciimoo/hister, AGPL-3.0-or-later) is a separate program. It captures the pages a
|
|
5
|
+
* Chromium or Firefox browser visits (through its own extension), keeps the full text, and owns the lexical and
|
|
6
|
+
* semantic indexes, incremental updates, and credentials. AutoRAG only sends search requests to its public HTTP
|
|
7
|
+
* API and maps the answers. It does not link, embed, bundle, copy, or modify Hister, and never hides that Hister
|
|
8
|
+
* is the backend: the manifest names it, its license, and its source.
|
|
9
|
+
*
|
|
10
|
+
* Web pages only: every query is confined to `type:web`, and any document Hister reports with another type
|
|
11
|
+
* (watched local files, remote file snapshots) is dropped. Local directory indexing in Hister is never used.
|
|
12
|
+
*/
|
|
13
|
+
import type { RetrievalMethod, RetrievalOptions, RetrievalResult } from "../../../retrieval/types.js";
|
|
14
|
+
import type { DatasourceIndexOptions, DatasourceIndexResult, DatasourceSkill, DatasourceSkillDescriptor, DatasourceSkillManifest, PollingMetadata, SourceDescription } from "../../types.js";
|
|
15
|
+
import { HisterClient, type HisterClientOptions } from "./client.js";
|
|
16
|
+
export declare const HISTER_SKILL_TYPE = "hister-web-history";
|
|
17
|
+
export interface HisterSkillOptions extends HisterClientOptions {
|
|
18
|
+
readonly client?: HisterClient;
|
|
19
|
+
readonly datasourceId?: string;
|
|
20
|
+
readonly instanceId?: string;
|
|
21
|
+
readonly instances?: readonly string[];
|
|
22
|
+
readonly tags?: readonly string[];
|
|
23
|
+
/**
|
|
24
|
+
* Also register Hister's semantic search. Requires `semantic_search.enable` and an embedding endpoint in the
|
|
25
|
+
* Hister server config; Hister embeds the query text through the endpoint the operator chose there.
|
|
26
|
+
*/
|
|
27
|
+
readonly semantic?: boolean;
|
|
28
|
+
}
|
|
29
|
+
type Mode = "lexical" | "semantic";
|
|
30
|
+
export declare class HisterSkill implements DatasourceSkill {
|
|
31
|
+
private readonly datasourceId;
|
|
32
|
+
private readonly instanceId;
|
|
33
|
+
private readonly instances;
|
|
34
|
+
private readonly tags;
|
|
35
|
+
private readonly semantic;
|
|
36
|
+
private readonly client;
|
|
37
|
+
/** A bad `baseUrl` or token setup is reported through `index()`/search, never thrown out of config loading. */
|
|
38
|
+
private readonly configError;
|
|
39
|
+
private lastIndexedAt;
|
|
40
|
+
private lastError;
|
|
41
|
+
constructor(options?: HisterSkillOptions);
|
|
42
|
+
describe(): DatasourceSkillDescriptor;
|
|
43
|
+
polling(): PollingMetadata;
|
|
44
|
+
/**
|
|
45
|
+
* Hister indexes pages itself the moment the browser extension sends them, so there is nothing to copy.
|
|
46
|
+
* `index()` is a read-only probe: reachability, authentication, how many web pages are searchable, and whether
|
|
47
|
+
* Hister also holds non-web documents that this datasource will never return.
|
|
48
|
+
*/
|
|
49
|
+
index(options?: DatasourceIndexOptions): Promise<DatasourceIndexResult>;
|
|
50
|
+
retrievalMethods(): readonly RetrievalMethod[];
|
|
51
|
+
describeSources(): readonly SourceDescription[];
|
|
52
|
+
skillManifest(): DatasourceSkillManifest;
|
|
53
|
+
search(mode: Mode, query: string, options: RetrievalOptions): Promise<RetrievalResult[]>;
|
|
54
|
+
/** Opaque, stable identity: `/<id>/<instance>/pages/<domain>/<hash of the URL>`. */
|
|
55
|
+
private sourceFor;
|
|
56
|
+
private toResult;
|
|
57
|
+
/** Does the scope reach this datasource at all, and can it be pushed down to Hister as `domain:`? */
|
|
58
|
+
private scopeTarget;
|
|
59
|
+
private failFrom;
|
|
60
|
+
private fail;
|
|
61
|
+
private note;
|
|
62
|
+
}
|
|
63
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { RetrievalOptions } from "../../../retrieval/types.js";
|
|
2
|
+
import type { EmbeddingEndpointSource } from "../../embedding-env.js";
|
|
2
3
|
/**
|
|
3
4
|
* Search modes accepted by the external `lazykatok search` subcommand.
|
|
4
5
|
*
|
|
@@ -43,6 +44,13 @@ export interface LazykatokOptions {
|
|
|
43
44
|
readonly source?: string;
|
|
44
45
|
/** Environment overrides merged on top of `process.env` for the child. */
|
|
45
46
|
readonly env?: Readonly<Record<string, string | undefined>>;
|
|
47
|
+
/**
|
|
48
|
+
* Where lazykatok gets its vectors. When set, `index` and the semantic and hybrid searches run lazykatok's
|
|
49
|
+
* OpenAI-compatible embedder against the endpoint it returns (a `minsync serve` daemon or the operator's
|
|
50
|
+
* remote), and lazykatok's own fastembed model is never used; with no endpoint, or a TEI one, those commands
|
|
51
|
+
* fail instead. Without it lazykatok keeps whatever embedder its own environment selects.
|
|
52
|
+
*/
|
|
53
|
+
readonly embeddingEndpoint?: EmbeddingEndpointSource;
|
|
46
54
|
}
|
|
47
55
|
export declare const DEFAULT_LAZYKATOK_BINARY = "lazykatok";
|
|
48
56
|
export declare const DEFAULT_LAZYKATOK_TIMEOUT_MS = 60000;
|
|
@@ -65,7 +73,7 @@ export declare const DEFAULT_LAZYKATOK_OPTIONS: {
|
|
|
65
73
|
* every method returns a discriminated union with `ok: false` and one of these
|
|
66
74
|
* reasons.
|
|
67
75
|
*/
|
|
68
|
-
export type LazykatokFailureReason = "binary-missing" | "nonzero-exit" | "spawn-error" | "timeout" | "aborted" | "stdout-too-large" | "stderr-too-large" | "invalid-json" | "invalid-shape";
|
|
76
|
+
export type LazykatokFailureReason = "binary-missing" | "nonzero-exit" | "spawn-error" | "timeout" | "aborted" | "stdout-too-large" | "stderr-too-large" | "invalid-json" | "invalid-shape" | "embedding-unavailable";
|
|
69
77
|
/** Common failure payload shared by every method result union. */
|
|
70
78
|
export interface LazykatokFailure {
|
|
71
79
|
readonly ok: false;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EmbeddingEndpointSource } from "../../embedding-env.js";
|
|
1
2
|
export type MailcrawlSearchMode = "keyword" | "bm25" | "semantic" | "hybrid";
|
|
2
3
|
export interface MailcrawlSearchOptions {
|
|
3
4
|
readonly topK?: number;
|
|
@@ -22,8 +23,15 @@ export interface MailcrawlOptions {
|
|
|
22
23
|
readonly indexTimeoutMs?: number;
|
|
23
24
|
readonly maxBufferBytes?: number;
|
|
24
25
|
readonly env?: Readonly<Record<string, string | undefined>>;
|
|
26
|
+
/**
|
|
27
|
+
* Where mailcrawl gets its vectors. When set, `index` and the semantic and hybrid searches run mailcrawl's
|
|
28
|
+
* `openai`/`tei` provider against the endpoint it returns (a `minsync serve` daemon or the operator's remote),
|
|
29
|
+
* and mailcrawl's own native model is never used; with no endpoint those commands fail instead. Without it
|
|
30
|
+
* mailcrawl keeps whatever embedder its own environment selects.
|
|
31
|
+
*/
|
|
32
|
+
readonly embeddingEndpoint?: EmbeddingEndpointSource;
|
|
25
33
|
}
|
|
26
|
-
export type MailcrawlFailureReason = "binary-missing" | "not-configured" | "nonzero-exit" | "spawn-error" | "timeout" | "aborted" | "stdout-too-large" | "stderr-too-large" | "invalid-output" | "remote-embedding-rejected";
|
|
34
|
+
export type MailcrawlFailureReason = "binary-missing" | "not-configured" | "nonzero-exit" | "spawn-error" | "timeout" | "aborted" | "stdout-too-large" | "stderr-too-large" | "invalid-output" | "remote-embedding-rejected" | "embedding-unavailable";
|
|
27
35
|
export interface MailcrawlFailure {
|
|
28
36
|
readonly ok: false;
|
|
29
37
|
readonly reason: MailcrawlFailureReason;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export type { QmdEmbedResult, QmdEnsureResult, QmdFailureReason, QmdOptions, QmdSearchHit, QmdSearchMode, QmdSearchOptions, QmdSearchResult, QmdUpdateResult, } from "./types.js";
|
|
6
|
-
export { DEFAULT_QMD_BINARY, DEFAULT_QMD_MAX_BUFFER_BYTES, DEFAULT_QMD_TIMEOUT_MS, } from "./types.js";
|
|
1
|
+
export { ObsidianBm25Method, type ObsidianMethodOptions, ObsidianSemanticMethod } from "./methods.js";
|
|
2
|
+
export { encodeSourceSegment, obsidianDatasourceDir, obsidianInstanceSource, obsidianMinSyncWorkspace, obsidianNoteSource, } from "./paths.js";
|
|
3
|
+
export { ObsidianSkill, type ObsidianSkillOptions } from "./skill.js";
|
|
4
|
+
export type { ObsidianMinSyncOptions, ObsidianSearchMode } from "./vault-index.js";
|
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
import type { RetrievalMethod, RetrievalMethodDescriptor, RetrievalOptions, RetrievalResult } from "../../../retrieval/types.js";
|
|
2
|
-
import type {
|
|
3
|
-
export interface ObsidianSearchClient {
|
|
4
|
-
search(mode: QmdSearchMode, query: string, options?: QmdSearchOptions): Promise<QmdSearchResult>;
|
|
5
|
-
}
|
|
2
|
+
import type { ObsidianSearchMode, ObsidianVaultIndex } from "./vault-index.js";
|
|
6
3
|
export interface ObsidianMethodOptions {
|
|
7
|
-
readonly
|
|
8
|
-
readonly
|
|
9
|
-
readonly tags?: readonly string[];
|
|
4
|
+
readonly index: ObsidianVaultIndex;
|
|
5
|
+
readonly tags: readonly string[];
|
|
10
6
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
private readonly
|
|
7
|
+
/** One MinSync query mode over one vault. A failure reaches the pipeline verbatim and is reported as unsearched. */
|
|
8
|
+
declare class ObsidianMinSyncMethod implements RetrievalMethod {
|
|
9
|
+
private readonly index;
|
|
14
10
|
private readonly tags;
|
|
15
|
-
|
|
11
|
+
private readonly mode;
|
|
12
|
+
constructor(mode: ObsidianSearchMode, options: ObsidianMethodOptions);
|
|
16
13
|
describe(): RetrievalMethodDescriptor;
|
|
17
14
|
retrieve(query: string, options: RetrievalOptions): Promise<RetrievalResult[]>;
|
|
18
15
|
}
|
|
19
|
-
export declare class
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
export declare class ObsidianBm25Method extends ObsidianMinSyncMethod {
|
|
17
|
+
constructor(options: ObsidianMethodOptions);
|
|
18
|
+
}
|
|
19
|
+
export declare class ObsidianSemanticMethod extends ObsidianMinSyncMethod {
|
|
23
20
|
constructor(options: ObsidianMethodOptions);
|
|
24
|
-
describe(): RetrievalMethodDescriptor;
|
|
25
|
-
retrieve(query: string, options: RetrievalOptions): Promise<RetrievalResult[]>;
|
|
26
21
|
}
|
|
22
|
+
export {};
|