enable json imports (#165)

* enable json imports

* Merge remote-tracking branch 'origin/main' into enable_json_imports
This commit is contained in:
Olcan 2025-04-24 18:30:19 -07:00 committed by GitHub
parent b1b9735889
commit 08463e6114
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 2 deletions

View File

@ -9,6 +9,7 @@
}, },
"types": ["node", "vitest/globals"] "types": ["node", "vitest/globals"]
}, },
"include": ["index.ts", "src/**/*.ts", "src/**/*.tsx", "src/**/*.json"],
"exclude": ["node_modules", "dist"], "exclude": ["node_modules", "dist"],
"references": [{ "path": "../server" }] "references": [{ "path": "../server" }]
} }

View File

@ -8,6 +8,7 @@ import path from 'path';
import fs from 'fs'; import fs from 'fs';
import { Config } from '../config/config.js'; import { Config } from '../config/config.js';
import { BaseTool, ToolResult } from './tools.js'; import { BaseTool, ToolResult } from './tools.js';
import toolParameterSchema from './shell.json' with { type: 'json' };
export interface ShellToolParams { export interface ShellToolParams {
command: string; command: string;
@ -23,8 +24,6 @@ export class ShellTool extends BaseTool<ShellToolParams, ToolResult> {
const toolDisplayName = 'Shell'; const toolDisplayName = 'Shell';
const descriptionUrl = new URL('shell.md', import.meta.url); const descriptionUrl = new URL('shell.md', import.meta.url);
const toolDescription = fs.readFileSync(descriptionUrl, 'utf-8'); const toolDescription = fs.readFileSync(descriptionUrl, 'utf-8');
const schemaUrl = new URL('shell.json', import.meta.url);
const toolParameterSchema = JSON.parse(fs.readFileSync(schemaUrl, 'utf-8'));
super( super(
ShellTool.Name, ShellTool.Name,
toolDisplayName, toolDisplayName,

View File

@ -5,5 +5,6 @@
"lib": ["DOM", "DOM.Iterable", "ES2020"], "lib": ["DOM", "DOM.Iterable", "ES2020"],
"composite": true "composite": true
}, },
"include": ["index.ts", "src/**/*.ts", "src/**/*.json"],
"exclude": ["node_modules", "dist"] "exclude": ["node_modules", "dist"]
} }