Skip to content

feat: 添加插件存储功能和请求元数据传递#6

Merged
Gaubee merged 1 commit intomainfrom
feat/plugin-store
Dec 30, 2025
Merged

feat: 添加插件存储功能和请求元数据传递#6
Gaubee merged 1 commit intomainfrom
feat/plugin-store

Conversation

@Gaubee
Copy link
Copy Markdown
Collaborator

@Gaubee Gaubee commented Dec 30, 2025

功能

  • 插件存储 (Plugin Store): 新增 plugin-store.ts,允许插件在 onRequest/onResponse 之间传递数据

    • 数据存储在私有 header: -x-jixo-store-${pluginName}
    • 通过 store.set(data, headers) 设置数据
    • 通过 store.get() 读取数据
    • 支持 Zod schema 类型校验
  • 请求元数据传递: ResponseHookParams 新增 requestMeta 字段

    • 包含: method, url, headers(不含 body)
    • 插件可在 onResponse 中读取原始请求信息

插件优化

  • codex-plugin: 只有当 onRequest 处理过请求时才转换响应
  • droid-plugin: 只有当 onRequest 处理过请求时才重写错误响应

测试

  • 更新所有插件测试用例
  • 新增 createMockStore 测试辅助函数

- 新增 plugin-store.ts 提供插件间数据传递能力
- ResponseHookParams 新增 requestMeta 字段(url, headers, method)
- 插件可通过 store.set/get 在 request/response 间传递数据
- 数据存储在私有 header: -x-jixo-store-${pluginName}
- 优化 codex/droid 插件:只有 onRequest 处理过才转换响应
- 更新测试用例
@Gaubee Gaubee merged commit c4b1366 into main Dec 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant