refactor flows into canonical runtime architecture

This commit is contained in:
QLHazyCoder
2026-05-21 07:21:34 +08:00
parent e2485d2e64
commit a7b35ee11a
167 changed files with 9034 additions and 3032 deletions
@@ -1,4 +1,4 @@
# 多注册流程来源与驱动注册设计
# 多注册流程来源与驱动注册设计
本文解决的是另一个会在第二个 flow 接入时立刻爆炸的问题:当前项目虽然有 `tab-runtime`,但“来源 source 是谁、该注入什么脚本、URL family 怎么判定、localhost callback 应该清谁”仍然带着明显的 OpenAI 单流程假设。
@@ -10,7 +10,7 @@
- `content/utils.js``detectScriptSource()`
- `background/navigation-utils.js``matchesSourceUrlFamily()`
- `background/tab-runtime.js` 的注册表、冲突清理、callback 清理
- `core/flow-kernel/tab-runtime.js` 的注册表、冲突清理、callback 清理
这说明当前的 source 体系不是“可扩展的来源注册表”,而是“OpenAI 时代遗留的 source 命名”。
@@ -58,10 +58,10 @@ sourceRegistry = {
'content/activation-utils.js',
'content/utils.js',
'content/operation-delay.js',
'content/auth-page-recovery.js',
'content/phone-country-utils.js',
'content/phone-auth.js',
'content/signup-page.js',
'flows/openai/content/auth-page-recovery.js',
'flows/openai/content/phone-country-utils.js',
'flows/openai/content/phone-auth.js',
'flows/openai/content/openai-auth.js',
],
cleanupScopes: ['oauth-localhost-callback'],
},
@@ -81,7 +81,7 @@ sourceRegistry = {
label: 'SUB2API 后台',
dynamicOnly: true,
familyMatcher: 'sub2api-panel-family',
injectFiles: ['content/utils.js', 'content/sub2api-panel.js'],
injectFiles: ['content/utils.js', 'flows/openai/content/sub2api-panel.js'],
},
};
```
@@ -125,7 +125,7 @@ sourceRegistry = {
driverRegistry = {
'openai-auth': {
sourceId: 'openai-auth',
driverId: 'content/signup-page',
driverId: 'flows/openai/content/openai-auth',
commands: [
'OPEN_SIGNUP',
'SUBMIT_SIGNUP_IDENTIFIER',
@@ -244,3 +244,4 @@ callbackRegistry = {
- manifest 与动态注入没有统一入口
- `content/utils.js` 的默认 source 回退会污染未来 flow