vovk 3.0.0-draft.420 → 3.0.0-draft.421
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/cjs/VovkApp.js +0 -2
- package/cjs/createVovkApp.js +1 -1
- package/cjs/utils/createLLMTools.d.ts +3 -1
- package/cjs/utils/createLLMTools.js +5 -2
- package/mjs/VovkApp.js +0 -2
- package/mjs/createVovkApp.js +1 -1
- package/mjs/utils/createLLMTools.d.ts +3 -1
- package/mjs/utils/createLLMTools.js +5 -2
- package/package.json +1 -1
package/cjs/VovkApp.js
CHANGED
package/cjs/createVovkApp.js
CHANGED
|
@@ -85,7 +85,7 @@ function createVovkApp() {
|
|
|
85
85
|
};
|
|
86
86
|
const properties = Object.keys(controller._handlers[propertyKey]?.validation?.params?.properties ?? {});
|
|
87
87
|
const kebab = toKebabCase(propertyKey); // 🥙
|
|
88
|
-
const path = properties.length ? `${kebab}/${properties.map((prop) =>
|
|
88
|
+
const path = properties.length ? `${kebab}/${properties.map((prop) => `{${prop}}`).join('/')}` : kebab;
|
|
89
89
|
assignSchema({ controller, propertyKey, path, options, httpMethod, vovkApp });
|
|
90
90
|
}
|
|
91
91
|
return decorator;
|
|
@@ -24,7 +24,8 @@ type CallerInput = {
|
|
|
24
24
|
output?: KnownAny;
|
|
25
25
|
iteration?: KnownAny;
|
|
26
26
|
} | undefined;
|
|
27
|
-
init
|
|
27
|
+
init: RequestInit | undefined;
|
|
28
|
+
apiRoot: string | undefined;
|
|
28
29
|
meta: Record<string, KnownAny> | undefined;
|
|
29
30
|
handlerName: string;
|
|
30
31
|
moduleName: string;
|
|
@@ -35,6 +36,7 @@ declare function defaultResultFormatter(result: KnownAny, _schema: VovkHandlerSc
|
|
|
35
36
|
export declare function createLLMTools({ modules, caller, meta, resultFormatter, onExecute, onError, }: {
|
|
36
37
|
modules: Record<string, object | [object, {
|
|
37
38
|
init?: RequestInit;
|
|
39
|
+
apiRoot?: string;
|
|
38
40
|
}]>;
|
|
39
41
|
caller?: typeof defaultCaller;
|
|
40
42
|
meta?: Record<string, KnownAny>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createLLMTools = createLLMTools;
|
|
4
|
-
const createLLMTool = ({ moduleName, handlerName, caller, module, init, meta, resultFormatter, onExecute, onError, }) => {
|
|
4
|
+
const createLLMTool = ({ moduleName, handlerName, caller, module, init, apiRoot, meta, resultFormatter, onExecute, onError, }) => {
|
|
5
5
|
if (!module) {
|
|
6
6
|
throw new Error(`Module "${moduleName}" not found.`);
|
|
7
7
|
}
|
|
@@ -23,6 +23,7 @@ const createLLMTool = ({ moduleName, handlerName, caller, module, init, meta, re
|
|
|
23
23
|
query,
|
|
24
24
|
params,
|
|
25
25
|
init,
|
|
26
|
+
apiRoot,
|
|
26
27
|
meta,
|
|
27
28
|
handlerName,
|
|
28
29
|
moduleName,
|
|
@@ -131,9 +132,10 @@ function createLLMTools({ modules, caller = defaultCaller, meta, resultFormatter
|
|
|
131
132
|
const tools = Object.entries(moduleWithConfig ?? {})
|
|
132
133
|
.map(([moduleName, moduleWithconfig]) => {
|
|
133
134
|
let init;
|
|
135
|
+
let apiRoot;
|
|
134
136
|
let module;
|
|
135
137
|
if (Array.isArray(moduleWithconfig)) {
|
|
136
|
-
[module, { init }] = moduleWithconfig;
|
|
138
|
+
[module, { init, apiRoot }] = moduleWithconfig;
|
|
137
139
|
}
|
|
138
140
|
else {
|
|
139
141
|
module = moduleWithconfig;
|
|
@@ -146,6 +148,7 @@ function createLLMTools({ modules, caller = defaultCaller, meta, resultFormatter
|
|
|
146
148
|
caller,
|
|
147
149
|
module,
|
|
148
150
|
init,
|
|
151
|
+
apiRoot,
|
|
149
152
|
meta,
|
|
150
153
|
resultFormatter: resultFormatter
|
|
151
154
|
? resultFormatter === 'mcp'
|
package/mjs/VovkApp.js
CHANGED
package/mjs/createVovkApp.js
CHANGED
|
@@ -85,7 +85,7 @@ function createVovkApp() {
|
|
|
85
85
|
};
|
|
86
86
|
const properties = Object.keys(controller._handlers[propertyKey]?.validation?.params?.properties ?? {});
|
|
87
87
|
const kebab = toKebabCase(propertyKey); // 🥙
|
|
88
|
-
const path = properties.length ? `${kebab}/${properties.map((prop) =>
|
|
88
|
+
const path = properties.length ? `${kebab}/${properties.map((prop) => `{${prop}}`).join('/')}` : kebab;
|
|
89
89
|
assignSchema({ controller, propertyKey, path, options, httpMethod, vovkApp });
|
|
90
90
|
}
|
|
91
91
|
return decorator;
|
|
@@ -24,7 +24,8 @@ type CallerInput = {
|
|
|
24
24
|
output?: KnownAny;
|
|
25
25
|
iteration?: KnownAny;
|
|
26
26
|
} | undefined;
|
|
27
|
-
init
|
|
27
|
+
init: RequestInit | undefined;
|
|
28
|
+
apiRoot: string | undefined;
|
|
28
29
|
meta: Record<string, KnownAny> | undefined;
|
|
29
30
|
handlerName: string;
|
|
30
31
|
moduleName: string;
|
|
@@ -35,6 +36,7 @@ declare function defaultResultFormatter(result: KnownAny, _schema: VovkHandlerSc
|
|
|
35
36
|
export declare function createLLMTools({ modules, caller, meta, resultFormatter, onExecute, onError, }: {
|
|
36
37
|
modules: Record<string, object | [object, {
|
|
37
38
|
init?: RequestInit;
|
|
39
|
+
apiRoot?: string;
|
|
38
40
|
}]>;
|
|
39
41
|
caller?: typeof defaultCaller;
|
|
40
42
|
meta?: Record<string, KnownAny>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createLLMTools = createLLMTools;
|
|
4
|
-
const createLLMTool = ({ moduleName, handlerName, caller, module, init, meta, resultFormatter, onExecute, onError, }) => {
|
|
4
|
+
const createLLMTool = ({ moduleName, handlerName, caller, module, init, apiRoot, meta, resultFormatter, onExecute, onError, }) => {
|
|
5
5
|
if (!module) {
|
|
6
6
|
throw new Error(`Module "${moduleName}" not found.`);
|
|
7
7
|
}
|
|
@@ -23,6 +23,7 @@ const createLLMTool = ({ moduleName, handlerName, caller, module, init, meta, re
|
|
|
23
23
|
query,
|
|
24
24
|
params,
|
|
25
25
|
init,
|
|
26
|
+
apiRoot,
|
|
26
27
|
meta,
|
|
27
28
|
handlerName,
|
|
28
29
|
moduleName,
|
|
@@ -131,9 +132,10 @@ function createLLMTools({ modules, caller = defaultCaller, meta, resultFormatter
|
|
|
131
132
|
const tools = Object.entries(moduleWithConfig ?? {})
|
|
132
133
|
.map(([moduleName, moduleWithconfig]) => {
|
|
133
134
|
let init;
|
|
135
|
+
let apiRoot;
|
|
134
136
|
let module;
|
|
135
137
|
if (Array.isArray(moduleWithconfig)) {
|
|
136
|
-
[module, { init }] = moduleWithconfig;
|
|
138
|
+
[module, { init, apiRoot }] = moduleWithconfig;
|
|
137
139
|
}
|
|
138
140
|
else {
|
|
139
141
|
module = moduleWithconfig;
|
|
@@ -146,6 +148,7 @@ function createLLMTools({ modules, caller = defaultCaller, meta, resultFormatter
|
|
|
146
148
|
caller,
|
|
147
149
|
module,
|
|
148
150
|
init,
|
|
151
|
+
apiRoot,
|
|
149
152
|
meta,
|
|
150
153
|
resultFormatter: resultFormatter
|
|
151
154
|
? resultFormatter === 'mcp'
|