datanotes 2.0.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/NOTICE +9 -0
  2. package/README.md +207 -28
  3. package/SECURITY.md +92 -45
  4. package/dist/THIRD-PARTY-NOTICES.txt +682 -0
  5. package/dist/api/catalog.d.cts +69 -0
  6. package/dist/api/catalog.d.ts +50 -2
  7. package/dist/api/cli-options.d.cts +39 -0
  8. package/dist/api/cli-options.d.ts +39 -0
  9. package/dist/api/client.d.cts +89 -0
  10. package/dist/api/client.d.ts +19 -30
  11. package/dist/api/docs.d.cts +211 -0
  12. package/dist/api/docs.d.ts +211 -0
  13. package/dist/api/guidance.d.cts +81 -0
  14. package/dist/api/guidance.d.ts +81 -0
  15. package/dist/api/index.cjs +6610 -2247
  16. package/dist/api/index.d.cts +13 -0
  17. package/dist/api/index.d.ts +10 -7
  18. package/dist/api/index.js +6610 -2247
  19. package/dist/api/local.cjs +118 -6
  20. package/dist/api/local.d.cts +95 -0
  21. package/dist/api/local.d.ts +70 -6
  22. package/dist/api/local.js +104 -6
  23. package/dist/api/mcp.cjs +17384 -0
  24. package/dist/api/mcp.d.cts +108 -0
  25. package/dist/api/mcp.d.ts +108 -0
  26. package/dist/api/mcp.js +17334 -0
  27. package/dist/api/otlp.d.cts +65 -0
  28. package/dist/api/redact.d.cts +17 -0
  29. package/dist/api/redact.d.ts +17 -0
  30. package/dist/api/requests.d.cts +26 -0
  31. package/dist/api/requests.d.ts +14 -16
  32. package/dist/api/results.d.cts +16 -0
  33. package/dist/api/results.d.ts +2 -1
  34. package/dist/api/tokens.d.cts +7 -0
  35. package/dist/datanotes.cjs +62511 -28069
  36. package/dist/docs/administration/configuration.md +59 -0
  37. package/dist/docs/administration/docker.md +80 -0
  38. package/dist/docs/administration/git-sync.md +71 -0
  39. package/dist/docs/administration/limits.md +69 -0
  40. package/dist/docs/administration/run-the-service.md +219 -0
  41. package/dist/docs/administration/status.md +61 -0
  42. package/dist/docs/administration/use-with-obsidian.md +75 -0
  43. package/dist/docs/api/operations/add_column.md +49 -0
  44. package/dist/docs/api/operations/add_constraint.md +55 -0
  45. package/dist/docs/api/operations/adopt_rows.md +50 -0
  46. package/dist/docs/api/operations/align_relations.md +41 -0
  47. package/dist/docs/api/operations/alter_column.md +46 -0
  48. package/dist/docs/api/operations/alter_table.md +67 -0
  49. package/dist/docs/api/operations/batch.md +48 -0
  50. package/dist/docs/api/operations/changes_stream.md +28 -0
  51. package/dist/docs/api/operations/check_table.md +29 -0
  52. package/dist/docs/api/operations/clone_table.md +48 -0
  53. package/dist/docs/api/operations/comment_on.md +42 -0
  54. package/dist/docs/api/operations/configure_database.md +52 -0
  55. package/dist/docs/api/operations/create_table.md +78 -0
  56. package/dist/docs/api/operations/create_view.md +54 -0
  57. package/dist/docs/api/operations/create_webhook.md +37 -0
  58. package/dist/docs/api/operations/define_base.md +52 -0
  59. package/dist/docs/api/operations/delete_rows.md +43 -0
  60. package/dist/docs/api/operations/delete_webhook.md +31 -0
  61. package/dist/docs/api/operations/describe_database.md +30 -0
  62. package/dist/docs/api/operations/describe_history.md +40 -0
  63. package/dist/docs/api/operations/describe_semantic_index.md +24 -0
  64. package/dist/docs/api/operations/describe_table.md +38 -0
  65. package/dist/docs/api/operations/docs.md +13 -0
  66. package/dist/docs/api/operations/drop_column.md +41 -0
  67. package/dist/docs/api/operations/drop_constraint.md +39 -0
  68. package/dist/docs/api/operations/drop_table.md +43 -0
  69. package/dist/docs/api/operations/drop_view.md +38 -0
  70. package/dist/docs/api/operations/engine_status.md +23 -0
  71. package/dist/docs/api/operations/graph_neighbors.md +32 -0
  72. package/dist/docs/api/operations/graph_path.md +32 -0
  73. package/dist/docs/api/operations/graph_traverse.md +43 -0
  74. package/dist/docs/api/operations/identify_session.md +24 -0
  75. package/dist/docs/api/operations/infer_table.md +43 -0
  76. package/dist/docs/api/operations/insert_row.md +48 -0
  77. package/dist/docs/api/operations/list_changes.md +35 -0
  78. package/dist/docs/api/operations/list_folder.md +28 -0
  79. package/dist/docs/api/operations/list_link_targets.md +44 -0
  80. package/dist/docs/api/operations/list_migrations.md +35 -0
  81. package/dist/docs/api/operations/list_tables.md +32 -0
  82. package/dist/docs/api/operations/list_webhooks.md +23 -0
  83. package/dist/docs/api/operations/manual_index.md +14 -0
  84. package/dist/docs/api/operations/manual_page.md +22 -0
  85. package/dist/docs/api/operations/merge_rows.md +44 -0
  86. package/dist/docs/api/operations/move_rows.md +52 -0
  87. package/dist/docs/api/operations/openapi.md +13 -0
  88. package/dist/docs/api/operations/openapi_post.md +20 -0
  89. package/dist/docs/api/operations/read_note.md +29 -0
  90. package/dist/docs/api/operations/recompute_columns.md +44 -0
  91. package/dist/docs/api/operations/record_tool_call.md +36 -0
  92. package/dist/docs/api/operations/rename_column.md +44 -0
  93. package/dist/docs/api/operations/rename_value.md +45 -0
  94. package/dist/docs/api/operations/restore_database.md +51 -0
  95. package/dist/docs/api/operations/restore_table.md +46 -0
  96. package/dist/docs/api/operations/search_notes.md +28 -0
  97. package/dist/docs/api/operations/select_rows.md +61 -0
  98. package/dist/docs/api/operations/semantic_search.md +34 -0
  99. package/dist/docs/api/operations/semantic_search_docs.md +26 -0
  100. package/dist/docs/api/operations/set_table_bases.md +44 -0
  101. package/dist/docs/api/operations/status.md +13 -0
  102. package/dist/docs/api/operations/stop_engine.md +23 -0
  103. package/dist/docs/api/operations/sync_semantic_index.md +33 -0
  104. package/dist/docs/api/operations/table_changes.md +31 -0
  105. package/dist/docs/api/operations/tags/auxiliary.md +14 -0
  106. package/dist/docs/api/operations/tags/change-feed.md +8 -0
  107. package/dist/docs/api/operations/tags/history.md +17 -0
  108. package/dist/docs/api/operations/tags/queries.md +15 -0
  109. package/dist/docs/api/operations/tags/rows-dml.md +16 -0
  110. package/dist/docs/api/operations/tags/schema-ddl.md +22 -0
  111. package/dist/docs/api/operations/tags/service.md +15 -0
  112. package/dist/docs/api/operations/tags/tokens.md +13 -0
  113. package/dist/docs/api/operations/tokens_create.md +34 -0
  114. package/dist/docs/api/operations/tokens_delete.md +29 -0
  115. package/dist/docs/api/operations/tokens_list.md +21 -0
  116. package/dist/docs/api/operations/tokens_me.md +20 -0
  117. package/dist/docs/api/operations/tokens_rotate.md +29 -0
  118. package/dist/docs/api/operations/tokens_update.md +34 -0
  119. package/dist/docs/api/operations/undo_migration.md +46 -0
  120. package/dist/docs/api/operations/update_row.md +60 -0
  121. package/dist/docs/api/operations/update_rows.md +46 -0
  122. package/dist/docs/api/operations/vacuum_table.md +37 -0
  123. package/dist/docs/api.md +135 -0
  124. package/dist/docs/develop/build-an-app.md +320 -0
  125. package/dist/docs/develop/build-on-datanotes.md +138 -0
  126. package/dist/docs/develop/change-feed-and-webhooks.md +70 -0
  127. package/dist/docs/develop/client.md +116 -0
  128. package/dist/docs/develop/concurrency.md +153 -0
  129. package/dist/docs/develop/http-api.md +79 -0
  130. package/dist/docs/develop/telemetry.md +86 -0
  131. package/dist/docs/guides/agents/docs-offline.md +99 -0
  132. package/dist/docs/guides/agents/how-agents-use-datanotes.md +124 -0
  133. package/dist/docs/guides/agents/prompts.md +495 -0
  134. package/dist/docs/guides/agents/reading-errors.md +112 -0
  135. package/dist/docs/guides/data-quality/check-constraints.md +379 -0
  136. package/dist/docs/guides/data-quality/check-table.md +63 -0
  137. package/dist/docs/guides/data-quality/hand-edits.md +507 -0
  138. package/dist/docs/guides/data-quality/sync-between-devices.md +51 -0
  139. package/dist/docs/guides/data-quality/validation.md +90 -0
  140. package/dist/docs/guides/database-objects/bases.md +480 -0
  141. package/dist/docs/guides/database-objects/catalogs-and-schemas.md +897 -0
  142. package/dist/docs/guides/database-objects/columns.md +1332 -0
  143. package/dist/docs/guides/database-objects/relations.md +1454 -0
  144. package/dist/docs/guides/database-objects/tables.md +1404 -0
  145. package/dist/docs/guides/database-objects/views.md +1003 -0
  146. package/dist/docs/guides/history/back-up.md +195 -0
  147. package/dist/docs/guides/history/change-data-feed.md +247 -0
  148. package/dist/docs/guides/history/journal-and-undo.md +262 -0
  149. package/dist/docs/guides/history/restore.md +341 -0
  150. package/dist/docs/guides/history/table-history.md +657 -0
  151. package/dist/docs/guides/history/vacuum.md +35 -0
  152. package/dist/docs/guides/read-and-write/automatic-links.md +768 -0
  153. package/dist/docs/guides/read-and-write/batch.md +139 -0
  154. package/dist/docs/guides/read-and-write/import-notes.md +896 -0
  155. package/dist/docs/guides/read-and-write/joins-and-aggregates.md +251 -0
  156. package/dist/docs/guides/read-and-write/read-and-filter.md +536 -0
  157. package/dist/docs/guides/read-and-write/write-rows.md +573 -0
  158. package/dist/docs/guides/search/link-graph.md +146 -0
  159. package/dist/docs/guides/search/semantic.md +133 -0
  160. package/dist/docs/guides/search/text.md +142 -0
  161. package/dist/docs/guides/security/security-model.md +110 -0
  162. package/dist/docs/guides/security/tokens.md +60 -0
  163. package/dist/docs/guides/security/who-did-what.md +42 -0
  164. package/dist/docs/index.md +113 -0
  165. package/dist/docs/llms.txt +33 -0
  166. package/dist/docs/reference/cli.md +136 -0
  167. package/dist/docs/reference/compatibility.md +63 -0
  168. package/dist/docs/reference/errors.md +72 -0
  169. package/dist/docs/reference/glossary.md +161 -0
  170. package/dist/docs/reference/operations/auxiliary.md +116 -0
  171. package/dist/docs/reference/operations/history.md +168 -0
  172. package/dist/docs/reference/operations/queries.md +169 -0
  173. package/dist/docs/reference/operations/rows.md +185 -0
  174. package/dist/docs/reference/operations/schema.md +316 -0
  175. package/dist/docs/reference/operations.md +96 -0
  176. package/dist/docs/reference/settings.md +31 -0
  177. package/dist/docs/release-notes.md +67 -0
  178. package/dist/docs/start/connect-agents.md +204 -0
  179. package/dist/docs/start/how-it-works.md +317 -0
  180. package/dist/docs/start/quick-start.md +126 -0
  181. package/package.json +58 -14
@@ -0,0 +1,108 @@
1
+ /**
2
+ * `datanotes/mcp`: the engine's operations as Model Context Protocol (MCP) tools, for people who
3
+ * build their own MCP server on Datanotes: list some of them next to tools of their own, call them
4
+ * through a `DatanotesClient`, and start the server's instructions with the engine's.
5
+ *
6
+ * const tools = [...engineTools({ only: ["select_rows", "insert_row"] }), myTool];
7
+ * if (isEngineTool(name)) return callEngineTool(client, name, args);
8
+ *
9
+ * The definitions come from the catalogue (`catalog.ts`), so they always match the engine's
10
+ * routes; `datanotes mcp` (src/mcp) serves the same ones. Next to them, the docs tools (list_docs,
11
+ * read_docs, search_docs: docsTools, callDocsTool) read the docs of this version that the package
12
+ * ships (src/api/docs.ts, Node only), with no engine; given a client, search_docs also asks the
13
+ * engine for its ranking of the docs by meaning, and fuses it with its own (hybrid search). Plain
14
+ * data and functions: no dependency, not even the MCP SDK, which only the server that uses them
15
+ * needs.
16
+ */
17
+ import { type OperationDef } from "./catalog.cjs";
18
+ import { type ActorInfo, type DatanotesClient } from "./client.cjs";
19
+ import { type DocsLibrary } from "./docs.cjs";
20
+ /** What an agent needs to know before it uses the engine's tools: `datanotes mcp` sends it as its instructions. */
21
+ export declare const ENGINE_INSTRUCTIONS = "Database of Markdown notes: tables defined in metastore.yaml, a row is a note whose front matter key `table` names its table, and each front matter key is a column. Use list_tables / describe_table first, select_rows to read, insert_row / update_row / update_rows / batch to write (validated, journaled, undo with undo_migration). Change the schema only with its operations (create_table, add_column, alter_column, create_view, ...); never edit metastore.yaml. Every table and column needs a `description` of what it holds, or it is refused: descriptions are how agents and people understand the schema. Fill those describe_table lists in `missing_descriptions` with alter_table / alter_column. A body you write links the notes it mentions by name (a one-word name only with a capital, inside a sentence): when a write returns ambiguous_mentions, read the candidate notes and link the right one with update_row and autolink: false, or leave the text. Read the docs of this version with search_docs and read_docs.";
22
+ /** An engine operation as an MCP tool definition (`tools/list`). */
23
+ export interface EngineTool {
24
+ name: string;
25
+ description: string;
26
+ inputSchema: Record<string, unknown>;
27
+ annotations: OperationDef["annotations"];
28
+ }
29
+ /** Which engine tools to keep: only these names, and none of those. Unknown names throw, so a typo shows at once. */
30
+ export interface EngineToolFilter {
31
+ only?: readonly string[];
32
+ except?: readonly string[];
33
+ }
34
+ /** MCP content of a tool's result (`tools/call`): what a server returns to the agent. */
35
+ export interface ToolContent {
36
+ [key: string]: unknown;
37
+ content: {
38
+ type: "text";
39
+ text: string;
40
+ }[];
41
+ structuredContent?: Record<string, unknown>;
42
+ isError?: boolean;
43
+ }
44
+ /**
45
+ * The engine's operations as MCP tool definitions, in the catalogue's order. Each one is a fresh
46
+ * copy (name, description, input schema, annotations), safe to change.
47
+ */
48
+ export declare function engineTools(filter?: EngineToolFilter): EngineTool[];
49
+ /** Is this the name of an engine tool (kept by the filter, when one is given)? */
50
+ export declare function isEngineTool(name: string, filter?: EngineToolFilter): boolean;
51
+ /** MCP content of a result: the text, and the object itself when it is one. */
52
+ export declare function toolContent(ok: boolean, value: unknown): ToolContent;
53
+ /**
54
+ * An error result as the agents of a server that serves the docs tools read it: each `Docs:` line
55
+ * names only the read_docs call that reads its section offline, with no web address to fetch, as
56
+ * `datanotes mcp` answers. A docs line that is not a page of the docs, and any other result, stay
57
+ * as they are.
58
+ */
59
+ export declare function offlineDocs(content: ToolContent): ToolContent;
60
+ /**
61
+ * What is wrong with a call before it reaches the engine, as the text the agent reads: a tool that
62
+ * does not exist (or that the filter leaves out), arguments the tool does not take, a required
63
+ * one missing, a value of the wrong type. Each with the closest real name, the tool's arguments
64
+ * and its docs. Null when the call can be sent.
65
+ */
66
+ export declare function callProblem(name: string, args: Record<string, unknown>, filter?: EngineToolFilter): string | null;
67
+ /**
68
+ * Call an engine tool for an agent and answer its MCP content. A refusal, bad arguments, a name
69
+ * the filter leaves out and an engine that does not answer come back as an error result
70
+ * (`isError`), never as a throw: the agent reads why, how to fix it and where to read more.
71
+ * `actor` names the agent in the journal (default: the client's own actor).
72
+ */
73
+ export declare function callEngineTool(client: DatanotesClient, name: string, args?: Record<string, unknown>, opts?: EngineToolFilter & {
74
+ actor?: ActorInfo;
75
+ }): Promise<ToolContent>;
76
+ /** The names of the docs tools. */
77
+ export declare const DOCS_TOOL_NAMES: readonly ["list_docs", "read_docs", "search_docs"];
78
+ /**
79
+ * The tools that read the Datanotes documentation of this version, shipped in the package
80
+ * (`list_docs`, `read_docs`, `search_docs`), as MCP tool definitions: fresh copies, kept by the
81
+ * same filter as engineTools (unknown names throw). They need no engine: callDocsTool answers them.
82
+ */
83
+ export declare function docsTools(filter?: EngineToolFilter): EngineTool[];
84
+ /** Is this the name of a docs tool (kept by the filter, when one is given)? */
85
+ export declare function isDocsTool(name: string, filter?: EngineToolFilter): boolean;
86
+ /** How long search_docs waits for the engine's ranking of the docs by meaning, before it ranks by words alone. */
87
+ export declare const SEMANTIC_DOCS_TIMEOUT_MS = 10000;
88
+ /** After an engine did not answer (or not in time), how long search_docs ranks by words alone before it asks it again. */
89
+ export declare const SEMANTIC_DOCS_RETRY_MS = 60000;
90
+ /** How search_docs reaches the engine for its ranking by meaning (hybrid search). */
91
+ export interface DocsSearchOptions {
92
+ /** The engine: with semantic search on, search_docs fuses its ranking by meaning with the ranking by words. */
93
+ client?: DatanotesClient;
94
+ /** Who asks, as for engine tools (default: the client's own actor). */
95
+ actor?: ActorInfo;
96
+ /** How long to wait for the engine (default SEMANTIC_DOCS_TIMEOUT_MS). */
97
+ semanticTimeoutMs?: number;
98
+ }
99
+ /**
100
+ * Answer a docs tool for an agent (MCP content): text, or an error result (`isError`) that says
101
+ * what is wrong (an unknown page or section, with the closest real ones), how to fix it and where
102
+ * to read more; never a throw. `docs`: the docs to read (default: the package's own, `openDocs()`).
103
+ * `client`: the engine, for search_docs' hybrid search (without it, or when the engine has no
104
+ * ranking by meaning to give, search_docs ranks by words alone).
105
+ */
106
+ export declare function callDocsTool(name: string, args?: Record<string, unknown>, opts?: EngineToolFilter & DocsSearchOptions & {
107
+ docs?: DocsLibrary;
108
+ }): Promise<ToolContent>;
@@ -0,0 +1,108 @@
1
+ /**
2
+ * `datanotes/mcp`: the engine's operations as Model Context Protocol (MCP) tools, for people who
3
+ * build their own MCP server on Datanotes: list some of them next to tools of their own, call them
4
+ * through a `DatanotesClient`, and start the server's instructions with the engine's.
5
+ *
6
+ * const tools = [...engineTools({ only: ["select_rows", "insert_row"] }), myTool];
7
+ * if (isEngineTool(name)) return callEngineTool(client, name, args);
8
+ *
9
+ * The definitions come from the catalogue (`catalog.ts`), so they always match the engine's
10
+ * routes; `datanotes mcp` (src/mcp) serves the same ones. Next to them, the docs tools (list_docs,
11
+ * read_docs, search_docs: docsTools, callDocsTool) read the docs of this version that the package
12
+ * ships (src/api/docs.ts, Node only), with no engine; given a client, search_docs also asks the
13
+ * engine for its ranking of the docs by meaning, and fuses it with its own (hybrid search). Plain
14
+ * data and functions: no dependency, not even the MCP SDK, which only the server that uses them
15
+ * needs.
16
+ */
17
+ import { type OperationDef } from "./catalog.js";
18
+ import { type ActorInfo, type DatanotesClient } from "./client.js";
19
+ import { type DocsLibrary } from "./docs.js";
20
+ /** What an agent needs to know before it uses the engine's tools: `datanotes mcp` sends it as its instructions. */
21
+ export declare const ENGINE_INSTRUCTIONS = "Database of Markdown notes: tables defined in metastore.yaml, a row is a note whose front matter key `table` names its table, and each front matter key is a column. Use list_tables / describe_table first, select_rows to read, insert_row / update_row / update_rows / batch to write (validated, journaled, undo with undo_migration). Change the schema only with its operations (create_table, add_column, alter_column, create_view, ...); never edit metastore.yaml. Every table and column needs a `description` of what it holds, or it is refused: descriptions are how agents and people understand the schema. Fill those describe_table lists in `missing_descriptions` with alter_table / alter_column. A body you write links the notes it mentions by name (a one-word name only with a capital, inside a sentence): when a write returns ambiguous_mentions, read the candidate notes and link the right one with update_row and autolink: false, or leave the text. Read the docs of this version with search_docs and read_docs.";
22
+ /** An engine operation as an MCP tool definition (`tools/list`). */
23
+ export interface EngineTool {
24
+ name: string;
25
+ description: string;
26
+ inputSchema: Record<string, unknown>;
27
+ annotations: OperationDef["annotations"];
28
+ }
29
+ /** Which engine tools to keep: only these names, and none of those. Unknown names throw, so a typo shows at once. */
30
+ export interface EngineToolFilter {
31
+ only?: readonly string[];
32
+ except?: readonly string[];
33
+ }
34
+ /** MCP content of a tool's result (`tools/call`): what a server returns to the agent. */
35
+ export interface ToolContent {
36
+ [key: string]: unknown;
37
+ content: {
38
+ type: "text";
39
+ text: string;
40
+ }[];
41
+ structuredContent?: Record<string, unknown>;
42
+ isError?: boolean;
43
+ }
44
+ /**
45
+ * The engine's operations as MCP tool definitions, in the catalogue's order. Each one is a fresh
46
+ * copy (name, description, input schema, annotations), safe to change.
47
+ */
48
+ export declare function engineTools(filter?: EngineToolFilter): EngineTool[];
49
+ /** Is this the name of an engine tool (kept by the filter, when one is given)? */
50
+ export declare function isEngineTool(name: string, filter?: EngineToolFilter): boolean;
51
+ /** MCP content of a result: the text, and the object itself when it is one. */
52
+ export declare function toolContent(ok: boolean, value: unknown): ToolContent;
53
+ /**
54
+ * An error result as the agents of a server that serves the docs tools read it: each `Docs:` line
55
+ * names only the read_docs call that reads its section offline, with no web address to fetch, as
56
+ * `datanotes mcp` answers. A docs line that is not a page of the docs, and any other result, stay
57
+ * as they are.
58
+ */
59
+ export declare function offlineDocs(content: ToolContent): ToolContent;
60
+ /**
61
+ * What is wrong with a call before it reaches the engine, as the text the agent reads: a tool that
62
+ * does not exist (or that the filter leaves out), arguments the tool does not take, a required
63
+ * one missing, a value of the wrong type. Each with the closest real name, the tool's arguments
64
+ * and its docs. Null when the call can be sent.
65
+ */
66
+ export declare function callProblem(name: string, args: Record<string, unknown>, filter?: EngineToolFilter): string | null;
67
+ /**
68
+ * Call an engine tool for an agent and answer its MCP content. A refusal, bad arguments, a name
69
+ * the filter leaves out and an engine that does not answer come back as an error result
70
+ * (`isError`), never as a throw: the agent reads why, how to fix it and where to read more.
71
+ * `actor` names the agent in the journal (default: the client's own actor).
72
+ */
73
+ export declare function callEngineTool(client: DatanotesClient, name: string, args?: Record<string, unknown>, opts?: EngineToolFilter & {
74
+ actor?: ActorInfo;
75
+ }): Promise<ToolContent>;
76
+ /** The names of the docs tools. */
77
+ export declare const DOCS_TOOL_NAMES: readonly ["list_docs", "read_docs", "search_docs"];
78
+ /**
79
+ * The tools that read the Datanotes documentation of this version, shipped in the package
80
+ * (`list_docs`, `read_docs`, `search_docs`), as MCP tool definitions: fresh copies, kept by the
81
+ * same filter as engineTools (unknown names throw). They need no engine: callDocsTool answers them.
82
+ */
83
+ export declare function docsTools(filter?: EngineToolFilter): EngineTool[];
84
+ /** Is this the name of a docs tool (kept by the filter, when one is given)? */
85
+ export declare function isDocsTool(name: string, filter?: EngineToolFilter): boolean;
86
+ /** How long search_docs waits for the engine's ranking of the docs by meaning, before it ranks by words alone. */
87
+ export declare const SEMANTIC_DOCS_TIMEOUT_MS = 10000;
88
+ /** After an engine did not answer (or not in time), how long search_docs ranks by words alone before it asks it again. */
89
+ export declare const SEMANTIC_DOCS_RETRY_MS = 60000;
90
+ /** How search_docs reaches the engine for its ranking by meaning (hybrid search). */
91
+ export interface DocsSearchOptions {
92
+ /** The engine: with semantic search on, search_docs fuses its ranking by meaning with the ranking by words. */
93
+ client?: DatanotesClient;
94
+ /** Who asks, as for engine tools (default: the client's own actor). */
95
+ actor?: ActorInfo;
96
+ /** How long to wait for the engine (default SEMANTIC_DOCS_TIMEOUT_MS). */
97
+ semanticTimeoutMs?: number;
98
+ }
99
+ /**
100
+ * Answer a docs tool for an agent (MCP content): text, or an error result (`isError`) that says
101
+ * what is wrong (an unknown page or section, with the closest real ones), how to fix it and where
102
+ * to read more; never a throw. `docs`: the docs to read (default: the package's own, `openDocs()`).
103
+ * `client`: the engine, for search_docs' hybrid search (without it, or when the engine has no
104
+ * ranking by meaning to give, search_docs ranks by words alone).
105
+ */
106
+ export declare function callDocsTool(name: string, args?: Record<string, unknown>, opts?: EngineToolFilter & DocsSearchOptions & {
107
+ docs?: DocsLibrary;
108
+ }): Promise<ToolContent>;