@autorag/librarian 2.6.0 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,6 +9,9 @@ import type { ResultFeedback } from "../memory/memory.js";
9
9
  import { type MinSyncSyncResult, type MinSyncVectorMethodOptions } from "../minsync/index.js";
10
10
  import { type ParsedMirrorSyncResult } from "../mirror/sync.js";
11
11
  import type { PolicyResolver } from "../p2p/policy-filter.js";
12
+ import type { SimplexQueryState } from "../p2p/simplex-query-store.js";
13
+ import { type SimplexTransport } from "../p2p/simplex-transport.js";
14
+ import type { PeerQueryResponse } from "../p2p/wire.js";
12
15
  import { type DefaultParserRegistryOptions } from "../parser/index.js";
13
16
  import { RetrievalEngine } from "../retrieval/engine.js";
14
17
  import { RetrievalMethodRegistry } from "../retrieval/registry.js";
@@ -118,6 +121,12 @@ export interface AutoRAGThinkingOptions {
118
121
  /** Thinking level for the verification/finalization phase. Default "high". */
119
122
  readonly final?: AutoRAGThinkingLevel;
120
123
  }
124
+ export interface PeerQueryOptions {
125
+ readonly port?: number;
126
+ readonly simplexDbPrefix?: string;
127
+ readonly openTransport?: () => Promise<SimplexTransport>;
128
+ readonly onResponse?: (state: SimplexQueryState, response: PeerQueryResponse) => void;
129
+ }
121
130
  export interface AutoRAGAgentOptions {
122
131
  model?: Model<Api>;
123
132
  apiKey?: string;
@@ -157,6 +166,11 @@ export interface AutoRAGAgentOptions {
157
166
  searchTimeoutMs?: number;
158
167
  /** Maximum number of retrieval/tool executions allowed in one search. */
159
168
  maxSearchToolCalls?: number;
169
+ /**
170
+ * Outbound SimpleX queries to trusted peer AutoRAG agents. Remote sessions
171
+ * never receive this tool.
172
+ */
173
+ peerQuery?: PeerQueryOptions | false;
160
174
  /** Restrict the agent to retrieval and result-emission tools for remote runs. */
161
175
  remoteSession?: boolean;
162
176
  /** Two-phase progressive answers with per-phase thinking control. Default enabled. */
@@ -1,10 +1,11 @@
1
- export type { AutoRAGAgentOptions, AutoRefreshOptions } from "./agent.js";
1
+ export type { AutoRAGAgentOptions, AutoRefreshOptions, PeerQueryOptions } from "./agent.js";
2
2
  export { AutoRAGAgent } from "./agent.js";
3
3
  export { buildDatasourceSkillsPrompt, createLoadDatasourceSkillTool, type DatasourceSkillProvider, datasourceSkillLocation, formatDatasourceSkillInvocation, LOAD_DATASOURCE_SKILL_TOOL_NAME, type LoadDatasourceSkillDetails, toDatasourceAgentSkill, } from "./datasource-skill.js";
4
4
  export { createScanDuplicateDocumentsTool, SCAN_DUPLICATE_DOCUMENTS_TOOL_NAME, type ScanDuplicateDocumentsDetails, type ScanDuplicateDocumentsProvider, } from "./dupey-tool.js";
5
5
  export type { AutoRAGEmittedResult, AutoRAGMappingEntry, AutoRAGResultsDetails, } from "./emit-results-tool.js";
6
6
  export { createEmitResultsTool, EMIT_AUTORAG_RESULTS_TOOL_NAME, emitResultsSchema, } from "./emit-results-tool.js";
7
7
  export { createJikjiFindTool, JIKJI_FIND_TOOL_NAME, type JikjiFindDetails, type JikjiFindPerRootPolicy, type JikjiFindProvider, type JikjiFindProviderResult, type MergedJikjiPolicy, } from "./jikji-find-tool.js";
8
+ export { createQueryPeerAgentTool, QUERY_PEER_AGENT_TOOL_NAME, type QueryPeerAgentDetails, type QueryPeerAgentResult, type QueryPeerAgentToolOptions, } from "./query-peer-tool.js";
8
9
  export { createSearchAllDocumentsTool, SEARCH_ALL_DOCUMENTS_TOOL_NAME, type SearchAllDocumentsDetails, type SearchAllDocumentsProvider, type SearchAllDocumentsResult, } from "./search-all-tool.js";
9
10
  export type { SearchDocumentDiagnostic, SearchDocumentDiagnosticCode, SearchDocumentDiagnosticSeverity, SearchDocumentEvidence, SearchDocumentResult, SearchDocumentsResponse, SearchDocumentsStreamEvent, SearchDocumentWarning, } from "./search-documents.js";
10
11
  export { createSearchMinSyncDocumentsTool, SEARCH_MINSYNC_DOCUMENTS_TOOL_NAME, type SearchMinSyncDocumentsDetails, } from "./search-minsync-tool.js";
@@ -0,0 +1,48 @@
1
+ import type { AgentTool } from "@earendil-works/pi-agent-core";
2
+ import { Type } from "typebox";
3
+ import { type SimplexQueryState } from "../p2p/simplex-query-store.js";
4
+ import type { SimplexTransport } from "../p2p/simplex-transport.js";
5
+ import type { PeerQueryResponse } from "../p2p/wire.js";
6
+ export declare const QUERY_PEER_AGENT_TOOL_NAME = "query_peer_agent";
7
+ declare const queryPeerAgentSchema: Type.TObject<{
8
+ alias: Type.TString;
9
+ query: Type.TString;
10
+ topK: Type.TOptional<Type.TInteger>;
11
+ scope: Type.TOptional<Type.TString>;
12
+ }>;
13
+ export interface QueryPeerAgentResult {
14
+ readonly number: number;
15
+ readonly title: string;
16
+ readonly summary: string;
17
+ readonly source: string;
18
+ readonly excerpt: string;
19
+ }
20
+ export interface QueryPeerAgentDetails {
21
+ readonly method: "query_peer_agent";
22
+ readonly ok: boolean;
23
+ readonly alias: string;
24
+ readonly contactId?: number;
25
+ readonly pendingId?: string;
26
+ readonly expiresAt?: string;
27
+ readonly status?: "ok" | "rejected" | "pending";
28
+ readonly answer?: string;
29
+ readonly results?: readonly QueryPeerAgentResult[];
30
+ readonly diagnostics?: PeerQueryResponse["diagnostics"];
31
+ readonly fileCount?: number;
32
+ readonly message?: string;
33
+ }
34
+ export interface QueryPeerAgentToolOptions {
35
+ readonly workspacePath: string;
36
+ readonly openTransport: () => Promise<SimplexTransport>;
37
+ readonly fastTimeoutMs?: number;
38
+ readonly autoStart?: boolean;
39
+ readonly sessionId?: () => string | undefined;
40
+ readonly onResponse?: (state: SimplexQueryState, response: PeerQueryResponse) => void;
41
+ readonly onExpired?: (state: SimplexQueryState) => void;
42
+ }
43
+ export interface QueryPeerAgentTool extends AgentTool<typeof queryPeerAgentSchema, QueryPeerAgentDetails> {
44
+ readonly ready: Promise<void>;
45
+ close(): Promise<void>;
46
+ }
47
+ export declare function createQueryPeerAgentTool(options: QueryPeerAgentToolOptions): QueryPeerAgentTool;
48
+ export {};