@lloyal-labs/rig 1.7.0 → 2.0.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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @lloyal-labs/rig
2
2
 
3
- Retrieval-Interleaved Generation for [lloyal-agents](../agents).
3
+ Retrieval-Interleaved Generation for the [lloyal HDK](https://github.com/lloyal-ai/hdk).
4
4
 
5
5
  ```bash
6
6
  npm i @lloyal-labs/rig @lloyal-labs/lloyal-agents @lloyal-labs/lloyal.node
@@ -10,7 +10,7 @@ npm i @lloyal-labs/rig @lloyal-labs/lloyal-agents @lloyal-labs/lloyal.node
10
10
 
11
11
  RAG retrieves first, then generates. A retrieval step runs upfront — query the vector DB, get top-k passages, inject them into the prompt, call the model once. The model sees static context. Retrieval and generation are separate phases.
12
12
 
13
- RIG interleaves retrieval and generation inside the decode loop. Agents generate reasoning, decide to search, process results, reason further, fetch a page, form hypotheses from the content, search again with refined queries. Retrieval decisions emerge from ongoing generation — each search query is informed by everything the agent has already discovered.
13
+ RIG interleaves retrieval and generation **inside the decode loop**. Agents generate reasoning, decide to search, process results, reason further, fetch a page, form hypotheses from the content, search again with refined queries. Retrieval decisions emerge from ongoing generation — each search query is informed by everything the agent has already discovered.
14
14
 
15
15
  The difference is observable in tool call inputs. A RAG system constructs search queries from the original user question. A RIG agent constructs queries from hypotheses formed during generation:
16
16
 
@@ -30,7 +30,7 @@ The last search — `"pool drain connection lifecycle interaction"` — is the s
30
30
 
31
31
  This behavior is not prompted or engineered. It emerges from the concurrency semantics of `lloyal-agents`.
32
32
 
33
- The four-phase tick loop creates a clean decision boundary between each tool call and the next generation step:
33
+ The five-phase tick loop creates a clean decision boundary between each tool call and the next generation step:
34
34
 
35
35
  1. Agent generates tokens, hits stop token, tool call extracted
36
36
  2. Tool executes to completion — agent is suspended
@@ -42,17 +42,15 @@ Step 5 is the critical moment. The model's next-token prediction operates on a c
42
42
 
43
43
  An agent that greps with a narrow pattern and gets 0 matches will broaden the pattern on its next grep — not because it's prompted to retry, but because the 0-match result is in context and the model naturally adjusts. An agent that reads a section and discovers an unexpected connection will construct a search query targeting that specific connection — the read result is in context, and the model forms a hypothesis from it.
44
44
 
45
- Under a concurrent dispatch model where tool results arrive mid-generation, the agent is already producing tokens when results land. The result gets incorporated, but there's no clean pause for hypothesis formation. The observable effect: sequential dispatch produces progressively more specific queries; concurrent dispatch produces variations on the original question.
46
-
47
- Depth scales with `maxTurns`. At 2 turns, agents do single-shot retrieval. At 6 turns, agents do 3-4 rounds of iterative refinement. At 20 turns, agents go deep — following citation chains, cross-referencing claims, building evidence maps. The quality difference is in the later tool call inputs.
45
+ Depth scales with `maxTurns`. At 2 turns, agents do single-shot retrieval. At 6 turns, agents do 3–4 rounds of iterative refinement. At 20 turns, agents go deep following citation chains, cross-referencing claims, building evidence maps. The quality difference is in the later tool call inputs.
48
46
 
49
47
  ## Sources
50
48
 
51
49
  `@lloyal-labs/rig` provides two `Source` implementations (extending the base class from `lloyal-agents`):
52
50
 
53
- **CorpusSource** — local files with grep, semantic search, read_file, and recursive research tools. Agents investigate a knowledge base by pattern matching, reading sections in context, and spawning sub-agents for deeper investigation.
51
+ **`CorpusSource`** — local files with grep, semantic search, read_file, and recursive delegation. Agents investigate a knowledge base by pattern matching, reading sections in context, and spawning sub-agents for deeper investigation.
54
52
 
55
- **WebSource** — web search via [Tavily](https://tavily.com), page fetching with attention-based content extraction, and recursive web_research tools. `BufferingFetchPage` wraps fetch results — full content goes to the agent for reasoning, while a parallel buffer stores content for post-research reranking. Content extraction uses `generate({ parent })` to attend over the fetched page and extract summary + links via grammar-constrained generation, then prunes the fork — zero net KV cost per extraction.
53
+ **`WebSource`** — web search via [Tavily](https://tavily.com), page fetching with attention-based content extraction, and recursive delegation. `BufferingFetchPage` wraps fetch results — full content goes to the agent for reasoning, while a parallel buffer stores content for post-research reranking. Content extraction uses an ephemeral fork to attend over the fetched page and extract summary + links via grammar-constrained generation, then prunes the fork — zero net KV cost per extraction.
56
54
 
57
55
  Sources are composable. A pipeline can use one source, both, or custom implementations:
58
56
 
@@ -61,20 +59,17 @@ import {
61
59
  CorpusSource,
62
60
  WebSource,
63
61
  TavilyProvider,
64
- loadResources,
65
- chunkResources,
66
62
  } from "@lloyal-labs/rig";
63
+ import { loadResources, chunkResources } from "@lloyal-labs/rig/node";
67
64
 
68
65
  const sources = [];
69
66
 
70
- // Local knowledge base
71
67
  if (corpusDir) {
72
68
  const resources = loadResources(corpusDir);
73
69
  const chunks = chunkResources(resources);
74
70
  sources.push(new CorpusSource(resources, chunks));
75
71
  }
76
72
 
77
- // Web search
78
73
  if (process.env.TAVILY_API_KEY) {
79
74
  sources.push(new WebSource(new TavilyProvider()));
80
75
  }
@@ -82,9 +77,20 @@ if (process.env.TAVILY_API_KEY) {
82
77
 
83
78
  When multiple sources are used, they run sequentially — each source gets the full KV budget. After source N completes, its inner branches are pruned and KV is freed for source N+1.
84
79
 
80
+ ### Cross-encoder reranker — four scoring roles
81
+
82
+ The reranker (a small cross-encoder GGUF — Qwen3-Reranker-0.6B is the recommended default) drives an `EntailmentScorer` with four distinct methods:
83
+
84
+ - **`scoreEntailmentBatch`** — texts vs. the original query. Boundary entailment for retrieved content.
85
+ - **`scoreRelevanceBatch`** — dual-score `min(toolQueryScore, originalQueryScore)`. Used in exploit mode when KV pressure tightens focus.
86
+ - **`scoreSimilarityBatch`** — texts vs. an arbitrary reference. Powers echo detection at delegation boundaries (the agent's own task as reference).
87
+ - **`shouldProceed`** — floor gate. Default `_entailmentFloor = 0.25`.
88
+
89
+ One model, four roles. The reranker is RIG infrastructure, not a fetch optimization.
90
+
85
91
  ### Bridge
86
92
 
87
- Between sources, a bridge exit gate structures discoveries from the completed source as durable context for the next source's investigation:
93
+ Between sources, a bridge structures discoveries from the completed source as durable context for the next source's investigation:
88
94
 
89
95
  ```
90
96
  Corpus research → Bridge → Web research → Synthesize
@@ -93,19 +99,11 @@ Corpus research → Bridge → Web research → Synthesize
93
99
  The bridge extracts three tiers of discovery:
94
100
 
95
101
  1. **What was established** — specific data points, study details, statistics, quotes. Evidence preserved verbatim.
96
- 2. **Where evidence is incomplete** — acknowledged limitations, absent study designs, uncertain mechanisms. These are well-researched claims with identified evidence gaps.
102
+ 2. **Where evidence is incomplete** — acknowledged limitations, absent study designs, uncertain mechanisms. Well-researched claims with identified evidence gaps.
97
103
  3. **What was not covered** — topics mentioned but not substantiated, or entirely absent.
98
104
 
99
105
  The distinction between (2) and (3) is critical. A topic with six sections of evidence but no experimental validation is not a gap — it is a well-researched claim with an identified evidence limitation. The bridge flags the limitation, not the topic. This prevents the next source from re-investigating what the previous source already covered, and directs it toward genuine gaps.
100
106
 
101
- Bridge discoveries condition the next source's questions:
102
-
103
- ```typescript
104
- activeQuestions = questions.map(
105
- (q) => `${q}\n\nPrior research discoveries:\n${discoveries}`,
106
- );
107
- ```
108
-
109
107
  ## Pipeline
110
108
 
111
109
  A typical RIG pipeline:
@@ -114,11 +112,11 @@ A typical RIG pipeline:
114
112
  Plan → Research → [Bridge →] Synthesize → Eval
115
113
  ```
116
114
 
117
- **Plan.** Grammar-constrained decomposition of the user query into sub-questions with intent classification (`research` vs `clarify`). If the query is focused enough to investigate directly, produces an empty array (passthrough). Uses `generate()` with a JSON schema grammar — the model outputs structured `{ questions: [{ text, intent }] }` in a single generation pass.
115
+ **Plan.** Grammar-constrained decomposition of the user query into sub-questions with intent classification (`research` vs `clarify`). If the query is focused enough to investigate directly, produces an empty array (passthrough). `PlanTool` uses `agent()` with a JSON schema grammar — the model outputs structured `{ questions: [{ text, intent }] }` in a single generation pass.
118
116
 
119
- **Research.** Each source's research tool spawns a pool of agents that investigate sub-questions. Agents interleave retrieval and generation — searching, reading, forming hypotheses, searching again. Within each source, all agents run concurrently on shared GPU compute via `useAgentPool`. Sources run sequentially, each getting the full KV budget.
117
+ **Research.** Each source's tools are passed to an `agentPool` that investigates sub-questions in parallel (or in chain mode, sequentially with spine extension). Agents interleave retrieval and generation — searching, reading, forming hypotheses, searching again. Within each source, all agents run concurrently on shared GPU compute. Sources run sequentially, each getting the full KV budget.
120
118
 
121
- Agents that get cut by context pressure (their tool results exceeded KV headroom) are recovered via scratchpad extraction — `generate({ parent: agent.branch })` with a grammar-constrained reporter prompt attends over the agent's accumulated KV and extracts findings. The agent paid the KV cost of reasoning; the extraction recovers the value.
119
+ Agents that get cut by context pressure (their tool results exceeded KV headroom) are recovered via scratchpad extraction — a grammar-constrained reporter prompt attends over the agent's accumulated KV and extracts findings. The agent paid the KV cost of reasoning; the extraction recovers the value.
122
120
 
123
121
  **Bridge.** Runs between sources when multiple sources are configured. A single agent with report-only tools structures discoveries from the completed source. The bridge output conditions the next source's sub-questions, directing investigation toward gaps rather than re-covering established ground.
124
122
 
@@ -126,6 +124,8 @@ Agents that get cut by context pressure (their tool results exceeded KV headroom
126
124
 
127
125
  **Eval.** Multi-branch semantic comparison via `diverge()`. Fork N branches from a shared frontier, generate independently with the same verify prompt, check convergence. Where branches agree, the model is confident. Where they diverge, the answer needs refinement.
128
126
 
127
+ Full architectural walkthrough: [RIG Pipeline reference](https://docs.lloyal.ai/reference/rig/pipeline).
128
+
129
129
  ## Tools
130
130
 
131
131
  ### Corpus tools
@@ -135,24 +135,44 @@ Agents that get cut by context pressure (their tool results exceeded KV headroom
135
135
  | `SearchTool` | Semantic search over corpus chunks via reranker scoring |
136
136
  | `GrepTool` | Exhaustive regex pattern matching across all files |
137
137
  | `ReadFileTool` | Read file content at specified line ranges, tracks per-agent read state |
138
- | `ResearchTool` | Spawn sub-agent pool for deeper investigation of sub-questions |
139
138
  | `ReportTool` | Terminal tool — agents call this to submit findings |
140
139
 
141
140
  ### Web tools
142
141
 
143
- | Tool | Description |
144
- | ----------------- | --------------------------------------------------------------- |
145
- | `WebSearchTool` | Web search via configurable provider (Tavily included) |
146
- | `FetchPageTool` | Fetch URL, extract article text via Readability |
147
- | `WebResearchTool` | Spawn sub-agent pool with web tools for recursive investigation |
142
+ | Tool | Description |
143
+ | --------------- | --------------------------------------------------------------- |
144
+ | `WebSearchTool` | Web search via configurable provider (`TavilyProvider` included) |
145
+ | `FetchPageTool` | Fetch URL, extract article text via Readability |
148
146
 
149
147
  ### Pipeline tools
150
148
 
151
- | Tool | Description |
152
- | --------------------------- | ------------------------------------------------------------------ |
153
- | `PlanTool` | Grammar-constrained query decomposition with intent classification |
154
- | `createTools(opts)` | Build corpus toolkit from resources, chunks, and reranker |
155
- | `createReranker(modelPath)` | Semantic reranker for chunk scoring and passage selection |
149
+ | Tool | Description |
150
+ | ---------------------- | ---------------------------------------------------------------------------- |
151
+ | `PlanTool` | Grammar-constrained query decomposition with intent classification |
152
+ | `DelegateTool` | Generic recursive-delegation tool agent calls it to spawn a sub-agent pool |
153
+ | `createTools(opts)` | Build corpus toolkit from resources, chunks, and reranker |
154
+ | `createReranker(path)` | (`/node` subpath) Semantic reranker for chunk scoring and passage selection |
155
+
156
+ ### `DelegateTool`
157
+
158
+ `DelegateTool` is the canonical recursive-delegation primitive. It takes a tool name, a sub-task extractor, a system prompt, and pool options — when the agent calls it, the tool spawns an inner `agentPool` with `parent: context.branch` (warm path) so sub-agents inherit the calling agent's full KV state at zero marginal cost.
159
+
160
+ ```typescript
161
+ import { DelegateTool, reportTool } from "@lloyal-labs/rig";
162
+
163
+ const delegate = new DelegateTool({
164
+ name: "web_research",
165
+ extractTasks: (a) => a.questions as string[],
166
+ systemPrompt: RESEARCH_PROMPT,
167
+ poolOpts: {
168
+ tools: [...sourceTools, reportTool],
169
+ terminalTool: "report",
170
+ scorer,
171
+ },
172
+ });
173
+ ```
174
+
175
+ The agent sees `web_research` (or whatever `name` you give it) as a callable tool. Calling it spawns parallel sub-agents that recurse into the corpus or web. The deeper an investigation goes, the richer the attention state at depth — and the cost of inheritance is zero.
156
176
 
157
177
  ## Custom Sources
158
178
 
@@ -162,17 +182,19 @@ Extend `Source` from `lloyal-agents` to create custom sources:
162
182
  import { Source } from "@lloyal-labs/lloyal-agents";
163
183
  import type { Tool } from "@lloyal-labs/lloyal-agents";
164
184
 
165
- class DatabaseSource extends Source<SourceContext, Row> {
185
+ class DatabaseSource extends Source<DatabaseContext, Row> {
166
186
  readonly name = "database";
167
187
 
168
- get researchTool(): Tool {
169
- return this._researchTool;
188
+ get tools(): Tool[] {
189
+ return this._tools;
170
190
  }
171
191
 
172
- *bind(ctx: SourceContext) {
173
- // Set up tools with access to ctx.parent (for generate({ parent })),
174
- // ctx.reranker, ctx.reporterPrompt, ctx.reportTool
175
- this._researchTool = new DatabaseResearchTool(/* ... */);
192
+ *bind(ctx: DatabaseContext) {
193
+ // Set up tools, reranker, scorer state
194
+ this._tools = [
195
+ new QueryTool(/* ... */),
196
+ new SchemaInspectTool(/* ... */),
197
+ ];
176
198
  }
177
199
 
178
200
  getChunks(): Row[] {
@@ -181,7 +203,13 @@ class DatabaseSource extends Source<SourceContext, Row> {
181
203
  }
182
204
  ```
183
205
 
184
- The `bind()` lifecycle receives a `SourceContext` with the parent branch (for forking), reranker, reporter prompt, and report tool. Your research tool calls `useAgentPool` or `runAgents` internally — same primitives the built-in sources use.
206
+ The `bind()` lifecycle receives a context with reranker and scorer plumbing. Your tools call `agentPool` or `useAgent` internally for recursive patterns — same primitives the built-in sources use.
207
+
208
+ See [custom sources](https://docs.lloyal.ai/reference/rig/custom-sources) for the full contract.
209
+
210
+ ## Documentation
211
+
212
+ Full positioning, source contract, reranker mechanics, and pipeline patterns at [docs.lloyal.ai](https://docs.lloyal.ai).
185
213
 
186
214
  ## License
187
215
 
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@
11
11
  * @category Rig
12
12
  */
13
13
  export { createTools, reportTool, ReportTool, WebSearchTool, TavilyProvider, FetchPageTool, DelegateTool, PlanTool, taskToContent, } from './tools';
14
- export type { DelegateToolOpts, PlanToolOpts, PlanResult, PlanQuestion, ResearchTask, SearchProvider, SearchResult, Reranker, ScoredChunk, ScoredResult, } from './tools';
14
+ export type { DelegateToolOpts, PlanToolOpts, PlanResult, PlanIntent, ResearchTask, SearchProvider, SearchResult, Reranker, ScoredChunk, ScoredResult, } from './tools';
15
15
  export { WebSource } from './sources/web';
16
16
  export type { WebSourceOpts } from './sources/web';
17
17
  export { CorpusSource } from './sources/corpus';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EACL,WAAW,EAAE,UAAU,EAAE,UAAU,EACnC,aAAa,EAAE,cAAc,EAAE,aAAa,EAC5C,YAAY,EACZ,QAAQ,EAAE,aAAa,GACxB,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,gBAAgB,EAChB,YAAY,EACZ,UAAU,EAAE,YAAY,EAAE,YAAY,EACtC,cAAc,EAAE,YAAY,EAC5B,QAAQ,EAAE,WAAW,EAAE,YAAY,GACpC,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC3E,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAClE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGtD,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EACL,WAAW,EAAE,UAAU,EAAE,UAAU,EACnC,aAAa,EAAE,cAAc,EAAE,aAAa,EAC5C,YAAY,EACZ,QAAQ,EAAE,aAAa,GACxB,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,gBAAgB,EAChB,YAAY,EACZ,UAAU,EAAE,UAAU,EAAE,YAAY,EACpC,cAAc,EAAE,YAAY,EAC5B,QAAQ,EAAE,WAAW,EAAE,YAAY,GACpC,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC3E,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAClE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGtD,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/node.d.ts CHANGED
@@ -12,5 +12,5 @@
12
12
  */
13
13
  export * from './index';
14
14
  export { createReranker } from './reranker';
15
- export { loadResources, chunkResources } from './resources';
15
+ export { loadResources, chunkResources, resolveCorpusInput } from './resources';
16
16
  //# sourceMappingURL=node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAG5C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAG5C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC"}
package/dist/node.js CHANGED
@@ -26,7 +26,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
26
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.chunkResources = exports.loadResources = exports.createReranker = void 0;
29
+ exports.resolveCorpusInput = exports.chunkResources = exports.loadResources = exports.createReranker = void 0;
30
30
  // Re-export everything from the platform-agnostic barrel
31
31
  __exportStar(require("./index"), exports);
32
32
  // Node-only: Reranker factory (requires @lloyal-labs/lloyal.node)
@@ -36,4 +36,5 @@ Object.defineProperty(exports, "createReranker", { enumerable: true, get: functi
36
36
  var resources_1 = require("./resources");
37
37
  Object.defineProperty(exports, "loadResources", { enumerable: true, get: function () { return resources_1.loadResources; } });
38
38
  Object.defineProperty(exports, "chunkResources", { enumerable: true, get: function () { return resources_1.chunkResources; } });
39
+ Object.defineProperty(exports, "resolveCorpusInput", { enumerable: true, get: function () { return resources_1.resolveCorpusInput; } });
39
40
  //# sourceMappingURL=node.js.map
package/dist/node.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;;;;;;;;;;;;;;;AAEH,yDAAyD;AACzD,0CAAwB;AAExB,kEAAkE;AAClE,uCAA4C;AAAnC,0GAAA,cAAc,OAAA;AAEvB,iDAAiD;AACjD,yCAA4D;AAAnD,0GAAA,aAAa,OAAA;AAAE,2GAAA,cAAc,OAAA"}
1
+ {"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;;;;;;;;;;;;;;;AAEH,yDAAyD;AACzD,0CAAwB;AAExB,kEAAkE;AAClE,uCAA4C;AAAnC,0GAAA,cAAc,OAAA;AAEvB,iDAAiD;AACjD,yCAAgF;AAAvE,0GAAA,aAAa,OAAA;AAAE,2GAAA,cAAc,OAAA;AAAE,+GAAA,kBAAkB,OAAA"}
@@ -1,16 +1,35 @@
1
1
  import type { Resource, Chunk } from "./types";
2
+ /** Split a path-with-glob into a `cwd` (everything up to the first glob
3
+ * character's nearest preceding `/`) + a `pattern` (the rest). Plain
4
+ * paths return `{ cwd: input, pattern: null }`. */
5
+ export declare function resolveCorpusInput(input: string): {
6
+ cwd: string;
7
+ pattern: string | null;
8
+ };
2
9
  /**
3
- * Load documents from a directory (or single file) into {@link Resource} objects
10
+ * Load documents into {@link Resource} objects.
4
11
  *
5
- * If `dir` is a file path, returns a single-element array. If it is a
6
- * directory, reads all `.md` files within it. Exits the process with an
7
- * error message if the path does not exist or contains no Markdown files.
12
+ * Accepts three input shapes:
8
13
  *
9
- * @param dir - Absolute path to a directory of `.md` files or a single file
10
- * @returns Array of loaded resources with file name and content
14
+ * 1. **Single file** (`/path/to/foo.md`) wrapped as one resource.
15
+ * 2. **Directory** (`/path/to/docs`) recursive `**\/*.{md,mdx}`. The
16
+ * `.gitignore` at the corpus root (if present) filters out vendored
17
+ * markdown (e.g. `node_modules`) the user already declared as
18
+ * ignored. To restrict to top-level only, pass `dir/*.md` explicitly.
19
+ * 3. **Glob pattern** (`/path/to/docs/*.md`, `/path/to/docs/sub/**\/*.md`,
20
+ * etc.) — the user controls scope. The pattern's tail must end in
21
+ * `.md`, `.mdx`, or `.{md,mdx}` — other extensions are rejected
22
+ * because the corpus only handles markdown. Quote the pattern in
23
+ * your shell to prevent shell expansion.
24
+ *
25
+ * Honors `.gitignore` at the corpus root if present. No HDK-side opinions
26
+ * about which directories to skip; just respect what's already declared.
27
+ *
28
+ * Resource names preserve the relative path from the corpus root so
29
+ * nested files with the same basename don't collide.
11
30
  *
12
31
  * @category Rig
13
32
  */
14
- export declare function loadResources(dir: string): Resource[];
33
+ export declare function loadResources(input: string): Resource[];
15
34
  export declare function chunkResources(resources: Resource[]): Chunk[];
16
35
  //# sourceMappingURL=files.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/resources/files.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAY/C;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,EAAE,CAsBrD;AA6DD,wBAAgB,cAAc,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,CAiC7D"}
1
+ {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/resources/files.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAmB/C;;oDAEoD;AACpD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG;IACjD,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB,CAQA;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,EAAE,CAuDvD;AA6DD,wBAAgB,cAAc,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,CAiC7D"}
@@ -1,44 +1,101 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveCorpusInput = resolveCorpusInput;
3
4
  exports.loadResources = loadResources;
4
5
  exports.chunkResources = chunkResources;
5
6
  const fs = require("node:fs");
6
7
  const path = require("node:path");
8
+ const ignoreFactory = require("ignore");
7
9
  const lloyal_node_1 = require("@lloyal-labs/lloyal.node");
8
10
  const { parseMarkdown } = (0, lloyal_node_1.loadBinary)();
11
+ /** Pattern accepted in glob inputs — tail must be `.md`, `.mdx`, or
12
+ * `.{md,mdx}` (with optional ordering / overlap variants). Anything else
13
+ * is rejected — the corpus only handles markdown. */
14
+ const ACCEPTED_GLOB_TAIL = /\.(md|mdx|\{(?:md|mdx)(?:,(?:md|mdx))*\})$/;
15
+ const GLOB_CHARS = /[*?[\]{}]/;
16
+ /** Split a path-with-glob into a `cwd` (everything up to the first glob
17
+ * character's nearest preceding `/`) + a `pattern` (the rest). Plain
18
+ * paths return `{ cwd: input, pattern: null }`. */
19
+ function resolveCorpusInput(input) {
20
+ const m = input.match(GLOB_CHARS);
21
+ if (!m)
22
+ return { cwd: input, pattern: null };
23
+ const idx = m.index ?? 0;
24
+ const lastSep = input.lastIndexOf("/", idx);
25
+ const cwd = lastSep > 0 ? input.slice(0, lastSep) : "/";
26
+ const pattern = input.slice(lastSep + 1);
27
+ return { cwd, pattern };
28
+ }
9
29
  /**
10
- * Load documents from a directory (or single file) into {@link Resource} objects
30
+ * Load documents into {@link Resource} objects.
31
+ *
32
+ * Accepts three input shapes:
11
33
  *
12
- * If `dir` is a file path, returns a single-element array. If it is a
13
- * directory, reads all `.md` files within it. Exits the process with an
14
- * error message if the path does not exist or contains no Markdown files.
34
+ * 1. **Single file** (`/path/to/foo.md`) wrapped as one resource.
35
+ * 2. **Directory** (`/path/to/docs`) recursive `**\/*.{md,mdx}`. The
36
+ * `.gitignore` at the corpus root (if present) filters out vendored
37
+ * markdown (e.g. `node_modules`) the user already declared as
38
+ * ignored. To restrict to top-level only, pass `dir/*.md` explicitly.
39
+ * 3. **Glob pattern** (`/path/to/docs/*.md`, `/path/to/docs/sub/**\/*.md`,
40
+ * etc.) — the user controls scope. The pattern's tail must end in
41
+ * `.md`, `.mdx`, or `.{md,mdx}` — other extensions are rejected
42
+ * because the corpus only handles markdown. Quote the pattern in
43
+ * your shell to prevent shell expansion.
15
44
  *
16
- * @param dir - Absolute path to a directory of `.md` files or a single file
17
- * @returns Array of loaded resources with file name and content
45
+ * Honors `.gitignore` at the corpus root if present. No HDK-side opinions
46
+ * about which directories to skip; just respect what's already declared.
47
+ *
48
+ * Resource names preserve the relative path from the corpus root so
49
+ * nested files with the same basename don't collide.
18
50
  *
19
51
  * @category Rig
20
52
  */
21
- function loadResources(dir) {
22
- if (!fs.existsSync(dir)) {
23
- process.stdout.write(`Error: corpus not found: ${dir}\n`);
24
- process.exit(1);
53
+ function loadResources(input) {
54
+ const { cwd, pattern: rawPattern } = resolveCorpusInput(input);
55
+ let pattern;
56
+ if (rawPattern) {
57
+ // Glob input — validate extension, then use as-is.
58
+ if (!ACCEPTED_GLOB_TAIL.test(rawPattern)) {
59
+ process.stdout.write(`Error: only .md/.mdx files are supported. Got pattern: ${rawPattern}\n`);
60
+ process.exit(1);
61
+ }
62
+ pattern = rawPattern;
25
63
  }
26
- const stat = fs.statSync(dir);
27
- if (stat.isFile()) {
28
- return [
29
- { name: path.basename(dir), content: fs.readFileSync(dir, "utf8") },
30
- ];
64
+ else {
65
+ // Plain path — file or directory.
66
+ if (!fs.existsSync(cwd)) {
67
+ process.stdout.write(`Error: corpus not found: ${cwd}\n`);
68
+ process.exit(1);
69
+ }
70
+ const stat = fs.statSync(cwd);
71
+ if (stat.isFile()) {
72
+ if (!/\.(md|mdx)$/.test(cwd)) {
73
+ process.stdout.write(`Error: only .md/.mdx files are supported. Got: ${cwd}\n`);
74
+ process.exit(1);
75
+ }
76
+ return [
77
+ { name: path.basename(cwd), content: fs.readFileSync(cwd, "utf8") },
78
+ ];
79
+ }
80
+ // Directory: recursive walk. `.gitignore` is the user's declared
81
+ // exclusion list (no HDK opinion baked in) — vendored markdown
82
+ // already on the ignore list stays out. To restrict to top-level
83
+ // only, the user passes `dir/*.md` explicitly.
84
+ pattern = "**/*.{md,mdx}";
31
85
  }
32
- const files = fs
33
- .readdirSync(dir)
34
- .filter((f) => f.endsWith(".md") || f.endsWith(".mdx"));
86
+ const gitignorePath = path.join(cwd, ".gitignore");
87
+ const ig = fs.existsSync(gitignorePath)
88
+ ? ignoreFactory().add(fs.readFileSync(gitignorePath, "utf8"))
89
+ : null;
90
+ const all = fs.globSync(pattern, { cwd });
91
+ const files = (ig ? all.filter((f) => !ig.ignores(f)) : all).sort();
35
92
  if (!files.length) {
36
- process.stdout.write(`Error: no .md(x) files in: ${dir}\n`);
93
+ process.stdout.write(`Error: no .md(x) files matched: ${cwd}/${pattern}\n`);
37
94
  process.exit(1);
38
95
  }
39
- return files.map((f) => ({
40
- name: f,
41
- content: fs.readFileSync(path.join(dir, f), "utf8"),
96
+ return files.map((rel) => ({
97
+ name: rel,
98
+ content: fs.readFileSync(path.join(cwd, rel), "utf8"),
42
99
  }));
43
100
  }
44
101
  /** Split plain text into chunks on blank-line paragraph boundaries */
@@ -1 +1 @@
1
- {"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/resources/files.ts"],"names":[],"mappings":";;AA2BA,sCAsBC;AA6DD,wCAiCC;AA/ID,8BAA8B;AAC9B,kCAAkC;AAClC,0DAAsD;AAStD,MAAM,EAAE,aAAa,EAAE,GAAG,IAAA,wBAAU,GAEnC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,SAAgB,aAAa,CAAC,GAAW;IACvC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,4BAA4B,GAAG,IAAI,CAAC,CAAC;QAC1D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;QAClB,OAAO;YACL,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE;SACpE,CAAC;IACJ,CAAC;IACD,MAAM,KAAK,GAAG,EAAE;SACb,WAAW,CAAC,GAAG,CAAC;SAChB,MAAM,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AI,CAAC;YACrC,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO;gBACzB,CAAC,CAAC,gBAAgB,CAAC,YAAY,EAAE,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC;gBACxD,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;YACb,GAAG,CAAC,IAAI,CAAC;gBACP,QAAQ,EAAE,GAAG,CAAC,IAAI;gBAClB,OAAO,EAAE,IAAI;gBACb,OAAO;gBACP,IAAI;gBACJ,MAAM,EAAE,EAAE;gBACV,SAAS,EAAE,GAAG,CAAC,SAAS;gBACxB,OAAO,EAAE,GAAG,CAAC,OAAO;aACrB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -4,6 +4,6 @@
4
4
  * @packageDocumentation
5
5
  * @category Rig
6
6
  */
7
- export { loadResources, chunkResources } from './files';
7
+ export { loadResources, chunkResources, resolveCorpusInput } from './files';
8
8
  export type { Resource, Chunk } from './types';
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACxD,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC5E,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.chunkResources = exports.loadResources = void 0;
3
+ exports.resolveCorpusInput = exports.chunkResources = exports.loadResources = void 0;
4
4
  /**
5
5
  * Resource loading and chunking utilities
6
6
  *
@@ -10,4 +10,5 @@ exports.chunkResources = exports.loadResources = void 0;
10
10
  var files_1 = require("./files");
11
11
  Object.defineProperty(exports, "loadResources", { enumerable: true, get: function () { return files_1.loadResources; } });
12
12
  Object.defineProperty(exports, "chunkResources", { enumerable: true, get: function () { return files_1.chunkResources; } });
13
+ Object.defineProperty(exports, "resolveCorpusInput", { enumerable: true, get: function () { return files_1.resolveCorpusInput; } });
13
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,iCAAwD;AAA/C,sGAAA,aAAa,OAAA;AAAE,uGAAA,cAAc,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,iCAA4E;AAAnE,sGAAA,aAAa,OAAA;AAAE,uGAAA,cAAc,OAAA;AAAE,2GAAA,kBAAkB,OAAA"}
@@ -15,8 +15,11 @@ export interface DelegateToolOpts {
15
15
  argsSchema?: JsonSchema;
16
16
  /** Extract task strings from parsed tool arguments. */
17
17
  extractTasks?: (args: Record<string, unknown>) => string[];
18
- /** Pool options propagated to the inner agentPool call. */
19
- poolOpts: CreateAgentPoolOpts;
18
+ /** Pool options propagated to the inner agentPool call. Orchestrator is set
19
+ * by DelegateTool (one agent per extracted task, parallel). */
20
+ poolOpts: Omit<CreateAgentPoolOpts, 'orchestrate'>;
21
+ /** System prompt applied to each delegated sub-agent. */
22
+ systemPrompt: string;
20
23
  /** Factory for per-invocation policy. Called fresh each time the tool fires so time budgets start from delegation, not from pool setup. */
21
24
  createPolicy?: () => AgentPolicy;
22
25
  }
@@ -37,6 +40,7 @@ export declare class DelegateTool extends Tool<Record<string, unknown>> {
37
40
  readonly description: string;
38
41
  readonly parameters: JsonSchema;
39
42
  private _poolOpts;
43
+ private _systemPrompt;
40
44
  private _extractTasks;
41
45
  private _createPolicy?;
42
46
  constructor(opts: DelegateToolOpts);
@@ -1 +1 @@
1
- {"version":3,"file":"delegate.d.ts","sourceRoot":"","sources":["../../src/tools/delegate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EACL,IAAI,EAKL,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,WAAW,EAEZ,MAAM,4BAA4B,CAAC;AAEpC;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,iEAAiE;IACjE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,uDAAuD;IACvD,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,EAAE,CAAC;IAC3D,2DAA2D;IAC3D,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,2IAA2I;IAC3I,YAAY,CAAC,EAAE,MAAM,WAAW,CAAC;CAClC;AAcD;;;;;;;;;;;GAWG;AACH,qBAAa,YAAa,SAAQ,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAEhC,OAAO,CAAC,SAAS,CAAsB;IACvC,OAAO,CAAC,aAAa,CAA8C;IACnE,OAAO,CAAC,aAAa,CAAC,CAAoB;gBAE9B,IAAI,EAAE,gBAAgB;IAUjC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,C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,gBAAgB;IAWjC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC,OAAO,CAAC;CAuInF"}
@@ -31,6 +31,7 @@ class DelegateTool extends lloyal_agents_1.Tool {
31
31
  description;
32
32
  parameters;
33
33
  _poolOpts;
34
+ _systemPrompt;
34
35
  _extractTasks;
35
36
  _createPolicy;
36
37
  constructor(opts) {
@@ -40,6 +41,7 @@ class DelegateTool extends lloyal_agents_1.Tool {
40
41
  this.parameters = opts.argsSchema ?? DEFAULT_ARGS_SCHEMA;
41
42
  this._extractTasks = opts.extractTasks ?? ((args) => args.tasks);
42
43
  this._poolOpts = opts.poolOpts;
44
+ this._systemPrompt = opts.systemPrompt;
43
45
  this._createPolicy = opts.createPolicy;
44
46
  }
45
47
  *execute(args, context) {
@@ -153,7 +155,7 @@ class DelegateTool extends lloyal_agents_1.Tool {
153
155
  const pool = yield* (0, lloyal_agents_1.agentPool)({
154
156
  ...opts,
155
157
  ...(this._createPolicy ? { policy: this._createPolicy() } : {}),
156
- tasks: tasks.map(t => ({ systemPrompt: opts.systemPrompt, content: t })),
158
+ orchestrate: (0, lloyal_agents_1.parallel)(tasks.map(t => ({ systemPrompt: this._systemPrompt, content: t }))),
157
159
  parent: context?.branch,
158
160
  pruneOnReport: opts.pruneOnReport ?? true,
159
161
  scorer: context?.scorer,
@@ -1 +1 @@
1
- {"version":3,"file":"delegate.js","sourceRoot":"","sources":["../../src/tools/delegate.ts"],"names":[],"mappings":";;;AACA,yCAAiC;AACjC,8DAMoC;AA6BpC,MAAM,mBAAmB,GAAe;IACtC,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,KAAK,EAAE;YACL,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACzB,WAAW,EAAE,0CAA0C;SACxD;KACF;IACD,QAAQ,EAAE,CAAC,OAAO,CAA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C,EAAE,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC/D,WAAW,EAAE,IAAA,wBAAQ,EAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YACzF,MAAM,EAAE,OAAO,EAAE,MAAM;YACvB,aAAa,EAAE,IAAI,CAAC,aAAa,IAAI,IAAI;YACzC,MAAM,EAAE,OAAO,EAAE,MAAM;SACxB,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG;YACb,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;YACzD,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,IAAI,EAAE,CAAC;YAChE,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM;YAC9B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAClC,CAAC;QACF,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA5JD,oCA4JC"}
@@ -9,7 +9,7 @@ export { DelegateTool } from './delegate';
9
9
  export type { DelegateToolOpts } from './delegate';
10
10
  export type { SearchProvider, SearchResult, Reranker, ScoredChunk, ScoredResult } from './types';
11
11
  export { PlanTool, taskToContent } from './plan';
12
- export type { PlanResult, PlanQuestion, PlanToolOpts, ResearchTask } from './plan';
12
+ export type { PlanResult, PlanIntent, PlanToolOpts, ResearchTask } from './plan';
13
13
  /**
14
14
  * Shared singleton {@link ReportTool} instance.
15
15
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAIxC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACjG,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACjD,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEnF;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,YAAmB,CAAC;AAE3C;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAChC,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,QAAQ,EAAE,QAAQ,CAAC;CACpB,GAAG,OAAO,CAOV"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAIxC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACjG,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACjD,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEjF;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,YAAmB,CAAC;AAE3C;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAChC,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,QAAQ,EAAE,QAAQ,CAAC;CACpB,GAAG,OAAO,CAOV"}
@@ -23,13 +23,14 @@ export interface PlanToolOpts {
23
23
  /**
24
24
  * A structured research task produced by the planner.
25
25
  *
26
+ * Intent is a plan-level decision (see {@link PlanIntent}), not a per-task
27
+ * attribute — a task is always a research assignment when emitted.
28
+ *
26
29
  * @category Rig
27
30
  */
28
31
  export interface ResearchTask {
29
32
  /** What to find out — a specific, actionable research assignment. */
30
33
  description: string;
31
- /** Whether the task is answerable via research or needs user clarification. */
32
- intent: 'research' | 'clarify';
33
34
  }
34
35
  /**
35
36
  * Convert a ResearchTask to agent content string.
@@ -38,39 +39,43 @@ export interface ResearchTask {
38
39
  */
39
40
  export declare function taskToContent(task: ResearchTask): string;
40
41
  /**
41
- * A single sub-question produced by the planner with intent classification.
42
+ * Plan-level disposition for the user's query.
43
+ *
44
+ * - **clarify** — query is genuinely ambiguous; planner emits `clarifyQuestions`,
45
+ * harness returns to REPL for user input.
46
+ * - **passthrough** — query is a follow-up answerable from session.trunk's prior
47
+ * Q&A turns; harness skips research pipeline, streams answer from trunk, commits turn.
48
+ * - **research** — query needs full decomposition; planner emits `tasks`, harness
49
+ * runs the chain → synth → verify pipeline.
42
50
  *
43
- * @deprecated Use {@link ResearchTask} instead.
44
51
  * @category Rig
45
52
  */
46
- export interface PlanQuestion {
47
- /** The sub-question text. */
48
- text: string;
49
- /** Whether the question can be answered via research or needs user clarification. */
50
- intent: 'research' | 'clarify';
51
- }
53
+ export type PlanIntent = 'clarify' | 'passthrough' | 'research';
52
54
  /**
53
55
  * Output returned by {@link PlanTool} execution.
54
56
  *
55
57
  * @category Rig
56
58
  */
57
59
  export interface PlanResult {
58
- /** Structured research tasks with optional entry points. */
60
+ /** Plan-level disposition: how should the harness route this query? */
61
+ intent: PlanIntent;
62
+ /** Research tasks (non-empty when intent === 'research'; empty otherwise). */
59
63
  tasks: ResearchTask[];
60
- /** @deprecated Use tasks. Adapter maps tasks to the old PlanQuestion shape. */
61
- questions: PlanQuestion[];
64
+ /** Clarification questions for the user (non-empty when intent === 'clarify'; empty otherwise). */
65
+ clarifyQuestions: string[];
62
66
  /** Number of tokens generated during planning. */
63
67
  tokenCount: number;
64
68
  /** Wall-clock time for the planning pass in milliseconds. */
65
69
  timeMs: number;
66
70
  }
67
71
  /**
68
- * Grammar-constrained query decomposition and intent classification.
72
+ * Grammar-constrained query planner.
69
73
  *
70
- * Analyzes a research query and produces an array of {@link ResearchTask}
71
- * tasks, each classified as `"research"` (answerable via search)
72
- * or `"clarify"` (needs user input). Uses a JSON grammar to guarantee
73
- * structured output.
74
+ * Analyzes the user's query (with prior conversation in KV via warm session fork)
75
+ * and produces a {@link PlanResult} that commits to one disposition: clarify /
76
+ * passthrough / research. Uses a JSON grammar to guarantee structured output;
77
+ * the planner must choose one of the three intents and populate the matching
78
+ * fields (tasks for research, clarifyQuestions for clarify, neither for passthrough).
74
79
  *
75
80
  * @category Rig
76
81
  */
@@ -79,7 +84,7 @@ export declare class PlanTool extends Tool<{
79
84
  context?: string;
80
85
  }> {
81
86
  readonly name = "plan";
82
- readonly description = "Analyze a research query. Return research tasks classified as \"research\" (answerable via web search) or \"clarify\" (needs user input). Return empty array if the query is focused enough to research directly.";
87
+ readonly description = "Analyze a user query and decide how to handle it: ask for clarification, pass through for direct answer from conversation history, or decompose into research tasks.";
83
88
  readonly parameters: JsonSchema;
84
89
  private _prompt;
85
90
  private _session;
@@ -1 +1 @@
1
- {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/tools/plan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAyB,MAAM,4BAA4B,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,0GAA0G;IAC1G,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,8EAA8E;IAC9E,OAAO,EAAE,OAAO,CAAC;IACjB,uDAAuD;IACvD,YAAY,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,qEAAqE;IACrE,WAAW,EAAE,MAAM,CAA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CAAmC;IAClD,OAAO,CAAC,QAAQ,CAAU;IAC1B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,YAAY,CAAS;gBAEjB,IAAI,EAAE,YAAY;IAQ7B,OAAO,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC,OAAO,CAAC;CA4ExE"}
@@ -12,18 +12,19 @@ function taskToContent(task) {
12
12
  return task.description;
13
13
  }
14
14
  /**
15
- * Grammar-constrained query decomposition and intent classification.
15
+ * Grammar-constrained query planner.
16
16
  *
17
- * Analyzes a research query and produces an array of {@link ResearchTask}
18
- * tasks, each classified as `"research"` (answerable via search)
19
- * or `"clarify"` (needs user input). Uses a JSON grammar to guarantee
20
- * structured output.
17
+ * Analyzes the user's query (with prior conversation in KV via warm session fork)
18
+ * and produces a {@link PlanResult} that commits to one disposition: clarify /
19
+ * passthrough / research. Uses a JSON grammar to guarantee structured output;
20
+ * the planner must choose one of the three intents and populate the matching
21
+ * fields (tasks for research, clarifyQuestions for clarify, neither for passthrough).
21
22
  *
22
23
  * @category Rig
23
24
  */
24
25
  class PlanTool extends lloyal_agents_1.Tool {
25
26
  name = 'plan';
26
- description = 'Analyze a research query. Return research tasks classified as "research" (answerable via web search) or "clarify" (needs user input). Return empty array if the query is focused enough to research directly.';
27
+ description = 'Analyze a user query and decide how to handle it: ask for clarification, pass through for direct answer from conversation history, or decompose into research tasks.';
27
28
  parameters = {
28
29
  type: 'object',
29
30
  properties: {
@@ -48,20 +49,24 @@ class PlanTool extends lloyal_agents_1.Tool {
48
49
  const schema = {
49
50
  type: 'object',
50
51
  properties: {
52
+ intent: { type: 'string', enum: ['clarify', 'passthrough', 'research'] },
51
53
  tasks: {
52
54
  type: 'array',
53
55
  items: {
54
56
  type: 'object',
55
57
  properties: {
56
58
  description: { type: 'string' },
57
- intent: { type: 'string', enum: ['research', 'clarify'] },
58
59
  },
59
- required: ['description', 'intent'],
60
+ required: ['description'],
60
61
  },
61
62
  maxItems: this._maxQuestions,
62
63
  },
64
+ clarifyQuestions: {
65
+ type: 'array',
66
+ items: { type: 'string' },
67
+ },
63
68
  },
64
- required: ['tasks'],
69
+ required: ['intent'],
65
70
  };
66
71
  const userContent = (0, lloyal_agents_1.renderTemplate)(this._prompt.user, {
67
72
  query: args.query,
@@ -79,20 +84,27 @@ class PlanTool extends lloyal_agents_1.Tool {
79
84
  const tokenCount = planAgent.tokenCount;
80
85
  try {
81
86
  const parsed = JSON.parse(planAgent.rawOutput);
82
- const raw = (parsed.tasks || []);
83
- const tasks = raw
87
+ const intent = parsed.intent === 'clarify' || parsed.intent === 'passthrough' || parsed.intent === 'research'
88
+ ? parsed.intent
89
+ : 'research';
90
+ const tasks = (parsed.tasks ?? [])
84
91
  .slice(0, this._maxQuestions)
85
- .filter(t => typeof t.description === 'string' && (t.intent === 'research' || t.intent === 'clarify'))
86
- .map(t => ({
87
- description: t.description,
88
- intent: t.intent,
89
- }));
90
- // Adapter: populate deprecated questions from tasks
91
- const questions = tasks.map(t => ({ text: t.description, intent: t.intent }));
92
- return { tasks, questions, tokenCount, timeMs };
92
+ .filter(t => typeof t.description === 'string')
93
+ .map(t => ({ description: t.description }));
94
+ const clarifyQuestions = (parsed.clarifyQuestions ?? []).filter(q => typeof q === 'string');
95
+ return { intent, tasks, clarifyQuestions, tokenCount, timeMs };
93
96
  }
94
97
  catch {
95
- return { tasks: [], questions: [], tokenCount, timeMs };
98
+ // Grammar should prevent this; fall through to passthrough on malformed output
99
+ // so the harness routes to a direct trunk-stream answer rather than running a
100
+ // research pipeline with no real plan.
101
+ return {
102
+ intent: 'passthrough',
103
+ tasks: [],
104
+ clarifyQuestions: [],
105
+ tokenCount,
106
+ timeMs,
107
+ };
96
108
  }
97
109
  }
98
110
  }
@@ -1 +1 @@
1
- {"version":3,"file":"plan.js","sourceRoot":"","sources":["../../src/tools/plan.ts"],"names":[],"mappings":";;;AAsCA,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AA+E;YAC/E,8EAA8E;YAC9E,uCAAuC;YACvC,OAAO;gBACL,MAAM,EAAE,aAAa;gBACrB,KAAK,EAAE,EAAE;gBACT,gBAAgB,EAAE,EAAE;gBACpB,UAAU;gBACV,MAAM;aACc,CAAC;QACzB,CAAC;IACH,CAAC;CACF;AArGD,4BAqGC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lloyal-labs/rig",
3
- "version": "1.7.0",
3
+ "version": "2.0.1",
4
4
  "description": "Retrieval-Interleaved Generation for lloyal-agents",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -19,12 +19,12 @@
19
19
  },
20
20
  "repository": {
21
21
  "type": "git",
22
- "url": "git+https://github.com/lloyal-ai/sdk.git",
22
+ "url": "git+https://github.com/lloyal-ai/hdk.git",
23
23
  "directory": "packages/rig"
24
24
  },
25
- "homepage": "https://github.com/lloyal-ai/sdk/tree/main/packages/rig#readme",
25
+ "homepage": "https://github.com/lloyal-ai/hdk/tree/main/packages/rig#readme",
26
26
  "bugs": {
27
- "url": "https://github.com/lloyal-ai/sdk/issues"
27
+ "url": "https://github.com/lloyal-ai/hdk/issues"
28
28
  },
29
29
  "keywords": [
30
30
  "llm",
@@ -40,10 +40,11 @@
40
40
  "build": "tsc -b"
41
41
  },
42
42
  "dependencies": {
43
- "@lloyal-labs/lloyal-agents": "^1.7.0",
44
- "@lloyal-labs/sdk": "^1.7.0",
43
+ "@lloyal-labs/lloyal-agents": "^2.0.0",
44
+ "@lloyal-labs/sdk": "^2.0.0",
45
45
  "@mozilla/readability": "^0.6.0",
46
46
  "effection": "^4.0.2",
47
+ "ignore": "^7.0.5",
47
48
  "linkedom": "^0.18.12"
48
49
  },
49
50
  "peerDependencies": {