Skip to content

Add an on/off switch for the four feature plugins - #2569

Merged
Birfy merged 4 commits into
mainfrom
dev/2564-plugin-switches
Nov 6, 2026
Merged

Birfy merged 4 commits into
mainfrom
dev/2564-plugin-switches

Conversation

@Birfy

@Birfy Birfy commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Written-by: Dev
Fixes #2564
Owner: Chief
Reviewer: Reviewer
Tip SHA: a4ae440
Base: 4526118
Docs-not-needed: the switch is one Settings row and one host module; docs/subsystems/core-host.md describes the team store, not plugin loading.

What changed

Settings → Plugins lists the four feature plugins with their package, a one-line purpose and a switch. The switch writes FlyBot's own state.json (flybot.plugins.<id>.enabled); the packages stay in the DSH profile, so nothing is installed or uninstalled.

A plugin reads the switch once, in its own apply() at start, through the host's flybot.pluginEnabled(id). When it is off the plugin returns before registering anything: its tools, its endpoints, its prompt text and its panels are all absent, and the next start brings them back. That is the owner's chosen scope — state.json + next start, never a hot unload.

The interface side needed its own switch because a disabled plugin's browser bundle still loads: the slot registry now drops entries belonging to a disabled plugin, and the boot path asks the host once.

Ran at the tip

  • node --import ./test/harness-resolve.mjs --test test/plugin-switches.test.js — 7/7 pass.
  • Same command with core/src/host/hooks.js and core/src/client/flybot-registry.js put back to their base blobs: 0/7 (red first).
  • test/flybot-client.test.js test/client-bundle.test.js test/client-apply-order.test.js test/api-route.test.js test/install.test.js test/flybot.test.js — 82/82 pass.
  • node scripts/ds-bot-patches.mjs check and … canonical — 10 patches apply, core/ equals ds-bot/ + patches/ds-bot/, and generate is a no-op on the committed split.
  • node scripts/build-client.mjs --check — clean.
  • node .github/scripts/changelog.mjs check — clean.

Not run

  • npm run verify end to end and the full core suite (not enough time in this slot); CI tests-ok is the authority.
  • npm run lint's arch-docs half: it needs origin/main and this box has no git; the Docs-not-needed: trailer is in the branch commit and here.
  • The DSH smoke test — nothing under core/src/host/turns|delivery|index changed.

Checkpoint

{
"pr": 2569,
"claim": "Chief",
"issue": 2564,
"summary": "Settings gains a Plugins page with one switch each for Bot Social, Tree, Timeline and Workflow. The answer is stored in FlyBot's own state.json and read when the plugin loads on the next start, so the packages stay installed and no running session loses a tool. A plugin that is off registers no tools, endpoints, prompt text or panels. Defaults stay on.",
"files": [
"core/src/host/plugins.js",
"core/src/host/hooks.js",
"core/src/client/flybot-registry.js",
"core/src/client/settings.js",
"core/test/plugin-switches.test.js",
"plugins/workflow/index.js"
],
"checks": {
"ran": "test/plugin-switches.test.js (7/7) + ds-bot-patches check/canonical + build-client --check",
"result": "green",
"at": "a4ae4400bd5ca32f66e1e7766fb116db8f64f3ed"
},
"next": "Review: panel hiding maps slot ids to plugins by prefix; the new test lists every id the four bundles register today."
}

Birfy added 2 commits November 6, 2026 20:21
The Settings page gets a Plugins section with one switch per plugin (social,
tree, timeline, workflow). The switch is kept in FlyBot's own state.json and
read at the plugin's apply() on the next start; the packages stay installed, so
a flip never unloads a running session. A plugin that is off registers no tools,
slots, endpoints or prompt text, and the interface drops its slot entries.

Fixes #2564
Docs-not-needed: the switch is one Settings row and one host module; docs/subsystems/core-host.md describes the team store, not plugin loading.
The four host files are mirrors in patches/ds-bot/files/, the three edited upstream
files get fresh hunks, and core/client.js is rebuilt from src/client. Verified with
the git-free applier: 10 patches apply cleanly and core/ equals ds-bot/ + patches.

Fixes #2564
Docs-not-needed: the switch is one Settings row and one host module; docs/subsystems/core-host.md describes the team store, not plugin loading.
Birfy added 2 commits November 6, 2026 20:28
Hand-written hunks drifted from what generate writes; the canonical split is what
CI compares against. check and canonical are both clean at this tip.

Fixes #2564
Docs-not-needed: the switch is one Settings row and one host module; docs/subsystems/core-host.md describes the team store, not plugin loading.
The zh dictionary needs the Plugins page lines and the page-list test counts the new
page; the client bundle and the patch series follow.

Fixes #2564
Docs-not-needed: the switch is one Settings row and one host module; docs/subsystems/core-host.md describes the team store, not plugin loading.
@Birfy

Birfy commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator Author

Verdict: PASS at a4ae440
Written-by: Reviewer
Attestation: a4ae440 role=Reviewer

Ran at this tip:

$ TZ=UTC node --import ./test/harness-resolve.mjs --test test/plugin-switches.test.js
# tests 7  # pass 7  # fail 0
$ TZ=UTC node --import ./test/harness-resolve.mjs --test test/settings-page-slot.test.js test/flybot-client.test.js test/client-bundle.test.js test/client-apply-order.test.js test/api-route.test.js test/install.test.js test/flybot.test.js
# tests 77  # pass 77  # fail 0
$ node scripts/build-client.mjs --check
$ node scripts/ds-bot-patches.mjs check
$ node .github/scripts/changelog.mjs check
$ node .github/scripts/risk-gate.mjs --pr 2569

Red first, on the same clean tip tree with only core/src/host/hooks.js put back to its base blob 4526118502aa: test/plugin-switches.test.js loads and 1 of 7 fails — not ok 4 - plugins/list answers all four switches and plugins/set persists a flip (# pass 6 # fail 1). Restoring the tip blob returns 7/7. With both hooks.js and flybot-registry.js at base the file fails to load (SyntaxError: … does not provide an export named 'pluginOfSlot'), so the behavioral red above is the narrower one and is the one quoted.

Review points:

  • Scope is the intended surface only (compare 4526118502aa...a4ae4400: 23 files, 4 commits). Hand-written: core/src/host/plugins.js (new, the four-switch table + pluginSwitches / setPluginSwitch / pluginEnabledAtStart), core/src/host/hooks.js (plugins/list, plugins/set, flybot.pluginEnabled), core/src/client/flybot-registry.js + core/src/client/index.js (slot filtering by plugin id, one boot read), core/src/client/settings.js + i18n.js, the four plugins/*/index.js early returns, one test, one changelog fragment. core/client.js and every patches/ds-bot/* entry is generated output (build-client --check exit 0, ds-bot-patches check ok core/ equals ds-bot/ + patches). Nothing unrelated under core/ and nothing else in patches/ds-bot/.
  • plugins/set validates the id and the boolean, then await rt.save(); a real flip sets pluginSwitchPending, and both endpoints report pendingRestart, which matches the chosen scope (state.json + next start) rather than a hot unload.
  • Each of the four apply() bodies returns before registering tools, endpoints, prompt text or middleware when ctx.flybot.pluginEnabled(id) === false; an unknown or unreadable state.json reads as on, so a fresh install is unchanged.
  • Checkpoint block is present and valid (pr 2569, claim Chief = the Owner: line, issue 2564, six files all in this diff, checks.at the tip). No Reviewer:/Owner: problem: Owner: Chief, Reviewer: Reviewer.
  • changelog: 8 fragment(s) … well formed. risk-tier: T3; basis: plugins/social/index.js=T3, … — this PASS is the T3 requirement, and the gating agent enqueues it itself.

@github-actions github-actions Bot added the pass label Nov 6, 2026
@Birfy
Birfy added this pull request to the merge queue Nov 6, 2026
Merged via the queue into main with commit 5d9e301 Nov 6, 2026
17 of 18 checks passed
@Birfy
Birfy deleted the dev/2564-plugin-switches branch November 6, 2026 12:44
@github-actions github-actions Bot removed the agent-pr Pull request opened by an agent label Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Settings 里要能开启/关闭 FlyBot 的四个插件(social / tree / timeline / workflow)

1 participant