@kenhkl/agent-moss 0.12.3 → 0.12.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/dist/cli.js +12 -5
- package/dist/cli.js.map +1 -1
- package/dist/engine/coordinator.d.ts +3 -3
- package/dist/engine/coordinator.js +10 -4
- package/dist/engine/coordinator.js.map +1 -1
- package/dist/rules/l1_rules.json +6 -0
- package/dist/server.js +12 -5
- package/dist/server.js.map +1 -1
- package/dist/static/index.html +39 -3
- package/package.json +1 -1
|
@@ -17,15 +17,15 @@ interface AnalysisInput {
|
|
|
17
17
|
actionType: string;
|
|
18
18
|
actionDetail: string;
|
|
19
19
|
}[];
|
|
20
|
-
/** 完整的交错历史 prompt(可选),每轮 {text, actions}
|
|
20
|
+
/** 完整的交错历史 prompt(可选),每轮 {text, actions} 或纯文本 string(AgentGate v3 旧格式),按时间序。
|
|
21
21
|
* 供 L2 意图一致性与 L3 语义分析使用;空则回退单条 promptSession。 */
|
|
22
|
-
promptHistory?: {
|
|
22
|
+
promptHistory?: ({
|
|
23
23
|
text: string;
|
|
24
24
|
actions: {
|
|
25
25
|
actionType: string;
|
|
26
26
|
actionDetail: string;
|
|
27
27
|
}[];
|
|
28
|
-
}[];
|
|
28
|
+
} | string)[];
|
|
29
29
|
aNext: {
|
|
30
30
|
actionType: string;
|
|
31
31
|
actionDetail: string;
|
|
@@ -2773,6 +2773,7 @@ var init_heuristic = __esm({
|
|
|
2773
2773
|
var token_stats_exports = {};
|
|
2774
2774
|
__export(token_stats_exports, {
|
|
2775
2775
|
getRecentRecords: () => getRecentRecords,
|
|
2776
|
+
getRecentRecordsCount: () => getRecentRecordsCount,
|
|
2776
2777
|
getTokenStats: () => getTokenStats,
|
|
2777
2778
|
getTokenTrend: () => getTokenTrend,
|
|
2778
2779
|
recordTokenUsage: () => recordTokenUsage,
|
|
@@ -2893,9 +2894,14 @@ function getTokenStats(days = 0, startDate, endDate) {
|
|
|
2893
2894
|
by_date: a.byDate
|
|
2894
2895
|
};
|
|
2895
2896
|
}
|
|
2896
|
-
function getRecentRecords(limit = 20) {
|
|
2897
|
+
function getRecentRecords(limit = 20, offset = 0) {
|
|
2897
2898
|
const records = loadAllRecords(getStatsPath());
|
|
2898
|
-
|
|
2899
|
+
const start = Math.max(0, records.length - offset - limit);
|
|
2900
|
+
const end = records.length - offset;
|
|
2901
|
+
return records.slice(start, end);
|
|
2902
|
+
}
|
|
2903
|
+
function getRecentRecordsCount() {
|
|
2904
|
+
return loadAllRecords(getStatsPath()).length;
|
|
2899
2905
|
}
|
|
2900
2906
|
function getTokenTrend(days = 0, startDate, endDate) {
|
|
2901
2907
|
const records = filterByDate(loadAllRecords(getStatsPath()), days, startDate, endDate);
|
|
@@ -3800,10 +3806,10 @@ function formatPromptHistory(promptHistory, maxTextChars = 500) {
|
|
|
3800
3806
|
const lines = [];
|
|
3801
3807
|
for (let i = 0; i < promptHistory.length; i++) {
|
|
3802
3808
|
const turn = promptHistory[i];
|
|
3803
|
-
const text = (turn?.text || "").trim();
|
|
3809
|
+
const text = (typeof turn === "string" ? turn : turn?.text || "").trim();
|
|
3804
3810
|
if (!text) continue;
|
|
3805
3811
|
let line = ` \u7B2C${i + 1}\u8F6E\u7528\u6237\u610F\u56FE: ${text.slice(0, maxTextChars)}`;
|
|
3806
|
-
const actions = turn?.actions;
|
|
3812
|
+
const actions = typeof turn === "string" ? void 0 : turn?.actions;
|
|
3807
3813
|
if (actions && actions.length > 0) {
|
|
3808
3814
|
const types = actions.map((a) => a?.actionType).filter((t) => typeof t === "string" && t.length > 0);
|
|
3809
3815
|
if (types.length > 0) {
|