scai 0.1.120 → 0.1.121

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.
@@ -74,7 +74,7 @@ export class MainAgent {
74
74
  if (!output) {
75
75
  throw new Error(`Module "${mod.name}" returned empty output`);
76
76
  }
77
- logLine("EXECUTE", step.action, stop(), step.description);
77
+ logLine("EXECUTE", step.action, stop());
78
78
  return {
79
79
  query: step.description ?? input.query,
80
80
  data: output.data,
@@ -26,7 +26,7 @@ export const infoPlanGen = {
26
26
  ? context.analysis.focus.missingFiles
27
27
  : [];
28
28
  if (missingFiles.length === 0) {
29
- console.log('ℹ️ No missing files — returning empty info plan.');
29
+ console.log(' - No missing files — returning empty info plan.');
30
30
  context.analysis.planSuggestion = { plan: { steps: [] } };
31
31
  logInputOutput('infoPlanGen', 'output', { steps: [] });
32
32
  return;
@@ -90,7 +90,7 @@ Code snippet: ${file.code ?? "[no code]"}
90
90
  data = JSON.parse(String(cleaned.content ?? "{}"));
91
91
  }
92
92
  catch {
93
- console.warn(`[semanticAnalysisStep] Non-JSON output for ${file.path}, defaulting to irrelevant`);
93
+ console.warn(` - [semanticAnalysisStep] Non-JSON output for ${file.path}, defaulting to irrelevant`);
94
94
  data = { intent: "irrelevant", risks: [] };
95
95
  }
96
96
  }
@@ -100,7 +100,7 @@ Code snippet: ${file.code ?? "[no code]"}
100
100
  };
101
101
  }
102
102
  catch (err) {
103
- console.warn(`[semanticAnalysisStep] Failed to analyze file ${file.path}:`, err);
103
+ console.warn(` - [semanticAnalysisStep] Failed to analyze file ${file.path}:`, err);
104
104
  return { intent: "irrelevant", risks: [] };
105
105
  }
106
106
  }
@@ -123,7 +123,9 @@ export const cleanupModule = {
123
123
  data: parsed,
124
124
  };
125
125
  }
126
- console.warn(chalk.red("[cleanupModule] Failed to parse JSON returning raw content."));
126
+ // Clear current line (removes leftover spinner)
127
+ process.stdout.write('\r\x1b[K');
128
+ console.warn(chalk.red(" - [cleanupModule] Failed to parse JSON — returning raw content."));
127
129
  return {
128
130
  query: input.query,
129
131
  content,
@@ -1,5 +1,8 @@
1
1
  import { encode } from 'gpt-3-encoder';
2
- export function splitCodeIntoChunks(text, maxTokens = 1500, hardLimitMultiplier = 1.8) {
2
+ export function splitCodeIntoChunks(text, softLimit = 1500, // first threshold
3
+ hardLimitMultiplier = 2 // hard limit will be softLimit * multiplier
4
+ ) {
5
+ const hardLimit = softLimit * hardLimitMultiplier;
3
6
  const lines = text.split('\n');
4
7
  const chunks = [];
5
8
  let currentChunkLines = [];
@@ -61,13 +64,14 @@ export function splitCodeIntoChunks(text, maxTokens = 1500, hardLimitMultiplier
61
64
  currentChunkLines.push(line);
62
65
  currentTokens += encode(line + '\n').length;
63
66
  // ---------- split decision ----------
64
- const softLimitReached = currentTokens >= maxTokens;
65
- const hardLimitReached = currentTokens >= maxTokens * hardLimitMultiplier;
67
+ const softLimitReached = currentTokens >= softLimit;
68
+ const hardLimitReached = currentTokens >= hardLimit;
66
69
  const safeToSplit = !inMultiComment &&
67
70
  !inTryBlock &&
68
71
  functionBraceDepth === 0 &&
69
72
  parenDepth === 0 &&
70
73
  bracketDepth === 0;
74
+ // try to split after soft limit if safe, or force at hard limit
71
75
  if ((softLimitReached && safeToSplit) || hardLimitReached) {
72
76
  chunks.push(currentChunkLines.join('\n'));
73
77
  currentChunkLines = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scai",
3
- "version": "0.1.120",
3
+ "version": "0.1.121",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "scai": "./dist/index.js"