@tpmjs/registry-execute 0.1.3 → 0.1.4
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/LICENSE +21 -0
- package/README.md +1 -1
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/package.json +15 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2025 TPMJS
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ Execute a tool from the TPMJS registry by its toolId.
|
|
|
42
42
|
|
|
43
43
|
| Name | Type | Required | Description |
|
|
44
44
|
|------|------|----------|-------------|
|
|
45
|
-
| `toolId` | string | Yes | Tool identifier (format: `package::
|
|
45
|
+
| `toolId` | string | Yes | Tool identifier (format: `package::name`) |
|
|
46
46
|
| `params` | object | Yes | Parameters to pass to the tool |
|
|
47
47
|
| `env` | object | No | Environment variables (API keys) if required |
|
|
48
48
|
|
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@ export const registryExecuteTool = tool({
|
|
|
18
18
|
properties: {
|
|
19
19
|
toolId: {
|
|
20
20
|
type: 'string',
|
|
21
|
-
description: "Tool identifier from registrySearchTool (format: 'package::
|
|
21
|
+
description: "Tool identifier from registrySearchTool (format: 'package::name')",
|
|
22
22
|
},
|
|
23
23
|
params: {
|
|
24
24
|
type: 'object',
|
|
@@ -37,19 +37,19 @@ export const registryExecuteTool = tool({
|
|
|
37
37
|
additionalProperties: false,
|
|
38
38
|
}),
|
|
39
39
|
async execute({ toolId, params, env }) {
|
|
40
|
-
// Parse toolId format: "package::
|
|
40
|
+
// Parse toolId format: "package::name"
|
|
41
41
|
const separatorIndex = toolId.lastIndexOf('::');
|
|
42
42
|
if (separatorIndex === -1) {
|
|
43
|
-
throw new Error(`Invalid toolId format. Expected "package::
|
|
43
|
+
throw new Error(`Invalid toolId format. Expected "package::name", got "${toolId}"`);
|
|
44
44
|
}
|
|
45
45
|
const packageName = toolId.substring(0, separatorIndex);
|
|
46
|
-
const
|
|
47
|
-
if (!packageName || !
|
|
48
|
-
throw new Error(`Invalid toolId format. Expected "package::
|
|
46
|
+
const name = toolId.substring(separatorIndex + 2);
|
|
47
|
+
if (!packageName || !name) {
|
|
48
|
+
throw new Error(`Invalid toolId format. Expected "package::name", got "${toolId}"`);
|
|
49
49
|
}
|
|
50
50
|
// Fetch tool metadata to get version and importUrl
|
|
51
51
|
const metaParams = new URLSearchParams({
|
|
52
|
-
q:
|
|
52
|
+
q: name,
|
|
53
53
|
limit: '10',
|
|
54
54
|
});
|
|
55
55
|
const metaResponse = await fetch(`${TPMJS_API_URL}/api/tools/search?${metaParams}`);
|
|
@@ -61,7 +61,7 @@ export const registryExecuteTool = tool({
|
|
|
61
61
|
const toolsArray = metaData.results?.tools || [];
|
|
62
62
|
// Find the exact tool match
|
|
63
63
|
// biome-ignore lint/suspicious/noExplicitAny: API response types vary
|
|
64
|
-
const toolMeta = toolsArray.find((t) => t.package.npmPackageName === packageName && t.
|
|
64
|
+
const toolMeta = toolsArray.find((t) => t.package.npmPackageName === packageName && t.name === name);
|
|
65
65
|
if (!toolMeta) {
|
|
66
66
|
throw new Error(`Tool not found: ${toolId}`);
|
|
67
67
|
}
|
|
@@ -73,7 +73,7 @@ export const registryExecuteTool = tool({
|
|
|
73
73
|
headers: { 'Content-Type': 'application/json' },
|
|
74
74
|
body: JSON.stringify({
|
|
75
75
|
packageName,
|
|
76
|
-
|
|
76
|
+
name,
|
|
77
77
|
version,
|
|
78
78
|
importUrl,
|
|
79
79
|
params,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAEtC,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,mBAAmB,CAAC;AACvE,MAAM,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,4BAA4B,CAAC;AAW1F;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;IACtC,WAAW,EACT,yHAAyH;IAC3H,WAAW,EAAE,UAAU,CAAuB;QAC5C,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE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AAW;gBACX,IAAI;gBACJ,OAAO;gBACP,SAAS;gBACT,MAAM;gBACN,GAAG,EAAE,GAAG,IAAI,EAAE;aACf,CAAC;SACH,CAAC,CAAC;QAEH,sEAAsE;QACtE,MAAM,MAAM,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAQ,CAAC;QAE9C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,uBAAuB,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO;YACL,MAAM;YACN,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,MAAM,EAAE,MAAM,CAAC,MAAM;SACtB,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tpmjs/registry-execute",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Execute tools from the TPMJS registry in any AI SDK agent",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"main": "dist/index.js",
|
|
7
|
+
"module": "dist/index.js",
|
|
6
8
|
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
7
16
|
"keywords": [
|
|
8
|
-
"tpmjs
|
|
17
|
+
"tpmjs",
|
|
9
18
|
"ai-sdk",
|
|
10
19
|
"vercel-ai",
|
|
11
20
|
"registry",
|
|
12
21
|
"execute"
|
|
13
22
|
],
|
|
14
23
|
"dependencies": {
|
|
15
|
-
"ai": "6.0.
|
|
24
|
+
"ai": "6.0.49"
|
|
16
25
|
},
|
|
17
26
|
"devDependencies": {
|
|
18
|
-
"typescript": "^5.
|
|
27
|
+
"typescript": "^5.9.3",
|
|
19
28
|
"@tpmjs/tsconfig": "0.0.0"
|
|
20
29
|
},
|
|
21
30
|
"files": [
|
|
@@ -39,13 +48,13 @@
|
|
|
39
48
|
],
|
|
40
49
|
"tools": [
|
|
41
50
|
{
|
|
42
|
-
"
|
|
51
|
+
"name": "registryExecuteTool",
|
|
43
52
|
"description": "Execute a tool from the TPMJS registry by toolId. Use registrySearchTool first to find toolIds.",
|
|
44
53
|
"parameters": [
|
|
45
54
|
{
|
|
46
55
|
"name": "toolId",
|
|
47
56
|
"type": "string",
|
|
48
|
-
"description": "Tool identifier from registrySearchTool (format: 'package::
|
|
57
|
+
"description": "Tool identifier from registrySearchTool (format: 'package::name')",
|
|
49
58
|
"required": true
|
|
50
59
|
},
|
|
51
60
|
{
|