codemini-cli 0.1.1 → 0.1.11

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codemini-cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.11",
4
4
  "description": "Coding CLI optimized for small-model workflows and Windows PowerShell",
5
5
  "keywords": [
6
6
  "cli",
@@ -36,11 +36,38 @@ function isMiniMaxModel(model) {
36
36
  return String(model || '').toLowerCase().includes('minimax');
37
37
  }
38
38
 
39
+ function sanitizeMiniMaxMessages(messages) {
40
+ const source = Array.isArray(messages) ? messages : [];
41
+ const out = [];
42
+ let seenNonSystem = false;
43
+ let keptLeadingSystem = false;
44
+
45
+ for (const message of source) {
46
+ if (!message || typeof message !== 'object') continue;
47
+ if (message.role === 'system') {
48
+ if (!seenNonSystem && !keptLeadingSystem) {
49
+ out.push(message);
50
+ keptLeadingSystem = true;
51
+ } else {
52
+ out.push({
53
+ role: 'user',
54
+ content: `[system-note]\n${extractTextContent(message.content)}`
55
+ });
56
+ }
57
+ continue;
58
+ }
59
+ seenNonSystem = true;
60
+ out.push(message);
61
+ }
62
+
63
+ return out;
64
+ }
65
+
39
66
  function buildPayload({ model, temperature, messages, tools, stream = false }) {
40
67
  const payload = {
41
68
  model,
42
69
  temperature,
43
- messages
70
+ messages: isMiniMaxModel(model) ? sanitizeMiniMaxMessages(messages) : messages
44
71
  };
45
72
  if (stream) {
46
73
  payload.stream = true;