tractor/ai/prompt-io/opencode/20260818T193005Z_bf06b4f8_p...

2.2 KiB

Prompt

Replace abandoned Portal.run() one-shots with a static linked-context endpoint. Follow Trio positional-call semantics, use partials for target keywords, preserve Python 3.14 Placeholder behavior, keep target lookup behind the RPC allowlist and support private, nursery and portal placement.

Response summary

Use Portal.open_context() and Context.wait_for_result() for one-shot tasks. Normalize every partial layer, validate signatures locally and send target namespace/function components separately to the authorized remote resolver. Retain the client-side function in its NamespacePath so to_tuple() does not re-import it. Owned actors enable the declaring _api.__name__ directly; caller-owned portals opt in through the public to_actor.MODULE alias.

Files changed

  • tractor/to_actor/_api.py - implement linked one-shot calls.
  • tractor/to_actor/__init__.py - export MODULE.
  • tractor/msg/ptr.py - retain refs created by from_ref().
  • tests/test_to_actor.py - cover the public API and authorization.
  • examples/parallelism/to_actor_one_shots.py - use positional inputs.

Human edits

The human rejected nested target-kwargs configuration and selected Trio-style positional inputs plus functools.partial(). During staged review the human required a Python 3.14 compatibility comment rather than removing Placeholder support, requested separate namespace and function inputs, preserved _get_rpc_func(ns: str, funcname: str) authorization, renamed RPC_MODULE to MODULE, rejected global module exposure and deferred speculative nursery/module-list helpers to the open_taskman() design line. The human also required this public API to land only after its lower-level safety dependencies. In final staged review, the human required _invoke_from_portal() to use NamespacePath.to_tuple() with the already-held function ref and required internal actor setup to use _api.__name__ directly, keeping to_actor.MODULE solely as the public importer-facing alias.