opentool 0.8.27 → 0.8.29

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 CHANGED
@@ -74,6 +74,10 @@ For private tools, say for internal trading apps:
74
74
  - GET-only (scheduled default profile)
75
75
  - POST-only (one-off, parameterized with Zod)
76
76
  - `profile.category` defaults to `tracker` if omitted; set to `strategy` or `orchestrator` for PnL/automation tools.
77
+ - Strategy tools must define `profile.templatePreview` with:
78
+ - `subtitle` (required short line)
79
+ - `description` (required multi-line summary, 3-8 non-empty lines; target ~5)
80
+ - `title` is optional and defaults to the tool name when omitted.
77
81
 
78
82
  GET-only (scheduled default)
79
83
 
@@ -83,6 +87,16 @@ export const profile = {
83
87
  description: "Stake 100 USDC daily at 12:00 UTC",
84
88
  category: "strategy",
85
89
  schedule: { cron: "0 12 * * *", enabled: false },
90
+ templatePreview: {
91
+ subtitle: "Automated daily staking strategy",
92
+ description: [
93
+ "Runs once per day on your configured schedule.",
94
+ "Uses fixed, explicit sizing controls from template config.",
95
+ "Designed for long-running automated execution.",
96
+ "Keeps logic deterministic and easy to audit.",
97
+ "Best for hands-off recurring onchain actions.",
98
+ ].join("\\n"),
99
+ },
86
100
  };
87
101
 
88
102
  export async function GET(_req: Request) {
@@ -109,8 +109,14 @@ function resolveConfig(options) {
109
109
  }
110
110
  async function store(input, options) {
111
111
  const normalizedInput = normalizeStoreInput(input);
112
+ const mode = normalizedInput.mode ?? "live";
112
113
  const eventLevel = normalizedInput.eventLevel;
113
114
  const normalizedAction = normalizeAction(normalizedInput.action);
115
+ if (mode === "backtest" && !normalizedInput.backtestRunId) {
116
+ throw new StoreError(
117
+ `backtestRunId is required when mode is "backtest"`
118
+ );
119
+ }
114
120
  if (eventLevel === "execution" || eventLevel === "lifecycle") {
115
121
  if (!normalizedAction || !EXECUTION_ACTIONS_SET.has(normalizedAction)) {
116
122
  throw new StoreError(
@@ -130,7 +136,8 @@ async function store(input, options) {
130
136
  );
131
137
  }
132
138
  const { baseUrl, apiKey, fetchFn } = resolveConfig(options);
133
- const url = `${baseUrl}/apps/positions/tx`;
139
+ const path = mode === "backtest" ? "/apps/backtests/tx" : "/apps/positions/tx";
140
+ const url = `${baseUrl}${path}`;
134
141
  let response;
135
142
  try {
136
143
  response = await fetchFn(url, {