Add semantic hash table tools, lock scaffolding, and H2 dual-hash migration scaffold

This commit is contained in:
Bill
2026-02-24 11:13:31 -07:00
parent 1a761c62e5
commit f4f3633b11
12 changed files with 665 additions and 6 deletions

View File

@@ -39,6 +39,77 @@
[this](const json& args) {
return callWhetstone("listAnnotatedFiles", args);
};
// whetstone_save_semantic_hash_table
tools_.push_back({"whetstone_save_semantic_hash_table",
"Compute and persist semantic hash table sidecar for the current "
"buffer. Uses SemAnno/Whetstone semantic primitives as hash inputs.",
{{"type", "object"}, {"properties", {
{"path", {{"type", "string"},
{"description", "Buffer path to save semantic hash table for"}}}
}}}
});
toolHandlers_["whetstone_save_semantic_hash_table"] =
[this](const json& args) {
return callWhetstone("saveSemanticHashTable", args);
};
// whetstone_get_semantic_hash_table
tools_.push_back({"whetstone_get_semantic_hash_table",
"Read semantic hash table sidecar for a file. Set refresh=true "
"to recompute from live AST before reading.",
{{"type", "object"}, {"properties", {
{"path", {{"type", "string"},
{"description", "Buffer path to read semantic hash table for"}}},
{"refresh", {{"type", "boolean"},
{"description", "Recompute hash table from AST before read"}}}
}}}
});
toolHandlers_["whetstone_get_semantic_hash_table"] =
[this](const json& args) {
return callWhetstone("getSemanticHashTable", args);
};
// whetstone_list_semantic_hash_tables
tools_.push_back({"whetstone_list_semantic_hash_tables",
"List all semantic hash table sidecar files in the workspace.",
{{"type", "object"}, {"properties", json::object()}}
});
toolHandlers_["whetstone_list_semantic_hash_tables"] =
[this](const json& args) {
return callWhetstone("listSemanticHashTables", args);
};
// whetstone_set_semantic_hash_lock
tools_.push_back({"whetstone_set_semantic_hash_lock",
"Set hash lock state on an AST node (locked/unlocked) with "
"optional reason. This is scaffolding metadata for lock policy.",
{{"type", "object"}, {"properties", {
{"nodeId", {{"type", "string"},
{"description", "AST node ID"}}},
{"locked", {{"type", "boolean"},
{"description", "true=locked, false=unlocked"}}},
{"reason", {{"type", "string"},
{"description", "Optional lock rationale"}}}
}}, {"required", {"nodeId", "locked"}}}
});
toolHandlers_["whetstone_set_semantic_hash_lock"] =
[this](const json& args) {
return callWhetstone("setSemanticHashLock", args);
};
// whetstone_get_semantic_hash_lock
tools_.push_back({"whetstone_get_semantic_hash_lock",
"Get semantic hash lock metadata for an AST node.",
{{"type", "object"}, {"properties", {
{"nodeId", {{"type", "string"},
{"description", "AST node ID"}}}
}}, {"required", {"nodeId"}}}
});
toolHandlers_["whetstone_get_semantic_hash_lock"] =
[this](const json& args) {
return callWhetstone("getSemanticHashLock", args);
};
}
// ---------------------------------------------------------------