opentool 0.8.5 → 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/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
2
- import { I as InternalToolDefinition, T as ToolResponse } from './validate-BJ5-5n8h.js';
3
- export { B as BuildConfig, m as BuildMetadata, H as HTTP_METHODS, f as HttpHandlerDefinition, e as HttpMethod, h as McpConfig, M as Metadata, N as NormalizedSchedule, P as PaymentConfig, S as ScheduleType, i as ServerConfig, j as Tool, d as ToolContent, k as ToolMetadataOverrides, b as generateMetadata, g as generateMetadataCommand, l as loadAndValidateTools, v as validateCommand } from './validate-BJ5-5n8h.js';
4
- import { z, ZodSchema } from 'zod';
2
+ import { I as InternalToolDefinition, T as ToolResponse } from './validate-3e5UvzfQ.js';
3
+ export { B as BuildConfig, m as BuildMetadata, C as CronSpec, q as GetHandler, H as HTTP_METHODS, f as HttpHandlerDefinition, e as HttpMethod, h as McpConfig, M as Metadata, N as NormalizedSchedule, P as PaymentConfig, r as PostHandler, S as ScheduleType, i as ServerConfig, j as Tool, n as ToolCategory, d as ToolContent, k as ToolMetadataOverrides, u as ToolModule, s as ToolModuleGET, t as ToolModulePOST, o as ToolProfileGET, p as ToolProfilePOST, b as generateMetadata, g as generateMetadataCommand, l as loadAndValidateTools, v as validateCommand } from './validate-3e5UvzfQ.js';
5
4
  export { CurrencySpec, DEFAULT_FACILITATOR, DefineX402PaymentConfig, EIP3009Authorization, PAYMENT_HEADERS, RequireX402PaymentOptions, RequireX402PaymentOutcome, RequireX402PaymentSuccess, SUPPORTED_CURRENCIES, X402BrowserClient, X402BrowserClientConfig, X402Client, X402ClientConfig, X402FacilitatorConfig, X402PayRequest, X402PayResult, X402Payment, X402PaymentContext, X402PaymentDefinition, X402PaymentRequiredError, X402VerificationResult, defineX402Payment, getX402PaymentContext, payX402, payX402WithWallet, requireX402Payment, withX402Payment } from './x402/index.js';
6
5
  export { DEFAULT_CHAIN, DEFAULT_TOKENS, chains, getRpcUrl, registry, tokens, wallet, walletToolkit } from './wallet/index.js';
7
6
  export { HyperliquidApiError, HyperliquidApproveBuilderFeeOptions, HyperliquidApproveBuilderFeeResponse, HyperliquidBuilderApprovalError, HyperliquidBuilderApprovalRecordInput, HyperliquidBuilderFee, HyperliquidClearinghouseState, HyperliquidDepositResult, HyperliquidEnvironment, HyperliquidExchangeClient, HyperliquidExchangeResponse, HyperliquidGrouping, HyperliquidGuardError, HyperliquidInfoClient, HyperliquidOrderIntent, HyperliquidOrderOptions, HyperliquidOrderResponse, HyperliquidOrderStatus, HyperliquidTermsError, HyperliquidTermsRecordInput, HyperliquidTriggerOptions, HyperliquidTriggerType, HyperliquidWithdrawResult, NonceSource, __hyperliquidInternals, approveHyperliquidBuilderFee, batchModifyHyperliquidOrders, cancelAllHyperliquidOrders, cancelHyperliquidOrders, cancelHyperliquidOrdersByCloid, cancelHyperliquidTwapOrder, createHyperliquidSubAccount, createMonotonicNonceFactory, depositToHyperliquidBridge, fetchHyperliquidAssetCtxs, fetchHyperliquidClearinghouseState, fetchHyperliquidFrontendOpenOrders, fetchHyperliquidHistoricalOrders, fetchHyperliquidMeta, fetchHyperliquidMetaAndAssetCtxs, fetchHyperliquidOpenOrders, fetchHyperliquidOrderStatus, fetchHyperliquidPreTransferCheck, fetchHyperliquidSpotAssetCtxs, fetchHyperliquidSpotClearinghouseState, fetchHyperliquidSpotMeta, fetchHyperliquidSpotMetaAndAssetCtxs, fetchHyperliquidUserFills, fetchHyperliquidUserFillsByTime, fetchHyperliquidUserRateLimit, getHyperliquidMaxBuilderFee, modifyHyperliquidOrder, placeHyperliquidOrder, placeHyperliquidTwapOrder, recordHyperliquidBuilderApproval, recordHyperliquidTermsAcceptance, reserveHyperliquidRequestWeight, scheduleHyperliquidCancel, sendHyperliquidSpot, setHyperliquidPortfolioMargin, transferHyperliquidSubAccount, updateHyperliquidIsolatedMargin, updateHyperliquidLeverage, withdrawFromHyperliquid } from './adapters/hyperliquid/index.js';
@@ -9,6 +8,7 @@ import { c as WalletFullContext } from './types-BVLpaY4O.js';
9
8
  export { C as ChainMetadata, i as ChainReference, a as ChainTokenMap, H as Hex, g as HexAddress, R as RpcProviderOptions, h as RpcUrlResolver, T as TokenMetadata, l as TurnkeyOptions, k as TurnkeySignWith, r as WalletBaseContext, s as WalletContext, n as WalletOptions, m as WalletOptionsBase, b as WalletPrivateKeyOptions, j as WalletProviderType, f as WalletReadonlyContext, e as WalletReadonlyOptions, W as WalletRegistry, o as WalletSendTransactionParams, q as WalletSignerContext, p as WalletTransferParams, d as WalletTurnkeyOptions } from './types-BVLpaY4O.js';
10
9
  export { AIAbortError, AIClientConfig, AIError, AIFetchError, AIRequestMetadata, AIResponseError, ChatCompletionChoice, ChatCompletionLogProbs, ChatCompletionResponse, ChatCompletionUsage, ChatMessage, ChatMessageContentPart, ChatMessageContentPartImageUrl, ChatMessageContentPartText, ChatMessageRole, DEFAULT_BASE_URL, DEFAULT_MODEL, DEFAULT_TIMEOUT_MS, FunctionToolDefinition, GenerateTextOptions, GenerateTextResult, GenerationParameters, JsonSchema, ResolvedAIClientConfig, ResponseErrorDetails, StreamTextOptions, StreamTextResult, StreamingEventHandlers, ToolChoice, ToolDefinition, ToolExecutionPolicy, WEBSEARCH_TOOL_DEFINITION, WEBSEARCH_TOOL_NAME, WebSearchOptions, createAIClient, ensureTextContent, flattenMessageContent, generateText, getModelConfig, isStreamingSupported, isToolCallingSupported, listModels, normalizeModelName, resolveConfig, resolveToolset, streamText } from './ai/index.js';
11
10
  export { AgentDigestRequest, MyToolsResponse, StoreAction, StoreError, StoreEventInput, StoreOptions, StoreResponse, StoreRetrieveParams, StoreRetrieveResult, ToolExecuteRequest, ToolExecuteResponse, executeTool, getMyPerformance, getMyTools, postAgentDigest, retrieve, store } from './store/index.js';
11
+ import { ZodSchema } from 'zod';
12
12
  import 'viem';
13
13
  import 'viem/accounts';
14
14
 
@@ -22,43 +22,6 @@ declare function createDevServer(tools: InternalToolDefinition[]): Server;
22
22
  declare function createStdioServer(tools?: InternalToolDefinition[]): Promise<void>;
23
23
  declare function resolveRuntimePath(value: string): string;
24
24
 
25
- type CronSpec = {
26
- /**
27
- * AWS EventBridge schedule expression (`cron(...)` or `rate(...)`).
28
- */
29
- cron: string;
30
- enabled?: boolean;
31
- notifyEmail?: boolean;
32
- };
33
- type ToolProfileGET = {
34
- description: string;
35
- schedule: CronSpec;
36
- fixedAmount?: string;
37
- tokenSymbol?: string;
38
- limits?: {
39
- concurrency?: number;
40
- dailyCap?: number;
41
- };
42
- };
43
- type ToolProfilePOST = {
44
- description?: string;
45
- };
46
- type GetHandler = (req: Request) => Promise<Response> | Response;
47
- type PostHandler = (req: Request) => Promise<Response> | Response;
48
- type ToolModuleGET = {
49
- profile: ToolProfileGET;
50
- GET: GetHandler;
51
- POST?: never;
52
- schema?: never;
53
- };
54
- type ToolModulePOST<B = unknown> = {
55
- profile?: ToolProfilePOST;
56
- POST: PostHandler;
57
- schema: z.ZodType<B>;
58
- GET?: never;
59
- };
60
- type ToolModule = ToolModuleGET | ToolModulePOST<any>;
61
-
62
25
  type PolymarketEnvironment = "mainnet" | "testnet";
63
26
  type PolymarketSide = "BUY" | "SELL";
64
27
  type PolymarketOrderType = "GTC" | "FOK" | "FAK" | "GTD";
@@ -385,4 +348,4 @@ interface CreateMcpAdapterOptions {
385
348
  declare function createMcpAdapter(options: CreateMcpAdapterOptions): (rawArguments: unknown) => Promise<ToolResponse>;
386
349
  declare function responseToToolResponse(response: Response): Promise<ToolResponse>;
387
350
 
388
- export { type CronSpec, type GetHandler, InternalToolDefinition, POLYMARKET_CHAIN_ID, POLYMARKET_CLOB_AUTH_DOMAIN, POLYMARKET_CLOB_DOMAIN, POLYMARKET_ENDPOINTS, POLYMARKET_EXCHANGE_ADDRESSES, type PolymarketApiCredentials, PolymarketApiError, type PolymarketApiKeyResponse, PolymarketAuthError, type PolymarketEnvironment, PolymarketExchangeClient, PolymarketInfoClient, type PolymarketMarket, type PolymarketOrderIntent, type PolymarketOrderType, type PolymarketOrderbook, type PolymarketPlaceOrderResponse, type PolymarketPriceHistoryPoint, type PolymarketSide, type PolymarketSignatureType, type PolymarketSignedOrderPayload, type PostHandler, type ToolModule, type ToolModuleGET, type ToolModulePOST, type ToolProfileGET, type ToolProfilePOST, ToolResponse, WalletFullContext, buildHmacSignature, buildL1Headers, buildL2Headers, buildPolymarketOrderAmounts, buildSignedOrderPayload, cancelAllPolymarketOrders, cancelMarketPolymarketOrders, cancelPolymarketOrder, cancelPolymarketOrders, createDevServer, createMcpAdapter, createPolymarketApiKey, createStdioServer, derivePolymarketApiKey, fetchPolymarketMarket, fetchPolymarketMarkets, fetchPolymarketMidpoint, fetchPolymarketOrderbook, fetchPolymarketPrice, fetchPolymarketPriceHistory, normalizeNumberArrayish, normalizeStringArrayish, placePolymarketOrder, resolveExchangeAddress, resolvePolymarketBaseUrl, resolveRuntimePath, responseToToolResponse };
351
+ export { InternalToolDefinition, POLYMARKET_CHAIN_ID, POLYMARKET_CLOB_AUTH_DOMAIN, POLYMARKET_CLOB_DOMAIN, POLYMARKET_ENDPOINTS, POLYMARKET_EXCHANGE_ADDRESSES, type PolymarketApiCredentials, PolymarketApiError, type PolymarketApiKeyResponse, PolymarketAuthError, type PolymarketEnvironment, PolymarketExchangeClient, PolymarketInfoClient, type PolymarketMarket, type PolymarketOrderIntent, type PolymarketOrderType, type PolymarketOrderbook, type PolymarketPlaceOrderResponse, type PolymarketPriceHistoryPoint, type PolymarketSide, type PolymarketSignatureType, type PolymarketSignedOrderPayload, ToolResponse, WalletFullContext, buildHmacSignature, buildL1Headers, buildL2Headers, buildPolymarketOrderAmounts, buildSignedOrderPayload, cancelAllPolymarketOrders, cancelMarketPolymarketOrders, cancelPolymarketOrder, cancelPolymarketOrders, createDevServer, createMcpAdapter, createPolymarketApiKey, createStdioServer, derivePolymarketApiKey, fetchPolymarketMarket, fetchPolymarketMarkets, fetchPolymarketMidpoint, fetchPolymarketOrderbook, fetchPolymarketPrice, fetchPolymarketPriceHistory, normalizeNumberArrayish, normalizeStringArrayish, placePolymarketOrder, resolveExchangeAddress, resolvePolymarketBaseUrl, resolveRuntimePath, responseToToolResponse };
package/dist/index.js CHANGED
@@ -4870,6 +4870,7 @@ var DiscoveryMetadataSchema = z.object({
4870
4870
  compatibility: z.record(z.string(), z.any()).optional(),
4871
4871
  documentation: z.union([z.string(), z.array(z.string())]).optional()
4872
4872
  }).catchall(z.any());
4873
+ var ToolCategorySchema = z.enum(["strategy", "tracker"]);
4873
4874
  var ToolMetadataOverridesSchema = z.object({
4874
4875
  name: z.string().optional(),
4875
4876
  description: z.string().optional(),
@@ -4885,7 +4886,9 @@ var ToolSchema = z.object({
4885
4886
  annotations: McpAnnotationsSchema.optional(),
4886
4887
  payment: PaymentConfigSchema.optional(),
4887
4888
  discovery: DiscoveryMetadataSchema.optional(),
4888
- chains: z.array(z.union([z.string(), z.number()])).optional()
4889
+ chains: z.array(z.union([z.string(), z.number()])).optional(),
4890
+ notifyEmail: z.boolean().optional(),
4891
+ category: ToolCategorySchema.optional()
4889
4892
  }).strict();
4890
4893
  var MetadataSchema = z.object({
4891
4894
  metadataSpecVersion: z.string().optional(),
@@ -5140,6 +5143,10 @@ async function buildMetadataArtifact(options) {
5140
5143
  }
5141
5144
  const toolDiscovery = overrides.discovery ?? void 0;
5142
5145
  const toolChains = overrides.chains ?? authored.chains ?? void 0;
5146
+ const toolCategory = tool.profileCategory ?? "tracker";
5147
+ if (!tool.profileCategory) {
5148
+ defaultsApplied.push(`tool ${toolName} category \u2192 tracker (default)`);
5149
+ }
5143
5150
  const toolDefinition = {
5144
5151
  name: toolName,
5145
5152
  description: toolDescription,
@@ -5157,6 +5164,14 @@ async function buildMetadataArtifact(options) {
5157
5164
  if (toolChains) {
5158
5165
  toolDefinition.chains = toolChains;
5159
5166
  }
5167
+ toolDefinition.category = toolCategory;
5168
+ const notifyEmail = tool.notifyEmail ?? tool.schedule?.notifyEmail;
5169
+ if (notifyEmail !== void 0) {
5170
+ toolDefinition.notifyEmail = notifyEmail;
5171
+ }
5172
+ if (tool.profileCategory) {
5173
+ toolDefinition.category = tool.profileCategory;
5174
+ }
5160
5175
  return toolDefinition;
5161
5176
  });
5162
5177
  const metadata = BuildMetadataSchema.parse({
@@ -5366,6 +5381,14 @@ async function loadAndValidateTools(toolsDir, options = {}) {
5366
5381
  }
5367
5382
  let normalizedSchedule = null;
5368
5383
  const schedule = toolModule?.profile?.schedule;
5384
+ const profileNotifyEmail = typeof toolModule?.profile?.notifyEmail === "boolean" ? toolModule.profile.notifyEmail : void 0;
5385
+ const profileCategoryRaw = typeof toolModule?.profile?.category === "string" ? toolModule.profile.category : void 0;
5386
+ const allowedProfileCategories = /* @__PURE__ */ new Set(["strategy", "tracker"]);
5387
+ if (profileCategoryRaw && !allowedProfileCategories.has(profileCategoryRaw)) {
5388
+ throw new Error(
5389
+ `${file}: profile.category must be one of ${Array.from(allowedProfileCategories).join(", ")}`
5390
+ );
5391
+ }
5369
5392
  if (hasGET && schedule && typeof schedule.cron === "string" && schedule.cron.trim().length > 0) {
5370
5393
  normalizedSchedule = normalizeScheduleExpression(schedule.cron, file);
5371
5394
  if (typeof schedule.enabled === "boolean") {
@@ -5435,7 +5458,9 @@ async function loadAndValidateTools(toolsDir, options = {}) {
5435
5458
  handler: async (params) => adapter(params),
5436
5459
  payment: paymentExport ?? null,
5437
5460
  schedule: normalizedSchedule,
5438
- profileDescription: typeof toolModule?.profile?.description === "string" ? toolModule.profile?.description ?? null : null
5461
+ ...profileNotifyEmail !== void 0 ? { notifyEmail: profileNotifyEmail } : {},
5462
+ profileDescription: typeof toolModule?.profile?.description === "string" ? toolModule.profile?.description ?? null : null,
5463
+ ...profileCategoryRaw ? { profileCategory: profileCategoryRaw } : {}
5439
5464
  };
5440
5465
  tools.push(tool);
5441
5466
  }