dero-mcp-server 0.4.4 → 0.4.5
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 +8 -8
- package/SKILL.md +4 -2
- package/dist/citations.d.ts.map +1 -1
- package/dist/citations.js +48 -0
- package/dist/citations.js.map +1 -1
- package/dist/composites/_shared.d.ts +27 -2
- package/dist/composites/_shared.d.ts.map +1 -1
- package/dist/composites/_shared.js +50 -6
- package/dist/composites/_shared.js.map +1 -1
- package/dist/composites/explain-smart-contract.d.ts +6 -2
- package/dist/composites/explain-smart-contract.d.ts.map +1 -1
- package/dist/composites/explain-smart-contract.js +26 -2
- package/dist/composites/explain-smart-contract.js.map +1 -1
- package/dist/composites/recommend-docs-path.d.ts.map +1 -1
- package/dist/composites/recommend-docs-path.js +70 -8
- package/dist/composites/recommend-docs-path.js.map +1 -1
- package/dist/composites/tela-get-doc-content.d.ts +51 -0
- package/dist/composites/tela-get-doc-content.d.ts.map +1 -0
- package/dist/composites/tela-get-doc-content.js +82 -0
- package/dist/composites/tela-get-doc-content.js.map +1 -0
- package/dist/composites/tela-inspect.d.ts +27 -0
- package/dist/composites/tela-inspect.d.ts.map +1 -0
- package/dist/composites/tela-inspect.js +126 -0
- package/dist/composites/tela-inspect.js.map +1 -0
- package/dist/docs-parse.d.ts +18 -0
- package/dist/docs-parse.d.ts.map +1 -1
- package/dist/docs-parse.js +74 -0
- package/dist/docs-parse.js.map +1 -1
- package/dist/docs.d.ts.map +1 -1
- package/dist/docs.js +201 -36
- package/dist/docs.js.map +1 -1
- package/dist/http-server.js +1 -1
- package/dist/server.d.ts +2 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +79 -18
- package/dist/server.js.map +1 -1
- package/dist/tela-parse.d.ts +114 -0
- package/dist/tela-parse.d.ts.map +1 -0
- package/dist/tela-parse.js +242 -0
- package/dist/tela-parse.js.map +1 -0
- package/dist/tool-descriptions.d.ts +3 -1
- package/dist/tool-descriptions.d.ts.map +1 -1
- package/dist/tool-descriptions.js +21 -2
- package/dist/tool-descriptions.js.map +1 -1
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# DERO MCP server
|
|
2
2
|
|
|
3
|
-
> **A read-only Model Context Protocol server for the DERO privacy blockchain** — a private-by-default Layer 1 with encrypted balances, private smart contracts (DVM-BASIC), and no public transaction graph. 21 daemon primitives +
|
|
3
|
+
> **A read-only Model Context Protocol server for the DERO privacy blockchain** — a private-by-default Layer 1 with encrypted balances, private smart contracts (DVM-BASIC), and no public transaction graph. 21 daemon primitives + 9 composite tools (including TELA on-chain app inspection), with a bundled documentation index spanning derod, tela, hologram, and deropay.
|
|
4
4
|
|
|
5
5
|
[](https://registry.modelcontextprotocol.io/v0.1/servers?search=io.github.DHEBP/dero-mcp-server)
|
|
6
6
|
[](https://github.com/DHEBP/dero-mcp-server/actions/workflows/ci.yml)
|
|
7
7
|
[](https://glama.ai/mcp/servers/DHEBP/dero-mcp-server)
|
|
8
8
|
|
|
9
|
-
**Registry listing:** `io.github.DHEBP/dero-mcp-server` · **Version:** `0.
|
|
9
|
+
**Registry listing:** `io.github.DHEBP/dero-mcp-server` · **Version:** `0.4.4` · **Transports:** `stdio` (default, npm package) · `streamable-http` (`--http`, for self-hosting)
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
@@ -32,7 +32,7 @@ Get a working DERO MCP connection in under 5 minutes.
|
|
|
32
32
|
|
|
33
33
|
### What you need
|
|
34
34
|
|
|
35
|
-
- **Node.js
|
|
35
|
+
- **Node.js 20+** ([install](https://nodejs.org)) — verify with `node --version`.
|
|
36
36
|
- **An MCP host** — Claude Desktop, Cursor, OpenCode, or ChatGPT with Custom Connectors. This walkthrough uses Claude Desktop; the JSON config below works identically in Cursor and OpenCode.
|
|
37
37
|
- **Optional:** a local DERO daemon. If one is running on `127.0.0.1:10102`, the server detects and uses it automatically; otherwise it falls back to a public RPC, so it works with zero setup. Run your own for production — [how to](https://derod.org/basics/running-a-node.md).
|
|
38
38
|
|
|
@@ -133,7 +133,7 @@ For multi-step agent recipes, per-tool guidance, error contract, and the composi
|
|
|
133
133
|
|
|
134
134
|
## Requirements
|
|
135
135
|
|
|
136
|
-
- Node.js **
|
|
136
|
+
- Node.js **20+**
|
|
137
137
|
- A reachable DERO daemon with RPC enabled (local node or your own remote URL).
|
|
138
138
|
|
|
139
139
|
## Install & build
|
|
@@ -269,9 +269,9 @@ curl "https://registry.modelcontextprotocol.io/v0.1/servers?search=io.github.DHE
|
|
|
269
269
|
|
|
270
270
|
## MCP Surface
|
|
271
271
|
|
|
272
|
-
- **Tools (
|
|
273
|
-
- **Resources (
|
|
274
|
-
- **Prompts (
|
|
272
|
+
- **Tools (30):** 21 daemon read/analysis primitives + 9 composites, including TELA app inspection (`tela_inspect`, `tela_get_doc_content`) and docs retrieval (`dero_docs_search`, `dero_docs_get_page`, `dero_docs_list`)
|
|
273
|
+
- **Resources (4):** `dero://mcp/server-info`, `dero://mcp/safety-boundary`, `dero://mcp/example-flows`, `dero://mcp/composites`
|
|
274
|
+
- **Prompts (5):** `network_health_check`, `inspect_smart_contract`, `trace_transaction`, `find_dero_docs_for_intent`, `estimate_deploy_for_contract`
|
|
275
275
|
|
|
276
276
|
## Error Contract
|
|
277
277
|
|
|
@@ -305,8 +305,8 @@ Common `code` values:
|
|
|
305
305
|
## Roadmap
|
|
306
306
|
|
|
307
307
|
- Optional wallet-RPC tools behind `DERO_ENABLE_WALLET_RPC=1` + separate URL.
|
|
308
|
-
- Streamable HTTP transport for hosted MCP.
|
|
309
308
|
- Stricter typing / OpenAPI-derived tool schemas.
|
|
309
|
+
- TELA-aware contract tooling (INDEX/DOC inspection, on-chain app discovery).
|
|
310
310
|
|
|
311
311
|
## License
|
|
312
312
|
|
package/SKILL.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: dero
|
|
3
3
|
description: Query the DERO privacy blockchain and its documentation through the dero-mcp-server. Use for any DERO ecosystem question — node setup, smart contracts (DVM-BASIC), wallets, TELA apps, RPC methods, ports, privacy mechanics, transaction tracing, contract inspection.
|
|
4
4
|
metadata:
|
|
5
|
-
version: 0.
|
|
5
|
+
version: 0.4.4
|
|
6
6
|
homepage: https://derod.org
|
|
7
7
|
mcp_package: dero-mcp-server
|
|
8
8
|
mcp_transport: stdio | streamable-http
|
|
@@ -39,7 +39,7 @@ Before answering the first user question that needs DERO knowledge, read the MCP
|
|
|
39
39
|
|
|
40
40
|
1. `dero://mcp/server-info` — server metadata, tool list, resource list, prompt names
|
|
41
41
|
2. `dero://mcp/example-flows` — agent flow recipes (composites first, primitives second)
|
|
42
|
-
3. `dero://mcp/composites` — full catalog of the
|
|
42
|
+
3. `dero://mcp/composites` — full catalog of the 9 composite tools and when to use each
|
|
43
43
|
4. `dero://mcp/safety-boundary` — read-only posture, excluded methods, write-path guidance
|
|
44
44
|
|
|
45
45
|
These four resources document the canonical agent workflows. Skim them once per session.
|
|
@@ -77,6 +77,8 @@ The MCP exposes both **primitive** tools (one daemon RPC method per tool) and **
|
|
|
77
77
|
| `trace_transaction_with_context` | get_transaction + (if SC install) get_sc | "what is this tx", "is this confirmed", "what contract did this deploy" |
|
|
78
78
|
| `audit_chain_artifact_claim` | (varies) | Verify a chain-related claim end-to-end |
|
|
79
79
|
| `dero_forge_demo_proof` | (varies) | Generate demo proof strings for testing |
|
|
80
|
+
| `tela_inspect` | get_sc + manual TELA schema parsing | User references a TELA SCID / `.tela` app: "what is this TELA contract", "what files does this app have" (auto-detects INDEX vs DOC) |
|
|
81
|
+
| `tela_get_doc_content` | get_sc + comment-block extraction | User wants the actual file content (HTML/CSS/JS) a TELA-DOC stores |
|
|
80
82
|
|
|
81
83
|
Fall back to primitives only when the composite is unavailable or returns `_meta.error`.
|
|
82
84
|
|
package/dist/citations.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"citations.d.ts","sourceRoot":"","sources":["../src/citations.ts"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SAAS,MAAM,EAAE,CAAA;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAOD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,oBAAoB,GAC1B,eAAe,EAAE,CAyBnB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,oBAAoB,EAC3B,eAAe,EAAE,YAAY,EAAE,GAAG,SAAS,GAC1C;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,YAAY,EAAE,CAAA;CAAE,GAAG,SAAS,CA2BpE"}
|
package/dist/citations.js
CHANGED
|
@@ -186,6 +186,54 @@ export const RELATED_DOCS_BY_TOOL = {
|
|
|
186
186
|
slug: 'dvm/create-deploy-use-smart-contract',
|
|
187
187
|
title: 'Create, Deploy & Use a Smart Contract on DERO | Step-by-Step Tutorial',
|
|
188
188
|
},
|
|
189
|
+
// TELA specs: elevated when the classifier detects a tela_index / tela_doc
|
|
190
|
+
// contract (the heuristic re-orders the matching spec to position 0).
|
|
191
|
+
{
|
|
192
|
+
product: 'tela',
|
|
193
|
+
slug: 'tela/tela-index-specification',
|
|
194
|
+
title: 'TELA-INDEX-1 Specification | Application Manifest Smart Contract Standard',
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
product: 'tela',
|
|
198
|
+
slug: 'tela/tela-doc-specification',
|
|
199
|
+
title: 'TELA-DOC-1 Specification | Smart Contract Standard for File Storage',
|
|
200
|
+
},
|
|
201
|
+
],
|
|
202
|
+
// tela_inspect curates both specs (so the matching one elevates per kind),
|
|
203
|
+
// plus dURL and Gnomon context for the builder.
|
|
204
|
+
tela_inspect: [
|
|
205
|
+
{
|
|
206
|
+
product: 'tela',
|
|
207
|
+
slug: 'tela/tela-index-specification',
|
|
208
|
+
title: 'TELA-INDEX-1 Specification | Application Manifest Smart Contract Standard',
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
product: 'tela',
|
|
212
|
+
slug: 'tela/tela-doc-specification',
|
|
213
|
+
title: 'TELA-DOC-1 Specification | Smart Contract Standard for File Storage',
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
product: 'tela',
|
|
217
|
+
slug: 'advanced-features/durl-explained',
|
|
218
|
+
title: 'Understanding dURLs | Decentralized URL Identity & Resolution',
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
product: 'tela',
|
|
222
|
+
slug: 'tela-cli/gnomon-guide',
|
|
223
|
+
title: 'Gnomon Indexer Deep-Dive Guide | TELA Content Discovery and Indexing',
|
|
224
|
+
},
|
|
225
|
+
],
|
|
226
|
+
tela_get_doc_content: [
|
|
227
|
+
{
|
|
228
|
+
product: 'tela',
|
|
229
|
+
slug: 'tela/tela-doc-specification',
|
|
230
|
+
title: 'TELA-DOC-1 Specification | Smart Contract Standard for File Storage',
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
product: 'tela',
|
|
234
|
+
slug: 'tela/tela-index-specification',
|
|
235
|
+
title: 'TELA-INDEX-1 Specification | Application Manifest Smart Contract Standard',
|
|
236
|
+
},
|
|
189
237
|
],
|
|
190
238
|
};
|
|
191
239
|
/**
|
package/dist/citations.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"citations.js","sourceRoot":"","sources":["../src/citations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,aAAa,EAAuB,MAAM,iBAAiB,CAAA;AAapE,SAAS,iBAAiB,CAAC,OAAuB,EAAE,IAAY;IAC9D,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAA;IAC9C,IAAI,CAAC,OAAO;QAAE,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,CAAA;IACjD,yEAAyE;IACzE,yEAAyE;IACzE,kEAAkE;IAClE,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI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CAAC;QAC/B,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,YAAY,EAAE,CAAC;YAC1C,MAAM,IAAI,GAAG,iBAAiB,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;YACtE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC;gBAClC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;gBACjB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;YAC9B,CAAC;QACH,CAAC;IACH,CAAC;IACD,IAAI,eAAe,EAAE,CAAC;QACpB,KAAK,MAAM,IAAI,IAAI,eAAe,EAAE,CAAC;YACnC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC;gBAClC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;gBACjB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;YAC9B,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,CAAA;AAC/C,CAAC"}
|
|
@@ -99,18 +99,43 @@ export type DeroScSurface = {
|
|
|
99
99
|
functions: DvmFunctionSignature[];
|
|
100
100
|
stringkeys: string[];
|
|
101
101
|
uint64keys: string[];
|
|
102
|
+
stringkeys_total: number;
|
|
103
|
+
uint64keys_total: number;
|
|
104
|
+
stringkeys_truncated: boolean;
|
|
105
|
+
uint64keys_truncated: boolean;
|
|
102
106
|
balances: Record<string, number | string>;
|
|
103
107
|
raw_code_length: number;
|
|
104
108
|
has_code: boolean;
|
|
105
109
|
};
|
|
110
|
+
/**
|
|
111
|
+
* Maximum number of state-variable keys surfaced per map. Real contracts
|
|
112
|
+
* like the on-chain name service hold tens of thousands of stringkeys
|
|
113
|
+
* (22,619 at time of writing), and an uncapped dump blows past every MCP
|
|
114
|
+
* host's token limit — turning the canonical `0000…0001` example into an
|
|
115
|
+
* unusable wall. The first N sorted keys are a deterministic, useful
|
|
116
|
+
* sample; `*_total` and `*_truncated` keep the response honest.
|
|
117
|
+
*/
|
|
118
|
+
export declare const SURFACE_KEY_CAP = 50;
|
|
119
|
+
/**
|
|
120
|
+
* Bound a raw `DERO.GetSC` variable map (`stringkeys` / `uint64keys`) for the
|
|
121
|
+
* `dero_get_sc` primitive, which returns the daemon payload verbatim. A map
|
|
122
|
+
* over `SURFACE_KEY_CAP` entries is replaced by a sorted sample plus
|
|
123
|
+
* `<field>_total` / `<field>_truncated` siblings so the response stays under
|
|
124
|
+
* host token limits without losing the count signal. Maps at or under the cap
|
|
125
|
+
* pass through untouched (no markers added). Returns the patch to spread onto
|
|
126
|
+
* the result; the field is deleted and re-added as a sample when truncated.
|
|
127
|
+
*/
|
|
128
|
+
export declare function capRawScVariables(result: Record<string, unknown>, field: 'stringkeys' | 'uint64keys'): void;
|
|
106
129
|
/**
|
|
107
130
|
* Convert a raw DERO.GetSC payload into a stable, agent-friendly surface.
|
|
108
131
|
*
|
|
109
132
|
* Behavior:
|
|
110
133
|
* - Returns `functions: []` when `code` is missing or the regex finds
|
|
111
134
|
* no Function declarations. Never throws on malformed code.
|
|
112
|
-
* - Sorts `stringkeys` / `uint64keys` alphabetically
|
|
113
|
-
* output
|
|
135
|
+
* - Sorts `stringkeys` / `uint64keys` alphabetically and caps each at
|
|
136
|
+
* `SURFACE_KEY_CAP` for deterministic, bounded output — large registries
|
|
137
|
+
* would otherwise overflow MCP host token limits. `*_total` /
|
|
138
|
+
* `*_truncated` report what was elided.
|
|
114
139
|
* - `balances` is passed through unchanged so callers can render asset
|
|
115
140
|
* balances; native DERO balance lives under `balance` on the raw
|
|
116
141
|
* payload and is left for callers to decide whether to surface.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_shared.d.ts","sourceRoot":"","sources":["../../src/composites/_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;AA+BD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,GAAG,aAAa,CAyBvF"}
|
|
@@ -89,6 +89,44 @@ export function attachCitations(payload, toolName) {
|
|
|
89
89
|
return payload;
|
|
90
90
|
return { ...payload, related_docs };
|
|
91
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Maximum number of state-variable keys surfaced per map. Real contracts
|
|
94
|
+
* like the on-chain name service hold tens of thousands of stringkeys
|
|
95
|
+
* (22,619 at time of writing), and an uncapped dump blows past every MCP
|
|
96
|
+
* host's token limit — turning the canonical `0000…0001` example into an
|
|
97
|
+
* unusable wall. The first N sorted keys are a deterministic, useful
|
|
98
|
+
* sample; `*_total` and `*_truncated` keep the response honest.
|
|
99
|
+
*/
|
|
100
|
+
export const SURFACE_KEY_CAP = 50;
|
|
101
|
+
/** Sort keys, take the first `SURFACE_KEY_CAP`, and report the full count. */
|
|
102
|
+
function capKeys(map) {
|
|
103
|
+
const all = map ? Object.keys(map).sort() : [];
|
|
104
|
+
return {
|
|
105
|
+
keys: all.slice(0, SURFACE_KEY_CAP),
|
|
106
|
+
total: all.length,
|
|
107
|
+
truncated: all.length > SURFACE_KEY_CAP,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Bound a raw `DERO.GetSC` variable map (`stringkeys` / `uint64keys`) for the
|
|
112
|
+
* `dero_get_sc` primitive, which returns the daemon payload verbatim. A map
|
|
113
|
+
* over `SURFACE_KEY_CAP` entries is replaced by a sorted sample plus
|
|
114
|
+
* `<field>_total` / `<field>_truncated` siblings so the response stays under
|
|
115
|
+
* host token limits without losing the count signal. Maps at or under the cap
|
|
116
|
+
* pass through untouched (no markers added). Returns the patch to spread onto
|
|
117
|
+
* the result; the field is deleted and re-added as a sample when truncated.
|
|
118
|
+
*/
|
|
119
|
+
export function capRawScVariables(result, field) {
|
|
120
|
+
const map = result[field];
|
|
121
|
+
if (!map || typeof map !== 'object')
|
|
122
|
+
return;
|
|
123
|
+
const entries = Object.entries(map).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
124
|
+
if (entries.length <= SURFACE_KEY_CAP)
|
|
125
|
+
return;
|
|
126
|
+
result[field] = Object.fromEntries(entries.slice(0, SURFACE_KEY_CAP));
|
|
127
|
+
result[`${field}_total`] = entries.length;
|
|
128
|
+
result[`${field}_truncated`] = true;
|
|
129
|
+
}
|
|
92
130
|
// DVM-BASIC function declaration:
|
|
93
131
|
// Function Name(arg Type, ...) Uint64|String
|
|
94
132
|
//
|
|
@@ -121,8 +159,10 @@ function parseDvmFunctions(code) {
|
|
|
121
159
|
* Behavior:
|
|
122
160
|
* - Returns `functions: []` when `code` is missing or the regex finds
|
|
123
161
|
* no Function declarations. Never throws on malformed code.
|
|
124
|
-
* - Sorts `stringkeys` / `uint64keys` alphabetically
|
|
125
|
-
* output
|
|
162
|
+
* - Sorts `stringkeys` / `uint64keys` alphabetically and caps each at
|
|
163
|
+
* `SURFACE_KEY_CAP` for deterministic, bounded output — large registries
|
|
164
|
+
* would otherwise overflow MCP host token limits. `*_total` /
|
|
165
|
+
* `*_truncated` report what was elided.
|
|
126
166
|
* - `balances` is passed through unchanged so callers can render asset
|
|
127
167
|
* balances; native DERO balance lives under `balance` on the raw
|
|
128
168
|
* payload and is left for callers to decide whether to surface.
|
|
@@ -130,8 +170,8 @@ function parseDvmFunctions(code) {
|
|
|
130
170
|
export function extractScSurface(raw) {
|
|
131
171
|
const code = typeof raw?.code === 'string' ? raw.code : '';
|
|
132
172
|
const functions = code.length > 0 ? parseDvmFunctions(code) : [];
|
|
133
|
-
const stringkeys = raw?.stringkeys
|
|
134
|
-
const uint64keys = raw?.uint64keys
|
|
173
|
+
const stringkeys = capKeys(raw?.stringkeys);
|
|
174
|
+
const uint64keys = capKeys(raw?.uint64keys);
|
|
135
175
|
const balances = {};
|
|
136
176
|
if (raw?.balances && typeof raw.balances === 'object') {
|
|
137
177
|
for (const [scid, amount] of Object.entries(raw.balances)) {
|
|
@@ -142,8 +182,12 @@ export function extractScSurface(raw) {
|
|
|
142
182
|
}
|
|
143
183
|
return {
|
|
144
184
|
functions,
|
|
145
|
-
stringkeys,
|
|
146
|
-
uint64keys,
|
|
185
|
+
stringkeys: stringkeys.keys,
|
|
186
|
+
uint64keys: uint64keys.keys,
|
|
187
|
+
stringkeys_total: stringkeys.total,
|
|
188
|
+
uint64keys_total: uint64keys.total,
|
|
189
|
+
stringkeys_truncated: stringkeys.truncated,
|
|
190
|
+
uint64keys_truncated: uint64keys.truncated,
|
|
147
191
|
balances,
|
|
148
192
|
raw_code_length: code.length,
|
|
149
193
|
has_code: code.length > 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_shared.js","sourceRoot":"","sources":["../../src/composites/_shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,cAAc,EAAqB,MAAM,iBAAiB,CAAA;AA6BnE;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,KAA2B;IACxD,MAAM,OAAO,GAAsB,EAAE,CAAA;IACrC,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,CAAA;IACnC,IAAI,QAAQ,GAAkB,IAAI,CAAA;IAElC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,CAAA;QACnC,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,EAAE,EAAE,CAAA;YAC7B,OAAO,CAAC,IAAI,CAAC;gBACX,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,EAAE,EAAE,IAAI;gBACR,KAAK;gBACL,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;aACrD,CAAC,CAAA;QACJ,CAAC;QAAC,O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generic';
|
|
37
|
+
type ContractKind = 'tela_index' | 'tela_doc' | 'token' | 'registry' | 'minimal' | 'generic';
|
|
38
38
|
/**
|
|
39
39
|
* Classify a contract from its surface + raw code so we can pick the
|
|
40
40
|
* most relevant docs page as "primary". Pure function, deterministic,
|
|
41
41
|
* unit-testable. Returns the classification AND the slug to elevate.
|
|
42
42
|
*/
|
|
43
|
-
export declare function classifyContractAndPickDoc(surface: DeroScSurface, code: string): {
|
|
43
|
+
export declare function classifyContractAndPickDoc(surface: DeroScSurface, code: string, rawStringkeys?: Record<string, unknown>): {
|
|
44
44
|
kind: ContractKind;
|
|
45
45
|
primarySlug: string;
|
|
46
46
|
};
|
|
@@ -52,6 +52,10 @@ export declare function explainSmartContract(rpc: DeroDaemonRpc, args: ExplainIn
|
|
|
52
52
|
functions: import("./_shared.js").DvmFunctionSignature[];
|
|
53
53
|
stringkeys: string[];
|
|
54
54
|
uint64keys: string[];
|
|
55
|
+
stringkeys_total: number;
|
|
56
|
+
uint64keys_total: number;
|
|
57
|
+
stringkeys_truncated: boolean;
|
|
58
|
+
uint64keys_truncated: boolean;
|
|
55
59
|
balances: Record<string, string | number>;
|
|
56
60
|
};
|
|
57
61
|
narrative: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"explain-smart-contract.d.ts","sourceRoot":"","sources":["../../src/composites/explain-smart-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAGL,KAAK,aAAa,EAElB,KAAK,aAAa,EACnB,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"explain-smart-contract.d.ts","sourceRoot":"","sources":["../../src/composites/explain-smart-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAGL,KAAK,aAAa,EAElB,KAAK,aAAa,EACnB,MAAM,cAAc,CAAA;AAKrB,eAAO,MAAM,+BAA+B;;;CAUlC,CAAA;AAEV,KAAK,YAAY,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAazD,KAAK,YAAY,GAAG,YAAY,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAA;AAE5F;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,aAAa,EACtB,IAAI,EAAE,MAAM,EACZ,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACtC;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAsC7C;AA6CD,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,YAAY;;;;;;;;;;;;;;;;;;;GA6DhF"}
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
*/
|
|
27
27
|
import { z } from 'zod';
|
|
28
28
|
import { attachCitations, extractScSurface, } from './_shared.js';
|
|
29
|
+
import { classifyTela } from '../tela-parse.js';
|
|
29
30
|
const SCID_HEX_REGEX = /^[0-9a-fA-F]{64}$/;
|
|
30
31
|
export const explainSmartContractInputSchema = {
|
|
31
32
|
scid: z
|
|
@@ -46,12 +47,24 @@ const DVM_DOC_FUNDAMENTALS = 'dvm/smart-contract-fundamentals';
|
|
|
46
47
|
const DVM_DOC_LANGUAGE = 'dvm/dvm-basic';
|
|
47
48
|
const DVM_DOC_DEPLOY = 'dvm/create-deploy-use-smart-contract';
|
|
48
49
|
const DVM_DOC_PLATFORM = 'dvm/dero-virtual-machine';
|
|
50
|
+
const TELA_DOC_INDEX_SPEC = 'tela/tela-index-specification';
|
|
51
|
+
const TELA_DOC_DOC_SPEC = 'tela/tela-doc-specification';
|
|
49
52
|
/**
|
|
50
53
|
* Classify a contract from its surface + raw code so we can pick the
|
|
51
54
|
* most relevant docs page as "primary". Pure function, deterministic,
|
|
52
55
|
* unit-testable. Returns the classification AND the slug to elevate.
|
|
53
56
|
*/
|
|
54
|
-
export function classifyContractAndPickDoc(surface, code) {
|
|
57
|
+
export function classifyContractAndPickDoc(surface, code, rawStringkeys) {
|
|
58
|
+
// TELA detection FIRST: a TELA contract's InitializePrivate contains
|
|
59
|
+
// `EXISTS("nameHdr")`, which the registry heuristic below would otherwise
|
|
60
|
+
// misclassify as a name registry. classifyTela keys on the TELA-specific
|
|
61
|
+
// markers (dURL/DOC1/docType/fileCheck) from both the raw stringkeys and the
|
|
62
|
+
// code literals, so it correctly distinguishes a TELA app from a registry.
|
|
63
|
+
const tela = classifyTela(rawStringkeys, code);
|
|
64
|
+
if (tela.kind === 'tela_index')
|
|
65
|
+
return { kind: 'tela_index', primarySlug: TELA_DOC_INDEX_SPEC };
|
|
66
|
+
if (tela.kind === 'tela_doc')
|
|
67
|
+
return { kind: 'tela_doc', primarySlug: TELA_DOC_DOC_SPEC };
|
|
55
68
|
const functionNames = new Set(surface.functions.map((f) => f.name.toLowerCase()));
|
|
56
69
|
const codeUpper = code.toUpperCase();
|
|
57
70
|
const looksLikeToken = codeUpper.includes('SEND_ASSET_TO_ADDRESS') ||
|
|
@@ -89,6 +102,8 @@ function buildNarrative(scid, topoheight, surface, kind) {
|
|
|
89
102
|
return `Found ${surface.raw_code_length} bytes of code at SCID ${scid} (topoheight ${topoheight ?? 'tip'}) but no DVM-BASIC Function declarations were recognized by the parser. The raw code is still available via dero_get_sc; ${stringCount} stored string keys and ${uint64Count} uint64 keys are present, with ${balanceCount} asset balance(s).`;
|
|
90
103
|
}
|
|
91
104
|
const kindPhrase = {
|
|
105
|
+
tela_index: 'is a TELA-INDEX-1 application manifest (the on-chain entrypoint listing an app’s DOC files)',
|
|
106
|
+
tela_doc: 'is a TELA-DOC-1 file contract (stores a single on-chain web-app file)',
|
|
92
107
|
token: 'has a token-style surface (transfer/asset operations)',
|
|
93
108
|
registry: 'has a registry-style surface (Register/Lookup/EXISTS pattern)',
|
|
94
109
|
minimal: 'is a minimal contract (Initialize-only or single function)',
|
|
@@ -114,7 +129,12 @@ export async function explainSmartContract(rpc, args) {
|
|
|
114
129
|
const raw = (await rpc('DERO.GetSC', params)) ?? {};
|
|
115
130
|
const surface = extractScSurface(raw);
|
|
116
131
|
const code = typeof raw.code === 'string' ? raw.code : '';
|
|
117
|
-
|
|
132
|
+
// Pass the RAW (uncapped) stringkeys so TELA marker detection is not affected
|
|
133
|
+
// by extractScSurface's 50-key cap.
|
|
134
|
+
const rawStringkeys = raw.stringkeys && typeof raw.stringkeys === 'object'
|
|
135
|
+
? raw.stringkeys
|
|
136
|
+
: undefined;
|
|
137
|
+
const { kind, primarySlug } = classifyContractAndPickDoc(surface, code, rawStringkeys);
|
|
118
138
|
const responseTopoheight = typeof args.topoheight === 'number' && Number.isFinite(args.topoheight)
|
|
119
139
|
? args.topoheight
|
|
120
140
|
: null;
|
|
@@ -131,6 +151,10 @@ export async function explainSmartContract(rpc, args) {
|
|
|
131
151
|
functions: surface.functions,
|
|
132
152
|
stringkeys: surface.stringkeys,
|
|
133
153
|
uint64keys: surface.uint64keys,
|
|
154
|
+
stringkeys_total: surface.stringkeys_total,
|
|
155
|
+
uint64keys_total: surface.uint64keys_total,
|
|
156
|
+
stringkeys_truncated: surface.stringkeys_truncated,
|
|
157
|
+
uint64keys_truncated: surface.uint64keys_truncated,
|
|
134
158
|
balances: surface.balances,
|
|
135
159
|
},
|
|
136
160
|
narrative,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"explain-smart-contract.js","sourceRoot":"","sources":["../../src/composites/explain-smart-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EACL,eAAe,EACf,gBAAgB,GAIjB,MA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O,CAAC,QAAQ;KAC3B,EACD,wBAAwB,CACzB,CAAA;IAED,IAAI,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5D,MAAM,GAAG,GAAG,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,CAAA;QACzE,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;YACZ,MAAM,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;YACpD,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QACtC,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recommend-docs-path.d.ts","sourceRoot":"","sources":["../../src/composites/recommend-docs-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,
|
|
1
|
+
{"version":3,"file":"recommend-docs-path.d.ts","sourceRoot":"","sources":["../../src/composites/recommend-docs-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAetE,eAAO,MAAM,4BAA4B;;;;CAkB/B,CAAA;AAEV,KAAK,cAAc,GAAG;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,cAAc,CAAA;IAC7B,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED;;;;GAIG;AACH,KAAK,SAAS,GAAG;IACf,OAAO,EAAE,cAAc,CAAA;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,KAAK,cAAc,GAAG;IACpB,OAAO,EAAE,cAAc,CAAA;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,aAAa,EAAE,MAAM,CAAA;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,KAAK,gBAAgB,GAAG,MAAM,CAC5B,cAAc,EACd;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CACrE,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,cAAc,GAAG,SAAS,EACvC,aAAa,EAAE,WAAW,CAAC,cAAc,EAAE,SAAS,SAAS,EAAE,CAAC,GAC/D,cAAc,EAAE,CAmClB;AA+ED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,cAAc;;;;;;;GAoD3D"}
|
|
@@ -37,9 +37,18 @@
|
|
|
37
37
|
* `DOCS_UNAVAILABLE` classification from `searchDeroDocs`.
|
|
38
38
|
*/
|
|
39
39
|
import { z } from 'zod';
|
|
40
|
-
import { DERO_DOC_PRODUCTS, searchDeroDocs, } from '../docs.js';
|
|
40
|
+
import { DERO_DOC_PRODUCTS, getDeroDocPage, searchDeroDocs, } from '../docs.js';
|
|
41
41
|
import { buildDeroCitation } from '../citations.js';
|
|
42
42
|
const PRODUCT_HINT_BOOST = 1.5;
|
|
43
|
+
// Concept-intro nudge: when an intent reads as a beginner asking "what is
|
|
44
|
+
// DERO / where do I start", the canonical orientation page (basics/about) is
|
|
45
|
+
// not token-dense on the query words and loses to advanced, jargon-heavy
|
|
46
|
+
// pages. Detect conceptual-beginner intent and lift ONLY the about explainer.
|
|
47
|
+
// Deliberately narrow — NOT all basics/*, NOT overview/quick-start (those
|
|
48
|
+
// flood other products' landing pages). CI-guarded by check:docs-ranking.
|
|
49
|
+
const CONCEPT_INTENT_REGEX = /\bwhat is\b|\bnew to\b|\bunderstand\b|\blearn about\b|\bgetting started\b|\bget started\b|where (?:do|should) i (?:start|begin)|\bbrand new\b|\bcompletely new\b|\bbeginner\b/i;
|
|
50
|
+
const ABOUT_SLUG_REGEX = /(?:^|\/)about$/;
|
|
51
|
+
const CONCEPT_INTRO_BOOST = 2.2;
|
|
43
52
|
export const recommendDocsPathInputSchema = {
|
|
44
53
|
intent: z
|
|
45
54
|
.string()
|
|
@@ -66,16 +75,18 @@ export const recommendDocsPathInputSchema = {
|
|
|
66
75
|
export function rankRecommendations(intent, productHint, hitsByProduct) {
|
|
67
76
|
const out = [];
|
|
68
77
|
const seen = new Set();
|
|
78
|
+
const conceptIntent = CONCEPT_INTENT_REGEX.test(intent);
|
|
69
79
|
for (const [product, hits] of hitsByProduct) {
|
|
70
80
|
for (const hit of hits) {
|
|
71
81
|
const key = `${product}::${hit.slug}`;
|
|
72
82
|
if (seen.has(key))
|
|
73
83
|
continue;
|
|
74
84
|
seen.add(key);
|
|
75
|
-
const
|
|
76
|
-
const
|
|
85
|
+
const hintBoost = product === productHint ? PRODUCT_HINT_BOOST : 1;
|
|
86
|
+
const conceptBoost = conceptIntent && ABOUT_SLUG_REGEX.test(hit.slug) ? CONCEPT_INTRO_BOOST : 1;
|
|
87
|
+
const boostedScore = Math.round(hit.score * hintBoost * conceptBoost * 100) / 100;
|
|
77
88
|
const topHeading = hit.headings[0];
|
|
78
|
-
const rationale = buildRationale(intent, product, hit.score,
|
|
89
|
+
const rationale = buildRationale(intent, product, hit.score, hintBoost, topHeading, conceptBoost > 1);
|
|
79
90
|
out.push({
|
|
80
91
|
product,
|
|
81
92
|
slug: hit.slug,
|
|
@@ -87,13 +98,21 @@ export function rankRecommendations(intent, productHint, hitsByProduct) {
|
|
|
87
98
|
});
|
|
88
99
|
}
|
|
89
100
|
}
|
|
90
|
-
|
|
101
|
+
// Tie-break on product/slug for deterministic ordering at equal scores.
|
|
102
|
+
out.sort((a, b) => {
|
|
103
|
+
if (b.boosted_score !== a.boosted_score)
|
|
104
|
+
return b.boosted_score - a.boosted_score;
|
|
105
|
+
const ak = `${a.product}/${a.slug}`;
|
|
106
|
+
const bk = `${b.product}/${b.slug}`;
|
|
107
|
+
return ak < bk ? -1 : ak > bk ? 1 : 0;
|
|
108
|
+
});
|
|
91
109
|
return out;
|
|
92
110
|
}
|
|
93
|
-
function buildRationale(intent, product, rawScore, boost, topHeading) {
|
|
111
|
+
function buildRationale(intent, product, rawScore, boost, topHeading, conceptBoosted = false) {
|
|
94
112
|
const boostNote = boost > 1 ? ` (×${boost} product_hint boost applied)` : '';
|
|
113
|
+
const conceptNote = conceptBoosted ? ' (elevated as the beginner orientation page)' : '';
|
|
95
114
|
const headingPart = topHeading ? ` Top heading: "${topHeading.slice(0, 80)}".` : '';
|
|
96
|
-
return `Match for "${intent.slice(0, 60)}" under product=${product} (raw score ${rawScore}${boostNote}).${headingPart}`;
|
|
115
|
+
return `Match for "${intent.slice(0, 60)}" under product=${product} (raw score ${rawScore}${boostNote}${conceptNote}).${headingPart}`;
|
|
97
116
|
}
|
|
98
117
|
function summarizeByProduct(recs) {
|
|
99
118
|
const out = Object.create(null);
|
|
@@ -120,9 +139,43 @@ function citationsFromRecommendations(recs, topN) {
|
|
|
120
139
|
.slice(0, topN)
|
|
121
140
|
.map((rec) => buildDeroCitation(rec.product, rec.slug, rec.title));
|
|
122
141
|
}
|
|
142
|
+
const ORIENTATION_SLUG = 'basics/about';
|
|
143
|
+
/**
|
|
144
|
+
* Ensure derod/basics/about is in the derod candidate pool. If already
|
|
145
|
+
* present, leave it. If absent, fetch its metadata and inject it with a base
|
|
146
|
+
* score floored at the current derod top hit (so the ×2.2 nudge lands it near
|
|
147
|
+
* the top without fabricating an out-of-range number). Silent no-op if the
|
|
148
|
+
* page can't be fetched (keeps the composite resilient).
|
|
149
|
+
*/
|
|
150
|
+
async function ensureOrientationCandidate(hitsByProduct) {
|
|
151
|
+
const derodHits = hitsByProduct.get('derod') ?? [];
|
|
152
|
+
if (derodHits.some((h) => h.slug === ORIENTATION_SLUG))
|
|
153
|
+
return;
|
|
154
|
+
try {
|
|
155
|
+
const page = await getDeroDocPage({ product: 'derod', slug: ORIENTATION_SLUG });
|
|
156
|
+
const topScore = derodHits[0]?.score ?? 1;
|
|
157
|
+
const injected = {
|
|
158
|
+
product: 'derod',
|
|
159
|
+
slug: ORIENTATION_SLUG,
|
|
160
|
+
title: page.title,
|
|
161
|
+
description: page.description ?? undefined,
|
|
162
|
+
canonical_url: page.canonical_url,
|
|
163
|
+
headings: page.headings,
|
|
164
|
+
excerpt: page.content.slice(0, 420),
|
|
165
|
+
score: topScore,
|
|
166
|
+
};
|
|
167
|
+
hitsByProduct.set('derod', [injected, ...derodHits]);
|
|
168
|
+
}
|
|
169
|
+
catch {
|
|
170
|
+
// Orientation page unavailable (older bundle / fs override) — skip.
|
|
171
|
+
}
|
|
172
|
+
}
|
|
123
173
|
export async function recommendDocsPath(args) {
|
|
124
174
|
const intent = args.intent.trim();
|
|
125
|
-
|
|
175
|
+
// Default 4 (was 2) so a concept-intro page that ranks mid-pack per product
|
|
176
|
+
// can still survive the per-product cut and reach the merge where the
|
|
177
|
+
// beginner-intent nudge promotes it.
|
|
178
|
+
const limitPerProduct = args.limit_per_product ?? 4;
|
|
126
179
|
const productHint = args.product_hint;
|
|
127
180
|
// Always fan out to all four products. `searchDeroDocs` shares an
|
|
128
181
|
// in-process page cache (15s TTL) so the second+ calls in the batch
|
|
@@ -131,6 +184,15 @@ export async function recommendDocsPath(args) {
|
|
|
131
184
|
// product_hint.
|
|
132
185
|
const searches = await Promise.all(DERO_DOC_PRODUCTS.map((product) => searchDeroDocs({ query: intent, product, limit: limitPerProduct }).then((res) => [product, res.results])));
|
|
133
186
|
const hitsByProduct = new Map(searches);
|
|
187
|
+
// On a clearly-beginner conceptual intent, GUARANTEE the canonical
|
|
188
|
+
// orientation page (derod/basics/about — "Understanding DERO") is a
|
|
189
|
+
// candidate. It's a short, high-signal page that BM25 length-norm pushes
|
|
190
|
+
// below long jargon-dense pages, so it often never reaches the merge for the
|
|
191
|
+
// nudge to act on. Inject it (floored at the derod top score) only when it's
|
|
192
|
+
// absent; the ×2.2 concept nudge in rankRecommendations then elevates it.
|
|
193
|
+
if (CONCEPT_INTENT_REGEX.test(intent)) {
|
|
194
|
+
await ensureOrientationCandidate(hitsByProduct);
|
|
195
|
+
}
|
|
134
196
|
const recommended = rankRecommendations(intent, productHint, hitsByProduct);
|
|
135
197
|
if (recommended.length === 0) {
|
|
136
198
|
throw new Error(`No DERO docs matched intent: "${intent}" across products: ${DERO_DOC_PRODUCTS.join(', ')}. Try rephrasing with product-specific nouns (e.g. "TELA INDEX-1 contract", "DeroPay webhook").`);
|