@cloudwarriors-ai/rlm 0.1.5

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 (220) hide show
  1. package/README.md +208 -0
  2. package/dist/application/index.d.ts +4 -0
  3. package/dist/application/index.d.ts.map +1 -0
  4. package/dist/application/index.js +4 -0
  5. package/dist/application/index.js.map +1 -0
  6. package/dist/application/query-handler.d.ts +49 -0
  7. package/dist/application/query-handler.d.ts.map +1 -0
  8. package/dist/application/query-handler.js +311 -0
  9. package/dist/application/query-handler.js.map +1 -0
  10. package/dist/application/rlm-service.d.ts +68 -0
  11. package/dist/application/rlm-service.d.ts.map +1 -0
  12. package/dist/application/rlm-service.js +132 -0
  13. package/dist/application/rlm-service.js.map +1 -0
  14. package/dist/application/session-manager.d.ts +70 -0
  15. package/dist/application/session-manager.d.ts.map +1 -0
  16. package/dist/application/session-manager.js +237 -0
  17. package/dist/application/session-manager.js.map +1 -0
  18. package/dist/cli/commands/config.d.ts +34 -0
  19. package/dist/cli/commands/config.d.ts.map +1 -0
  20. package/dist/cli/commands/config.js +157 -0
  21. package/dist/cli/commands/config.js.map +1 -0
  22. package/dist/cli/commands/index.d.ts +4 -0
  23. package/dist/cli/commands/index.d.ts.map +1 -0
  24. package/dist/cli/commands/index.js +4 -0
  25. package/dist/cli/commands/index.js.map +1 -0
  26. package/dist/cli/commands/query.d.ts +26 -0
  27. package/dist/cli/commands/query.d.ts.map +1 -0
  28. package/dist/cli/commands/query.js +90 -0
  29. package/dist/cli/commands/query.js.map +1 -0
  30. package/dist/cli/commands/session.d.ts +40 -0
  31. package/dist/cli/commands/session.d.ts.map +1 -0
  32. package/dist/cli/commands/session.js +55 -0
  33. package/dist/cli/commands/session.js.map +1 -0
  34. package/dist/cli/config-loader.d.ts +63 -0
  35. package/dist/cli/config-loader.d.ts.map +1 -0
  36. package/dist/cli/config-loader.js +94 -0
  37. package/dist/cli/config-loader.js.map +1 -0
  38. package/dist/cli/index.d.ts +3 -0
  39. package/dist/cli/index.d.ts.map +1 -0
  40. package/dist/cli/index.js +120 -0
  41. package/dist/cli/index.js.map +1 -0
  42. package/dist/cli/output/formatter.d.ts +24 -0
  43. package/dist/cli/output/formatter.d.ts.map +1 -0
  44. package/dist/cli/output/formatter.js +196 -0
  45. package/dist/cli/output/formatter.js.map +1 -0
  46. package/dist/cli/output/index.d.ts +3 -0
  47. package/dist/cli/output/index.d.ts.map +1 -0
  48. package/dist/cli/output/index.js +3 -0
  49. package/dist/cli/output/index.js.map +1 -0
  50. package/dist/cli/output/progress.d.ts +60 -0
  51. package/dist/cli/output/progress.d.ts.map +1 -0
  52. package/dist/cli/output/progress.js +142 -0
  53. package/dist/cli/output/progress.js.map +1 -0
  54. package/dist/domain/errors/base-error.d.ts +17 -0
  55. package/dist/domain/errors/base-error.d.ts.map +1 -0
  56. package/dist/domain/errors/base-error.js +29 -0
  57. package/dist/domain/errors/base-error.js.map +1 -0
  58. package/dist/domain/errors/execution-error.d.ts +61 -0
  59. package/dist/domain/errors/execution-error.d.ts.map +1 -0
  60. package/dist/domain/errors/execution-error.js +86 -0
  61. package/dist/domain/errors/execution-error.js.map +1 -0
  62. package/dist/domain/errors/index.d.ts +14 -0
  63. package/dist/domain/errors/index.d.ts.map +1 -0
  64. package/dist/domain/errors/index.js +26 -0
  65. package/dist/domain/errors/index.js.map +1 -0
  66. package/dist/domain/errors/limit-exceeded.d.ts +38 -0
  67. package/dist/domain/errors/limit-exceeded.d.ts.map +1 -0
  68. package/dist/domain/errors/limit-exceeded.js +71 -0
  69. package/dist/domain/errors/limit-exceeded.js.map +1 -0
  70. package/dist/domain/errors/llm-error.d.ts +60 -0
  71. package/dist/domain/errors/llm-error.d.ts.map +1 -0
  72. package/dist/domain/errors/llm-error.js +92 -0
  73. package/dist/domain/errors/llm-error.js.map +1 -0
  74. package/dist/domain/errors/validation-error.d.ts +58 -0
  75. package/dist/domain/errors/validation-error.d.ts.map +1 -0
  76. package/dist/domain/errors/validation-error.js +81 -0
  77. package/dist/domain/errors/validation-error.js.map +1 -0
  78. package/dist/domain/interfaces/code-executor.d.ts +98 -0
  79. package/dist/domain/interfaces/code-executor.d.ts.map +1 -0
  80. package/dist/domain/interfaces/code-executor.js +2 -0
  81. package/dist/domain/interfaces/code-executor.js.map +1 -0
  82. package/dist/domain/interfaces/event-emitter.d.ts +137 -0
  83. package/dist/domain/interfaces/event-emitter.d.ts.map +1 -0
  84. package/dist/domain/interfaces/event-emitter.js +2 -0
  85. package/dist/domain/interfaces/event-emitter.js.map +1 -0
  86. package/dist/domain/interfaces/index.d.ts +5 -0
  87. package/dist/domain/interfaces/index.d.ts.map +1 -0
  88. package/dist/domain/interfaces/index.js +2 -0
  89. package/dist/domain/interfaces/index.js.map +1 -0
  90. package/dist/domain/interfaces/llm-provider.d.ts +64 -0
  91. package/dist/domain/interfaces/llm-provider.d.ts.map +1 -0
  92. package/dist/domain/interfaces/llm-provider.js +2 -0
  93. package/dist/domain/interfaces/llm-provider.js.map +1 -0
  94. package/dist/domain/interfaces/session-store.d.ts +65 -0
  95. package/dist/domain/interfaces/session-store.d.ts.map +1 -0
  96. package/dist/domain/interfaces/session-store.js +2 -0
  97. package/dist/domain/interfaces/session-store.js.map +1 -0
  98. package/dist/domain/services/context-chunker.d.ts +43 -0
  99. package/dist/domain/services/context-chunker.d.ts.map +1 -0
  100. package/dist/domain/services/context-chunker.js +152 -0
  101. package/dist/domain/services/context-chunker.js.map +1 -0
  102. package/dist/domain/services/cost-calculator.d.ts +63 -0
  103. package/dist/domain/services/cost-calculator.d.ts.map +1 -0
  104. package/dist/domain/services/cost-calculator.js +121 -0
  105. package/dist/domain/services/cost-calculator.js.map +1 -0
  106. package/dist/domain/services/index.d.ts +5 -0
  107. package/dist/domain/services/index.d.ts.map +1 -0
  108. package/dist/domain/services/index.js +9 -0
  109. package/dist/domain/services/index.js.map +1 -0
  110. package/dist/domain/services/limit-checker.d.ts +54 -0
  111. package/dist/domain/services/limit-checker.d.ts.map +1 -0
  112. package/dist/domain/services/limit-checker.js +146 -0
  113. package/dist/domain/services/limit-checker.js.map +1 -0
  114. package/dist/domain/services/result-aggregator.d.ts +49 -0
  115. package/dist/domain/services/result-aggregator.d.ts.map +1 -0
  116. package/dist/domain/services/result-aggregator.js +131 -0
  117. package/dist/domain/services/result-aggregator.js.map +1 -0
  118. package/dist/domain/types/config.d.ts +41 -0
  119. package/dist/domain/types/config.d.ts.map +1 -0
  120. package/dist/domain/types/config.js +22 -0
  121. package/dist/domain/types/config.js.map +1 -0
  122. package/dist/domain/types/context.d.ts +64 -0
  123. package/dist/domain/types/context.d.ts.map +1 -0
  124. package/dist/domain/types/context.js +20 -0
  125. package/dist/domain/types/context.js.map +1 -0
  126. package/dist/domain/types/index.d.ts +5 -0
  127. package/dist/domain/types/index.d.ts.map +1 -0
  128. package/dist/domain/types/index.js +9 -0
  129. package/dist/domain/types/index.js.map +1 -0
  130. package/dist/domain/types/result.d.ts +137 -0
  131. package/dist/domain/types/result.d.ts.map +1 -0
  132. package/dist/domain/types/result.js +27 -0
  133. package/dist/domain/types/result.js.map +1 -0
  134. package/dist/domain/types/session.d.ts +74 -0
  135. package/dist/domain/types/session.d.ts.map +1 -0
  136. package/dist/domain/types/session.js +31 -0
  137. package/dist/domain/types/session.js.map +1 -0
  138. package/dist/factory/create-rlm.d.ts +77 -0
  139. package/dist/factory/create-rlm.d.ts.map +1 -0
  140. package/dist/factory/create-rlm.js +82 -0
  141. package/dist/factory/create-rlm.js.map +1 -0
  142. package/dist/factory/default-config.d.ts +27 -0
  143. package/dist/factory/default-config.d.ts.map +1 -0
  144. package/dist/factory/default-config.js +98 -0
  145. package/dist/factory/default-config.js.map +1 -0
  146. package/dist/factory/index.d.ts +3 -0
  147. package/dist/factory/index.d.ts.map +1 -0
  148. package/dist/factory/index.js +3 -0
  149. package/dist/factory/index.js.map +1 -0
  150. package/dist/index.d.ts +37 -0
  151. package/dist/index.d.ts.map +1 -0
  152. package/dist/index.js +40 -0
  153. package/dist/index.js.map +1 -0
  154. package/dist/infrastructure/events/event-types.d.ts +35 -0
  155. package/dist/infrastructure/events/event-types.d.ts.map +1 -0
  156. package/dist/infrastructure/events/event-types.js +44 -0
  157. package/dist/infrastructure/events/event-types.js.map +1 -0
  158. package/dist/infrastructure/events/index.d.ts +3 -0
  159. package/dist/infrastructure/events/index.d.ts.map +1 -0
  160. package/dist/infrastructure/events/index.js +3 -0
  161. package/dist/infrastructure/events/index.js.map +1 -0
  162. package/dist/infrastructure/events/node-emitter.d.ts +72 -0
  163. package/dist/infrastructure/events/node-emitter.d.ts.map +1 -0
  164. package/dist/infrastructure/events/node-emitter.js +125 -0
  165. package/dist/infrastructure/events/node-emitter.js.map +1 -0
  166. package/dist/infrastructure/llm/index.d.ts +3 -0
  167. package/dist/infrastructure/llm/index.d.ts.map +1 -0
  168. package/dist/infrastructure/llm/index.js +3 -0
  169. package/dist/infrastructure/llm/index.js.map +1 -0
  170. package/dist/infrastructure/llm/openrouter-provider.d.ts +35 -0
  171. package/dist/infrastructure/llm/openrouter-provider.d.ts.map +1 -0
  172. package/dist/infrastructure/llm/openrouter-provider.js +158 -0
  173. package/dist/infrastructure/llm/openrouter-provider.js.map +1 -0
  174. package/dist/infrastructure/llm/prompts/code-gen-prompt.d.ts +21 -0
  175. package/dist/infrastructure/llm/prompts/code-gen-prompt.d.ts.map +1 -0
  176. package/dist/infrastructure/llm/prompts/code-gen-prompt.js +78 -0
  177. package/dist/infrastructure/llm/prompts/code-gen-prompt.js.map +1 -0
  178. package/dist/infrastructure/llm/prompts/error-recovery-prompt.d.ts +24 -0
  179. package/dist/infrastructure/llm/prompts/error-recovery-prompt.d.ts.map +1 -0
  180. package/dist/infrastructure/llm/prompts/error-recovery-prompt.js +70 -0
  181. package/dist/infrastructure/llm/prompts/error-recovery-prompt.js.map +1 -0
  182. package/dist/infrastructure/llm/prompts/index.d.ts +4 -0
  183. package/dist/infrastructure/llm/prompts/index.d.ts.map +1 -0
  184. package/dist/infrastructure/llm/prompts/index.js +4 -0
  185. package/dist/infrastructure/llm/prompts/index.js.map +1 -0
  186. package/dist/infrastructure/llm/prompts/system-prompt.d.ts +12 -0
  187. package/dist/infrastructure/llm/prompts/system-prompt.d.ts.map +1 -0
  188. package/dist/infrastructure/llm/prompts/system-prompt.js +96 -0
  189. package/dist/infrastructure/llm/prompts/system-prompt.js.map +1 -0
  190. package/dist/infrastructure/persistence/index.d.ts +3 -0
  191. package/dist/infrastructure/persistence/index.d.ts.map +1 -0
  192. package/dist/infrastructure/persistence/index.js +3 -0
  193. package/dist/infrastructure/persistence/index.js.map +1 -0
  194. package/dist/infrastructure/persistence/memory-store.d.ts +24 -0
  195. package/dist/infrastructure/persistence/memory-store.d.ts.map +1 -0
  196. package/dist/infrastructure/persistence/memory-store.js +71 -0
  197. package/dist/infrastructure/persistence/memory-store.js.map +1 -0
  198. package/dist/infrastructure/persistence/schema.d.ts +120 -0
  199. package/dist/infrastructure/persistence/schema.d.ts.map +1 -0
  200. package/dist/infrastructure/persistence/schema.js +130 -0
  201. package/dist/infrastructure/persistence/schema.js.map +1 -0
  202. package/dist/infrastructure/sandbox/ast-validator.d.ts +23 -0
  203. package/dist/infrastructure/sandbox/ast-validator.d.ts.map +1 -0
  204. package/dist/infrastructure/sandbox/ast-validator.js +249 -0
  205. package/dist/infrastructure/sandbox/ast-validator.js.map +1 -0
  206. package/dist/infrastructure/sandbox/index.d.ts +4 -0
  207. package/dist/infrastructure/sandbox/index.d.ts.map +1 -0
  208. package/dist/infrastructure/sandbox/index.js +4 -0
  209. package/dist/infrastructure/sandbox/index.js.map +1 -0
  210. package/dist/infrastructure/sandbox/prelude/rlm_prelude.py +376 -0
  211. package/dist/infrastructure/sandbox/process-manager.d.ts +98 -0
  212. package/dist/infrastructure/sandbox/process-manager.d.ts.map +1 -0
  213. package/dist/infrastructure/sandbox/process-manager.js +186 -0
  214. package/dist/infrastructure/sandbox/process-manager.js.map +1 -0
  215. package/dist/infrastructure/sandbox/python-executor.d.ts +29 -0
  216. package/dist/infrastructure/sandbox/python-executor.d.ts.map +1 -0
  217. package/dist/infrastructure/sandbox/python-executor.js +182 -0
  218. package/dist/infrastructure/sandbox/python-executor.js.map +1 -0
  219. package/package.json +65 -0
  220. package/src/infrastructure/sandbox/prelude/rlm_prelude.py +376 -0
@@ -0,0 +1,4 @@
1
+ export { queryCommand, type QueryOptions } from './query.js';
2
+ export { sessionListCommand, sessionGetCommand, sessionCancelCommand, type SessionListOptions, type SessionGetOptions, type SessionCancelOptions, } from './session.js';
3
+ export { configShowCommand, configSetCommand, configInitCommand, type ConfigShowOptions, type ConfigSetOptions, type ConfigInitOptions, } from './config.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,GAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,GACvB,MAAM,aAAa,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { queryCommand } from './query.js';
2
+ export { sessionListCommand, sessionGetCommand, sessionCancelCommand, } from './session.js';
3
+ export { configShowCommand, configSetCommand, configInitCommand, } from './config.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqB,MAAM,YAAY,CAAC;AAC7D,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,GAIrB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,GAIlB,MAAM,aAAa,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { type OutputFormat } from '../output/index.js';
2
+ import type { SandboxMode } from '../../domain/types/config.js';
3
+ /**
4
+ * Options for query command
5
+ */
6
+ export interface QueryOptions {
7
+ context?: string;
8
+ file?: string;
9
+ query: string;
10
+ model?: string;
11
+ maxDepth?: number;
12
+ maxCost?: number;
13
+ maxTokens?: number;
14
+ timeout?: number;
15
+ temperature?: number;
16
+ sandbox?: SandboxMode;
17
+ format?: OutputFormat;
18
+ verbose?: boolean;
19
+ config?: string;
20
+ apiKey?: string;
21
+ }
22
+ /**
23
+ * Execute the query command
24
+ */
25
+ export declare function queryCommand(options: QueryOptions): Promise<void>;
26
+ //# sourceMappingURL=query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/query.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgB,KAAK,YAAY,EAAkB,MAAM,oBAAoB,CAAC;AAErF,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAgFvE"}
@@ -0,0 +1,90 @@
1
+ import fs from 'node:fs';
2
+ import { createRLM } from '../../factory/create-rlm.js';
3
+ import { NodeEventEmitter } from '../../infrastructure/events/node-emitter.js';
4
+ import { formatResult, createProgress } from '../output/index.js';
5
+ import { findAndLoadConfig, mergeConfigs } from '../config-loader.js';
6
+ /**
7
+ * Execute the query command
8
+ */
9
+ export async function queryCommand(options) {
10
+ // Load config file
11
+ let fileConfig = null;
12
+ if (options.config) {
13
+ const { loadConfigFile } = await import('../config-loader.js');
14
+ fileConfig = loadConfigFile(options.config);
15
+ }
16
+ else {
17
+ fileConfig = findAndLoadConfig();
18
+ }
19
+ // Build config from CLI options
20
+ const cliConfig = {};
21
+ if (options.model)
22
+ cliConfig.model = options.model;
23
+ if (options.maxDepth)
24
+ cliConfig.maxRecursionDepth = options.maxDepth;
25
+ if (options.maxCost)
26
+ cliConfig.maxCostUsd = options.maxCost;
27
+ if (options.maxTokens)
28
+ cliConfig.maxTokens = options.maxTokens;
29
+ if (options.timeout)
30
+ cliConfig.timeoutMs = options.timeout * 1000;
31
+ if (options.temperature)
32
+ cliConfig.temperature = options.temperature;
33
+ if (options.sandbox)
34
+ cliConfig.sandboxMode = options.sandbox;
35
+ // Merge configs
36
+ const { config, apiKey: fileApiKey } = mergeConfigs(cliConfig, fileConfig);
37
+ // Resolve API key
38
+ const apiKey = options.apiKey ?? fileApiKey;
39
+ // Load context
40
+ let context;
41
+ if (options.file) {
42
+ if (!fs.existsSync(options.file)) {
43
+ console.error(`Error: File not found: ${options.file}`);
44
+ process.exit(1);
45
+ }
46
+ context = fs.readFileSync(options.file, 'utf-8');
47
+ }
48
+ else if (options.context) {
49
+ context = options.context;
50
+ }
51
+ else {
52
+ // Read from stdin
53
+ context = fs.readFileSync(0, 'utf-8');
54
+ }
55
+ if (!context.trim()) {
56
+ console.error('Error: No context provided');
57
+ process.exit(1);
58
+ }
59
+ // Create event emitter for progress
60
+ const eventEmitter = new NodeEventEmitter();
61
+ // Set up progress display
62
+ const progress = createProgress({
63
+ verbose: options.verbose,
64
+ spinner: process.stderr.isTTY ?? false,
65
+ });
66
+ progress.attachToEmitter(eventEmitter);
67
+ // Create RLM instance
68
+ const rlm = createRLM({
69
+ apiKey,
70
+ config,
71
+ eventEmitter,
72
+ });
73
+ try {
74
+ // Execute query
75
+ const result = await rlm.query(context, options.query);
76
+ // Format and output result
77
+ const format = options.format ?? 'text';
78
+ const output = formatResult(result, format);
79
+ console.log(output);
80
+ // Exit with appropriate code
81
+ process.exit(result.success ? 0 : 1);
82
+ }
83
+ catch (error) {
84
+ progress.stop();
85
+ const message = error instanceof Error ? error.message : 'Unknown error';
86
+ console.error(`Error: ${message}`);
87
+ process.exit(1);
88
+ }
89
+ }
90
+ //# sourceMappingURL=query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.js","sourceRoot":"","sources":["../../../src/cli/commands/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAqB,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAuBtE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAqB;IACtD,mBAAmB;IACnB,IAAI,UAAU,GAAG,IAAI,CAAC;IACtB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC,CAAC;QAC/D,UAA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,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,QAAQ,CAAC,IAAI,EAAE,CAAC;QAChB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;QACzE,OAAO,CAAC,KAAK,CAAC,UAAU,OAAO,EAAE,CAAC,CAAC;QACnC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { type OutputFormat } from '../output/index.js';
2
+ import type { SessionStatus } from '../../domain/types/session.js';
3
+ /**
4
+ * Options for session list command
5
+ */
6
+ export interface SessionListOptions {
7
+ status?: SessionStatus;
8
+ limit?: number;
9
+ offset?: number;
10
+ format?: OutputFormat;
11
+ apiKey?: string;
12
+ }
13
+ /**
14
+ * List sessions
15
+ */
16
+ export declare function sessionListCommand(options: SessionListOptions): Promise<void>;
17
+ /**
18
+ * Options for session get command
19
+ */
20
+ export interface SessionGetOptions {
21
+ id: string;
22
+ format?: OutputFormat;
23
+ apiKey?: string;
24
+ }
25
+ /**
26
+ * Get a session by ID
27
+ */
28
+ export declare function sessionGetCommand(options: SessionGetOptions): Promise<void>;
29
+ /**
30
+ * Options for session cancel command
31
+ */
32
+ export interface SessionCancelOptions {
33
+ id: string;
34
+ apiKey?: string;
35
+ }
36
+ /**
37
+ * Cancel a session
38
+ */
39
+ export declare function sessionCancelCommand(options: SessionCancelOptions): Promise<void>;
40
+ //# sourceMappingURL=session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/session.ts"],"names":[],"mappings":"AACA,OAAO,EAAoC,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEzF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBnF;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBjF;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAevF"}
@@ -0,0 +1,55 @@
1
+ import { createRLM } from '../../factory/create-rlm.js';
2
+ import { formatSession, formatSessionList } from '../output/index.js';
3
+ import { findAndLoadConfig, mergeConfigs } from '../config-loader.js';
4
+ /**
5
+ * List sessions
6
+ */
7
+ export async function sessionListCommand(options) {
8
+ const fileConfig = findAndLoadConfig();
9
+ const { apiKey: fileApiKey } = mergeConfigs({}, fileConfig);
10
+ const apiKey = options.apiKey ?? fileApiKey;
11
+ const rlm = createRLM({ apiKey });
12
+ const sessions = await rlm.listSessions({
13
+ status: options.status,
14
+ limit: options.limit ?? 20,
15
+ offset: options.offset ?? 0,
16
+ orderBy: 'createdAt',
17
+ orderDir: 'desc',
18
+ });
19
+ const format = options.format ?? 'text';
20
+ const output = formatSessionList(sessions, format);
21
+ console.log(output);
22
+ }
23
+ /**
24
+ * Get a session by ID
25
+ */
26
+ export async function sessionGetCommand(options) {
27
+ const fileConfig = findAndLoadConfig();
28
+ const { apiKey: fileApiKey } = mergeConfigs({}, fileConfig);
29
+ const apiKey = options.apiKey ?? fileApiKey;
30
+ const rlm = createRLM({ apiKey });
31
+ const session = await rlm.getSession(options.id);
32
+ if (!session) {
33
+ console.error(`Session not found: ${options.id}`);
34
+ process.exit(1);
35
+ }
36
+ const format = options.format ?? 'text';
37
+ const output = formatSession(session, format);
38
+ console.log(output);
39
+ }
40
+ /**
41
+ * Cancel a session
42
+ */
43
+ export async function sessionCancelCommand(options) {
44
+ const fileConfig = findAndLoadConfig();
45
+ const { apiKey: fileApiKey } = mergeConfigs({}, fileConfig);
46
+ const apiKey = options.apiKey ?? fileApiKey;
47
+ const rlm = createRLM({ apiKey });
48
+ const session = await rlm.cancelSession(options.id);
49
+ if (!session) {
50
+ console.error(`Session not found: ${options.id}`);
51
+ process.exit(1);
52
+ }
53
+ console.log(`Session ${options.id} cancelled.`);
54
+ }
55
+ //# sourceMappingURL=session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/cli/commands/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAqB,MAAM,oBAAoB,CAAC;AACzF,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AActE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,OAA2B;IAClE,MAAM,UAAU,GAAG,iBAAiB,EAAE,CAAC;IACvC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,YAAY,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;IAC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GAAG,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC;AAUD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAA6B;IACtE,MAAM,UAAU,GAAG,iBAAiB,EAAE,CAAC;IACvC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,YAAY,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;IAC5D,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,UAAU,CAAC;IAE5C,MAAM,GAAG,GAAG,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAElC,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAEpD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,sBAAsB,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;QAClD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,WAAW,OAAO,CAAC,EAAE,aAAa,CAAC,CAAC;AAClD,CAAC"}
@@ -0,0 +1,63 @@
1
+ import { z } from 'zod';
2
+ import type { RLMConfigInput } from '../domain/types/config.js';
3
+ /**
4
+ * Schema for CLI config file
5
+ */
6
+ declare const ConfigFileSchema: z.ZodObject<{
7
+ apiKey: z.ZodOptional<z.ZodString>;
8
+ model: z.ZodOptional<z.ZodString>;
9
+ maxRecursionDepth: z.ZodOptional<z.ZodNumber>;
10
+ maxTokens: z.ZodOptional<z.ZodNumber>;
11
+ maxCostUsd: z.ZodOptional<z.ZodNumber>;
12
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
13
+ temperature: z.ZodOptional<z.ZodNumber>;
14
+ sandboxMode: z.ZodOptional<z.ZodEnum<["strict", "permissive", "disabled"]>>;
15
+ }, "strip", z.ZodTypeAny, {
16
+ timeoutMs?: number | undefined;
17
+ temperature?: number | undefined;
18
+ maxTokens?: number | undefined;
19
+ model?: string | undefined;
20
+ apiKey?: string | undefined;
21
+ maxRecursionDepth?: number | undefined;
22
+ maxCostUsd?: number | undefined;
23
+ sandboxMode?: "strict" | "permissive" | "disabled" | undefined;
24
+ }, {
25
+ timeoutMs?: number | undefined;
26
+ temperature?: number | undefined;
27
+ maxTokens?: number | undefined;
28
+ model?: string | undefined;
29
+ apiKey?: string | undefined;
30
+ maxRecursionDepth?: number | undefined;
31
+ maxCostUsd?: number | undefined;
32
+ sandboxMode?: "strict" | "permissive" | "disabled" | undefined;
33
+ }>;
34
+ export type ConfigFile = z.infer<typeof ConfigFileSchema>;
35
+ /**
36
+ * Load config from a file
37
+ */
38
+ export declare function loadConfigFile(filePath: string): ConfigFile;
39
+ /**
40
+ * Find and load config from default locations
41
+ */
42
+ export declare function findAndLoadConfig(): ConfigFile | null;
43
+ /**
44
+ * Convert config file to RLMConfigInput
45
+ */
46
+ export declare function configFileToInput(file: ConfigFile): RLMConfigInput;
47
+ /**
48
+ * Merge configs with priority: CLI args > file > env > defaults
49
+ */
50
+ export declare function mergeConfigs(cliArgs: Partial<RLMConfigInput>, fileConfig?: ConfigFile | null): {
51
+ config: RLMConfigInput;
52
+ apiKey?: string;
53
+ };
54
+ /**
55
+ * Save config to file
56
+ */
57
+ export declare function saveConfigFile(filePath: string, config: ConfigFile): void;
58
+ /**
59
+ * Get default config file path
60
+ */
61
+ export declare function getDefaultConfigPath(): string;
62
+ export {};
63
+ //# sourceMappingURL=config-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../src/cli/config-loader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,2BAA2B,CAAC;AAE7E;;GAEG;AACH,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;EASpB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAY1D;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAI3D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,UAAU,GAAG,IAAI,CAWrD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,cAAc,CAUlE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,EAChC,UAAU,CAAC,EAAE,UAAU,GAAG,IAAI,GAC7B;IAAE,MAAM,EAAE,cAAc,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAU7C;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAMzE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAG7C"}
@@ -0,0 +1,94 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { z } from 'zod';
4
+ /**
5
+ * Schema for CLI config file
6
+ */
7
+ const ConfigFileSchema = z.object({
8
+ apiKey: z.string().optional(),
9
+ model: z.string().optional(),
10
+ maxRecursionDepth: z.number().min(1).max(10).optional(),
11
+ maxTokens: z.number().min(1000).optional(),
12
+ maxCostUsd: z.number().min(0).optional(),
13
+ timeoutMs: z.number().min(1000).optional(),
14
+ temperature: z.number().min(0).max(1).optional(),
15
+ sandboxMode: z.enum(['strict', 'permissive', 'disabled']).optional(),
16
+ });
17
+ /**
18
+ * Default config file locations
19
+ */
20
+ const CONFIG_LOCATIONS = [
21
+ '.rlm.json',
22
+ '.rlm/config.json',
23
+ path.join(process.env['HOME'] ?? '', '.rlm/config.json'),
24
+ path.join(process.env['HOME'] ?? '', '.config/rlm/config.json'),
25
+ ];
26
+ /**
27
+ * Load config from a file
28
+ */
29
+ export function loadConfigFile(filePath) {
30
+ const content = fs.readFileSync(filePath, 'utf-8');
31
+ const parsed = JSON.parse(content);
32
+ return ConfigFileSchema.parse(parsed);
33
+ }
34
+ /**
35
+ * Find and load config from default locations
36
+ */
37
+ export function findAndLoadConfig() {
38
+ for (const location of CONFIG_LOCATIONS) {
39
+ try {
40
+ if (fs.existsSync(location)) {
41
+ return loadConfigFile(location);
42
+ }
43
+ }
44
+ catch {
45
+ // Continue to next location
46
+ }
47
+ }
48
+ return null;
49
+ }
50
+ /**
51
+ * Convert config file to RLMConfigInput
52
+ */
53
+ export function configFileToInput(file) {
54
+ return {
55
+ maxRecursionDepth: file.maxRecursionDepth,
56
+ maxTokens: file.maxTokens,
57
+ maxCostUsd: file.maxCostUsd,
58
+ timeoutMs: file.timeoutMs,
59
+ temperature: file.temperature,
60
+ sandboxMode: file.sandboxMode,
61
+ model: file.model,
62
+ };
63
+ }
64
+ /**
65
+ * Merge configs with priority: CLI args > file > env > defaults
66
+ */
67
+ export function mergeConfigs(cliArgs, fileConfig) {
68
+ const fileInput = fileConfig ? configFileToInput(fileConfig) : {};
69
+ return {
70
+ config: {
71
+ ...fileInput,
72
+ ...cliArgs,
73
+ },
74
+ apiKey: fileConfig?.apiKey,
75
+ };
76
+ }
77
+ /**
78
+ * Save config to file
79
+ */
80
+ export function saveConfigFile(filePath, config) {
81
+ const dir = path.dirname(filePath);
82
+ if (!fs.existsSync(dir)) {
83
+ fs.mkdirSync(dir, { recursive: true });
84
+ }
85
+ fs.writeFileSync(filePath, JSON.stringify(config, null, 2));
86
+ }
87
+ /**
88
+ * Get default config file path
89
+ */
90
+ export function getDefaultConfigPath() {
91
+ const home = process.env['HOME'] ?? '';
92
+ return path.join(home, '.rlm', 'config.json');
93
+ }
94
+ //# sourceMappingURL=config-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-loader.js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MAAM,EAAE,UAAU,EAAE,MAAM;KAC3B,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB,EAAE,MAAkB;IACjE,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACzC,CAAC;IACD,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB;IAClC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IACvC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;AAChD,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,120 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from 'commander';
3
+ import { queryCommand, sessionListCommand, sessionGetCommand, sessionCancelCommand, configShowCommand, configSetCommand, configInitCommand, } from './commands/index.js';
4
+ const program = new Command();
5
+ program
6
+ .name('rlm')
7
+ .description('Recursive Language Model - Process massive contexts through recursive LLM decomposition')
8
+ .version('0.1.0');
9
+ // Query command
10
+ program
11
+ .command('query')
12
+ .description('Execute an RLM query on context')
13
+ .requiredOption('-q, --query <query>', 'The query/task to perform')
14
+ .option('-c, --context <text>', 'Context text to process')
15
+ .option('-f, --file <path>', 'Read context from file')
16
+ .option('-m, --model <model>', 'LLM model to use')
17
+ .option('--max-depth <n>', 'Maximum recursion depth', parseInt)
18
+ .option('--max-cost <n>', 'Maximum cost in USD', parseFloat)
19
+ .option('--max-tokens <n>', 'Maximum tokens', parseInt)
20
+ .option('--timeout <seconds>', 'Timeout in seconds', parseInt)
21
+ .option('--temperature <n>', 'LLM temperature (0-1)', parseFloat)
22
+ .option('--sandbox <mode>', 'Sandbox mode (strict|permissive|disabled)')
23
+ .option('--format <format>', 'Output format (text|json|table)')
24
+ .option('-v, --verbose', 'Show verbose output')
25
+ .option('--config <path>', 'Path to config file')
26
+ .option('--api-key <key>', 'OpenRouter API key')
27
+ .action(async (options) => {
28
+ await queryCommand({
29
+ query: options.query,
30
+ context: options.context,
31
+ file: options.file,
32
+ model: options.model,
33
+ maxDepth: options.maxDepth,
34
+ maxCost: options.maxCost,
35
+ maxTokens: options.maxTokens,
36
+ timeout: options.timeout,
37
+ temperature: options.temperature,
38
+ sandbox: options.sandbox,
39
+ format: options.format,
40
+ verbose: options.verbose,
41
+ config: options.config,
42
+ apiKey: options.apiKey,
43
+ });
44
+ });
45
+ // Session commands
46
+ const session = program
47
+ .command('session')
48
+ .description('Manage RLM sessions');
49
+ session
50
+ .command('list')
51
+ .description('List sessions')
52
+ .option('--status <status>', 'Filter by status')
53
+ .option('--limit <n>', 'Maximum number of sessions', parseInt)
54
+ .option('--offset <n>', 'Offset for pagination', parseInt)
55
+ .option('--format <format>', 'Output format (text|json|table)')
56
+ .option('--api-key <key>', 'OpenRouter API key')
57
+ .action(async (options) => {
58
+ await sessionListCommand({
59
+ status: options.status,
60
+ limit: options.limit,
61
+ offset: options.offset,
62
+ format: options.format,
63
+ apiKey: options.apiKey,
64
+ });
65
+ });
66
+ session
67
+ .command('get <id>')
68
+ .description('Get session details')
69
+ .option('--format <format>', 'Output format (text|json)')
70
+ .option('--api-key <key>', 'OpenRouter API key')
71
+ .action(async (id, options) => {
72
+ await sessionGetCommand({
73
+ id,
74
+ format: options.format,
75
+ apiKey: options.apiKey,
76
+ });
77
+ });
78
+ session
79
+ .command('cancel <id>')
80
+ .description('Cancel a running session')
81
+ .option('--api-key <key>', 'OpenRouter API key')
82
+ .action(async (id, options) => {
83
+ await sessionCancelCommand({
84
+ id,
85
+ apiKey: options.apiKey,
86
+ });
87
+ });
88
+ // Config commands
89
+ const config = program
90
+ .command('config')
91
+ .description('Manage RLM configuration');
92
+ config
93
+ .command('show')
94
+ .description('Show current configuration')
95
+ .option('--format <format>', 'Output format (text|json)')
96
+ .option('--effective', 'Show effective (merged) configuration')
97
+ .action((options) => {
98
+ configShowCommand({
99
+ format: options.format,
100
+ effective: options.effective,
101
+ });
102
+ });
103
+ config
104
+ .command('set <key> <value>')
105
+ .description('Set a configuration value')
106
+ .action((key, value) => {
107
+ configSetCommand({ key, value });
108
+ });
109
+ config
110
+ .command('init')
111
+ .description('Initialize configuration file')
112
+ .option('-f, --force', 'Overwrite existing config')
113
+ .action((options) => {
114
+ configInitCommand({
115
+ force: options.force,
116
+ });
117
+ });
118
+ // Parse and run
119
+ program.parse();
120
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAK7B,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,KAAK,CAAC;KACX,WAAW,CAAC,yFAAyF,CAAC;KACtG,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,gBAAgB;AAChB,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,iCAAiC,CAAC;KAC9C,cAAc,C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AAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEL,gBAAgB;AAChB,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { RLMResult } from '../../domain/types/result.js';
2
+ import type { RLMSession } from '../../domain/types/session.js';
3
+ import type { RLMConfig } from '../../domain/types/config.js';
4
+ /**
5
+ * Output format types
6
+ */
7
+ export type OutputFormat = 'text' | 'json' | 'table';
8
+ /**
9
+ * Format RLM result for display
10
+ */
11
+ export declare function formatResult(result: RLMResult, format?: OutputFormat): string;
12
+ /**
13
+ * Format session for display
14
+ */
15
+ export declare function formatSession(session: RLMSession, format?: OutputFormat): string;
16
+ /**
17
+ * Format session list for display
18
+ */
19
+ export declare function formatSessionList(sessions: readonly RLMSession[], format?: OutputFormat): string;
20
+ /**
21
+ * Format config for display
22
+ */
23
+ export declare function formatConfig(config: RLMConfig, format?: OutputFormat): string;
24
+ //# sourceMappingURL=formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../../src/cli/output/formatter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAErD;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,GAAE,YAAqB,GAAG,MAAM,CAYrF;AA2ED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,GAAE,YAAqB,GAAG,MAAM,CASxF;AAgCD;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,SAAS,UAAU,EAAE,EAC/B,MAAM,GAAE,YAAqB,GAC5B,MAAM,CAgBR;AA+BD;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,GAAE,YAAqB,GAAG,MAAM,CAkBrF"}