diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6885e67..2d399ba 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,7 +48,7 @@ jobs: - name: Build API for ${{ matrix.target }} run: | cd api - deno compile --allow-env --allow-net --allow-read --allow-run --allow-write --target ${{ matrix.target }} --output ../build/bbai-api${{ matrix.target == 'x86_64-pc-windows-msvc' && '.exe' || '' }} src/main.ts + deno run --allow-read --allow-run --allow-write scripts/compile.ts --target ${{ matrix.target }} --output ../build/bbai-api${{ matrix.target == 'x86_64-pc-windows-msvc' && '.exe' || '' }} - name: Create install script (Unix) if: matrix.target != 'x86_64-pc-windows-msvc' diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c31510..c3348a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 +## [0.0.24-beta] - 2024-10-07 + +### Changed + +- generate tools manifest file to facilitate loading from compiled binary +- dynamically include tools at build compile time +- update build scripts and release workflow to use compile script + + ## [0.0.23-beta] - 2024-10-06 ### Changed diff --git a/api/deno.jsonc b/api/deno.jsonc index b9287b1..c2c4cdb 100644 --- a/api/deno.jsonc +++ b/api/deno.jsonc @@ -1,13 +1,15 @@ { "name": "bbai-api", - "version": "0.0.23-beta", + "version": "0.0.24-beta", "exports": "./src/main.ts", "tasks": { "start": "deno run --allow-read --allow-write --allow-run --allow-net --allow-env src/main.ts", "dev": "deno run --watch --allow-read --allow-write --allow-run --allow-net --allow-env src/main.ts", "debug": "LOG_LEVEL=debug deno run --allow-read --allow-write --allow-run --allow-net --allow-env src/main.ts", "test": "deno test --allow-read --allow-write --allow-run --allow-net --allow-env tests/ tests/t/llms/tools/index.ts", - "build": "deno compile --allow-env --allow-net --allow-read --allow-run --allow-write --output ../build/bbai-api src/main.ts", + "generate-tools-manifest": "deno run --allow-read --allow-write scripts/generate_core_tools_manifest.ts && deno fmt ./src/llms/tools_manifest.ts", + "build": "deno run --allow-read --allow-run --allow-write scripts/compile.ts", + "build-local": "deno task generate-tools-manifest && deno compile --allow-env --allow-net --allow-read --allow-run --allow-write --output ../build/bbai-api src/main.ts", "format": "deno fmt", "check-format": "deno fmt --check", "check-types": "deno check src/main.ts", diff --git a/api/scripts/compile.ts b/api/scripts/compile.ts new file mode 100755 index 0000000..d877e61 --- /dev/null +++ b/api/scripts/compile.ts @@ -0,0 +1,88 @@ +#!/usr/bin/env -S deno run --allow-read --allow-run --allow-write + +import { parseArgs } from '@std/cli'; +import { walk } from '@std/fs'; +import { join } from '@std/path'; + +const TOOLS_DIR = './src/llms/tools'; +const MAIN_FILE = 'src/main.ts'; +const OUTPUT_FILE = '../build/bbai-api'; + +const args = parseArgs(Deno.args, { + string: ['target', 'output'], + alias: { t: 'target', o: 'output' }, +}); + +const target = args.target ? `--target ${args.target}` : ''; +const output = args.output || OUTPUT_FILE; + +async function getIncludeFiles() { + const includeFiles = []; + for await ( + const entry of walk(TOOLS_DIR, { + exts: ['.ts', '.tsx', '.json'], + followSymlinks: false, + }) + ) { + if (entry.isFile) { + includeFiles.push(entry.path); + } + } + return includeFiles; +} + +// Run the generate-tools-manifest task +const manifestProcess = new Deno.Command('deno', { + args: ['task', 'generate-tools-manifest'], + stdout: 'piped', + stderr: 'piped', +}); +const { code: manifestCode, stdout: manifestStdout, stderr: manifestStderr } = await manifestProcess.output(); + +const manifestOutput = new TextDecoder().decode(manifestStdout); +const manifestErrorOutput = new TextDecoder().decode(manifestStderr); + +if (manifestCode !== 0) { + if (manifestErrorOutput !== '') console.error(manifestErrorOutput); + console.error('Failed to generate tools manifest'); + Deno.exit(manifestCode); +} + +console.log(manifestOutput); +if (manifestErrorOutput !== '') console.error(manifestErrorOutput); + +const includeFiles = await getIncludeFiles(); +const includeArgs = includeFiles.map((file) => `--include ${file}`).join(' '); +console.log(`Including files for core tools:\n${JSON.stringify(includeFiles, null, 2)}`); + +// Compile the API +const compileProcess = new Deno.Command('deno', { + args: [ + 'compile', + '-A', + '--unstable', + target, + '--output', + output, + ...includeArgs.split(' '), + MAIN_FILE, + ].filter(Boolean), + stdout: 'piped', + stderr: 'piped', +}); + +const { code: compileCode, stdout: compileStdout, stderr: compileStderr } = await compileProcess.output(); + +const compileOutput = new TextDecoder().decode(compileStdout); +const compileErrorOutput = new TextDecoder().decode(compileStderr); + +if (compileCode !== 0) { + if (compileErrorOutput !== '') console.error(compileErrorOutput); + console.error('Compilation failed'); + Deno.exit(compileCode); +} + +console.log(compileOutput); +if (compileErrorOutput !== '') console.error(compileErrorOutput); + +console.log('Compilation successful'); diff --git a/api/scripts/generate_core_tools_manifest.ts b/api/scripts/generate_core_tools_manifest.ts new file mode 100644 index 0000000..7c08ee4 --- /dev/null +++ b/api/scripts/generate_core_tools_manifest.ts @@ -0,0 +1,43 @@ +//import { walk } from "@std/fs"; +import { join } from '@std/path'; +import { stripIndents } from 'common-tags'; + +// paths relative to api/deno.jsonc +const TOOLS_DIR = './src/llms/tools'; +const OUTPUT_FILE = './src/llms/tools_manifest.ts'; + +async function generateCoreTools() { + const tools = []; + + //for await (const entry of walk(TOOLS_DIR, { maxDepth: 1 })) { + for await (const entry of Deno.readDir(TOOLS_DIR)) { + if (entry.isDirectory && entry.name.endsWith('.tool')) { + const infoPath = join(TOOLS_DIR, entry.name, 'info.json'); + try { + const info = JSON.parse(await Deno.readTextFile(infoPath)); + tools.push({ + toolNamePath: entry.name, + metadata: info, + }); + } catch (error) { + console.error(`Error reading ${infoPath}:`, error); + } + } + } + + const fileContent = `// This file is auto-generated. Do not edit manually. +import type { ToolMetadata } from './llmToolManager.ts'; + +interface CoreTool { + toolNamePath: string; + metadata: ToolMetadata; +} + +export const CORE_TOOLS: Array = ${JSON.stringify(tools, null, '\t')}; +`; + + await Deno.writeTextFile(OUTPUT_FILE, fileContent); + console.log(`Generated ${OUTPUT_FILE} with ${tools.length} tools.`); +} + +await generateCoreTools(); diff --git a/api/src/llms/llmToolManager.ts b/api/src/llms/llmToolManager.ts index 757b08d..1958f82 100644 --- a/api/src/llms/llmToolManager.ts +++ b/api/src/llms/llmToolManager.ts @@ -9,20 +9,25 @@ import { createError, ErrorType } from 'api/utils/error.ts'; import type { LLMValidationErrorOptions } from '../errors/error.ts'; import { logger } from 'shared/logger.ts'; import type { FullConfigSchema } from 'shared/configManager.ts'; + import { compare as compareVersions, parse as parseVersion } from '@std/semver'; -import { dirname, fromFileUrl, join } from '@std/path'; +import { dirname, fromFileUrl, isAbsolute, join, SEPARATOR } from '@std/path'; import { exists } from '@std/fs'; -const BUILT_IN_TOOL_DIRECTORY = join(dirname(fromFileUrl(import.meta.url)), 'tools'); +import { CORE_TOOLS } from './tools_manifest.ts'; -interface ToolMetadata { +export interface ToolMetadata { name: string; version: string; + author: string; + license: string; description: string; - path: string; - toolSets: string | string[]; - enabled: boolean; + path?: string; // is set by code, not part of manifest + toolSets?: string | string[]; //defaults to 'core' + category?: string | string[]; + enabled?: boolean; //defaults to true error?: string; + config?: unknown; } export type LLMToolManagerToolSetType = 'core' | 'coding' | 'research' | 'creative'; @@ -42,17 +47,20 @@ class LLMToolManager { } async init() { - const toolDirectories = [ - BUILT_IN_TOOL_DIRECTORY, - ...this.fullConfig.userToolDirectories, - ]; - - await this.loadToolMetadata(toolDirectories); + await this.loadToolMetadata(this.fullConfig.userToolDirectories); return this; } private async loadToolMetadata(directories: string[]) { + for (const coreTool of CORE_TOOLS) { + const toolNamePath = join('tools', coreTool.toolNamePath); + coreTool.metadata.path = toolNamePath; + //logger.debug(`LLMToolManager: Metadata for CORE tool ${coreTool.toolNamePath}`, coreTool.metadata); + logger.debug(`LLMToolManager: Setting metadata for CORE tool ${coreTool.toolNamePath}`); + this.toolMetadata.set(coreTool.metadata.name, coreTool.metadata); + } + //logger.debug(`LLMToolManager: Processing tool directories:`, directories); for (const directory of directories) { logger.debug(`LLMToolManager: Checking ${directory} for tools`); @@ -130,7 +138,7 @@ class LLMToolManager { private shouldReplaceExistingTool(existing: ToolMetadata, newMetadata: ToolMetadata): boolean { // Prefer user-supplied tools - if (this.fullConfig.userToolDirectories.some((dir) => newMetadata.path.startsWith(dir))) { + if (this.fullConfig.userToolDirectories.some((dir) => newMetadata.path!.startsWith(dir))) { if (compareVersions(parseVersion(existing.version), parseVersion(newMetadata.version)) > 0) { logger.warn( `LLMToolManager: User-supplied tool ${newMetadata.name} (${newMetadata.version}) is older than built-in tool (${existing.version})`, @@ -142,6 +150,7 @@ class LLMToolManager { } async getTool(name: string): Promise { + logger.info(`LLMToolManager: Getting Tool ${name}`); if (this.loadedTools.has(name)) { logger.debug(`LLMToolManager: Returning cached ${name} tool`); return this.loadedTools.get(name); @@ -161,10 +170,14 @@ class LLMToolManager { // Proceed with loading the tool try { - logger.debug(`LLMToolManager: Tool ${name} is loading`); - const module = await import(`${metadata.path}/tool.ts`); + logger.info(`LLMToolManager: Is tool ${name} absolute ${metadata.path}`); + const toolPath = isAbsolute(metadata.path!) + ? join(metadata.path!, 'tool.ts') + : `.${SEPARATOR}${metadata.path}${SEPARATOR}tool.ts`; + logger.info(`LLMToolManager: Tool ${name} is loading from ${toolPath}`); + const module = await import(toolPath); const tool = new module.default(); - logger.debug(`LLMToolManager: Tool ${tool.name} is loaded`); + //logger.debug(`LLMToolManager: Tool ${tool.name} is loaded`); this.loadedTools.set(name, tool); return tool; } catch (error) { @@ -179,10 +192,10 @@ class LLMToolManager { return metadata ? `${metadata.path}/tool.ts` : undefined; } - async getAllTools(): Promise { + async getAllTools(enabledOnly = true): Promise { const tools: LLMTool[] = []; for (const metadata of this.toolMetadata.values()) { - if (this.isToolEnabled(metadata)) { + if (enabledOnly && this.isToolEnabled(metadata)) { const tool = await this.getTool(metadata.name); if (tool) { tools.push(tool); diff --git a/api/src/llms/tools/fetchWebPage.tool/formatter.browser.tsx b/api/src/llms/tools/fetchWebPage.tool/formatter.browser.tsx index 656ecfc..bd1ff78 100644 --- a/api/src/llms/tools/fetchWebPage.tool/formatter.browser.tsx +++ b/api/src/llms/tools/fetchWebPage.tool/formatter.browser.tsx @@ -2,7 +2,7 @@ import type { JSX } from 'preact'; import type { LLMToolInputSchema, LLMToolRunResultContent } from 'api/llms/llmTool.ts'; //import type { LLMMessageContentPart, LLMMessageContentParts } from 'api/llms/llmMessage.ts'; -import { getContentFromToolResult } from '../../../utils/llms.utils.ts'; +import { getContentFromToolResult } from 'api/utils/llms.ts'; export const formatToolUse = (toolInput: LLMToolInputSchema): JSX.Element => { const { url } = toolInput as { url: string }; diff --git a/api/src/llms/tools/fetchWebPage.tool/formatter.console.ts b/api/src/llms/tools/fetchWebPage.tool/formatter.console.ts index c51c950..396bd8d 100644 --- a/api/src/llms/tools/fetchWebPage.tool/formatter.console.ts +++ b/api/src/llms/tools/fetchWebPage.tool/formatter.console.ts @@ -2,7 +2,7 @@ import type { LLMToolInputSchema, LLMToolRunResultContent } from 'api/llms/llmTo //import type { LLMMessageContentPart, LLMMessageContentParts } from 'api/llms/llmMessage.ts'; import { colors } from 'cliffy/ansi/colors.ts'; import { stripIndents } from 'common-tags'; -import { getContentFromToolResult } from '../../../utils/llms.utils.ts'; +import { getContentFromToolResult } from 'api/utils/llms.ts'; export const formatToolUse = (toolInput: LLMToolInputSchema): string => { const { url } = toolInput as { url: string }; diff --git a/api/src/llms/tools/fetchWebScreenshot.tool/formatter.browser.tsx b/api/src/llms/tools/fetchWebScreenshot.tool/formatter.browser.tsx index ee86a83..ffedd6d 100644 --- a/api/src/llms/tools/fetchWebScreenshot.tool/formatter.browser.tsx +++ b/api/src/llms/tools/fetchWebScreenshot.tool/formatter.browser.tsx @@ -2,7 +2,7 @@ import type { JSX } from 'preact'; import type { LLMToolInputSchema, LLMToolRunResultContent } from 'api/llms/llmTool.ts'; //import type { LLMMessageContentPart, LLMMessageContentParts } from 'api/llms/llmMessage.ts'; -import { getContentFromToolResult } from '../../../utils/llms.utils.ts'; +import { getContentFromToolResult } from 'api/utils/llms.ts'; export const formatToolUse = (toolInput: LLMToolInputSchema): JSX.Element => { const { url } = toolInput as { url: string }; diff --git a/api/src/llms/tools/fetchWebScreenshot.tool/formatter.console.ts b/api/src/llms/tools/fetchWebScreenshot.tool/formatter.console.ts index 1b75c55..a8a3be3 100644 --- a/api/src/llms/tools/fetchWebScreenshot.tool/formatter.console.ts +++ b/api/src/llms/tools/fetchWebScreenshot.tool/formatter.console.ts @@ -2,7 +2,7 @@ import type { LLMToolInputSchema, LLMToolRunResultContent } from 'api/llms/llmTo //import type { LLMMessageContentPart, LLMMessageContentParts } from 'api/llms/llmMessage.ts'; import { colors } from 'cliffy/ansi/colors.ts'; import { stripIndents } from 'common-tags'; -import { getContentFromToolResult } from '../../../utils/llms.utils.ts'; +import { getContentFromToolResult } from 'api/utils/llms.ts'; export const formatToolUse = (toolInput: LLMToolInputSchema): string => { const { url } = toolInput as { url: string }; diff --git a/api/src/llms/tools/searchAndReplace.tool/tool.ts b/api/src/llms/tools/searchAndReplace.tool/tool.ts index 702cf1d..d90ad81 100644 --- a/api/src/llms/tools/searchAndReplace.tool/tool.ts +++ b/api/src/llms/tools/searchAndReplace.tool/tool.ts @@ -19,7 +19,7 @@ import { isPathWithinProject } from 'api/utils/fileHandling.ts'; import { logger } from 'shared/logger.ts'; import { dirname, join } from '@std/path'; import { ensureDir } from '@std/fs'; -import { getContentFromToolResult } from '../../../utils/llms.utils.ts'; +import { getContentFromToolResult } from 'api/utils/llms.ts'; export default class LLMToolSearchAndReplace extends LLMTool { private static readonly MIN_SEARCH_LENGTH = 1; diff --git a/api/src/llms/tools/searchAndReplaceMultilineCode.tool/formatter.browser.tsx b/api/src/llms/tools/searchAndReplaceMultilineCode.tool/formatter.browser.tsx new file mode 100644 index 0000000..c779f05 --- /dev/null +++ b/api/src/llms/tools/searchAndReplaceMultilineCode.tool/formatter.browser.tsx @@ -0,0 +1,17 @@ +/** @jsxImportSource preact */ +import type { JSX } from 'preact'; +import type { LLMToolInputSchema, LLMToolRunResultContent } from 'api/llms/llmTool.ts'; + +export const formatToolUse = (toolInput: LLMToolInputSchema): JSX.Element => { + return ( +
+
+ ); +}; + +export const formatToolResult = (toolResult: LLMToolRunResultContent): JSX.Element => { + return ( +
+
+ ); +}; diff --git a/api/src/llms/tools/searchAndReplaceMultilineCode.tool/formatter.console.ts b/api/src/llms/tools/searchAndReplaceMultilineCode.tool/formatter.console.ts new file mode 100644 index 0000000..707f793 --- /dev/null +++ b/api/src/llms/tools/searchAndReplaceMultilineCode.tool/formatter.console.ts @@ -0,0 +1,9 @@ +import type { LLMToolInputSchema, LLMToolRunResultContent } from 'api/llms/llmTool.ts'; + +export const formatToolUse = (toolInput: LLMToolInputSchema): string => { + return ''; +}; + +export const formatToolResult = (toolResult: LLMToolRunResultContent): string => { + return ''; +}; diff --git a/api/src/llms/tools/searchAndReplaceMultilineCode.tool/tool.ts b/api/src/llms/tools/searchAndReplaceMultilineCode.tool/tool.ts index 9af3dc8..f10f110 100644 --- a/api/src/llms/tools/searchAndReplaceMultilineCode.tool/tool.ts +++ b/api/src/llms/tools/searchAndReplaceMultilineCode.tool/tool.ts @@ -1,6 +1,7 @@ -//import type { JSX } from 'preact'; +import type { JSX } from 'preact'; + import LLMTool from 'api/llms/llmTool.ts'; -import type { LLMToolInputSchema, LLMToolRunResult } from 'api/llms/llmTool.ts'; +import type { LLMToolInputSchema, LLMToolRunResult, LLMToolRunResultContent } from 'api/llms/llmTool.ts'; import type LLMConversationInteraction from 'api/llms/conversationInteraction.ts'; import type { LLMAnswerToolUse } from 'api/llms/llmMessage.ts'; import type ProjectEditor from 'api/editor/projectEditor.ts'; @@ -8,6 +9,15 @@ import { createError, ErrorType } from 'api/utils/error.ts'; import type { FileHandlingErrorOptions } from 'api/errors/error.ts'; import { isPathWithinProject } from 'api/utils/fileHandling.ts'; import { logger } from 'shared/logger.ts'; +import { + formatToolResult as formatToolResultBrowser, + formatToolUse as formatToolUseBrowser, +} from './formatter.browser.tsx'; +import { + formatToolResult as formatToolResultConsole, + formatToolUse as formatToolUseConsole, +} from './formatter.console.ts'; + import { dirname, join } from '@std/path'; import { ensureDir } from '@std/fs'; @@ -232,6 +242,14 @@ export default class LLMToolSearchAndReplaceCode extends LLMTool { }; } + formatToolUse(toolInput: LLMToolInputSchema, format: 'console' | 'browser'): string | JSX.Element { + return format === 'console' ? formatToolUseConsole(toolInput) : formatToolUseBrowser(toolInput); + } + + formatToolResult(toolResult: LLMToolRunResultContent, format: 'console' | 'browser'): string | JSX.Element { + return format === 'console' ? formatToolResultConsole(toolResult) : formatToolResultBrowser(toolResult); + } + /** * Detects the programming language of a file based on its extension and content. * diff --git a/api/src/llms/tools/searchProject.tool/formatter.browser.tsx b/api/src/llms/tools/searchProject.tool/formatter.browser.tsx index a14fde8..a46a14a 100644 --- a/api/src/llms/tools/searchProject.tool/formatter.browser.tsx +++ b/api/src/llms/tools/searchProject.tool/formatter.browser.tsx @@ -2,7 +2,7 @@ import type { JSX } from 'preact'; import type { LLMToolInputSchema, LLMToolRunResultContent } from 'api/llms/llmTool.ts'; //import type { LLMMessageContentPart, LLMMessageContentParts } from 'api/llms/llmMessage.ts'; -import { getContentFromToolResult } from '../../../utils/llms.utils.ts'; +import { getContentFromToolResult } from 'api/utils/llms.ts'; export const formatToolUse = (toolInput: LLMToolInputSchema): JSX.Element => { const { contentPattern, filePattern, dateAfter, dateBefore, sizeMin, sizeMax } = toolInput as { diff --git a/api/src/llms/tools/searchProject.tool/formatter.console.ts b/api/src/llms/tools/searchProject.tool/formatter.console.ts index 1ed9e69..e697c33 100644 --- a/api/src/llms/tools/searchProject.tool/formatter.console.ts +++ b/api/src/llms/tools/searchProject.tool/formatter.console.ts @@ -2,7 +2,7 @@ import type { LLMToolInputSchema, LLMToolRunResultContent } from 'api/llms/llmTo //import type { LLMMessageContentPart, LLMMessageContentParts } from 'api/llms/llmMessage.ts'; import { colors } from 'cliffy/ansi/colors.ts'; import { stripIndents } from 'common-tags'; -import { getContentFromToolResult } from '../../../utils/llms.utils.ts'; +import { getContentFromToolResult } from 'api/utils/llms.ts'; export const formatToolUse = (toolInput: LLMToolInputSchema): string => { const { contentPattern, filePattern, dateAfter, dateBefore, sizeMin, sizeMax } = toolInput as { diff --git a/api/src/llms/tools/vectorSearch.tool/formatter.browser.tsx b/api/src/llms/tools/vectorSearch.tool/formatter.browser.tsx new file mode 100644 index 0000000..c779f05 --- /dev/null +++ b/api/src/llms/tools/vectorSearch.tool/formatter.browser.tsx @@ -0,0 +1,17 @@ +/** @jsxImportSource preact */ +import type { JSX } from 'preact'; +import type { LLMToolInputSchema, LLMToolRunResultContent } from 'api/llms/llmTool.ts'; + +export const formatToolUse = (toolInput: LLMToolInputSchema): JSX.Element => { + return ( +
+
+ ); +}; + +export const formatToolResult = (toolResult: LLMToolRunResultContent): JSX.Element => { + return ( +
+
+ ); +}; diff --git a/api/src/llms/tools/vectorSearch.tool/formatter.console.ts b/api/src/llms/tools/vectorSearch.tool/formatter.console.ts new file mode 100644 index 0000000..707f793 --- /dev/null +++ b/api/src/llms/tools/vectorSearch.tool/formatter.console.ts @@ -0,0 +1,9 @@ +import type { LLMToolInputSchema, LLMToolRunResultContent } from 'api/llms/llmTool.ts'; + +export const formatToolUse = (toolInput: LLMToolInputSchema): string => { + return ''; +}; + +export const formatToolResult = (toolResult: LLMToolRunResultContent): string => { + return ''; +}; diff --git a/api/src/llms/tools_manifest.ts b/api/src/llms/tools_manifest.ts new file mode 100644 index 0000000..fc35bab --- /dev/null +++ b/api/src/llms/tools_manifest.ts @@ -0,0 +1,164 @@ +// This file is auto-generated. Do not edit manually. +import type { ToolMetadata } from './llmToolManager.ts'; + +interface CoreTool { + toolNamePath: string; + metadata: ToolMetadata; +} + +export const CORE_TOOLS: Array = [ + { + 'toolNamePath': 'moveFiles.tool', + 'metadata': { + 'name': 'move_files', + 'description': 'Move one or more files or directories to a new location within the project', + 'version': '1.0.0', + 'author': 'BBai Team', + 'license': 'MIT', + }, + }, + { + 'toolNamePath': 'searchProject.tool', + 'metadata': { + 'name': 'search_project', + 'description': 'Searches the project for files matching content, name, date, or size criteria', + 'version': '1.0.0', + 'author': 'BBai Team', + 'license': 'MIT', + }, + }, + { + 'toolNamePath': 'requestFiles.tool', + 'metadata': { + 'name': 'request_files', + 'description': 'Request one or more files within the project to be added to the conversation.', + 'version': '1.0.0', + 'author': 'BBai Team', + 'license': 'MIT', + }, + }, + { + 'toolNamePath': 'fetchWebScreenshot.tool', + 'metadata': { + 'name': 'fetch_web_screenshot', + 'description': 'Fetches a screenshot of a specified web page', + 'version': '1.0.0', + 'author': 'BBai Team', + 'license': 'MIT', + }, + }, + { + 'toolNamePath': 'fetchWebPage.tool', + 'metadata': { + 'name': 'fetch_web_page', + 'description': 'Fetches the content of a specified web page', + 'version': '1.0.0', + 'author': 'BBai Team', + 'license': 'MIT', + }, + }, + { + 'toolNamePath': 'searchAndReplace.tool', + 'metadata': { + 'name': 'search_and_replace', + 'description': 'Apply a list of search and replace operations to a file', + 'version': '1.0.0', + 'author': 'BBai Team', + 'license': 'MIT', + }, + }, + { + 'toolNamePath': 'forgetFiles.tool', + 'metadata': { + 'name': 'forget_files', + 'description': 'Remove and forget specified files from the chat when they are no longer needed', + 'version': '1.0.0', + 'category': 'FileManipulation', + 'author': 'BBai Team', + 'license': 'MIT', + }, + }, + { + 'toolNamePath': 'searchAndReplaceMultilineCode.tool', + 'metadata': { + 'name': 'search_and_replace_multiline_code', + 'description': 'Apply a list of search and replace operations to a file, supporting multiline code', + 'enabled': false, + 'version': '1.0.0', + 'author': 'BBai Team', + 'license': 'MIT', + }, + }, + { + 'toolNamePath': 'vectorSearch.tool', + 'metadata': { + 'name': 'vector_search', + 'description': 'Performs vector search operations', + 'enabled': false, + 'version': '1.0.0', + 'author': 'BBai Team', + 'license': 'MIT', + }, + }, + { + 'toolNamePath': 'runCommand.tool', + 'metadata': { + 'name': 'run_command', + 'description': 'Run a system command and return the output', + 'version': '1.0.0', + 'author': 'BBai Team', + 'license': 'MIT', + 'config': { + 'allowedCommands': [ + 'deno task tool:check-types-project', + 'deno task tool:check-types-args', + 'deno task tool:test', + 'deno task tool:format', + ], + }, + }, + }, + { + 'toolNamePath': 'delegateTasks.tool', + 'metadata': { + 'name': 'delegate_tasks', + 'description': + 'Delegate tasks to child interactions. Input includes background, instructions, and resources. Output is the completed task requirements.', + 'enabled': false, + 'version': '1.0.0', + 'author': 'BBai Team', + 'license': 'MIT', + }, + }, + { + 'toolNamePath': 'applyPatch.tool', + 'metadata': { + 'name': 'apply_patch', + 'description': 'Apply a well-formed patch to one or more files', + 'version': '1.0.0', + 'author': 'BBai Team', + 'license': 'MIT', + }, + }, + { + 'toolNamePath': 'renameFiles.tool', + 'metadata': { + 'name': 'rename_files', + 'description': 'Rename one or more files or directories within the project.', + 'version': '1.0.0', + 'author': 'BBai Team', + 'license': 'MIT', + }, + }, + { + 'toolNamePath': 'rewriteFile.tool', + 'metadata': { + 'name': 'rewrite_file', + 'description': 'Rewrites an entire file or creates a new one', + 'version': '1.0.0', + 'category': 'FileManipulation', + 'author': 'BBai Team', + 'license': 'MIT', + }, + }, +]; diff --git a/bui/deno.jsonc b/bui/deno.jsonc index fb8a9c2..4a72472 100644 --- a/bui/deno.jsonc +++ b/bui/deno.jsonc @@ -46,5 +46,5 @@ "src/fixtures/**/*.ts" ] }, - "version": "0.0.23-beta" + "version": "0.0.24-beta" } diff --git a/cli/deno.jsonc b/cli/deno.jsonc index 78135c8..f98a521 100644 --- a/cli/deno.jsonc +++ b/cli/deno.jsonc @@ -1,6 +1,6 @@ { "name": "bbai-cli", - "version": "0.0.23-beta", + "version": "0.0.24-beta", "exports": "./src/main.ts", "tasks": { "start": "deno run --allow-env --allow-read --allow-write --allow-run --allow-net src/main.ts", diff --git a/deno.jsonc b/deno.jsonc index da465a9..16f48b2 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -1,6 +1,6 @@ { "name": "bbai", - "version": "0.0.23-beta", + "version": "0.0.24-beta", "exports": "./cli/src/main.ts", "tasks": { "tool:check-types-project": "deno task -c ./cli/deno.jsonc check-types && deno task -c ./bui/deno.jsonc check-types && deno task -c ./api/deno.jsonc check-types", diff --git a/import_map.json b/import_map.json index 110291d..1bd7710 100644 --- a/import_map.json +++ b/import_map.json @@ -66,6 +66,7 @@ "api/errors/error.ts": "./api/src/errors/error.ts", "api/utils/fileHandling.ts": "./api/src/utils/fileHandling.utils.ts", "api/utils/error.ts": "./api/src/utils/error.utils.ts", + "api/utils/llms.ts": "./api/src/utils/llms.utils.ts", "api/llms/llmMessage.ts": "./api/src/llms/llmMessage.ts", "api/llms/llmTool.ts": "./api/src/llms/llmTool.ts", "api/llms/conversationInteraction.ts": "./api/src/llms/interactions/conversationInteraction.ts", diff --git a/scripts/build_windows_exe.sh b/scripts/build_windows_exe.sh index 186ce2d..af192f0 100755 --- a/scripts/build_windows_exe.sh +++ b/scripts/build_windows_exe.sh @@ -7,5 +7,5 @@ deno compile --allow-env --allow-net --allow-read --allow-run --allow-write --ta cd .. cd api -deno compile --allow-env --allow-net --allow-read --allow-run --allow-write --target x86_64-pc-windows-msvc --output ../build/bbai-api.exe src/main.ts +deno run --allow-read --allow-run --allow-write scripts/compile.ts --target x86_64-pc-windows-msvc --output ../build/bbai-api.exe cd .. diff --git a/version.ts b/version.ts index 8b74e44..6ea1709 100644 --- a/version.ts +++ b/version.ts @@ -1 +1 @@ -export const VERSION = "0.0.23-beta"; \ No newline at end of file +export const VERSION = "0.0.24-beta"; \ No newline at end of file