feat(plugins): add scoped prompt and host context services - #5014
Open
xxhZs wants to merge 12 commits into
Open
Conversation
Member
|
从问题定义和奥卡姆剃刀的角度看,动态 prompt 主线成立,但当前 PR 的范围已经明显超过标题和 Summary。 建议收敛的问题定义
对应的因果链是:插件注册贡献 → 选择当前 Session 可见的贡献 → 每个逻辑模型步骤重新求值 → 组装请求并记录来源版本。 当前实现把按 sessionId + turnId 缓存的 Host 基础提示词与每步重新求值的插件贡献分开,确实能让工具执行后的插件状态变化进入下一次模型调用。作用域隔离、确定性排序、卸载清理、失败替换回滚,以及 source revision / inspection,都是应保留的正确性和诊断边界。这里稳定的是 Host 基线,并非完整 system prompt。 哪些复杂度还需要需求证据
建议建议按三个可独立验收的目标拆分:
目前在仓库中查到的新 prompt 注册调用主要在测试里,尚未找到非测试业务消费者;这不排除外部已有需求,但建议补充具体场景及验收标准。若这些能力确实必须一起交付,也需要说明不可拆分的依赖,并更新标题和 Summary。 核心意见不是为了减少行数而删掉安全边界,而是:“插件状态能正确进入下一次模型请求”是清晰的问题;“补齐插件平台所有能力”不是它的最小解。 以上基于 3ce03f4 的代码与相关测试阅读,未运行构建或测试。 |
xxhZs
force-pushed
the
feat/plugin-system-prompt-service
branch
from
September 9, 2026 14:39
3ce03f4 to
2320830
Compare
xxhZs
force-pushed
the
feat/plugin-system-prompt-service
branch
from
September 9, 2026 14:42
2320830 to
eac1ec7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Trusted Host-side plugins need two related capabilities that currently require ad-hoc integration: contribute model instructions/context for the active Session, and use bounded Host services under the same Plugin Fiber and Session authority.
The required lifecycle is: activate a contribution in one Plugin scope, resolve only the contributions visible to the current Session, re-evaluate dynamic input before each logical model step, and remove or restore the contribution atomically on unload, replacement, or rollback.
Summary
ctx.systemPromptsections, complete overrides, variables, and dynamic context contributionsRequestCompositionand expose bounded Host-side inspectionThese services share the same scope registry, lifecycle publication, and Host binding path as dynamic prompt contributions, so this PR reviews that common context boundary as one unit.
Out of scope
executionBackendThe Session Executor work previously present on this branch has been removed and will be proposed separately with its own execution, stop, recovery, and lifecycle contract.
Verification
npm run typecheck --workspace @maka/runtimenpm run typecheck --workspace @maka/runtime-hostnpm run build --workspace @maka/corenpm run build --workspace @maka/storagenpm run build --workspace @maka/runtimenpm run build --workspace @maka/runtime-host