@autorag/librarian 2.1.0 → 2.3.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/README.md +155 -55
- package/dist/agent/agent.d.ts +27 -41
- package/dist/agent/bash-tool.d.ts +0 -11
- package/dist/agent/dupey-tool.d.ts +15 -0
- package/dist/agent/emit-results-tool.d.ts +14 -0
- package/dist/agent/index.d.ts +1 -0
- package/dist/agent/local-model.d.ts +12 -0
- package/dist/agent/search-bm25-tool.d.ts +1 -1
- package/dist/agent/search-documents.d.ts +1 -1
- package/dist/agent/search-minsync-tool.d.ts +1 -1
- package/dist/agent/system-prompt.d.ts +1 -2
- package/dist/cli/commands/duplicates.d.ts +4 -0
- package/dist/cli/commands/health.d.ts +9 -65
- package/dist/cli/commands/init.d.ts +1 -1
- package/dist/cli/commands/search.d.ts +2 -2
- package/dist/cli/config.d.ts +10 -14
- package/dist/cli/index.js +10652 -9947
- package/dist/datasource/aliased-skill.d.ts +28 -0
- package/dist/datasource/chunk-store.d.ts +2 -0
- package/dist/datasource/connector-skill.d.ts +4 -1
- package/dist/datasource/connector.d.ts +5 -1
- package/dist/datasource/crawler-client.d.ts +9 -0
- package/dist/datasource/crawler-skill.d.ts +47 -0
- package/dist/datasource/crawler-types.d.ts +53 -0
- package/dist/datasource/index.d.ts +8 -4
- package/dist/datasource/skills/cloud-drive/index.d.ts +1 -0
- package/dist/datasource/skills/cloud-drive/skill.d.ts +14 -0
- package/dist/datasource/skills/discrawl/client.d.ts +23 -0
- package/dist/datasource/skills/discrawl/config.d.ts +9 -0
- package/dist/datasource/skills/discrawl/index.d.ts +5 -0
- package/dist/datasource/skills/discrawl/methods.d.ts +55 -0
- package/dist/datasource/skills/discrawl/paths.d.ts +30 -0
- package/dist/datasource/skills/discrawl/skill.d.ts +61 -0
- package/dist/datasource/skills/discrawl/types.d.ts +198 -0
- package/dist/datasource/skills/factory.d.ts +7 -0
- package/dist/datasource/skills/gdrive/rclone-connector.d.ts +16 -24
- package/dist/datasource/skills/notion/index.d.ts +15 -2
- package/dist/datasource/skills/obsidian/client.d.ts +15 -0
- package/dist/datasource/skills/obsidian/index.d.ts +6 -2
- package/dist/datasource/skills/obsidian/methods.d.ts +26 -0
- package/dist/datasource/skills/obsidian/paths.d.ts +27 -0
- package/dist/datasource/skills/obsidian/skill.d.ts +41 -17
- package/dist/datasource/skills/obsidian/types.d.ts +90 -0
- package/dist/datasource/skills/slack/index.d.ts +15 -2
- package/dist/datasource/skills/telecrawl/index.d.ts +15 -0
- package/dist/datasource/skills/wacrawl/index.d.ts +15 -0
- package/dist/dupey/cli.d.ts +40 -0
- package/dist/dupey/filter.d.ts +8 -0
- package/dist/dupey/index.d.ts +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7774 -7409
- package/dist/memory/check-memory-tool.d.ts +1 -0
- package/dist/memory/index.d.ts +2 -2
- package/dist/memory/memory.d.ts +33 -3
- package/dist/memory/renderer.d.ts +2 -1
- package/dist/mirror/sync.d.ts +3 -1
- package/dist/observability/run-log.d.ts +1 -26
- package/dist/process/portable-spawn.d.ts +10 -0
- package/dist/retrieval/merger.d.ts +1 -0
- package/dist/retrieval/scope.d.ts +10 -0
- package/package.json +21 -20
- package/skills/autorag/SKILL.md +59 -96
- package/skills/autorag-setup/SKILL.md +144 -378
- package/dist/datasource/skills/discord/connector.d.ts +0 -30
- package/dist/datasource/skills/discord/index.d.ts +0 -2
- package/dist/datasource/skills/discord/skill.d.ts +0 -20
- package/dist/datasource/skills/notion/connector.d.ts +0 -26
- package/dist/datasource/skills/notion/skill.d.ts +0 -20
- package/dist/datasource/skills/obsidian/connector.d.ts +0 -22
- package/dist/datasource/skills/slack/connector.d.ts +0 -28
- package/dist/datasource/skills/slack/skill.d.ts +0 -20
- package/dist/subagents/contracts.d.ts +0 -90
- package/dist/subagents/dispatch-templates.d.ts +0 -104
- package/dist/subagents/dispatch-validation.d.ts +0 -169
- package/dist/subagents/explorer-tools-extension.d.ts +0 -4
- package/dist/subagents/explorer-tools-extension.js +0 -130
- package/dist/subagents/local-models.d.ts +0 -14
- package/dist/subagents/model-policy.d.ts +0 -31
- package/dist/subagents/runtime.d.ts +0 -52
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Discord guild datasource skill (issue #1305).
|
|
3
|
-
*
|
|
4
|
-
* Thin composition of DiscordConnector with the shared
|
|
5
|
-
* {@link ConnectorDatasourceSkill} base: descriptor, polling metadata,
|
|
6
|
-
* ok/fail indexing with path/PII-opaque diagnostics, lexical retrieval via
|
|
7
|
-
* the shared pipeline, opaque `/discord/<instance>/…` sources, and a
|
|
8
|
-
* progressive-disclosure agent-skill manifest.
|
|
9
|
-
*/
|
|
10
|
-
import { ConnectorDatasourceSkill, type ConnectorSkillDefinition, type ConnectorSkillOptions } from "../../connector-skill.js";
|
|
11
|
-
import { DiscordConnector, type DiscordConnectorOptions } from "./connector.js";
|
|
12
|
-
export declare const DISCORD_SKILL_DEFINITION: ConnectorSkillDefinition;
|
|
13
|
-
export interface DiscordSkillOptions extends Omit<ConnectorSkillOptions, "connector"> {
|
|
14
|
-
/** Trusted connector configuration; a pre-built connector wins. */
|
|
15
|
-
readonly connector?: DiscordConnector;
|
|
16
|
-
readonly connectorOptions?: DiscordConnectorOptions;
|
|
17
|
-
}
|
|
18
|
-
export declare class DiscordSkill extends ConnectorDatasourceSkill {
|
|
19
|
-
constructor(options?: DiscordSkillOptions);
|
|
20
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Notion workspace connector (issue #1302).
|
|
3
|
-
*
|
|
4
|
-
* Enumerates pages/databases via the Notion search API using a trusted,
|
|
5
|
-
* server-configured integration token, then pulls one page of block children
|
|
6
|
-
* per page for text content. Per-page block failures degrade to warnings.
|
|
7
|
-
* Never throws; messages stay path/PII-opaque.
|
|
8
|
-
*/
|
|
9
|
-
import type { ConnectorFetchResult, DatasourceConnector } from "../../connector.js";
|
|
10
|
-
export interface NotionConnectorOptions {
|
|
11
|
-
/** Notion REST base; override to point at a mock server in tests. */
|
|
12
|
-
readonly baseUrl?: string;
|
|
13
|
-
/** Integration token; explicit value wins over {@link tokenEnv}. */
|
|
14
|
-
readonly token?: string;
|
|
15
|
-
/** Env var name holding the integration token. Default `NOTION_TOKEN`. */
|
|
16
|
-
readonly tokenEnv?: string;
|
|
17
|
-
readonly timeoutMs?: number;
|
|
18
|
-
readonly fetchImpl?: typeof fetch;
|
|
19
|
-
readonly maxPages?: number;
|
|
20
|
-
readonly maxDocuments?: number;
|
|
21
|
-
}
|
|
22
|
-
export declare class NotionConnector implements DatasourceConnector {
|
|
23
|
-
private readonly options;
|
|
24
|
-
constructor(options?: NotionConnectorOptions);
|
|
25
|
-
fetch(signal?: AbortSignal): Promise<ConnectorFetchResult>;
|
|
26
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Notion workspace datasource skill (issue #1302).
|
|
3
|
-
*
|
|
4
|
-
* Thin composition of NotionConnector with the shared
|
|
5
|
-
* {@link ConnectorDatasourceSkill} base: descriptor, polling metadata,
|
|
6
|
-
* ok/fail indexing with path/PII-opaque diagnostics, lexical retrieval via
|
|
7
|
-
* the shared pipeline, opaque `/notion/<instance>/…` sources, and a
|
|
8
|
-
* progressive-disclosure agent-skill manifest.
|
|
9
|
-
*/
|
|
10
|
-
import { ConnectorDatasourceSkill, type ConnectorSkillDefinition, type ConnectorSkillOptions } from "../../connector-skill.js";
|
|
11
|
-
import { NotionConnector, type NotionConnectorOptions } from "./connector.js";
|
|
12
|
-
export declare const NOTION_SKILL_DEFINITION: ConnectorSkillDefinition;
|
|
13
|
-
export interface NotionSkillOptions extends Omit<ConnectorSkillOptions, "connector"> {
|
|
14
|
-
/** Trusted connector configuration; a pre-built connector wins. */
|
|
15
|
-
readonly connector?: NotionConnector;
|
|
16
|
-
readonly connectorOptions?: NotionConnectorOptions;
|
|
17
|
-
}
|
|
18
|
-
export declare class NotionSkill extends ConnectorDatasourceSkill {
|
|
19
|
-
constructor(options?: NotionSkillOptions);
|
|
20
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Obsidian vault connector (issue #1314).
|
|
3
|
-
*
|
|
4
|
-
* Walks a trusted, server-configured vault directory for markdown notes,
|
|
5
|
-
* extracting frontmatter/inline tags, wiki links, and embeds. No network
|
|
6
|
-
* access. Per-file read failures aggregate into a count-only warning;
|
|
7
|
-
* absolute paths never appear in warnings (vault-relative segments are the
|
|
8
|
-
* vault's own logical hierarchy and are allowed in doc ids).
|
|
9
|
-
*/
|
|
10
|
-
import type { ConnectorFetchResult, DatasourceConnector } from "../../connector.js";
|
|
11
|
-
export interface ObsidianConnectorOptions {
|
|
12
|
-
/** Absolute path to the vault root. Required trusted configuration. */
|
|
13
|
-
readonly vaultPath?: string;
|
|
14
|
-
readonly maxDocuments?: number;
|
|
15
|
-
/** Files larger than this are skipped. Default 2 MiB. */
|
|
16
|
-
readonly maxBytesPerFile?: number;
|
|
17
|
-
}
|
|
18
|
-
export declare class ObsidianConnector implements DatasourceConnector {
|
|
19
|
-
private readonly options;
|
|
20
|
-
constructor(options?: ObsidianConnectorOptions);
|
|
21
|
-
fetch(): Promise<ConnectorFetchResult>;
|
|
22
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Slack workspace connector (issue #1300).
|
|
3
|
-
*
|
|
4
|
-
* Fetches channel history through the Slack Web API using a trusted,
|
|
5
|
-
* server-configured bot token. Never throws; failures map onto the coarse
|
|
6
|
-
* connector failure union with path/PII-opaque messages. Per-channel
|
|
7
|
-
* failures degrade to warnings so one denied channel cannot fail the fetch.
|
|
8
|
-
*/
|
|
9
|
-
import type { ConnectorFetchResult, DatasourceConnector } from "../../connector.js";
|
|
10
|
-
export interface SlackConnectorOptions {
|
|
11
|
-
/** Slack Web API base; override to point at a mock server in tests. */
|
|
12
|
-
readonly baseUrl?: string;
|
|
13
|
-
/** Bot token; explicit value wins over {@link tokenEnv}. */
|
|
14
|
-
readonly token?: string;
|
|
15
|
-
/** Env var name holding the bot token. Default `SLACK_BOT_TOKEN`. */
|
|
16
|
-
readonly tokenEnv?: string;
|
|
17
|
-
/** Restrict indexing to these channel names or ids. */
|
|
18
|
-
readonly channels?: readonly string[];
|
|
19
|
-
readonly timeoutMs?: number;
|
|
20
|
-
readonly fetchImpl?: typeof fetch;
|
|
21
|
-
readonly maxPages?: number;
|
|
22
|
-
readonly maxDocuments?: number;
|
|
23
|
-
}
|
|
24
|
-
export declare class SlackConnector implements DatasourceConnector {
|
|
25
|
-
private readonly options;
|
|
26
|
-
constructor(options?: SlackConnectorOptions);
|
|
27
|
-
fetch(signal?: AbortSignal): Promise<ConnectorFetchResult>;
|
|
28
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Slack workspace datasource skill (issue #1300).
|
|
3
|
-
*
|
|
4
|
-
* Thin composition of SlackConnector with the shared
|
|
5
|
-
* {@link ConnectorDatasourceSkill} base: descriptor, polling metadata,
|
|
6
|
-
* ok/fail indexing with path/PII-opaque diagnostics, lexical retrieval via
|
|
7
|
-
* the shared pipeline, opaque `/slack/<instance>/…` sources, and a
|
|
8
|
-
* progressive-disclosure agent-skill manifest.
|
|
9
|
-
*/
|
|
10
|
-
import { ConnectorDatasourceSkill, type ConnectorSkillDefinition, type ConnectorSkillOptions } from "../../connector-skill.js";
|
|
11
|
-
import { SlackConnector, type SlackConnectorOptions } from "./connector.js";
|
|
12
|
-
export declare const SLACK_SKILL_DEFINITION: ConnectorSkillDefinition;
|
|
13
|
-
export interface SlackSkillOptions extends Omit<ConnectorSkillOptions, "connector"> {
|
|
14
|
-
/** Trusted connector configuration; a pre-built connector wins. */
|
|
15
|
-
readonly connector?: SlackConnector;
|
|
16
|
-
readonly connectorOptions?: SlackConnectorOptions;
|
|
17
|
-
}
|
|
18
|
-
export declare class SlackSkill extends ConnectorDatasourceSkill {
|
|
19
|
-
constructor(options?: SlackSkillOptions);
|
|
20
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
export declare const RETRIEVAL_METHODS: readonly ["posix", "bash", "posix/bash", "bm25", "minsync", "vector", "minsync/vector", "datasource"];
|
|
2
|
-
export type RetrievalMethod = (typeof RETRIEVAL_METHODS)[number];
|
|
3
|
-
export type SourceTemporalStatus = "asOf" | "updatedAt" | "createdAt" | "unknown";
|
|
4
|
-
export type SourceTemporal = {
|
|
5
|
-
readonly status: "asOf";
|
|
6
|
-
readonly asOf: string;
|
|
7
|
-
} | {
|
|
8
|
-
readonly status: "updatedAt";
|
|
9
|
-
readonly updatedAt: string;
|
|
10
|
-
} | {
|
|
11
|
-
readonly status: "createdAt";
|
|
12
|
-
readonly createdAt: string;
|
|
13
|
-
} | {
|
|
14
|
-
readonly status: "unknown";
|
|
15
|
-
};
|
|
16
|
-
export interface ExplorerAssignment {
|
|
17
|
-
readonly originalQuery: string;
|
|
18
|
-
readonly method: RetrievalMethod;
|
|
19
|
-
readonly queryVariant: string;
|
|
20
|
-
/** Optional set of variants retained when an orchestrator fans out work. */
|
|
21
|
-
readonly queryVariants?: readonly string[];
|
|
22
|
-
}
|
|
23
|
-
export interface EvidenceCandidate {
|
|
24
|
-
readonly source: string;
|
|
25
|
-
readonly method: RetrievalMethod;
|
|
26
|
-
readonly evidence: string;
|
|
27
|
-
readonly retrievedAt: string;
|
|
28
|
-
readonly sourceTemporal: SourceTemporal;
|
|
29
|
-
readonly locator?: string;
|
|
30
|
-
}
|
|
31
|
-
export interface ExplorerReport {
|
|
32
|
-
readonly assignment: ExplorerAssignment;
|
|
33
|
-
readonly evidenceCandidates: readonly EvidenceCandidate[];
|
|
34
|
-
/** Alias for consumers that use the shorter candidate field name. */
|
|
35
|
-
readonly candidates?: readonly EvidenceCandidate[];
|
|
36
|
-
readonly summary?: string;
|
|
37
|
-
}
|
|
38
|
-
export interface FollowUpRequest {
|
|
39
|
-
readonly reason: string;
|
|
40
|
-
readonly assignments: readonly ExplorerAssignment[];
|
|
41
|
-
}
|
|
42
|
-
export type JudgeDecision = {
|
|
43
|
-
readonly decision: "sufficient";
|
|
44
|
-
readonly rationale: string;
|
|
45
|
-
readonly followUp?: undefined;
|
|
46
|
-
} | {
|
|
47
|
-
readonly decision: "follow_up";
|
|
48
|
-
readonly rationale: string;
|
|
49
|
-
readonly followUp: FollowUpRequest;
|
|
50
|
-
};
|
|
51
|
-
export interface ExhaustionErrorDetails {
|
|
52
|
-
readonly code: "EXPLORER_EXHAUSTED";
|
|
53
|
-
readonly originalQuery: string;
|
|
54
|
-
readonly iterations: number;
|
|
55
|
-
readonly maxIterations: number;
|
|
56
|
-
readonly reason: string;
|
|
57
|
-
}
|
|
58
|
-
export type ContractErrorCode = "INVALID_OBJECT" | "MISSING_ORIGINAL_QUERY" | "INVALID_ORIGINAL_QUERY" | "MISSING_RETRIEVAL_METHOD" | "INVALID_RETRIEVAL_METHOD" | "MISSING_QUERY_VARIANT" | "INVALID_QUERY_VARIANT" | "INVALID_QUERY_VARIANTS" | "QUERY_VARIANT_NOT_INCLUDED" | "MISSING_SOURCE" | "INVALID_SOURCE" | "MISSING_EVIDENCE_METHOD" | "INVALID_EVIDENCE_METHOD" | "MISSING_EVIDENCE" | "INVALID_EVIDENCE" | "MISSING_RETRIEVED_AT" | "INVALID_RETRIEVED_AT" | "MISSING_SOURCE_TEMPORAL" | "INVALID_SOURCE_TEMPORAL" | "MISSING_SOURCE_TEMPORAL_DATE" | "INVALID_SOURCE_TEMPORAL_DATE" | "MISSING_ASSIGNMENT" | "MISSING_EVIDENCE_CANDIDATES" | "INVALID_EVIDENCE_CANDIDATES" | "INVALID_SUMMARY" | "MISSING_FOLLOW_UP_REASON" | "INVALID_FOLLOW_UP_REASON" | "MISSING_FOLLOW_UP_ASSIGNMENTS" | "EMPTY_FOLLOW_UP_ASSIGNMENTS" | "INVALID_FOLLOW_UP_ASSIGNMENTS" | "MISSING_JUDGE_DECISION" | "INVALID_JUDGE_DECISION" | "MISSING_JUDGE_RATIONALE" | "INVALID_JUDGE_RATIONALE" | "MISSING_FOLLOW_UP" | "INVALID_FOLLOW_UP" | "INVALID_EXHAUSTION_ERROR" | "INVALID_EXHAUSTION_CODE" | "MISSING_EXHAUSTION_QUERY" | "INVALID_EXHAUSTION_QUERY" | "INVALID_EXHAUSTION_ITERATIONS" | "INVALID_EXHAUSTION_LIMIT" | "MISSING_EXHAUSTION_REASON" | "INVALID_EXHAUSTION_REASON";
|
|
59
|
-
export declare class ContractValidationError extends Error {
|
|
60
|
-
readonly code: ContractErrorCode;
|
|
61
|
-
readonly path?: string;
|
|
62
|
-
constructor(code: ContractErrorCode, message: string, path?: string);
|
|
63
|
-
}
|
|
64
|
-
export declare class ExplorerExhaustionError extends Error {
|
|
65
|
-
readonly code: "EXPLORER_EXHAUSTED";
|
|
66
|
-
readonly originalQuery: string;
|
|
67
|
-
readonly iterations: number;
|
|
68
|
-
readonly maxIterations: number;
|
|
69
|
-
readonly reason: string;
|
|
70
|
-
constructor(details: Omit<ExhaustionErrorDetails, "code">);
|
|
71
|
-
toJSON(): ExhaustionErrorDetails;
|
|
72
|
-
}
|
|
73
|
-
export declare function parseExplorerAssignment(value: unknown): ExplorerAssignment;
|
|
74
|
-
export declare function parseEvidenceCandidate(value: unknown): EvidenceCandidate;
|
|
75
|
-
export declare function parseExplorerReport(value: unknown): ExplorerReport;
|
|
76
|
-
export declare function parseFollowUpRequest(value: unknown): FollowUpRequest;
|
|
77
|
-
export declare function parseJudgeDecision(value: unknown): JudgeDecision;
|
|
78
|
-
export declare function parseExhaustionError(value: unknown): ExhaustionErrorDetails;
|
|
79
|
-
export declare function isExplorerAssignment(value: unknown): value is ExplorerAssignment;
|
|
80
|
-
export declare function isEvidenceCandidate(value: unknown): value is EvidenceCandidate;
|
|
81
|
-
export declare function isExplorerReport(value: unknown): value is ExplorerReport;
|
|
82
|
-
export declare function isFollowUpRequest(value: unknown): value is FollowUpRequest;
|
|
83
|
-
export declare function isJudgeDecision(value: unknown): value is JudgeDecision;
|
|
84
|
-
export declare function isExhaustionError(value: unknown): value is ExhaustionErrorDetails;
|
|
85
|
-
export declare function safeParseExplorerAssignment(value: unknown): ExplorerAssignment | undefined;
|
|
86
|
-
export declare function safeParseEvidenceCandidate(value: unknown): EvidenceCandidate | undefined;
|
|
87
|
-
export declare function safeParseExplorerReport(value: unknown): ExplorerReport | undefined;
|
|
88
|
-
export declare function safeParseFollowUpRequest(value: unknown): FollowUpRequest | undefined;
|
|
89
|
-
export declare function safeParseJudgeDecision(value: unknown): JudgeDecision | undefined;
|
|
90
|
-
export declare function safeParseExhaustionError(value: unknown): ExhaustionErrorDetails | undefined;
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared dispatch template builders, skeleton literals, and anti-examples for
|
|
3
|
-
* AutoRAG explorer subagent dispatch.
|
|
4
|
-
*
|
|
5
|
-
* This module is the single source of truth for:
|
|
6
|
-
* - Assignment V1 sentinel/role-line constants and block builder
|
|
7
|
-
* - Single-root and multi-root success dispatch payload builders
|
|
8
|
-
* - Compact skeleton literals consumed by `formatBlockReason`
|
|
9
|
-
* - Anti-examples for rejected dispatch patterns
|
|
10
|
-
* - Stable coded patch-error reference (single source of truth for the error catalog)
|
|
11
|
-
*
|
|
12
|
-
* `buildSearchPrompt` and prompt tests reuse these builders so no divergent
|
|
13
|
-
* template text exists inside TypeScript.
|
|
14
|
-
*/
|
|
15
|
-
export declare const AUTORAG_ASSIGNMENT_V1_START = "<<<AUTORAG_ASSIGNMENT_V1>>>";
|
|
16
|
-
export declare const AUTORAG_ASSIGNMENT_V1_END = "<<<END_AUTORAG_ASSIGNMENT_V1>>>";
|
|
17
|
-
export declare const AUTORAG_ROLE_LINE_RETRIEVED_AT = "Required handoff: include retrievedAt.";
|
|
18
|
-
export declare const AUTORAG_ROLE_LINE_TEMPORAL_METADATA = "Required handoff: include temporal metadata.";
|
|
19
|
-
export declare const AUTORAG_CANONICAL_ROLE_LINES = "Required handoff: include retrievedAt.\nRequired handoff: include temporal metadata.";
|
|
20
|
-
export declare const PLACEHOLDER_CONFIGURED_MODEL = "<configured-model>";
|
|
21
|
-
export declare const PLACEHOLDER_ALLOWED_ROOT = "<allowed-root>";
|
|
22
|
-
export declare const PLACEHOLDER_ASSIGNMENT_V1_BLOCK = "<Assignment V1 block>";
|
|
23
|
-
export declare const PLACEHOLDER_CALLER_QUERY = "<caller query verbatim>";
|
|
24
|
-
export declare const DISPATCH_ADMIN_SKELETON = "{\"action\":\"list\"}";
|
|
25
|
-
export declare const DISPATCH_SINGLE_SKELETON = "{\"agentScope\":\"user\",\"artifacts\":false,\"agent\":\"autorag-explorer\",\"model\":\"<configured-model>\",\"cwd\":\"<allowed-root>\",\"task\":\"<Assignment V1 block>\"}";
|
|
26
|
-
export declare const DISPATCH_FANOUT_SKELETON = "{\"agentScope\":\"user\",\"artifacts\":false,\"tasks\":[{\"agent\":\"autorag-explorer\",\"model\":\"<configured-model>\",\"cwd\":\"<allowed-root>\",\"task\":\"<Assignment V1 block>\"}]}";
|
|
27
|
-
export interface AssignmentV1Options {
|
|
28
|
-
readonly originalQuery: string;
|
|
29
|
-
readonly method: string;
|
|
30
|
-
readonly queryVariants: readonly string[];
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Build a canonical Assignment V1 block string for use as the `task` field
|
|
34
|
-
* value in a subagent dispatch payload.
|
|
35
|
-
*
|
|
36
|
-
* Output shape (LF-joined):
|
|
37
|
-
* ```
|
|
38
|
-
* <<<AUTORAG_ASSIGNMENT_V1>>>
|
|
39
|
-
* {"originalQuery":"...","method":"...","queryVariants":["..."]}
|
|
40
|
-
* <<<END_AUTORAG_ASSIGNMENT_V1>>>
|
|
41
|
-
* Required handoff: include retrievedAt.
|
|
42
|
-
* Required handoff: include temporal metadata.
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
export declare function buildAssignmentV1Block(opts: AssignmentV1Options): string;
|
|
46
|
-
export interface SingleRootDispatchOptions {
|
|
47
|
-
readonly explorerModel: string;
|
|
48
|
-
readonly allowedRoot: string;
|
|
49
|
-
readonly task: string;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Build a single-root success dispatch payload as pretty-printed JSON.
|
|
53
|
-
*
|
|
54
|
-
* `agentScope` and `artifacts` are set exactly once at the top level.
|
|
55
|
-
* The single leaf carries `agent`, `model`, `cwd`, and `task`.
|
|
56
|
-
* Pass `PLACEHOLDER_*` constants for prompt examples or real values for
|
|
57
|
-
* actual dispatch payloads.
|
|
58
|
-
*/
|
|
59
|
-
export declare function buildSingleRootDispatchPayload(opts: SingleRootDispatchOptions): string;
|
|
60
|
-
export interface MultiRootDispatchTask {
|
|
61
|
-
readonly explorerModel: string;
|
|
62
|
-
readonly allowedRoot: string;
|
|
63
|
-
readonly task: string;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Build a multi-root success dispatch payload as pretty-printed JSON.
|
|
67
|
-
*
|
|
68
|
-
* `agentScope` and `artifacts` are set exactly once at the top level.
|
|
69
|
-
* Each task in `tasks` carries `agent`, `model`, `cwd`, and `task` and
|
|
70
|
-
* omits `agentScope`/`artifacts`. Pass one task per configured root.
|
|
71
|
-
*/
|
|
72
|
-
export declare function buildMultiRootDispatchPayload(tasks: readonly MultiRootDispatchTask[]): string;
|
|
73
|
-
export interface DispatchAntiExample {
|
|
74
|
-
readonly label: string;
|
|
75
|
-
readonly body: string;
|
|
76
|
-
readonly reason: string;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Brief anti-examples showing dispatch patterns that are rejected.
|
|
80
|
-
* Each body is pretty-printed JSON using non-sensitive placeholders only.
|
|
81
|
-
*/
|
|
82
|
-
export declare const DISPATCH_ANTIEXAMPLES: readonly DispatchAntiExample[];
|
|
83
|
-
export interface DispatchErrorInfo {
|
|
84
|
-
readonly code: string;
|
|
85
|
-
readonly exactFix: string;
|
|
86
|
-
readonly forceCorrectable: boolean;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Reference table of stable dispatch rejection codes, their exactFix strings,
|
|
90
|
-
* and forceCorrectable flags. This is the single source of truth for the error
|
|
91
|
-
* catalog — `dispatch-validation.ts` derives its `EXACT_FIX_MAP` and
|
|
92
|
-
* `FORCE_CORRECTABLE_MAP` from this table so no dual catalog exists.
|
|
93
|
-
*
|
|
94
|
-
* `DISPATCH_ROLE_METADATA_INVALID` is intentionally absent: valid tasks are
|
|
95
|
-
* normalized by `ensureRoleLines` and no rejection path emits that code.
|
|
96
|
-
*/
|
|
97
|
-
export declare const DISPATCH_ERROR_REFERENCE: readonly DispatchErrorInfo[];
|
|
98
|
-
/**
|
|
99
|
-
* Build the `### Canonical dispatch templates` subsection text for the system
|
|
100
|
-
* prompt. Uses the builders and constants above so no divergent template text
|
|
101
|
-
* exists. The `explorerModelId` parameter fills the model field in the example
|
|
102
|
-
* payloads.
|
|
103
|
-
*/
|
|
104
|
-
export declare function buildDispatchTemplatesPromptSection(explorerModelId: string): string;
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
export type DispatchRejectionCode = "DISPATCH_MALFORMED" | "DISPATCH_ACTION_UNKNOWN" | "DISPATCH_ADMIN_MUTATION_FORBIDDEN" | "DISPATCH_CONTROL_FORBIDDEN" | "DISPATCH_SCHEDULE_FORBIDDEN" | "DISPATCH_ARTIFACTS_INVALID" | "DISPATCH_AGENT_SCOPE_INVALID" | "DISPATCH_AGENT_IDENTITY" | "DISPATCH_MODEL_MISMATCH" | "DISPATCH_ASSIGNMENT_INVALID" | "DISPATCH_QUERY_MISMATCH" | "DISPATCH_CWD_MISSING" | "DISPATCH_CWD_OUTSIDE_ROOTS" | "DISPATCH_NO_ACTIVE_QUERY";
|
|
2
|
-
export type DispatchKind = "launch" | "admin" | "control" | "mutation" | "schedule" | "hybrid" | "unknown";
|
|
3
|
-
export interface DispatchRejection {
|
|
4
|
-
readonly code: DispatchRejectionCode;
|
|
5
|
-
readonly field: string;
|
|
6
|
-
readonly dispatchKind: DispatchKind;
|
|
7
|
-
}
|
|
8
|
-
export declare class DispatchRejectionError extends Error {
|
|
9
|
-
readonly code: DispatchRejectionCode;
|
|
10
|
-
readonly field: string;
|
|
11
|
-
readonly exactFix: string;
|
|
12
|
-
readonly forceCorrectable: boolean;
|
|
13
|
-
readonly skeleton: string;
|
|
14
|
-
readonly dispatchKind: DispatchKind;
|
|
15
|
-
constructor(rejection: DispatchRejection, exactFix: string, forceCorrectable: boolean, skeleton: string);
|
|
16
|
-
}
|
|
17
|
-
export declare const EXACT_FIX_MAP: Readonly<Record<DispatchRejectionCode, string>>;
|
|
18
|
-
export declare const FORCE_CORRECTABLE_MAP: Readonly<Record<DispatchRejectionCode, boolean>>;
|
|
19
|
-
/** Backward-compatible aliases for the shared skeleton literals from dispatch-templates.ts. */
|
|
20
|
-
export declare const SKELETON_ADMIN = "{\"action\":\"list\"}";
|
|
21
|
-
export declare const SKELETON_SINGLE = "{\"agentScope\":\"user\",\"artifacts\":false,\"agent\":\"autorag-explorer\",\"model\":\"<configured-model>\",\"cwd\":\"<allowed-root>\",\"task\":\"<Assignment V1 block>\"}";
|
|
22
|
-
export declare const SKELETON_FANOUT = "{\"agentScope\":\"user\",\"artifacts\":false,\"tasks\":[{\"agent\":\"autorag-explorer\",\"model\":\"<configured-model>\",\"cwd\":\"<allowed-root>\",\"task\":\"<Assignment V1 block>\"}]}";
|
|
23
|
-
export declare function formatBlockReason(code: DispatchRejectionCode, field: string, exactFix: string, skeleton: string): string;
|
|
24
|
-
export declare function classifyAction(action: unknown): DispatchKind;
|
|
25
|
-
/**
|
|
26
|
-
* Classify a full dispatch invocation into a dispatch kind.
|
|
27
|
-
*
|
|
28
|
-
* Classification happens BEFORE any defaults or autofill.
|
|
29
|
-
* - If `action` is present and is a mutation/control/schedule → that kind (forbidden-action precedence).
|
|
30
|
-
* - If `action` is present and is a diagnostic (exact lowercase) → admin.
|
|
31
|
-
* - If `action` is present and is an explicit execution alias (exact lowercase: single/parallel/tasks) with launch shape → launch.
|
|
32
|
-
* - If `action` is present but is non-string, unknown, or a non-exact-lowercase value
|
|
33
|
-
* (e.g. "Create", "LIST", "Interrupt", 42) → unknown, regardless of launch fields.
|
|
34
|
-
* - If no `action` property but launch shape fields present (agent/task/tasks/chain/parallel) → launch.
|
|
35
|
-
* - Otherwise → unknown.
|
|
36
|
-
*/
|
|
37
|
-
export declare function classifyDispatch(args: unknown): DispatchKind;
|
|
38
|
-
/**
|
|
39
|
-
* Validate a diagnostic invocation against its exact allowed field set.
|
|
40
|
-
* Returns a DispatchRejection if invalid, undefined if valid.
|
|
41
|
-
* Diagnostics bypass explorer assignment/root/model launch gates.
|
|
42
|
-
*/
|
|
43
|
-
export declare function validateDiagnostic(args: Record<string, unknown>, action: string): DispatchRejection | undefined;
|
|
44
|
-
export declare function rejectForbiddenAction(action: string): DispatchRejection;
|
|
45
|
-
export interface PrepareContext {
|
|
46
|
-
/** Configured explorer model wire id (e.g. "provider/model-id"). */
|
|
47
|
-
readonly configuredModel: string | undefined;
|
|
48
|
-
}
|
|
49
|
-
export interface PrepareResult {
|
|
50
|
-
/** Normalized args (defaults filled for launch, null-deleted). */
|
|
51
|
-
readonly args: Record<string, unknown>;
|
|
52
|
-
/** Whether any field was autofilled. */
|
|
53
|
-
readonly autofilled: {
|
|
54
|
-
readonly artifacts: boolean;
|
|
55
|
-
readonly agentScope: boolean;
|
|
56
|
-
readonly leafModelFillCount: number;
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Composed prepareArguments for the subagent tool.
|
|
61
|
-
*
|
|
62
|
-
* Classifies first, then applies launch-only normalization (null-delete + missing defaults).
|
|
63
|
-
* Diagnostics never receive artifacts/agentScope/model defaults.
|
|
64
|
-
* Throws DispatchRejectionError on any validation failure.
|
|
65
|
-
*/
|
|
66
|
-
export declare function autoragPrepare(rawArgs: unknown, ctx: PrepareContext): Record<string, unknown>;
|
|
67
|
-
export declare function readAutofilled(args: Record<string, unknown>): {
|
|
68
|
-
readonly artifacts: boolean;
|
|
69
|
-
readonly agentScope: boolean;
|
|
70
|
-
readonly leafModelFillCount: number;
|
|
71
|
-
} | undefined;
|
|
72
|
-
interface LaunchLeaf {
|
|
73
|
-
readonly record: Record<string, unknown>;
|
|
74
|
-
readonly path: string;
|
|
75
|
-
}
|
|
76
|
-
export declare function getLaunchLeaves(args: Record<string, unknown>): readonly LaunchLeaf[];
|
|
77
|
-
/**
|
|
78
|
-
* Create a DispatchRejectionError from a DispatchRejection with proper
|
|
79
|
-
* exactFix, forceCorrectable, and skeleton selection.
|
|
80
|
-
* Used by beforeToolCall for post-schema rejections.
|
|
81
|
-
*
|
|
82
|
-
* When `args` is provided and the rejection is a launch kind, the skeleton is
|
|
83
|
-
* selected from the args shape: fanout if `tasks`/`chain`/`parallel` are
|
|
84
|
-
* present, single otherwise. When `args` is omitted, launch rejections default
|
|
85
|
-
* to the single skeleton. Non-launch kinds always use the admin skeleton.
|
|
86
|
-
*/
|
|
87
|
-
export declare function createDispatchRejectionError(rejection: DispatchRejection, args?: Record<string, unknown>): DispatchRejectionError;
|
|
88
|
-
/** Backward-compatible aliases for shared V1 sentinel constants. */
|
|
89
|
-
export declare const AUTORAG_ASSIGNMENT_V1_START = "<<<AUTORAG_ASSIGNMENT_V1>>>";
|
|
90
|
-
export declare const AUTORAG_ASSIGNMENT_V1_END = "<<<END_AUTORAG_ASSIGNMENT_V1>>>";
|
|
91
|
-
export interface ParsedAssignment {
|
|
92
|
-
readonly originalQuery: string;
|
|
93
|
-
readonly method: string;
|
|
94
|
-
readonly queryVariants: readonly string[];
|
|
95
|
-
/** Whether V1 (true) or legacy (false) format was used. */
|
|
96
|
-
readonly isV1: boolean;
|
|
97
|
-
}
|
|
98
|
-
/** Backward-compatible aliases for shared role line constants. */
|
|
99
|
-
export declare const ROLE_LINE_RETRIEVED_AT = "Required handoff: include retrievedAt.";
|
|
100
|
-
export declare const ROLE_LINE_TEMPORAL_METADATA = "Required handoff: include temporal metadata.";
|
|
101
|
-
export declare function canonicalRoleLines(): string;
|
|
102
|
-
/**
|
|
103
|
-
* Parse a task string as an Assignment V1 block.
|
|
104
|
-
*
|
|
105
|
-
* V1 sentinels:
|
|
106
|
-
* - Start line (after stripping single trailing CR) must equal <<<AUTORAG_ASSIGNMENT_V1>>>
|
|
107
|
-
* - End line (after stripping single trailing CR) must equal <<<END_AUTORAG_ASSIGNMENT_V1>>>
|
|
108
|
-
* - End sentinel at EOF valid
|
|
109
|
-
* - Exactly one V1 block; duplicate/malformed/unterminated → reject
|
|
110
|
-
* - Body: one JSON object with exactly keys originalQuery, method, queryVariants
|
|
111
|
-
* - originalQuery: string, trimmed nonempty
|
|
112
|
-
* - method: string, trimmed nonempty
|
|
113
|
-
* - queryVariants: nonempty array of nonempty strings
|
|
114
|
-
* - Extra/missing keys/wrong types → reject
|
|
115
|
-
*
|
|
116
|
-
* Returns undefined if no V1 sentinel found (caller should try legacy).
|
|
117
|
-
* Returns ParsedAssignment on success.
|
|
118
|
-
* Throws DispatchRejectionError on malformed V1.
|
|
119
|
-
*/
|
|
120
|
-
export declare function parseAssignmentV1(task: string): ParsedAssignment | undefined;
|
|
121
|
-
/**
|
|
122
|
-
* Parse a task string as a legacy prose assignment.
|
|
123
|
-
*
|
|
124
|
-
* Legacy (n4 retained):
|
|
125
|
-
* - Full logical lines; optional leading whitespace; optional `- ` bullet; optional matching `**` around label.
|
|
126
|
-
* - Case/space normalize labels; value = remainder of same line only.
|
|
127
|
-
* - Labels: Original query; Selected retrieval method | Retrieval method; Query variants | Query variant.
|
|
128
|
-
* - Reorder OK; exactly once each; Query variants split on `;`, trim, reject empty segments.
|
|
129
|
-
* - Later label-looking line → reject.
|
|
130
|
-
* - Prefix/suffix outside three lines preserved.
|
|
131
|
-
* - Multiline / special / label-looking content inside values → V1 required, not legacy.
|
|
132
|
-
*
|
|
133
|
-
* Returns undefined if no legacy labels found.
|
|
134
|
-
* Throws DispatchRejectionError on malformed legacy.
|
|
135
|
-
*/
|
|
136
|
-
export declare function parseLegacyAssignment(task: string): ParsedAssignment | undefined;
|
|
137
|
-
/**
|
|
138
|
-
* Parse a task string as either V1 or legacy assignment.
|
|
139
|
-
* Tries V1 first; if no V1 sentinels, tries legacy.
|
|
140
|
-
* Returns undefined if neither format is found.
|
|
141
|
-
* Throws DispatchRejectionError on malformed input.
|
|
142
|
-
*/
|
|
143
|
-
export declare function parseAssignment(task: string): ParsedAssignment | undefined;
|
|
144
|
-
/**
|
|
145
|
-
* Insert canonical role lines into a task string, byte-idempotent.
|
|
146
|
-
*
|
|
147
|
-
* 1. Remove all existing exact canonical role lines (the two literals after CR-strip).
|
|
148
|
-
* 2. Insert exactly one of each immediately after end sentinel (V1) or
|
|
149
|
-
* immediately after the last of the three recognized legacy label lines.
|
|
150
|
-
* 3. Preserve all other suffix bytes and original newline style.
|
|
151
|
-
* 4. Repeat rendering is byte-idempotent.
|
|
152
|
-
*/
|
|
153
|
-
export declare function ensureRoleLines(task: string): string;
|
|
154
|
-
export interface PostSchemaContext {
|
|
155
|
-
readonly configuredModel: string | undefined;
|
|
156
|
-
readonly currentQuery: string | undefined;
|
|
157
|
-
readonly allowedRoots: readonly string[];
|
|
158
|
-
readonly workspaceRoot: string;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Post-schema validation for launch invocations.
|
|
162
|
-
* Checks: assignment parse, structural query equality, role lines,
|
|
163
|
-
* cwd realpath/allowed roots, model match.
|
|
164
|
-
*
|
|
165
|
-
* Returns a DispatchRejection if invalid, undefined if valid.
|
|
166
|
-
* Also normalizes cwd to canonical realpath on success.
|
|
167
|
-
*/
|
|
168
|
-
export declare function validateLaunchPostSchema(args: Record<string, unknown>, ctx: PostSchemaContext): DispatchRejection | undefined;
|
|
169
|
-
export {};
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __returnValue = (v) => v;
|
|
4
|
-
function __exportSetter(name, newValue) {
|
|
5
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
6
|
-
}
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, {
|
|
10
|
-
get: all[name],
|
|
11
|
-
enumerable: true,
|
|
12
|
-
configurable: true,
|
|
13
|
-
set: __exportSetter.bind(all, name)
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
17
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
18
|
-
|
|
19
|
-
// src/subagents/explorer-tools-extension.ts
|
|
20
|
-
import { realpath, stat } from "node:fs/promises";
|
|
21
|
-
import { dirname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
22
|
-
import {
|
|
23
|
-
createFindToolDefinition,
|
|
24
|
-
createGrepToolDefinition,
|
|
25
|
-
createLsToolDefinition,
|
|
26
|
-
createReadToolDefinition
|
|
27
|
-
} from "@earendil-works/pi-coding-agent";
|
|
28
|
-
var PARENT_TRAVERSAL_SEGMENT = /(^|[/\\])\.\.($|[/\\])/;
|
|
29
|
-
var TOOL_METADATA_CWD = "/";
|
|
30
|
-
|
|
31
|
-
class ExplorerPathContainmentError extends Error {
|
|
32
|
-
code;
|
|
33
|
-
requestedPath;
|
|
34
|
-
root;
|
|
35
|
-
constructor(message, requestedPath, root) {
|
|
36
|
-
super(message);
|
|
37
|
-
this.name = "ExplorerPathContainmentError";
|
|
38
|
-
this.code = "EXPLORER_PATH_CONTAINMENT";
|
|
39
|
-
this.requestedPath = requestedPath;
|
|
40
|
-
this.root = root;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
function isMissingPathError(error) {
|
|
44
|
-
return error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR");
|
|
45
|
-
}
|
|
46
|
-
function isEqualOrDescendant(root, target) {
|
|
47
|
-
const pathFromRoot = relative(root, target);
|
|
48
|
-
return pathFromRoot === "" || pathFromRoot !== ".." && !pathFromRoot.startsWith(`..${sep}`) && !isAbsolute(pathFromRoot);
|
|
49
|
-
}
|
|
50
|
-
async function resolveExistingTargetOrNearestParent(target) {
|
|
51
|
-
try {
|
|
52
|
-
return await realpath(target);
|
|
53
|
-
} catch (error) {
|
|
54
|
-
if (!isMissingPathError(error))
|
|
55
|
-
throw error;
|
|
56
|
-
}
|
|
57
|
-
let candidateParent = dirname(target);
|
|
58
|
-
while (true) {
|
|
59
|
-
try {
|
|
60
|
-
const realParent = await realpath(candidateParent);
|
|
61
|
-
return resolve(realParent, relative(candidateParent, target));
|
|
62
|
-
} catch (error) {
|
|
63
|
-
if (!isMissingPathError(error))
|
|
64
|
-
throw error;
|
|
65
|
-
const nextParent = dirname(candidateParent);
|
|
66
|
-
if (nextParent === candidateParent)
|
|
67
|
-
throw error;
|
|
68
|
-
candidateParent = nextParent;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
async function resolveExplorerRoot(cwd) {
|
|
73
|
-
const root = await realpath(cwd);
|
|
74
|
-
if (!(await stat(root)).isDirectory()) {
|
|
75
|
-
throw new Error(`Explorer assigned cwd is not a directory: ${cwd}`);
|
|
76
|
-
}
|
|
77
|
-
return root;
|
|
78
|
-
}
|
|
79
|
-
async function resolveContainedPath(root, requestedPath) {
|
|
80
|
-
if (PARENT_TRAVERSAL_SEGMENT.test(requestedPath)) {
|
|
81
|
-
throw new ExplorerPathContainmentError(`Explorer filesystem containment rejected parent traversal path: ${requestedPath}`, requestedPath, root);
|
|
82
|
-
}
|
|
83
|
-
const target = await resolveExistingTargetOrNearestParent(resolve(root, requestedPath));
|
|
84
|
-
if (!isEqualOrDescendant(root, target)) {
|
|
85
|
-
throw new ExplorerPathContainmentError(`Explorer filesystem containment rejected path outside assigned cwd: ${requestedPath}`, requestedPath, root);
|
|
86
|
-
}
|
|
87
|
-
return { root, target };
|
|
88
|
-
}
|
|
89
|
-
function registerExplorerTools(pi) {
|
|
90
|
-
let pinnedRoot;
|
|
91
|
-
const getPinnedRoot = (cwd) => {
|
|
92
|
-
pinnedRoot ??= resolveExplorerRoot(cwd);
|
|
93
|
-
return pinnedRoot;
|
|
94
|
-
};
|
|
95
|
-
const readTool = createReadToolDefinition(TOOL_METADATA_CWD);
|
|
96
|
-
pi.registerTool({
|
|
97
|
-
...readTool,
|
|
98
|
-
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
99
|
-
const { root, target } = await resolveContainedPath(await getPinnedRoot(ctx.cwd), params.path);
|
|
100
|
-
return createReadToolDefinition(root).execute(toolCallId, { ...params, path: target }, signal, onUpdate, ctx);
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
const grepTool = createGrepToolDefinition(TOOL_METADATA_CWD);
|
|
104
|
-
pi.registerTool({
|
|
105
|
-
...grepTool,
|
|
106
|
-
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
107
|
-
const { root, target } = await resolveContainedPath(await getPinnedRoot(ctx.cwd), params.path ?? ".");
|
|
108
|
-
return createGrepToolDefinition(root).execute(toolCallId, { ...params, path: target }, signal, onUpdate, ctx);
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
const findTool = createFindToolDefinition(TOOL_METADATA_CWD);
|
|
112
|
-
pi.registerTool({
|
|
113
|
-
...findTool,
|
|
114
|
-
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
115
|
-
const { root, target } = await resolveContainedPath(await getPinnedRoot(ctx.cwd), params.path ?? ".");
|
|
116
|
-
return createFindToolDefinition(root).execute(toolCallId, { ...params, path: target }, signal, onUpdate, ctx);
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
const lsTool = createLsToolDefinition(TOOL_METADATA_CWD);
|
|
120
|
-
pi.registerTool({
|
|
121
|
-
...lsTool,
|
|
122
|
-
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
123
|
-
const { root, target } = await resolveContainedPath(await getPinnedRoot(ctx.cwd), params.path ?? ".");
|
|
124
|
-
return createLsToolDefinition(root).execute(toolCallId, { ...params, path: target }, signal, onUpdate, ctx);
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
export {
|
|
129
|
-
registerExplorerTools as default
|
|
130
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Model } from "@earendil-works/pi-ai";
|
|
2
|
-
export interface LocalAutoRAGModels {
|
|
3
|
-
readonly provider: string;
|
|
4
|
-
readonly apiKey: string;
|
|
5
|
-
readonly orchestrator: Model<"openai-responses">;
|
|
6
|
-
readonly explorer: Model<"openai-responses">;
|
|
7
|
-
}
|
|
8
|
-
export interface LoadLocalAutoRAGModelsOptions {
|
|
9
|
-
readonly configPath?: string;
|
|
10
|
-
readonly env?: Readonly<Record<string, string | undefined>>;
|
|
11
|
-
readonly orchestratorModelId?: string;
|
|
12
|
-
readonly explorerModelId?: string;
|
|
13
|
-
}
|
|
14
|
-
export declare function loadLocalAutoRAGModels(options?: LoadLocalAutoRAGModelsOptions): LocalAutoRAGModels;
|