Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
40 changes: 0 additions & 40 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

113 changes: 0 additions & 113 deletions packages/plugin-sdk/src/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45857,119 +45857,6 @@ export const contracts: {
},
resources: {},
},
glob: {
mode: 'query',
input: {
type: 'object',
additionalProperties: false,
properties: {
pattern: {
type: 'string',
minLength: 1,
},
cwd: {
type: 'string',
minLength: 1,
default: '.',
},
},
required: ['pattern'],
title: 'Input',
$schema: 'https://json-schema.org/draft/2020-12/schema',
},
output: {
oneOf: [
{
type: 'object',
additionalProperties: false,
properties: {
kind: {
type: 'string',
const: 'completed',
},
value: true,
},
required: ['kind', 'value'],
},
{
type: 'object',
additionalProperties: false,
properties: {
kind: {
type: 'string',
const: 'failed',
},
message: {
type: 'string',
},
},
required: ['kind', 'message'],
description:
'A known completed failure. Uncertain external effects use the original receipt.',
},
],
title: 'WorkspaceFileResult',
$schema: 'https://json-schema.org/draft/2020-12/schema',
},
resources: {},
},
grep: {
mode: 'query',
input: {
type: 'object',
additionalProperties: false,
properties: {
pattern: {
type: 'string',
},
path: {
type: 'string',
default: '.',
},
glob: {
type: 'string',
},
},
required: ['pattern'],
title: 'Input',
$schema: 'https://json-schema.org/draft/2020-12/schema',
},
output: {
oneOf: [
{
type: 'object',
additionalProperties: false,
properties: {
kind: {
type: 'string',
const: 'completed',
},
value: true,
},
required: ['kind', 'value'],
},
{
type: 'object',
additionalProperties: false,
properties: {
kind: {
type: 'string',
const: 'failed',
},
message: {
type: 'string',
},
},
required: ['kind', 'message'],
description:
'A known completed failure. Uncertain external effects use the original receipt.',
},
],
title: 'WorkspaceFileResult',
$schema: 'https://json-schema.org/draft/2020-12/schema',
},
resources: {},
},
publishChange: {
mode: 'mutation',
input: {
Expand Down
28 changes: 1 addition & 27 deletions platform/capabilities/src/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ pub enum Operation {
Read(ReadInput),
Write(Write),
Edit(Edit),
Glob(Glob),
Grep(Grep),
Patch(Patch),
Entries(entries::Operation),
}
Expand All @@ -91,22 +89,6 @@ pub struct Edit {
pub new_string: String,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct Glob {
pub pattern: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub cwd: Option<String>,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct Grep {
pub pattern: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub path: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub glob: Option<String>,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(tag = "type", rename_all = "snake_case", deny_unknown_fields)]
pub enum Patch {
CreateFile { path: String, diff: String },
Expand All @@ -116,24 +98,16 @@ pub enum Patch {
impl Operation {
pub fn is_read(&self) -> bool {
match self {
Self::Read(_) | Self::Glob(_) | Self::Grep(_) => true,
Self::Read(_) => true,
Self::Entries(operation) => operation.is_read(),
_ => false,
}
}
pub fn required_tool(&self) -> &'static str {
match self {
Self::Entries(operation) => operation.required_tool(),
_ => self.name(),
}
}
pub fn name(&self) -> &'static str {
match self {
Self::Read(_) => "Read",
Self::Write(_) => "Write",
Self::Edit(_) => "Edit",
Self::Glob(_) => "Glob",
Self::Grep(_) => "Grep",
Self::Patch(_) => "apply_patch",
Self::Entries(operation) => operation.name(),
}
Expand Down
8 changes: 0 additions & 8 deletions platform/capabilities/src/filesystem/entries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,6 @@ impl Operation {
pub fn is_read(&self) -> bool {
matches!(self, Self::Read(_) | Self::List(_) | Self::Stat { .. })
}
pub fn required_tool(&self) -> &'static str {
match self {
Self::Read(_) | Self::Stat { .. } => "Read",
Self::List(_) => "Glob",
Self::Write(_) | Self::CreateDirectory { .. } => "Write",
Self::Remove { .. } | Self::Rename { .. } | Self::Sync { .. } => "apply_patch",
}
}
pub fn name(&self) -> &'static str {
match self {
Self::Read(_) => "files.read_bytes",
Expand Down
2 changes: 1 addition & 1 deletion platform/presentation/src/shell/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use std::sync::Arc;
const MODEL_BYTES: usize = maka_plugin_core::terminal::PREVIEW_BYTES;
const TERMINAL_MARKER: &str = "[terminal snapshot truncated to fit the output limit]";
const FIELD_MARKER: &str = "[runtime resource field truncated]";
const RECOVERY: &str = "If the command is safe to re-run, redirect its output to a file (e.g. `cmd > out.txt 2>&1`) then Read or Grep that file for the omitted portion. If re-running could repeat side effects, do not. Otherwise work from the kept output above.";
const RECOVERY: &str = "If the command is safe to re-run, redirect its output to a file (e.g. `cmd > out.txt 2>&1`) then use Read on that file for the omitted portion. If re-running could repeat side effects, do not. Otherwise work from the kept output above.";

pub fn local_update(record: ShellRun) -> Result<ResourceUpdate, ProjectionError> {
project(record, true, None)
Expand Down
2 changes: 1 addition & 1 deletion plugins/agent/engine/src/history/references.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ pub(super) fn text(
let json = serde_json::to_string(references)
.map_err(|error| RunError::Internal(error.to_string()))?;
text.push_str("\n\n<directory_references>\n");
text.push_str(match language { Language::En => "Live directory paths on the originating Runtime Host, accessible with Glob/Read. The project and working directory are unchanged.\n", Language::ZhCn => "原始运行时主机上的实时目录路径,可通过 Glob/Read 访问。项目与工作目录不变。\n", Language::ZhTw => "原始執行階段主機上的即時目錄路徑,可透過 Glob/Read 存取。專案與工作目錄不變。\n" });
text.push_str(match language { Language::En => "Live directory paths on the originating Runtime Host, available to Shell and Read according to workspace permissions. The project and working directory are unchanged.\n", Language::ZhCn => "原始运行时主机上的实时目录路径,Shell 和 Read 可按工作区权限访问。项目与工作目录不变。\n", Language::ZhTw => "原始執行階段主機上的即時目錄路徑,Shell 和 Read 可依工作區權限存取。專案與工作目錄不變。\n" });
for character in json.chars() {
match character {
'<' => text.push_str("\\u003c"),
Expand Down
2 changes: 0 additions & 2 deletions plugins/agent/native/src/tools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,6 @@ fn catalog_inner(
"write" => Some(title::Kind::Write),
"edit" => Some(title::Kind::Edit),
"applyPatch" => Some(title::Kind::Patch),
"glob" => Some(title::Kind::Glob),
"grep" => Some(title::Kind::Grep),
_ => None,
}
} else if binding.contract() == &web_contract {
Expand Down
4 changes: 1 addition & 3 deletions plugins/agent/native/src/tools/title.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ pub(crate) enum Kind {
Patch,
Glob,
List,
Grep,
Fetch,
Search,
CreateSession,
Expand All @@ -45,7 +44,7 @@ impl Kind {
let target = match self {
Self::Read | Self::ReadImage | Self::Write | Self::Edit | Self::List => &input["path"],
Self::Patch => &input["operation"]["path"],
Self::Glob | Self::Grep => &input["pattern"],
Self::Glob => &input["pattern"],
Self::Fetch => &input["url"],
Self::CreateSession | Self::ForkSession => &input["title"],
Self::SendSession => &input["message"],
Expand Down Expand Up @@ -82,7 +81,6 @@ impl Kind {
Self::Patch => ("Patch file", "修补文件", "修補檔案"),
Self::Glob => ("Find files", "查找文件", "尋找檔案"),
Self::List => ("List directory", "列出目录", "列出目錄"),
Self::Grep => ("Search files", "搜索文件", "搜尋檔案"),
Self::Fetch => ("Read web page", "读取网页", "讀取網頁"),
Self::Search => ("Search the web", "搜索网络", "搜尋網路"),
Self::CreateSession => ("Create conversation", "创建会话", "建立對話"),
Expand Down
2 changes: 1 addition & 1 deletion plugins/agent/tool-catalog/src/availability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,6 @@ fn invalid() -> ToolRejection {
fn direct(name: &str) -> bool {
matches!(
name,
"Shell" | "Read" | "Glob" | "Grep" | "AskUserQuestion" | "ProcessStop" | "ProcessInput"
"Shell" | "Read" | "AskUserQuestion" | "ProcessStop" | "ProcessInput"
)
}
4 changes: 0 additions & 4 deletions plugins/workspace/api/src/files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ pub fn method(name: &str) -> Option<(&'static str, bool)> {
use maka_fs_tools::*;
Some(match name {
"readText" | "readImage" => (READ_NAME, false),
"glob" => (GLOB_NAME, false),
"grep" => (GREP_NAME, false),
"write" => (WRITE_NAME, true),
"edit" => (EDIT_NAME, true),
"applyPatch" => (PATCH_NAME, true),
Expand All @@ -54,8 +52,6 @@ pub fn contract() -> Contract {
let mut methods: BTreeMap<String, Method> = [
("readText", maka_fs_tools::read_schema()),
("readImage", maka_fs_tools::read_schema()),
("glob", maka_fs_tools::glob_schema()),
("grep", maka_fs_tools::grep_schema()),
("write", maka_fs_tools::write_schema()),
("edit", maka_fs_tools::edit_schema()),
("applyPatch", maka_fs_tools::patch_schema()),
Expand Down
3 changes: 0 additions & 3 deletions plugins/workspace/workspace-files/engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ cap-fs-ext.workspace = true
dunce = "1.0.5"
encoding_rs = "0.8.35"
flate2 = { version = "1.1.10", default-features = false, features = ["rust_backend"] }
glob = "0.3.4"
gix = { workspace = true, features = ["status", "worktree-mutation"] }
grep-searcher = "0.1.17"
grep-regex = "0.1.14"
ignore = "0.4.33"
imagesize.workspace = true
serde.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion plugins/workspace/workspace-files/engine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ Text reads scan the original authorized file descriptor once per page, retaining

`files` lists direct children through held directory capabilities and reports native invalidation hints. The caller supplies the original workspace identity, private Root/control paths and validated managed-worktree binding; caller paths cannot create that exception. `WorkspacePath` is shared with Git and preserves exact relative pathname bytes. Listing is live and bounded, with no snapshot cache. A watch registers the workspace-to-target directory chain before readiness, ignores read/access notifications, coalesces changes and revalidates names before delivery. The original worker must await `Watch::close` through normal native watch/callback cleanup, even after client cancellation. Native filesystem notifications are not a durable event history.

Grep and Glob return the complete matching set within their admitted scope. They buffer sources and results, check caller cancellation, and use iterative traversal with active-cycle detection; they impose no separate source-size, result-count, traversal-depth or whole-search deadline. Hidden, ignored, binary and symlink behavior remains part of each tool’s documented scope. Regex compilation retains the pinned library’s nesting and compiled-memory guards; this is not a promise to accept every mathematically valid regular expression. Current-file captures and readable write previews preserve complete original content. File listings use continuation pages with a soft byte target: one complete first entry can always advance. Git retains dependency representation limits and reduced-trust allocation policy; changing pathname length never grants repository authority.
Current-file captures and readable write previews preserve complete original content. File listings use continuation pages with a soft byte target: one complete first entry can always advance. Git retains dependency representation limits and reduced-trust allocation policy; changing pathname length never grants repository authority.

[Source](src/lib.rs) · [Cargo manifest](Cargo.toml)
2 changes: 1 addition & 1 deletion plugins/workspace/workspace-files/engine/README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@

`files` 通过持有的目录能力列出直接子项,并提供原生变更失效提示。调用方传入原工作区身份、私有 Root/control 路径及经过验证的受管 worktree 绑定;调用方路径不能自行创建这个例外。与 Git 共用的 `WorkspacePath` 保留准确的相对路径字节。列表采用有界实时分页,不保存快照缓存。监听在就绪前注册工作区到目标目录的祖先链,忽略读取/access 通知、合并变更,并在交付前重新校验目录名称。即使客户端取消,原 worker 也必须等待 `Watch::close` 完成正常的原生监听及回调清理。原生文件系统通知不是持久事件历史。

Grep 和 Glob 返回授权搜索范围内的完整匹配集合,保留完整源数据和结果,并通过迭代遍历及活动循环检测检查调用方取消;不再设置独立的源大小、结果数量、遍历层数或整次搜索期限。隐藏、忽略、二进制及符号链接仍遵循各工具声明的范围。正则编译保留所固定依赖的嵌套与编译内存保护,不承诺接受所有数学上有效的正则表达式。当前文件捕获和可读取的写入前内容保留完整原文。文件列表使用可继续的分页及软字节目标,完整首项始终可以推进。Git 仍受依赖表示范围及降低信任时的分配策略约束;路径长度不会授予仓库权限。
当前文件捕获和可读取的写入前内容保留完整原文。文件列表使用可继续的分页及软字节目标,完整首项始终可以推进。Git 仍受依赖表示范围及降低信任时的分配策略约束;路径长度不会授予仓库权限。

[源码](src/lib.rs) · [Cargo 配置](Cargo.toml)
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ fn disappeared(error: &io::Error) -> bool {
}

fn excluded(rules: &[[Gitignore; 4]], path: &Path, directory: bool) -> bool {
// Keep the same rule priority as Grep while allowing a nested negation to win.
// Let a nested negation override its parent rule.
for priority in 0..4 {
for layer in rules.iter().rev() {
let matched = layer[priority].matched_path_or_any_parents(path, directory);
Expand Down
Loading
Loading