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/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-D5sE9GUm.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-D5sE9GUm.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,44 +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
- notifyEmail?: boolean;
46
- };
47
- type GetHandler = (req: Request) => Promise<Response> | Response;
48
- type PostHandler = (req: Request) => Promise<Response> | Response;
49
- type ToolModuleGET = {
50
- profile: ToolProfileGET;
51
- GET: GetHandler;
52
- POST?: never;
53
- schema?: never;
54
- };
55
- type ToolModulePOST<B = unknown> = {
56
- profile?: ToolProfilePOST;
57
- POST: PostHandler;
58
- schema: z.ZodType<B>;
59
- GET?: never;
60
- };
61
- type ToolModule = ToolModuleGET | ToolModulePOST<any>;
62
-
63
25
  type PolymarketEnvironment = "mainnet" | "testnet";
64
26
  type PolymarketSide = "BUY" | "SELL";
65
27
  type PolymarketOrderType = "GTC" | "FOK" | "FAK" | "GTD";
@@ -386,4 +348,4 @@ interface CreateMcpAdapterOptions {
386
348
  declare function createMcpAdapter(options: CreateMcpAdapterOptions): (rawArguments: unknown) => Promise<ToolResponse>;
387
349
  declare function responseToToolResponse(response: Response): Promise<ToolResponse>;
388
350
 
389
- 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(),
@@ -4886,7 +4887,8 @@ var ToolSchema = z.object({
4886
4887
  payment: PaymentConfigSchema.optional(),
4887
4888
  discovery: DiscoveryMetadataSchema.optional(),
4888
4889
  chains: z.array(z.union([z.string(), z.number()])).optional(),
4889
- notifyEmail: z.boolean().optional()
4890
+ notifyEmail: z.boolean().optional(),
4891
+ category: ToolCategorySchema.optional()
4890
4892
  }).strict();
4891
4893
  var MetadataSchema = z.object({
4892
4894
  metadataSpecVersion: z.string().optional(),
@@ -5141,6 +5143,10 @@ async function buildMetadataArtifact(options) {
5141
5143
  }
5142
5144
  const toolDiscovery = overrides.discovery ?? void 0;
5143
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
+ }
5144
5150
  const toolDefinition = {
5145
5151
  name: toolName,
5146
5152
  description: toolDescription,
@@ -5158,10 +5164,14 @@ async function buildMetadataArtifact(options) {
5158
5164
  if (toolChains) {
5159
5165
  toolDefinition.chains = toolChains;
5160
5166
  }
5167
+ toolDefinition.category = toolCategory;
5161
5168
  const notifyEmail = tool.notifyEmail ?? tool.schedule?.notifyEmail;
5162
5169
  if (notifyEmail !== void 0) {
5163
5170
  toolDefinition.notifyEmail = notifyEmail;
5164
5171
  }
5172
+ if (tool.profileCategory) {
5173
+ toolDefinition.category = tool.profileCategory;
5174
+ }
5165
5175
  return toolDefinition;
5166
5176
  });
5167
5177
  const metadata = BuildMetadataSchema.parse({
@@ -5372,6 +5382,13 @@ async function loadAndValidateTools(toolsDir, options = {}) {
5372
5382
  let normalizedSchedule = null;
5373
5383
  const schedule = toolModule?.profile?.schedule;
5374
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
+ }
5375
5392
  if (hasGET && schedule && typeof schedule.cron === "string" && schedule.cron.trim().length > 0) {
5376
5393
  normalizedSchedule = normalizeScheduleExpression(schedule.cron, file);
5377
5394
  if (typeof schedule.enabled === "boolean") {
@@ -5442,7 +5459,8 @@ async function loadAndValidateTools(toolsDir, options = {}) {
5442
5459
  payment: paymentExport ?? null,
5443
5460
  schedule: normalizedSchedule,
5444
5461
  ...profileNotifyEmail !== void 0 ? { notifyEmail: profileNotifyEmail } : {},
5445
- profileDescription: typeof toolModule?.profile?.description === "string" ? toolModule.profile?.description ?? null : null
5462
+ profileDescription: typeof toolModule?.profile?.description === "string" ? toolModule.profile?.description ?? null : null,
5463
+ ...profileCategoryRaw ? { profileCategory: profileCategoryRaw } : {}
5446
5464
  };
5447
5465
  tools.push(tool);
5448
5466
  }