Repository navigation
Library: every tool a real method; help(job) and help(langslice) as the index - #48
Conversation
…he index A script's job handle now has a class made for its job: each tool is a method of it, so help(job), dir(job) and an editor list every tool with its arguments, and the class docstring indexes them by group with the handle's own methods and the job.context parts. Before, the tools came through __getattr__ and help(job) showed none of them. help(langslice) is the start-here index of the library. The handle's properties carry their real types. The job statement and the job folder's AGENTS.md point at help(job). tests/test_library_index.py checks that help(job) lists every tool with its signature and that every public name a script reaches has a docstring. The synthetic job fixture moved to conftest so both tests open it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 32f98aec62
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| { | ||
| "__doc__": f"{guide}\n\n{tool_index(tools, groups)}\n", | ||
| "__module__": JobHandle.__module__, | ||
| **{name: staticmethod(method) for name, method in tools.items()}, |
There was a problem hiding this comment.
Prevent plugin tools from overriding handle members
When a job includes a plugin tool named close, wait, state, or another existing handle member, installing every tool directly on the subclass overrides the inherited member. These names are accepted by job.plugins.check_tool, which checks native-tool collisions but not handle-member collisions. For example, a plugin named close now causes JobHandle.__exit__ to invoke the plugin instead of closing the opened job and waiting for background writes; previously, the handle's own method took precedence over __getattr__. Reject conflicting names or otherwise preserve the handle's lifecycle methods and properties.
Useful? React with 👍 / 👎.
Requested by Nash · project thread
What changes
An agent scripting LangSlice learns the library through
help(). Before this,help(job)showed none of a job's tools: they came through__getattr__, so onlydir(job)revealed them, with no arguments.open_job/create_jobreturn a handle whose class is made for the job: every tool is a real method, sohelp(job),dir(job)and an editor list each one with its signature and full description. The class docstring indexes the tools by group (Common, Positioning, Linear, Nonlinear), the handle's own methods and the sixjob.contextparts.help(langslice)is a start-here index: where the tools, the context parts,plugin_api, the atlas and coordinate helpers and the job folder'sAGENTS.mdare.job.state,job.job,job.workspace,job.image_model,job.section_mapsreturn their real types instead ofAny.AGENTS.mdcard anddocs/developers/library.mdpoint athelp(job).Checks
tests/test_library_index.py:help(job)lists every tool with its signature; every public name a script reaches (package, handle, context and its parts,plugin_api) has a docstring;help(langslice)names every way in.tests/conftest.pyso the smoke test and this one share it.🤖 Generated with Claude Code