matimo 0.1.0-alpha.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 (90) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +651 -0
  3. package/dist/auth/oauth2-config.d.ts +104 -0
  4. package/dist/auth/oauth2-config.d.ts.map +1 -0
  5. package/dist/auth/oauth2-config.js +38 -0
  6. package/dist/auth/oauth2-config.js.map +1 -0
  7. package/dist/auth/oauth2-handler.d.ts +130 -0
  8. package/dist/auth/oauth2-handler.d.ts.map +1 -0
  9. package/dist/auth/oauth2-handler.js +265 -0
  10. package/dist/auth/oauth2-handler.js.map +1 -0
  11. package/dist/auth/oauth2-provider-loader.d.ts +68 -0
  12. package/dist/auth/oauth2-provider-loader.d.ts.map +1 -0
  13. package/dist/auth/oauth2-provider-loader.js +120 -0
  14. package/dist/auth/oauth2-provider-loader.js.map +1 -0
  15. package/dist/core/schema.d.ts +238 -0
  16. package/dist/core/schema.d.ts.map +1 -0
  17. package/dist/core/schema.js +168 -0
  18. package/dist/core/schema.js.map +1 -0
  19. package/dist/core/tool-loader.d.ts +29 -0
  20. package/dist/core/tool-loader.d.ts.map +1 -0
  21. package/dist/core/tool-loader.js +98 -0
  22. package/dist/core/tool-loader.js.map +1 -0
  23. package/dist/core/tool-registry.d.ts +48 -0
  24. package/dist/core/tool-registry.d.ts.map +1 -0
  25. package/dist/core/tool-registry.js +89 -0
  26. package/dist/core/tool-registry.js.map +1 -0
  27. package/dist/core/types.d.ts +143 -0
  28. package/dist/core/types.d.ts.map +1 -0
  29. package/dist/core/types.js +5 -0
  30. package/dist/core/types.js.map +1 -0
  31. package/dist/decorators/index.d.ts +2 -0
  32. package/dist/decorators/index.d.ts.map +1 -0
  33. package/dist/decorators/index.js +2 -0
  34. package/dist/decorators/index.js.map +1 -0
  35. package/dist/decorators/tool-decorator.d.ts +97 -0
  36. package/dist/decorators/tool-decorator.d.ts.map +1 -0
  37. package/dist/decorators/tool-decorator.js +154 -0
  38. package/dist/decorators/tool-decorator.js.map +1 -0
  39. package/dist/encodings/parameter-encoding.d.ts +51 -0
  40. package/dist/encodings/parameter-encoding.d.ts.map +1 -0
  41. package/dist/encodings/parameter-encoding.js +116 -0
  42. package/dist/encodings/parameter-encoding.js.map +1 -0
  43. package/dist/errors/matimo-error.d.ts +34 -0
  44. package/dist/errors/matimo-error.d.ts.map +1 -0
  45. package/dist/errors/matimo-error.js +49 -0
  46. package/dist/errors/matimo-error.js.map +1 -0
  47. package/dist/executors/command-executor.d.ts +19 -0
  48. package/dist/executors/command-executor.d.ts.map +1 -0
  49. package/dist/executors/command-executor.js +94 -0
  50. package/dist/executors/command-executor.js.map +1 -0
  51. package/dist/executors/http-executor.d.ts +26 -0
  52. package/dist/executors/http-executor.d.ts.map +1 -0
  53. package/dist/executors/http-executor.js +133 -0
  54. package/dist/executors/http-executor.js.map +1 -0
  55. package/dist/index.d.ts +22 -0
  56. package/dist/index.d.ts.map +1 -0
  57. package/dist/index.js +23 -0
  58. package/dist/index.js.map +1 -0
  59. package/dist/matimo-instance.d.ts +98 -0
  60. package/dist/matimo-instance.d.ts.map +1 -0
  61. package/dist/matimo-instance.js +260 -0
  62. package/dist/matimo-instance.js.map +1 -0
  63. package/docs/Gemfile +5 -0
  64. package/docs/RELEASES.md +69 -0
  65. package/docs/ROADMAP.md +138 -0
  66. package/docs/_config.yml +27 -0
  67. package/docs/api-reference/ERRORS.md +445 -0
  68. package/docs/api-reference/SDK.md +582 -0
  69. package/docs/api-reference/TYPES.md +415 -0
  70. package/docs/architecture/OAUTH.md +1366 -0
  71. package/docs/architecture/OVERVIEW.md +564 -0
  72. package/docs/assets/logo.png +0 -0
  73. package/docs/community/COMMIT_GUIDELINES.md +552 -0
  74. package/docs/framework-integrations/LANGCHAIN.md +286 -0
  75. package/docs/getting-started/QUICK_START.md +211 -0
  76. package/docs/getting-started/YOUR_FIRST_TOOL.md +217 -0
  77. package/docs/getting-started/installation.md +124 -0
  78. package/docs/index.md +288 -0
  79. package/docs/tool-development/DECORATOR_GUIDE.md +633 -0
  80. package/docs/tool-development/OAUTH_LINK.md +5 -0
  81. package/docs/tool-development/PROVIDER_CONFIGURATION.md +458 -0
  82. package/docs/tool-development/TESTING.md +412 -0
  83. package/docs/tool-development/TOOL_SPECIFICATION.md +793 -0
  84. package/docs/tool-development/YAML_TOOLS.md +65 -0
  85. package/docs/troubleshooting/FAQ.md +391 -0
  86. package/docs/user-guide/AUTHENTICATION.md +255 -0
  87. package/docs/user-guide/DEVELOPMENT_STANDARDS.md +698 -0
  88. package/docs/user-guide/SDK_PATTERNS.md +316 -0
  89. package/docs/user-guide/TOOL_DISCOVERY.md +209 -0
  90. package/package.json +96 -0
@@ -0,0 +1,98 @@
1
+ import * as fs from 'fs';
2
+ import * as path from 'path';
3
+ import * as YAML from 'js-yaml';
4
+ import { validateToolDefinition } from './schema';
5
+ /**
6
+ * Tool Loader - Loads and validates YAML/JSON tool definitions
7
+ * Implements TDD pattern: test failures guide implementation
8
+ */
9
+ export class ToolLoader {
10
+ /**
11
+ * Load a single tool from a YAML or JSON file
12
+ * @param filePath - Path to tool definition file
13
+ * @returns Validated tool definition
14
+ * @throws {Error} If file not found or invalid schema
15
+ */
16
+ loadToolFromFile(filePath) {
17
+ // Read file
18
+ if (!fs.existsSync(filePath)) {
19
+ throw new Error(`Tool file not found: ${filePath}`);
20
+ }
21
+ const content = fs.readFileSync(filePath, 'utf-8');
22
+ // Parse based on file extension
23
+ let parsed;
24
+ const ext = path.extname(filePath).toLowerCase();
25
+ if (ext === '.yaml' || ext === '.yml') {
26
+ parsed = YAML.load(content);
27
+ }
28
+ else if (ext === '.json') {
29
+ parsed = JSON.parse(content);
30
+ }
31
+ else {
32
+ throw new Error(`Unsupported file format: ${ext}. Use .yaml or .json`);
33
+ }
34
+ // Validate against schema
35
+ try {
36
+ return validateToolDefinition(parsed);
37
+ }
38
+ catch (error) {
39
+ const message = error instanceof Error ? error.message : String(error);
40
+ throw new Error(`Invalid tool definition in ${filePath}:\n${message}`);
41
+ }
42
+ }
43
+ /**
44
+ * Load all tools from a directory
45
+ * @param dirPath - Path to directory containing tool files
46
+ * @returns Map of tool names to definitions
47
+ * @note Prefers definition.yaml/definition.json over tool.yaml/tool.json
48
+ */
49
+ loadToolsFromDirectory(dirPath) {
50
+ const tools = new Map();
51
+ if (!fs.existsSync(dirPath)) {
52
+ throw new Error(`Tools directory not found: ${dirPath}`);
53
+ }
54
+ // Recursively find all definition files (definition.yaml/definition.json preferred)
55
+ // Also finds tool.yaml/tool.json for backwards compatibility
56
+ const findToolFiles = (dir) => {
57
+ const files = [];
58
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
59
+ for (const entry of entries) {
60
+ const fullPath = path.join(dir, entry.name);
61
+ if (entry.isDirectory()) {
62
+ files.push(...findToolFiles(fullPath));
63
+ }
64
+ else if (entry.isFile() &&
65
+ (/^definition\.(yaml|yml|json)$/.test(entry.name) ||
66
+ /^tool\.(yaml|yml|json)$/.test(entry.name))) {
67
+ files.push(fullPath);
68
+ }
69
+ }
70
+ return files;
71
+ };
72
+ const toolFiles = findToolFiles(dirPath);
73
+ for (const file of toolFiles) {
74
+ try {
75
+ const tool = this.loadToolFromFile(file);
76
+ // Don't add if we already have this tool (definition.yaml takes precedence)
77
+ if (!tools.has(tool.name)) {
78
+ tools.set(tool.name, tool);
79
+ }
80
+ }
81
+ catch {
82
+ // Skip files that fail validation - they may not be tool definitions
83
+ // (e.g., provider definitions are in tools/ directory but are not tools)
84
+ }
85
+ }
86
+ return tools;
87
+ }
88
+ /**
89
+ * Load a tool from a JSON object
90
+ * @param data - Tool definition as object
91
+ * @returns Validated tool definition
92
+ */
93
+ loadToolFromObject(data) {
94
+ return validateToolDefinition(data);
95
+ }
96
+ }
97
+ export default ToolLoader;
98
+ //# sourceMappingURL=tool-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-loader.js","sourceRoot":"","sources":["../../src/core/tool-loader.ts"],"names":[],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BACH,MAAM,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;gBACzC,4EAA4E;gBAC5E,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC1B,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC7B,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,qEAAqE;gBACrE,yEAAyE;YAC3E,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;OAIG;IACH,kBAAkB,CAAC,IAAa;QAC9B,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;CACF;AAED,eAAe,UAAU,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { ToolDefinition } from './schema';
2
+ /**
3
+ * Tool Registry - In-memory store for loaded tools
4
+ * Enables tool discovery and management
5
+ */
6
+ export declare class ToolRegistry {
7
+ private tools;
8
+ private toolsByTag;
9
+ /**
10
+ * Register a tool in the registry
11
+ * @param tool - Tool definition to register
12
+ */
13
+ register(tool: ToolDefinition): void;
14
+ /**
15
+ * Register multiple tools
16
+ */
17
+ registerAll(tools: ToolDefinition[]): void;
18
+ /**
19
+ * Get a tool by name
20
+ */
21
+ get(name: string): ToolDefinition | undefined;
22
+ /**
23
+ * Check if a tool exists
24
+ */
25
+ has(name: string): boolean;
26
+ /**
27
+ * Get all tools
28
+ */
29
+ getAll(): ToolDefinition[];
30
+ /**
31
+ * Get tools by tag
32
+ */
33
+ getByTag(tag: string): ToolDefinition[];
34
+ /**
35
+ * Search tools by name (partial match)
36
+ */
37
+ search(query: string): ToolDefinition[];
38
+ /**
39
+ * Get total count of registered tools
40
+ */
41
+ count(): number;
42
+ /**
43
+ * Clear all tools
44
+ */
45
+ clear(): void;
46
+ }
47
+ export default ToolRegistry;
48
+ //# sourceMappingURL=tool-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-registry.d.ts","sourceRoot":"","sources":["../../src/core/tool-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C;;;GAGG;AAEH,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAA0C;IACvD,OAAO,CAAC,UAAU,CAAuC;IAEzD;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI;IAkBpC;;OAEG;IACH,WAAW,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,IAAI;IAM1C;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAI7C;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B;;OAEG;IACH,MAAM,IAAI,cAAc,EAAE;IAI1B;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,EAAE;IAQvC;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,EAAE;IASvC;;OAEG;IACH,KAAK,IAAI,MAAM;IAIf;;OAEG;IACH,KAAK,IAAI,IAAI;CAId;AAED,eAAe,YAAY,CAAC"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Tool Registry - In-memory store for loaded tools
3
+ * Enables tool discovery and management
4
+ */
5
+ export class ToolRegistry {
6
+ constructor() {
7
+ this.tools = new Map();
8
+ this.toolsByTag = new Map();
9
+ }
10
+ /**
11
+ * Register a tool in the registry
12
+ * @param tool - Tool definition to register
13
+ */
14
+ register(tool) {
15
+ if (this.tools.has(tool.name)) {
16
+ throw new Error(`Tool '${tool.name}' is already registered`);
17
+ }
18
+ this.tools.set(tool.name, tool);
19
+ // Index by tags for discovery
20
+ if (tool.tags && tool.tags.length > 0) {
21
+ for (const tag of tool.tags) {
22
+ if (!this.toolsByTag.has(tag)) {
23
+ this.toolsByTag.set(tag, new Set());
24
+ }
25
+ this.toolsByTag.get(tag).add(tool.name);
26
+ }
27
+ }
28
+ }
29
+ /**
30
+ * Register multiple tools
31
+ */
32
+ registerAll(tools) {
33
+ for (const tool of tools) {
34
+ this.register(tool);
35
+ }
36
+ }
37
+ /**
38
+ * Get a tool by name
39
+ */
40
+ get(name) {
41
+ return this.tools.get(name);
42
+ }
43
+ /**
44
+ * Check if a tool exists
45
+ */
46
+ has(name) {
47
+ return this.tools.has(name);
48
+ }
49
+ /**
50
+ * Get all tools
51
+ */
52
+ getAll() {
53
+ return Array.from(this.tools.values());
54
+ }
55
+ /**
56
+ * Get tools by tag
57
+ */
58
+ getByTag(tag) {
59
+ const toolNames = this.toolsByTag.get(tag);
60
+ if (!toolNames)
61
+ return [];
62
+ return Array.from(toolNames)
63
+ .map((name) => this.tools.get(name))
64
+ .filter((tool) => tool !== undefined);
65
+ }
66
+ /**
67
+ * Search tools by name (partial match)
68
+ */
69
+ search(query) {
70
+ const lowerQuery = query.toLowerCase();
71
+ return this.getAll().filter((tool) => tool.name.toLowerCase().includes(lowerQuery) ||
72
+ tool.description.toLowerCase().includes(lowerQuery));
73
+ }
74
+ /**
75
+ * Get total count of registered tools
76
+ */
77
+ count() {
78
+ return this.tools.size;
79
+ }
80
+ /**
81
+ * Clear all tools
82
+ */
83
+ clear() {
84
+ this.tools.clear();
85
+ this.toolsByTag.clear();
86
+ }
87
+ }
88
+ export default ToolRegistry;
89
+ //# sourceMappingURL=tool-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-registry.js","sourceRoot":"","sources":["../../src/core/tool-registry.ts"],"names":[],"mappings":"AAEA;;;GAGG;AAEH,MAAM,OAAO,YAAY;IAAzB;QACU,UAAK,GAAgC,IAAI,GAAG,EAAE,CAAC;QAC/C,eAAU,GAA6B,IAAI,GAAG,EAAE,CAAC;IA2F3D,CAAC;IAzFC;;;OAGG;IACH,QAAQ,CAAC,IAAoB;QAC3B,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAA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;QAClB,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC3C,IAAI,CAAC,SAAS;YAAE,OAAO,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;aACzB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;aACnC,MAAM,CAAC,CAAC,IAAI,EAA0B,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;IAClE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAa;QAClB,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QACvC,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,MAAM,CACzB,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC;YAC5C,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,CACtD,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;CACF;AAED,eAAe,YAAY,CAAC"}
@@ -0,0 +1,143 @@
1
+ /**
2
+ * Core type definitions for Matimo tool ecosystem
3
+ */
4
+ import { ParameterEncodingConfig } from '../encodings/parameter-encoding';
5
+ /**
6
+ * Parameter definition for a tool
7
+ */
8
+ export interface Parameter {
9
+ type: 'string' | 'number' | 'boolean' | 'array' | 'object';
10
+ description: string;
11
+ required?: boolean;
12
+ enum?: (string | number | boolean)[];
13
+ default?: unknown;
14
+ items?: Parameter;
15
+ properties?: Record<string, Parameter>;
16
+ }
17
+ /**
18
+ * Authentication configuration for a tool
19
+ */
20
+ export interface AuthConfig {
21
+ type: 'none' | 'api_key' | 'oauth2' | 'basic' | 'bearer';
22
+ location?: 'header' | 'query' | 'body';
23
+ name?: string;
24
+ scheme?: string;
25
+ }
26
+ /**
27
+ * HTTP execution configuration
28
+ */
29
+ export interface HttpExecution {
30
+ type: 'http';
31
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
32
+ url: string;
33
+ headers?: Record<string, string>;
34
+ body?: Record<string, unknown>;
35
+ params?: Record<string, string>;
36
+ query_params?: Record<string, string>;
37
+ parameter_encoding?: ParameterEncodingConfig[];
38
+ timeout?: number;
39
+ }
40
+ /**
41
+ * Command execution configuration
42
+ */
43
+ export interface CommandExecution {
44
+ type: 'command';
45
+ command: string;
46
+ args?: string[];
47
+ cwd?: string;
48
+ shell?: boolean;
49
+ timeout?: number;
50
+ env?: Record<string, string>;
51
+ }
52
+ /**
53
+ * Output schema for tool response validation
54
+ */
55
+ export interface OutputSchema {
56
+ type: 'object' | 'array' | 'string' | 'number' | 'boolean';
57
+ properties?: Record<string, OutputSchema>;
58
+ items?: OutputSchema;
59
+ description?: string;
60
+ }
61
+ /**
62
+ * Rate limiting configuration
63
+ */
64
+ export interface RateLimitConfig {
65
+ enabled?: boolean;
66
+ requests_per_minute?: number;
67
+ requests_per_hour?: number;
68
+ burst_size?: number;
69
+ }
70
+ /**
71
+ * Error handling configuration
72
+ */
73
+ export interface ErrorHandlingConfig {
74
+ retry?: number;
75
+ backoff_type?: 'exponential' | 'linear' | 'fixed';
76
+ initial_delay_ms?: number;
77
+ max_delay_ms?: number;
78
+ }
79
+ /**
80
+ * Tool example configuration
81
+ */
82
+ export interface ToolExample {
83
+ name: string;
84
+ params: Record<string, unknown>;
85
+ description?: string;
86
+ }
87
+ /**
88
+ * Complete tool definition
89
+ */
90
+ export interface ToolDefinition {
91
+ name: string;
92
+ version: string;
93
+ description: string;
94
+ parameters: Record<string, Parameter>;
95
+ execution: HttpExecution | CommandExecution;
96
+ authentication?: AuthConfig;
97
+ output_schema?: OutputSchema;
98
+ rate_limiting?: RateLimitConfig;
99
+ error_handling?: ErrorHandlingConfig;
100
+ examples?: ToolExample[];
101
+ deprecated?: boolean;
102
+ deprecation_message?: string;
103
+ tags?: string[];
104
+ }
105
+ /**
106
+ * Tool execution result
107
+ */
108
+ export interface ExecutionResult {
109
+ success: boolean;
110
+ data?: unknown;
111
+ error?: string;
112
+ statusCode?: number;
113
+ duration: number;
114
+ traceId: string;
115
+ }
116
+ /**
117
+ * Execution context for a tool run
118
+ */
119
+ export interface ExecutionContext {
120
+ traceId: string;
121
+ userId?: string;
122
+ toolName: string;
123
+ parameters: Record<string, unknown>;
124
+ timestamp: Date;
125
+ secrets: Record<string, string>;
126
+ }
127
+ /**
128
+ * Schema validation error
129
+ */
130
+ export interface ValidationError {
131
+ field: string;
132
+ message: string;
133
+ expectedType?: string;
134
+ receivedValue?: unknown;
135
+ }
136
+ /**
137
+ * Validation result
138
+ */
139
+ export interface ValidationResult {
140
+ valid: boolean;
141
+ errors: ValidationError[];
142
+ }
143
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC3D,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC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AAE,OAAO,CAAC;IACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,SAAS,EAAE,IAAI,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Core type definitions for Matimo tool ecosystem
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,2 @@
1
+ export { tool, setGlobalMatimoInstance, getGlobalMatimoInstance } from './tool-decorator';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { tool, setGlobalMatimoInstance, getGlobalMatimoInstance } from './tool-decorator';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,97 @@
1
+ import { ToolDefinition } from '../core/types.js';
2
+ import type { MatimoInstance } from '../matimo-instance.js';
3
+ /**
4
+ * Set the global Matimo instance for decorator usage
5
+ *
6
+ * Must be called before any @tool decorated methods are invoked
7
+ *
8
+ * @param instance - The MatimoInstance to use globally
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * const matimo = await MatimoInstance.init('./tools');
13
+ * setGlobalMatimoInstance(matimo);
14
+ *
15
+ * class MyAgent {
16
+ * @tool('calculator')
17
+ * async calculate(operation: string, a: number, b: number) { }
18
+ * }
19
+ *
20
+ * const agent = new MyAgent();
21
+ * await agent.calculate('add', 5, 3);
22
+ * ```
23
+ */
24
+ export declare function setGlobalMatimoInstance(instance: MatimoInstance | null): void;
25
+ /**
26
+ * Get the global Matimo instance
27
+ *
28
+ * @throws {Error} If no global instance is set
29
+ */
30
+ export declare function getGlobalMatimoInstance(): MatimoInstance;
31
+ /**
32
+ * Tool decorator - transforms a method into a tool executor
33
+ *
34
+ * Automatically calls matimo.execute() with the method's arguments mapped to tool parameters.
35
+ * Must be used in a class that has a `matimo` property or after setGlobalMatimoInstance() is called.
36
+ *
37
+ * Works with both traditional and modern TypeScript decorator syntax.
38
+ *
39
+ * @param toolName - Name of the tool to execute (e.g., 'calculator', 'github-get-repo')
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * // Using global instance
44
+ * const matimo = await MatimoInstance.init('./tools');
45
+ * setGlobalMatimoInstance(matimo);
46
+ *
47
+ * class MyAgent {
48
+ * @tool('calculator')
49
+ * async calculate(operation: string, a: number, b: number) {
50
+ * // Automatically executes: matimo.execute('calculator', { operation, a, b })
51
+ * }
52
+ *
53
+ * @tool('github-get-repo')
54
+ * async getRepo(owner: string, repo: string) {
55
+ * // Automatically executes: matimo.execute('github-get-repo', { owner, repo })
56
+ * }
57
+ * }
58
+ *
59
+ * const agent = new MyAgent();
60
+ * const result = await agent.calculate('add', 5, 3);
61
+ * ```
62
+ *
63
+ * @example
64
+ * ```typescript
65
+ * // Using instance property
66
+ * class MyAgent {
67
+ * constructor(public matimo: MatimoInstance) {}
68
+ *
69
+ * @tool('calculator')
70
+ * async calculate(operation: string, a: number, b: number) { }
71
+ * }
72
+ *
73
+ * const matimo = await MatimoInstance.init('./tools');
74
+ * const agent = new MyAgent(matimo);
75
+ * const result = await agent.calculate('add', 5, 3);
76
+ * ```
77
+ */
78
+ export declare function tool(toolName: string): <This, Args extends unknown[], Return>(_target: (this: This, ...args: Args) => Return, _context: any) => (this: any, ...args: Args) => Promise<unknown>;
79
+ /**
80
+ * Execute tool via decorator - shared logic for both decorator syntaxes
81
+ * Exported for testing purposes
82
+ */
83
+ export declare function executeToolViaDecorator(toolName: string, thisArg: unknown, args: any[]): Promise<unknown>;
84
+ /**
85
+ * Convert positional arguments to named parameters object
86
+ * Maps function arguments to tool parameter names in order
87
+ * Exported for testing purposes
88
+ *
89
+ * @example
90
+ * ```
91
+ * Tool has parameters: { operation, a, b }
92
+ * Args: ['add', 5, 3]
93
+ * Result: { operation: 'add', a: 5, b: 3 }
94
+ * ```
95
+ */
96
+ export declare function convertArgsToParams(args: unknown[], toolDef: ToolDefinition): Record<string, unknown>;
97
+ //# sourceMappingURL=tool-decorator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/tool-decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAQ5D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,GAAG,IAAI,CAE7E;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,IAAI,cAAc,CAOxD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAgB,IAAI,CAAC,QAAQ,EAAE,MAAM,IAClB,IAAI,EAAE,IAAI,SAAS,OAAO,EAAE,EAAE,MAAM,EACnD,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,IAAI,KAAK,MAAM,EAE9C,UAAU,GAAG,MAOU,MAAM,GAAG,EAAE,GAAG,MAAM,IAAI,KAAG,OAAO,CAAC,OAAO,CAAC,CAIrE;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,OAAO,EAEhB,IAAI,EAAE,GAAG,EAAE,GACV,OAAO,CAAC,OAAO,CAAC,CA+BlB;AACD;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,OAAO,EAAE,EACf,OAAO,EAAE,cAAc,GACtB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAczB"}