@autorag/librarian 2.10.4 → 2.10.6
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 +9 -9
- package/README.md +32 -17
- package/dist/agent/agent.d.ts +63 -51
- 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/pi-session.d.ts +21 -1
- package/dist/agent/query-decomposition.d.ts +1 -1
- package/dist/agent/search-documents.d.ts +2 -2
- package/dist/agent/system-prompt.d.ts +1 -1
- package/dist/agent/web-search-tool.d.ts +2 -2
- package/dist/cli/commands/models.d.ts +0 -14
- package/dist/cli/commands/search.d.ts +3 -4
- package/dist/cli/config.d.ts +7 -19
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +6056 -9408
- package/dist/cli/setup.d.ts +13 -36
- package/dist/cli/whatsapp-extension.d.ts +21 -0
- package/dist/cloud/config.d.ts +3 -3
- package/dist/core.js +7126 -9804
- package/dist/datasource/embedding-env.d.ts +29 -0
- 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 +14 -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/lazykatok/types.d.ts +9 -1
- package/dist/datasource/skills/mailcrawl/types.d.ts +9 -1
- 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 +7149 -9829
- package/dist/mcp/index.js +7146 -9824
- 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 +19 -10
- package/dist/minsync/embedder-config.d.ts +11 -1
- package/dist/minsync/index.d.ts +1 -1
- package/dist/minsync/installer.d.ts +1 -1
- package/dist/minsync/kiwi.d.ts +17 -0
- package/dist/minsync/lexical-language.d.ts +18 -0
- package/dist/minsync/method.d.ts +3 -11
- package/dist/minsync/process.d.ts +1 -0
- package/dist/minsync/types.d.ts +9 -2
- package/dist/retrieval/rerank.d.ts +10 -3
- package/dist/web/search/types.d.ts +22 -18
- package/package.json +4 -3
- package/skills/autorag/SKILL.md +3 -8
- package/skills/autorag-doctor/SKILL.md +47 -26
- package/skills/autorag-lite-setup/SKILL.md +8 -8
- package/skills/autorag-setup/SKILL.md +39 -23
- 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/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
|
@@ -189,20 +189,28 @@ is impossible, refresh continues without this optimization and the user is
|
|
|
189
189
|
told duplicate exclusion is off. Set `"excludeExactDuplicates": false` to
|
|
190
190
|
index every copy.
|
|
191
191
|
|
|
192
|
-
|
|
193
|
-
(`
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
192
|
+
AutoRAG owns no embedding model. MinSync provisions the embedder
|
|
193
|
+
(`Qwen/Qwen3-Embedding-0.6B`, 1024 dimensions) in its own cache
|
|
194
|
+
(`~/.cache/minsync/models`); there is no local model download and no bundled
|
|
195
|
+
runtime. One shared embedder serves everything that embeds inside
|
|
196
|
+
AutoRAG: MinSync indexing/query, memory similar-question search, the
|
|
197
|
+
chat-crawler sidecars, the GitHub Gist vector index, and the endpoint external
|
|
198
|
+
CLIs are pointed at. The default needs no embedder flags and no API key. It
|
|
199
|
+
resolves in order:
|
|
200
|
+
|
|
201
|
+
1. A configured remote endpoint (`minSync.embedder`), used for everything; no
|
|
202
|
+
daemon is started and no local model is loaded.
|
|
203
|
+
2. A running `minsync serve` daemon (loopback only; MinSync 0.4.11+).
|
|
204
|
+
AutoRAG never starts it: run `minsync serve --idle-timeout 0` yourself, as
|
|
205
|
+
a launchd/systemd service (see `docs/minsync-setup.md`), or press
|
|
206
|
+
Ctrl+Shift+E in `autorag tui`. `autorag setup` only reports whether it is
|
|
207
|
+
alive.
|
|
208
|
+
3. MinSync's in-process engine, through the optional Node-API addon
|
|
209
|
+
`@nomadamas/minsync-native` (same engine and weights, so bit-for-bit
|
|
210
|
+
identical vectors; not bundled). Without a daemon and without the addon,
|
|
211
|
+
embedding fails with an error naming the missing package.
|
|
212
|
+
|
|
213
|
+
Override the embedder only when intentionally using a remote provider:
|
|
206
214
|
|
|
207
215
|
```bash
|
|
208
216
|
autorag init \
|
|
@@ -213,9 +221,14 @@ autorag init \
|
|
|
213
221
|
--embedder-batch-size 64
|
|
214
222
|
```
|
|
215
223
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
224
|
+
A remote `minSync.embedder` names an `id` (`openai:<model>`, `tei:<model>`, or
|
|
225
|
+
any id together with a `baseUrl`) plus optional `apiKeyEnv` (the **name** of the
|
|
226
|
+
environment variable holding the bearer token), `dimension`, `batchSize`, and
|
|
227
|
+
`timeoutMs`. OpenAI-protocol endpoints POST `{baseUrl}/v1/embeddings`; a `tei:`
|
|
228
|
+
endpoint POSTs `{baseUrl}/embed`; `openai:` with no `baseUrl` means
|
|
229
|
+
`https://api.openai.com`. Only store the environment-variable name, never its
|
|
230
|
+
value. `dimension` and `batchSize` must be positive integers, and `dimension`
|
|
231
|
+
must match the endpoint (the local default is 1024).
|
|
219
232
|
|
|
220
233
|
### Jev routing and question decomposition (on by default)
|
|
221
234
|
|
|
@@ -336,7 +349,7 @@ keeps its mirrors and reports `search-root-unavailable`; see
|
|
|
336
349
|
|
|
337
350
|
## Probe and configure datasource skills (setup wizard)
|
|
338
351
|
|
|
339
|
-
Use `autorag setup` to probe the
|
|
352
|
+
Use `autorag setup` to probe the embedding backend, MinSync, and known
|
|
340
353
|
datasources automatically:
|
|
341
354
|
|
|
342
355
|
```bash
|
|
@@ -393,13 +406,15 @@ aliases with `"type": "<template>"`. Unknown names are skipped with an
|
|
|
393
406
|
Tokens are environment-variable names, not raw secrets. CLI-backed connectors
|
|
394
407
|
keep authentication in their external tool configuration.
|
|
395
408
|
|
|
396
|
-
Mailcrawl must be installed separately (`@nomadamas/mailcrawl@0.2.
|
|
409
|
+
Mailcrawl must be installed separately (`@nomadamas/mailcrawl@0.2.2` or newer)
|
|
397
410
|
and configured through its own Himalaya account. AutoRAG runs its local `sync`
|
|
398
411
|
and `index` lifecycle, then uses the mailcrawl CLI for BM25, semantic, or
|
|
399
412
|
hybrid search. Do not use 0.1.3 or earlier: a no-op sync followed by `index`
|
|
400
|
-
fails with `text array must be non-empty`. 0.2.
|
|
401
|
-
|
|
402
|
-
|
|
413
|
+
fails with `text array must be non-empty`. 0.2.2 embeds through the same
|
|
414
|
+
backend as the rest of AutoRAG (a remote `minSync.embedder`, else the
|
|
415
|
+
`minsync serve` daemon) instead of its own in-process model, and keeps vectors
|
|
416
|
+
in LanceDB. Switching from the old native model rebuilds the semantic index on
|
|
417
|
+
the next `index`. kakao needs `lazykatok` 0.3.3 or newer for the same reason.
|
|
403
418
|
Use mailcrawl for Gmail, IMAP, and Maildir retrieval. The former Gmail REST
|
|
404
419
|
datasource is removed.
|
|
405
420
|
|
|
@@ -415,7 +430,8 @@ autorag refresh --json
|
|
|
415
430
|
autorag search "summarize the collection" --top-k 3 --json --debug
|
|
416
431
|
```
|
|
417
432
|
|
|
418
|
-
- `setup` probes
|
|
433
|
+
- `setup` probes the embedding backend (`embedding.backend`), MinSync, and
|
|
434
|
+
datasource readiness.
|
|
419
435
|
- `status` is model-free and path-opaque.
|
|
420
436
|
- `health` resolves the single model, checks credential presence, and normally
|
|
421
437
|
performs one live completion probe.
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { AgentTool } from "@earendil-works/pi-agent-core";
|
|
2
|
-
import { Type } from "typebox";
|
|
3
|
-
export declare const RECOMMEND_PEER_TARGETS_TOOL_NAME = "recommend_peer_targets";
|
|
4
|
-
declare const recommendPeerTargetsSchema: Type.TObject<{
|
|
5
|
-
query: Type.TString;
|
|
6
|
-
}>;
|
|
7
|
-
export interface PeerTargetRecommendation {
|
|
8
|
-
readonly alias: string;
|
|
9
|
-
readonly matchedTerms: readonly string[];
|
|
10
|
-
readonly displayName?: string;
|
|
11
|
-
readonly description?: string;
|
|
12
|
-
}
|
|
13
|
-
export interface RecommendPeerTargetsDetails {
|
|
14
|
-
readonly method: "recommend_peer_targets";
|
|
15
|
-
readonly resultCount: number;
|
|
16
|
-
readonly matches: readonly PeerTargetRecommendation[];
|
|
17
|
-
}
|
|
18
|
-
export declare function createRecommendPeerTargetsTool(workspacePath: string): AgentTool<typeof recommendPeerTargetsSchema, RecommendPeerTargetsDetails>;
|
|
19
|
-
export {};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type { AgentTool } from "@earendil-works/pi-agent-core";
|
|
2
|
-
import { Type } from "typebox";
|
|
3
|
-
import { type SimplexQueryState } from "../p2p/simplex-query-store.js";
|
|
4
|
-
import type { SimplexTransport } from "../p2p/simplex-transport.js";
|
|
5
|
-
import type { PeerQueryResponse } from "../p2p/wire.js";
|
|
6
|
-
import { EvidenceLedger } from "./evidence-ledger.js";
|
|
7
|
-
export declare const QUERY_PEER_AGENT_TOOL_NAME = "query_peer_agent";
|
|
8
|
-
declare const queryPeerAgentSchema: Type.TObject<{
|
|
9
|
-
alias: Type.TString;
|
|
10
|
-
query: Type.TString;
|
|
11
|
-
topK: Type.TOptional<Type.TInteger>;
|
|
12
|
-
scope: Type.TOptional<Type.TString>;
|
|
13
|
-
}>;
|
|
14
|
-
export interface QueryPeerAgentResult {
|
|
15
|
-
readonly number: number;
|
|
16
|
-
readonly title: string;
|
|
17
|
-
readonly summary: string;
|
|
18
|
-
readonly source: string;
|
|
19
|
-
readonly excerpt: string;
|
|
20
|
-
}
|
|
21
|
-
export interface QueryPeerAgentDetails {
|
|
22
|
-
readonly method: "query_peer_agent";
|
|
23
|
-
readonly ok: boolean;
|
|
24
|
-
readonly alias: string;
|
|
25
|
-
readonly contactId?: number;
|
|
26
|
-
readonly pendingId?: string;
|
|
27
|
-
readonly expiresAt?: string;
|
|
28
|
-
readonly status?: "ok" | "rejected" | "pending";
|
|
29
|
-
readonly answer?: string;
|
|
30
|
-
readonly results?: readonly QueryPeerAgentResult[];
|
|
31
|
-
readonly diagnostics?: PeerQueryResponse["diagnostics"];
|
|
32
|
-
readonly fileCount?: number;
|
|
33
|
-
readonly message?: string;
|
|
34
|
-
}
|
|
35
|
-
export interface QueryPeerAgentToolOptions {
|
|
36
|
-
readonly workspacePath: string;
|
|
37
|
-
readonly openTransport: () => Promise<SimplexTransport>;
|
|
38
|
-
readonly fastTimeoutMs?: number;
|
|
39
|
-
readonly autoStart?: boolean;
|
|
40
|
-
readonly sessionId?: () => string | undefined;
|
|
41
|
-
readonly onResponse?: (state: SimplexQueryState, response: PeerQueryResponse) => void;
|
|
42
|
-
readonly onExpired?: (state: SimplexQueryState) => void;
|
|
43
|
-
/** Run evidence ledger; each peer result is registered so the final emit can cite it by id. */
|
|
44
|
-
readonly ledger?: EvidenceLedger;
|
|
45
|
-
}
|
|
46
|
-
export interface QueryPeerAgentTool extends AgentTool<typeof queryPeerAgentSchema, QueryPeerAgentDetails> {
|
|
47
|
-
readonly ready: Promise<void>;
|
|
48
|
-
close(): Promise<void>;
|
|
49
|
-
}
|
|
50
|
-
export declare function createQueryPeerAgentTool(options: QueryPeerAgentToolOptions): QueryPeerAgentTool;
|
|
51
|
-
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type RuntimeStatus } from "../../embedding-runtime/index.js";
|
|
2
|
-
import type { CommandContext } from "./types.js";
|
|
3
|
-
export interface GatewayCommandDeps {
|
|
4
|
-
runtimeStatus?: () => Promise<RuntimeStatus>;
|
|
5
|
-
stopRuntime?: () => Promise<void>;
|
|
6
|
-
}
|
|
7
|
-
export declare function runGateway(ctx: CommandContext, deps?: GatewayCommandDeps): Promise<number>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { CommandContext } from "./types.js";
|
|
2
|
-
/** Resolve the workspace used for P2P identity/policy, matching `autorag serve`. */
|
|
3
|
-
export declare function resolveP2pWorkspace(ctx: CommandContext): string;
|
|
4
|
-
/**
|
|
5
|
-
* `autorag p2p` — SimpleX peer trust management.
|
|
6
|
-
*/
|
|
7
|
-
export declare function runP2p(ctx: CommandContext): Promise<number>;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { InjectionClassifierModel } from "../../p2p/injection-classifier.js";
|
|
2
|
-
import { type SimplexPeerServer, startSimplexPeerServer, syncSimplexPeers } from "../../p2p/simplex-server.js";
|
|
3
|
-
import { type SimplexTransport, type StartSimplexOptions } from "../../p2p/simplex-transport.js";
|
|
4
|
-
import { type CliConfig, type ResolveAgentModelOptions, type ResolvedAgentModel } from "../config.js";
|
|
5
|
-
import type { CommandContext } from "./types.js";
|
|
6
|
-
export interface ServeCommandDeps {
|
|
7
|
-
readonly startSimplexPeerServer?: typeof startSimplexPeerServer;
|
|
8
|
-
readonly startSimplexChat?: (options: StartSimplexOptions) => Promise<SimplexTransport>;
|
|
9
|
-
readonly syncSimplexPeers?: typeof syncSimplexPeers;
|
|
10
|
-
readonly waitUntilStopped?: (server: SimplexPeerServer) => Promise<void>;
|
|
11
|
-
readonly modelResolver?: (config: CliConfig, options?: ResolveAgentModelOptions) => ResolvedAgentModel | Promise<ResolvedAgentModel>;
|
|
12
|
-
}
|
|
13
|
-
export declare function createInjectionClassifierModel(resolved: ResolvedAgentModel): InjectionClassifierModel;
|
|
14
|
-
/**
|
|
15
|
-
* `autorag serve` — start the P2P peer query server over SimpleX Chat.
|
|
16
|
-
* Peers reach this installation through SimpleX; all security gates run
|
|
17
|
-
* unchanged.
|
|
18
|
-
*/
|
|
19
|
-
export declare function runServe(ctx: CommandContext, deps?: ServeCommandDeps): Promise<number>;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export { CacheError } from "./types.js";
|
|
2
|
-
export interface CacheAsset {
|
|
3
|
-
readonly id: string;
|
|
4
|
-
readonly url: string;
|
|
5
|
-
readonly filename: string;
|
|
6
|
-
readonly sha256: string;
|
|
7
|
-
readonly kind?: "model" | "runtime";
|
|
8
|
-
readonly archiveMembers?: readonly string[];
|
|
9
|
-
}
|
|
10
|
-
export declare function cacheDirectory(kind: "models" | "runtime", cacheRoot?: string): string;
|
|
11
|
-
export interface CacheOptions {
|
|
12
|
-
readonly cacheRoot?: string;
|
|
13
|
-
readonly offline?: boolean;
|
|
14
|
-
readonly fetch?: typeof globalThis.fetch;
|
|
15
|
-
/** Total budget (ms) for a single asset download. Defaults to 10 minutes so large models can transfer. */
|
|
16
|
-
readonly downloadTimeoutMs?: number;
|
|
17
|
-
}
|
|
18
|
-
export declare function verifyCacheEntry(path: string, expectedSha256: string): Promise<string>;
|
|
19
|
-
/**
|
|
20
|
-
* Marker a distributor writes inside `<archive>.extracted/` when it ships the
|
|
21
|
-
* runtime already extracted instead of as the pinned archive. Its content is the
|
|
22
|
-
* archive's SHA-256, so a tree provisioned for another runtime build is never
|
|
23
|
-
* taken for this one. A signed and notarized macOS app needs this: every Mach-O
|
|
24
|
-
* it carries must be re-signed with the app's Developer ID, so the binaries can
|
|
25
|
-
* no longer be packed back into an archive that matches the pinned digest.
|
|
26
|
-
*/
|
|
27
|
-
export declare const PROVISIONED_RUNTIME_MARKER = ".autorag-archive-sha256";
|
|
28
|
-
export declare function hasVerifiedAsset(asset: CacheAsset, cacheRoot?: string): Promise<boolean>;
|
|
29
|
-
export declare function downloadAsset(asset: CacheAsset, options?: CacheOptions): Promise<string>;
|
|
30
|
-
export declare function importAsset(sourcePath: string, asset: CacheAsset, options?: CacheOptions): Promise<string>;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { ProfileId } from "./types.js";
|
|
2
|
-
export interface EmbeddingIdentity {
|
|
3
|
-
readonly provider: string;
|
|
4
|
-
readonly model: string;
|
|
5
|
-
readonly dimension: number;
|
|
6
|
-
}
|
|
7
|
-
/** Embedder contract: identity is async because the gateway resolves it lazily. */
|
|
8
|
-
export interface Embedder {
|
|
9
|
-
identity(): Promise<EmbeddingIdentity>;
|
|
10
|
-
embed(texts: readonly string[]): Promise<readonly (readonly number[])[]>;
|
|
11
|
-
}
|
|
12
|
-
export interface GatewayEmbedderOptions {
|
|
13
|
-
/** Runtime resolver; defaults to the shared embedding-runtime ensureRuntime. */
|
|
14
|
-
readonly runtime?: {
|
|
15
|
-
ensureRuntime(input?: {
|
|
16
|
-
profileId?: ProfileId;
|
|
17
|
-
cachedOnly?: boolean;
|
|
18
|
-
}): Promise<{
|
|
19
|
-
baseUrl: string;
|
|
20
|
-
identity: {
|
|
21
|
-
provider: string;
|
|
22
|
-
model: string;
|
|
23
|
-
dimension: number;
|
|
24
|
-
};
|
|
25
|
-
}>;
|
|
26
|
-
};
|
|
27
|
-
readonly profileId?: ProfileId;
|
|
28
|
-
readonly fetchImpl?: typeof fetch;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Texts per `/v1/embeddings` call. The llama.cpp upstream rejects very large
|
|
32
|
-
* batches (HTTP 413 on a full-archive sync), so embedding fans out in
|
|
33
|
-
* bounded sequential batches while preserving input order.
|
|
34
|
-
*/
|
|
35
|
-
export declare const EMBED_BATCH_SIZE = 32;
|
|
36
|
-
/**
|
|
37
|
-
* Production embedder backed by the loopback autorag-gateway. The runtime is
|
|
38
|
-
* ensured lazily with `cachedOnly` so embedding never triggers a model
|
|
39
|
-
* download; an unprimed cache surfaces as a caller-side degrade.
|
|
40
|
-
*/
|
|
41
|
-
export declare function createGatewayEmbedder(options?: GatewayEmbedderOptions): Embedder;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { RuntimeProfile } from "./types.js";
|
|
2
|
-
export type GatewayErrorCode = "non-loopback-host" | "non-loopback-upstream" | "bad-request" | "batch-limit" | "upstream" | "upstream-violation" | "timeout";
|
|
3
|
-
export declare class GatewayError extends Error {
|
|
4
|
-
readonly code: GatewayErrorCode;
|
|
5
|
-
readonly status: number;
|
|
6
|
-
constructor(code: GatewayErrorCode, message: string, status?: number, options?: {
|
|
7
|
-
readonly cause?: unknown;
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
export interface StartEmbeddingGatewayOptions {
|
|
11
|
-
readonly profile: RuntimeProfile;
|
|
12
|
-
readonly host?: string;
|
|
13
|
-
readonly port?: number;
|
|
14
|
-
readonly upstreamUrl: string;
|
|
15
|
-
readonly fetch?: typeof fetch;
|
|
16
|
-
readonly maxInputs?: number;
|
|
17
|
-
readonly maxCharacters?: number;
|
|
18
|
-
readonly timeoutMs?: number;
|
|
19
|
-
}
|
|
20
|
-
export interface EmbeddingGateway {
|
|
21
|
-
readonly host: string;
|
|
22
|
-
readonly port: number;
|
|
23
|
-
readonly url: string;
|
|
24
|
-
close(): Promise<void>;
|
|
25
|
-
}
|
|
26
|
-
export declare function isLoopbackHost(host: string): boolean;
|
|
27
|
-
export declare function startEmbeddingGateway(options: StartEmbeddingGatewayOptions): Promise<EmbeddingGateway>;
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { type CacheOptions } from "./cache.js";
|
|
2
|
-
import { startEmbeddingGateway } from "./gateway.js";
|
|
3
|
-
import { type SupervisorStatus } from "./supervisor.js";
|
|
4
|
-
import type { BackendKind, HealthStatus, ProfileId, RuntimeProfile } from "./types.js";
|
|
5
|
-
export interface EmbeddingRuntimeCache {
|
|
6
|
-
downloadAsset(asset: {
|
|
7
|
-
id: string;
|
|
8
|
-
url: string;
|
|
9
|
-
filename: string;
|
|
10
|
-
sha256: string;
|
|
11
|
-
kind?: "model" | "runtime";
|
|
12
|
-
archiveMembers?: readonly string[];
|
|
13
|
-
}, options?: CacheOptions): Promise<string>;
|
|
14
|
-
importAsset(sourcePath: string, asset: {
|
|
15
|
-
id: string;
|
|
16
|
-
url: string;
|
|
17
|
-
filename: string;
|
|
18
|
-
sha256: string;
|
|
19
|
-
kind?: "model" | "runtime";
|
|
20
|
-
archiveMembers?: readonly string[];
|
|
21
|
-
}, options?: CacheOptions): Promise<string>;
|
|
22
|
-
verifyCacheEntry(path: string, expectedSha256: string): Promise<string>;
|
|
23
|
-
hasVerifiedAsset?(asset: {
|
|
24
|
-
id: string;
|
|
25
|
-
url: string;
|
|
26
|
-
filename: string;
|
|
27
|
-
sha256: string;
|
|
28
|
-
kind?: "model" | "runtime";
|
|
29
|
-
archiveMembers?: readonly string[];
|
|
30
|
-
}, cacheRoot?: string): Promise<boolean>;
|
|
31
|
-
}
|
|
32
|
-
export interface EmbeddingRuntimeSupervisor {
|
|
33
|
-
ensureRunning(): Promise<SupervisorStatus>;
|
|
34
|
-
shutdown(): Promise<void>;
|
|
35
|
-
status(): SupervisorStatus;
|
|
36
|
-
}
|
|
37
|
-
export interface EmbeddingRuntimeGateway {
|
|
38
|
-
readonly url: string;
|
|
39
|
-
close(): Promise<void>;
|
|
40
|
-
}
|
|
41
|
-
export interface EmbeddingRuntimeOptions {
|
|
42
|
-
cacheRoot?: string;
|
|
43
|
-
backend?: BackendKind;
|
|
44
|
-
offline?: boolean;
|
|
45
|
-
platform?: "darwin-arm64-metal" | "win-x64-cpu" | "win-x64-vulkan";
|
|
46
|
-
fetch?: typeof fetch;
|
|
47
|
-
supervisor?: EmbeddingRuntimeSupervisor;
|
|
48
|
-
cache?: EmbeddingRuntimeCache;
|
|
49
|
-
gatewayFactory?: (options: Parameters<typeof startEmbeddingGateway>[0]) => Promise<EmbeddingRuntimeGateway>;
|
|
50
|
-
}
|
|
51
|
-
export interface EnsureRuntimeOptions extends EmbeddingRuntimeOptions {
|
|
52
|
-
profileId?: ProfileId;
|
|
53
|
-
/** Refuse downloads; used by MinSync refresh/query paths. */
|
|
54
|
-
cachedOnly?: boolean;
|
|
55
|
-
}
|
|
56
|
-
export interface RuntimeIdentity {
|
|
57
|
-
readonly profileId: ProfileId;
|
|
58
|
-
readonly provider: string;
|
|
59
|
-
readonly model: string;
|
|
60
|
-
readonly dimension: number;
|
|
61
|
-
readonly runtimeBuild: string;
|
|
62
|
-
readonly modelRevision: string;
|
|
63
|
-
readonly artifactSha256: string;
|
|
64
|
-
}
|
|
65
|
-
export interface EnsuredRuntime {
|
|
66
|
-
readonly baseUrl: string;
|
|
67
|
-
readonly profile: RuntimeProfile;
|
|
68
|
-
readonly identity: RuntimeIdentity;
|
|
69
|
-
readonly supervisor: SupervisorStatus;
|
|
70
|
-
}
|
|
71
|
-
export interface RuntimeStatus {
|
|
72
|
-
readonly state: SupervisorStatus["state"];
|
|
73
|
-
readonly backend: BackendKind;
|
|
74
|
-
readonly model: string;
|
|
75
|
-
readonly pid?: number;
|
|
76
|
-
readonly port?: number;
|
|
77
|
-
readonly uptimeMs?: number;
|
|
78
|
-
readonly lastError?: string;
|
|
79
|
-
readonly profileId?: ProfileId;
|
|
80
|
-
readonly baseUrl?: string;
|
|
81
|
-
readonly health: HealthStatus;
|
|
82
|
-
}
|
|
83
|
-
export declare function createEmbeddingRuntime(options?: EmbeddingRuntimeOptions): {
|
|
84
|
-
resolveRuntimeProfile: (profileId?: ProfileId) => RuntimeProfile;
|
|
85
|
-
ensureRuntime: (input?: EnsureRuntimeOptions) => Promise<EnsuredRuntime>;
|
|
86
|
-
releaseRuntimeHandles: () => Promise<void>;
|
|
87
|
-
stopRuntime: () => Promise<void>;
|
|
88
|
-
runtimeStatus: () => Promise<RuntimeStatus>;
|
|
89
|
-
prefetchModel: (profileId?: ProfileId) => Promise<{
|
|
90
|
-
profileId: "qwen3-embedding-0.6b";
|
|
91
|
-
path: string;
|
|
92
|
-
}>;
|
|
93
|
-
importModel: (profileId: ProfileId | undefined, sourcePath: string) => Promise<{
|
|
94
|
-
profileId: "qwen3-embedding-0.6b";
|
|
95
|
-
path: string;
|
|
96
|
-
}>;
|
|
97
|
-
verifyModel: (profileId?: ProfileId) => Promise<{
|
|
98
|
-
profileId: "qwen3-embedding-0.6b";
|
|
99
|
-
path: string;
|
|
100
|
-
hash: string;
|
|
101
|
-
}>;
|
|
102
|
-
};
|
|
103
|
-
export declare const resolveRuntimeProfile: (profileId?: ProfileId) => RuntimeProfile;
|
|
104
|
-
export declare const ensureRuntime: (input?: EnsureRuntimeOptions) => Promise<EnsuredRuntime>;
|
|
105
|
-
export declare const releaseRuntimeHandles: () => Promise<void>;
|
|
106
|
-
export declare const stopRuntime: () => Promise<void>;
|
|
107
|
-
export declare const runtimeStatus: () => Promise<RuntimeStatus>;
|
|
108
|
-
export declare const prefetchModel: (profileId?: ProfileId) => Promise<{
|
|
109
|
-
profileId: "qwen3-embedding-0.6b";
|
|
110
|
-
path: string;
|
|
111
|
-
}>;
|
|
112
|
-
export declare const importModel: (profileId: ProfileId | undefined, sourcePath: string) => Promise<{
|
|
113
|
-
profileId: "qwen3-embedding-0.6b";
|
|
114
|
-
path: string;
|
|
115
|
-
}>;
|
|
116
|
-
export declare const verifyModel: (profileId?: ProfileId) => Promise<{
|
|
117
|
-
profileId: "qwen3-embedding-0.6b";
|
|
118
|
-
path: string;
|
|
119
|
-
hash: string;
|
|
120
|
-
}>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { BackendKind, PlatformId, ProfileId, RuntimeAsset, RuntimeProfile } from "./types.js";
|
|
2
|
-
export declare function resolveProfile(profileId: ProfileId): RuntimeProfile;
|
|
3
|
-
export declare function platformRuntimeAsset(platform: PlatformId): RuntimeAsset;
|
|
4
|
-
export declare function selectPlatformAsset(platform: PlatformId, backend: BackendKind, vulkanAvailable?: boolean): RuntimeAsset;
|
|
5
|
-
export declare const MODEL_ASSETS: {
|
|
6
|
-
readonly qwen3: {
|
|
7
|
-
readonly url: "https://huggingface.co/Qwen/Qwen3-Embedding-0.6B-GGUF/resolve/370f27d7550e0def9b39c1f16d3fbaa13aa67728/Qwen3-Embedding-0.6B-Q8_0.gguf";
|
|
8
|
-
readonly revision: "370f27d7550e0def9b39c1f16d3fbaa13aa67728";
|
|
9
|
-
readonly sha256: "06507c7b42688469c4e7298b0a1e16deff06caf291cf0a5b278c308249c3e439";
|
|
10
|
-
readonly license: "Apache-2.0";
|
|
11
|
-
readonly noticeReference: "Qwen3 model card and Apache-2.0 license";
|
|
12
|
-
readonly intendedUse: "Local loopback embedding for AutoRAG MinSync and native-datasource semantic retrieval. Not a generative model.";
|
|
13
|
-
readonly unsuitableUse: "Chat or generation, remote embedding of corpus text, shipping weights in the npm package, any GGUF other than the pinned SHA-256.";
|
|
14
|
-
readonly upstreamCardUrl: "https://huggingface.co/Qwen/Qwen3-Embedding-0.6B";
|
|
15
|
-
readonly modelCard: "docs/model-cards/qwen3-embedding-0.6b.md";
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
export declare const MODEL_ASSET_URLS: {
|
|
19
|
-
readonly qwen3: "https://huggingface.co/Qwen/Qwen3-Embedding-0.6B-GGUF/resolve/370f27d7550e0def9b39c1f16d3fbaa13aa67728/Qwen3-Embedding-0.6B-Q8_0.gguf";
|
|
20
|
-
};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { type ChildProcess, type SpawnOptions } from "node:child_process";
|
|
2
|
-
import type { BackendKind, ProfileId } from "./types.js";
|
|
3
|
-
export type SupervisorState = "stopped" | "starting" | "ready" | "failed" | "stopping";
|
|
4
|
-
export interface SupervisorStatus {
|
|
5
|
-
readonly state: SupervisorState;
|
|
6
|
-
readonly pid?: number;
|
|
7
|
-
readonly port?: number;
|
|
8
|
-
readonly backend: BackendKind;
|
|
9
|
-
readonly model: string;
|
|
10
|
-
readonly uptimeMs?: number;
|
|
11
|
-
readonly lastError?: string;
|
|
12
|
-
}
|
|
13
|
-
export declare class SupervisorError extends Error {
|
|
14
|
-
readonly code: "lock-conflict" | "readiness-timeout" | "spawn" | "exited" | "shutdown" | "missing-executable";
|
|
15
|
-
constructor(code: SupervisorError["code"], message: string, options?: {
|
|
16
|
-
readonly cause?: unknown;
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
type SpawnLike = (command: string, args: readonly string[], options: SpawnOptions) => ChildProcess;
|
|
20
|
-
type KillLike = (pid: number, signal?: NodeJS.Signals | number) => void;
|
|
21
|
-
export interface SupervisorOptions {
|
|
22
|
-
readonly cacheRoot?: string;
|
|
23
|
-
readonly profileId?: ProfileId;
|
|
24
|
-
readonly backend?: BackendKind;
|
|
25
|
-
readonly executablePath?: string;
|
|
26
|
-
readonly modelPath?: string;
|
|
27
|
-
readonly readinessTimeoutMs?: number;
|
|
28
|
-
readonly readinessIntervalMs?: number;
|
|
29
|
-
readonly logMaxBytes?: number;
|
|
30
|
-
readonly fetch?: typeof globalThis.fetch;
|
|
31
|
-
readonly spawn?: SpawnLike;
|
|
32
|
-
readonly kill?: KillLike;
|
|
33
|
-
readonly platform?: NodeJS.Platform;
|
|
34
|
-
}
|
|
35
|
-
export declare const DEFAULT_READINESS_TIMEOUT_MS = 60000;
|
|
36
|
-
export declare class EmbeddingRuntimeSupervisor {
|
|
37
|
-
private readonly root;
|
|
38
|
-
private readonly backend;
|
|
39
|
-
private readonly executablePath;
|
|
40
|
-
private readonly modelPath;
|
|
41
|
-
private readonly timeoutMs;
|
|
42
|
-
private readonly intervalMs;
|
|
43
|
-
private readonly logMaxBytes;
|
|
44
|
-
private readonly spawnProcess;
|
|
45
|
-
private readonly killProcess;
|
|
46
|
-
private readonly fetchHealth;
|
|
47
|
-
private readonly osPlatform;
|
|
48
|
-
private readonly defaultExecutable;
|
|
49
|
-
private child?;
|
|
50
|
-
private adoptedPid?;
|
|
51
|
-
private startedAt?;
|
|
52
|
-
private currentPort?;
|
|
53
|
-
private state;
|
|
54
|
-
private lastError?;
|
|
55
|
-
private restartCount;
|
|
56
|
-
private shutdownRequested;
|
|
57
|
-
private stopping?;
|
|
58
|
-
constructor(options?: SupervisorOptions);
|
|
59
|
-
ensureRunning(): Promise<SupervisorStatus>;
|
|
60
|
-
status(): SupervisorStatus;
|
|
61
|
-
shutdown(): Promise<void>;
|
|
62
|
-
private adoptExistingRuntime;
|
|
63
|
-
private acquireLock;
|
|
64
|
-
private resolveExecutable;
|
|
65
|
-
private startChild;
|
|
66
|
-
private recoverUnexpectedExit;
|
|
67
|
-
private waitUntilReady;
|
|
68
|
-
private stopAdopted;
|
|
69
|
-
private stopChild;
|
|
70
|
-
private cleanupState;
|
|
71
|
-
private appendLog;
|
|
72
|
-
private readLog;
|
|
73
|
-
}
|
|
74
|
-
export {};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
export type BackendKind = "auto" | "cpu" | "vulkan";
|
|
2
|
-
export type PlatformId = "darwin-arm64-metal" | "win-x64-cpu" | "win-x64-vulkan";
|
|
3
|
-
export type ProfileId = "qwen3-embedding-0.6b";
|
|
4
|
-
export interface ProtocolCapabilities {
|
|
5
|
-
readonly healthz: boolean;
|
|
6
|
-
readonly embed: boolean;
|
|
7
|
-
readonly openaiCompatible: boolean;
|
|
8
|
-
readonly ollamaCompatible: boolean;
|
|
9
|
-
}
|
|
10
|
-
export interface RuntimeProfile {
|
|
11
|
-
readonly profileId: ProfileId;
|
|
12
|
-
readonly provider: string;
|
|
13
|
-
readonly model: string;
|
|
14
|
-
readonly dimension: number;
|
|
15
|
-
readonly queryPrefix: string;
|
|
16
|
-
readonly passagePrefix: string;
|
|
17
|
-
readonly runtimeBuild: string;
|
|
18
|
-
readonly modelRevision: string;
|
|
19
|
-
readonly artifactSha256: string;
|
|
20
|
-
readonly backend: BackendKind;
|
|
21
|
-
readonly protocolCapabilities: ProtocolCapabilities;
|
|
22
|
-
}
|
|
23
|
-
export interface HealthResult {
|
|
24
|
-
readonly ok: true;
|
|
25
|
-
readonly profileId: ProfileId;
|
|
26
|
-
readonly dimension: number;
|
|
27
|
-
readonly runtimeBuild: string;
|
|
28
|
-
}
|
|
29
|
-
export interface HealthFailure {
|
|
30
|
-
readonly ok: false;
|
|
31
|
-
readonly code: "unavailable" | "starting" | "incompatible" | "failed";
|
|
32
|
-
readonly message: string;
|
|
33
|
-
readonly retryable: boolean;
|
|
34
|
-
}
|
|
35
|
-
export type HealthStatus = HealthResult | HealthFailure;
|
|
36
|
-
export interface FailureResult {
|
|
37
|
-
readonly ok: false;
|
|
38
|
-
readonly code: string;
|
|
39
|
-
readonly message: string;
|
|
40
|
-
readonly cause?: unknown;
|
|
41
|
-
}
|
|
42
|
-
export declare class CacheError extends Error {
|
|
43
|
-
readonly code: "invalid-hash" | "offline-missing" | "download" | "hash-mismatch" | "io" | "extraction" | "missing-member";
|
|
44
|
-
readonly path?: string;
|
|
45
|
-
constructor(code: CacheError["code"], message: string, options?: {
|
|
46
|
-
readonly path?: string;
|
|
47
|
-
readonly cause?: unknown;
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
export interface ModelAsset {
|
|
51
|
-
readonly url: string;
|
|
52
|
-
readonly revision: string;
|
|
53
|
-
readonly sha256: string;
|
|
54
|
-
readonly license: string;
|
|
55
|
-
readonly noticeReference: string;
|
|
56
|
-
readonly intendedUse: string;
|
|
57
|
-
readonly unsuitableUse: string;
|
|
58
|
-
readonly upstreamCardUrl: string;
|
|
59
|
-
readonly modelCard: string;
|
|
60
|
-
}
|
|
61
|
-
export interface RuntimeAsset {
|
|
62
|
-
readonly id: string;
|
|
63
|
-
readonly url: string;
|
|
64
|
-
readonly filename: string;
|
|
65
|
-
readonly sha256: string;
|
|
66
|
-
readonly version: string;
|
|
67
|
-
readonly platform: PlatformId;
|
|
68
|
-
readonly archiveMembers: readonly string[];
|
|
69
|
-
readonly kind: "runtime";
|
|
70
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { PeerQueryResponse } from "./wire.js";
|
|
2
|
-
export type PeerRequestDecisionKind = "approve" | "deny";
|
|
3
|
-
export interface PendingPeerRequest {
|
|
4
|
-
readonly id: string;
|
|
5
|
-
readonly contactId: number;
|
|
6
|
-
readonly query: string;
|
|
7
|
-
readonly createdAt: string;
|
|
8
|
-
readonly sources: readonly string[];
|
|
9
|
-
readonly payload: PeerQueryResponse;
|
|
10
|
-
}
|
|
11
|
-
export interface PeerRequestDecision {
|
|
12
|
-
readonly id: string;
|
|
13
|
-
readonly decision: PeerRequestDecisionKind;
|
|
14
|
-
readonly decidedAt: string;
|
|
15
|
-
}
|
|
16
|
-
export declare class ApprovalTimeoutError extends Error {
|
|
17
|
-
constructor(id: string);
|
|
18
|
-
}
|
|
19
|
-
export declare class ApprovalAbortedError extends Error {
|
|
20
|
-
constructor(id: string);
|
|
21
|
-
}
|
|
22
|
-
export declare const PEER_REQUEST_TTL_MS: number;
|
|
23
|
-
export declare function savePendingPeerRequest(workspacePath: string, request: PendingPeerRequest): void;
|
|
24
|
-
export declare function loadPendingPeerRequest(workspacePath: string, id: string): PendingPeerRequest | undefined;
|
|
25
|
-
export declare function listPendingPeerRequests(workspacePath: string): PendingPeerRequest[];
|
|
26
|
-
export declare function writePeerRequestDecision(workspacePath: string, id: string, decision: PeerRequestDecisionKind): PeerRequestDecision;
|
|
27
|
-
export declare function loadPeerRequestDecision(workspacePath: string, id: string): PeerRequestDecision | undefined;
|
|
28
|
-
export declare function removePeerRequest(workspacePath: string, id: string): void;
|
|
29
|
-
export declare function waitForPeerRequestDecision(workspacePath: string, id: string, options?: {
|
|
30
|
-
readonly timeoutMs?: number;
|
|
31
|
-
readonly abort?: AbortSignal;
|
|
32
|
-
}): Promise<PeerRequestDecision>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { SearchDocumentsResponse } from "../agent/search-documents.js";
|
|
2
|
-
import type { PolicyResolution } from "./policy.js";
|
|
3
|
-
import type { PeerQueryResponse } from "./wire.js";
|
|
4
|
-
export type EgressPolicyResolver = (source: string, peerFingerprint?: string) => PolicyResolution;
|
|
5
|
-
export interface BuildPeerResponseOptions {
|
|
6
|
-
readonly response: SearchDocumentsResponse;
|
|
7
|
-
/** Sources returned by the server's policy-filtered retrieval pipeline. */
|
|
8
|
-
readonly observedSources: ReadonlySet<string>;
|
|
9
|
-
readonly resolvePolicy: EgressPolicyResolver;
|
|
10
|
-
readonly peerFingerprint: string;
|
|
11
|
-
readonly workspaceRoots: readonly string[];
|
|
12
|
-
readonly pseudonymize: boolean;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Build the wire response for one remote search.
|
|
16
|
-
*
|
|
17
|
-
* A result source is admissible only when it is an exact member of the
|
|
18
|
-
* server-owned observed-source registry. The model response is therefore
|
|
19
|
-
* never used to expand the allowlist; it can only name one of the sources the
|
|
20
|
-
* server actually observed during this run.
|
|
21
|
-
*/
|
|
22
|
-
export declare function buildPeerResponse(options: BuildPeerResponseOptions): PeerQueryResponse;
|