Skip to content

Commit 987b789

Browse files
quangdang46claude
andcommitted
feat(hashline): integrate oh-my-pi hashline pipeline
- Bump hashline crate to latest HEAD (286b510) - Add global SnapshotStore (30 paths, 4 versions, 64MiB) - crates/jcode-app-core/src/tool/hashline_snapshots.rs - Add no-op loop guard (3 identical no-ops → error) - crates/jcode-app-core/src/tool/hashline_loop_guard.rs - read.rs: emit [path#TAG] header + record snapshots + seenLines - hashline_edit: drift detection via snapshot hash - edit.rs: optional tag field for str_replace hash verification - system_prompt: document hashline patch format Recovery engine (3-way merge + session-chain replay) deferred — std::sync::RwLock + .await Send issue. Use tokio::sync::RwLock when ready, or clone snapshot before await. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 5faf961 commit 987b789

9 files changed

Lines changed: 517 additions & 11 deletions

File tree

Cargo.lock

Lines changed: 137 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/jcode-app-core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ jcode-mempalace-adapter = { path = "../jcode-mempalace-adapter", optional = true
143143
flate2 = "1"
144144
tar = "0.4"
145145
tempfile = "3"
146-
hashline = { git = "https://github.com/quangdang46/hashline.git", rev = "1780f4b81333047323058041d3d0e64abce0c9ad", }
146+
hashline = { git = "https://github.com/quangdang46/hashline.git", rev = "286b5104aec108d2ddf4eb3d2c89e5c47ca5ccbc", }
147147
agentgrep = { git = "https://github.com/1jehuang/agentgrep.git", tag = "v0.1.3" }
148148
qrcode = { version = "0.14.1", default-features = false }
149149
# DCP integration (dynamic context pruning)

crates/jcode-app-core/src/tool/edit.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use super::{Tool, ToolContext, ToolOutput};
22
use crate::bus::{Bus, BusEvent, FileOp, FileTouch};
3+
use crate::tool::hashline_snapshots;
34
use anyhow::Result;
45
use async_trait::async_trait;
56
use hashline::{anchor, document::FileContent, hash as hashline_hash};
@@ -31,6 +32,10 @@ struct EditInput {
3132
new_string: String,
3233
#[serde(default)]
3334
replace_all: bool,
35+
/// Optional hashline tag for drift verification. When present, the current
36+
/// file hash must match the snapshot before any edit is applied.
37+
#[serde(default)]
38+
tag: Option<String>,
3439
}
3540

3641
/// Write `content` to `path` atomically via temp file + rename.

crates/jcode-app-core/src/tool/hashline_edit.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use super::{Tool, ToolContext, ToolOutput};
22
use crate::bus::{Bus, BusEvent, FileOp, FileTouch};
3+
use crate::tool::hashline_snapshots;
34
use anyhow::Result;
45
use async_trait::async_trait;
56
use hashline::{anchor, document::FileContent, hash as hashline_hash};
@@ -125,7 +126,7 @@ fn publish_edit_event(
125126
#[async_trait]
126127
impl Tool for HashlineEditTool {
127128
fn name(&self) -> &str {
128-
"ffs hashline_edit"
129+
"hashline_edit"
129130
}
130131

131132
fn description(&self) -> &str {

0 commit comments

Comments
 (0)