@shanepadgett/tau-agent 0.24.0 → 0.25.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.
@@ -125,10 +125,12 @@ export function createAstTools(client: AstClient, rowState: ToolRowStateStore) {
125
125
  return `${indent}${lines}(${locator(entry, path)}): ${label}`;
126
126
  }
127
127
 
128
- function renderOutlineFile(file: OutlineFileResult, cwd: string): string[] {
129
- const lines = [
130
- `${formatPathForDisplay(file.path, cwd)} (${file.language}, ${file.lineCount} lines, ${formatSize(file.byteLength)})`,
131
- ];
128
+ function renderOutlineFile(file: OutlineFileResult, cwd: string, includeHeader: boolean): string[] {
129
+ const lines = includeHeader
130
+ ? [
131
+ `${formatPathForDisplay(file.path, cwd)} (${file.language}, ${file.lineCount} lines, ${formatSize(file.byteLength)})`,
132
+ ]
133
+ : [];
132
134
  if (file.diagnostics.errorNodes > 0 || file.diagnostics.missingNodes > 0) {
133
135
  lines.push(
134
136
  `warning: parser recovered with ${file.diagnostics.errorNodes} ERROR and ${file.diagnostics.missingNodes} MISSING nodes`,
@@ -144,7 +146,8 @@ export function createAstTools(client: AstClient, rowState: ToolRowStateStore) {
144
146
  else groups.set(key, [item]);
145
147
  }
146
148
  for (const [label, items] of groups) {
147
- lines.push("", label);
149
+ if (lines.length > 0) lines.push("");
150
+ lines.push(label);
148
151
  for (const item of items) {
149
152
  lines.push(renderEntry(item, file.path, file.language, ""));
150
153
  for (const member of item.members) {
@@ -178,7 +181,7 @@ export function createAstTools(client: AstClient, rowState: ToolRowStateStore) {
178
181
  const result = await client.outline(target, params.includePrivate ?? false, names, signal);
179
182
  const lines = result.files.flatMap((file, index) => [
180
183
  ...(index === 0 ? [] : [""]),
181
- ...renderOutlineFile(file, ctx.cwd),
184
+ ...renderOutlineFile(file, ctx.cwd, result.files.length > 1),
182
185
  ]);
183
186
  const declarationCount = result.files.reduce(
184
187
  (count, file) =>
@@ -219,7 +222,7 @@ export function createAstTools(client: AstClient, rowState: ToolRowStateStore) {
219
222
  promptSnippet: "Retrieve exact declaration source for several outline locators",
220
223
  parameters: symbolParams,
221
224
  async execute(_toolCallId, params, signal, _onUpdate, ctx) {
222
- const records = params.locators.map((id) => {
225
+ const records = [...new Set(params.locators)].map((id) => {
223
226
  const record = locators.get(id);
224
227
  if (!record) throw new Error(`Unknown symbol locator: ${id}. Run outline again.`);
225
228
  if (record.stale) throw new Error(`Symbol locator ${id} is stale. Run outline again.`);
@@ -230,14 +233,19 @@ export function createAstTools(client: AstClient, rowState: ToolRowStateStore) {
230
233
  params.contextLines ?? 0,
231
234
  signal,
232
235
  );
233
- const requestedByToken = new Map(records.map((record) => [record.token, record]));
236
+ const requestedByToken = new Map<string, LocatorRecord[]>();
237
+ for (const record of records) {
238
+ const requested = requestedByToken.get(record.token);
239
+ if (requested) requested.push(record);
240
+ else requestedByToken.set(record.token, [record]);
241
+ }
234
242
  const lines: string[] = [];
243
+ const includePaths = new Set(result.blocks.map((block) => block.path)).size > 1;
235
244
  for (const [blockIndex, block] of result.blocks.entries()) {
236
245
  if (blockIndex > 0) lines.push("");
237
246
  const represented = block.declarationIndexes.flatMap((index) => {
238
247
  const declaration = result.declarations[index];
239
- const record = declaration ? requestedByToken.get(declaration.locator) : undefined;
240
- return record ? [record] : [];
248
+ return declaration ? (requestedByToken.get(declaration.locator) ?? []) : [];
241
249
  });
242
250
  const range = block.returnedRange;
243
251
  const lineRange =
@@ -245,7 +253,7 @@ export function createAstTools(client: AstClient, rowState: ToolRowStateStore) {
245
253
  ? `${range.start.line + 1}`
246
254
  : `${range.start.line + 1}-${range.end.line + 1}`;
247
255
  lines.push(
248
- formatPathForDisplay(block.path, ctx.cwd),
256
+ ...(includePaths ? [formatPathForDisplay(block.path, ctx.cwd)] : []),
249
257
  `${lineRange}(${represented.map((record) => record.id).join(",")}): ${represented.map((record) => record.name).join(", ")}`,
250
258
  block.source,
251
259
  );
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shanepadgett/tau-agent",
3
- "version": "0.24.0",
3
+ "version": "0.25.1",
4
4
  "description": "Tau is a custom agentic harness built with pi extensions",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -35,7 +35,7 @@
35
35
  "README.md"
36
36
  ],
37
37
  "dependencies": {
38
- "@shanepadgett/tau-tui": "0.24.0",
38
+ "@shanepadgett/tau-tui": "0.25.1",
39
39
  "@toon-format/toon": "2.3.0",
40
40
  "image-size": "2.0.2",
41
41
  "smol-toml": "1.7.0"