@zktx.io/sui-mcp 0.5.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.
- package/LICENSE +21 -0
- package/LICENSES/@mysten-bcs-2.0.5-Apache-2.0.txt +205 -0
- package/LICENSES/@mysten-sui-2.17.0-Apache-2.0.txt +201 -0
- package/LICENSES/@mysten-utils-0.3.3-Apache-2.0.txt +205 -0
- package/LICENSES/fancy-canvas-2.1.0-MIT.txt +7 -0
- package/LICENSES/lightweight-charts-5.2.0-NOTICE.txt +2 -0
- package/README.md +288 -0
- package/dist/adapters/adapterLifecycleValidators.js +5 -0
- package/dist/adapters/adapterPromptSurfaces.js +60 -0
- package/dist/adapters/deepbook/deepbookHumanReviewProducer.js +178 -0
- package/dist/adapters/deepbook/deepbookQuotePolicy.js +112 -0
- package/dist/adapters/deepbook/deepbookReviewEvidence.js +507 -0
- package/dist/adapters/deepbook/deepbookReviewLifecycle.js +85 -0
- package/dist/adapters/deepbook/deepbookSwapIntent.js +79 -0
- package/dist/adapters/deepbook/deepbookTransactionMaterialProducer.js +254 -0
- package/dist/adapters/intentPlanFactories.js +51 -0
- package/dist/adapters/reviewAdapters.js +47 -0
- package/dist/core/action/adapterLifecycleValidation.js +12 -0
- package/dist/core/action/contractNameRegistry.js +151 -0
- package/dist/core/action/forbiddenFields.js +43 -0
- package/dist/core/action/humanReadableReviewEvidence.js +193 -0
- package/dist/core/action/humanReadableReviewProjectionVerifier.js +29 -0
- package/dist/core/action/ptbVisualizationProducer.js +71 -0
- package/dist/core/action/receiptPtbGraph.js +29 -0
- package/dist/core/action/reviewCheckResults.js +6 -0
- package/dist/core/action/reviewStateValidation.js +11 -0
- package/dist/core/action/reviewTimeSimulationEvidence.js +470 -0
- package/dist/core/action/schemas.js +491 -0
- package/dist/core/action/signableAdapterContract.js +998 -0
- package/dist/core/action/suiChainReceiptEvidence.js +106 -0
- package/dist/core/action/suiChainReceiptMapping.js +107 -0
- package/dist/core/action/suiChainReceiptReader.js +211 -0
- package/dist/core/action/suiChainReceiptVerifier.js +178 -0
- package/dist/core/action/swapHumanReadableReviewProjection.js +130 -0
- package/dist/core/action/swapQuotePolicyEvidence.js +271 -0
- package/dist/core/action/transactionFunding.js +244 -0
- package/dist/core/action/transactionObjectOwnershipEvidence.js +256 -0
- package/dist/core/action/transactionObjectOwnershipProducer.js +323 -0
- package/dist/core/action/types.js +33 -0
- package/dist/core/action/walletReviewContractAssembler.js +286 -0
- package/dist/core/activity/accountAssetTimeline.js +157 -0
- package/dist/core/activity/accountAssetTimelineUsdcReferences.js +120 -0
- package/dist/core/activity/activityStore.js +16 -0
- package/dist/core/activity/externalActivityCoverage.js +76 -0
- package/dist/core/activity/externalActivityTransactionStream.js +82 -0
- package/dist/core/activity/localDataService.js +296 -0
- package/dist/core/activity/localDataTypes.js +11 -0
- package/dist/core/activity/localDataValidation.js +439 -0
- package/dist/core/activity/schemaVersion.js +2 -0
- package/dist/core/activity/sqliteActivityStore.js +1068 -0
- package/dist/core/activity/sqliteActivityStoreRows.js +389 -0
- package/dist/core/activity/sqliteActivityStoreSchema.js +367 -0
- package/dist/core/activity/sqliteActivityStoreTypes.js +5 -0
- package/dist/core/activity/suiFunctionTarget.js +43 -0
- package/dist/core/activity/transactionActivityAccountEffects.js +186 -0
- package/dist/core/activity/transactionActivityAnalysis.js +295 -0
- package/dist/core/activity/transactionActivityClassifier.js +306 -0
- package/dist/core/activity/transactionActivityDetails.js +229 -0
- package/dist/core/activity/transactionActivityProtocolRules.js +218 -0
- package/dist/core/activity/transactionActivityScanPolicy.js +170 -0
- package/dist/core/activity/transactionActivityService.js +379 -0
- package/dist/core/activity/transactionActivityTypes.js +18 -0
- package/dist/core/eventlog/sink.js +35 -0
- package/dist/core/evidence/settlementFamilies.js +85 -0
- package/dist/core/evidence/userAnswerUse.js +1 -0
- package/dist/core/numeric/rawU64.js +63 -0
- package/dist/core/preferences/preferencesStore.js +26 -0
- package/dist/core/preferences/sqlitePreferencesRepository.js +136 -0
- package/dist/core/proposal/externalProposalReview.js +347 -0
- package/dist/core/proposal/schemas.js +208 -0
- package/dist/core/proposal/types.js +35 -0
- package/dist/core/read/amounts.js +14 -0
- package/dist/core/read/coinMetadata.js +60 -0
- package/dist/core/read/deepbookOfficialIndexerSource.js +373 -0
- package/dist/core/read/deepbookRawQuoteClient.js +86 -0
- package/dist/core/read/deepbookReadHelpers.js +321 -0
- package/dist/core/read/deepbookRegistry.js +157 -0
- package/dist/core/read/deepbookSourceOwners.js +159 -0
- package/dist/core/read/deepbookUsdcChartService.js +342 -0
- package/dist/core/read/intentEvidenceResponseFormatting.js +228 -0
- package/dist/core/read/readCardInputs.js +19 -0
- package/dist/core/read/readCardResult.js +40 -0
- package/dist/core/read/readResponseGuidance.js +402 -0
- package/dist/core/read/readService.js +1639 -0
- package/dist/core/read/readServiceTypes.js +88 -0
- package/dist/core/read/settlementParityFormatting.js +82 -0
- package/dist/core/read/walletReadHelpers.js +99 -0
- package/dist/core/review/reviewChecks.js +45 -0
- package/dist/core/review/reviewComputation.js +38 -0
- package/dist/core/review/reviewComputationResult.js +87 -0
- package/dist/core/session/cardSession.js +31 -0
- package/dist/core/session/cardSessionStore.js +204 -0
- package/dist/core/session/keyedRecordStore.js +18 -0
- package/dist/core/session/liveReviewSessionContract.js +3 -0
- package/dist/core/session/localSession.js +31 -0
- package/dist/core/session/privateReviewArtifacts.js +75 -0
- package/dist/core/session/reviewValidity.js +49 -0
- package/dist/core/session/sessionErrors.js +9 -0
- package/dist/core/session/sessionRecordStore.js +40 -0
- package/dist/core/session/sessionStore.js +655 -0
- package/dist/core/session/settingsSession.js +1 -0
- package/dist/core/session/settingsSessions.js +45 -0
- package/dist/core/session/sqliteCardStore.js +88 -0
- package/dist/core/session/sqliteSessionStore.js +213 -0
- package/dist/core/session/sqliteTransactionMaterialStore.js +64 -0
- package/dist/core/session/sqliteWalletWorkflowStore.js +821 -0
- package/dist/core/session/status.js +60 -0
- package/dist/core/session/transactionMaterialStore.js +221 -0
- package/dist/core/session/transactionRequest.js +72 -0
- package/dist/core/session/wait.js +79 -0
- package/dist/core/session/walletConnection.js +92 -0
- package/dist/core/session/walletRuntime.js +38 -0
- package/dist/core/session/walletWorkflow.js +608 -0
- package/dist/core/session/workflowState.js +80 -0
- package/dist/core/session/workflowView.js +150 -0
- package/dist/core/suiAddress.js +18 -0
- package/dist/core/suiEndpoint.js +72 -0
- package/dist/mcp/activeAccountResponse.js +24 -0
- package/dist/mcp/prompts.js +146 -0
- package/dist/mcp/registerTool.js +19 -0
- package/dist/mcp/resources.js +72 -0
- package/dist/mcp/responseGuidance.js +326 -0
- package/dist/mcp/result.js +17 -0
- package/dist/mcp/schemas.js +11 -0
- package/dist/mcp/server.js +32 -0
- package/dist/mcp/serverInfo.js +131 -0
- package/dist/mcp/toolErrors.js +118 -0
- package/dist/mcp/toolNames.js +58 -0
- package/dist/mcp/tools/account/index.js +44 -0
- package/dist/mcp/tools/action/prepareSuiActionReview.js +126 -0
- package/dist/mcp/tools/read/commonSchemas.js +43 -0
- package/dist/mcp/tools/read/deepbookReadTools.js +686 -0
- package/dist/mcp/tools/read/index.js +14 -0
- package/dist/mcp/tools/read/readToolHelpers.js +97 -0
- package/dist/mcp/tools/read/reviewActivityTools.js +179 -0
- package/dist/mcp/tools/read/serverStatusTools.js +100 -0
- package/dist/mcp/tools/read/transactionActivityOutput.js +371 -0
- package/dist/mcp/tools/read/transactionActivityTools.js +858 -0
- package/dist/mcp/tools/read/walletReadTools.js +734 -0
- package/dist/mcp/tools/session/executionResultTools.js +44 -0
- package/dist/mcp/tools/session/index.js +8 -0
- package/dist/mcp/tools/session/shared.js +36 -0
- package/dist/mcp/tools/session/statusTools.js +69 -0
- package/dist/mcp/tools/session/walletConnectionTools.js +69 -0
- package/dist/mcp/tools/settings/index.js +66 -0
- package/dist/mcp-app/account.html +3133 -0
- package/dist/mcp-app/account.notices.txt +973 -0
- package/dist/mcp-app/chart.html +3354 -0
- package/dist/mcp-app/chart.notices.txt +1194 -0
- package/dist/mcp-app/connect.html +3179 -0
- package/dist/mcp-app/connect.notices.txt +1012 -0
- package/dist/mcp-app/receipt.html +8430 -0
- package/dist/mcp-app/receipt.notices.txt +3549 -0
- package/dist/mcp-app/review.html +8430 -0
- package/dist/mcp-app/review.notices.txt +3549 -0
- package/dist/mcp-ui/contracts.js +31 -0
- package/dist/mcp-ui/readCards.js +28 -0
- package/dist/mcp-ui/tools.js +134 -0
- package/dist/review-app/brand-dark.svg +1 -0
- package/dist/review-app/brand-light.svg +1 -0
- package/dist/review-app/favicon.svg +1 -0
- package/dist/review-app/settings.css +1 -0
- package/dist/review-app/settings.js +1 -0
- package/dist/review-app/ui.css +809 -0
- package/dist/review-server/assets.js +48 -0
- package/dist/review-server/html.js +45 -0
- package/dist/review-server/http.js +47 -0
- package/dist/review-server/middleware/hostOrigin.js +48 -0
- package/dist/review-server/middleware/reviewToken.js +7 -0
- package/dist/review-server/reviewServerPolicy.js +1 -0
- package/dist/review-server/server.js +72 -0
- package/dist/review-server/settingsApi.js +158 -0
- package/dist/runtime/application.js +203 -0
- package/dist/runtime/config.js +97 -0
- package/dist/runtime/localSettingsService.js +198 -0
- package/dist/runtime/logger.js +66 -0
- package/dist/runtime/reviewDependencies.js +58 -0
- package/dist/runtime/reviewServerAcquire.js +93 -0
- package/dist/runtime/runtimeTermination.js +60 -0
- package/dist/runtime/shared/authenticatedFetch.js +127 -0
- package/dist/runtime/shared/control.js +93 -0
- package/dist/runtime/shared/dataAccess.js +66 -0
- package/dist/runtime/shared/mcpHttp.js +84 -0
- package/dist/runtime/shared/ownerLease.js +50 -0
- package/dist/runtime/shared/server.js +98 -0
- package/dist/runtime/shared/stdio.js +113 -0
- package/dist/runtime/smokeMainnetRead.js +391 -0
- package/dist/runtime/smokeMainnetReadAssertions.js +306 -0
- package/dist/runtime/smokeReview.js +40 -0
- package/dist/runtime/start.js +90 -0
- package/dist/runtime/suiEndpoint.js +97 -0
- package/dist/runtime/suiTransactionGraphqlMapping.js +200 -0
- package/dist/runtime/suiTransactionGraphqlQueries.js +231 -0
- package/dist/runtime/suiTransactionGraphqlSource.js +148 -0
- package/dist/runtime/walletConnectConfig.js +3 -0
- package/dist/runtime/walletConnectStorage.js +99 -0
- package/dist/runtime/walletConnectTransport.js +128 -0
- package/dist/runtime/walletSdkChild.js +3 -0
- package/dist/runtime/walletSdkChildRuntime.js +160 -0
- package/dist/runtime/walletSdkIpc.js +26 -0
- package/dist/runtime/walletSdkProcess.js +358 -0
- package/docs/AGENT_BEHAVIOR.md +524 -0
- package/docs/AGENT_DEVELOPMENT_POLICY.md +815 -0
- package/docs/FRONTEND_POLICY.md +534 -0
- package/docs/LOCAL_DB_ARCHITECTURE.md +381 -0
- package/docs/MCP_SETUP.md +742 -0
- package/docs/MCP_TOOLS.md +1318 -0
- package/docs/SDK_API.md +206 -0
- package/docs/SIGNABLE_ADAPTER_CONTRACT.md +396 -0
- package/docs/TRANSACTION_ACTIVITY_LOG.md +194 -0
- package/docs/UTILITY_INDEX.md +275 -0
- package/docs/WALLET_CONNECTION.md +238 -0
- package/docs/golden-scenarios/BEHAVIOR_MATRIX.md +166 -0
- package/docs/golden-scenarios/INTENT_EVIDENCE_GOLDEN_ANSWERS.md +161 -0
- package/docs/golden-scenarios/INTENT_EVIDENCE_MATRIX.md +259 -0
- package/package.json +79 -0
- package/protocols/deepbook-margin.md +15 -0
- package/protocols/deepbook-v3.md +24 -0
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import { DEEPBOOK_ANSWER_USE, DEEPBOOK_READ_RESPONSE_UNSUPPORTED } from "./deepbookSourceOwners.js";
|
|
2
|
+
const intentEvidenceConclusionRuleFields = [
|
|
3
|
+
"responseSummary.doNotCallQuoteToolsForThisQuestion",
|
|
4
|
+
"responseSummary.separateQuoteOutputs",
|
|
5
|
+
"responseSummary.doNotUseForConclusion",
|
|
6
|
+
"responseSummary.excludedFromConclusion",
|
|
7
|
+
"unsupportedClaims"
|
|
8
|
+
];
|
|
9
|
+
export function walletBalanceUserAnswerUse() {
|
|
10
|
+
return {
|
|
11
|
+
canAnswer: [
|
|
12
|
+
"current_coin_balance_snapshot",
|
|
13
|
+
"current_coin_balance_display_amount_when_balance_unit_status_is_available"
|
|
14
|
+
],
|
|
15
|
+
cannotAnswer: [
|
|
16
|
+
"transaction_history",
|
|
17
|
+
"specific_transaction_receipt",
|
|
18
|
+
"specific_transaction_balance_delta",
|
|
19
|
+
"acquisition_source",
|
|
20
|
+
"object_provenance",
|
|
21
|
+
"payment_coverage_or_shortfall",
|
|
22
|
+
"usd_denominated_settlement_asset_balance_total",
|
|
23
|
+
"fiat_usd_cash_out",
|
|
24
|
+
"profit_or_pnl",
|
|
25
|
+
"cost_basis",
|
|
26
|
+
"signing_data_or_readiness"
|
|
27
|
+
],
|
|
28
|
+
answerFields: [
|
|
29
|
+
"account",
|
|
30
|
+
"fetchedAt",
|
|
31
|
+
"balances[].coinType",
|
|
32
|
+
"balances[].balance",
|
|
33
|
+
"balances[].unit",
|
|
34
|
+
"balances[].display"
|
|
35
|
+
],
|
|
36
|
+
diagnosticOnlyFields: ["source", "quantitySemantics", "hasNextPage", "cursor"],
|
|
37
|
+
followUp: {
|
|
38
|
+
tool: "read.preview_intent_evidence",
|
|
39
|
+
inputFields: ["account"],
|
|
40
|
+
answerFields: ["responseSummary"],
|
|
41
|
+
reason: "Use for USD-denominated payment coverage, balance-total, or shortfall answers; wallet balances are current coin snapshots only."
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export function walletClassificationUserAnswerUse() {
|
|
46
|
+
return {
|
|
47
|
+
canAnswer: [
|
|
48
|
+
"current_coin_balance_classification",
|
|
49
|
+
"current_coin_balance_display_amount_when_balance_unit_status_is_available",
|
|
50
|
+
"which_asset_classes_were_not_inspected_by_this_classifier"
|
|
51
|
+
],
|
|
52
|
+
cannotAnswer: [
|
|
53
|
+
"complete_portfolio_inventory",
|
|
54
|
+
"transaction_history",
|
|
55
|
+
"specific_transaction_receipt",
|
|
56
|
+
"payment_coverage_or_shortfall",
|
|
57
|
+
"usd_denominated_settlement_asset_balance_total",
|
|
58
|
+
"route_or_funding_plan",
|
|
59
|
+
"fiat_usd_cash_out",
|
|
60
|
+
"profit_or_pnl",
|
|
61
|
+
"cost_basis",
|
|
62
|
+
"signing_data_or_readiness"
|
|
63
|
+
],
|
|
64
|
+
answerFields: [
|
|
65
|
+
"account",
|
|
66
|
+
"fetchedAt",
|
|
67
|
+
"classifiedAssets[].balance",
|
|
68
|
+
"classifiedAssets[].classification",
|
|
69
|
+
"uninspectedAssetClasses"
|
|
70
|
+
],
|
|
71
|
+
diagnosticOnlyFields: ["source", "quantitySemantics", "hasNextPage", "cursor"],
|
|
72
|
+
followUp: {
|
|
73
|
+
tool: "read.preview_intent_evidence",
|
|
74
|
+
inputFields: ["account"],
|
|
75
|
+
answerFields: ["responseSummary"],
|
|
76
|
+
reason: "Use for USD-denominated payment coverage, balance-total, or shortfall answers; classification labels are not payment evidence."
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export function settlementAssetGroupParityUserAnswerUse() {
|
|
81
|
+
return {
|
|
82
|
+
canAnswer: [
|
|
83
|
+
"settlement_asset_group_internal_parity_statistics",
|
|
84
|
+
"highest_lowest_mean_or_median_parity_from_available_direct_deepbook_mid_price_snapshots"
|
|
85
|
+
],
|
|
86
|
+
cannotAnswer: [
|
|
87
|
+
"settlement_token_selection",
|
|
88
|
+
"payment_coverage_or_shortfall",
|
|
89
|
+
"fiat_usd_cash_out",
|
|
90
|
+
"external_market_price_conversion",
|
|
91
|
+
"usd_peg_assumption",
|
|
92
|
+
"payment_execution_readiness",
|
|
93
|
+
"route_recommendation",
|
|
94
|
+
"transaction_building",
|
|
95
|
+
"signing_data_or_readiness",
|
|
96
|
+
"profit_or_pnl",
|
|
97
|
+
"cost_basis"
|
|
98
|
+
],
|
|
99
|
+
answerFields: [
|
|
100
|
+
"responseSummary",
|
|
101
|
+
"responseSummary.min",
|
|
102
|
+
"responseSummary.max",
|
|
103
|
+
"responseSummary.mean",
|
|
104
|
+
"responseSummary.median",
|
|
105
|
+
"responseSummary.referenceAssetRole",
|
|
106
|
+
"fetchedAt"
|
|
107
|
+
],
|
|
108
|
+
conclusionRuleFields: ["responseSummary.excludedFromConclusion", "unsupportedClaims"],
|
|
109
|
+
diagnosticOnlyFields: ["assets", "statistics", "evidenceSources", "quantitySemantics"]
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
export function intentEvidenceUserAnswerUse(settlementAssetCoverageStatus, responseEvidence = "settlement_asset_only") {
|
|
113
|
+
const responseEvidenceMode = typeof responseEvidence === "string" ? responseEvidence : responseEvidence.mode;
|
|
114
|
+
const hasDirectQuoteEvidence = typeof responseEvidence !== "string" &&
|
|
115
|
+
responseEvidence.supportedResponseClaims.includes("direct_pool_quote_evidence");
|
|
116
|
+
if (settlementAssetCoverageStatus === "unavailable_mixed_decimals" ||
|
|
117
|
+
settlementAssetCoverageStatus === "unavailable_wallet_balance_scan_incomplete") {
|
|
118
|
+
return {
|
|
119
|
+
canAnswer: [
|
|
120
|
+
"why_usd_denominated_payment_coverage_is_unavailable",
|
|
121
|
+
"required_user_choices_for_the_supported_settlement_asset_group"
|
|
122
|
+
],
|
|
123
|
+
cannotAnswer: [
|
|
124
|
+
"usd_denominated_settlement_asset_balance_total",
|
|
125
|
+
"usd_denominated_payment_coverage_status",
|
|
126
|
+
"usd_denominated_payment_shortfall",
|
|
127
|
+
"settlement_token_selection",
|
|
128
|
+
"route_dependent_payment_support",
|
|
129
|
+
"gas_reserve_or_fee_readiness",
|
|
130
|
+
"payment_execution_readiness",
|
|
131
|
+
"transaction_building",
|
|
132
|
+
"signing_data_or_readiness",
|
|
133
|
+
"fiat_usd_cash_out",
|
|
134
|
+
"profit_or_pnl",
|
|
135
|
+
"cost_basis"
|
|
136
|
+
],
|
|
137
|
+
answerFields: [
|
|
138
|
+
"responseSummary",
|
|
139
|
+
"responseSummary.conclusionKind",
|
|
140
|
+
"responseSummary.requiredDisplayAmount",
|
|
141
|
+
"responseSummary.unavailableReason",
|
|
142
|
+
"responseSummary.requiredUserChoices",
|
|
143
|
+
"blockedReasons"
|
|
144
|
+
],
|
|
145
|
+
conclusionRuleFields: [...intentEvidenceConclusionRuleFields],
|
|
146
|
+
diagnosticOnlyFields: [
|
|
147
|
+
"evidenceSources",
|
|
148
|
+
"quantitySemantics",
|
|
149
|
+
"settlementAssetGroup",
|
|
150
|
+
"balances",
|
|
151
|
+
"aggregate",
|
|
152
|
+
"candidateConversions",
|
|
153
|
+
"uninspectedAssetClasses"
|
|
154
|
+
]
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
const selectedTargetAnswerFields = responseEvidenceMode === "selected_target_context"
|
|
158
|
+
? [
|
|
159
|
+
"selectedTarget",
|
|
160
|
+
"selectedTarget.selectionSource",
|
|
161
|
+
"selectedTarget.currentDisplayAmount",
|
|
162
|
+
"selectedTarget.shortfallDisplayAmount",
|
|
163
|
+
"candidateConversions",
|
|
164
|
+
"candidateConversions[].sourceSymbol",
|
|
165
|
+
"candidateConversions[].targetSymbol",
|
|
166
|
+
"candidateConversions[].sourceDisplayAmount",
|
|
167
|
+
"candidateConversions[].status",
|
|
168
|
+
"requiredUserChoices"
|
|
169
|
+
]
|
|
170
|
+
: [];
|
|
171
|
+
const selectedTargetCanAnswer = responseEvidenceMode === "selected_target_context"
|
|
172
|
+
? [
|
|
173
|
+
"selected_target_shortfall",
|
|
174
|
+
...(hasDirectQuoteEvidence ? ["direct_pool_quote_evidence_for_user_selected_target"] : [])
|
|
175
|
+
]
|
|
176
|
+
: [];
|
|
177
|
+
return {
|
|
178
|
+
canAnswer: [
|
|
179
|
+
"usd_denominated_settlement_asset_balance_total",
|
|
180
|
+
"usd_denominated_payment_coverage_status",
|
|
181
|
+
"usd_denominated_payment_shortfall",
|
|
182
|
+
"required_user_choices_for_the_supported_settlement_asset_group",
|
|
183
|
+
...selectedTargetCanAnswer
|
|
184
|
+
],
|
|
185
|
+
cannotAnswer: [
|
|
186
|
+
"settlement_token_selection",
|
|
187
|
+
"route_dependent_payment_support",
|
|
188
|
+
"gas_reserve_or_fee_readiness",
|
|
189
|
+
"payment_execution_readiness",
|
|
190
|
+
"transaction_building",
|
|
191
|
+
"signing_data_or_readiness",
|
|
192
|
+
"fiat_usd_cash_out",
|
|
193
|
+
"profit_or_pnl",
|
|
194
|
+
"cost_basis"
|
|
195
|
+
],
|
|
196
|
+
answerFields: [
|
|
197
|
+
"responseSummary",
|
|
198
|
+
"responseSummary.currentDisplayAmount",
|
|
199
|
+
"responseSummary.requiredDisplayAmount",
|
|
200
|
+
"responseSummary.shortfallDisplayAmount",
|
|
201
|
+
"responseSummary.amountsUsedForAnswer",
|
|
202
|
+
"responseSummary.requiredUserChoices",
|
|
203
|
+
...selectedTargetAnswerFields
|
|
204
|
+
],
|
|
205
|
+
conclusionRuleFields: [...intentEvidenceConclusionRuleFields],
|
|
206
|
+
diagnosticOnlyFields: [
|
|
207
|
+
"evidenceSources",
|
|
208
|
+
"quantitySemantics",
|
|
209
|
+
"settlementAssetGroup",
|
|
210
|
+
"balances",
|
|
211
|
+
"aggregate",
|
|
212
|
+
"blockedReasons",
|
|
213
|
+
"uninspectedAssetClasses"
|
|
214
|
+
]
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
export function deepbookOrderbookUserAnswerUse() {
|
|
218
|
+
return {
|
|
219
|
+
canAnswer: [
|
|
220
|
+
"deepbook_pool_orderbook_context_at_fetchedAt",
|
|
221
|
+
"deepbook_pool_mid_price_context_returned_with_the_orderbook_snapshot"
|
|
222
|
+
],
|
|
223
|
+
cannotAnswer: [...DEEPBOOK_READ_RESPONSE_UNSUPPORTED.orderbook],
|
|
224
|
+
answerFields: [
|
|
225
|
+
"poolKey",
|
|
226
|
+
"ticks",
|
|
227
|
+
"fetchedAt",
|
|
228
|
+
"midPrice",
|
|
229
|
+
"poolBookParams",
|
|
230
|
+
"level2TicksFromMid"
|
|
231
|
+
],
|
|
232
|
+
diagnosticOnlyFields: ["source"],
|
|
233
|
+
followUp: {
|
|
234
|
+
tool: "read.quote_deepbook_display_amount",
|
|
235
|
+
inputFields: ["poolKey"],
|
|
236
|
+
answerFields: ["quote"],
|
|
237
|
+
reason: "Use for an indicative DeepBook quote after the user supplies an explicit source amount, pool, and direction."
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
export function deepbookMidPriceUserAnswerUse() {
|
|
242
|
+
return {
|
|
243
|
+
canAnswer: ["deepbook_pool_mid_price_context"],
|
|
244
|
+
cannotAnswer: [...DEEPBOOK_READ_RESPONSE_UNSUPPORTED.midPrice],
|
|
245
|
+
answerFields: ["poolKey", "base", "quote", "price", "priceDirection", "priceType", "fetchedAt"],
|
|
246
|
+
diagnosticOnlyFields: ["source", "priceSemantics"],
|
|
247
|
+
followUp: {
|
|
248
|
+
tool: "read.preview_intent_evidence",
|
|
249
|
+
answerFields: ["responseSummary"],
|
|
250
|
+
reason: "Use for USD-denominated payment coverage, balance-total, or shortfall answers; mid price is pool price context only."
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
export function deepbookUsdcPriceHistoryUserAnswerUse() {
|
|
255
|
+
return {
|
|
256
|
+
canAnswer: [
|
|
257
|
+
DEEPBOOK_ANSWER_USE.officialUsdcCandleHistory,
|
|
258
|
+
DEEPBOOK_ANSWER_USE.officialCandleAvailabilityForRequestedUtcRange
|
|
259
|
+
],
|
|
260
|
+
cannotAnswer: [...DEEPBOOK_READ_RESPONSE_UNSUPPORTED.officialUsdcCandles],
|
|
261
|
+
answerFields: [
|
|
262
|
+
"pair",
|
|
263
|
+
"requested.range",
|
|
264
|
+
"candleAvailability",
|
|
265
|
+
"bars",
|
|
266
|
+
"source.candles",
|
|
267
|
+
"responseSummary",
|
|
268
|
+
"unsupportedClaims"
|
|
269
|
+
],
|
|
270
|
+
conclusionRuleFields: ["responseSummary", "quantitySemantics", "unsupportedClaims"],
|
|
271
|
+
diagnosticOnlyFields: ["source.poolList", "source.baseUrl"]
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
export function deepbookUsdcPriceAtTimeUserAnswerUse(matchAvailable) {
|
|
275
|
+
return {
|
|
276
|
+
canAnswer: [
|
|
277
|
+
DEEPBOOK_ANSWER_USE.officialUsdcCandleForRequestedTime,
|
|
278
|
+
...(matchAvailable ? [DEEPBOOK_ANSWER_USE.representativeClosePriceForMatchedCandle] : [])
|
|
279
|
+
],
|
|
280
|
+
cannotAnswer: [...DEEPBOOK_READ_RESPONSE_UNSUPPORTED.officialUsdcCandles],
|
|
281
|
+
answerFields: [
|
|
282
|
+
"target.targetTime",
|
|
283
|
+
"target.searchWindow",
|
|
284
|
+
"status",
|
|
285
|
+
"pair",
|
|
286
|
+
...(matchAvailable
|
|
287
|
+
? [
|
|
288
|
+
"match.kind",
|
|
289
|
+
"match.distanceMinutes",
|
|
290
|
+
"match.representativePrice",
|
|
291
|
+
"matchedCandle.start",
|
|
292
|
+
"matchedCandle.end",
|
|
293
|
+
"matchedCandle.open",
|
|
294
|
+
"matchedCandle.high",
|
|
295
|
+
"matchedCandle.low",
|
|
296
|
+
"matchedCandle.close"
|
|
297
|
+
]
|
|
298
|
+
: []),
|
|
299
|
+
"candleAvailability",
|
|
300
|
+
"source.candles",
|
|
301
|
+
"responseSummary",
|
|
302
|
+
"unsupportedClaims"
|
|
303
|
+
],
|
|
304
|
+
conclusionRuleFields: ["responseSummary", "quantitySemantics", "unsupportedClaims"],
|
|
305
|
+
diagnosticOnlyFields: ["requested.range", "source.poolList", "source.baseUrl"]
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
export function deepbookQuoteUserAnswerUse(summaryKind) {
|
|
309
|
+
return {
|
|
310
|
+
canAnswer: [
|
|
311
|
+
"indicative_deepbook_pool_quote_for_explicit_source_input",
|
|
312
|
+
"raw_sdk_quote_return_values_before_slippage_policy"
|
|
313
|
+
],
|
|
314
|
+
cannotAnswer: [...DEEPBOOK_READ_RESPONSE_UNSUPPORTED.quote],
|
|
315
|
+
answerFields: summaryKind === "raw"
|
|
316
|
+
? [
|
|
317
|
+
"poolKey",
|
|
318
|
+
"direction",
|
|
319
|
+
"amountRaw",
|
|
320
|
+
"quote.baseOut",
|
|
321
|
+
"quote.quoteOut",
|
|
322
|
+
"quote.deepRequired",
|
|
323
|
+
"rawQuote.directionalOutput",
|
|
324
|
+
"fetchedAt"
|
|
325
|
+
]
|
|
326
|
+
: [
|
|
327
|
+
"pool",
|
|
328
|
+
"direction",
|
|
329
|
+
"inputAmount",
|
|
330
|
+
"quote.baseOut",
|
|
331
|
+
"quote.quoteOut",
|
|
332
|
+
"quote.deepRequired",
|
|
333
|
+
"rawQuote.directionalOutput",
|
|
334
|
+
"fetchedAt"
|
|
335
|
+
],
|
|
336
|
+
diagnosticOnlyFields: ["source", "rawQuote.returnValueOrder", "rawQuote.boundary"],
|
|
337
|
+
conclusionRuleFields: [
|
|
338
|
+
"quantitySemantics.canUseForPaymentAnswer",
|
|
339
|
+
"quantitySemantics.canUseForShortfallAnswer",
|
|
340
|
+
"quantitySemantics.doNotCombineWithPaymentAnswer",
|
|
341
|
+
"quantitySemantics.requiredPaymentAnswerTool",
|
|
342
|
+
"quantitySemantics.requiredPaymentAnswerField",
|
|
343
|
+
"quantitySemantics.paymentAnswerUseBlockedReason"
|
|
344
|
+
],
|
|
345
|
+
followUp: {
|
|
346
|
+
tool: "read.preview_intent_evidence",
|
|
347
|
+
answerFields: ["responseSummary"],
|
|
348
|
+
reason: "Use responseSummary for payment coverage, balance-total, or shortfall answers; if this quote was called during a payment question, do not combine its numbers into the conclusion."
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
export function deepbookAccountInventoryUserAnswerUse(detailStatus) {
|
|
353
|
+
const poolAnswerFields = detailStatus === "manager_discovery_only" || detailStatus === "pool_key_required" ? [] : ["pool"];
|
|
354
|
+
const detailAnswerFields = detailStatus === "available"
|
|
355
|
+
? ["accountExists", "accountSummary", "lockedBalances", "openOrderIds", "openOrderCount"]
|
|
356
|
+
: detailStatus === "account_not_found"
|
|
357
|
+
? ["accountExists"]
|
|
358
|
+
: [];
|
|
359
|
+
const detailUnavailableCanAnswer = detailStatus === "pool_key_required" ||
|
|
360
|
+
detailStatus === "manager_address_required" ||
|
|
361
|
+
detailStatus === "manager_address_not_discovered_for_active_account"
|
|
362
|
+
? ["why_deepbook_pool_account_inventory_detail_is_unavailable"]
|
|
363
|
+
: [];
|
|
364
|
+
const accountNotFoundCanAnswer = detailStatus === "account_not_found"
|
|
365
|
+
? ["deepbook_pool_account_absence_when_pool_and_manager_are_supplied"]
|
|
366
|
+
: [];
|
|
367
|
+
const detailCanAnswer = detailStatus === "available"
|
|
368
|
+
? ["deepbook_pool_account_inventory_when_pool_and_manager_are_supplied"]
|
|
369
|
+
: [];
|
|
370
|
+
const detailUnavailableCannotAnswer = detailStatus === "available" ? [] : ["deepbook_pool_account_inventory_when_detailStatus_is_not_available"];
|
|
371
|
+
const diagnosticOnlyFields = detailStatus === "available"
|
|
372
|
+
? ["source", "quantitySemantics", "openOrderIdsTruncated"]
|
|
373
|
+
: ["source", "quantitySemantics"];
|
|
374
|
+
return {
|
|
375
|
+
canAnswer: [
|
|
376
|
+
"active_account_deepbook_balance_manager_discovery",
|
|
377
|
+
...detailUnavailableCanAnswer,
|
|
378
|
+
...accountNotFoundCanAnswer,
|
|
379
|
+
...detailCanAnswer
|
|
380
|
+
],
|
|
381
|
+
cannotAnswer: [
|
|
382
|
+
...detailUnavailableCannotAnswer,
|
|
383
|
+
...DEEPBOOK_READ_RESPONSE_UNSUPPORTED.accountInventory
|
|
384
|
+
],
|
|
385
|
+
answerFields: [
|
|
386
|
+
"account",
|
|
387
|
+
"fetchedAt",
|
|
388
|
+
"detailStatus",
|
|
389
|
+
"managerAddresses",
|
|
390
|
+
"requested",
|
|
391
|
+
...poolAnswerFields,
|
|
392
|
+
...detailAnswerFields
|
|
393
|
+
],
|
|
394
|
+
preconditionFields: ["detailStatus"],
|
|
395
|
+
diagnosticOnlyFields,
|
|
396
|
+
followUp: {
|
|
397
|
+
tool: "read.summarize_wallet_assets",
|
|
398
|
+
answerFields: ["balances"],
|
|
399
|
+
reason: "Use for current wallet coin-balance snapshots; DeepBook BalanceManager inventory is a separate account surface."
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
}
|