@troykelly/openclaw-projects 0.0.1

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 (120) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +389 -0
  3. package/dist/api-client.d.ts +81 -0
  4. package/dist/api-client.d.ts.map +1 -0
  5. package/dist/api-client.js +216 -0
  6. package/dist/api-client.js.map +1 -0
  7. package/dist/cli.d.ts +112 -0
  8. package/dist/cli.d.ts.map +1 -0
  9. package/dist/cli.js +233 -0
  10. package/dist/cli.js.map +1 -0
  11. package/dist/config.d.ts +324 -0
  12. package/dist/config.d.ts.map +1 -0
  13. package/dist/config.js +287 -0
  14. package/dist/config.js.map +1 -0
  15. package/dist/context.d.ts +87 -0
  16. package/dist/context.d.ts.map +1 -0
  17. package/dist/context.js +144 -0
  18. package/dist/context.js.map +1 -0
  19. package/dist/gateway/rpc-methods.d.ts +93 -0
  20. package/dist/gateway/rpc-methods.d.ts.map +1 -0
  21. package/dist/gateway/rpc-methods.js +145 -0
  22. package/dist/gateway/rpc-methods.js.map +1 -0
  23. package/dist/hooks.d.ts +86 -0
  24. package/dist/hooks.d.ts.map +1 -0
  25. package/dist/hooks.js +314 -0
  26. package/dist/hooks.js.map +1 -0
  27. package/dist/index.d.ts +106 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +221 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/logger.d.ts +22 -0
  32. package/dist/logger.d.ts.map +1 -0
  33. package/dist/logger.js +78 -0
  34. package/dist/logger.js.map +1 -0
  35. package/dist/register-openclaw.d.ts +43 -0
  36. package/dist/register-openclaw.d.ts.map +1 -0
  37. package/dist/register-openclaw.js +1838 -0
  38. package/dist/register-openclaw.js.map +1 -0
  39. package/dist/secrets.d.ts +56 -0
  40. package/dist/secrets.d.ts.map +1 -0
  41. package/dist/secrets.js +161 -0
  42. package/dist/secrets.js.map +1 -0
  43. package/dist/services/notification-service.d.ts +60 -0
  44. package/dist/services/notification-service.d.ts.map +1 -0
  45. package/dist/services/notification-service.js +145 -0
  46. package/dist/services/notification-service.js.map +1 -0
  47. package/dist/tools/contacts.d.ts +139 -0
  48. package/dist/tools/contacts.d.ts.map +1 -0
  49. package/dist/tools/contacts.js +333 -0
  50. package/dist/tools/contacts.js.map +1 -0
  51. package/dist/tools/email-send.d.ts +71 -0
  52. package/dist/tools/email-send.d.ts.map +1 -0
  53. package/dist/tools/email-send.js +132 -0
  54. package/dist/tools/email-send.js.map +1 -0
  55. package/dist/tools/file-share.d.ts +64 -0
  56. package/dist/tools/file-share.d.ts.map +1 -0
  57. package/dist/tools/file-share.js +133 -0
  58. package/dist/tools/file-share.js.map +1 -0
  59. package/dist/tools/index.d.ts +22 -0
  60. package/dist/tools/index.d.ts.map +1 -0
  61. package/dist/tools/index.js +33 -0
  62. package/dist/tools/index.js.map +1 -0
  63. package/dist/tools/memory-forget.d.ts +69 -0
  64. package/dist/tools/memory-forget.d.ts.map +1 -0
  65. package/dist/tools/memory-forget.js +224 -0
  66. package/dist/tools/memory-forget.js.map +1 -0
  67. package/dist/tools/memory-recall.d.ts +82 -0
  68. package/dist/tools/memory-recall.d.ts.map +1 -0
  69. package/dist/tools/memory-recall.js +161 -0
  70. package/dist/tools/memory-recall.js.map +1 -0
  71. package/dist/tools/memory-store.d.ts +80 -0
  72. package/dist/tools/memory-store.d.ts.map +1 -0
  73. package/dist/tools/memory-store.js +172 -0
  74. package/dist/tools/memory-store.js.map +1 -0
  75. package/dist/tools/message-search.d.ts +85 -0
  76. package/dist/tools/message-search.d.ts.map +1 -0
  77. package/dist/tools/message-search.js +137 -0
  78. package/dist/tools/message-search.js.map +1 -0
  79. package/dist/tools/notebooks.d.ts +155 -0
  80. package/dist/tools/notebooks.d.ts.map +1 -0
  81. package/dist/tools/notebooks.js +287 -0
  82. package/dist/tools/notebooks.js.map +1 -0
  83. package/dist/tools/notes.d.ts +272 -0
  84. package/dist/tools/notes.d.ts.map +1 -0
  85. package/dist/tools/notes.js +530 -0
  86. package/dist/tools/notes.js.map +1 -0
  87. package/dist/tools/projects.d.ts +139 -0
  88. package/dist/tools/projects.d.ts.map +1 -0
  89. package/dist/tools/projects.js +280 -0
  90. package/dist/tools/projects.js.map +1 -0
  91. package/dist/tools/relationships.d.ts +133 -0
  92. package/dist/tools/relationships.d.ts.map +1 -0
  93. package/dist/tools/relationships.js +281 -0
  94. package/dist/tools/relationships.js.map +1 -0
  95. package/dist/tools/sms-send.d.ts +62 -0
  96. package/dist/tools/sms-send.d.ts.map +1 -0
  97. package/dist/tools/sms-send.js +121 -0
  98. package/dist/tools/sms-send.js.map +1 -0
  99. package/dist/tools/threads.d.ts +127 -0
  100. package/dist/tools/threads.d.ts.map +1 -0
  101. package/dist/tools/threads.js +202 -0
  102. package/dist/tools/threads.js.map +1 -0
  103. package/dist/tools/todos.d.ts +142 -0
  104. package/dist/tools/todos.d.ts.map +1 -0
  105. package/dist/tools/todos.js +308 -0
  106. package/dist/tools/todos.js.map +1 -0
  107. package/dist/types/openclaw-api.d.ts +215 -0
  108. package/dist/types/openclaw-api.d.ts.map +1 -0
  109. package/dist/types/openclaw-api.js +10 -0
  110. package/dist/types/openclaw-api.js.map +1 -0
  111. package/dist/utils/zod-to-json-schema.d.ts +19 -0
  112. package/dist/utils/zod-to-json-schema.d.ts.map +1 -0
  113. package/dist/utils/zod-to-json-schema.js +132 -0
  114. package/dist/utils/zod-to-json-schema.js.map +1 -0
  115. package/openclaw.plugin.json +229 -0
  116. package/package.json +69 -0
  117. package/skills/contact-lookup/SKILL.md +30 -0
  118. package/skills/daily-summary/SKILL.md +23 -0
  119. package/skills/project-status/SKILL.md +33 -0
  120. package/skills/send-reminder/SKILL.md +42 -0
package/dist/hooks.js ADDED
@@ -0,0 +1,314 @@
1
+ /**
2
+ * Plugin lifecycle hooks implementation.
3
+ * Provides auto-recall and auto-capture functionality.
4
+ */
5
+ /** Default timeout for auto-recall hook (5 seconds) */
6
+ const DEFAULT_RECALL_TIMEOUT_MS = 5000;
7
+ /** Default timeout for auto-capture hook (10 seconds) */
8
+ const DEFAULT_CAPTURE_TIMEOUT_MS = 10000;
9
+ /** Patterns that indicate sensitive content to filter */
10
+ const SENSITIVE_PATTERNS = [
11
+ /\b(?:password|passwd|pwd)\s*[:=]\s*\S+/gi,
12
+ /\b(?:api[_-]?key|apikey)\s*[:=]\s*\S+/gi,
13
+ /\bsk-[a-zA-Z0-9]{10,}/g, // API keys (10+ chars after sk-)
14
+ /\b(?:secret|token)\s*[:=]\s*\S+/gi,
15
+ /\b\d{4}[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4}\b/, // Credit card numbers
16
+ /\b\d{3}-\d{2}-\d{4}\b/, // SSN
17
+ ];
18
+ /**
19
+ * Create a promise that rejects after a timeout.
20
+ */
21
+ function createTimeoutPromise(ms, timeoutResult) {
22
+ return new Promise((resolve) => {
23
+ setTimeout(() => resolve(timeoutResult), ms);
24
+ });
25
+ }
26
+ /**
27
+ * Check if content contains sensitive patterns.
28
+ */
29
+ function containsSensitiveContent(content) {
30
+ return SENSITIVE_PATTERNS.some((pattern) => pattern.test(content));
31
+ }
32
+ /**
33
+ * Filter sensitive content from a string.
34
+ */
35
+ function filterSensitiveContent(content) {
36
+ let filtered = content;
37
+ for (const pattern of SENSITIVE_PATTERNS) {
38
+ filtered = filtered.replace(pattern, '[REDACTED]');
39
+ }
40
+ return filtered;
41
+ }
42
+ /**
43
+ * Creates the auto-recall hook (before_agent_start).
44
+ *
45
+ * This hook fetches relevant context from the backend based on the user's prompt
46
+ * and returns it to be prepended to the conversation.
47
+ */
48
+ export function createAutoRecallHook(options) {
49
+ const { client, logger, config, userId, timeoutMs = DEFAULT_RECALL_TIMEOUT_MS, } = options;
50
+ return async (event) => {
51
+ // Skip if auto-recall is disabled
52
+ if (!config.autoRecall) {
53
+ logger.debug('auto-recall skipped: disabled in config', { userId });
54
+ return null;
55
+ }
56
+ // Log without prompt content
57
+ logger.info('auto-recall invoked', {
58
+ userId,
59
+ promptLength: event.prompt.length,
60
+ });
61
+ try {
62
+ // Race between API call and timeout
63
+ const result = await Promise.race([
64
+ fetchContext(client, userId, event.prompt, logger, config.maxRecallMemories),
65
+ createTimeoutPromise(timeoutMs, null).then(() => {
66
+ logger.warn('auto-recall timeout exceeded', { userId, timeoutMs });
67
+ return null;
68
+ }),
69
+ ]);
70
+ if (result === null) {
71
+ logger.debug('auto-recall returned no context', { userId });
72
+ return null;
73
+ }
74
+ logger.debug('auto-recall completed', {
75
+ userId,
76
+ contextLength: result.prependContext.length,
77
+ });
78
+ return result;
79
+ }
80
+ catch (error) {
81
+ logger.error('auto-recall failed', {
82
+ userId,
83
+ error: error instanceof Error ? error.message : String(error),
84
+ });
85
+ return null;
86
+ }
87
+ };
88
+ }
89
+ /**
90
+ * Fetch context from the backend API using semantic memory search.
91
+ *
92
+ * Uses the existing `/api/memories/search` endpoint (which works)
93
+ * instead of the non-existent `/api/context` endpoint.
94
+ * The user's actual prompt is passed as the search query for semantic matching.
95
+ */
96
+ async function fetchContext(client, userId, prompt, logger, maxResults = 5) {
97
+ // Truncate prompt to a reasonable length for the search query
98
+ const searchQuery = prompt.substring(0, 500);
99
+ const queryParams = new URLSearchParams({
100
+ q: searchQuery,
101
+ limit: String(maxResults),
102
+ });
103
+ const response = await client.get(`/api/memories/search?${queryParams.toString()}`, { userId });
104
+ if (!response.success) {
105
+ logger.error('auto-recall API error', {
106
+ userId,
107
+ status: response.error.status,
108
+ code: response.error.code,
109
+ });
110
+ return null;
111
+ }
112
+ const memories = response.data.memories ?? [];
113
+ if (memories.length === 0) {
114
+ return null;
115
+ }
116
+ // Format memories as context to prepend to the conversation
117
+ const context = memories
118
+ .map((m) => `- [${m.category}] ${m.content}`)
119
+ .join('\n');
120
+ return {
121
+ prependContext: context,
122
+ };
123
+ }
124
+ /**
125
+ * Creates the auto-capture hook (agent_end).
126
+ *
127
+ * This hook analyzes the completed conversation and stores important
128
+ * information as memories.
129
+ */
130
+ export function createAutoCaptureHook(options) {
131
+ const { client, logger, config, userId, timeoutMs = DEFAULT_CAPTURE_TIMEOUT_MS, } = options;
132
+ return async (event) => {
133
+ // Skip if auto-capture is disabled
134
+ if (!config.autoCapture) {
135
+ logger.debug('auto-capture skipped: disabled in config', { userId });
136
+ return;
137
+ }
138
+ // Skip empty conversations
139
+ if (!event.messages || event.messages.length === 0) {
140
+ logger.debug('auto-capture skipped: no messages', { userId });
141
+ return;
142
+ }
143
+ // Log without message content
144
+ logger.info('auto-capture invoked', {
145
+ userId,
146
+ messageCount: event.messages.length,
147
+ });
148
+ try {
149
+ // Race between API call and timeout
150
+ await Promise.race([
151
+ captureContext(client, userId, event.messages, logger),
152
+ createTimeoutPromise(timeoutMs, undefined).then(() => {
153
+ logger.warn('auto-capture timeout exceeded', { userId, timeoutMs });
154
+ }),
155
+ ]);
156
+ logger.debug('auto-capture completed', { userId });
157
+ }
158
+ catch (error) {
159
+ logger.error('auto-capture failed', {
160
+ userId,
161
+ error: error instanceof Error ? error.message : String(error),
162
+ });
163
+ // Don't throw - hook errors should not crash the agent
164
+ }
165
+ };
166
+ }
167
+ /**
168
+ * Capture context from conversation messages.
169
+ */
170
+ async function captureContext(client, userId, messages, logger) {
171
+ // Filter out messages with sensitive content
172
+ const filteredMessages = messages.filter((msg) => {
173
+ if (containsSensitiveContent(msg.content)) {
174
+ logger.debug('auto-capture filtered sensitive message', { userId });
175
+ return false;
176
+ }
177
+ return true;
178
+ });
179
+ if (filteredMessages.length === 0) {
180
+ logger.debug('auto-capture skipped: all messages filtered', { userId });
181
+ return;
182
+ }
183
+ // Prepare conversation summary for capture
184
+ const conversationSummary = filteredMessages
185
+ .map((msg) => filterSensitiveContent(msg.content))
186
+ .join('\n');
187
+ const response = await client.post('/api/context/capture', {
188
+ conversation: conversationSummary,
189
+ messageCount: filteredMessages.length,
190
+ }, { userId });
191
+ if (!response.success) {
192
+ logger.error('auto-capture API error', {
193
+ userId,
194
+ status: response.error.status,
195
+ code: response.error.code,
196
+ });
197
+ }
198
+ }
199
+ /**
200
+ * Creates a graph-aware auto-recall hook (before_agent_start).
201
+ *
202
+ * This hook uses the graph-aware context retrieval API to fetch memories
203
+ * across the user's relationship graph (personal, contact, group, relationship
204
+ * scopes). Falls back to basic memory search if the graph-aware endpoint
205
+ * is unavailable.
206
+ *
207
+ * Part of Epic #486, Issue #497.
208
+ */
209
+ export function createGraphAwareRecallHook(options) {
210
+ const { client, logger, config, userId, timeoutMs = DEFAULT_RECALL_TIMEOUT_MS, } = options;
211
+ return async (event) => {
212
+ // Skip if auto-recall is disabled
213
+ if (!config.autoRecall) {
214
+ logger.debug('graph-aware-recall skipped: disabled in config', { userId });
215
+ return null;
216
+ }
217
+ // Log without prompt content
218
+ logger.info('graph-aware-recall invoked', {
219
+ userId,
220
+ promptLength: event.prompt.length,
221
+ });
222
+ try {
223
+ // Race between API call and timeout
224
+ const result = await Promise.race([
225
+ fetchGraphAwareContext(client, userId, event.prompt, logger, config.maxRecallMemories),
226
+ createTimeoutPromise(timeoutMs, null).then(() => {
227
+ logger.warn('graph-aware-recall timeout exceeded', { userId, timeoutMs });
228
+ return null;
229
+ }),
230
+ ]);
231
+ if (result === null) {
232
+ logger.debug('graph-aware-recall returned no context', { userId });
233
+ return null;
234
+ }
235
+ logger.debug('graph-aware-recall completed', {
236
+ userId,
237
+ contextLength: result.prependContext.length,
238
+ });
239
+ return result;
240
+ }
241
+ catch (error) {
242
+ logger.error('graph-aware-recall failed', {
243
+ userId,
244
+ error: error instanceof Error ? error.message : String(error),
245
+ });
246
+ return null;
247
+ }
248
+ };
249
+ }
250
+ /**
251
+ * Fetch context using the graph-aware context retrieval API.
252
+ *
253
+ * Calls POST /api/context/graph-aware with the user's prompt for
254
+ * multi-scope semantic search across relationships.
255
+ * Falls back to basic /api/memories/search if the graph-aware endpoint fails.
256
+ */
257
+ async function fetchGraphAwareContext(client, userId, prompt, logger, maxResults = 10) {
258
+ // Truncate prompt for the search query
259
+ const searchPrompt = prompt.substring(0, 500);
260
+ // Try graph-aware endpoint first
261
+ const graphResponse = await client.post('/api/context/graph-aware', {
262
+ prompt: searchPrompt,
263
+ maxMemories: maxResults,
264
+ maxDepth: 1,
265
+ }, { userId });
266
+ if (graphResponse.success && graphResponse.data.context) {
267
+ logger.debug('graph-aware context retrieved', {
268
+ userId,
269
+ memoryCount: graphResponse.data.memories.length,
270
+ scopeCount: graphResponse.data.metadata.scopeCount,
271
+ searchType: graphResponse.data.metadata.searchType,
272
+ queryTimeMs: graphResponse.data.metadata.queryTimeMs,
273
+ });
274
+ return {
275
+ prependContext: graphResponse.data.context,
276
+ };
277
+ }
278
+ // Fall back to basic memory search if graph-aware endpoint fails
279
+ logger.debug('graph-aware endpoint unavailable, falling back to basic recall', {
280
+ userId,
281
+ graphError: graphResponse.success ? 'no context' : graphResponse.error.code,
282
+ });
283
+ return fetchContext(client, userId, prompt, logger, maxResults);
284
+ }
285
+ /**
286
+ * Creates the health check function.
287
+ */
288
+ export function createHealthCheck(options) {
289
+ const { client, logger } = options;
290
+ return async () => {
291
+ try {
292
+ const response = await client.healthCheck();
293
+ if (!response.healthy) {
294
+ logger.warn('health check failed', { latencyMs: response.latencyMs });
295
+ return {
296
+ healthy: false,
297
+ error: 'Health check failed',
298
+ };
299
+ }
300
+ logger.debug('health check passed', { latencyMs: response.latencyMs });
301
+ return { healthy: true };
302
+ }
303
+ catch (error) {
304
+ logger.error('health check error', {
305
+ error: error instanceof Error ? error.message : String(error),
306
+ });
307
+ return {
308
+ healthy: false,
309
+ error: error instanceof Error ? error.message : 'Unknown error',
310
+ };
311
+ }
312
+ };
313
+ }
314
+ //# sourceMappingURL=hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,uDAAuD;AACvD,MAAM,yBAAyB,GAAG,IAAI,CAAA;AAEtC,yDAAyD;AACzD,MAAM,0BAA0B,GAAG,KAAK,CAAA;AAExC,y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ugin
3
+ *
4
+ * This plugin provides memory management, projects, todos, and contacts
5
+ * integration for OpenClaw agents.
6
+ *
7
+ * Supports two registration patterns:
8
+ * 1. OpenClaw 2026 API: `export default (api) => { ... }` (recommended)
9
+ * 2. Legacy API: `register(ctx)` returns plugin instance (deprecated)
10
+ */
11
+ export { default, registerOpenClaw, schemas } from './register-openclaw.js';
12
+ export type { OpenClawPluginAPI, PluginInitializer, PluginDefinition, ToolDefinition, ToolContext, ToolResult, JSONSchema, JSONSchemaProperty, HookEvent, HookHandler, PluginHookName, PluginHookBeforeAgentStartEvent, PluginHookAgentContext, PluginHookBeforeAgentStartResult, PluginHookAgentEndEvent, CliRegistrationCallback, CliRegistrationContext, ServiceDefinition, } from './types/openclaw-api.js';
13
+ import type { PluginConfig } from './config.js';
14
+ import { type Logger } from './logger.js';
15
+ import { type ApiClient } from './api-client.js';
16
+ import { type PluginContext } from './context.js';
17
+ import { type AutoRecallEvent, type AutoRecallResult, type AutoCaptureEvent, type HealthCheckResult } from './hooks.js';
18
+ import { type CliCommands } from './cli.js';
19
+ import { type MemoryRecallTool, type MemoryStoreTool, type MemoryForgetTool, type ProjectListTool, type ProjectGetTool, type ProjectCreateTool, type TodoListTool, type TodoCreateTool, type TodoCompleteTool, type ContactSearchTool, type ContactGetTool, type ContactCreateTool } from './tools/index.js';
20
+ /** Plugin registration context from OpenClaw runtime */
21
+ export interface RegistrationContext {
22
+ config: Record<string, unknown>;
23
+ logger?: Logger;
24
+ runtime?: unknown;
25
+ }
26
+ /** Tool instances created for the plugin */
27
+ export interface PluginTools {
28
+ memoryRecall: MemoryRecallTool;
29
+ memoryStore: MemoryStoreTool;
30
+ memoryForget: MemoryForgetTool;
31
+ projectList: ProjectListTool;
32
+ projectGet: ProjectGetTool;
33
+ projectCreate: ProjectCreateTool;
34
+ todoList: TodoListTool;
35
+ todoCreate: TodoCreateTool;
36
+ todoComplete: TodoCompleteTool;
37
+ contactSearch: ContactSearchTool;
38
+ contactGet: ContactGetTool;
39
+ contactCreate: ContactCreateTool;
40
+ }
41
+ /** Lifecycle hooks for the plugin */
42
+ export interface PluginHooks {
43
+ beforeAgentStart: (event: AutoRecallEvent) => Promise<AutoRecallResult | null>;
44
+ agentEnd: (event: AutoCaptureEvent) => Promise<void>;
45
+ }
46
+ /** Plugin instance after registration */
47
+ export interface PluginInstance {
48
+ id: string;
49
+ name: string;
50
+ kind: string;
51
+ config: PluginConfig;
52
+ apiClient: ApiClient;
53
+ context: PluginContext;
54
+ tools: PluginTools;
55
+ hooks: PluginHooks;
56
+ cli: CliCommands;
57
+ healthCheck: () => Promise<HealthCheckResult>;
58
+ }
59
+ /**
60
+ * Registers the plugin with OpenClaw (synchronous version).
61
+ *
62
+ * This function supports configurations with direct secret values only.
63
+ * For file or command-based secrets, use registerAsync instead.
64
+ *
65
+ * @deprecated Use registerAsync for flexible secret handling
66
+ */
67
+ export declare function register(ctx: RegistrationContext): PluginInstance;
68
+ /**
69
+ * Registers the plugin with OpenClaw (asynchronous version).
70
+ *
71
+ * This function supports all secret loading methods:
72
+ * - Direct values (apiKey: "sk-xxx")
73
+ * - File references (apiKeyFile: "~/.secrets/api_key")
74
+ * - Command references (apiKeyCommand: "op read op://...")
75
+ *
76
+ * Preferred over register() for flexible secret handling.
77
+ */
78
+ export declare function registerAsync(ctx: RegistrationContext): Promise<PluginInstance>;
79
+ /** Plugin definition object for OpenClaw */
80
+ export declare const plugin: {
81
+ id: string;
82
+ name: string;
83
+ kind: string;
84
+ register: typeof register;
85
+ };
86
+ export type { PluginConfig, RawPluginConfig } from './config.js';
87
+ export { validateConfig, safeValidateConfig, validateRawConfig, safeValidateRawConfig, resolveConfigSecrets, redactConfig, } from './config.js';
88
+ export type { SecretConfig } from './secrets.js';
89
+ export { resolveSecret, resolveSecrets, clearSecretCache, clearCachedSecret } from './secrets.js';
90
+ export type { Logger } from './logger.js';
91
+ export { createLogger, redactSensitive } from './logger.js';
92
+ export type { ApiClient, ApiResponse, ApiError } from './api-client.js';
93
+ export { createApiClient } from './api-client.js';
94
+ export type { PluginContext, UserContext, AgentContext, SessionContext, } from './context.js';
95
+ export { extractContext, getUserScopeKey } from './context.js';
96
+ export type { MemoryRecallTool, MemoryRecallParams, MemoryRecallResult, Memory, MemoryStoreTool, MemoryStoreParams, MemoryStoreResult, StoredMemory, MemoryForgetTool, MemoryForgetParams, MemoryForgetResult, ProjectListTool, ProjectGetTool, ProjectCreateTool, ProjectListParams, ProjectGetParams, ProjectCreateParams, ProjectListResult, ProjectGetResult, ProjectCreateResult, Project, ProjectToolOptions, TodoListTool, TodoCreateTool, TodoCompleteTool, TodoListParams, TodoCreateParams, TodoCompleteParams, TodoListResult, TodoCreateResult, TodoCompleteResult, Todo, TodoToolOptions, ContactSearchTool, ContactGetTool, ContactCreateTool, ContactSearchParams, ContactGetParams, ContactCreateParams, ContactSearchResult, ContactGetResult, ContactCreateResult, Contact, ContactToolOptions, } from './tools/index.js';
97
+ export { createMemoryRecallTool, createMemoryStoreTool, createMemoryForgetTool, createProjectListTool, createProjectGetTool, createProjectCreateTool, createTodoListTool, createTodoCreateTool, createTodoCompleteTool, createContactSearchTool, createContactGetTool, createContactCreateTool, MemoryRecallParamsSchema, MemoryStoreParamsSchema, MemoryForgetParamsSchema, MemoryCategory, ProjectListParamsSchema, ProjectGetParamsSchema, ProjectCreateParamsSchema, ProjectStatus, TodoListParamsSchema, TodoCreateParamsSchema, TodoCompleteParamsSchema, ContactSearchParamsSchema, ContactGetParamsSchema, ContactCreateParamsSchema, } from './tools/index.js';
98
+ export type { AutoRecallEvent, AutoRecallResult, AutoCaptureEvent, HealthCheckResult, AutoRecallHookOptions, AutoCaptureHookOptions, HealthCheckOptions, } from './hooks.js';
99
+ export { createAutoRecallHook, createAutoCaptureHook, createHealthCheck, } from './hooks.js';
100
+ export type { CliContext, CliCommands, CommandResult, RecallOptions, ExportOptions, StatusData, UsersData, RecallData, StatsData, ExportData, MemoryItem, } from './cli.js';
101
+ export { createCliCommands, createStatusCommand, createUsersCommand, createRecallCommand, createStatsCommand, createExportCommand, } from './cli.js';
102
+ export type { NotificationEvent, SubscribeParams, SubscribeResult, UnsubscribeParams, UnsubscribeResult, GetNotificationsParams, GetNotificationsResult, Notification, GatewayMethods, GatewayMethodsOptions, } from './gateway/rpc-methods.js';
103
+ export { createGatewayMethods, registerGatewayRpcMethods, } from './gateway/rpc-methods.js';
104
+ export type { NotificationServiceConfig, NotificationServiceEvents, NotificationServiceOptions, NotificationService, } from './services/notification-service.js';
105
+ export { createNotificationService, } from './services/notification-service.js';
106
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAG3E,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,WAAW,EACX,cAAc,EACd,+BAA+B,EAC/B,sBAAsB,EACtB,gCAAgC,EAChC,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,yBAAyB,CAAA;AAEhC,OAAO,KAAK,EAAE,YAAY,EAAmB,MAAM,aAAa,CAAA;AAQhE,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,aAAa,CAAA;AACvD,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACjE,OAAO,EAAmC,KAAK,aAAa,EAAE,MAAM,cAAc,CAAA;AAClF,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACvB,MAAM,YAAY,CAAA;AACnB,OAAO,EAEL,KAAK,WAAW,EAGjB,MAAM,UAAU,CAAA;AACjB,OAAO,EAaL,KAA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AAa,EACb,UAAU,EACV,SAAS,EACT,UAAU,EACV,SAAS,EACT,UAAU,EACV,UAAU,GACX,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,UAAU,CAAA;AAGjB,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EACtB,YAAY,EACZ,cAAc,EACd,qBAAqB,GACtB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACL,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,0BAA0B,CAAA;AAGjC,YAAY,EACV,yBAAyB,EACzB,yBAAyB,EACzB,0BAA0B,EAC1B,mBAAmB,GACpB,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EACL,yBAAyB,GAC1B,MAAM,oCAAoC,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,221 @@
1
+ /**
2
+ * OpenClaw Projects Plugin
3
+ *
4
+ * This plugin provides memory management, projects, todos, and contacts
5
+ * integration for OpenClaw agents.
6
+ *
7
+ * Supports two registration patterns:
8
+ * 1. OpenClaw 2026 API: `export default (api) => { ... }` (recommended)
9
+ * 2. Legacy API: `register(ctx)` returns plugin instance (deprecated)
10
+ */
11
+ // Re-export the OpenClaw 2026 API default export
12
+ export { default, registerOpenClaw, schemas } from './register-openclaw.js';
13
+ import { validateConfig, validateRawConfig, resolveConfigSecrets, redactConfig, } from './config.js';
14
+ import { createLogger } from './logger.js';
15
+ import { createApiClient } from './api-client.js';
16
+ import { extractContext, getUserScopeKey } from './context.js';
17
+ import { createAutoRecallHook, createAutoCaptureHook, createHealthCheck, } from './hooks.js';
18
+ import { createCliCommands, } from './cli.js';
19
+ import { createMemoryRecallTool, createMemoryStoreTool, createMemoryForgetTool, createProjectListTool, createProjectGetTool, createProjectCreateTool, createTodoListTool, createTodoCreateTool, createTodoCompleteTool, createContactSearchTool, createContactGetTool, createContactCreateTool, } from './tools/index.js';
20
+ /**
21
+ * Creates a plugin instance from resolved configuration.
22
+ * Internal helper used by both sync and async registration.
23
+ */
24
+ function createPluginInstance(config, logger, runtime) {
25
+ // Create API client
26
+ const apiClient = createApiClient({ config, logger });
27
+ // Extract context
28
+ const context = extractContext(runtime);
29
+ // Determine user scope key based on config
30
+ const userId = getUserScopeKey({
31
+ agentId: context.agent.agentId,
32
+ sessionKey: context.session.sessionId,
33
+ }, config.userScoping);
34
+ // Create tools
35
+ const tools = {
36
+ memoryRecall: createMemoryRecallTool({
37
+ client: apiClient,
38
+ logger,
39
+ config,
40
+ userId,
41
+ }),
42
+ memoryStore: createMemoryStoreTool({
43
+ client: apiClient,
44
+ logger,
45
+ config,
46
+ userId,
47
+ }),
48
+ memoryForget: createMemoryForgetTool({
49
+ client: apiClient,
50
+ logger,
51
+ config,
52
+ userId,
53
+ }),
54
+ projectList: createProjectListTool({
55
+ client: apiClient,
56
+ logger,
57
+ config,
58
+ userId,
59
+ }),
60
+ projectGet: createProjectGetTool({
61
+ client: apiClient,
62
+ logger,
63
+ config,
64
+ userId,
65
+ }),
66
+ projectCreate: createProjectCreateTool({
67
+ client: apiClient,
68
+ logger,
69
+ config,
70
+ userId,
71
+ }),
72
+ todoList: createTodoListTool({
73
+ client: apiClient,
74
+ logger,
75
+ config,
76
+ userId,
77
+ }),
78
+ todoCreate: createTodoCreateTool({
79
+ client: apiClient,
80
+ logger,
81
+ config,
82
+ userId,
83
+ }),
84
+ todoComplete: createTodoCompleteTool({
85
+ client: apiClient,
86
+ logger,
87
+ config,
88
+ userId,
89
+ }),
90
+ contactSearch: createContactSearchTool({
91
+ client: apiClient,
92
+ logger,
93
+ config,
94
+ userId,
95
+ }),
96
+ contactGet: createContactGetTool({
97
+ client: apiClient,
98
+ logger,
99
+ config,
100
+ userId,
101
+ }),
102
+ contactCreate: createContactCreateTool({
103
+ client: apiClient,
104
+ logger,
105
+ config,
106
+ userId,
107
+ }),
108
+ };
109
+ // Create lifecycle hooks
110
+ const hooks = {
111
+ beforeAgentStart: createAutoRecallHook({
112
+ client: apiClient,
113
+ logger,
114
+ config,
115
+ userId,
116
+ }),
117
+ agentEnd: createAutoCaptureHook({
118
+ client: apiClient,
119
+ logger,
120
+ config,
121
+ userId,
122
+ }),
123
+ };
124
+ // Create health check
125
+ const healthCheck = createHealthCheck({ client: apiClient, logger });
126
+ // Create CLI commands
127
+ const cli = createCliCommands({
128
+ client: apiClient,
129
+ logger,
130
+ config,
131
+ userId,
132
+ });
133
+ logger.info('Plugin registered', {
134
+ agentId: context.agent.agentId,
135
+ sessionId: context.session.sessionId,
136
+ userId,
137
+ config: redactConfig(config),
138
+ });
139
+ return {
140
+ id: 'openclaw-projects',
141
+ name: 'OpenClaw Projects Plugin',
142
+ kind: 'memory',
143
+ config,
144
+ apiClient,
145
+ context,
146
+ tools,
147
+ hooks,
148
+ cli,
149
+ healthCheck,
150
+ };
151
+ }
152
+ /**
153
+ * Registers the plugin with OpenClaw (synchronous version).
154
+ *
155
+ * This function supports configurations with direct secret values only.
156
+ * For file or command-based secrets, use registerAsync instead.
157
+ *
158
+ * @deprecated Use registerAsync for flexible secret handling
159
+ */
160
+ export function register(ctx) {
161
+ const logger = ctx.logger ?? createLogger('openclaw-projects');
162
+ // Validate as raw config first to check structure
163
+ const rawConfig = validateRawConfig(ctx.config);
164
+ // For sync registration, we require direct values - file/command refs won't work
165
+ // Build a resolved config from direct values only
166
+ const config = validateConfig({
167
+ apiUrl: rawConfig.apiUrl,
168
+ apiKey: rawConfig.apiKey ?? '',
169
+ twilioAccountSid: rawConfig.twilioAccountSid,
170
+ twilioAuthToken: rawConfig.twilioAuthToken,
171
+ twilioPhoneNumber: rawConfig.twilioPhoneNumber,
172
+ postmarkToken: rawConfig.postmarkToken,
173
+ postmarkFromEmail: rawConfig.postmarkFromEmail,
174
+ secretCommandTimeout: rawConfig.secretCommandTimeout,
175
+ autoRecall: rawConfig.autoRecall,
176
+ autoCapture: rawConfig.autoCapture,
177
+ userScoping: rawConfig.userScoping,
178
+ maxRecallMemories: rawConfig.maxRecallMemories,
179
+ minRecallScore: rawConfig.minRecallScore,
180
+ timeout: rawConfig.timeout,
181
+ maxRetries: rawConfig.maxRetries,
182
+ debug: rawConfig.debug,
183
+ });
184
+ return createPluginInstance(config, logger, ctx.runtime);
185
+ }
186
+ /**
187
+ * Registers the plugin with OpenClaw (asynchronous version).
188
+ *
189
+ * This function supports all secret loading methods:
190
+ * - Direct values (apiKey: "sk-xxx")
191
+ * - File references (apiKeyFile: "~/.secrets/api_key")
192
+ * - Command references (apiKeyCommand: "op read op://...")
193
+ *
194
+ * Preferred over register() for flexible secret handling.
195
+ */
196
+ export async function registerAsync(ctx) {
197
+ const logger = ctx.logger ?? createLogger('openclaw-projects');
198
+ // Validate raw configuration
199
+ const rawConfig = validateRawConfig(ctx.config);
200
+ // Resolve all secrets
201
+ const config = await resolveConfigSecrets(rawConfig);
202
+ return createPluginInstance(config, logger, ctx.runtime);
203
+ }
204
+ /** Plugin definition object for OpenClaw */
205
+ export const plugin = {
206
+ id: 'openclaw-projects',
207
+ name: 'OpenClaw Projects Plugin',
208
+ kind: 'memory',
209
+ register,
210
+ };
211
+ export { validateConfig, safeValidateConfig, validateRawConfig, safeValidateRawConfig, resolveConfigSecrets, redactConfig, } from './config.js';
212
+ export { resolveSecret, resolveSecrets, clearSecretCache, clearCachedSecret } from './secrets.js';
213
+ export { createLogger, redactSensitive } from './logger.js';
214
+ export { createApiClient } from './api-client.js';
215
+ export { extractContext, getUserScopeKey } from './context.js';
216
+ export { createMemoryRecallTool, createMemoryStoreTool, createMemoryForgetTool, createProjectListTool, createProjectGetTool, createProjectCreateTool, createTodoListTool, createTodoCreateTool, createTodoCompleteTool, createContactSearchTool, createContactGetTool, createContactCreateTool, MemoryRecallParamsSchema, MemoryStoreParamsSchema, MemoryForgetParamsSchema, MemoryCategory, ProjectListParamsSchema, ProjectGetParamsSchema, ProjectCreateParamsSchema, ProjectStatus, TodoListParamsSchema, TodoCreateParamsSchema, TodoCompleteParamsSchema, ContactSearchParamsSchema, ContactGetParamsSchema, ContactCreateParamsSchema, } from './tools/index.js';
217
+ export { createAutoRecallHook, createAutoCaptureHook, createHealthCheck, } from './hooks.js';
218
+ export { createCliCommands, createStatusCommand, createUsersCommand, createRecallCommand, createStatsCommand, createExportCommand, } from './cli.js';
219
+ export { createGatewayMethods, registerGatewayRpcMethods, } from './gateway/rpc-methods.js';
220
+ export { createNotificationService, } from './services/notification-service.js';
221
+ //# sourceMappingURL=index.js.map