@stackmemoryai/stackmemory 0.5.28 → 0.5.30

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 (48) hide show
  1. package/README.md +37 -16
  2. package/dist/cli/claude-sm.js +17 -5
  3. package/dist/cli/claude-sm.js.map +2 -2
  4. package/dist/core/database/batch-operations.js +29 -4
  5. package/dist/core/database/batch-operations.js.map +2 -2
  6. package/dist/core/database/connection-pool.js +13 -2
  7. package/dist/core/database/connection-pool.js.map +2 -2
  8. package/dist/core/database/migration-manager.js +130 -34
  9. package/dist/core/database/migration-manager.js.map +2 -2
  10. package/dist/core/database/paradedb-adapter.js +23 -7
  11. package/dist/core/database/paradedb-adapter.js.map +2 -2
  12. package/dist/core/database/query-router.js +8 -3
  13. package/dist/core/database/query-router.js.map +2 -2
  14. package/dist/core/database/sqlite-adapter.js +152 -33
  15. package/dist/core/database/sqlite-adapter.js.map +2 -2
  16. package/dist/hooks/session-summary.js +23 -2
  17. package/dist/hooks/session-summary.js.map +2 -2
  18. package/dist/hooks/sms-notify.js +47 -13
  19. package/dist/hooks/sms-notify.js.map +2 -2
  20. package/dist/integrations/linear/auth.js +34 -20
  21. package/dist/integrations/linear/auth.js.map +2 -2
  22. package/dist/integrations/linear/auto-sync.js +18 -8
  23. package/dist/integrations/linear/auto-sync.js.map +2 -2
  24. package/dist/integrations/linear/client.js +42 -9
  25. package/dist/integrations/linear/client.js.map +2 -2
  26. package/dist/integrations/linear/migration.js +94 -36
  27. package/dist/integrations/linear/migration.js.map +2 -2
  28. package/dist/integrations/linear/oauth-server.js +77 -34
  29. package/dist/integrations/linear/oauth-server.js.map +2 -2
  30. package/dist/integrations/linear/rest-client.js +13 -3
  31. package/dist/integrations/linear/rest-client.js.map +2 -2
  32. package/dist/integrations/linear/sync-service.js +18 -15
  33. package/dist/integrations/linear/sync-service.js.map +2 -2
  34. package/dist/integrations/linear/sync.js +12 -4
  35. package/dist/integrations/linear/sync.js.map +2 -2
  36. package/dist/integrations/linear/unified-sync.js +33 -8
  37. package/dist/integrations/linear/unified-sync.js.map +2 -2
  38. package/dist/integrations/linear/webhook-handler.js +5 -1
  39. package/dist/integrations/linear/webhook-handler.js.map +2 -2
  40. package/dist/integrations/linear/webhook-server.js +7 -7
  41. package/dist/integrations/linear/webhook-server.js.map +2 -2
  42. package/dist/integrations/linear/webhook.js +9 -2
  43. package/dist/integrations/linear/webhook.js.map +2 -2
  44. package/dist/integrations/mcp/schemas.js +147 -0
  45. package/dist/integrations/mcp/schemas.js.map +7 -0
  46. package/dist/integrations/mcp/server.js +19 -3
  47. package/dist/integrations/mcp/server.js.map +2 -2
  48. package/package.json +1 -1
@@ -0,0 +1,147 @@
1
+ import { fileURLToPath as __fileURLToPath } from 'url';
2
+ import { dirname as __pathDirname } from 'path';
3
+ const __filename = __fileURLToPath(import.meta.url);
4
+ const __dirname = __pathDirname(__filename);
5
+ import { z } from "zod";
6
+ const GetContextSchema = z.object({
7
+ query: z.string().min(1).max(5e3).optional(),
8
+ limit: z.number().int().min(1).max(100).default(10)
9
+ });
10
+ const AddDecisionSchema = z.object({
11
+ content: z.string().min(1).max(1e4),
12
+ type: z.enum(["decision", "constraint", "learning"])
13
+ });
14
+ const StartFrameSchema = z.object({
15
+ name: z.string().min(1).max(500),
16
+ type: z.enum(["task", "subtask", "tool_scope", "review", "write", "debug"]),
17
+ constraints: z.array(z.string().max(1e3)).optional()
18
+ });
19
+ const CloseFrameSchema = z.object({
20
+ result: z.string().max(1e4).optional(),
21
+ outputs: z.record(z.unknown()).optional()
22
+ });
23
+ const AddAnchorSchema = z.object({
24
+ type: z.enum([
25
+ "FACT",
26
+ "DECISION",
27
+ "CONSTRAINT",
28
+ "INTERFACE_CONTRACT",
29
+ "TODO",
30
+ "RISK"
31
+ ]),
32
+ text: z.string().min(1).max(1e4),
33
+ priority: z.number().int().min(0).max(10).default(5)
34
+ });
35
+ const GetHotStackSchema = z.object({
36
+ maxDepth: z.number().int().min(1).max(50).default(10)
37
+ });
38
+ const CreateTaskSchema = z.object({
39
+ title: z.string().min(1).max(500),
40
+ description: z.string().max(1e4).optional(),
41
+ priority: z.enum(["low", "medium", "high", "critical"]).default("medium"),
42
+ tags: z.array(z.string().max(100)).optional(),
43
+ parentId: z.string().uuid().optional()
44
+ });
45
+ const UpdateTaskStatusSchema = z.object({
46
+ taskId: z.string().min(1),
47
+ status: z.enum(["pending", "in_progress", "completed", "blocked"]),
48
+ note: z.string().max(5e3).optional()
49
+ });
50
+ const GetActiveTasksSchema = z.object({
51
+ status: z.enum(["pending", "in_progress", "blocked"]).optional(),
52
+ limit: z.number().int().min(1).max(100).default(50)
53
+ });
54
+ const AddTaskDependencySchema = z.object({
55
+ taskId: z.string().min(1),
56
+ dependsOn: z.string().min(1)
57
+ });
58
+ const LinearSyncSchema = z.object({
59
+ direction: z.enum(["to_linear", "from_linear", "bidirectional"]).optional(),
60
+ force: z.boolean().default(false)
61
+ });
62
+ const LinearUpdateTaskSchema = z.object({
63
+ taskId: z.string().min(1),
64
+ updates: z.object({
65
+ title: z.string().min(1).max(500).optional(),
66
+ description: z.string().max(1e4).optional(),
67
+ status: z.string().optional(),
68
+ priority: z.number().int().min(0).max(4).optional()
69
+ })
70
+ });
71
+ const LinearGetTasksSchema = z.object({
72
+ status: z.string().optional(),
73
+ limit: z.number().int().min(1).max(100).default(50)
74
+ });
75
+ const GetTracesSchema = z.object({
76
+ sessionId: z.string().optional(),
77
+ limit: z.number().int().min(1).max(1e3).default(100),
78
+ since: z.string().datetime().optional()
79
+ });
80
+ const CompressOldTracesSchema = z.object({
81
+ olderThanDays: z.number().int().min(1).max(365).default(7)
82
+ });
83
+ const SmartContextSchema = z.object({
84
+ query: z.string().min(1).max(5e3),
85
+ maxResults: z.number().int().min(1).max(50).default(10),
86
+ includeRelated: z.boolean().default(true)
87
+ });
88
+ const GetSummarySchema = z.object({
89
+ timeRange: z.object({
90
+ start: z.string().datetime(),
91
+ end: z.string().datetime()
92
+ }).optional(),
93
+ includeMetrics: z.boolean().default(true)
94
+ });
95
+ const DiscoverSchema = z.object({
96
+ pattern: z.string().max(500).optional(),
97
+ maxDepth: z.number().int().min(1).max(20).default(5)
98
+ });
99
+ const RelatedFilesSchema = z.object({
100
+ filePath: z.string().min(1).max(1e3),
101
+ limit: z.number().int().min(1).max(50).default(10)
102
+ });
103
+ const SearchSchema = z.object({
104
+ query: z.string().min(1).max(1e3),
105
+ type: z.enum(["code", "context", "task", "all"]).default("all"),
106
+ limit: z.number().int().min(1).max(100).default(20)
107
+ });
108
+ import { ValidationError, ErrorCode } from "../../core/errors/index.js";
109
+ function validateInput(schema, input, toolName) {
110
+ const result = schema.safeParse(input);
111
+ if (!result.success) {
112
+ const errors = result.error.errors.map((e) => ({
113
+ path: e.path.join("."),
114
+ message: e.message
115
+ }));
116
+ throw new ValidationError(
117
+ `Invalid input for tool '${toolName}': ${errors.map((e) => e.message).join(", ")}`,
118
+ ErrorCode.VALIDATION_FAILED,
119
+ { toolName, errors }
120
+ );
121
+ }
122
+ return result.data;
123
+ }
124
+ export {
125
+ AddAnchorSchema,
126
+ AddDecisionSchema,
127
+ AddTaskDependencySchema,
128
+ CloseFrameSchema,
129
+ CompressOldTracesSchema,
130
+ CreateTaskSchema,
131
+ DiscoverSchema,
132
+ GetActiveTasksSchema,
133
+ GetContextSchema,
134
+ GetHotStackSchema,
135
+ GetSummarySchema,
136
+ GetTracesSchema,
137
+ LinearGetTasksSchema,
138
+ LinearSyncSchema,
139
+ LinearUpdateTaskSchema,
140
+ RelatedFilesSchema,
141
+ SearchSchema,
142
+ SmartContextSchema,
143
+ StartFrameSchema,
144
+ UpdateTaskStatusSchema,
145
+ validateInput
146
+ };
147
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/integrations/mcp/schemas.ts"],
4
+ "sourcesContent": ["/**\n * Zod schemas for MCP tool input validation\n * These schemas validate tool parameters before processing\n */\n\nimport { z } from 'zod';\n\n// ============================================\n// Context Tools\n// ============================================\n\nexport const GetContextSchema = z.object({\n query: z.string().min(1).max(5000).optional(),\n limit: z.number().int().min(1).max(100).default(10),\n});\nexport type GetContextInput = z.infer<typeof GetContextSchema>;\n\nexport const AddDecisionSchema = z.object({\n content: z.string().min(1).max(10000),\n type: z.enum(['decision', 'constraint', 'learning']),\n});\nexport type AddDecisionInput = z.infer<typeof AddDecisionSchema>;\n\n// ============================================\n// Frame Tools\n// ============================================\n\nexport const StartFrameSchema = z.object({\n name: z.string().min(1).max(500),\n type: z.enum(['task', 'subtask', 'tool_scope', 'review', 'write', 'debug']),\n constraints: z.array(z.string().max(1000)).optional(),\n});\nexport type StartFrameInput = z.infer<typeof StartFrameSchema>;\n\nexport const CloseFrameSchema = z.object({\n result: z.string().max(10000).optional(),\n outputs: z.record(z.unknown()).optional(),\n});\nexport type CloseFrameInput = z.infer<typeof CloseFrameSchema>;\n\nexport const AddAnchorSchema = z.object({\n type: z.enum([\n 'FACT',\n 'DECISION',\n 'CONSTRAINT',\n 'INTERFACE_CONTRACT',\n 'TODO',\n 'RISK',\n ]),\n text: z.string().min(1).max(10000),\n priority: z.number().int().min(0).max(10).default(5),\n});\nexport type AddAnchorInput = z.infer<typeof AddAnchorSchema>;\n\nexport const GetHotStackSchema = z.object({\n maxDepth: z.number().int().min(1).max(50).default(10),\n});\nexport type GetHotStackInput = z.infer<typeof GetHotStackSchema>;\n\n// ============================================\n// Task Tools\n// ============================================\n\nexport const CreateTaskSchema = z.object({\n title: z.string().min(1).max(500),\n description: z.string().max(10000).optional(),\n priority: z.enum(['low', 'medium', 'high', 'critical']).default('medium'),\n tags: z.array(z.string().max(100)).optional(),\n parentId: z.string().uuid().optional(),\n});\nexport type CreateTaskInput = z.infer<typeof CreateTaskSchema>;\n\nexport const UpdateTaskStatusSchema = z.object({\n taskId: z.string().min(1),\n status: z.enum(['pending', 'in_progress', 'completed', 'blocked']),\n note: z.string().max(5000).optional(),\n});\nexport type UpdateTaskStatusInput = z.infer<typeof UpdateTaskStatusSchema>;\n\nexport const GetActiveTasksSchema = z.object({\n status: z.enum(['pending', 'in_progress', 'blocked']).optional(),\n limit: z.number().int().min(1).max(100).default(50),\n});\nexport type GetActiveTasksInput = z.infer<typeof GetActiveTasksSchema>;\n\nexport const AddTaskDependencySchema = z.object({\n taskId: z.string().min(1),\n dependsOn: z.string().min(1),\n});\nexport type AddTaskDependencyInput = z.infer<typeof AddTaskDependencySchema>;\n\n// ============================================\n// Linear Integration Tools\n// ============================================\n\nexport const LinearSyncSchema = z.object({\n direction: z.enum(['to_linear', 'from_linear', 'bidirectional']).optional(),\n force: z.boolean().default(false),\n});\nexport type LinearSyncInput = z.infer<typeof LinearSyncSchema>;\n\nexport const LinearUpdateTaskSchema = z.object({\n taskId: z.string().min(1),\n updates: z.object({\n title: z.string().min(1).max(500).optional(),\n description: z.string().max(10000).optional(),\n status: z.string().optional(),\n priority: z.number().int().min(0).max(4).optional(),\n }),\n});\nexport type LinearUpdateTaskInput = z.infer<typeof LinearUpdateTaskSchema>;\n\nexport const LinearGetTasksSchema = z.object({\n status: z.string().optional(),\n limit: z.number().int().min(1).max(100).default(50),\n});\nexport type LinearGetTasksInput = z.infer<typeof LinearGetTasksSchema>;\n\n// ============================================\n// Trace Tools\n// ============================================\n\nexport const GetTracesSchema = z.object({\n sessionId: z.string().optional(),\n limit: z.number().int().min(1).max(1000).default(100),\n since: z.string().datetime().optional(),\n});\nexport type GetTracesInput = z.infer<typeof GetTracesSchema>;\n\nexport const CompressOldTracesSchema = z.object({\n olderThanDays: z.number().int().min(1).max(365).default(7),\n});\nexport type CompressOldTracesInput = z.infer<typeof CompressOldTracesSchema>;\n\n// ============================================\n// Smart Context Tools\n// ============================================\n\nexport const SmartContextSchema = z.object({\n query: z.string().min(1).max(5000),\n maxResults: z.number().int().min(1).max(50).default(10),\n includeRelated: z.boolean().default(true),\n});\nexport type SmartContextInput = z.infer<typeof SmartContextSchema>;\n\nexport const GetSummarySchema = z.object({\n timeRange: z\n .object({\n start: z.string().datetime(),\n end: z.string().datetime(),\n })\n .optional(),\n includeMetrics: z.boolean().default(true),\n});\nexport type GetSummaryInput = z.infer<typeof GetSummarySchema>;\n\n// ============================================\n// Discovery Tools\n// ============================================\n\nexport const DiscoverSchema = z.object({\n pattern: z.string().max(500).optional(),\n maxDepth: z.number().int().min(1).max(20).default(5),\n});\nexport type DiscoverInput = z.infer<typeof DiscoverSchema>;\n\nexport const RelatedFilesSchema = z.object({\n filePath: z.string().min(1).max(1000),\n limit: z.number().int().min(1).max(50).default(10),\n});\nexport type RelatedFilesInput = z.infer<typeof RelatedFilesSchema>;\n\nexport const SearchSchema = z.object({\n query: z.string().min(1).max(1000),\n type: z.enum(['code', 'context', 'task', 'all']).default('all'),\n limit: z.number().int().min(1).max(100).default(20),\n});\nexport type SearchInput = z.infer<typeof SearchSchema>;\n\n// ============================================\n// Validation Helper\n// ============================================\n\nimport { ValidationError, ErrorCode } from '../../core/errors/index.js';\n\n/**\n * Validate input using a Zod schema\n * Throws ValidationError with details if validation fails\n */\nexport function validateInput<T>(\n schema: z.ZodSchema<T>,\n input: unknown,\n toolName: string\n): T {\n const result = schema.safeParse(input);\n\n if (!result.success) {\n const errors = result.error.errors.map((e) => ({\n path: e.path.join('.'),\n message: e.message,\n }));\n\n throw new ValidationError(\n `Invalid input for tool '${toolName}': ${errors.map((e) => e.message).join(', ')}`,\n ErrorCode.VALIDATION_FAILED,\n { toolName, errors }\n );\n }\n\n return result.data;\n}\n"],
5
+ "mappings": ";;;;AAKA,SAAS,SAAS;AAMX,MAAM,mBAAmB,EAAE,OAAO;AAAA,EACvC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAI,EAAE,SAAS;AAAA,EAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG,EAAE,QAAQ,EAAE;AACpD,CAAC;AAGM,MAAM,oBAAoB,EAAE,OAAO;AA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
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
8
8
  import { z } from "zod";
9
9
  import Database from "better-sqlite3";
10
+ import {
11
+ validateInput,
12
+ StartFrameSchema,
13
+ AddAnchorSchema,
14
+ CreateTaskSchema
15
+ } from "./schemas.js";
10
16
  import { readFileSync, existsSync, mkdirSync } from "fs";
11
17
  import { join, dirname } from "path";
12
18
  import { execSync } from "child_process";
@@ -904,7 +910,11 @@ ID: ${id}`
904
910
  };
905
911
  }
906
912
  async handleStartFrame(args) {
907
- const { name, type, constraints } = args;
913
+ const { name, type, constraints } = validateInput(
914
+ StartFrameSchema,
915
+ args,
916
+ "start_frame"
917
+ );
908
918
  const inputs = {};
909
919
  if (constraints) {
910
920
  inputs.constraints = constraints;
@@ -964,7 +974,11 @@ Stack depth: ${newStackDepth}`
964
974
  };
965
975
  }
966
976
  async handleAddAnchor(args) {
967
- const { type, text, priority = 5 } = args;
977
+ const { type, text, priority } = validateInput(
978
+ AddAnchorSchema,
979
+ args,
980
+ "add_anchor"
981
+ );
968
982
  const anchorId = this.frameManager.addAnchor(type, text, priority);
969
983
  this.frameManager.addEvent("decision", {
970
984
  anchor_type: type,
@@ -1043,7 +1057,9 @@ Anchor ID: ${anchorId}`
1043
1057
  ).run(query, response);
1044
1058
  }
1045
1059
  async handleCreateTask(args) {
1046
- const { title, description, priority, estimatedEffort, dependsOn, tags } = args;
1060
+ const validated = validateInput(CreateTaskSchema, args, "create_task");
1061
+ const { title, description, priority, tags } = validated;
1062
+ const { estimatedEffort, dependsOn } = args;
1047
1063
  const currentFrameId = this.frameManager.getCurrentFrameId();
1048
1064
  if (!currentFrameId) {
1049
1065
  return {