@tonk/cli 0.2.4 → 0.2.6

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 (35) hide show
  1. package/dist/commands/worker/commands.d.ts +42 -0
  2. package/dist/commands/worker/commands.d.ts.map +1 -0
  3. package/dist/commands/worker/commands.js +580 -0
  4. package/dist/commands/worker/commands.js.map +1 -0
  5. package/dist/commands/worker/index.d.ts +7 -0
  6. package/dist/commands/worker/index.d.ts.map +1 -0
  7. package/dist/commands/worker/index.js +28 -0
  8. package/dist/commands/worker/index.js.map +1 -0
  9. package/dist/commands/worker/utils/config.d.ts +26 -0
  10. package/dist/commands/worker/utils/config.d.ts.map +1 -0
  11. package/dist/commands/worker/utils/config.js +197 -0
  12. package/dist/commands/worker/utils/config.js.map +1 -0
  13. package/dist/commands/worker/utils/display.d.ts +6 -0
  14. package/dist/commands/worker/utils/display.d.ts.map +1 -0
  15. package/dist/commands/worker/utils/display.js +32 -0
  16. package/dist/commands/worker/utils/display.js.map +1 -0
  17. package/dist/commands/worker/utils/finder.d.ts +12 -0
  18. package/dist/commands/worker/utils/finder.d.ts.map +1 -0
  19. package/dist/commands/worker/utils/finder.js +60 -0
  20. package/dist/commands/worker/utils/finder.js.map +1 -0
  21. package/dist/lib/workerManager.d.ts +60 -0
  22. package/dist/lib/workerManager.d.ts.map +1 -0
  23. package/dist/lib/workerManager.js +426 -0
  24. package/dist/lib/workerManager.js.map +1 -0
  25. package/dist/tonk.js +2 -0
  26. package/dist/tonk.js.map +1 -1
  27. package/dist/types/worker.d.ts +102 -0
  28. package/dist/types/worker.d.ts.map +1 -0
  29. package/dist/types/worker.js +7 -0
  30. package/dist/types/worker.js.map +1 -0
  31. package/dist/types/workerConfig.d.ts +164 -0
  32. package/dist/types/workerConfig.d.ts.map +1 -0
  33. package/dist/types/workerConfig.js +80 -0
  34. package/dist/types/workerConfig.js.map +1 -0
  35. package/package.json +3 -2
@@ -0,0 +1,164 @@
1
+ /**
2
+ * Worker YAML Configuration Schema
3
+ *
4
+ * This file defines the standard format for worker configuration YAML files in Tonk.
5
+ */
6
+ import { z } from 'zod';
7
+ /**
8
+ * Zod schema for worker health check configuration
9
+ */
10
+ export declare const WorkerHealthCheckSchema: z.ZodObject<{
11
+ endpoint: z.ZodOptional<z.ZodString>;
12
+ method: z.ZodDefault<z.ZodString>;
13
+ interval: z.ZodDefault<z.ZodNumber>;
14
+ timeout: z.ZodDefault<z.ZodNumber>;
15
+ }, "strip", z.ZodTypeAny, {
16
+ method: string;
17
+ timeout: number;
18
+ interval: number;
19
+ endpoint?: string | undefined;
20
+ }, {
21
+ method?: string | undefined;
22
+ endpoint?: string | undefined;
23
+ timeout?: number | undefined;
24
+ interval?: number | undefined;
25
+ }>;
26
+ /**
27
+ * Zod schema for worker configuration
28
+ */
29
+ export declare const WorkerConfigSchema: z.ZodObject<{
30
+ name: z.ZodString;
31
+ description: z.ZodOptional<z.ZodString>;
32
+ version: z.ZodOptional<z.ZodString>;
33
+ endpoint: z.ZodString;
34
+ protocol: z.ZodDefault<z.ZodString>;
35
+ healthCheck: z.ZodOptional<z.ZodObject<{
36
+ endpoint: z.ZodOptional<z.ZodString>;
37
+ method: z.ZodDefault<z.ZodString>;
38
+ interval: z.ZodDefault<z.ZodNumber>;
39
+ timeout: z.ZodDefault<z.ZodNumber>;
40
+ }, "strip", z.ZodTypeAny, {
41
+ method: string;
42
+ timeout: number;
43
+ interval: number;
44
+ endpoint?: string | undefined;
45
+ }, {
46
+ method?: string | undefined;
47
+ endpoint?: string | undefined;
48
+ timeout?: number | undefined;
49
+ interval?: number | undefined;
50
+ }>>;
51
+ process: z.ZodObject<{
52
+ script: z.ZodString;
53
+ cwd: z.ZodOptional<z.ZodString>;
54
+ instances: z.ZodDefault<z.ZodNumber>;
55
+ autorestart: z.ZodDefault<z.ZodBoolean>;
56
+ watch: z.ZodDefault<z.ZodBoolean>;
57
+ max_memory_restart: z.ZodOptional<z.ZodString>;
58
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
59
+ }, "strip", z.ZodTypeAny, {
60
+ script: string;
61
+ instances: number;
62
+ autorestart: boolean;
63
+ watch: boolean;
64
+ env?: Record<string, string> | undefined;
65
+ cwd?: string | undefined;
66
+ max_memory_restart?: string | undefined;
67
+ }, {
68
+ script: string;
69
+ env?: Record<string, string> | undefined;
70
+ cwd?: string | undefined;
71
+ instances?: number | undefined;
72
+ autorestart?: boolean | undefined;
73
+ watch?: boolean | undefined;
74
+ max_memory_restart?: string | undefined;
75
+ }>;
76
+ config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
77
+ }, "strip", z.ZodTypeAny, {
78
+ name: string;
79
+ process: {
80
+ script: string;
81
+ instances: number;
82
+ autorestart: boolean;
83
+ watch: boolean;
84
+ env?: Record<string, string> | undefined;
85
+ cwd?: string | undefined;
86
+ max_memory_restart?: string | undefined;
87
+ };
88
+ endpoint: string;
89
+ protocol: string;
90
+ healthCheck?: {
91
+ method: string;
92
+ timeout: number;
93
+ interval: number;
94
+ endpoint?: string | undefined;
95
+ } | undefined;
96
+ version?: string | undefined;
97
+ description?: string | undefined;
98
+ config?: Record<string, any> | undefined;
99
+ }, {
100
+ name: string;
101
+ process: {
102
+ script: string;
103
+ env?: Record<string, string> | undefined;
104
+ cwd?: string | undefined;
105
+ instances?: number | undefined;
106
+ autorestart?: boolean | undefined;
107
+ watch?: boolean | undefined;
108
+ max_memory_restart?: string | undefined;
109
+ };
110
+ endpoint: string;
111
+ healthCheck?: {
112
+ method?: string | undefined;
113
+ endpoint?: string | undefined;
114
+ timeout?: number | undefined;
115
+ interval?: number | undefined;
116
+ } | undefined;
117
+ version?: string | undefined;
118
+ description?: string | undefined;
119
+ protocol?: string | undefined;
120
+ config?: Record<string, any> | undefined;
121
+ }>;
122
+ /**
123
+ * Type for worker configuration
124
+ */
125
+ export type WorkerConfig = z.infer<typeof WorkerConfigSchema>;
126
+ /**
127
+ * Example YAML configuration:
128
+ *
129
+ * ```yaml
130
+ * # Worker Information
131
+ * name: obsidian-worker
132
+ * description: Tonk worker for Obsidian integration
133
+ * version: 1.0.0
134
+ *
135
+ * # Connection Details
136
+ * endpoint: http://localhost:5555/tonk
137
+ * protocol: http
138
+ *
139
+ * # Health Check Configuration
140
+ * healthCheck:
141
+ * endpoint: http://localhost:5555/health
142
+ * method: GET
143
+ * interval: 30000
144
+ * timeout: 5000
145
+ *
146
+ * # Process Management
147
+ * process:
148
+ * script: ./dist/index.js
149
+ * cwd: ./
150
+ * instances: 1
151
+ * autorestart: true
152
+ * watch: false
153
+ * max_memory_restart: 500M
154
+ * env:
155
+ * NODE_ENV: production
156
+ * CHROMA_URL: http://localhost:8888
157
+ *
158
+ * # Additional Configuration
159
+ * config:
160
+ * syncDirectory: notes
161
+ * embedModel: all-MiniLM-L6-v2
162
+ * ```
163
+ */
164
+ //# sourceMappingURL=workerConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workerConfig.d.ts","sourceRoot":"","sources":["../../src/types/workerConfig.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;EAKlC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0B7B,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Worker YAML Configuration Schema
3
+ *
4
+ * This file defines the standard format for worker configuration YAML files in Tonk.
5
+ */
6
+ import { z } from 'zod';
7
+ /**
8
+ * Zod schema for worker health check configuration
9
+ */
10
+ export const WorkerHealthCheckSchema = z.object({
11
+ endpoint: z.string().optional(),
12
+ method: z.string().default('GET'),
13
+ interval: z.number().default(30000),
14
+ timeout: z.number().default(5000),
15
+ });
16
+ /**
17
+ * Zod schema for worker configuration
18
+ */
19
+ export const WorkerConfigSchema = z.object({
20
+ // Basic worker information
21
+ name: z.string(),
22
+ description: z.string().optional(),
23
+ version: z.string().optional(),
24
+ // Connection details
25
+ endpoint: z.string(),
26
+ protocol: z.string().default('http'),
27
+ // Health check configuration
28
+ healthCheck: WorkerHealthCheckSchema.optional(),
29
+ // Process management
30
+ process: z.object({
31
+ script: z.string(),
32
+ cwd: z.string().optional(),
33
+ instances: z.number().default(1),
34
+ autorestart: z.boolean().default(true),
35
+ watch: z.boolean().default(false),
36
+ max_memory_restart: z.string().optional(),
37
+ env: z.record(z.string()).optional(),
38
+ }),
39
+ // Additional custom configuration
40
+ config: z.record(z.any()).optional(),
41
+ });
42
+ /**
43
+ * Example YAML configuration:
44
+ *
45
+ * ```yaml
46
+ * # Worker Information
47
+ * name: obsidian-worker
48
+ * description: Tonk worker for Obsidian integration
49
+ * version: 1.0.0
50
+ *
51
+ * # Connection Details
52
+ * endpoint: http://localhost:5555/tonk
53
+ * protocol: http
54
+ *
55
+ * # Health Check Configuration
56
+ * healthCheck:
57
+ * endpoint: http://localhost:5555/health
58
+ * method: GET
59
+ * interval: 30000
60
+ * timeout: 5000
61
+ *
62
+ * # Process Management
63
+ * process:
64
+ * script: ./dist/index.js
65
+ * cwd: ./
66
+ * instances: 1
67
+ * autorestart: true
68
+ * watch: false
69
+ * max_memory_restart: 500M
70
+ * env:
71
+ * NODE_ENV: production
72
+ * CHROMA_URL: http://localhost:8888
73
+ *
74
+ * # Additional Configuration
75
+ * config:
76
+ * syncDirectory: notes
77
+ * embedModel: all-MiniLM-L6-v2
78
+ * ```
79
+ */
80
+ //# sourceMappingURL=workerConfig.js.map
@@ -0,0 +1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,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;QACtC,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;QACjC,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QACzC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;KACrC,CAAC;IAEF,kCAAkC;IAClC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAC;AAOH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tonk/cli",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "The Tonk stack command line utility",
5
5
  "type": "module",
6
6
  "bin": {
@@ -36,8 +36,9 @@
36
36
  "posttest": "npm run lint"
37
37
  },
38
38
  "dependencies": {
39
- "@tonk/server": "^0.2.3",
39
+ "@tonk/server": "^0.2.4",
40
40
  "chalk": "^5.3.0",
41
+ "cli-table3": "^0.6.5",
41
42
  "commander": "^11.1.0",
42
43
  "dotenv": "^16.4.7",
43
44
  "env-paths": "^3.0.0",