- mint_public_link:AI 只传文件名,core 在进程内直接 publicFiles.mint() 签出短命公网链接,返回单行 URL;校验 = base_url 已配 + resolveInTask 沙箱 + 确认是文件 + realpath 未跳出任务
目录
- 删除 routes/public-link.js 与 server.js 里的签发端口(PUBLIC_LINK_PORT/8081):该接口对 AI 已冗余(进程内签发不绕 HTTP,也不存在带不了凭据的问题);public_link 配置项收窄为 mint_public_link 的开关,不再监听额外端口
- 跟进:definitions.json/HANDLERS 注册;config.example.yml、config.js、public-files.js、download-token.js、routes/files.js 注释;ARCHITECTURE(目录树/部署图/关键约束/5.4 工具表)、DEPLOY 4.1、init.sh 自检改探 /p/<id>、两个 README(工具数 16、公网链接说明)
- 注:docker-compose.yml 一并带上此前工作区的 VIRTUAL_HOST/my-app-network 改动
364 lines
15 KiB
JSON
364 lines
15 KiB
JSON
[
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "copy_path",
|
|
"description": "Copies a file or directory to a new location, preserving the original. Directories are copied recursively.\n\nUse this tool when you need to duplicate a file or directory without modifying the original. It is more efficient than reading and writing contents manually. Returns confirmation on success.",
|
|
"parameters": {
|
|
"type": "object",
|
|
"required": ["source_path", "destination_path"],
|
|
"properties": {
|
|
"source_path": {
|
|
"type": "string",
|
|
"description": "Path of the file or directory to copy, relative to the session working directory. Absolute paths are also accepted."
|
|
},
|
|
"destination_path": {
|
|
"type": "string",
|
|
"description": "Destination path where the copy should be placed, relative to the session working directory. Absolute paths are also accepted."
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "create_directory",
|
|
"description": "Creates a new directory (and any missing parent directories) at the specified path. Returns confirmation on success.",
|
|
"parameters": {
|
|
"type": "object",
|
|
"required": ["path"],
|
|
"properties": {
|
|
"path": {
|
|
"type": "string",
|
|
"description": "Path of the directory to create, relative to the session working directory. Absolute paths are also accepted."
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "delete_path",
|
|
"description": "Deletes a file or directory (recursively) at the specified path. Returns confirmation on success.",
|
|
"parameters": {
|
|
"type": "object",
|
|
"required": ["path"],
|
|
"properties": {
|
|
"path": {
|
|
"type": "string",
|
|
"description": "Path of the file or directory to delete, relative to the session working directory. Absolute paths are also accepted."
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "edit_file",
|
|
"description": "This is a tool for applying edits to an existing file.\n\nBefore using this tool, use the `read_file` tool to understand the file's contents and context.\nTo create a new file or overwrite an existing one with completely new contents, use the `write_file` tool instead.\n\n`read_file` prefixes each line of its output with a line number right-aligned in a\n6-character field followed by a single tab, then the line's actual content. When you\nderive `old_text` or `new_text` from that output, strip this prefix and keep only what\ncomes after the tab, preserving the original indentation (tabs and spaces) exactly.\nNever include any part of the line number prefix in `old_text` or `new_text`.",
|
|
"parameters": {
|
|
"type": "object",
|
|
"required": ["path", "edits"],
|
|
"properties": {
|
|
"path": {
|
|
"type": "string",
|
|
"description": "Path of the file to edit, relative to the session working directory. Absolute paths are also accepted."
|
|
},
|
|
"edits": {
|
|
"type": "array",
|
|
"description": "List of edit operations to apply sequentially.",
|
|
"items": {
|
|
"type": "object",
|
|
"required": ["old_text", "new_text"],
|
|
"properties": {
|
|
"old_text": {
|
|
"type": "string",
|
|
"description": "The exact text to find in the file. Use enough context to make it unique."
|
|
},
|
|
"new_text": {
|
|
"type": "string",
|
|
"description": "The replacement text."
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "fetch",
|
|
"description": "Fetches a URL and returns the content as Markdown. The request may be subject to timeout and response size limits.",
|
|
"parameters": {
|
|
"type": "object",
|
|
"required": ["url"],
|
|
"properties": {
|
|
"url": {
|
|
"type": "string",
|
|
"description": "The URL to fetch."
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "find_path",
|
|
"description": "Finds file paths matching a glob pattern.\n\n- Supports patterns like \"**/*.js\" or \"src/**/*.ts\".\n- Returns matching paths sorted alphabetically.\n- Use `grep` instead when searching for file contents.\n- Results are paginated (50 per page); use `offset` to get more.",
|
|
"parameters": {
|
|
"type": "object",
|
|
"required": ["glob"],
|
|
"properties": {
|
|
"glob": {
|
|
"type": "string",
|
|
"description": "Glob pattern to match against file paths, relative to the session working directory."
|
|
},
|
|
"offset": {
|
|
"type": "integer",
|
|
"description": "Optional starting position for paginated results (0-based). Defaults to 0.",
|
|
"default": 0,
|
|
"minimum": 0
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "grep",
|
|
"description": "Searches file contents using a regular expression.\n\n- Prefer this tool when looking for symbols or text inside files, rather than guessing paths.\n- Supports full regex syntax.\n- Use `include_pattern` to limit which files are searched.\n- Results are paginated (20 per page); use `offset` for more.\n- Do not use HTML entities to escape characters.",
|
|
"parameters": {
|
|
"type": "object",
|
|
"required": ["regex"],
|
|
"properties": {
|
|
"regex": {
|
|
"type": "string",
|
|
"description": "Regular expression pattern to search for. Matches against file contents only."
|
|
},
|
|
"include_pattern": {
|
|
"type": "string",
|
|
"nullable": true,
|
|
"description": "Optional glob pattern to filter which files are searched (e.g., \"**/*.py\"). If omitted, all files are searched."
|
|
},
|
|
"offset": {
|
|
"type": "integer",
|
|
"description": "Optional starting position for paginated results (0-based). Defaults to 0.",
|
|
"default": 0,
|
|
"minimum": 0
|
|
},
|
|
"case_sensitive": {
|
|
"type": "boolean",
|
|
"description": "Whether the search is case-sensitive. Defaults to false (case-insensitive).",
|
|
"default": false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "list_directory",
|
|
"description": "Lists files and directories in a given path.\n\nUse this to see the contents of a directory. For searching by name or content, prefer `find_path` or `grep`.",
|
|
"parameters": {
|
|
"type": "object",
|
|
"properties": {
|
|
"path": {
|
|
"type": "string",
|
|
"description": "Path of the directory to list, relative to the session working directory. Absolute paths are also accepted. If empty or omitted, lists the current working directory (like `ls` with no argument)."
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "mint_public_link",
|
|
"description": "Create a short-lived, publicly reachable URL for a local file, so an external service that cannot authenticate can download it.\nUse this when another tool or API needs to fetch a local file by URL. Returns the URL as plain text on a single line.",
|
|
"parameters": {
|
|
"type": "object",
|
|
"required": ["path"],
|
|
"properties": {
|
|
"path": {
|
|
"type": "string",
|
|
"description": "Path of the file to publish, relative to the session working directory. Absolute paths inside the session working directory are also accepted."
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "move_path",
|
|
"description": "Moves or renames a file or directory, and returns confirmation that the move succeeded. If source and destination are in the same directory but with different names, this acts as a rename.",
|
|
"parameters": {
|
|
"type": "object",
|
|
"required": ["source_path", "destination_path"],
|
|
"properties": {
|
|
"source_path": {
|
|
"type": "string",
|
|
"description": "Path of the file or directory to move or rename, relative to the session working directory. Absolute paths are also accepted."
|
|
},
|
|
"destination_path": {
|
|
"type": "string",
|
|
"description": "Destination path after the move/rename, relative to the session working directory. Absolute paths are also accepted."
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "read_file",
|
|
"description": "Reads the content of a file.\n\n- For large text files, this tool may return an outline with symbol names and line numbers instead of the full content. This outline IS a successful response; use the line numbers to read specific sections with `start_line` and `end_line`.\n- Do NOT retry reading the same file without line numbers if you receive an outline.\n- Supports reading image files (PNG, JPEG, WebP, GIF, BMP, TIFF) and returns them as visual content you can analyze directly.\n- When reading text files, each line in the returned content is prefixed with a right-aligned line number field and a tab. When extracting text for use in `edit_file`, remove this prefix and keep only the content after the tab, preserving original indentation.",
|
|
"parameters": {
|
|
"type": "object",
|
|
"required": ["path"],
|
|
"properties": {
|
|
"path": {
|
|
"type": "string",
|
|
"description": "Path of the file to read, relative to the session working directory. Absolute paths are also accepted."
|
|
},
|
|
"start_line": {
|
|
"type": "integer",
|
|
"nullable": true,
|
|
"description": "Optional line number to start reading from (1-based).",
|
|
"default": null,
|
|
"minimum": 1
|
|
},
|
|
"end_line": {
|
|
"type": "integer",
|
|
"nullable": true,
|
|
"description": "Optional line number to end reading at (1-based, inclusive).",
|
|
"default": null,
|
|
"minimum": 1
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "terminal",
|
|
"description": "Executes a shell one-liner and returns combined stdout/stderr output.\n\n- Run commands relative to the session working directory. Use the `cd` parameter to specify a different directory if needed.\n- Do not use shell substitutions or interpolations (e.g., `$VAR`, `${VAR}`, `$(...)`, backticks). Resolve values yourself first.\n- Do not pipe output to `head` or `tail`; use the `head_lines` and `tail_lines` parameters to limit what is returned while keeping full output visible to the user.\n- Avoid commands that run indefinitely (servers, watchers). For long-running commands, set `timeout_ms`.\n- Each invocation starts a new shell; do not rely on state from previous calls.\n- If a command may open a pager or editor, disable it using environment variables (e.g., `GIT_PAGER=cat`, `EDITOR=true`).",
|
|
"parameters": {
|
|
"type": "object",
|
|
"required": ["command"],
|
|
"properties": {
|
|
"command": {
|
|
"type": "string",
|
|
"description": "The shell one-liner to execute. Do not include shell substitutions; use literal values."
|
|
},
|
|
"cd": {
|
|
"type": "string",
|
|
"nullable": true,
|
|
"description": "Optional working directory for the command. If omitted, runs in the session working directory. Accepts relative or absolute path."
|
|
},
|
|
"timeout_ms": {
|
|
"type": "integer",
|
|
"nullable": true,
|
|
"description": "Optional maximum runtime in milliseconds. If exceeded, the process is killed.",
|
|
"minimum": 0
|
|
},
|
|
"head_lines": {
|
|
"type": "integer",
|
|
"nullable": true,
|
|
"description": "Return only the first N lines of output to the model. The user still sees full live output.",
|
|
"minimum": 0,
|
|
"default": null
|
|
},
|
|
"tail_lines": {
|
|
"type": "integer",
|
|
"nullable": true,
|
|
"description": "Return only the last N lines of output to the model. The user still sees full live output.",
|
|
"minimum": 0,
|
|
"default": null
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "write_file",
|
|
"description": "Creates a new file or overwrites an existing file with the given content.\n\nUse `edit_file` for targeted changes to existing files. Before creating a new file, verify the parent directory exists with `list_directory`.",
|
|
"parameters": {
|
|
"type": "object",
|
|
"required": ["path", "content"],
|
|
"properties": {
|
|
"path": {
|
|
"type": "string",
|
|
"description": "Path of the file to create or overwrite, relative to the session working directory. Absolute paths are also accepted."
|
|
},
|
|
"content": {
|
|
"type": "string",
|
|
"description": "The entire content to write to the file."
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "list_skills",
|
|
"description": "Lists all available skills from the skill root directory, returning each skill's name and brief description.\n\nSkills are self-contained directories with a SKILL.md description and an executable entry point (run.py or run.sh). Use this tool to refresh or confirm the current list of available skills, then use get_skill_info for details or run_skill to execute.",
|
|
"parameters": {
|
|
"type": "object",
|
|
"required": [],
|
|
"properties": {}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "get_skill_info",
|
|
"description": "Returns the full content of the SKILL.md file for a given skill, including its purpose, parameters (input_schema), and usage instructions.",
|
|
"parameters": {
|
|
"type": "object",
|
|
"required": ["skill_name"],
|
|
"properties": {
|
|
"skill_name": {
|
|
"type": "string",
|
|
"description": "Name of the skill (subdirectory name under the skill root directory)."
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "run_skill",
|
|
"description": "Executes a specified skill with the provided input arguments. The skill's entry script receives a JSON string as the only command-line argument.\n\n- Required parameters are validated against the skill's input_schema.\n- Default timeout is 120 seconds.\n- Relative paths in arguments are resolved against the session working directory; you may pass relative or absolute paths.",
|
|
"parameters": {
|
|
"type": "object",
|
|
"required": ["skill_name", "input_args"],
|
|
"properties": {
|
|
"skill_name": {
|
|
"type": "string",
|
|
"description": "Name of the skill to execute."
|
|
},
|
|
"input_args": {
|
|
"type": "object",
|
|
"description": "Dictionary of input arguments for the skill. Keys and values should match the skill's input_schema. Example: {\"input\": \"file.md\", \"output\": \"out.pdf\"}."
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
]
|