@matimo/core 0.1.0-alpha.4

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 (77) hide show
  1. package/LICENSE +21 -0
  2. package/dist/src/auth/oauth2-config.d.ts +104 -0
  3. package/dist/src/auth/oauth2-config.d.ts.map +1 -0
  4. package/dist/src/auth/oauth2-config.js +38 -0
  5. package/dist/src/auth/oauth2-config.js.map +1 -0
  6. package/dist/src/auth/oauth2-handler.d.ts +130 -0
  7. package/dist/src/auth/oauth2-handler.d.ts.map +1 -0
  8. package/dist/src/auth/oauth2-handler.js +265 -0
  9. package/dist/src/auth/oauth2-handler.js.map +1 -0
  10. package/dist/src/auth/oauth2-provider-loader.d.ts +68 -0
  11. package/dist/src/auth/oauth2-provider-loader.d.ts.map +1 -0
  12. package/dist/src/auth/oauth2-provider-loader.js +120 -0
  13. package/dist/src/auth/oauth2-provider-loader.js.map +1 -0
  14. package/dist/src/core/schema.d.ts +248 -0
  15. package/dist/src/core/schema.d.ts.map +1 -0
  16. package/dist/src/core/schema.js +182 -0
  17. package/dist/src/core/schema.js.map +1 -0
  18. package/dist/src/core/tool-loader.d.ts +45 -0
  19. package/dist/src/core/tool-loader.d.ts.map +1 -0
  20. package/dist/src/core/tool-loader.js +205 -0
  21. package/dist/src/core/tool-loader.js.map +1 -0
  22. package/dist/src/core/tool-registry.d.ts +48 -0
  23. package/dist/src/core/tool-registry.d.ts.map +1 -0
  24. package/dist/src/core/tool-registry.js +93 -0
  25. package/dist/src/core/tool-registry.js.map +1 -0
  26. package/dist/src/core/types.d.ts +157 -0
  27. package/dist/src/core/types.d.ts.map +1 -0
  28. package/dist/src/core/types.js +5 -0
  29. package/dist/src/core/types.js.map +1 -0
  30. package/dist/src/decorators/index.d.ts +2 -0
  31. package/dist/src/decorators/index.d.ts.map +1 -0
  32. package/dist/src/decorators/index.js +2 -0
  33. package/dist/src/decorators/index.js.map +1 -0
  34. package/dist/src/decorators/tool-decorator.d.ts +97 -0
  35. package/dist/src/decorators/tool-decorator.d.ts.map +1 -0
  36. package/dist/src/decorators/tool-decorator.js +157 -0
  37. package/dist/src/decorators/tool-decorator.js.map +1 -0
  38. package/dist/src/encodings/parameter-encoding.d.ts +51 -0
  39. package/dist/src/encodings/parameter-encoding.d.ts.map +1 -0
  40. package/dist/src/encodings/parameter-encoding.js +123 -0
  41. package/dist/src/encodings/parameter-encoding.js.map +1 -0
  42. package/dist/src/errors/matimo-error.d.ts +34 -0
  43. package/dist/src/errors/matimo-error.d.ts.map +1 -0
  44. package/dist/src/errors/matimo-error.js +49 -0
  45. package/dist/src/errors/matimo-error.js.map +1 -0
  46. package/dist/src/executors/command-executor.d.ts +19 -0
  47. package/dist/src/executors/command-executor.d.ts.map +1 -0
  48. package/dist/src/executors/command-executor.js +98 -0
  49. package/dist/src/executors/command-executor.js.map +1 -0
  50. package/dist/src/executors/function-executor.d.ts +23 -0
  51. package/dist/src/executors/function-executor.d.ts.map +1 -0
  52. package/dist/src/executors/function-executor.js +164 -0
  53. package/dist/src/executors/function-executor.js.map +1 -0
  54. package/dist/src/executors/http-executor.d.ts +26 -0
  55. package/dist/src/executors/http-executor.d.ts.map +1 -0
  56. package/dist/src/executors/http-executor.js +137 -0
  57. package/dist/src/executors/http-executor.js.map +1 -0
  58. package/dist/src/index.d.ts +26 -0
  59. package/dist/src/index.d.ts.map +1 -0
  60. package/dist/src/index.js +26 -0
  61. package/dist/src/index.js.map +1 -0
  62. package/dist/src/integrations/langchain.d.ts +46 -0
  63. package/dist/src/integrations/langchain.d.ts.map +1 -0
  64. package/dist/src/integrations/langchain.js +197 -0
  65. package/dist/src/integrations/langchain.js.map +1 -0
  66. package/dist/src/matimo-instance.d.ts +124 -0
  67. package/dist/src/matimo-instance.d.ts.map +1 -0
  68. package/dist/src/matimo-instance.js +313 -0
  69. package/dist/src/matimo-instance.js.map +1 -0
  70. package/dist/tools/calculator/calculator.d.ts +26 -0
  71. package/dist/tools/calculator/calculator.d.ts.map +1 -0
  72. package/dist/tools/calculator/calculator.js +104 -0
  73. package/dist/tools/calculator/calculator.js.map +1 -0
  74. package/dist/tsconfig.tsbuildinfo +1 -0
  75. package/package.json +94 -0
  76. package/tools/calculator/calculator.ts +125 -0
  77. package/tools/calculator/definition.yaml +71 -0
@@ -0,0 +1,125 @@
1
+ // Calculator implementation
2
+ // This script is executed by the calculator tool
3
+
4
+ /**
5
+ * Calculator utility functions
6
+ */
7
+ const Calculator = {
8
+ /**
9
+ * Normalize operation name to handle variations
10
+ */
11
+ normalizeOperation(op: string): string {
12
+ const normalized = op.toLowerCase().trim();
13
+
14
+ // Map variations to canonical operation names
15
+ const operationMap: Record<string, string> = {
16
+ // Addition variants
17
+ add: 'add',
18
+ addition: 'add',
19
+ sum: 'add',
20
+ plus: 'add',
21
+ '+': 'add',
22
+
23
+ // Subtraction variants
24
+ subtract: 'subtract',
25
+ subtraction: 'subtract',
26
+ minus: 'subtract',
27
+ sub: 'subtract',
28
+ '-': 'subtract',
29
+
30
+ // Multiplication variants
31
+ multiply: 'multiply',
32
+ multiplication: 'multiply',
33
+ times: 'multiply',
34
+ product: 'multiply',
35
+ mul: 'multiply',
36
+ '*': 'multiply',
37
+ x: 'multiply',
38
+
39
+ // Division variants
40
+ divide: 'divide',
41
+ division: 'divide',
42
+ div: 'divide',
43
+ '/': 'divide',
44
+ };
45
+
46
+ return operationMap[normalized] || normalized;
47
+ },
48
+
49
+ /**
50
+ * Perform arithmetic calculation
51
+ */
52
+ calculate(
53
+ operation: string,
54
+ a: number,
55
+ b: number
56
+ ): {
57
+ result: number;
58
+ operation: string;
59
+ original_operation: string;
60
+ operands: { a: number; b: number };
61
+ } {
62
+ const normalizedOp = this.normalizeOperation(operation);
63
+ let result: number;
64
+
65
+ switch (normalizedOp) {
66
+ case 'add':
67
+ result = a + b;
68
+ break;
69
+ case 'subtract':
70
+ result = a - b;
71
+ break;
72
+ case 'multiply':
73
+ result = a * b;
74
+ break;
75
+ case 'divide':
76
+ if (b === 0) {
77
+ throw new Error('Division by zero');
78
+ }
79
+ result = a / b;
80
+ break;
81
+ default:
82
+ throw new Error(`Unknown operation: ${operation}`);
83
+ }
84
+
85
+ return {
86
+ result,
87
+ operation: normalizedOp,
88
+ original_operation: operation,
89
+ operands: { a, b },
90
+ };
91
+ },
92
+ };
93
+
94
+ /**
95
+ * CLI entry point
96
+ */
97
+ function main(): void {
98
+ try {
99
+ const [operation, aStr, bStr] = process.argv.slice(2);
100
+
101
+ if (!operation || !aStr || !bStr) {
102
+ console.error('Usage: calculator.ts <operation> <a> <b>');
103
+ console.error('Operations: add, subtract, multiply, divide');
104
+ process.exit(1);
105
+ }
106
+
107
+ const a = parseFloat(aStr);
108
+ const b = parseFloat(bStr);
109
+
110
+ if (isNaN(a) || isNaN(b)) {
111
+ console.error('Error: Arguments must be valid numbers');
112
+ process.exit(1);
113
+ }
114
+
115
+ const result = Calculator.calculate(operation, a, b);
116
+ console.log(JSON.stringify(result));
117
+ } catch (error) {
118
+ const message = error instanceof Error ? error.message : String(error);
119
+ console.error(message);
120
+ process.exit(1);
121
+ }
122
+ }
123
+
124
+ // Execute CLI entry point
125
+ main();
@@ -0,0 +1,71 @@
1
+ name: calculator
2
+ version: '1.0.0'
3
+ description: 'Perform basic arithmetic operations'
4
+
5
+ parameters:
6
+ operation:
7
+ type: string
8
+ description: 'The operation to perform. Accepts: add (addition, sum, plus), subtract (subtraction, minus), multiply (multiplication, times, product), divide (division)'
9
+ required: true
10
+ a:
11
+ type: number
12
+ description: 'First operand'
13
+ required: true
14
+ b:
15
+ type: number
16
+ description: 'Second operand'
17
+ required: true
18
+
19
+ execution:
20
+ type: command
21
+ command: 'tsx'
22
+ args: ['tools/calculator/calculator.ts', '{operation}', '{a}', '{b}']
23
+
24
+ output_schema:
25
+ type: object
26
+ properties:
27
+ result:
28
+ type: number
29
+ description: 'Result of the operation'
30
+ operation:
31
+ type: string
32
+ operands:
33
+ type: object
34
+ properties:
35
+ a:
36
+ type: number
37
+ b:
38
+ type: number
39
+
40
+ error_handling:
41
+ retry: 2
42
+ backoff_type: exponential
43
+ initial_delay_ms: 500
44
+
45
+ examples:
46
+ - name: 'Simple addition'
47
+ description: 'Add 5 and 3'
48
+ params:
49
+ operation: 'add'
50
+ a: 5
51
+ b: 3
52
+ - name: 'Addition with variant'
53
+ description: "Add using 'addition' keyword"
54
+ params:
55
+ operation: 'addition'
56
+ a: 10
57
+ b: 20
58
+ - name: 'Subtraction'
59
+ description: 'Subtract 3 from 10'
60
+ params:
61
+ operation: 'subtract'
62
+ a: 10
63
+ b: 3
64
+ - name: 'Multiplication'
65
+ description: 'Multiply 4 and 7'
66
+ params:
67
+ operation: 'multiply'
68
+ a: 4
69
+ b: 7
70
+
71
+ tags: [math, arithmetic, basic]