Support define is tool logic function (#17926)

- supports isTool and timeout settings in defineLogicFunction in apps
and in setting tabs definition
- compute for all toolInputSchema for logic funciton, in settings and in
code steps

<img width="991" height="802" alt="image"
src="https://github.com/user-attachments/assets/05dc1221-cac9-45a3-87b0-3b13161446fd"
/>
This commit is contained in:
martmull
2026-02-16 10:43:29 +01:00
committed by GitHub
parent f694bb99b3
commit da064d5e88
138 changed files with 4839 additions and 367 deletions
@@ -271,15 +271,20 @@ const EXCLUDED_DIRECTORIES = [
'**/__stories__/**',
'**/internal/**',
] as const;
function getTypeScriptFiles(
const EXCLUDED_FILES = ['**/get-function-input-schema.ts'] as const;
const getTypeScriptFiles = (
directoryPath: string,
includeIndex: boolean = false,
): string[] {
): string[] => {
const pattern = slash(path.join(directoryPath, '**', '*.{ts,tsx}'));
const files = globSync(pattern, {
cwd: SRC_PATH,
nodir: true,
ignore: [...EXCLUDED_EXTENSIONS, ...EXCLUDED_DIRECTORIES],
ignore: [
...EXCLUDED_EXTENSIONS,
...EXCLUDED_DIRECTORIES,
...EXCLUDED_FILES,
],
});
return files.filter(
@@ -287,7 +292,7 @@ function getTypeScriptFiles(
!file.endsWith('.d.ts') &&
(includeIndex ? true : !file.endsWith('index.ts')),
);
}
};
const getKind = (
node: ts.VariableStatement,
@@ -305,10 +310,10 @@ const getKind = (
return 'var';
};
function extractExportsFromSourceFile(sourceFile: ts.SourceFile) {
const extractExportsFromSourceFile = (sourceFile: ts.SourceFile) => {
const exports: DeclarationOccurrence[] = [];
function visit(node: ts.Node) {
const visit = (node: ts.Node): void => {
if (!ts.canHaveModifiers(node)) {
return ts.forEachChild(node, visit);
}
@@ -409,11 +414,11 @@ function extractExportsFromSourceFile(sourceFile: ts.SourceFile) {
break;
}
return ts.forEachChild(node, visit);
}
};
visit(sourceFile);
return exports;
}
};
type ExportKind =
| 'type'
@@ -430,7 +435,7 @@ type FileExports = Array<{
exports: DeclarationOccurrence[];
}>;
function findAllExports(directoryPath: string): FileExports {
const findAllExports = (directoryPath: string): FileExports => {
const results: FileExports = [];
const files = getTypeScriptFiles(directoryPath);
@@ -453,7 +458,7 @@ function findAllExports(directoryPath: string): FileExports {
}
return results;
}
};
type ExportByBarrel = {
barrel: {