@weavelogic/knowledge-graph-agent 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +290 -3
- package/dist/_virtual/index10.js +2 -2
- package/dist/_virtual/index6.js +2 -2
- package/dist/_virtual/index7.js +2 -2
- package/dist/_virtual/index8.js +2 -2
- package/dist/_virtual/index9.js +2 -2
- package/dist/audit/config.d.ts +150 -0
- package/dist/audit/config.d.ts.map +1 -0
- package/dist/audit/config.js +111 -0
- package/dist/audit/config.js.map +1 -0
- package/dist/audit/index.d.ts +38 -0
- package/dist/audit/index.d.ts.map +1 -0
- package/dist/audit/services/audit-chain.d.ts +276 -0
- package/dist/audit/services/audit-chain.d.ts.map +1 -0
- package/dist/audit/services/audit-chain.js +502 -0
- package/dist/audit/services/audit-chain.js.map +1 -0
- package/dist/audit/services/index.d.ts +11 -0
- package/dist/audit/services/index.d.ts.map +1 -0
- package/dist/audit/services/syndication.d.ts +334 -0
- package/dist/audit/services/syndication.d.ts.map +1 -0
- package/dist/audit/services/syndication.js +589 -0
- package/dist/audit/services/syndication.js.map +1 -0
- package/dist/audit/types.d.ts +453 -0
- package/dist/audit/types.d.ts.map +1 -0
- package/dist/cli/commands/audit.d.ts +21 -0
- package/dist/cli/commands/audit.d.ts.map +1 -0
- package/dist/cli/commands/audit.js +621 -0
- package/dist/cli/commands/audit.js.map +1 -0
- package/dist/cli/commands/vector.d.ts +14 -0
- package/dist/cli/commands/vector.d.ts.map +1 -0
- package/dist/cli/commands/vector.js +429 -0
- package/dist/cli/commands/vector.js.map +1 -0
- package/dist/cli/commands/workflow.d.ts +12 -0
- package/dist/cli/commands/workflow.d.ts.map +1 -0
- package/dist/cli/commands/workflow.js +471 -0
- package/dist/cli/commands/workflow.js.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +26 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/database/schemas/index.d.ts +85 -0
- package/dist/database/schemas/index.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp-server/tools/audit/checkpoint.d.ts +58 -0
- package/dist/mcp-server/tools/audit/checkpoint.d.ts.map +1 -0
- package/dist/mcp-server/tools/audit/checkpoint.js +73 -0
- package/dist/mcp-server/tools/audit/checkpoint.js.map +1 -0
- package/dist/mcp-server/tools/audit/index.d.ts +53 -0
- package/dist/mcp-server/tools/audit/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/audit/index.js +12 -0
- package/dist/mcp-server/tools/audit/index.js.map +1 -0
- package/dist/mcp-server/tools/audit/query.d.ts +58 -0
- package/dist/mcp-server/tools/audit/query.d.ts.map +1 -0
- package/dist/mcp-server/tools/audit/query.js +125 -0
- package/dist/mcp-server/tools/audit/query.js.map +1 -0
- package/dist/mcp-server/tools/audit/sync.d.ts +58 -0
- package/dist/mcp-server/tools/audit/sync.d.ts.map +1 -0
- package/dist/mcp-server/tools/audit/sync.js +126 -0
- package/dist/mcp-server/tools/audit/sync.js.map +1 -0
- package/dist/mcp-server/tools/index.d.ts +3 -0
- package/dist/mcp-server/tools/index.d.ts.map +1 -1
- package/dist/mcp-server/tools/registry.js +90 -0
- package/dist/mcp-server/tools/registry.js.map +1 -1
- package/dist/mcp-server/tools/vector/index.d.ts +12 -0
- package/dist/mcp-server/tools/vector/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/vector/index.js +12 -0
- package/dist/mcp-server/tools/vector/index.js.map +1 -0
- package/dist/mcp-server/tools/vector/search.d.ts +41 -0
- package/dist/mcp-server/tools/vector/search.d.ts.map +1 -0
- package/dist/mcp-server/tools/vector/search.js +224 -0
- package/dist/mcp-server/tools/vector/search.js.map +1 -0
- package/dist/mcp-server/tools/vector/trajectory.d.ts +39 -0
- package/dist/mcp-server/tools/vector/trajectory.d.ts.map +1 -0
- package/dist/mcp-server/tools/vector/trajectory.js +170 -0
- package/dist/mcp-server/tools/vector/trajectory.js.map +1 -0
- package/dist/mcp-server/tools/vector/upsert.d.ts +44 -0
- package/dist/mcp-server/tools/vector/upsert.d.ts.map +1 -0
- package/dist/mcp-server/tools/vector/upsert.js +175 -0
- package/dist/mcp-server/tools/vector/upsert.js.map +1 -0
- package/dist/mcp-server/tools/workflow/index.d.ts +29 -0
- package/dist/mcp-server/tools/workflow/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/workflow/index.js +12 -0
- package/dist/mcp-server/tools/workflow/index.js.map +1 -0
- package/dist/mcp-server/tools/workflow/list.d.ts +41 -0
- package/dist/mcp-server/tools/workflow/list.d.ts.map +1 -0
- package/dist/mcp-server/tools/workflow/list.js +195 -0
- package/dist/mcp-server/tools/workflow/list.js.map +1 -0
- package/dist/mcp-server/tools/workflow/start.d.ts +40 -0
- package/dist/mcp-server/tools/workflow/start.d.ts.map +1 -0
- package/dist/mcp-server/tools/workflow/start.js +165 -0
- package/dist/mcp-server/tools/workflow/start.js.map +1 -0
- package/dist/mcp-server/tools/workflow/status.d.ts +38 -0
- package/dist/mcp-server/tools/workflow/status.d.ts.map +1 -0
- package/dist/mcp-server/tools/workflow/status.js +97 -0
- package/dist/mcp-server/tools/workflow/status.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/index.js +1 -1
- package/dist/node_modules/ajv/dist/vocabularies/applicator/index.js +1 -1
- package/dist/node_modules/ajv/dist/vocabularies/core/index.js +1 -1
- package/dist/node_modules/ajv/dist/vocabularies/format/index.js +1 -1
- package/dist/node_modules/ajv/dist/vocabularies/validation/index.js +1 -1
- package/dist/vector/config.d.ts +300 -0
- package/dist/vector/config.d.ts.map +1 -0
- package/dist/vector/config.js +124 -0
- package/dist/vector/config.js.map +1 -0
- package/dist/vector/index.d.ts +50 -0
- package/dist/vector/index.d.ts.map +1 -0
- package/dist/vector/services/index.d.ts +13 -0
- package/dist/vector/services/index.d.ts.map +1 -0
- package/dist/vector/services/trajectory-tracker.d.ts +405 -0
- package/dist/vector/services/trajectory-tracker.d.ts.map +1 -0
- package/dist/vector/services/trajectory-tracker.js +445 -0
- package/dist/vector/services/trajectory-tracker.js.map +1 -0
- package/dist/vector/services/vector-store.d.ts +339 -0
- package/dist/vector/services/vector-store.d.ts.map +1 -0
- package/dist/vector/services/vector-store.js +748 -0
- package/dist/vector/services/vector-store.js.map +1 -0
- package/dist/vector/types.d.ts +677 -0
- package/dist/vector/types.d.ts.map +1 -0
- package/dist/workflow/adapters/goap-adapter.d.ts +196 -0
- package/dist/workflow/adapters/goap-adapter.d.ts.map +1 -0
- package/dist/workflow/adapters/goap-adapter.js +706 -0
- package/dist/workflow/adapters/goap-adapter.js.map +1 -0
- package/dist/workflow/adapters/index.d.ts +10 -0
- package/dist/workflow/adapters/index.d.ts.map +1 -0
- package/dist/workflow/config.d.ts +135 -0
- package/dist/workflow/config.d.ts.map +1 -0
- package/dist/workflow/config.js +92 -0
- package/dist/workflow/config.js.map +1 -0
- package/dist/workflow/handlers/index.d.ts +9 -0
- package/dist/workflow/handlers/index.d.ts.map +1 -0
- package/dist/workflow/handlers/webhook-handlers.d.ts +397 -0
- package/dist/workflow/handlers/webhook-handlers.d.ts.map +1 -0
- package/dist/workflow/handlers/webhook-handlers.js +454 -0
- package/dist/workflow/handlers/webhook-handlers.js.map +1 -0
- package/dist/workflow/index.d.ts +42 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workflow/services/index.d.ts +9 -0
- package/dist/workflow/services/index.d.ts.map +1 -0
- package/dist/workflow/services/workflow-service.d.ts +318 -0
- package/dist/workflow/services/workflow-service.d.ts.map +1 -0
- package/dist/workflow/services/workflow-service.js +577 -0
- package/dist/workflow/services/workflow-service.js.map +1 -0
- package/dist/workflow/types.d.ts +470 -0
- package/dist/workflow/types.d.ts.map +1 -0
- package/dist/workflow/workflows/realtime-collab.d.ts +245 -0
- package/dist/workflow/workflows/realtime-collab.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Webhook Handlers
|
|
3
|
+
*
|
|
4
|
+
* Handles incoming webhooks and hooks for workflow triggers.
|
|
5
|
+
* Integrates with the existing file watcher system.
|
|
6
|
+
*
|
|
7
|
+
* @module workflow/handlers/webhook-handlers
|
|
8
|
+
*/
|
|
9
|
+
import type { NodeUpdateEvent, GapDetectedEvent, WorkflowCompleteEvent } from '../types.js';
|
|
10
|
+
export type { NodeUpdateEvent, GapDetectedEvent, WorkflowCompleteEvent };
|
|
11
|
+
/**
|
|
12
|
+
* Event types that can trigger workflows
|
|
13
|
+
*/
|
|
14
|
+
export type WorkflowTriggerEvent = {
|
|
15
|
+
type: 'file:created';
|
|
16
|
+
path: string;
|
|
17
|
+
timestamp: number;
|
|
18
|
+
} | {
|
|
19
|
+
type: 'file:changed';
|
|
20
|
+
path: string;
|
|
21
|
+
timestamp: number;
|
|
22
|
+
changes?: string;
|
|
23
|
+
} | {
|
|
24
|
+
type: 'file:deleted';
|
|
25
|
+
path: string;
|
|
26
|
+
timestamp: number;
|
|
27
|
+
} | {
|
|
28
|
+
type: 'node:updated';
|
|
29
|
+
event: NodeUpdateEvent;
|
|
30
|
+
} | {
|
|
31
|
+
type: 'gap:detected';
|
|
32
|
+
event: GapDetectedEvent;
|
|
33
|
+
} | {
|
|
34
|
+
type: 'workflow:complete';
|
|
35
|
+
event: WorkflowCompleteEvent;
|
|
36
|
+
} | {
|
|
37
|
+
type: 'timeout:inactivity';
|
|
38
|
+
lastActivity: number;
|
|
39
|
+
threshold: number;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Webhook handler configuration
|
|
43
|
+
*/
|
|
44
|
+
export interface WebhookConfig {
|
|
45
|
+
/** Secret for validating webhook signatures */
|
|
46
|
+
secret?: string;
|
|
47
|
+
/** Maximum payload size in bytes */
|
|
48
|
+
maxPayloadSize?: number;
|
|
49
|
+
/** Allowed origins for CORS */
|
|
50
|
+
allowedOrigins?: string[];
|
|
51
|
+
/** Rate limit per minute */
|
|
52
|
+
rateLimit?: number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Webhook validation result
|
|
56
|
+
*/
|
|
57
|
+
export interface WebhookValidation {
|
|
58
|
+
/** Whether the webhook payload is valid */
|
|
59
|
+
valid: boolean;
|
|
60
|
+
/** Error message if invalid */
|
|
61
|
+
error?: string;
|
|
62
|
+
/** Parsed event if valid */
|
|
63
|
+
event?: WorkflowTriggerEvent;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Handler function type for processing workflow trigger events
|
|
67
|
+
* @template T - Context type passed to handlers
|
|
68
|
+
*/
|
|
69
|
+
export type WebhookHandler<T = unknown> = (event: WorkflowTriggerEvent, context: T) => Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Webhook handler registry
|
|
72
|
+
*
|
|
73
|
+
* Manages registration and dispatch of webhook event handlers.
|
|
74
|
+
* Supports multiple handlers per event type and provides
|
|
75
|
+
* payload validation with optional signature verification.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* const registry = new WebhookRegistry({ secret: 'my-secret' });
|
|
80
|
+
*
|
|
81
|
+
* // Register handler
|
|
82
|
+
* const unsubscribe = registry.on('file:changed', async (event) => {
|
|
83
|
+
* console.log('File changed:', event.path);
|
|
84
|
+
* });
|
|
85
|
+
*
|
|
86
|
+
* // Emit event
|
|
87
|
+
* await registry.emit({
|
|
88
|
+
* type: 'file:changed',
|
|
89
|
+
* path: '/docs/readme.md',
|
|
90
|
+
* timestamp: Date.now()
|
|
91
|
+
* });
|
|
92
|
+
*
|
|
93
|
+
* // Cleanup
|
|
94
|
+
* unsubscribe();
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
export declare class WebhookRegistry {
|
|
98
|
+
private handlers;
|
|
99
|
+
private config;
|
|
100
|
+
/**
|
|
101
|
+
* Create a new webhook registry
|
|
102
|
+
* @param config - Registry configuration
|
|
103
|
+
*/
|
|
104
|
+
constructor(config?: WebhookConfig);
|
|
105
|
+
/**
|
|
106
|
+
* Register a handler for an event type
|
|
107
|
+
*
|
|
108
|
+
* @param eventType - The event type to listen for
|
|
109
|
+
* @param handler - Handler function to call when event occurs
|
|
110
|
+
* @returns Unsubscribe function to remove the handler
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```typescript
|
|
114
|
+
* const unsubscribe = registry.on('file:created', async (event) => {
|
|
115
|
+
* if (event.type === 'file:created') {
|
|
116
|
+
* await processNewFile(event.path);
|
|
117
|
+
* }
|
|
118
|
+
* });
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
on(eventType: WorkflowTriggerEvent['type'], handler: WebhookHandler): () => void;
|
|
122
|
+
/**
|
|
123
|
+
* Remove all handlers for an event type
|
|
124
|
+
*
|
|
125
|
+
* @param eventType - The event type to clear handlers for
|
|
126
|
+
*/
|
|
127
|
+
off(eventType: WorkflowTriggerEvent['type']): void;
|
|
128
|
+
/**
|
|
129
|
+
* Remove all handlers for all event types
|
|
130
|
+
*/
|
|
131
|
+
clear(): void;
|
|
132
|
+
/**
|
|
133
|
+
* Get the number of handlers registered for an event type
|
|
134
|
+
*
|
|
135
|
+
* @param eventType - The event type to check
|
|
136
|
+
* @returns Number of registered handlers
|
|
137
|
+
*/
|
|
138
|
+
listenerCount(eventType: WorkflowTriggerEvent['type']): number;
|
|
139
|
+
/**
|
|
140
|
+
* Emit an event to all registered handlers
|
|
141
|
+
*
|
|
142
|
+
* Handlers are called in parallel. Errors in individual handlers
|
|
143
|
+
* are caught and logged but do not prevent other handlers from running.
|
|
144
|
+
*
|
|
145
|
+
* @param event - The event to emit
|
|
146
|
+
* @param context - Optional context to pass to handlers
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```typescript
|
|
150
|
+
* await registry.emit({
|
|
151
|
+
* type: 'node:updated',
|
|
152
|
+
* event: {
|
|
153
|
+
* nodeId: 'doc-123',
|
|
154
|
+
* userId: 'user-456',
|
|
155
|
+
* changes: { title: 'Updated Title' },
|
|
156
|
+
* timestamp: Date.now()
|
|
157
|
+
* }
|
|
158
|
+
* });
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
emit<T>(event: WorkflowTriggerEvent, context?: T): Promise<void>;
|
|
162
|
+
/**
|
|
163
|
+
* Validate incoming webhook payload
|
|
164
|
+
*
|
|
165
|
+
* Checks that the payload is properly structured and optionally
|
|
166
|
+
* verifies the signature if a secret is configured.
|
|
167
|
+
*
|
|
168
|
+
* @param payload - Raw payload data
|
|
169
|
+
* @param signature - Optional signature for verification
|
|
170
|
+
* @returns Validation result with parsed event if valid
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```typescript
|
|
174
|
+
* const result = registry.validatePayload(
|
|
175
|
+
* { type: 'file:created', path: '/test.md', timestamp: Date.now() },
|
|
176
|
+
* 'sha256=abc123...'
|
|
177
|
+
* );
|
|
178
|
+
*
|
|
179
|
+
* if (result.valid && result.event) {
|
|
180
|
+
* await registry.emit(result.event);
|
|
181
|
+
* } else {
|
|
182
|
+
* console.error('Invalid webhook:', result.error);
|
|
183
|
+
* }
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
validatePayload(payload: unknown, signature?: string): WebhookValidation;
|
|
187
|
+
/**
|
|
188
|
+
* Get current configuration
|
|
189
|
+
* @returns A copy of the current configuration
|
|
190
|
+
*/
|
|
191
|
+
getConfig(): Readonly<WebhookConfig>;
|
|
192
|
+
/**
|
|
193
|
+
* Verify webhook signature
|
|
194
|
+
* @param payload - The payload to verify
|
|
195
|
+
* @param signature - The signature to check against
|
|
196
|
+
* @returns Whether the signature is valid
|
|
197
|
+
*/
|
|
198
|
+
private verifySignature;
|
|
199
|
+
/**
|
|
200
|
+
* Parse raw data into typed event
|
|
201
|
+
* @param data - Raw event data
|
|
202
|
+
* @returns Typed workflow trigger event
|
|
203
|
+
* @throws Error if event type is unknown or data is malformed
|
|
204
|
+
*/
|
|
205
|
+
private parseEvent;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* File watcher integration
|
|
209
|
+
*
|
|
210
|
+
* Converts file system events to workflow trigger events and
|
|
211
|
+
* manages inactivity detection for watched paths.
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* ```typescript
|
|
215
|
+
* const registry = createWebhookRegistry();
|
|
216
|
+
* const watcher = createFileWatcherIntegration(registry, {
|
|
217
|
+
* inactivityThreshold: 10 * 60 * 1000 // 10 minutes
|
|
218
|
+
* });
|
|
219
|
+
*
|
|
220
|
+
* // Register for inactivity events
|
|
221
|
+
* registry.on('timeout:inactivity', async (event) => {
|
|
222
|
+
* console.log('No activity for:', event.threshold, 'ms');
|
|
223
|
+
* });
|
|
224
|
+
*
|
|
225
|
+
* // Start watching
|
|
226
|
+
* watcher.watch('/path/to/docs');
|
|
227
|
+
*
|
|
228
|
+
* // Simulate file events
|
|
229
|
+
* await watcher.onFileCreated('/path/to/docs/new-file.md');
|
|
230
|
+
* await watcher.onFileChanged('/path/to/docs/existing.md', 'content diff');
|
|
231
|
+
* ```
|
|
232
|
+
*/
|
|
233
|
+
export declare class FileWatcherIntegration {
|
|
234
|
+
private registry;
|
|
235
|
+
private watchPaths;
|
|
236
|
+
private lastActivityMap;
|
|
237
|
+
private inactivityTimers;
|
|
238
|
+
private inactivityThreshold;
|
|
239
|
+
/**
|
|
240
|
+
* Create a new file watcher integration
|
|
241
|
+
* @param registry - Webhook registry to emit events to
|
|
242
|
+
* @param options - Configuration options
|
|
243
|
+
*/
|
|
244
|
+
constructor(registry: WebhookRegistry, options?: {
|
|
245
|
+
inactivityThreshold?: number;
|
|
246
|
+
});
|
|
247
|
+
/**
|
|
248
|
+
* Add a path to watch
|
|
249
|
+
*
|
|
250
|
+
* Files created, changed, or deleted under this path will
|
|
251
|
+
* trigger workflow events. Inactivity detection starts immediately.
|
|
252
|
+
*
|
|
253
|
+
* @param path - Absolute path to watch
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* ```typescript
|
|
257
|
+
* watcher.watch('/path/to/docs');
|
|
258
|
+
* watcher.watch('/path/to/templates');
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
watch(path: string): void;
|
|
262
|
+
/**
|
|
263
|
+
* Stop watching a path
|
|
264
|
+
*
|
|
265
|
+
* Clears inactivity timer and removes path from watch list.
|
|
266
|
+
*
|
|
267
|
+
* @param path - Path to stop watching
|
|
268
|
+
*/
|
|
269
|
+
unwatch(path: string): void;
|
|
270
|
+
/**
|
|
271
|
+
* Stop watching all paths and clear all timers
|
|
272
|
+
*/
|
|
273
|
+
unwatchAll(): void;
|
|
274
|
+
/**
|
|
275
|
+
* Handle file created event
|
|
276
|
+
*
|
|
277
|
+
* @param path - Path to the created file
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* ```typescript
|
|
281
|
+
* // Called by file system watcher
|
|
282
|
+
* fsWatcher.on('add', (path) => {
|
|
283
|
+
* watcher.onFileCreated(path);
|
|
284
|
+
* });
|
|
285
|
+
* ```
|
|
286
|
+
*/
|
|
287
|
+
onFileCreated(path: string): Promise<void>;
|
|
288
|
+
/**
|
|
289
|
+
* Handle file changed event
|
|
290
|
+
*
|
|
291
|
+
* @param path - Path to the changed file
|
|
292
|
+
* @param changes - Optional description of changes (e.g., diff)
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* ```typescript
|
|
296
|
+
* // Called by file system watcher
|
|
297
|
+
* fsWatcher.on('change', (path) => {
|
|
298
|
+
* const diff = computeDiff(path);
|
|
299
|
+
* watcher.onFileChanged(path, diff);
|
|
300
|
+
* });
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
303
|
+
onFileChanged(path: string, changes?: string): Promise<void>;
|
|
304
|
+
/**
|
|
305
|
+
* Handle file deleted event
|
|
306
|
+
*
|
|
307
|
+
* @param path - Path to the deleted file
|
|
308
|
+
*/
|
|
309
|
+
onFileDeleted(path: string): Promise<void>;
|
|
310
|
+
/**
|
|
311
|
+
* Get all watched paths
|
|
312
|
+
* @returns Array of watched paths
|
|
313
|
+
*/
|
|
314
|
+
getWatchedPaths(): string[];
|
|
315
|
+
/**
|
|
316
|
+
* Get last activity timestamp for a path
|
|
317
|
+
* @param path - Path to check
|
|
318
|
+
* @returns Timestamp of last activity, or undefined if not tracked
|
|
319
|
+
*/
|
|
320
|
+
getLastActivity(path: string): number | undefined;
|
|
321
|
+
/**
|
|
322
|
+
* Get the inactivity threshold
|
|
323
|
+
* @returns Inactivity threshold in milliseconds
|
|
324
|
+
*/
|
|
325
|
+
getInactivityThreshold(): number;
|
|
326
|
+
/**
|
|
327
|
+
* Set the inactivity threshold
|
|
328
|
+
*
|
|
329
|
+
* Updates the threshold and resets all active timers with the new value.
|
|
330
|
+
*
|
|
331
|
+
* @param threshold - New threshold in milliseconds
|
|
332
|
+
*/
|
|
333
|
+
setInactivityThreshold(threshold: number): void;
|
|
334
|
+
/**
|
|
335
|
+
* Check if path should be processed
|
|
336
|
+
* @param path - Path to check
|
|
337
|
+
* @returns Whether the path is being watched
|
|
338
|
+
*/
|
|
339
|
+
private shouldProcess;
|
|
340
|
+
/**
|
|
341
|
+
* Update activity timestamp and reset inactivity timer
|
|
342
|
+
* @param path - Path where activity occurred
|
|
343
|
+
*/
|
|
344
|
+
private updateActivity;
|
|
345
|
+
/**
|
|
346
|
+
* Find the watched parent path for a given path
|
|
347
|
+
* @param path - Path to find parent for
|
|
348
|
+
* @returns Watched parent path, or undefined if not found
|
|
349
|
+
*/
|
|
350
|
+
private findWatchedParent;
|
|
351
|
+
/**
|
|
352
|
+
* Reset the inactivity timer for a path
|
|
353
|
+
* @param path - Path to reset timer for
|
|
354
|
+
*/
|
|
355
|
+
private resetInactivityTimer;
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Create a webhook registry instance
|
|
359
|
+
*
|
|
360
|
+
* Factory function for creating a configured webhook registry.
|
|
361
|
+
*
|
|
362
|
+
* @param config - Registry configuration
|
|
363
|
+
* @returns Configured webhook registry
|
|
364
|
+
*
|
|
365
|
+
* @example
|
|
366
|
+
* ```typescript
|
|
367
|
+
* const registry = createWebhookRegistry({
|
|
368
|
+
* secret: process.env.WEBHOOK_SECRET,
|
|
369
|
+
* maxPayloadSize: 2 * 1024 * 1024, // 2MB
|
|
370
|
+
* rateLimit: 50
|
|
371
|
+
* });
|
|
372
|
+
* ```
|
|
373
|
+
*/
|
|
374
|
+
export declare function createWebhookRegistry(config?: WebhookConfig): WebhookRegistry;
|
|
375
|
+
/**
|
|
376
|
+
* Create a file watcher integration instance
|
|
377
|
+
*
|
|
378
|
+
* Factory function for creating a configured file watcher integration.
|
|
379
|
+
*
|
|
380
|
+
* @param registry - Webhook registry to emit events to
|
|
381
|
+
* @param options - Configuration options
|
|
382
|
+
* @returns Configured file watcher integration
|
|
383
|
+
*
|
|
384
|
+
* @example
|
|
385
|
+
* ```typescript
|
|
386
|
+
* const registry = createWebhookRegistry();
|
|
387
|
+
* const watcher = createFileWatcherIntegration(registry, {
|
|
388
|
+
* inactivityThreshold: 10 * 60 * 1000 // 10 minutes
|
|
389
|
+
* });
|
|
390
|
+
*
|
|
391
|
+
* watcher.watch('/docs');
|
|
392
|
+
* ```
|
|
393
|
+
*/
|
|
394
|
+
export declare function createFileWatcherIntegration(registry: WebhookRegistry, options?: {
|
|
395
|
+
inactivityThreshold?: number;
|
|
396
|
+
}): FileWatcherIntegration;
|
|
397
|
+
//# sourceMappingURL=webhook-handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook-handlers.d.ts","sourceRoot":"","sources":["../../../src/workflow/handlers/webhook-handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAGrB,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,qBAAqB,EAAE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