@roam-research/roam-tools-core 0.5.0 → 0.6.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 (47) hide show
  1. package/README.md +23 -8
  2. package/dist/index.d.ts +3 -7
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +8 -8
  5. package/dist/operations/blocks.d.ts +25 -20
  6. package/dist/operations/blocks.d.ts.map +1 -1
  7. package/dist/operations/blocks.js +66 -15
  8. package/dist/operations/datalog.d.ts +15 -0
  9. package/dist/operations/datalog.d.ts.map +1 -0
  10. package/dist/operations/datalog.js +16 -0
  11. package/dist/operations/files.d.ts +6 -7
  12. package/dist/operations/files.d.ts.map +1 -1
  13. package/dist/operations/files.js +18 -5
  14. package/dist/operations/navigation.d.ts +9 -10
  15. package/dist/operations/navigation.d.ts.map +1 -1
  16. package/dist/operations/navigation.js +4 -1
  17. package/dist/operations/pages.d.ts +15 -13
  18. package/dist/operations/pages.d.ts.map +1 -1
  19. package/dist/operations/pages.js +34 -10
  20. package/dist/operations/query.d.ts +10 -11
  21. package/dist/operations/query.d.ts.map +1 -1
  22. package/dist/operations/query.js +24 -6
  23. package/dist/operations/search.d.ts +7 -8
  24. package/dist/operations/search.d.ts.map +1 -1
  25. package/dist/operations/search.js +22 -6
  26. package/dist/tools.d.ts +37 -4
  27. package/dist/tools.d.ts.map +1 -1
  28. package/dist/tools.js +91 -80
  29. package/dist/types.d.ts +11 -10
  30. package/dist/types.d.ts.map +1 -1
  31. package/dist/types.js +14 -4
  32. package/package.json +7 -10
  33. package/dist/client.d.ts +0 -34
  34. package/dist/client.d.ts.map +0 -1
  35. package/dist/client.js +0 -275
  36. package/dist/connect.d.ts +0 -10
  37. package/dist/connect.d.ts.map +0 -1
  38. package/dist/connect.js +0 -477
  39. package/dist/graph-resolver.d.ts +0 -54
  40. package/dist/graph-resolver.d.ts.map +0 -1
  41. package/dist/graph-resolver.js +0 -338
  42. package/dist/operations/graphs.d.ts +0 -26
  43. package/dist/operations/graphs.d.ts.map +0 -1
  44. package/dist/operations/graphs.js +0 -214
  45. package/dist/roam-api.d.ts +0 -32
  46. package/dist/roam-api.d.ts.map +0 -1
  47. package/dist/roam-api.js +0 -50
package/README.md CHANGED
@@ -1,17 +1,32 @@
1
1
  # @roam-research/roam-tools-core
2
2
 
3
- Shared core library for Roam Research tools. Provides the Roam API client, tool definitions, graph resolution, and operations.
3
+ Transport-agnostic core for Roam Research MCP and CLI tools. Provides the tool registry, schemas, operation functions, and dispatch — but no transport.
4
4
 
5
- > **This package is not meant to be used directly.** It is an internal dependency of [`@roam-research/roam-mcp`](https://www.npmjs.com/package/@roam-research/roam-mcp) (MCP server) and [`@roam-research/roam-cli`](https://www.npmjs.com/package/@roam-research/roam-cli) (CLI). If you want to connect an AI assistant to Roam, install `@roam-research/roam-mcp`. If you want a command-line interface, install `@roam-research/roam-cli`.
5
+ > **Most users don't want this package directly.** If you want to connect an AI assistant to Roam, install [`@roam-research/roam-mcp`](https://www.npmjs.com/package/@roam-research/roam-mcp). For the command line, install [`@roam-research/roam-cli`](https://www.npmjs.com/package/@roam-research/roam-cli). Both wrap the local Roam Desktop transport ([`@roam-research/roam-tools-local`](https://www.npmjs.com/package/@roam-research/roam-tools-local)) which depends on this package.
6
+
7
+ ## Who is this for?
8
+
9
+ This package is for **hosted MCP transports** that talk to Roam through a different backend (e.g., a WorkOS-authenticated proxy) and want to reuse the same tool registry, Zod schemas, and operation functions without dragging in the local Roam Desktop client or the `~/.roam-tools.json` config reader.
6
10
 
7
11
  ## What's in here
8
12
 
9
- - **RoamClient**authenticated HTTP client for Roam's local API
10
- - **Tool definitions**Zod-validated tool schemas used by both MCP and CLI
11
- - **Operations** page, block, search, query, file, and navigation operations
12
- - **Graph resolution** config loading, graph lookup, and multi-graph support
13
- - **Types** shared TypeScript types, error codes, and schemas
13
+ - `RoamActionClient`structural client interface (`call()` + optional `getTokenInfo()`). Bring your own implementation.
14
+ - `routeToolCall(name, args, options)` central dispatcher. **Requires** `options.resolveGraph` and `options.createClient`. Optional: `tokenInfoMode`, `onTokenStatusUpdate`.
15
+ - `ToolGraph` / `ResolvedGraph` cross-transport graph identity types.
16
+ - Tool registry: `dataTools` (graph content, reusable across transports), `desktopUiTools` (file ops + window/selection — local-only), `contentTools` (the union), `tools` (alias of contentTools at this layer).
17
+ - Helpers: `defineTool`, `defineStandaloneTool`, `findTool`.
18
+ - Operations: page, block, search, query, datalog, navigation, files (all transport-agnostic — they only call `client.call(...)`).
19
+ - Types and schemas: `GraphConfigSchema`, `RoamMcpConfigSchema`, `RoamError`, `ErrorCodes`, `EXPECTED_API_VERSION`, etc.
20
+
21
+ ## What's NOT in here
22
+
23
+ - `RoamClient` — the local Roam Desktop transport, in `@roam-research/roam-tools-local`.
24
+ - `~/.roam-tools.json` reader (`getPort`, `resolveGraph`, `getMcpConfig`, etc.) — also in `@roam-research/roam-tools-local`.
25
+ - `connect` interactive setup — also in `@roam-research/roam-tools-local`.
26
+ - The `list_graphs` and `setup_new_graph` standalone tools — also local.
27
+
28
+ Hosted consumers reimplement these (or substitute their own equivalents — e.g., reading picker grants from a remote store) and inject them via `routeToolCall`'s options.
14
29
 
15
30
  ## Documentation
16
31
 
17
- See the [main repository](https://github.com/Roam-Research/roam-tools) for full documentation.
32
+ See the [main repository](https://github.com/Roam-Research/roam-tools) for full documentation, including the architecture rationale and the integration pattern.
package/dist/index.d.ts CHANGED
@@ -1,9 +1,5 @@
1
- export type { CallToolResult, TextContent, ImageContent, GraphType, AccessLevel, GraphConfig, RoamMcpConfig, ResolvedGraph, ErrorCode, RoamApiError, RoamResponse, RoamClientConfig, Block, Page, BlockLocation, WindowType, SidebarWindow, SidebarWindowInfo, FocusedBlock, SelectedBlock, MainWindowViewType, MainWindowView, SearchResultPath, SearchResult, SearchResponse, RecentlyOpenedBlock, RecentlyOpenedItem, DailyNotePagesViewItem, RecentlyEditedPage, SearchSuggestionsResponse, SearchTemplatesResponse, GetPageResponse, GetBlockResponse, Template, QueryResult, QueryResponse, TokenInfoResponse, TokenInfoResult, } from "./types.js";
1
+ export type { CallToolResult, TextContent, ImageContent, GraphType, AccessLevel, GraphConfig, RoamMcpConfig, ToolGraph, ResolvedGraph, RoamActionClient, ErrorCode, RoamApiError, RoamResponse, Block, Page, BlockLocation, WindowType, SidebarWindow, SidebarWindowInfo, FocusedBlock, SelectedBlock, MainWindowViewType, MainWindowView, SearchResultPath, SearchResult, SearchResponse, RecentlyOpenedBlock, RecentlyOpenedItem, DailyNotePagesViewItem, RecentlyEditedPage, SearchSuggestionsResponse, SearchTemplatesResponse, GetPageResponse, GetBlockResponse, Template, QueryResult, QueryResponse, TokenInfoResponse, TokenInfoResult, } from "./types.js";
2
2
  export { GraphConfigSchema, RoamMcpConfigSchema, ErrorCodes, RoamError, CONFIG_VERSION, EXPECTED_API_VERSION, textResult, imageResult, errorResult, getErrorMessage, } from "./types.js";
3
- export { RoamClient } from "./client.js";
4
- export { getPort, resolveGraph, saveGraphToConfig, removeGraphFromConfig, updateGraphTokenStatus, getConfiguredGraphsSafe, getConfiguredGraphs, findGraphConfig, getMcpConfig, getOpenGraphs, } from "./graph-resolver.js";
5
- export { fetchAvailableGraphs, requestToken, sleep, openRoamApp, slugify, } from "./roam-api.js";
6
- export type { AvailableGraph, GraphsResponse, TokenExchangeResponse, } from "./roam-api.js";
7
- export { tools, findTool, routeToolCall } from "./tools.js";
8
- export type { ToolDefinition, ClientToolDefinition, StandaloneToolDefinition, } from "./tools.js";
3
+ export { tools, findTool, routeToolCall, contentTools, dataTools, desktopUiTools, defineTool, defineStandaloneTool, } from "./tools.js";
4
+ export type { ToolDefinition, ClientToolDefinition, StandaloneToolDefinition, RouteToolCallOptions, } from "./tools.js";
9
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,cAAc,EAAE,WAAW,EAAE,YAAY,EACz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/index.ts"],"names":[],"mappings":"AASA,YAAY,EACV,cAAc,EACd,WAAW,EACX,YAAY,EACZ,SAAS,EACT,WAAW,EACX,WAAW,EACX,aAAa,EACb,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,IAAI,EACJ,aAAa,EACb,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,yBAAyB,EACzB,uBAAuB,EACvB,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,EACV,SAAS,EACT,cAAc,EACd,oBAAoB,EACpB,UAAU,EACV,WAAW,EACX,WAAW,EACX,eAAe,GAChB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,KAAK,EACL,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,SAAS,EACT,cAAc,EACd,UAAU,EACV,oBAAoB,GACrB,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,cAAc,EACd,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  // Barrel export for @roam-research/roam-tools-core
2
+ //
3
+ // Core is transport-agnostic — it does NOT export RoamClient, the
4
+ // ~/.roam-tools.json reader, or the connect command. Those live in
5
+ // @roam-research/roam-tools-local. Hosted MCP transports depend on this
6
+ // package directly and supply their own resolveGraph + createClient via
7
+ // routeToolCall's options.
2
8
  export { GraphConfigSchema, RoamMcpConfigSchema, ErrorCodes, RoamError, CONFIG_VERSION, EXPECTED_API_VERSION, textResult, imageResult, errorResult, getErrorMessage, } from "./types.js";
3
- // Client
4
- export { RoamClient } from "./client.js";
5
- // Graph resolution and config management
6
- export { getPort, resolveGraph, saveGraphToConfig, removeGraphFromConfig, updateGraphTokenStatus, getConfiguredGraphsSafe, getConfiguredGraphs, findGraphConfig, getMcpConfig, getOpenGraphs, } from "./graph-resolver.js";
7
- // Shared Roam API functions
8
- export { fetchAvailableGraphs, requestToken, sleep, openRoamApp, slugify, } from "./roam-api.js";
9
- // Tool definitions and routing
10
- export { tools, findTool, routeToolCall } from "./tools.js";
9
+ // Tool definitions, helpers, and routing
10
+ export { tools, findTool, routeToolCall, contentTools, dataTools, desktopUiTools, defineTool, defineStandaloneTool, } from "./tools.js";
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { RoamClient } from "../client.js";
3
- import type { CallToolResult } from "../types.js";
2
+ import type { CallToolResult, RoamActionClient } from "../types.js";
4
3
  export declare const CreateBlockSchema: z.ZodObject<{
5
4
  parentUid: z.ZodOptional<z.ZodString>;
6
5
  pageTitle: z.ZodOptional<z.ZodString>;
@@ -38,16 +37,22 @@ export declare const UpdateBlockSchema: z.ZodObject<{
38
37
  string: z.ZodOptional<z.ZodString>;
39
38
  open: z.ZodOptional<z.ZodBoolean>;
40
39
  heading: z.ZodOptional<z.ZodNumber>;
40
+ childrenViewType: z.ZodOptional<z.ZodEnum<["bullet", "numbered", "document"]>>;
41
+ textAlign: z.ZodOptional<z.ZodEnum<["left", "center", "right", "justify"]>>;
41
42
  }, "strip", z.ZodTypeAny, {
42
43
  uid: string;
43
44
  string?: string | undefined;
45
+ childrenViewType?: "bullet" | "numbered" | "document" | undefined;
44
46
  open?: boolean | undefined;
45
47
  heading?: number | undefined;
48
+ textAlign?: "left" | "center" | "right" | "justify" | undefined;
46
49
  }, {
47
50
  uid: string;
48
51
  string?: string | undefined;
52
+ childrenViewType?: "bullet" | "numbered" | "document" | undefined;
49
53
  open?: boolean | undefined;
50
54
  heading?: number | undefined;
55
+ textAlign?: "left" | "center" | "right" | "justify" | undefined;
51
56
  }>;
52
57
  export declare const DeleteBlockSchema: z.ZodObject<{
53
58
  uid: z.ZodString;
@@ -80,25 +85,25 @@ export declare const GetBacklinksSchema: z.ZodObject<{
80
85
  includePath: z.ZodOptional<z.ZodBoolean>;
81
86
  maxDepth: z.ZodOptional<z.ZodNumber>;
82
87
  }, "strip", z.ZodTypeAny, {
88
+ title?: string | undefined;
83
89
  sort?: "created-date" | "edited-date" | "daily-note-date" | undefined;
90
+ search?: string | undefined;
84
91
  uid?: string | undefined;
85
- title?: string | undefined;
86
- sortOrder?: "asc" | "desc" | undefined;
87
- includePath?: boolean | undefined;
92
+ maxDepth?: number | undefined;
88
93
  offset?: number | undefined;
89
94
  limit?: number | undefined;
90
- maxDepth?: number | undefined;
91
- search?: string | undefined;
95
+ sortOrder?: "asc" | "desc" | undefined;
96
+ includePath?: boolean | undefined;
92
97
  }, {
98
+ title?: string | undefined;
93
99
  sort?: "created-date" | "edited-date" | "daily-note-date" | undefined;
100
+ search?: string | undefined;
94
101
  uid?: string | undefined;
95
- title?: string | undefined;
96
- sortOrder?: "asc" | "desc" | undefined;
97
- includePath?: boolean | undefined;
102
+ maxDepth?: number | undefined;
98
103
  offset?: number | undefined;
99
104
  limit?: number | undefined;
100
- maxDepth?: number | undefined;
101
- search?: string | undefined;
105
+ sortOrder?: "asc" | "desc" | undefined;
106
+ includePath?: boolean | undefined;
102
107
  }>;
103
108
  export type CreateBlockParams = z.infer<typeof CreateBlockSchema>;
104
109
  export type GetBlockParams = z.infer<typeof GetBlockSchema>;
@@ -121,12 +126,12 @@ export interface GetBacklinksResponse {
121
126
  total: number;
122
127
  results: BacklinkResult[];
123
128
  }
124
- export declare function createBlock(client: RoamClient, params: CreateBlockParams): Promise<CallToolResult>;
125
- export declare function getBlock(client: RoamClient, params: GetBlockParams): Promise<CallToolResult>;
126
- export declare function updateBlock(client: RoamClient, params: UpdateBlockParams): Promise<CallToolResult>;
127
- export declare function deleteBlock(client: RoamClient, params: DeleteBlockParams): Promise<CallToolResult>;
128
- export declare function moveBlock(client: RoamClient, params: MoveBlockParams): Promise<CallToolResult>;
129
- export declare function getBacklinks(client: RoamClient, params: GetBacklinksParams): Promise<CallToolResult>;
129
+ export declare function createBlock(client: RoamActionClient, params: CreateBlockParams): Promise<CallToolResult>;
130
+ export declare function getBlock(client: RoamActionClient, params: GetBlockParams): Promise<CallToolResult>;
131
+ export declare function updateBlock(client: RoamActionClient, params: UpdateBlockParams): Promise<CallToolResult>;
132
+ export declare function deleteBlock(client: RoamActionClient, params: DeleteBlockParams): Promise<CallToolResult>;
133
+ export declare function moveBlock(client: RoamActionClient, params: MoveBlockParams): Promise<CallToolResult>;
134
+ export declare function getBacklinks(client: RoamActionClient, params: GetBacklinksParams): Promise<CallToolResult>;
130
135
  export declare const AddCommentSchema: z.ZodObject<{
131
136
  blockUid: z.ZodString;
132
137
  comment: z.ZodOptional<z.ZodString>;
@@ -165,6 +170,6 @@ export interface GetCommentsResponse {
165
170
  total: number;
166
171
  comments: CommentResult[];
167
172
  }
168
- export declare function addComment(client: RoamClient, params: AddCommentParams): Promise<CallToolResult>;
169
- export declare function getComments(client: RoamClient, params: GetCommentsParams): Promise<CallToolResult>;
173
+ export declare function addComment(client: RoamActionClient, params: AddCommentParams): Promise<CallToolResult>;
174
+ export declare function getComments(client: RoamActionClient, params: GetCommentsParams): Promise<CallToolResult>;
170
175
  //# sourceMappingURL=blocks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../src/operations/blocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAoB,MAAM,aAAa,CAAC;AAIpE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;EAiB5B,CAAC;AAEH,eAAO,MAA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gB,CAAC,CAAC;AAChE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,aAAa,EAAE,CAAC;CAC3B;AAED,wBAAsB,UAAU,CAC9B,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,cAAc,CAAC,CA0BzB;AAED,wBAAsB,WAAW,CAC/B,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,cAAc,CAAC,CAMzB"}
@@ -2,22 +2,46 @@ import { z } from "zod";
2
2
  import { textResult, RoamError, ErrorCodes } from "../types.js";
3
3
  // Schemas
4
4
  export const CreateBlockSchema = z.object({
5
- parentUid: z.string().optional().describe("UID of parent block or page. Exactly one of parentUid, pageTitle, or dailyNotePage is required."),
6
- pageTitle: z.string().optional().describe("Page title to create block under (creates the page if it doesn't exist). Exactly one of parentUid, pageTitle, or dailyNotePage is required."),
7
- dailyNotePage: z.string().regex(/^\d{2}-\d{2}-\d{4}$/, "Must be MM-DD-YYYY format (e.g. '03-17-2026')").optional().describe("Daily note date in MM-DD-YYYY format (e.g. '03-17-2026'). Targets that day's daily note page, creating it if needed. Exactly one of parentUid, pageTitle, or dailyNotePage is required."),
8
- nestUnder: z.string().optional().describe("Insert under a direct child block matching this string (matches on the block's string field, including markup like **bold** or [[links]]). If no match exists, creates a new child block with this text first, then inserts under it. Works with parentUid, pageTitle, or dailyNotePage."),
5
+ parentUid: z
6
+ .string()
7
+ .optional()
8
+ .describe("UID of parent block or page. Exactly one of parentUid, pageTitle, or dailyNotePage is required."),
9
+ pageTitle: z
10
+ .string()
11
+ .optional()
12
+ .describe("Page title to create block under (creates the page if it doesn't exist). Exactly one of parentUid, pageTitle, or dailyNotePage is required."),
13
+ dailyNotePage: z
14
+ .string()
15
+ .regex(/^\d{2}-\d{2}-\d{4}$/, "Must be MM-DD-YYYY format (e.g. '03-17-2026')")
16
+ .optional()
17
+ .describe("Daily note date in MM-DD-YYYY format (e.g. '03-17-2026'). Targets that day's daily note page, creating it if needed. Exactly one of parentUid, pageTitle, or dailyNotePage is required."),
18
+ nestUnder: z
19
+ .string()
20
+ .optional()
21
+ .describe("Insert under a direct child block matching this string (matches on the block's string field, including markup like **bold** or [[links]]). If no match exists, creates a new child block with this text first, then inserts under it. Works with parentUid, pageTitle, or dailyNotePage."),
9
22
  markdown: z.string().describe("Markdown content for the block"),
10
- order: z.union([z.coerce.number(), z.enum(["first", "last"])]).optional().describe("Position (number, 'first', or 'last'). Defaults to 'last'"),
23
+ order: z
24
+ .union([z.coerce.number(), z.enum(["first", "last"])])
25
+ .optional()
26
+ .describe("Position (number, 'first', or 'last'). Defaults to 'last'"),
11
27
  });
12
28
  export const GetBlockSchema = z.object({
13
29
  uid: z.string().describe("Block UID"),
14
- maxDepth: z.coerce.number().optional().describe("Max depth of children to include in markdown (omit for full tree)"),
30
+ maxDepth: z.coerce
31
+ .number()
32
+ .optional()
33
+ .describe("Max depth of children to include in markdown (omit for full tree)"),
15
34
  });
16
35
  export const UpdateBlockSchema = z.object({
17
36
  uid: z.string().describe("Block UID"),
18
37
  string: z.string().optional().describe("New text content"),
19
38
  open: z.boolean().optional().describe("Collapse state"),
20
39
  heading: z.coerce.number().optional().describe("Heading level (0-3)"),
40
+ childrenViewType: z
41
+ .enum(["bullet", "numbered", "document"])
42
+ .optional()
43
+ .describe("How children are displayed (bullet, numbered, or document)"),
44
+ textAlign: z.enum(["left", "center", "right", "justify"]).optional().describe("Text alignment"),
21
45
  });
22
46
  export const DeleteBlockSchema = z.object({
23
47
  uid: z.string().describe("Block UID to delete"),
@@ -25,22 +49,36 @@ export const DeleteBlockSchema = z.object({
25
49
  export const MoveBlockSchema = z.object({
26
50
  uid: z.string().describe("Block UID to move"),
27
51
  parentUid: z.string().describe("UID of the new parent block or page"),
28
- order: z.union([z.coerce.number(), z.enum(["first", "last"])]).describe("Position in the new parent (number, 'first', or 'last')"),
52
+ order: z
53
+ .union([z.coerce.number(), z.enum(["first", "last"])])
54
+ .describe("Position in the new parent (number, 'first', or 'last')"),
29
55
  });
30
56
  export const GetBacklinksSchema = z.object({
31
57
  uid: z.string().optional().describe("UID of page or block (required if no title)"),
32
58
  title: z.string().optional().describe("Page title (required if no uid)"),
33
59
  offset: z.coerce.number().optional().describe("Skip first N results (default: 0)"),
34
60
  limit: z.coerce.number().optional().describe("Max results to return (default: 20)"),
35
- sort: z.enum(["created-date", "edited-date", "daily-note-date"]).optional().describe("Sort order (default: created-date)"),
61
+ sort: z
62
+ .enum(["created-date", "edited-date", "daily-note-date"])
63
+ .optional()
64
+ .describe("Sort order (default: created-date)"),
36
65
  sortOrder: z.enum(["asc", "desc"]).optional().describe("Sort direction (default: desc)"),
37
- search: z.string().optional().describe("Filter results by text match (searches block, parents, children, page title)"),
38
- includePath: z.boolean().optional().describe("Include breadcrumb path to each result (default: true)"),
39
- maxDepth: z.coerce.number().optional().describe("Max depth of children to include in markdown (default: 2)"),
66
+ search: z
67
+ .string()
68
+ .optional()
69
+ .describe("Filter results by text match (searches block, parents, children, page title)"),
70
+ includePath: z
71
+ .boolean()
72
+ .optional()
73
+ .describe("Include breadcrumb path to each result (default: true)"),
74
+ maxDepth: z.coerce
75
+ .number()
76
+ .optional()
77
+ .describe("Max depth of children to include in markdown (default: 2)"),
40
78
  });
41
79
  export async function createBlock(client, params) {
42
80
  // Validate: exactly one of parentUid, pageTitle, or dailyNotePage
43
- const targets = [params.parentUid, params.pageTitle, params.dailyNotePage].filter(v => v !== undefined);
81
+ const targets = [params.parentUid, params.pageTitle, params.dailyNotePage].filter((v) => v !== undefined);
44
82
  if (targets.length === 0) {
45
83
  throw new RoamError("Either 'parentUid', 'pageTitle', or 'dailyNotePage' is required to specify where to create the block", ErrorCodes.VALIDATION_ERROR);
46
84
  }
@@ -82,6 +120,10 @@ export async function updateBlock(client, params) {
82
120
  block.open = params.open;
83
121
  if (params.heading !== undefined)
84
122
  block.heading = params.heading;
123
+ if (params.childrenViewType !== undefined)
124
+ block["children-view-type"] = params.childrenViewType;
125
+ if (params.textAlign !== undefined)
126
+ block["text-align"] = params.textAlign;
85
127
  await client.call("data.block.update", [{ block }]);
86
128
  return textResult({ success: true });
87
129
  }
@@ -129,12 +171,21 @@ export async function getBacklinks(client, params) {
129
171
  // --- Comments ---
130
172
  export const AddCommentSchema = z.object({
131
173
  blockUid: z.string().describe("UID of the block to comment on"),
132
- comment: z.string().optional().describe("Plain text comment (single block, editable later via update_block). Required if commentMarkdown not provided. Preferred for simple comments."),
133
- commentMarkdown: z.string().optional().describe("Markdown comment parsed into multiple blocks. Required if comment not provided. Use only when you need structure (lists, headings). Harder to edit later."),
174
+ comment: z
175
+ .string()
176
+ .optional()
177
+ .describe("Plain text comment (single block, editable later via update_block). Required if commentMarkdown not provided. Preferred for simple comments."),
178
+ commentMarkdown: z
179
+ .string()
180
+ .optional()
181
+ .describe("Markdown comment parsed into multiple blocks. Required if comment not provided. Use only when you need structure (lists, headings). Harder to edit later."),
134
182
  });
135
183
  export const GetCommentsSchema = z.object({
136
184
  blockUid: z.string().describe("UID of the block to get comments for"),
137
- maxDepth: z.coerce.number().optional().describe("Max depth of children to include in each comment's markdown (omit for full tree)"),
185
+ maxDepth: z.coerce
186
+ .number()
187
+ .optional()
188
+ .describe("Max depth of children to include in each comment's markdown (omit for full tree)"),
138
189
  });
139
190
  export async function addComment(client, params) {
140
191
  // Validate: exactly one of comment or commentMarkdown must be provided
@@ -0,0 +1,15 @@
1
+ import { z } from "zod";
2
+ import type { CallToolResult, RoamActionClient } from "../types.js";
3
+ export declare const DatalogQuerySchema: z.ZodObject<{
4
+ query: z.ZodString;
5
+ inputs: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
6
+ }, "strip", z.ZodTypeAny, {
7
+ query: string;
8
+ inputs?: unknown[] | undefined;
9
+ }, {
10
+ query: string;
11
+ inputs?: unknown[] | undefined;
12
+ }>;
13
+ export type DatalogQueryParams = z.infer<typeof DatalogQuerySchema>;
14
+ export declare function datalogQuery(client: RoamActionClient, params: DatalogQueryParams): Promise<CallToolResult>;
15
+ //# sourceMappingURL=datalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datalog.d.ts","sourceRoot":"","sources":["../../src/operations/datalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpE,eAAO,MAAM,kBAAkB;;;;;;;;;EAQ7B,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE,wBAAsB,YAAY,CAChC,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,cAAc,CAAC,CAIzB"}
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ import { textResult } from "../types.js";
3
+ export const DatalogQuerySchema = z.object({
4
+ query: z
5
+ .string()
6
+ .describe("Datalog query string (e.g., '[:find ?title :where [?e :node/title ?title]]')"),
7
+ inputs: z
8
+ .array(z.unknown())
9
+ .optional()
10
+ .describe("Input parameters for the query, corresponding to :in clause bindings after $"),
11
+ });
12
+ export async function datalogQuery(client, params) {
13
+ const args = params.inputs ? [params.query, ...params.inputs] : [params.query];
14
+ const response = await client.call("q", args);
15
+ return textResult(response.result ?? []);
16
+ }
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { RoamClient } from "../client.js";
3
- import type { CallToolResult } from "../types.js";
2
+ import type { CallToolResult, RoamActionClient } from "../types.js";
4
3
  export declare const FileGetSchema: z.ZodObject<{
5
4
  url: z.ZodString;
6
5
  }, "strip", z.ZodTypeAny, {
@@ -16,14 +15,14 @@ export declare const FileUploadSchema: z.ZodObject<{
16
15
  filename: z.ZodOptional<z.ZodString>;
17
16
  }, "strip", z.ZodTypeAny, {
18
17
  url?: string | undefined;
19
- filePath?: string | undefined;
20
18
  base64?: string | undefined;
19
+ filePath?: string | undefined;
21
20
  mimetype?: string | undefined;
22
21
  filename?: string | undefined;
23
22
  }, {
24
23
  url?: string | undefined;
25
- filePath?: string | undefined;
26
24
  base64?: string | undefined;
25
+ filePath?: string | undefined;
27
26
  mimetype?: string | undefined;
28
27
  filename?: string | undefined;
29
28
  }>;
@@ -37,7 +36,7 @@ export declare const FileDeleteSchema: z.ZodObject<{
37
36
  export type FileGetParams = z.infer<typeof FileGetSchema>;
38
37
  export type FileUploadParams = z.infer<typeof FileUploadSchema>;
39
38
  export type FileDeleteParams = z.infer<typeof FileDeleteSchema>;
40
- export declare function getFile(client: RoamClient, params: FileGetParams): Promise<CallToolResult>;
41
- export declare function uploadFile(client: RoamClient, params: FileUploadParams): Promise<CallToolResult>;
42
- export declare function deleteFile(client: RoamClient, params: FileDeleteParams): Promise<CallToolResult>;
39
+ export declare function getFile(client: RoamActionClient, params: FileGetParams): Promise<CallToolResult>;
40
+ export declare function uploadFile(client: RoamActionClient, params: FileUploadParams): Promise<CallToolResult>;
41
+ export declare function deleteFile(client: RoamActionClient, params: FileDeleteParams): Promise<CallToolResult>;
43
42
  //# sourceMappingURL=files.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/operations/files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KA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C,OAAO,aAAa,CAAC,CAAC;AAC1D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAChE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AA+GhE,wBAAsB,OAAO,CAC3B,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,cAAc,CAAC,CAkBzB;AAED,wBAAsB,UAAU,CAC9B,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,cAAc,CAAC,CAiDzB;AAED,wBAAsB,UAAU,CAC9B,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,cAAc,CAAC,CAGzB"}
@@ -7,11 +7,23 @@ export const FileGetSchema = z.object({
7
7
  url: z.string().describe("Firebase storage URL of the file"),
8
8
  });
9
9
  export const FileUploadSchema = z.object({
10
- filePath: z.string().optional().describe("Local file path (preferred) - server reads the file directly"),
10
+ filePath: z
11
+ .string()
12
+ .optional()
13
+ .describe("Local file path (preferred) - server reads the file directly"),
11
14
  url: z.string().optional().describe("Remote URL to fetch the file from"),
12
- base64: z.string().optional().describe("Base64-encoded file data (fallback for sandboxed clients)"),
13
- mimetype: z.string().optional().describe("MIME type (e.g., image/png, image/jpeg) - auto-detected if not provided"),
14
- filename: z.string().optional().describe("Original filename for reference - derived from path/url if not provided"),
15
+ base64: z
16
+ .string()
17
+ .optional()
18
+ .describe("Base64-encoded file data (fallback for sandboxed clients)"),
19
+ mimetype: z
20
+ .string()
21
+ .optional()
22
+ .describe("MIME type (e.g., image/png, image/jpeg) - auto-detected if not provided"),
23
+ filename: z
24
+ .string()
25
+ .optional()
26
+ .describe("Original filename for reference - derived from path/url if not provided"),
15
27
  });
16
28
  export const FileDeleteSchema = z.object({
17
29
  url: z.string().describe("Firebase storage URL of the file to delete"),
@@ -102,7 +114,8 @@ async function fetchRemoteFile(url) {
102
114
  // Try Content-Type header first, then extension, then magic bytes
103
115
  let mimetype = response.headers.get("content-type")?.split(";")[0];
104
116
  if (!mimetype || mimetype === "application/octet-stream") {
105
- mimetype = detectMimeTypeFromExtension(urlPath) || detectMimeTypeFromBase64(base64) || undefined;
117
+ mimetype =
118
+ detectMimeTypeFromExtension(urlPath) || detectMimeTypeFromBase64(base64) || undefined;
106
119
  }
107
120
  if (!mimetype) {
108
121
  throw new Error(`Could not detect MIME type for URL: ${url}`);
@@ -1,32 +1,31 @@
1
1
  import { z } from "zod";
2
- import type { RoamClient } from "../client.js";
3
- import type { CallToolResult } from "../types.js";
2
+ import type { CallToolResult, RoamActionClient } from "../types.js";
4
3
  export declare const GetOpenWindowsSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
5
4
  export declare const GetSelectionSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
6
5
  export declare const OpenMainWindowSchema: z.ZodObject<{
7
6
  uid: z.ZodOptional<z.ZodString>;
8
7
  title: z.ZodOptional<z.ZodString>;
9
8
  }, "strip", z.ZodTypeAny, {
10
- uid?: string | undefined;
11
9
  title?: string | undefined;
12
- }, {
13
10
  uid?: string | undefined;
11
+ }, {
14
12
  title?: string | undefined;
13
+ uid?: string | undefined;
15
14
  }>;
16
15
  export declare const OpenSidebarSchema: z.ZodObject<{
17
16
  uid: z.ZodString;
18
17
  type: z.ZodOptional<z.ZodEnum<["block", "outline", "mentions"]>>;
19
18
  }, "strip", z.ZodTypeAny, {
20
19
  uid: string;
21
- type?: "block" | "outline" | "mentions" | undefined;
20
+ type?: "mentions" | "block" | "outline" | undefined;
22
21
  }, {
23
22
  uid: string;
24
- type?: "block" | "outline" | "mentions" | undefined;
23
+ type?: "mentions" | "block" | "outline" | undefined;
25
24
  }>;
26
25
  export type OpenMainWindowParams = z.infer<typeof OpenMainWindowSchema>;
27
26
  export type OpenSidebarParams = z.infer<typeof OpenSidebarSchema>;
28
- export declare function getOpenWindows(client: RoamClient): Promise<CallToolResult>;
29
- export declare function getSelection(client: RoamClient): Promise<CallToolResult>;
30
- export declare function openMainWindow(client: RoamClient, params: OpenMainWindowParams): Promise<CallToolResult>;
31
- export declare function openSidebar(client: RoamClient, params: OpenSidebarParams): Promise<CallToolResult>;
27
+ export declare function getOpenWindows(client: RoamActionClient): Promise<CallToolResult>;
28
+ export declare function getSelection(client: RoamActionClient): Promise<CallToolResult>;
29
+ export declare function openMainWindow(client: RoamActionClient, params: OpenMainWindowParams): Promise<CallToolResult>;
30
+ export declare function openSidebar(client: RoamActionClient, params: OpenSidebarParams): Promise<CallToolResult>;
32
31
  //# sourceMappingURL=navigation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/operations/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAkE,cAAc,EAAE,MAAM,aAAa,CAAC;AAIlH,eAAO,MAAM,oBAAoB,gDAAe,CAAC;AAEjD,eAAO,MAAM,kBAAkB,gDAAe,CAAC;AAE/C,eAAO,MAAM,oBAAoB;;;;;;;;;EAG/B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;EAG5B,CAAC;AAGH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACxE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,wBAAsB,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC,CAShF;AAED,wBAAsB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC,CAS9E;AAED,wBAAsB,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,cAAc,CAAC,CAQ9G;AAED,wBAAsB,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAUxG"}
1
+ {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/operations/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAKV,cAAc,EACd,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAIrB,eAAO,MAAM,oBAAoB,gDAAe,CAAC;AAEjD,eAAO,MAAM,kBAAkB,gDAAe,CAAC;AAE/C,eAAO,MAAM,oBAAoB;;;;;;;;;EAG/B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;EAM5B,CAAC;AAGH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACxE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,wBAAsB,cAAc,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC,CAStF;AAED,wBAAsB,YAAY,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC,CASpF;AAED,wBAAsB,cAAc,CAClC,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,cAAc,CAAC,CAQzB;AAED,wBAAsB,WAAW,CAC/B,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,cAAc,CAAC,CAUzB"}
@@ -9,7 +9,10 @@ export const OpenMainWindowSchema = z.object({
9
9
  });
10
10
  export const OpenSidebarSchema = z.object({
11
11
  uid: z.string().describe("UID of page or block"),
12
- type: z.enum(["block", "outline", "mentions"]).optional().describe("View type (default: outline)"),
12
+ type: z
13
+ .enum(["block", "outline", "mentions"])
14
+ .optional()
15
+ .describe("View type (default: outline)"),
13
16
  });
14
17
  export async function getOpenWindows(client) {
15
18
  const [mainResponse, sidebarResponse] = await Promise.all([
@@ -1,30 +1,32 @@
1
1
  import { z } from "zod";
2
- import type { RoamClient } from "../client.js";
3
- import type { CallToolResult } from "../types.js";
2
+ import type { CallToolResult, RoamActionClient } from "../types.js";
4
3
  export declare const CreatePageSchema: z.ZodObject<{
5
4
  title: z.ZodString;
6
5
  markdown: z.ZodOptional<z.ZodString>;
7
6
  uid: z.ZodOptional<z.ZodString>;
7
+ childrenViewType: z.ZodOptional<z.ZodEnum<["document", "bullet", "numbered"]>>;
8
8
  }, "strip", z.ZodTypeAny, {
9
9
  title: string;
10
- uid?: string | undefined;
11
10
  markdown?: string | undefined;
11
+ uid?: string | undefined;
12
+ childrenViewType?: "bullet" | "numbered" | "document" | undefined;
12
13
  }, {
13
14
  title: string;
14
- uid?: string | undefined;
15
15
  markdown?: string | undefined;
16
+ uid?: string | undefined;
17
+ childrenViewType?: "bullet" | "numbered" | "document" | undefined;
16
18
  }>;
17
19
  export declare const GetPageSchema: z.ZodObject<{
18
20
  title: z.ZodOptional<z.ZodString>;
19
21
  uid: z.ZodOptional<z.ZodString>;
20
22
  maxDepth: z.ZodOptional<z.ZodNumber>;
21
23
  }, "strip", z.ZodTypeAny, {
22
- uid?: string | undefined;
23
24
  title?: string | undefined;
25
+ uid?: string | undefined;
24
26
  maxDepth?: number | undefined;
25
27
  }, {
26
- uid?: string | undefined;
27
28
  title?: string | undefined;
29
+ uid?: string | undefined;
28
30
  maxDepth?: number | undefined;
29
31
  }>;
30
32
  export declare const DeletePageSchema: z.ZodObject<{
@@ -42,12 +44,12 @@ export declare const UpdatePageSchema: z.ZodObject<{
42
44
  }, "strip", z.ZodTypeAny, {
43
45
  uid: string;
44
46
  title?: string | undefined;
45
- childrenViewType?: "document" | "bullet" | "numbered" | undefined;
47
+ childrenViewType?: "bullet" | "numbered" | "document" | undefined;
46
48
  mergePages?: boolean | undefined;
47
49
  }, {
48
50
  uid: string;
49
51
  title?: string | undefined;
50
- childrenViewType?: "document" | "bullet" | "numbered" | undefined;
52
+ childrenViewType?: "bullet" | "numbered" | "document" | undefined;
51
53
  mergePages?: boolean | undefined;
52
54
  }>;
53
55
  export declare const GetGuidelinesSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
@@ -55,9 +57,9 @@ export type CreatePageParams = z.infer<typeof CreatePageSchema>;
55
57
  export type GetPageParams = z.infer<typeof GetPageSchema>;
56
58
  export type DeletePageParams = z.infer<typeof DeletePageSchema>;
57
59
  export type UpdatePageParams = z.infer<typeof UpdatePageSchema>;
58
- export declare function createPage(client: RoamClient, params: CreatePageParams): Promise<CallToolResult>;
59
- export declare function getPage(client: RoamClient, params: GetPageParams): Promise<CallToolResult>;
60
- export declare function deletePage(client: RoamClient, params: DeletePageParams): Promise<CallToolResult>;
61
- export declare function updatePage(client: RoamClient, params: UpdatePageParams): Promise<CallToolResult>;
62
- export declare function getGuidelines(client: RoamClient): Promise<CallToolResult>;
60
+ export declare function createPage(client: RoamActionClient, params: CreatePageParams): Promise<CallToolResult>;
61
+ export declare function getPage(client: RoamActionClient, params: GetPageParams): Promise<CallToolResult>;
62
+ export declare function deletePage(client: RoamActionClient, params: DeletePageParams): Promise<CallToolResult>;
63
+ export declare function updatePage(client: RoamActionClient, params: UpdatePageParams): Promise<CallToolResult>;
64
+ export declare function getGuidelines(client: RoamActionClient): Promise<CallToolResult>;
63
65
  //# sourceMappingURL=pages.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../src/operations/pages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KA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