codemini-cli 0.5.3 → 0.5.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.
- package/codemini-web/dist/assets/{highlighted-body-OFNGDK62-CDUecv8k.js → highlighted-body-OFNGDK62-DC-rSI65.js} +1 -1
- package/codemini-web/dist/assets/{index-Dqq2DCEb.css → index-DErltUwI.css} +1 -1
- package/codemini-web/dist/assets/{index-Cfk9ARKs.js → index-cYRgZ3WI.js} +105 -105
- package/codemini-web/dist/assets/mermaid-GHXKKRXX-DdvTRIYD.js +1 -0
- package/codemini-web/dist/index.html +2 -2
- package/deployment.md +5 -5
- package/package.json +1 -1
- package/src/core/chat-runtime.js +73 -17
- package/src/core/fff-adapter.js +1 -1
- package/codemini-web/dist/assets/mermaid-GHXKKRXX-BWSxGKNn.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./index-cYRgZ3WI.js";export{e as Mermaid};
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
document.documentElement.dataset.palette = palette;
|
|
15
15
|
})();
|
|
16
16
|
</script>
|
|
17
|
-
<script type="module" crossorigin src="/assets/index-
|
|
17
|
+
<script type="module" crossorigin src="/assets/index-cYRgZ3WI.js"></script>
|
|
18
18
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-S-ySWqyJ.js">
|
|
19
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
19
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DErltUwI.css">
|
|
20
20
|
</head>
|
|
21
21
|
<body class="font-sans antialiased">
|
|
22
22
|
<div id="root"></div>
|
package/deployment.md
CHANGED
|
@@ -13,13 +13,13 @@ npm pack
|
|
|
13
13
|
Expected output:
|
|
14
14
|
|
|
15
15
|
```text
|
|
16
|
-
codemini-cli-0.5.
|
|
16
|
+
codemini-cli-0.5.5.tgz
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
If you want to verify the package contents:
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
tar -tf codemini-cli-0.5.
|
|
22
|
+
tar -tf codemini-cli-0.5.5.tgz
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
## 2. Copy To The Target Machine
|
|
@@ -34,7 +34,7 @@ Copy the generated `.tgz` file to the Win10 machine by one of these methods:
|
|
|
34
34
|
Recommended target path:
|
|
35
35
|
|
|
36
36
|
```powershell
|
|
37
|
-
C:\temp\codemini-cli-0.5.
|
|
37
|
+
C:\temp\codemini-cli-0.5.5.tgz
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## 3. Environment Requirements
|
|
@@ -58,7 +58,7 @@ npm -v
|
|
|
58
58
|
Global install:
|
|
59
59
|
|
|
60
60
|
```powershell
|
|
61
|
-
npm install -g C:\temp\codemini-cli-0.5.
|
|
61
|
+
npm install -g C:\temp\codemini-cli-0.5.5.tgz
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
If global install is blocked by company policy, install in a working directory instead:
|
|
@@ -66,7 +66,7 @@ If global install is blocked by company policy, install in a working directory i
|
|
|
66
66
|
```powershell
|
|
67
67
|
mkdir C:\temp\coder-test
|
|
68
68
|
cd C:\temp\coder-test
|
|
69
|
-
npm install C:\temp\codemini-cli-0.5.
|
|
69
|
+
npm install C:\temp\codemini-cli-0.5.5.tgz
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
## 5. Confirm Installation
|
package/package.json
CHANGED
package/src/core/chat-runtime.js
CHANGED
|
@@ -64,6 +64,15 @@ function toOpenAIMessages(sessionMessages) {
|
|
|
64
64
|
return mapped;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
function translateCompactBoundaryToOriginal(sourceIsCompacted, compactMeta, compactBoundaryIndex) {
|
|
68
|
+
const boundary = Number(compactBoundaryIndex);
|
|
69
|
+
if (!Number.isFinite(boundary)) return undefined;
|
|
70
|
+
if (!sourceIsCompacted) return Math.max(0, boundary);
|
|
71
|
+
const previousBoundary = Number(compactMeta?.boundaryIndex);
|
|
72
|
+
if (!Number.isFinite(previousBoundary)) return Math.max(0, boundary);
|
|
73
|
+
return Math.max(0, previousBoundary + Math.max(0, boundary - 1));
|
|
74
|
+
}
|
|
75
|
+
|
|
67
76
|
function slugify(input) {
|
|
68
77
|
const base = String(input || '')
|
|
69
78
|
.toLowerCase()
|
|
@@ -2630,14 +2639,20 @@ async function askModel({
|
|
|
2630
2639
|
}
|
|
2631
2640
|
}
|
|
2632
2641
|
if (needsMacro) {
|
|
2633
|
-
const
|
|
2642
|
+
const sourceIsCompacted = Boolean(compacted);
|
|
2643
|
+
const macroSource = compacted ?? session.messages;
|
|
2634
2644
|
const auto = compactMessagesLocally(macroSource, {
|
|
2635
2645
|
mode: preflightPct >= hardPct ? 'aggressive' : 'conservative',
|
|
2636
2646
|
force: true
|
|
2637
2647
|
});
|
|
2638
2648
|
if (auto.changed) {
|
|
2639
2649
|
compacted = auto.compacted.map((m) => ({ ...m, at: new Date().toISOString() }));
|
|
2640
|
-
if (onCompactedUpdate)
|
|
2650
|
+
if (onCompactedUpdate) {
|
|
2651
|
+
onCompactedUpdate(compacted, {
|
|
2652
|
+
boundaryIndex: translateCompactBoundaryToOriginal(sourceIsCompacted, session.compact, auto.boundaryIndex),
|
|
2653
|
+
mode: preflightPct >= hardPct ? 'aggressive' : 'conservative'
|
|
2654
|
+
});
|
|
2655
|
+
}
|
|
2641
2656
|
if (onAgentEvent) {
|
|
2642
2657
|
onAgentEvent({
|
|
2643
2658
|
type: 'compact:auto',
|
|
@@ -2699,7 +2714,12 @@ async function askModel({
|
|
|
2699
2714
|
const shouldGenerateTitle = !session.messages.some((msg) => msg?.role === 'user');
|
|
2700
2715
|
const modelExtra =
|
|
2701
2716
|
typeof modelText === 'string' && modelText && modelText !== text ? { model_content: modelText } : {};
|
|
2702
|
-
|
|
2717
|
+
const userMessage = stampedMessage('user', text, modelExtra);
|
|
2718
|
+
session.messages.push(userMessage);
|
|
2719
|
+
if (compacted) {
|
|
2720
|
+
compacted.push({ ...userMessage });
|
|
2721
|
+
if (onCompactedUpdate) onCompactedUpdate(compacted);
|
|
2722
|
+
}
|
|
2703
2723
|
if (!shouldGenerateTitle) {
|
|
2704
2724
|
session.title = deriveSessionTitle(session.messages);
|
|
2705
2725
|
}
|
|
@@ -2818,6 +2838,22 @@ async function askModel({
|
|
|
2818
2838
|
}
|
|
2819
2839
|
current.at = new Date().toISOString();
|
|
2820
2840
|
if (persistSession) scheduleSessionSave();
|
|
2841
|
+
} else {
|
|
2842
|
+
const assistantMessage = event.assistantMessage && typeof event.assistantMessage === 'object'
|
|
2843
|
+
? event.assistantMessage
|
|
2844
|
+
: { content: event.text || '' };
|
|
2845
|
+
session.messages.push(stampedMessage('assistant', assistantMessage.content || event.text || '', {
|
|
2846
|
+
...(typeof assistantMessage.reasoning_content === 'string' && assistantMessage.reasoning_content
|
|
2847
|
+
? { reasoning_content: assistantMessage.reasoning_content }
|
|
2848
|
+
: {}),
|
|
2849
|
+
...(Array.isArray(assistantMessage.reasoning_details) && assistantMessage.reasoning_details.length > 0
|
|
2850
|
+
? { reasoning_details: assistantMessage.reasoning_details }
|
|
2851
|
+
: {}),
|
|
2852
|
+
...(Array.isArray(assistantMessage.tool_calls) && assistantMessage.tool_calls.length > 0
|
|
2853
|
+
? { tool_calls: assistantMessage.tool_calls }
|
|
2854
|
+
: {})
|
|
2855
|
+
}));
|
|
2856
|
+
if (persistSession) scheduleSessionSave();
|
|
2821
2857
|
}
|
|
2822
2858
|
activeAssistantIndex = -1;
|
|
2823
2859
|
} else if (event?.type === 'tool:end' || event?.type === 'tool:error' || event?.type === 'tool:blocked') {
|
|
@@ -2879,9 +2915,9 @@ async function askModel({
|
|
|
2879
2915
|
requestCompletion: async ({ messages, tools, model: selectedModel }) => {
|
|
2880
2916
|
let started = false;
|
|
2881
2917
|
const startAssistantStream = () => {
|
|
2882
|
-
if (!started
|
|
2918
|
+
if (!started) {
|
|
2883
2919
|
started = true;
|
|
2884
|
-
|
|
2920
|
+
wrappedAgentEvent({ type: 'assistant:start' });
|
|
2885
2921
|
}
|
|
2886
2922
|
};
|
|
2887
2923
|
|
|
@@ -2897,11 +2933,11 @@ async function askModel({
|
|
|
2897
2933
|
signal,
|
|
2898
2934
|
onTextDelta: (delta) => {
|
|
2899
2935
|
startAssistantStream();
|
|
2900
|
-
|
|
2936
|
+
wrappedAgentEvent({ type: 'assistant:delta', text: delta });
|
|
2901
2937
|
},
|
|
2902
2938
|
onToolCallDelta: (toolCall) => {
|
|
2903
2939
|
startAssistantStream();
|
|
2904
|
-
|
|
2940
|
+
wrappedAgentEvent({ type: 'assistant:tool_call_delta', toolCall });
|
|
2905
2941
|
}
|
|
2906
2942
|
});
|
|
2907
2943
|
|
|
@@ -4189,9 +4225,16 @@ export async function createChatRuntime({
|
|
|
4189
4225
|
const setCompactedView = (view, meta = {}) => {
|
|
4190
4226
|
compactedForModel = view;
|
|
4191
4227
|
currentSession.compact = view
|
|
4192
|
-
? { view, timestamp: new Date().toISOString(), ...meta }
|
|
4228
|
+
? { ...(currentSession.compact || {}), view, timestamp: new Date().toISOString(), ...meta }
|
|
4193
4229
|
: null;
|
|
4194
4230
|
};
|
|
4231
|
+
const appendSessionMessage = (message) => {
|
|
4232
|
+
currentSession.messages.push(message);
|
|
4233
|
+
if (compactedForModel) {
|
|
4234
|
+
compactedForModel.push({ ...message });
|
|
4235
|
+
setCompactedView(compactedForModel);
|
|
4236
|
+
}
|
|
4237
|
+
};
|
|
4195
4238
|
let historyIdCache = [currentSession.id];
|
|
4196
4239
|
let historySessionCache = [
|
|
4197
4240
|
{
|
|
@@ -4666,10 +4709,10 @@ export async function createChatRuntime({
|
|
|
4666
4709
|
|
|
4667
4710
|
const persistLocalExchange = async (userText, systemText, { includeUser = true } = {}) => {
|
|
4668
4711
|
if (includeUser && userText) {
|
|
4669
|
-
|
|
4712
|
+
appendSessionMessage(stampedMessage('user', userText));
|
|
4670
4713
|
}
|
|
4671
4714
|
if (systemText) {
|
|
4672
|
-
|
|
4715
|
+
appendSessionMessage(stampedMessage('system', systemText));
|
|
4673
4716
|
}
|
|
4674
4717
|
if (shouldReplaceSessionTitle(currentSession.title)) {
|
|
4675
4718
|
currentSession.title = deriveSessionTitle(currentSession.messages);
|
|
@@ -4681,10 +4724,10 @@ export async function createChatRuntime({
|
|
|
4681
4724
|
|
|
4682
4725
|
const persistAssistantExchange = async (userText, assistantText, { includeUser = true, extra = {} } = {}) => {
|
|
4683
4726
|
if (includeUser && userText) {
|
|
4684
|
-
|
|
4727
|
+
appendSessionMessage(stampedMessage('user', userText));
|
|
4685
4728
|
}
|
|
4686
4729
|
if (assistantText) {
|
|
4687
|
-
|
|
4730
|
+
appendSessionMessage(stampedMessage('assistant', assistantText, extra));
|
|
4688
4731
|
}
|
|
4689
4732
|
if (shouldReplaceSessionTitle(currentSession.title)) {
|
|
4690
4733
|
currentSession.title = await generateSessionTitle({
|
|
@@ -4700,7 +4743,7 @@ export async function createChatRuntime({
|
|
|
4700
4743
|
|
|
4701
4744
|
const persistUserExchange = async (userText) => {
|
|
4702
4745
|
if (!userText) return;
|
|
4703
|
-
|
|
4746
|
+
appendSessionMessage(stampedMessage('user', userText));
|
|
4704
4747
|
if (shouldReplaceSessionTitle(currentSession.title)) {
|
|
4705
4748
|
currentSession.title = deriveSessionTitle(currentSession.messages);
|
|
4706
4749
|
}
|
|
@@ -5675,7 +5718,9 @@ export async function createChatRuntime({
|
|
|
5675
5718
|
return { type: 'system', text: report };
|
|
5676
5719
|
}
|
|
5677
5720
|
|
|
5678
|
-
const
|
|
5721
|
+
const sourceIsCompacted = Boolean(compactedForModel);
|
|
5722
|
+
const macroSource = compactedForModel ?? currentSession.messages;
|
|
5723
|
+
const result = compactMessagesLocally(macroSource, { mode: compactState.mode, force: true });
|
|
5679
5724
|
if (!result.changed) {
|
|
5680
5725
|
return { type: 'system', text: 'Nothing to compact yet' };
|
|
5681
5726
|
}
|
|
@@ -5688,7 +5733,10 @@ export async function createChatRuntime({
|
|
|
5688
5733
|
|
|
5689
5734
|
setCompactedView(
|
|
5690
5735
|
result.compacted.map((m) => ({ ...m, at: new Date().toISOString() })),
|
|
5691
|
-
{
|
|
5736
|
+
{
|
|
5737
|
+
boundaryIndex: translateCompactBoundaryToOriginal(sourceIsCompacted, currentSession.compact, result.boundaryIndex),
|
|
5738
|
+
mode: compactState.mode
|
|
5739
|
+
}
|
|
5692
5740
|
);
|
|
5693
5741
|
await captureCompactSummary({
|
|
5694
5742
|
summary: result.summary,
|
|
@@ -5907,7 +5955,8 @@ export async function createChatRuntime({
|
|
|
5907
5955
|
}
|
|
5908
5956
|
// Phase 1: macro compact if still over threshold
|
|
5909
5957
|
if (needsMacro) {
|
|
5910
|
-
const
|
|
5958
|
+
const sourceIsCompacted = Boolean(compactedForModel);
|
|
5959
|
+
const macroSource = compactedForModel ?? currentSession.messages;
|
|
5911
5960
|
const autoResult = compactMessagesLocally(macroSource, {
|
|
5912
5961
|
mode: compactState.mode,
|
|
5913
5962
|
force: true
|
|
@@ -5918,7 +5967,14 @@ export async function createChatRuntime({
|
|
|
5918
5967
|
...m,
|
|
5919
5968
|
at: new Date().toISOString()
|
|
5920
5969
|
})),
|
|
5921
|
-
{
|
|
5970
|
+
{
|
|
5971
|
+
boundaryIndex: translateCompactBoundaryToOriginal(
|
|
5972
|
+
sourceIsCompacted,
|
|
5973
|
+
currentSession.compact,
|
|
5974
|
+
autoResult.boundaryIndex
|
|
5975
|
+
),
|
|
5976
|
+
mode: compactState.mode
|
|
5977
|
+
}
|
|
5922
5978
|
);
|
|
5923
5979
|
await captureCompactSummary({
|
|
5924
5980
|
summary: autoResult.summary,
|
package/src/core/fff-adapter.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./index-Cfk9ARKs.js";export{e as Mermaid};
|