jinzd-ai-cli 0.4.229 → 0.4.230
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/dist/{batch-XZHTNJXJ.js → batch-T74D2CCK.js} +3 -3
- package/dist/{chunk-DEHVRQWW.js → chunk-4KM53GLG.js} +1 -1
- package/dist/{chunk-EEQHP4GK.js → chunk-62R7CACG.js} +101 -302
- package/dist/{chunk-B3POS7LB.js → chunk-6GSDDDEO.js} +1 -1
- package/dist/{chunk-QCGKCNBX.js → chunk-7I4GGVIS.js} +1 -1
- package/dist/{chunk-FEVOW3NQ.js → chunk-DKPHVQUA.js} +1 -1
- package/dist/{chunk-DMF6UHO6.js → chunk-F2DUNYGY.js} +3 -23
- package/dist/{chunk-TEXAIWUJ.js → chunk-ITEGK3IN.js} +1 -1
- package/dist/{chunk-PQLRX7US.js → chunk-LMKCS5XH.js} +4 -4
- package/dist/{chunk-AEXWMIRE.js → chunk-S6SFZP3G.js} +1 -1
- package/dist/{chunk-QFOJ4GXC.js → chunk-SARJYCDV.js} +4 -4
- package/dist/{chunk-SJ36SUG7.js → chunk-SKUNYJDW.js} +2 -2
- package/dist/{chunk-AXIMNQSY.js → chunk-T3A74XGG.js} +1 -1
- package/dist/{chunk-QYQCCIBT.js → chunk-ZWU7FWHO.js} +22 -3
- package/dist/{ci-ZCVDKFXY.js → ci-ADQTAYOZ.js} +5 -5
- package/dist/{ci-format-CKXDFTN3.js → ci-format-KZSTHIEW.js} +2 -2
- package/dist/{constants-J2MSGNFA.js → constants-JTHN5JSQ.js} +1 -1
- package/dist/{doctor-cli-3VNTECP2.js → doctor-cli-XTIL3RTQ.js} +5 -5
- package/dist/electron-server.js +146 -355
- package/dist/{hub-LIH5JEI7.js → hub-BHHNMBCY.js} +2 -2
- package/dist/index.js +36 -49
- package/dist/{persist-XUXIPYUU.js → persist-I3JI27OK.js} +2 -2
- package/dist/{pr-HY2QCVUY.js → pr-NUHU64NS.js} +5 -5
- package/dist/{run-tests-WBGQI5V7.js → run-tests-HZMY436A.js} +2 -2
- package/dist/{run-tests-QVXDTJ3O.js → run-tests-M45ZJPR6.js} +1 -1
- package/dist/{server-5RXWIX4I.js → server-Q7MNZB4X.js} +4 -4
- package/dist/{server-LYTXYK6Y.js → server-RCAFE2LO.js} +32 -39
- package/dist/{task-orchestrator-FA4KOVD2.js → task-orchestrator-IVSLED6U.js} +4 -4
- package/dist/{usage-EHV6YVGH.js → usage-KNMT35C2.js} +2 -2
- package/dist/web/client/app.js +13 -5
- package/dist/web/client/index.html +14 -6
- package/package.json +1 -1
|
@@ -43,6 +43,8 @@ var Session = class _Session {
|
|
|
43
43
|
* 持久化在 toJSON / fromJSON 中,重启后不会重复请求。
|
|
44
44
|
*/
|
|
45
45
|
titleAiGenerated;
|
|
46
|
+
/** P1-PERF-03: 脏标记 — 任何修改操作设为 true,save() 后归零;避免大 session 无变更时的全量序列化写盘 */
|
|
47
|
+
dirty = false;
|
|
46
48
|
tokenUsage = {
|
|
47
49
|
inputTokens: 0,
|
|
48
50
|
outputTokens: 0,
|
|
@@ -85,10 +87,12 @@ var Session = class _Session {
|
|
|
85
87
|
this.provider = provider;
|
|
86
88
|
this.model = model;
|
|
87
89
|
this.updated = /* @__PURE__ */ new Date();
|
|
90
|
+
this.dirty = true;
|
|
88
91
|
}
|
|
89
92
|
addMessage(message) {
|
|
90
93
|
this.messages.push(message);
|
|
91
94
|
this.updated = /* @__PURE__ */ new Date();
|
|
95
|
+
this.dirty = true;
|
|
92
96
|
if (!this.title && message.role === "user") {
|
|
93
97
|
this.title = getContentText(message.content).slice(0, 50).replace(/\n/g, " ");
|
|
94
98
|
}
|
|
@@ -98,6 +102,7 @@ var Session = class _Session {
|
|
|
98
102
|
this.tokenUsage.outputTokens += usage.outputTokens;
|
|
99
103
|
this.tokenUsage.cacheCreationTokens += usage.cacheCreationTokens ?? 0;
|
|
100
104
|
this.tokenUsage.cacheReadTokens += usage.cacheReadTokens ?? 0;
|
|
105
|
+
this.dirty = true;
|
|
101
106
|
}
|
|
102
107
|
clear() {
|
|
103
108
|
this.messages = [];
|
|
@@ -110,6 +115,7 @@ var Session = class _Session {
|
|
|
110
115
|
cacheReadTokens: 0
|
|
111
116
|
};
|
|
112
117
|
this.updated = /* @__PURE__ */ new Date();
|
|
118
|
+
this.dirty = true;
|
|
113
119
|
}
|
|
114
120
|
/**
|
|
115
121
|
* 上下文压缩:用摘要消息替换旧消息,保留最近 keepLast 条。
|
|
@@ -135,6 +141,7 @@ var Session = class _Session {
|
|
|
135
141
|
const removedCount = cutIndex;
|
|
136
142
|
this.messages = [summaryMsg, ackMsg, ...preserved];
|
|
137
143
|
this.updated = /* @__PURE__ */ new Date();
|
|
144
|
+
this.dirty = true;
|
|
138
145
|
return removedCount;
|
|
139
146
|
}
|
|
140
147
|
/** 在当前消息位置创建检查点 */
|
|
@@ -145,6 +152,7 @@ var Session = class _Session {
|
|
|
145
152
|
messageIndex: this.messages.length,
|
|
146
153
|
timestamp: /* @__PURE__ */ new Date()
|
|
147
154
|
});
|
|
155
|
+
this.dirty = true;
|
|
148
156
|
}
|
|
149
157
|
/** 恢复到指定检查点:截断消息到检查点位置,移除后续检查点 */
|
|
150
158
|
restoreCheckpoint(name) {
|
|
@@ -153,6 +161,7 @@ var Session = class _Session {
|
|
|
153
161
|
this.messages = this.messages.slice(0, cp.messageIndex);
|
|
154
162
|
this.checkpoints = this.checkpoints.filter((c) => c.messageIndex <= cp.messageIndex);
|
|
155
163
|
this.updated = /* @__PURE__ */ new Date();
|
|
164
|
+
this.dirty = true;
|
|
156
165
|
return true;
|
|
157
166
|
}
|
|
158
167
|
listCheckpoints() {
|
|
@@ -220,6 +229,7 @@ var Session = class _Session {
|
|
|
220
229
|
this.messages = _Session.cloneMessages(this.messages.slice(0, fromIndex));
|
|
221
230
|
this.activeBranchId = id;
|
|
222
231
|
this.updated = /* @__PURE__ */ new Date();
|
|
232
|
+
this.dirty = true;
|
|
223
233
|
return id;
|
|
224
234
|
}
|
|
225
235
|
/**
|
|
@@ -237,6 +247,7 @@ var Session = class _Session {
|
|
|
237
247
|
this.messages = target;
|
|
238
248
|
this.activeBranchId = id;
|
|
239
249
|
this.updated = /* @__PURE__ */ new Date();
|
|
250
|
+
this.dirty = true;
|
|
240
251
|
return true;
|
|
241
252
|
}
|
|
242
253
|
/**
|
|
@@ -261,6 +272,7 @@ var Session = class _Session {
|
|
|
261
272
|
this.branches.splice(idx, 1);
|
|
262
273
|
this._inactiveBranchMessages.delete(id);
|
|
263
274
|
this.updated = /* @__PURE__ */ new Date();
|
|
275
|
+
this.dirty = true;
|
|
264
276
|
return true;
|
|
265
277
|
}
|
|
266
278
|
/** Rename a branch (affects only display title). */
|
|
@@ -269,6 +281,7 @@ var Session = class _Session {
|
|
|
269
281
|
if (!b) return false;
|
|
270
282
|
b.title = newTitle;
|
|
271
283
|
this.updated = /* @__PURE__ */ new Date();
|
|
284
|
+
this.dirty = true;
|
|
272
285
|
return true;
|
|
273
286
|
}
|
|
274
287
|
/**
|
|
@@ -351,6 +364,7 @@ var Session = class _Session {
|
|
|
351
364
|
};
|
|
352
365
|
this.messages.push(copy);
|
|
353
366
|
this.updated = /* @__PURE__ */ new Date();
|
|
367
|
+
this.dirty = true;
|
|
354
368
|
return copy;
|
|
355
369
|
}
|
|
356
370
|
getMeta() {
|
|
@@ -443,6 +457,7 @@ var Session = class _Session {
|
|
|
443
457
|
});
|
|
444
458
|
forked.checkpoints = original.checkpoints.filter((c) => c.messageIndex <= clampedCount).map((c) => ({ ...c, timestamp: new Date(c.timestamp.getTime()) }));
|
|
445
459
|
forked.updated = /* @__PURE__ */ new Date();
|
|
460
|
+
forked.dirty = true;
|
|
446
461
|
return forked;
|
|
447
462
|
}
|
|
448
463
|
/**
|
|
@@ -522,6 +537,7 @@ var Session = class _Session {
|
|
|
522
537
|
}
|
|
523
538
|
}
|
|
524
539
|
}
|
|
540
|
+
session.dirty = false;
|
|
525
541
|
return session;
|
|
526
542
|
}
|
|
527
543
|
};
|
|
@@ -585,8 +601,10 @@ var SessionManager = class {
|
|
|
585
601
|
clearCurrent() {
|
|
586
602
|
this._current = null;
|
|
587
603
|
}
|
|
588
|
-
|
|
604
|
+
/** P1-PERF-03: `force` 跳过脏检查(用于进程退出、fork 等必须落盘场景) */
|
|
605
|
+
async save(force = false) {
|
|
589
606
|
if (!this._current) return;
|
|
607
|
+
if (!force && !this._current.dirty) return;
|
|
590
608
|
mkdirSync(this.historyDir, { recursive: true });
|
|
591
609
|
const filePath = join(this.historyDir, `${this._current.id}.json`);
|
|
592
610
|
const raw = this._current.toJSON();
|
|
@@ -594,6 +612,7 @@ var SessionManager = class {
|
|
|
594
612
|
const { value: payload, hits } = redactJson(raw, opts);
|
|
595
613
|
this.lastRedactionHits = hits.length;
|
|
596
614
|
atomicWriteFileSync(filePath, JSON.stringify(payload, null, 2));
|
|
615
|
+
this._current.dirty = false;
|
|
597
616
|
}
|
|
598
617
|
loadSession(id) {
|
|
599
618
|
const filePath = join(this.historyDir, `${id}.json`);
|
|
@@ -734,10 +753,10 @@ var SessionManager = class {
|
|
|
734
753
|
if (!this._current) {
|
|
735
754
|
throw new Error("No active session to fork");
|
|
736
755
|
}
|
|
737
|
-
await this.save();
|
|
756
|
+
await this.save(true);
|
|
738
757
|
const forked = Session.fork(this._current, uuidv4(), messageCount, title);
|
|
739
758
|
this._current = forked;
|
|
740
|
-
await this.save();
|
|
759
|
+
await this.save(true);
|
|
741
760
|
return forked;
|
|
742
761
|
}
|
|
743
762
|
/**
|
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
CI_COMMENT_MARKER,
|
|
4
4
|
countSeverity,
|
|
5
5
|
runCi
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-LMKCS5XH.js";
|
|
7
|
+
import "./chunk-T3A74XGG.js";
|
|
8
8
|
import "./chunk-HLWUDRBO.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-62R7CACG.js";
|
|
10
10
|
import "./chunk-ODYTXQ26.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-DKPHVQUA.js";
|
|
12
12
|
import "./chunk-5ULLIOVC.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-6GSDDDEO.js";
|
|
14
14
|
import "./chunk-IW3Q7AE5.js";
|
|
15
15
|
export {
|
|
16
16
|
CI_COMMENT_MARKER,
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import {
|
|
3
3
|
formatDoctorReport,
|
|
4
4
|
runDoctorCli
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-SARJYCDV.js";
|
|
6
|
+
import "./chunk-62R7CACG.js";
|
|
7
|
+
import "./chunk-ITEGK3IN.js";
|
|
8
8
|
import "./chunk-ODYTXQ26.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-DKPHVQUA.js";
|
|
10
10
|
import "./chunk-5ULLIOVC.js";
|
|
11
11
|
import "./chunk-HOSJZMQS.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-6GSDDDEO.js";
|
|
13
13
|
import "./chunk-IW3Q7AE5.js";
|
|
14
14
|
export {
|
|
15
15
|
formatDoctorReport,
|