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