mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-13 03:52:00 +00:00
docs(platforms): document env_enablement_fn + cron_deliver_env_var hooks (#21331)
Following PR #21306 which added the new generic plugin-platform hooks, update the three platform-authoring docs so plugin authors find them: - website/docs/developer-guide/adding-platform-adapters.md: expand the 'What the Plugin System Handles Automatically' table with env-only auto-enable + cron delivery + hermes-config UI entries rows. Add three new sections — 'Env-Driven Auto-Configuration', 'Cron Delivery', 'Surfacing Env Vars in hermes config' — covering the hook signatures, plugin.yaml rich-dict format, and the home_channel-key special case. Update the main register() example to pass env_enablement_fn + cron_deliver_env_var inline so readers see them on their first pass. Upgrade the PLUGIN.yaml snippet to show bare-string + rich-dict + optional_env. - website/docs/guides/build-a-hermes-plugin.md: the thin platform example in the build-a-plugin tour now includes env_enablement_fn and cron_deliver_env_var, plus an optional_env block in the inline plugin.yaml. Keeps pointing to the developer-guide page for the full treatment. - gateway/platforms/ADDING_A_PLATFORM.md: the in-repo reference shallow-points at the docsite but now names the three new hooks explicitly so contributors reading the source tree know what they're for. Also adds teams + google_chat as reference implementations alongside irc.
This commit is contained in:
parent
5b121c6e35
commit
5c08b851df
3 changed files with 174 additions and 10 deletions
|
|
@ -747,6 +747,13 @@ def check_requirements():
|
|||
import os
|
||||
return bool(os.environ.get("MYPLATFORM_TOKEN"))
|
||||
|
||||
def _env_enablement():
|
||||
import os
|
||||
tok = os.getenv("MYPLATFORM_TOKEN", "").strip()
|
||||
if not tok:
|
||||
return None
|
||||
return {"token": tok}
|
||||
|
||||
def register(ctx):
|
||||
ctx.register_platform(
|
||||
name="myplatform",
|
||||
|
|
@ -754,6 +761,11 @@ def register(ctx):
|
|||
adapter_factory=lambda cfg: MyPlatformAdapter(cfg),
|
||||
check_fn=check_requirements,
|
||||
required_env=["MYPLATFORM_TOKEN"],
|
||||
# Auto-populate PlatformConfig.extra from env so env-only setups
|
||||
# show up in `hermes gateway status` without SDK instantiation.
|
||||
env_enablement_fn=_env_enablement,
|
||||
# Opt in to cron delivery: `deliver=myplatform` routes to this var.
|
||||
cron_deliver_env_var="MYPLATFORM_HOME_CHANNEL",
|
||||
emoji="💬",
|
||||
platform_hint="You are chatting via MyPlatform. Keep responses concise.",
|
||||
)
|
||||
|
|
@ -762,10 +774,18 @@ def register(ctx):
|
|||
```yaml
|
||||
# plugins/platforms/myplatform/plugin.yaml
|
||||
name: myplatform-platform
|
||||
label: MyPlatform
|
||||
kind: platform
|
||||
version: 1.0.0
|
||||
description: MyPlatform gateway adapter
|
||||
requires_env: [MYPLATFORM_TOKEN]
|
||||
requires_env:
|
||||
- name: MYPLATFORM_TOKEN
|
||||
description: "Bot token from the MyPlatform console"
|
||||
password: true
|
||||
optional_env:
|
||||
- name: MYPLATFORM_HOME_CHANNEL
|
||||
description: "Default channel for cron delivery"
|
||||
password: false
|
||||
```
|
||||
|
||||
**Full guide:** [Adding Platform Adapters](/docs/developer-guide/adding-platform-adapters) — complete `BasePlatformAdapter` contract, message routing, auth gating, setup wizard integration. Look at `plugins/platforms/irc/` for a stdlib-only working example.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue