内置命令说明
软件包会为其命令、方法和元素添加同类注释,与其示例一同显示。软件包文件会在每个条目下方显示这些注释:
- `->push(items...): list` A new list with items added to the end.
- pitfall: Returns a new list and leaves the old one alone: write items = $items->push($x).
- e.g. `[1, 2]->push(3, 4)`
- `@api(url: string, options?: map): response` Makes an HTTP request and returns the response.
- `options.timeout: duration` Maximum wait for an outbound HTTP(S) request. Example `30s`.
- prefer: @api($url, as: Type) (the same as ->check()->convert(from: json, as: Type)) to fail fast and check the data's shape.
- pitfall: A 4xx or 5xx status doesn't throw: chain ->check() (throws Network) or test .is_ok.用 C# 编写的包通过 p.AgentNotes(("list->push", new AgentNotes(pitfall: "..."))) 添加它们,键形式为 p.Examples("@api"、"list->push",或用于元素的 "<input>")。每条注释保持在一行之内,因为智能体会读取所有注释。