@tryarcanist/cli 0.1.76 → 0.1.77
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/index.js +44 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -885,13 +885,50 @@ function projectBranchChanged(data, index) {
|
|
|
885
885
|
}
|
|
886
886
|
function projectMemoryUsage(data, index) {
|
|
887
887
|
const activeMemoryIds = Array.isArray(data?.activeMemoryIds) ? data.activeMemoryIds.filter((id) => typeof id === "string" && id.trim().length > 0) : [];
|
|
888
|
+
const activeMemories = mergeMemoryRefs(activeMemoryIds, data?.activeMemories);
|
|
888
889
|
return {
|
|
889
890
|
type: "memory_usage",
|
|
890
891
|
id: `mem-${data?.timestamp ?? index}`,
|
|
891
892
|
activeMemoryIds,
|
|
893
|
+
activeMemories,
|
|
892
894
|
...resolvePromptId(data) ? { promptId: resolvePromptId(data) } : {}
|
|
893
895
|
};
|
|
894
896
|
}
|
|
897
|
+
function projectMemoryRecallUsage(data, index) {
|
|
898
|
+
const requestedMemoryIds = Array.isArray(data?.requestedMemoryIds) ? data.requestedMemoryIds.filter((id) => typeof id === "string" && id.trim().length > 0) : [];
|
|
899
|
+
const returnedMemoryIds = Array.isArray(data?.returnedMemoryIds) ? data.returnedMemoryIds.filter((id) => typeof id === "string" && id.trim().length > 0) : [];
|
|
900
|
+
const requestedMemories = mergeMemoryRefs(requestedMemoryIds, data?.requestedMemories);
|
|
901
|
+
const returnedMemories = mergeMemoryRefs(returnedMemoryIds, data?.returnedMemories);
|
|
902
|
+
const eventName = typeof data?.eventName === "string" ? data.eventName : "memory_recall.returned";
|
|
903
|
+
return {
|
|
904
|
+
type: "memory_recall_usage",
|
|
905
|
+
id: `mrec-${data?.timestamp ?? index}-${eventName}`,
|
|
906
|
+
eventName,
|
|
907
|
+
requestedMemoryIds,
|
|
908
|
+
returnedMemoryIds,
|
|
909
|
+
requestedMemories,
|
|
910
|
+
returnedMemories,
|
|
911
|
+
...typeof data?.intent === "string" && data.intent.trim() ? { intent: data.intent.trim() } : {},
|
|
912
|
+
...typeof data?.tool === "string" && data.tool.trim() ? { tool: data.tool.trim() } : {},
|
|
913
|
+
...resolvePromptId(data) ? { promptId: resolvePromptId(data) } : {}
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
function mergeMemoryRefs(ids, rawRefs) {
|
|
917
|
+
const byId = /* @__PURE__ */ new Map();
|
|
918
|
+
if (Array.isArray(rawRefs)) {
|
|
919
|
+
for (const entry of rawRefs) {
|
|
920
|
+
if (!entry || typeof entry !== "object") continue;
|
|
921
|
+
const record = entry;
|
|
922
|
+
const id = typeof record.id === "string" ? record.id.trim() : "";
|
|
923
|
+
if (!id) continue;
|
|
924
|
+
const ref = { id };
|
|
925
|
+
if (typeof record.path === "string" && record.path.trim()) ref.path = record.path.trim();
|
|
926
|
+
if (typeof record.title === "string" && record.title.trim()) ref.title = record.title.trim();
|
|
927
|
+
byId.set(id, ref);
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
return ids.map((id) => byId.get(id) ?? { id });
|
|
931
|
+
}
|
|
895
932
|
function projectAgentTimeline(data, index) {
|
|
896
933
|
return {
|
|
897
934
|
type: "agent_timeline",
|
|
@@ -1095,6 +1132,9 @@ function flattenSessionEvents(raw) {
|
|
|
1095
1132
|
case "memory_usage":
|
|
1096
1133
|
pushEvent(state, projectMemoryUsage(data, state.merged.length));
|
|
1097
1134
|
break;
|
|
1135
|
+
case "memory_recall_usage":
|
|
1136
|
+
pushEvent(state, projectMemoryRecallUsage(data, state.merged.length));
|
|
1137
|
+
break;
|
|
1098
1138
|
case "agent_timeline":
|
|
1099
1139
|
pushEvent(state, projectAgentTimeline(data, state.merged.length));
|
|
1100
1140
|
break;
|
|
@@ -1375,7 +1415,10 @@ ${event.answer ? `**Answer:** ${event.answer}
|
|
|
1375
1415
|
return `*[switched to branch \`${event.branch}\`]*
|
|
1376
1416
|
`;
|
|
1377
1417
|
case "memory_usage":
|
|
1378
|
-
return event.activeMemoryIds.length > 0 ? `*[used ${event.activeMemoryIds.length === 1 ? "1 memory" : `${event.activeMemoryIds.length} memories`}: ${event.
|
|
1418
|
+
return event.activeMemoryIds.length > 0 ? `*[used ${event.activeMemoryIds.length === 1 ? "1 memory" : `${event.activeMemoryIds.length} memories`}: ${event.activeMemories.map((memory) => `\`${memory.title || memory.id}\``).join(", ")}]*
|
|
1419
|
+
` : "";
|
|
1420
|
+
case "memory_recall_usage":
|
|
1421
|
+
return event.returnedMemoryIds.length > 0 ? `*[recalled ${event.returnedMemoryIds.length === 1 ? "1 memory" : `${event.returnedMemoryIds.length} memories`}: ${event.returnedMemories.map((memory) => `\`${memory.title || memory.id}\``).join(", ")}]*
|
|
1379
1422
|
` : "";
|
|
1380
1423
|
case "agent_timeline":
|
|
1381
1424
|
return `*[${event.eventType}${event.status ? ` (${event.status})` : ""}: ${event.summary}]*
|