@nu-art/ts-agent-tools-backend 0.400.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ModuleBE_AgentTools.d.ts +13 -0
- package/ModuleBE_AgentTools.js +32 -0
- package/ModuleBE_AgentTools.js.map +1 -0
- package/index.d.ts +2 -0
- package/index.js +3 -0
- package/index.js.map +1 -0
- package/package.json +59 -0
- package/types.d.ts +43 -0
- package/types.js +2 -0
- package/types.js.map +1 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Module, TS_Object } from '@nu-art/ts-common';
|
|
2
|
+
import { TS_AgentTool } from './types.js';
|
|
3
|
+
type Config = {};
|
|
4
|
+
export declare class ModuleBE_AgentTools_Class extends Module<Config> {
|
|
5
|
+
private tools;
|
|
6
|
+
protected init(): void;
|
|
7
|
+
registerTool<T extends TS_Object, V extends any>(tool: TS_AgentTool<T, V>): void;
|
|
8
|
+
getTools(tools?: string[]): TS_AgentTool<any, any>[] | undefined;
|
|
9
|
+
getTool(toolName: string): TS_AgentTool<any, any>;
|
|
10
|
+
clearTools(): void;
|
|
11
|
+
}
|
|
12
|
+
export declare const ModuleBE_AgentTools: ModuleBE_AgentTools_Class;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ImplementationMissingException, Module } from '@nu-art/ts-common';
|
|
2
|
+
export class ModuleBE_AgentTools_Class extends Module {
|
|
3
|
+
tools = {};
|
|
4
|
+
init() {
|
|
5
|
+
}
|
|
6
|
+
registerTool(tool) {
|
|
7
|
+
this.tools[tool.name] = tool;
|
|
8
|
+
const originalExecute = tool.execute;
|
|
9
|
+
tool.execute = async (args) => {
|
|
10
|
+
this.logDebug(`Calling tool: ${tool.name} with args:`, args);
|
|
11
|
+
return originalExecute(args);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
getTools(tools) {
|
|
15
|
+
return tools?.map(toolName => {
|
|
16
|
+
if (!this.tools[toolName])
|
|
17
|
+
throw new ImplementationMissingException(`Tool '${toolName}' not found`);
|
|
18
|
+
return this.tools[toolName];
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
getTool(toolName) {
|
|
22
|
+
const tool = this.tools[toolName];
|
|
23
|
+
if (!tool)
|
|
24
|
+
throw new ImplementationMissingException(`Tool '${toolName}' not found`);
|
|
25
|
+
return tool;
|
|
26
|
+
}
|
|
27
|
+
clearTools() {
|
|
28
|
+
this.tools = {};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export const ModuleBE_AgentTools = new ModuleBE_AgentTools_Class();
|
|
32
|
+
//# sourceMappingURL=ModuleBE_AgentTools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModuleBE_AgentTools.js","sourceRoot":"/Users/tacb0ss/dev/nu-art/beamz/_thunderstorm/ts-agents/tools/backend/src/main/","sources":["ModuleBE_AgentTools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,8BAA8B,EAAE,MAAM,EAAY,MAAM,mBAAmB,CAAC;AAKpF,MAAM,OAAO,yBACZ,SAAQ,MAAc;IAEd,KAAK,GAAG,EAA4C,CAAC;IAEnD,IAAI;IACd,CAAC;IAED,YAAY,CAAqC,IAAwB;QACxE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QAC7B,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,KAAK,EAAE,IAAO,EAAE,EAAE;YAChC,IAAI,CAAC,QAAQ,CAAC,iBAAiB,IAAI,CAAC,IAAI,aAAa,EAAE,IAAI,CAAC,CAAC;YAC7D,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC;QAC9B,CAAC,CAAC;IACH,CAAC;IAED,QAAQ,CAAC,KAAgB;QACxB,OAAO,KAAK,EAAE,GAAG,CAAC,QAAQ,CAAC,EAAE;YAC5B,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;gBACxB,MAAM,IAAI,8BAA8B,CAAC,SAAS,QAAQ,aAAa,CAAC,CAAC;YAC1E,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,QAAgB;QACvB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAClC,IAAI,CAAC,IAAI;YACR,MAAM,IAAI,8BAA8B,CAAC,SAAS,QAAQ,aAAa,CAAC,CAAC;QAE1E,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,UAAU;QAChB,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IACjB,CAAC;CACD;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,yBAAyB,EAAE,CAAC"}
|
package/index.d.ts
ADDED
package/index.js
ADDED
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/Users/tacb0ss/dev/nu-art/beamz/_thunderstorm/ts-agents/tools/backend/src/main/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,YAAY,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nu-art/ts-agent-tools-backend",
|
|
3
|
+
"version": "0.400.2",
|
|
4
|
+
"description": "",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"TacB0sS",
|
|
7
|
+
"infra",
|
|
8
|
+
"nu-art",
|
|
9
|
+
"thunderstorm",
|
|
10
|
+
"typescript",
|
|
11
|
+
"ts-openai"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/nu-art-js/thunderstorm",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/nu-art-js/thunderstorm/issues"
|
|
16
|
+
},
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"directory": "dist",
|
|
19
|
+
"linkDirectory": true
|
|
20
|
+
},
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "git+ssh://git@github.com:nu-art-js/thunderstorm.git"
|
|
24
|
+
},
|
|
25
|
+
"license": "Apache-2.0",
|
|
26
|
+
"author": "TacB0sS",
|
|
27
|
+
"files": [
|
|
28
|
+
"**/*"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsc"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@nu-art/ts-common": "0.400.2",
|
|
35
|
+
"@nu-art/thunderstorm": "0.400.2",
|
|
36
|
+
"openai": "^6.7.0",
|
|
37
|
+
"firebase": "^11.9.0",
|
|
38
|
+
"firebase-admin": "13.4.0",
|
|
39
|
+
"firebase-functions": "6.3.2",
|
|
40
|
+
"react": "^18.0.0",
|
|
41
|
+
"sinon": "^20.0.0"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@types/react": "^18.0.0",
|
|
45
|
+
"@types/chai": "^4.3.4",
|
|
46
|
+
"@types/mocha": "^10.0.1",
|
|
47
|
+
"@types/sinon": "^17.0.0"
|
|
48
|
+
},
|
|
49
|
+
"unitConfig": {
|
|
50
|
+
"type": "typescript-lib"
|
|
51
|
+
},
|
|
52
|
+
"type": "module",
|
|
53
|
+
"exports": {
|
|
54
|
+
".": {
|
|
55
|
+
"types": "./index.d.ts",
|
|
56
|
+
"import": "./index.js"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ArrayType, MandatoryKeys, TS_Object } from '@nu-art/ts-common';
|
|
2
|
+
export type JSONSchemaTypeAsString<ValueType> = ValueType extends readonly any[] ? 'array' : ValueType extends any[] ? 'array' : ValueType extends string ? 'string' : ValueType extends number ? 'number' : ValueType extends boolean ? 'boolean' : ValueType extends object ? 'object' : never;
|
|
3
|
+
type JSON_ValueSchema<T> = {
|
|
4
|
+
type: JSONSchemaTypeAsString<T>;
|
|
5
|
+
description: string;
|
|
6
|
+
default?: T;
|
|
7
|
+
};
|
|
8
|
+
type JSON_ArraySchema<T> = {
|
|
9
|
+
items: [T] extends [readonly any[] | any[]] ? JSON_Schema<ArrayType<T>> : never;
|
|
10
|
+
};
|
|
11
|
+
type JSON_StringSchema<T> = {
|
|
12
|
+
enum?: [T] extends [string] ? readonly T[] : never;
|
|
13
|
+
pattern?: string;
|
|
14
|
+
};
|
|
15
|
+
type JSON_BooleanSchema<T> = {};
|
|
16
|
+
type JSON_NumberSchema<T> = {
|
|
17
|
+
enum?: [T] extends [number] ? readonly T[] : never;
|
|
18
|
+
minimum?: number;
|
|
19
|
+
maximum?: number;
|
|
20
|
+
};
|
|
21
|
+
type JSON_ObjectSchema<T> = {
|
|
22
|
+
properties: [T] extends [TS_Object] ? {
|
|
23
|
+
[P in keyof T]?: JSON_Schema<T[P]>;
|
|
24
|
+
} : never;
|
|
25
|
+
required: [T] extends [TS_Object] ? ReadonlyArray<MandatoryKeys<T> & string> : never;
|
|
26
|
+
};
|
|
27
|
+
export type JSON_Schema<T = unknown> = JSON_ValueSchema<T> & ([
|
|
28
|
+
T
|
|
29
|
+
] extends [readonly any[] | any[]] ? JSON_ArraySchema<T> : [
|
|
30
|
+
T
|
|
31
|
+
] extends [string] ? JSON_StringSchema<T> : [
|
|
32
|
+
T
|
|
33
|
+
] extends [number] ? JSON_NumberSchema<T> : [
|
|
34
|
+
T
|
|
35
|
+
] extends [boolean] ? JSON_BooleanSchema<T> : [
|
|
36
|
+
T
|
|
37
|
+
] extends [TS_Object] ? JSON_ObjectSchema<T> : never);
|
|
38
|
+
export type TS_AgentTool<Input extends TS_Object, Output> = {
|
|
39
|
+
name: string;
|
|
40
|
+
inputSchema: JSON_Schema<Input>;
|
|
41
|
+
execute: (args: Input) => Promise<Output>;
|
|
42
|
+
};
|
|
43
|
+
export {};
|
package/types.js
ADDED
package/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"/Users/tacb0ss/dev/nu-art/beamz/_thunderstorm/ts-agents/tools/backend/src/main/","sources":["types.ts"],"names":[],"mappings":""}
|