Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
db5b957
feat(search): implement item search protocol
cocolord Nov 11, 2026
fd8750f
feat(search): align item search v1 protocol
cocolord Nov 12, 2026
c8f61f4
fix(search): align item search contracts and native grouping
cocolord Nov 17, 2026
569ae58
fix(search): avoid unused Item I/O and complete interface docs
cocolord Nov 17, 2026
8706e27
refactor(search): simplify Item Search implementation and review scope
cocolord Nov 17, 2026
f39356a
feat(search): adapt VikingDB Item Search and default to union
cocolord Nov 18, 2026
7f735d8
fix(search): isolate native item recall by account
cocolord Nov 19, 2026
cd21f27
fix(search): align Item Search backend and result contracts
cocolord Nov 19, 2026
8017f13
perf(search): fuse native Item Search in C++
cocolord Nov 23, 2026
8791968
fix(search): preserve destination Item declaration on ordinary-direct…
cocolord Nov 23, 2026
d6f83f1
refactor(search): remove dead query_items catalog op
cocolord Nov 23, 2026
47c0b47
fix(search): clear account Catalog and align VikingDB requests
cocolord Nov 24, 2026
d950e9b
fix(search): pass VikingDB item attribute filters through
cocolord Nov 24, 2026
25fc16a
fix(storage): share VikingDB Item operations with API key backend
cocolord Nov 24, 2026
d24d295
fix: declare VikingDB Items with explicit empty attrs
cocolord Nov 24, 2026
cb9b0fd
fix: support keyword and filter-only Item queries
cocolord Nov 24, 2026
7ec33f0
fix: share filter-only retrieval between search and find
cocolord Nov 24, 2026
2927dc3
fix: align Item filter ordering and simplify query branches
cocolord Nov 24, 2026
8ca786c
docs: align Item and ordinary filter-only retrieval contracts
cocolord Nov 24, 2026
c5f066f
fix: use API-key Item protocol without collection metadata
cocolord Nov 25, 2026
a49cf07
Merge upstream main into Item Search branch
cocolord Nov 26, 2026
23da995
fix(catalog): address CodeQL review comments
cocolord Nov 26, 2026
716c742
test(item-search): consolidate overlapping regression coverage
cocolord Nov 26, 2026
44f9707
fix(storage): route VikingDB queries by account partition
cocolord Nov 26, 2026
65ba240
fix(storage): preserve ordinary VikingDB query compatibility
cocolord Nov 26, 2026
350afa9
Merge upstream main into Item Search
cocolord Nov 26, 2026
36c4583
test(item-search): remove overlapping regression cases
cocolord Nov 26, 2026
833f0be
fix(item-search): store VikingDB Item identity on directory records
cocolord Nov 26, 2026
8c838f4
fix(item-search): roll back incomplete VikingDB mkdir
cocolord Nov 26, 2026
a721f47
fix(item-search): preserve ordinary behavior and Skill identity
cocolord Nov 26, 2026
dcd5a91
Merge remote-tracking branch 'origin/main' into codex/pr7815-test-cle…
cocolord Nov 26, 2026
cfec0f9
refactor(item-search): store only item declarations in native catalog
cocolord Nov 27, 2026
1468b76
fix(item-search): preserve transfer cleanup and keyword options
cocolord Nov 27, 2026
5338017
refactor(item-search): simplify grouped recall and verify directory l…
cocolord Nov 27, 2026
0652a67
refactor(catalog): share native Item declaration state
cocolord Nov 27, 2026
6275e2b
Merge main into Item Search branch
cocolord Nov 27, 2026
1d3f02e
fix: preserve ordinary storage behavior with Item Search
cocolord Nov 29, 2026
36c3e9c
refactor: simplify Item Search and share native projection
cocolord Nov 29, 2026
470ec61
docs: fix Item Search links in MCP guides
cocolord Nov 29, 2026
a0ccf62
fix: keep ordinary Skill replacement cleanup unchanged
cocolord Nov 29, 2026
85b3a44
refactor: simplify Skill Item writes and cleanup
cocolord Nov 29, 2026
90668d5
refactor: simplify Item declarations and subtree lifecycle
cocolord Nov 30, 2026
091715f
fix: restore MCP context defaults and local Item lifecycle
cocolord Nov 30, 2026
8b70953
fix(fs): keep Item mkdir retryable after lost replies
cocolord Nov 30, 2026
a683690
Merge main into Item Search
cocolord Nov 30, 2026
2cf2c82
refactor: trim unused Item Search branches
cocolord Nov 30, 2026
cb5f818
fix(item-search): filter groups and defer import declarations
cocolord Nov 30, 2026
47a3027
fix(item-search): remove Catalog reads from ordinary writes
cocolord Nov 30, 2026
3442172
test(item-search): consolidate overlapping coverage
cocolord Nov 30, 2026
dc0aef8
docs(item-search): consolidate guidance and verify the video example
cocolord Nov 30, 2026
72681e3
refactor(item-search): simplify Catalog inheritance and revisions
cocolord Nov 30, 2026
7a3ec07
fix(item-search): release index lock before candidate lookups
cocolord Nov 30, 2026
6a4fe98
perf(item-search): reuse resolved roots and shorten Catalog lock holds
cocolord Nov 30, 2026
09214ff
refactor(item-search): consolidate catalog operations and regression …
cocolord Nov 30, 2026
ecbdf07
refactor(item-search): derive Catalog activation from declarations
cocolord Nov 30, 2026
f3696a5
refactor(item-search): run native Item queries in one engine call
cocolord Dec 1, 2026
11489ee
docs(item-search): explain VikingDB filter-only limits
cocolord Dec 1, 2026
7da0d33
refactor(item-search): simplify retrieval and ingestion paths
cocolord Dec 1, 2026
d119a81
fix(item-search): scope native recall retries to matching paths
cocolord Dec 2, 2026
5111fa0
Align Item search tags and aggregation arguments
cocolord Dec 2, 2026
de697d9
perf(item-search): skip redundant root filters for covered paths
cocolord Dec 2, 2026
198b650
Merge main into Item search and preserve delegated search scope
cocolord Dec 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crates/ov_cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ ov cp -r viking://resources/docs viking://resources/docs-backup

`search --mode list` (the default) returns ranked hits. `search --mode context` assembles context using server defaults and prints its text; use `-o json` to retain the complete `entries`, `rendered`, `digest`, and `stats` result. Context mode supports `--events-time-decay-protection`, but rejects `--uri` and `--read-content`; `--level` is ignored by the server. Context-specific options such as `max_tokens` and `detail` are not exposed as CLI flags yet.

Use `--search-as-item` with `find` or `search --mode list` to return [Item roots](../../docs/en/api/06-retrieval.md#item-search-preview).

### Sessions And Memory

- `session new` - Create a session with optional event-memory tags and auto-commit policy.
Expand Down
2 changes: 2 additions & 0 deletions crates/ov_cli/README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ ov cp -r viking://resources/docs viking://resources/docs-backup

`search --mode list`(默认)返回排序命中列表。`search --mode context` 按服务端默认配置组装上下文并输出文本;使用 `-o json` 可保留完整的 `entries`、`rendered`、`digest` 和 `stats` 结果。context 模式支持 `--events-time-decay-protection`,但拒绝 `--uri` 和 `--read-content`,服务端会忽略 `--level`。CLI 暂未提供 `max_tokens`、`detail` 等 context 专用选项。

`find` 和 `search --mode list` 可用 `--search-as-item` 返回 [Item 根](../../docs/zh/api/06-retrieval.md#item-search-preview)。

### Session 与记忆

- `session new` - 创建 session,并可设置事件记忆默认 tags 和自动提交策略。
Expand Down
14 changes: 13 additions & 1 deletion crates/ov_cli/src/app/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ pub(super) async fn dispatch(
wait,
tags,
tag_mode,
as_item,
item_attrs,
acl,
strict_mode,
ignore_dirs,
Expand Down Expand Up @@ -87,6 +89,8 @@ pub(super) async fn dispatch(
resource_args,
tags,
tag_mode,
as_item,
item_attrs,
acl,
ctx,
)
Expand Down Expand Up @@ -553,8 +557,10 @@ pub(super) async fn dispatch(
Commands::Mkdir {
uri,
description,
as_item,
item_attrs,
acl,
} => handlers::handle_mkdir(uri, description, acl, ctx).await,
} => handlers::handle_mkdir(uri, description, as_item, item_attrs, acl, ctx).await,
Commands::Rm {
uri,
recursive,
Expand Down Expand Up @@ -785,6 +791,8 @@ pub(super) async fn dispatch(
tags,
read_content,
events_time_decay_protection,
item,
args,
} => {
handlers::handle_find(
query,
Expand All @@ -799,6 +807,8 @@ pub(super) async fn dispatch(
tags,
read_content,
events_time_decay_protection,
item,
args,
ctx,
)
.await
Expand All @@ -819,6 +829,7 @@ pub(super) async fn dispatch(
tags,
read_content,
events_time_decay_protection,
item,
args,
} => {
handlers::handle_search(
Expand All @@ -837,6 +848,7 @@ pub(super) async fn dispatch(
tags,
read_content,
events_time_decay_protection,
item,
args,
ctx,
)
Expand Down
103 changes: 102 additions & 1 deletion crates/ov_cli/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,71 @@ pub(crate) use upload::{UploadCliOptions, legacy_upload_option_error};
use crate::output::OutputFormat;
use clap::{ArgAction, Parser, Subcommand};

#[derive(clap::Args, Debug, Default)]
pub(crate) struct ItemSearchArgs {
/// Metadata filter as JSON; Item attributes use field=item_attrs
#[arg(
long,
value_name = "json",
value_parser = |s: &str| serde_json::from_str::<serde_json::Value>(s),
help_heading = "Advanced options"
)]
pub(crate) filter: Option<serde_json::Value>,
/// Group matching chunks by their declared Item root
#[arg(
long = "search-as-item",
conflicts_with_all = ["read_content", "events_time_decay_protection"],
help_heading = "Common options"
)]
pub(crate) search_as_item: bool,
/// Item score aggregation (default: max)
#[arg(
long,
value_parser = ["max", "sum"],
requires = "search_as_item",
value_name = "max|sum",
help_heading = "Common options"
)]
pub(crate) aggregation: Option<String>,
}

impl ItemSearchArgs {
pub(crate) fn accepts_empty_query(
&self,
context_types: Option<&[String]>,
tags: Option<&[String]>,
) -> bool {
self.search_as_item
&& (self.filter.is_some()
|| context_types.is_some_and(|values| !values.is_empty())
|| tags.is_some_and(|values| !values.is_empty()))
}

pub(crate) fn search_args(
&self,
mut args: Option<serde_json::Map<String, serde_json::Value>>,
) -> Option<serde_json::Map<String, serde_json::Value>> {
if let Some(op) = &self.aggregation {
args.get_or_insert_with(serde_json::Map::new)
.insert("aggregation".into(), serde_json::json!(op));
}
args
}
}

fn parse_item_attrs(input: &str) -> Result<serde_json::Value, String> {
let attrs: std::collections::BTreeMap<String, String> =
serde_json::from_str(input).map_err(|err| err.to_string())?;
if attrs.iter().any(|(key, value)| {
key.is_empty() || key.contains('=') || key.contains('\0') || value.contains('\0')
}) {
return Err(
"Item attributes cannot have empty keys, '=' in keys, or NUL characters.".to_string(),
);
}
Ok(serde_json::json!(attrs))
}

const MAX_TIME_DECAY_DURATION_DAYS: u128 = 3000 * 365;

/// Return the unchanged configuration name or a CLI usage error before contacting the server.
Expand Down Expand Up @@ -177,7 +242,7 @@ pub(crate) enum Commands {
"add_type", "to", "parent", "parent_auto_create",
"strict_mode", "ignore_dirs", "include", "exclude",
"no_directly_upload_media", "tags", "tag_mode", "acl",
"reason", "instruction"
"reason", "instruction", "as_item", "item_attrs"
]
)]
manifest: Option<String>,
Expand Down Expand Up @@ -283,6 +348,23 @@ pub(crate) enum Commands {
help_heading = "Common options"
)]
tag_mode: String,
/// Declare the imported resource root as an Item
#[arg(
long = "as-item",
conflicts_with = "manifest",
help_heading = "Common options"
)]
as_item: bool,
/// Immutable Item attributes as a flat JSON string map
#[arg(
long = "item-attrs",
value_name = "json",
requires = "as_item",
conflicts_with = "manifest",
value_parser = parse_item_attrs,
help_heading = "Common options"
)]
item_attrs: Option<serde_json::Value>,
#[command(flatten)]
upload_options: UploadCliOptions,
/// ACL JSON, for example {"acl_mode":"restricted","entries":[]}
Expand Down Expand Up @@ -529,6 +611,18 @@ pub(crate) enum Commands {
/// Initial directory description
#[arg(long, value_name = "text", help_heading = "Common options")]
description: Option<String>,
/// Declare this directory as an Item
#[arg(long = "as-item", help_heading = "Common options")]
as_item: bool,
/// Immutable Item attributes as a flat JSON string map
#[arg(
long = "item-attrs",
value_name = "json",
requires = "as_item",
value_parser = parse_item_attrs,
help_heading = "Common options"
)]
item_attrs: Option<serde_json::Value>,
/// ACL JSON, for example {"acl_mode":"restricted","entries":[]}
#[arg(long, value_parser = |s: &str| serde_json::from_str::<serde_json::Value>(s))]
acl: Option<serde_json::Value>,
Expand Down Expand Up @@ -766,6 +860,11 @@ pub(crate) enum Commands {
help_heading = "Advanced options"
)]
events_time_decay_protection: Option<String>,
#[command(flatten)]
item: ItemSearchArgs,
/// Advanced retrieval arguments such as {"aggregation":"sum"}
#[arg(long)]
args: Option<String>,
},
/// [Experimental][Data] Run context-aware retrieval
Search {
Expand Down Expand Up @@ -866,6 +965,8 @@ pub(crate) enum Commands {
/// JSON args for keyword search: {"bm25_k1":1.2,"bm25_b":0.75,"post_process_input_limit":1000}
#[arg(long, value_name = "json", help_heading = "Advanced options")]
args: Option<String>,
#[command(flatten)]
item: ItemSearchArgs,
},
/// [Data] Run content pattern search
Grep {
Expand Down
21 changes: 21 additions & 0 deletions crates/ov_cli/src/cli/tests/parsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,27 @@ fn cli_parses_search_image_with_query() {
}
}

#[test]
fn item_flags_require_opt_in() {
assert!(Cli::try_parse_from(["ov", "find", "beach", "--aggregation", "sum"]).is_err());
let cli = Cli::try_parse_from([
"ov",
"find",
"beach",
"--search-as-item",
"--aggregation",
"sum",
])
.expect("Item ranking options");
assert!(matches!(
cli.command,
Commands::Find {
item: crate::cli::ItemSearchArgs { search_as_item: true, aggregation: Some(ref value), .. },
..
} if value == "sum"
));
}

#[test]
fn cli_parses_grep_context_lines() {
let cli = Cli::try_parse_from([
Expand Down
48 changes: 47 additions & 1 deletion crates/ov_cli/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,8 @@ impl HttpClient {
&self,
uri: &str,
description: Option<&str>,
as_item: bool,
item_attrs: Option<Value>,
acl: Option<Value>,
) -> Result<serde_json::Value> {
let mut body = match description {
Expand All @@ -778,7 +780,27 @@ impl HttpClient {
if let Some(acl) = acl {
body["acl"] = acl;
}
self.post("/api/v1/fs/mkdir", &body).await
if as_item {
body["as_item"] = Value::Bool(true);
}
if let Some(item_attrs) = item_attrs {
body["item_attrs"] = item_attrs;
}
let result: Value = self.post("/api/v1/fs/mkdir", &body).await?;
if as_item
&& result
.get("item_uuid")
.and_then(Value::as_str)
.is_none_or(|value| value.trim().is_empty())
{
return Err(Error::Api {
code: Some("FAILED_PRECONDITION".to_string()),
message: "Server did not confirm the Item declaration. Upgrade the server and check the target URI; an ordinary directory may already have been created.".to_string(),
details: Some(serde_json::json!({"uri": uri, "stage": "item_declaration_confirmation"})),
status: None,
});
}
Ok(result)
}

pub async fn rm(
Expand Down Expand Up @@ -844,6 +866,9 @@ impl HttpClient {
tags: Option<Vec<String>>,
read_content: bool,
events_time_decay_protection: Option<String>,
filter: Option<&Value>,
search_as_item: bool,
args: Option<&Map<String, Value>>,
) -> Result<serde_json::Value> {
let image_url = normalize_image_input(image)?;
let mut body = serde_json::json!({
Expand All @@ -857,9 +882,12 @@ impl HttpClient {
"time_field": time_field,
"level": level,
"context_type": context_type,
"filter": filter,
"tags": tags,
"read_content": read_content.then_some(true),
"events_time_decay_protection": events_time_decay_protection,
"args": args,
"search_as_item": search_as_item.then_some(true),
});
compact_request_body(&mut body);
self.post("/api/v1/search/find", &body).await
Expand All @@ -883,6 +911,8 @@ impl HttpClient {
tags: Option<Vec<String>>,
read_content: bool,
events_time_decay_protection: Option<String>,
filter: Option<&Value>,
search_as_item: bool,
args: Option<&Map<String, Value>>,
) -> Result<serde_json::Value> {
let image_url = normalize_image_input(image)?;
Expand All @@ -901,10 +931,12 @@ impl HttpClient {
"time_field": time_field,
"level": level,
"context_type": context_type,
"filter": filter,
"tags": tags,
"read_content": read_content.then_some(true),
"events_time_decay_protection": events_time_decay_protection,
"args": args,
"search_as_item": search_as_item.then_some(true),
});
compact_request_body(&mut body);
self.post("/api/v1/search/search", &body).await
Expand Down Expand Up @@ -984,6 +1016,8 @@ impl HttpClient {
resource_args: Option<Map<String, Value>>,
tags: Vec<String>,
tag_mode: String,
as_item: bool,
item_attrs: Option<Value>,
acl: Option<Value>,
show_progress: bool,
verbose: bool,
Expand All @@ -1008,6 +1042,12 @@ impl HttpClient {
body["acl"] = acl.clone();
}
add_resource_tag_fields(&mut body, &tags, &tag_mode);
if as_item {
body["as_item"] = Value::Bool(true);
}
if let Some(item_attrs) = &item_attrs {
body["item_attrs"] = item_attrs.clone();
}
if create_parent {
body.as_object_mut()
.expect("add_resource request body must be an object")
Expand Down Expand Up @@ -2547,6 +2587,8 @@ mod tests {
args,
tags,
tag_mode.to_string(),
false,
None,
None,
false,
false,
Expand Down Expand Up @@ -2592,6 +2634,8 @@ mod tests {
false,
None,
None,
false,
None,
)
.await
.expect("list search should succeed");
Expand Down Expand Up @@ -2628,6 +2672,8 @@ mod tests {
false,
Some("7d".to_string()),
None,
false,
None,
)
.await
.expect("context search should succeed");
Expand Down
2 changes: 2 additions & 0 deletions crates/ov_cli/src/client/resource_wait_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ async fn submit(
None,
Vec::new(),
"replace".into(),
false,
None,
None,
false,
false,
Expand Down
Loading
Loading