@vfarcic/dot-ai 1.2.4 → 1.4.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 (74) hide show
  1. package/dist/core/artifacthub.d.ts.map +1 -1
  2. package/dist/core/artifacthub.js +16 -10
  3. package/dist/core/base-vector-service.d.ts.map +1 -1
  4. package/dist/core/base-vector-service.js +19 -10
  5. package/dist/core/capabilities.d.ts.map +1 -1
  6. package/dist/core/capabilities.js +17 -11
  7. package/dist/core/capability-operations.d.ts.map +1 -1
  8. package/dist/core/capability-operations.js +118 -98
  9. package/dist/core/crd-availability.d.ts.map +1 -1
  10. package/dist/core/crd-availability.js +2 -2
  11. package/dist/core/deploy-operation.d.ts.map +1 -1
  12. package/dist/core/deploy-operation.js +9 -6
  13. package/dist/core/discovery.d.ts.map +1 -1
  14. package/dist/core/discovery.js +157 -56
  15. package/dist/core/embedding-service.d.ts +1 -1
  16. package/dist/core/embedding-service.d.ts.map +1 -1
  17. package/dist/core/embedding-service.js +76 -43
  18. package/dist/core/model-config.d.ts +3 -3
  19. package/dist/core/model-config.js +3 -3
  20. package/dist/core/packaging.d.ts.map +1 -1
  21. package/dist/core/packaging.js +11 -10
  22. package/dist/core/platform-utils.d.ts.map +1 -1
  23. package/dist/core/platform-utils.js +6 -2
  24. package/dist/core/plugin-manager.d.ts.map +1 -1
  25. package/dist/core/plugin-manager.js +26 -20
  26. package/dist/core/policy-operations.d.ts.map +1 -1
  27. package/dist/core/policy-operations.js +111 -65
  28. package/dist/core/providers/host-provider.d.ts.map +1 -1
  29. package/dist/core/providers/host-provider.js +12 -5
  30. package/dist/core/providers/vercel-provider.d.ts.map +1 -1
  31. package/dist/core/providers/vercel-provider.js +4 -2
  32. package/dist/core/schema.d.ts.map +1 -1
  33. package/dist/core/schema.js +173 -95
  34. package/dist/core/session-utils.d.ts.map +1 -1
  35. package/dist/core/session-utils.js +3 -3
  36. package/dist/core/user-prompts-loader.d.ts.map +1 -1
  37. package/dist/core/user-prompts-loader.js +2 -4
  38. package/dist/evaluation/datasets/loader.d.ts.map +1 -1
  39. package/dist/evaluation/datasets/loader.js +7 -3
  40. package/dist/interfaces/embedding-migration-handler.d.ts +16 -0
  41. package/dist/interfaces/embedding-migration-handler.d.ts.map +1 -0
  42. package/dist/interfaces/embedding-migration-handler.js +296 -0
  43. package/dist/interfaces/rest-api.d.ts +8 -0
  44. package/dist/interfaces/rest-api.d.ts.map +1 -1
  45. package/dist/interfaces/rest-api.js +294 -132
  46. package/dist/interfaces/rest-route-registry.js +3 -3
  47. package/dist/interfaces/routes/index.d.ts.map +1 -1
  48. package/dist/interfaces/routes/index.js +72 -12
  49. package/dist/interfaces/schemas/common.d.ts +2 -0
  50. package/dist/interfaces/schemas/common.d.ts.map +1 -1
  51. package/dist/interfaces/schemas/common.js +2 -0
  52. package/dist/interfaces/schemas/embeddings.d.ts +138 -0
  53. package/dist/interfaces/schemas/embeddings.d.ts.map +1 -0
  54. package/dist/interfaces/schemas/embeddings.js +79 -0
  55. package/dist/interfaces/schemas/index.d.ts +2 -1
  56. package/dist/interfaces/schemas/index.d.ts.map +1 -1
  57. package/dist/interfaces/schemas/index.js +14 -2
  58. package/dist/interfaces/schemas/prompts.d.ts +37 -0
  59. package/dist/interfaces/schemas/prompts.d.ts.map +1 -1
  60. package/dist/interfaces/schemas/prompts.js +18 -1
  61. package/dist/tools/answer-question.d.ts.map +1 -1
  62. package/dist/tools/answer-question.js +109 -81
  63. package/dist/tools/generate-manifests.d.ts.map +1 -1
  64. package/dist/tools/generate-manifests.js +163 -103
  65. package/dist/tools/operate-analysis.d.ts.map +1 -1
  66. package/dist/tools/operate-analysis.js +35 -18
  67. package/dist/tools/operate.d.ts.map +1 -1
  68. package/dist/tools/operate.js +47 -17
  69. package/dist/tools/prompts.d.ts.map +1 -1
  70. package/dist/tools/prompts.js +1 -1
  71. package/dist/tools/remediate.d.ts.map +1 -1
  72. package/dist/tools/remediate.js +205 -116
  73. package/package.json +6 -6
  74. package/prompts/remediate-system.md +1 -1
@@ -21,12 +21,16 @@ const tracing_1 = require("./tracing");
21
21
  const embeddingCircuitBreaker = new circuit_breaker_1.CircuitBreaker('embedding-api', {
22
22
  failureThreshold: 3, // Open after 3 consecutive failures
23
23
  cooldownPeriodMs: 30000, // 30s cooldown before half-open
24
- halfOpenMaxAttempts: 1 // Allow 1 test request in half-open
24
+ halfOpenMaxAttempts: 1, // Allow 1 test request in half-open
25
25
  });
26
26
  /**
27
27
  * Supported embedding providers - single source of truth
28
28
  */
29
- exports.EMBEDDING_PROVIDERS = ['openai', 'google', 'amazon_bedrock'];
29
+ exports.EMBEDDING_PROVIDERS = [
30
+ 'openai',
31
+ 'google',
32
+ 'amazon_bedrock',
33
+ ];
30
34
  /**
31
35
  * Unified Vercel AI SDK Embedding Provider
32
36
  * Supports OpenAI, Google, and Amazon Bedrock through Vercel AI SDK
@@ -43,20 +47,39 @@ class VercelEmbeddingProvider {
43
47
  this.available = false;
44
48
  // Get API key based on provider
45
49
  switch (this.providerType) {
46
- case 'openai':
47
- this.apiKey = config.apiKey || process.env.CUSTOM_EMBEDDINGS_API_KEY || process.env.OPENAI_API_KEY || '';
48
- this.model = config.model || process.env.EMBEDDINGS_MODEL || 'text-embedding-3-small';
49
- this.dimensions = config.dimensions || (process.env.EMBEDDINGS_DIMENSIONS ? parseInt(process.env.EMBEDDINGS_DIMENSIONS, 10) : 1536);
50
+ case 'openai': {
51
+ this.apiKey =
52
+ config.apiKey ||
53
+ process.env.CUSTOM_EMBEDDINGS_API_KEY ||
54
+ process.env.OPENAI_API_KEY ||
55
+ '';
56
+ this.model =
57
+ config.model ||
58
+ process.env.EMBEDDINGS_MODEL ||
59
+ 'text-embedding-3-small';
60
+ const envDimensions = process.env.EMBEDDINGS_DIMENSIONS
61
+ ? parseInt(process.env.EMBEDDINGS_DIMENSIONS, 10)
62
+ : undefined;
63
+ this.dimensions =
64
+ config.dimensions ||
65
+ (Number.isFinite(envDimensions) ? envDimensions : 1536);
50
66
  break;
67
+ }
51
68
  case 'google':
52
69
  this.apiKey = config.apiKey || process.env.GOOGLE_API_KEY || '';
53
- this.model = config.model || process.env.EMBEDDINGS_MODEL || 'gemini-embedding-001';
70
+ this.model =
71
+ config.model ||
72
+ process.env.EMBEDDINGS_MODEL ||
73
+ 'gemini-embedding-001';
54
74
  this.dimensions = config.dimensions || 768;
55
75
  break;
56
76
  case 'amazon_bedrock':
57
77
  // AWS SDK handles credentials automatically - no API key needed
58
78
  this.apiKey = 'bedrock-uses-aws-credentials';
59
- this.model = config.model || process.env.EMBEDDINGS_MODEL || 'amazon.titan-embed-text-v2:0';
79
+ this.model =
80
+ config.model ||
81
+ process.env.EMBEDDINGS_MODEL ||
82
+ 'amazon.titan-embed-text-v2:0';
60
83
  this.dimensions = config.dimensions || 1024; // Titan v2 default
61
84
  break;
62
85
  }
@@ -71,7 +94,7 @@ class VercelEmbeddingProvider {
71
94
  const baseURL = process.env.CUSTOM_EMBEDDINGS_BASE_URL;
72
95
  const openai = (0, openai_1.createOpenAI)({
73
96
  apiKey: this.apiKey,
74
- ...(baseURL && { baseURL })
97
+ ...(baseURL && { baseURL }),
75
98
  });
76
99
  this.modelInstance = openai.textEmbedding(this.model);
77
100
  break;
@@ -110,22 +133,22 @@ class VercelEmbeddingProvider {
110
133
  return await (0, tracing_1.withAITracing)({
111
134
  provider: this.providerType,
112
135
  model: this.model,
113
- operation: 'embeddings'
136
+ operation: 'embeddings',
114
137
  }, async () => {
115
138
  try {
116
139
  // Execute through circuit breaker to prevent cascading failures
117
140
  return await embeddingCircuitBreaker.execute(async () => {
118
141
  const embedOptions = {
119
142
  model: this.modelInstance,
120
- value: text.trim()
143
+ value: text.trim(),
121
144
  };
122
145
  // Add Google-specific options
123
146
  if (this.providerType === 'google') {
124
147
  embedOptions.providerOptions = {
125
148
  google: {
126
149
  outputDimensionality: this.dimensions,
127
- taskType: 'SEMANTIC_SIMILARITY'
128
- }
150
+ taskType: 'SEMANTIC_SIMILARITY',
151
+ },
129
152
  };
130
153
  }
131
154
  const result = await (0, ai_1.embed)(embedOptions);
@@ -135,16 +158,18 @@ class VercelEmbeddingProvider {
135
158
  catch (error) {
136
159
  // Convert CircuitOpenError to descriptive message
137
160
  if (error instanceof circuit_breaker_1.CircuitOpenError) {
138
- throw new Error(`Embedding API circuit open: ${error.message}`);
161
+ throw new Error(`Embedding API circuit open: ${error.message}`, {
162
+ cause: error,
163
+ });
139
164
  }
140
165
  if (error instanceof Error) {
141
- throw new Error(`${this.providerType} embedding failed: ${error.message}`);
166
+ throw new Error(`${this.providerType} embedding failed: ${error.message}`, { cause: error });
142
167
  }
143
- throw new Error(`${this.providerType} embedding failed: ${String(error)}`);
168
+ throw new Error(`${this.providerType} embedding failed: ${String(error)}`, { cause: error });
144
169
  }
145
- }, (embedding) => ({
170
+ }, embedding => ({
146
171
  embeddingCount: 1,
147
- embeddingDimensions: embedding.length
172
+ embeddingDimensions: embedding.length,
148
173
  }));
149
174
  }
150
175
  async generateEmbeddings(texts) {
@@ -154,9 +179,7 @@ class VercelEmbeddingProvider {
154
179
  if (!texts || texts.length === 0) {
155
180
  return [];
156
181
  }
157
- const validTexts = texts
158
- .map(t => t?.trim())
159
- .filter(t => t && t.length > 0);
182
+ const validTexts = texts.map(t => t?.trim()).filter(t => t && t.length > 0);
160
183
  if (validTexts.length === 0) {
161
184
  return [];
162
185
  }
@@ -164,7 +187,7 @@ class VercelEmbeddingProvider {
164
187
  return await (0, tracing_1.withAITracing)({
165
188
  provider: this.providerType,
166
189
  model: this.model,
167
- operation: 'embeddings'
190
+ operation: 'embeddings',
168
191
  }, async () => {
169
192
  try {
170
193
  // Execute through circuit breaker to prevent cascading failures
@@ -172,15 +195,15 @@ class VercelEmbeddingProvider {
172
195
  const results = await Promise.all(validTexts.map(text => {
173
196
  const embedOptions = {
174
197
  model: this.modelInstance,
175
- value: text
198
+ value: text,
176
199
  };
177
200
  // Add Google-specific options
178
201
  if (this.providerType === 'google') {
179
202
  embedOptions.providerOptions = {
180
203
  google: {
181
204
  outputDimensionality: this.dimensions,
182
- taskType: 'SEMANTIC_SIMILARITY'
183
- }
205
+ taskType: 'SEMANTIC_SIMILARITY',
206
+ },
184
207
  };
185
208
  }
186
209
  return (0, ai_1.embed)(embedOptions);
@@ -191,16 +214,18 @@ class VercelEmbeddingProvider {
191
214
  catch (error) {
192
215
  // Convert CircuitOpenError to descriptive message
193
216
  if (error instanceof circuit_breaker_1.CircuitOpenError) {
194
- throw new Error(`Embedding API circuit open: ${error.message}`);
217
+ throw new Error(`Embedding API circuit open: ${error.message}`, {
218
+ cause: error,
219
+ });
195
220
  }
196
221
  if (error instanceof Error) {
197
- throw new Error(`${this.providerType} batch embedding failed: ${error.message}`);
222
+ throw new Error(`${this.providerType} batch embedding failed: ${error.message}`, { cause: error });
198
223
  }
199
- throw new Error(`${this.providerType} batch embedding failed: ${String(error)}`);
224
+ throw new Error(`${this.providerType} batch embedding failed: ${String(error)}`, { cause: error });
200
225
  }
201
- }, (embeddings) => ({
226
+ }, embeddings => ({
202
227
  embeddingCount: embeddings.length,
203
- embeddingDimensions: embeddings[0]?.length || this.dimensions
228
+ embeddingDimensions: embeddings[0]?.length || this.dimensions,
204
229
  }));
205
230
  }
206
231
  isAvailable() {
@@ -221,7 +246,9 @@ exports.VercelEmbeddingProvider = VercelEmbeddingProvider;
221
246
  * Factory function to create embedding provider based on configuration
222
247
  */
223
248
  function createEmbeddingProvider(config = {}) {
224
- const providerType = (config.provider || process.env.EMBEDDINGS_PROVIDER || 'openai').toLowerCase();
249
+ const providerType = (config.provider ||
250
+ process.env.EMBEDDINGS_PROVIDER ||
251
+ 'openai').toLowerCase();
225
252
  // Validate provider type using centralized list
226
253
  if (!exports.EMBEDDING_PROVIDERS.includes(providerType)) {
227
254
  console.warn(`Unknown embedding provider: ${providerType}, falling back to openai`);
@@ -230,7 +257,7 @@ function createEmbeddingProvider(config = {}) {
230
257
  try {
231
258
  const provider = new VercelEmbeddingProvider({
232
259
  ...config,
233
- provider: providerType
260
+ provider: providerType,
234
261
  });
235
262
  return provider.isAvailable() ? provider : null;
236
263
  }
@@ -262,7 +289,7 @@ class EmbeddingService {
262
289
  }
263
290
  catch (error) {
264
291
  // Throw error immediately - no silent fallback
265
- throw new Error(`Embedding generation failed: ${error instanceof Error ? error.message : String(error)}`);
292
+ throw new Error(`Embedding generation failed: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
266
293
  }
267
294
  }
268
295
  /**
@@ -300,25 +327,29 @@ class EmbeddingService {
300
327
  getStatus() {
301
328
  if (this.isAvailable()) {
302
329
  // Get provider type from VercelEmbeddingProvider
303
- const providerName = this.provider.getProviderType?.() || 'unknown';
330
+ const providerName = this.provider.getProviderType?.() ||
331
+ 'unknown';
332
+ const isCustomEndpoint = providerName === 'openai' && !!process.env.CUSTOM_EMBEDDINGS_BASE_URL;
304
333
  return {
305
334
  available: true,
306
- provider: providerName,
307
- model: this.provider.getModel(),
308
- dimensions: this.provider.getDimensions()
335
+ provider: isCustomEndpoint ? 'custom' : providerName,
336
+ model: isCustomEndpoint && !process.env.EMBEDDINGS_MODEL
337
+ ? 'custom'
338
+ : this.provider.getModel(),
339
+ dimensions: this.provider.getDimensions(),
309
340
  };
310
341
  }
311
342
  const requestedProvider = process.env.EMBEDDINGS_PROVIDER || 'openai';
312
343
  const keyMap = {
313
- 'openai': 'OPENAI_API_KEY',
314
- 'google': 'GOOGLE_API_KEY',
315
- 'amazon_bedrock': 'AWS credentials (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION)'
344
+ openai: 'OPENAI_API_KEY',
345
+ google: 'GOOGLE_API_KEY',
346
+ amazon_bedrock: 'AWS credentials (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION)',
316
347
  };
317
348
  const requiredKey = keyMap[requestedProvider] || 'OPENAI_API_KEY';
318
349
  return {
319
350
  available: false,
320
351
  provider: null,
321
- reason: `${requiredKey} not set - vector operations will fail`
352
+ reason: `${requiredKey} not set - vector operations will fail`,
322
353
  };
323
354
  }
324
355
  /**
@@ -330,8 +361,10 @@ class EmbeddingService {
330
361
  ...pattern.triggers,
331
362
  pattern.rationale,
332
363
  // Include resource types for better semantic matching
333
- ...pattern.suggestedResources.map(r => `kubernetes ${r.toLowerCase()}`)
334
- ].join(' ').trim();
364
+ ...pattern.suggestedResources.map(r => `kubernetes ${r.toLowerCase()}`),
365
+ ]
366
+ .join(' ')
367
+ .trim();
335
368
  }
336
369
  /**
337
370
  * Get circuit breaker statistics for monitoring
@@ -5,11 +5,11 @@
5
5
  * Update versions here to change them everywhere.
6
6
  */
7
7
  export declare const CURRENT_MODELS: {
8
- readonly anthropic: "claude-sonnet-4-5-20250929";
8
+ readonly anthropic: "claude-sonnet-4-6";
9
9
  readonly anthropic_opus: "claude-opus-4-6";
10
10
  readonly anthropic_haiku: "claude-haiku-4-5-20251001";
11
11
  readonly openai: "gpt-5.1-codex";
12
- readonly google: "gemini-3-pro-preview";
12
+ readonly google: "gemini-3.1-pro-preview";
13
13
  readonly google_flash: "gemini-3-flash-preview";
14
14
  readonly kimi: "kimi-k2-0905-preview";
15
15
  readonly kimi_thinking: "kimi-k2-thinking";
@@ -17,7 +17,7 @@ export declare const CURRENT_MODELS: {
17
17
  readonly host: "host";
18
18
  readonly openrouter: "anthropic/claude-haiku-4.5";
19
19
  readonly custom: "gpt-5.1-codex";
20
- readonly amazon_bedrock: "global.anthropic.claude-sonnet-4-20250514-v1:0";
20
+ readonly amazon_bedrock: "global.anthropic.claude-sonnet-4-6";
21
21
  };
22
22
  /**
23
23
  * Get current model for a provider
@@ -9,11 +9,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.CURRENT_MODELS = void 0;
10
10
  exports.getCurrentModel = getCurrentModel;
11
11
  exports.CURRENT_MODELS = {
12
- anthropic: 'claude-sonnet-4-5-20250929',
12
+ anthropic: 'claude-sonnet-4-6',
13
13
  anthropic_opus: 'claude-opus-4-6',
14
14
  anthropic_haiku: 'claude-haiku-4-5-20251001',
15
15
  openai: 'gpt-5.1-codex',
16
- google: 'gemini-3-pro-preview',
16
+ google: 'gemini-3.1-pro-preview',
17
17
  google_flash: 'gemini-3-flash-preview', // PRD #294: Gemini 3 Flash - faster/cheaper variant with same 1M context
18
18
  kimi: 'kimi-k2-0905-preview', // PRD #237: Moonshot AI Kimi K2 - standard model with 256K context
19
19
  kimi_thinking: 'kimi-k2-thinking', // PRD #237: Moonshot AI Kimi K2 - extended thinking variant
@@ -21,7 +21,7 @@ exports.CURRENT_MODELS = {
21
21
  host: 'host', // Delegates generation to the client via MCP Sampling
22
22
  openrouter: 'anthropic/claude-haiku-4.5', // PRD #194: OpenRouter default model (overridden by AI_MODEL env var)
23
23
  custom: 'gpt-5.1-codex', // PRD #194: Custom endpoint default model (overridden by AI_MODEL env var)
24
- amazon_bedrock: 'global.anthropic.claude-sonnet-4-20250514-v1:0' // PRD #175: Amazon Bedrock default model (overridden by AI_MODEL env var)
24
+ amazon_bedrock: 'global.anthropic.claude-sonnet-4-6' // PRD #175: Amazon Bedrock default model (overridden by AI_MODEL env var)
25
25
  };
26
26
  /**
27
27
  * Get current model for a provider
@@ -1 +1 @@
1
- {"version":3,"file":"packaging.d.ts","sourceRoot":"","sources":["../../src/core/packaging.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,MAAM,GAAG,WAAW,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,MAAM,EAAE,YAAY,CAAC;CACtB;AAED;;GAEG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,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,MAAM,EAAE,YAAY,CAAC;CACtB;AAED;;GAEG;AACH,UAAU,qBAAqB;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,UAAU,YAAY;IACpB,SAAS,CAAC,EAAE;QACV,QAAQ,CAAC,EAAE,kBAAkB,EAAE,CAAC;QAChC,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC;QAC7B,QAAQ,CAAC,EAAE,kBAAkB,EAAE,CAAC;QAChC,IAAI,CAAC,EAAE;YAAE,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KAC5B,CAAC;IACF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAiPD;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CACpC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,YAAY,EACtB,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,qBAAqB,EACpC,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,eAAe,CAAC,CAoE1B"}
@@ -155,14 +155,14 @@ function getFormatConfig(format) {
155
155
  outputFormat: 'Helm Chart',
156
156
  outputFormatDescription: 'a complete Helm chart structure',
157
157
  formatSpecificInstructions: HELM_FORMAT_INSTRUCTIONS,
158
- formatExample: HELM_FORMAT_EXAMPLE
158
+ formatExample: HELM_FORMAT_EXAMPLE,
159
159
  };
160
160
  case 'kustomize':
161
161
  return {
162
162
  outputFormat: 'Kustomize',
163
163
  outputFormatDescription: 'a Kustomize overlay structure',
164
164
  formatSpecificInstructions: KUSTOMIZE_FORMAT_INSTRUCTIONS,
165
- formatExample: KUSTOMIZE_FORMAT_EXAMPLE
165
+ formatExample: KUSTOMIZE_FORMAT_EXAMPLE,
166
166
  };
167
167
  default:
168
168
  throw new Error(`Unsupported format for packaging: ${format}`);
@@ -207,14 +207,15 @@ function parsePackagingResponse(response) {
207
207
  }
208
208
  catch (parseError) {
209
209
  const preview = jsonContent.slice(0, 200);
210
- throw new Error(`Failed to parse packaging response as JSON: ${parseError instanceof Error ? parseError.message : String(parseError)}. Content preview: ${preview}...`);
210
+ throw new Error(`Failed to parse packaging response as JSON: ${parseError instanceof Error ? parseError.message : String(parseError)}. Content preview: ${preview}...`, { cause: parseError });
211
211
  }
212
212
  if (!parsed.files || !Array.isArray(parsed.files)) {
213
213
  throw new Error('Invalid packaging response: missing files array');
214
214
  }
215
215
  // Validate each file entry
216
216
  for (const file of parsed.files) {
217
- if (typeof file.relativePath !== 'string' || typeof file.content !== 'string') {
217
+ if (typeof file.relativePath !== 'string' ||
218
+ typeof file.content !== 'string') {
218
219
  throw new Error('Invalid packaging response: each file must have relativePath and content strings');
219
220
  }
220
221
  }
@@ -238,14 +239,14 @@ async function packageManifests(rawManifests, solution, outputFormat, outputPath
238
239
  // Raw format - no packaging needed
239
240
  return {
240
241
  files: [{ relativePath: 'manifests.yaml', content: rawManifests }],
241
- format: 'raw'
242
+ format: 'raw',
242
243
  };
243
244
  }
244
245
  logger.info('Packaging manifests', {
245
246
  format: outputFormat,
246
247
  outputPath,
247
248
  isRetry: !!errorContext,
248
- attempt: errorContext?.attempt
249
+ attempt: errorContext?.attempt,
249
250
  });
250
251
  // Get format-specific configuration
251
252
  const formatConfig = getFormatConfig(outputFormat);
@@ -268,23 +269,23 @@ async function packageManifests(rawManifests, solution, outputFormat, outputPath
268
269
  format_specific_instructions: formatConfig.formatSpecificInstructions,
269
270
  format_example: formatConfig.formatExample,
270
271
  previous_attempt: previousAttempt,
271
- error_details: errorDetails
272
+ error_details: errorDetails,
272
273
  });
273
274
  // Call AI for packaging
274
275
  const aiProvider = dotAI.ai;
275
276
  const response = await aiProvider.sendMessage(prompt, `packaging-${outputFormat}`, {
276
277
  user_intent: solution.intent || 'Package Kubernetes manifests',
277
- interaction_id
278
+ interaction_id,
278
279
  });
279
280
  // Parse response
280
281
  const files = parsePackagingResponse(response.content);
281
282
  logger.info('Packaging completed', {
282
283
  format: outputFormat,
283
284
  fileCount: files.length,
284
- files: files.map(f => f.relativePath)
285
+ files: files.map(f => f.relativePath),
285
286
  });
286
287
  return {
287
288
  files,
288
- format: outputFormat
289
+ format: outputFormat,
289
290
  };
290
291
  }
@@ -1 +1 @@
1
- {"version":3,"file":"platform-utils.d.ts","sourceRoot":"","sources":["../../src/core/platform-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAIrC,eAAO,MAAM,SAAS,2BAAkB,CAAC;AAEzC;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAItC;AAGD;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAkCrE;AAED;;;GAGG;AACH,wBAAgB,oCAAoC,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAY/F;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,EAAE,CAkC5E"}
1
+ {"version":3,"file":"platform-utils.d.ts","sourceRoot":"","sources":["../../src/core/platform-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAIrC,eAAO,MAAM,SAAS,2BAAkB,CAAC;AAEzC;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAItC;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAsCrE;AAED;;;GAGG;AACH,wBAAgB,oCAAoC,CAClD,OAAO,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM,CAeR;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,EAAE,CAsC5E"}
@@ -91,7 +91,9 @@ function extractJsonFromAIResponse(aiResponse) {
91
91
  return JSON.parse(jsonContent.trim());
92
92
  }
93
93
  catch (error) {
94
- throw new Error(`Failed to parse JSON from AI response: ${error}`);
94
+ throw new Error(`Failed to parse JSON from AI response: ${error}`, {
95
+ cause: error,
96
+ });
95
97
  }
96
98
  }
97
99
  /**
@@ -145,6 +147,8 @@ function extractJsonArrayFromAIResponse(aiResponse) {
145
147
  return JSON.parse(jsonContent.trim());
146
148
  }
147
149
  catch (error) {
148
- throw new Error(`Failed to parse JSON array from AI response: ${error}`);
150
+ throw new Error(`Failed to parse JSON array from AI response: ${error}`, {
151
+ cause: error,
152
+ });
149
153
  }
150
154
  }
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-manager.d.ts","sourceRoot":"","sources":["../../src/core/plugin-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EACL,YAAY,EAEZ,gBAAgB,EAChB,cAAc,EACf,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAW/D;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;AAE1E;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;aAG3B,aAAa,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MA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,CAAC,eAAe;CAOxB"}
@@ -68,14 +68,14 @@ class PluginManager {
68
68
  content = (0, node_fs_1.readFileSync)(PLUGINS_CONFIG_PATH, 'utf-8');
69
69
  }
70
70
  catch (err) {
71
- throw new Error(`Failed to read plugin config at ${PLUGINS_CONFIG_PATH}: ${err instanceof Error ? err.message : String(err)}`);
71
+ throw new Error(`Failed to read plugin config at ${PLUGINS_CONFIG_PATH}: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
72
72
  }
73
73
  let parsed;
74
74
  try {
75
75
  parsed = JSON.parse(content);
76
76
  }
77
77
  catch (err) {
78
- throw new Error(`Invalid JSON in plugin config at ${PLUGINS_CONFIG_PATH}: ${err instanceof Error ? err.message : String(err)}`);
78
+ throw new Error(`Invalid JSON in plugin config at ${PLUGINS_CONFIG_PATH}: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
79
79
  }
80
80
  if (!Array.isArray(parsed)) {
81
81
  throw new Error(`Plugin config at ${PLUGINS_CONFIG_PATH} must be an array, got ${typeof parsed}`);
@@ -120,16 +120,19 @@ class PluginManager {
120
120
  }
121
121
  this.logger.info('Starting plugin discovery', {
122
122
  pluginCount: configs.length,
123
- plugins: configs.map((c) => c.name),
123
+ plugins: configs.map(c => c.name),
124
124
  });
125
- const results = await Promise.allSettled(configs.map((config) => this.discoverPluginQuick(config)));
125
+ const results = await Promise.allSettled(configs.map(config => this.discoverPluginQuick(config)));
126
126
  const failed = [];
127
127
  const requiredFailed = [];
128
128
  results.forEach((result, index) => {
129
129
  const config = configs[index];
130
- if (result.status === 'rejected' || (result.status === 'fulfilled' && !result.value)) {
130
+ if (result.status === 'rejected' ||
131
+ (result.status === 'fulfilled' && !result.value)) {
131
132
  const error = result.status === 'rejected'
132
- ? (result.reason instanceof Error ? result.reason.message : String(result.reason))
133
+ ? result.reason instanceof Error
134
+ ? result.reason.message
135
+ : String(result.reason)
133
136
  : 'Discovery failed';
134
137
  failed.push({ name: config.name, error });
135
138
  if (config.required) {
@@ -143,12 +146,12 @@ class PluginManager {
143
146
  });
144
147
  if (failed.length > 0) {
145
148
  this.logger.warn('Some plugins failed initial discovery', {
146
- failed: failed.map((f) => f.name),
147
- willRetryInBackground: this.pendingPlugins.map((p) => p.name),
149
+ failed: failed.map(f => f.name),
150
+ willRetryInBackground: this.pendingPlugins.map(p => p.name),
148
151
  });
149
152
  }
150
153
  if (requiredFailed.length > 0) {
151
- throw new PluginDiscoveryError(`Required plugins failed to discover: ${requiredFailed.map((f) => f.name).join(', ')}`, requiredFailed);
154
+ throw new PluginDiscoveryError(`Required plugins failed to discover: ${requiredFailed.map(f => f.name).join(', ')}`, requiredFailed);
152
155
  }
153
156
  this.logger.info('Plugin discovery complete', {
154
157
  discovered: this.discoveredPlugins.size,
@@ -169,7 +172,7 @@ class PluginManager {
169
172
  }
170
173
  this.backgroundRetryStartTime = Date.now();
171
174
  this.logger.info('Starting background plugin discovery', {
172
- pendingPlugins: this.pendingPlugins.map((p) => p.name),
175
+ pendingPlugins: this.pendingPlugins.map(p => p.name),
173
176
  retryIntervalMs: BACKGROUND_RETRY_INTERVAL_MS,
174
177
  maxDurationMs: BACKGROUND_RETRY_MAX_DURATION_MS,
175
178
  });
@@ -183,7 +186,7 @@ class PluginManager {
183
186
  clearTimeout(this.backgroundRetryTimer);
184
187
  this.backgroundRetryTimer = null;
185
188
  this.logger.info('Stopped background plugin discovery', {
186
- remainingPending: this.pendingPlugins.map((p) => p.name),
189
+ remainingPending: this.pendingPlugins.map(p => p.name),
187
190
  });
188
191
  }
189
192
  this.backgroundRetryStartTime = null;
@@ -192,7 +195,7 @@ class PluginManager {
192
195
  * Get pending plugins that are still awaiting discovery
193
196
  */
194
197
  getPendingPlugins() {
195
- return this.pendingPlugins.map((p) => p.name);
198
+ return this.pendingPlugins.map(p => p.name);
196
199
  }
197
200
  /**
198
201
  * Check if background discovery is active
@@ -218,7 +221,7 @@ class PluginManager {
218
221
  if (elapsed >= BACKGROUND_RETRY_MAX_DURATION_MS) {
219
222
  this.logger.warn('Background plugin discovery timed out', {
220
223
  elapsedMs: elapsed,
221
- remainingPending: this.pendingPlugins.map((p) => p.name),
224
+ remainingPending: this.pendingPlugins.map(p => p.name),
222
225
  });
223
226
  this.stopBackgroundDiscovery();
224
227
  return;
@@ -294,7 +297,7 @@ class PluginManager {
294
297
  this.logger.info('Plugin discovered', {
295
298
  name: config.name,
296
299
  version: response.version,
297
- tools: response.tools.map((t) => t.name),
300
+ tools: response.tools.map(t => t.name),
298
301
  attempts: attempt,
299
302
  });
300
303
  return true;
@@ -307,7 +310,7 @@ class PluginManager {
307
310
  attempt,
308
311
  error: errorMessage,
309
312
  });
310
- await new Promise((resolve) => setTimeout(resolve, retryDelayMs));
313
+ await new Promise(resolve => setTimeout(resolve, retryDelayMs));
311
314
  }
312
315
  else {
313
316
  this.logger.debug('Plugin discovery failed, will retry in background', {
@@ -347,7 +350,7 @@ class PluginManager {
347
350
  if (!plugin) {
348
351
  return [];
349
352
  }
350
- return plugin.tools.map((t) => this.convertToAITool(t));
353
+ return plugin.tools.map(t => this.convertToAITool(t));
351
354
  }
352
355
  /**
353
356
  * Check if a tool is provided by a plugin
@@ -407,12 +410,15 @@ class PluginManager {
407
410
  if (response.success) {
408
411
  // PRD #343: Return only the data field to AI, not the full JSON wrapper
409
412
  // This saves tokens and provides cleaner output matching raw command output
410
- if (typeof response.result === 'object' && response.result !== null) {
413
+ if (typeof response.result === 'object' &&
414
+ response.result !== null) {
411
415
  const result = response.result;
412
416
  if ('success' in result && 'data' in result) {
413
417
  // Return just the data (raw command output) for successful results
414
418
  // Return error message string for failed results
415
- return result.success ? result.data : `Error: ${result.message || result.error || 'Command failed'}`;
419
+ return result.success
420
+ ? result.data
421
+ : `Error: ${result.message || result.error || 'Command failed'}`;
416
422
  }
417
423
  }
418
424
  // Fallback for non-standard responses - return result directly
@@ -463,7 +469,7 @@ class PluginManager {
463
469
  * Get plugin statistics
464
470
  */
465
471
  getStats() {
466
- const plugins = Array.from(this.discoveredPlugins.values()).map((p) => ({
472
+ const plugins = Array.from(this.discoveredPlugins.values()).map(p => ({
467
473
  name: p.name,
468
474
  version: p.version,
469
475
  toolCount: p.tools.length,
@@ -472,7 +478,7 @@ class PluginManager {
472
478
  pluginCount: this.discoveredPlugins.size,
473
479
  toolCount: this.toolToPlugin.size,
474
480
  plugins,
475
- pendingDiscovery: this.pendingPlugins.map((p) => p.name),
481
+ pendingDiscovery: this.pendingPlugins.map(p => p.name),
476
482
  backgroundDiscoveryActive: this.isBackgroundDiscoveryActive(),
477
483
  };
478
484
  }
@@ -1 +1 @@
1
- {"version":3,"file":"policy-operations.d.ts","sourceRoot":"","sources":["../../src/core/policy-operations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAA8C,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAmB9D;;GAEG;AACH,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAaD;;GAEG;AACH,UAAU,mBAAmB;IAC3B,UAAU,EAAE,KAAK,CAAC;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5D,MAAM,EAAE,KAAK,CAAC;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,UAAU,qBAAqB;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,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