From a9a5ebd78ef4d975fe4cce817ea7c6948588b732 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 4 Dec 2026 12:59:53 +0100 Subject: feat(assistant): Memory section, git status and commit-and-push Co-Authored-By: Claude Opus 5.5 --- desktop/modules/assistant/AssistantModule.qml | 15 +++++++++++++++ desktop/modules/assistant/AssistantPage.qml | 25 +++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/desktop/modules/assistant/AssistantModule.qml b/desktop/modules/assistant/AssistantModule.qml index 49e8c7b..f493aa7 100644 --- a/desktop/modules/assistant/AssistantModule.qml +++ b/desktop/modules/assistant/AssistantModule.qml @@ -125,6 +125,7 @@ Module { function refresh() { fv.reload(); am.listTools(); + am.memoryStatus(); am.listModels(); if (Object.keys(am.defaults).length === 0) am.run([am.python, am.daemonDir + "/assistant.py", "--defaults"], null, (code, out) => { @@ -273,6 +274,20 @@ Module { }); } + // memory.py status for the Memory section: {dir, repo, last_commit, + // push_error, dirty}. sync returns at once and pushes detached, so the + // status is read again a moment later. + property var memory: ({}) + readonly property string memoryPy: am.toolsDir + "/memory.py" + function memoryStatus() { + am.run([am.python, am.memoryPy, "status"], null, (code, out) => { + try { am.memory = code === 0 ? JSON.parse(out) : {}; } catch (e) { am.memory = {}; } + }); + } + function memorySync() { am.run([am.python, am.memoryPy, "sync"], null, () => memoryAgain.restart()); } + property Timer memoryAgain: Timer { interval: 3000; onTriggered: am.memoryStatus() } + function openMemory() { if (am.memory.dir) Quickshell.execDetached(["typora", am.memory.dir]); } + // Whether a tool is on in the draft: its wanted state, else the file's. function toolOn(t) { return am.toolsWanted[t.name] ?? t.on; } function toggleTool(t) { diff --git a/desktop/modules/assistant/AssistantPage.qml b/desktop/modules/assistant/AssistantPage.qml index 7691cb5..ab913ba 100644 --- a/desktop/modules/assistant/AssistantPage.qml +++ b/desktop/modules/assistant/AssistantPage.qml @@ -674,6 +674,31 @@ Column { } } + // --- memory --- + + Heading { text: "Memory" } + Small { + readonly property var m: page.asst.memory + width: page.width + wrapMode: Text.Wrap + text: !m.repo ? "The memory folder is not a git repo yet (memory spec, setup)." + : (m.last_commit ? "Last commit " + new Date(m.last_commit * 1000).toLocaleString(Qt.locale(), Locale.ShortFormat) + : "No commits yet") + + (m.dirty ? ", uncommitted changes" : "") + } + Small { + width: page.width + visible: !!page.asst.memory.push_error + wrapMode: Text.Wrap + text: "Push failed: " + (page.asst.memory.push_error ?? "") + color: Theme.red + } + Row { + spacing: 6 + Button { text: "Commit and push now"; enabled: !!page.asst.memory.repo; onClicked: page.asst.memorySync() } + Button { text: "Open in Typora"; enabled: !!page.asst.memory.dir; onClicked: page.asst.openMemory() } + } + // --- tools --- Heading { text: "Tools" } -- cgit v1.2.3