@supyagent/sdk 0.2.1 → 0.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/dist/index.cjs +501 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +191 -1
- package/dist/index.d.ts +191 -1
- package/dist/index.js +495 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -356,4 +356,194 @@ declare function createLoadSkillTool(skills: ParsedSkill[]): ai.Tool<unknown, {
|
|
|
356
356
|
*/
|
|
357
357
|
declare function createApiCallTool(baseUrl: string, apiKey: string, accountId?: string): ai.Tool<unknown, any>;
|
|
358
358
|
|
|
359
|
-
|
|
359
|
+
interface EditFileToolOptions {
|
|
360
|
+
/** Base directory for resolving relative paths. Defaults to `process.cwd()`. */
|
|
361
|
+
cwd?: string;
|
|
362
|
+
/** Maximum file size in bytes that can be edited. Defaults to 1MB. */
|
|
363
|
+
maxFileSize?: number;
|
|
364
|
+
}
|
|
365
|
+
interface EditFileToolResult {
|
|
366
|
+
path: string;
|
|
367
|
+
replacements: number;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Create an editFile tool that patches files using search-and-replace.
|
|
371
|
+
*
|
|
372
|
+
* Unlike a full-file write, this lets the LLM send only the changed sections,
|
|
373
|
+
* saving tokens and reducing the risk of accidentally dropping content.
|
|
374
|
+
*
|
|
375
|
+
* @example
|
|
376
|
+
* ```ts
|
|
377
|
+
* import { createEditFileTool } from '@supyagent/sdk';
|
|
378
|
+
*
|
|
379
|
+
* const tools = {
|
|
380
|
+
* editFile: createEditFileTool({ cwd: '/path/to/project' }),
|
|
381
|
+
* };
|
|
382
|
+
* ```
|
|
383
|
+
*/
|
|
384
|
+
declare function createEditFileTool(options?: EditFileToolOptions): ai.Tool<unknown, EditFileToolResult | {
|
|
385
|
+
error: string;
|
|
386
|
+
currentContent?: string;
|
|
387
|
+
}>;
|
|
388
|
+
|
|
389
|
+
interface GrepToolOptions {
|
|
390
|
+
/** Base directory for searching. Defaults to `process.cwd()`. */
|
|
391
|
+
cwd?: string;
|
|
392
|
+
/** Timeout in milliseconds. Defaults to 15000 (15s). */
|
|
393
|
+
timeout?: number;
|
|
394
|
+
/** Maximum output length in characters. Defaults to 30000. */
|
|
395
|
+
maxOutput?: number;
|
|
396
|
+
}
|
|
397
|
+
interface GrepToolResult {
|
|
398
|
+
matches: string;
|
|
399
|
+
matchCount: number;
|
|
400
|
+
truncated: boolean;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Create a grep tool for searching file contents by pattern.
|
|
404
|
+
*
|
|
405
|
+
* Uses `grep -rn` (or `rg` if available) under the hood.
|
|
406
|
+
* Returns matching lines with file paths and line numbers.
|
|
407
|
+
*
|
|
408
|
+
* @example
|
|
409
|
+
* ```ts
|
|
410
|
+
* import { createGrepTool } from '@supyagent/sdk';
|
|
411
|
+
*
|
|
412
|
+
* const tools = {
|
|
413
|
+
* grep: createGrepTool({ cwd: '/path/to/project' }),
|
|
414
|
+
* };
|
|
415
|
+
* ```
|
|
416
|
+
*/
|
|
417
|
+
declare function createGrepTool(options?: GrepToolOptions): ai.Tool<unknown, GrepToolResult | {
|
|
418
|
+
error: string;
|
|
419
|
+
}>;
|
|
420
|
+
|
|
421
|
+
interface FindToolOptions {
|
|
422
|
+
/** Base directory for searching. Defaults to `process.cwd()`. */
|
|
423
|
+
cwd?: string;
|
|
424
|
+
/** Timeout in milliseconds. Defaults to 15000 (15s). */
|
|
425
|
+
timeout?: number;
|
|
426
|
+
/** Maximum output length in characters. Defaults to 30000. */
|
|
427
|
+
maxOutput?: number;
|
|
428
|
+
}
|
|
429
|
+
interface FindToolResult {
|
|
430
|
+
files: string[];
|
|
431
|
+
count: number;
|
|
432
|
+
truncated: boolean;
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Create a find tool for discovering files by name or glob pattern.
|
|
436
|
+
*
|
|
437
|
+
* Uses `find` under the hood with common ignore patterns
|
|
438
|
+
* (node_modules, .git, dist, etc.) pre-configured.
|
|
439
|
+
*
|
|
440
|
+
* @example
|
|
441
|
+
* ```ts
|
|
442
|
+
* import { createFindTool } from '@supyagent/sdk';
|
|
443
|
+
*
|
|
444
|
+
* const tools = {
|
|
445
|
+
* find: createFindTool({ cwd: '/path/to/project' }),
|
|
446
|
+
* };
|
|
447
|
+
* ```
|
|
448
|
+
*/
|
|
449
|
+
declare function createFindTool(options?: FindToolOptions): ai.Tool<unknown, FindToolResult | {
|
|
450
|
+
error: string;
|
|
451
|
+
}>;
|
|
452
|
+
|
|
453
|
+
interface ReadFileRangeToolOptions {
|
|
454
|
+
/** Base directory for resolving relative paths. Defaults to `process.cwd()`. */
|
|
455
|
+
cwd?: string;
|
|
456
|
+
/** Maximum number of lines that can be requested at once. Defaults to 200. */
|
|
457
|
+
maxLines?: number;
|
|
458
|
+
}
|
|
459
|
+
interface ReadFileRangeToolResult {
|
|
460
|
+
path: string;
|
|
461
|
+
content: string;
|
|
462
|
+
startLine: number;
|
|
463
|
+
endLine: number;
|
|
464
|
+
totalLines: number;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Create a readFileRange tool that reads specific line ranges from files.
|
|
468
|
+
*
|
|
469
|
+
* More token-efficient than reading entire files — especially useful
|
|
470
|
+
* after a grep to read context around a match.
|
|
471
|
+
*
|
|
472
|
+
* @example
|
|
473
|
+
* ```ts
|
|
474
|
+
* import { createReadFileRangeTool } from '@supyagent/sdk';
|
|
475
|
+
*
|
|
476
|
+
* const tools = {
|
|
477
|
+
* readFileRange: createReadFileRangeTool({ cwd: '/path/to/project' }),
|
|
478
|
+
* };
|
|
479
|
+
* ```
|
|
480
|
+
*/
|
|
481
|
+
declare function createReadFileRangeTool(options?: ReadFileRangeToolOptions): ai.Tool<unknown, ReadFileRangeToolResult | {
|
|
482
|
+
error: string;
|
|
483
|
+
}>;
|
|
484
|
+
|
|
485
|
+
interface AppendFileToolOptions {
|
|
486
|
+
/** Base directory for resolving relative paths. Defaults to `process.cwd()`. */
|
|
487
|
+
cwd?: string;
|
|
488
|
+
}
|
|
489
|
+
interface AppendFileToolResult {
|
|
490
|
+
path: string;
|
|
491
|
+
bytesAppended: number;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Create an appendFile tool that appends content to existing files.
|
|
495
|
+
*
|
|
496
|
+
* More token-efficient than read-concat-write for incremental file building
|
|
497
|
+
* (logs, CSVs, reports). Creates the file if it doesn't exist.
|
|
498
|
+
*
|
|
499
|
+
* @example
|
|
500
|
+
* ```ts
|
|
501
|
+
* import { createAppendFileTool } from '@supyagent/sdk';
|
|
502
|
+
*
|
|
503
|
+
* const tools = {
|
|
504
|
+
* appendFile: createAppendFileTool({ cwd: '/path/to/project' }),
|
|
505
|
+
* };
|
|
506
|
+
* ```
|
|
507
|
+
*/
|
|
508
|
+
declare function createAppendFileTool(options?: AppendFileToolOptions): ai.Tool<unknown, AppendFileToolResult | {
|
|
509
|
+
error: string;
|
|
510
|
+
}>;
|
|
511
|
+
|
|
512
|
+
interface HttpRequestToolOptions {
|
|
513
|
+
/** Default timeout in milliseconds. Defaults to 30000 (30s). */
|
|
514
|
+
timeout?: number;
|
|
515
|
+
/** Maximum response body size in characters. Defaults to 100000. */
|
|
516
|
+
maxResponseSize?: number;
|
|
517
|
+
/** Default headers to include in every request. */
|
|
518
|
+
defaultHeaders?: Record<string, string>;
|
|
519
|
+
}
|
|
520
|
+
interface HttpRequestToolResult {
|
|
521
|
+
status: number;
|
|
522
|
+
statusText: string;
|
|
523
|
+
headers: Record<string, string>;
|
|
524
|
+
body: string;
|
|
525
|
+
durationMs: number;
|
|
526
|
+
truncated: boolean;
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Create an httpRequest tool for making HTTP requests.
|
|
530
|
+
*
|
|
531
|
+
* Supports GET, POST, PUT, PATCH, DELETE with headers, body, and
|
|
532
|
+
* parsed JSON responses. Cleaner than composing curl commands via bash.
|
|
533
|
+
*
|
|
534
|
+
* @example
|
|
535
|
+
* ```ts
|
|
536
|
+
* import { createHttpRequestTool } from '@supyagent/sdk';
|
|
537
|
+
*
|
|
538
|
+
* const tools = {
|
|
539
|
+
* httpRequest: createHttpRequestTool({
|
|
540
|
+
* defaultHeaders: { 'Authorization': 'Bearer ...' },
|
|
541
|
+
* }),
|
|
542
|
+
* };
|
|
543
|
+
* ```
|
|
544
|
+
*/
|
|
545
|
+
declare function createHttpRequestTool(options?: HttpRequestToolOptions): ai.Tool<unknown, HttpRequestToolResult | {
|
|
546
|
+
error: string;
|
|
547
|
+
}>;
|
|
548
|
+
|
|
549
|
+
export { type AccountIntegration, type AccountIntegrationDetail, type AccountsClient, type AppendFileToolOptions, type AppendFileToolResult, type BashToolOptions, type BashToolResult, type ConnectOptions, type ConnectSession, type ConnectSessionStatus, type ConnectedAccount, type ConnectedAccountWithIntegrations, type CreateAccountOptions, type EditFileToolOptions, type EditFileToolResult, type FindToolOptions, type FindToolResult, type GrepToolOptions, type GrepToolResult, type HttpRequestToolOptions, type HttpRequestToolResult, type ListAccountsOptions, type ListAccountsResponse, type MeOptions, type MeResponse, type OpenAITool, type ParsedSkill, type ParsedSkillsDocument, type ReadFileRangeToolOptions, type ReadFileRangeToolResult, type ScopedClient, type ScoredTool, type SkillsOptions, type SkillsResult, type SupyagentClient, type SupyagentOptions, type ToolFilterOptions, type ToolListResponse, type ToolMetadata, type ToolSearchResponse, type ToolsResponse, type UpdateAccountOptions, type ViewImageToolOptions, type ViewImageToolResult, buildSkillsSystemPrompt, createApiCallTool, createAppendFileTool, createBashTool, createEditFileTool, createFindTool, createGrepTool, createHttpRequestTool, createLoadSkillTool, createReadFileRangeTool, createViewImageTool, findSkill, parseSkillsMarkdown, supyagent };
|