@roam-research/roam-tools-core 0.4.2 → 0.5.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.
@@ -288,7 +288,7 @@ export async function resolveGraph(providedGraph) {
288
288
  if (!graphConfig) {
289
289
  throw new RoamError(`Graph "${providedGraph}" not found in config. Available graph nicknames are listed below.`, ErrorCodes.GRAPH_NOT_CONFIGURED, {
290
290
  available_graphs: await getConfiguredGraphs(),
291
- instruction: "Pass the 'nickname' value as the graph parameter. Before operating on a graph, call get_graph_guidelines to understand its conventions.",
291
+ instruction: "Pass the 'nickname' value as the graph parameter. After identifying which graph to use, ALWAYS call get_graph_guidelines next it returns essential context and orientation for the session.",
292
292
  });
293
293
  }
294
294
  return {
@@ -315,7 +315,7 @@ export async function resolveGraph(providedGraph) {
315
315
  // 3. Multiple graphs - require explicit selection
316
316
  throw new RoamError("Multiple graphs configured. Pass a graph nickname as the graph parameter to specify which graph to use.", ErrorCodes.GRAPH_NOT_SELECTED, {
317
317
  available_graphs: await getConfiguredGraphs(),
318
- instruction: "Pass the 'nickname' value as the graph parameter. Before operating on a graph, call get_graph_guidelines to understand its conventions.",
318
+ instruction: "Pass the 'nickname' value as the graph parameter. After identifying which graph to use, ALWAYS call get_graph_guidelines next it returns essential context and orientation for the session.",
319
319
  });
320
320
  }
321
321
  /**
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
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, Template, QueryResult, QueryResponse, TokenInfoResponse, TokenInfoResult, } from "./types.js";
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";
2
2
  export { GraphConfigSchema, RoamMcpConfigSchema, ErrorCodes, RoamError, CONFIG_VERSION, EXPECTED_API_VERSION, textResult, imageResult, errorResult, getErrorMessage, } from "./types.js";
3
3
  export { RoamClient } from "./client.js";
4
4
  export { getPort, resolveGraph, saveGraphToConfig, removeGraphFromConfig, updateGraphTokenStatus, getConfiguredGraphsSafe, getConfiguredGraphs, findGraphConfig, getMcpConfig, getOpenGraphs, } from "./graph-resolver.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,cAAc,EAAE,WAAW,EAAE,YAAY,EACzC,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EACjE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EACvD,KAAK,EAAE,IAAI,EAAE,aAAa,EAC1B,UAAU,EAAE,aAAa,EAAE,iBAAiB,EAC5C,YAAY,EAAE,aAAa,EAC3B,kBAAkB,EAAE,cAAc,EAClC,gBAAgB,EAAE,YAAY,EAAE,cAAc,EAC9C,QAAQ,EAAE,WAAW,EAAE,aAAa,EACpC,iBAAiB,EAAE,eAAe,GACnC,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,iBAAiB,EAAE,mBAAmB,EACtC,UAAU,EAAE,SAAS,EACrB,cAAc,EAAE,oBAAoB,EACpC,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,GACtD,MAAM,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AE,oBAAoB,EACpC,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,GACtD,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EACL,OAAO,EAAE,YAAY,EACrB,iBAAiB,EAAE,qBAAqB,EAAE,sBAAsB,EAChE,uBAAuB,EAAE,mBAAmB,EAAE,eAAe,EAC7D,YAAY,EAAE,aAAa,GAC5B,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,oBAAoB,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,GAChE,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,cAAc,EAAE,cAAc,EAAE,qBAAqB,GACtD,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC5D,YAAY,EACV,cAAc,EAAE,oBAAoB,EAAE,wBAAwB,GAC/D,MAAM,YAAY,CAAC"}
@@ -2,16 +2,25 @@ import { z } from "zod";
2
2
  import type { RoamClient } from "../client.js";
3
3
  import type { CallToolResult } from "../types.js";
4
4
  export declare const CreateBlockSchema: z.ZodObject<{
5
- parentUid: z.ZodString;
5
+ parentUid: z.ZodOptional<z.ZodString>;
6
+ pageTitle: z.ZodOptional<z.ZodString>;
7
+ dailyNotePage: z.ZodOptional<z.ZodString>;
8
+ nestUnder: z.ZodOptional<z.ZodString>;
6
9
  markdown: z.ZodString;
7
10
  order: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodEnum<["first", "last"]>]>>;
8
11
  }, "strip", z.ZodTypeAny, {
9
12
  markdown: string;
10
- parentUid: string;
13
+ parentUid?: string | undefined;
14
+ pageTitle?: string | undefined;
15
+ dailyNotePage?: string | undefined;
16
+ nestUnder?: string | undefined;
11
17
  order?: number | "first" | "last" | undefined;
12
18
  }, {
13
19
  markdown: string;
14
- parentUid: string;
20
+ parentUid?: string | undefined;
21
+ pageTitle?: string | undefined;
22
+ dailyNotePage?: string | undefined;
23
+ nestUnder?: string | undefined;
15
24
  order?: number | "first" | "last" | undefined;
16
25
  }>;
17
26
  export declare const GetBlockSchema: z.ZodObject<{
@@ -71,25 +80,25 @@ export declare const GetBacklinksSchema: z.ZodObject<{
71
80
  includePath: z.ZodOptional<z.ZodBoolean>;
72
81
  maxDepth: z.ZodOptional<z.ZodNumber>;
73
82
  }, "strip", z.ZodTypeAny, {
74
- title?: string | undefined;
75
83
  sort?: "created-date" | "edited-date" | "daily-note-date" | undefined;
76
- search?: string | undefined;
77
84
  uid?: string | undefined;
78
- maxDepth?: number | undefined;
79
- offset?: number | undefined;
80
- limit?: number | undefined;
85
+ title?: string | undefined;
81
86
  sortOrder?: "asc" | "desc" | undefined;
82
87
  includePath?: boolean | undefined;
88
+ offset?: number | undefined;
89
+ limit?: number | undefined;
90
+ maxDepth?: number | undefined;
91
+ search?: string | undefined;
83
92
  }, {
84
- title?: string | undefined;
85
93
  sort?: "created-date" | "edited-date" | "daily-note-date" | undefined;
86
- search?: string | undefined;
87
94
  uid?: string | undefined;
88
- maxDepth?: number | undefined;
89
- offset?: number | undefined;
90
- limit?: number | undefined;
95
+ title?: string | undefined;
91
96
  sortOrder?: "asc" | "desc" | undefined;
92
97
  includePath?: boolean | undefined;
98
+ offset?: number | undefined;
99
+ limit?: number | undefined;
100
+ maxDepth?: number | undefined;
101
+ search?: string | undefined;
93
102
  }>;
94
103
  export type CreateBlockParams = z.infer<typeof CreateBlockSchema>;
95
104
  export type GetBlockParams = z.infer<typeof GetBlockSchema>;
@@ -108,6 +117,7 @@ export interface BacklinkResult {
108
117
  }>;
109
118
  }
110
119
  export interface GetBacklinksResponse {
120
+ queriedAt?: string;
111
121
  total: number;
112
122
  results: BacklinkResult[];
113
123
  }
@@ -117,4 +127,44 @@ export declare function updateBlock(client: RoamClient, params: UpdateBlockParam
117
127
  export declare function deleteBlock(client: RoamClient, params: DeleteBlockParams): Promise<CallToolResult>;
118
128
  export declare function moveBlock(client: RoamClient, params: MoveBlockParams): Promise<CallToolResult>;
119
129
  export declare function getBacklinks(client: RoamClient, params: GetBacklinksParams): Promise<CallToolResult>;
130
+ export declare const AddCommentSchema: z.ZodObject<{
131
+ blockUid: z.ZodString;
132
+ comment: z.ZodOptional<z.ZodString>;
133
+ commentMarkdown: z.ZodOptional<z.ZodString>;
134
+ }, "strip", z.ZodTypeAny, {
135
+ blockUid: string;
136
+ comment?: string | undefined;
137
+ commentMarkdown?: string | undefined;
138
+ }, {
139
+ blockUid: string;
140
+ comment?: string | undefined;
141
+ commentMarkdown?: string | undefined;
142
+ }>;
143
+ export declare const GetCommentsSchema: z.ZodObject<{
144
+ blockUid: z.ZodString;
145
+ maxDepth: z.ZodOptional<z.ZodNumber>;
146
+ }, "strip", z.ZodTypeAny, {
147
+ blockUid: string;
148
+ maxDepth?: number | undefined;
149
+ }, {
150
+ blockUid: string;
151
+ maxDepth?: number | undefined;
152
+ }>;
153
+ export type AddCommentParams = z.infer<typeof AddCommentSchema>;
154
+ export type GetCommentsParams = z.infer<typeof GetCommentsSchema>;
155
+ export interface CommentResult {
156
+ parentUid: string;
157
+ author: string;
158
+ createdTime: string;
159
+ editedTime: string;
160
+ markdown: string;
161
+ singleEditableUid: string | null;
162
+ }
163
+ export interface GetCommentsResponse {
164
+ queriedAt?: string;
165
+ total: number;
166
+ comments: CommentResult[];
167
+ }
168
+ export declare function addComment(client: RoamClient, params: AddCommentParams): Promise<CallToolResult>;
169
+ export declare function getComments(client: RoamClient, params: GetCommentsParams): Promise<CallToolResult>;
120
170
  //# 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,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AAM,EAAE,UAAU,EAAE,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAGxG;AAED,wBAAsB,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAapG;AAED,wBAAsB,YAAY,CAChC,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,cAAc,CAAC,CAezB;AAID,eAAO,MAAM,gBAAgB;;;;;;;;;;;;EAI3B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;EAG5B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,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,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC,CAiBtG;AAED,wBAAsB,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAMxG"}
@@ -1,8 +1,11 @@
1
1
  import { z } from "zod";
2
- import { textResult } from "../types.js";
2
+ import { textResult, RoamError, ErrorCodes } from "../types.js";
3
3
  // Schemas
4
4
  export const CreateBlockSchema = z.object({
5
- parentUid: z.string().describe("UID of parent block or page"),
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."),
6
9
  markdown: z.string().describe("Markdown content for the block"),
7
10
  order: z.union([z.coerce.number(), z.enum(["first", "last"])]).optional().describe("Position (number, 'first', or 'last'). Defaults to 'last'"),
8
11
  });
@@ -36,14 +39,31 @@ export const GetBacklinksSchema = z.object({
36
39
  maxDepth: z.coerce.number().optional().describe("Max depth of children to include in markdown (default: 2)"),
37
40
  });
38
41
  export async function createBlock(client, params) {
42
+ // Validate: exactly one of parentUid, pageTitle, or dailyNotePage
43
+ const targets = [params.parentUid, params.pageTitle, params.dailyNotePage].filter(v => v !== undefined);
44
+ if (targets.length === 0) {
45
+ throw new RoamError("Either 'parentUid', 'pageTitle', or 'dailyNotePage' is required to specify where to create the block", ErrorCodes.VALIDATION_ERROR);
46
+ }
47
+ if (targets.length > 1) {
48
+ throw new RoamError("Provide only one of 'parentUid', 'pageTitle', or 'dailyNotePage'", ErrorCodes.VALIDATION_ERROR);
49
+ }
50
+ const location = {
51
+ order: params.order ?? "last",
52
+ };
53
+ if (params.parentUid !== undefined) {
54
+ location["parent-uid"] = params.parentUid;
55
+ }
56
+ else if (params.dailyNotePage !== undefined) {
57
+ location["page-title"] = { "daily-note-page": params.dailyNotePage };
58
+ }
59
+ else {
60
+ location["page-title"] = params.pageTitle;
61
+ }
62
+ if (params.nestUnder !== undefined) {
63
+ location["nest-under-str"] = params.nestUnder;
64
+ }
39
65
  const response = await client.call("data.block.fromMarkdown", [
40
- {
41
- location: {
42
- "parent-uid": params.parentUid,
43
- order: params.order ?? "last",
44
- },
45
- "markdown-string": params.markdown,
46
- },
66
+ { location, "markdown-string": params.markdown },
47
67
  ]);
48
68
  return textResult(response.result ?? { uids: [] });
49
69
  }
@@ -106,3 +126,38 @@ export async function getBacklinks(client, params) {
106
126
  const response = await client.call("data.ai.getBacklinks", [apiParams]);
107
127
  return textResult(response.result ?? { total: 0, results: [] });
108
128
  }
129
+ // --- Comments ---
130
+ export const AddCommentSchema = z.object({
131
+ 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."),
134
+ });
135
+ export const GetCommentsSchema = z.object({
136
+ 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)"),
138
+ });
139
+ export async function addComment(client, params) {
140
+ // Validate: exactly one of comment or commentMarkdown must be provided
141
+ const hasComment = params.comment !== undefined;
142
+ const hasCommentMarkdown = params.commentMarkdown !== undefined;
143
+ if (!hasComment && !hasCommentMarkdown) {
144
+ throw new RoamError("Provide one of 'comment' or 'commentMarkdown'", ErrorCodes.VALIDATION_ERROR);
145
+ }
146
+ if (hasComment && hasCommentMarkdown) {
147
+ throw new RoamError("Provide 'comment' or 'commentMarkdown', not both", ErrorCodes.VALIDATION_ERROR);
148
+ }
149
+ const apiParams = { "block-uid": params.blockUid };
150
+ if (hasComment)
151
+ apiParams["reply-string"] = params.comment;
152
+ if (hasCommentMarkdown)
153
+ apiParams["reply-markdown"] = params.commentMarkdown;
154
+ const response = await client.call("data.block.addComment", [apiParams]);
155
+ return textResult(response.result ?? { uids: [] });
156
+ }
157
+ export async function getComments(client, params) {
158
+ const apiParams = { uid: params.blockUid };
159
+ if (params.maxDepth !== undefined)
160
+ apiParams.maxDepth = params.maxDepth;
161
+ const response = await client.call("data.ai.getComments", [apiParams]);
162
+ return textResult(response.result ?? { total: 0, comments: [] });
163
+ }
@@ -16,14 +16,14 @@ export declare const FileUploadSchema: z.ZodObject<{
16
16
  filename: z.ZodOptional<z.ZodString>;
17
17
  }, "strip", z.ZodTypeAny, {
18
18
  url?: string | undefined;
19
- base64?: string | undefined;
20
19
  filePath?: string | undefined;
20
+ base64?: string | undefined;
21
21
  mimetype?: string | undefined;
22
22
  filename?: string | undefined;
23
23
  }, {
24
24
  url?: string | undefined;
25
- base64?: string | undefined;
26
25
  filePath?: string | undefined;
26
+ base64?: string | undefined;
27
27
  mimetype?: string | undefined;
28
28
  filename?: string | undefined;
29
29
  }>;
@@ -33,7 +33,7 @@ export async function listGraphs() {
33
33
  const graphs = await getConfiguredGraphs();
34
34
  return textResult({
35
35
  graphs,
36
- instruction: "Pass the 'nickname' value as the graph parameter. Before operating on a graph, call get_graph_guidelines to understand its conventions.",
36
+ instruction: "Pass the 'nickname' value as the graph parameter. After identifying which graph to use, ALWAYS call get_graph_guidelines next it returns essential context and orientation for the session.",
37
37
  setup: "To connect additional graphs, use the setup_new_graph tool (call it without arguments to see available graphs).",
38
38
  });
39
39
  }
@@ -7,21 +7,21 @@ export declare const OpenMainWindowSchema: z.ZodObject<{
7
7
  uid: z.ZodOptional<z.ZodString>;
8
8
  title: z.ZodOptional<z.ZodString>;
9
9
  }, "strip", z.ZodTypeAny, {
10
- title?: string | undefined;
11
10
  uid?: string | undefined;
12
- }, {
13
11
  title?: string | undefined;
12
+ }, {
14
13
  uid?: string | undefined;
14
+ title?: string | undefined;
15
15
  }>;
16
16
  export declare const OpenSidebarSchema: z.ZodObject<{
17
17
  uid: z.ZodString;
18
18
  type: z.ZodOptional<z.ZodEnum<["block", "outline", "mentions"]>>;
19
19
  }, "strip", z.ZodTypeAny, {
20
20
  uid: string;
21
- type?: "mentions" | "block" | "outline" | undefined;
21
+ type?: "block" | "outline" | "mentions" | undefined;
22
22
  }, {
23
23
  uid: string;
24
- type?: "mentions" | "block" | "outline" | undefined;
24
+ type?: "block" | "outline" | "mentions" | undefined;
25
25
  }>;
26
26
  export type OpenMainWindowParams = z.infer<typeof OpenMainWindowSchema>;
27
27
  export type OpenSidebarParams = z.infer<typeof OpenSidebarSchema>;
@@ -7,24 +7,24 @@ export declare const CreatePageSchema: z.ZodObject<{
7
7
  uid: z.ZodOptional<z.ZodString>;
8
8
  }, "strip", z.ZodTypeAny, {
9
9
  title: string;
10
- markdown?: string | undefined;
11
10
  uid?: string | undefined;
11
+ markdown?: string | undefined;
12
12
  }, {
13
13
  title: string;
14
- markdown?: string | undefined;
15
14
  uid?: string | undefined;
15
+ markdown?: string | undefined;
16
16
  }>;
17
17
  export declare const GetPageSchema: z.ZodObject<{
18
18
  title: z.ZodOptional<z.ZodString>;
19
19
  uid: z.ZodOptional<z.ZodString>;
20
20
  maxDepth: z.ZodOptional<z.ZodNumber>;
21
21
  }, "strip", z.ZodTypeAny, {
22
- title?: string | undefined;
23
22
  uid?: string | undefined;
23
+ title?: string | undefined;
24
24
  maxDepth?: number | undefined;
25
25
  }, {
26
- title?: string | undefined;
27
26
  uid?: string | undefined;
27
+ title?: string | undefined;
28
28
  maxDepth?: number | undefined;
29
29
  }>;
30
30
  export declare const DeletePageSchema: z.ZodObject<{
@@ -42,12 +42,12 @@ export declare const UpdatePageSchema: z.ZodObject<{
42
42
  }, "strip", z.ZodTypeAny, {
43
43
  uid: string;
44
44
  title?: string | undefined;
45
- childrenViewType?: "bullet" | "numbered" | "document" | undefined;
45
+ childrenViewType?: "document" | "bullet" | "numbered" | undefined;
46
46
  mergePages?: boolean | undefined;
47
47
  }, {
48
48
  uid: string;
49
49
  title?: string | undefined;
50
- childrenViewType?: "bullet" | "numbered" | "document" | undefined;
50
+ childrenViewType?: "document" | "bullet" | "numbered" | undefined;
51
51
  mergePages?: boolean | undefined;
52
52
  }>;
53
53
  export declare const GetGuidelinesSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
@@ -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,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAIlD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;EAI3B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;EAIxB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;EAE3B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;EAK3B,CAAC;AAEH,eAAO,MAAM,mBAAmB,gDAAe,CAAC;AAGhD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAChE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,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;AAEhE,wBAAsB,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC,CAQtG;AAED,wBAAsB,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,C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QtG;AAED,wBAAsB,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAMhG;AAED,wBAAsB,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC,CAGtG;AAED,wBAAsB,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC,CAUtG;AAED,wBAAsB,aAAa,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC,CAwB/E"}
@@ -55,5 +55,13 @@ export async function updatePage(client, params) {
55
55
  }
56
56
  export async function getGuidelines(client) {
57
57
  const response = await client.call("data.ai.getGraphGuidelines", []);
58
- return textResult(response.result ?? { guidelines: null, starredPages: [] });
58
+ const result = response.result ?? { guidelines: null, starredPages: [], todaysDailyNotePage: null };
59
+ const dnpTitle = result.todaysDailyNotePage;
60
+ const nextSteps = dnpTitle
61
+ ? `Start by reading today's daily note page ("${dnpTitle}") with get_page — this is the user's primary workspace for the day. If you need more context, call search with an empty query for recently edited and viewed content. Skip these orientation steps only when the user has already given you a specific task to execute (e.g. "create a page called X").`
62
+ : `Start by calling search with an empty query to see recently edited and viewed content. Skip this only when the user has already given you a specific task to execute.`;
63
+ return textResult({
64
+ ...result,
65
+ nextSteps,
66
+ });
59
67
  }
@@ -13,21 +13,21 @@ export declare const QuerySchema: z.ZodObject<{
13
13
  }, "strip", z.ZodTypeAny, {
14
14
  sort?: "created-date" | "edited-date" | "daily-note-date" | undefined;
15
15
  uid?: string | undefined;
16
- maxDepth?: number | undefined;
17
- offset?: number | undefined;
18
- limit?: number | undefined;
16
+ query?: string | undefined;
19
17
  sortOrder?: "asc" | "desc" | undefined;
20
18
  includePath?: boolean | undefined;
21
- query?: string | undefined;
19
+ offset?: number | undefined;
20
+ limit?: number | undefined;
21
+ maxDepth?: number | undefined;
22
22
  }, {
23
23
  sort?: "created-date" | "edited-date" | "daily-note-date" | undefined;
24
24
  uid?: string | undefined;
25
- maxDepth?: number | undefined;
26
- offset?: number | undefined;
27
- limit?: number | undefined;
25
+ query?: string | undefined;
28
26
  sortOrder?: "asc" | "desc" | undefined;
29
27
  includePath?: boolean | undefined;
30
- query?: string | undefined;
28
+ offset?: number | undefined;
29
+ limit?: number | undefined;
30
+ maxDepth?: number | undefined;
31
31
  }>;
32
32
  export type QueryParams = z.infer<typeof QuerySchema>;
33
33
  export declare function query(client: RoamClient, params: QueryParams): Promise<CallToolResult>;
@@ -10,17 +10,17 @@ export declare const SearchSchema: z.ZodObject<{
10
10
  maxDepth: z.ZodOptional<z.ZodNumber>;
11
11
  }, "strip", z.ZodTypeAny, {
12
12
  query: string;
13
- maxDepth?: number | undefined;
13
+ includePath?: boolean | undefined;
14
14
  offset?: number | undefined;
15
15
  limit?: number | undefined;
16
- includePath?: boolean | undefined;
16
+ maxDepth?: number | undefined;
17
17
  scope?: "pages" | "blocks" | "all" | undefined;
18
18
  }, {
19
19
  query: string;
20
- maxDepth?: number | undefined;
20
+ includePath?: boolean | undefined;
21
21
  offset?: number | undefined;
22
22
  limit?: number | undefined;
23
- includePath?: boolean | undefined;
23
+ maxDepth?: number | undefined;
24
24
  scope?: "pages" | "blocks" | "all" | undefined;
25
25
  }>;
26
26
  export declare const SearchTemplatesSchema: z.ZodObject<{
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/operations/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAA4B,cAAc,EAAE,MAAM,aAAa,CAAC;AAI5E,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;EAOvB,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;EAEhC,CAAC;AAGH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AACxD,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E,wBAAsB,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CAY9F;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,cAAc,CAAC,CAKzB"}
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/operations/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAsE,cAAc,EAAE,MAAM,aAAa,CAAC;AAItH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;EAOvB,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;EAEhC,CAAC;AAGH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AACxD,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E,wBAAsB,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CAY9F;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,cAAc,CAAC,CAKzB"}
@@ -2,7 +2,7 @@ import { z } from "zod";
2
2
  import { textResult } from "../types.js";
3
3
  // Schemas
4
4
  export const SearchSchema = z.object({
5
- query: z.string().describe("Search query"),
5
+ query: z.string().describe("Search query — use empty string to get recently edited and viewed content"),
6
6
  scope: z.enum(["pages", "blocks", "all"]).optional().describe("Search scope: 'pages' for page titles only, 'blocks' for block content only, 'all' for both (default: 'all')"),
7
7
  offset: z.coerce.number().optional().describe("Skip first N results (default: 0)"),
8
8
  limit: z.coerce.number().optional().describe("Max results (default: 20)"),
@@ -29,5 +29,5 @@ export async function searchTemplates(client, params) {
29
29
  const response = await client.call("data.ai.searchTemplates", [
30
30
  { query: params.query },
31
31
  ]);
32
- return textResult(response.result ?? []);
32
+ return textResult(response.result ?? { results: [] });
33
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAkC,MAAM,YAAY,CAAC;AAEjF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA8BzC,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IACnC,MAAM,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IACvE,IAAI,EAAE,QAAQ,CAAC;CAChB;AAGD,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IACnC,MAAM,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IACnD,IAAI,EAAE,YAAY,CAAC;CACpB;AAED,MAAM,MAAM,cAAc,GAAG,oBAAoB,GAAG,wBAAwB,CAAC;AAmL7E,eAAO,MAAM,KAAK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wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,cAAc,CAAC,CA+HzB"}
package/dist/tools.js CHANGED
@@ -3,7 +3,7 @@ import { RoamError } from "./types.js";
3
3
  import { RoamClient } from "./client.js";
4
4
  import { resolveGraph, getPort, updateGraphTokenStatus } from "./graph-resolver.js";
5
5
  import { CreatePageSchema, GetPageSchema, DeletePageSchema, UpdatePageSchema, GetGuidelinesSchema, createPage, getPage, deletePage, updatePage, getGuidelines, } from "./operations/pages.js";
6
- import { CreateBlockSchema, GetBlockSchema, UpdateBlockSchema, DeleteBlockSchema, MoveBlockSchema, GetBacklinksSchema, createBlock, getBlock, updateBlock, deleteBlock, moveBlock, getBacklinks, } from "./operations/blocks.js";
6
+ import { CreateBlockSchema, GetBlockSchema, UpdateBlockSchema, DeleteBlockSchema, MoveBlockSchema, GetBacklinksSchema, AddCommentSchema, GetCommentsSchema, createBlock, getBlock, updateBlock, deleteBlock, moveBlock, getBacklinks, addComment, getComments, } from "./operations/blocks.js";
7
7
  import { SearchSchema, SearchTemplatesSchema, search, searchTemplates } from "./operations/search.js";
8
8
  import { QuerySchema, query } from "./operations/query.js";
9
9
  import { GetOpenWindowsSchema, GetSelectionSchema, OpenMainWindowSchema, OpenSidebarSchema, getOpenWindows, getSelection, openMainWindow, openSidebar, } from "./operations/navigation.js";
@@ -46,15 +46,17 @@ const graphManagementTools = [
46
46
  const GUIDELINES_NOTE = "\n\nNote: Call get_graph_guidelines first when starting to work with a graph.";
47
47
  // Content Tools (require graph/client)
48
48
  const contentTools = [
49
- defineTool("get_graph_guidelines", "IMPORTANT: Call this tool first when starting to work with a graph, before performing any other operations. Returns user-defined instructions and preferences for AI agents. The user may have specified naming conventions, preferred structures, or constraints that should guide your behavior.", GetGuidelinesSchema, getGuidelines),
49
+ defineTool("get_graph_guidelines", "IMPORTANT: Call this tool first when starting to work with a graph, before performing any other operations. Returns user-defined instructions and preferences for AI agents. The user may have specified naming conventions, preferred structures, or constraints that should guide your behavior. After receiving the response, follow the nextSteps field — it contains orientation actions you should take before proceeding.", GetGuidelinesSchema, getGuidelines),
50
50
  defineTool("create_page", "Create a new page in Roam, optionally with markdown content." + GUIDELINES_NOTE, CreatePageSchema, createPage),
51
- defineTool("create_block", "Create a new block under a parent, using markdown content. Supports nested bulleted lists - pass a markdown string with `- ` list items and indentation to create an entire block hierarchy in a single call." + GUIDELINES_NOTE, CreateBlockSchema, createBlock),
51
+ defineTool("create_block", "Create blocks from markdown content. Target by parentUid, pageTitle, or dailyNotePage (page created if needed). Use nestUnder to insert under a specific child block. Supports nested bulleted lists via markdown indentation." + GUIDELINES_NOTE, CreateBlockSchema, createBlock),
52
52
  defineTool("update_block", "Update an existing block's content or properties." + GUIDELINES_NOTE, UpdateBlockSchema, updateBlock),
53
53
  defineTool("delete_block", "Delete a block and all its children." + GUIDELINES_NOTE, DeleteBlockSchema, deleteBlock),
54
54
  defineTool("move_block", "Move a block to a new location." + GUIDELINES_NOTE, MoveBlockSchema, moveBlock),
55
+ defineTool("add_comment", "Add a comment to a block (comment thread, NOT a child block). Prefer `comment` for simple text; use `commentMarkdown` for structured content. Same-day calls on the same block append to your existing comment." + GUIDELINES_NOTE, AddCommentSchema, addComment),
56
+ defineTool("get_comments", "Get comments on a block with author, timestamps, and edit info. If singleEditableUid is set, the comment can be edited with update_block. Only works for blocks, not pages." + GUIDELINES_NOTE, GetCommentsSchema, getComments),
55
57
  defineTool("delete_page", "Delete a page and all its contents." + GUIDELINES_NOTE, DeletePageSchema, deletePage),
56
58
  defineTool("update_page", "Update a page's title or children view type. Set mergePages to true if renaming to a title that already exists." + GUIDELINES_NOTE, UpdatePageSchema, updatePage),
57
- defineTool("search", "Search for pages and blocks by text. Returns paginated results with markdown content and optional breadcrumb paths." + GUIDELINES_NOTE, SearchSchema, search),
59
+ defineTool("search", "Search for pages and blocks by text. Returns paginated results with markdown content and optional breadcrumb paths. Call with an empty query to get recently edited and viewed content — useful for understanding what the user is currently working on." + GUIDELINES_NOTE, SearchSchema, search),
58
60
  defineTool("search_templates", "Search Roam templates by name. When the user mentions 'my X template' or 'the X template', use this tool to find it. Templates are user-created reusable content blocks tagged with [[roam/templates]]. Returns template name, uid, and content as markdown." + GUIDELINES_NOTE, SearchTemplatesSchema, searchTemplates),
59
61
  defineTool("roam_query", 'Execute a Roam query ({{query: }} or {{[[query]]: }} blocks, NOT Datalog). Two modes: (1) UID mode - pass a block UID containing a query component to run it with saved settings/filters; (2) Query mode - pass a raw query string like "{and: [[TODO]] {not: [[DONE]]}}". Returns paginated results with markdown content.' + GUIDELINES_NOTE, QuerySchema, query),
60
62
  defineTool("get_page", "Get a page's content as markdown. Returns content with <roam> metadata tags containing UIDs - use these for follow-up operations but strip them when showing content to the user. Show remaining content verbatim, never paraphrase. Use maxDepth for large pages." + GUIDELINES_NOTE, GetPageSchema, getPage),
package/dist/types.d.ts CHANGED
@@ -14,8 +14,8 @@ export declare const GraphConfigSchema: z.ZodObject<{
14
14
  accessLevel: z.ZodOptional<z.ZodEnum<["read-only", "read-append", "full"]>>;
15
15
  lastKnownTokenStatus: z.ZodOptional<z.ZodEnum<["active", "revoked"]>>;
16
16
  }, "strip", z.ZodTypeAny, {
17
- type: "hosted" | "offline";
18
17
  name: string;
18
+ type: "hosted" | "offline";
19
19
  token: string;
20
20
  nickname: string;
21
21
  accessLevel?: "read-only" | "read-append" | "full" | undefined;
@@ -39,8 +39,8 @@ export declare const RoamMcpConfigSchema: z.ZodObject<{
39
39
  accessLevel: z.ZodOptional<z.ZodEnum<["read-only", "read-append", "full"]>>;
40
40
  lastKnownTokenStatus: z.ZodOptional<z.ZodEnum<["active", "revoked"]>>;
41
41
  }, "strip", z.ZodTypeAny, {
42
- type: "hosted" | "offline";
43
42
  name: string;
43
+ type: "hosted" | "offline";
44
44
  token: string;
45
45
  nickname: string;
46
46
  accessLevel?: "read-only" | "read-append" | "full" | undefined;
@@ -55,8 +55,8 @@ export declare const RoamMcpConfigSchema: z.ZodObject<{
55
55
  }>, "many">;
56
56
  }, "strip", z.ZodTypeAny, {
57
57
  graphs: {
58
- type: "hosted" | "offline";
59
58
  name: string;
59
+ type: "hosted" | "offline";
60
60
  token: string;
61
61
  nickname: string;
62
62
  accessLevel?: "read-only" | "read-append" | "full" | undefined;
@@ -112,7 +112,7 @@ export declare class RoamError extends Error {
112
112
  constructor(message: string, code?: ErrorCode | undefined, context?: Record<string, unknown> | undefined);
113
113
  }
114
114
  export declare const CONFIG_VERSION = 1;
115
- export declare const EXPECTED_API_VERSION = "1.1.0";
115
+ export declare const EXPECTED_API_VERSION = "1.1.2";
116
116
  export interface RoamApiError {
117
117
  message: string;
118
118
  code?: string;
@@ -188,14 +188,64 @@ export interface SearchResult {
188
188
  type?: "page";
189
189
  }
190
190
  export interface SearchResponse {
191
+ queriedAt?: string;
191
192
  total: number;
192
193
  results: SearchResult[];
193
194
  }
195
+ export interface RecentlyOpenedBlock {
196
+ uid: string;
197
+ string: string;
198
+ openedAt: string;
199
+ path?: string;
200
+ }
201
+ export interface RecentlyOpenedItem {
202
+ uid: string;
203
+ title: string;
204
+ type: "page";
205
+ openedAt: string;
206
+ visitCount: number;
207
+ totalDurationMs: number;
208
+ currentlyOpen?: boolean;
209
+ blocks?: RecentlyOpenedBlock[];
210
+ }
211
+ export interface DailyNotePagesViewItem {
212
+ type: "dailyNotePagesView";
213
+ totalDurationMs: number;
214
+ currentlyOpen: boolean;
215
+ }
216
+ export interface RecentlyEditedPage {
217
+ uid: string;
218
+ title: string;
219
+ editedBy: string;
220
+ editedAt: string;
221
+ }
222
+ export interface SearchSuggestionsResponse {
223
+ queriedAt?: string;
224
+ suggestions: {
225
+ recentlyOpenedByUser: (RecentlyOpenedItem | DailyNotePagesViewItem)[];
226
+ recentlyEditedPages: RecentlyEditedPage[];
227
+ };
228
+ }
194
229
  export interface Template {
195
230
  name: string;
196
231
  uid: string;
197
232
  content: string;
198
233
  }
234
+ export interface SearchTemplatesResponse {
235
+ queriedAt?: string;
236
+ results: Template[];
237
+ }
238
+ export interface GetPageResponse {
239
+ uid: string;
240
+ markdown: string;
241
+ queriedAt: string;
242
+ }
243
+ export interface GetBlockResponse {
244
+ uid: string;
245
+ markdown: string;
246
+ path: string;
247
+ queriedAt: string;
248
+ }
199
249
  export interface QueryResult {
200
250
  uid: string;
201
251
  markdown: string;
@@ -203,6 +253,7 @@ export interface QueryResult {
203
253
  type?: "page";
204
254
  }
205
255
  export interface QueryResponse {
256
+ queriedAt?: string;
206
257
  total: number;
207
258
  results: QueryResult[];
208
259
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AACpG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,CAGzD;AAGD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,cAAc,CAE1E;AAGD,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,CAE3D;AAOD,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAG7C,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,aAAa,GAAG,MAAM,CAAC;AAM/D,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;EAS5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG9B,CAAC;AACH,MAAM,M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class RoamError extends Error {
81
81
  // so a newer version may write a config that an older version can't parse.
82
82
  // Bump this when the config schema changes in a breaking way.
83
83
  export const CONFIG_VERSION = 1;
84
- // API version this client expects (major.minor must match)
85
- export const EXPECTED_API_VERSION = "1.1.0";
84
+ // API version this client expects. Sent as `expectedApiVersion` in every request.
85
+ // Roam's compatibility check compares major.minor ONLY — patch is ignored.
86
+ // So 1.1.0, 1.1.1, 1.1.2 are all compatible; 1.1.x and 1.2.x are NOT.
87
+ //
88
+ // When to bump:
89
+ // - Patch bump on Roam side (e.g. 1.1.1 → 1.1.2): no change needed here, but
90
+ // you can bump for cosmetic alignment.
91
+ // - Minor bump on Roam side (e.g. 1.1.x → 1.2.0): MUST bump here too, or all
92
+ // requests will fail with VERSION_MISMATCH.
93
+ // - This is independent of the npm package version (0.x.y in package.json).
94
+ export const EXPECTED_API_VERSION = "1.1.2";
86
95
  // Helper to extract error message from RoamResponse
87
96
  export function getErrorMessage(error) {
88
97
  if (!error)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roam-research/roam-tools-core",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "description": "Core library for Roam Research tools",
5
5
  "repository": {
6
6
  "type": "git",