@autorag/librarian 2.10.1 → 2.10.3

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 (73) hide show
  1. package/NOTICE +0 -3
  2. package/README.md +76 -33
  3. package/dist/agent/agent.d.ts +96 -18
  4. package/dist/agent/evidence-ledger.d.ts +54 -5
  5. package/dist/agent/evidence-persistence.d.ts +24 -0
  6. package/dist/agent/jev-extension.d.ts +5 -3
  7. package/dist/agent/search-documents.d.ts +1 -1
  8. package/dist/agent/system-prompt.d.ts +0 -2
  9. package/dist/agent/tool-burst-guard.d.ts +26 -0
  10. package/dist/cli/config.d.ts +37 -23
  11. package/dist/cli/index.js +2122 -1153
  12. package/dist/cloud/config.d.ts +16 -10
  13. package/dist/cloud/credential.d.ts +17 -0
  14. package/dist/cloud/errors.d.ts +6 -6
  15. package/dist/cloud/index.d.ts +5 -4
  16. package/dist/cloud/jev-backend.d.ts +15 -13
  17. package/dist/cloud/models.d.ts +4 -4
  18. package/dist/cloud/oauth-login.d.ts +3 -3
  19. package/dist/cloud/provider.d.ts +16 -11
  20. package/dist/cloud/token.d.ts +2 -2
  21. package/dist/core.d.ts +2 -1
  22. package/dist/core.js +2265 -1313
  23. package/dist/datasource/aliased-skill.d.ts +2 -2
  24. package/dist/datasource/connector-skill.d.ts +2 -2
  25. package/dist/datasource/crawler-skill.d.ts +2 -2
  26. package/dist/datasource/described-skill.d.ts +2 -2
  27. package/dist/datasource/index.d.ts +1 -1
  28. package/dist/datasource/retry.d.ts +49 -0
  29. package/dist/datasource/skills/clawgallery/skill.d.ts +4 -4
  30. package/dist/datasource/skills/discrawl/skill.d.ts +5 -5
  31. package/dist/datasource/skills/github-gist/skill.d.ts +2 -2
  32. package/dist/datasource/skills/lazykatok/skill.d.ts +5 -5
  33. package/dist/datasource/skills/mailcrawl/skill.d.ts +2 -2
  34. package/dist/datasource/skills/obsidian/skill.d.ts +5 -5
  35. package/dist/datasource/types.d.ts +13 -1
  36. package/dist/embedding-runtime/cache.d.ts +9 -0
  37. package/dist/index.d.ts +1 -2
  38. package/dist/index.js +2338 -1387
  39. package/dist/jikji/client.d.ts +13 -2
  40. package/dist/jikji/index.d.ts +1 -1
  41. package/dist/jikji/path-map.d.ts +9 -0
  42. package/dist/jikji/prepare-budget.d.ts +18 -0
  43. package/dist/jikji/serial-queue.d.ts +17 -0
  44. package/dist/jikji/types.d.ts +17 -0
  45. package/dist/mcp/index.js +2326 -1374
  46. package/dist/minsync/client.d.ts +3 -1
  47. package/dist/minsync/index.d.ts +1 -1
  48. package/dist/minsync/installer.d.ts +1 -1
  49. package/dist/minsync/method.d.ts +1 -1
  50. package/dist/minsync/types.d.ts +8 -1
  51. package/dist/mirror/atomic-write.d.ts +6 -0
  52. package/dist/mirror/index-store.d.ts +8 -1
  53. package/dist/mirror/index.d.ts +2 -2
  54. package/dist/mirror/sync.d.ts +57 -1
  55. package/dist/p2p/simplex-server.d.ts +0 -1
  56. package/dist/parser/defaults.d.ts +8 -0
  57. package/dist/parser/errors.d.ts +10 -0
  58. package/dist/parser/isolated.d.ts +77 -0
  59. package/dist/parser/kordoc.d.ts +1 -0
  60. package/dist/parser/parse-worker.d.ts +1 -0
  61. package/dist/parser/parse-worker.js +780 -0
  62. package/dist/parser/types.d.ts +5 -0
  63. package/dist/process/abort-reason.d.ts +2 -0
  64. package/dist/retrieval/index.d.ts +1 -1
  65. package/dist/retrieval/rerank.d.ts +16 -10
  66. package/package.json +5 -5
  67. package/skills/autorag/SKILL.md +2 -1
  68. package/skills/autorag-doctor/SKILL.md +7 -0
  69. package/skills/autorag-lite-setup/SKILL.md +2 -2
  70. package/skills/autorag-setup/SKILL.md +42 -17
  71. package/dist/manifest/index.d.ts +0 -2
  72. package/dist/manifest/loader.d.ts +0 -3
  73. package/dist/manifest/types.d.ts +0 -8
@@ -0,0 +1,26 @@
1
+ export interface ToolBurstGuardOptions {
2
+ /** Calls of one tool inside `windowMs` that count as a runaway loop. */
3
+ readonly maxCalls: number;
4
+ /** Sliding window, in milliseconds. */
5
+ readonly windowMs: number;
6
+ }
7
+ /** One tool called 60 times inside 60 seconds is a loop, not work. */
8
+ export declare const DEFAULT_TOOL_BURST_GUARD: ToolBurstGuardOptions;
9
+ /**
10
+ * Detects a runaway tool loop: the same tool called `maxCalls` times inside
11
+ * `windowMs`. It limits the rate of one tool, never a run's total length or
12
+ * duration, so a long indexing job or a many-step run is never cut short.
13
+ * It reports every call that is part of a burst; `reset()` clears it for the next run.
14
+ */
15
+ export declare class ToolBurstGuard {
16
+ private readonly options;
17
+ private readonly calls;
18
+ constructor(options?: ToolBurstGuardOptions | false);
19
+ /**
20
+ * Record one call. Returns true while the tool is inside a burst: on the call that
21
+ * reaches `maxCalls` and on every further call in the window. An abort issued
22
+ * mid-tool does not always stop the next model turn, so the caller keeps aborting.
23
+ */
24
+ record(tool: string, now?: number): boolean;
25
+ reset(): void;
26
+ }
@@ -1,6 +1,6 @@
1
1
  import type { Api, Model } from "@earendil-works/pi-ai";
2
2
  import { ModelRuntime } from "@earendil-works/pi-coding-agent";
3
- import type { AutoRAGAgentOptions, AutoRAGRetrievalLimits } from "../agent/agent.js";
3
+ import type { AutoRAGAgentOptions, AutoRAGRefreshLimits, AutoRAGRetrievalLimits } from "../agent/agent.js";
4
4
  import type { JevBackendName } from "../agent/jev-extension.js";
5
5
  import { type LoadLocalAutoRAGModelOptions } from "../agent/local-model.js";
6
6
  import type { DecompositionModel } from "../agent/query-decomposition.js";
@@ -57,12 +57,12 @@ export interface WebSearchCliConfig {
57
57
  * Jev decision-tool config. Absent disables the tool; `enabled: false` disables
58
58
  * it explicitly. Secrets never appear here: `jev-use` reads the backend
59
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`.
60
+ * `OPENROUTER_API_KEY`, or `AI_GATEWAY_API_KEY`), and the hosted Dazzi Models
61
+ * `dazzi` backend uses the credential stored by `/login`.
62
62
  */
63
63
  export interface JevCliConfig {
64
64
  enabled?: boolean;
65
- /** Force one backend (`openrouter`, `typesafe`, `vercel`, or `autorag`); omit to let the first credential present win. */
65
+ /** Force one backend (`openrouter`, `typesafe`, `vercel`, or `dazzi`); omit to let the first credential present win. */
66
66
  backend?: JevBackendName;
67
67
  /** Model id sent with every call, e.g. `jev-latest`. */
68
68
  model?: string;
@@ -76,21 +76,22 @@ export interface QueryDecompositionConfig {
76
76
  }
77
77
  /**
78
78
  * Post-merge reranking config. Routes merged evidence through a dedicated
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.
79
+ * rerank model. `provider` is `openrouter` (default) or the hosted Dazzi Models
80
+ * plan (`dazzi`); each provider supplies its own default `model`. OpenRouter
81
+ * reads its key from `apiKeyEnv`; Dazzi uses the credential stored by `/login`.
82
+ * Secrets never appear here — only the environment-variable name that holds a
83
+ * provider API key.
83
84
  */
84
85
  export interface RerankConfig {
85
86
  /** `false` disables reranking. Missing means enabled when the block is present. */
86
87
  enabled?: boolean;
87
- /** Provider id (`openrouter` or `autorag`). @default "openrouter" */
88
+ /** Provider id (`openrouter` or `dazzi`). @default "openrouter" */
88
89
  provider?: string;
89
- /** Wire model id. @default "voyageai/rerank-3-lite" (`openrouter`) / "qwen/qwen3-reranker-8b" (`autorag`) */
90
+ /** Wire model id. @default "voyageai/rerank-3-lite" (`openrouter`) / "qwen/qwen3-reranker-8b" (`dazzi`) */
90
91
  model?: string;
91
- /** Environment variable holding the provider API key. @default "OPENROUTER_API_KEY" (`openrouter`) / "AUTORAG_API_KEY" (`autorag`) */
92
+ /** Environment variable holding the provider API key (`openrouter` only). @default "OPENROUTER_API_KEY" */
92
93
  apiKeyEnv?: string;
93
- /** Override the provider base URL (e.g. a gateway); for `autorag`, the API base including `/v1`. */
94
+ /** Override the provider base URL (e.g. a gateway); for `dazzi`, the API base including `/v1`. */
94
95
  baseUrl?: string;
95
96
  /** Return only the top N merged results. @default 25 (DEFAULT_RERANK_TOP_N) */
96
97
  topN?: number;
@@ -112,7 +113,6 @@ export interface P2pConfig {
112
113
  };
113
114
  injectionClassifier?: boolean;
114
115
  piiNer?: boolean;
115
- searchTimeoutMs?: number;
116
116
  newFilesPublic?: boolean;
117
117
  }
118
118
  export interface AgentModelConfig {
@@ -182,7 +182,7 @@ export interface CliConfig {
182
182
  /**
183
183
  * Question decomposition for the Jev query pipeline. `model` names the LLM
184
184
  * that splits one question into at most five search queries; absent or `{}`
185
- * uses {@link DEFAULT_QUERY_DECOMPOSITION_MODEL}, and `false` lets the
185
+ * uses {@link defaultQueryDecompositionModel}, and `false` lets the
186
186
  * agent's own model decompose.
187
187
  */
188
188
  queryDecomposition?: QueryDecompositionConfig | false;
@@ -199,6 +199,8 @@ export interface CliConfig {
199
199
  excludePaths?: string[];
200
200
  /** Hard caps on retrieval, baseline prefetch, and model-facing candidate lists. */
201
201
  limits?: AutoRAGRetrievalLimits;
202
+ /** Refresh limits (delete-ratio valve, walk caps) and `transientRetries` (default 3, EMFILE/EBUSY/EIO/ETIMEDOUT per file). */
203
+ refresh?: AutoRAGRefreshLimits;
202
204
  /** Datasource skill configuration (skill name → config). */
203
205
  datasources?: DatasourcesConfig;
204
206
  /** P2P sharing configuration. Disabled by default. */
@@ -237,6 +239,8 @@ export declare function normalizeEmbedder(raw: unknown, path: string): MinSyncEm
237
239
  export declare function normalizeIndexingConfig(raw: RawIndexingMethods): NormalizedIndexingConfig;
238
240
  /** Validate the `limits` section and map it onto the agent option. */
239
241
  export declare function normalizeLimitsConfig(raw: unknown): AutoRAGRetrievalLimits;
242
+ /** Validate the `refresh` section and map it onto the agent option. */
243
+ export declare function normalizeRefreshConfig(raw: unknown): AutoRAGRefreshLimits;
240
244
  export declare function resolveConfig(input: ResolveConfigInput): CliConfig;
241
245
  /**
242
246
  * Resolve config without writing, migrating, or locking. Health and other
@@ -246,20 +250,30 @@ export declare function resolveConfig(input: ResolveConfigInput): CliConfig;
246
250
  export declare function resolveConfigReadOnly(input: ResolveConfigInput): CliConfig;
247
251
  /** Validate and normalize the `jev` config section. */
248
252
  export declare function normalizeJevConfig(raw: unknown): JevCliConfig;
249
- /** Jev backend used when the config names none (absent section or `{}`). */
250
- export declare const DEFAULT_JEV_BACKEND: JevBackendName;
251
253
  /**
252
- * Question-decomposition model used when the config names none. Picked from a
253
- * live OpenRouter bench (6 questions incl. Korean, 2 runs each): 12/12 valid,
254
- * covering, language-preserving decompositions at ~0.9s p50, about 3.5x
255
- * cheaper per call than the previous default (a 2025 Gemini flash-lite) at equal quality.
254
+ * Jev backend used when the config names none (absent section or `{}`): the
255
+ * hosted Dazzi Models plan when the user is signed in, else OpenRouter.
256
256
  */
257
- export declare const DEFAULT_QUERY_DECOMPOSITION_MODEL: AgentModelConfig;
257
+ export declare function defaultJevBackend(agentDir?: string): JevBackendName;
258
+ /** The OpenRouter fallback decomposition model, used when not signed in to Dazzi Models. */
259
+ export declare const OPENROUTER_QUERY_DECOMPOSITION_MODEL: AgentModelConfig;
260
+ /**
261
+ * Question-decomposition model used when the config names none: the hosted
262
+ * Dazzi Models plan when signed in, else OpenRouter. The OpenRouter pick came
263
+ * from a live bench (6 questions incl. Korean, 2 runs each): 12/12 valid,
264
+ * covering, language-preserving decompositions at ~0.9s p50.
265
+ */
266
+ export declare function defaultQueryDecompositionModel(agentDir?: string): AgentModelConfig;
258
267
  /** Validate the `queryDecomposition` config section (`false` = decompose with the session model). */
259
268
  export declare function normalizeQueryDecompositionConfig(raw: unknown): QueryDecompositionConfig | false;
260
269
  /** Normalize and validate the `rerank` config section, filling in defaults. */
261
270
  export declare function normalizeRerankConfig(raw: unknown, path: string): RerankConfig | false;
262
- export declare function buildAgentOptions(config: CliConfig): Omit<AutoRAGAgentOptions, "model">;
271
+ /**
272
+ * Rerank block `autorag init` writes when none is given: the hosted Dazzi
273
+ * Models reranker when signed in, else OpenRouter's.
274
+ */
275
+ export declare function defaultRerankConfig(agentDir?: string): RerankConfig;
276
+ export declare function buildAgentOptions(config: CliConfig, agentDir?: string): Omit<AutoRAGAgentOptions, "model">;
263
277
  /**
264
278
  * Extra resolution inputs beyond the local codex-runtime options. `agentDir`
265
279
  * points at the pi agent home (`~/.pi/agent` by default) that owns
@@ -316,7 +330,7 @@ export declare function validateAgentConfigFile(configPath: string, options?: Re
316
330
  /**
317
331
  * Resolve the question-decomposition model and its credential through the same
318
332
  * chain as the agent model. An absent section or `{}` uses
319
- * {@link DEFAULT_QUERY_DECOMPOSITION_MODEL}; `queryDecomposition: false`
333
+ * {@link defaultQueryDecompositionModel}; `queryDecomposition: false`
320
334
  * returns undefined so the agent's own model decomposes.
321
335
  */
322
336
  export declare function resolveQueryDecompositionModel(config: CliConfig, options?: ResolveAgentModelOptions): Promise<DecompositionModel | undefined>;