(chunk: Chunk)
| 1139 | // ─── Write ─── |
| 1140 | |
| 1141 | insertChunk(chunk: Chunk): void { |
| 1142 | const stmt = this.db.prepare(` |
| 1143 | INSERT OR REPLACE INTO chunks (id, session_key, turn_id, seq, role, content, kind, summary, task_id, content_hash, owner, dedup_status, dedup_target, dedup_reason, created_at, updated_at) |
| 1144 | VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) |
| 1145 | `); |
| 1146 | stmt.run( |
| 1147 | chunk.id, |
| 1148 | chunk.sessionKey, |
| 1149 | chunk.turnId, |
| 1150 | chunk.seq, |
| 1151 | chunk.role, |
| 1152 | chunk.content, |
| 1153 | chunk.kind, |
| 1154 | chunk.summary, |
| 1155 | chunk.taskId, |
| 1156 | contentHash(chunk.content), |
| 1157 | chunk.owner ?? "agent:main", |
| 1158 | chunk.dedupStatus ?? "active", |
| 1159 | chunk.dedupTarget ?? null, |
| 1160 | chunk.dedupReason ?? null, |
| 1161 | chunk.createdAt, |
| 1162 | chunk.updatedAt, |
| 1163 | ); |
| 1164 | } |
| 1165 | |
| 1166 | markDedupStatus(chunkId: string, status: "duplicate" | "merged", targetChunkId: string | null, reason: string): void { |
| 1167 | this.db.prepare( |
no test coverage detected