u
This commit is contained in:
@@ -133,21 +133,25 @@ export function createJavascriptExecuteTool({ googleAuthId }) {
|
||||
additionalProperties: false,
|
||||
required: ['code'],
|
||||
properties: {
|
||||
note: {
|
||||
type: ['string', 'null'],
|
||||
description: 'A note explaining what this code is doing (or null). This note will be displayed to the user while the code is executing.',
|
||||
},
|
||||
code: {
|
||||
type: 'string',
|
||||
description: 'JavaScript code. Assign result to `module.exports`. Async code must use IIFE. Do not use require() or import.',
|
||||
},
|
||||
timeout: {
|
||||
type: 'number',
|
||||
description: `Execution timeout in ms. Default ${DEFAULT_TIMEOUT_MS}, max ${MAX_TIMEOUT_MS}.`,
|
||||
type: ['number', 'null'],
|
||||
description: `Execution timeout in ms or null. Default ${DEFAULT_TIMEOUT_MS}, max ${MAX_TIMEOUT_MS}.`,
|
||||
},
|
||||
max_output: {
|
||||
type: 'number',
|
||||
description: `Max stdout chars. Default ${DEFAULT_MAX_OUTPUT}.`,
|
||||
type: ['number', 'null'],
|
||||
description: `Max stdout chars or null. Default ${DEFAULT_MAX_OUTPUT}.`,
|
||||
},
|
||||
},
|
||||
},
|
||||
invoke: async ({ code, timeout = DEFAULT_TIMEOUT_MS, max_output = DEFAULT_MAX_OUTPUT }) => {
|
||||
invoke: async ({ code, timeout = DEFAULT_TIMEOUT_MS, max_output = DEFAULT_MAX_OUTPUT, note }) => {
|
||||
if (typeof code !== 'string' || !code.trim()) {
|
||||
throw new ToolError('"code" must be a non-empty string.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user