@autorag/librarian 2.11.0 → 2.13.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.
- package/NOTICE +6 -0
- package/README.md +14 -6
- package/dist/agent/agent.d.ts +136 -33
- package/dist/agent/answer-citations.d.ts +34 -2
- package/dist/agent/answer-guidelines.d.ts +20 -3
- package/dist/agent/ask-user.d.ts +8 -0
- package/dist/agent/automation-tool.d.ts +45 -0
- package/dist/agent/citation-links.d.ts +23 -0
- package/dist/agent/citation-numbers.d.ts +68 -0
- package/dist/agent/citation-relevance.d.ts +37 -0
- package/dist/agent/conversation-queries.d.ts +31 -0
- package/dist/agent/convert-tool.d.ts +28 -0
- package/dist/agent/current-date.d.ts +10 -0
- package/dist/agent/datasource-skill.d.ts +2 -2
- package/dist/agent/environment-prompt.d.ts +20 -0
- package/dist/agent/evidence-ledger.d.ts +4 -2
- package/dist/agent/evidence-persistence.d.ts +17 -11
- package/dist/agent/index.d.ts +1 -0
- package/dist/agent/intent-tracing.d.ts +33 -0
- package/dist/agent/location-claims.d.ts +14 -0
- package/dist/agent/packaged-skill.d.ts +19 -0
- package/dist/agent/permission-gate.d.ts +78 -0
- package/dist/agent/permission-judgment.d.ts +72 -0
- package/dist/agent/permission-paths.d.ts +23 -0
- package/dist/agent/query-routing.d.ts +78 -27
- package/dist/agent/results.d.ts +10 -2
- package/dist/agent/search-documents.d.ts +6 -1
- package/dist/agent/self-config.d.ts +6 -4
- package/dist/agent/skill-invocation.d.ts +17 -0
- package/dist/agent/user-requests.d.ts +52 -0
- package/dist/automation/config.d.ts +48 -0
- package/dist/automation/daemon.d.ts +31 -0
- package/dist/automation/dispatch.d.ts +13 -0
- package/dist/automation/run-agent.d.ts +22 -0
- package/dist/automation/run.d.ts +32 -0
- package/dist/automation/service.d.ts +61 -0
- package/dist/cli/commands/automate.d.ts +2 -0
- package/dist/cli/commands/evidence.d.ts +2 -0
- package/dist/cli/config.d.ts +21 -0
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +19531 -14871
- package/dist/cli/open-target.d.ts +9 -0
- package/dist/cli/setup.d.ts +14 -0
- package/dist/convert/cli.d.ts +77 -0
- package/dist/convert/index.d.ts +4 -0
- package/dist/convert/installer.d.ts +84 -0
- package/dist/convert/matrix.d.ts +27 -0
- package/dist/convert/relate.d.ts +30 -0
- package/dist/core.js +32479 -28141
- package/dist/datasource/connector-timeouts.d.ts +6 -2
- package/dist/datasource/crawler-skill.d.ts +1 -0
- package/dist/datasource/crawler-types.d.ts +1 -1
- package/dist/datasource/index.d.ts +1 -1
- package/dist/datasource/sidecar/methods.d.ts +8 -1
- package/dist/datasource/skills/clawgallery/skill.d.ts +4 -0
- package/dist/datasource/skills/discrawl/skill.d.ts +5 -0
- package/dist/datasource/skills/factory.d.ts +5 -1
- package/dist/datasource/skills/lazykatok/index.d.ts +1 -1
- package/dist/datasource/skills/lazykatok/methods.d.ts +5 -5
- package/dist/datasource/skills/lazykatok/skill.d.ts +1 -0
- package/dist/datasource/skills/lazykatok/types.d.ts +2 -2
- package/dist/datasource/skills/mailcrawl/skill.d.ts +1 -0
- package/dist/datasource/skills/mailcrawl/types.d.ts +1 -1
- package/dist/dupey/cli.d.ts +18 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +32558 -28145
- package/dist/mcp/index.js +32651 -28263
- package/dist/memory/memory.d.ts +4 -1
- package/dist/minsync/installer.d.ts +1 -1
- package/dist/mirror/atomic-write.d.ts +16 -1
- package/dist/mirror/sync.d.ts +2 -0
- package/dist/profiles/agent-factory.d.ts +60 -0
- package/dist/profiles/automation-profiles.d.ts +25 -0
- package/dist/profiles/loop-guard.d.ts +23 -0
- package/dist/profiles/retrieval-tools.d.ts +24 -0
- package/dist/profiles/session-model.d.ts +69 -0
- package/dist/profiles.d.ts +13 -0
- package/dist/profiles.js +35246 -0
- package/dist/retrieval/chunk-location.d.ts +28 -0
- package/dist/retrieval/fallback.d.ts +24 -0
- package/dist/retrieval/index.d.ts +1 -0
- package/dist/retrieval/rerank.d.ts +6 -0
- package/dist/retrieval/types.d.ts +16 -0
- package/internal-skills/organize/SKILL.md +43 -0
- package/package.json +9 -2
- package/skills/autorag/SKILL.md +89 -7
- package/skills/autorag-setup/SKILL.md +10 -4
package/NOTICE
CHANGED
|
@@ -24,6 +24,9 @@ License: MIT
|
|
|
24
24
|
@modelcontextprotocol/server@2.3.1
|
|
25
25
|
License: Apache-2.0
|
|
26
26
|
|
|
27
|
+
@parcel/watcher@2.6.0
|
|
28
|
+
License: MIT
|
|
29
|
+
|
|
27
30
|
chardet@2.2.0
|
|
28
31
|
License: MIT
|
|
29
32
|
|
|
@@ -51,6 +54,9 @@ License: MIT
|
|
|
51
54
|
pdfjs-dist@6.4.299
|
|
52
55
|
License: Apache-2.0
|
|
53
56
|
|
|
57
|
+
pi-ask-user@0.17.0
|
|
58
|
+
License: MIT
|
|
59
|
+
|
|
54
60
|
pi-discord-remote@0.2.4
|
|
55
61
|
License: MIT
|
|
56
62
|
|
package/README.md
CHANGED
|
@@ -222,7 +222,7 @@ A fresh session — at launch and after `/new` (or `/reload`) — opens on AutoR
|
|
|
222
222
|
|
|
223
223
|
Typing while a search runs works like steering one of Pi's own turns. **Enter** steers the running search: AutoRAG treats the text as a correction of a search that is going wrong, delivers it before the search's next model request (also between phases, where no turn is streaming), cuts in-flight retrieval short so the correction lands promptly, and always runs the verification phase so the answer reflects the correction. **Alt+Enter** queues a new question that runs after the current search answers. **Esc** stops the search instead of letting it continue into its next phase. Pi's registered `/` commands still run during a search; any other line starting with `/` (a path, for example) is a steer like any other text. A query typed after a search answers is a new search in the same session, as before.
|
|
224
224
|
|
|
225
|
-
From the moment a question is submitted, a live progress widget sits above the editor: a spinner, the elapsed time, and one line per step the search is running (routing, splitting the question, each retrieval source with its hit count and time, ranking, the first answer, verification). A slow source shows its own running timer, a failing source shows its error text verbatim, and the widget disappears when the answer is final or **Esc** stops the search. While the model streams, Pi's own `Working` loader takes over and the widget keeps only the header and steps.
|
|
225
|
+
From the moment a question is submitted, a live progress widget sits above the editor: a spinner, the elapsed time, and one line per step the search is running (routing, splitting the question, each retrieval source with its hit count and time, ranking, the first answer, verification). A slow source shows its own running timer, a failing source shows its error text verbatim, and the widget disappears when the answer is final or **Esc** stops the search. While the model streams, Pi's own `Working` loader takes over and the widget keeps only the header and steps. Every tool call also carries a short model-written intent (the `i` argument): Pi's `Working` loader shows the newest one, and `autorag search` and the desktop app receive it as progress, so the model does not write separate progress notes before tool calls.
|
|
226
226
|
|
|
227
227
|
Update notices are AutoRAG's, not Pi's: `autorag tui` suppresses Pi's "run `pi update`" banner (Pi is a bundled host, not a separate install) and instead checks the published `@autorag/librarian` release, showing a one-line notice in the session when a newer version exists. Set `AUTORAG_NO_UPDATE_CHECK=1` to skip the lookup; `AUTORAG_UPDATE_CHECK_URL` overrides the registry endpoint.
|
|
228
228
|
|
|
@@ -263,6 +263,7 @@ bun add @autorag/librarian
|
|
|
263
263
|
- **Rust Toolchain (Optional):** Automatically compiles Jikji (`jikji-cli`) if installed.
|
|
264
264
|
- **MinSync:** Automatically downloaded and installed into `<workspace>/.autorag/bin` on first run.
|
|
265
265
|
- **Everything (Windows only, bundled):** The package ships the portable Everything 1.4.1.1032 and its ES 1.1.0.38 CLI (x64 and ARM64, SHA-256 pinned). On Windows, AutoRAG extracts them into `<workspace>/.autorag/everything/` and runs a private, user-level instance that indexes only your configured search roots: no administrator rights, no Everything service, no whole-drive scan, no HTTP/ETP server, and no change to any Everything you already run. Set `"everything": false` in the config to turn it off. macOS and Linux are not affected.
|
|
266
|
+
- **filee-cli (file conversion, automatic):** `autorag setup` and the TUI download the pinned filee-cli release (~85 MB, SHA-256 verified) into `<AUTORAG_HOME>/tools/filee-cli/<version>/`, so the agent can convert between 255 formats offline with `convert_files`. A `filee`/`filee-cli` already on `PATH` is used instead. Set `"filee": { "autoInstall": false }` to forbid the download or `"filee": { "enabled": false }` to remove the tools. Filee fetches its own engines (FFmpeg, Pandoc, LibreOffice, calibre, Ghostscript; hundreds of MB, only when a conversion needs one) on first use.
|
|
266
267
|
- **FSearch (macOS/Linux only, separate install):** Install [`fsearch-cli`](https://github.com/NomaDamas/fsearch-mac) yourself (e.g. `brew install NomaDamas/fsearch-mac/fsearch-mac` (installs the `fsearch-cli` binary); GPL-2.0, spawned as a separate process, never bundled or linked). On macOS and Linux, AutoRAG builds a per-workspace database at `<workspace>/.autorag/fsearch/` indexing only your configured search roots, and keeps a `fsearch-cli watch` daemon live (FSEvents/inotify) for sub-second name search. It never touches the FSearch app's own database. Without fsearch-cli, name search falls back to a slow bounded filesystem walk. Set `"fsearch": false` in the config to turn it off. Windows is not affected (Everything covers it).
|
|
267
268
|
|
|
268
269
|
---
|
|
@@ -460,7 +461,9 @@ mirrored are kept and not re-parsed on the next run. `onProgress` reports `parse
|
|
|
460
461
|
(`processed`/`total` are files, `currentVirtualPath` is the file about to be processed) and
|
|
461
462
|
`datasources` (`processed`/`total` are datasource skills). During the parse phase
|
|
462
463
|
`.autorag/refresh-progress.json` also carries the running `sourceFiles.total` and
|
|
463
|
-
`parsedCounts
|
|
464
|
+
`parsedCounts`, refreshed every 25 files rather than per file. The marker is replaced with a
|
|
465
|
+
retried rename (an in-place overwrite if a reader keeps the destination held, as on Windows).
|
|
466
|
+
Without these options a refresh behaves as before.
|
|
464
467
|
|
|
465
468
|
---
|
|
466
469
|
|
|
@@ -475,7 +478,7 @@ mirrored are kept and not re-parsed on the next run. `onProgress` reports `parse
|
|
|
475
478
|
| `autorag health` | Check model provider authentication, token validity, and API reachability |
|
|
476
479
|
| `autorag models list` | List chat models the pi runtime can resolve (built-ins, `models.json`, custom/extension providers) with provider auth status; never prints credential values |
|
|
477
480
|
| `autorag update-check` | Compare the running `autorag` against the published npm version (also runs on `autorag tui` launch) |
|
|
478
|
-
| `autorag tui` | Open Pi's interactive librarian TUI (`/login`, `/model`, `/resume`, …); `--telegram` / `--whatsapp` / `--discord` add the Telegram / WhatsApp / Discord remote-control bridges |
|
|
481
|
+
| `autorag tui` | Open Pi's interactive librarian TUI (`/login`, `/model`, `/resume`, …); the agent can stop and ask you a multiple-choice or open question through the [`ask_user` tool](docs/ask-user.md); `--telegram` / `--whatsapp` / `--discord` add the Telegram / WhatsApp / Discord remote-control bridges; `--permission-mode ask\|auto\|full` (Shift+Tab, `/permissions`) sets the [approval gate for file changes](docs/permissions.md) |
|
|
479
482
|
| `autorag duplicates [DIR]` | Read-only scan for exact and near-duplicate document families with `dupey` |
|
|
480
483
|
| `autorag lite ...` | CLI bootstrap, indexing repair, terminal maintenance, and fallback interface; agents use MCP for normal Lite operation |
|
|
481
484
|
| `autorag memory inspect` | Render a read-only, path-opaque snapshot of retrieval memory (judged evidence, curated results, evidence chunks, insights); model-free |
|
|
@@ -600,7 +603,10 @@ and `skills/autorag-setup` only when the agent should also drive the
|
|
|
600
603
|
model-backed librarian, and `skills/autorag-doctor` for diagnostics. Other
|
|
601
604
|
agents read their own skill directories; copy the same setup folder there and
|
|
602
605
|
reload the agent session so it picks up the MCP registration instructions.
|
|
603
|
-
Do not copy or retain the removed `autorag-lite-search` skill.
|
|
606
|
+
Do not copy or retain the removed `autorag-lite-search` skill. The package also
|
|
607
|
+
ships `internal-skills/`, which holds the librarian's own turn rules (for
|
|
608
|
+
example `internal-skills/organize/`) — those are never parent-agent skills, so
|
|
609
|
+
do not copy them into another agent.
|
|
604
610
|
|
|
605
611
|
### Quick Agent Workflow
|
|
606
612
|
|
|
@@ -649,7 +655,7 @@ AutoRAG Agent connects to external tools and communication platforms using dedic
|
|
|
649
655
|
| **macOS Spotlight** | `spotlight` | Native `mdfind` CLI | macOS system metadata and content index | System Native |
|
|
650
656
|
| **Browser History** | `hister` | [Hister](https://github.com/asciimoo/hister) server (AGPL-3.0-or-later, separate program, HTTP API) | Pages visited in Chrome/Chromium/Firefox, captured by Hister's own extension and indexed by Hister (web pages only; its local-file indexing is never used) | Lexical full-text; optional Semantic via Hister's own embedding endpoint |
|
|
651
657
|
|
|
652
|
-
For configuration syntax and connector details, see [docs/datasource-skills.md](docs/datasource-skills.md). Non-interactive `sync`/`index` steps get a
|
|
658
|
+
For configuration syntax and connector details, see [docs/datasource-skills.md](docs/datasource-skills.md). Non-interactive `sync`/`index` steps get a one-hour per-connector budget (`connector.indexTimeoutMs`) because first-run imports routinely take minutes; interactive search keeps its 60-second default.
|
|
653
659
|
|
|
654
660
|
---
|
|
655
661
|
|
|
@@ -729,7 +735,7 @@ Deep dive into AutoRAG Agent's architecture, security, and integration guides:
|
|
|
729
735
|
- **[Telegram Remote Control](docs/telegram.md):** Ask the librarian from a Telegram chat through a running `autorag tui --telegram` session: setup, commands, and keeping it alive.
|
|
730
736
|
- **[Datasource Skills Reference](docs/datasource-skills.md):** Full configuration contracts, connection aliases, and connector options.
|
|
731
737
|
- **[Apple Calendar & Reminders via EventKit MCP](docs/eventkit-mcp.md):** macOS-only: read Calendar events and Reminders (Google/iCloud/Exchange accounts already in Calendar.app) by running `mcp-server-apple-events` beside `autorag-mcp`. Live, read-only; not indexed.
|
|
732
|
-
- **[Jev Decisions](docs/jev-decisions.md):** Jev query pipeline, **on by default** via Dazzi Models when signed in (OpenRouter otherwise): it routes each question to
|
|
738
|
+
- **[Jev Decisions](docs/jev-decisions.md):** Jev query pipeline, **on by default** via Dazzi Models when signed in (OpenRouter otherwise): it routes each question to local search (everything needing more information, including the public web when the question needs recent public facts), `extra` (a knowledge answer or any other action such as committing code; one turn with every tool, no retrieval), `organize` (move, rename, convert, or sort files and folders), or its own `config` branch, and keeps a weakly-favored non-local verdict on local search through a 0.75 confidence floor. It also splits multi-part questions into up to five parallel searches (`dazzi/openai/gpt-6-luna` when signed in, else `openrouter/qwen/qwen3.7-flash`), picks which registered datasources to search before the fast answer, and ends the run after the fast answer when that answer is complete. Also covers the `jev` judgment tool, backends (OpenRouter, TypeSafe, Vercel AI Gateway), and how to opt out.
|
|
733
739
|
- **[Manual QA & Datasource Test Harnesses](docs/manual-qa-datasources.md):** Real-world testing guides for Discord, KakaoTalk, Slack, Notion, and email.
|
|
734
740
|
- **[Supply Chain Security & License Audits](docs/supply-chain.md):** Software bill of materials (SBOM) and dependency gate policies.
|
|
735
741
|
- **[Competitive Landscape Study](docs/competitive-landscape-2026-09.md):** In-depth analysis of why in-place federation outperforms centralized RAG.
|
|
@@ -742,6 +748,7 @@ Deep dive into AutoRAG Agent's architecture, security, and integration guides:
|
|
|
742
748
|
AutoRAG Agent is an open-source project built by the community. We welcome contributions, bug reports, datasource connectors, and ideas!
|
|
743
749
|
|
|
744
750
|
- **Contributing:** Feel free to open an issue or pull request. Start with [CONTRIBUTING.md](CONTRIBUTING.md) — development setup, the `make ci` check we ask for, the `Signed-off-by` trailer every commit needs, and when to run the live end-to-end lanes. [MAINTAINERS](MAINTAINERS) lists who reviews which area. AI tools are allowed; unverified dumps are not — see [AI_POLICY.md](AI_POLICY.md).
|
|
751
|
+
- **Discussions:** For questions, usage help, ideas, and open-ended design talk, please use [GitHub Discussions](https://github.com/Marker-Inc-Korea/AutoRAG/discussions) instead of opening an issue. Keep issues for confirmed bugs and concrete, actionable work.
|
|
745
752
|
- **Security:** Private vulnerability reports and the response SLA live in [SECURITY.md](SECURITY.md).
|
|
746
753
|
- **GitHub Contributors:** [View all contributors](https://github.com/Marker-Inc-Korea/AutoRAG/graphs/contributors) on GitHub.
|
|
747
754
|
|
|
@@ -758,6 +765,7 @@ AutoRAG Agent stands on the shoulders of fantastic open-source projects:
|
|
|
758
765
|
- **[FSearch](https://github.com/cboxdoerfer/fsearch)** and **[fsearch-cli](https://github.com/NomaDamas/fsearch-mac)** — Everything-style file-name search for macOS/Linux (GPL-2.0-or-later). Never bundled or linked: users install fsearch-cli separately and AutoRAG spawns it as a separate process (mere aggregation per the FSF GPL FAQ).
|
|
759
766
|
- **[Hister](https://github.com/asciimoo/hister)** by [asciimoo](https://github.com/asciimoo) and contributors — Self-hosted browser web-history search (AGPL-3.0-or-later). Never bundled, linked, copied, or modified: users run Hister as a separate program and AutoRAG only calls its public HTTP search API (mere aggregation). Hister is always named as the backend of the `hister` datasource.
|
|
760
767
|
- **[dupey](https://github.com/NomaDamas/dupey)** by [NomaDamas](https://github.com/NomaDamas) — Fast duplicate and near-duplicate document family detection.
|
|
768
|
+
- **[Filee](https://github.com/KnifeLemon/Filee)** by [KnifeLemon](https://github.com/KnifeLemon) — Offline conversion of 240+ file formats (MIT). Never bundled or linked: AutoRAG downloads the SHA-256-pinned [`filee-cli`](https://github.com/NomaDamas/filee-cli) release (NomaDamas' CLI-only redistribution, MIT) into `<AUTORAG_HOME>/tools/filee-cli/` on `autorag setup` / first conversion and spawns it as a separate process. An existing `filee`/`filee-cli` on `PATH` or `filee.binaryPath` wins. Filee downloads its own engines (FFmpeg, Pandoc, LibreOffice, …) on first use.
|
|
761
769
|
- **Federated CLI Authors:** External datasource tools [`lazykatok`](https://github.com/changeroa/lazykatok), [`discrawl`](https://github.com/openclaw/discrawl), [`mailcrawl`](https://github.com/NomaDamas/mailcrawl), [`wacrawl`](https://github.com/openclaw/wacrawl), [`telecrawl`](https://github.com/openclaw/telecrawl), [`slacrawl`](https://github.com/openclaw/slacrawl), [`notcrawl`](https://github.com/openclaw/notcrawl), and [`rclone`](https://rclone.org).
|
|
762
770
|
- **[kordoc](https://github.com/chrisryugj/kordoc)** by [chrisryugj](https://github.com/chrisryugj) — HWP/HWPX/HWPML, PDF, DOCX and XLSX parsing with nested-table fidelity, used as AutoRAG's default document parser.
|
|
763
771
|
|
package/dist/agent/agent.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Agent, AgentTool } from "@earendil-works/pi-agent-core";
|
|
2
2
|
import type { Api, ImageContent, Model } from "@earendil-works/pi-ai";
|
|
3
|
+
import { type FileeCliOptions, type FileeConvertRequest } from "../convert/index.js";
|
|
3
4
|
import { type DatasourceRetryOptions } from "../datasource/retry.js";
|
|
4
5
|
import type { DatasourceIndexResult, DatasourceSkill } from "../datasource/types.js";
|
|
5
6
|
import { type DupeyCliOptions } from "../dupey/index.js";
|
|
@@ -15,10 +16,13 @@ import { RetrievalEngine } from "../retrieval/engine.js";
|
|
|
15
16
|
import { RetrievalMethodRegistry } from "../retrieval/registry.js";
|
|
16
17
|
import type { DatasourceCatalogEntry } from "../retrieval/selection.js";
|
|
17
18
|
import type { RetrievalDiagnostic, RetrievalOptions, RetrievalResult } from "../retrieval/types.js";
|
|
19
|
+
import { type ConvertFilesDetails } from "./convert-tool.js";
|
|
18
20
|
import { type DatasourceAgentSkill } from "./datasource-skill.js";
|
|
19
21
|
import { type ScanDuplicateDocumentsDetails } from "./dupey-tool.js";
|
|
20
22
|
import { type JevToolOptions } from "./jev-extension.js";
|
|
21
23
|
import { type JikjiFindProviderResult } from "./jikji-find-tool.js";
|
|
24
|
+
import { type PackagedAgentSkill } from "./packaged-skill.js";
|
|
25
|
+
import { PermissionController, type PermissionMode } from "./permission-gate.js";
|
|
22
26
|
import { type AutoRAGPiInteractiveRuntime, type AutoRAGPiSession } from "./pi-session.js";
|
|
23
27
|
import { type RefreshProgressCounts, type RefreshProgressPhase } from "./refresh-progress.js";
|
|
24
28
|
import { type SearchDocumentDiagnostic, type SearchDocumentsResponse, type SearchDocumentsStreamEvent } from "./search-documents.js";
|
|
@@ -256,11 +260,18 @@ export interface AutoRAGAgentOptions {
|
|
|
256
260
|
autoRefresh?: AutoRefreshOptions;
|
|
257
261
|
parserOptions?: DefaultParserRegistryOptions;
|
|
258
262
|
dupey?: DupeyCliOptions | false;
|
|
263
|
+
/**
|
|
264
|
+
* Filee command line behind `convert_files` and `list_file_conversions`.
|
|
265
|
+
* `false` leaves both tools out. The duplicate-family check on converted
|
|
266
|
+
* copies follows `dupey`.
|
|
267
|
+
*/
|
|
268
|
+
filee?: FileeCliOptions | false;
|
|
259
269
|
/**
|
|
260
270
|
* Jev (TypeSafe's judgment model: typed questions in, calibrated
|
|
261
271
|
* probabilities out). When set, the two-phase search asks Jev before the
|
|
262
|
-
* fast answer
|
|
263
|
-
*
|
|
272
|
+
* fast answer which branch handles the question (local search, file
|
|
273
|
+
* organization, an extra task, or — in a local host — its own configuration)
|
|
274
|
+
* and whether to decompose it; after the fast answer, whether
|
|
264
275
|
* verification is needed. It also exposes the `jev` tool.
|
|
265
276
|
*
|
|
266
277
|
* The CLI config enables this by default on OpenRouter (`buildAgentOptions`
|
|
@@ -288,6 +299,12 @@ export interface AutoRAGAgentOptions {
|
|
|
288
299
|
* message.
|
|
289
300
|
*/
|
|
290
301
|
selfConfig?: SelfConfigOptions;
|
|
302
|
+
/**
|
|
303
|
+
* Override for the packaged `organize` skill file that the Jev `organize`
|
|
304
|
+
* branch loads into its turn; defaults to the packaged skill. Present for a
|
|
305
|
+
* host that ships its own organize rules, and for tests.
|
|
306
|
+
*/
|
|
307
|
+
organizeSkillPath?: string;
|
|
291
308
|
/**
|
|
292
309
|
* Question decomposition used by the Jev query pipeline. `model` (with its
|
|
293
310
|
* `apiKey`) is the LLM that splits one question into at most five search
|
|
@@ -358,6 +375,15 @@ export interface AutoRAGAgentOptions {
|
|
|
358
375
|
* owner pairing live in pi's `telegram.json`, never in AutoRAG config.
|
|
359
376
|
*/
|
|
360
377
|
telegram?: boolean;
|
|
378
|
+
/**
|
|
379
|
+
* Approval gate for what the agent does to existing files. `full` (the programmatic default) installs a
|
|
380
|
+
* gate that never asks; `ask` and `auto` approve deletes, moves, renames, and in-place edits of originals
|
|
381
|
+
* (copying and creating new files never ask). `auto` asks Jev first and only falls back to the user when
|
|
382
|
+
* Jev will not approve. See {@link PermissionMode}.
|
|
383
|
+
*/
|
|
384
|
+
permissionMode?: PermissionMode;
|
|
385
|
+
/** Share one controller (mode, session grants) with a host that switches modes itself. Wins over `permissionMode`. */
|
|
386
|
+
permissionController?: PermissionController;
|
|
361
387
|
}
|
|
362
388
|
/** Post-merge reranking options. Mirrors the CLI `RerankConfig` (secrets via env). */
|
|
363
389
|
export interface RerankAgentOptions {
|
|
@@ -406,6 +432,8 @@ export declare class AutoRAGAgent {
|
|
|
406
432
|
private readonly memory;
|
|
407
433
|
private readonly runLogger;
|
|
408
434
|
private lastQuery;
|
|
435
|
+
/** What the user has said in this conversation; Jev's permission gate judges file changes against it. */
|
|
436
|
+
private readonly userRequests;
|
|
409
437
|
private lastSessionId;
|
|
410
438
|
private activeRun;
|
|
411
439
|
/**
|
|
@@ -428,6 +456,10 @@ export declare class AutoRAGAgent {
|
|
|
428
456
|
* run starts from an empty ledger.
|
|
429
457
|
*/
|
|
430
458
|
private readonly evidenceLedger;
|
|
459
|
+
/** The result numbers (`[n]`) this conversation has shown, kept next to the ledger's `e<N>` ordinals. */
|
|
460
|
+
private readonly citationNumbers;
|
|
461
|
+
/** Everything the user typed in this conversation; Jev reads it to judge whether a citation relates to what was asked. */
|
|
462
|
+
private readonly conversationQueries;
|
|
431
463
|
private preliminaryCallback;
|
|
432
464
|
/** Per-phase thinking levels of the two-phase search. */
|
|
433
465
|
private readonly fastThinkingLevel;
|
|
@@ -460,12 +492,18 @@ export declare class AutoRAGAgent {
|
|
|
460
492
|
private readonly datasourceAgentSkills;
|
|
461
493
|
private readonly parserOptions;
|
|
462
494
|
private readonly dupeyOptions;
|
|
495
|
+
private readonly fileeOptions;
|
|
463
496
|
/** pi extension registering the optional `jev` tool; undefined when disabled. */
|
|
464
497
|
private readonly jevExtension;
|
|
465
498
|
/** Jev judge shared by the `jev` tool and the query router; undefined when disabled. */
|
|
466
499
|
private readonly jevJudge;
|
|
500
|
+
/** Mode and grants of the file-change approval gate; shared by every pi session this agent creates. */
|
|
501
|
+
private readonly permissions;
|
|
502
|
+
private readonly permissionGate;
|
|
467
503
|
/** Self-configuration, enabled only with Jev on a local session. */
|
|
468
504
|
private readonly selfConfig;
|
|
505
|
+
/** Override for the packaged organize skill the `organize` branch loads; undefined keeps the packaged one. */
|
|
506
|
+
private readonly organizeSkillPath;
|
|
469
507
|
private readonly queryDecompositionModel;
|
|
470
508
|
/** Web search options for the agent's `web_search` / `web_fetch` tools; undefined when web tools are off. */
|
|
471
509
|
private readonly webSearchOptions;
|
|
@@ -497,11 +535,15 @@ export declare class AutoRAGAgent {
|
|
|
497
535
|
/** The memory context loaded for the in-flight run; cleared whenever a run starts. */
|
|
498
536
|
private memoryContextCache;
|
|
499
537
|
private readonly discordRemote;
|
|
538
|
+
/** Whether the bound interactive session offers `ask_user`; the phase prompts name it only then. */
|
|
539
|
+
private askUserOffered;
|
|
500
540
|
private activeRetrievalOptions;
|
|
501
541
|
private readonly toolBurstGuard;
|
|
502
542
|
private readonly limits;
|
|
503
543
|
private readonly refreshLimits;
|
|
504
544
|
constructor(options: AutoRAGAgentOptions);
|
|
545
|
+
convertFiles(request: FileeConvertRequest, signal?: AbortSignal): Promise<ConvertFilesDetails>;
|
|
546
|
+
listFileConversions(from?: string, signal?: AbortSignal): Promise<string>;
|
|
505
547
|
scanDuplicateDocuments(): Promise<ScanDuplicateDocumentsDetails>;
|
|
506
548
|
/**
|
|
507
549
|
* Reference memory for the current question: everything judged earlier in
|
|
@@ -544,6 +586,8 @@ export declare class AutoRAGAgent {
|
|
|
544
586
|
private configureSearchSession;
|
|
545
587
|
private recordSearchToolEvent;
|
|
546
588
|
private currentSystemPromptConfig;
|
|
589
|
+
/** The approval gate's controller: read or switch the permission mode of this agent's sessions. */
|
|
590
|
+
get permissionControl(): PermissionController;
|
|
547
591
|
subscribe(listener: Parameters<Agent["subscribe"]>[0]): () => void;
|
|
548
592
|
createPiInteractiveRuntime(): Promise<AutoRAGPiInteractiveRuntime>;
|
|
549
593
|
/**
|
|
@@ -565,7 +609,12 @@ export declare class AutoRAGAgent {
|
|
|
565
609
|
* matters, so the steer reaches the model before the next request.
|
|
566
610
|
*/
|
|
567
611
|
private interruptibleBySteer;
|
|
568
|
-
/**
|
|
612
|
+
/**
|
|
613
|
+
* Resolve the model's inline `[eN]` citations against this run's evidence and derive the structured results.
|
|
614
|
+
* With Jev on, every cited chunk is first checked for relevance to the sentence that cites it and to what
|
|
615
|
+
* the user typed in this conversation; a chunk Jev finds unrelated (a table of contents, a footer) is dropped
|
|
616
|
+
* from the citations before the answer is returned or judged for memory.
|
|
617
|
+
*/
|
|
569
618
|
private deriveAnswer;
|
|
570
619
|
/**
|
|
571
620
|
* Routes one TUI input the way pi routes typed input for its own turns. With
|
|
@@ -677,39 +726,52 @@ export declare class AutoRAGAgent {
|
|
|
677
726
|
private shouldFollowUp;
|
|
678
727
|
/**
|
|
679
728
|
* Jev query pipeline, run before the fast answer. Jev picks the branch
|
|
680
|
-
* (
|
|
681
|
-
* needs decomposition; a "yes" splits it into at
|
|
682
|
-
* with the configured decomposition model
|
|
683
|
-
* the local branch, Jev also judges, per
|
|
684
|
-
* must be searched (in parallel with
|
|
685
|
-
* routing failure, this is today's
|
|
686
|
-
* question with no datasource search.
|
|
729
|
+
* (local search, file organization, an extra task, AutoRAG configuration)
|
|
730
|
+
* and whether the question needs decomposition; a "yes" splits it into at
|
|
731
|
+
* most five search queries with the configured decomposition model
|
|
732
|
+
* (default: the session model). On the local branch, Jev also judges, per
|
|
733
|
+
* registered datasource, whether it must be searched (in parallel with
|
|
734
|
+
* decomposition). Without Jev, and on any routing failure, this is today's
|
|
735
|
+
* single local search for the original question with no datasource search.
|
|
736
|
+
* A non-local branch that misses the confidence floor is not a failure: it
|
|
737
|
+
* becomes a full local plan, decomposition and datasource check included.
|
|
687
738
|
*/
|
|
688
739
|
private planQuery;
|
|
689
740
|
/**
|
|
690
741
|
* Jev datasource check for the local branch: one `noul` per configured
|
|
691
|
-
* datasource that has retrieval methods,
|
|
692
|
-
*
|
|
693
|
-
*
|
|
742
|
+
* datasource that has retrieval methods, plus the public web when its tools
|
|
743
|
+
* are enabled, with where similar past questions were answered (from
|
|
744
|
+
* retrieval memory) in the state. Returns the datasource ids and whether the
|
|
745
|
+
* web is to be searched with every query before the rerank; a failed check
|
|
746
|
+
* searches neither.
|
|
694
747
|
*/
|
|
695
748
|
private selectSearchDatasources;
|
|
696
749
|
/**
|
|
697
|
-
* Baseline local evidence for the fast answer. Jikji, MinSync,
|
|
698
|
-
* Jev-selected datasource
|
|
699
|
-
* itself queues per workspace), the
|
|
700
|
-
* deduplicated into one pool, and that
|
|
701
|
-
* original question.
|
|
750
|
+
* Baseline local evidence for the fast answer. Jikji, MinSync, every
|
|
751
|
+
* Jev-selected datasource, and (when Jev selected it) one web search run for
|
|
752
|
+
* every search query in parallel (MinSync itself queues per workspace), the
|
|
753
|
+
* per-query hits are interleaved and deduplicated into one pool, and that
|
|
754
|
+
* pool is reranked against the original question.
|
|
702
755
|
*/
|
|
703
756
|
private prefetchInitialRetrievalContext;
|
|
757
|
+
/**
|
|
758
|
+
* One web search for the baseline, on the same provider chain, ordering, and
|
|
759
|
+
* credentials as the `web_search` tool. Hits carry the URL as their source
|
|
760
|
+
* and the title plus snippet as their content, so they merge, rerank, and
|
|
761
|
+
* register like any other candidate. A failure contributes no evidence and
|
|
762
|
+
* is reported by the caller; a steer abort is the user stopping the search,
|
|
763
|
+
* not a failure.
|
|
764
|
+
*/
|
|
765
|
+
private prefetchWebSearch;
|
|
704
766
|
/**
|
|
705
767
|
* Rerank the pre-fast-answer baseline pool — Jikji answer paths, MinSync
|
|
706
|
-
* chunks,
|
|
707
|
-
* `rerank.topN`. With decomposition the pool merges every
|
|
708
|
-
* hits (interleaved), capped at the same per-source sizes as a
|
|
709
|
-
* so the rerank request does not grow with the query count.
|
|
710
|
-
* `undefined` when reranking is disabled or the pool is empty. A
|
|
711
|
-
* reranker that is unavailable, throws, or returns nothing for a
|
|
712
|
-
* pool throws, so the caller can report it and fall back.
|
|
768
|
+
* chunks, Jev-selected datasource chunks, and prefetched web hits — down to
|
|
769
|
+
* the configured `rerank.topN`. With decomposition the pool merges every
|
|
770
|
+
* search query's hits (interleaved), capped at the same per-source sizes as a
|
|
771
|
+
* single query so the rerank request does not grow with the query count.
|
|
772
|
+
* Returns `undefined` when reranking is disabled or the pool is empty. A
|
|
773
|
+
* configured reranker that is unavailable, throws, or returns nothing for a
|
|
774
|
+
* non-empty pool throws, so the caller can report it and fall back.
|
|
713
775
|
*/
|
|
714
776
|
private rerankPrefetchPool;
|
|
715
777
|
/**
|
|
@@ -718,10 +780,23 @@ export declare class AutoRAGAgent {
|
|
|
718
780
|
* continues on the retrieval-order fallback.
|
|
719
781
|
*/
|
|
720
782
|
private reportRerankFailure;
|
|
783
|
+
/**
|
|
784
|
+
* Sentence for the phase prompts that forbid tool calls: `ask_user` is not a search tool, and a request
|
|
785
|
+
* that hinges on a choice only the user can make must be asked, not guessed. Empty when the session does
|
|
786
|
+
* not offer the tool.
|
|
787
|
+
*/
|
|
788
|
+
private askUserException;
|
|
789
|
+
/**
|
|
790
|
+
* Fast-phase exception to the no-tools rule, naming only the web tools this
|
|
791
|
+
* session actually registered. Empty when web tools are off, so the prompt
|
|
792
|
+
* never mentions a tool the model does not have.
|
|
793
|
+
*/
|
|
794
|
+
private fastPhaseWebHint;
|
|
721
795
|
/**
|
|
722
796
|
* Fast-phase prompt for two-phase searches. The baseline retrieval context
|
|
723
797
|
* is already gathered, so the model answers immediately with minimal thinking,
|
|
724
|
-
* as plain text, without
|
|
798
|
+
* as plain text, without further retrieval; the web tools are the only
|
|
799
|
+
* exception, for public facts the baseline cannot settle.
|
|
725
800
|
*/
|
|
726
801
|
buildFastAnswerPrompt(query: string, options: RetrievalOptions, baseline: string): string;
|
|
727
802
|
/**
|
|
@@ -731,17 +806,45 @@ export declare class AutoRAGAgent {
|
|
|
731
806
|
*/
|
|
732
807
|
private isConversationTurn;
|
|
733
808
|
/**
|
|
734
|
-
* Prompt for a
|
|
735
|
-
*
|
|
736
|
-
*
|
|
809
|
+
* Prompt for a request Jev routed to `organize`: act on files and folders
|
|
810
|
+
* (move, rename, convert, sort). No route changes the active tools any more,
|
|
811
|
+
* so the prompt names the tools the task uses and the ones it must not, and
|
|
812
|
+
* carries the loaded organize skill with the rules. No retrieval ran and no
|
|
813
|
+
* verification follows; the model's plain final message is the answer.
|
|
814
|
+
*/
|
|
815
|
+
buildOrganizePrompt(query: string, skill: PackagedAgentSkill): string;
|
|
816
|
+
/**
|
|
817
|
+
* The tool-scope sentence of an `organize` turn: the tools the task uses and
|
|
818
|
+
* the content-retrieval and web tools it must not call. Every route keeps the
|
|
819
|
+
* whole tool set now, so the prompt is what scopes the turn; both lists name
|
|
820
|
+
* only tools this agent actually registered, so the prompt never points the
|
|
821
|
+
* model at a tool the session does not have.
|
|
822
|
+
*/
|
|
823
|
+
private organizeToolScope;
|
|
824
|
+
/**
|
|
825
|
+
* Prompt for a request Jev routed to `extra`: no branch had a confident
|
|
826
|
+
* non-local verdict, and handling it needs no search of the user's records
|
|
827
|
+
* first. Nothing was retrieved and nothing follows this turn — no fast
|
|
828
|
+
* answer, follow-up check, or verification — so the single tool-capable
|
|
829
|
+
* turn either answers the question or carries the task out. No tool is
|
|
830
|
+
* forbidden: the model looks facts up itself when they are not its own.
|
|
831
|
+
*/
|
|
832
|
+
buildExtraPrompt(query: string): string;
|
|
833
|
+
/**
|
|
834
|
+
* One tool-capable turn for an action route (`organize`, `extra`): the model
|
|
835
|
+
* carries the request out with the tools it has and reports through its plain
|
|
836
|
+
* final message. No retrieval, no fast answer, no verification — and no route
|
|
837
|
+
* changes the session's active tools, so the turn prompt is what scopes the
|
|
838
|
+
* work. Returns the report, or `undefined` when the user stopped the run or
|
|
839
|
+
* the turn ended without one.
|
|
737
840
|
*/
|
|
738
|
-
|
|
841
|
+
private runActionTurn;
|
|
739
842
|
/** Discovery-tool hint naming only the registered discovery tools; empty when none. */
|
|
740
843
|
private discoveryHint;
|
|
741
844
|
/**
|
|
742
|
-
* Verification-phase nudge toward the internet
|
|
743
|
-
*
|
|
744
|
-
* missing, thin, or possibly stale,
|
|
845
|
+
* Verification-phase nudge toward the internet, for when the web was not
|
|
846
|
+
* selected before the fast answer or its evidence fell short: when local
|
|
847
|
+
* evidence is missing, thin, or possibly stale, the agent searches the web. Empty when web tools are off.
|
|
745
848
|
*/
|
|
746
849
|
private webFallbackHint;
|
|
747
850
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CitationNumbers } from "./citation-numbers.js";
|
|
1
2
|
import { type EvidenceLedger } from "./evidence-ledger.js";
|
|
2
3
|
import type { AutoRAGResultsDetails } from "./results.js";
|
|
3
4
|
import type { SearchDocumentDiagnostic } from "./search-documents.js";
|
|
@@ -5,6 +6,31 @@ export interface DerivedAnswer {
|
|
|
5
6
|
readonly details: AutoRAGResultsDetails;
|
|
6
7
|
readonly diagnostics: readonly SearchDocumentDiagnostic[];
|
|
7
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Identity of one cited chunk: the source plus the recorded chunk text. A
|
|
11
|
+
* source can back several chunks, so a chunk is judged and excluded on its own.
|
|
12
|
+
*/
|
|
13
|
+
export declare function citedChunkKey(ref: {
|
|
14
|
+
readonly source: string;
|
|
15
|
+
readonly content?: string;
|
|
16
|
+
}): string;
|
|
17
|
+
/** One chunk the answer cites, with the sentences that cite it. */
|
|
18
|
+
export interface CitedChunk {
|
|
19
|
+
/** {@link citedChunkKey} of the chunk. */
|
|
20
|
+
readonly key: string;
|
|
21
|
+
readonly source: string;
|
|
22
|
+
readonly content: string;
|
|
23
|
+
/** Each distinct sentence ending in a marker that cites this chunk, in answer order. */
|
|
24
|
+
readonly sentences: readonly string[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Every chunk the answer cites, read from the raw markers. It resolves ids the
|
|
28
|
+
* way {@link deriveResultsFromAnswer} does but numbers nothing, so judging a
|
|
29
|
+
* citation never touches the conversation's result numbers.
|
|
30
|
+
*/
|
|
31
|
+
export declare function citedChunks(text: string, ledger: EvidenceLedger, options: {
|
|
32
|
+
readonly allowLocalFiles: boolean;
|
|
33
|
+
}): CitedChunk[];
|
|
8
34
|
/**
|
|
9
35
|
* Turn the model's plain answer into the structured results the rest of the
|
|
10
36
|
* harness consumes. The model cites with the evidence ids the retrieval tools
|
|
@@ -12,11 +38,17 @@ export interface DerivedAnswer {
|
|
|
12
38
|
* itself. Each id is resolved against the run's evidence ledger, so a source,
|
|
13
39
|
* method, and chunk always come from recorded evidence, never from model text.
|
|
14
40
|
*
|
|
15
|
-
* Results are one per cited source,
|
|
16
|
-
*
|
|
41
|
+
* Results are one per cited source, in order of first appearance in this answer. A source's
|
|
42
|
+
* number comes from the conversation's {@link CitationNumbers}: a source
|
|
43
|
+
* numbered in an earlier answer (or an earlier phase of this turn) keeps its
|
|
44
|
+
* number, a new source gets the next unused one, and every marker in the
|
|
45
|
+
* returned answer is rewritten to its result number (`[1]`).
|
|
17
46
|
* A marker that matches no evidence, and any numeric marker the model wrote on
|
|
18
47
|
* its own, is dropped and reported: it can never point at the wrong result.
|
|
19
48
|
*/
|
|
20
49
|
export declare function deriveResultsFromAnswer(text: string, ledger: EvidenceLedger, options: {
|
|
21
50
|
readonly allowLocalFiles: boolean;
|
|
51
|
+
readonly numbers: CitationNumbers;
|
|
52
|
+
/** Chunks ({@link citedChunkKey}) a relevance judgment rejected: a citation of only these is dropped silently. */
|
|
53
|
+
readonly excludedChunks?: ReadonlySet<string>;
|
|
22
54
|
}): DerivedAnswer;
|
|
@@ -31,13 +31,30 @@ export declare const ANSWER_EMPHASIS_RULE = "**Emphasis**: put the values a read
|
|
|
31
31
|
export declare const ANSWER_LANGUAGE_RULE = "**Answer language**: write the answer in the language of the user's question (a Korean question gets a Korean answer) even when the sources are in another language; if the user asks for a specific language, use that one. Keep proper nouns, identifiers, code, and terms quoted from sources in their original form.";
|
|
32
32
|
/** Uncertainty goes last so it never buries the conclusion. */
|
|
33
33
|
export declare const ANSWER_UNCERTAINTY_RULE = "**Uncertainty placement**: when the answer is incomplete or uncertain, state that in one short sentence on the last line of the answer, never before or ahead of the conclusion. Do not hedge the conclusion itself.";
|
|
34
|
+
/**
|
|
35
|
+
* Every sentence answers the question. Models that find nothing on point tend to
|
|
36
|
+
* prove the search was thorough by listing what they found instead and why it
|
|
37
|
+
* does not match; the caller never asked for that, so it is left out for every
|
|
38
|
+
* phase, delta included.
|
|
39
|
+
*/
|
|
40
|
+
export declare const ANSWER_RELEVANCE_RULE = "**Answer only what was asked**: every sentence must answer the user's question. Never list retrieved items, topics, documents, or figures that do not answer it, never describe how or where you searched, and never explain why something was left out or how it differs from what was asked (no \"I also found X, but it is not what you asked\", no near-miss lists, no \"nothing about Y, only Z\", no inventory of the sources that lacked it). Unrelated or merely adjacent material is omitted entirely unless the user asked for related items or alternatives.";
|
|
41
|
+
/**
|
|
42
|
+
* Fast phase, no supporting evidence: park the question in one line. The
|
|
43
|
+
* verification phase that follows keeps searching, so the line is true.
|
|
44
|
+
*/
|
|
45
|
+
export declare const ANSWER_UNCONFIRMED_FAST_RULE = "**When the evidence does not answer the question yet**: do not build an answer out of what was found instead, and do not argue that the answer is absent by naming what the sources did contain (no \"only X exists\" contrast). The whole answer is then one short line saying it is not confirmed yet and that you are searching further (the verification phase that follows does the searching), with no bullets and no citations. A different subject, place, year, or party is unrelated evidence, not part of the answer. If a part the user actually asked for is answered, answer that part normally and say on the last line what is still being searched.";
|
|
46
|
+
/**
|
|
47
|
+
* Phases that can end the run: search before giving up, and when the search
|
|
48
|
+
* still finds nothing the answer is one line, not an inventory of the corpus.
|
|
49
|
+
*/
|
|
50
|
+
export declare const ANSWER_UNCONFIRMED_FINAL_RULE = "**When the answer cannot be found**: keep searching first (different terms, synonyms, other retrieval methods or datasources) instead of answering from unrelated results. If it still cannot be confirmed, the whole answer is one short line saying so, with no bullets, no citations, no mention of what was found instead (no \"only X exists\" contrast), and no account of where you looked or what the documents do contain. A different subject, place, year, or party is unrelated evidence, not part of the answer. If a part the user actually asked for is answered, answer that part normally and say on the last line what is still unconfirmed.";
|
|
34
51
|
/**
|
|
35
52
|
* Inline evidence citations. The model writes the id the retrieval tools print
|
|
36
53
|
* next to each result; the harness resolves it to the recorded source and
|
|
37
|
-
* renumbers the markers `[1]`, `[2]`, ...
|
|
38
|
-
* caller only ever sees numbered citations backed by recorded evidence.
|
|
54
|
+
* renumbers the markers `[1]`, `[2]`, ... (a source keeps its number for the whole
|
|
55
|
+
* conversation), so the caller only ever sees numbered citations backed by recorded evidence.
|
|
39
56
|
*/
|
|
40
|
-
export declare const ANSWER_CITATION_RULE = "**Citations**: cite supporting evidence inline with the evidence id shown next to each retrieved result, in square brackets (e.g. [e3], or [e3][e7] for two). Copy ids exactly; never invent one. For a local file you opened yourself with `bash`, cite `[file:<absolute path>]`. Cite the evidence that backs a sentence at the end of that sentence. Do not cite numbers, paths, or anything else.";
|
|
57
|
+
export declare const ANSWER_CITATION_RULE = "**Citations**: cite supporting evidence inline with the evidence id shown next to each retrieved result, in square brackets (e.g. [e3], or [e3][e7] for two). Copy ids exactly; never invent one. For a local file you opened yourself with `bash`, cite `[file:<absolute path>]`. Cite the evidence that backs a sentence at the end of that sentence. Do not cite numbers, paths, or anything else. A retrieved result may carry a measured location note such as `(lines 7-8, section \"\uC81C5\uC870(\uD68C\uC6D0\uC758 \uC758\uBB34)\")` next to its id: when you state a line number, line range, or article/section of a passage, copy it from that note, and when no note is printed give none. Never count or infer line numbers yourself, and never state how many items (paragraphs, articles, results) there are unless you counted them in the quoted text.";
|
|
41
58
|
/**
|
|
42
59
|
* Deliverable/artifact rule (issue #1832). The 5-bullet cap and direct-answer
|
|
43
60
|
* format remain the default unless the user explicitly asks otherwise; when the
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Tool the `pi-ask-user` extension registers; pi's allow-list must name it to keep it active. */
|
|
2
|
+
export declare const ASK_USER_TOOL_NAME = "ask_user";
|
|
3
|
+
/**
|
|
4
|
+
* Entry file of the community `pi-ask-user` extension (the most-installed pi package for this: Claude
|
|
5
|
+
* Code's AskUserQuestion, with a searchable single/multi-select sheet, freeform answers, and 2-4 question
|
|
6
|
+
* batches). It ships TypeScript source and no `main`, so pi's own extension loader runs it from this path.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveAskUserExtensionPath(): string;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { AgentTool } from "@earendil-works/pi-agent-core";
|
|
2
|
+
import { Type } from "typebox";
|
|
3
|
+
import type { AutomationRunRecord } from "../automation/run.js";
|
|
4
|
+
import { type ServiceCommandExec } from "../automation/service.js";
|
|
5
|
+
export declare const MANAGE_AUTOMATIONS_TOOL_NAME = "manage_automations";
|
|
6
|
+
declare const manageAutomationsSchema: Type.TObject<{
|
|
7
|
+
action: Type.TUnion<[Type.TLiteral<"list">, Type.TLiteral<"save">, Type.TLiteral<"delete">, Type.TLiteral<"run">, Type.TLiteral<"install_service">, Type.TLiteral<"uninstall_service">]>;
|
|
8
|
+
id: Type.TOptional<Type.TString>;
|
|
9
|
+
automation: Type.TOptional<Type.TObject<{
|
|
10
|
+
paths: Type.TArray<Type.TString>;
|
|
11
|
+
events: Type.TOptional<Type.TArray<Type.TUnion<[Type.TLiteral<"create">, Type.TLiteral<"update">, Type.TLiteral<"delete">]>>>;
|
|
12
|
+
include: Type.TOptional<Type.TArray<Type.TString>>;
|
|
13
|
+
exclude: Type.TOptional<Type.TArray<Type.TString>>;
|
|
14
|
+
run: Type.TOptional<Type.TArray<Type.TString>>;
|
|
15
|
+
agent: Type.TOptional<Type.TObject<{
|
|
16
|
+
profile: Type.TString;
|
|
17
|
+
task: Type.TString;
|
|
18
|
+
retrieval: Type.TOptional<Type.TObject<{
|
|
19
|
+
searchAll: Type.TOptional<Type.TBoolean>;
|
|
20
|
+
datasources: Type.TOptional<Type.TArray<Type.TString>>;
|
|
21
|
+
}>>;
|
|
22
|
+
}>>;
|
|
23
|
+
appendFiles: Type.TOptional<Type.TBoolean>;
|
|
24
|
+
debounceMs: Type.TOptional<Type.TInteger>;
|
|
25
|
+
timeoutMs: Type.TOptional<Type.TInteger>;
|
|
26
|
+
}>>;
|
|
27
|
+
events: Type.TOptional<Type.TArray<Type.TObject<{
|
|
28
|
+
type: Type.TUnion<[Type.TLiteral<"create">, Type.TLiteral<"update">, Type.TLiteral<"delete">]>;
|
|
29
|
+
path: Type.TString;
|
|
30
|
+
}>>>;
|
|
31
|
+
}>;
|
|
32
|
+
export interface ManageAutomationsToolOptions {
|
|
33
|
+
readonly home?: string;
|
|
34
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
35
|
+
readonly platform?: NodeJS.Platform;
|
|
36
|
+
readonly exec?: ServiceCommandExec;
|
|
37
|
+
readonly waitForRunningMs?: number;
|
|
38
|
+
}
|
|
39
|
+
export interface ManageAutomationsDetails {
|
|
40
|
+
readonly action: string;
|
|
41
|
+
readonly id?: string;
|
|
42
|
+
readonly run?: AutomationRunRecord;
|
|
43
|
+
}
|
|
44
|
+
export declare function createManageAutomationsTool(options?: ManageAutomationsToolOptions): AgentTool<typeof manageAutomationsSchema, ManageAutomationsDetails>;
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ExtensionFactory } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { type EvidenceLedger } from "./evidence-ledger.js";
|
|
3
|
+
/** `file://` URL of an absolute local path, an http(s) URL as is, otherwise undefined (a datasource id, a message id). */
|
|
4
|
+
export declare function openableTarget(source: string): string | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* Rewrite the citation markers of an assistant answer into Markdown links, so
|
|
7
|
+
* pi renders them as terminal hyperlinks that open the cited file or page.
|
|
8
|
+
*
|
|
9
|
+
* `[e3]` and `[e3, e7]` keep their brackets and ids; each id that resolves to
|
|
10
|
+
* an openable source becomes a link. `[file:/abs/path]` becomes `[<file name>]`
|
|
11
|
+
* linked to that file. Markers that resolve to nothing openable stay as the
|
|
12
|
+
* model wrote them.
|
|
13
|
+
*
|
|
14
|
+
* `sourceOf` maps an evidence id to its recorded source; `isFile` says whether
|
|
15
|
+
* a `[file:...]` path is a real local file.
|
|
16
|
+
*/
|
|
17
|
+
export declare function linkCitations(markdown: string, sourceOf: (id: string) => string | undefined, isFile: (path: string) => boolean): string;
|
|
18
|
+
/**
|
|
19
|
+
* pi extension that makes the citations in the interactive transcript
|
|
20
|
+
* clickable. The model cites by evidence id; the ledger recorded the source
|
|
21
|
+
* each id names, so the link target is never model-written text.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createCitationLinks(ledger: EvidenceLedger): ExtensionFactory;
|