@autorag/librarian 2.10.6 → 2.12.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 (86) hide show
  1. package/NOTICE +14 -0
  2. package/README.md +52 -10
  3. package/dist/agent/agent.d.ts +70 -2
  4. package/dist/agent/answer-citations.d.ts +34 -2
  5. package/dist/agent/answer-guidelines.d.ts +24 -3
  6. package/dist/agent/ask-user.d.ts +8 -0
  7. package/dist/agent/automation-tool.d.ts +45 -0
  8. package/dist/agent/citation-links.d.ts +23 -0
  9. package/dist/agent/citation-numbers.d.ts +68 -0
  10. package/dist/agent/citation-relevance.d.ts +37 -0
  11. package/dist/agent/conversation-queries.d.ts +31 -0
  12. package/dist/agent/convert-tool.d.ts +28 -0
  13. package/dist/agent/evidence-persistence.d.ts +17 -11
  14. package/dist/agent/index.d.ts +1 -0
  15. package/dist/agent/intent-tracing.d.ts +33 -0
  16. package/dist/agent/mcp-client.d.ts +27 -0
  17. package/dist/agent/permission-gate.d.ts +78 -0
  18. package/dist/agent/permission-judgment.d.ts +72 -0
  19. package/dist/agent/permission-paths.d.ts +23 -0
  20. package/dist/agent/pi-session.d.ts +8 -0
  21. package/dist/agent/query-routing.d.ts +14 -17
  22. package/dist/agent/search-documents.d.ts +1 -1
  23. package/dist/agent/search-progress.d.ts +96 -0
  24. package/dist/agent/self-config.d.ts +2 -0
  25. package/dist/agent/user-requests.d.ts +52 -0
  26. package/dist/agent/welcome-header.d.ts +35 -0
  27. package/dist/automation/config.d.ts +48 -0
  28. package/dist/automation/daemon.d.ts +31 -0
  29. package/dist/automation/dispatch.d.ts +13 -0
  30. package/dist/automation/run-agent.d.ts +22 -0
  31. package/dist/automation/run.d.ts +32 -0
  32. package/dist/automation/service.d.ts +61 -0
  33. package/dist/cli/commands/automate.d.ts +2 -0
  34. package/dist/cli/commands/setup.d.ts +2 -0
  35. package/dist/cli/config.d.ts +21 -0
  36. package/dist/cli/index.d.ts +1 -1
  37. package/dist/cli/index.js +26740 -21094
  38. package/dist/cli/open-target.d.ts +9 -0
  39. package/dist/cli/setup.d.ts +21 -0
  40. package/dist/convert/cli.d.ts +77 -0
  41. package/dist/convert/index.d.ts +4 -0
  42. package/dist/convert/installer.d.ts +84 -0
  43. package/dist/convert/matrix.d.ts +27 -0
  44. package/dist/convert/relate.d.ts +30 -0
  45. package/dist/core.js +32095 -27288
  46. package/dist/datasource/connector-timeouts.d.ts +6 -2
  47. package/dist/datasource/crawler-types.d.ts +1 -1
  48. package/dist/datasource/errors.d.ts +1 -1
  49. package/dist/datasource/index.d.ts +2 -1
  50. package/dist/datasource/skills/factory.d.ts +3 -0
  51. package/dist/datasource/skills/hister/client.d.ts +83 -0
  52. package/dist/datasource/skills/hister/embedding.d.ts +64 -0
  53. package/dist/datasource/skills/hister/index.d.ts +2 -0
  54. package/dist/datasource/skills/hister/setup.d.ts +87 -0
  55. package/dist/datasource/skills/hister/skill.d.ts +63 -0
  56. package/dist/datasource/skills/lazykatok/types.d.ts +2 -2
  57. package/dist/datasource/skills/mailcrawl/types.d.ts +1 -1
  58. package/dist/datasource/skills/obsidian/index.d.ts +4 -6
  59. package/dist/datasource/skills/obsidian/methods.d.ts +13 -17
  60. package/dist/datasource/skills/obsidian/paths.d.ts +24 -24
  61. package/dist/datasource/skills/obsidian/skill.d.ts +10 -15
  62. package/dist/datasource/skills/obsidian/staging.d.ts +50 -0
  63. package/dist/datasource/skills/obsidian/vault-index.d.ts +44 -0
  64. package/dist/dupey/cli.d.ts +18 -0
  65. package/dist/index.d.ts +1 -0
  66. package/dist/index.js +32263 -27429
  67. package/dist/mcp/index.js +32149 -27342
  68. package/dist/minsync/installer.d.ts +1 -1
  69. package/dist/minsync/workspace-lock.d.ts +7 -0
  70. package/dist/process/terminate-tree.d.ts +4 -5
  71. package/dist/profiles/agent-factory.d.ts +60 -0
  72. package/dist/profiles/automation-profiles.d.ts +25 -0
  73. package/dist/profiles/loop-guard.d.ts +23 -0
  74. package/dist/profiles/retrieval-tools.d.ts +24 -0
  75. package/dist/profiles/session-model.d.ts +69 -0
  76. package/dist/profiles.d.ts +13 -0
  77. package/dist/profiles.js +34739 -0
  78. package/dist/retrieval/rerank.d.ts +6 -0
  79. package/licenses/hister-AGPL-3.0-notice.txt +47 -0
  80. package/package.json +9 -3
  81. package/skills/autorag/SKILL.md +79 -5
  82. package/skills/autorag-doctor/SKILL.md +5 -4
  83. package/skills/autorag-lite-setup/SKILL.md +23 -5
  84. package/skills/autorag-setup/SKILL.md +68 -7
  85. package/dist/datasource/skills/obsidian/client.d.ts +0 -15
  86. package/dist/datasource/skills/obsidian/types.d.ts +0 -92
@@ -0,0 +1,96 @@
1
+ import type { ExtensionFactory, ExtensionUIContext } from "@earendil-works/pi-coding-agent";
2
+ /** Where pi shows the progress widget: its own slot above the editor, where the submitted question lands. */
3
+ export declare const SEARCH_PROGRESS_WIDGET_KEY = "autorag-search-progress";
4
+ export type SearchProgressStatus = "running" | "done" | "failed";
5
+ /** One unit of work the search is doing (routing, one retrieval source, a model phase, …). */
6
+ export interface SearchProgressStep {
7
+ readonly id: string;
8
+ readonly label: string;
9
+ readonly status: SearchProgressStatus;
10
+ /** Outcome text: the result count, the route, or the failure's own message. */
11
+ readonly detail?: string;
12
+ readonly startedAt: number;
13
+ readonly endedAt?: number;
14
+ }
15
+ /** An immutable view of the running search, handed to subscribers on every change. */
16
+ export interface SearchProgressSnapshot {
17
+ readonly active: boolean;
18
+ readonly query: string;
19
+ readonly startedAt: number;
20
+ /** A model turn streams: pi's own working loader is on screen then. */
21
+ readonly modelStreaming: boolean;
22
+ readonly steps: readonly SearchProgressStep[];
23
+ }
24
+ /** Options of {@link SearchProgressTracker.track}. */
25
+ export interface TrackOptions<T> {
26
+ /** How many hits a settled job returned; the step reports the sum. */
27
+ readonly count?: (value: T) => number;
28
+ }
29
+ /**
30
+ * What the running search is doing right now, in the user's terms. The agent
31
+ * reports into it; the TUI renders it so a silent first retrieval is visibly
32
+ * alive. Reports outside a begun search are ignored, so the library path
33
+ * (`searchDocuments()` with no UI) pays nothing.
34
+ */
35
+ export declare class SearchProgressTracker {
36
+ private active;
37
+ private query;
38
+ private startedAt;
39
+ private modelStreaming;
40
+ /** Bumped by every {@link begin}: a job that settles after its search ended must not touch the next one. */
41
+ private run;
42
+ private steps;
43
+ private readonly listeners;
44
+ private readonly now;
45
+ constructor(now?: () => number);
46
+ begin(query: string): void;
47
+ end(): void;
48
+ setModelStreaming(streaming: boolean): void;
49
+ /** Starts (or restarts) a step that the caller closes with {@link endStep}. */
50
+ beginStep(id: string, label: string): void;
51
+ endStep(id: string, status: Exclude<SearchProgressStatus, "running">, detail?: string): void;
52
+ /**
53
+ * Runs `work` as step `id`: running while it is in flight, done with
54
+ * `detail(value)` when it resolves, failed with the error's own message when
55
+ * it rejects (the rejection still propagates).
56
+ */
57
+ step<T>(id: string, label: string, work: () => Promise<T>, detail?: (value: T) => string | undefined): Promise<T>;
58
+ /**
59
+ * Follows one job as part of step `id`. Jobs sharing an id (the same source
60
+ * searched for several queries) form one step that ends when the last one
61
+ * settles. The job's result and rejection pass through untouched.
62
+ */
63
+ track<T>(id: string, label: string, work: Promise<T>, options?: TrackOptions<T>): Promise<T>;
64
+ snapshot(): SearchProgressSnapshot;
65
+ /** Notified after every change. Not called on subscribe: read {@link snapshot} for the current state. */
66
+ subscribe(listener: (snapshot: SearchProgressSnapshot) => void): () => void;
67
+ private open;
68
+ private emit;
69
+ }
70
+ /** `7s` under a minute, `1:01` after. */
71
+ export declare function formatElapsed(ms: number): string;
72
+ /** Colour hooks for {@link renderSearchProgress}; pi's theme supplies them, tests pass identity. */
73
+ export interface SearchProgressPalette {
74
+ readonly accent: (text: string) => string;
75
+ readonly muted: (text: string) => string;
76
+ readonly success: (text: string) => string;
77
+ readonly error: (text: string) => string;
78
+ }
79
+ /**
80
+ * The widget's lines at time `now`. Pure so the TUI and the tests render the
81
+ * same thing: a spinner header with the elapsed time, then one line per step.
82
+ * More steps than fit keep every running step and the newest finished ones.
83
+ */
84
+ export declare function renderSearchProgress(snapshot: SearchProgressSnapshot, now: number, palette: SearchProgressPalette, width: number, interruptKey: string): string[];
85
+ /**
86
+ * Binds the tracker to pi's widget slot: the widget appears when a search
87
+ * begins and disappears when it ends. `isCurrent` lets a replaced session's
88
+ * late notifications be dropped.
89
+ */
90
+ export declare function bindSearchProgressWidget(ui: Pick<ExtensionUIContext, "setWidget">, tracker: SearchProgressTracker, interruptKey: () => string): () => void;
91
+ /**
92
+ * pi extension that shows the tracker as a widget while a search runs. The
93
+ * widget slot is rebound on every `session_start` (resume, `/new`, fork) and
94
+ * released on shutdown, so a replaced session is never written to.
95
+ */
96
+ export declare function createSearchProgressExtension(tracker: SearchProgressTracker, interruptKey: () => string): ExtensionFactory;
@@ -21,6 +21,8 @@ export interface SelfConfigPromptInput {
21
21
  readonly configPath: string;
22
22
  readonly agentDir: string;
23
23
  readonly skill: string;
24
+ /** True when `manage_automations` is available: file-triggered automations are then in scope. */
25
+ readonly automations?: boolean;
24
26
  }
25
27
  /** The config file's current text, or `undefined` when it does not exist. */
26
28
  export declare function snapshotConfigFile(configPath: string): string | undefined;
@@ -0,0 +1,52 @@
1
+ import type { ExtensionFactory } from "@earendil-works/pi-coding-agent";
2
+ /** Custom session entry type under which a conversation persists what the user said. */
3
+ export declare const USER_REQUEST_ENTRY_TYPE = "autorag.user-request";
4
+ /**
5
+ * `request`: a new question or a follow-up. `steer`: a correction typed while a search runs, which
6
+ * adjusts the request it interrupts rather than starting a new one.
7
+ */
8
+ export type UserRequestKind = "request" | "steer";
9
+ export interface UserRequest {
10
+ readonly text: string;
11
+ readonly kind: UserRequestKind;
12
+ }
13
+ type SaveEntry = (request: UserRequest) => void;
14
+ /**
15
+ * What the user has said in this conversation, in order, exactly as typed: the first question, every
16
+ * follow-up, every steer. AutoRAG's own phase prompts (fast answer, verification, direct answer, steer
17
+ * continuation) never enter it, because it is fed where the user's words arrive, not from the transcript.
18
+ *
19
+ * It is not truncated here. Whoever consumes it fits it to its own limit.
20
+ */
21
+ export declare class UserRequestLog {
22
+ private items;
23
+ private save;
24
+ record(text: string, kind?: UserRequestKind): void;
25
+ entries(): readonly UserRequest[];
26
+ /** Forgets everything: a new conversation. */
27
+ reset(): void;
28
+ /** Replaces the log with a conversation read back from a session. */
29
+ restore(requests: readonly UserRequest[]): void;
30
+ /**
31
+ * Where each recorded message is saved. Returns a detach that only unplugs this saver: a session that
32
+ * shut down late must not unplug the one that replaced it. Detached, the log is in-memory only.
33
+ */
34
+ attach(save: SaveEntry): () => void;
35
+ }
36
+ /**
37
+ * pi extension that keeps the conversation's {@link UserRequestLog} in the session file, next to the
38
+ * transcript. Starting, resuming, forking, or navigating the session tree rebuilds the log from the branch
39
+ * now in view, so `/new` begins empty and `/resume` brings the earlier requests back.
40
+ */
41
+ export declare function createUserRequestPersistence(log: UserRequestLog): ExtensionFactory;
42
+ /** `text` cut to `max` characters by dropping its middle, so both what it starts with and ends with survive. */
43
+ export declare function cutMiddle(text: string, max: number): string;
44
+ /**
45
+ * The conversation as the Jev gate reads it: every user message in order, verbatim and numbered, with
46
+ * corrections marked. Nothing is shortened while it fits in `maxChars`. Over that, the opening request and
47
+ * the newest messages stay and the middle is dropped with a count (the numbering shows where), because the
48
+ * first message says what the user came for and the last ones say where they ended up. Only when even
49
+ * those two do not fit is a single message cut, in the middle.
50
+ */
51
+ export declare function renderUserRequests(requests: readonly UserRequest[], maxChars: number): string;
52
+ export {};
@@ -0,0 +1,35 @@
1
+ import type { ExtensionFactory, SettingsManager, Theme } from "@earendil-works/pi-coding-agent";
2
+ /**
3
+ * One is shown per session, picked at random. Each fits on one line of an
4
+ * 80-column terminal after the `Tip · ` label, and is true of the TUI as shipped.
5
+ */
6
+ export declare const WELCOME_TIPS: readonly string[];
7
+ export interface WelcomeBannerOptions {
8
+ readonly width: number;
9
+ readonly version: string;
10
+ readonly theme: Pick<Theme, "fg" | "bold">;
11
+ /** Source of the rotating tip offset. Default `Math.random`. */
12
+ readonly random?: () => number;
13
+ }
14
+ /**
15
+ * The first screen of `autorag tui`: the logo, the version, and one random tip,
16
+ * centered on `width`. The logo is centered as one block so its shape holds;
17
+ * the version and the tip are centered on their own. The tip is always one line
18
+ * and is cut with `...` when the terminal is narrower than it.
19
+ */
20
+ export declare function renderWelcomeBanner({ width, version, theme, random }: WelcomeBannerOptions): string[];
21
+ /** The slice of pi's settings the banner reads and adjusts. */
22
+ type WelcomeSettings = Pick<SettingsManager, "applyOverrides" | "getGlobalSettings" | "getProjectSettings" | "getQuietStartup">;
23
+ export interface WelcomeHeaderOptions {
24
+ readonly version: string;
25
+ readonly settings: WelcomeSettings;
26
+ readonly random?: () => number;
27
+ }
28
+ /**
29
+ * Replaces pi's startup header (its logo, key hints) with the AutoRAG banner on
30
+ * every session start: launch, `/new`, `/resume`, `/fork`, `/reload`. pi
31
+ * restores its built-in header before each session start, so there is nothing
32
+ * to clean up. A user who saved `quietStartup: true` gets no banner.
33
+ */
34
+ export declare function createWelcomeHeader(options: WelcomeHeaderOptions): ExtensionFactory;
35
+ export {};
@@ -0,0 +1,48 @@
1
+ export type AutomationEventType = "create" | "update" | "delete";
2
+ export declare const AUTOMATION_EVENT_TYPES: readonly AutomationEventType[];
3
+ export interface AutomationEvent {
4
+ readonly type: AutomationEventType;
5
+ readonly path: string;
6
+ }
7
+ /** Which retrieval tools an agent rule's session is offered; retrieval memory is never connected. */
8
+ export interface AutomationAgentRetrieval {
9
+ readonly searchAll: boolean;
10
+ readonly datasources: readonly string[];
11
+ }
12
+ /** What an agent rule runs: a registered agent profile, spawned in-process on each batch of events. */
13
+ export interface AutomationAgent {
14
+ readonly profile: string;
15
+ readonly task: string;
16
+ readonly retrieval: AutomationAgentRetrieval;
17
+ }
18
+ /** A rule runs exactly one of `run` (a command) or `agent` (a profile session). */
19
+ export interface Automation {
20
+ readonly id: string;
21
+ readonly paths: readonly string[];
22
+ readonly events: readonly AutomationEventType[];
23
+ readonly include: readonly string[];
24
+ readonly exclude: readonly string[];
25
+ readonly run?: readonly string[];
26
+ readonly agent?: AutomationAgent;
27
+ readonly appendFiles: boolean;
28
+ readonly debounceMs: number;
29
+ readonly timeoutMs: number;
30
+ }
31
+ export declare const DEFAULT_DEBOUNCE_MS = 1000;
32
+ export declare const DEFAULT_TIMEOUT_MS = 600000;
33
+ export declare const DEFAULT_EXCLUDES: readonly string[];
34
+ export declare class AutomationConfigError extends Error {
35
+ constructor(message: string);
36
+ }
37
+ export declare function automationsConfigPath(env?: NodeJS.ProcessEnv): string;
38
+ export declare function parseAutomations(raw: unknown, env?: NodeJS.ProcessEnv): Automation[];
39
+ export declare function loadAutomations(configPath?: string, env?: NodeJS.ProcessEnv): Automation[];
40
+ /**
41
+ * Insert or replace the rule with `id`, keeping every other rule as written. The
42
+ * whole file is validated before it is written, so an invalid rule never lands
43
+ * on disk and the running daemon never reloads a broken file.
44
+ */
45
+ export declare function saveAutomation(configPath: string, id: string, rule: Readonly<Record<string, unknown>>, env?: NodeJS.ProcessEnv): Automation;
46
+ export declare function deleteAutomation(configPath: string, id: string): void;
47
+ export declare function matchesAutomationPath(automation: Automation, watchedRoot: string, filePath: string): boolean;
48
+ export declare function matchesAutomation(automation: Automation, watchedRoot: string, event: AutomationEvent): boolean;
@@ -0,0 +1,31 @@
1
+ import { type Automation, type AutomationEvent } from "./config.js";
2
+ import type { AutomationRunRecord } from "./run.js";
3
+ export declare const DEFAULT_MAX_RUNS_PER_MINUTE = 20;
4
+ /** An agent run costs model calls, so a rule that starts agents trips the self-trigger breaker sooner. */
5
+ export declare const DEFAULT_MAX_AGENT_RUNS_PER_MINUTE = 6;
6
+ export interface AutomationSubscription {
7
+ unsubscribe(): Promise<void>;
8
+ }
9
+ export type AutomationWatcherBackend = (dir: string, onEvents: (events: readonly AutomationEvent[]) => void, onError?: (error: Error) => void) => Promise<AutomationSubscription>;
10
+ export type AutomationRunner = (automation: Automation, events: readonly AutomationEvent[]) => Promise<AutomationRunRecord>;
11
+ export interface AutomationDaemonOptions {
12
+ readonly home?: string;
13
+ readonly env?: NodeJS.ProcessEnv;
14
+ readonly selfCommand?: readonly string[];
15
+ readonly watcher?: AutomationWatcherBackend;
16
+ readonly runner?: AutomationRunner;
17
+ readonly maxRunsPerMinute?: number;
18
+ readonly watchConfigFile?: boolean;
19
+ readonly onRun?: (automation: Automation, record: AutomationRunRecord) => void;
20
+ readonly onError?: (message: string) => void;
21
+ }
22
+ export interface AutomationDaemonHandle {
23
+ reload(): Promise<void>;
24
+ stop(): Promise<void>;
25
+ }
26
+ export declare class AutomationDaemonAlreadyRunningError extends Error {
27
+ constructor(home: string);
28
+ }
29
+ export declare function automationDaemonLockPath(home?: string): string;
30
+ export declare function isAutomationDaemonRunning(home?: string): boolean;
31
+ export declare function startAutomationDaemon(options?: AutomationDaemonOptions): Promise<AutomationDaemonHandle>;
@@ -0,0 +1,13 @@
1
+ import type { Automation, AutomationEvent } from "./config.js";
2
+ import { type AutomationRunRecord, type RunAutomationOptions } from "./run.js";
3
+ import { type RunAgentAutomationOptions } from "./run-agent.js";
4
+ /**
5
+ * Agent runs the process may have in flight at once, across every rule. A run
6
+ * holds a model session and, with retrieval tools, the configured indexes, so
7
+ * rules wait their turn instead of running in parallel. Events that arrive
8
+ * while a rule waits stay in its pending batch and are handled together.
9
+ */
10
+ export declare const AGENT_RUN_CONCURRENCY = 1;
11
+ export type RunRuleOptions = RunAutomationOptions & RunAgentAutomationOptions;
12
+ /** Run one rule: its command, or its agent profile. The single entry for the daemon, the CLI and the tool. */
13
+ export declare function runRule(automation: Automation, events: readonly AutomationEvent[], options?: RunRuleOptions): Promise<AutomationRunRecord>;
@@ -0,0 +1,22 @@
1
+ import { type AgentProfile, type ProfileModel } from "../profiles/agent-factory.js";
2
+ import type { Automation, AutomationEvent } from "./config.js";
3
+ import { type AutomationRunRecord } from "./run.js";
4
+ export interface RunAgentAutomationOptions {
5
+ readonly home?: string;
6
+ readonly env?: NodeJS.ProcessEnv;
7
+ /** pi's agent dir (the shared credential store); defaults to pi's own. */
8
+ readonly agentDir?: string;
9
+ /** Resolves the model the session runs on; defaults to the AutoRAG agent's configured model. */
10
+ readonly resolveModel?: (cwd: string) => Promise<ProfileModel>;
11
+ }
12
+ /** The profile an agent rule runs, with the loop guard appended. A profile cannot leave the guard out. */
13
+ export declare function buildAutomationProfile(automation: Automation): AgentProfile;
14
+ /** The user message of a run: one `type: path` line per changed file, capped like `appendFiles`. */
15
+ export declare function eventsPrompt(events: readonly AutomationEvent[]): string;
16
+ /**
17
+ * Run an agent rule: spawn its profile as an in-memory pi session, hand it the
18
+ * changed files, and wait for its final reply. The session never touches
19
+ * AutoRAG's retrieval memory; retrieval tools, when the rule asks for them, run
20
+ * against a throwaway memory file.
21
+ */
22
+ export declare function runAgentAutomation(automation: Automation, events: readonly AutomationEvent[], options?: RunAgentAutomationOptions): Promise<AutomationRunRecord>;
@@ -0,0 +1,32 @@
1
+ import type { Automation, AutomationEvent } from "./config.js";
2
+ export declare const AUTOMATION_MAX_APPEND_FILES = 100;
3
+ export interface AutomationRunRecord {
4
+ readonly id: string;
5
+ readonly startedAt: string;
6
+ readonly durationMs: number;
7
+ readonly eventCount: number;
8
+ readonly filesOverflow: boolean;
9
+ readonly exitCode: number | null;
10
+ readonly signal: NodeJS.Signals | null;
11
+ readonly timedOut: boolean;
12
+ readonly stdout: string;
13
+ readonly stderr: string;
14
+ readonly error?: string;
15
+ }
16
+ export interface RunAutomationOptions {
17
+ readonly home?: string;
18
+ readonly env?: NodeJS.ProcessEnv;
19
+ /** Override `[nodePath, cliEntry]` used when `run[0] === "autorag"`. */
20
+ readonly selfCommand?: readonly string[];
21
+ }
22
+ export declare function automationLogPath(home: string | undefined, id: string): string;
23
+ export declare function appendAutomationRunLog(home: string, record: AutomationRunRecord): void;
24
+ export declare function readLastAutomationRun(home: string, id: string): AutomationRunRecord | undefined;
25
+ /**
26
+ * `[runtime, cliEntry]` for this AutoRAG install, found by walking up from this
27
+ * module to the package root. `process.argv[1]` is not used: inside the MCP
28
+ * server or a library host it is not the AutoRAG CLI. Bundled installs run
29
+ * `dist/cli/index.js`; a source checkout without a build runs the TypeScript entry.
30
+ */
31
+ export declare function autoragCliCommand(): readonly string[];
32
+ export declare function runAutomation(automation: Automation, events: readonly AutomationEvent[], options?: RunAutomationOptions): Promise<AutomationRunRecord>;
@@ -0,0 +1,61 @@
1
+ import { type Automation } from "./config.js";
2
+ import { type AutomationRunRecord } from "./run.js";
3
+ export interface AutomationServiceSpec {
4
+ readonly id: string;
5
+ readonly nodePath: string;
6
+ readonly cliEntry: string;
7
+ readonly envFilePath: string;
8
+ readonly logPath: string;
9
+ readonly home: string;
10
+ readonly pathEnv: string;
11
+ readonly configPath?: string;
12
+ }
13
+ export interface AutomationServiceDescriptor {
14
+ readonly platform: NodeJS.Platform;
15
+ readonly id: string;
16
+ readonly definitionPath: string;
17
+ readonly envFilePath: string;
18
+ readonly logPath: string;
19
+ }
20
+ export interface ServiceExecResult {
21
+ readonly code: number;
22
+ readonly stdout: string;
23
+ readonly stderr: string;
24
+ }
25
+ export type ServiceCommandExec = (cmd: string, args: readonly string[]) => Promise<ServiceExecResult>;
26
+ export interface AutomationServiceOptions {
27
+ readonly platform?: NodeJS.Platform;
28
+ readonly home?: string;
29
+ readonly env?: NodeJS.ProcessEnv;
30
+ readonly selfCommand?: readonly string[];
31
+ readonly exec?: ServiceCommandExec;
32
+ /** How long install waits for the daemon to hold its lock. Default 15000. */
33
+ readonly waitForRunningMs?: number;
34
+ }
35
+ export interface AutomationServiceInstallResult extends AutomationServiceDescriptor {
36
+ /** Whether the daemon was observed running before install returned. */
37
+ readonly running: boolean;
38
+ }
39
+ export interface AutomationStatusEntry extends Automation {
40
+ readonly lastRun?: AutomationRunRecord;
41
+ }
42
+ export interface AutomationStatusReport {
43
+ readonly service: {
44
+ readonly platform: NodeJS.Platform;
45
+ readonly id: string;
46
+ readonly definitionPath: string;
47
+ readonly logPath: string;
48
+ readonly installed: boolean;
49
+ readonly running: boolean;
50
+ };
51
+ readonly configPath: string;
52
+ readonly configError?: string;
53
+ readonly automations: readonly AutomationStatusEntry[];
54
+ }
55
+ export declare function automationServiceDescriptor(options?: AutomationServiceOptions): AutomationServiceDescriptor;
56
+ export declare function renderLaunchdPlist(spec: AutomationServiceSpec): string;
57
+ export declare function renderSystemdUnit(spec: AutomationServiceSpec): string;
58
+ export declare function renderWindowsTaskXml(spec: AutomationServiceSpec): string;
59
+ export declare function installAutomationService(options?: AutomationServiceOptions): Promise<AutomationServiceInstallResult>;
60
+ export declare function uninstallAutomationService(options?: AutomationServiceOptions): Promise<AutomationServiceDescriptor>;
61
+ export declare function getAutomationStatus(options?: AutomationServiceOptions): AutomationStatusReport;
@@ -0,0 +1,2 @@
1
+ import type { CommandContext } from "./types.js";
2
+ export declare function runAutomate(ctx: CommandContext): Promise<number>;
@@ -1,2 +1,4 @@
1
+ import { type SetupReport } from "../setup.js";
1
2
  import type { CommandContext } from "./types.js";
2
3
  export declare function runSetupCommand(ctx: CommandContext): Promise<number>;
4
+ export declare function renderSetup(report: SetupReport): string;
@@ -3,6 +3,7 @@ import { ModelRuntime } from "@earendil-works/pi-coding-agent";
3
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
+ import { type PermissionMode } from "../agent/permission-gate.js";
6
7
  import type { DecompositionModel } from "../agent/query-decomposition.js";
7
8
  import { type DatasourcesConfig } from "../datasource/skills/factory.js";
8
9
  import type { EnsureMinSyncBinaryOptions, MinSyncEmbedderConfig } from "../minsync/index.js";
@@ -169,6 +170,11 @@ export interface CliConfig {
169
170
  * agent's own model decompose.
170
171
  */
171
172
  queryDecomposition?: QueryDecompositionConfig | false;
173
+ /**
174
+ * Approval gate for file changes by the agent: `auto` (default for the TUI: Jev first, user as fallback; `full` for `search` and a bridged TUI), `ask`
175
+ * (the user approves every file-capable call, Jev unused), or `full` (no gate). `--permission-mode` and `AUTORAG_PERMISSION_MODE` override the file.
176
+ */
177
+ permissionMode?: PermissionMode;
172
178
  /** Post-merge reranking. Absent ⇒ reranking disabled. `false` disables it. */
173
179
  rerank?: RerankConfig | false;
174
180
  parserOptions?: Record<string, unknown>;
@@ -178,6 +184,16 @@ export interface CliConfig {
178
184
  timeoutMs?: number;
179
185
  };
180
186
  excludeExactDuplicates?: boolean;
187
+ /** Filee command line behind the `convert_files` tool. `enabled: false` removes the conversion tools. */
188
+ filee?: {
189
+ enabled?: boolean;
190
+ binaryPath?: string;
191
+ /** Download the pinned filee-cli into `<AUTORAG_HOME>/tools` when none is found. Default true. */
192
+ autoInstall?: boolean;
193
+ timeoutMs?: number;
194
+ /** Folder for Filee's own settings and engines (`FILEE_DATA_DIR`); default is Filee's per-user folder. */
195
+ dataDir?: string;
196
+ };
181
197
  /** Absolute or workspace-relative files/directories omitted from local indexing. */
182
198
  excludePaths?: string[];
183
199
  /** Hard caps on retrieval, baseline prefetch, and model-facing candidate lists. */
@@ -192,6 +208,11 @@ export interface ResolveConfigInput {
192
208
  env?: NodeJS.ProcessEnv;
193
209
  cwd?: string;
194
210
  readOnly?: boolean;
211
+ /**
212
+ * Mode when no flag, environment variable, or config file sets one. Commands that run with nobody to approve
213
+ * (`search`) or through a remote bridge pass `full`; the interactive TUI leaves it to the default (`auto`).
214
+ */
215
+ defaultPermissionMode?: PermissionMode;
195
216
  }
196
217
  export interface ResolvedConfigPath {
197
218
  configPath: string;
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- declare const COMMANDS: readonly ["init", "setup", "refresh", "status", "search", "evidence", "memory", "index", "watch", "health", "duplicates", "tui", "lite", "models", "update-check"];
2
+ declare const COMMANDS: readonly ["init", "setup", "refresh", "status", "search", "evidence", "memory", "index", "watch", "health", "duplicates", "tui", "lite", "models", "update-check", "automate"];
3
3
  type CommandName = (typeof COMMANDS)[number];
4
4
  export type { CommandName };
5
5
  interface ParsedArgs {