@revealui/ai 0.2.7 → 0.2.9

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 (220) hide show
  1. package/LICENSE +104 -17
  2. package/README.md +2 -2
  3. package/dist/a2a/card.d.ts +1 -1
  4. package/dist/a2a/card.d.ts.map +1 -1
  5. package/dist/a2a/card.js +4 -4
  6. package/dist/a2a/handler.d.ts +4 -4
  7. package/dist/a2a/handler.js +5 -5
  8. package/dist/a2a/index.d.ts +1 -1
  9. package/dist/a2a/index.js +1 -1
  10. package/dist/audit/emitter.d.ts +1 -1
  11. package/dist/audit/emitter.js +2 -2
  12. package/dist/audit/index.d.ts +2 -2
  13. package/dist/audit/index.js +2 -2
  14. package/dist/audit/store.d.ts +2 -2
  15. package/dist/audit/store.js +2 -2
  16. package/dist/client/errors.d.ts +13 -0
  17. package/dist/client/errors.d.ts.map +1 -0
  18. package/dist/client/errors.js +28 -0
  19. package/dist/client/hooks/useAgentContext.d.ts.map +1 -1
  20. package/dist/client/hooks/useAgentContext.js +6 -5
  21. package/dist/client/hooks/useAgentStream.d.ts +2 -2
  22. package/dist/client/hooks/useAgentStream.js +3 -3
  23. package/dist/client/hooks/useEpisodicMemory.d.ts.map +1 -1
  24. package/dist/client/hooks/useEpisodicMemory.js +6 -5
  25. package/dist/client/hooks/useWorkingMemory.d.ts.map +1 -1
  26. package/dist/client/hooks/useWorkingMemory.js +7 -6
  27. package/dist/embeddings/index.d.ts +1 -1
  28. package/dist/embeddings/index.js +4 -4
  29. package/dist/index.d.ts +1 -2
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +1 -2
  32. package/dist/inference/context-budget.d.ts +1 -1
  33. package/dist/inference/context-budget.js +4 -4
  34. package/dist/inference/index.d.ts +1 -1
  35. package/dist/inference/index.js +1 -1
  36. package/dist/inference/runRag.d.ts +3 -3
  37. package/dist/inference/runRag.d.ts.map +1 -1
  38. package/dist/inference/runRag.js +1 -1
  39. package/dist/inference/task-decomposer.d.ts +1 -1
  40. package/dist/inference/task-decomposer.d.ts.map +1 -1
  41. package/dist/inference/task-decomposer.js +3 -3
  42. package/dist/inference/tool-result-compressor.d.ts +1 -1
  43. package/dist/inference/tool-result-compressor.js +1 -1
  44. package/dist/ingestion/{cms-indexer.d.ts → admin-indexer.d.ts} +12 -12
  45. package/dist/ingestion/admin-indexer.d.ts.map +1 -0
  46. package/dist/ingestion/{cms-indexer.js → admin-indexer.js} +9 -9
  47. package/dist/ingestion/bm25.d.ts +1 -1
  48. package/dist/ingestion/bm25.js +1 -1
  49. package/dist/ingestion/file-parsers.d.ts +1 -1
  50. package/dist/ingestion/file-parsers.d.ts.map +1 -1
  51. package/dist/ingestion/file-parsers.js +36 -17
  52. package/dist/ingestion/hybrid-search.d.ts +1 -1
  53. package/dist/ingestion/hybrid-search.js +1 -1
  54. package/dist/ingestion/index.d.ts +1 -1
  55. package/dist/ingestion/index.d.ts.map +1 -1
  56. package/dist/ingestion/index.js +1 -1
  57. package/dist/ingestion/rag-vector-service.d.ts +1 -1
  58. package/dist/ingestion/rag-vector-service.js +1 -1
  59. package/dist/ingestion/reranker.d.ts +1 -1
  60. package/dist/ingestion/reranker.js +1 -1
  61. package/dist/ingestion/text-splitter.d.ts +1 -1
  62. package/dist/ingestion/text-splitter.js +2 -2
  63. package/dist/llm/cache-utils.d.ts.map +1 -1
  64. package/dist/llm/cache-utils.js +1 -17
  65. package/dist/llm/client.d.ts +8 -13
  66. package/dist/llm/client.d.ts.map +1 -1
  67. package/dist/llm/client.js +12 -60
  68. package/dist/llm/key-validator.d.ts +1 -1
  69. package/dist/llm/key-validator.js +8 -8
  70. package/dist/llm/providers/base.d.ts +2 -2
  71. package/dist/llm/providers/groq.d.ts +2 -2
  72. package/dist/llm/providers/groq.d.ts.map +1 -1
  73. package/dist/llm/providers/groq.js +4 -4
  74. package/dist/llm/providers/inference-snaps.d.ts +5 -5
  75. package/dist/llm/providers/inference-snaps.d.ts.map +1 -1
  76. package/dist/llm/providers/inference-snaps.js +6 -6
  77. package/dist/llm/providers/ollama.d.ts +2 -2
  78. package/dist/llm/providers/ollama.d.ts.map +1 -1
  79. package/dist/llm/providers/ollama.js +3 -3
  80. package/dist/llm/providers/{openai.d.ts → openai-compat.d.ts} +8 -7
  81. package/dist/llm/providers/openai-compat.d.ts.map +1 -0
  82. package/dist/llm/providers/{openai.js → openai-compat.js} +13 -17
  83. package/dist/llm/providers/vultr.d.ts.map +1 -1
  84. package/dist/llm/providers/vultr.js +1 -0
  85. package/dist/llm/server.d.ts +1 -3
  86. package/dist/llm/server.d.ts.map +1 -1
  87. package/dist/llm/server.js +1 -3
  88. package/dist/llm/token-counter.d.ts.map +1 -1
  89. package/dist/llm/token-counter.js +11 -8
  90. package/dist/llm/workspace-provider-config.d.ts +1 -1
  91. package/dist/llm/workspace-provider-config.d.ts.map +1 -1
  92. package/dist/llm/workspace-provider-config.js +1 -1
  93. package/dist/memory/crdt/or-set.d.ts +12 -0
  94. package/dist/memory/crdt/or-set.d.ts.map +1 -1
  95. package/dist/memory/crdt/or-set.js +27 -0
  96. package/dist/memory/index.d.ts +1 -0
  97. package/dist/memory/index.d.ts.map +1 -1
  98. package/dist/memory/index.js +1 -0
  99. package/dist/memory/persistence/crdt-persistence.d.ts +21 -1
  100. package/dist/memory/persistence/crdt-persistence.d.ts.map +1 -1
  101. package/dist/memory/persistence/crdt-persistence.js +67 -0
  102. package/dist/memory/preferences/user-preferences-manager.d.ts.map +1 -1
  103. package/dist/memory/preferences/user-preferences-manager.js +11 -1
  104. package/dist/memory/stores/episodic-memory.js +2 -2
  105. package/dist/memory/stores/working-memory.d.ts +7 -2
  106. package/dist/memory/stores/working-memory.d.ts.map +1 -1
  107. package/dist/memory/stores/working-memory.js +31 -17
  108. package/dist/memory/sync/index.d.ts +2 -0
  109. package/dist/memory/sync/index.d.ts.map +1 -0
  110. package/dist/memory/sync/index.js +1 -0
  111. package/dist/memory/sync/sync-manager.d.ts +104 -0
  112. package/dist/memory/sync/sync-manager.d.ts.map +1 -0
  113. package/dist/memory/sync/sync-manager.js +137 -0
  114. package/dist/memory/utils/validation.js +1 -1
  115. package/dist/memory/vector/vector-memory-service.d.ts +1 -1
  116. package/dist/memory/vector/vector-memory-service.js +1 -1
  117. package/dist/orchestration/agent.d.ts +2 -2
  118. package/dist/orchestration/defaults.d.ts +1 -1
  119. package/dist/orchestration/defaults.js +1 -1
  120. package/dist/orchestration/orchestrator.d.ts +3 -3
  121. package/dist/orchestration/orchestrator.js +3 -3
  122. package/dist/orchestration/runtime.d.ts +1 -1
  123. package/dist/orchestration/runtime.js +1 -1
  124. package/dist/orchestration/streaming-runtime.d.ts +2 -2
  125. package/dist/orchestration/streaming-runtime.js +2 -2
  126. package/dist/orchestration/ticket-agent.d.ts +11 -11
  127. package/dist/orchestration/ticket-agent.d.ts.map +1 -1
  128. package/dist/orchestration/ticket-agent.js +10 -10
  129. package/dist/skills/catalog/vercel-catalog.d.ts.map +1 -1
  130. package/dist/skills/catalog/vercel-catalog.js +7 -4
  131. package/dist/skills/loader/github-loader.d.ts.map +1 -1
  132. package/dist/skills/loader/github-loader.js +2 -0
  133. package/dist/skills/loader/local-loader.js +1 -1
  134. package/dist/skills/loader/vercel-loader.d.ts.map +1 -1
  135. package/dist/skills/loader/vercel-loader.js +2 -0
  136. package/dist/skills/parser/skill-md-parser.js +2 -2
  137. package/dist/skills/registry/skill-registry.js +1 -1
  138. package/dist/skills/types.d.ts +6 -6
  139. package/dist/templates/prompt-spec.js +1 -1
  140. package/dist/templates/skill-spec.js +1 -1
  141. package/dist/tools/{cms → admin}/collection-tools.d.ts +2 -2
  142. package/dist/tools/admin/collection-tools.d.ts.map +1 -0
  143. package/dist/tools/{cms → admin}/collection-tools.js +8 -8
  144. package/dist/tools/{cms → admin}/factory.d.ts +11 -11
  145. package/dist/tools/admin/factory.d.ts.map +1 -0
  146. package/dist/tools/{cms → admin}/factory.js +4 -4
  147. package/dist/tools/{cms → admin}/global-tools.d.ts +1 -1
  148. package/dist/tools/admin/global-tools.d.ts.map +1 -0
  149. package/dist/tools/{cms → admin}/global-tools.js +4 -4
  150. package/dist/tools/{cms → admin}/index.d.ts +4 -4
  151. package/dist/tools/admin/index.d.ts.map +1 -0
  152. package/dist/tools/{cms → admin}/index.js +3 -3
  153. package/dist/tools/{cms → admin}/media-tools.d.ts +1 -1
  154. package/dist/tools/admin/media-tools.d.ts.map +1 -0
  155. package/dist/tools/{cms → admin}/media-tools.js +4 -4
  156. package/dist/tools/{cms → admin}/user-tools.d.ts +1 -1
  157. package/dist/tools/admin/user-tools.d.ts.map +1 -0
  158. package/dist/tools/{cms → admin}/user-tools.js +1 -1
  159. package/dist/tools/coding/file-edit.d.ts +1 -1
  160. package/dist/tools/coding/file-edit.js +2 -2
  161. package/dist/tools/coding/file-glob.d.ts +1 -1
  162. package/dist/tools/coding/file-glob.d.ts.map +1 -1
  163. package/dist/tools/coding/file-glob.js +2 -1
  164. package/dist/tools/coding/file-grep.d.ts +1 -1
  165. package/dist/tools/coding/file-grep.d.ts.map +1 -1
  166. package/dist/tools/coding/file-grep.js +2 -1
  167. package/dist/tools/coding/file-read.d.ts +1 -1
  168. package/dist/tools/coding/file-read.d.ts.map +1 -1
  169. package/dist/tools/coding/file-read.js +15 -9
  170. package/dist/tools/coding/file-write.d.ts +1 -1
  171. package/dist/tools/coding/file-write.js +1 -1
  172. package/dist/tools/coding/git-ops.d.ts +1 -1
  173. package/dist/tools/coding/git-ops.d.ts.map +1 -1
  174. package/dist/tools/coding/git-ops.js +5 -7
  175. package/dist/tools/coding/index.d.ts +1 -1
  176. package/dist/tools/coding/index.d.ts.map +1 -1
  177. package/dist/tools/coding/lint-fix.d.ts +1 -1
  178. package/dist/tools/coding/lint-fix.d.ts.map +1 -1
  179. package/dist/tools/coding/lint-fix.js +8 -4
  180. package/dist/tools/coding/project-context.d.ts +1 -1
  181. package/dist/tools/coding/project-context.d.ts.map +1 -1
  182. package/dist/tools/coding/project-context.js +25 -24
  183. package/dist/tools/coding/safety.d.ts +1 -1
  184. package/dist/tools/coding/safety.d.ts.map +1 -1
  185. package/dist/tools/coding/shell-exec.d.ts +1 -1
  186. package/dist/tools/coding/shell-exec.js +1 -1
  187. package/dist/tools/coding/test-runner.d.ts +1 -1
  188. package/dist/tools/coding/test-runner.d.ts.map +1 -1
  189. package/dist/tools/coding/test-runner.js +12 -7
  190. package/dist/tools/deduplicator.js +1 -1
  191. package/dist/tools/document-summarizer.js +2 -2
  192. package/dist/tools/memory/store-memory.d.ts +1 -1
  193. package/dist/tools/memory/store-memory.js +2 -2
  194. package/dist/tools/ticket-tools.d.ts +2 -2
  195. package/dist/tools/ticket-tools.js +3 -3
  196. package/dist/tools/web/duck-duck-go.d.ts +3 -3
  197. package/dist/tools/web/duck-duck-go.js +4 -4
  198. package/dist/tools/web/exa.d.ts +1 -1
  199. package/dist/tools/web/exa.js +1 -1
  200. package/dist/tools/web/scraper.js +1 -1
  201. package/dist/tools/web/tavily.d.ts +2 -2
  202. package/dist/tools/web/tavily.js +2 -2
  203. package/dist/tools/web/types.d.ts +2 -2
  204. package/dist/tools/web/types.js +2 -2
  205. package/package.json +23 -17
  206. package/LICENSE.commercial +0 -111
  207. package/dist/ingestion/cms-indexer.d.ts.map +0 -1
  208. package/dist/llm/providers/anthropic.d.ts +0 -31
  209. package/dist/llm/providers/anthropic.d.ts.map +0 -1
  210. package/dist/llm/providers/anthropic.js +0 -264
  211. package/dist/llm/providers/bitnet.d.ts +0 -28
  212. package/dist/llm/providers/bitnet.d.ts.map +0 -1
  213. package/dist/llm/providers/bitnet.js +0 -36
  214. package/dist/llm/providers/openai.d.ts.map +0 -1
  215. package/dist/tools/cms/collection-tools.d.ts.map +0 -1
  216. package/dist/tools/cms/factory.d.ts.map +0 -1
  217. package/dist/tools/cms/global-tools.d.ts.map +0 -1
  218. package/dist/tools/cms/index.d.ts.map +0 -1
  219. package/dist/tools/cms/media-tools.d.ts.map +0 -1
  220. package/dist/tools/cms/user-tools.d.ts.map +0 -1
@@ -132,7 +132,7 @@ export class SkillRegistry {
132
132
  }
133
133
  }
134
134
  catch {
135
- // Skip directories with missing or invalid skill.jsonregistry remains partial
135
+ // Skip directories with missing or invalid skill.json - registry remains partial
136
136
  }
137
137
  }
138
138
  }
@@ -27,13 +27,13 @@ export declare const SkillMetadataSchema: z.ZodObject<{
27
27
  repository: z.ZodOptional<z.ZodString>;
28
28
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
29
29
  compatibility: z.ZodOptional<z.ZodArray<z.ZodEnum<{
30
- openai: "openai";
31
- anthropic: "anthropic";
32
30
  "claude-code": "claude-code";
33
31
  cursor: "cursor";
34
32
  windsurf: "windsurf";
35
33
  cline: "cline";
36
34
  copilot: "copilot";
35
+ openai: "openai";
36
+ anthropic: "anthropic";
37
37
  universal: "universal";
38
38
  }>>>;
39
39
  allowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -78,13 +78,13 @@ export declare const SkillSchema: z.ZodObject<{
78
78
  repository: z.ZodOptional<z.ZodString>;
79
79
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
80
80
  compatibility: z.ZodOptional<z.ZodArray<z.ZodEnum<{
81
- openai: "openai";
82
- anthropic: "anthropic";
83
81
  "claude-code": "claude-code";
84
82
  cursor: "cursor";
85
83
  windsurf: "windsurf";
86
84
  cline: "cline";
87
85
  copilot: "copilot";
86
+ openai: "openai";
87
+ anthropic: "anthropic";
88
88
  universal: "universal";
89
89
  }>>>;
90
90
  allowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -143,13 +143,13 @@ export declare const SkillActivationResultSchema: z.ZodObject<{
143
143
  repository: z.ZodOptional<z.ZodString>;
144
144
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
145
145
  compatibility: z.ZodOptional<z.ZodArray<z.ZodEnum<{
146
- openai: "openai";
147
- anthropic: "anthropic";
148
146
  "claude-code": "claude-code";
149
147
  cursor: "cursor";
150
148
  windsurf: "windsurf";
151
149
  cline: "cline";
152
150
  copilot: "copilot";
151
+ openai: "openai";
152
+ anthropic: "anthropic";
153
153
  universal: "universal";
154
154
  }>>>;
155
155
  allowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -83,7 +83,7 @@ export const PromptSpecSchema = z.object({
83
83
  guardrails: PromptGuardrailsSchema,
84
84
  /** Security constraints */
85
85
  security: PromptSecuritySchema,
86
- /** Examplesat least one required for documentation and testing */
86
+ /** Examples - at least one required for documentation and testing */
87
87
  examples: z.array(PromptExampleSchema).min(1, 'At least one example is required'),
88
88
  /** Who created this prompt */
89
89
  author: z.string().min(1),
@@ -66,7 +66,7 @@ export const SkillSpecSchema = z.object({
66
66
  permissions: SkillPermissionsSchema,
67
67
  /** Security constraints */
68
68
  security: SkillSecuritySchema,
69
- /** Test casesat least one required */
69
+ /** Test cases - at least one required */
70
70
  testCases: z.array(SkillTestCaseSchema).min(1, 'At least one test case is required'),
71
71
  /** Who created this skill */
72
72
  author: z.string().min(1),
@@ -1,11 +1,11 @@
1
1
  /**
2
- * CMS Collection Tools
2
+ * Admin Collection Tools
3
3
  * Tools for managing collection documents (create, read, update, delete)
4
4
  */
5
5
  import type { Tool } from '../base.js';
6
6
  /**
7
7
  * Tool: List all collections
8
- * Returns available collections in the CMS
8
+ * Returns available collections in the admin
9
9
  */
10
10
  export declare const listCollectionsTool: Tool;
11
11
  /**
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collection-tools.d.ts","sourceRoot":"","sources":["../../../src/tools/admin/collection-tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,IAiCjC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,IA2C/B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,IAwB7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,IA+BhC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,IAmChC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,IAwBhC,CAAC"}
@@ -1,15 +1,15 @@
1
1
  /**
2
- * CMS Collection Tools
2
+ * Admin Collection Tools
3
3
  * Tools for managing collection documents (create, read, update, delete)
4
4
  */
5
5
  import { z } from 'zod/v4';
6
6
  /**
7
7
  * Tool: List all collections
8
- * Returns available collections in the CMS
8
+ * Returns available collections in the admin
9
9
  */
10
10
  export const listCollectionsTool = {
11
11
  name: 'list_collections',
12
- description: 'Get a list of all available CMS collections. Use this to discover what content types exist (e.g., pages, posts, users, media).',
12
+ description: 'Get a list of all available admin collections. Use this to discover what content types exist (e.g., pages, posts, users, media).',
13
13
  parameters: z.object({}),
14
14
  async execute() {
15
15
  try {
@@ -45,7 +45,7 @@ export const listCollectionsTool = {
45
45
  */
46
46
  export const findDocumentsTool = {
47
47
  name: 'find_documents',
48
- description: 'Search for documents in a CMS collection. Use this to find existing content before creating or updating.',
48
+ description: 'Search for documents in an admin collection. Use this to find existing content before creating or updating.',
49
49
  parameters: z.object({
50
50
  collection: z.string().describe('The collection slug (e.g., "pages", "posts", "users")'),
51
51
  page: z.number().optional().describe('Page number for pagination (default: 1)'),
@@ -77,7 +77,7 @@ export const findDocumentsTool = {
77
77
  */
78
78
  export const getDocumentTool = {
79
79
  name: 'get_document',
80
- description: 'Get a specific document by ID from a CMS collection. Use this to retrieve full details of a single item.',
80
+ description: 'Get a specific document by ID from an admin collection. Use this to retrieve full details of a single item.',
81
81
  parameters: z.object({
82
82
  collection: z.string().describe('The collection slug (e.g., "pages", "posts")'),
83
83
  id: z.string().describe('The document ID'),
@@ -102,7 +102,7 @@ export const getDocumentTool = {
102
102
  */
103
103
  export const createDocumentTool = {
104
104
  name: 'create_document',
105
- description: 'Create a new document in a CMS collection. Use this to add new content like pages, posts, or other records.',
105
+ description: 'Create a new document in an admin collection. Use this to add new content like pages, posts, or other records.',
106
106
  parameters: z.object({
107
107
  collection: z.string().describe('The collection slug (e.g., "pages", "posts")'),
108
108
  data: z
@@ -129,7 +129,7 @@ export const createDocumentTool = {
129
129
  */
130
130
  export const updateDocumentTool = {
131
131
  name: 'update_document',
132
- description: 'Update an existing document in a CMS collection. Use this to modify content like changing titles, updating text, etc.',
132
+ description: 'Update an existing document in an admin collection. Use this to modify content like changing titles, updating text, etc.',
133
133
  parameters: z.object({
134
134
  collection: z.string().describe('The collection slug (e.g., "pages", "posts")'),
135
135
  id: z.string().describe('The document ID to update'),
@@ -157,7 +157,7 @@ export const updateDocumentTool = {
157
157
  */
158
158
  export const deleteDocumentTool = {
159
159
  name: 'delete_document',
160
- description: 'Delete a document from a CMS collection. Use this to remove unwanted content. This action is permanent.',
160
+ description: 'Delete a document from an admin collection. Use this to remove unwanted content. This action is permanent.',
161
161
  parameters: z.object({
162
162
  collection: z.string().describe('The collection slug (e.g., "pages", "posts")'),
163
163
  id: z.string().describe('The document ID to delete'),
@@ -1,12 +1,12 @@
1
1
  /**
2
- * CMS Tools Factory
3
- * Creates CMS tools with API client injected for actual execution
2
+ * admin Tools Factory
3
+ * Creates admin tools with API client injected for actual execution
4
4
  */
5
5
  import type { Tool } from '../base.js';
6
6
  /**
7
7
  * API Client interface (compatible with @revealui/core/admin/utils/apiClient)
8
8
  */
9
- export interface CMSAPIClient {
9
+ export interface AdminAPIClient {
10
10
  find(options: {
11
11
  collection: string;
12
12
  page?: number;
@@ -43,7 +43,7 @@ export interface CMSAPIClient {
43
43
  }): Promise<unknown>;
44
44
  }
45
45
  /**
46
- * Collection metadata for CMS tools
46
+ * Collection metadata for admin tools
47
47
  * Simplified representation of a collection configuration
48
48
  */
49
49
  export interface CollectionMetadata {
@@ -52,7 +52,7 @@ export interface CollectionMetadata {
52
52
  description?: string;
53
53
  }
54
54
  /**
55
- * Global metadata for CMS tools
55
+ * Global metadata for admin tools
56
56
  * Simplified representation of a global configuration
57
57
  */
58
58
  export interface GlobalMetadata {
@@ -61,7 +61,7 @@ export interface GlobalMetadata {
61
61
  description?: string;
62
62
  }
63
63
  /**
64
- * User context for CMS tools
64
+ * User context for admin tools
65
65
  */
66
66
  export interface UserContext {
67
67
  id: string;
@@ -69,11 +69,11 @@ export interface UserContext {
69
69
  role?: string;
70
70
  }
71
71
  /**
72
- * Configuration interface for CMS tools
72
+ * Configuration interface for admin tools
73
73
  */
74
- export interface CMSToolsConfig {
74
+ export interface AdminToolsConfig {
75
75
  /** API client instance */
76
- apiClient: CMSAPIClient;
76
+ apiClient: AdminAPIClient;
77
77
  /** Available collections (optional, for list_collections tool) */
78
78
  collections?: CollectionMetadata[];
79
79
  /** Available globals (optional, for list_globals tool) */
@@ -82,8 +82,8 @@ export interface CMSToolsConfig {
82
82
  user?: UserContext;
83
83
  }
84
84
  /**
85
- * Create CMS tools with API client injected
85
+ * Create admin tools with API client injected
86
86
  * This factory function creates functional tools by injecting the actual API implementation
87
87
  */
88
- export declare function createCMSTools(config: CMSToolsConfig): Tool[];
88
+ export declare function createAdminTools(config: AdminToolsConfig): Tool[];
89
89
  //# sourceMappingURL=factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/tools/admin/factory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAyBvC;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,OAAO,EAAE;QACZ,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAChC,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC;QACV,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,CAAC;IAEH,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE3D,MAAM,CAAC,OAAO,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEzF,MAAM,CAAC,OAAO,EAAE;QACd,UAAU,EAAE,MAAM,CAAC;QACnB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC/B,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAErB,MAAM,CAAC,OAAO,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnE,UAAU,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAExE,YAAY,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1F;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,0BAA0B;IAC1B,SAAS,EAAE,cAAc,CAAC;IAE1B,kEAAkE;IAClE,WAAW,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAEnC,0DAA0D;IAC1D,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAE3B,mDAAmD;IACnD,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI,EAAE,CAggBjE"}
@@ -1,16 +1,16 @@
1
1
  /**
2
- * CMS Tools Factory
3
- * Creates CMS tools with API client injected for actual execution
2
+ * admin Tools Factory
3
+ * Creates admin tools with API client injected for actual execution
4
4
  */
5
5
  import { createDocumentTool, deleteDocumentTool, findDocumentsTool, getDocumentTool, listCollectionsTool, updateDocumentTool, } from './collection-tools.js';
6
6
  import { getGlobalTool, listGlobalsTool, updateGlobalTool } from './global-tools.js';
7
7
  import { deleteMediaTool, getMediaTool, listMediaTool, updateMediaTool, uploadMediaTool, } from './media-tools.js';
8
8
  import { createUserTool, deleteUserTool, getCurrentUserTool, listUsersTool, updateUserTool, } from './user-tools.js';
9
9
  /**
10
- * Create CMS tools with API client injected
10
+ * Create admin tools with API client injected
11
11
  * This factory function creates functional tools by injecting the actual API implementation
12
12
  */
13
- export function createCMSTools(config) {
13
+ export function createAdminTools(config) {
14
14
  const { apiClient, collections, globals, user } = config;
15
15
  // Clone tools and inject API client implementation
16
16
  const tools = [];
@@ -1,5 +1,5 @@
1
1
  /**
2
- * CMS Global Tools
2
+ * Admin Global Tools
3
3
  * Tools for managing global content (Header, Footer, Settings)
4
4
  */
5
5
  import type { Tool } from '../base.js';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"global-tools.d.ts","sourceRoot":"","sources":["../../../src/tools/admin/global-tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,IA6B7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,IAwB3B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,IA+B9B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * CMS Global Tools
2
+ * Admin Global Tools
3
3
  * Tools for managing global content (Header, Footer, Settings)
4
4
  */
5
5
  import { z } from 'zod/v4';
@@ -9,7 +9,7 @@ import { z } from 'zod/v4';
9
9
  */
10
10
  export const listGlobalsTool = {
11
11
  name: 'list_globals',
12
- description: 'Get a list of all available CMS globals. Globals are site-wide settings like Header, Footer, and Settings.',
12
+ description: 'Get a list of all available admin globals. Globals are site-wide settings like Header, Footer, and Settings.',
13
13
  parameters: z.object({}),
14
14
  async execute() {
15
15
  try {
@@ -41,7 +41,7 @@ export const listGlobalsTool = {
41
41
  */
42
42
  export const getGlobalTool = {
43
43
  name: 'get_global',
44
- description: 'Get the current configuration of a CMS global. Use this to see the current state before updating (e.g., current header navigation items).',
44
+ description: 'Get the current configuration of a admin global. Use this to see the current state before updating (e.g., current header navigation items).',
45
45
  parameters: z.object({
46
46
  slug: z.string().describe('The global slug (e.g., "header", "footer", "settings")'),
47
47
  depth: z.number().optional().describe('Depth of populated relationships (default: 0, max: 10)'),
@@ -66,7 +66,7 @@ export const getGlobalTool = {
66
66
  */
67
67
  export const updateGlobalTool = {
68
68
  name: 'update_global',
69
- description: 'Update a CMS global configuration. Use this to modify site-wide settings like header navigation, footer links, or global settings. Common uses:\n- Add/remove navigation links in header\n- Update footer content\n- Change site-wide settings\n\nExample for header navigation:\n{\n "slug": "header",\n "data": {\n "navItems": [\n {"link": {"type": "custom", "label": "Home", "url": "/"}},\n {"link": {"type": "custom", "label": "About", "url": "/about"}}\n ]\n }\n}',
69
+ description: 'Update a admin global configuration. Use this to modify site-wide settings like header navigation, footer links, or global settings. Common uses:\n- Add/remove navigation links in header\n- Update footer content\n- Change site-wide settings\n\nExample for header navigation:\n{\n "slug": "header",\n "data": {\n "navItems": [\n {"link": {"type": "custom", "label": "Home", "url": "/"}},\n {"link": {"type": "custom", "label": "About", "url": "/about"}}\n ]\n }\n}',
70
70
  parameters: z.object({
71
71
  slug: z.string().describe('The global slug (e.g., "header", "footer", "settings")'),
72
72
  data: z
@@ -1,10 +1,10 @@
1
1
  /**
2
- * CMS Tools Package
3
- * Complete set of tools for AI-powered CMS management
2
+ * admin Tools Package
3
+ * Complete set of tools for AI-powered admin management
4
4
  */
5
5
  export { createDocumentTool, deleteDocumentTool, findDocumentsTool, getDocumentTool, listCollectionsTool, updateDocumentTool, } from './collection-tools.js';
6
- export type { CMSAPIClient, CMSToolsConfig, CollectionMetadata, GlobalMetadata, UserContext, } from './factory.js';
7
- export { createCMSTools } from './factory.js';
6
+ export type { AdminAPIClient, AdminToolsConfig, CollectionMetadata, GlobalMetadata, UserContext, } from './factory.js';
7
+ export { createAdminTools } from './factory.js';
8
8
  export { getGlobalTool, listGlobalsTool, updateGlobalTool } from './global-tools.js';
9
9
  export { deleteMediaTool, getMediaTool, listMediaTool, updateMediaTool, uploadMediaTool, } from './media-tools.js';
10
10
  export { createUserTool, deleteUserTool, getCurrentUserTool, listUsersTool, updateUserTool, } from './user-tools.js';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/admin/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,WAAW,GACZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErF,OAAO,EACL,eAAe,EACf,YAAY,EACZ,aAAa,EACb,eAAe,EACf,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,cAAc,GACf,MAAM,iBAAiB,CAAC"}
@@ -1,11 +1,11 @@
1
1
  /**
2
- * CMS Tools Package
3
- * Complete set of tools for AI-powered CMS management
2
+ * admin Tools Package
3
+ * Complete set of tools for AI-powered admin management
4
4
  */
5
5
  // Export individual tool definitions (for documentation/reference)
6
6
  export { createDocumentTool, deleteDocumentTool, findDocumentsTool, getDocumentTool, listCollectionsTool, updateDocumentTool, } from './collection-tools.js';
7
7
  // Export factory for creating functional tools
8
- export { createCMSTools } from './factory.js';
8
+ export { createAdminTools } from './factory.js';
9
9
  export { getGlobalTool, listGlobalsTool, updateGlobalTool } from './global-tools.js';
10
10
  export { deleteMediaTool, getMediaTool, listMediaTool, updateMediaTool, uploadMediaTool, } from './media-tools.js';
11
11
  export { createUserTool, deleteUserTool, getCurrentUserTool, listUsersTool, updateUserTool, } from './user-tools.js';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * CMS Media Tools
2
+ * Admin Media Tools
3
3
  * Tools for managing media files (images, videos, documents)
4
4
  */
5
5
  import type { Tool } from '../base.js';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media-tools.d.ts","sourceRoot":"","sources":["../../../src/tools/admin/media-tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,IAqC3B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,IAsB1B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,IAyC7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,IAuB7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,IAoC7B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * CMS Media Tools
2
+ * Admin Media Tools
3
3
  * Tools for managing media files (images, videos, documents)
4
4
  */
5
5
  import { z } from 'zod/v4';
@@ -9,7 +9,7 @@ import { z } from 'zod/v4';
9
9
  */
10
10
  export const listMediaTool = {
11
11
  name: 'list_media',
12
- description: 'Get a list of media files from the CMS media library. Use this to browse uploaded images, videos, and documents.',
12
+ description: 'Get a list of media files from the admin media library. Use this to browse uploaded images, videos, and documents.',
13
13
  parameters: z.object({
14
14
  page: z.number().optional().describe('Page number for pagination (default: 1)'),
15
15
  limit: z.number().optional().describe('Number of results per page (default: 10)'),
@@ -63,7 +63,7 @@ export const getMediaTool = {
63
63
  */
64
64
  export const uploadMediaTool = {
65
65
  name: 'upload_media',
66
- description: 'Upload a new media file (image, video, or document) to the CMS. The file should be provided as a base64-encoded string.',
66
+ description: 'Upload a new media file (image, video, or document) to the admin. The file should be provided as a base64-encoded string.',
67
67
  parameters: z.object({
68
68
  filename: z.string().describe('The filename (e.g., "logo.png")'),
69
69
  mimeType: z.string().describe('The MIME type (e.g., "image/png", "image/jpeg")'),
@@ -93,7 +93,7 @@ export const uploadMediaTool = {
93
93
  */
94
94
  export const deleteMediaTool = {
95
95
  name: 'delete_media',
96
- description: 'Delete a media file from the CMS media library. This removes both the database record and the file from storage. This action is permanent.',
96
+ description: 'Delete a media file from the admin media library. This removes both the database record and the file from storage. This action is permanent.',
97
97
  parameters: z.object({
98
98
  id: z.string().describe('The media file ID to delete'),
99
99
  }),
@@ -1,5 +1,5 @@
1
1
  /**
2
- * CMS User Tools
2
+ * Admin User Tools
3
3
  * Tools for user management and authentication
4
4
  */
5
5
  import type { Tool } from '../base.js';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-tools.d.ts","sourceRoot":"","sources":["../../../src/tools/admin/user-tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,IAoBhC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,IAiC3B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,IAsC5B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,IAsC5B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,IAuB5B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * CMS User Tools
2
+ * Admin User Tools
3
3
  * Tools for user management and authentication
4
4
  */
5
5
  import { z } from 'zod/v4';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * file_editSurgical string replacement in a file
2
+ * file_edit - Surgical string replacement in a file
3
3
  */
4
4
  import type { Tool } from '../base.js';
5
5
  export declare const fileEditTool: Tool;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * file_editSurgical string replacement in a file
2
+ * file_edit - Surgical string replacement in a file
3
3
  */
4
4
  import { readFileSync, writeFileSync } from 'node:fs';
5
5
  import { z } from 'zod/v4';
@@ -23,7 +23,7 @@ export const fileEditTool = {
23
23
  return { success: false, error: check.reason };
24
24
  }
25
25
  if (old_text === new_text) {
26
- return { success: false, error: 'old_text and new_text are identicalnothing to change' };
26
+ return { success: false, error: 'old_text and new_text are identical - nothing to change' };
27
27
  }
28
28
  const resolvedPath = resolveSafePath(path, config);
29
29
  try {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * file_globFast file pattern matching with picomatch-style globs
2
+ * file_glob - Fast file pattern matching with picomatch-style globs
3
3
  */
4
4
  import type { Tool } from '../base.js';
5
5
  export declare const fileGlobTool: Tool;
@@ -1 +1 @@
1
- {"version":3,"file":"file-glob.d.ts","sourceRoot":"","sources":["../../../src/tools/coding/file-glob.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AA+DnD,eAAO,MAAM,YAAY,EAAE,IAgE1B,CAAC"}
1
+ {"version":3,"file":"file-glob.d.ts","sourceRoot":"","sources":["../../../src/tools/coding/file-glob.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AAgEnD,eAAO,MAAM,YAAY,EAAE,IAgE1B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * file_globFast file pattern matching with picomatch-style globs
2
+ * file_glob - Fast file pattern matching with picomatch-style globs
3
3
  */
4
4
  import { readdirSync, statSync } from 'node:fs';
5
5
  import { join, relative } from 'node:path';
@@ -8,6 +8,7 @@ import { getSafetyConfig } from './safety.js';
8
8
  /** Simple glob matcher supporting *, **, and ? */
9
9
  function matchGlob(pattern, filePath) {
10
10
  const regex = pattern
11
+ .replace(/\\/g, '\\\\')
11
12
  .replace(/\./g, '\\.')
12
13
  .replace(/\*\*/g, '⟨GLOBSTAR⟩')
13
14
  .replace(/\*/g, '[^/]*')
@@ -1,5 +1,5 @@
1
1
  /**
2
- * file_grepRegex content search across files
2
+ * file_grep - Regex content search across files
3
3
  */
4
4
  import type { Tool } from '../base.js';
5
5
  export declare const fileGrepTool: Tool;
@@ -1 +1 @@
1
- {"version":3,"file":"file-grep.d.ts","sourceRoot":"","sources":["../../../src/tools/coding/file-grep.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AAiGnD,eAAO,MAAM,YAAY,EAAE,IA0H1B,CAAC"}
1
+ {"version":3,"file":"file-grep.d.ts","sourceRoot":"","sources":["../../../src/tools/coding/file-grep.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AAkGnD,eAAO,MAAM,YAAY,EAAE,IA0H1B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * file_grepRegex content search across files
2
+ * file_grep - Regex content search across files
3
3
  */
4
4
  import { readdirSync, readFileSync, statSync } from 'node:fs';
5
5
  import { join, relative } from 'node:path';
@@ -8,6 +8,7 @@ import { getSafetyConfig } from './safety.js';
8
8
  /** Simple glob test for file filtering */
9
9
  function matchesGlob(filePath, glob) {
10
10
  const regex = glob
11
+ .replace(/\\/g, '\\\\')
11
12
  .replace(/\./g, '\\.')
12
13
  .replace(/\*\*/g, '⟨GLOBSTAR⟩')
13
14
  .replace(/\*/g, '[^/]*')
@@ -1,5 +1,5 @@
1
1
  /**
2
- * file_readRead file contents with line numbers
2
+ * file_read - Read file contents with line numbers
3
3
  */
4
4
  import type { Tool } from '../base.js';
5
5
  export declare const fileReadTool: Tool;
@@ -1 +1 @@
1
- {"version":3,"file":"file-read.d.ts","sourceRoot":"","sources":["../../../src/tools/coding/file-read.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AAGnD,eAAO,MAAM,YAAY,EAAE,IAkE1B,CAAC"}
1
+ {"version":3,"file":"file-read.d.ts","sourceRoot":"","sources":["../../../src/tools/coding/file-read.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AAGnD,eAAO,MAAM,YAAY,EAAE,IAsE1B,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /**
2
- * file_readRead file contents with line numbers
2
+ * file_read - Read file contents with line numbers
3
3
  */
4
- import { readFileSync, statSync } from 'node:fs';
4
+ import { readFileSync } from 'node:fs';
5
5
  import { z } from 'zod/v4';
6
6
  import { getSafetyConfig, resolveSafePath, validatePath } from './safety.js';
7
7
  export const fileReadTool = {
@@ -24,14 +24,20 @@ export const fileReadTool = {
24
24
  const maxLines = limit ?? 2000;
25
25
  const startLine = (offset ?? 1) - 1; // Convert to 0-based
26
26
  try {
27
- const stat = statSync(resolvedPath);
28
- if (stat.isDirectory()) {
29
- return {
30
- success: false,
31
- error: `${path} is a directory, not a file. Use file_glob to list directory contents.`,
32
- };
27
+ // Read first, then check if directory (avoids TOCTOU race between stat and read)
28
+ let raw;
29
+ try {
30
+ raw = readFileSync(resolvedPath, 'utf8');
31
+ }
32
+ catch (readErr) {
33
+ if (readErr.code === 'EISDIR') {
34
+ return {
35
+ success: false,
36
+ error: `${path} is a directory, not a file. Use file_glob to list directory contents.`,
37
+ };
38
+ }
39
+ throw readErr;
33
40
  }
34
- const raw = readFileSync(resolvedPath, 'utf8');
35
41
  const allLines = raw.split('\n');
36
42
  const totalLines = allLines.length;
37
43
  const sliced = allLines.slice(startLine, startLine + maxLines);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * file_writeWrite entire file contents
2
+ * file_write - Write entire file contents
3
3
  */
4
4
  import type { Tool } from '../base.js';
5
5
  export declare const fileWriteTool: Tool;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * file_writeWrite entire file contents
2
+ * file_write - Write entire file contents
3
3
  */
4
4
  import { mkdirSync, writeFileSync } from 'node:fs';
5
5
  import { dirname } from 'node:path';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * git_opsGit operations wrapper (status, diff, log, blame)
2
+ * git_ops - Git operations wrapper (status, diff, log, blame)
3
3
  */
4
4
  import type { Tool } from '../base.js';
5
5
  export declare const gitOpsTool: Tool;
@@ -1 +1 @@
1
- {"version":3,"file":"git-ops.d.ts","sourceRoot":"","sources":["../../../src/tools/coding/git-ops.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AAyBnD,eAAO,MAAM,UAAU,EAAE,IA4FxB,CAAC"}
1
+ {"version":3,"file":"git-ops.d.ts","sourceRoot":"","sources":["../../../src/tools/coding/git-ops.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AAuBnD,eAAO,MAAM,UAAU,EAAE,IA4FxB,CAAC"}
@@ -1,15 +1,14 @@
1
1
  /**
2
- * git_opsGit operations wrapper (status, diff, log, blame)
2
+ * git_ops - Git operations wrapper (status, diff, log, blame)
3
3
  */
4
- import { execSync } from 'node:child_process';
4
+ import { execFileSync } from 'node:child_process';
5
5
  import { z } from 'zod/v4';
6
6
  import { getSafetyConfig } from './safety.js';
7
7
  const GIT_OPERATIONS = ['status', 'diff', 'diff_full', 'log', 'blame', 'show', 'branch'];
8
8
  /** Max output per git command */
9
9
  const MAX_OUTPUT = 50_000;
10
10
  function runGit(args, cwd) {
11
- const cmd = `git ${args.join(' ')}`;
12
- return execSync(cmd, {
11
+ return execFileSync('git', args, {
13
12
  cwd,
14
13
  timeout: 15_000,
15
14
  maxBuffer: MAX_OUTPUT,
@@ -17,7 +16,6 @@ function runGit(args, cwd) {
17
16
  env: {
18
17
  ...process.env,
19
18
  GIT_TERMINAL_PROMPT: '0',
20
- // Prevent pager from blocking
21
19
  GIT_PAGER: 'cat',
22
20
  },
23
21
  }).trim();
@@ -25,7 +23,7 @@ function runGit(args, cwd) {
25
23
  export const gitOpsTool = {
26
24
  name: 'git_ops',
27
25
  label: 'Git Operations',
28
- description: 'Run read-only git operations: status, diff (summary), diff_full (full patch), log, blame, show, branch. Safe operations onlyno push, commit, reset, or checkout.',
26
+ description: 'Run read-only git operations: status, diff (summary), diff_full (full patch), log, blame, show, branch. Safe operations only - no push, commit, reset, or checkout.',
29
27
  parameters: z.object({
30
28
  operation: z.enum(GIT_OPERATIONS).describe('Git operation to perform'),
31
29
  args: z
@@ -57,7 +55,7 @@ export const gitOpsTool = {
57
55
  output = runGit(['diff', '--stat', ...args], config.projectRoot);
58
56
  break;
59
57
  case 'diff_full':
60
- // Full patch content for code reviewhunks per file
58
+ // Full patch content for code review - hunks per file
61
59
  output = runGit(['diff', '--no-color', '-U3', ...args], config.projectRoot);
62
60
  break;
63
61
  case 'log':
@@ -20,7 +20,7 @@ export { testRunnerTool } from './test-runner.js';
20
20
  * Configuration for the coding tools factory
21
21
  */
22
22
  export interface CodingToolsConfig {
23
- /** Project root directoryall file operations sandboxed here */
23
+ /** Project root directory - all file operations sandboxed here */
24
24
  projectRoot: string;
25
25
  /** Additional directories to allow (e.g., /tmp for scratch files) */
26
26
  allowedPaths?: string[];