@jack200714/mafw 4.8.0 → 4.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -3
- package/gateway/dist/core/manager/goal-snapshot.js +2 -2
- package/gateway/dist/core/manager/manager-session-runtime.js +59 -0
- package/gateway/dist/core/manager/milestone-push.js +25 -10
- package/gateway/dist/index.js +265 -103
- package/gateway/dist/media/media-plugin-loader.js +25 -1
- package/gateway/dist/media/resolve-prompt.js +20 -0
- package/gateway/dist/memory/gateway-db.js +23 -0
- package/gateway/dist/opencode-adapter.js +34 -0
- package/gateway/dist/plugins/package-context.js +24 -0
- package/gateway/dist/plugins/package-host.js +331 -0
- package/gateway/dist/plugins/package-types.js +2 -0
- package/gateway/dist/recall/gateway-db-migrate.js +5 -2
- package/gateway/dist/recall/redact.js +53 -0
- package/gateway/dist/recall/turn-pipeline.js +2 -0
- package/gateway/dist/routes/event-publish.js +44 -0
- package/gateway/dist/routes/plugins.js +4 -1
- package/gateway/dist/routes/waitwhat-command.js +43 -0
- package/gateway/dist/runtime/contract.js +4 -1
- package/gateway/dist/runtime/event-broadcast.js +8 -0
- package/gateway/dist/runtime/loader.js +22 -1
- package/gateway/dist/runtime/normalize.js +13 -0
- package/gateway/dist/runtime/pi/pi-approval-bridge.js +12 -2
- package/gateway/dist/runtime/pi/pi-approval-extension.js +11 -3
- package/gateway/dist/runtime/pi/pi-session.js +21 -3
- package/gateway/dist/runtime/plugins/pi-runtime.js +6 -3
- package/gateway/dist/runtime/serve-sidecar.js +4 -1
- package/gateway/dist/runtime/serve-supervisor.js +12 -0
- package/gateway/dist/runtime/validate.js +39 -0
- package/gateway/dist/skills/manager-identity.js +6 -1
- package/gateway/dist/usage/builtin-plugins/gateway.js +91 -36
- package/gateway/dist/usage/plugin-context.js +42 -2
- package/gateway/dist/usage/plugin-loader.js +32 -2
- package/gateway/package.json +1 -1
- package/package.json +3 -1
- package/packages/tui/dist/cli.js +20 -2
|
@@ -74,6 +74,7 @@ class PluginLoader {
|
|
|
74
74
|
builtinNames;
|
|
75
75
|
usageStats;
|
|
76
76
|
resolveInlineApiKey;
|
|
77
|
+
packageEntries = [];
|
|
77
78
|
constructor(pluginsDir, builtinNames, opts) {
|
|
78
79
|
this.pluginsDir = pluginsDir;
|
|
79
80
|
this.builtinNames = new Set(builtinNames);
|
|
@@ -173,18 +174,47 @@ class PluginLoader {
|
|
|
173
174
|
this.builtinNames = builtinNameSet;
|
|
174
175
|
}
|
|
175
176
|
getAdapters() {
|
|
177
|
+
const packageNames = new Set(this.packageEntries.map((e) => e.mod.name));
|
|
176
178
|
const adapters = [];
|
|
177
179
|
for (const s of this.state.values()) {
|
|
178
|
-
if (s.status === 'ok' && s.adapter && !s.disabled)
|
|
180
|
+
if (s.status === 'ok' && s.adapter && !s.disabled && !packageNames.has(s.name))
|
|
179
181
|
adapters.push(s.adapter);
|
|
180
182
|
}
|
|
183
|
+
for (const e of this.packageEntries) {
|
|
184
|
+
if (this.disabledPlugins.has(e.mod.name))
|
|
185
|
+
continue;
|
|
186
|
+
adapters.push((0, plugin_context_1.makeAdapter)(e.mod, e.source, this.usageStats, this.resolveInlineApiKey));
|
|
187
|
+
}
|
|
181
188
|
return adapters;
|
|
182
189
|
}
|
|
183
190
|
isBuiltinName(name) {
|
|
184
191
|
return this.builtinNames.has(name);
|
|
185
192
|
}
|
|
186
193
|
getState() {
|
|
187
|
-
|
|
194
|
+
const out = [...this.state.values()].map((s) => ({ ...s }));
|
|
195
|
+
const packageNames = new Set(this.packageEntries.map((e) => e.mod.name));
|
|
196
|
+
for (const s of out) {
|
|
197
|
+
if (s.name && packageNames.has(s.name))
|
|
198
|
+
s.overridden = true;
|
|
199
|
+
}
|
|
200
|
+
for (const e of this.packageEntries) {
|
|
201
|
+
out.push({
|
|
202
|
+
file: e.source,
|
|
203
|
+
name: e.mod.name,
|
|
204
|
+
status: 'ok',
|
|
205
|
+
overridden: false,
|
|
206
|
+
builtin: false,
|
|
207
|
+
adapter: undefined,
|
|
208
|
+
configSchema: validateConfigSchema(e.mod.configSchema),
|
|
209
|
+
disabled: this.disabledPlugins.has(e.mod.name),
|
|
210
|
+
pluginType: typeof e.mod.type === 'string' ? e.mod.type : undefined,
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
return out;
|
|
214
|
+
}
|
|
215
|
+
/** PluginHost 推送的包贡献。同名包覆盖 legacy 文件与内置;disabledPlugins 同样生效。 */
|
|
216
|
+
setPackageEntries(entries) {
|
|
217
|
+
this.packageEntries = entries ?? [];
|
|
188
218
|
}
|
|
189
219
|
async reload() {
|
|
190
220
|
await this.scan();
|
package/gateway/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jack200714/mafw",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.10.1",
|
|
4
4
|
"description": "MAFW Loop Agent Plugin for OpenCode - Phase Relay + TMEM + Dynamic Compression",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
"postinstall": "node -e \"var p=require('path'),f=require('fs'),d=p.join(__dirname,'gateway'),ts=p.join(d,'node_modules','typescript','bin','tsc');if(f.existsSync(d)){if(f.existsSync(ts)){console.log('[mafw] gateway dev deps present, skip prod install')}else{require('child_process').execSync('npm install --omit=dev --no-audit --no-fund --loglevel=error',{cwd:d,stdio:'inherit'})}}\"",
|
|
15
15
|
"prepare": "node -e \"var p=require('path'),f=require('fs'),ts=p.join(__dirname,'gateway','node_modules','typescript','bin','tsc');if(!f.existsSync(ts)){console.log('[mafw] gateway dev deps missing, skip prepare build (fresh CI install)');process.exit(0)}require('child_process').execSync('npm run build',{cwd:__dirname,stdio:'inherit'})\"",
|
|
16
16
|
"pack:install": "npm run build && npm pack && npm install -g jack200714-mafw-*.tgz && mafw version",
|
|
17
|
+
"version:set": "node scripts/bump-version.mjs",
|
|
18
|
+
"version:check": "node scripts/bump-version.mjs --check",
|
|
17
19
|
"test": "npm test --prefix gateway",
|
|
18
20
|
"test:unit": "npm test --prefix gateway",
|
|
19
21
|
"test:tui": "node --test packages/tui/tests/*.test.ts"
|
package/packages/tui/dist/cli.js
CHANGED
|
@@ -380,7 +380,7 @@ var require_client = __commonJS({
|
|
|
380
380
|
return { id: data.projectDir || ".", worktree: data.projectDir || "." };
|
|
381
381
|
},
|
|
382
382
|
setCurrent: async (path) => {
|
|
383
|
-
await this.request("/
|
|
383
|
+
await this.request("/register", {
|
|
384
384
|
method: "POST",
|
|
385
385
|
body: JSON.stringify({ projectDir: path, mafwDir: path + "/.mafw" })
|
|
386
386
|
});
|
|
@@ -413,7 +413,14 @@ var require_client = __commonJS({
|
|
|
413
413
|
};
|
|
414
414
|
},
|
|
415
415
|
/** SSE 连接状态(onopen/onerror 维护;供监督器健康轮询)。 */
|
|
416
|
-
connected: () => this._sse.connected
|
|
416
|
+
connected: () => this._sse.connected,
|
|
417
|
+
/** 发布自定义事件到全部 UI 通道(SSE/WS/推送)。type 建议命名空间
|
|
418
|
+
* 'plugin:<name>:<event>';消费方对未知 type 忽略(SSE 通知语义,无注册制)。 */
|
|
419
|
+
publish: async (event) => this.request("/api/events", {
|
|
420
|
+
method: "POST",
|
|
421
|
+
headers: { "Content-Type": "application/json" },
|
|
422
|
+
body: JSON.stringify(event)
|
|
423
|
+
})
|
|
417
424
|
};
|
|
418
425
|
// ── Runtime ──
|
|
419
426
|
runtime = {
|
|
@@ -1831,6 +1838,7 @@ var init_command_registry = __esm({
|
|
|
1831
1838
|
{ name: "status", description: "\u4F1A\u8BDD\u72B6\u6001\u56DE\u987E\uFF08\u672C\u5730\u8BA1\u7B97\uFF09", category: "\u4F1A\u8BDD", immediate: true },
|
|
1832
1839
|
{ name: "queue", description: "\u6392\u961F\u6D88\u606F\u7BA1\u7406\uFF08\u6536\u56DE/\u4E22\u5F03\uFF09", category: "\u4F1A\u8BDD", aliases: ["q"], immediate: true },
|
|
1833
1840
|
{ name: "btw", description: "\u652F\u7EBF\u95EE\u7B54\uFF1A/btw <\u95EE\u9898>", category: "\u4F1A\u8BDD" },
|
|
1841
|
+
{ name: "waitwhat", description: "\u6CA1\u542C\u61C2\uFF1A\u7528\u7B80\u660E\u8BED\u8A00+\u9879\u76EE\u672F\u8BED\u91CD\u8FF0\u4E0A\u4E00\u6761\u56DE\u590D", category: "\u4F1A\u8BDD", immediate: true },
|
|
1834
1842
|
{ name: "compact", description: "\u538B\u7F29\u5F53\u524D\u4F1A\u8BDD\u4E0A\u4E0B\u6587", category: "\u4E0A\u4E0B\u6587", destructive: true, immediate: true },
|
|
1835
1843
|
{ name: "undo", description: "\u56DE\u9000\u6700\u540E\u4E00\u8F6E\u5BF9\u8BDD", category: "\u4E0A\u4E0B\u6587", destructive: true },
|
|
1836
1844
|
{ name: "redo", description: "\u6062\u590D\u4E0A\u4E00\u6B21\u56DE\u9000", category: "\u4E0A\u4E0B\u6587", destructive: true },
|
|
@@ -2165,6 +2173,8 @@ function createSlashHandler(deps) {
|
|
|
2165
2173
|
case "status":
|
|
2166
2174
|
deps.showStatusRecap();
|
|
2167
2175
|
return null;
|
|
2176
|
+
case "waitwhat":
|
|
2177
|
+
return deps.waitwhat();
|
|
2168
2178
|
case "queue":
|
|
2169
2179
|
await deps.showQueueManager();
|
|
2170
2180
|
return null;
|
|
@@ -3921,6 +3931,14 @@ async function runApp(opts) {
|
|
|
3921
3931
|
if ("error" in r) return `btw \u5931\u8D25: ${r.error}`;
|
|
3922
3932
|
return null;
|
|
3923
3933
|
},
|
|
3934
|
+
waitwhat: async () => {
|
|
3935
|
+
const sid = chatStore.sessionID;
|
|
3936
|
+
if (!sid) return "\u5F53\u524D\u65E0\u4F1A\u8BDD";
|
|
3937
|
+
const r = await client.mafwCommands.run({ command: "waitwhat", sessionID: sid }).catch((e) => ({ error: e.message }));
|
|
3938
|
+
if ("error" in r) return `waitwhat \u5931\u8D25: ${r.error}`;
|
|
3939
|
+
if (r.ok === false) return `waitwhat: ${r.error ?? "\u6CA1\u6709\u53EF\u91CD\u8FF0\u7684\u56DE\u590D"}`;
|
|
3940
|
+
return null;
|
|
3941
|
+
},
|
|
3924
3942
|
showSessionPicker,
|
|
3925
3943
|
showQueueManager,
|
|
3926
3944
|
showModelPicker,
|