[plugin sdk] Phase 1: consolidate host workflow seams and media extraction runtime#80229
[plugin sdk] Phase 1: consolidate host workflow seams and media extraction runtime#80229100yenadmin wants to merge 45 commits into
Conversation
Squashed rebase of PR #75581 onto upstream/main (rebase-2026-05-08). Drops PR's outbound-base.ts and macOS GatewayModels.swift since upstream already deleted those and integrated the attachment delivery surface into createTelegramOutboundAdapter. Original commits in PR include 19 follow-up fixes; squashed for clean rebase. Refresh plugin-sdk-api-baseline. Replaces part of #73384/#74483.
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: not applicable. for this PR as a feature/API consolidation rather than an issue report. The review finding is source-reproducible: durable Telegram delivery pre-renders text through the adapter chunker, then the PR makes Real behavior proof Next step before merge Security Review findings
Review detailsBest possible solution: Keep the PR open, fix the Telegram default formatting path, add redacted real Telegram proof for the transport behavior, then have maintainers decide whether this phase-one SDK/Gateway shape should land as a single consolidation branch. Do we have a high-confidence way to reproduce the issue? Not applicable for this PR as a feature/API consolidation rather than an issue report. The review finding is source-reproducible: durable Telegram delivery pre-renders text through the adapter chunker, then the PR makes Is this the best way to solve the issue? No: the PR is not ready as written because the Telegram adapter change drops HTML mode on an existing pre-rendered path and the branch lacks required real Telegram proof. A safer fix is to preserve HTML mode for adapter-chunked durable delivery while separately supporting raw direct calls that intentionally rely on Telegram Markdown defaults. Full review comments:
Overall correctness: patch is incorrect Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 1429f9a181c9. |
|
Thanks Eva. I carried this forward in #80267 so we can apply maintainer fixups on an OpenClaw branch while preserving your commits/credit. What changed in the replacement:
Closing this PR as superseded by #80267. |
Closes #80219.
This is Phase 1 of the whole-surface Plugin SDK consolidation plan in #80219. It intentionally cleans up the host-workflow/session-control slice plus the active proof-gated seams, not the entire SDK/API surface in one PR.
This PR consolidates the active Plugin SDK host-hook/runtime work into one cleanup-first branch instead of asking reviewers to reason across four separate PRs plus a follow-up architecture issue.
It folds together:
It also adds one narrow consolidation slice on top:
OpenClawPluginApiWhy this matters
OpenClaw is moving more host behavior into plugins and extensions, but the current Plugin SDK surface was heading toward a flat pile of new top-level verbs. That makes every new capability feel like permanent API expansion even when the underlying runtime seams are valid.
This PR keeps the feature work, but makes the shape easier to grow from:
runtime.llmWhat this PR does
1. Integrates the active host-hook/runtime slices
2. Adds a narrow consolidation layer
api.session.state.*api.session.workflow.*api.session.controls.*api.agent.events.*api.runContext.*api.lifecycle.*These are additive aliases over the current flat methods. Existing plugin code keeps working.
3. Centralizes loader late-callability policy
Instead of
loader.tshardcoding post-register callable methods inline, this PR moves that policy into shared metadata so the runtime-callable host-hook seams have one source of truth.Current runtime-callable post-register methods remain:
sendSessionAttachmentscheduleSessionTurnunscheduleSessionTurnsByTagArchitecture
flowchart TD A["Plugin author surface"] --> B["OpenClawPluginApi"] B --> C["Flat legacy methods remain supported"] B --> D["Additive grouped aliases"] D --> E["session.state"] D --> F["session.workflow"] D --> G["session.controls"] D --> H["agent.events"] D --> I["runContext"] D --> J["lifecycle"] F --> K["next-turn injection"] F --> L["attachments"] F --> M["scheduled turns"] G --> N["session actions"] H --> O["event subscribe/emit"] J --> P["runtime cleanup"] Q["mediaUnderstanding runtime"] --> R["structured extraction"] Q --> S["explicit provider/model media inference lane"]Plugin families this supports
This combined surface is meant to support more than one product feature. Concretely, it is a foundation for:
Boundaries
runtime.llm.complete.Real behavior proof
Behavior or issue addressed:
This combined branch keeps the new host-hook seams narrow while proving they work together on the
#80229head. After this patch, typed plugin session actions dispatch through the Gateway with the action-declared operator scope bundle, grouped late-call workflow aliases remain callable afterregister()closes for bundled-plugin attachment and scheduled-turn operations, registration-only APIs stay blocked after register, and bounded structured extraction stays inside the media-understanding runtime instead of widening genericruntime.llm.Real environment tested:
Local macOS checkout at
/Volumes/LEXAR/repos/openclaw-plugin-sdk-consolidationon head564400622821b7f89b374f2e7c25ac0de61bfa4d. I used an isolated temp workspace/state/config root at/var/folders/l7/tyvn8qfs50v57w__75s3k0f00000gp/T/openclaw-pr80229-proof-qGy5Vs, started a token-auth loopback Gateway onws://127.0.0.1:18997, ran livegateway callrequests for the session-action seam, ran a standalone bundled-origin guarded API script against that livecron.*backend for grouped workflow aliases, and ran a standalone runtime proof script forextractStructuredWithModel(...).Exact steps or command run after this patch:
node --import tsxproof script from repo root that:createPluginRegistry(...)loader.__testing.runPluginRegisterSync(...)capturedApi.session.workflow.sendSessionAttachment(...)capturedApi.session.state.registerSessionExtension(...)stays blocked afterregister()capturedApi.session.workflow.scheduleSessionTurn(...)twice plus invalid tag/deleteAfterRun casescapturedApi.session.workflow.unscheduleSessionTurnsByTag(...)cron.listbefore and after cleanup through the running Gatewaynode --import tsxruntime proof script from repo root that invokesruntime.mediaUnderstanding.extractStructuredWithModel(...)once with image+text input and once with text-only input.Evidence after fix:
Observed result after fix:
On the combined
#80229head,plugins.sessionActiondispatch succeeds with typed output and reaches the handler under the action-declared operator scope bundle, while malformed payloads are rejected before handler execution. The grouped late-call workflow aliases onapi.session.workflow.*remain callable afterregister()closes for a bundled plugin, the registration-onlysession.state.registerSessionExtension(...)path stays blocked (sessionExtensionsBefore/Afterremained0), a relative attachment path resolves against the session workspace and is delivered to the active direct-outbound route, two real host cron jobs are created and visible throughcron.list, invalid tag/deleteAfterRun inputs fail closed, and tagged cleanup removes both jobs. Structured extraction stays bounded in the media-understanding runtime, forwards the selected auth profile into the provider-owned runtime, returns parsed JSON for image input, and rejects text-only calls before provider dispatch.What was not tested:
This proof did not run a full end-to-end Control UI or native Apple client flow, and it did not use a credentialed live Codex desktop session. The live evidence here is intentionally limited to merged-head Gateway dispatch, bundled-origin guarded workflow aliases against a real
cron.*backend, direct-outbound attachment delivery, and bounded runtime/provider structured extraction behavior.Verification
Local verification on this combined branch:
Notes for reviewers