praisonai 1.2.1 → 1.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.
Files changed (202) hide show
  1. package/dist/agent/simple.js +1 -1
  2. package/dist/cache/index.d.ts +78 -0
  3. package/dist/cache/index.js +235 -0
  4. package/dist/cli/commands/auto.d.ts +12 -0
  5. package/dist/cli/commands/auto.js +109 -0
  6. package/dist/cli/commands/autonomy.d.ts +5 -0
  7. package/dist/cli/commands/autonomy.js +152 -0
  8. package/dist/cli/commands/cache.d.ts +9 -0
  9. package/dist/cli/commands/cache.js +143 -0
  10. package/dist/cli/commands/chat.d.ts +14 -0
  11. package/dist/cli/commands/chat.js +127 -0
  12. package/dist/cli/commands/checkpoints.d.ts +5 -0
  13. package/dist/cli/commands/checkpoints.js +236 -0
  14. package/dist/cli/commands/context.d.ts +11 -0
  15. package/dist/cli/commands/context.js +182 -0
  16. package/dist/cli/commands/cost.d.ts +5 -0
  17. package/dist/cli/commands/cost.js +146 -0
  18. package/dist/cli/commands/db.d.ts +9 -0
  19. package/dist/cli/commands/db.js +149 -0
  20. package/dist/cli/commands/eval.d.ts +17 -0
  21. package/dist/cli/commands/eval.js +247 -0
  22. package/dist/cli/commands/external-agents.d.ts +5 -0
  23. package/dist/cli/commands/external-agents.js +169 -0
  24. package/dist/cli/commands/fast-context.d.ts +5 -0
  25. package/dist/cli/commands/fast-context.js +126 -0
  26. package/dist/cli/commands/flow.d.ts +5 -0
  27. package/dist/cli/commands/flow.js +141 -0
  28. package/dist/cli/commands/git.d.ts +5 -0
  29. package/dist/cli/commands/git.js +178 -0
  30. package/dist/cli/commands/graph-rag.d.ts +9 -0
  31. package/dist/cli/commands/graph-rag.js +131 -0
  32. package/dist/cli/commands/guardrail.d.ts +11 -0
  33. package/dist/cli/commands/guardrail.js +156 -0
  34. package/dist/cli/commands/handoff.d.ts +9 -0
  35. package/dist/cli/commands/handoff.js +133 -0
  36. package/dist/cli/commands/help.d.ts +8 -0
  37. package/dist/cli/commands/help.js +167 -0
  38. package/dist/cli/commands/image.d.ts +13 -0
  39. package/dist/cli/commands/image.js +192 -0
  40. package/dist/cli/commands/interactive.d.ts +6 -0
  41. package/dist/cli/commands/interactive.js +79 -0
  42. package/dist/cli/commands/jobs.d.ts +5 -0
  43. package/dist/cli/commands/jobs.js +282 -0
  44. package/dist/cli/commands/knowledge.d.ts +9 -0
  45. package/dist/cli/commands/knowledge.js +226 -0
  46. package/dist/cli/commands/mcp.d.ts +9 -0
  47. package/dist/cli/commands/mcp.js +243 -0
  48. package/dist/cli/commands/memory.d.ts +10 -0
  49. package/dist/cli/commands/memory.js +198 -0
  50. package/dist/cli/commands/n8n.d.ts +5 -0
  51. package/dist/cli/commands/n8n.js +137 -0
  52. package/dist/cli/commands/observability.d.ts +9 -0
  53. package/dist/cli/commands/observability.js +145 -0
  54. package/dist/cli/commands/planning.d.ts +9 -0
  55. package/dist/cli/commands/planning.js +167 -0
  56. package/dist/cli/commands/prompt-expand.d.ts +11 -0
  57. package/dist/cli/commands/prompt-expand.js +100 -0
  58. package/dist/cli/commands/providers.d.ts +9 -0
  59. package/dist/cli/commands/providers.js +98 -0
  60. package/dist/cli/commands/query-rewrite.d.ts +12 -0
  61. package/dist/cli/commands/query-rewrite.js +102 -0
  62. package/dist/cli/commands/repo-map.d.ts +5 -0
  63. package/dist/cli/commands/repo-map.js +151 -0
  64. package/dist/cli/commands/reranker.d.ts +10 -0
  65. package/dist/cli/commands/reranker.js +144 -0
  66. package/dist/cli/commands/research.d.ts +12 -0
  67. package/dist/cli/commands/research.js +108 -0
  68. package/dist/cli/commands/router.d.ts +11 -0
  69. package/dist/cli/commands/router.js +142 -0
  70. package/dist/cli/commands/run.d.ts +14 -0
  71. package/dist/cli/commands/run.js +111 -0
  72. package/dist/cli/commands/sandbox.d.ts +5 -0
  73. package/dist/cli/commands/sandbox.js +135 -0
  74. package/dist/cli/commands/scheduler.d.ts +5 -0
  75. package/dist/cli/commands/scheduler.js +260 -0
  76. package/dist/cli/commands/session.d.ts +9 -0
  77. package/dist/cli/commands/session.js +238 -0
  78. package/dist/cli/commands/skills.d.ts +9 -0
  79. package/dist/cli/commands/skills.js +256 -0
  80. package/dist/cli/commands/telemetry.d.ts +9 -0
  81. package/dist/cli/commands/telemetry.js +146 -0
  82. package/dist/cli/commands/tools.d.ts +9 -0
  83. package/dist/cli/commands/tools.js +172 -0
  84. package/dist/cli/commands/vector.d.ts +10 -0
  85. package/dist/cli/commands/vector.js +171 -0
  86. package/dist/cli/commands/version.d.ts +8 -0
  87. package/dist/cli/commands/version.js +68 -0
  88. package/dist/cli/commands/voice.d.ts +10 -0
  89. package/dist/cli/commands/voice.js +162 -0
  90. package/dist/cli/commands/workflow.d.ts +13 -0
  91. package/dist/cli/commands/workflow.js +184 -0
  92. package/dist/cli/config/index.d.ts +6 -0
  93. package/dist/cli/config/index.js +22 -0
  94. package/dist/cli/config/load.d.ts +20 -0
  95. package/dist/cli/config/load.js +229 -0
  96. package/dist/cli/config/resolve.d.ts +28 -0
  97. package/dist/cli/config/resolve.js +70 -0
  98. package/dist/cli/config/schema.d.ts +15 -0
  99. package/dist/cli/config/schema.js +65 -0
  100. package/dist/cli/features/autonomy-mode.d.ts +98 -0
  101. package/dist/cli/features/autonomy-mode.js +266 -0
  102. package/dist/cli/features/background-jobs.d.ts +155 -0
  103. package/dist/cli/features/background-jobs.js +416 -0
  104. package/dist/cli/features/checkpoints.d.ts +126 -0
  105. package/dist/cli/features/checkpoints.js +288 -0
  106. package/dist/cli/features/cost-tracker.d.ts +101 -0
  107. package/dist/cli/features/cost-tracker.js +212 -0
  108. package/dist/cli/features/external-agents.d.ts +115 -0
  109. package/dist/cli/features/external-agents.js +294 -0
  110. package/dist/cli/features/fast-context.d.ts +126 -0
  111. package/dist/cli/features/fast-context.js +310 -0
  112. package/dist/cli/features/flow-display.d.ts +100 -0
  113. package/dist/cli/features/flow-display.js +254 -0
  114. package/dist/cli/features/git-integration.d.ts +138 -0
  115. package/dist/cli/features/git-integration.js +374 -0
  116. package/dist/cli/features/index.d.ts +17 -0
  117. package/dist/cli/features/index.js +102 -0
  118. package/dist/cli/features/interactive-tui.d.ts +114 -0
  119. package/dist/cli/features/interactive-tui.js +326 -0
  120. package/dist/cli/features/n8n-integration.d.ts +108 -0
  121. package/dist/cli/features/n8n-integration.js +296 -0
  122. package/dist/cli/features/repo-map.d.ts +101 -0
  123. package/dist/cli/features/repo-map.js +350 -0
  124. package/dist/cli/features/sandbox-executor.d.ts +89 -0
  125. package/dist/cli/features/sandbox-executor.js +314 -0
  126. package/dist/cli/features/scheduler.d.ts +111 -0
  127. package/dist/cli/features/scheduler.js +298 -0
  128. package/dist/cli/features/slash-commands.d.ts +77 -0
  129. package/dist/cli/features/slash-commands.js +316 -0
  130. package/dist/cli/index.d.ts +19 -15
  131. package/dist/cli/index.js +163 -123
  132. package/dist/cli/output/errors.d.ts +32 -0
  133. package/dist/cli/output/errors.js +72 -0
  134. package/dist/cli/output/index.d.ts +6 -0
  135. package/dist/cli/output/index.js +22 -0
  136. package/dist/cli/output/json.d.ts +17 -0
  137. package/dist/cli/output/json.js +54 -0
  138. package/dist/cli/output/pretty.d.ts +21 -0
  139. package/dist/cli/output/pretty.js +106 -0
  140. package/dist/cli/runtime/env.d.ts +12 -0
  141. package/dist/cli/runtime/env.js +49 -0
  142. package/dist/cli/runtime/exit.d.ts +11 -0
  143. package/dist/cli/runtime/exit.js +49 -0
  144. package/dist/cli/runtime/index.d.ts +6 -0
  145. package/dist/cli/runtime/index.js +22 -0
  146. package/dist/cli/runtime/lazy.d.ts +18 -0
  147. package/dist/cli/runtime/lazy.js +85 -0
  148. package/dist/cli/spec/cli-spec.d.ts +87 -0
  149. package/dist/cli/spec/cli-spec.js +478 -0
  150. package/dist/cli/spec/index.d.ts +4 -0
  151. package/dist/cli/spec/index.js +20 -0
  152. package/dist/db/postgres.d.ts +84 -0
  153. package/dist/db/postgres.js +266 -0
  154. package/dist/db/redis.d.ts +109 -0
  155. package/dist/db/redis.js +307 -0
  156. package/dist/db/sqlite.d.ts +66 -0
  157. package/dist/db/sqlite.js +339 -0
  158. package/dist/events/index.d.ts +84 -0
  159. package/dist/events/index.js +153 -0
  160. package/dist/index.d.ts +15 -1
  161. package/dist/index.js +182 -6
  162. package/dist/integrations/index.d.ts +7 -0
  163. package/dist/integrations/index.js +26 -0
  164. package/dist/integrations/observability/base.d.ts +123 -0
  165. package/dist/integrations/observability/base.js +183 -0
  166. package/dist/integrations/observability/index.d.ts +8 -0
  167. package/dist/integrations/observability/index.js +29 -0
  168. package/dist/integrations/observability/langfuse.d.ts +32 -0
  169. package/dist/integrations/observability/langfuse.js +174 -0
  170. package/dist/integrations/vector/base.d.ts +110 -0
  171. package/dist/integrations/vector/base.js +158 -0
  172. package/dist/integrations/vector/chroma.d.ts +25 -0
  173. package/dist/integrations/vector/chroma.js +143 -0
  174. package/dist/integrations/vector/index.d.ts +14 -0
  175. package/dist/integrations/vector/index.js +37 -0
  176. package/dist/integrations/vector/pinecone.d.ts +28 -0
  177. package/dist/integrations/vector/pinecone.js +172 -0
  178. package/dist/integrations/vector/qdrant.d.ts +25 -0
  179. package/dist/integrations/vector/qdrant.js +146 -0
  180. package/dist/integrations/vector/weaviate.d.ts +30 -0
  181. package/dist/integrations/vector/weaviate.js +206 -0
  182. package/dist/integrations/voice/base.d.ts +76 -0
  183. package/dist/integrations/voice/base.js +168 -0
  184. package/dist/integrations/voice/index.d.ts +6 -0
  185. package/dist/integrations/voice/index.js +26 -0
  186. package/dist/knowledge/graph-rag.d.ts +125 -0
  187. package/dist/knowledge/graph-rag.js +289 -0
  188. package/dist/knowledge/index.d.ts +2 -0
  189. package/dist/knowledge/index.js +18 -0
  190. package/dist/knowledge/reranker.d.ts +86 -0
  191. package/dist/knowledge/reranker.js +196 -0
  192. package/dist/memory/auto-memory.d.ts +136 -0
  193. package/dist/memory/auto-memory.js +301 -0
  194. package/dist/memory/file-memory.d.ts +88 -0
  195. package/dist/memory/file-memory.js +287 -0
  196. package/dist/memory/index.d.ts +2 -0
  197. package/dist/memory/index.js +11 -1
  198. package/dist/workflows/loop.d.ts +0 -0
  199. package/dist/workflows/loop.js +1 -0
  200. package/dist/workflows/yaml-parser.d.ts +48 -0
  201. package/dist/workflows/yaml-parser.js +304 -0
  202. package/package.json +1 -1
@@ -10,7 +10,7 @@ class Agent {
10
10
  this.name = config.name || `Agent_${Math.random().toString(36).substr(2, 9)}`;
11
11
  this.verbose = config.verbose ?? process.env.PRAISON_VERBOSE !== 'false';
12
12
  this.pretty = config.pretty ?? process.env.PRAISON_PRETTY === 'true';
13
- this.llm = config.llm || 'gpt-5-nano';
13
+ this.llm = config.llm || 'gpt-4o-mini';
14
14
  this.markdown = config.markdown ?? true;
15
15
  this.stream = config.stream ?? true;
16
16
  this.tools = config.tools;
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Cache System - In-memory and persistent caching for agents
3
+ * Inspired by mastra's cache module
4
+ */
5
+ export interface CacheConfig {
6
+ name?: string;
7
+ ttl?: number;
8
+ maxSize?: number;
9
+ }
10
+ export interface CacheEntry<T = any> {
11
+ value: T;
12
+ createdAt: number;
13
+ expiresAt?: number;
14
+ }
15
+ /**
16
+ * Abstract base class for cache implementations
17
+ */
18
+ export declare abstract class BaseCache {
19
+ readonly name: string;
20
+ constructor(config?: CacheConfig);
21
+ abstract get<T = any>(key: string): Promise<T | undefined>;
22
+ abstract set<T = any>(key: string, value: T, ttl?: number): Promise<void>;
23
+ abstract delete(key: string): Promise<boolean>;
24
+ abstract clear(): Promise<void>;
25
+ abstract has(key: string): Promise<boolean>;
26
+ abstract keys(): Promise<string[]>;
27
+ abstract size(): Promise<number>;
28
+ abstract listPush<T = any>(key: string, value: T): Promise<void>;
29
+ abstract listLength(key: string): Promise<number>;
30
+ abstract listRange<T = any>(key: string, start: number, end?: number): Promise<T[]>;
31
+ }
32
+ /**
33
+ * In-memory cache implementation
34
+ */
35
+ export declare class MemoryCache extends BaseCache {
36
+ private cache;
37
+ private lists;
38
+ private ttl?;
39
+ private maxSize?;
40
+ constructor(config?: CacheConfig);
41
+ get<T = any>(key: string): Promise<T | undefined>;
42
+ set<T = any>(key: string, value: T, ttl?: number): Promise<void>;
43
+ delete(key: string): Promise<boolean>;
44
+ clear(): Promise<void>;
45
+ has(key: string): Promise<boolean>;
46
+ keys(): Promise<string[]>;
47
+ size(): Promise<number>;
48
+ listPush<T = any>(key: string, value: T): Promise<void>;
49
+ listLength(key: string): Promise<number>;
50
+ listRange<T = any>(key: string, start: number, end?: number): Promise<T[]>;
51
+ }
52
+ /**
53
+ * File-based cache implementation
54
+ */
55
+ export declare class FileCache extends BaseCache {
56
+ private cacheDir;
57
+ private fs;
58
+ private path;
59
+ constructor(config?: CacheConfig & {
60
+ cacheDir?: string;
61
+ });
62
+ private ensureDir;
63
+ private getFilePath;
64
+ get<T = any>(key: string): Promise<T | undefined>;
65
+ set<T = any>(key: string, value: T, ttl?: number): Promise<void>;
66
+ delete(key: string): Promise<boolean>;
67
+ clear(): Promise<void>;
68
+ has(key: string): Promise<boolean>;
69
+ keys(): Promise<string[]>;
70
+ size(): Promise<number>;
71
+ listPush<T = any>(key: string, value: T): Promise<void>;
72
+ listLength(key: string): Promise<number>;
73
+ listRange<T = any>(key: string, start: number, end?: number): Promise<T[]>;
74
+ }
75
+ export declare function createMemoryCache(config?: CacheConfig): MemoryCache;
76
+ export declare function createFileCache(config?: CacheConfig & {
77
+ cacheDir?: string;
78
+ }): FileCache;
@@ -0,0 +1,235 @@
1
+ "use strict";
2
+ /**
3
+ * Cache System - In-memory and persistent caching for agents
4
+ * Inspired by mastra's cache module
5
+ */
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
19
+ }) : function(o, v) {
20
+ o["default"] = v;
21
+ });
22
+ var __importStar = (this && this.__importStar) || (function () {
23
+ var ownKeys = function(o) {
24
+ ownKeys = Object.getOwnPropertyNames || function (o) {
25
+ var ar = [];
26
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
27
+ return ar;
28
+ };
29
+ return ownKeys(o);
30
+ };
31
+ return function (mod) {
32
+ if (mod && mod.__esModule) return mod;
33
+ var result = {};
34
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
35
+ __setModuleDefault(result, mod);
36
+ return result;
37
+ };
38
+ })();
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.FileCache = exports.MemoryCache = exports.BaseCache = void 0;
41
+ exports.createMemoryCache = createMemoryCache;
42
+ exports.createFileCache = createFileCache;
43
+ /**
44
+ * Abstract base class for cache implementations
45
+ */
46
+ class BaseCache {
47
+ constructor(config = {}) {
48
+ this.name = config.name || 'cache';
49
+ }
50
+ }
51
+ exports.BaseCache = BaseCache;
52
+ /**
53
+ * In-memory cache implementation
54
+ */
55
+ class MemoryCache extends BaseCache {
56
+ constructor(config = {}) {
57
+ super(config);
58
+ this.cache = new Map();
59
+ this.lists = new Map();
60
+ this.ttl = config.ttl;
61
+ this.maxSize = config.maxSize;
62
+ }
63
+ async get(key) {
64
+ const entry = this.cache.get(key);
65
+ if (!entry)
66
+ return undefined;
67
+ // Check expiration
68
+ if (entry.expiresAt && Date.now() > entry.expiresAt) {
69
+ this.cache.delete(key);
70
+ return undefined;
71
+ }
72
+ return entry.value;
73
+ }
74
+ async set(key, value, ttl) {
75
+ // Enforce max size
76
+ if (this.maxSize && this.cache.size >= this.maxSize && !this.cache.has(key)) {
77
+ // Remove oldest entry
78
+ const firstKey = this.cache.keys().next().value;
79
+ if (firstKey)
80
+ this.cache.delete(firstKey);
81
+ }
82
+ const effectiveTtl = ttl ?? this.ttl;
83
+ const entry = {
84
+ value,
85
+ createdAt: Date.now(),
86
+ expiresAt: effectiveTtl ? Date.now() + effectiveTtl : undefined
87
+ };
88
+ this.cache.set(key, entry);
89
+ }
90
+ async delete(key) {
91
+ const existed = this.cache.has(key);
92
+ this.cache.delete(key);
93
+ this.lists.delete(key);
94
+ return existed;
95
+ }
96
+ async clear() {
97
+ this.cache.clear();
98
+ this.lists.clear();
99
+ }
100
+ async has(key) {
101
+ const entry = this.cache.get(key);
102
+ if (!entry)
103
+ return false;
104
+ if (entry.expiresAt && Date.now() > entry.expiresAt) {
105
+ this.cache.delete(key);
106
+ return false;
107
+ }
108
+ return true;
109
+ }
110
+ async keys() {
111
+ return Array.from(this.cache.keys());
112
+ }
113
+ async size() {
114
+ return this.cache.size;
115
+ }
116
+ async listPush(key, value) {
117
+ if (!this.lists.has(key)) {
118
+ this.lists.set(key, []);
119
+ }
120
+ this.lists.get(key).push(value);
121
+ }
122
+ async listLength(key) {
123
+ return this.lists.get(key)?.length ?? 0;
124
+ }
125
+ async listRange(key, start, end) {
126
+ const list = this.lists.get(key) ?? [];
127
+ return list.slice(start, end);
128
+ }
129
+ }
130
+ exports.MemoryCache = MemoryCache;
131
+ /**
132
+ * File-based cache implementation
133
+ */
134
+ class FileCache extends BaseCache {
135
+ constructor(config = {}) {
136
+ super(config);
137
+ this.cacheDir = config.cacheDir || '.cache';
138
+ }
139
+ async ensureDir() {
140
+ if (!this.fs) {
141
+ this.fs = await Promise.resolve().then(() => __importStar(require('fs/promises')));
142
+ this.path = await Promise.resolve().then(() => __importStar(require('path')));
143
+ }
144
+ try {
145
+ await this.fs.mkdir(this.cacheDir, { recursive: true });
146
+ }
147
+ catch { }
148
+ }
149
+ getFilePath(key) {
150
+ const safeKey = key.replace(/[^a-zA-Z0-9-_]/g, '_');
151
+ return this.path.join(this.cacheDir, `${safeKey}.json`);
152
+ }
153
+ async get(key) {
154
+ await this.ensureDir();
155
+ try {
156
+ const data = await this.fs.readFile(this.getFilePath(key), 'utf-8');
157
+ const entry = JSON.parse(data);
158
+ if (entry.expiresAt && Date.now() > entry.expiresAt) {
159
+ await this.delete(key);
160
+ return undefined;
161
+ }
162
+ return entry.value;
163
+ }
164
+ catch {
165
+ return undefined;
166
+ }
167
+ }
168
+ async set(key, value, ttl) {
169
+ await this.ensureDir();
170
+ const entry = {
171
+ value,
172
+ createdAt: Date.now(),
173
+ expiresAt: ttl ? Date.now() + ttl : undefined
174
+ };
175
+ await this.fs.writeFile(this.getFilePath(key), JSON.stringify(entry));
176
+ }
177
+ async delete(key) {
178
+ await this.ensureDir();
179
+ try {
180
+ await this.fs.unlink(this.getFilePath(key));
181
+ return true;
182
+ }
183
+ catch {
184
+ return false;
185
+ }
186
+ }
187
+ async clear() {
188
+ await this.ensureDir();
189
+ try {
190
+ const files = await this.fs.readdir(this.cacheDir);
191
+ await Promise.all(files.filter((f) => f.endsWith('.json'))
192
+ .map((f) => this.fs.unlink(this.path.join(this.cacheDir, f))));
193
+ }
194
+ catch { }
195
+ }
196
+ async has(key) {
197
+ return (await this.get(key)) !== undefined;
198
+ }
199
+ async keys() {
200
+ await this.ensureDir();
201
+ try {
202
+ const files = await this.fs.readdir(this.cacheDir);
203
+ return files
204
+ .filter((f) => f.endsWith('.json'))
205
+ .map((f) => f.replace('.json', ''));
206
+ }
207
+ catch {
208
+ return [];
209
+ }
210
+ }
211
+ async size() {
212
+ return (await this.keys()).length;
213
+ }
214
+ async listPush(key, value) {
215
+ const list = (await this.get(`list_${key}`)) || [];
216
+ list.push(value);
217
+ await this.set(`list_${key}`, list);
218
+ }
219
+ async listLength(key) {
220
+ const list = (await this.get(`list_${key}`)) || [];
221
+ return list.length;
222
+ }
223
+ async listRange(key, start, end) {
224
+ const list = (await this.get(`list_${key}`)) || [];
225
+ return list.slice(start, end);
226
+ }
227
+ }
228
+ exports.FileCache = FileCache;
229
+ // Factory functions
230
+ function createMemoryCache(config) {
231
+ return new MemoryCache(config);
232
+ }
233
+ function createFileCache(config) {
234
+ return new FileCache(config);
235
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Auto command - AutoAgents for automatic agent generation
3
+ */
4
+ export interface AutoOptions {
5
+ model?: string;
6
+ verbose?: boolean;
7
+ output?: 'json' | 'text' | 'pretty';
8
+ json?: boolean;
9
+ pattern?: string;
10
+ agents?: number;
11
+ }
12
+ export declare function execute(args: string[], options: AutoOptions): Promise<void>;
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ /**
3
+ * Auto command - AutoAgents for automatic agent generation
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.execute = execute;
40
+ const auto_1 = require("../../auto");
41
+ const resolve_1 = require("../config/resolve");
42
+ const json_1 = require("../output/json");
43
+ const pretty = __importStar(require("../output/pretty"));
44
+ const cli_spec_1 = require("../spec/cli-spec");
45
+ const errors_1 = require("../output/errors");
46
+ async function execute(args, options) {
47
+ const topic = args.join(' ');
48
+ const outputFormat = options.json ? 'json' : (options.output || 'pretty');
49
+ const config = (0, resolve_1.resolveConfig)(options);
50
+ if (!topic) {
51
+ if (outputFormat === 'json') {
52
+ (0, json_1.outputJson)((0, json_1.formatError)(errors_1.ERROR_CODES.MISSING_ARG, 'Please provide a topic for auto-generation'));
53
+ }
54
+ else {
55
+ await pretty.error('Please provide a topic for auto-generation');
56
+ await pretty.dim('Usage: praisonai-ts auto "Create a research team"');
57
+ }
58
+ process.exit(cli_spec_1.EXIT_CODES.INVALID_ARGUMENTS);
59
+ }
60
+ const startTime = Date.now();
61
+ try {
62
+ if (outputFormat !== 'json') {
63
+ await pretty.info(`Generating agents for: "${topic}"`);
64
+ }
65
+ const autoAgents = (0, auto_1.createAutoAgents)({
66
+ llm: config.model,
67
+ pattern: options.pattern,
68
+ verbose: options.verbose
69
+ });
70
+ const result = await autoAgents.generate(topic);
71
+ const duration = Date.now() - startTime;
72
+ if (outputFormat === 'json') {
73
+ (0, json_1.outputJson)((0, json_1.formatSuccess)({
74
+ topic,
75
+ agents: result.agents,
76
+ tasks: result.tasks,
77
+ pattern: result.pattern
78
+ }, {
79
+ duration_ms: duration,
80
+ model: config.model
81
+ }));
82
+ }
83
+ else {
84
+ await pretty.heading('Generated Team');
85
+ await pretty.plain(`Pattern: ${result.pattern}`);
86
+ await pretty.newline();
87
+ await pretty.plain('Agents:');
88
+ for (const agent of result.agents) {
89
+ await pretty.plain(` • ${agent.name}: ${agent.role}`);
90
+ }
91
+ await pretty.newline();
92
+ await pretty.plain('Tasks:');
93
+ for (const task of result.tasks) {
94
+ await pretty.plain(` • ${task.description?.substring(0, 60)}...`);
95
+ }
96
+ await pretty.newline();
97
+ await pretty.success(`Generated in ${duration}ms`);
98
+ }
99
+ }
100
+ catch (error) {
101
+ if (outputFormat === 'json') {
102
+ (0, json_1.outputJson)((0, json_1.formatError)(errors_1.ERROR_CODES.UNKNOWN, error instanceof Error ? error.message : String(error)));
103
+ }
104
+ else {
105
+ await pretty.error(error instanceof Error ? error.message : String(error));
106
+ }
107
+ process.exit(cli_spec_1.EXIT_CODES.RUNTIME_ERROR);
108
+ }
109
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * CLI command: autonomy
3
+ * Autonomy mode management for agent actions
4
+ */
5
+ export declare function execute(args: string[], options: Record<string, unknown>): Promise<void>;
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+ /**
3
+ * CLI command: autonomy
4
+ * Autonomy mode management for agent actions
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.execute = execute;
8
+ const autonomy_mode_1 = require("../features/autonomy-mode");
9
+ let manager = null;
10
+ function getManager() {
11
+ if (!manager) {
12
+ manager = (0, autonomy_mode_1.createAutonomyManager)();
13
+ }
14
+ return manager;
15
+ }
16
+ async function execute(args, options) {
17
+ const subcommand = args[0] || 'help';
18
+ const isJson = Boolean(options.output === 'json' || options.json);
19
+ switch (subcommand) {
20
+ case 'status':
21
+ await handleStatus(isJson);
22
+ break;
23
+ case 'set':
24
+ await handleSet(args.slice(1), isJson);
25
+ break;
26
+ case 'policies':
27
+ await handlePolicies(args.slice(1), isJson);
28
+ break;
29
+ case 'reset':
30
+ await handleReset(isJson);
31
+ break;
32
+ case 'help':
33
+ default:
34
+ showHelp(isJson);
35
+ }
36
+ }
37
+ async function handleStatus(isJson) {
38
+ const mgr = getManager();
39
+ const summary = mgr.getSummary();
40
+ const mode = mgr.getMode();
41
+ const actionCount = mgr.getActionCount();
42
+ if (isJson) {
43
+ console.log(JSON.stringify({
44
+ success: true,
45
+ mode,
46
+ actionCount,
47
+ policies: autonomy_mode_1.MODE_POLICIES[mode]
48
+ }, null, 2));
49
+ }
50
+ else {
51
+ console.log(summary);
52
+ }
53
+ }
54
+ async function handleSet(args, isJson) {
55
+ const mode = args[0];
56
+ if (!mode || !['suggest', 'auto_edit', 'full_auto'].includes(mode)) {
57
+ console.error('Error: Valid mode required (suggest, auto_edit, full_auto)');
58
+ process.exit(1);
59
+ }
60
+ const mgr = getManager();
61
+ mgr.setMode(mode);
62
+ if (isJson) {
63
+ console.log(JSON.stringify({ success: true, mode }));
64
+ }
65
+ else {
66
+ console.log(`✓ Autonomy mode set to: ${mode}`);
67
+ console.log('\nPolicies for this mode:');
68
+ for (const policy of autonomy_mode_1.MODE_POLICIES[mode]) {
69
+ const status = policy.requiresApproval ? '⚠️ requires approval' : '✓ auto-approved';
70
+ console.log(` ${policy.action}: ${status}`);
71
+ }
72
+ }
73
+ }
74
+ async function handlePolicies(args, isJson) {
75
+ const mode = args[0] || 'suggest';
76
+ if (!['suggest', 'auto_edit', 'full_auto'].includes(mode)) {
77
+ console.error('Error: Valid mode required (suggest, auto_edit, full_auto)');
78
+ process.exit(1);
79
+ }
80
+ const policies = autonomy_mode_1.MODE_POLICIES[mode];
81
+ if (isJson) {
82
+ console.log(JSON.stringify({ success: true, mode, policies }, null, 2));
83
+ }
84
+ else {
85
+ console.log(`Policies for mode: ${mode}\n`);
86
+ for (const policy of policies) {
87
+ const status = policy.requiresApproval ? '⚠️ requires approval' : '✓ auto-approved';
88
+ console.log(` ${policy.action.padEnd(20)} ${status}`);
89
+ }
90
+ }
91
+ }
92
+ async function handleReset(isJson) {
93
+ const mgr = getManager();
94
+ mgr.clearRemembered();
95
+ mgr.resetActionCount();
96
+ mgr.setMode('suggest');
97
+ if (isJson) {
98
+ console.log(JSON.stringify({ success: true, message: 'Autonomy state reset' }));
99
+ }
100
+ else {
101
+ console.log('✓ Autonomy state reset');
102
+ console.log(' Mode: suggest');
103
+ console.log(' Remembered decisions: cleared');
104
+ console.log(' Action count: 0');
105
+ }
106
+ }
107
+ function showHelp(isJson) {
108
+ const help = {
109
+ command: 'autonomy',
110
+ description: 'Autonomy mode management for agent actions',
111
+ subcommands: {
112
+ status: 'Show current autonomy status',
113
+ set: 'Set autonomy mode',
114
+ policies: 'Show policies for a mode',
115
+ reset: 'Reset autonomy state'
116
+ },
117
+ modes: {
118
+ suggest: 'Requires approval for most actions (default)',
119
+ auto_edit: 'Auto-approves file edits, requires approval for others',
120
+ full_auto: 'Auto-approves most actions (use with caution)'
121
+ },
122
+ flags: {
123
+ '--json': 'Output in JSON format'
124
+ },
125
+ examples: [
126
+ 'praisonai-ts autonomy status',
127
+ 'praisonai-ts autonomy set suggest',
128
+ 'praisonai-ts autonomy set auto_edit',
129
+ 'praisonai-ts autonomy set full_auto',
130
+ 'praisonai-ts autonomy policies suggest',
131
+ 'praisonai-ts autonomy reset'
132
+ ]
133
+ };
134
+ if (isJson) {
135
+ console.log(JSON.stringify(help, null, 2));
136
+ }
137
+ else {
138
+ console.log('Autonomy - Agent action approval management\n');
139
+ console.log('Subcommands:');
140
+ for (const [cmd, desc] of Object.entries(help.subcommands)) {
141
+ console.log(` ${cmd.padEnd(12)} ${desc}`);
142
+ }
143
+ console.log('\nModes:');
144
+ for (const [mode, desc] of Object.entries(help.modes)) {
145
+ console.log(` ${mode.padEnd(12)} ${desc}`);
146
+ }
147
+ console.log('\nExamples:');
148
+ for (const ex of help.examples) {
149
+ console.log(` ${ex}`);
150
+ }
151
+ }
152
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Cache command - Caching management
3
+ */
4
+ export interface CacheOptions {
5
+ verbose?: boolean;
6
+ output?: 'json' | 'text' | 'pretty';
7
+ json?: boolean;
8
+ }
9
+ export declare function execute(args: string[], options: CacheOptions): Promise<void>;