datanotes 2.0.0 → 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.
- package/NOTICE +9 -0
- package/README.md +207 -28
- package/SECURITY.md +92 -45
- package/dist/THIRD-PARTY-NOTICES.txt +682 -0
- package/dist/api/catalog.d.cts +69 -0
- package/dist/api/catalog.d.ts +50 -2
- package/dist/api/cli-options.d.cts +39 -0
- package/dist/api/cli-options.d.ts +39 -0
- package/dist/api/client.d.cts +89 -0
- package/dist/api/client.d.ts +19 -30
- package/dist/api/docs.d.cts +211 -0
- package/dist/api/docs.d.ts +211 -0
- package/dist/api/guidance.d.cts +81 -0
- package/dist/api/guidance.d.ts +81 -0
- package/dist/api/index.cjs +6610 -2247
- package/dist/api/index.d.cts +13 -0
- package/dist/api/index.d.ts +10 -7
- package/dist/api/index.js +6610 -2247
- package/dist/api/local.cjs +118 -6
- package/dist/api/local.d.cts +95 -0
- package/dist/api/local.d.ts +70 -6
- package/dist/api/local.js +104 -6
- package/dist/api/mcp.cjs +17384 -0
- package/dist/api/mcp.d.cts +108 -0
- package/dist/api/mcp.d.ts +108 -0
- package/dist/api/mcp.js +17334 -0
- package/dist/api/otlp.d.cts +65 -0
- package/dist/api/redact.d.cts +17 -0
- package/dist/api/redact.d.ts +17 -0
- package/dist/api/requests.d.cts +26 -0
- package/dist/api/requests.d.ts +14 -16
- package/dist/api/results.d.cts +16 -0
- package/dist/api/results.d.ts +2 -1
- package/dist/api/tokens.d.cts +7 -0
- package/dist/datanotes.cjs +62911 -28409
- package/dist/docs/administration/configuration.md +59 -0
- package/dist/docs/administration/docker.md +80 -0
- package/dist/docs/administration/git-sync.md +71 -0
- package/dist/docs/administration/limits.md +69 -0
- package/dist/docs/administration/run-the-service.md +219 -0
- package/dist/docs/administration/status.md +61 -0
- package/dist/docs/administration/use-with-obsidian.md +75 -0
- package/dist/docs/api/operations/add_column.md +49 -0
- package/dist/docs/api/operations/add_constraint.md +55 -0
- package/dist/docs/api/operations/adopt_rows.md +50 -0
- package/dist/docs/api/operations/align_relations.md +41 -0
- package/dist/docs/api/operations/alter_column.md +46 -0
- package/dist/docs/api/operations/alter_table.md +67 -0
- package/dist/docs/api/operations/batch.md +48 -0
- package/dist/docs/api/operations/changes_stream.md +28 -0
- package/dist/docs/api/operations/check_table.md +29 -0
- package/dist/docs/api/operations/clone_table.md +48 -0
- package/dist/docs/api/operations/comment_on.md +42 -0
- package/dist/docs/api/operations/configure_database.md +52 -0
- package/dist/docs/api/operations/create_table.md +78 -0
- package/dist/docs/api/operations/create_view.md +54 -0
- package/dist/docs/api/operations/create_webhook.md +37 -0
- package/dist/docs/api/operations/define_base.md +52 -0
- package/dist/docs/api/operations/delete_rows.md +43 -0
- package/dist/docs/api/operations/delete_webhook.md +31 -0
- package/dist/docs/api/operations/describe_database.md +30 -0
- package/dist/docs/api/operations/describe_history.md +40 -0
- package/dist/docs/api/operations/describe_semantic_index.md +24 -0
- package/dist/docs/api/operations/describe_table.md +38 -0
- package/dist/docs/api/operations/docs.md +13 -0
- package/dist/docs/api/operations/drop_column.md +41 -0
- package/dist/docs/api/operations/drop_constraint.md +39 -0
- package/dist/docs/api/operations/drop_table.md +43 -0
- package/dist/docs/api/operations/drop_view.md +38 -0
- package/dist/docs/api/operations/engine_status.md +23 -0
- package/dist/docs/api/operations/graph_neighbors.md +32 -0
- package/dist/docs/api/operations/graph_path.md +32 -0
- package/dist/docs/api/operations/graph_traverse.md +43 -0
- package/dist/docs/api/operations/identify_session.md +24 -0
- package/dist/docs/api/operations/infer_table.md +43 -0
- package/dist/docs/api/operations/insert_row.md +48 -0
- package/dist/docs/api/operations/list_changes.md +35 -0
- package/dist/docs/api/operations/list_folder.md +28 -0
- package/dist/docs/api/operations/list_link_targets.md +44 -0
- package/dist/docs/api/operations/list_migrations.md +35 -0
- package/dist/docs/api/operations/list_tables.md +32 -0
- package/dist/docs/api/operations/list_webhooks.md +23 -0
- package/dist/docs/api/operations/manual_index.md +14 -0
- package/dist/docs/api/operations/manual_page.md +22 -0
- package/dist/docs/api/operations/merge_rows.md +44 -0
- package/dist/docs/api/operations/move_rows.md +52 -0
- package/dist/docs/api/operations/openapi.md +13 -0
- package/dist/docs/api/operations/openapi_post.md +20 -0
- package/dist/docs/api/operations/read_note.md +29 -0
- package/dist/docs/api/operations/recompute_columns.md +44 -0
- package/dist/docs/api/operations/record_tool_call.md +36 -0
- package/dist/docs/api/operations/rename_column.md +44 -0
- package/dist/docs/api/operations/rename_value.md +45 -0
- package/dist/docs/api/operations/restore_database.md +51 -0
- package/dist/docs/api/operations/restore_table.md +46 -0
- package/dist/docs/api/operations/search_notes.md +28 -0
- package/dist/docs/api/operations/select_rows.md +61 -0
- package/dist/docs/api/operations/semantic_search.md +34 -0
- package/dist/docs/api/operations/semantic_search_docs.md +26 -0
- package/dist/docs/api/operations/set_table_bases.md +44 -0
- package/dist/docs/api/operations/status.md +13 -0
- package/dist/docs/api/operations/stop_engine.md +23 -0
- package/dist/docs/api/operations/sync_semantic_index.md +33 -0
- package/dist/docs/api/operations/table_changes.md +31 -0
- package/dist/docs/api/operations/tags/auxiliary.md +14 -0
- package/dist/docs/api/operations/tags/change-feed.md +8 -0
- package/dist/docs/api/operations/tags/history.md +17 -0
- package/dist/docs/api/operations/tags/queries.md +15 -0
- package/dist/docs/api/operations/tags/rows-dml.md +16 -0
- package/dist/docs/api/operations/tags/schema-ddl.md +22 -0
- package/dist/docs/api/operations/tags/service.md +15 -0
- package/dist/docs/api/operations/tags/tokens.md +13 -0
- package/dist/docs/api/operations/tokens_create.md +34 -0
- package/dist/docs/api/operations/tokens_delete.md +29 -0
- package/dist/docs/api/operations/tokens_list.md +21 -0
- package/dist/docs/api/operations/tokens_me.md +20 -0
- package/dist/docs/api/operations/tokens_rotate.md +29 -0
- package/dist/docs/api/operations/tokens_update.md +34 -0
- package/dist/docs/api/operations/undo_migration.md +46 -0
- package/dist/docs/api/operations/update_row.md +60 -0
- package/dist/docs/api/operations/update_rows.md +46 -0
- package/dist/docs/api/operations/vacuum_table.md +37 -0
- package/dist/docs/api.md +135 -0
- package/dist/docs/develop/build-an-app.md +320 -0
- package/dist/docs/develop/build-on-datanotes.md +138 -0
- package/dist/docs/develop/change-feed-and-webhooks.md +70 -0
- package/dist/docs/develop/client.md +116 -0
- package/dist/docs/develop/concurrency.md +153 -0
- package/dist/docs/develop/http-api.md +79 -0
- package/dist/docs/develop/telemetry.md +86 -0
- package/dist/docs/guides/agents/docs-offline.md +99 -0
- package/dist/docs/guides/agents/how-agents-use-datanotes.md +124 -0
- package/dist/docs/guides/agents/prompts.md +495 -0
- package/dist/docs/guides/agents/reading-errors.md +112 -0
- package/dist/docs/guides/data-quality/check-constraints.md +379 -0
- package/dist/docs/guides/data-quality/check-table.md +63 -0
- package/dist/docs/guides/data-quality/hand-edits.md +507 -0
- package/dist/docs/guides/data-quality/sync-between-devices.md +51 -0
- package/dist/docs/guides/data-quality/validation.md +90 -0
- package/dist/docs/guides/database-objects/bases.md +480 -0
- package/dist/docs/guides/database-objects/catalogs-and-schemas.md +897 -0
- package/dist/docs/guides/database-objects/columns.md +1332 -0
- package/dist/docs/guides/database-objects/relations.md +1454 -0
- package/dist/docs/guides/database-objects/tables.md +1404 -0
- package/dist/docs/guides/database-objects/views.md +1003 -0
- package/dist/docs/guides/history/back-up.md +195 -0
- package/dist/docs/guides/history/change-data-feed.md +247 -0
- package/dist/docs/guides/history/journal-and-undo.md +262 -0
- package/dist/docs/guides/history/restore.md +341 -0
- package/dist/docs/guides/history/table-history.md +657 -0
- package/dist/docs/guides/history/vacuum.md +35 -0
- package/dist/docs/guides/read-and-write/automatic-links.md +768 -0
- package/dist/docs/guides/read-and-write/batch.md +139 -0
- package/dist/docs/guides/read-and-write/import-notes.md +896 -0
- package/dist/docs/guides/read-and-write/joins-and-aggregates.md +251 -0
- package/dist/docs/guides/read-and-write/read-and-filter.md +536 -0
- package/dist/docs/guides/read-and-write/write-rows.md +573 -0
- package/dist/docs/guides/search/link-graph.md +146 -0
- package/dist/docs/guides/search/semantic.md +133 -0
- package/dist/docs/guides/search/text.md +142 -0
- package/dist/docs/guides/security/security-model.md +110 -0
- package/dist/docs/guides/security/tokens.md +60 -0
- package/dist/docs/guides/security/who-did-what.md +42 -0
- package/dist/docs/index.md +113 -0
- package/dist/docs/llms.txt +33 -0
- package/dist/docs/reference/cli.md +136 -0
- package/dist/docs/reference/compatibility.md +63 -0
- package/dist/docs/reference/errors.md +72 -0
- package/dist/docs/reference/glossary.md +161 -0
- package/dist/docs/reference/operations/auxiliary.md +116 -0
- package/dist/docs/reference/operations/history.md +168 -0
- package/dist/docs/reference/operations/queries.md +169 -0
- package/dist/docs/reference/operations/rows.md +185 -0
- package/dist/docs/reference/operations/schema.md +316 -0
- package/dist/docs/reference/operations.md +96 -0
- package/dist/docs/reference/settings.md +31 -0
- package/dist/docs/release-notes.md +67 -0
- package/dist/docs/start/connect-agents.md +204 -0
- package/dist/docs/start/how-it-works.md +317 -0
- package/dist/docs/start/quick-start.md +126 -0
- package/package.json +59 -14
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The operations of the HTTP API, described for their callers: name, description, input schema
|
|
3
|
+
* and hints. The MCP server (`datanotes mcp`, src/mcp) offers each one as a tool of the same name
|
|
4
|
+
* (the shape is MCP's tool definition); the OpenAPI document and the docs are generated from it. The route and body each
|
|
5
|
+
* one sends: `requests.ts`.
|
|
6
|
+
*/
|
|
7
|
+
export interface OperationDef {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
inputSchema: Record<string, unknown>;
|
|
11
|
+
/**
|
|
12
|
+
* MCP tool hints (not part of the Datanotes 3 contract). `destructiveHint` is true for every
|
|
13
|
+
* write that may overwrite or remove existing data (values, names, definitions, settings, history)
|
|
14
|
+
* or send it out of the engine (webhooks); false only for reads and purely additive writes
|
|
15
|
+
* (tests/api-mcp.test.ts holds the list).
|
|
16
|
+
*/
|
|
17
|
+
annotations: {
|
|
18
|
+
title?: string;
|
|
19
|
+
readOnlyHint?: boolean;
|
|
20
|
+
destructiveHint?: boolean;
|
|
21
|
+
idempotentHint?: boolean;
|
|
22
|
+
openWorldHint?: boolean;
|
|
23
|
+
};
|
|
24
|
+
/** JSON Schema of the successful (2xx) response body, for the OpenAPI document; not sent to MCP clients. */
|
|
25
|
+
responseSchema?: Record<string, unknown>;
|
|
26
|
+
/**
|
|
27
|
+
* Secrets in the call: the argument names and result keys never recorded (the change feed's
|
|
28
|
+
* `tool_call` events, which the store backup commits). `redactToolCall` (redact.ts) applies it.
|
|
29
|
+
*/
|
|
30
|
+
sensitive?: {
|
|
31
|
+
args?: string[];
|
|
32
|
+
result?: string[];
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export declare const OPERATIONS: OperationDef[];
|
|
36
|
+
/**
|
|
37
|
+
* The kinds of operation, as the docs' reference groups them (one page each,
|
|
38
|
+
* `reference/operations/<kind>`), like the statement kinds of a SQL reference.
|
|
39
|
+
*/
|
|
40
|
+
export declare const OPERATION_KINDS: {
|
|
41
|
+
readonly schema: {
|
|
42
|
+
readonly title: "Schema operations (DDL)";
|
|
43
|
+
readonly label: "Schema (DDL)";
|
|
44
|
+
readonly description: "Operations that define the database: tables, columns, constraints, bases and views.";
|
|
45
|
+
};
|
|
46
|
+
readonly rows: {
|
|
47
|
+
readonly title: "Row operations (DML)";
|
|
48
|
+
readonly label: "Rows (DML)";
|
|
49
|
+
readonly description: "Operations that write rows: insert, update, merge, delete, move, adopt and batch.";
|
|
50
|
+
};
|
|
51
|
+
readonly queries: {
|
|
52
|
+
readonly title: "Query operations";
|
|
53
|
+
readonly label: "Queries";
|
|
54
|
+
readonly description: "Operations that read rows and notes: select_rows, link targets, text and semantic search, the link graph.";
|
|
55
|
+
};
|
|
56
|
+
readonly history: {
|
|
57
|
+
readonly title: "History operations";
|
|
58
|
+
readonly label: "History";
|
|
59
|
+
readonly description: "Operations on the journal, a table's versions, the change feed and webhooks: undo, time travel, restore and vacuum.";
|
|
60
|
+
};
|
|
61
|
+
readonly auxiliary: {
|
|
62
|
+
readonly title: "Auxiliary operations";
|
|
63
|
+
readonly label: "Auxiliary";
|
|
64
|
+
readonly description: "Operations that describe and check the database, configure it and maintain its indexes.";
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export type OperationKind = keyof typeof OPERATION_KINDS;
|
|
68
|
+
/** The kind of every operation of {@link OPERATIONS} (tests/operation-kinds.test.ts: each has exactly one). */
|
|
69
|
+
export declare const OPERATION_KIND: Readonly<Record<string, OperationKind>>;
|
package/dist/api/catalog.d.ts
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The operations of the HTTP API, described for their callers: name, description, input schema
|
|
3
|
-
* and hints.
|
|
4
|
-
* definition); the OpenAPI document and the docs are generated from it. The route and body each
|
|
3
|
+
* and hints. The MCP server (`datanotes mcp`, src/mcp) offers each one as a tool of the same name
|
|
4
|
+
* (the shape is MCP's tool definition); the OpenAPI document and the docs are generated from it. The route and body each
|
|
5
5
|
* one sends: `requests.ts`.
|
|
6
6
|
*/
|
|
7
7
|
export interface OperationDef {
|
|
8
8
|
name: string;
|
|
9
9
|
description: string;
|
|
10
10
|
inputSchema: Record<string, unknown>;
|
|
11
|
+
/**
|
|
12
|
+
* MCP tool hints (not part of the Datanotes 3 contract). `destructiveHint` is true for every
|
|
13
|
+
* write that may overwrite or remove existing data (values, names, definitions, settings, history)
|
|
14
|
+
* or send it out of the engine (webhooks); false only for reads and purely additive writes
|
|
15
|
+
* (tests/api-mcp.test.ts holds the list).
|
|
16
|
+
*/
|
|
11
17
|
annotations: {
|
|
12
18
|
title?: string;
|
|
13
19
|
readOnlyHint?: boolean;
|
|
@@ -17,5 +23,47 @@ export interface OperationDef {
|
|
|
17
23
|
};
|
|
18
24
|
/** JSON Schema of the successful (2xx) response body, for the OpenAPI document; not sent to MCP clients. */
|
|
19
25
|
responseSchema?: Record<string, unknown>;
|
|
26
|
+
/**
|
|
27
|
+
* Secrets in the call: the argument names and result keys never recorded (the change feed's
|
|
28
|
+
* `tool_call` events, which the store backup commits). `redactToolCall` (redact.ts) applies it.
|
|
29
|
+
*/
|
|
30
|
+
sensitive?: {
|
|
31
|
+
args?: string[];
|
|
32
|
+
result?: string[];
|
|
33
|
+
};
|
|
20
34
|
}
|
|
21
35
|
export declare const OPERATIONS: OperationDef[];
|
|
36
|
+
/**
|
|
37
|
+
* The kinds of operation, as the docs' reference groups them (one page each,
|
|
38
|
+
* `reference/operations/<kind>`), like the statement kinds of a SQL reference.
|
|
39
|
+
*/
|
|
40
|
+
export declare const OPERATION_KINDS: {
|
|
41
|
+
readonly schema: {
|
|
42
|
+
readonly title: "Schema operations (DDL)";
|
|
43
|
+
readonly label: "Schema (DDL)";
|
|
44
|
+
readonly description: "Operations that define the database: tables, columns, constraints, bases and views.";
|
|
45
|
+
};
|
|
46
|
+
readonly rows: {
|
|
47
|
+
readonly title: "Row operations (DML)";
|
|
48
|
+
readonly label: "Rows (DML)";
|
|
49
|
+
readonly description: "Operations that write rows: insert, update, merge, delete, move, adopt and batch.";
|
|
50
|
+
};
|
|
51
|
+
readonly queries: {
|
|
52
|
+
readonly title: "Query operations";
|
|
53
|
+
readonly label: "Queries";
|
|
54
|
+
readonly description: "Operations that read rows and notes: select_rows, link targets, text and semantic search, the link graph.";
|
|
55
|
+
};
|
|
56
|
+
readonly history: {
|
|
57
|
+
readonly title: "History operations";
|
|
58
|
+
readonly label: "History";
|
|
59
|
+
readonly description: "Operations on the journal, a table's versions, the change feed and webhooks: undo, time travel, restore and vacuum.";
|
|
60
|
+
};
|
|
61
|
+
readonly auxiliary: {
|
|
62
|
+
readonly title: "Auxiliary operations";
|
|
63
|
+
readonly label: "Auxiliary";
|
|
64
|
+
readonly description: "Operations that describe and check the database, configure it and maintain its indexes.";
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export type OperationKind = keyof typeof OPERATION_KINDS;
|
|
68
|
+
/** The kind of every operation of {@link OPERATIONS} (tests/operation-kinds.test.ts: each has exactly one). */
|
|
69
|
+
export declare const OPERATION_KIND: Readonly<Record<string, OperationKind>>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The command line options of the `datanotes` commands: `--name value` or `--name=value` for an
|
|
3
|
+
* option with a value, `--name` for a flag. An option the command does not know is refused with
|
|
4
|
+
* the closest one, so a typo never runs a command with its defaults.
|
|
5
|
+
*/
|
|
6
|
+
export interface OptionSpec {
|
|
7
|
+
/** Options that take a value. */
|
|
8
|
+
values?: readonly string[];
|
|
9
|
+
/** Options that take none. */
|
|
10
|
+
flags?: readonly string[];
|
|
11
|
+
}
|
|
12
|
+
/** A command line the command cannot run: what is wrong, and how to write it. */
|
|
13
|
+
export declare class CliOptionError extends Error {
|
|
14
|
+
readonly hint: string;
|
|
15
|
+
readonly name = "CliOptionError";
|
|
16
|
+
/** Every command and its options. */
|
|
17
|
+
readonly docs = "https://datanotes.dev/reference/cli.md";
|
|
18
|
+
constructor(message: string, hint: string);
|
|
19
|
+
}
|
|
20
|
+
export interface Options {
|
|
21
|
+
/** The value of an option, when given. */
|
|
22
|
+
get(name: string): string | undefined;
|
|
23
|
+
/** Was a flag given? */
|
|
24
|
+
has(name: string): boolean;
|
|
25
|
+
}
|
|
26
|
+
/** Read `argv` against what `command` takes; throws {@link CliOptionError} on anything else. */
|
|
27
|
+
export declare function readOptions(argv: readonly string[], spec: OptionSpec, command: string): Options;
|
|
28
|
+
/** The folder a command works on, and how to read it. */
|
|
29
|
+
export interface FolderArg {
|
|
30
|
+
folder: string;
|
|
31
|
+
/** `--database`: the folder is the database (metastore.yaml at its root); else a vault holding it. */
|
|
32
|
+
atRoot: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The folder of `--database` (the folder is the database) or `--vault` (a vault holding the
|
|
36
|
+
* database in a subfolder), else DATANOTES_DATABASE or DATANOTES_VAULT: one of the two, never
|
|
37
|
+
* both. Null when none is given and the command can do without (`required` false).
|
|
38
|
+
*/
|
|
39
|
+
export declare function folderArg(o: Options, env: Record<string, string | undefined>, command: string, required?: boolean): FolderArg | null;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The command line options of the `datanotes` commands: `--name value` or `--name=value` for an
|
|
3
|
+
* option with a value, `--name` for a flag. An option the command does not know is refused with
|
|
4
|
+
* the closest one, so a typo never runs a command with its defaults.
|
|
5
|
+
*/
|
|
6
|
+
export interface OptionSpec {
|
|
7
|
+
/** Options that take a value. */
|
|
8
|
+
values?: readonly string[];
|
|
9
|
+
/** Options that take none. */
|
|
10
|
+
flags?: readonly string[];
|
|
11
|
+
}
|
|
12
|
+
/** A command line the command cannot run: what is wrong, and how to write it. */
|
|
13
|
+
export declare class CliOptionError extends Error {
|
|
14
|
+
readonly hint: string;
|
|
15
|
+
readonly name = "CliOptionError";
|
|
16
|
+
/** Every command and its options. */
|
|
17
|
+
readonly docs = "https://datanotes.dev/reference/cli.md";
|
|
18
|
+
constructor(message: string, hint: string);
|
|
19
|
+
}
|
|
20
|
+
export interface Options {
|
|
21
|
+
/** The value of an option, when given. */
|
|
22
|
+
get(name: string): string | undefined;
|
|
23
|
+
/** Was a flag given? */
|
|
24
|
+
has(name: string): boolean;
|
|
25
|
+
}
|
|
26
|
+
/** Read `argv` against what `command` takes; throws {@link CliOptionError} on anything else. */
|
|
27
|
+
export declare function readOptions(argv: readonly string[], spec: OptionSpec, command: string): Options;
|
|
28
|
+
/** The folder a command works on, and how to read it. */
|
|
29
|
+
export interface FolderArg {
|
|
30
|
+
folder: string;
|
|
31
|
+
/** `--database`: the folder is the database (metastore.yaml at its root); else a vault holding it. */
|
|
32
|
+
atRoot: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The folder of `--database` (the folder is the database) or `--vault` (a vault holding the
|
|
36
|
+
* database in a subfolder), else DATANOTES_DATABASE or DATANOTES_VAULT: one of the two, never
|
|
37
|
+
* both. Null when none is given and the command can do without (`required` false).
|
|
38
|
+
*/
|
|
39
|
+
export declare function folderArg(o: Options, env: Record<string, string | undefined>, command: string, required?: boolean): FolderArg | null;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A client of the Datanotes HTTP API, with no dependency: it runs in Node, in browsers and in
|
|
3
|
+
* Obsidian (pass Obsidian's `requestUrl` as the transport). `call` runs an operation of the
|
|
4
|
+
* catalogue by name, the way agents name them; `request` reaches any route.
|
|
5
|
+
*/
|
|
6
|
+
import { type OperationResult } from "./results.cjs";
|
|
7
|
+
import { type Guidance } from "./guidance.cjs";
|
|
8
|
+
export interface HttpRequest {
|
|
9
|
+
url: string;
|
|
10
|
+
method: "GET" | "POST";
|
|
11
|
+
headers: Record<string, string>;
|
|
12
|
+
body?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface HttpResponse {
|
|
15
|
+
status: number;
|
|
16
|
+
text: string;
|
|
17
|
+
}
|
|
18
|
+
export type Transport = (req: HttpRequest) => Promise<HttpResponse>;
|
|
19
|
+
/** Who is calling, recorded with every write (header `X-Datanotes-Actor`). Self-reported. */
|
|
20
|
+
export interface ActorInfo {
|
|
21
|
+
/** The program: "claude-code", "cursor", a program's own name. */
|
|
22
|
+
harness?: string;
|
|
23
|
+
harness_version?: string;
|
|
24
|
+
model?: string;
|
|
25
|
+
/** The agent's session (the engine remembers the model an MCP server reports for it). */
|
|
26
|
+
session?: string;
|
|
27
|
+
/** The tool the agent called, when the call comes from an MCP server. */
|
|
28
|
+
tool?: string;
|
|
29
|
+
}
|
|
30
|
+
export declare const ACTOR_HEADER = "X-Datanotes-Actor";
|
|
31
|
+
export declare class DatanotesError extends Error {
|
|
32
|
+
readonly kind: "unreachable" | "auth" | "http";
|
|
33
|
+
readonly status: number;
|
|
34
|
+
readonly name = "DatanotesError";
|
|
35
|
+
/** How to fix it, and where to read more (also at the end of the message). */
|
|
36
|
+
readonly hint?: string;
|
|
37
|
+
readonly docs?: string;
|
|
38
|
+
/** `unreachable`: the engine did not answer; `auth`: the token was refused. */
|
|
39
|
+
constructor(message: string, kind?: "unreachable" | "auth" | "http", status?: number, guidance?: Guidance | null);
|
|
40
|
+
}
|
|
41
|
+
export interface ClientOptions {
|
|
42
|
+
/** The engine's address, e.g. `http://127.0.0.1:27150`. */
|
|
43
|
+
url: string;
|
|
44
|
+
token: string;
|
|
45
|
+
/** Recorded with every write unless a call names another actor. */
|
|
46
|
+
actor?: ActorInfo;
|
|
47
|
+
transport?: Transport;
|
|
48
|
+
}
|
|
49
|
+
/** One tool call by an agent (an engine operation, or a tool of the MCP server's own), for the engine's change feed. */
|
|
50
|
+
export interface ToolCallRecord {
|
|
51
|
+
tool: string;
|
|
52
|
+
args: Record<string, unknown>;
|
|
53
|
+
ok: boolean;
|
|
54
|
+
duration_ms: number;
|
|
55
|
+
value: unknown;
|
|
56
|
+
/** Who served it: "engine", or the name of the MCP server whose own tool it is. */
|
|
57
|
+
served_by: string;
|
|
58
|
+
session?: string;
|
|
59
|
+
result_chars?: number;
|
|
60
|
+
result_tokens?: number;
|
|
61
|
+
}
|
|
62
|
+
export declare const fetchTransport: Transport;
|
|
63
|
+
export declare class DatanotesClient {
|
|
64
|
+
private readonly o;
|
|
65
|
+
readonly url: string;
|
|
66
|
+
private readonly send;
|
|
67
|
+
constructor(o: ClientOptions);
|
|
68
|
+
/** Send a request; the answer's status, its JSON (when it is JSON) and its text. */
|
|
69
|
+
request(method: "GET" | "POST", path: string, body?: unknown, opts?: {
|
|
70
|
+
actor?: ActorInfo;
|
|
71
|
+
accept?: string;
|
|
72
|
+
}): Promise<{
|
|
73
|
+
status: number;
|
|
74
|
+
json: unknown;
|
|
75
|
+
text: string;
|
|
76
|
+
}>;
|
|
77
|
+
/** `POST /datanotes/<route>` and its JSON answer; throws on an error status. */
|
|
78
|
+
post<T = unknown>(route: string, body?: unknown, actor?: ActorInfo): Promise<T>;
|
|
79
|
+
/**
|
|
80
|
+
* Run an operation of the catalogue (`select_rows`, `insert_row`, …) with an agent's arguments.
|
|
81
|
+
* Arguments the operation does not take, or of the wrong type, are refused before anything is sent,
|
|
82
|
+
* with the same message the engine gives.
|
|
83
|
+
*/
|
|
84
|
+
call(name: string, args?: Record<string, unknown>, actor?: ActorInfo): Promise<OperationResult>;
|
|
85
|
+
/** True when the engine answers `GET /` (no token needed). */
|
|
86
|
+
ping(): Promise<boolean>;
|
|
87
|
+
/** Record an agent's tool call in the change feed (what MCP servers report). */
|
|
88
|
+
recordToolCall(call: ToolCallRecord, actor?: ActorInfo): Promise<void>;
|
|
89
|
+
}
|
package/dist/api/client.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Obsidian (pass Obsidian's `requestUrl` as the transport). `call` runs an operation of the
|
|
4
4
|
* catalogue by name, the way agents name them; `request` reaches any route.
|
|
5
5
|
*/
|
|
6
|
-
import { type OperationResult } from "./results";
|
|
7
|
-
import type
|
|
6
|
+
import { type OperationResult } from "./results.js";
|
|
7
|
+
import { type Guidance } from "./guidance.js";
|
|
8
8
|
export interface HttpRequest {
|
|
9
9
|
url: string;
|
|
10
10
|
method: "GET" | "POST";
|
|
@@ -18,11 +18,11 @@ export interface HttpResponse {
|
|
|
18
18
|
export type Transport = (req: HttpRequest) => Promise<HttpResponse>;
|
|
19
19
|
/** Who is calling, recorded with every write (header `X-Datanotes-Actor`). Self-reported. */
|
|
20
20
|
export interface ActorInfo {
|
|
21
|
-
/** The program: "claude-code", "cursor",
|
|
21
|
+
/** The program: "claude-code", "cursor", a program's own name. */
|
|
22
22
|
harness?: string;
|
|
23
23
|
harness_version?: string;
|
|
24
24
|
model?: string;
|
|
25
|
-
/** The agent's session (the engine remembers the model an
|
|
25
|
+
/** The agent's session (the engine remembers the model an MCP server reports for it). */
|
|
26
26
|
session?: string;
|
|
27
27
|
/** The tool the agent called, when the call comes from an MCP server. */
|
|
28
28
|
tool?: string;
|
|
@@ -32,8 +32,11 @@ export declare class DatanotesError extends Error {
|
|
|
32
32
|
readonly kind: "unreachable" | "auth" | "http";
|
|
33
33
|
readonly status: number;
|
|
34
34
|
readonly name = "DatanotesError";
|
|
35
|
+
/** How to fix it, and where to read more (also at the end of the message). */
|
|
36
|
+
readonly hint?: string;
|
|
37
|
+
readonly docs?: string;
|
|
35
38
|
/** `unreachable`: the engine did not answer; `auth`: the token was refused. */
|
|
36
|
-
constructor(message: string, kind?: "unreachable" | "auth" | "http", status?: number);
|
|
39
|
+
constructor(message: string, kind?: "unreachable" | "auth" | "http", status?: number, guidance?: Guidance | null);
|
|
37
40
|
}
|
|
38
41
|
export interface ClientOptions {
|
|
39
42
|
/** The engine's address, e.g. `http://127.0.0.1:27150`. */
|
|
@@ -43,23 +46,18 @@ export interface ClientOptions {
|
|
|
43
46
|
actor?: ActorInfo;
|
|
44
47
|
transport?: Transport;
|
|
45
48
|
}
|
|
46
|
-
/**
|
|
47
|
-
export interface AppTool extends Omit<OperationDef, "annotations"> {
|
|
48
|
-
annotations?: OperationDef["annotations"];
|
|
49
|
-
app: string;
|
|
50
|
-
}
|
|
51
|
-
/** One call of an operation or an app tool by an agent, for the engine's change feed. */
|
|
49
|
+
/** One tool call by an agent (an engine operation, or a tool of the MCP server's own), for the engine's change feed. */
|
|
52
50
|
export interface ToolCallRecord {
|
|
53
51
|
tool: string;
|
|
54
52
|
args: Record<string, unknown>;
|
|
55
53
|
ok: boolean;
|
|
56
|
-
|
|
54
|
+
duration_ms: number;
|
|
57
55
|
value: unknown;
|
|
58
|
-
/** Who served it: "engine" or the
|
|
59
|
-
|
|
56
|
+
/** Who served it: "engine", or the name of the MCP server whose own tool it is. */
|
|
57
|
+
served_by: string;
|
|
60
58
|
session?: string;
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
result_chars?: number;
|
|
60
|
+
result_tokens?: number;
|
|
63
61
|
}
|
|
64
62
|
export declare const fetchTransport: Transport;
|
|
65
63
|
export declare class DatanotesClient {
|
|
@@ -78,23 +76,14 @@ export declare class DatanotesClient {
|
|
|
78
76
|
}>;
|
|
79
77
|
/** `POST /datanotes/<route>` and its JSON answer; throws on an error status. */
|
|
80
78
|
post<T = unknown>(route: string, body?: unknown, actor?: ActorInfo): Promise<T>;
|
|
81
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* Run an operation of the catalogue (`select_rows`, `insert_row`, …) with an agent's arguments.
|
|
81
|
+
* Arguments the operation does not take, or of the wrong type, are refused before anything is sent,
|
|
82
|
+
* with the same message the engine gives.
|
|
83
|
+
*/
|
|
82
84
|
call(name: string, args?: Record<string, unknown>, actor?: ActorInfo): Promise<OperationResult>;
|
|
83
|
-
/** Run an operation of the engine, or else a registered app's tool of that name. */
|
|
84
|
-
invoke(name: string, args?: Record<string, unknown>, actor?: ActorInfo): Promise<OperationResult & {
|
|
85
|
-
servedBy: string;
|
|
86
|
-
}>;
|
|
87
85
|
/** True when the engine answers `GET /` (no token needed). */
|
|
88
86
|
ping(): Promise<boolean>;
|
|
89
|
-
/** The tools of the registered apps and the apps' instructions for agents. */
|
|
90
|
-
appTools(): Promise<{
|
|
91
|
-
tools: AppTool[];
|
|
92
|
-
instructions: string;
|
|
93
|
-
}>;
|
|
94
|
-
/** Call an app's tool through the engine (which holds the app's credentials). */
|
|
95
|
-
callAppTool(name: string, args: Record<string, unknown>, actor?: ActorInfo): Promise<OperationResult & {
|
|
96
|
-
servedBy: string;
|
|
97
|
-
}>;
|
|
98
87
|
/** Record an agent's tool call in the change feed (what MCP servers report). */
|
|
99
88
|
recordToolCall(call: ToolCallRecord, actor?: ActorInfo): Promise<void>;
|
|
100
89
|
}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The documentation of this version of Datanotes, read offline: every page of datanotes.dev as
|
|
3
|
+
* Markdown, shipped in the npm package as `dist/docs/` (scripts/copy-docs.mjs copies them there
|
|
4
|
+
* after the docs build). The MCP server `datanotes mcp` serves it to agents as three tools
|
|
5
|
+
* (`list_docs`, `read_docs`, `search_docs`: src/api/mcp.ts), the engine to programs as
|
|
6
|
+
* `GET /datanotes/manual/<page>.md` (src/server/http-server.ts). They are not engine operations:
|
|
7
|
+
* nothing is journaled and no engine is needed.
|
|
8
|
+
*
|
|
9
|
+
* A page is named by its path on the site without `.md` (`guides/read-and-write/read-and-filter`), a section by the
|
|
10
|
+
* anchor of its heading (`guides/read-and-write/read-and-filter#compare-values-with-operators`), as on the site; the
|
|
11
|
+
* site's own addresses (`https://datanotes.dev/guides/read-and-write/read-and-filter/#…`) are read too. Every mistake
|
|
12
|
+
* says what is wrong, the closest real page or section, and how to list them (the hint standard
|
|
13
|
+
* of src/api/guidance.ts).
|
|
14
|
+
*/
|
|
15
|
+
import { type Guidance } from "./guidance.cjs";
|
|
16
|
+
/** An environment variable that names the folder of the docs instead of the package's own. */
|
|
17
|
+
export declare const DOCS_DIR_ENV = "DATANOTES_DOCS_DIR";
|
|
18
|
+
/** The most characters read_docs returns at once: about 5 000 tokens. */
|
|
19
|
+
export declare const READ_DOCS_MAX = 20000;
|
|
20
|
+
/** The page for agents on reading the docs offline. */
|
|
21
|
+
export declare const OFFLINE_DOCS = "https://datanotes.dev/guides/agents/docs-offline.md#the-agent-reads-the-docs-of-its-version";
|
|
22
|
+
/** A mistake in reading the docs: what is wrong, how to fix it, where to read more. */
|
|
23
|
+
export declare class DocsError extends Error {
|
|
24
|
+
readonly hint: string;
|
|
25
|
+
readonly docs: string;
|
|
26
|
+
/** `missing`: the docs are not in this installation; `not_found`: no such page or section; `bad_input`: wrong arguments. */
|
|
27
|
+
readonly code: "missing" | "not_found" | "bad_input";
|
|
28
|
+
constructor(message: string, g: Guidance, code: DocsError["code"]);
|
|
29
|
+
}
|
|
30
|
+
/** A page of the docs. */
|
|
31
|
+
export interface DocsPage {
|
|
32
|
+
/** Its path on the site, without `.md`: `guides/read-and-write/read-and-filter` (the home page is `index`). */
|
|
33
|
+
path: string;
|
|
34
|
+
title: string;
|
|
35
|
+
description: string;
|
|
36
|
+
}
|
|
37
|
+
/** How a section matched a search: by its words (BM25), or by its meaning (the engine's vector index of the docs). */
|
|
38
|
+
export type DocsSignal = "keyword" | "semantic";
|
|
39
|
+
/** A section of a page that matches a search. */
|
|
40
|
+
export interface DocsHit {
|
|
41
|
+
/** What read_docs reads: `guides/read-and-write/read-and-filter#compare-values-with-operators` (the page alone for its introduction). */
|
|
42
|
+
path: string;
|
|
43
|
+
page: string;
|
|
44
|
+
section: string;
|
|
45
|
+
excerpt: string;
|
|
46
|
+
/** BM25 for a keyword search; the Reciprocal Rank Fusion score for a hybrid one. */
|
|
47
|
+
score: number;
|
|
48
|
+
/** The rankings the section is in: `keyword` alone without semantic search. */
|
|
49
|
+
signals: DocsSignal[];
|
|
50
|
+
}
|
|
51
|
+
/** A section as search_docs ranks it, with the text the engine embeds for semantic search. */
|
|
52
|
+
export interface DocsSection {
|
|
53
|
+
/** What read_docs reads, as in {@link DocsHit}. */
|
|
54
|
+
path: string;
|
|
55
|
+
page: string;
|
|
56
|
+
section: string;
|
|
57
|
+
/** The page's title and the heading, then the section's own prose, then its code. */
|
|
58
|
+
text: string;
|
|
59
|
+
}
|
|
60
|
+
interface Section {
|
|
61
|
+
anchor: string;
|
|
62
|
+
title: string;
|
|
63
|
+
level: number;
|
|
64
|
+
/** Where its heading starts, where it ends with its subsections, and where its own text ends. */
|
|
65
|
+
start: number;
|
|
66
|
+
end: number;
|
|
67
|
+
ownEnd: number;
|
|
68
|
+
}
|
|
69
|
+
interface Page extends DocsPage {
|
|
70
|
+
text: string;
|
|
71
|
+
sections: Section[];
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The folder of the docs: `DATANOTES_DOCS_DIR` when set, else the package's `dist/docs` (next to
|
|
75
|
+
* `dist/datanotes.cjs`, above `dist/api/`, or in a checkout where the docs were built). Null when
|
|
76
|
+
* there is none.
|
|
77
|
+
*/
|
|
78
|
+
export declare function findDocsDir(env?: Record<string, string | undefined>, from?: string): string | null;
|
|
79
|
+
/** A heading's anchor as the site makes it (github-slugger): lowercase, punctuation dropped, spaces as dashes. */
|
|
80
|
+
export declare function slug(heading: string): string;
|
|
81
|
+
/** A page or section as given (`guides/read-and-write/read-and-filter.md`, `/guides/read-and-write/read-and-filter/#x`, a datanotes.dev address): the page's path and the anchor. */
|
|
82
|
+
export declare function docsRef(input: string): {
|
|
83
|
+
page: string;
|
|
84
|
+
anchor: string | null;
|
|
85
|
+
};
|
|
86
|
+
/** Common English words left out of queries and texts: they say nothing of the topic. */
|
|
87
|
+
export declare const STOP_WORDS: ReadonlySet<string>;
|
|
88
|
+
/**
|
|
89
|
+
* The stem of a lowercase word: plurals and verb endings stripped, so that the forms of a word meet
|
|
90
|
+
* (`tables`/`table`, `queries`/`query`, `renamed`/`renaming`/`rename`, `dropped`/`drop`,
|
|
91
|
+
* `rated`/`rate`, `using`/`use`). Not a dictionary form (`create` is `creat`), only the same for
|
|
92
|
+
* every form. Words of three letters or less, and words with digits, stay as they are.
|
|
93
|
+
*/
|
|
94
|
+
export declare function stem(word: string): string;
|
|
95
|
+
/** The search terms of a text: folded words, without one-letter and common words, stemmed. */
|
|
96
|
+
export declare function tokenize(text: string): string[];
|
|
97
|
+
/**
|
|
98
|
+
* Words that mean the same thing in these docs, for queries: a word of the query also matches the
|
|
99
|
+
* others of its group, with SYNONYM_WEIGHT. An entry can be a phrase ("roll back"), which matches
|
|
100
|
+
* where its words follow each other, in the query and in the docs.
|
|
101
|
+
*/
|
|
102
|
+
export declare const SEARCH_SYNONYMS: readonly (readonly string[])[];
|
|
103
|
+
/** How much a synonym counts against the word itself. */
|
|
104
|
+
export declare const SYNONYM_WEIGHT = 0.7;
|
|
105
|
+
/** A term of a query: the word (or synonym phrase) as stems, and every way it matches, itself first. */
|
|
106
|
+
export interface QueryTerm {
|
|
107
|
+
term: string;
|
|
108
|
+
alternatives: {
|
|
109
|
+
stems: string[];
|
|
110
|
+
weight: number;
|
|
111
|
+
}[];
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* The terms of a query, each with its synonyms. A synonym phrase written in the query ("roll
|
|
115
|
+
* back", "time travel") is one term; a term repeated in the query counts once.
|
|
116
|
+
*/
|
|
117
|
+
export declare function queryTerms(query: string): QueryTerm[];
|
|
118
|
+
/** A query of search_docs as written: the words to rank by, and the words a section must hold or must not. */
|
|
119
|
+
export interface DocsQuery {
|
|
120
|
+
/** The words to rank by, the syntax taken out: `"time travel" +view -sql` ranks by `time travel view`. */
|
|
121
|
+
text: string;
|
|
122
|
+
/** Quoted phrases and +terms, as stems: each must appear in a section (its words in a row, in any form). */
|
|
123
|
+
required: string[][];
|
|
124
|
+
/** -terms and -"phrases", as stems: a section that holds one is left out. */
|
|
125
|
+
excluded: string[][];
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Read the syntax of a search_docs query: `"a phrase"` and `+term` must appear in a section,
|
|
129
|
+
* `-term` (or `-"a phrase"`) must not, every other word ranks only. Curly quotes count as straight
|
|
130
|
+
* ones, a quote left open runs to the end, and a word that starts with two dashes (`--vault`) is a
|
|
131
|
+
* word. Words that say nothing (`+the`) require nothing.
|
|
132
|
+
*/
|
|
133
|
+
export declare function parseQuery(query: string): DocsQuery;
|
|
134
|
+
/** The docs in a folder (null: there are none, and every call says how to get them). */
|
|
135
|
+
export declare class DocsLibrary {
|
|
136
|
+
readonly dir: string | null;
|
|
137
|
+
private loaded;
|
|
138
|
+
private index;
|
|
139
|
+
private hash;
|
|
140
|
+
private sectionList;
|
|
141
|
+
constructor(dir: string | null);
|
|
142
|
+
private missing;
|
|
143
|
+
private all;
|
|
144
|
+
/** The pages, sorted by path; only those under `prefix` (`guides/`) when it is given. */
|
|
145
|
+
list(prefix?: string): DocsPage[];
|
|
146
|
+
private page;
|
|
147
|
+
private section;
|
|
148
|
+
/**
|
|
149
|
+
* The Markdown of a page (`guides/read-and-write/read-and-filter`) or of one section (`guides/read-and-write/read-and-filter#anchor`, or
|
|
150
|
+
* `section`), with its subsections. Without a cap, the whole text.
|
|
151
|
+
*/
|
|
152
|
+
text(ref: string, section?: string | null): {
|
|
153
|
+
ref: string;
|
|
154
|
+
text: string;
|
|
155
|
+
page: Page;
|
|
156
|
+
from: number;
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* What read_docs returns: the page or section from `offset`, at most `max` characters, cut at the
|
|
160
|
+
* end of a line, then a note on how to read the rest (the sections that follow, or the offset).
|
|
161
|
+
*/
|
|
162
|
+
read(ref: string, opts?: {
|
|
163
|
+
section?: string | null;
|
|
164
|
+
offset?: number;
|
|
165
|
+
max?: number;
|
|
166
|
+
}): string;
|
|
167
|
+
private searchIndex;
|
|
168
|
+
/** The terms of a query to rank by; a query with none is refused. */
|
|
169
|
+
private termsOf;
|
|
170
|
+
/**
|
|
171
|
+
* The units ranked by BM25 for the query's words, best first, without those the required and
|
|
172
|
+
* excluded words leave out. Each term of the query (a word in any form, or one of its synonyms)
|
|
173
|
+
* scores by BM25 in a section's text, and more in its heading and its page's title; rare terms
|
|
174
|
+
* count more than common ones; a heading with every term, and terms next to each other as in
|
|
175
|
+
* the query, add to it; a section with every term ranks above one with some.
|
|
176
|
+
*/
|
|
177
|
+
private ranked;
|
|
178
|
+
/**
|
|
179
|
+
* The sections that best match `query`, best first, by their words (BM25: {@link ranked}). A
|
|
180
|
+
* quoted phrase or a +term must appear in a section, a -term must not (parseQuery).
|
|
181
|
+
*/
|
|
182
|
+
search(query: string, limit?: number): DocsHit[];
|
|
183
|
+
/**
|
|
184
|
+
* Hybrid search: the ranking of {@link search} by words, and `semantic`, the sections ranked by
|
|
185
|
+
* meaning (the engine's vector index of these docs, best first), fused by Reciprocal Rank
|
|
186
|
+
* Fusion: a section scores the sum of 1 / (RRF_K + its rank) over the rankings it is in, among
|
|
187
|
+
* the first FUSION_DEPTH of each. The required and excluded words filter both rankings, and a
|
|
188
|
+
* section these docs do not have is left out. Each hit says which rankings it is in (`signals`).
|
|
189
|
+
*/
|
|
190
|
+
hybrid(query: string, semantic: readonly {
|
|
191
|
+
path: string;
|
|
192
|
+
}[], limit?: number): DocsHit[];
|
|
193
|
+
/**
|
|
194
|
+
* Every section as search_docs ranks them (a page's introduction too), with the text to embed
|
|
195
|
+
* for semantic search: the page's title and the heading, the prose, then the code.
|
|
196
|
+
*/
|
|
197
|
+
sections(): readonly DocsSection[];
|
|
198
|
+
/**
|
|
199
|
+
* The version of these docs: a hash of their sections (paths and texts). The engine's vector
|
|
200
|
+
* index of the docs is rebuilt when it changes, and search_docs fuses its ranking only when the
|
|
201
|
+
* engine's docs have the same version as its own.
|
|
202
|
+
*/
|
|
203
|
+
version(): string;
|
|
204
|
+
}
|
|
205
|
+
/** The constant of Reciprocal Rank Fusion: 60, the value of its paper (Cormack et al., 2009) and of most search engines; it keeps the first ranks from outweighing agreement between the rankings. */
|
|
206
|
+
export declare const RRF_K = 60;
|
|
207
|
+
/** How many sections of each ranking hybrid search fuses. */
|
|
208
|
+
export declare const FUSION_DEPTH = 50;
|
|
209
|
+
/** The docs of a folder (default: `findDocsDir()`), loaded once per folder. */
|
|
210
|
+
export declare function openDocs(dir?: string | null): DocsLibrary;
|
|
211
|
+
export {};
|