Skip to main content

Crate ocserve_tools

Crate ocserve_tools 

Source
Expand description

ocserve-tools: v1 tool names + permission evaluation (PLAN §11: v1 names kept; no v2 renames). Wildcard/evaluate ported from v1 util/wildcard.ts and core/permission.ts; tool params verified against v1 sources + live tool-part capture (testdata/m2).

Modules§

bash_patterns
Bash command → permission patterns (upstream permission/arity.ts parity).
permission_asks
Tool → permission ask sequence (upstream tool-call ctx.ask() parity).
shell_prompt
The bash tool description is TEMPLATED upstream (tool/shell/prompt.ts ShellPrompt.render): ${os}, ${shell}, ${tmp}, and a generated command section are substituted at runtime. A capture therefore bakes in the capturing host’s values — never ship that. This mirrors the upstream template so the description is correct on the running host (K-CAPDIFF: capdiff compares description bytes too; a stale/host-baked string is red).

Structs§

Rule
v1 permission evaluation: find LAST rule matching (permission, resource); default = ask (core/permission.ts evaluate()).
ToolResult

Constants§

IMPLEMENTED
Tools ocserve executes. Advertised tool list = the intersection of these names and the frozen provider-tools.json (D-TOOLS-TASK: task is advertised upstream but not yet executed here, so it is excluded until implemented — see bench/openapi/FIELD-CONTRACT.md).
MAX_BYTES
MAX_LINES
Truncation (v1 shell: MAX_LINES/MAX_BYTES constants).
QUESTION_DESCRIPTION
v1 tool/question.txt — model-facing contract for the question tool (verbatim: prompt_loop routes question to the QuestionGate, never to execute()).

Functions§

evaluate
execute
Execute a tool by v1 name. cwd scopes relative paths.
schemas
Provider tool schemas, filtered to IMPLEMENTED (deny filtering happens in the caller). Order matches the frozen capture.
wildcard_match
v1 Wildcard.match: glob → regex, \→/, trailing “ *“ tail optional.