@agent-api/sdk 1.4.6 → 1.4.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog — @agent-api/sdk
2
2
 
3
+ ## 1.4.7
4
+
5
+ ### Added
6
+
7
+ - Added warning-aware low-level local workdir listing via `listWithWarnings()`.
8
+
9
+ ### Fixed
10
+
11
+ - Made local context packages use bounded recursive scans and expose `scan_warnings` for skipped child paths.
12
+
3
13
  ## 1.4.6
4
14
 
5
15
  ### Fixed
@@ -1,4 +1,4 @@
1
- import { type LocalFileDeliver, type LocalGrepResponse, type LocalPathSensitivity, type LocalPathSensitivityInfo, type LocalSummary, type LocalWorkdir, type LocalWorkdirSnapshotFile } from "./core.js";
1
+ import { type LocalFileDeliver, type LocalGrepResponse, type LocalPathSensitivity, type LocalPathSensitivityInfo, type LocalScanWarning, type LocalSummary, type LocalWorkdir, type LocalWorkdirSnapshotFile } from "./core.js";
2
2
  export interface LocalContextPackageParams {
3
3
  path?: string;
4
4
  include?: string[];
@@ -7,6 +7,7 @@ export interface LocalContextPackageParams {
7
7
  maxFiles?: number;
8
8
  maxBytes?: number;
9
9
  maxBytesPerFile?: number;
10
+ maxDepth?: number;
10
11
  previewBytes?: number;
11
12
  includeContent?: boolean;
12
13
  includeHashes?: boolean;
@@ -38,6 +39,7 @@ export interface LocalContextManifest {
38
39
  included_bytes: number;
39
40
  truncated: boolean;
40
41
  files: LocalContextFile[];
42
+ scan_warnings?: LocalScanWarning[];
41
43
  summary?: LocalSummary;
42
44
  search?: LocalGrepResponse;
43
45
  }
@@ -6,13 +6,14 @@ export async function createLocalContextPackage(workdir, params = {}) {
6
6
  const maxFiles = positiveInt(params.maxFiles, 80);
7
7
  const maxBytes = positiveInt(params.maxBytes, 256 * 1024);
8
8
  const maxBytesPerFile = positiveInt(params.maxBytesPerFile, 32 * 1024);
9
+ const maxDepth = positiveInt(params.maxDepth, 3);
9
10
  const previewBytes = positiveInt(params.previewBytes, maxBytesPerFile);
10
11
  const includeContent = params.includeContent ?? true;
11
12
  const includeHashes = params.includeHashes ?? true;
12
13
  const includeSummary = params.includeSummary ?? true;
13
14
  const includeSearch = Boolean(params.includeSearch && params.query?.trim());
14
15
  const includeSecrets = params.includeSecrets ?? false;
15
- const stats = await workdir.list(basePath, { recursive: true });
16
+ const { stats, warnings } = await workdir.listWithWarnings(basePath, { recursive: true, maxDepth });
16
17
  const fileStats = stats
17
18
  .filter((item) => item.type === "file")
18
19
  .filter((item) => matchesPathFilters(item.path, params.include, params.exclude))
@@ -75,6 +76,7 @@ export async function createLocalContextPackage(workdir, params = {}) {
75
76
  ? await workdir.summarize({
76
77
  path: basePath,
77
78
  maxFiles,
79
+ maxDepth,
78
80
  previewBytes,
79
81
  ignore: params.exclude,
80
82
  })
@@ -99,6 +101,7 @@ export async function createLocalContextPackage(workdir, params = {}) {
99
101
  included_bytes: includedBytes,
100
102
  truncated,
101
103
  files,
104
+ scan_warnings: warnings.length ? warnings : undefined,
102
105
  summary,
103
106
  search,
104
107
  };
@@ -68,6 +68,10 @@ export interface LocalEntryList {
68
68
  entries: LocalEntry[];
69
69
  scan_warnings?: LocalScanWarning[];
70
70
  }
71
+ export interface LocalFileStatList {
72
+ stats: LocalFileStat[];
73
+ warnings: LocalScanWarning[];
74
+ }
71
75
  export interface LocalScanWarning {
72
76
  path: string;
73
77
  code?: string;
@@ -286,6 +290,7 @@ export declare class LocalFileStore {
286
290
  stat(relativePath?: string): Promise<LocalFileStat>;
287
291
  mkdir(relativePath?: string): Promise<string>;
288
292
  list(relativePath?: string, options?: LocalListOptions): Promise<LocalFileStat[]>;
293
+ listWithWarnings(relativePath?: string, options?: LocalListOptions): Promise<LocalFileStatList>;
289
294
  listEntries(relativePath?: string, options?: LocalListOptions): Promise<LocalEntryList>;
290
295
  searchEntries(params: LocalSearchEntriesParams): Promise<LocalEntryList>;
291
296
  readText(relativePath: string): Promise<string>;
@@ -317,7 +322,6 @@ export declare class LocalFileStore {
317
322
  grep(params: LocalGrepParams): Promise<LocalGrepResponse>;
318
323
  private grepCandidates;
319
324
  summarize(params?: LocalSummarizeParams): Promise<LocalSummary>;
320
- private listWithWarnings;
321
325
  private walk;
322
326
  }
323
327
  export declare class LocalConfigStore {
@@ -348,6 +352,7 @@ export declare class LocalWorkdir {
348
352
  child(relativePath: string, options?: LocalWorkdirOptions): LocalWorkdir;
349
353
  resolvePath(relativePath?: string): string;
350
354
  list(relativePath?: string, options?: LocalListOptions): Promise<LocalFileStat[]>;
355
+ listWithWarnings(relativePath?: string, options?: LocalListOptions): Promise<LocalFileStatList>;
351
356
  listEntries(relativePath?: string, options?: LocalListOptions): Promise<LocalEntryList>;
352
357
  searchEntries(params: LocalSearchEntriesParams): Promise<LocalEntryList>;
353
358
  readFile(relativePath: string, params: LocalReadFileRawParams): Promise<LocalFileRaw>;
@@ -141,6 +141,14 @@ export class LocalFileStore {
141
141
  async list(relativePath = ".", options = {}) {
142
142
  return (await this.listWithWarnings(relativePath, options)).stats;
143
143
  }
144
+ async listWithWarnings(relativePath = ".", options = {}) {
145
+ const base = this.resolvePath(relativePath);
146
+ const maxDepth = options.recursive ? options.maxDepth ?? Number.POSITIVE_INFINITY : 1;
147
+ const out = [];
148
+ const warnings = [];
149
+ await this.walk(this.root, base, base, out, maxDepth, options, warnings);
150
+ return { stats: out.sort((a, b) => a.path.localeCompare(b.path)), warnings };
151
+ }
144
152
  async listEntries(relativePath = ".", options = {}) {
145
153
  const { stats, warnings } = await this.listWithWarnings(relativePath, { ...options, includeDirectories: options.includeDirectories ?? true });
146
154
  return withScanWarnings({ object: "list", entries: stats.map(localEntryFromStat) }, warnings);
@@ -408,14 +416,6 @@ export class LocalFileStore {
408
416
  scan_truncated: scanTruncated,
409
417
  }, warnings);
410
418
  }
411
- async listWithWarnings(relativePath = ".", options = {}) {
412
- const base = this.resolvePath(relativePath);
413
- const maxDepth = options.recursive ? options.maxDepth ?? Number.POSITIVE_INFINITY : 1;
414
- const out = [];
415
- const warnings = [];
416
- await this.walk(this.root, base, base, out, maxDepth, options, warnings);
417
- return { stats: out.sort((a, b) => a.path.localeCompare(b.path)), warnings };
418
- }
419
419
  async walk(storeRoot, scanRoot, dir, out, maxDepth, options, warnings) {
420
420
  let entries;
421
421
  try {
@@ -562,6 +562,9 @@ export class LocalWorkdir {
562
562
  async list(relativePath = ".", options = {}) {
563
563
  return await this.files.list(relativePath, this.scopedListOptions(options));
564
564
  }
565
+ async listWithWarnings(relativePath = ".", options = {}) {
566
+ return await this.files.listWithWarnings(relativePath, this.scopedListOptions(options));
567
+ }
565
568
  async listEntries(relativePath = ".", options = {}) {
566
569
  return await this.files.listEntries(relativePath, this.scopedListOptions(options));
567
570
  }
@@ -255,6 +255,7 @@ function contextPackageArgs(args) {
255
255
  maxFiles: optionalNumberArg(args, "maxFiles", "max_files"),
256
256
  maxBytes: optionalNumberArg(args, "maxBytes", "max_bytes"),
257
257
  maxBytesPerFile: optionalNumberArg(args, "maxBytesPerFile", "max_bytes_per_file"),
258
+ maxDepth: optionalNumberArg(args, "maxDepth", "max_depth"),
258
259
  includeContent: optionalBooleanArg(args, "includeContent", "include_content"),
259
260
  includeSummary: optionalBooleanArg(args, "includeSummary", "include_summary"),
260
261
  includeSearch: optionalBooleanArg(args, "includeSearch", "include_search"),
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.4.6";
2
- export declare const USER_AGENT = "@agent-api/sdk/1.4.6";
1
+ export declare const VERSION = "1.4.7";
2
+ export declare const USER_AGENT = "@agent-api/sdk/1.4.7";
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = "1.4.6";
1
+ export const VERSION = "1.4.7";
2
2
  export const USER_AGENT = `@agent-api/sdk/${VERSION}`;
@@ -10,13 +10,14 @@ async function createLocalContextPackage(workdir, params = {}) {
10
10
  const maxFiles = positiveInt(params.maxFiles, 80);
11
11
  const maxBytes = positiveInt(params.maxBytes, 256 * 1024);
12
12
  const maxBytesPerFile = positiveInt(params.maxBytesPerFile, 32 * 1024);
13
+ const maxDepth = positiveInt(params.maxDepth, 3);
13
14
  const previewBytes = positiveInt(params.previewBytes, maxBytesPerFile);
14
15
  const includeContent = params.includeContent ?? true;
15
16
  const includeHashes = params.includeHashes ?? true;
16
17
  const includeSummary = params.includeSummary ?? true;
17
18
  const includeSearch = Boolean(params.includeSearch && params.query?.trim());
18
19
  const includeSecrets = params.includeSecrets ?? false;
19
- const stats = await workdir.list(basePath, { recursive: true });
20
+ const { stats, warnings } = await workdir.listWithWarnings(basePath, { recursive: true, maxDepth });
20
21
  const fileStats = stats
21
22
  .filter((item) => item.type === "file")
22
23
  .filter((item) => matchesPathFilters(item.path, params.include, params.exclude))
@@ -79,6 +80,7 @@ async function createLocalContextPackage(workdir, params = {}) {
79
80
  ? await workdir.summarize({
80
81
  path: basePath,
81
82
  maxFiles,
83
+ maxDepth,
82
84
  previewBytes,
83
85
  ignore: params.exclude,
84
86
  })
@@ -103,6 +105,7 @@ async function createLocalContextPackage(workdir, params = {}) {
103
105
  included_bytes: includedBytes,
104
106
  truncated,
105
107
  files,
108
+ scan_warnings: warnings.length ? warnings : undefined,
106
109
  summary,
107
110
  search,
108
111
  };
@@ -156,6 +156,14 @@ class LocalFileStore {
156
156
  async list(relativePath = ".", options = {}) {
157
157
  return (await this.listWithWarnings(relativePath, options)).stats;
158
158
  }
159
+ async listWithWarnings(relativePath = ".", options = {}) {
160
+ const base = this.resolvePath(relativePath);
161
+ const maxDepth = options.recursive ? options.maxDepth ?? Number.POSITIVE_INFINITY : 1;
162
+ const out = [];
163
+ const warnings = [];
164
+ await this.walk(this.root, base, base, out, maxDepth, options, warnings);
165
+ return { stats: out.sort((a, b) => a.path.localeCompare(b.path)), warnings };
166
+ }
159
167
  async listEntries(relativePath = ".", options = {}) {
160
168
  const { stats, warnings } = await this.listWithWarnings(relativePath, { ...options, includeDirectories: options.includeDirectories ?? true });
161
169
  return withScanWarnings({ object: "list", entries: stats.map(localEntryFromStat) }, warnings);
@@ -423,14 +431,6 @@ class LocalFileStore {
423
431
  scan_truncated: scanTruncated,
424
432
  }, warnings);
425
433
  }
426
- async listWithWarnings(relativePath = ".", options = {}) {
427
- const base = this.resolvePath(relativePath);
428
- const maxDepth = options.recursive ? options.maxDepth ?? Number.POSITIVE_INFINITY : 1;
429
- const out = [];
430
- const warnings = [];
431
- await this.walk(this.root, base, base, out, maxDepth, options, warnings);
432
- return { stats: out.sort((a, b) => a.path.localeCompare(b.path)), warnings };
433
- }
434
434
  async walk(storeRoot, scanRoot, dir, out, maxDepth, options, warnings) {
435
435
  let entries;
436
436
  try {
@@ -580,6 +580,9 @@ class LocalWorkdir {
580
580
  async list(relativePath = ".", options = {}) {
581
581
  return await this.files.list(relativePath, this.scopedListOptions(options));
582
582
  }
583
+ async listWithWarnings(relativePath = ".", options = {}) {
584
+ return await this.files.listWithWarnings(relativePath, this.scopedListOptions(options));
585
+ }
583
586
  async listEntries(relativePath = ".", options = {}) {
584
587
  return await this.files.listEntries(relativePath, this.scopedListOptions(options));
585
588
  }
@@ -262,6 +262,7 @@ function contextPackageArgs(args) {
262
262
  maxFiles: optionalNumberArg(args, "maxFiles", "max_files"),
263
263
  maxBytes: optionalNumberArg(args, "maxBytes", "max_bytes"),
264
264
  maxBytesPerFile: optionalNumberArg(args, "maxBytesPerFile", "max_bytes_per_file"),
265
+ maxDepth: optionalNumberArg(args, "maxDepth", "max_depth"),
265
266
  includeContent: optionalBooleanArg(args, "includeContent", "include_content"),
266
267
  includeSummary: optionalBooleanArg(args, "includeSummary", "include_summary"),
267
268
  includeSearch: optionalBooleanArg(args, "includeSearch", "include_search"),
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.USER_AGENT = exports.VERSION = void 0;
4
- exports.VERSION = "1.4.6";
4
+ exports.VERSION = "1.4.7";
5
5
  exports.USER_AGENT = `@agent-api/sdk/${exports.VERSION}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-api/sdk",
3
- "version": "1.4.6",
3
+ "version": "1.4.7",
4
4
  "description": "Production JavaScript SDK for the Managed Agent API",
5
5
  "license": "MIT",
6
6
  "repository": {