Skip to content

docs(extensions v0.2.1): add a ten-page extension developer manual - #5769

Merged
WillemJiang merged 4 commits into
bytedance:mainfrom
ggnnggez:docs/extension-api-docs
Sep 23, 2026
Merged

WillemJiang merged 4 commits into
bytedance:mainfrom
ggnnggez:docs/extension-api-docs

Conversation

@ggnnggez

@ggnnggez ggnnggez commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds an extension developer manual under harness/extensions/, in English and Chinese, covering the deerflow-extension-api 0.2.1 contract, the version on 2.1.x-dev. The manual is scoped to 0.2.1 so this PR can be cherry-picked to 2.1.x-dev for the 2.1 release.

Full-stack plugins (#5647, #5685) and request-scoped run evidence (#5727) exist only on main, so they are documented in the stacked follow-up #5775, which brings the manual up to 0.2.3.

Chapter Covers
Extensions (index) When to write an extension vs a tool, MCP server, skill, or extensions.middlewares; the seven contribution kinds; loading; failure and trust model; versioning
Quick Start Build, unit-test, install, configure, and remove a working extension end to end
Runtime Model Load sequence, API version rules, scopes and ExtensionData, fail-open and cancellation rules, diagnostics
Middleware Contributions The five placements and where each lands today, scope, ordering, observe-only wrap hooks, failure isolation, task state
Lifecycle and Observers Task lifecycle, system model calls, agent assembly and fingerprint, context compaction
Services and Routes Service lifecycle, router rejection rules and their log messages, auth, resolve_principal / require_admin
Run Evidence The global service reader, cursor semantics, deletions, redaction, store differences
Operating Extensions Extension manager CLI with real output, accepted sources, upgrade and rollback, Docker, Helm, recovery
Troubleshooting Indexed by the exact log and error strings
Reference Every public name in the 0.2.1 contract and the version history, 0.1.0 (#4636) to 0.2.1 (#5405)

Also fixes stale descriptions found along the way:

  • The root AGENTS.md said the reference extension demonstrates "all" contribution kinds; it demonstrates five.
  • deerflow/extensions/AGENTS.md said run-evidence metadata is "secret-redacted"; only the legacy auth_token key is removed.

CHANGELOG entries are added in both languages.

Verification

  • Every example was run against the real host (uv run --frozen): the loader, create_app() with TestClient (auth on and off), the notify functions, the real run and event stores, and the extension CLI against a throwaway project root. Quoted log lines, error messages, and status codes are copied from that output.
  • The middleware placement table was measured by inserting probes into the real lead-agent and subagent stacks.
  • The Quick Start package was built as a standalone project; its tests pass and it loads through load_extensions with no diagnostics.
  • EN/ZH parity: same headings and code fences on every page; code blocks are copied from the English pages by script.
  • All 20 pages compile with @mdx-js/mdx; prettier and pre-commit hooks pass; scripts/check_agent_guidance.py reports 0 errors.
  • Applied the full diff to upstream/2.1.x-dev: it applies cleanly, check_agent_guidance.py reports 0 errors there, and every /docs/... link and linked repository path in the manual exists in the 2.1 tree.

Notes for reviewers

The manual documents current behavior. Writing it surfaced these likely code issues, which the pages describe as-is; happy to file them as separate issues:

  1. Inline system-model observers have no timeout: goal.py, title_middleware.py, and summarization_middleware.py call observe_system_model_call without timeout=, so a slow observer stalls the run path (lifecycle hooks have a 3 s budget).
  2. ExtensionService.start() has no timeout (extensions/gateway.py); a hung service blocks Gateway startup. stop() is bounded at 30 s.
  3. Memory-backend run-evidence cursors from before a restart return empty pages instead of raising InvalidRunEvidenceCursor.
  4. make extension-upgrade fails when the entry-point target changes (manager.py matches the record by use).
  5. A subagent-scoped TOOL_RAW contribution logs a "fell back to a secondary anchor" warning on every subagent build, although the fallback still meets the guarantee.
  6. Smaller: TaskInfo.resumed is never True; the subagent task store scope_id differs from TaskInfo.task_id; the version-mismatch hint suggests a pip install the host can't follow.

Plugin-specific findings are listed in #5775.

The Reference chapter's version history must be updated by hand when the contract changes.

Add a harness/extensions/ section in English and Chinese documenting the
deerflow-extension-api 0.2.3 contract:

  index                when to write an extension vs a tool, MCP server or
                       skill; contribution kinds; loading; failure and
                       trust model; versioning
  quick-start          build, test, install and remove a working extension
  runtime              load sequence, API version rules, scopes and
                       ExtensionData, fail-open and cancellation, diagnostics
  middleware           placements and where each lands, scope, ordering,
                       observe-only wrap hooks, failure isolation
  observers            task lifecycle, system model calls, agent assembly
                       and fingerprint, context compaction
  services-and-routes  service lifecycle, router rejection rules, auth,
                       principals
  run-evidence         service and request-scoped readers (bytedance#5727), cursor
                       semantics, deletions, redaction, store differences
  plugins              experimental full-stack plugins, inline modules and
                       manifest-based browser assets (bytedance#5685)
  operations           extension manager CLI, sources, upgrade, rollback,
                       Docker, Helm, recovery
  troubleshooting      indexed by the exact log and error strings
  reference            every public name and the contract version history

Also fix stale descriptions: the contribution kinds listed in AGENTS.md
and deerflow/extensions/AGENTS.md (now eight, including plugins), the
run-evidence redaction claim (only auth_token is removed), and the plugin
mount return value in docs/full-stack-plugins.md ({ dispose }, not a
function). Changelog entries added in both languages.
@github-actions github-actions Bot added area:docs Documentation and Markdown only area:frontend Next.js frontend under frontend/ risk:medium Medium risk: regular code changes size/XL PR changes 700+ lines labels Sep 23, 2026
@ggnnggez ggnnggez added this to the 2.1.0 milestone Sep 23, 2026
@ggnnggez
ggnnggez marked this pull request as draft September 23, 2026 09:26
@ggnnggez ggnnggez removed this from the 2.1.0 milestone Sep 23, 2026
Plugins and request-scoped run evidence are not in 2.1.x-dev yet; they
move to a stacked follow-up so this change can be cherry-picked.
@ggnnggez ggnnggez changed the title docs(extensions): add an eleven-page extension developer manual docs(extensions-2.1.0): add an eleven-page extension developer manual Sep 23, 2026
@ggnnggez ggnnggez changed the title docs(extensions-2.1.0): add an eleven-page extension developer manual docs(extensions-0.2.1): add an eleven-page extension developer manual Sep 23, 2026
@ggnnggez ggnnggez changed the title docs(extensions-0.2.1): add an eleven-page extension developer manual docs(extensions v0.2.1): add an eleven-page extension developer manual Sep 23, 2026
@ggnnggez
ggnnggez marked this pull request as ready for review September 23, 2026 10:07
@ggnnggez ggnnggez added this to the 2.1.0 milestone Sep 23, 2026
@ggnnggez ggnnggez changed the title docs(extensions v0.2.1): add an eleven-page extension developer manual docs(extensions): add a ten-page extension developer manual Sep 23, 2026
@ggnnggez ggnnggez changed the title docs(extensions): add a ten-page extension developer manual docs(extensions v0.2.1): add a ten-page extension developer manual Sep 23, 2026

@willem-bd willem-bd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static review against the documented deerflow-extension-api 0.2.1 host behavior. I found one authentication mismatch in the new route guidance.


Contributed routes sit behind the same middleware as the host API, and they cannot opt out:

- **Authentication.** A request without a valid session or personal access token gets `401` before your handler runs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Do not advertise PAT access to contributed routes

PATs never reach an extension-contributed path under the current host policy. AuthMiddleware authenticates the token and then calls is_pat_allowed_route(), whose allowlist only enumerates built-in thread/project/run routes; /api/ext-status/* therefore returns 403 {"detail":"PAT credentials are not permitted on this route"} before this handler. This also makes the PAT-specific principal paragraph and /reset response below inaccurate (and the Chinese page mirrors it). Please document contributed routes as rejecting PAT credentials, or add an explicit PAT policy for extension routes before promising token access.

@WillemJiang
WillemJiang merged commit 7cbcbef into bytedance:main Sep 23, 2026
20 checks passed
WillemJiang pushed a commit that referenced this pull request Sep 23, 2026
…5769)

* docs(extensions): add an eleven-page extension developer manual

Add a harness/extensions/ section in English and Chinese documenting the
deerflow-extension-api 0.2.3 contract:

  index                when to write an extension vs a tool, MCP server or
                       skill; contribution kinds; loading; failure and
                       trust model; versioning
  quick-start          build, test, install and remove a working extension
  runtime              load sequence, API version rules, scopes and
                       ExtensionData, fail-open and cancellation, diagnostics
  middleware           placements and where each lands, scope, ordering,
                       observe-only wrap hooks, failure isolation
  observers            task lifecycle, system model calls, agent assembly
                       and fingerprint, context compaction
  services-and-routes  service lifecycle, router rejection rules, auth,
                       principals
  run-evidence         service and request-scoped readers (#5727), cursor
                       semantics, deletions, redaction, store differences
  plugins              experimental full-stack plugins, inline modules and
                       manifest-based browser assets (#5685)
  operations           extension manager CLI, sources, upgrade, rollback,
                       Docker, Helm, recovery
  troubleshooting      indexed by the exact log and error strings
  reference            every public name and the contract version history

Also fix stale descriptions: the contribution kinds listed in AGENTS.md
and deerflow/extensions/AGENTS.md (now eight, including plugins), the
run-evidence redaction claim (only auth_token is removed), and the plugin
mount return value in docs/full-stack-plugins.md ({ dispose }, not a
function). Changelog entries added in both languages.

* docs(agents): trim root AGENTS.md to keep inherited chains under the size limit

* docs(extensions): scope the manual to the 0.2.1 contract

Plugins and request-scoped run evidence are not in 2.1.x-dev yet; they
move to a stacked follow-up so this change can be cherry-picked.

* docs(extensions): clarify PAT rejection on contributed routes
vieenrose pushed a commit to vieenrose/deer-flow that referenced this pull request Sep 27, 2026
…ytedance#5769)

* docs(extensions): add an eleven-page extension developer manual

Add a harness/extensions/ section in English and Chinese documenting the
deerflow-extension-api 0.2.3 contract:

  index                when to write an extension vs a tool, MCP server or
                       skill; contribution kinds; loading; failure and
                       trust model; versioning
  quick-start          build, test, install and remove a working extension
  runtime              load sequence, API version rules, scopes and
                       ExtensionData, fail-open and cancellation, diagnostics
  middleware           placements and where each lands, scope, ordering,
                       observe-only wrap hooks, failure isolation
  observers            task lifecycle, system model calls, agent assembly
                       and fingerprint, context compaction
  services-and-routes  service lifecycle, router rejection rules, auth,
                       principals
  run-evidence         service and request-scoped readers (bytedance#5727), cursor
                       semantics, deletions, redaction, store differences
  plugins              experimental full-stack plugins, inline modules and
                       manifest-based browser assets (bytedance#5685)
  operations           extension manager CLI, sources, upgrade, rollback,
                       Docker, Helm, recovery
  troubleshooting      indexed by the exact log and error strings
  reference            every public name and the contract version history

Also fix stale descriptions: the contribution kinds listed in AGENTS.md
and deerflow/extensions/AGENTS.md (now eight, including plugins), the
run-evidence redaction claim (only auth_token is removed), and the plugin
mount return value in docs/full-stack-plugins.md ({ dispose }, not a
function). Changelog entries added in both languages.

* docs(agents): trim root AGENTS.md to keep inherited chains under the size limit

* docs(extensions): scope the manual to the 0.2.1 contract

Plugins and request-scoped run evidence are not in 2.1.x-dev yet; they
move to a stacked follow-up so this change can be cherry-picked.

* docs(extensions): clarify PAT rejection on contributed routes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Documentation and Markdown only area:frontend Next.js frontend under frontend/ risk:medium Medium risk: regular code changes size/XL PR changes 700+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants