@autorag/librarian 2.8.0 → 2.10.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 (97) hide show
  1. package/NOTICE +4 -4
  2. package/README.md +120 -24
  3. package/dist/agent/agent.d.ts +147 -78
  4. package/dist/agent/answer-citations.d.ts +22 -0
  5. package/dist/agent/answer-guidelines.d.ts +9 -9
  6. package/dist/agent/citations.d.ts +42 -7
  7. package/dist/agent/datasource-skill.d.ts +30 -16
  8. package/dist/agent/evidence-judgment.d.ts +58 -0
  9. package/dist/agent/evidence-ledger.d.ts +54 -0
  10. package/dist/agent/evidence-origins.d.ts +49 -0
  11. package/dist/agent/index.d.ts +2 -2
  12. package/dist/agent/jikji-find-tool.d.ts +2 -1
  13. package/dist/agent/pi-session.d.ts +8 -1
  14. package/dist/agent/query-peer-tool.d.ts +3 -0
  15. package/dist/agent/query-routing.d.ts +71 -10
  16. package/dist/agent/{emit-results-tool.d.ts → results.d.ts} +11 -11
  17. package/dist/agent/search-all-tool.d.ts +5 -5
  18. package/dist/agent/search-documents.d.ts +14 -27
  19. package/dist/agent/search-minsync-tool.d.ts +5 -5
  20. package/dist/agent/search-single-datasource-tool.d.ts +9 -8
  21. package/dist/agent/self-config.d.ts +40 -0
  22. package/dist/agent/system-prompt.d.ts +2 -3
  23. package/dist/agent/web-fetch-tool.d.ts +2 -1
  24. package/dist/agent/web-search-tool.d.ts +2 -1
  25. package/dist/cli/commands/evidence.d.ts +2 -2
  26. package/dist/cli/commands/memory.d.ts +1 -1
  27. package/dist/cli/commands/report.d.ts +2 -2
  28. package/dist/cli/commands/tui.d.ts +3 -2
  29. package/dist/cli/config.d.ts +16 -8
  30. package/dist/cli/index.d.ts +1 -1
  31. package/dist/cli/index.js +11133 -10103
  32. package/dist/cli/output.d.ts +2 -6
  33. package/dist/cloud/authorize.d.ts +12 -0
  34. package/dist/cloud/callback-server.d.ts +33 -0
  35. package/dist/cloud/callback.d.ts +23 -0
  36. package/dist/cloud/config.d.ts +23 -0
  37. package/dist/cloud/errors.d.ts +46 -0
  38. package/dist/cloud/index.d.ts +12 -0
  39. package/dist/cloud/models.d.ts +32 -0
  40. package/dist/cloud/oauth-login.d.ts +22 -0
  41. package/dist/cloud/pkce.d.ts +20 -0
  42. package/dist/cloud/provider.d.ts +40 -0
  43. package/dist/cloud/token.d.ts +22 -0
  44. package/dist/config/home.d.ts +6 -0
  45. package/dist/core.d.ts +10 -21
  46. package/dist/core.js +15272 -14207
  47. package/dist/datasource/chunk-store.d.ts +2 -6
  48. package/dist/datasource/connector-skill.d.ts +2 -3
  49. package/dist/datasource/index.d.ts +2 -4
  50. package/dist/datasource/registry.d.ts +11 -13
  51. package/dist/datasource/scope.d.ts +19 -0
  52. package/dist/datasource/skills/github-gist/index.d.ts +1 -1
  53. package/dist/datasource/skills/github-gist/semantic.d.ts +3 -44
  54. package/dist/datasource/skills/github-gist/skill.d.ts +3 -3
  55. package/dist/datasource/types.d.ts +14 -28
  56. package/dist/embedding-runtime/gateway-embedder.d.ts +41 -0
  57. package/dist/index.d.ts +2 -1
  58. package/dist/index.js +15488 -14359
  59. package/dist/language.d.ts +2 -1
  60. package/dist/mcp/index.js +15413 -14341
  61. package/dist/memory/check-memory-tool.d.ts +8 -4
  62. package/dist/memory/context.d.ts +51 -0
  63. package/dist/memory/index.d.ts +8 -1
  64. package/dist/memory/judged-evidence.d.ts +32 -0
  65. package/dist/memory/memory.d.ts +36 -120
  66. package/dist/memory/renderer.d.ts +16 -7
  67. package/dist/memory/similar-queries.d.ts +40 -0
  68. package/dist/minsync/client.d.ts +1 -1
  69. package/dist/minsync/errors.d.ts +14 -0
  70. package/dist/minsync/index.d.ts +1 -0
  71. package/dist/minsync/installer.d.ts +1 -1
  72. package/dist/minsync/method.d.ts +3 -3
  73. package/dist/mirror/sync.d.ts +5 -2
  74. package/dist/observability/run-log.d.ts +1 -1
  75. package/dist/parser/defaults.d.ts +16 -5
  76. package/dist/parser/index.d.ts +1 -1
  77. package/dist/parser/kordoc.d.ts +8 -1
  78. package/dist/parser/ocr-engines.d.ts +19 -0
  79. package/dist/retrieval/bm25.d.ts +19 -0
  80. package/dist/retrieval/engine.d.ts +17 -58
  81. package/dist/retrieval/index.d.ts +3 -2
  82. package/dist/retrieval/merger.d.ts +6 -0
  83. package/dist/retrieval/rerank.d.ts +2 -2
  84. package/dist/retrieval/selection.d.ts +33 -41
  85. package/dist/retrieval/types.d.ts +1 -26
  86. package/dist/web/search/format.d.ts +5 -2
  87. package/dist/web/search/index.d.ts +7 -1
  88. package/package.json +5 -5
  89. package/skills/autorag/SKILL.md +21 -22
  90. package/skills/autorag-doctor/SKILL.md +20 -15
  91. package/skills/autorag-lite-setup/SKILL.md +22 -19
  92. package/skills/autorag-setup/SKILL.md +34 -21
  93. package/dist/agent/fast-answer-tool.d.ts +0 -46
  94. package/dist/cli/commands/feedback.d.ts +0 -8
  95. package/dist/datasource/access-context.d.ts +0 -43
  96. package/dist/datasource/result-filter.d.ts +0 -64
  97. package/dist/parser/ocr.d.ts +0 -31
@@ -57,12 +57,8 @@ export declare class DatasourceChunkStore {
57
57
  hierarchies(): readonly (readonly string[])[];
58
58
  /**
59
59
  * BM25-style lexical search over the stored chunks. Empty queries and
60
- * empty stores return `[]`; this method never throws.
61
- *
62
- * Terms match document tokens exactly or as a prefix (min 2 chars), so
63
- * agglutinative suffixes — Korean particles/endings (인증서 → 인증서를) and
64
- * English inflections (index → indexing) — still rank. Prefix hits are
65
- * slightly discounted against exact hits.
60
+ * empty stores return `[]`; this method never throws. Scoring is delegated
61
+ * to {@link bm25Scores}.
66
62
  */
67
63
  search(query: string, topK: number): readonly ScoredChunk[];
68
64
  private persist;
@@ -14,8 +14,8 @@
14
14
  * - Constructed only from trusted, server-supplied configuration.
15
15
  * - Sources are stable slash-hierarchical paths `/<skill>/<instance>/…`.
16
16
  * - `index()` never throws; failures surface as traceable diagnostics.
17
- * - Retrieval honors `scope` and `allowedScopes` narrowing; tool arguments
18
- * can never widen access (enforced upstream by DatasourceAccessContext).
17
+ * - Retrieval honors the ordinary query `scope`; results are slash-hierarchical
18
+ * opaque sources with no `#` fragment.
19
19
  * - Results and metadata may carry real file paths or account identifiers;
20
20
  * privacy is the operator's responsibility (use a local LLM).
21
21
  */
@@ -111,6 +111,5 @@ export declare class ConnectorLexicalMethod implements RetrievalMethod {
111
111
  constructor(options: ConnectorLexicalMethodOptions);
112
112
  describe(): RetrievalMethodDescriptor;
113
113
  retrieve(query: string, options: RetrievalOptions): Promise<RetrievalResult[]>;
114
- private matchesScope;
115
114
  }
116
115
  export {};
@@ -1,4 +1,3 @@
1
- export { DatasourceAccessContext, type DatasourceAccessContextOptions } from "./access-context.js";
2
1
  export { type AliasDatasourceSkillOptions, AliasedDatasourceSkill } from "./aliased-skill.js";
3
2
  export { DatasourceChunkStore, type DatasourceChunkStoreOptions, datasourceChunkStorePath, type ScoredChunk, type StoredChunk, } from "./chunk-store.js";
4
3
  export { boundDiagnosticText, type ConnectorDocument, type ConnectorFailureReason, type ConnectorFetchFail, type ConnectorFetchOk, type ConnectorFetchResult, connectorFailureToDiagnosticCode, type DatasourceConnector, sanitizeIdSegment, } from "./connector.js";
@@ -6,8 +5,7 @@ export { ConnectorDatasourceSkill, ConnectorLexicalMethod, type ConnectorSkillDe
6
5
  export { mapDatasourceDiagnostic, mapDatasourceDiagnostics } from "./diagnostics.js";
7
6
  export { type CronParseResult, isDue, parseCronExpr } from "./polling.js";
8
7
  export { DatasourceSkillRegistry, type RegisteredDatasourceSkill } from "./registry.js";
9
- export { DatasourceResultFilter, type ResultsByMethod } from "./result-filter.js";
10
- export { buildDatasourceChunkSource, buildDatasourceInstanceSource, DATASOURCE_CHUNKS_SEGMENT, datasourceSourceHasFragment, datasourceSourcePath, isDatasourceSource, matchesDatasourceScope, matchesVirtualPathScope, normalizeVirtualPath, } from "./scope.js";
8
+ export { buildDatasourceChunkSource, buildDatasourceInstanceSource, DATASOURCE_CHUNKS_SEGMENT, datasourceSourceHasFragment, datasourceSourcePath, filterDatasourceScope, isDatasourceSource, matchesDatasourceScope, matchesVirtualPathScope, normalizeVirtualPath, type ResultsByMethod, } from "./scope.js";
11
9
  export { CLOUD_DRIVE_SKILL_DEFINITION, CloudDriveSkill, type CloudDriveSkillOptions, RcloneConnector, type RcloneConnectorOptions, type RcloneRunner, type RcloneRunResult, } from "./skills/cloud-drive/index.js";
12
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";
13
11
  export { BUILTIN_DATASOURCE_SKILL_NAMES, type BuildDatasourceSkillsResult, buildDatasourceSkills, type DatasourceSkillConfig, type DatasourcesConfig, } from "./skills/factory.js";
@@ -24,4 +22,4 @@ export { SlackSkill, type SlackSkillOptions, SlacrawlClient, type SlacrawlOption
24
22
  export { SpotlightConnector, type SpotlightConnectorOptions, SpotlightSkill, type SpotlightSkillOptions, } from "./skills/spotlight/index.js";
25
23
  export { TelecrawlClient, type TelecrawlOptions, TelecrawlSkill, type TelecrawlSkillOptions, } from "./skills/telecrawl/index.js";
26
24
  export { WacrawlClient, type WacrawlOptions, WacrawlSkill, type WacrawlSkillOptions } from "./skills/wacrawl/index.js";
27
- export type { DatasourceAccessible, DatasourceDiagnostic, DatasourceDiagnosticCode, DatasourceIndexFail, DatasourceIndexOk, DatasourceIndexResult, DatasourceInstance, DatasourceSkill, DatasourceSkillDescriptor, DatasourceSkillManifest, PollingMetadata, SourceDescription, } from "./types.js";
25
+ export type { DatasourceDiagnostic, DatasourceDiagnosticCode, DatasourceIndexFail, DatasourceIndexOk, DatasourceIndexResult, DatasourceInstance, DatasourceSkill, DatasourceSkillDescriptor, DatasourceSkillManifest, PollingMetadata, SourceDescription, } from "./types.js";
@@ -3,14 +3,13 @@
3
3
  *
4
4
  * Skills are constructed from trusted, server-supplied configuration and
5
5
  * registered here so the retrieval pipeline can enumerate them, look them up
6
- * by tag, and resolve the concrete instances a given access context permits.
6
+ * by tag (descriptive metadata), and resolve the concrete instances they expose.
7
7
  *
8
- * The registry never grants access: {@link resolveInstances} only *narrows*
9
- * the registered skills to those a {@link DatasourceAccessContext} already
10
- * allows. Model/tool arguments are not consulted.
8
+ * Every configured/connected datasource is searchable without permission setup;
9
+ * there is no access context. The ordinary query `scope` narrows results later
10
+ * in the pipeline, not here. Model/tool arguments are not consulted.
11
11
  */
12
12
  import type { RetrievalMethod } from "../retrieval/types.js";
13
- import type { DatasourceAccessContext } from "./access-context.js";
14
13
  import type { DatasourceInstance, DatasourceSkill, DatasourceSkillDescriptor } from "./types.js";
15
14
  /** A registered skill paired with its cached descriptor. */
16
15
  export interface RegisteredDatasourceSkill {
@@ -30,23 +29,22 @@ export declare class DatasourceSkillRegistry {
30
29
  register(skill: DatasourceSkill): void;
31
30
  /** All registered skills in insertion order. */
32
31
  list(): readonly RegisteredDatasourceSkill[];
33
- /** Skills whose descriptor carries the given tag. */
32
+ /** Skills whose descriptor carries the given tag (descriptive metadata). */
34
33
  byTag(tag: string): readonly RegisteredDatasourceSkill[];
35
34
  /** Look up a registered skill by id, or `undefined`. */
36
35
  get(id: string): RegisteredDatasourceSkill | undefined;
37
36
  /**
38
- * Resolve the concrete datasource instances reachable under `ctx`.
37
+ * Resolve every configured datasource instance.
39
38
  *
40
- * Only skills whose descriptor {@link DatasourceAccessContext.isAccessible}
41
- * allows contribute instances, and only their declared instance ids are
39
+ * All registered skills contribute, and only their declared instance ids are
42
40
  * materialized. Each instance carries its opaque slash-hierarchical
43
41
  * {@link DatasourceInstance.sourcePath} (e.g. `/kakao/acct-1`), built from
44
42
  * the trusted skill name and instance id — never from model input.
45
43
  */
46
- resolveInstances(ctx: DatasourceAccessContext): readonly DatasourceInstance[];
44
+ resolveInstances(): readonly DatasourceInstance[];
47
45
  /**
48
- * Convenience: all retrieval methods exposed by accessible skills, for
49
- * feeding the shared retriever. Methods from denied skills are excluded.
46
+ * All retrieval methods exposed by registered skills, for feeding the shared
47
+ * retriever.
50
48
  */
51
- accessibleMethods(ctx: DatasourceAccessContext): readonly RetrievalMethod[];
49
+ retrievalMethods(): readonly RetrievalMethod[];
52
50
  }
@@ -9,6 +9,9 @@
9
9
  * `src/retrieval/scope.ts` so datasource scopes compose with the existing
10
10
  * retrieval scope grammar (globs, leading-slash normalization).
11
11
  */
12
+ import type { RetrievalMethod, RetrievalResult } from "../retrieval/types.js";
13
+ /** Per-method retrieval results keyed by method name. */
14
+ export type ResultsByMethod = Map<string, RetrievalResult[]>;
12
15
  /** Path segment separating an instance root from its chunk sub-namespace. */
13
16
  export declare const DATASOURCE_CHUNKS_SEGMENT = "chunks";
14
17
  /**
@@ -35,4 +38,20 @@ export declare function isDatasourceSource(source: string): boolean;
35
38
  * scope matcher so globs and leading-slash normalization behave identically.
36
39
  */
37
40
  export declare function matchesDatasourceScope(source: string, scope: string | undefined): boolean;
41
+ /**
42
+ * Narrow a per-method result map by the ordinary query `scope`.
43
+ *
44
+ * This is the only post-retrieval narrowing left in the datasource layer: every
45
+ * configured datasource is searchable without permission setup. Methods whose
46
+ * descriptor has no `datasourceId` (plain retrieval methods such as `posix`) and
47
+ * datasource methods that do not advertise the `scoped` capability pass through
48
+ * untouched. Scope-capable datasource methods keep only the results whose
49
+ * source matches `scope`; `undefined` scope matches every valid source, and
50
+ * sources containing a `#` fragment are always rejected.
51
+ *
52
+ * Result entries for methods not present in `methods` are passed through
53
+ * unchanged (they cannot be classified). A new map is returned; the input is
54
+ * not mutated.
55
+ */
56
+ export declare function filterDatasourceScope(byMethod: ResultsByMethod, methods: readonly RetrievalMethod[], scope?: string): ResultsByMethod;
38
57
  export { matchesVirtualPathScope, normalizeVirtualPath } from "../retrieval/scope.js";
@@ -1,3 +1,3 @@
1
1
  export { GitHubGistConnector, type GitHubGistConnectorOptions } from "./connector.js";
2
- export { createGatewayGistEmbedder, type GatewayGistEmbedderOptions, type GistEmbedder, type GistEmbeddingIdentity, GistSemanticIndex, GitHubGistSemanticMethod, } from "./semantic.js";
2
+ export { GistSemanticIndex, GitHubGistSemanticMethod } from "./semantic.js";
3
3
  export { GITHUB_GIST_SKILL_DEFINITION, type GitHubGistSemanticOptions, GitHubGistSkill, type GitHubGistSkillOptions, gistDatasourceDir, } from "./skill.js";
@@ -9,19 +9,9 @@
9
9
  * `cachedOnly`, then `POST /v1/embeddings`); tests inject a stub. Every
10
10
  * failure degrades — indexing stays lexical-only and retrieval returns [].
11
11
  */
12
- import type { ProfileId } from "../../../embedding-runtime/types.js";
12
+ import type { Embedder } from "../../../embedding-runtime/gateway-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
- export interface GistEmbeddingIdentity {
16
- readonly provider: string;
17
- readonly model: string;
18
- readonly dimension: number;
19
- }
20
- /** Embedder contract: identity is async because the gateway resolves it lazily. */
21
- export interface GistEmbedder {
22
- identity(): Promise<GistEmbeddingIdentity>;
23
- embed(texts: readonly string[]): Promise<readonly (readonly number[])[]>;
24
- }
25
15
  export interface GistSemanticSyncOk {
26
16
  readonly ok: true;
27
17
  /** Number of chunks (re-)embedded in this sync. */
@@ -44,7 +34,7 @@ export declare class GistSemanticIndex {
44
34
  * Embed new/changed chunks, prune removed ones, and persist. Never throws;
45
35
  * an embedder failure leaves prior entries intact and reports ok:false.
46
36
  */
47
- sync(chunks: readonly StoredChunk[], embedder: GistEmbedder): Promise<GistSemanticSyncOk | GistSemanticSyncFail>;
37
+ sync(chunks: readonly StoredChunk[], embedder: Embedder): Promise<GistSemanticSyncOk | GistSemanticSyncFail>;
48
38
  /** Cosine-ranked chunk ids for a query vector. Never throws. */
49
39
  searchByVector(queryVector: readonly number[], topK: number): readonly {
50
40
  chunkId: string;
@@ -60,7 +50,7 @@ export interface GitHubGistSemanticMethodOptions {
60
50
  readonly tags: readonly string[];
61
51
  readonly store: DatasourceChunkStore;
62
52
  readonly index: GistSemanticIndex;
63
- readonly embedder: GistEmbedder;
53
+ readonly embedder: Embedder;
64
54
  }
65
55
  /** Cosine similarity retrieval over the gist vector sidecar. Never throws. */
66
56
  export declare class GitHubGistSemanticMethod implements RetrievalMethod {
@@ -68,35 +58,4 @@ export declare class GitHubGistSemanticMethod implements RetrievalMethod {
68
58
  constructor(options: GitHubGistSemanticMethodOptions);
69
59
  describe(): RetrievalMethodDescriptor;
70
60
  retrieve(query: string, options: RetrievalOptions): Promise<RetrievalResult[]>;
71
- private matchesScope;
72
61
  }
73
- export interface GatewayGistEmbedderOptions {
74
- /** Runtime resolver; defaults to the shared embedding-runtime ensureRuntime. */
75
- readonly runtime?: {
76
- ensureRuntime(input?: {
77
- profileId?: ProfileId;
78
- cachedOnly?: boolean;
79
- }): Promise<{
80
- baseUrl: string;
81
- identity: {
82
- provider: string;
83
- model: string;
84
- dimension: number;
85
- };
86
- }>;
87
- };
88
- readonly profileId?: ProfileId;
89
- readonly fetchImpl?: typeof fetch;
90
- }
91
- /**
92
- * Production embedder backed by the loopback autorag-gateway. The runtime is
93
- * ensured lazily with `cachedOnly` so semantic retrieval never triggers a
94
- * model download; an unprimed cache surfaces as a sync/retrieve degrade.
95
- */
96
- /**
97
- * Texts per `/v1/embeddings` call. The llama.cpp upstream rejects very large
98
- * batches (HTTP 413 on a full-archive sync), so embedding fans out in
99
- * bounded sequential batches while preserving input order.
100
- */
101
- export declare const GIST_EMBED_BATCH_SIZE = 32;
102
- export declare function createGatewayGistEmbedder(options?: GatewayGistEmbedderOptions): GistEmbedder;
@@ -7,19 +7,19 @@
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 { type Embedder, type GatewayEmbedderOptions } from "../../../embedding-runtime/gateway-embedder.js";
10
11
  import type { RetrievalMethod } from "../../../retrieval/types.js";
11
12
  import { ConnectorDatasourceSkill, type ConnectorSkillDefinition, type ConnectorSkillOptions } from "../../connector-skill.js";
12
13
  import type { DatasourceIndexResult } from "../../types.js";
13
14
  import { GitHubGistConnector, type GitHubGistConnectorOptions } from "./connector.js";
14
- import { type GatewayGistEmbedderOptions, type GistEmbedder } from "./semantic.js";
15
15
  export declare const GITHUB_GIST_SKILL_DEFINITION: ConnectorSkillDefinition;
16
16
  export declare function gistDatasourceDir(workspaceRoot: string, skillName: string, instanceId: string): string;
17
17
  export interface GitHubGistSemanticOptions {
18
18
  /** Set false to run lexical-only. Default true. */
19
19
  readonly enabled?: boolean;
20
20
  /** Injected embedder (tests); defaults to the loopback gateway embedder. */
21
- readonly embedder?: GistEmbedder;
22
- readonly embedderOptions?: GatewayGistEmbedderOptions;
21
+ readonly embedder?: Embedder;
22
+ readonly embedderOptions?: GatewayEmbedderOptions;
23
23
  /** Vector sidecar path override; defaults under `.autorag/datasources/…`. */
24
24
  readonly statePath?: string;
25
25
  }
@@ -4,27 +4,24 @@
4
4
  * A *datasource* is an external, server-bound source of retrieval evidence
5
5
  * (e.g. a KakaoTalk export reached through the external `lazykatok` CLI). The
6
6
  * datasource layer sits *on top of* the existing retrieval pipeline: it owns
7
- * access gating and slash-hierarchical source naming, while actual retrieval
8
- * still flows through {@link RetrievalMethod} instances returned by a skill.
7
+ * slash-hierarchical source naming, while actual retrieval still flows through
8
+ * {@link RetrievalMethod} instances returned by a skill.
9
9
  *
10
- * Security invariants (enforced by {@link DatasourceAccessContext}):
11
- * - Access is **default-deny**: when no trusted allow-tags are configured,
12
- * every datasource descriptor and source is denied.
13
- * - Deny is always an explicit `false` boolean / predicate return — never
14
- * `undefined`-as-deny.
15
- * - Model/tool arguments never grant access. Only the trusted server-supplied
16
- * {@link DatasourceAccessContext} can authorize a datasource.
17
- * - Datasource sources are slash-hierarchical opaque paths when the skill
18
- * supports the `scoped` capability; skills without that capability may
19
- * expose another opaque identity format.
10
+ * Every configured/connected datasource is searchable without permission
11
+ * setup: there is no tag/scope authorization layer. The ordinary query `scope`
12
+ * narrows results after retrieval (see `filterDatasourceScope`), and skill
13
+ * descriptor `tags` are descriptive metadata only — never authority.
14
+ * Datasource sources are slash-hierarchical opaque paths for skills that
15
+ * advertise the `scoped` capability; skills without it may expose another
16
+ * opaque identity format.
20
17
  */
21
18
  import type { RetrievalMethod } from "../retrieval/types.js";
22
19
  export type { RetrievalMethod } from "../retrieval/types.js";
23
20
  /**
24
21
  * Descriptor for a datasource skill (e.g. KakaoTalk via `lazykatok`).
25
22
  *
26
- * Structurally compatible with {@link RetrievalMethodDescriptor} so that
27
- * retrieval method descriptors can be gated by the same access context.
23
+ * Structurally compatible with {@link RetrievalMethodDescriptor}: retrieval
24
+ * method descriptors carry the same `datasourceId`/`tags`/`capabilities` fields.
28
25
  */
29
26
  export interface DatasourceSkillDescriptor {
30
27
  /** Stable skill name, e.g. `"kakao"`. */
@@ -37,8 +34,8 @@ export interface DatasourceSkillDescriptor {
37
34
  /** Capability tags such as `"chat"`, `"external-cli"`, `"polling"`. */
38
35
  readonly capabilities: readonly string[];
39
36
  /**
40
- * Authorization tags. A descriptor is accessible only when at least one tag
41
- * intersects the trusted allow-tags on the access context.
37
+ * Descriptive tags such as `"chat"` or `"external-cli"`. Metadata only —
38
+ * never used to authorize or narrow access.
42
39
  */
43
40
  readonly tags: readonly string[];
44
41
  readonly status: "active" | "stub";
@@ -47,7 +44,7 @@ export interface DatasourceSkillDescriptor {
47
44
  /**
48
45
  * Set when this descriptor describes a datasource-backed surface.
49
46
  * Non-datasource descriptors (e.g. plain `posix` retrieval methods) leave
50
- * this undefined and are passed through by the access context.
47
+ * this undefined.
51
48
  */
52
49
  readonly datasourceId?: string;
53
50
  /** Optional primary instance id for single-instance skills. */
@@ -55,17 +52,6 @@ export interface DatasourceSkillDescriptor {
55
52
  /** Optional list of instance ids this skill reports. */
56
53
  readonly instances?: readonly string[];
57
54
  }
58
- /**
59
- * Minimal structural shape required to gate a descriptor by access context.
60
- * Both {@link DatasourceSkillDescriptor} and `RetrievalMethodDescriptor`
61
- * satisfy this interface structurally.
62
- */
63
- export interface DatasourceAccessible {
64
- readonly datasourceId?: string;
65
- readonly tags?: readonly string[];
66
- /** Capability names such as `scoped`; absent means no source-scope support. */
67
- readonly capabilities?: readonly string[];
68
- }
69
55
  /**
70
56
  * A pluggable datasource skill. Skills are server-bound: they are constructed
71
57
  * with trusted configuration and never derive authority from model/tool args.
@@ -0,0 +1,41 @@
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;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { AutoRAGAgent, type AutoRAGAgentOptions, type AutoRAGRefreshComponentStatus, type AutoRAGRefreshOptions, type AutoRAGRefreshResult, type AutoRAGRefreshStatus, type AutoRAGWatchRefreshHandle, type AutoRAGWatchRefreshOptions, type AutoRefreshOptions, type RefreshMethod, } from "./agent/agent.js";
2
- export { type AutoRAGResultsDetails, createEmitResultsTool, EMIT_AUTORAG_RESULTS_TOOL_NAME, emitResultsSchema, type SearchDocumentDiagnostic, type SearchDocumentDiagnosticCode, type SearchDocumentDiagnosticSeverity, type SearchDocumentsResponse, type SearchDocumentsStreamEvent, type SearchDocumentWarning, } from "./agent/index.js";
2
+ export { type AutoRAGResultsDetails, reportSchema, type SearchDocumentDiagnostic, type SearchDocumentDiagnosticCode, type SearchDocumentDiagnosticSeverity, type SearchDocumentsResponse, type SearchDocumentsStreamEvent, type SearchDocumentWarning, } from "./agent/index.js";
3
3
  export { buildSystemPrompt, type SystemPromptConfig } from "./agent/system-prompt.js";
4
+ export * from "./cloud/index.js";
4
5
  export { AutoRAGLite, type AutoRAGLiteOptions, buildAgentOptions, type CliConfig, createAutoRAGLite, type ResolveConfigInput, resolveConfig, resolveConfigReadOnly, writeConfigObject, writeDefaultConfig, } from "./core.js";
5
6
  export * from "./datasource/index.js";
6
7
  export * from "./dupey/index.js";