Skip to content

Commit

Permalink
- fix: deno warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
agallardol committed Nov 28, 2024
1 parent 17ec967 commit e0e654a
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 15 deletions.
3 changes: 1 addition & 2 deletions apps/shinkai-tool-aave-state/src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import process from 'node:process';
import { run } from './index.ts';
import { expect } from 'jsr:@std/expect';

Expand All @@ -10,7 +9,7 @@ Deno.test({
fn: async () => {
const result = await run(
{
chromePath: process.env?.CHROME_PATH,
chromePath: Deno.env.get('CHROME_PATH'),
},
{},
);
Expand Down
2 changes: 1 addition & 1 deletion apps/shinkai-tool-defillama-tvl-rankings/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Deno.test({
fn: async () => {
const run_result = await run(
{
chromePath: process.env?.CHROME_PATH,
chromePath: Deno.env.get('CHROME_PATH'),
},
{
top10: false,
Expand Down
2 changes: 1 addition & 1 deletion apps/shinkai-tool-perplexity/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Deno.test({
fn: async () => {
const run_result = await run(
{
chromePath: process.env?.CHROME_PATH,
chromePath: Deno.env.get('CHROME_PATH'),
},
{
query: 'What is the meaning of life?',
Expand Down
2 changes: 1 addition & 1 deletion apps/shinkai-tool-playwright-example/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Deno.test({
fn: async () => {
const result = await run(
{
chromePath: process.env?.CHROME_PATH,
chromePath: Deno.env.get('CHROME_PATH'),
},
{ url: 'https://shinkai.com' },
);
Expand Down
2 changes: 1 addition & 1 deletion apps/shinkai-tool-playwright-example/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const run: Run<Configurations, Parameters, Result> = async (
): Promise<Result> => {
const chromePath =
configurations?.chromePath ||
process.env.CHROME_PATH ||
Deno.env.get('CHROME_PATH') ||
chromePaths.chrome ||
chromePaths.chromium;

Expand Down
17 changes: 8 additions & 9 deletions scripts/tool-bundler.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/**
* Script to bundle and process Shinkai tools
*
*
* This script takes an entry file and output folder as arguments, bundles the tool code,
* generates embeddings for the tool definition, and creates an extended tool definition
* that includes the code and embedding metadata.
*
*
* Usage:
* Run with --entry and --outputFolder parameters:
* deno run tool-bundler.ts --entry=<entry-file> --outputFolder=<output-folder>
*
*
* The script will:
* 1. Read and bundle the tool code from the entry file
* 2. Write the bundled code to index.ts in the output folder
Expand All @@ -21,7 +21,6 @@
import { join } from 'node:path';
import minimist from 'npm:minimist';
import fs from 'node:fs';
import process from 'node:process';
import axios from 'npm:axios';

console.log('🚀 Starting Shinkai Tool bundler...');
Expand All @@ -37,9 +36,9 @@ type ExtendedToolDefinition = ToolDefinition<any> & {

// Parse command line arguments
console.log('📝 Parsing command line arguments...');
const args = minimist(process.argv.slice(2));
const entryFile: string = join(process.cwd(), args.entry);
const outputFolder: string = join(process.cwd(), args.outputFolder);
const args = minimist(Deno.args.slice(2));
const entryFile: string = join(Deno.cwd(), args.entry);
const outputFolder: string = join(Deno.cwd(), args.outputFolder);
const outputFile: string = join(outputFolder, 'index.ts');

console.log('📂 Entry file:', entryFile);
Expand Down Expand Up @@ -79,7 +78,7 @@ fs.promises
// Import tool definition from bundled code
console.log('📥 Importing tool definition...');
const { definition }: { definition: ToolDefinition<any> } = await import(
process.platform === 'win32' ? `file://${outputFile}` : outputFile
Deno.build.os == 'windows' ? `file://${outputFile}` : outputFile
);

console.log('✨ Tool definition loaded:', definition.name);
Expand All @@ -88,7 +87,7 @@ fs.promises
console.log('🧮 Generating embeddings for tool metadata...');
const prompt = `${definition.id} ${definition.name} ${definition.description} ${definition.author} ${definition.keywords.join(' ')}`;
const embeddings = await getEmbeddings(prompt);

// Create extended tool definition with code and embeddings
console.log('🔨 Creating extended tool definition...');
const toolDefinition: ExtendedToolDefinition = {
Expand Down

0 comments on commit e0e654a

Please sign in to comment.