otto-intel-mcp 0.1.2 → 0.1.4
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 +76 -18
- package/dist/account-userop-policy-definition.d.ts +14 -0
- package/dist/account-userop-policy-definition.js +12 -0
- package/dist/account-userop-policy-relation.d.ts +371 -0
- package/dist/account-userop-policy-relation.js +87 -0
- package/dist/adapter/cdp-signer.d.ts +76 -9
- package/dist/adapter/cdp-signer.js +274 -33
- package/dist/adapter/evm-call-failure.d.ts +29 -0
- package/dist/adapter/evm-call-failure.js +109 -0
- package/dist/adapter/refusal.d.ts +1 -1
- package/dist/adapter/refusal.js +13 -0
- package/dist/adapter/route-simulator.d.ts +91 -0
- package/dist/adapter/route-simulator.js +143 -0
- package/dist/adapter-cdp-index.d.ts +1 -1
- package/dist/executable-equities.d.ts +55 -0
- package/dist/executable-equities.js +116 -0
- package/dist/executable-yield-markets.d.ts +261 -0
- package/dist/executable-yield-markets.js +154 -0
- package/dist/execution-account-gas-quote.d.ts +141 -0
- package/dist/execution-account-gas-quote.js +443 -0
- package/dist/execution-account-gas-review.d.ts +123 -0
- package/dist/execution-account-gas-review.js +104 -0
- package/dist/execution-account-gas-runtime.d.ts +33 -0
- package/dist/execution-account-gas-runtime.js +131 -0
- package/dist/execution-account-gas-view.d.ts +936 -0
- package/dist/execution-account-gas-view.js +56 -0
- package/dist/execution-config.d.ts +3 -0
- package/dist/execution-config.js +4 -0
- package/dist/execution-delegated-definition.d.ts +7 -6
- package/dist/execution-delegated-definition.js +13 -2
- package/dist/execution-delegation-admin-definition.d.ts +127 -5
- package/dist/execution-delegation-admin-definition.js +155 -5
- package/dist/execution-delegation-admin.d.ts +48 -2
- package/dist/execution-delegation-admin.js +422 -12
- package/dist/execution-delegation-cap-store.d.ts +386 -0
- package/dist/execution-delegation-cap-store.js +1150 -0
- package/dist/execution-delegation-exit-definition.d.ts +309 -0
- package/dist/execution-delegation-exit-definition.js +204 -0
- package/dist/execution-delegation-exit-store.d.ts +114 -0
- package/dist/execution-delegation-exit-store.js +671 -0
- package/dist/execution-delegation-exit.d.ts +4 -0
- package/dist/execution-delegation-exit.js +614 -0
- package/dist/execution-delegation-finality.d.ts +22 -0
- package/dist/execution-delegation-finality.js +90 -0
- package/dist/execution-delegation-operation-store.d.ts +129 -0
- package/dist/execution-delegation-operation-store.js +1107 -0
- package/dist/execution-delegation-operations-definition.d.ts +282 -0
- package/dist/execution-delegation-operations-definition.js +117 -0
- package/dist/execution-delegation-operations.d.ts +6 -0
- package/dist/execution-delegation-operations.js +282 -0
- package/dist/execution-delegation-policy.d.ts +154 -8
- package/dist/execution-delegation-policy.js +273 -40
- package/dist/execution-delegation.d.ts +51 -0
- package/dist/execution-delegation.js +441 -31
- package/dist/execution-errors.d.ts +1 -1
- package/dist/execution-errors.js +122 -0
- package/dist/execution-index.d.ts +7 -2
- package/dist/execution-index.js +7 -2
- package/dist/execution-journal-schema.d.ts +96 -0
- package/dist/execution-journal-schema.js +368 -0
- package/dist/execution-journal-tables.d.ts +14 -0
- package/dist/execution-journal-tables.js +227 -0
- package/dist/execution-policy-compatibility.d.ts +34 -0
- package/dist/execution-policy-compatibility.js +76 -0
- package/dist/execution-registration.d.ts +54 -2
- package/dist/execution-registration.js +151 -5
- package/dist/execution-sponsored-account-profile.d.ts +32 -0
- package/dist/execution-sponsored-account-profile.js +59 -0
- package/dist/execution-sponsored-account.d.ts +1519 -0
- package/dist/execution-sponsored-account.js +222 -0
- package/dist/execution-sponsored-definition.d.ts +1713 -0
- package/dist/execution-sponsored-definition.js +185 -0
- package/dist/execution-sponsored-gas-policy.d.ts +27 -0
- package/dist/execution-sponsored-gas-policy.js +110 -0
- package/dist/execution-sponsored-hosted.d.ts +3 -0
- package/dist/execution-sponsored-hosted.js +71 -0
- package/dist/execution-sponsored-index.d.ts +1322 -0
- package/dist/execution-sponsored-index.js +102 -0
- package/dist/execution-sponsored-mcp-definition.d.ts +1662 -0
- package/dist/execution-sponsored-mcp-definition.js +94 -0
- package/dist/execution-sponsored-receipt.d.ts +47 -0
- package/dist/execution-sponsored-receipt.js +74 -0
- package/dist/execution-sponsored-registration.d.ts +14 -0
- package/dist/execution-sponsored-registration.js +77 -0
- package/dist/execution-sponsored-runtime.d.ts +84 -0
- package/dist/execution-sponsored-runtime.js +149 -0
- package/dist/execution-sponsored-settlement.d.ts +15 -0
- package/dist/execution-sponsored-settlement.js +88 -0
- package/dist/execution-sponsored-store.d.ts +67 -0
- package/dist/execution-sponsored-store.js +517 -0
- package/dist/execution-sponsored-transport.d.ts +90 -0
- package/dist/execution-sponsored-transport.js +180 -0
- package/dist/execution-tool-definitions.d.ts +21 -21
- package/dist/execution-tool-definitions.js +0 -7
- package/dist/execution-tools.d.ts +53 -1
- package/dist/execution-tools.js +171 -13
- package/dist/execution-worker-guard.d.ts +28 -0
- package/dist/execution-worker-guard.js +124 -0
- package/dist/hybrid-yield-index.d.ts +10 -0
- package/dist/hybrid-yield-index.js +11 -0
- package/dist/hybrid-yield-markets.d.ts +96 -0
- package/dist/hybrid-yield-markets.js +124 -0
- package/dist/hybrid-yield.d.ts +411 -0
- package/dist/hybrid-yield.js +155 -0
- package/dist/hyperliquid-order-builder.js +4 -0
- package/dist/lifi-execution-client.d.ts +6 -0
- package/dist/lifi-execution-client.js +3 -0
- package/dist/lp-userop-account.d.ts +461 -0
- package/dist/lp-userop-account.js +417 -0
- package/dist/lp-userop-authority.d.ts +49 -0
- package/dist/lp-userop-authority.js +211 -0
- package/dist/lp-userop-definition.d.ts +233 -0
- package/dist/lp-userop-definition.js +85 -0
- package/dist/lp-userop-hosted.d.ts +3 -0
- package/dist/lp-userop-hosted.js +73 -0
- package/dist/lp-userop-index.d.ts +1569 -0
- package/dist/lp-userop-index.js +112 -0
- package/dist/lp-userop-mcp-definition.d.ts +1220 -0
- package/dist/lp-userop-mcp-definition.js +46 -0
- package/dist/lp-userop-operation.d.ts +1230 -0
- package/dist/lp-userop-operation.js +140 -0
- package/dist/lp-userop-registration.d.ts +14 -0
- package/dist/lp-userop-registration.js +70 -0
- package/dist/lp-userop-settlement.d.ts +89 -0
- package/dist/lp-userop-settlement.js +184 -0
- package/dist/lp-userop.d.ts +643 -0
- package/dist/lp-userop.js +343 -0
- package/dist/native-yield-account-definition.d.ts +1192 -0
- package/dist/native-yield-account-definition.js +232 -0
- package/dist/native-yield-account-gas.d.ts +58 -0
- package/dist/native-yield-account-gas.js +228 -0
- package/dist/native-yield-account-index.d.ts +23 -0
- package/dist/native-yield-account-index.js +28 -0
- package/dist/native-yield-account-policy.d.ts +168 -0
- package/dist/native-yield-account-policy.js +525 -0
- package/dist/native-yield-account-rpc.d.ts +8 -0
- package/dist/native-yield-account-rpc.js +128 -0
- package/dist/native-yield-account-runtime.d.ts +71 -0
- package/dist/native-yield-account-runtime.js +125 -0
- package/dist/native-yield-account-store.d.ts +40 -0
- package/dist/native-yield-account-store.js +307 -0
- package/dist/native-yield-account.d.ts +662 -0
- package/dist/native-yield-account.js +371 -0
- package/dist/native-yield-consent-store.d.ts +20 -0
- package/dist/native-yield-consent-store.js +317 -0
- package/dist/native-yield-definition.d.ts +288 -0
- package/dist/native-yield-definition.js +105 -0
- package/dist/native-yield-reader.d.ts +4 -0
- package/dist/native-yield-reader.js +137 -0
- package/dist/native-yield-settlement.d.ts +48 -0
- package/dist/native-yield-settlement.js +167 -0
- package/dist/native-yield-simulation.d.ts +18 -0
- package/dist/native-yield-simulation.js +45 -0
- package/dist/native-yield-userop-account.d.ts +675 -0
- package/dist/native-yield-userop-account.js +357 -0
- package/dist/native-yield-userop-authority.d.ts +214 -0
- package/dist/native-yield-userop-authority.js +296 -0
- package/dist/native-yield-userop-definition.d.ts +331 -0
- package/dist/native-yield-userop-definition.js +105 -0
- package/dist/native-yield-userop-hosted.d.ts +3 -0
- package/dist/native-yield-userop-hosted.js +71 -0
- package/dist/native-yield-userop-index.d.ts +1522 -0
- package/dist/native-yield-userop-index.js +142 -0
- package/dist/native-yield-userop-mcp-definition.d.ts +1356 -0
- package/dist/native-yield-userop-mcp-definition.js +50 -0
- package/dist/native-yield-userop-operation.d.ts +845 -0
- package/dist/native-yield-userop-operation.js +127 -0
- package/dist/native-yield-userop-policy.d.ts +23 -0
- package/dist/native-yield-userop-policy.js +25 -0
- package/dist/native-yield-userop-registration.d.ts +17 -0
- package/dist/native-yield-userop-registration.js +76 -0
- package/dist/native-yield-userop-settlement.d.ts +8 -0
- package/dist/native-yield-userop-settlement.js +79 -0
- package/dist/native-yield-userop-simulation.d.ts +18 -0
- package/dist/native-yield-userop-simulation.js +34 -0
- package/dist/native-yield-userop.d.ts +35 -0
- package/dist/native-yield-userop.js +156 -0
- package/dist/native-yield-verify.d.ts +30 -0
- package/dist/native-yield-verify.js +141 -0
- package/dist/native-yield.d.ts +17 -0
- package/dist/native-yield.js +119 -0
- package/dist/stdio-main.js +0 -0
- package/dist/stock-buy-definition.d.ts +338 -0
- package/dist/stock-buy-definition.js +127 -0
- package/dist/stock-buy-oracle.d.ts +8 -0
- package/dist/stock-buy-oracle.js +22 -0
- package/dist/stock-buy.d.ts +17 -0
- package/dist/stock-buy.js +164 -0
- package/dist/tool-definitions.d.ts +3 -1
- package/dist/tool-definitions.js +55 -2
- package/dist/vendor/lp-v3/lp-v3-atomic-contract.d.ts +445 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-contract.js +90 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-evidence.d.ts +14 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-evidence.js +82 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-index.d.ts +80 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-index.js +19 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-plan.d.ts +43 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-plan.js +112 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-read-contract.d.ts +312 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-read-contract.js +41 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-read-index.d.ts +3 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-read-index.js +3 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-read-rpc.d.ts +49 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-read-rpc.js +88 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-read.d.ts +17 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-read.js +232 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-settlement.d.ts +105 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-settlement.js +162 -0
- package/dist/vendor/lp-v3/lp-v3-collect-protocol-contract.d.ts +606 -0
- package/dist/vendor/lp-v3/lp-v3-collect-protocol-contract.js +59 -0
- package/dist/vendor/lp-v3/lp-v3-collect-protocol-index.d.ts +168 -0
- package/dist/vendor/lp-v3/lp-v3-collect-protocol-index.js +23 -0
- package/dist/vendor/lp-v3/lp-v3-collect-protocol-observation.d.ts +32 -0
- package/dist/vendor/lp-v3/lp-v3-collect-protocol-observation.js +228 -0
- package/dist/vendor/lp-v3/lp-v3-collect-protocol-plan.d.ts +11 -0
- package/dist/vendor/lp-v3/lp-v3-collect-protocol-plan.js +91 -0
- package/dist/vendor/lp-v3/lp-v3-collect-protocol-reconcile.d.ts +9 -0
- package/dist/vendor/lp-v3/lp-v3-collect-protocol-reconcile.js +124 -0
- package/dist/vendor/lp-v3/lp-v3-contract.d.ts +538 -0
- package/dist/vendor/lp-v3/lp-v3-contract.js +137 -0
- package/dist/vendor/lp-v3/lp-v3-evidence.d.ts +25 -0
- package/dist/vendor/lp-v3/lp-v3-evidence.js +168 -0
- package/dist/vendor/lp-v3/lp-v3-plan.d.ts +22 -0
- package/dist/vendor/lp-v3/lp-v3-plan.js +135 -0
- package/dist/vendor/lp-v3/types.d.ts +131 -0
- package/dist/vendor/lp-v3/types.js +6 -0
- package/dist/vendor/lp-v3/v4-math.d.ts +18 -0
- package/dist/vendor/lp-v3/v4-math.js +90 -0
- package/dist/yield-deposit-definition.d.ts +374 -0
- package/dist/yield-deposit-definition.js +123 -0
- package/dist/yield-deposit.d.ts +16 -0
- package/dist/yield-deposit.js +149 -0
- package/dist/yield-route-semantics.d.ts +27 -0
- package/dist/yield-route-semantics.js +71 -0
- package/dist/yield-withdraw-definition.d.ts +357 -0
- package/dist/yield-withdraw-definition.js +90 -0
- package/dist/yield-withdraw.d.ts +11 -0
- package/dist/yield-withdraw.js +122 -0
- package/package.json +239 -7
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
/** Token-bound, read-only view of the durable delegated-operation journal. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { type DelegatedSendResult } from './execution-delegated-definition.js';
|
|
4
|
+
import { type DelegationOperationRecord } from './execution-delegation-operation-store.js';
|
|
5
|
+
export declare const DELEGATION_OPERATIONS_TOOL_NAME: "otto_delegation_operations";
|
|
6
|
+
export declare const DELEGATION_RECONCILE_TOOL_NAME: "otto_delegation_reconcile";
|
|
7
|
+
export declare const DELEGATION_OPERATIONS_INPUT_SCHEMA: z.ZodObject<{
|
|
8
|
+
accessToken: z.ZodString;
|
|
9
|
+
artifactId: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, z.core.$strict>;
|
|
11
|
+
export declare const DELEGATION_RECONCILE_INPUT_SCHEMA: z.ZodObject<{
|
|
12
|
+
accessToken: z.ZodString;
|
|
13
|
+
artifactId: z.ZodString;
|
|
14
|
+
}, z.core.$strict>;
|
|
15
|
+
export declare const DELEGATION_OPERATIONS_RESULT_SCHEMA: z.ZodObject<{
|
|
16
|
+
user_id: z.ZodString;
|
|
17
|
+
store_available: z.ZodBoolean;
|
|
18
|
+
journal: z.ZodObject<{
|
|
19
|
+
schema_version: z.ZodLiteral<2>;
|
|
20
|
+
ready: z.ZodBoolean;
|
|
21
|
+
coverage_started_at: z.ZodNullable<z.ZodString>;
|
|
22
|
+
}, z.core.$strict>;
|
|
23
|
+
unresolved: z.ZodBoolean;
|
|
24
|
+
operations: z.ZodArray<z.ZodObject<{
|
|
25
|
+
artifact_id: z.ZodString;
|
|
26
|
+
account: z.ZodString;
|
|
27
|
+
chain_id: z.ZodLiteral<8453>;
|
|
28
|
+
state: z.ZodEnum<{
|
|
29
|
+
unknown: "unknown";
|
|
30
|
+
confirmed: "confirmed";
|
|
31
|
+
prepared: "prepared";
|
|
32
|
+
submitted: "submitted";
|
|
33
|
+
failed: "failed";
|
|
34
|
+
}>;
|
|
35
|
+
created_at: z.ZodString;
|
|
36
|
+
updated_at: z.ZodString;
|
|
37
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
38
|
+
index: z.ZodNumber;
|
|
39
|
+
transaction_hash: z.ZodOptional<z.ZodString>;
|
|
40
|
+
state: z.ZodEnum<{
|
|
41
|
+
unknown: "unknown";
|
|
42
|
+
confirmed: "confirmed";
|
|
43
|
+
prepared: "prepared";
|
|
44
|
+
submitted: "submitted";
|
|
45
|
+
failed: "failed";
|
|
46
|
+
}>;
|
|
47
|
+
}, z.core.$strict>>;
|
|
48
|
+
result: z.ZodOptional<z.ZodObject<{
|
|
49
|
+
status: z.ZodLiteral<"sent">;
|
|
50
|
+
user_id: z.ZodString;
|
|
51
|
+
address: z.ZodString;
|
|
52
|
+
chain_id: z.ZodLiteral<8453>;
|
|
53
|
+
artifact_id: z.ZodString;
|
|
54
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
55
|
+
index: z.ZodNumber;
|
|
56
|
+
kind: z.ZodEnum<{
|
|
57
|
+
approve: "approve";
|
|
58
|
+
approve_reset: "approve_reset";
|
|
59
|
+
call: "call";
|
|
60
|
+
}>;
|
|
61
|
+
to: z.ZodString;
|
|
62
|
+
transaction_hash: z.ZodString;
|
|
63
|
+
status: z.ZodLiteral<"success">;
|
|
64
|
+
block_number: z.ZodString;
|
|
65
|
+
gas_used: z.ZodString;
|
|
66
|
+
}, z.core.$strict>>;
|
|
67
|
+
fence: z.ZodObject<{
|
|
68
|
+
policy_id: z.ZodString;
|
|
69
|
+
policy_name: z.ZodString;
|
|
70
|
+
rules_digest: z.ZodString;
|
|
71
|
+
per_swap_cap_usd: z.ZodLiteral<5000>;
|
|
72
|
+
user_cap_usd: z.ZodNumber;
|
|
73
|
+
}, z.core.$strict>;
|
|
74
|
+
delegation: z.ZodObject<{
|
|
75
|
+
expires_at: z.ZodString;
|
|
76
|
+
}, z.core.$strict>;
|
|
77
|
+
replayed: z.ZodOptional<z.ZodBoolean>;
|
|
78
|
+
verification: z.ZodObject<{
|
|
79
|
+
checks: z.ZodArray<z.ZodString>;
|
|
80
|
+
gross: z.ZodString;
|
|
81
|
+
min_amount_out: z.ZodString;
|
|
82
|
+
otto_fee_atomic: z.ZodString;
|
|
83
|
+
otto_fee_recipient: z.ZodString;
|
|
84
|
+
fee_config_version: z.ZodString;
|
|
85
|
+
receiver: z.ZodString;
|
|
86
|
+
call_data_digest: z.ZodOptional<z.ZodString>;
|
|
87
|
+
}, z.core.$strict>;
|
|
88
|
+
}, z.core.$strict>>;
|
|
89
|
+
}, z.core.$strict>>;
|
|
90
|
+
}, z.core.$strict>;
|
|
91
|
+
export type DelegationOperationsResult = z.infer<typeof DELEGATION_OPERATIONS_RESULT_SCHEMA>;
|
|
92
|
+
/**
|
|
93
|
+
* Parse a stored success only when it is the exact receipt for this durable operation.
|
|
94
|
+
* Both replay and the protected lookup use this one validator so neither can trust a
|
|
95
|
+
* schema-valid result whose user, artifact, account, chain, step order, kind or hash
|
|
96
|
+
* disagrees with the journal.
|
|
97
|
+
*/
|
|
98
|
+
export declare function confirmedDelegationOperationResult(operation: DelegationOperationRecord): DelegatedSendResult | undefined;
|
|
99
|
+
export declare const DELEGATION_OPERATIONS_TOOL_DEFINITION: Readonly<{
|
|
100
|
+
name: "otto_delegation_operations";
|
|
101
|
+
title: "Read one end user's delegated operation history and recovery state";
|
|
102
|
+
description: "Read the durable Base delegated-operation journal for the end user resolved from { accessToken }. Optional artifactId selects one exact own-user operation; without it, the result includes a bounded recent terminal history and every unresolved operation regardless of age. The global unresolved flag is fail-closed: it is true when the store is unavailable, journal coverage is not rollout-ready, or any operation has a prepared/submitted/unknown outcome. Stored serialized transactions and CDP idempotency keys are never returned, and this tool never submits or retries anything. Server-to-server only: the caller also presents Otto's delegation secret in the x-otto-delegation-auth request header; no userId argument is accepted.";
|
|
103
|
+
inputSchema: z.ZodObject<{}, z.core.$loose>;
|
|
104
|
+
strictInputSchema: z.ZodObject<{
|
|
105
|
+
accessToken: z.ZodString;
|
|
106
|
+
artifactId: z.ZodOptional<z.ZodString>;
|
|
107
|
+
}, z.core.$strict>;
|
|
108
|
+
outputSchema: z.ZodObject<{
|
|
109
|
+
user_id: z.ZodString;
|
|
110
|
+
store_available: z.ZodBoolean;
|
|
111
|
+
journal: z.ZodObject<{
|
|
112
|
+
schema_version: z.ZodLiteral<2>;
|
|
113
|
+
ready: z.ZodBoolean;
|
|
114
|
+
coverage_started_at: z.ZodNullable<z.ZodString>;
|
|
115
|
+
}, z.core.$strict>;
|
|
116
|
+
unresolved: z.ZodBoolean;
|
|
117
|
+
operations: z.ZodArray<z.ZodObject<{
|
|
118
|
+
artifact_id: z.ZodString;
|
|
119
|
+
account: z.ZodString;
|
|
120
|
+
chain_id: z.ZodLiteral<8453>;
|
|
121
|
+
state: z.ZodEnum<{
|
|
122
|
+
unknown: "unknown";
|
|
123
|
+
confirmed: "confirmed";
|
|
124
|
+
prepared: "prepared";
|
|
125
|
+
submitted: "submitted";
|
|
126
|
+
failed: "failed";
|
|
127
|
+
}>;
|
|
128
|
+
created_at: z.ZodString;
|
|
129
|
+
updated_at: z.ZodString;
|
|
130
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
131
|
+
index: z.ZodNumber;
|
|
132
|
+
transaction_hash: z.ZodOptional<z.ZodString>;
|
|
133
|
+
state: z.ZodEnum<{
|
|
134
|
+
unknown: "unknown";
|
|
135
|
+
confirmed: "confirmed";
|
|
136
|
+
prepared: "prepared";
|
|
137
|
+
submitted: "submitted";
|
|
138
|
+
failed: "failed";
|
|
139
|
+
}>;
|
|
140
|
+
}, z.core.$strict>>;
|
|
141
|
+
result: z.ZodOptional<z.ZodObject<{
|
|
142
|
+
status: z.ZodLiteral<"sent">;
|
|
143
|
+
user_id: z.ZodString;
|
|
144
|
+
address: z.ZodString;
|
|
145
|
+
chain_id: z.ZodLiteral<8453>;
|
|
146
|
+
artifact_id: z.ZodString;
|
|
147
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
148
|
+
index: z.ZodNumber;
|
|
149
|
+
kind: z.ZodEnum<{
|
|
150
|
+
approve: "approve";
|
|
151
|
+
approve_reset: "approve_reset";
|
|
152
|
+
call: "call";
|
|
153
|
+
}>;
|
|
154
|
+
to: z.ZodString;
|
|
155
|
+
transaction_hash: z.ZodString;
|
|
156
|
+
status: z.ZodLiteral<"success">;
|
|
157
|
+
block_number: z.ZodString;
|
|
158
|
+
gas_used: z.ZodString;
|
|
159
|
+
}, z.core.$strict>>;
|
|
160
|
+
fence: z.ZodObject<{
|
|
161
|
+
policy_id: z.ZodString;
|
|
162
|
+
policy_name: z.ZodString;
|
|
163
|
+
rules_digest: z.ZodString;
|
|
164
|
+
per_swap_cap_usd: z.ZodLiteral<5000>;
|
|
165
|
+
user_cap_usd: z.ZodNumber;
|
|
166
|
+
}, z.core.$strict>;
|
|
167
|
+
delegation: z.ZodObject<{
|
|
168
|
+
expires_at: z.ZodString;
|
|
169
|
+
}, z.core.$strict>;
|
|
170
|
+
replayed: z.ZodOptional<z.ZodBoolean>;
|
|
171
|
+
verification: z.ZodObject<{
|
|
172
|
+
checks: z.ZodArray<z.ZodString>;
|
|
173
|
+
gross: z.ZodString;
|
|
174
|
+
min_amount_out: z.ZodString;
|
|
175
|
+
otto_fee_atomic: z.ZodString;
|
|
176
|
+
otto_fee_recipient: z.ZodString;
|
|
177
|
+
fee_config_version: z.ZodString;
|
|
178
|
+
receiver: z.ZodString;
|
|
179
|
+
call_data_digest: z.ZodOptional<z.ZodString>;
|
|
180
|
+
}, z.core.$strict>;
|
|
181
|
+
}, z.core.$strict>>;
|
|
182
|
+
}, z.core.$strict>>;
|
|
183
|
+
}, z.core.$strict>;
|
|
184
|
+
annotations: Readonly<{
|
|
185
|
+
readOnlyHint: true;
|
|
186
|
+
destructiveHint: false;
|
|
187
|
+
idempotentHint: true;
|
|
188
|
+
openWorldHint: true;
|
|
189
|
+
}>;
|
|
190
|
+
}>;
|
|
191
|
+
export declare const DELEGATION_RECONCILE_TOOL_DEFINITION: Readonly<{
|
|
192
|
+
name: "otto_delegation_reconcile";
|
|
193
|
+
title: "Reconcile one end user's known-hash delegated operation";
|
|
194
|
+
description: "Acquire the artifact's permanent process-liveness guard, then check Base for finalized canonical receipts of already-stored transaction hashes. Every chain transaction must match the stored chain, hash, sender, target, calldata, value, nonce, gas and EIP-1559 fee fields before its receipt is recorded. This tool never calls CDP, never retries a request, never builds or submits a later step, and leaves prepared/unknown no-hash steps unresolved. It returns the same token-bound operation snapshot as otto_delegation_operations. Server-to-server only: the caller also presents Otto's delegation secret in x-otto-delegation-auth.";
|
|
195
|
+
inputSchema: z.ZodObject<{}, z.core.$loose>;
|
|
196
|
+
strictInputSchema: z.ZodObject<{
|
|
197
|
+
accessToken: z.ZodString;
|
|
198
|
+
artifactId: z.ZodString;
|
|
199
|
+
}, z.core.$strict>;
|
|
200
|
+
outputSchema: z.ZodObject<{
|
|
201
|
+
user_id: z.ZodString;
|
|
202
|
+
store_available: z.ZodBoolean;
|
|
203
|
+
journal: z.ZodObject<{
|
|
204
|
+
schema_version: z.ZodLiteral<2>;
|
|
205
|
+
ready: z.ZodBoolean;
|
|
206
|
+
coverage_started_at: z.ZodNullable<z.ZodString>;
|
|
207
|
+
}, z.core.$strict>;
|
|
208
|
+
unresolved: z.ZodBoolean;
|
|
209
|
+
operations: z.ZodArray<z.ZodObject<{
|
|
210
|
+
artifact_id: z.ZodString;
|
|
211
|
+
account: z.ZodString;
|
|
212
|
+
chain_id: z.ZodLiteral<8453>;
|
|
213
|
+
state: z.ZodEnum<{
|
|
214
|
+
unknown: "unknown";
|
|
215
|
+
confirmed: "confirmed";
|
|
216
|
+
prepared: "prepared";
|
|
217
|
+
submitted: "submitted";
|
|
218
|
+
failed: "failed";
|
|
219
|
+
}>;
|
|
220
|
+
created_at: z.ZodString;
|
|
221
|
+
updated_at: z.ZodString;
|
|
222
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
223
|
+
index: z.ZodNumber;
|
|
224
|
+
transaction_hash: z.ZodOptional<z.ZodString>;
|
|
225
|
+
state: z.ZodEnum<{
|
|
226
|
+
unknown: "unknown";
|
|
227
|
+
confirmed: "confirmed";
|
|
228
|
+
prepared: "prepared";
|
|
229
|
+
submitted: "submitted";
|
|
230
|
+
failed: "failed";
|
|
231
|
+
}>;
|
|
232
|
+
}, z.core.$strict>>;
|
|
233
|
+
result: z.ZodOptional<z.ZodObject<{
|
|
234
|
+
status: z.ZodLiteral<"sent">;
|
|
235
|
+
user_id: z.ZodString;
|
|
236
|
+
address: z.ZodString;
|
|
237
|
+
chain_id: z.ZodLiteral<8453>;
|
|
238
|
+
artifact_id: z.ZodString;
|
|
239
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
240
|
+
index: z.ZodNumber;
|
|
241
|
+
kind: z.ZodEnum<{
|
|
242
|
+
approve: "approve";
|
|
243
|
+
approve_reset: "approve_reset";
|
|
244
|
+
call: "call";
|
|
245
|
+
}>;
|
|
246
|
+
to: z.ZodString;
|
|
247
|
+
transaction_hash: z.ZodString;
|
|
248
|
+
status: z.ZodLiteral<"success">;
|
|
249
|
+
block_number: z.ZodString;
|
|
250
|
+
gas_used: z.ZodString;
|
|
251
|
+
}, z.core.$strict>>;
|
|
252
|
+
fence: z.ZodObject<{
|
|
253
|
+
policy_id: z.ZodString;
|
|
254
|
+
policy_name: z.ZodString;
|
|
255
|
+
rules_digest: z.ZodString;
|
|
256
|
+
per_swap_cap_usd: z.ZodLiteral<5000>;
|
|
257
|
+
user_cap_usd: z.ZodNumber;
|
|
258
|
+
}, z.core.$strict>;
|
|
259
|
+
delegation: z.ZodObject<{
|
|
260
|
+
expires_at: z.ZodString;
|
|
261
|
+
}, z.core.$strict>;
|
|
262
|
+
replayed: z.ZodOptional<z.ZodBoolean>;
|
|
263
|
+
verification: z.ZodObject<{
|
|
264
|
+
checks: z.ZodArray<z.ZodString>;
|
|
265
|
+
gross: z.ZodString;
|
|
266
|
+
min_amount_out: z.ZodString;
|
|
267
|
+
otto_fee_atomic: z.ZodString;
|
|
268
|
+
otto_fee_recipient: z.ZodString;
|
|
269
|
+
fee_config_version: z.ZodString;
|
|
270
|
+
receiver: z.ZodString;
|
|
271
|
+
call_data_digest: z.ZodOptional<z.ZodString>;
|
|
272
|
+
}, z.core.$strict>;
|
|
273
|
+
}, z.core.$strict>>;
|
|
274
|
+
}, z.core.$strict>>;
|
|
275
|
+
}, z.core.$strict>;
|
|
276
|
+
annotations: Readonly<{
|
|
277
|
+
readOnlyHint: false;
|
|
278
|
+
destructiveHint: false;
|
|
279
|
+
idempotentHint: true;
|
|
280
|
+
openWorldHint: true;
|
|
281
|
+
}>;
|
|
282
|
+
}>;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/** Token-bound, read-only view of the durable delegated-operation journal. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { DELEGATED_SEND_RESULT_SCHEMA, DELEGATED_TOOL_TRANSPORT_SCHEMA, DELEGATION_AUTH_HEADER, } from './execution-delegated-definition.js';
|
|
4
|
+
import { DELEGATION_OPERATION_JOURNAL_SCHEMA_VERSION, DELEGATION_OPERATION_STATES, DELEGATION_OPERATION_STEP_STATES, } from './execution-delegation-operation-store.js';
|
|
5
|
+
export const DELEGATION_OPERATIONS_TOOL_NAME = 'otto_delegation_operations';
|
|
6
|
+
export const DELEGATION_RECONCILE_TOOL_NAME = 'otto_delegation_reconcile';
|
|
7
|
+
const ACCESS_TOKEN_SCHEMA = z.string().min(16).max(8192);
|
|
8
|
+
const ARTIFACT_ID_SCHEMA = z.string().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/);
|
|
9
|
+
const ADDRESS_SCHEMA = z.string().regex(/^0x[0-9a-fA-F]{40}$/);
|
|
10
|
+
const HASH_SCHEMA = z.string().regex(/^0x[0-9a-fA-F]{64}$/);
|
|
11
|
+
export const DELEGATION_OPERATIONS_INPUT_SCHEMA = z
|
|
12
|
+
.object({
|
|
13
|
+
accessToken: ACCESS_TOKEN_SCHEMA,
|
|
14
|
+
/** Exact own-user lookup when present; otherwise bounded terminal history plus every unresolved row. */
|
|
15
|
+
artifactId: ARTIFACT_ID_SCHEMA.optional(),
|
|
16
|
+
})
|
|
17
|
+
.strict();
|
|
18
|
+
export const DELEGATION_RECONCILE_INPUT_SCHEMA = z.object({
|
|
19
|
+
accessToken: ACCESS_TOKEN_SCHEMA,
|
|
20
|
+
artifactId: ARTIFACT_ID_SCHEMA,
|
|
21
|
+
}).strict();
|
|
22
|
+
export const DELEGATION_OPERATIONS_RESULT_SCHEMA = z
|
|
23
|
+
.object({
|
|
24
|
+
user_id: z.string().regex(/^[a-zA-Z0-9-]{1,100}$/),
|
|
25
|
+
store_available: z.boolean(),
|
|
26
|
+
journal: z
|
|
27
|
+
.object({
|
|
28
|
+
schema_version: z.literal(DELEGATION_OPERATION_JOURNAL_SCHEMA_VERSION),
|
|
29
|
+
ready: z.boolean(),
|
|
30
|
+
coverage_started_at: z.string().datetime().nullable(),
|
|
31
|
+
})
|
|
32
|
+
.strict(),
|
|
33
|
+
/** Global own-user guard state, never narrowed by artifactId. */
|
|
34
|
+
unresolved: z.boolean(),
|
|
35
|
+
operations: z.array(z
|
|
36
|
+
.object({
|
|
37
|
+
artifact_id: ARTIFACT_ID_SCHEMA,
|
|
38
|
+
account: ADDRESS_SCHEMA,
|
|
39
|
+
chain_id: z.literal(8453),
|
|
40
|
+
state: z.enum(DELEGATION_OPERATION_STATES),
|
|
41
|
+
created_at: z.string().datetime(),
|
|
42
|
+
updated_at: z.string().datetime(),
|
|
43
|
+
steps: z.array(z
|
|
44
|
+
.object({
|
|
45
|
+
index: z.number().int().min(0).max(3),
|
|
46
|
+
transaction_hash: HASH_SCHEMA.optional(),
|
|
47
|
+
state: z.enum(DELEGATION_OPERATION_STEP_STATES),
|
|
48
|
+
})
|
|
49
|
+
.strict()),
|
|
50
|
+
result: DELEGATED_SEND_RESULT_SCHEMA.optional(),
|
|
51
|
+
})
|
|
52
|
+
.strict()),
|
|
53
|
+
})
|
|
54
|
+
.strict();
|
|
55
|
+
const CONFIRMED_STEP_KINDS = ['approve_reset', 'approve', 'call'];
|
|
56
|
+
/**
|
|
57
|
+
* Parse a stored success only when it is the exact receipt for this durable operation.
|
|
58
|
+
* Both replay and the protected lookup use this one validator so neither can trust a
|
|
59
|
+
* schema-valid result whose user, artifact, account, chain, step order, kind or hash
|
|
60
|
+
* disagrees with the journal.
|
|
61
|
+
*/
|
|
62
|
+
export function confirmedDelegationOperationResult(operation) {
|
|
63
|
+
if (operation.state !== 'confirmed')
|
|
64
|
+
return undefined;
|
|
65
|
+
const parsed = DELEGATED_SEND_RESULT_SCHEMA.safeParse(operation.result);
|
|
66
|
+
if (!parsed.success)
|
|
67
|
+
return undefined;
|
|
68
|
+
const result = parsed.data;
|
|
69
|
+
if (result.user_id !== operation.userId ||
|
|
70
|
+
result.artifact_id !== operation.artifactId ||
|
|
71
|
+
result.address.toLowerCase() !== operation.account.toLowerCase() ||
|
|
72
|
+
result.chain_id !== operation.chainId ||
|
|
73
|
+
operation.steps.length !== CONFIRMED_STEP_KINDS.length ||
|
|
74
|
+
result.steps.length !== CONFIRMED_STEP_KINDS.length)
|
|
75
|
+
return undefined;
|
|
76
|
+
for (const [index, kind] of CONFIRMED_STEP_KINDS.entries()) {
|
|
77
|
+
const saved = operation.steps[index];
|
|
78
|
+
const sent = result.steps[index];
|
|
79
|
+
if (saved?.index !== index ||
|
|
80
|
+
saved.kind !== kind ||
|
|
81
|
+
saved.state !== 'confirmed' ||
|
|
82
|
+
sent?.index !== index ||
|
|
83
|
+
sent.kind !== kind ||
|
|
84
|
+
saved.transactionHash?.toLowerCase() !== sent.transaction_hash.toLowerCase())
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
export const DELEGATION_OPERATIONS_TOOL_DEFINITION = Object.freeze({
|
|
90
|
+
name: DELEGATION_OPERATIONS_TOOL_NAME,
|
|
91
|
+
title: "Read one end user's delegated operation history and recovery state",
|
|
92
|
+
description: `Read the durable Base delegated-operation journal for the end user resolved from { accessToken }. Optional artifactId selects one exact own-user operation; without it, the result includes a bounded recent terminal history and every unresolved operation regardless of age. The global unresolved flag is fail-closed: it is true when the store is unavailable, journal coverage is not rollout-ready, or any operation has a prepared/submitted/unknown outcome. Stored serialized transactions and CDP idempotency keys are never returned, and this tool never submits or retries anything. Server-to-server only: the caller also presents Otto's delegation secret in the ${DELEGATION_AUTH_HEADER} request header; no userId argument is accepted.`,
|
|
93
|
+
inputSchema: DELEGATED_TOOL_TRANSPORT_SCHEMA,
|
|
94
|
+
strictInputSchema: DELEGATION_OPERATIONS_INPUT_SCHEMA,
|
|
95
|
+
outputSchema: DELEGATION_OPERATIONS_RESULT_SCHEMA,
|
|
96
|
+
annotations: Object.freeze({
|
|
97
|
+
readOnlyHint: true,
|
|
98
|
+
destructiveHint: false,
|
|
99
|
+
idempotentHint: true,
|
|
100
|
+
openWorldHint: true,
|
|
101
|
+
}),
|
|
102
|
+
});
|
|
103
|
+
export const DELEGATION_RECONCILE_TOOL_DEFINITION = Object.freeze({
|
|
104
|
+
name: DELEGATION_RECONCILE_TOOL_NAME,
|
|
105
|
+
title: "Reconcile one end user's known-hash delegated operation",
|
|
106
|
+
description: `Acquire the artifact's permanent process-liveness guard, then check Base for finalized canonical receipts of already-stored transaction hashes. Every chain transaction must match the stored chain, hash, sender, target, calldata, value, nonce, gas and EIP-1559 fee fields before its receipt is recorded. This tool never calls CDP, never retries a request, never builds or submits a later step, and leaves prepared/unknown no-hash steps unresolved. It returns the same token-bound operation snapshot as ${DELEGATION_OPERATIONS_TOOL_NAME}. Server-to-server only: the caller also presents Otto's delegation secret in ${DELEGATION_AUTH_HEADER}.`,
|
|
107
|
+
inputSchema: DELEGATED_TOOL_TRANSPORT_SCHEMA,
|
|
108
|
+
strictInputSchema: DELEGATION_RECONCILE_INPUT_SCHEMA,
|
|
109
|
+
outputSchema: DELEGATION_OPERATIONS_RESULT_SCHEMA,
|
|
110
|
+
annotations: Object.freeze({
|
|
111
|
+
readOnlyHint: false,
|
|
112
|
+
destructiveHint: false,
|
|
113
|
+
idempotentHint: true,
|
|
114
|
+
openWorldHint: true,
|
|
115
|
+
}),
|
|
116
|
+
});
|
|
117
|
+
//# sourceMappingURL=execution-delegation-operations-definition.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type DelegationCaller } from './execution-delegation.js';
|
|
2
|
+
import { type DelegationOperationsResult } from './execution-delegation-operations-definition.js';
|
|
3
|
+
import type { ExecutionToolRuntime } from './execution-tools.js';
|
|
4
|
+
export declare function readDelegationOperations(runtime: ExecutionToolRuntime, rawInput: unknown, caller: DelegationCaller): Promise<DelegationOperationsResult>;
|
|
5
|
+
/** Known-hash-only recovery. The original worker's fixed guard must be acquirable before any mutation. */
|
|
6
|
+
export declare function reconcileDelegationOperation(runtime: ExecutionToolRuntime, rawInput: unknown, caller: DelegationCaller): Promise<DelegationOperationsResult>;
|