@autorag/librarian 2.9.0 → 2.10.1

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 (71) hide show
  1. package/LICENSE +195 -21
  2. package/NOTICE +17 -21
  3. package/README.md +372 -143
  4. package/dist/agent/agent.d.ts +93 -22
  5. package/dist/agent/answer-citations.d.ts +22 -0
  6. package/dist/agent/answer-guidelines.d.ts +9 -9
  7. package/dist/agent/citations.d.ts +35 -23
  8. package/dist/agent/context-token-guard.d.ts +23 -0
  9. package/dist/agent/evidence-ledger.d.ts +7 -12
  10. package/dist/agent/index.d.ts +2 -2
  11. package/dist/agent/jev-extension.d.ts +5 -4
  12. package/dist/agent/jikji-find-tool.d.ts +1 -0
  13. package/dist/agent/pi-session.d.ts +35 -2
  14. package/dist/agent/request-limits.d.ts +20 -0
  15. package/dist/agent/{emit-results-tool.d.ts → results.d.ts} +5 -40
  16. package/dist/agent/search-all-tool.d.ts +1 -0
  17. package/dist/agent/search-documents.d.ts +14 -19
  18. package/dist/agent/search-single-datasource-tool.d.ts +1 -0
  19. package/dist/agent/self-config.d.ts +1 -1
  20. package/dist/cli/commands/report.d.ts +1 -1
  21. package/dist/cli/commands/tui.d.ts +3 -2
  22. package/dist/cli/config.d.ts +13 -11
  23. package/dist/cli/index.js +3939 -1684
  24. package/dist/cloud/authorize.d.ts +12 -0
  25. package/dist/cloud/callback-server.d.ts +33 -0
  26. package/dist/cloud/callback.d.ts +23 -0
  27. package/dist/cloud/config.d.ts +41 -0
  28. package/dist/cloud/errors.d.ts +46 -0
  29. package/dist/cloud/index.d.ts +12 -0
  30. package/dist/cloud/jev-backend.d.ts +90 -0
  31. package/dist/cloud/models.d.ts +32 -0
  32. package/dist/cloud/oauth-login.d.ts +22 -0
  33. package/dist/cloud/pkce.d.ts +20 -0
  34. package/dist/cloud/provider.d.ts +40 -0
  35. package/dist/cloud/token.d.ts +22 -0
  36. package/dist/core.d.ts +2 -5
  37. package/dist/core.js +3803 -1613
  38. package/dist/datasource/crawler-skill.d.ts +17 -0
  39. package/dist/datasource/sidecar/config.d.ts +26 -0
  40. package/dist/datasource/sidecar/descriptors.d.ts +67 -0
  41. package/dist/datasource/sidecar/fusion.d.ts +25 -0
  42. package/dist/datasource/sidecar/index.d.ts +131 -0
  43. package/dist/datasource/sidecar/methods.d.ts +27 -0
  44. package/dist/datasource/types.d.ts +3 -1
  45. package/dist/embedding-runtime/index.d.ts +6 -6
  46. package/dist/embedding-runtime/manifest.d.ts +0 -12
  47. package/dist/embedding-runtime/types.d.ts +1 -1
  48. package/dist/index.d.ts +2 -1
  49. package/dist/index.js +3982 -1676
  50. package/dist/mcp/index.js +3908 -1662
  51. package/dist/minsync/client.d.ts +3 -3
  52. package/dist/minsync/installer.d.ts +1 -1
  53. package/dist/minsync/process.d.ts +1 -0
  54. package/dist/minsync/types.d.ts +1 -1
  55. package/dist/observability/run-log.d.ts +1 -1
  56. package/dist/parser/defaults.d.ts +6 -4
  57. package/dist/parser/ocr-engines.d.ts +6 -0
  58. package/dist/retrieval/index.d.ts +2 -2
  59. package/dist/retrieval/rerank.d.ts +20 -3
  60. package/dist/retrieval/types.d.ts +0 -23
  61. package/licenses/embedding-assets.json +0 -35
  62. package/package.json +24 -27
  63. package/skills/autorag/SKILL.md +1 -1
  64. package/skills/autorag-doctor/SKILL.md +1 -1
  65. package/skills/autorag-lite-setup/SKILL.md +2 -2
  66. package/skills/autorag-setup/SKILL.md +3 -3
  67. package/dist/agent/fast-answer-tool.d.ts +0 -56
  68. package/licenses/gemma-notice.txt +0 -24
  69. package/licenses/gemma-section-3.2-flow-down.txt +0 -9
  70. package/licenses/gemma-terms-of-use.html +0 -4750
  71. package/licenses/gemma-terms-of-use.txt +0 -158
@@ -1,7 +1,6 @@
1
- import { type RetrievalMemory } from "../memory/memory.js";
2
- import type { CuratedResult, RetrievalResult } from "../retrieval/types.js";
3
- import type { AutoRAGResultsDetails } from "./emit-results-tool.js";
4
- import type { AutoRAGFastAnswerDetails } from "./fast-answer-tool.js";
1
+ import { type RetrievalMemory, type SessionEvidenceRef } from "../memory/memory.js";
2
+ import type { RetrievalResult } from "../retrieval/types.js";
3
+ import type { AutoRAGMappingEntry, AutoRAGResultsDetails } from "./results.js";
5
4
  export type SearchDocumentWarning = "empty-query";
6
5
  export type SearchDocumentDiagnosticSeverity = "info" | "warning" | "error";
7
6
  /**
@@ -10,7 +9,7 @@ export type SearchDocumentDiagnosticSeverity = "info" | "warning" | "error";
10
9
  * (#21/#22) does not require another source-breaking type change; codes not yet
11
10
  * emitted are still valid members.
12
11
  */
13
- export type SearchDocumentDiagnosticCode = "empty-query" | "no-verified-results" | "unknown-warning" | "caller-tool-dropped" | "minsync-staging-excluded" | "minsync-sync-failed" | "embedder-unavailable" | "embedding-identity-mismatch" | "parser-skipped" | "parser-failed" | "source-vanished" | "source-unreadable" | "parser-warning" | "duplicate-excluded" | "unsupported-file" | "stale-index" | "deleted-mirror" | "pdf-extract-thin" | "retrieval-method-failed" | "rerank-failed" | "jikji-unavailable" | "jikji-prepare-failed" | "jikji-find-failed" | "everything-index-failed" | "fsearch-index-failed" | "fsearch-binary-missing" | "refresh-failed" | "refresh-interrupted" | "watch-failed" | "watch-limited" | "unknown-datasource-skill" | "missing-final-emit" | "model-request-failed" | "search-timeout" | "query-routed" | "query-route-fallback" | "query-decomposition-failed" | "follow-up-skipped" | "follow-up-check-fallback" | "datasources-selected" | "datasource-selection-fallback" | "citation-without-result" | "evidence-judged" | "evidence-judgment-fallback" | "memory-search-fallback" | "self-config-unavailable" | "self-config-rolled-back";
12
+ export type SearchDocumentDiagnosticCode = "empty-query" | "no-verified-results" | "unknown-warning" | "caller-tool-dropped" | "minsync-staging-excluded" | "minsync-sync-failed" | "embedder-unavailable" | "embedding-identity-mismatch" | "parser-skipped" | "parser-failed" | "source-vanished" | "source-unreadable" | "parser-warning" | "duplicate-excluded" | "unsupported-file" | "stale-index" | "deleted-mirror" | "pdf-extract-thin" | "retrieval-method-failed" | "rerank-failed" | "jikji-unavailable" | "jikji-prepare-failed" | "jikji-find-failed" | "everything-index-failed" | "fsearch-index-failed" | "fsearch-binary-missing" | "refresh-failed" | "refresh-interrupted" | "watch-failed" | "watch-limited" | "unknown-datasource-skill" | "no-final-answer" | "model-request-failed" | "search-timeout" | "query-routed" | "query-route-fallback" | "query-decomposition-failed" | "follow-up-skipped" | "follow-up-check-fallback" | "datasources-selected" | "datasource-selection-fallback" | "citation-without-result" | "evidence-judged" | "evidence-judgment-fallback" | "memory-search-fallback" | "self-config-unavailable" | "self-config-rolled-back";
14
13
  export interface SearchDocumentDiagnostic {
15
14
  readonly code: SearchDocumentDiagnosticCode;
16
15
  readonly severity: SearchDocumentDiagnosticSeverity;
@@ -27,7 +26,8 @@ export interface SearchDocumentResult {
27
26
  readonly title: string;
28
27
  readonly summary: string;
29
28
  readonly evidence: readonly SearchDocumentEvidence[];
30
- readonly confidence: number;
29
+ /** Absent when nothing measured one: derived results carry no model-reported confidence. */
30
+ readonly confidence?: number;
31
31
  readonly source?: string;
32
32
  }
33
33
  /** One retrieval candidate captured in a run's retrieval trace. */
@@ -38,7 +38,7 @@ export interface SearchDocumentRetrievalTraceResult {
38
38
  }
39
39
  /**
40
40
  * What one retrieval tool execution found during a search run. Attached to the
41
- * degraded fallback response when the agent never called emit_autorag_results,
41
+ * degraded fallback response when the agent never wrote a final answer,
42
42
  * so an upstream agent can still inspect the raw candidates.
43
43
  */
44
44
  export interface SearchDocumentRetrievalTraceEntry {
@@ -84,20 +84,15 @@ export type SearchDocumentsStreamEvent = {
84
84
  readonly type: "complete";
85
85
  readonly response: SearchDocumentsResponse;
86
86
  };
87
- type SearchSession = {
88
- query: string;
89
- registry: Map<number, CuratedResult>;
90
- };
91
- type SearchSessions = Map<string, SearchSession>;
92
87
  /**
93
88
  * Build the preliminary (fast-phase) search response. Unlike
94
- * {@link recordStructuredResultsSession} this NEVER touches memory or the
95
- * session registry — the final response owns those.
89
+ * {@link recordStructuredResultsSession} this NEVER touches memory — the final
90
+ * response owns that.
96
91
  */
97
- export declare function createPreliminarySearchDocumentsResponse(sessionId: string, query: string, details: AutoRAGFastAnswerDetails, diagnostics?: readonly SearchDocumentDiagnostic[]): SearchDocumentsResponse;
98
- export declare function createEmptySearchDocumentsResponse(sessionId: string, query: string, sessions: SearchSessions, diagnostics?: readonly SearchDocumentDiagnostic[]): SearchDocumentsResponse;
99
- export declare function recordStructuredResultsSession(sessionId: string, query: string, details: AutoRAGResultsDetails, sessions: SearchSessions, memory: RetrievalMemory, componentDiagnostics?: readonly SearchDocumentDiagnostic[], options?: {
100
- /** Record the session registry only, skipping the retrieval-memory write. */
92
+ export declare function createPreliminarySearchDocumentsResponse(sessionId: string, query: string, details: AutoRAGResultsDetails, diagnostics?: readonly SearchDocumentDiagnostic[]): SearchDocumentsResponse;
93
+ export declare function createEmptySearchDocumentsResponse(sessionId: string, query: string, diagnostics?: readonly SearchDocumentDiagnostic[]): SearchDocumentsResponse;
94
+ export declare function normalizeEntryEvidenceRefs(entry: AutoRAGMappingEntry): SessionEvidenceRef[];
95
+ export declare function recordStructuredResultsSession(sessionId: string, query: string, details: AutoRAGResultsDetails, memory: RetrievalMemory, componentDiagnostics?: readonly SearchDocumentDiagnostic[], options?: {
96
+ /** Skip the retrieval-memory write. */
101
97
  readonly isolateMemory?: boolean;
102
98
  }): SearchDocumentsResponse;
103
- export {};
@@ -39,6 +39,7 @@ export interface SingleDatasourceSearchProvider {
39
39
  searchSingleDatasourceDocuments(datasourceId: string, query: string, options?: {
40
40
  readonly topK?: number;
41
41
  readonly scope?: string;
42
+ readonly signal?: AbortSignal;
42
43
  }): Promise<{
43
44
  readonly results: readonly RetrievalResult[];
44
45
  readonly diagnostics: readonly RetrievalDiagnostic[];
@@ -35,6 +35,6 @@ export declare function rollbackIfBroken(options: SelfConfigOptions, before: str
35
35
  /**
36
36
  * The turn prompt for the `config` branch: the whole setup skill, where this
37
37
  * run's config lives, the safety rules for editing it, and the user's request.
38
- * The turn ends with `emit_autorag_results`; there is no fast answer.
38
+ * The turn ends with the model's plain final message; there is no fast answer.
39
39
  */
40
40
  export declare function buildSelfConfigPrompt(input: SelfConfigPromptInput): string;
@@ -1,4 +1,4 @@
1
- import { type AutoRAGResultsDetails } from "../../agent/emit-results-tool.js";
1
+ import { type AutoRAGResultsDetails } from "../../agent/results.js";
2
2
  import type { CommandContext } from "./types.js";
3
3
  /** Validate a curated report payload against the `autorag report` contract (explicit number -> source mapping). */
4
4
  export declare function validateReport(value: unknown): AutoRAGResultsDetails;
@@ -5,8 +5,9 @@ import type { CommandContext } from "./types.js";
5
5
  * Pi owns the terminal UI, `read`/`bash`/`edit`/`write`/`grep`/`find`/`ls`
6
6
  * tools, provider credentials/OAuth, model selection, session persistence and
7
7
  * resume/fork/compaction, settings, and extension loading. AutoRAG registers
8
- * its domain tools and streams progress, preliminary answers, and final results
9
- * into the same session through the agent's interactive runtime. The native
8
+ * its domain tools and runs the two-phase search in the same session through
9
+ * the agent's interactive runtime; the model's progress notes, first answer, and
10
+ * final answer are ordinary assistant messages there. The native
10
11
  * `/login`, `/model`, `/resume`, `/new`, `/tree`, `/compact`, and `/settings`
11
12
  * commands are therefore always available.
12
13
  */
@@ -55,13 +55,14 @@ export interface WebSearchCliConfig {
55
55
  }
56
56
  /**
57
57
  * Jev decision-tool config. Absent disables the tool; `enabled: false` disables
58
- * it explicitly. Secrets never appear here: the `jev-use` engine reads the
59
- * backend credential from its own environment variable (`TYPESAFE_API_KEY`,
60
- * `OPENROUTER_API_KEY`, or `AI_GATEWAY_API_KEY`).
58
+ * it explicitly. Secrets never appear here: `jev-use` reads the backend
59
+ * credential from its own environment variable (`TYPESAFE_API_KEY`,
60
+ * `OPENROUTER_API_KEY`, or `AI_GATEWAY_API_KEY`), and the hosted AutoRAG
61
+ * `autorag` backend reads `AUTORAG_API_KEY`.
61
62
  */
62
63
  export interface JevCliConfig {
63
64
  enabled?: boolean;
64
- /** Force one backend; omit to let the first credential present win. */
65
+ /** Force one backend (`openrouter`, `typesafe`, `vercel`, or `autorag`); omit to let the first credential present win. */
65
66
  backend?: JevBackendName;
66
67
  /** Model id sent with every call, e.g. `jev-latest`. */
67
68
  model?: string;
@@ -75,20 +76,21 @@ export interface QueryDecompositionConfig {
75
76
  }
76
77
  /**
77
78
  * Post-merge reranking config. Routes merged evidence through a dedicated
78
- * rerank model. `provider` is `openrouter` today; `model` is the OpenRouter
79
- * wire id (default `voyageai/rerank-3-lite`). Secrets never appear here — only
80
- * the environment-variable name that holds the provider API key.
79
+ * rerank model. `provider` is `openrouter` (default) or the hosted AutoRAG
80
+ * plan (`autorag`); each provider supplies its own default `model` and
81
+ * `apiKeyEnv`. Secrets never appear here — only the environment-variable name
82
+ * that holds the provider API key.
81
83
  */
82
84
  export interface RerankConfig {
83
85
  /** `false` disables reranking. Missing means enabled when the block is present. */
84
86
  enabled?: boolean;
85
- /** Provider id. @default "openrouter" */
87
+ /** Provider id (`openrouter` or `autorag`). @default "openrouter" */
86
88
  provider?: string;
87
- /** Wire model id. @default "voyageai/rerank-3-lite" */
89
+ /** Wire model id. @default "voyageai/rerank-3-lite" (`openrouter`) / "qwen/qwen3-reranker-8b" (`autorag`) */
88
90
  model?: string;
89
- /** Environment variable holding the provider API key. @default "OPENROUTER_API_KEY" */
91
+ /** Environment variable holding the provider API key. @default "OPENROUTER_API_KEY" (`openrouter`) / "AUTORAG_API_KEY" (`autorag`) */
90
92
  apiKeyEnv?: string;
91
- /** Override the provider base URL (e.g. a gateway). */
93
+ /** Override the provider base URL (e.g. a gateway); for `autorag`, the API base including `/v1`. */
92
94
  baseUrl?: string;
93
95
  /** Return only the top N merged results. @default 25 (DEFAULT_RERANK_TOP_N) */
94
96
  topN?: number;