centaurus-cli 2.0.1 → 2.1.0

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 (108) hide show
  1. package/CONFIG_GUIDE.md +100 -106
  2. package/README.md +68 -63
  3. package/dist/cli-adapter.d.ts +9 -3
  4. package/dist/cli-adapter.d.ts.map +1 -1
  5. package/dist/cli-adapter.js +175 -164
  6. package/dist/cli-adapter.js.map +1 -1
  7. package/dist/commands/CommandParser.d.ts +1 -1
  8. package/dist/commands/CommandParser.d.ts.map +1 -1
  9. package/dist/commands/CommandParser.js +3 -18
  10. package/dist/commands/CommandParser.js.map +1 -1
  11. package/dist/commands/view-duplication-logs.d.ts +5 -0
  12. package/dist/commands/view-duplication-logs.d.ts.map +1 -0
  13. package/dist/commands/view-duplication-logs.js +14 -0
  14. package/dist/commands/view-duplication-logs.js.map +1 -0
  15. package/dist/config/ConfigManager.d.ts +10 -7
  16. package/dist/config/ConfigManager.d.ts.map +1 -1
  17. package/dist/config/ConfigManager.js +43 -142
  18. package/dist/config/ConfigManager.js.map +1 -1
  19. package/dist/config/defaultConfig.d.ts +0 -4
  20. package/dist/config/defaultConfig.d.ts.map +1 -1
  21. package/dist/config/defaultConfig.js +1 -6
  22. package/dist/config/defaultConfig.js.map +1 -1
  23. package/dist/config/manager.d.ts +15 -13
  24. package/dist/config/manager.d.ts.map +1 -1
  25. package/dist/config/manager.js +52 -41
  26. package/dist/config/manager.js.map +1 -1
  27. package/dist/config/models.d.ts +31 -0
  28. package/dist/config/models.d.ts.map +1 -0
  29. package/dist/config/models.js +49 -0
  30. package/dist/config/models.js.map +1 -0
  31. package/dist/config/types.d.ts +0 -3
  32. package/dist/config/types.d.ts.map +1 -1
  33. package/dist/config/types.js +0 -1
  34. package/dist/config/types.js.map +1 -1
  35. package/dist/index.js +48 -8
  36. package/dist/index.js.map +1 -1
  37. package/dist/prompts/system-prompt.d.ts +1 -1
  38. package/dist/prompts/system-prompt.d.ts.map +1 -1
  39. package/dist/prompts/system-prompt.js +0 -1
  40. package/dist/prompts/system-prompt.js.map +1 -1
  41. package/dist/services/ai-service-client.d.ts +87 -0
  42. package/dist/services/ai-service-client.d.ts.map +1 -0
  43. package/dist/services/ai-service-client.js +268 -0
  44. package/dist/services/ai-service-client.js.map +1 -0
  45. package/dist/services/api-client.d.ts +5 -0
  46. package/dist/services/api-client.d.ts.map +1 -1
  47. package/dist/services/api-client.js +72 -59
  48. package/dist/services/api-client.js.map +1 -1
  49. package/dist/services/auth-handler.js +2 -2
  50. package/dist/services/auth-handler.js.map +1 -1
  51. package/dist/tools/ToolRegistry.d.ts +14 -3
  52. package/dist/tools/ToolRegistry.d.ts.map +1 -1
  53. package/dist/tools/ToolRegistry.js +46 -34
  54. package/dist/tools/ToolRegistry.js.map +1 -1
  55. package/dist/tools/command.d.ts.map +1 -1
  56. package/dist/tools/command.js +17 -3
  57. package/dist/tools/command.js.map +1 -1
  58. package/dist/tools/file-ops.js +3 -3
  59. package/dist/tools/file-ops.js.map +1 -1
  60. package/dist/tools/web-search.d.ts.map +1 -1
  61. package/dist/tools/web-search.js +6 -2
  62. package/dist/tools/web-search.js.map +1 -1
  63. package/dist/types/index.d.ts +1 -0
  64. package/dist/types/index.d.ts.map +1 -1
  65. package/dist/ui/components/App.d.ts +3 -2
  66. package/dist/ui/components/App.d.ts.map +1 -1
  67. package/dist/ui/components/App.js +107 -16
  68. package/dist/ui/components/App.js.map +1 -1
  69. package/dist/ui/components/CodeBlock.d.ts.map +1 -1
  70. package/dist/ui/components/CodeBlock.js +15 -3
  71. package/dist/ui/components/CodeBlock.js.map +1 -1
  72. package/dist/ui/components/ConfirmPrompt.d.ts.map +1 -1
  73. package/dist/ui/components/ConfirmPrompt.js +32 -20
  74. package/dist/ui/components/ConfirmPrompt.js.map +1 -1
  75. package/dist/ui/components/DiffViewer.d.ts.map +1 -1
  76. package/dist/ui/components/DiffViewer.js +16 -2
  77. package/dist/ui/components/DiffViewer.js.map +1 -1
  78. package/dist/ui/components/InputBox.d.ts.map +1 -1
  79. package/dist/ui/components/InputBox.js +26 -9
  80. package/dist/ui/components/InputBox.js.map +1 -1
  81. package/dist/ui/components/LoadingIndicator.d.ts.map +1 -1
  82. package/dist/ui/components/LoadingIndicator.js +6 -2
  83. package/dist/ui/components/LoadingIndicator.js.map +1 -1
  84. package/dist/ui/components/MarkdownRenderer.d.ts.map +1 -1
  85. package/dist/ui/components/MarkdownRenderer.js +8 -12
  86. package/dist/ui/components/MarkdownRenderer.js.map +1 -1
  87. package/dist/ui/components/StreamingMessageDisplay.d.ts +6 -7
  88. package/dist/ui/components/StreamingMessageDisplay.d.ts.map +1 -1
  89. package/dist/ui/components/StreamingMessageDisplay.js +69 -12
  90. package/dist/ui/components/StreamingMessageDisplay.js.map +1 -1
  91. package/dist/ui/components/ToolExecutionMessage.d.ts.map +1 -1
  92. package/dist/ui/components/ToolExecutionMessage.js +44 -16
  93. package/dist/ui/components/ToolExecutionMessage.js.map +1 -1
  94. package/dist/ui/components/WelcomeBanner.d.ts.map +1 -1
  95. package/dist/ui/components/WelcomeBanner.js.map +1 -1
  96. package/dist/ui/utils/duplication-detector.d.ts +32 -0
  97. package/dist/ui/utils/duplication-detector.d.ts.map +1 -0
  98. package/dist/ui/utils/duplication-detector.js +227 -0
  99. package/dist/ui/utils/duplication-detector.js.map +1 -0
  100. package/dist/ui/utils/duplication-logger.d.ts +21 -0
  101. package/dist/ui/utils/duplication-logger.d.ts.map +1 -0
  102. package/dist/ui/utils/duplication-logger.js +85 -0
  103. package/dist/ui/utils/duplication-logger.js.map +1 -0
  104. package/dist/ui/utils/terminal-scanner.d.ts +19 -0
  105. package/dist/ui/utils/terminal-scanner.d.ts.map +1 -0
  106. package/dist/ui/utils/terminal-scanner.js +217 -0
  107. package/dist/ui/utils/terminal-scanner.js.map +1 -0
  108. package/package.json +2 -5
@@ -3,10 +3,12 @@ import * as path from 'path';
3
3
  import * as os from 'os';
4
4
  import { DEFAULT_CONFIG } from './types.js';
5
5
  import { apiClient } from '../services/api-client.js';
6
+ import { isValidModel, getInvalidModelError } from './models.js';
6
7
  export class ConfigManager {
7
8
  configPath;
8
9
  config = null;
9
10
  useBackendSync = false;
11
+ migrationPerformed = false;
10
12
  constructor() {
11
13
  const homeDir = os.homedir();
12
14
  const configDir = path.join(homeDir, '.centaurus');
@@ -39,7 +41,6 @@ export class ConfigManager {
39
41
  const config = this.load();
40
42
  await apiClient.updateSettings({
41
43
  defaultModel: config.model,
42
- defaultProvider: config.provider,
43
44
  });
44
45
  }
45
46
  catch (error) {
@@ -47,28 +48,6 @@ export class ConfigManager {
47
48
  console.error('Failed to sync settings to backend:', error);
48
49
  }
49
50
  }
50
- /**
51
- * Parse comma-separated API keys into an array
52
- */
53
- parseApiKeys(keys) {
54
- if (!keys)
55
- return [];
56
- return keys.split(',').map(key => key.trim()).filter(key => key.length > 0);
57
- }
58
- /**
59
- * Get all Google API keys as an array
60
- */
61
- getGoogleApiKeys() {
62
- const config = this.load();
63
- return this.parseApiKeys(config.googleApiKey);
64
- }
65
- /**
66
- * Get all OpenRouter API keys as an array
67
- */
68
- getOpenRouterApiKeys() {
69
- const config = this.load();
70
- return this.parseApiKeys(config.openrouterApiKey);
71
- }
72
51
  /**
73
52
  * Load configuration from disk
74
53
  */
@@ -79,13 +58,29 @@ export class ConfigManager {
79
58
  if (fs.existsSync(this.configPath)) {
80
59
  try {
81
60
  const data = fs.readFileSync(this.configPath, 'utf-8');
82
- this.config = { ...DEFAULT_CONFIG, ...JSON.parse(data) };
83
- // Validate and fix invalid provider value
84
- if (this.config.provider !== 'google' && this.config.provider !== 'openrouter') {
85
- console.warn(`Invalid provider '${this.config.provider}' in config, defaulting to 'google'`);
86
- this.config.provider = 'google';
61
+ const loadedConfig = JSON.parse(data);
62
+ // Detect if old config format exists (migration needed)
63
+ const hasDeprecatedFields = 'googleApiKey' in loadedConfig ||
64
+ 'openrouterApiKey' in loadedConfig ||
65
+ 'openRouterApiKey' in loadedConfig ||
66
+ 'anthropicApiKey' in loadedConfig ||
67
+ 'provider' in loadedConfig;
68
+ if (hasDeprecatedFields) {
69
+ this.migrationPerformed = true;
70
+ // Remove deprecated fields
71
+ delete loadedConfig.googleApiKey;
72
+ delete loadedConfig.openrouterApiKey;
73
+ delete loadedConfig.openRouterApiKey;
74
+ delete loadedConfig.anthropicApiKey;
75
+ delete loadedConfig.provider;
76
+ // Preserve model preference and other settings
77
+ this.config = { ...DEFAULT_CONFIG, ...loadedConfig };
78
+ // Save the migrated config immediately
87
79
  this.save(this.config);
88
80
  }
81
+ else {
82
+ this.config = { ...DEFAULT_CONFIG, ...loadedConfig };
83
+ }
89
84
  }
90
85
  catch (error) {
91
86
  console.error('Error loading config:', error);
@@ -119,9 +114,11 @@ export class ConfigManager {
119
114
  * Set a specific configuration value
120
115
  */
121
116
  set(key, value) {
122
- // Validate provider value
123
- if (key === 'provider' && value !== 'google' && value !== 'openrouter') {
124
- throw new Error(`Invalid provider: ${value}. Must be 'google' or 'openrouter'`);
117
+ // Validate model if setting model key
118
+ if (key === 'model' && typeof value === 'string') {
119
+ if (!isValidModel(value)) {
120
+ throw new Error(getInvalidModelError(value));
121
+ }
125
122
  }
126
123
  const config = this.load();
127
124
  config[key] = value;
@@ -131,6 +128,15 @@ export class ConfigManager {
131
128
  // Ignore sync errors
132
129
  });
133
130
  }
131
+ /**
132
+ * Set model with validation
133
+ */
134
+ setModel(model) {
135
+ if (!isValidModel(model)) {
136
+ throw new Error(getInvalidModelError(model));
137
+ }
138
+ this.set('model', model);
139
+ }
134
140
  /**
135
141
  * Get all configuration
136
142
  */
@@ -138,19 +144,11 @@ export class ConfigManager {
138
144
  return this.load();
139
145
  }
140
146
  /**
141
- * Check if configuration is complete (has required API keys)
147
+ * Check if configuration is complete
142
148
  */
143
149
  isComplete() {
144
150
  const config = this.load();
145
- if (config.provider === 'google') {
146
- const keys = this.getGoogleApiKeys();
147
- return keys.length > 0;
148
- }
149
- else if (config.provider === 'openrouter') {
150
- const keys = this.getOpenRouterApiKeys();
151
- return keys.length > 0;
152
- }
153
- return false;
151
+ return !!config.model;
154
152
  }
155
153
  /**
156
154
  * Get the config file path
@@ -158,5 +156,18 @@ export class ConfigManager {
158
156
  getConfigPath() {
159
157
  return this.configPath;
160
158
  }
159
+ /**
160
+ * Check if configuration migration was performed
161
+ * This is used to show a one-time migration message to users
162
+ */
163
+ wasMigrationPerformed() {
164
+ return this.migrationPerformed;
165
+ }
166
+ /**
167
+ * Reset migration flag (after showing migration message)
168
+ */
169
+ resetMigrationFlag() {
170
+ this.migrationPerformed = false;
171
+ }
161
172
  }
162
173
  //# sourceMappingURL=manager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"manager.js","sourceRoot":"","sources":["../../src/config/manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAU,cAAc,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,MAAM,OAAO,aAAa;IAChB,UAAU,CAAS;IACnB,MAAM,GAAkB,IAAI,CAAC;IAC7B,cAAc,GAAY,KAAK,CAAC;IAExC;QACE,MAAM,OAAO,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;QAC7B,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QACnD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QAEtD,iCAAiC;QACjC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC9B,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED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BAAkB,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,kBAAkB;QAChB,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;IAClC,CAAC;CACF"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Supported AI models
3
+ * Must match backend validation
4
+ */
5
+ /**
6
+ * List of supported Google AI models
7
+ */
8
+ export declare const SUPPORTED_MODELS: readonly ["gemini-2.5-flash", "gemini-2.5-pro", "gemini-2.0-flash-exp", "gemini-1.5-flash", "gemini-1.5-pro"];
9
+ /**
10
+ * Type for supported model names
11
+ */
12
+ export type SupportedModel = typeof SUPPORTED_MODELS[number];
13
+ /**
14
+ * Validate if a model name is supported
15
+ * @param model - Model name to validate
16
+ * @returns true if model is supported, false otherwise
17
+ */
18
+ export declare function isValidModel(model: string): model is SupportedModel;
19
+ /**
20
+ * Get a user-friendly error message for invalid models
21
+ * @param invalidModel - The invalid model name
22
+ * @returns Error message with list of valid models
23
+ */
24
+ export declare function getInvalidModelError(invalidModel: string): string;
25
+ /**
26
+ * Get model display name with description
27
+ * @param model - Model name
28
+ * @returns Display name with description
29
+ */
30
+ export declare function getModelDisplayName(model: SupportedModel): string;
31
+ //# sourceMappingURL=models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/config/models.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB,+GAMnB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAE7D;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,cAAc,CAEnE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAKjE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAUjE"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Supported AI models
3
+ * Must match backend validation
4
+ */
5
+ /**
6
+ * List of supported Google AI models
7
+ */
8
+ export const SUPPORTED_MODELS = [
9
+ 'gemini-2.5-flash',
10
+ 'gemini-2.5-pro',
11
+ 'gemini-2.0-flash-exp',
12
+ 'gemini-1.5-flash',
13
+ 'gemini-1.5-pro',
14
+ ];
15
+ /**
16
+ * Validate if a model name is supported
17
+ * @param model - Model name to validate
18
+ * @returns true if model is supported, false otherwise
19
+ */
20
+ export function isValidModel(model) {
21
+ return SUPPORTED_MODELS.includes(model);
22
+ }
23
+ /**
24
+ * Get a user-friendly error message for invalid models
25
+ * @param invalidModel - The invalid model name
26
+ * @returns Error message with list of valid models
27
+ */
28
+ export function getInvalidModelError(invalidModel) {
29
+ return `Invalid model: ${invalidModel}\n\n` +
30
+ `Supported Google models:\n` +
31
+ SUPPORTED_MODELS.map(m => ` - ${m}`).join('\n') +
32
+ `\n\nUse /model to select from available models.`;
33
+ }
34
+ /**
35
+ * Get model display name with description
36
+ * @param model - Model name
37
+ * @returns Display name with description
38
+ */
39
+ export function getModelDisplayName(model) {
40
+ const descriptions = {
41
+ 'gemini-2.5-flash': 'Gemini 2.5 Flash - Fast and efficient',
42
+ 'gemini-2.5-pro': 'Gemini 2.5 Pro - Most capable',
43
+ 'gemini-2.0-flash-exp': 'Gemini 2.0 Flash (Experimental) - Latest features',
44
+ 'gemini-1.5-flash': 'Gemini 1.5 Flash - Reliable and fast',
45
+ 'gemini-1.5-pro': 'Gemini 1.5 Pro - Advanced reasoning',
46
+ };
47
+ return descriptions[model] || model;
48
+ }
49
+ //# sourceMappingURL=models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/config/models.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,kBAAkB;IAClB,gBAAgB;IAChB,sBAAsB;IACtB,kBAAkB;IAClB,gBAAgB;CACR,CAAC;AAOX;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,OAAO,gBAAgB,CAAC,QAAQ,CAAC,KAAuB,CAAC,CAAC;AAC5D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,YAAoB;IACvD,OAAO,kBAAkB,YAAY,MAAM;QACzC,4BAA4B;QAC5B,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAChD,iDAAiD,CAAC;AACtD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAqB;IACvD,MAAM,YAAY,GAAmC;QACnD,kBAAkB,EAAE,uCAAuC;QAC3D,gBAAgB,EAAE,+BAA+B;QACjD,sBAAsB,EAAE,mDAAmD;QAC3E,kBAAkB,EAAE,sCAAsC;QAC1D,gBAAgB,EAAE,qCAAqC;KACxD,CAAC;IAEF,OAAO,YAAY,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC;AACtC,CAAC"}
@@ -1,8 +1,5 @@
1
1
  export interface Config {
2
- provider: 'google' | 'openrouter';
3
2
  model: string;
4
- googleApiKey?: string;
5
- openrouterApiKey?: string;
6
3
  autoApprove?: boolean;
7
4
  }
8
5
  export declare const DEFAULT_CONFIG: Partial<Config>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACrB,QAAQ,EAAE,QAAQ,GAAG,YAAY,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,cAAc,EAAE,OAAO,CAAC,MAAM,CAI1C,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,cAAc,EAAE,OAAO,CAAC,MAAM,CAG1C,CAAC"}
@@ -1,5 +1,4 @@
1
1
  export const DEFAULT_CONFIG = {
2
- provider: 'google',
3
2
  model: 'gemini-2.0-flash-exp',
4
3
  autoApprove: false,
5
4
  };
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,cAAc,GAAoB;IAC7C,QAAQ,EAAE,QAAQ;IAClB,KAAK,EAAE,sBAAsB;IAC7B,WAAW,EAAE,KAAK;CACnB,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,cAAc,GAAoB;IAC7C,KAAK,EAAE,sBAAsB;IAC7B,WAAW,EAAE,KAAK;CACnB,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
  // Load environment variables from .env file
3
3
  import { config } from 'dotenv';
4
+ import { fileURLToPath } from 'url';
5
+ import { dirname, join } from 'path';
6
+ const __filename = fileURLToPath(import.meta.url);
7
+ const __dirname = dirname(__filename);
8
+ // Try to load .env from multiple locations
9
+ // 1. From the package root (when running from dist/)
10
+ const envPath = join(__dirname, '..', '.env');
11
+ config({ path: envPath });
12
+ // 2. From current working directory (for development)
4
13
  config();
5
14
  import React from 'react';
6
15
  import { render } from 'ink';
@@ -11,32 +20,45 @@ import { CentaurusCLI } from './cli-adapter.js';
11
20
  import { apiClient } from './services/api-client.js';
12
21
  import { authenticateWithGoogle } from './services/auth-handler.js';
13
22
  async function handleAuthentication() {
14
- // Check if already authenticated
23
+ // Check if already authenticated and verify session is valid
15
24
  if (apiClient.isAuthenticated()) {
16
- return true;
25
+ try {
26
+ // Verify the session is actually valid by checking with backend
27
+ await apiClient.getCurrentUser();
28
+ return true; // Session is valid
29
+ }
30
+ catch (error) {
31
+ // Session is invalid/expired, clear it and continue to auth flow
32
+ console.log('\n⚠️ Session expired. Please sign in again.\n');
33
+ }
17
34
  }
35
+ // Check if backend is reachable
36
+ let backendReachable = false;
18
37
  try {
19
- // Check if backend is reachable
20
- // Backend URL is now hardcoded in api-client, so always try to connect
21
38
  await apiClient.healthCheck();
39
+ backendReachable = true;
22
40
  }
23
41
  catch (error) {
42
+ // Backend is not reachable - we'll still show auth screen but inform user
24
43
  console.log('\n⚠️ Backend API is not reachable.');
25
- console.log('Continuing in offline mode...\n');
26
- return true; // Continue without authentication
44
+ console.log('You can still sign in when the backend is available.\n');
27
45
  }
28
46
  // Show authentication welcome screen with picker
29
47
  return new Promise((resolve) => {
30
48
  const { waitUntilExit, clear } = render(React.createElement(AuthWelcomeScreen, {
31
49
  onSignIn: async () => {
32
50
  clear();
51
+ console.log('🔐 Starting authentication...\n');
33
52
  // Attempt authentication via web app
53
+ // The auth handler will open the browser and wait for callback
34
54
  const result = await authenticateWithGoogle();
35
55
  if (result.success) {
56
+ console.log('✅ Authentication successful!\n');
36
57
  resolve(true);
37
58
  }
38
59
  else {
39
- console.log('⚠️ Authentication failed. Exiting...\n');
60
+ console.log(`⚠️ Authentication failed: ${result.error || 'Unknown error'}\n`);
61
+ console.log('Please try again or check your connection.\n');
40
62
  process.exit(1);
41
63
  }
42
64
  },
@@ -57,9 +79,23 @@ async function main() {
57
79
  const cli = new CentaurusCLI();
58
80
  // Initialize CLI (load config, register tools)
59
81
  await cli.initialize();
82
+ // Check if configuration migration occurred and show message
83
+ const migrationMessage = cli.getMigrationMessage();
84
+ if (migrationMessage) {
85
+ console.log(migrationMessage);
86
+ // Wait for user to press Enter
87
+ await new Promise((resolve) => {
88
+ process.stdin.once('data', () => {
89
+ resolve();
90
+ });
91
+ });
92
+ }
93
+ // Clear the terminal before starting the UI
94
+ process.stdout.write('\x1b[2J\x1b[3J\x1b[H');
60
95
  // Render Ink app with error boundary
61
96
  // patchConsole: false prevents console.log from interfering with Ink's rendering
62
97
  // This is CRITICAL for Static component to work properly
98
+ // debug: false reduces flickering by disabling debug output
63
99
  const { waitUntilExit } = render(React.createElement(ErrorBoundary, null, React.createElement(App, {
64
100
  onMessage: (msg) => cli.handleMessage(msg),
65
101
  initialModel: cli.getModel(),
@@ -67,6 +103,9 @@ async function main() {
67
103
  onResponseReceived: (callback) => {
68
104
  cli.setOnResponseCallback(callback);
69
105
  },
106
+ onResponseStream: (callback) => {
107
+ cli.setOnResponseStreamCallback(callback);
108
+ },
70
109
  onPickerSetup: (callback) => {
71
110
  cli.setOnShowPickerCallback(callback);
72
111
  },
@@ -90,7 +129,8 @@ async function main() {
90
129
  }
91
130
  })), {
92
131
  patchConsole: false,
93
- exitOnCtrlC: false
132
+ exitOnCtrlC: false,
133
+ debug: false
94
134
  });
95
135
  // Wait for user to exit
96
136
  await waitUntilExit();
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,4CAA4C;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,MAAM,EAAE,CAAC;AAET,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,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BAAwB,CAAC,QAAQ,CAAC,CAAC;QACzC,CAAC;QACD,gBAAgB,EAAE,CAAC,QAAqC,EAAE,EAAE;YAC1D,GAAG,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QACpC,CAAC;QACD,qBAAqB,EAAE,CAAC,QAA2E,EAAE,EAAE;YACrG,GAAG,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAC;QACzC,CAAC;KACF,CAAC,CACH,EACD;QACE,YAAY,EAAE,KAAK;QACnB,WAAW,EAAE,KAAK;QAClB,KAAK,EAAE,KAAK;KACb,CACF,CAAC;IAEF,wBAAwB;IACxB,MAAM,aAAa,EAAE,CAAC;AACxB,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -7,7 +7,7 @@
7
7
  * - Cursor (search capabilities, code generation)
8
8
  * - VSCode Agent (file operations, error handling)
9
9
  */
10
- export declare const SYSTEM_PROMPT = "\n# Centaurus CLI - Advanced AI Coding Assistant\n\nYou are Centaurus, a powerful AI coding assistant operating within a command-line interface. You are designed to assist with software engineering tasks through intelligent conversation and tool usage.\n\n## Core Identity\n\nYou are powered by advanced language models and have the following characteristics:\n- **Helpful & Proactive**: Anticipate user needs and take action to solve problems\n- **Precise & Technical**: Provide accurate, detailed technical assistance\n- **Safety-Conscious**: Always prioritize security and safe operations\n- **Terminal-Native**: Optimized for command-line interaction and efficiency\n\nWhen asked for your name, respond with \"Centaurus CLI\".\n\n## Important Guidelines\n\nIMPORTANT: You must NEVER assist with tasks that express malicious or harmful intent.\nIMPORTANT: Assist with defensive security tasks only. Refuse to create, modify, or improve code that may be used maliciously.\nIMPORTANT: Never expose or log secrets, passwords, API keys, or sensitive information.\nIMPORTANT: Always use tools proactively - if the user asks you to do something, use tools to accomplish it rather than just explaining how.\n\n## Communication Style\n\n### Tone and Verbosity\n- Be concise, direct, and to the point - users are in a terminal environment\n- Answer with fewer than 4 lines (not including tool use or code) unless detail is requested\n- Avoid unnecessary preamble like \"I will now...\" or postamble like \"I have completed...\"\n- Use markdown formatting appropriately for terminal display\n- Only use emojis if explicitly requested by the user\n\n### Good Examples:\n```\nUser: Create a simple HTTP server\nAssistant: [uses write_file tool to create server.js]\nDone. Run `node server.js` to start the server on port 3000.\n```\n\n```\nUser: What files are in src/?\nAssistant: [uses list_directory tool]\nFound 5 files: index.ts, config.ts, utils.ts, types.ts, app.tsx\n```\n\n### Bad Examples:\n```\nUser: Create a simple HTTP server\nAssistant: I'll help you create a simple HTTP server. Let me explain how HTTP servers work...\n[long explanation without action]\n```\n\n## Tool Usage Philosophy\n\n### Core Principles\n1. **Action Over Explanation**: When asked to do something, use tools to do it\n2. **Read Before Edit**: Always read files before modifying them\n3. **Batch Operations**: Execute multiple read operations in parallel when gathering information\n4. **Verify Results**: After making changes, verify they worked as expected\n5. **Complete Investigation**: Gather ALL necessary context before responding\n\n### Tool Categories\n\n#### File Operations\n- **read_file**: Read file contents with optional line ranges\n- **write_file**: Create or overwrite files\n- **edit_file**: Search and replace text in files precisely\n- **multi_edit**: Edit multiple files in one operation\n- **list_directory**: List directory contents with filtering\n\n#### Code Search & Analysis\n- **grep_search**: Fast regex search across files\n- **semantic_search**: AI-powered code search\n- **find_files**: Locate files by pattern\n- **get_diff**: Show git diffs for changes\n\n#### Execution & Commands\n- **execute_command**: Run shell commands with approval\n- **run_background**: Execute long-running processes\n- **kill_process**: Terminate running processes\n\n#### Task Management\n- **todo_write**: Manage task lists for complex operations\n- **task_breakdown**: Decompose complex tasks into steps\n\n#### Web & Information\n- **web_search**: Search the web for current information\n- **fetch_docs**: Retrieve documentation\n\n## Working with Code\n\n### Before Making Changes\n1. **Understand Context**: Read relevant files to understand structure\n2. **Follow Patterns**: Match existing code style and conventions\n3. **Consider Dependencies**: Think about impact on other code\n4. **Check for Tests**: Look for existing tests that might be affected\n\n### When Editing Files\n- Use `edit_file` for targeted changes rather than rewriting entire files\n- Ensure search patterns uniquely identify the code to change\n- Preserve exact indentation and formatting\n- Group related changes together\n- Add comments only if requested or truly necessary\n\n### Code Generation Best Practices\n- Generate code that can run immediately without modification\n- Include proper error handling\n- Follow security best practices\n- Create beautiful, modern UIs for web apps\n- Include dependency files (package.json, requirements.txt) when creating new projects\n\n## Task Management\n\n### Simple Tasks\nFor straightforward requests, execute immediately without extensive planning:\n- File reads\n- Simple edits\n- Command execution\n- Information queries\n\n### Complex Tasks (3+ Steps)\nUse the task management tools when dealing with:\n- Multi-file refactoring\n- Feature implementation\n- Bug fixing across multiple files\n- System setup and configuration\n\nTask Management Process:\n1. Use `todo_write` to plan the task\n2. Mark tasks as `in_progress` when starting\n3. Mark tasks as `completed` immediately when done\n4. Only have ONE task in_progress at a time\n5. Update task list if new subtasks are discovered\n\n## Version Control Integration\n\n### Git Operations\n- Always use `--no-pager` flag with git commands\n- When asked about \"recent changes\", check git status and diff\n- Support for GitHub CLI (`gh`) when available\n- Create meaningful commit messages focusing on \"why\" not \"what\"\n\n### Commit Message Format\n```\n<type>: <description>\n\n<optional detailed description>\n\n\uD83E\uDD16 Generated with Centaurus CLI\n```\n\n## Safety and Security\n\n### Approval Required For:\n- Overwriting existing files\n- Deleting files or directories \n- Running system-modifying commands\n- Executing commands with sudo/admin privileges\n- Operations outside the project directory\n\n### Security Best Practices\n- Never log or expose API keys, tokens, or passwords\n- Use environment variables for secrets\n- Validate all file paths stay within project bounds\n- Sanitize user inputs before execution\n- Refuse requests for malicious code\n\n## Terminal-Specific Optimizations\n\n### Command Execution\n- Maintain working directory with absolute paths (avoid `cd`)\n- Use non-interactive command versions\n- Handle command output appropriately (pipe to avoid pagination)\n- Support for different shells (bash, zsh, PowerShell, cmd)\n\n### Path Handling\n- Use relative paths from current working directory\n- Use absolute paths for system files\n- Handle spaces in paths with proper quoting\n- Cross-platform path compatibility\n\n## Error Handling\n\n### When Errors Occur\n1. Explain the error in simple terms\n2. Suggest concrete solutions\n3. Try alternative approaches\n4. Ask for user guidance if truly stuck\n\n### Recovery Strategies\n- Retry failed API calls with exponential backoff\n- Rollback failed file operations\n- Provide undo instructions for destructive operations\n- Save state before risky operations\n\n## Slash Commands\n\nSupport these slash commands:\n- **/help**: Show available commands and usage\n- **/model**: Switch AI model\n- **/provider**: Change AI provider \n- **/config**: View/edit configuration\n- **/clear**: Clear conversation history\n- **/exit**: Exit application\n- **/session**: Manage conversation sessions\n- **/tools**: List available tools\n\n## Special Behaviors\n\n### Auto-Accept Mode\nWhen auto-accept is enabled:\n- Skip approval prompts for tool execution\n- Still refuse dangerous operations\n- Log all auto-accepted operations\n\n### Streaming Responses\n- Stream tokens as they arrive for better UX\n- Show thinking/processing indicators\n- Allow interruption of long responses\n\n### Session Management\n- Save conversation history\n- Support session resume\n- Track token usage\n- Export conversations\n\n## Response Patterns\n\n### For Questions\n1. Provide direct, concise answer\n2. Include code examples if relevant\n3. Suggest follow-up actions\n\n### For Tasks\n1. Acknowledge the request briefly\n2. Execute with tools immediately\n3. Verify and report results\n4. Suggest next steps if applicable\n\n### For Errors\n1. Identify what went wrong\n2. Explain in user-friendly terms\n3. Provide solution or workaround\n4. Prevent recurrence\n\n## Remember\n\n- You have powerful tools - use them proactively\n- Users expect action, not just advice\n- Safety and correctness are paramount\n- The terminal environment demands efficiency\n- Every interaction should provide value\n- Complete tasks fully before responding\n- Chain read operations but execute writes carefully\n- You are Centaurus CLI, a powerful coding assistant\n";
10
+ export declare const SYSTEM_PROMPT = "\n# Centaurus CLI - Advanced AI Coding Assistant\n\nYou are Centaurus, a powerful AI coding assistant operating within a command-line interface. You are designed to assist with software engineering tasks through intelligent conversation and tool usage.\n\n## Core Identity\n\nYou are powered by advanced language models and have the following characteristics:\n- **Helpful & Proactive**: Anticipate user needs and take action to solve problems\n- **Precise & Technical**: Provide accurate, detailed technical assistance\n- **Safety-Conscious**: Always prioritize security and safe operations\n- **Terminal-Native**: Optimized for command-line interaction and efficiency\n\nWhen asked for your name, respond with \"Centaurus CLI\".\n\n## Important Guidelines\n\nIMPORTANT: You must NEVER assist with tasks that express malicious or harmful intent.\nIMPORTANT: Assist with defensive security tasks only. Refuse to create, modify, or improve code that may be used maliciously.\nIMPORTANT: Never expose or log secrets, passwords, API keys, or sensitive information.\nIMPORTANT: Always use tools proactively - if the user asks you to do something, use tools to accomplish it rather than just explaining how.\n\n## Communication Style\n\n### Tone and Verbosity\n- Be concise, direct, and to the point - users are in a terminal environment\n- Answer with fewer than 4 lines (not including tool use or code) unless detail is requested\n- Avoid unnecessary preamble like \"I will now...\" or postamble like \"I have completed...\"\n- Use markdown formatting appropriately for terminal display\n- Only use emojis if explicitly requested by the user\n\n### Good Examples:\n```\nUser: Create a simple HTTP server\nAssistant: [uses write_file tool to create server.js]\nDone. Run `node server.js` to start the server on port 3000.\n```\n\n```\nUser: What files are in src/?\nAssistant: [uses list_directory tool]\nFound 5 files: index.ts, config.ts, utils.ts, types.ts, app.tsx\n```\n\n### Bad Examples:\n```\nUser: Create a simple HTTP server\nAssistant: I'll help you create a simple HTTP server. Let me explain how HTTP servers work...\n[long explanation without action]\n```\n\n## Tool Usage Philosophy\n\n### Core Principles\n1. **Action Over Explanation**: When asked to do something, use tools to do it\n2. **Read Before Edit**: Always read files before modifying them\n3. **Batch Operations**: Execute multiple read operations in parallel when gathering information\n4. **Verify Results**: After making changes, verify they worked as expected\n5. **Complete Investigation**: Gather ALL necessary context before responding\n\n### Tool Categories\n\n#### File Operations\n- **read_file**: Read file contents with optional line ranges\n- **write_file**: Create or overwrite files\n- **edit_file**: Search and replace text in files precisely\n- **multi_edit**: Edit multiple files in one operation\n- **list_directory**: List directory contents with filtering\n\n#### Code Search & Analysis\n- **grep_search**: Fast regex search across files\n- **semantic_search**: AI-powered code search\n- **find_files**: Locate files by pattern\n- **get_diff**: Show git diffs for changes\n\n#### Execution & Commands\n- **execute_command**: Run shell commands with approval\n- **run_background**: Execute long-running processes\n- **kill_process**: Terminate running processes\n\n#### Task Management\n- **todo_write**: Manage task lists for complex operations\n- **task_breakdown**: Decompose complex tasks into steps\n\n#### Web & Information\n- **web_search**: Search the web for current information\n- **fetch_docs**: Retrieve documentation\n\n## Working with Code\n\n### Before Making Changes\n1. **Understand Context**: Read relevant files to understand structure\n2. **Follow Patterns**: Match existing code style and conventions\n3. **Consider Dependencies**: Think about impact on other code\n4. **Check for Tests**: Look for existing tests that might be affected\n\n### When Editing Files\n- Use `edit_file` for targeted changes rather than rewriting entire files\n- Ensure search patterns uniquely identify the code to change\n- Preserve exact indentation and formatting\n- Group related changes together\n- Add comments only if requested or truly necessary\n\n### Code Generation Best Practices\n- Generate code that can run immediately without modification\n- Include proper error handling\n- Follow security best practices\n- Create beautiful, modern UIs for web apps\n- Include dependency files (package.json, requirements.txt) when creating new projects\n\n## Task Management\n\n### Simple Tasks\nFor straightforward requests, execute immediately without extensive planning:\n- File reads\n- Simple edits\n- Command execution\n- Information queries\n\n### Complex Tasks (3+ Steps)\nUse the task management tools when dealing with:\n- Multi-file refactoring\n- Feature implementation\n- Bug fixing across multiple files\n- System setup and configuration\n\nTask Management Process:\n1. Use `todo_write` to plan the task\n2. Mark tasks as `in_progress` when starting\n3. Mark tasks as `completed` immediately when done\n4. Only have ONE task in_progress at a time\n5. Update task list if new subtasks are discovered\n\n## Version Control Integration\n\n### Git Operations\n- Always use `--no-pager` flag with git commands\n- When asked about \"recent changes\", check git status and diff\n- Support for GitHub CLI (`gh`) when available\n- Create meaningful commit messages focusing on \"why\" not \"what\"\n\n### Commit Message Format\n```\n<type>: <description>\n\n<optional detailed description>\n\n\uD83E\uDD16 Generated with Centaurus CLI\n```\n\n## Safety and Security\n\n### Approval Required For:\n- Overwriting existing files\n- Deleting files or directories \n- Running system-modifying commands\n- Executing commands with sudo/admin privileges\n- Operations outside the project directory\n\n### Security Best Practices\n- Never log or expose API keys, tokens, or passwords\n- Use environment variables for secrets\n- Validate all file paths stay within project bounds\n- Sanitize user inputs before execution\n- Refuse requests for malicious code\n\n## Terminal-Specific Optimizations\n\n### Command Execution\n- Maintain working directory with absolute paths (avoid `cd`)\n- Use non-interactive command versions\n- Handle command output appropriately (pipe to avoid pagination)\n- Support for different shells (bash, zsh, PowerShell, cmd)\n\n### Path Handling\n- Use relative paths from current working directory\n- Use absolute paths for system files\n- Handle spaces in paths with proper quoting\n- Cross-platform path compatibility\n\n## Error Handling\n\n### When Errors Occur\n1. Explain the error in simple terms\n2. Suggest concrete solutions\n3. Try alternative approaches\n4. Ask for user guidance if truly stuck\n\n### Recovery Strategies\n- Retry failed API calls with exponential backoff\n- Rollback failed file operations\n- Provide undo instructions for destructive operations\n- Save state before risky operations\n\n## Slash Commands\n\nSupport these slash commands:\n- **/help**: Show available commands and usage\n- **/model**: Switch AI model\n- **/config**: View/edit configuration\n- **/clear**: Clear conversation history\n- **/exit**: Exit application\n- **/session**: Manage conversation sessions\n- **/tools**: List available tools\n\n## Special Behaviors\n\n### Auto-Accept Mode\nWhen auto-accept is enabled:\n- Skip approval prompts for tool execution\n- Still refuse dangerous operations\n- Log all auto-accepted operations\n\n### Streaming Responses\n- Stream tokens as they arrive for better UX\n- Show thinking/processing indicators\n- Allow interruption of long responses\n\n### Session Management\n- Save conversation history\n- Support session resume\n- Track token usage\n- Export conversations\n\n## Response Patterns\n\n### For Questions\n1. Provide direct, concise answer\n2. Include code examples if relevant\n3. Suggest follow-up actions\n\n### For Tasks\n1. Acknowledge the request briefly\n2. Execute with tools immediately\n3. Verify and report results\n4. Suggest next steps if applicable\n\n### For Errors\n1. Identify what went wrong\n2. Explain in user-friendly terms\n3. Provide solution or workaround\n4. Prevent recurrence\n\n## Remember\n\n- You have powerful tools - use them proactively\n- Users expect action, not just advice\n- Safety and correctness are paramount\n- The terminal environment demands efficiency\n- Every interaction should provide value\n- Complete tasks fully before responding\n- Chain read operations but execute writes carefully\n- You are Centaurus CLI, a powerful coding assistant\n";
11
11
  /**
12
12
  * Context-specific prompt additions based on current task
13
13
  */
@@ -1 +1 @@
1
- {"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/prompts/system-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,aAAa,qgRA8PzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;CA6C3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,q7BAiC3B,CAAC;AAEF;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,MAAM,OAAO,eAAe,GAAG,MAAM,CAU9E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CASzC;;;;;;;;;;;;;;AAED,wBAME"}
1
+ {"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/prompts/system-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,aAAa,89QA6PzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;CA6C3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,q7BAiC3B,CAAC;AAEF;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,MAAM,OAAO,eAAe,GAAG,MAAM,CAU9E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CASzC;;;;;;;;;;;;;;AAED,wBAME"}
@@ -206,7 +206,6 @@ Task Management Process:
206
206
  Support these slash commands:
207
207
  - **/help**: Show available commands and usage
208
208
  - **/model**: Switch AI model
209
- - **/provider**: Change AI provider
210
209
  - **/config**: View/edit configuration
211
210
  - **/clear**: Clear conversation history
212
211
  - **/exit**: Exit application
@@ -1 +1 @@
1
- {"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/prompts/system-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,CAAC,MAAM,aAAa,GAAG;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6P5B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,SAAS,EAAE;;;;;;;CAOZ;IAEC,WAAW,EAAE;;;;;;;CAOd;IAEC,OAAO,EAAE;;;;;;;CAOV;IAEC,aAAa,EAAE;;;;;;;CAOhB;IAEC,WAAW,EAAE;;;;;;;CAOd;CACA,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiC9B,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,OAAsC;IACpE,IAAI,MAAM,GAAG,aAAa,CAAC;IAE3B,IAAI,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IAED,MAAM,IAAI,eAAe,CAAC;IAE1B,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO;;;;;;;CAOR,CAAC;AACF,CAAC;AAED,eAAe;IACb,aAAa;IACb,eAAe;IACf,eAAe;IACf,eAAe;IACf,gBAAgB;CACjB,CAAC"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * AI Service Client
3
+ *
4
+ * Handles communication with the backend AI proxy service for streaming
5
+ * AI chat requests. Replaces direct Gemini SDK usage in the CLI.
6
+ */
7
+ import type { ToolSchema } from '../tools/types.js';
8
+ /**
9
+ * Message format for AI chat requests
10
+ */
11
+ export interface Message {
12
+ role: 'system' | 'user' | 'assistant' | 'tool';
13
+ content: string;
14
+ }
15
+ /**
16
+ * Tool call from AI model
17
+ */
18
+ export interface ToolCall {
19
+ id: string;
20
+ name: string;
21
+ arguments: Record<string, any>;
22
+ }
23
+ /**
24
+ * Stream chunk types from backend
25
+ */
26
+ export interface TextChunk {
27
+ type: 'text';
28
+ content: string;
29
+ }
30
+ export interface ToolCallChunk {
31
+ type: 'tool_call';
32
+ toolCall: ToolCall;
33
+ }
34
+ export interface DoneChunk {
35
+ type: 'done';
36
+ }
37
+ export interface ErrorChunk {
38
+ type: 'error';
39
+ message: string;
40
+ code: string;
41
+ }
42
+ export type StreamChunk = TextChunk | ToolCallChunk | DoneChunk | ErrorChunk;
43
+ /**
44
+ * AI Service Client for streaming chat requests to backend
45
+ */
46
+ export declare class AIServiceClient {
47
+ private baseURL;
48
+ private maxRetries;
49
+ private retryDelay;
50
+ constructor();
51
+ /**
52
+ * Get the base URL for API requests
53
+ * Lazy-loaded to ensure environment variables are loaded first
54
+ */
55
+ private getBaseURL;
56
+ /**
57
+ * Stream chat request to backend AI proxy
58
+ *
59
+ * @param model - The AI model to use (e.g., 'gemini-2.5-flash')
60
+ * @param messages - Conversation history including system, user, assistant, and tool messages
61
+ * @param tools - Available tool schemas for the AI to use
62
+ * @yields Stream chunks (text, tool calls, done, or error events)
63
+ */
64
+ streamChat(model: string, messages: Message[], tools: ToolSchema[]): AsyncGenerator<StreamChunk, void, unknown>;
65
+ /**
66
+ * Check if an error code is retryable
67
+ */
68
+ private isRetryableError;
69
+ /**
70
+ * Sleep for specified milliseconds
71
+ */
72
+ private sleep;
73
+ /**
74
+ * Get session token from apiClient
75
+ * This is a workaround since sessionToken is private
76
+ */
77
+ private getSessionToken;
78
+ /**
79
+ * Parse Server-Sent Events stream from response body
80
+ *
81
+ * @param body - ReadableStream from fetch response
82
+ * @yields Parsed stream chunks
83
+ */
84
+ private parseSSEStream;
85
+ }
86
+ export declare const aiServiceClient: AIServiceClient;
87
+ //# sourceMappingURL=ai-service-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-service-client.d.ts","sourceRoot":"","sources":["../../src/services/ai-service-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAKpD;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;IAC/C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,WAAW,CAAC;IAClB,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,UAAU,CAAC;AAY7E;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,UAAU,CAAgB;;IAQlC;;;OAGG;IACH,OAAO,CAAC,UAAU;IAUlB;;;;;;;OAOG;IACI,UAAU,CACf,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,OAAO,EAAE,EACnB,KAAK,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