otto-intel-mcp 0.1.0

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.
Files changed (94) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +102 -0
  3. package/dist/adapter/cdp-signer.d.ts +133 -0
  4. package/dist/adapter/cdp-signer.js +356 -0
  5. package/dist/adapter/cdp-signer.js.map +1 -0
  6. package/dist/adapter/chain.d.ts +36 -0
  7. package/dist/adapter/chain.js +65 -0
  8. package/dist/adapter/chain.js.map +1 -0
  9. package/dist/adapter/erc20.d.ts +39 -0
  10. package/dist/adapter/erc20.js +17 -0
  11. package/dist/adapter/erc20.js.map +1 -0
  12. package/dist/adapter/lifi-decode.d.ts +52 -0
  13. package/dist/adapter/lifi-decode.js +149 -0
  14. package/dist/adapter/lifi-decode.js.map +1 -0
  15. package/dist/adapter/refusal.d.ts +21 -0
  16. package/dist/adapter/refusal.js +55 -0
  17. package/dist/adapter/refusal.js.map +1 -0
  18. package/dist/adapter/sent-step.d.ts +15 -0
  19. package/dist/adapter/sent-step.js +6 -0
  20. package/dist/adapter/sent-step.js.map +1 -0
  21. package/dist/adapter/verify.d.ts +149 -0
  22. package/dist/adapter/verify.js +432 -0
  23. package/dist/adapter/verify.js.map +1 -0
  24. package/dist/adapter-cdp-index.d.ts +6 -0
  25. package/dist/adapter-cdp-index.js +7 -0
  26. package/dist/adapter-index.d.ts +15 -0
  27. package/dist/adapter-index.js +15 -0
  28. package/dist/artifact-id.d.ts +16 -0
  29. package/dist/artifact-id.js +60 -0
  30. package/dist/boot-redaction.d.ts +16 -0
  31. package/dist/boot-redaction.js +54 -0
  32. package/dist/data-source.d.ts +7 -0
  33. package/dist/data-source.js +2 -0
  34. package/dist/errors.d.ts +70 -0
  35. package/dist/errors.js +221 -0
  36. package/dist/execution-config.d.ts +232 -0
  37. package/dist/execution-config.js +443 -0
  38. package/dist/execution-delegated-definition.d.ts +165 -0
  39. package/dist/execution-delegated-definition.js +116 -0
  40. package/dist/execution-delegation-admin-definition.d.ts +208 -0
  41. package/dist/execution-delegation-admin-definition.js +170 -0
  42. package/dist/execution-delegation-admin.d.ts +74 -0
  43. package/dist/execution-delegation-admin.js +290 -0
  44. package/dist/execution-delegation-policy.d.ts +257 -0
  45. package/dist/execution-delegation-policy.js +279 -0
  46. package/dist/execution-delegation.d.ts +190 -0
  47. package/dist/execution-delegation.js +545 -0
  48. package/dist/execution-errors.d.ts +9 -0
  49. package/dist/execution-errors.js +128 -0
  50. package/dist/execution-index.d.ts +17 -0
  51. package/dist/execution-index.js +16 -0
  52. package/dist/execution-intent.d.ts +14 -0
  53. package/dist/execution-intent.js +36 -0
  54. package/dist/execution-registration.d.ts +113 -0
  55. package/dist/execution-registration.js +161 -0
  56. package/dist/execution-tool-definitions.d.ts +1103 -0
  57. package/dist/execution-tool-definitions.js +1051 -0
  58. package/dist/execution-tools.d.ts +85 -0
  59. package/dist/execution-tools.js +690 -0
  60. package/dist/execution-types.d.ts +274 -0
  61. package/dist/execution-types.js +157 -0
  62. package/dist/hyperliquid-info-client.d.ts +31 -0
  63. package/dist/hyperliquid-info-client.js +121 -0
  64. package/dist/hyperliquid-order-assertions.d.ts +89 -0
  65. package/dist/hyperliquid-order-assertions.js +325 -0
  66. package/dist/hyperliquid-order-builder.d.ts +47 -0
  67. package/dist/hyperliquid-order-builder.js +55 -0
  68. package/dist/lifi-bridge-assertions.d.ts +49 -0
  69. package/dist/lifi-bridge-assertions.js +303 -0
  70. package/dist/lifi-execution-client.d.ts +74 -0
  71. package/dist/lifi-execution-client.js +165 -0
  72. package/dist/lifi-fee-assertions.d.ts +32 -0
  73. package/dist/lifi-fee-assertions.js +103 -0
  74. package/dist/lifi-swap-assertions.d.ts +32 -0
  75. package/dist/lifi-swap-assertions.js +214 -0
  76. package/dist/local-config.d.ts +9 -0
  77. package/dist/local-config.js +45 -0
  78. package/dist/mcp-server.d.ts +4 -0
  79. package/dist/mcp-server.js +44 -0
  80. package/dist/polymarket-clob-client.d.ts +73 -0
  81. package/dist/polymarket-clob-client.js +186 -0
  82. package/dist/polymarket-order-assertions.d.ts +60 -0
  83. package/dist/polymarket-order-assertions.js +273 -0
  84. package/dist/polymarket-order-builder.d.ts +43 -0
  85. package/dist/polymarket-order-builder.js +74 -0
  86. package/dist/prepared-artifacts.d.ts +45 -0
  87. package/dist/prepared-artifacts.js +92 -0
  88. package/dist/stdio-main.d.ts +2 -0
  89. package/dist/stdio-main.js +20 -0
  90. package/dist/tool-definitions.d.ts +20 -0
  91. package/dist/tool-definitions.js +162 -0
  92. package/dist/x402-read-source.d.ts +11 -0
  93. package/dist/x402-read-source.js +77 -0
  94. package/package.json +162 -0
@@ -0,0 +1,85 @@
1
+ import { type ExecutionServiceConfig } from './execution-config.js';
2
+ import { type DelegationServices } from './execution-delegation.js';
3
+ import { type BridgeExecutionEnvelope, type ExecutionEnvelope, type HyperliquidExecutionEnvelope, type PolymarketExecutionEnvelope } from './execution-types.js';
4
+ import { type HyperliquidInfoClient } from './hyperliquid-info-client.js';
5
+ import { type UnsignedHyperliquidAction, type UnsignedHyperliquidActionRequest } from './hyperliquid-order-builder.js';
6
+ import { type LiFiQuoteClient } from './lifi-execution-client.js';
7
+ import { type PolymarketClobClient } from './polymarket-clob-client.js';
8
+ import { type UnsignedPolymarketOrder, type UnsignedPolymarketOrderRequest } from './polymarket-order-builder.js';
9
+ /** The order-construction seam: request in, unsigned SDK-built order out. */
10
+ export type PolymarketOrderBuilder = (request: UnsignedPolymarketOrderRequest) => Promise<UnsignedPolymarketOrder>;
11
+ /** The Hyperliquid action-construction seam: legs in, venue-normalized canonical action out. */
12
+ export type HyperliquidActionBuilder = (request: UnsignedHyperliquidActionRequest) => UnsignedHyperliquidAction;
13
+ export interface ExecutionToolRuntime {
14
+ readonly config: ExecutionServiceConfig;
15
+ readonly quoteClient: LiFiQuoteClient;
16
+ readonly clobClient: PolymarketClobClient;
17
+ /**
18
+ * The Polymarket order-construction seam. Production always uses the SDK-backed builder; it is
19
+ * injectable so the decode-back assertions can be mutation-proved against a real constructed
20
+ * order — an assertion no test can redden is indistinguishable from an absent one.
21
+ */
22
+ readonly polymarketOrderBuilder: PolymarketOrderBuilder;
23
+ readonly hyperliquidInfoClient: HyperliquidInfoClient;
24
+ /** Injectable for the same reason as the Polymarket seam: the decode-back must be mutation-provable. */
25
+ readonly hyperliquidActionBuilder: HyperliquidActionBuilder;
26
+ readonly nowMs: () => number;
27
+ readonly entropy: () => Uint8Array;
28
+ /**
29
+ * 16 bytes per Hyperliquid client order id. Separate from `entropy`, which mints the 10-byte ULID
30
+ * suffix: a shared source would silently hand a 10-byte buffer to a 16-byte field.
31
+ */
32
+ readonly clientOrderIdEntropy: () => Uint8Array;
33
+ /**
34
+ * The delegated-send services (Otto's CDP developer access + the caller secret), present only on the
35
+ * hosted service when the five delegation variables are set. The prepare tools never READ it; the swap
36
+ * constructor records every artifact it mints there, because the delegated tool submits only artifacts
37
+ * this process prepared (`prepared-artifacts.ts`).
38
+ */
39
+ readonly delegation?: DelegationServices;
40
+ }
41
+ export interface ExecutionRuntimeOverrides {
42
+ readonly quoteClient?: LiFiQuoteClient;
43
+ readonly clobClient?: PolymarketClobClient;
44
+ readonly polymarketOrderBuilder?: PolymarketOrderBuilder;
45
+ readonly hyperliquidInfoClient?: HyperliquidInfoClient;
46
+ readonly hyperliquidActionBuilder?: HyperliquidActionBuilder;
47
+ readonly nowMs?: () => number;
48
+ readonly entropy?: () => Uint8Array;
49
+ readonly clientOrderIdEntropy?: () => Uint8Array;
50
+ readonly delegation?: DelegationServices;
51
+ }
52
+ export declare function createExecutionToolRuntime(config: ExecutionServiceConfig, overrides?: ExecutionRuntimeOverrides): ExecutionToolRuntime;
53
+ export declare function createExecutionToolRuntimeFromEnv(env?: NodeJS.ProcessEnv): ExecutionToolRuntime | undefined;
54
+ /**
55
+ * The hosted boot: the prepare runtime plus, when the five delegation variables are set, the delegated
56
+ * services (the optional SDK loaded, the Base RPC chain id checked). Delegation configured while
57
+ * execution is switched off is a misconfiguration and refuses to boot rather than silently dropping
58
+ * the tool.
59
+ */
60
+ export declare function createExecutionToolRuntimeWithDelegationFromEnv(env?: NodeJS.ProcessEnv): Promise<ExecutionToolRuntime | undefined>;
61
+ export declare function prepareSwap(runtime: ExecutionToolRuntime, rawInput: unknown, signal?: AbortSignal): Promise<ExecutionEnvelope>;
62
+ /**
63
+ * Build the ordered source-chain plan for a cross-chain native-USDC bridge over the enumerated v1
64
+ * Circle-CCTP route set. Prepare-only: the plan is handed to the caller's own custody to sign.
65
+ */
66
+ export declare function prepareBridge(runtime: ExecutionToolRuntime, rawInput: unknown, signal?: AbortSignal): Promise<BridgeExecutionEnvelope>;
67
+ /**
68
+ * Build an unsigned Polymarket CTF Exchange V2 limit order for the caller's own Polygon EOA, with
69
+ * Otto's builder code inside the signed struct (spec §7.3). Prepare-only: the artifact carries order
70
+ * args and the EIP-712 payload; the caller's own signer signs it and the caller's own credentials
71
+ * post it. Nothing here holds a key, a CLOB credential, or the caller's collateral.
72
+ */
73
+ export declare function preparePolymarketOrder(runtime: ExecutionToolRuntime, rawInput: unknown, signal?: AbortSignal): Promise<PolymarketExecutionEnvelope>;
74
+ /**
75
+ * Build an unsigned Hyperliquid perp order L1 action for the caller's own Hyperliquid account, with
76
+ * optional reduce-only take-profit and stop-loss triggers bundled under `normalTpsl` (spec §7.2).
77
+ *
78
+ * Prepare-only, and structurally so: nothing on this path can sign or submit. The artifact carries the
79
+ * canonical action plus the declared EIP-712 Agent domain, struct, and `connectionId` recipe; the
80
+ * caller's own signer picks the nonce, computes the digest, and signs. The root-secret-derived agent
81
+ * wallet the trade-execution agent uses (`hyperliquid-client.ts:558`) is fenced out entirely (§11), and
82
+ * the builder attribution field is spec'd and VALUELESS until the Step-0 `approveBuilderFee` reversal
83
+ * lands (§7.2), so the action carries no builder key and the envelope declares that pending state.
84
+ */
85
+ export declare function preparePerpOrder(runtime: ExecutionToolRuntime, rawInput: unknown, signal?: AbortSignal): Promise<HyperliquidExecutionEnvelope>;