oh-my-adhd 0.2.4 β 0.2.6
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { getThreads, getThread, OPEN_SIGNAL, DONE_SIGNAL, extractFieldBrain } from "../../lib/brain.js";
|
|
2
|
+
import { getThreads, getThread, OPEN_SIGNAL, DONE_SIGNAL, extractFieldBrain, updateManifestEntry } from "../../lib/brain.js";
|
|
3
3
|
import { runConsolidationIfDue } from "../../lib/consolidate.js";
|
|
4
4
|
import { git } from "../utils.js";
|
|
5
5
|
export function registerWikiRecall(server) {
|
|
@@ -72,6 +72,16 @@ export function registerWikiRecall(server) {
|
|
|
72
72
|
const gapHours = isNaN(new Date(t.updatedAt).getTime())
|
|
73
73
|
? null
|
|
74
74
|
: Math.round((Date.now() - new Date(t.updatedAt).getTime()) / 3600000);
|
|
75
|
+
// Back-fill manifest cache so stop hook sees correct is_open next time
|
|
76
|
+
updateManifestEntry(t.id, {
|
|
77
|
+
is_open,
|
|
78
|
+
is_done: isDone,
|
|
79
|
+
capture_count,
|
|
80
|
+
last_action: last_action.slice(0, 160),
|
|
81
|
+
next_action: next_action || undefined,
|
|
82
|
+
blocker: blocker || undefined,
|
|
83
|
+
title,
|
|
84
|
+
}).catch(() => { });
|
|
75
85
|
return {
|
|
76
86
|
threadId: t.id,
|
|
77
87
|
title,
|
|
@@ -136,8 +146,16 @@ export function registerWikiRecall(server) {
|
|
|
136
146
|
// Lead entry β the most important thread, formatted as a direct question
|
|
137
147
|
const top = sorted[0];
|
|
138
148
|
const others = sorted.slice(1);
|
|
149
|
+
// Stale-open threads: split by depth of abandonment
|
|
150
|
+
const GHOST_THRESHOLD_H = 336; // 2 weeks
|
|
151
|
+
const topIsGhost = top.is_open && top.status === "stale" && (top.gap_hours ?? 0) >= GHOST_THRESHOLD_H;
|
|
139
152
|
// Lead section header
|
|
140
|
-
if (
|
|
153
|
+
if (topIsGhost) {
|
|
154
|
+
lines.push("## π μμ§λ ν κ±°μΌ?\n");
|
|
155
|
+
const weeks = top.gap_hours !== null ? Math.floor(top.gap_hours / 168) : null;
|
|
156
|
+
lines.push(`_${weeks ? `${weeks}μ£Ό` : "μ€λ«λμ"} λͺ» λ΄€μ΄. κ³μν 건μ§, μ 리ν κ±΄μ§ κ²°μ ν΄μ€._\n`);
|
|
157
|
+
}
|
|
158
|
+
else if (top.is_open) {
|
|
141
159
|
lines.push("## μ΄μ λ©μΆ κ³³\n");
|
|
142
160
|
}
|
|
143
161
|
else {
|
|
@@ -154,20 +172,40 @@ export function registerWikiRecall(server) {
|
|
|
154
172
|
if (top.blocker)
|
|
155
173
|
lines.push(`> β λ§νκ²: ${top.blocker}`);
|
|
156
174
|
// Call to action
|
|
157
|
-
|
|
158
|
-
|
|
175
|
+
lines.push(`>`);
|
|
176
|
+
if (topIsGhost) {
|
|
177
|
+
lines.push(`> β μ΄μ΄μ? \`wiki_dump({ threadId: "${top.threadId}", content: "κ³μ" })\``);
|
|
178
|
+
lines.push(`> β μ 리? \`wiki_dump({ threadId: "${top.threadId}", content: "κ²°μ : μ΄ νλ‘μ νΈ μ’
λ£" })\``);
|
|
179
|
+
}
|
|
180
|
+
else if (top.is_open) {
|
|
159
181
|
lines.push(`> μ΄μ΄μ κ°κΉ? (thread: \`${top.threadId}\`)`);
|
|
160
182
|
}
|
|
161
183
|
else {
|
|
162
|
-
lines.push(`>`);
|
|
163
184
|
lines.push(`> thread: \`${top.threadId}\``);
|
|
164
185
|
}
|
|
165
|
-
// Stale-open threads
|
|
166
|
-
const
|
|
186
|
+
// Stale-open threads: split by depth of abandonment
|
|
187
|
+
const ghostThreads = others.filter(t => t.is_open && t.status === "stale" && (t.gap_hours ?? 0) >= GHOST_THRESHOLD_H);
|
|
188
|
+
const forgottenThreads = others.filter(t => t.is_open && t.status === "stale" && (t.gap_hours ?? 0) < GHOST_THRESHOLD_H);
|
|
167
189
|
const activeOthers = others.filter(t => !(t.is_open && t.status === "stale"));
|
|
190
|
+
// Ghost projects: 2+ weeks untouched β direct question
|
|
191
|
+
if (ghostThreads.length > 0) {
|
|
192
|
+
lines.push("\n---");
|
|
193
|
+
lines.push("## π μμ§λ ν κ±°μΌ?");
|
|
194
|
+
lines.push(`_${Math.floor(GHOST_THRESHOLD_H / 168)}μ£Ό μ΄μ λͺ» λ΄€μ΄. κ³μν 건μ§, μ 리ν κ±΄μ§ κ²°μ ν΄μ€._`);
|
|
195
|
+
for (const t of ghostThreads) {
|
|
196
|
+
const weeks = t.gap_hours !== null ? Math.floor(t.gap_hours / 168) : null;
|
|
197
|
+
const gapStr = weeks !== null ? `${weeks}μ£Ό μ ` : "";
|
|
198
|
+
const preview = t.next_action || t.last_action?.replace(/^(?:κ²°μ |κ°μ€|λ§νκ²|λ€μν κ²|λΈλ‘컀|μμ½)\s*:\s*/i, "").slice(0, 80) || "";
|
|
199
|
+
lines.push(`π **${t.title}**${gapStr ? ` (${gapStr})` : ""}`);
|
|
200
|
+
if (preview)
|
|
201
|
+
lines.push(` λ§μ§λ§: ${preview}`);
|
|
202
|
+
lines.push(` β μ΄μ΄μ? \`wiki_dump({ threadId: "${t.threadId}", content: "κ³μ" })\``);
|
|
203
|
+
lines.push(` β μ 리? \`wiki_dump({ threadId: "${t.threadId}", content: "κ²°μ : μ΄ νλ‘μ νΈ μ’
λ£" })\``);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
168
206
|
if (forgottenThreads.length > 0) {
|
|
169
207
|
lines.push("\n---");
|
|
170
|
-
lines.push("## π μκ³ μλ κ±°
|
|
208
|
+
lines.push("## π μκ³ μλ κ±°");
|
|
171
209
|
for (const t of forgottenThreads) {
|
|
172
210
|
const gap = gapLabel(t.gap_hours);
|
|
173
211
|
const preview = t.next_action || t.last_action?.replace(/^(?:κ²°μ |κ°μ€|λ§νκ²|λ€μν κ²|λΈλ‘컀|μμ½)\s*:\s*/i, "").slice(0, 80) || "";
|
package/package.json
CHANGED