refactor(opencode): single source of discovery docs, clearer attachment wording

- Reword the attachment line in the execute description: attachments are
  opaque media handles you forward to the user, not byte-readable in code.
- Strip the hardcoded tools.$rune.search/describe block from the runtime's
  instructions(): discovery is not a runtime feature (the embedder registers
  and documents it), and the baked-in object-arg form contradicted code
  mode's positional API. Removes the only prompt discrepancy.
- Make the runtime's unknown-tool suggestion generic instead of naming $rune.

Discovery is now documented in exactly one place (code-mode describe()).
This commit is contained in:
Aiden Cline
2026-06-30 13:59:33 -05:00
parent a3bfba809f
commit cbcc67b1e2
2 changed files with 7 additions and 13 deletions
+3 -3
View File
@@ -181,9 +181,9 @@ export function describe(groups: Map<string, CatalogEntry[]>): string {
"- Call a tool by its path: `await tools.<server>.<tool>(input)`. Each resolves to `{ result, attachments? }`.",
"",
"Every tool call and your final `return` use the same envelope: `{ result, attachments? }`.",
"`result` is the structured data; `attachments` carries images/files for the user. Return a whole tool",
"result to forward its attachments, or return only its `.result` to drop the media. You cannot read the",
"contents of an attachment in code — only pass it along.",
"`result` is the structured data you compute over; `attachments` carry media (images, files) to show",
"the user. Return a tool's whole result to keep its attachments, or return just its `.result` to drop",
"them. Attachments are opaque handles — pass them through; their bytes aren't available in code.",
"",
"Compose multiple calls in one program and `return` the final value — intermediate results stay in the",
"sandbox and never re-enter the conversation. Use `tools.$rune.search('', { namespace })` to list a namespace.",