3c7c6695f2
Adds two STM components and a transparent cache hook in the agent loop so
read-only tools don't re-do work the agent already did in this session.
New STM components:
- ToolResultsCache — {tool_name: {key: result}}, session-scoped.
to_dict() exposes only the key inventory (not payloads) to keep the
prompt cheap.
- ReleaseFocus — current_release_path + working_set list, updated
automatically when a path-keyed inspector runs.
YAML spec layer:
- New optional 'cache: { key: <param_name> }' block in ToolSpec.
- Validated at load time: cache.key must be a declared parameter.
- Surfaced on Tool dataclass as cache_key: str | None.
Agent._execute_tool_call:
- Pre-exec cache lookup; hit short-circuits and adds _from_cache=true.
- Post-exec: stores successful results, updates release_focus for
path-keyed tools, refreshes episodic.last_search_results when
find_torrent's hit served the response (so get_torrent_by_index
keeps pointing at the right list).
Cacheable tools (5): analyze_release, probe_media, list_folder,
find_media_imdb_id, find_torrent.
64 lines
2.0 KiB
YAML
64 lines
2.0 KiB
YAML
name: list_folder
|
|
|
|
summary: >
|
|
List the contents of a configured folder, optionally below a
|
|
relative subpath.
|
|
|
|
description: |
|
|
Reads a folder previously configured via set_path_for_folder and
|
|
returns its entries (files + directories). A relative `path` lets you
|
|
drill down without re-specifying the absolute root each time. Path
|
|
traversal is rejected (no `..`, no absolute paths) so the agent
|
|
cannot escape the configured root.
|
|
|
|
when_to_use: |
|
|
- At the start of an organize workflow to discover what's available
|
|
in the download folder.
|
|
- To browse a library collection ("what tv shows do I have?").
|
|
- As a sanity check before any move to confirm the target exists.
|
|
|
|
when_not_to_use: |
|
|
- For folders that are not configured — call set_path_for_folder
|
|
first.
|
|
- To list arbitrary system paths — this tool is intentionally scoped
|
|
to the known roots.
|
|
|
|
next_steps: |
|
|
- After listing the download folder: typically call analyze_release
|
|
on a specific entry.
|
|
- After listing a library folder: use the result to disambiguate a
|
|
destination during resolve_*_destination.
|
|
|
|
cache:
|
|
key: path
|
|
|
|
parameters:
|
|
folder_type:
|
|
description: Logical folder key (download, torrent, movie, tv_show, ...).
|
|
why_needed: |
|
|
Resolves to an absolute root through LTM. Must have been set via
|
|
set_path_for_folder beforehand.
|
|
example: download
|
|
|
|
path:
|
|
description: Relative subpath inside the root (default ".").
|
|
why_needed: |
|
|
Lets you drill into a subfolder without expanding the root. No
|
|
".." or absolute path is allowed.
|
|
example: Breaking.Bad.S01.1080p.BluRay.x265-GROUP
|
|
|
|
returns:
|
|
ok:
|
|
description: Listing returned.
|
|
fields:
|
|
status: "'ok'"
|
|
folder_type: The key that was listed.
|
|
path: The relative path that was listed.
|
|
entries: List of {name, type, size?} for each entry.
|
|
|
|
error:
|
|
description: Could not list the folder.
|
|
fields:
|
|
error: Short error code (folder_not_configured, path_not_found, path_traversal, ...).
|
|
message: Human-readable explanation.
|