modality-kit 0.1.0 → 0.1.2

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.js CHANGED
@@ -197,10 +197,10 @@ class ErrorCode extends Error {
197
197
  this.name = this.constructor.name;
198
198
  }
199
199
  }
200
- function withErrorHandling(taskFn, operation) {
200
+ function withErrorHandling(fn, operation) {
201
201
  return async (...args) => {
202
202
  try {
203
- return await taskFn(...args);
203
+ return await fn(...args);
204
204
  } catch (error) {
205
205
  if (error instanceof ErrorCode) {
206
206
  logger.error(`${operation || "Task operation"} failed: ${error.code}`, {
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * TypeScript interfaces for tool configuration objects
3
3
  */
4
+ export type AIToolExecutor = (...args: any[]) => Promise<string>;
4
5
  /**
5
6
  * Tool interface for AI SDK compatibility
6
7
  */
@@ -9,7 +10,7 @@ export interface AITool {
9
10
  annotations?: any;
10
11
  description: string;
11
12
  parameters: any;
12
- execute: (parameters: any, options?: any) => Promise<any>;
13
+ execute: AIToolExecutor;
13
14
  }
14
15
  /**
15
16
  * Type for a collection of AI tools
@@ -6,6 +6,6 @@ export declare abstract class ErrorCode extends Error {
6
6
  constructor(message: string);
7
7
  }
8
8
  /**
9
- * Wrapper for MCP task functions that adds consistent error handling
9
+ * Wrapper for any functions that adds consistent error handling
10
10
  */
11
- export declare function withErrorHandling<T extends (...args: any[]) => Promise<string>>(taskFn: T, operation?: string): T;
11
+ export declare function withErrorHandling<T extends (...args: any[]) => Promise<any>>(fn: T, operation?: string): T;
@@ -20,7 +20,7 @@ export declare class ModalityLogger {
20
20
  log(level: LogLevel, payload: any, categroy?: string): void;
21
21
  debug(message: string, error?: Error): void;
22
22
  info(message: string, data?: any): void;
23
- warn(message: string, resolution: string): void;
23
+ warn(message: string, resolution: any): void;
24
24
  error(message: string, error?: Error | unknown, additionalData?: any): void;
25
25
  success(message: string, data?: any): void;
26
26
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.0",
2
+ "version": "0.1.2",
3
3
  "name": "modality-kit",
4
4
  "repository": {
5
5
  "type": "git",