@tekmidian/devon 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +472 -0
  3. package/dist/index.d.ts +12 -0
  4. package/dist/index.js +82 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/jxa/escape.d.ts +22 -0
  7. package/dist/jxa/escape.js +38 -0
  8. package/dist/jxa/escape.js.map +1 -0
  9. package/dist/jxa/executor.d.ts +32 -0
  10. package/dist/jxa/executor.js +65 -0
  11. package/dist/jxa/executor.js.map +1 -0
  12. package/dist/jxa/helpers.d.ts +51 -0
  13. package/dist/jxa/helpers.js +136 -0
  14. package/dist/jxa/helpers.js.map +1 -0
  15. package/dist/jxa/types.d.ts +33 -0
  16. package/dist/jxa/types.js +43 -0
  17. package/dist/jxa/types.js.map +1 -0
  18. package/dist/server.d.ts +10 -0
  19. package/dist/server.js +65 -0
  20. package/dist/server.js.map +1 -0
  21. package/dist/setup.d.ts +12 -0
  22. package/dist/setup.js +323 -0
  23. package/dist/setup.js.map +1 -0
  24. package/dist/shared/plist/parser.d.ts +29 -0
  25. package/dist/shared/plist/parser.js +112 -0
  26. package/dist/shared/plist/parser.js.map +1 -0
  27. package/dist/shared/plist/reader.d.ts +31 -0
  28. package/dist/shared/plist/reader.js +127 -0
  29. package/dist/shared/plist/reader.js.map +1 -0
  30. package/dist/shared/shell.d.ts +15 -0
  31. package/dist/shared/shell.js +22 -0
  32. package/dist/shared/shell.js.map +1 -0
  33. package/dist/tools/ai/ask-ai-about-documents.d.ts +8 -0
  34. package/dist/tools/ai/ask-ai-about-documents.js +88 -0
  35. package/dist/tools/ai/ask-ai-about-documents.js.map +1 -0
  36. package/dist/tools/ai/check-ai-health.d.ts +8 -0
  37. package/dist/tools/ai/check-ai-health.js +40 -0
  38. package/dist/tools/ai/check-ai-health.js.map +1 -0
  39. package/dist/tools/ai/create-summary-document.d.ts +8 -0
  40. package/dist/tools/ai/create-summary-document.js +102 -0
  41. package/dist/tools/ai/create-summary-document.js.map +1 -0
  42. package/dist/tools/ai/get-ai-tool-documentation.d.ts +8 -0
  43. package/dist/tools/ai/get-ai-tool-documentation.js +220 -0
  44. package/dist/tools/ai/get-ai-tool-documentation.js.map +1 -0
  45. package/dist/tools/application/is-running.d.ts +7 -0
  46. package/dist/tools/application/is-running.js +24 -0
  47. package/dist/tools/application/is-running.js.map +1 -0
  48. package/dist/tools/custom/column-layout.d.ts +9 -0
  49. package/dist/tools/custom/column-layout.js +244 -0
  50. package/dist/tools/custom/column-layout.js.map +1 -0
  51. package/dist/tools/custom/list-smart-groups.d.ts +8 -0
  52. package/dist/tools/custom/list-smart-groups.js +79 -0
  53. package/dist/tools/custom/list-smart-groups.js.map +1 -0
  54. package/dist/tools/custom/list-smart-rules.d.ts +8 -0
  55. package/dist/tools/custom/list-smart-rules.js +85 -0
  56. package/dist/tools/custom/list-smart-rules.js.map +1 -0
  57. package/dist/tools/custom/parse-eml-headers.d.ts +8 -0
  58. package/dist/tools/custom/parse-eml-headers.js +155 -0
  59. package/dist/tools/custom/parse-eml-headers.js.map +1 -0
  60. package/dist/tools/database/get-current-database.d.ts +7 -0
  61. package/dist/tools/database/get-current-database.js +29 -0
  62. package/dist/tools/database/get-current-database.js.map +1 -0
  63. package/dist/tools/database/get-open-databases.d.ts +6 -0
  64. package/dist/tools/database/get-open-databases.js +32 -0
  65. package/dist/tools/database/get-open-databases.js.map +1 -0
  66. package/dist/tools/groups/get-selected-records.d.ts +8 -0
  67. package/dist/tools/groups/get-selected-records.js +30 -0
  68. package/dist/tools/groups/get-selected-records.js.map +1 -0
  69. package/dist/tools/groups/list-group-content.d.ts +8 -0
  70. package/dist/tools/groups/list-group-content.js +65 -0
  71. package/dist/tools/groups/list-group-content.js.map +1 -0
  72. package/dist/tools/index.d.ts +9 -0
  73. package/dist/tools/index.js +87 -0
  74. package/dist/tools/index.js.map +1 -0
  75. package/dist/tools/intelligence/classify.d.ts +8 -0
  76. package/dist/tools/intelligence/classify.js +83 -0
  77. package/dist/tools/intelligence/classify.js.map +1 -0
  78. package/dist/tools/intelligence/compare.d.ts +8 -0
  79. package/dist/tools/intelligence/compare.js +121 -0
  80. package/dist/tools/intelligence/compare.js.map +1 -0
  81. package/dist/tools/records/convert-record.d.ts +10 -0
  82. package/dist/tools/records/convert-record.js +77 -0
  83. package/dist/tools/records/convert-record.js.map +1 -0
  84. package/dist/tools/records/create-record.d.ts +8 -0
  85. package/dist/tools/records/create-record.js +64 -0
  86. package/dist/tools/records/create-record.js.map +1 -0
  87. package/dist/tools/records/delete-record.d.ts +9 -0
  88. package/dist/tools/records/delete-record.js +50 -0
  89. package/dist/tools/records/delete-record.js.map +1 -0
  90. package/dist/tools/records/duplicate-record.d.ts +8 -0
  91. package/dist/tools/records/duplicate-record.js +53 -0
  92. package/dist/tools/records/duplicate-record.js.map +1 -0
  93. package/dist/tools/records/get-record-by-id.d.ts +8 -0
  94. package/dist/tools/records/get-record-by-id.js +51 -0
  95. package/dist/tools/records/get-record-by-id.js.map +1 -0
  96. package/dist/tools/records/get-record-content.d.ts +7 -0
  97. package/dist/tools/records/get-record-content.js +48 -0
  98. package/dist/tools/records/get-record-content.js.map +1 -0
  99. package/dist/tools/records/get-record-properties.d.ts +7 -0
  100. package/dist/tools/records/get-record-properties.js +42 -0
  101. package/dist/tools/records/get-record-properties.js.map +1 -0
  102. package/dist/tools/records/move-record.d.ts +8 -0
  103. package/dist/tools/records/move-record.js +60 -0
  104. package/dist/tools/records/move-record.js.map +1 -0
  105. package/dist/tools/records/rename-record.d.ts +7 -0
  106. package/dist/tools/records/rename-record.js +40 -0
  107. package/dist/tools/records/rename-record.js.map +1 -0
  108. package/dist/tools/records/replicate-record.d.ts +8 -0
  109. package/dist/tools/records/replicate-record.js +53 -0
  110. package/dist/tools/records/replicate-record.js.map +1 -0
  111. package/dist/tools/records/set-record-properties.d.ts +10 -0
  112. package/dist/tools/records/set-record-properties.js +76 -0
  113. package/dist/tools/records/set-record-properties.js.map +1 -0
  114. package/dist/tools/records/update-record-content.d.ts +7 -0
  115. package/dist/tools/records/update-record-content.js +43 -0
  116. package/dist/tools/records/update-record-content.js.map +1 -0
  117. package/dist/tools/search/lookup-record.d.ts +7 -0
  118. package/dist/tools/search/lookup-record.js +160 -0
  119. package/dist/tools/search/lookup-record.js.map +1 -0
  120. package/dist/tools/search/search.d.ts +8 -0
  121. package/dist/tools/search/search.js +146 -0
  122. package/dist/tools/search/search.js.map +1 -0
  123. package/dist/tools/tags/add-tags.d.ts +7 -0
  124. package/dist/tools/tags/add-tags.js +47 -0
  125. package/dist/tools/tags/add-tags.js.map +1 -0
  126. package/dist/tools/tags/remove-tags.d.ts +7 -0
  127. package/dist/tools/tags/remove-tags.js +53 -0
  128. package/dist/tools/tags/remove-tags.js.map +1 -0
  129. package/dist/tools/web/create-from-url.d.ts +8 -0
  130. package/dist/tools/web/create-from-url.js +140 -0
  131. package/dist/tools/web/create-from-url.js.map +1 -0
  132. package/package.json +48 -0
@@ -0,0 +1,15 @@
1
+ /**
2
+ * shell.ts — Shell utilities shared across tools.
3
+ */
4
+ /**
5
+ * Shell-quote a string by wrapping in single quotes and escaping embedded single quotes.
6
+ */
7
+ export declare function shellQuote(s: string): string;
8
+ /**
9
+ * Execute a shell command with timeout and encoding defaults.
10
+ * Returns trimmed stdout. Throws on non-zero exit.
11
+ */
12
+ export declare function execSyncWithTimeout(command: string, opts?: {
13
+ timeout?: number;
14
+ maxBuffer?: number;
15
+ }): string;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * shell.ts — Shell utilities shared across tools.
3
+ */
4
+ import { execSync } from "node:child_process";
5
+ /**
6
+ * Shell-quote a string by wrapping in single quotes and escaping embedded single quotes.
7
+ */
8
+ export function shellQuote(s) {
9
+ return `'${s.replace(/'/g, "'\\''")}'`;
10
+ }
11
+ /**
12
+ * Execute a shell command with timeout and encoding defaults.
13
+ * Returns trimmed stdout. Throws on non-zero exit.
14
+ */
15
+ export function execSyncWithTimeout(command, opts) {
16
+ return execSync(command, {
17
+ encoding: "utf-8",
18
+ timeout: opts?.timeout ?? 10_000,
19
+ maxBuffer: opts?.maxBuffer ?? 50 * 1024 * 1024,
20
+ }).trim();
21
+ }
22
+ //# sourceMappingURL=shell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/shared/shell.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,CAAS;IAClC,OAAO,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC;AACzC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAe,EACf,IAA+C;IAE/C,OAAO,QAAQ,CAAC,OAAO,EAAE;QACvB,QAAQ,EAAE,OAAO;QACjB,OAAO,EAAE,IAAI,EAAE,OAAO,IAAI,MAAM;QAChC,SAAS,EAAE,IAAI,EAAE,SAAS,IAAI,EAAE,GAAG,IAAI,GAAG,IAAI;KAC/C,CAAC,CAAC,IAAI,EAAE,CAAC;AACZ,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * ask-ai-about-documents.ts — Ask DEVONthink's AI a question about specific documents.
3
+ *
4
+ * Resolves each UUID to a DEVONthink record and passes them to DEVONthink's
5
+ * built-in AI feature along with the user's question. Supports optional engine,
6
+ * model, and temperature overrides. Returns the AI-generated answer string.
7
+ */
8
+ export declare const askAiAboutDocumentsTool: import("../../jxa/types.js").McpTool;
@@ -0,0 +1,88 @@
1
+ /**
2
+ * ask-ai-about-documents.ts — Ask DEVONthink's AI a question about specific documents.
3
+ *
4
+ * Resolves each UUID to a DEVONthink record and passes them to DEVONthink's
5
+ * built-in AI feature along with the user's question. Supports optional engine,
6
+ * model, and temperature overrides. Returns the AI-generated answer string.
7
+ */
8
+ import { z } from "zod";
9
+ import { defineTool } from "../../jxa/types.js";
10
+ import { jxaLiteral } from "../../jxa/escape.js";
11
+ import { JXA_APP } from "../../jxa/helpers.js";
12
+ const ENGINE_VALUES = [
13
+ "ChatGPT",
14
+ "Claude",
15
+ "Gemini",
16
+ "Mistral AI",
17
+ "GPT4All",
18
+ "LM Studio",
19
+ "Ollama",
20
+ ];
21
+ export const askAiAboutDocumentsTool = defineTool({
22
+ name: "ask_ai_about_documents",
23
+ description: "Ask AI questions about specific DEVONthink documents for analysis, comparison, or extraction.",
24
+ schema: z.object({
25
+ documentUuids: z
26
+ .array(z.string())
27
+ .min(1)
28
+ .describe("One or more DEVONthink record UUIDs to use as context for the AI question"),
29
+ question: z
30
+ .string()
31
+ .min(1)
32
+ .max(10000)
33
+ .describe("The question or instruction to send to the AI about the documents"),
34
+ temperature: z
35
+ .number()
36
+ .min(0)
37
+ .max(2)
38
+ .default(0.7)
39
+ .optional()
40
+ .describe("Sampling temperature for the AI response (0 = deterministic, 2 = creative). Defaults to 0.7"),
41
+ model: z
42
+ .string()
43
+ .optional()
44
+ .describe("Optional AI model name to use (e.g. 'gpt-4o', 'claude-3-5-sonnet'). Uses DEVONthink default if omitted"),
45
+ engine: z
46
+ .enum(ENGINE_VALUES)
47
+ .optional()
48
+ .describe("Optional AI engine to use. Uses DEVONthink's configured default if omitted"),
49
+ }),
50
+ run: async (args, executor) => {
51
+ const { documentUuids, question, temperature, model, engine } = args;
52
+ const script = `
53
+ ${JXA_APP}
54
+ var uuids = ${jxaLiteral(documentUuids)};
55
+ var question = ${jxaLiteral(question)};
56
+ var temperature = ${jxaLiteral(temperature ?? 0.7)};
57
+ var modelName = ${jxaLiteral(model ?? null)};
58
+ var engineName = ${jxaLiteral(engine ?? null)};
59
+
60
+ // Resolve each UUID to a DEVONthink record
61
+ var records = [];
62
+ for (var i = 0; i < uuids.length; i++) {
63
+ var rec = app.getRecordWithUuid(uuids[i]);
64
+ if (!rec || !rec.uuid()) {
65
+ throw new Error("Record not found for UUID: " + uuids[i]);
66
+ }
67
+ records.push(rec);
68
+ }
69
+
70
+ // Build AI call options
71
+ var aiOpts = { record: records, temperature: temperature };
72
+ if (engineName) aiOpts["engine"] = engineName;
73
+ if (modelName) aiOpts["model"] = modelName;
74
+
75
+ // Call DEVONthink's AI
76
+ var answer = app.getChatResponseForMessage(question, aiOpts);
77
+
78
+ JSON.stringify({
79
+ answer: answer || null,
80
+ documentCount: records.length,
81
+ question: question
82
+ });
83
+ `;
84
+ const result = executor.run(script);
85
+ return JSON.parse(result.stdout);
86
+ },
87
+ });
88
+ //# sourceMappingURL=ask-ai-about-documents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ask-ai-about-documents.js","sourceRoot":"","sources":["../../../src/tools/ai/ask-ai-about-documents.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,MAAM,aAAa,GAAG;IACpB,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,YAAY;IACZ,SAAS;IACT,WAAW;IACX,QAAQ;CACA,CAAC;AAEX,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAAC;IAChD,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EACT,+FAA+F;IACjG,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,aAAa,EAAE,CAAC;aACb,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;aACjB,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CAAC,2EAA2E,CAAC;QACxF,QAAQ,EAAE,CAAC;aACR,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,GAAG,CAAC,KAAK,CAAC;aACV,QAAQ,CAAC,mEAAmE,CAAC;QAChF,WAAW,EAAE,CAAC;aACX,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,GAAG,CAAC,CAAC,CAAC;aACN,OAAO,CAAC,GAAG,CAAC;aACZ,QAAQ,EAAE;aACV,QAAQ,CAAC,6FAA6F,CAAC;QAC1G,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,wGAAwG,CAAC;QACrH,MAAM,EAAE,CAAC;aACN,IAAI,CAAC,aAAa,CAAC;aACnB,QAAQ,EAAE;aACV,QAAQ,CAAC,4EAA4E,CAAC;KAC1F,CAAC;IACF,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;QAC5B,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAErE,MAAM,MAAM,GAAG;QACX,OAAO;oBACK,UAAU,CAAC,aAAa,CAAC;uBACtB,UAAU,CAAC,QAAQ,CAAC;0BACjB,UAAU,CAAC,WAAW,IAAI,GAAG,CAAC;wBAChC,UAAU,CAAC,KAAK,IAAI,IAAI,CAAC;yBACxB,UAAU,CAAC,MAAM,IAAI,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;KAyB9C,CAAC;QAEF,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAI9B,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * check-ai-health.ts — Check if DEVONthink's AI services are available.
3
+ *
4
+ * Probes DEVONthink AI by attempting a lightweight operation. Returns a
5
+ * structured availability report with a human-readable message so callers
6
+ * can decide whether to proceed with more expensive AI tool calls.
7
+ */
8
+ export declare const checkAiHealthTool: import("../../jxa/types.js").McpTool;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * check-ai-health.ts — Check if DEVONthink's AI services are available.
3
+ *
4
+ * Probes DEVONthink AI by attempting a lightweight operation. Returns a
5
+ * structured availability report with a human-readable message so callers
6
+ * can decide whether to proceed with more expensive AI tool calls.
7
+ */
8
+ import { z } from "zod";
9
+ import { defineTool } from "../../jxa/types.js";
10
+ import { JXA_APP } from "../../jxa/helpers.js";
11
+ export const checkAiHealthTool = defineTool({
12
+ name: "check_ai_health",
13
+ description: "Check if DEVONthink's AI services are available and working properly.",
14
+ schema: z.object({}),
15
+ run: async (_args, executor) => {
16
+ const script = `
17
+ ${JXA_APP}
18
+
19
+ var available = false;
20
+ var message = "";
21
+ var model = null;
22
+
23
+ try {
24
+ // Attempt a lightweight AI probe: ask a trivial question with no documents.
25
+ // DEVONthink will throw if the AI engine is unavailable or misconfigured.
26
+ var testAnswer = app.getChatResponseForMessage("Reply with the single word: OK", { temperature: 0 });
27
+ available = true;
28
+ message = "DEVONthink AI is available and responding.";
29
+ } catch (e) {
30
+ available = false;
31
+ message = e.message || String(e);
32
+ }
33
+
34
+ JSON.stringify({ available: available, message: message, model: model });
35
+ `;
36
+ const result = executor.run(script);
37
+ return JSON.parse(result.stdout);
38
+ },
39
+ });
40
+ //# sourceMappingURL=check-ai-health.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-ai-health.js","sourceRoot":"","sources":["../../../src/tools/ai/check-ai-health.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAC;IAC1C,IAAI,EAAE,iBAAiB;IACvB,WAAW,EACT,uEAAuE;IACzE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IACpB,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;QAC7B,MAAM,MAAM,GAAG;QACX,OAAO;;;;;;;;;;;;;;;;;;KAkBV,CAAC;QAEF,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAI9B,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * create-summary-document.ts — Create an AI-generated summary document in DEVONthink.
3
+ *
4
+ * Resolves source documents by UUID, invokes DEVONthink's AI summarization,
5
+ * and stores the result as a new record. The destination group and title are
6
+ * optional; sensible defaults are applied when they are omitted.
7
+ */
8
+ export declare const createSummaryDocumentTool: import("../../jxa/types.js").McpTool;
@@ -0,0 +1,102 @@
1
+ /**
2
+ * create-summary-document.ts — Create an AI-generated summary document in DEVONthink.
3
+ *
4
+ * Resolves source documents by UUID, invokes DEVONthink's AI summarization,
5
+ * and stores the result as a new record. The destination group and title are
6
+ * optional; sensible defaults are applied when they are omitted.
7
+ */
8
+ import { z } from "zod";
9
+ import { defineTool } from "../../jxa/types.js";
10
+ import { jxaLiteral } from "../../jxa/escape.js";
11
+ import { JXA_APP, JXA_RECORD_PROPS } from "../../jxa/helpers.js";
12
+ const SUMMARY_TYPE_VALUES = ["markdown", "rich", "sheet", "simple"];
13
+ const SUMMARY_STYLE_VALUES = [
14
+ "text summary",
15
+ "key points summary",
16
+ "list summary",
17
+ "table summary",
18
+ "custom summary",
19
+ ];
20
+ export const createSummaryDocumentTool = defineTool({
21
+ name: "create_summary_document",
22
+ description: "Create an AI-generated summary document from multiple DEVONthink documents.",
23
+ schema: z.object({
24
+ documentUuids: z
25
+ .array(z.string())
26
+ .min(1)
27
+ .describe("UUIDs of the source DEVONthink records to summarize"),
28
+ summaryType: z
29
+ .enum(SUMMARY_TYPE_VALUES)
30
+ .default("markdown")
31
+ .optional()
32
+ .describe("Output format for the summary document. " +
33
+ "One of: markdown, rich, sheet, simple. Defaults to markdown"),
34
+ summaryStyle: z
35
+ .enum(SUMMARY_STYLE_VALUES)
36
+ .optional()
37
+ .describe("Style of summary to generate. " +
38
+ "One of: text summary, key points summary, list summary, table summary, custom summary"),
39
+ parentGroupUuid: z
40
+ .string()
41
+ .optional()
42
+ .describe("UUID of the group where the summary document should be created. " +
43
+ "If omitted, the summary is placed in the same group as the first source record"),
44
+ customTitle: z
45
+ .string()
46
+ .optional()
47
+ .describe("Title for the new summary record. Defaults to 'Summary - <ISO date>' if omitted"),
48
+ }),
49
+ run: async (args, executor) => {
50
+ const { documentUuids, summaryType, summaryStyle, parentGroupUuid, customTitle } = args;
51
+ const script = `
52
+ ${JXA_APP}
53
+ var uuids = ${jxaLiteral(documentUuids)};
54
+ var summaryType = ${jxaLiteral(summaryType ?? "markdown")};
55
+ var summaryStyle = ${jxaLiteral(summaryStyle ?? null)};
56
+ var parentGroupUuid = ${jxaLiteral(parentGroupUuid ?? null)};
57
+ var customTitle = ${jxaLiteral(customTitle ?? null)};
58
+
59
+ // Resolve source records
60
+ var records = [];
61
+ for (var i = 0; i < uuids.length; i++) {
62
+ var rec = app.getRecordWithUuid(uuids[i]);
63
+ if (!rec || !rec.uuid()) {
64
+ throw new Error("Record not found for UUID: " + uuids[i]);
65
+ }
66
+ records.push(rec);
67
+ }
68
+
69
+ // Resolve destination group
70
+ var parentGroup = null;
71
+ if (parentGroupUuid) {
72
+ parentGroup = app.getRecordWithUuid(parentGroupUuid);
73
+ if (!parentGroup || !parentGroup.uuid()) {
74
+ throw new Error("Parent group not found for UUID: " + parentGroupUuid);
75
+ }
76
+ } else {
77
+ // Default: same group as the first source record
78
+ parentGroup = records[0].parent();
79
+ }
80
+
81
+ // Build summarization options
82
+ var summarizeOpts = {
83
+ records: records,
84
+ to: summaryType,
85
+ in: parentGroup
86
+ };
87
+ if (summaryStyle) summarizeOpts["as"] = summaryStyle;
88
+
89
+ // Call DEVONthink's AI summarization
90
+ var summaryRecord = app.summarizeContentsOf(summarizeOpts);
91
+ if (!summaryRecord || !summaryRecord.uuid()) {
92
+ throw new Error("DEVONthink did not return a summary record");
93
+ }
94
+
95
+ var record = summaryRecord;
96
+ JSON.stringify(${JXA_RECORD_PROPS});
97
+ `;
98
+ const result = executor.run(script);
99
+ return JSON.parse(result.stdout);
100
+ },
101
+ });
102
+ //# sourceMappingURL=create-summary-document.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-summary-document.js","sourceRoot":"","sources":["../../../src/tools/ai/create-summary-document.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,MAAM,mBAAmB,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAU,CAAC;AAE7E,MAAM,oBAAoB,GAAG;IAC3B,cAAc;IACd,oBAAoB;IACpB,cAAc;IACd,eAAe;IACf,gBAAgB;CACR,CAAC;AAEX,MAAM,CAAC,MAAM,yBAAyB,GAAG,UAAU,CAAC;IAClD,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EACT,6EAA6E;IAC/E,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,aAAa,EAAE,CAAC;aACb,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;aACjB,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CAAC,qDAAqD,CAAC;QAClE,WAAW,EAAE,CAAC;aACX,IAAI,CAAC,mBAAmB,CAAC;aACzB,OAAO,CAAC,UAAU,CAAC;aACnB,QAAQ,EAAE;aACV,QAAQ,CACP,0CAA0C;YAC1C,6DAA6D,CAC9D;QACH,YAAY,EAAE,CAAC;aACZ,IAAI,CAAC,oBAAoB,CAAC;aAC1B,QAAQ,EAAE;aACV,QAAQ,CACP,gCAAgC;YAChC,uFAAuF,CACxF;QACH,eAAe,EAAE,CAAC;aACf,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,kEAAkE;YAClE,gFAAgF,CACjF;QACH,WAAW,EAAE,CAAC;aACX,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,iFAAiF,CAClF;KACJ,CAAC;IACF,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;QAC5B,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;QAExF,MAAM,MAAM,GAAG;QACX,OAAO;oBACK,UAAU,CAAC,aAAa,CAAC;0BACnB,UAAU,CAAC,WAAW,IAAI,UAAU,CAAC;2BACpC,UAAU,CAAC,YAAY,IAAI,IAAI,CAAC;8BAC7B,UAAU,CAAC,eAAe,IAAI,IAAI,CAAC;0BACvC,UAAU,CAAC,WAAW,IAAI,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAuClC,gBAAgB;KAClC,CAAC;QAEF,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * get-ai-tool-documentation.ts — Return documentation for DEVONthink AI tools.
3
+ *
4
+ * This is a pure TypeScript tool with no JXA execution. It serves embedded
5
+ * documentation for the four AI tools so that the AI assistant can understand
6
+ * how to use them effectively before making calls.
7
+ */
8
+ export declare const getAiToolDocumentationTool: import("../../jxa/types.js").McpTool;
@@ -0,0 +1,220 @@
1
+ /**
2
+ * get-ai-tool-documentation.ts — Return documentation for DEVONthink AI tools.
3
+ *
4
+ * This is a pure TypeScript tool with no JXA execution. It serves embedded
5
+ * documentation for the four AI tools so that the AI assistant can understand
6
+ * how to use them effectively before making calls.
7
+ */
8
+ import { z } from "zod";
9
+ import { defineTool } from "../../jxa/types.js";
10
+ const AI_TOOL_DOCS = {
11
+ get_ai_tool_documentation: {
12
+ name: "get_ai_tool_documentation",
13
+ description: "Returns detailed documentation, parameter descriptions, usage examples, and " +
14
+ "notes for any of the four DEVONthink AI tools. Call this tool first if you are " +
15
+ "unsure how to use ask_ai_about_documents, check_ai_health, or create_summary_document.",
16
+ parameters: [
17
+ {
18
+ name: "toolName",
19
+ type: "string (enum)",
20
+ required: false,
21
+ description: "Optional. One of: get_ai_tool_documentation, check_ai_health, " +
22
+ "ask_ai_about_documents, create_summary_document. " +
23
+ "If omitted, documentation for all four tools is returned.",
24
+ },
25
+ ],
26
+ returns: "A documentation object (or array of documentation objects) describing " +
27
+ "each requested AI tool — including its parameters, return shape, usage examples, and tips.",
28
+ examples: [
29
+ {
30
+ description: "Get documentation for all AI tools",
31
+ input: {},
32
+ },
33
+ {
34
+ description: "Get documentation for a specific tool",
35
+ input: { toolName: "ask_ai_about_documents" },
36
+ },
37
+ ],
38
+ notes: [
39
+ "This tool itself has no side-effects and does not call DEVONthink.",
40
+ "Use this before calling AI tools for the first time in a session.",
41
+ ],
42
+ },
43
+ check_ai_health: {
44
+ name: "check_ai_health",
45
+ description: "Verifies that DEVONthink's built-in AI features are available and responding. " +
46
+ "Call this before any AI-intensive operations to confirm the AI engine is ready.",
47
+ parameters: [],
48
+ returns: "An object with fields: { available: boolean, model?: string, error?: string }. " +
49
+ "`available` is true when DEVONthink AI is ready to process requests. " +
50
+ "`model` reports the active AI model name when available.",
51
+ examples: [
52
+ {
53
+ description: "Check if AI is available before summarising a document",
54
+ input: {},
55
+ },
56
+ ],
57
+ notes: [
58
+ "DEVONthink AI requires an active network connection and a valid subscription.",
59
+ "If `available` is false, inspect the `error` field for the reason.",
60
+ "The check adds minimal latency and is safe to call frequently.",
61
+ ],
62
+ },
63
+ ask_ai_about_documents: {
64
+ name: "ask_ai_about_documents",
65
+ description: "Sends a natural-language question to DEVONthink AI with one or more documents " +
66
+ "as context. The AI reads the document content and returns an answer grounded in " +
67
+ "those documents. Ideal for summarisation, extraction, comparison, and Q&A tasks.",
68
+ parameters: [
69
+ {
70
+ name: "question",
71
+ type: "string",
72
+ required: true,
73
+ description: "The question or instruction to send to the AI. Be specific: " +
74
+ "'Summarise the key findings' or 'List all action items mentioned'.",
75
+ },
76
+ {
77
+ name: "uuids",
78
+ type: "string[]",
79
+ required: true,
80
+ description: "Array of DEVONthink record UUIDs to include as context. " +
81
+ "Use search or get_record_properties to obtain UUIDs first.",
82
+ },
83
+ {
84
+ name: "database",
85
+ type: "string",
86
+ required: false,
87
+ description: "Optional database name to scope the lookup. If omitted, all open databases are searched.",
88
+ },
89
+ ],
90
+ returns: "An object with fields: { answer: string, tokensUsed?: number, error?: string }. " +
91
+ "`answer` contains the AI-generated response. `tokensUsed` is the approximate " +
92
+ "token count consumed by the request.",
93
+ examples: [
94
+ {
95
+ description: "Summarise a single document",
96
+ input: {
97
+ question: "Summarise this document in three bullet points.",
98
+ uuids: ["A1B2C3D4-..."],
99
+ },
100
+ },
101
+ {
102
+ description: "Compare two contracts",
103
+ input: {
104
+ question: "What are the key differences between these two contracts?",
105
+ uuids: ["UUID-contract-a", "UUID-contract-b"],
106
+ database: "Legal",
107
+ },
108
+ },
109
+ {
110
+ description: "Extract action items",
111
+ input: {
112
+ question: "List every action item and its owner from these meeting notes.",
113
+ uuids: ["UUID-meeting-2026-01", "UUID-meeting-2026-02"],
114
+ },
115
+ },
116
+ ],
117
+ notes: [
118
+ "Each UUID must refer to a record in an open database.",
119
+ "Very large documents may be truncated to fit the AI context window.",
120
+ "Token limits apply — avoid including more than 5-10 large documents at once.",
121
+ "check_ai_health first if you encounter repeated failures.",
122
+ ],
123
+ },
124
+ create_summary_document: {
125
+ name: "create_summary_document",
126
+ description: "Generates a new DEVONthink document containing an AI-written summary of one or " +
127
+ "more source records. The summary is saved as a new Markdown or plain-text record " +
128
+ "in the specified group or database, leaving the originals untouched.",
129
+ parameters: [
130
+ {
131
+ name: "uuids",
132
+ type: "string[]",
133
+ required: true,
134
+ description: "Array of DEVONthink record UUIDs to summarise. " +
135
+ "Use search or get_record_properties to obtain UUIDs first.",
136
+ },
137
+ {
138
+ name: "prompt",
139
+ type: "string",
140
+ required: false,
141
+ description: "Optional custom instruction for the AI, e.g. 'Focus on the financial data only'. " +
142
+ "If omitted, a standard summarisation prompt is used.",
143
+ },
144
+ {
145
+ name: "destinationUuid",
146
+ type: "string",
147
+ required: false,
148
+ description: "UUID of the DEVONthink group where the summary document should be created. " +
149
+ "If omitted, the summary is created in the same group as the first source record.",
150
+ },
151
+ {
152
+ name: "title",
153
+ type: "string",
154
+ required: false,
155
+ description: "Title for the new summary record. Defaults to 'Summary - <date>'.",
156
+ },
157
+ ],
158
+ returns: "An object with fields: { success: boolean, uuid?: string, name?: string, error?: string }. " +
159
+ "`uuid` and `name` identify the newly created summary record.",
160
+ examples: [
161
+ {
162
+ description: "Summarise a single report",
163
+ input: {
164
+ uuids: ["UUID-annual-report-2025"],
165
+ title: "Annual Report 2025 - Summary",
166
+ },
167
+ },
168
+ {
169
+ description: "Create a focused summary in a specific group",
170
+ input: {
171
+ uuids: ["UUID-doc-a", "UUID-doc-b", "UUID-doc-c"],
172
+ prompt: "Extract only the risk factors and mitigation strategies.",
173
+ destinationUuid: "UUID-risk-analysis-group",
174
+ title: "Risk Factor Summary",
175
+ },
176
+ },
177
+ ],
178
+ notes: [
179
+ "The new summary record is created immediately; the AI generation is synchronous.",
180
+ "For very long source documents, the AI may only see a truncated excerpt.",
181
+ "The summary is saved as Markdown by default.",
182
+ "Use check_ai_health if the call fails without a clear error.",
183
+ ],
184
+ },
185
+ };
186
+ // ---------------------------------------------------------------------------
187
+ // Tool definition
188
+ // ---------------------------------------------------------------------------
189
+ const AI_TOOL_NAMES = [
190
+ "get_ai_tool_documentation",
191
+ "check_ai_health",
192
+ "ask_ai_about_documents",
193
+ "create_summary_document",
194
+ ];
195
+ export const getAiToolDocumentationTool = defineTool({
196
+ name: "get_ai_tool_documentation",
197
+ description: "Get detailed documentation for DEVONthink AI tools including examples and use cases. " +
198
+ "Optionally specify a toolName to get docs for a single tool; omit to get docs for all four.",
199
+ schema: z.object({
200
+ toolName: z
201
+ .enum(AI_TOOL_NAMES)
202
+ .optional()
203
+ .describe("Optional name of the specific AI tool to document. " +
204
+ "One of: get_ai_tool_documentation, check_ai_health, " +
205
+ "ask_ai_about_documents, create_summary_document."),
206
+ }),
207
+ run: async (args, _executor) => {
208
+ const { toolName } = args;
209
+ if (toolName) {
210
+ const doc = AI_TOOL_DOCS[toolName];
211
+ if (!doc) {
212
+ return { error: `No documentation found for tool: ${toolName}` };
213
+ }
214
+ return doc;
215
+ }
216
+ // Return all tool docs as an array
217
+ return AI_TOOL_NAMES.map((name) => AI_TOOL_DOCS[name]);
218
+ },
219
+ });
220
+ //# sourceMappingURL=get-ai-tool-documentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-ai-tool-documentation.js","sourceRoot":"","sources":["../../../src/tools/ai/get-ai-tool-documentation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAuBhD,MAAM,YAAY,GAA4B;IAC5C,yBAAyB,EAAE;QACzB,IAAI,EAAE,2BAA2B;QACjC,WAAW,EACT,8EAA8E;YAC9E,iFAAiF;YACjF,wFAAwF;QAC1F,UAAU,EAAE;YACV;gBACE,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,eAAe;gBACrB,QAAQ,EAAE,KAAK;gBACf,WAAW,EACT,gEAAgE;oBAChE,mDAAmD;oBACnD,2DAA2D;aAC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,CAAC,IAAI,CAAC,CAAC,CAAC;IACzD,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * is-running.ts — Check whether the DEVONthink application is currently running.
3
+ *
4
+ * Uses System Events to query the process list, which avoids launching DEVONthink
5
+ * as a side-effect. Checks for both "DEVONthink 3" (v3.x) and "DEVONthink" (v4.x).
6
+ */
7
+ export declare const isRunningTool: import("../../jxa/types.js").McpTool;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * is-running.ts — Check whether the DEVONthink application is currently running.
3
+ *
4
+ * Uses System Events to query the process list, which avoids launching DEVONthink
5
+ * as a side-effect. Checks for both "DEVONthink 3" (v3.x) and "DEVONthink" (v4.x).
6
+ */
7
+ import { z } from "zod";
8
+ import { defineTool } from "../../jxa/types.js";
9
+ export const isRunningTool = defineTool({
10
+ name: "is_running",
11
+ description: "Check if the DEVONthink application is currently running.",
12
+ schema: z.object({}),
13
+ run: async (_args, executor) => {
14
+ const script = `
15
+ var se = Application("System Events");
16
+ var v3 = se.processes.whose({ name: "DEVONthink 3" }).length > 0;
17
+ var v4 = se.processes.whose({ name: "DEVONthink" }).length > 0;
18
+ JSON.stringify({ running: v3 || v4 });
19
+ `.trim();
20
+ const { stdout } = executor.run(script);
21
+ return JSON.parse(stdout);
22
+ },
23
+ });
24
+ //# sourceMappingURL=is-running.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-running.js","sourceRoot":"","sources":["../../../src/tools/application/is-running.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC;IACtC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,2DAA2D;IACxE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IACpB,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;QAC7B,MAAM,MAAM,GAAG;;;;;CAKlB,CAAC,IAAI,EAAE,CAAC;QAEL,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAyB,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * column-layout.ts — Read and copy DEVONthink column layouts for smart groups/rules.
3
+ *
4
+ * Column layouts are stored in ~/Library/Preferences/com.devon-technologies.think.plist
5
+ * under three related keys per smart group or rule.
6
+ */
7
+ import type { McpTool } from "../../jxa/types.js";
8
+ export declare const getColumnLayoutTool: McpTool;
9
+ export declare const copyColumnLayoutTool: McpTool;