@blinkdotnew/sdk 2.3.0 → 2.3.2

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.js CHANGED
@@ -6350,551 +6350,47 @@ var BlinkStorageImpl = class {
6350
6350
  };
6351
6351
 
6352
6352
  // src/tools/core.ts
6353
- var webSearch = {
6354
- name: "web_search",
6355
- description: "Search the web for current information. Returns titles, URLs, and snippets from relevant web pages. Powered by Exa AI.",
6356
- inputSchema: {
6357
- type: "object",
6358
- properties: {
6359
- query: {
6360
- type: "string",
6361
- description: "Search query"
6362
- },
6363
- max_results: {
6364
- type: "number",
6365
- description: "Maximum number of results (default: 10, max: 20)"
6366
- }
6367
- },
6368
- required: ["query"]
6369
- }
6370
- };
6371
- var fetchUrl = {
6372
- name: "fetch_url",
6373
- description: "Fetch content from a URL and extract clean text (HTML stripped). Fast, no JavaScript rendering. Good for Wikipedia, documentation, articles.",
6374
- inputSchema: {
6375
- type: "object",
6376
- properties: {
6377
- url: {
6378
- type: "string",
6379
- format: "uri",
6380
- description: "URL to fetch content from"
6381
- },
6382
- chunking: {
6383
- type: "boolean",
6384
- description: "Whether to return content as chunks (default: false)"
6385
- },
6386
- chunk_size: {
6387
- type: "number",
6388
- description: "Size of each chunk in characters (default: 4000)"
6389
- }
6390
- },
6391
- required: ["url"]
6392
- }
6393
- };
6394
- var runCode = {
6395
- name: "run_code",
6396
- description: "Execute Python code in an isolated sandbox with numpy, pandas, matplotlib, scipy, scikit-learn, requests. Returns stdout, stderr, text result, and rich outputs (matplotlib plots as base64 PNG images). Use for calculations, data analysis, and visualizations.",
6397
- inputSchema: {
6398
- type: "object",
6399
- properties: {
6400
- code: {
6401
- type: "string",
6402
- minLength: 1,
6403
- description: "Python code to execute. Matplotlib plots are automatically captured - use plt.show() or display(plt.gcf())"
6404
- },
6405
- timeout: {
6406
- type: "number",
6407
- minimum: 1,
6408
- maximum: 60,
6409
- description: "Execution timeout in seconds (default: 30, max: 60)"
6410
- }
6411
- },
6412
- required: ["code"]
6413
- }
6414
- };
6353
+ var webSearch = "web_search";
6354
+ var fetchUrl = "fetch_url";
6355
+ var runCode = "run_code";
6356
+ var coreTools = [webSearch, fetchUrl, runCode];
6415
6357
 
6416
6358
  // src/tools/sandbox.ts
6417
- var readFile = {
6418
- name: "read_file",
6419
- description: `Read file from sandbox filesystem.
6420
- - Lines are numbered: LINE_NUMBER|CONTENT
6421
- - Use offset/limit for large files
6422
- - Images (png, jpg, gif, webp) returned as base64`,
6423
- inputSchema: {
6424
- type: "object",
6425
- properties: {
6426
- path: {
6427
- type: "string",
6428
- description: "File path to read"
6429
- },
6430
- offset: {
6431
- type: "number",
6432
- description: "Line number to start from (1-based)"
6433
- },
6434
- limit: {
6435
- type: "number",
6436
- description: "Number of lines to read"
6437
- }
6438
- },
6439
- required: ["path"]
6440
- }
6441
- };
6442
- var listDir = {
6443
- name: "list_dir",
6444
- description: `List files and directories at path.
6445
- - Returns [FILE] and [DIR] prefixes
6446
- - Auto-excludes node_modules, .git, dist, etc.
6447
- - Use include_glob to filter for specific patterns`,
6448
- inputSchema: {
6449
- type: "object",
6450
- properties: {
6451
- path: {
6452
- type: "string",
6453
- description: "Directory path to list"
6454
- },
6455
- include_glob: {
6456
- type: "string",
6457
- description: 'Glob pattern to filter results (e.g., "*.ts", "*.{ts,tsx}"). Only matching files/dirs shown.'
6458
- },
6459
- ignore_globs: {
6460
- type: "array",
6461
- items: { type: "string" },
6462
- description: 'Additional patterns to exclude (e.g., ["*.log", "temp*"])'
6463
- }
6464
- },
6465
- required: ["path"]
6466
- }
6467
- };
6468
- var writeFile = {
6469
- name: "write_file",
6470
- description: `Create a NEW file. For existing files, use search_replace instead!
6471
- \u26A0\uFE0F This OVERWRITES existing files - only use for NEW files.`,
6472
- inputSchema: {
6473
- type: "object",
6474
- properties: {
6475
- path: {
6476
- type: "string",
6477
- description: "Path to create the file"
6478
- },
6479
- content: {
6480
- type: "string",
6481
- description: "File content"
6482
- }
6483
- },
6484
- required: ["path", "content"]
6485
- }
6486
- };
6487
- var searchReplace = {
6488
- name: "search_replace",
6489
- description: `\u{1F6A8} PREFERRED: Safest way to modify existing files.
6490
- - Include 3-5 lines of context for unique matching
6491
- - Use replace_all=true for renaming variables across file
6492
- - Preserves all other code (surgical precision)`,
6493
- inputSchema: {
6494
- type: "object",
6495
- properties: {
6496
- file_path: {
6497
- type: "string",
6498
- description: "Path to the file to modify"
6499
- },
6500
- old_string: {
6501
- type: "string",
6502
- description: "Text to replace (include 3-5 lines of context for uniqueness)"
6503
- },
6504
- new_string: {
6505
- type: "string",
6506
- description: "Replacement text"
6507
- },
6508
- replace_all: {
6509
- type: "boolean",
6510
- description: "Replace ALL occurrences (default: false)"
6511
- }
6512
- },
6513
- required: ["file_path", "old_string", "new_string"]
6514
- }
6515
- };
6516
- var grep = {
6517
- name: "grep",
6518
- description: `Search file contents using ripgrep regex.
6519
- - Supports: "log.*Error", "function\\s+\\w+"
6520
- - Modes: "content" (lines), "files_with_matches" (paths), "count"
6521
- - Context: -A (after), -B (before), -C (both)`,
6522
- inputSchema: {
6523
- type: "object",
6524
- properties: {
6525
- pattern: {
6526
- type: "string",
6527
- description: "Regex pattern to search for"
6528
- },
6529
- path: {
6530
- type: "string",
6531
- description: "Search path (default: project root)"
6532
- },
6533
- type: {
6534
- type: "string",
6535
- description: "File type filter (js, py, ts, tsx, etc.)"
6536
- },
6537
- glob: {
6538
- type: "string",
6539
- description: 'Glob pattern filter (e.g., "*.tsx")'
6540
- },
6541
- output_mode: {
6542
- type: "string",
6543
- enum: ["content", "files_with_matches", "count"],
6544
- description: "Output format (default: content)"
6545
- },
6546
- "-i": {
6547
- type: "boolean",
6548
- description: "Case insensitive search"
6549
- },
6550
- "-A": {
6551
- type: "number",
6552
- description: "Lines to show after match"
6553
- },
6554
- "-B": {
6555
- type: "number",
6556
- description: "Lines to show before match"
6557
- },
6558
- "-C": {
6559
- type: "number",
6560
- description: "Lines to show around match"
6561
- },
6562
- multiline: {
6563
- type: "boolean",
6564
- description: "Enable multiline matching"
6565
- },
6566
- head_limit: {
6567
- type: "number",
6568
- description: "Limit output lines"
6569
- }
6570
- },
6571
- required: ["pattern"]
6572
- }
6573
- };
6574
- var globFileSearch = {
6575
- name: "glob_file_search",
6576
- description: `Find files by name pattern.
6577
- - Examples: "*.ts", "**/*.test.tsx", "src/**/*.js"
6578
- - Results sorted by modification time (recent first)
6579
- - Use grep to search file CONTENTS, this searches file NAMES`,
6580
- inputSchema: {
6581
- type: "object",
6582
- properties: {
6583
- pattern: {
6584
- type: "string",
6585
- description: 'Glob pattern (e.g., "*.ts", "**/*.test.tsx")'
6586
- },
6587
- path: {
6588
- type: "string",
6589
- description: "Directory to search in (default: project root)"
6590
- },
6591
- output_mode: {
6592
- type: "string",
6593
- enum: ["files", "count", "details"],
6594
- description: "Output format (default: files)"
6595
- },
6596
- max_results: {
6597
- type: "number",
6598
- description: "Maximum results to return (default: 200, max: 500)"
6599
- },
6600
- include_hidden: {
6601
- type: "boolean",
6602
- description: "Include hidden files/dirs (starting with dot). Default: false"
6603
- }
6604
- },
6605
- required: ["pattern"]
6606
- }
6607
- };
6608
- var runTerminalCmd = {
6609
- name: "run_terminal_cmd",
6610
- description: `Run shell command in sandbox.
6611
- - Use background=true for dev servers
6612
- - Auto-prefixes sudo for package installs`,
6613
- inputSchema: {
6614
- type: "object",
6615
- properties: {
6616
- command: {
6617
- type: "string",
6618
- description: "Shell command to execute"
6619
- },
6620
- background: {
6621
- type: "boolean",
6622
- description: "Run in background (for servers)"
6623
- }
6624
- },
6625
- required: ["command"]
6626
- }
6627
- };
6628
- var getHost = {
6629
- name: "get_host",
6630
- description: "Get public URL for a sandbox port (e.g., 3000 for dev server).",
6631
- inputSchema: {
6632
- type: "object",
6633
- properties: {
6634
- port: {
6635
- type: "number",
6636
- description: "Port number to get URL for"
6637
- }
6638
- },
6639
- required: ["port"]
6640
- }
6641
- };
6359
+ var readFile = "read_file";
6360
+ var listDir = "list_dir";
6361
+ var writeFile = "write_file";
6362
+ var searchReplace = "search_replace";
6363
+ var grep = "grep";
6364
+ var globFileSearch = "glob_file_search";
6365
+ var runTerminalCmd = "run_terminal_cmd";
6366
+ var getHost = "get_host";
6642
6367
  var sandboxTools = [
6643
- // File reading
6644
6368
  readFile,
6645
6369
  listDir,
6646
- // File editing
6647
6370
  writeFile,
6648
6371
  searchReplace,
6649
- // Search
6650
6372
  grep,
6651
6373
  globFileSearch,
6652
- // Execution
6653
6374
  runTerminalCmd,
6654
6375
  getHost
6655
6376
  ];
6656
6377
 
6657
6378
  // src/tools/db.ts
6658
- var dbInsert = {
6659
- name: "db_insert",
6660
- description: "Insert a new row into a database table. The user_id is automatically set via row-level security.",
6661
- inputSchema: {
6662
- type: "object",
6663
- properties: {
6664
- table: {
6665
- type: "string",
6666
- description: "Table name to insert into"
6667
- },
6668
- data: {
6669
- type: "object",
6670
- additionalProperties: true,
6671
- description: "Data to insert (user_id is auto-set)"
6672
- }
6673
- },
6674
- required: ["table", "data"]
6675
- }
6676
- };
6677
- var dbList = {
6678
- name: "db_list",
6679
- description: "List rows from a database table with optional filtering, sorting, and pagination. Only returns rows owned by the current user (RLS enforced).",
6680
- inputSchema: {
6681
- type: "object",
6682
- properties: {
6683
- table: {
6684
- type: "string",
6685
- description: "Table name to query"
6686
- },
6687
- where: {
6688
- type: "object",
6689
- additionalProperties: true,
6690
- description: 'Filter conditions like { status: "active", type: "order" }'
6691
- },
6692
- order_by: {
6693
- type: "object",
6694
- properties: {
6695
- column: { type: "string", description: "Column to sort by" },
6696
- direction: { type: "string", enum: ["asc", "desc"], description: "Sort direction" }
6697
- },
6698
- required: ["column", "direction"],
6699
- description: "Sort order"
6700
- },
6701
- limit: {
6702
- type: "number",
6703
- description: "Maximum rows to return (default: 50, max: 100)"
6704
- },
6705
- offset: {
6706
- type: "number",
6707
- description: "Rows to skip for pagination"
6708
- }
6709
- },
6710
- required: ["table"]
6711
- }
6712
- };
6713
- var dbGet = {
6714
- name: "db_get",
6715
- description: "Get a single row by ID from a database table. Returns null if not found or not owned by user.",
6716
- inputSchema: {
6717
- type: "object",
6718
- properties: {
6719
- table: {
6720
- type: "string",
6721
- description: "Table name"
6722
- },
6723
- id: {
6724
- type: "string",
6725
- description: "Row ID to retrieve"
6726
- }
6727
- },
6728
- required: ["table", "id"]
6729
- }
6730
- };
6731
- var dbUpdate = {
6732
- name: "db_update",
6733
- description: "Update a row by ID. Only updates rows owned by the current user (RLS enforced).",
6734
- inputSchema: {
6735
- type: "object",
6736
- properties: {
6737
- table: {
6738
- type: "string",
6739
- description: "Table name"
6740
- },
6741
- id: {
6742
- type: "string",
6743
- description: "Row ID to update"
6744
- },
6745
- data: {
6746
- type: "object",
6747
- additionalProperties: true,
6748
- description: "Fields to update"
6749
- }
6750
- },
6751
- required: ["table", "id", "data"]
6752
- }
6753
- };
6754
- var dbDelete = {
6755
- name: "db_delete",
6756
- description: "Delete a row by ID. Only deletes rows owned by the current user (RLS enforced).",
6757
- inputSchema: {
6758
- type: "object",
6759
- properties: {
6760
- table: {
6761
- type: "string",
6762
- description: "Table name"
6763
- },
6764
- id: {
6765
- type: "string",
6766
- description: "Row ID to delete"
6767
- }
6768
- },
6769
- required: ["table", "id"]
6770
- }
6771
- };
6772
- var dbTools = [
6773
- dbInsert,
6774
- dbList,
6775
- dbGet,
6776
- dbUpdate,
6777
- dbDelete
6778
- ];
6379
+ var dbInsert = "db_insert";
6380
+ var dbList = "db_list";
6381
+ var dbGet = "db_get";
6382
+ var dbUpdate = "db_update";
6383
+ var dbDelete = "db_delete";
6384
+ var dbTools = [dbInsert, dbList, dbGet, dbUpdate, dbDelete];
6779
6385
 
6780
6386
  // src/tools/storage.ts
6781
- var storageUpload = {
6782
- name: "storage_upload",
6783
- description: "Upload a file to storage. Accepts base64-encoded content or a URL to fetch from.",
6784
- inputSchema: {
6785
- type: "object",
6786
- properties: {
6787
- path: {
6788
- type: "string",
6789
- description: "Destination path for the file"
6790
- },
6791
- content: {
6792
- type: "string",
6793
- description: "Base64-encoded file content OR URL to fetch"
6794
- },
6795
- content_type: {
6796
- type: "string",
6797
- description: "MIME type (auto-detected if omitted)"
6798
- }
6799
- },
6800
- required: ["path", "content"]
6801
- }
6802
- };
6803
- var storageDownload = {
6804
- name: "storage_download",
6805
- description: "Get download URL for a file in storage.",
6806
- inputSchema: {
6807
- type: "object",
6808
- properties: {
6809
- path: {
6810
- type: "string",
6811
- description: "Path to the file to download"
6812
- }
6813
- },
6814
- required: ["path"]
6815
- }
6816
- };
6817
- var storageList = {
6818
- name: "storage_list",
6819
- description: "List files in a storage directory.",
6820
- inputSchema: {
6821
- type: "object",
6822
- properties: {
6823
- path: {
6824
- type: "string",
6825
- description: 'Folder path to list (default: "/")'
6826
- },
6827
- limit: {
6828
- type: "number",
6829
- description: "Max files to return (default: 50, max: 100)"
6830
- }
6831
- }
6832
- }
6833
- };
6834
- var storageDelete = {
6835
- name: "storage_delete",
6836
- description: "Delete a file from storage.",
6837
- inputSchema: {
6838
- type: "object",
6839
- properties: {
6840
- path: {
6841
- type: "string",
6842
- description: "Path to the file to delete"
6843
- }
6844
- },
6845
- required: ["path"]
6846
- }
6847
- };
6848
- var storagePublicUrl = {
6849
- name: "storage_public_url",
6850
- description: "Get the public URL for a file in storage.",
6851
- inputSchema: {
6852
- type: "object",
6853
- properties: {
6854
- path: {
6855
- type: "string",
6856
- description: "Path to the file"
6857
- }
6858
- },
6859
- required: ["path"]
6860
- }
6861
- };
6862
- var storageMove = {
6863
- name: "storage_move",
6864
- description: "Move or rename a file in storage.",
6865
- inputSchema: {
6866
- type: "object",
6867
- properties: {
6868
- from: {
6869
- type: "string",
6870
- description: "Source path"
6871
- },
6872
- to: {
6873
- type: "string",
6874
- description: "Destination path"
6875
- }
6876
- },
6877
- required: ["from", "to"]
6878
- }
6879
- };
6880
- var storageCopy = {
6881
- name: "storage_copy",
6882
- description: "Copy a file to a new location in storage.",
6883
- inputSchema: {
6884
- type: "object",
6885
- properties: {
6886
- from: {
6887
- type: "string",
6888
- description: "Source path"
6889
- },
6890
- to: {
6891
- type: "string",
6892
- description: "Destination path"
6893
- }
6894
- },
6895
- required: ["from", "to"]
6896
- }
6897
- };
6387
+ var storageUpload = "storage_upload";
6388
+ var storageDownload = "storage_download";
6389
+ var storageList = "storage_list";
6390
+ var storageDelete = "storage_delete";
6391
+ var storagePublicUrl = "storage_public_url";
6392
+ var storageMove = "storage_move";
6393
+ var storageCopy = "storage_copy";
6898
6394
  var storageTools = [
6899
6395
  storageUpload,
6900
6396
  storageDownload,
@@ -6906,53 +6402,19 @@ var storageTools = [
6906
6402
  ];
6907
6403
 
6908
6404
  // src/tools/rag.ts
6909
- var ragSearch = {
6910
- name: "rag_search",
6911
- description: "Search a knowledge base using semantic similarity. Returns relevant document chunks with content and scores. Use this to find information in uploaded documents, then synthesize an answer from the results.",
6912
- inputSchema: {
6913
- type: "object",
6914
- properties: {
6915
- collection_id: {
6916
- type: "string",
6917
- description: "Collection ID to search in"
6918
- },
6919
- collection_name: {
6920
- type: "string",
6921
- description: "Collection name to search in (alternative to collection_id)"
6922
- },
6923
- query: {
6924
- type: "string",
6925
- description: "Search query - what you want to find in the knowledge base"
6926
- },
6927
- max_results: {
6928
- type: "number",
6929
- description: "Maximum number of results (1-100, default: 10)"
6930
- },
6931
- score_threshold: {
6932
- type: "number",
6933
- description: "Minimum similarity score 0-1 (default: 0.3)"
6934
- },
6935
- filters: {
6936
- type: "object",
6937
- description: "Metadata filters to narrow results",
6938
- additionalProperties: true
6939
- }
6940
- },
6941
- required: ["query"]
6942
- }
6943
- };
6944
- var ragTools = [
6945
- ragSearch
6946
- ];
6405
+ var ragSearch = "rag_search";
6406
+ var ragTools = [ragSearch];
6407
+
6408
+ // src/tools/media.ts
6409
+ var generateImage = "generate_image";
6410
+ var editImage = "edit_image";
6411
+ var generateVideo = "generate_video";
6412
+ var imageToVideo = "image_to_video";
6413
+ var mediaTools = [generateImage, editImage, generateVideo, imageToVideo];
6947
6414
 
6948
6415
  // src/tools/index.ts
6949
6416
  function serializeTools(tools) {
6950
- return tools.map((tool) => {
6951
- if (typeof tool === "string") {
6952
- return tool;
6953
- }
6954
- return tool.name;
6955
- });
6417
+ return tools;
6956
6418
  }
6957
6419
 
6958
6420
  // src/agent.ts
@@ -9799,6 +9261,7 @@ exports.NoOpStorageAdapter = NoOpStorageAdapter;
9799
9261
  exports.SANDBOX_TEMPLATES = SANDBOX_TEMPLATES;
9800
9262
  exports.SandboxConnectionError = SandboxConnectionError;
9801
9263
  exports.WebStorageAdapter = WebStorageAdapter;
9264
+ exports.coreTools = coreTools;
9802
9265
  exports.createClient = createClient;
9803
9266
  exports.dbDelete = dbDelete;
9804
9267
  exports.dbGet = dbGet;
@@ -9806,11 +9269,15 @@ exports.dbInsert = dbInsert;
9806
9269
  exports.dbList = dbList;
9807
9270
  exports.dbTools = dbTools;
9808
9271
  exports.dbUpdate = dbUpdate;
9272
+ exports.editImage = editImage;
9809
9273
  exports.fetchUrl = fetchUrl;
9274
+ exports.generateImage = generateImage;
9275
+ exports.generateVideo = generateVideo;
9810
9276
  exports.getDefaultStorageAdapter = getDefaultStorageAdapter;
9811
9277
  exports.getHost = getHost;
9812
9278
  exports.globFileSearch = globFileSearch;
9813
9279
  exports.grep = grep;
9280
+ exports.imageToVideo = imageToVideo;
9814
9281
  exports.isBrowser = isBrowser;
9815
9282
  exports.isDeno = isDeno;
9816
9283
  exports.isNode = isNode;
@@ -9818,6 +9285,7 @@ exports.isReactNative = isReactNative;
9818
9285
  exports.isServer = isServer;
9819
9286
  exports.isWeb = isWeb;
9820
9287
  exports.listDir = listDir;
9288
+ exports.mediaTools = mediaTools;
9821
9289
  exports.platform = platform;
9822
9290
  exports.ragSearch = ragSearch;
9823
9291
  exports.ragTools = ragTools;