Leo
c950778fdf
feat(mira/feed): WikiStatusBadge 加 🚫 放棄 狀態 + ↻ 重試
...
對應 wiki_giveup_scanner workflow (mira repo) 標 wiki-give-up tag 的 raw:
顯示 🚫 放棄 ↻ 按鈕,hover 解釋。點擊清 tag + 強制重 trigger。
leo 2026-05-17 反饋 C 落地:watcher 一直 fail 的 raw 不會無限重試了,
6h+ scanner 標給棄、UI 顯示給棄、用戶可手動修。
2026-05-17 11:36:54 +08:00
Leo
175a290730
feat(mira/feed): WikiStatusBadge 加手動重試按鈕
...
leo 2026-05-17 反饋:「漏了的要怎麼做?會自己慢慢完成還是要手動下令?」
自動行為解釋:
mira_feed_watcher cron 每 5 min 掃 tags=[] 的 raw 自動重試。
但若已被 mark wiki-processed (假處理),watcher 永遠跳過 → 需手動。
互動加:
- ⚠️ 漏了 變按鈕,click → 清 tag + 立即 trigger wiki_synthesis
- ✅ wiki 旁加小 ↻ icon,給「tag 標完成但實際沒 wiki」的情況用
- 點擊後 1 分鐘內顯示「⏳ 重試中」防 spam
UX 細節:
- title hover 解釋每個狀態跟動作
- retry 同時清 tag + 直接 trigger(不等下個 cron tick)
- 失敗 fail silently (catch all),1 min 後可再試
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com >
2026-05-17 11:26:24 +08:00
Leo
efdd75cbdc
feat(mira/feed): WikiStatusBadge — 顯示貼文 wiki 合成狀態 (leo 2026-05-17 反饋)
...
leo 反饋:「沒有符號顯示是否已建立 wiki,不知道是出錯了還是要等下一批」
新 component WikiStatusBadge 顯示在 PostCard header 來源/時間旁邊:
- ✅ wiki — tags 含 wiki-processed
- ⏳ 處理中 — 貼 < 6 分鐘前(cron 5 分鐘一輪,可能還沒撈到)
- ○ 排隊 — 6-30 分鐘(等下一個 tick)
- ⚠️ 漏了? — > 30 分鐘還沒處理(可能 wiki_synthesis 失敗)
Mira 自己貼文(type=wiki-page from showMira)不顯示 — 它本身就是 wiki。
資料來源純 client-side:mainBlocksList[0].tags_json + doc.created_at。
未來可加 click → 跳對應 wiki page,或 hover 顯示 entity 預覽。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com >
2026-05-17 09:53:19 +08:00
Leo
1084e0102a
fix(mira): wikilink autocomplete 5s cache + 開下拉時 refetch
...
leo 反饋:30s TTL 太久,wiki_synthesis 後台跑出新 entity,autocomplete 撈不到。
- TTL 30s → 5s
- WikilinkAutocomplete 在 matchInfo 從 null → 有值時主動 invalidate refetch
- 順手把 yaml-parser 對 FOREACH iterator relation 命名變體(「對每個 X」/「FOREACH X」)放行,graph-builder 早就支援,validate 卻擋掉
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com >
2026-05-16 13:37:03 +08:00
Leo
7da1eb6d65
feat(mira): [[entity]] wikilink — 顯式建檔 + autocomplete + render link
...
對應 tasks.md backlog #12 / design.md §3.6.2。leo 反饋:要像 Logseq 那樣
寫 [[X]] 立刻建檔,下次 [[X 自動補完,render 變連結。
helpers:
- parseWikilinks(text) → 抽 [[X]] entity list
- fetchAllEntityNames(apiKey) → 合 index-entry + wiki-page entity 名稱
- getEntityNamesCached → 30s session cache for autocomplete
- ensureEntitiesExist → 新 entity 立刻建 wiki-page placeholder
- tags 含 entity-type:book/url/concept(guessEntityType 推測:《》→ book / http → url)
- source: leo-explicit
- expandWikilinks(text) → render 時把 [[X]] 轉 markdown link to /mira/wiki/wiki-X
UI:
- <WikilinkAutocomplete>:textarea cursor 在 `[[query` 未閉合時,下拉顯示既存
entity(substring filter)+「⊕ 建立 [[query]]」option,↑↓選 / Enter 確認 /
Esc 取消。fixed-position below textarea bottom(cursor tracking 留下輪)
- PostComposer compact + popup 兩個 textarea 都掛 autocomplete
- EditingArea(PostEditor / BlockEditor / ReplyLine / PageReplyComposer 共用)
加 apiKey prop,內部 textarea + popup 都掛 autocomplete
submit hook:
- PostComposer.submit:postBlockId 建好後 ensureEntitiesExist(wikilinks)
- BlockEditor.submitReply / ReplyLine.submitReply 同樣建檔
- 在 wiki_synthesis trigger 前先建,避免 race
render:
- markdown.tsx expandWikilinks 取代 stripLogseqMeta 前處理(兩階段)
- 內部 wiki link(/mira/wiki/...)不開 _target=_blank(不離開頁面)
留下輪:metadata 補完 (作者/出版社) / cursor tracking / PostEditor.save 也建檔
2026-05-16 12:08:28 +08:00
Leo
d6bff9d551
fix(mira): reply @mira indicator + RAG match 寬鬆化
...
leo 試用反饋:
bug:reply 中 @mira 「看起來無效」
- 真正 root cause: trigger 確實 fire,但 thinking indicator 沒亮起 → leo 沒看到回應
以為失敗(其實 mira 後台跑 30s+ 才回)
- 修:MiraTriggerContext 把 thinking trigger 抽成 context callback
PostComposer / PostEditor / BlockEditor / ReplyLine 五個 @mira 觸發點
都呼叫 triggerThinking?.(docPageName) 啟動 5s polling
bug:RAG 抓不到 entity(leo 寫《李飛飛的視界之旅》沒被識別)
- 之前只看 type=index-entry,且嚴格 substring。新建 wiki 還沒 index-entry
時就漏;entity 名稱跟貼文文字稍微不同也漏
- 修 fetchRelevantWikiContext:
- 平行撈 index-entry + wiki-page 兩種,合併 entity set
- 雙向匹配:entity 完整 substring postContent(嚴格) OR
entity 內 3+ 字片段在 postContent 出現(寬鬆,中文友善)
- top 5(從 3 增加),給 mira 更多上下文
2026-05-16 11:43:28 +08:00
Leo
94368ec981
fix(mira): 4 bug — popup 在 edit / 思考 indicator 條件 / RAG / edit @mira
...
leo 試用 P0 後反饋的 4 個問題:
bug #1 : popup 編輯時沒有,更擠
- EditingArea 元件加 ⇱ 放大 button + popup overlay(共用 PostComposer 的 popup pattern)
- 影響:所有 edit / reply 模式現在都有放大編輯
bug #2 : Mira 思考中很久(即使沒 @mira)
- root cause: onAiTriggered(pageName) 在 PostComposer 永遠 fire,會在每篇貼文觸發
thinking indicator UI
- 修:移到 if (hasMiraMention) 分支內。沒 @mira → 不顯示 thinking
- wiki_synthesis 仍每篇都跑(背景靜默)但不顯示 thinking,避免 leo 誤會
bug #3 : Mira reply 不知道有 wiki,無狀態
- 加 fetchRelevantWikiContext: 撈所有 type=index-entry blocks,用 entity 名稱
keyword match against post content,取 top 3 整篇 markdown 餵進 prompt
- prompt 加規則「如果 leo 提到的 entity 你已有 wiki 知識,請主動引用」
- 對應 leo「應該以擁有知識庫的專人來回覆」
bug #4 : edit 時 @mira 沒反應
- PostEditor.save / BlockEditor.saveEdit / ReplyLine.save 三處都加 hasMiraMention 偵測
- 條件:新內容含 @mira 且舊版沒有 → 觸發(避免重複編輯重複 trigger)
placeholder 加 hint「@mira 呼叫 Mira 回覆」。
2026-05-16 11:07:34 +08:00
Leo
8d4c3a3464
feat(mira): P0 河道完善 3 task — Mira 頭像 / @mira 選擇性回覆 / 編輯器 popup
...
對應 tasks.md backlog #5a / #5b / #5c(leo 2026-05-16 P0),design.md §3.6.5。
#5a Mira 發文獨立頭像
- 新 MiraAvatar 元件(紫色漸層圓 + 🤖 emoji)
- isMiraSource() 判斷 post 來源是 leo(km-writer-direct/logseq/mobile/web/tg/rss)
還是 mira(ai-* / mira-* / 其他 test sources)
- PostCard header:showMira ? Mira 頭像 + 名「Mira」 : leo 頭像 + leo 名
#5b @mira 選擇性回覆(撤回每篇 auto-reply)
- 新 hasMiraMention() regex:偵測文字含 @mira(前後可有標點)
- PostComposer / BlockEditor / ReplyLine 三處 submit:只有 @mira 時 triggerAiReply
- triggerAiReply prompt 加 topic 抽取(@mira 後第一段到標點)+ scope hint
- wiki_synthesis trigger 跟 @mira 無關,每篇都跑(KB 副本同步)
- 不擋手動筆記(leo 隨手寫不需要 mira 每篇都回)
#5c 編輯器 popup 放大
- composer 加 ⇱ 放大按鈕 → 切到 fullscreen overlay popup
- popup 含大 textarea + 同 markdown toolbar + 同 submit 邏輯
- ⌘+Enter 發布、Esc 收起、外點 backdrop 收起
- 對應 leo「寫長文 textarea 太小」需求
CSS 加 .mira-avatar-mira / .mira-composer-popup-* 系列。
TS check pass。
2026-05-16 10:35:32 +08:00
Leo
bc6360ccfc
feat(arcrun): http_request body_json + error heuristic; mira feed fire-and-forget
...
http_request 零件擴展(registry/components/http_request):
- 加 body_json 物件欄位(內部 JSON.stringify),yaml 端不用手組 JSON 字串
- 新增 JSON 回應的 error 欄位偵測 → 若 body 含 `{"error":"..."}` 則零件回 success=false
解 cascade bug:mira_feed_watcher 用 http_request trigger wiki_synthesis,
原本 4xx response 也被當 success,ON_SUCCESS 鏈會誤觸發
根因架構債:host fn 沒回 HTTP status code(arcrun.md 列為 P1 follow-up)
landing 河道 feed (landing/app/mira/feed/page.tsx):
- 加回 triggerWikiSynthesis fire-and-forget 對 cypher.arcrun.dev/webhooks/named/
wiki_synthesis/trigger 公開觸發 endpoint(arcrun-native,非 mira-specific route)
- 不走 watcher 是因為 cypher-executor 自己 fetch 自己 workers.dev URL = CF 1042
self-fetch 擋
watcher 仍存在當 cron backup,但目前因 self-fetch 1042 不會真正觸發下游
wiki_synthesis(arcrun.md 列為 P1 follow-up)。
2026-05-14 16:06:46 +08:00
Leo
9560485937
feat(cypher): add scheduled() handler — arcrun-native cron 排程基建
...
對應 arcrun.md 三-A P1 #3。
緣由:cron 零件存在但只做 expression validation,沒有真正的排程跑。leo 指出
「邊用 arcrun 邊修,不要 workaround」— 撤回前一輪的 /mira/wiki-from-raw
mira-specific route(違反 mira CLAUDE.md §1.5 一律 arcrun-native),改補
真正的 cron infra。
加入:
- src/lib/cron-match.ts — 5 欄位 cron matcher(* / N / */N / a-b / a,b 組合)
- src/scheduled.ts — handler:掃 KV cron-idx: prefix,比對 controller.scheduledTime
→ executeWebhookGraph 背景跑
- routes/webhooks-named.ts — acr push 時偵測首節點 cron → 存 cron_expr 到 record
+ 額外寫 cron-idx:{api_key}:{name} 輕量索引;DELETE 一併清理
- src/index.ts — export default 改 { fetch, scheduled }
- wrangler.toml — [triggers] crons = ["* * * * *"](每分鐘 tick)
- wrangler.toml — workers_dev = true 供 self-fetch self-trigger 用
- tests/arcrun-test/cron_heartbeat.yaml — 健康監控 workflow(每分鐘 fire + set 節點)
撤回:
- 刪 src/routes/mira.ts(mira-specific workaround)
- types.ts 拿掉 MIRA_CONFIG
- index.ts 拿掉 miraRouter wire
- landing/app/mira/feed/page.tsx 拿掉 triggerWikiSynthesis 呼叫
下一輪:mira_feed_watcher.yaml(mira side),可能要先補 kbdb_get filter +
CALLS_SUBFLOW wire(arcrun.md 列為跟進)。
2026-05-14 14:04:57 +08:00
Leo
660b32eafd
feat(mira): 河道 → wiki 自動化(fire-and-forget 觸發 wiki_synthesis)
...
對應 polaris/mira/.agents/specs/mira-app/tasks.md 7B.3h(簡化版)。
原計畫用 arcrun cron 零件 → cypher-executor scheduled() handler,但發現
cron 零件只是 validator,cypher-executor 還沒實作 scheduled()。為了不擋
「河道書寫 → 自動產 wiki」這條 UX,先做 fire-and-forget 版本:
- 新 cypher-executor route POST /mira/wiki-from-raw
- body: { raw_block_id }
- server 端從 MIRA_CONFIG secret 補 partner key / mira_token / 三個 block IDs
- waitUntil 背景跑 executeWebhookGraph,立刻回 202
- landing 河道 post composer 成功寫 raw 後 fire-and-forget triggerWikiSynthesis()
跟既有 triggerAiReply() 同範式
- types.ts 加 MIRA_CONFIG?: string
部署後需手動:
echo '{"service_api_key":"ak_...","data_api_key":"ak_...","schema_block_id":"...","skill_block_id":"...","entities_block_id":"...","mira_token":"..."}' \
| wrangler secret put MIRA_CONFIG
UX:河道貼一則 → AI reply 30s 內 → wiki 60-90s 內出現在 /mira/wiki。
arcrun.md 記 P1 #3:cypher-executor 加 scheduled() handler,那是真正的
cron 路線,封測前不擋。
2026-05-14 13:50:13 +08:00
Leo
519423cb0d
feat(arcrun): mira wiki page with tag filter + accumulated WIP
...
- landing/app/mira/wiki: tag=mira-wiki list now shows all wiki paragraphs
(depends on KBDB tag filter exposed in matrix/kbdb commit, separate repo)
- landing: app/mira hub + feed split + various WIP from prior sessions
- registry/components: claude_api / kbdb_create_block / kbdb_get / km_writer /
platform_crypto / auth_oauth2 contracts + main.go (accumulated)
- .component-builds: pkg-lock updates + index.ts adjustments (WIP)
- .agents/specs/arcrun/frontend-redesign: design notes
- docs/test_credentials, docs/user_requirements/arcrun-landing-page: WIP docs
- cypher-executor: auth-dispatcher / wasi-shim adjustments (WIP)
Includes accumulated work from prior sessions plus the wiki UI tag-filter
update that surfaces the AI-generated wiki paragraphs at /mira/wiki.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com >
2026-05-07 16:52:01 +08:00