codemini-cli 0.5.4 → 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-C0p6xCdM.js → highlighted-body-OFNGDK62-DC-rSI65.js} +1 -1
- package/codemini-web/dist/assets/{index-SZnRN7a3.css → index-DErltUwI.css} +1 -1
- package/codemini-web/dist/assets/{index-fbvf7RS1.js → index-cYRgZ3WI.js} +4 -4
- 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 +53 -13
- package/src/core/fff-adapter.js +1 -1
- package/codemini-web/dist/assets/mermaid-GHXKKRXX-DgSNlEad.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
|
}
|
|
@@ -4205,9 +4225,16 @@ export async function createChatRuntime({
|
|
|
4205
4225
|
const setCompactedView = (view, meta = {}) => {
|
|
4206
4226
|
compactedForModel = view;
|
|
4207
4227
|
currentSession.compact = view
|
|
4208
|
-
? { view, timestamp: new Date().toISOString(), ...meta }
|
|
4228
|
+
? { ...(currentSession.compact || {}), view, timestamp: new Date().toISOString(), ...meta }
|
|
4209
4229
|
: null;
|
|
4210
4230
|
};
|
|
4231
|
+
const appendSessionMessage = (message) => {
|
|
4232
|
+
currentSession.messages.push(message);
|
|
4233
|
+
if (compactedForModel) {
|
|
4234
|
+
compactedForModel.push({ ...message });
|
|
4235
|
+
setCompactedView(compactedForModel);
|
|
4236
|
+
}
|
|
4237
|
+
};
|
|
4211
4238
|
let historyIdCache = [currentSession.id];
|
|
4212
4239
|
let historySessionCache = [
|
|
4213
4240
|
{
|
|
@@ -4682,10 +4709,10 @@ export async function createChatRuntime({
|
|
|
4682
4709
|
|
|
4683
4710
|
const persistLocalExchange = async (userText, systemText, { includeUser = true } = {}) => {
|
|
4684
4711
|
if (includeUser && userText) {
|
|
4685
|
-
|
|
4712
|
+
appendSessionMessage(stampedMessage('user', userText));
|
|
4686
4713
|
}
|
|
4687
4714
|
if (systemText) {
|
|
4688
|
-
|
|
4715
|
+
appendSessionMessage(stampedMessage('system', systemText));
|
|
4689
4716
|
}
|
|
4690
4717
|
if (shouldReplaceSessionTitle(currentSession.title)) {
|
|
4691
4718
|
currentSession.title = deriveSessionTitle(currentSession.messages);
|
|
@@ -4697,10 +4724,10 @@ export async function createChatRuntime({
|
|
|
4697
4724
|
|
|
4698
4725
|
const persistAssistantExchange = async (userText, assistantText, { includeUser = true, extra = {} } = {}) => {
|
|
4699
4726
|
if (includeUser && userText) {
|
|
4700
|
-
|
|
4727
|
+
appendSessionMessage(stampedMessage('user', userText));
|
|
4701
4728
|
}
|
|
4702
4729
|
if (assistantText) {
|
|
4703
|
-
|
|
4730
|
+
appendSessionMessage(stampedMessage('assistant', assistantText, extra));
|
|
4704
4731
|
}
|
|
4705
4732
|
if (shouldReplaceSessionTitle(currentSession.title)) {
|
|
4706
4733
|
currentSession.title = await generateSessionTitle({
|
|
@@ -4716,7 +4743,7 @@ export async function createChatRuntime({
|
|
|
4716
4743
|
|
|
4717
4744
|
const persistUserExchange = async (userText) => {
|
|
4718
4745
|
if (!userText) return;
|
|
4719
|
-
|
|
4746
|
+
appendSessionMessage(stampedMessage('user', userText));
|
|
4720
4747
|
if (shouldReplaceSessionTitle(currentSession.title)) {
|
|
4721
4748
|
currentSession.title = deriveSessionTitle(currentSession.messages);
|
|
4722
4749
|
}
|
|
@@ -5691,7 +5718,9 @@ export async function createChatRuntime({
|
|
|
5691
5718
|
return { type: 'system', text: report };
|
|
5692
5719
|
}
|
|
5693
5720
|
|
|
5694
|
-
const
|
|
5721
|
+
const sourceIsCompacted = Boolean(compactedForModel);
|
|
5722
|
+
const macroSource = compactedForModel ?? currentSession.messages;
|
|
5723
|
+
const result = compactMessagesLocally(macroSource, { mode: compactState.mode, force: true });
|
|
5695
5724
|
if (!result.changed) {
|
|
5696
5725
|
return { type: 'system', text: 'Nothing to compact yet' };
|
|
5697
5726
|
}
|
|
@@ -5704,7 +5733,10 @@ export async function createChatRuntime({
|
|
|
5704
5733
|
|
|
5705
5734
|
setCompactedView(
|
|
5706
5735
|
result.compacted.map((m) => ({ ...m, at: new Date().toISOString() })),
|
|
5707
|
-
{
|
|
5736
|
+
{
|
|
5737
|
+
boundaryIndex: translateCompactBoundaryToOriginal(sourceIsCompacted, currentSession.compact, result.boundaryIndex),
|
|
5738
|
+
mode: compactState.mode
|
|
5739
|
+
}
|
|
5708
5740
|
);
|
|
5709
5741
|
await captureCompactSummary({
|
|
5710
5742
|
summary: result.summary,
|
|
@@ -5923,7 +5955,8 @@ export async function createChatRuntime({
|
|
|
5923
5955
|
}
|
|
5924
5956
|
// Phase 1: macro compact if still over threshold
|
|
5925
5957
|
if (needsMacro) {
|
|
5926
|
-
const
|
|
5958
|
+
const sourceIsCompacted = Boolean(compactedForModel);
|
|
5959
|
+
const macroSource = compactedForModel ?? currentSession.messages;
|
|
5927
5960
|
const autoResult = compactMessagesLocally(macroSource, {
|
|
5928
5961
|
mode: compactState.mode,
|
|
5929
5962
|
force: true
|
|
@@ -5934,7 +5967,14 @@ export async function createChatRuntime({
|
|
|
5934
5967
|
...m,
|
|
5935
5968
|
at: new Date().toISOString()
|
|
5936
5969
|
})),
|
|
5937
|
-
{
|
|
5970
|
+
{
|
|
5971
|
+
boundaryIndex: translateCompactBoundaryToOriginal(
|
|
5972
|
+
sourceIsCompacted,
|
|
5973
|
+
currentSession.compact,
|
|
5974
|
+
autoResult.boundaryIndex
|
|
5975
|
+
),
|
|
5976
|
+
mode: compactState.mode
|
|
5977
|
+
}
|
|
5938
5978
|
);
|
|
5939
5979
|
await captureCompactSummary({
|
|
5940
5980
|
summary: autoResult.summary,
|
package/src/core/fff-adapter.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./index-fbvf7RS1.js";export{e as Mermaid};
|