opentool 0.8.6 → 0.8.7
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/README.md +3 -0
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.js +20 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +4 -42
- package/dist/index.js +20 -2
- package/dist/index.js.map +1 -1
- package/dist/{validate-D5sE9GUm.d.ts → validate-3e5UvzfQ.d.ts} +51 -1
- package/package.json +1 -1
- package/templates/base/package.json +1 -1
- package/templates/base/tools/aave-stake.ts +1 -0
package/README.md
CHANGED
|
@@ -73,6 +73,7 @@ For private tools, say for internal trading apps:
|
|
|
73
73
|
|
|
74
74
|
- GET-only (scheduled default profile)
|
|
75
75
|
- POST-only (one-off, parameterized with Zod)
|
|
76
|
+
- `profile.category` defaults to `tracker` if omitted; set to `strategy` for PnL/automation tools.
|
|
76
77
|
|
|
77
78
|
GET-only (scheduled default)
|
|
78
79
|
|
|
@@ -80,6 +81,7 @@ GET-only (scheduled default)
|
|
|
80
81
|
// tools/aave-stake.ts
|
|
81
82
|
export const profile = {
|
|
82
83
|
description: "Stake 100 USDC daily at 12:00 UTC",
|
|
84
|
+
category: "strategy",
|
|
83
85
|
fixedAmount: "100",
|
|
84
86
|
tokenSymbol: "USDC",
|
|
85
87
|
schedule: { cron: "0 12 * * *", enabled: false },
|
|
@@ -105,6 +107,7 @@ import { z } from "zod";
|
|
|
105
107
|
|
|
106
108
|
export const profile = {
|
|
107
109
|
description: "Unstake USDC on demand",
|
|
110
|
+
category: "tracker",
|
|
108
111
|
notifyEmail: true,
|
|
109
112
|
};
|
|
110
113
|
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { M as Metadata, I as InternalToolDefinition } from '../validate-
|
|
3
|
-
export { G as GenerateMetadataOptions, a as GenerateMetadataResult, V as ValidateOptions, b as generateMetadata, g as generateMetadataCommand, l as loadAndValidateTools, v as validateCommand, c as validateFullCommand } from '../validate-
|
|
2
|
+
import { M as Metadata, I as InternalToolDefinition } from '../validate-3e5UvzfQ.js';
|
|
3
|
+
export { G as GenerateMetadataOptions, a as GenerateMetadataResult, V as ValidateOptions, b as generateMetadata, g as generateMetadataCommand, l as loadAndValidateTools, v as validateCommand, c as validateFullCommand } from '../validate-3e5UvzfQ.js';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import '../x402/index.js';
|
|
6
6
|
import 'viem';
|
package/dist/cli/index.js
CHANGED
|
@@ -139,6 +139,7 @@ var DiscoveryMetadataSchema = z.object({
|
|
|
139
139
|
compatibility: z.record(z.string(), z.any()).optional(),
|
|
140
140
|
documentation: z.union([z.string(), z.array(z.string())]).optional()
|
|
141
141
|
}).catchall(z.any());
|
|
142
|
+
var ToolCategorySchema = z.enum(["strategy", "tracker"]);
|
|
142
143
|
var ToolMetadataOverridesSchema = z.object({
|
|
143
144
|
name: z.string().optional(),
|
|
144
145
|
description: z.string().optional(),
|
|
@@ -155,7 +156,8 @@ var ToolSchema = z.object({
|
|
|
155
156
|
payment: PaymentConfigSchema.optional(),
|
|
156
157
|
discovery: DiscoveryMetadataSchema.optional(),
|
|
157
158
|
chains: z.array(z.union([z.string(), z.number()])).optional(),
|
|
158
|
-
notifyEmail: z.boolean().optional()
|
|
159
|
+
notifyEmail: z.boolean().optional(),
|
|
160
|
+
category: ToolCategorySchema.optional()
|
|
159
161
|
}).strict();
|
|
160
162
|
var MetadataSchema = z.object({
|
|
161
163
|
metadataSpecVersion: z.string().optional(),
|
|
@@ -341,6 +343,10 @@ async function buildMetadataArtifact(options) {
|
|
|
341
343
|
}
|
|
342
344
|
const toolDiscovery = overrides.discovery ?? void 0;
|
|
343
345
|
const toolChains = overrides.chains ?? authored.chains ?? void 0;
|
|
346
|
+
const toolCategory = tool.profileCategory ?? "tracker";
|
|
347
|
+
if (!tool.profileCategory) {
|
|
348
|
+
defaultsApplied.push(`tool ${toolName} category \u2192 tracker (default)`);
|
|
349
|
+
}
|
|
344
350
|
const toolDefinition = {
|
|
345
351
|
name: toolName,
|
|
346
352
|
description: toolDescription,
|
|
@@ -358,10 +364,14 @@ async function buildMetadataArtifact(options) {
|
|
|
358
364
|
if (toolChains) {
|
|
359
365
|
toolDefinition.chains = toolChains;
|
|
360
366
|
}
|
|
367
|
+
toolDefinition.category = toolCategory;
|
|
361
368
|
const notifyEmail = tool.notifyEmail ?? tool.schedule?.notifyEmail;
|
|
362
369
|
if (notifyEmail !== void 0) {
|
|
363
370
|
toolDefinition.notifyEmail = notifyEmail;
|
|
364
371
|
}
|
|
372
|
+
if (tool.profileCategory) {
|
|
373
|
+
toolDefinition.category = tool.profileCategory;
|
|
374
|
+
}
|
|
365
375
|
return toolDefinition;
|
|
366
376
|
});
|
|
367
377
|
const metadata = BuildMetadataSchema.parse({
|
|
@@ -1099,6 +1109,13 @@ async function loadAndValidateTools(toolsDir, options = {}) {
|
|
|
1099
1109
|
let normalizedSchedule = null;
|
|
1100
1110
|
const schedule = toolModule?.profile?.schedule;
|
|
1101
1111
|
const profileNotifyEmail = typeof toolModule?.profile?.notifyEmail === "boolean" ? toolModule.profile.notifyEmail : void 0;
|
|
1112
|
+
const profileCategoryRaw = typeof toolModule?.profile?.category === "string" ? toolModule.profile.category : void 0;
|
|
1113
|
+
const allowedProfileCategories = /* @__PURE__ */ new Set(["strategy", "tracker"]);
|
|
1114
|
+
if (profileCategoryRaw && !allowedProfileCategories.has(profileCategoryRaw)) {
|
|
1115
|
+
throw new Error(
|
|
1116
|
+
`${file}: profile.category must be one of ${Array.from(allowedProfileCategories).join(", ")}`
|
|
1117
|
+
);
|
|
1118
|
+
}
|
|
1102
1119
|
if (hasGET && schedule && typeof schedule.cron === "string" && schedule.cron.trim().length > 0) {
|
|
1103
1120
|
normalizedSchedule = normalizeScheduleExpression(schedule.cron, file);
|
|
1104
1121
|
if (typeof schedule.enabled === "boolean") {
|
|
@@ -1169,7 +1186,8 @@ async function loadAndValidateTools(toolsDir, options = {}) {
|
|
|
1169
1186
|
payment: paymentExport ?? null,
|
|
1170
1187
|
schedule: normalizedSchedule,
|
|
1171
1188
|
...profileNotifyEmail !== void 0 ? { notifyEmail: profileNotifyEmail } : {},
|
|
1172
|
-
profileDescription: typeof toolModule?.profile?.description === "string" ? toolModule.profile?.description ?? null : null
|
|
1189
|
+
profileDescription: typeof toolModule?.profile?.description === "string" ? toolModule.profile?.description ?? null : null,
|
|
1190
|
+
...profileCategoryRaw ? { profileCategory: profileCategoryRaw } : {}
|
|
1173
1191
|
};
|
|
1174
1192
|
tools.push(tool);
|
|
1175
1193
|
}
|