datanotes 3.2.0 → 3.3.1
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 +1 -0
- package/SECURITY.md +12 -0
- package/dist/api/client.d.cts +2 -0
- package/dist/api/client.d.ts +2 -0
- package/dist/api/docs.d.cts +14 -4
- package/dist/api/docs.d.ts +14 -4
- package/dist/api/extension-files.d.cts +23 -0
- package/dist/api/extension-files.d.ts +23 -0
- package/dist/api/extension-host.d.cts +108 -0
- package/dist/api/extension-host.d.ts +108 -0
- package/dist/api/extension-manifest.d.cts +154 -0
- package/dist/api/extension-manifest.d.ts +154 -0
- package/dist/api/extension-plan.d.cts +174 -0
- package/dist/api/extension-plan.d.ts +174 -0
- package/dist/api/extension-record.d.cts +65 -0
- package/dist/api/extension-record.d.ts +65 -0
- package/dist/api/extension-sdk.d.cts +65 -0
- package/dist/api/extension-sdk.d.ts +65 -0
- package/dist/api/extensions.cjs +19660 -0
- package/dist/api/extensions.d.cts +11 -0
- package/dist/api/extensions.d.ts +11 -0
- package/dist/api/extensions.js +19597 -0
- package/dist/api/index.cjs +1568 -375
- package/dist/api/index.js +1568 -375
- package/dist/api/mcp.cjs +1238 -27
- package/dist/api/mcp.js +1238 -27
- package/dist/datanotes.cjs +8365 -4335
- package/dist/docs/administration/extensions.md +213 -0
- package/dist/docs/api/operations/alter_table.md +4 -3
- package/dist/docs/api/operations/extensions_delete.md +29 -0
- package/dist/docs/api/operations/extensions_list.md +20 -0
- package/dist/docs/api/operations/extensions_record.md +44 -0
- package/dist/docs/api/operations/tags/extensions.md +9 -0
- package/dist/docs/api.md +9 -1
- package/dist/docs/develop/write-an-extension.md +369 -0
- package/dist/docs/guides/data-quality/check-constraints.md +10 -10
- package/dist/docs/guides/data-quality/hand-edits.md +8 -8
- package/dist/docs/guides/database-objects/bases.md +11 -11
- package/dist/docs/guides/database-objects/catalogs-and-schemas.md +30 -10
- package/dist/docs/guides/database-objects/columns.md +38 -38
- package/dist/docs/guides/database-objects/relations.md +28 -28
- package/dist/docs/guides/database-objects/tables.md +167 -43
- package/dist/docs/guides/database-objects/views.md +44 -44
- package/dist/docs/guides/history/change-data-feed.md +34 -34
- package/dist/docs/guides/history/journal-and-undo.md +12 -12
- package/dist/docs/guides/history/restore.md +20 -20
- package/dist/docs/guides/history/table-history.md +31 -31
- package/dist/docs/guides/read-and-write/automatic-links.md +15 -15
- package/dist/docs/guides/read-and-write/import-notes.md +20 -20
- package/dist/docs/guides/read-and-write/joins-and-aggregates.md +7 -7
- package/dist/docs/guides/read-and-write/read-and-filter.md +10 -10
- package/dist/docs/guides/read-and-write/write-rows.md +10 -10
- package/dist/docs/guides/search/text.md +1 -1
- package/dist/docs/guides/security/security-model.md +12 -0
- package/dist/docs/reference/cli.md +32 -1
- package/dist/docs/reference/glossary.md +8 -0
- package/dist/docs/reference/operations/auxiliary.md +1 -1
- package/dist/docs/reference/operations/rows.md +1 -1
- package/dist/docs/reference/operations/schema.md +3 -3
- package/dist/docs/reference/operations.md +4 -4
- package/dist/docs/release-notes.md +49 -0
- package/dist/docs/start/connect-agents.md +11 -0
- package/package.json +11 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The module API of Datanotes extensions, version 1 (`"api": 1` in datanotes-extension.json): what an
|
|
3
|
+
* extension's entry file exports and what its tool handlers get. The MCP server that loads the extension
|
|
4
|
+
* (`datanotes mcp`, DatanotesOS) builds the context; the extension never sees a token.
|
|
5
|
+
*/
|
|
6
|
+
/** The version of this module API: an entry file exports `api: 1`. */
|
|
7
|
+
export declare const EXTENSION_API_VERSION = 1;
|
|
8
|
+
/** The agent that called a tool, as its MCP server knows it. */
|
|
9
|
+
export interface ExtensionActor {
|
|
10
|
+
/** The MCP session (16 characters). */
|
|
11
|
+
session?: string;
|
|
12
|
+
/** The app running the agent ("claude-code"). */
|
|
13
|
+
harness?: string;
|
|
14
|
+
harness_version?: string;
|
|
15
|
+
/** The model id, when the agent named it (DatanotesOS start_session). */
|
|
16
|
+
model?: string;
|
|
17
|
+
}
|
|
18
|
+
/** What an engine operation answered: `ok` and the answer, or the refusal's text (with its Hint and Docs lines). */
|
|
19
|
+
export interface ExtensionCallResult {
|
|
20
|
+
ok: boolean;
|
|
21
|
+
value: unknown;
|
|
22
|
+
}
|
|
23
|
+
/** What a tool handler gets. */
|
|
24
|
+
export interface ExtensionContext {
|
|
25
|
+
/** Run an engine operation (select_rows, insert_row, batch, …) with the extension's own token, on behalf of the agent. Never throws for a refusal. */
|
|
26
|
+
callTool(operation: string, args: Record<string, unknown>): Promise<ExtensionCallResult>;
|
|
27
|
+
/** The agent that called the tool. */
|
|
28
|
+
actor(): ExtensionActor;
|
|
29
|
+
/** The MCP session of the call, when there is one. */
|
|
30
|
+
readonly session?: string;
|
|
31
|
+
/** The qualified name of the table bound to a role of the manifest; throws for a role the manifest does not have. */
|
|
32
|
+
table(role: string): string;
|
|
33
|
+
/** The name, in the bound table, of a role's column: the user's mapping, else the manifest's name. */
|
|
34
|
+
column(role: string, column: string): string;
|
|
35
|
+
/** Whether the bound table has the role's column (an optional column of a table the extension depends on may be missing). */
|
|
36
|
+
hasColumn(role: string, column: string): boolean;
|
|
37
|
+
/** The database's time zone (IANA name), "" when it has none. */
|
|
38
|
+
readonly timezone: string;
|
|
39
|
+
/** A log record through the MCP server's log: a constant message, the variable parts as attributes; never argument values or tokens. */
|
|
40
|
+
log(level: "DEBUG" | "INFO" | "WARN" | "ERROR", message: string, attributes?: Record<string, string | number | boolean>): void;
|
|
41
|
+
readonly extension: {
|
|
42
|
+
readonly name: string;
|
|
43
|
+
readonly version: string;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/** A tool's handler: the agent's arguments (checked against the tool's input schema first) and the context. Its answer goes to the agent as JSON. */
|
|
47
|
+
export type ExtensionHandler = (args: Record<string, unknown>, ctx: ExtensionContext) => Promise<unknown>;
|
|
48
|
+
/** What an entry file exports as default. */
|
|
49
|
+
export interface ExtensionModule {
|
|
50
|
+
api: 1;
|
|
51
|
+
handlers: Record<string, ExtensionHandler>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A refusal the agent can fix: what is wrong, how to fix it (`hint`), and a page of the extension's docs
|
|
55
|
+
* (`docs`: "tools#start_task", read as read_docs("extensions/<name>/tools#start_task")). The host recognises
|
|
56
|
+
* it by its name, so a copy of this class bundled into the extension works too.
|
|
57
|
+
*/
|
|
58
|
+
export declare class ExtensionToolError extends Error {
|
|
59
|
+
readonly hint?: string | undefined;
|
|
60
|
+
readonly docs?: string | undefined;
|
|
61
|
+
readonly name = "ToolError";
|
|
62
|
+
constructor(message: string, hint?: string | undefined, docs?: string | undefined);
|
|
63
|
+
}
|
|
64
|
+
/** The entry file's default export, typed: `export default defineExtension({ api: 1, handlers: { … } })`. */
|
|
65
|
+
export declare function defineExtension(m: ExtensionModule): ExtensionModule;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The module API of Datanotes extensions, version 1 (`"api": 1` in datanotes-extension.json): what an
|
|
3
|
+
* extension's entry file exports and what its tool handlers get. The MCP server that loads the extension
|
|
4
|
+
* (`datanotes mcp`, DatanotesOS) builds the context; the extension never sees a token.
|
|
5
|
+
*/
|
|
6
|
+
/** The version of this module API: an entry file exports `api: 1`. */
|
|
7
|
+
export declare const EXTENSION_API_VERSION = 1;
|
|
8
|
+
/** The agent that called a tool, as its MCP server knows it. */
|
|
9
|
+
export interface ExtensionActor {
|
|
10
|
+
/** The MCP session (16 characters). */
|
|
11
|
+
session?: string;
|
|
12
|
+
/** The app running the agent ("claude-code"). */
|
|
13
|
+
harness?: string;
|
|
14
|
+
harness_version?: string;
|
|
15
|
+
/** The model id, when the agent named it (DatanotesOS start_session). */
|
|
16
|
+
model?: string;
|
|
17
|
+
}
|
|
18
|
+
/** What an engine operation answered: `ok` and the answer, or the refusal's text (with its Hint and Docs lines). */
|
|
19
|
+
export interface ExtensionCallResult {
|
|
20
|
+
ok: boolean;
|
|
21
|
+
value: unknown;
|
|
22
|
+
}
|
|
23
|
+
/** What a tool handler gets. */
|
|
24
|
+
export interface ExtensionContext {
|
|
25
|
+
/** Run an engine operation (select_rows, insert_row, batch, …) with the extension's own token, on behalf of the agent. Never throws for a refusal. */
|
|
26
|
+
callTool(operation: string, args: Record<string, unknown>): Promise<ExtensionCallResult>;
|
|
27
|
+
/** The agent that called the tool. */
|
|
28
|
+
actor(): ExtensionActor;
|
|
29
|
+
/** The MCP session of the call, when there is one. */
|
|
30
|
+
readonly session?: string;
|
|
31
|
+
/** The qualified name of the table bound to a role of the manifest; throws for a role the manifest does not have. */
|
|
32
|
+
table(role: string): string;
|
|
33
|
+
/** The name, in the bound table, of a role's column: the user's mapping, else the manifest's name. */
|
|
34
|
+
column(role: string, column: string): string;
|
|
35
|
+
/** Whether the bound table has the role's column (an optional column of a table the extension depends on may be missing). */
|
|
36
|
+
hasColumn(role: string, column: string): boolean;
|
|
37
|
+
/** The database's time zone (IANA name), "" when it has none. */
|
|
38
|
+
readonly timezone: string;
|
|
39
|
+
/** A log record through the MCP server's log: a constant message, the variable parts as attributes; never argument values or tokens. */
|
|
40
|
+
log(level: "DEBUG" | "INFO" | "WARN" | "ERROR", message: string, attributes?: Record<string, string | number | boolean>): void;
|
|
41
|
+
readonly extension: {
|
|
42
|
+
readonly name: string;
|
|
43
|
+
readonly version: string;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/** A tool's handler: the agent's arguments (checked against the tool's input schema first) and the context. Its answer goes to the agent as JSON. */
|
|
47
|
+
export type ExtensionHandler = (args: Record<string, unknown>, ctx: ExtensionContext) => Promise<unknown>;
|
|
48
|
+
/** What an entry file exports as default. */
|
|
49
|
+
export interface ExtensionModule {
|
|
50
|
+
api: 1;
|
|
51
|
+
handlers: Record<string, ExtensionHandler>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A refusal the agent can fix: what is wrong, how to fix it (`hint`), and a page of the extension's docs
|
|
55
|
+
* (`docs`: "tools#start_task", read as read_docs("extensions/<name>/tools#start_task")). The host recognises
|
|
56
|
+
* it by its name, so a copy of this class bundled into the extension works too.
|
|
57
|
+
*/
|
|
58
|
+
export declare class ExtensionToolError extends Error {
|
|
59
|
+
readonly hint?: string | undefined;
|
|
60
|
+
readonly docs?: string | undefined;
|
|
61
|
+
readonly name = "ToolError";
|
|
62
|
+
constructor(message: string, hint?: string | undefined, docs?: string | undefined);
|
|
63
|
+
}
|
|
64
|
+
/** The entry file's default export, typed: `export default defineExtension({ api: 1, handlers: { … } })`. */
|
|
65
|
+
export declare function defineExtension(m: ExtensionModule): ExtensionModule;
|