Repository navigation
docs(extensions v0.2.1): add a ten-page extension developer manual - #5769
Conversation
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.
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.
willem-bd
left a comment
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
[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.
…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
…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
Summary
Adds an extension developer manual under
harness/extensions/, in English and Chinese, covering thedeerflow-extension-api0.2.1 contract, the version on2.1.x-dev. The manual is scoped to 0.2.1 so this PR can be cherry-picked to2.1.x-devfor 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.extensions.middlewares; the seven contribution kinds; loading; failure and trust model; versioningExtensionData, fail-open and cancellation rules, diagnosticsresolve_principal/require_adminAlso fixes stale descriptions found along the way:
AGENTS.mdsaid the reference extension demonstrates "all" contribution kinds; it demonstrates five.deerflow/extensions/AGENTS.mdsaid run-evidence metadata is "secret-redacted"; only the legacyauth_tokenkey is removed.CHANGELOG entries are added in both languages.
Verification
uv run --frozen): the loader,create_app()withTestClient(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.load_extensionswith no diagnostics.@mdx-js/mdx; prettier and pre-commit hooks pass;scripts/check_agent_guidance.pyreports 0 errors.upstream/2.1.x-dev: it applies cleanly,check_agent_guidance.pyreports 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:
goal.py,title_middleware.py, andsummarization_middleware.pycallobserve_system_model_callwithouttimeout=, so a slow observer stalls the run path (lifecycle hooks have a 3 s budget).ExtensionService.start()has no timeout (extensions/gateway.py); a hung service blocks Gateway startup.stop()is bounded at 30 s.InvalidRunEvidenceCursor.make extension-upgradefails when the entry-point target changes (manager.pymatches the record byuse).TOOL_RAWcontribution logs a "fell back to a secondary anchor" warning on every subagent build, although the fallback still meets the guarantee.TaskInfo.resumedis neverTrue; the subagent task storescope_iddiffers fromTaskInfo.task_id; the version-mismatch hint suggests apip installthe 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.