Skip to content

Library: every tool a real method; help(job) and help(langslice) as the index - #48

Merged
greenpolo merged 1 commit into
mainfrom
library/discoverable-handle
Nov 20, 2026
Merged

greenpolo merged 1 commit into
mainfrom
library/discoverable-handle

Conversation

@greenpolo

Copy link
Copy Markdown
Owner

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 only dir(job) revealed them, with no arguments.

  • open_job / create_job return a handle whose class is made for the job: every tool is a real method, so help(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 six job.context parts.
  • help(langslice) is a start-here index: where the tools, the context parts, plugin_api, the atlas and coordinate helpers and the job folder's AGENTS.md are.
  • job.state, job.job, job.workspace, job.image_model, job.section_maps return their real types instead of Any.
  • The job statement's scripting lines, the job folder's AGENTS.md card and docs/developers/library.md point at help(job).

Checks

  • New 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.
  • The synthetic job fixture moved to tests/conftest.py so the smoke test and this one share it.
  • pytest 16 passed, ruff, ruff format, basedpyright (0 errors), import-linter all pass locally. Opened and called on a copy of a real 20-section Carey job.
  • Not run: a real agent registration (no quota-spending runs were allowed); the model-facing change is one clause in the scripting lines.

🤖 Generated with Claude Code

…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>
@greenpolo greenpolo self-assigned this Nov 20, 2026
@greenpolo
greenpolo marked this pull request as ready for review November 20, 2026 18:31
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T18:32:53.561871Z 32f98ae Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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()},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@greenpolo
greenpolo merged commit 9137e97 into main Nov 20, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant