updating and refining plugin system refactor

This commit is contained in:
2026-04-28 22:20:54 -07:00
parent 8685fbb723
commit 323c24f4f4
33 changed files with 4287 additions and 3312 deletions
+37 -7
View File
@@ -1478,13 +1478,18 @@ class PipelineExecutor:
config: Any,
selected_items: list,
*,
stage_is_last: bool
stage_is_last: bool,
source_command: Any = None,
prefer_detail_fallback: bool = False,
) -> bool:
if not stage_is_last:
return False
candidates: list[str] = []
seen: set[str] = set()
current_table = None
table_meta = None
table_type = ""
def _add(value) -> None:
try:
@@ -1504,6 +1509,8 @@ class PipelineExecutor:
table if current_table and hasattr(current_table,
"table") else None
)
if current_table and hasattr(current_table, "table"):
table_type = str(getattr(current_table, "table", "") or "").strip()
# Prefer an explicit plugin hint from table metadata when available.
# This keeps @N selectors working even when row payloads don't carry a
@@ -1516,6 +1523,7 @@ class PipelineExecutor:
)
except Exception:
meta = None
table_meta = meta if isinstance(meta, dict) else None
if isinstance(meta, dict):
_add(meta.get("plugin"))
_add(meta.get("provider"))
@@ -1585,6 +1593,26 @@ class PipelineExecutor:
if handled:
return True
if prefer_detail_fallback:
detail_renderer = getattr(provider, "show_selection_details", None)
if callable(detail_renderer):
try:
detail_handled = bool(
detail_renderer(
selected_items,
ctx=ctx,
stage_is_last=True,
source_command=str(source_command or ""),
table_type=table_type,
table_metadata=table_meta,
)
)
except Exception as exc:
logger.exception("%s detail fallback failed during selection: %s", key, exc)
return True
if detail_handled:
return True
@staticmethod
def _maybe_expand_plugin_selection(
selected_items: List[Any],
@@ -2180,10 +2208,12 @@ class PipelineExecutor:
filtered = expanded
if PipelineExecutor._maybe_run_class_selector(
ctx,
config,
filtered,
stage_is_last=(not stages)):
ctx,
config,
filtered,
stage_is_last=(not stages),
source_command=source_cmd,
prefer_detail_fallback=bool(prefer_row_action and not stages and len(selection_indices) == 1)):
return False, None
from SYS.pipe_object import coerce_to_pipe_object
@@ -2204,7 +2234,7 @@ class PipelineExecutor:
except Exception:
logger.exception("Failed to record Applied @N selection log step (pipeline_session=%r)", getattr(pipeline_session, 'worker_id', None))
# Auto-insert downloader stages for provider tables.
# Auto-insert downloader stages for plugin tables.
try:
current_table = ctx.get_current_stage_table()
if current_table is None and hasattr(ctx, "get_display_table"):
@@ -2360,7 +2390,7 @@ class PipelineExecutor:
# Multi-selection fallback: if any selected row declares a
# download-file action, insert a generic download-file stage.
# This keeps provider-specific behavior in provider metadata.
# This keeps plugin-specific behavior in plugin metadata.
if (not inserted_provider_download) and len(selection_indices) > 1:
try:
has_download_row_action = False