Phase 4c: Migrate thread history from JSONL to ocas variable store #18
Reference in New Issue
Block a user
Delete Branch "refactor/history-to-ocas-variable"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Migrate completed/cancelled thread history from
history.jsonlto ocas VariableStore (@uwf/history/<thread-id>).Why
Phase 4c of issue #11. After this, all persistent state (registry, threads, history) lives in the variable store — no more YAML or JSONL files.
Changes
store.ts
HISTORY_VAR_PREFIX+ sync functions:loadAllHistory,findHistoryEntry,addHistoryEntrymigrateHistoryIfNeeded(): readshistory.jsonl→ writes variables → renames.migratedloadThreadHistory,findThreadInHistory,appendThreadHistory,getHistoryPathCallers
cmdThreadList/Show/Cancel/Complete,archiveThread,resolveHeadHashall use varStorearchiveThreadnow syncVariable schema
@uwf/history/<thread-id>, Value: CAS head hashworkflow,completedAt,reason(completed|cancelled)Tests
Ref
Closes #11
LGTM ✅
Phase 4 收尾干净:
history.jsonlappend-only →@uwf/history/<thread-id>variable,metadata 用 tags(workflow,completedAt,reason)appendFile删除,addHistoryEntry同步写 variablefindHistoryEntry用exactNameprefix 查找单条,不需要扫全量parseHistoryJsonlLine抽出复用于迁移逻辑,好.migratedloadAllHistory的completedAt用Number(v.tags.completedAt ?? "0")— tags 只能存 string 所以需要转换,合理Phase 4 三刀全砍完,YAML + JSONL 全部消灭 ⚔️