@rainfall-devkit/sdk 0.2.2 → 0.2.3

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/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { l as RainfallClient } from './sdk-4OvXPr8E.mjs';
2
- export { A as AI, b as ApiError, c as ApiResponse, d as Articles, D as Data, I as Integrations, M as Memory, a as Rainfall, R as RainfallConfig, e as RateLimitInfo, f as RequestOptions, T as ToolSchema, U as Utils, W as Web } from './sdk-4OvXPr8E.mjs';
1
+ import { l as RainfallClient, a as Rainfall } from './sdk-Cl5Qzt4I.mjs';
2
+ export { A as AI, b as ApiError, c as ApiResponse, d as Articles, D as Data, I as Integrations, M as Memory, P as ParamSchema, R as RainfallConfig, e as RateLimitInfo, f as RequestOptions, m as ToolParamsSchema, T as ToolSchema, U as Utils, V as ValidationIssue, n as ValidationResult, W as Web, o as clearSchemaCache, p as fetchToolSchema, q as formatValidationErrors, v as validateParams } from './sdk-Cl5Qzt4I.mjs';
3
3
  export { A as AuthenticationError, N as NetworkError, a as NotFoundError, R as RainfallError, b as RateLimitError, S as ServerError, T as TimeoutError, c as ToolNotFoundError, V as ValidationError } from './errors-BMPseAnM.mjs';
4
- export { C as ContextOptions, c as CronTriggerConfig, E as EdgeNodeRegistration, F as FileWatcherConfig, L as ListenerEvent, d as ListenerRegistry, M as MemoryEntry, N as NetworkedExecutorOptions, e as NodeCapabilities, Q as QueuedJob, a as RainfallDaemonContext, b as RainfallListenerRegistry, R as RainfallNetworkedExecutor, S as SessionContext, T as ToolExecutionRecord, f as createCronWorkflow, g as createFileWatcherWorkflow } from './listeners-MNAnpZj-.mjs';
4
+ export { C as ContextOptions, c as CronTriggerConfig, E as EdgeNodeRegistration, F as FileWatcherConfig, L as ListenerEvent, d as ListenerRegistry, M as MemoryEntry, N as NetworkedExecutorOptions, e as NodeCapabilities, Q as QueuedJob, a as RainfallDaemonContext, b as RainfallListenerRegistry, R as RainfallNetworkedExecutor, S as SessionContext, T as ToolExecutionRecord, f as createCronWorkflow, g as createFileWatcherWorkflow } from './listeners-Ckdj6D8T.mjs';
5
5
  import 'ws';
6
6
  import '@modelcontextprotocol/sdk/client/index.js';
7
7
  import '@modelcontextprotocol/sdk/client/stdio.js';
@@ -247,6 +247,68 @@ declare function createSecureEdgeClient(client: RainfallClient, options: {
247
247
  backendSecret?: string;
248
248
  }): Promise<SecureEdgeClient>;
249
249
 
250
+ /**
251
+ * CLI handler types for tool-specific preflight/postflight/display overrides
252
+ */
253
+
254
+ interface ToolContext {
255
+ rainfall: Rainfall;
256
+ toolId: string;
257
+ params: Record<string, unknown>;
258
+ args: string[];
259
+ flags: {
260
+ raw?: boolean;
261
+ quiet?: boolean;
262
+ [key: string]: unknown;
263
+ };
264
+ }
265
+ interface PreflightResult {
266
+ /** Modified params to use for execution */
267
+ params?: Record<string, unknown>;
268
+ /** Skip normal execution and return this result directly */
269
+ skipExecution?: unknown;
270
+ /** Additional context to pass to postflight */
271
+ context?: Record<string, unknown>;
272
+ }
273
+ interface PostflightContext extends ToolContext {
274
+ /** The result from tool execution (or skipExecution) */
275
+ result: unknown;
276
+ /** Context passed from preflight */
277
+ preflightContext?: Record<string, unknown>;
278
+ }
279
+ interface DisplayContext extends PostflightContext {
280
+ /** Output stream (for testing/custom output) */
281
+ output?: NodeJS.WriteStream;
282
+ }
283
+ /** Tool handler interface for custom CLI behavior */
284
+ interface ToolHandler {
285
+ /** Tool ID this handler applies to (or pattern) */
286
+ toolId: string | RegExp;
287
+ /**
288
+ * Preflight: Modify params, validate, or skip execution entirely
289
+ * Called before tool execution
290
+ */
291
+ preflight?(context: ToolContext): Promise<PreflightResult | void> | PreflightResult | void;
292
+ /**
293
+ * Postflight: Process result, trigger side effects
294
+ * Called after successful tool execution
295
+ */
296
+ postflight?(context: PostflightContext): Promise<void> | void;
297
+ /**
298
+ * Display: Custom output formatting
299
+ * Return true if handled, false to use default display
300
+ */
301
+ display?(context: DisplayContext): Promise<boolean> | boolean;
302
+ }
303
+ /** Registry of tool handlers */
304
+ declare class ToolHandlerRegistry {
305
+ private handlers;
306
+ register(handler: ToolHandler): void;
307
+ findHandler(toolId: string): ToolHandler | undefined;
308
+ getAllHandlers(): ToolHandler[];
309
+ }
310
+ declare const globalHandlerRegistry: ToolHandlerRegistry;
311
+
250
312
  /**
251
313
  * Rainfall SDK - Official SDK for Rainfall API
252
314
  *
@@ -273,4 +335,4 @@ declare function createSecureEdgeClient(client: RainfallClient, options: {
273
335
 
274
336
  declare const VERSION = "0.1.0";
275
337
 
276
- export { type ACLCheck, type ACLResult, type EdgeNodeJWT, EdgeNodeSecurity, type EncryptedPayload, type JWTPayload, type JobResult, type KeyPair, RainfallClient, SecureEdgeClient, type SecureEdgeConfig, type SecureJob, VERSION, createEdgeNodeSecurity, createSecureEdgeClient };
338
+ export { type ACLCheck, type ACLResult, type DisplayContext, type EdgeNodeJWT, EdgeNodeSecurity, type EncryptedPayload, type JWTPayload, type JobResult, type KeyPair, type PostflightContext, type PreflightResult, Rainfall, RainfallClient, SecureEdgeClient, type SecureEdgeConfig, type SecureJob, type ToolContext, type ToolHandler, ToolHandlerRegistry, VERSION, createEdgeNodeSecurity, createSecureEdgeClient, globalHandlerRegistry };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { l as RainfallClient } from './sdk-4OvXPr8E.js';
2
- export { A as AI, b as ApiError, c as ApiResponse, d as Articles, D as Data, I as Integrations, M as Memory, a as Rainfall, R as RainfallConfig, e as RateLimitInfo, f as RequestOptions, T as ToolSchema, U as Utils, W as Web } from './sdk-4OvXPr8E.js';
1
+ import { l as RainfallClient, a as Rainfall } from './sdk-Cl5Qzt4I.js';
2
+ export { A as AI, b as ApiError, c as ApiResponse, d as Articles, D as Data, I as Integrations, M as Memory, P as ParamSchema, R as RainfallConfig, e as RateLimitInfo, f as RequestOptions, m as ToolParamsSchema, T as ToolSchema, U as Utils, V as ValidationIssue, n as ValidationResult, W as Web, o as clearSchemaCache, p as fetchToolSchema, q as formatValidationErrors, v as validateParams } from './sdk-Cl5Qzt4I.js';
3
3
  export { A as AuthenticationError, N as NetworkError, a as NotFoundError, R as RainfallError, b as RateLimitError, S as ServerError, T as TimeoutError, c as ToolNotFoundError, V as ValidationError } from './errors-BMPseAnM.js';
4
- export { C as ContextOptions, c as CronTriggerConfig, E as EdgeNodeRegistration, F as FileWatcherConfig, L as ListenerEvent, d as ListenerRegistry, M as MemoryEntry, N as NetworkedExecutorOptions, e as NodeCapabilities, Q as QueuedJob, a as RainfallDaemonContext, b as RainfallListenerRegistry, R as RainfallNetworkedExecutor, S as SessionContext, T as ToolExecutionRecord, f as createCronWorkflow, g as createFileWatcherWorkflow } from './listeners-B5Vy9Ao5.js';
4
+ export { C as ContextOptions, c as CronTriggerConfig, E as EdgeNodeRegistration, F as FileWatcherConfig, L as ListenerEvent, d as ListenerRegistry, M as MemoryEntry, N as NetworkedExecutorOptions, e as NodeCapabilities, Q as QueuedJob, a as RainfallDaemonContext, b as RainfallListenerRegistry, R as RainfallNetworkedExecutor, S as SessionContext, T as ToolExecutionRecord, f as createCronWorkflow, g as createFileWatcherWorkflow } from './listeners-BBNBsJCk.js';
5
5
  import 'ws';
6
6
  import '@modelcontextprotocol/sdk/client/index.js';
7
7
  import '@modelcontextprotocol/sdk/client/stdio.js';
@@ -247,6 +247,68 @@ declare function createSecureEdgeClient(client: RainfallClient, options: {
247
247
  backendSecret?: string;
248
248
  }): Promise<SecureEdgeClient>;
249
249
 
250
+ /**
251
+ * CLI handler types for tool-specific preflight/postflight/display overrides
252
+ */
253
+
254
+ interface ToolContext {
255
+ rainfall: Rainfall;
256
+ toolId: string;
257
+ params: Record<string, unknown>;
258
+ args: string[];
259
+ flags: {
260
+ raw?: boolean;
261
+ quiet?: boolean;
262
+ [key: string]: unknown;
263
+ };
264
+ }
265
+ interface PreflightResult {
266
+ /** Modified params to use for execution */
267
+ params?: Record<string, unknown>;
268
+ /** Skip normal execution and return this result directly */
269
+ skipExecution?: unknown;
270
+ /** Additional context to pass to postflight */
271
+ context?: Record<string, unknown>;
272
+ }
273
+ interface PostflightContext extends ToolContext {
274
+ /** The result from tool execution (or skipExecution) */
275
+ result: unknown;
276
+ /** Context passed from preflight */
277
+ preflightContext?: Record<string, unknown>;
278
+ }
279
+ interface DisplayContext extends PostflightContext {
280
+ /** Output stream (for testing/custom output) */
281
+ output?: NodeJS.WriteStream;
282
+ }
283
+ /** Tool handler interface for custom CLI behavior */
284
+ interface ToolHandler {
285
+ /** Tool ID this handler applies to (or pattern) */
286
+ toolId: string | RegExp;
287
+ /**
288
+ * Preflight: Modify params, validate, or skip execution entirely
289
+ * Called before tool execution
290
+ */
291
+ preflight?(context: ToolContext): Promise<PreflightResult | void> | PreflightResult | void;
292
+ /**
293
+ * Postflight: Process result, trigger side effects
294
+ * Called after successful tool execution
295
+ */
296
+ postflight?(context: PostflightContext): Promise<void> | void;
297
+ /**
298
+ * Display: Custom output formatting
299
+ * Return true if handled, false to use default display
300
+ */
301
+ display?(context: DisplayContext): Promise<boolean> | boolean;
302
+ }
303
+ /** Registry of tool handlers */
304
+ declare class ToolHandlerRegistry {
305
+ private handlers;
306
+ register(handler: ToolHandler): void;
307
+ findHandler(toolId: string): ToolHandler | undefined;
308
+ getAllHandlers(): ToolHandler[];
309
+ }
310
+ declare const globalHandlerRegistry: ToolHandlerRegistry;
311
+
250
312
  /**
251
313
  * Rainfall SDK - Official SDK for Rainfall API
252
314
  *
@@ -273,4 +335,4 @@ declare function createSecureEdgeClient(client: RainfallClient, options: {
273
335
 
274
336
  declare const VERSION = "0.1.0";
275
337
 
276
- export { type ACLCheck, type ACLResult, type EdgeNodeJWT, EdgeNodeSecurity, type EncryptedPayload, type JWTPayload, type JobResult, type KeyPair, RainfallClient, SecureEdgeClient, type SecureEdgeConfig, type SecureJob, VERSION, createEdgeNodeSecurity, createSecureEdgeClient };
338
+ export { type ACLCheck, type ACLResult, type DisplayContext, type EdgeNodeJWT, EdgeNodeSecurity, type EncryptedPayload, type JWTPayload, type JobResult, type KeyPair, type PostflightContext, type PreflightResult, Rainfall, RainfallClient, SecureEdgeClient, type SecureEdgeConfig, type SecureJob, type ToolContext, type ToolHandler, ToolHandlerRegistry, VERSION, createEdgeNodeSecurity, createSecureEdgeClient, globalHandlerRegistry };