@tekmidian/pai 0.8.2 → 0.8.4
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/index.mjs
CHANGED
|
@@ -3793,7 +3793,7 @@ function cmdLogs(opts) {
|
|
|
3793
3793
|
}
|
|
3794
3794
|
function registerDaemonCommands(daemonCmd) {
|
|
3795
3795
|
daemonCmd.command("serve").description("Start the PAI daemon in the foreground").action(async () => {
|
|
3796
|
-
const { serve } = await import("../daemon-
|
|
3796
|
+
const { serve } = await import("../daemon-nXyhvdzz.mjs").then((n) => n.t);
|
|
3797
3797
|
const { loadConfig: lc, ensureConfigDir } = await import("../config-BuhHWyOK.mjs").then((n) => n.r);
|
|
3798
3798
|
ensureConfigDir();
|
|
3799
3799
|
await serve(lc());
|
package/dist/daemon/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import "../indexer-D53l5d1U.mjs";
|
|
|
8
8
|
import { t as PaiClient } from "../ipc-client-CoyUHPod.mjs";
|
|
9
9
|
import { i as ensureConfigDir, o as loadConfig } from "../config-BuhHWyOK.mjs";
|
|
10
10
|
import "../factory-Ygqe_bVZ.mjs";
|
|
11
|
-
import { n as serve } from "../daemon-
|
|
11
|
+
import { n as serve } from "../daemon-nXyhvdzz.mjs";
|
|
12
12
|
import "../state-C6_vqz7w.mjs";
|
|
13
13
|
import "../tools-DcaJlYDN.mjs";
|
|
14
14
|
import "../detector-jGBuYQJM.mjs";
|
|
@@ -1820,12 +1820,19 @@ function extractTopic(summaryText) {
|
|
|
1820
1820
|
return match[1].trim();
|
|
1821
1821
|
}
|
|
1822
1822
|
/**
|
|
1823
|
-
* Extract the
|
|
1824
|
-
*
|
|
1823
|
+
* Extract the topic from an existing session note.
|
|
1824
|
+
* First checks for a <!-- TOPIC: ... --> comment (stored by previous summaries).
|
|
1825
|
+
* Falls back to the H1 "# Session NNNN: Title" line.
|
|
1826
|
+
*
|
|
1827
|
+
* The HTML comment is the reliable source because the H1 gets renamed by
|
|
1828
|
+
* renameSessionNote, which can add/change words and cause false topic shifts.
|
|
1825
1829
|
*/
|
|
1826
1830
|
function extractExistingNoteTitle(notePath) {
|
|
1827
1831
|
try {
|
|
1828
|
-
const
|
|
1832
|
+
const content = readFileSync(notePath, "utf-8");
|
|
1833
|
+
const topicComment = content.match(/<!-- TOPIC:\s*(.+?)\s*-->/);
|
|
1834
|
+
if (topicComment) return topicComment[1].trim();
|
|
1835
|
+
const match = content.match(/^# Session \d+:\s*(.+)$/m);
|
|
1829
1836
|
if (match) return match[1].trim();
|
|
1830
1837
|
} catch {}
|
|
1831
1838
|
return null;
|
|
@@ -1967,6 +1974,9 @@ function writeSessionNote(cwd, summaryText, filesModified) {
|
|
|
1967
1974
|
function updateNoteWithSummary(notePath, summaryText) {
|
|
1968
1975
|
if (!existsSync(notePath)) return;
|
|
1969
1976
|
let content = readFileSync(notePath, "utf-8");
|
|
1977
|
+
const newTopic = extractTopic(summaryText);
|
|
1978
|
+
if (newTopic) if (content.includes("<!-- TOPIC:")) content = content.replace(/<!-- TOPIC:.*?-->/, `<!-- TOPIC: ${newTopic} -->`);
|
|
1979
|
+
else content = content.replace(/^(# Session .+)$/m, `$1\n<!-- TOPIC: ${newTopic} -->`);
|
|
1970
1980
|
const workDoneMatch = summaryText.match(/## Work Done\n\n([\s\S]*?)(?=\n## Key Decisions|\n## Known Issues|\n\*\*Tags|\n$)/);
|
|
1971
1981
|
if (workDoneMatch) {
|
|
1972
1982
|
const aiWorkContent = workDoneMatch[1].trim();
|
|
@@ -2006,14 +2016,19 @@ function createNoteFromSummary(notesDir, summaryText) {
|
|
|
2006
2016
|
const numberMatch = noteFilename.match(/^(\d+)/);
|
|
2007
2017
|
const noteNumber = numberMatch ? numberMatch[1] : "0000";
|
|
2008
2018
|
const titleMatch = summaryText.match(/^# Session:\s*(.+)$/m);
|
|
2009
|
-
|
|
2019
|
+
const title = titleMatch ? titleMatch[1].trim() : "New Session";
|
|
2020
|
+
const date = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
2021
|
+
const topic = extractTopic(summaryText);
|
|
2022
|
+
const aiBody = summaryText.replace(/^TOPIC:.*$/m, "").replace(/^# Session:.*$/m, "").replace(/^\*\*Date:\*\*.*$/m, "").replace(/^\*\*Status:\*\*.*$/m, "").replace(/^---$/m, "").trim();
|
|
2023
|
+
writeFileSync(notePath, `# Session ${noteNumber}: ${title}
|
|
2024
|
+
${topic ? `<!-- TOPIC: ${topic} -->` : ""}
|
|
2010
2025
|
|
|
2011
|
-
**Date:** ${
|
|
2026
|
+
**Date:** ${date}
|
|
2012
2027
|
**Status:** In Progress
|
|
2013
2028
|
|
|
2014
2029
|
---
|
|
2015
2030
|
|
|
2016
|
-
${
|
|
2031
|
+
${aiBody}
|
|
2017
2032
|
|
|
2018
2033
|
---
|
|
2019
2034
|
|
|
@@ -3043,4 +3058,4 @@ var daemon_exports = /* @__PURE__ */ __exportAll({ serve: () => serve });
|
|
|
3043
3058
|
|
|
3044
3059
|
//#endregion
|
|
3045
3060
|
export { serve as n, daemon_exports as t };
|
|
3046
|
-
//# sourceMappingURL=daemon-
|
|
3061
|
+
//# sourceMappingURL=daemon-nXyhvdzz.mjs.map
|