@claude-flow/cli 3.38.20 → 3.38.22
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/.claude/helpers/.helpers-version +1 -1
- package/.claude/helpers/helpers.manifest.json +3 -3
- package/.claude/helpers/hook-handler.cjs +17 -6
- package/catalog-manifest.json +4 -4
- package/dist/src/commands/memory.js +4 -0
- package/dist/src/commands/proxy-lifecycle.js +6 -5
- package/dist/src/mcp-tools/memory-tools.js +4 -0
- package/dist/src/memory/memory-initializer.d.ts +5 -0
- package/dist/src/memory/memory-initializer.js +37 -12
- package/dist/src/proxy/activation.d.ts +14 -0
- package/dist/src/proxy/activation.js +210 -0
- package/dist/src/proxy/install.js +3 -0
- package/dist/src/proxy/paths.d.ts +2 -0
- package/dist/src/proxy/paths.js +4 -0
- package/dist/src/ruvector/enhanced-model-router.js +25 -14
- package/node_modules/@claude-flow/codex/dist/cli.js +0 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js +0 -0
- package/node_modules/@claude-flow/security/dist/input-validator.d.ts +6 -6
- package/package.json +1 -1
- package/dist/src/ruvector/lattice-wasm.d.ts +0 -14
- package/dist/src/ruvector/lattice-wasm.js +0 -144
- package/plugins/ruflo-metaharness/.claude-flow/daemon-state.json +0 -178
- package/plugins/ruflo-metaharness/.claude-flow/daemon.pid +0 -1
- package/plugins/ruflo-metaharness/.claude-flow/data/pending-insights.jsonl +0 -5
- package/plugins/ruflo-metaharness/.claude-flow/logs/daemon.log +0 -269
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783604774864_ozbujc_prompt.log +0 -19
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783604774864_ozbujc_result.log +0 -108
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783605513587_ulvmpb_prompt.log +0 -19
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783605513587_ulvmpb_result.log +0 -209
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783606368867_ahysui_prompt.log +0 -19
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783606368867_ahysui_result.log +0 -192
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783607120257_lh05rb_prompt.log +0 -19
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783607120257_lh05rb_result.log +0 -13
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783608020362_j3096j_prompt.log +0 -19
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783608020362_j3096j_result.log +0 -120
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783608776347_261b61_prompt.log +0 -19
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783608776347_261b61_result.log +0 -85
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783609621359_s5i6ye_prompt.log +0 -19
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783609621359_s5i6ye_result.log +0 -13
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783610087998_qihv9v_prompt.log +0 -19
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783610087998_qihv9v_result.log +0 -17
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783610773920_qlzmxo_prompt.log +0 -19
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783610773920_qlzmxo_result.log +0 -17
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783611376090_xpqf1z_prompt.log +0 -19
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783611376090_xpqf1z_result.log +0 -16
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783612097184_9rqfor_prompt.log +0 -19
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783612097184_9rqfor_result.log +0 -138
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783612811574_4u602j_prompt.log +0 -19
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783612811574_4u602j_result.log +0 -16
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783613750487_a46ttn_prompt.log +0 -19
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783613750487_a46ttn_result.log +0 -107
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783614289360_figwc0_prompt.log +0 -19
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783614289360_figwc0_result.log +0 -200
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783615067640_l7tm6a_prompt.log +0 -19
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783615067640_l7tm6a_result.log +0 -54
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783615825308_44nor5_prompt.log +0 -19
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783615825308_44nor5_result.log +0 -85
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783616524771_ut1ftw_prompt.log +0 -19
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783616524771_ut1ftw_result.log +0 -266
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783617323039_fs3x5a_prompt.log +0 -19
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783617323039_fs3x5a_result.log +0 -56
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783618049184_1f4yah_prompt.log +0 -19
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783618049184_1f4yah_result.log +0 -96
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783618793925_4ee7tf_prompt.log +0 -19
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783618793925_4ee7tf_result.log +0 -481
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783619642574_yjr4mm_prompt.log +0 -19
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783619642574_yjr4mm_result.log +0 -104
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783620392771_oduto0_prompt.log +0 -19
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783620392771_oduto0_result.log +0 -148
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783621183670_gd0p1x_prompt.log +0 -19
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783621183670_gd0p1x_result.log +0 -111
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783621738388_z4k48b_prompt.log +0 -19
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783621738388_z4k48b_result.log +0 -89
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783622493677_zwc35w_prompt.log +0 -19
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/audit_1783622493677_zwc35w_result.log +0 -207
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783604894861_v6n3ut_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783604894861_v6n3ut_result.log +0 -66
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783605934532_9h8ikb_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783605934532_9h8ikb_result.log +0 -68
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783607181736_t12f4y_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783607181736_t12f4y_result.log +0 -78
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783608341266_zhk0fl_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783608341266_zhk0fl_result.log +0 -68
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783609420180_7xw817_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783609420180_7xw817_result.log +0 -72
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783610535307_2pxofp_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783610535307_2pxofp_result.log +0 -17
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783611437445_ofwnpb_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783611437445_ofwnpb_result.log +0 -60
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783612556827_1cb112_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783612556827_1cb112_result.log +0 -56
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783613579531_18xiax_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783613579531_18xiax_result.log +0 -74
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783614650481_2zdz7w_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783614650481_2zdz7w_result.log +0 -68
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783615742328_rjj69d_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783615742328_rjj69d_result.log +0 -65
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783616767230_1iad99_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783616767230_1iad99_result.log +0 -68
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783617783537_rqagku_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783617783537_rqagku_result.log +0 -56
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783618817343_r1lbhr_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783618817343_r1lbhr_result.log +0 -65
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783619907773_8msfw3_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783619907773_8msfw3_result.log +0 -77
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783621009302_hybdum_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783621009302_hybdum_result.log +0 -64
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783622083681_nznpnx_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783622083681_nznpnx_result.log +0 -56
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/optimize_1783623208340_olsbaw_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783605134860_9jssz9_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783605134860_9jssz9_result.log +0 -69
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783606516743_zftbaa_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783606516743_zftbaa_result.log +0 -92
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783608038317_jrd66e_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783608038317_jrd66e_result.log +0 -92
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783609388416_mc3zoe_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783609388416_mc3zoe_result.log +0 -82
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783610821384_tzqvlb_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783610821384_tzqvlb_result.log +0 -17
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783612023285_buygpo_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783612023285_buygpo_result.log +0 -57
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783613599301_6f78cw_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783613599301_6f78cw_result.log +0 -60
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783615000844_v95ues_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783615000844_v95ues_result.log +0 -69
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783616341693_bl5d9o_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783616341693_bl5d9o_result.log +0 -64
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783617832831_ha6s8d_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783617832831_ha6s8d_result.log +0 -42
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783619384959_s5iiwf_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783619384959_s5iiwf_result.log +0 -47
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783620946263_d7ovai_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783620946263_d7ovai_result.log +0 -52
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783622473846_t839e5_prompt.log +0 -14
- package/plugins/ruflo-metaharness/.claude-flow/logs/headless/testgaps_1783622473846_t839e5_result.log +0 -96
- package/plugins/ruflo-metaharness/.claude-flow/metrics/backup.json +0 -7
- package/plugins/ruflo-metaharness/.claude-flow/metrics/codebase-map.json +0 -11
- package/plugins/ruflo-metaharness/.claude-flow/metrics/consolidation.json +0 -16
- package/plugins/ruflo-metaharness/.claude-flow/metrics/harness-loop.json +0 -83
- package/plugins/ruflo-metaharness/.claude-flow/metrics/performance.json +0 -55
- package/plugins/ruflo-metaharness/.claude-flow/metrics/security-audit.json +0 -206
- package/plugins/ruflo-metaharness/.claude-flow/metrics/test-gaps.json +0 -95
- package/plugins/ruflo-metaharness/.claude-flow/neural/stats.json +0 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
3.38.
|
|
1
|
+
3.38.20
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"manifest": {
|
|
3
|
-
"version": "3.38.
|
|
3
|
+
"version": "3.38.22",
|
|
4
4
|
"files": {
|
|
5
5
|
"auto-memory-hook.mjs": "85fe05c757421c52137c0bc8545a0896bab6b4714538c2a11d1d0835bfcc8c1c",
|
|
6
|
-
"hook-handler.cjs": "
|
|
6
|
+
"hook-handler.cjs": "209d9fafe10e17d1be0866727f6f9cf9ac66f9a0793f1c793a4f58319e8e4583",
|
|
7
7
|
"intelligence.cjs": "30e42ed7ec4ca5a94ac54fdb1330d2d47ac5f3fdeeef207753574723a9e77b5c",
|
|
8
8
|
"statusline.cjs": "4a48353b4f1566fa4379b00fd0321b6676a22b6cc91fbbd8380ac5183d619468"
|
|
9
9
|
}
|
|
10
10
|
},
|
|
11
|
-
"signature": "
|
|
11
|
+
"signature": "L/Ni7Qu9lqMl9mA0S+bEte8Y0kQP18vOxwaH2KP6yXFrI89YF5rLVmx2I8WI8GJyjOiEcctPnbwyA97QpLO0CA==",
|
|
12
12
|
"algorithm": "ed25519"
|
|
13
13
|
}
|
|
@@ -587,9 +587,20 @@ const handlers = {
|
|
|
587
587
|
|
|
588
588
|
// Hooks must ALWAYS exit 0 — Claude Code treats non-zero as "hook error"
|
|
589
589
|
// and skips all subsequent hooks for the event.
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
590
|
+
//
|
|
591
|
+
// Only dispatch when run directly (node hook-handler.cjs <cmd>). When
|
|
592
|
+
// require()'d by a test, expose the internals instead of reading stdin and
|
|
593
|
+
// calling process.exit — the 2026-06-15 fix (cb1e93e8d) added this guard and
|
|
594
|
+
// the exports for tests/hook-handler-runwithtimeout.test.cjs; the 2026-07-04
|
|
595
|
+
// helper sync (a5f86ad0a) dropped both, so the test died with
|
|
596
|
+
// "runWithTimeout is not a function" once the Test Suite job ran again.
|
|
597
|
+
if (require.main === module) {
|
|
598
|
+
process.exitCode = 0;
|
|
599
|
+
main().catch((e) => {
|
|
600
|
+
try { console.log(`[WARN] Hook handler error: ${e.message}`); } catch (_) {}
|
|
601
|
+
}).finally(() => {
|
|
602
|
+
process.exit(0);
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
module.exports = { runWithTimeout, INTELLIGENCE_TIMEOUT_MS };
|
package/catalog-manifest.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"generation":
|
|
4
|
-
"generatedAt": "2026-
|
|
5
|
-
"gitSha": "
|
|
3
|
+
"generation": 6,
|
|
4
|
+
"generatedAt": "2026-09-07T17:25:59.600Z",
|
|
5
|
+
"gitSha": "6acc6891",
|
|
6
6
|
"catalog": {
|
|
7
|
-
"agents":
|
|
7
|
+
"agents": 167,
|
|
8
8
|
"tools": 397,
|
|
9
9
|
"skills": 34
|
|
10
10
|
},
|
|
@@ -583,6 +583,10 @@ const searchCommand = {
|
|
|
583
583
|
score: e.score,
|
|
584
584
|
namespace: e.namespace,
|
|
585
585
|
provenanceType: e.provenanceType,
|
|
586
|
+
// Dream Cycle 2026-09-03: thread the already-computed
|
|
587
|
+
// embedding through so SmartRetrieval's MMR step can use
|
|
588
|
+
// cosine similarity instead of a text-overlap proxy.
|
|
589
|
+
embedding: e.embedding,
|
|
586
590
|
})),
|
|
587
591
|
};
|
|
588
592
|
};
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { output } from '../output.js';
|
|
9
9
|
import { hasConsent, recordConsent, revokeConsent } from '../funnel/index.js';
|
|
10
|
-
import {
|
|
10
|
+
import { uninstallProxy } from '../proxy/install.js';
|
|
11
|
+
import { installAndActivateProxy } from '../proxy/activation.js';
|
|
11
12
|
import { startForeground, startBackground, stopProxy, getProxyStatus, readProxyLogTail, watchProxyLog, ProxyNotInstalledError, ProxyAlreadyRunningError, } from '../proxy/lifecycle.js';
|
|
12
13
|
import { proxyTokenPath } from '../proxy/paths.js';
|
|
13
14
|
import { removeInjectedToken, startTokenRefreshPump } from '../proxy/token-bridge.js';
|
|
@@ -135,8 +136,8 @@ const installSub = {
|
|
|
135
136
|
try {
|
|
136
137
|
const spinner = output.createSpinner({ text: `Installing meta-proxy ${version}...`, spinner: 'dots' });
|
|
137
138
|
spinner.start();
|
|
138
|
-
const result = await
|
|
139
|
-
spinner.succeed(`meta-proxy ${version} installed`);
|
|
139
|
+
const result = await installAndActivateProxy(version, (line) => spinner.setText(line));
|
|
140
|
+
spinner.succeed(`meta-proxy ${version} installed and verified effective`);
|
|
140
141
|
output.writeln(` binary: ${result.binaryPath}`);
|
|
141
142
|
output.writeln(` sha256: ${result.sha256}`);
|
|
142
143
|
return { success: true, data: result };
|
|
@@ -172,8 +173,8 @@ const updateSub = {
|
|
|
172
173
|
try {
|
|
173
174
|
const spinner = output.createSpinner({ text: `Updating meta-proxy to ${version}...`, spinner: 'dots' });
|
|
174
175
|
spinner.start();
|
|
175
|
-
const result = await
|
|
176
|
-
spinner.succeed(`meta-proxy updated to ${version}`);
|
|
176
|
+
const result = await installAndActivateProxy(version, (line) => spinner.setText(line));
|
|
177
|
+
spinner.succeed(`meta-proxy updated to ${version} and verified effective`);
|
|
177
178
|
output.writeln(` binary: ${result.binaryPath}`);
|
|
178
179
|
return { success: true, data: result };
|
|
179
180
|
}
|
|
@@ -485,6 +485,10 @@ export const memoryTools = [
|
|
|
485
485
|
score: e.score,
|
|
486
486
|
namespace: e.namespace,
|
|
487
487
|
provenanceType: e.provenanceType,
|
|
488
|
+
// Dream Cycle 2026-09-03: thread the already-computed
|
|
489
|
+
// embedding through so SmartRetrieval's MMR step can use
|
|
490
|
+
// cosine similarity instead of a text-overlap proxy.
|
|
491
|
+
embedding: e.embedding,
|
|
488
492
|
})),
|
|
489
493
|
};
|
|
490
494
|
};
|
|
@@ -476,6 +476,11 @@ export declare function searchEntries(options: {
|
|
|
476
476
|
score: number;
|
|
477
477
|
namespace: string;
|
|
478
478
|
provenanceType?: string;
|
|
479
|
+
/** Dream Cycle 2026-09-03: the query-time cosine score above already
|
|
480
|
+
* consumes this vector — surfaced so SmartRetrieval's MMR step can
|
|
481
|
+
* reuse it instead of falling back to a text-overlap proxy. Internal
|
|
482
|
+
* plumbing only; CLI/MCP response mappers do not forward this field. */
|
|
483
|
+
embedding?: number[];
|
|
479
484
|
}[];
|
|
480
485
|
searchTime: number;
|
|
481
486
|
error?: string;
|
|
@@ -1250,13 +1250,33 @@ export async function checkAndMigrateLegacy(options) {
|
|
|
1250
1250
|
* (ReasoningBank, SkillLibrary, ExplainableRecall, etc.) are instantiated.
|
|
1251
1251
|
*
|
|
1252
1252
|
* Uses the memory-bridge's getControllerRegistry() which lazily creates
|
|
1253
|
-
* a singleton ControllerRegistry
|
|
1254
|
-
*
|
|
1253
|
+
* a singleton ControllerRegistry. Deliberately called with NO dbPath so the
|
|
1254
|
+
* bridge resolves its own dedicated file via `getAgentDbPath()` — the same
|
|
1255
|
+
* resolution every other bridge call (bridgeStoreEntry, bridgeGetEntry, ...)
|
|
1256
|
+
* uses when it omits `dbPath`. After this call, all enabled controllers are
|
|
1257
|
+
* ready for immediate use.
|
|
1255
1258
|
*
|
|
1256
|
-
*
|
|
1257
|
-
*
|
|
1259
|
+
* #3155: this used to be called with the sql.js-facing `memory.db` path
|
|
1260
|
+
* (the one just written by the block above, via `resolveDbPath()`), which
|
|
1261
|
+
* seeded the process-wide ControllerRegistry singleton with THAT file as
|
|
1262
|
+
* AgentDB's native better-sqlite3 database — instead of the dedicated
|
|
1263
|
+
* `agentdb-memory.db` sibling `getAgentDbPath()` exists specifically to
|
|
1264
|
+
* provide (#2786, so native better-sqlite3 doesn't hit a possibly-encrypted
|
|
1265
|
+
* `memory.db`). Because `initializeMemoryDatabase()` only reaches this call
|
|
1266
|
+
* on a database's FIRST-EVER init (the `#1791.6` already-exists branch above
|
|
1267
|
+
* returns early without activating anything), a bridge started against a
|
|
1268
|
+
* brand-new `.swarm/` directory would activate the registry against
|
|
1269
|
+
* `memory.db`, store/retrieve correctly for that process's lifetime, and
|
|
1270
|
+
* then a SUBSEQUENT process — where `.swarm/memory.db` already exists so
|
|
1271
|
+
* this init path is skipped — would have its first bridge call activate the
|
|
1272
|
+
* registry against `agentdb-memory.db` instead (via the `dbPath ||
|
|
1273
|
+
* getAgentDbPath()` fallback in memory-bridge.ts's `getRegistry()`), an
|
|
1274
|
+
* empty file that never received the earlier writes. Restarting the bridge
|
|
1275
|
+
* therefore silently lost read access to everything it had written, with no
|
|
1276
|
+
* error anywhere. Passing no dbPath here makes both code paths agree on
|
|
1277
|
+
* `agentdb-memory.db` every time, regardless of init history.
|
|
1258
1278
|
*/
|
|
1259
|
-
async function activateControllerRegistry(
|
|
1279
|
+
async function activateControllerRegistry(verbose) {
|
|
1260
1280
|
const startTime = performance.now();
|
|
1261
1281
|
const activated = [];
|
|
1262
1282
|
const failed = [];
|
|
@@ -1265,7 +1285,7 @@ async function activateControllerRegistry(dbPath, verbose) {
|
|
|
1265
1285
|
if (!bridge) {
|
|
1266
1286
|
return { activated, failed, initTimeMs: performance.now() - startTime };
|
|
1267
1287
|
}
|
|
1268
|
-
const registry = await bridge.getControllerRegistry(
|
|
1288
|
+
const registry = await bridge.getControllerRegistry();
|
|
1269
1289
|
if (!registry) {
|
|
1270
1290
|
return { activated, failed, initTimeMs: performance.now() - startTime };
|
|
1271
1291
|
}
|
|
@@ -1708,7 +1728,7 @@ export async function initializeMemoryDatabase(options) {
|
|
|
1708
1728
|
fs.writeFileSync(schemaPath, MEMORY_SCHEMA_V3 + '\n' + getInitialMetadata(backend));
|
|
1709
1729
|
// ADR-053: Activate ControllerRegistry so controllers (ReasoningBank,
|
|
1710
1730
|
// SkillLibrary, ExplainableRecall, etc.) are instantiated during init
|
|
1711
|
-
const controllerResult = await activateControllerRegistry(
|
|
1731
|
+
const controllerResult = await activateControllerRegistry(verbose);
|
|
1712
1732
|
return {
|
|
1713
1733
|
success: true,
|
|
1714
1734
|
backend,
|
|
@@ -1768,7 +1788,7 @@ export async function initializeMemoryDatabase(options) {
|
|
|
1768
1788
|
sqliteHeader[27] = 0x20; // leaf payload
|
|
1769
1789
|
writeFileRestricted(dbPath, sqliteHeader, { encrypt: true });
|
|
1770
1790
|
// ADR-053: Activate ControllerRegistry even on fallback path
|
|
1771
|
-
const controllerResult = await activateControllerRegistry(
|
|
1791
|
+
const controllerResult = await activateControllerRegistry(verbose);
|
|
1772
1792
|
return {
|
|
1773
1793
|
success: true,
|
|
1774
1794
|
backend,
|
|
@@ -2673,10 +2693,11 @@ export async function searchEntries(options) {
|
|
|
2673
2693
|
continue;
|
|
2674
2694
|
}
|
|
2675
2695
|
let score = 0;
|
|
2696
|
+
let parsedEmbedding;
|
|
2676
2697
|
if (embeddingJson) {
|
|
2677
2698
|
try {
|
|
2678
|
-
|
|
2679
|
-
score = cosineSim(queryEmbedding,
|
|
2699
|
+
parsedEmbedding = JSON.parse(embeddingJson);
|
|
2700
|
+
score = cosineSim(queryEmbedding, parsedEmbedding);
|
|
2680
2701
|
}
|
|
2681
2702
|
catch { /* skip */ }
|
|
2682
2703
|
}
|
|
@@ -2688,6 +2709,7 @@ export async function searchEntries(options) {
|
|
|
2688
2709
|
score,
|
|
2689
2710
|
namespace: candidate.namespace,
|
|
2690
2711
|
provenanceType: provenanceTypeVal || 'unknown',
|
|
2712
|
+
embedding: parsedEmbedding,
|
|
2691
2713
|
});
|
|
2692
2714
|
}
|
|
2693
2715
|
}
|
|
@@ -2789,13 +2811,15 @@ export async function searchEntries(options) {
|
|
|
2789
2811
|
for (const row of entries[0].values) {
|
|
2790
2812
|
const [id, key, ns, content, embeddingJson, provenanceTypeVal] = row;
|
|
2791
2813
|
let score = 0;
|
|
2814
|
+
let parsedEmbedding;
|
|
2792
2815
|
if (embeddingJson) {
|
|
2793
2816
|
try {
|
|
2794
|
-
|
|
2795
|
-
score = cosineSim(queryEmbedding,
|
|
2817
|
+
parsedEmbedding = JSON.parse(embeddingJson);
|
|
2818
|
+
score = cosineSim(queryEmbedding, parsedEmbedding);
|
|
2796
2819
|
}
|
|
2797
2820
|
catch {
|
|
2798
2821
|
// Invalid embedding, use keyword score
|
|
2822
|
+
parsedEmbedding = undefined;
|
|
2799
2823
|
}
|
|
2800
2824
|
}
|
|
2801
2825
|
// Fallback to keyword matching
|
|
@@ -2815,6 +2839,7 @@ export async function searchEntries(options) {
|
|
|
2815
2839
|
score,
|
|
2816
2840
|
namespace: ns || 'default',
|
|
2817
2841
|
provenanceType: provenanceTypeVal || 'unknown',
|
|
2842
|
+
embedding: parsedEmbedding,
|
|
2818
2843
|
});
|
|
2819
2844
|
}
|
|
2820
2845
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type InstallResult } from './install.js';
|
|
2
|
+
export interface EffectiveProxy {
|
|
3
|
+
version: string;
|
|
4
|
+
pid: number;
|
|
5
|
+
executable: string;
|
|
6
|
+
}
|
|
7
|
+
type Wait = (milliseconds: number) => Promise<void>;
|
|
8
|
+
export declare function probeEffectiveProxy(fetcher?: typeof fetch, platform?: NodeJS.Platform): Promise<EffectiveProxy | null>;
|
|
9
|
+
export declare function acquireProxyInstallLease(wait?: Wait): Promise<() => void>;
|
|
10
|
+
export declare function installAndActivateProxy(version: string, log?: (line: string) => void): Promise<InstallResult & {
|
|
11
|
+
pid: number;
|
|
12
|
+
}>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=activation.d.ts.map
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/** Transactional activation of the daemon that actually owns the proxy port. */
|
|
2
|
+
import { spawn, spawnSync } from 'node:child_process';
|
|
3
|
+
import * as fs from 'node:fs';
|
|
4
|
+
import { homedir } from 'node:os';
|
|
5
|
+
import * as path from 'node:path';
|
|
6
|
+
import { installProxy } from './install.js';
|
|
7
|
+
import { isLoopbackBind, proxyBinaryPath, proxyConfigPath, proxyInstallLockPath, proxyInstallManifestPath, proxyLogFilePath, proxyPidFilePath, } from './paths.js';
|
|
8
|
+
const waitNormally = (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
9
|
+
function processExists(pid) {
|
|
10
|
+
try {
|
|
11
|
+
process.kill(pid, 0);
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
return error.code === 'EPERM';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function effectiveEndpoint() {
|
|
19
|
+
let bind = '127.0.0.1:11435';
|
|
20
|
+
try {
|
|
21
|
+
const match = fs.readFileSync(proxyConfigPath(), 'utf8').match(/^bind\s*=\s*"([^"]+)"\s*$/m);
|
|
22
|
+
if (match?.[1])
|
|
23
|
+
bind = match[1];
|
|
24
|
+
}
|
|
25
|
+
catch { /* documented default */ }
|
|
26
|
+
if (!isLoopbackBind(bind))
|
|
27
|
+
throw new Error(`Refusing to probe non-loopback Meta-Proxy bind "${bind}".`);
|
|
28
|
+
return `http://${bind}`;
|
|
29
|
+
}
|
|
30
|
+
function executableFor(pid, platform) {
|
|
31
|
+
try {
|
|
32
|
+
if (platform === 'linux') {
|
|
33
|
+
const result = spawnSync('readlink', ['-f', `/proc/${pid}/exe`], { encoding: 'utf8', timeout: 2_000 });
|
|
34
|
+
return result.status === 0 ? result.stdout.trim() || null : null;
|
|
35
|
+
}
|
|
36
|
+
if (platform === 'win32') {
|
|
37
|
+
const command = `$p = Get-CimInstance Win32_Process -Filter 'ProcessId = ${pid}'; if ($null -ne $p) { [Console]::Out.Write($p.ExecutablePath) }`;
|
|
38
|
+
const result = spawnSync('powershell.exe', ['-NoProfile', '-NonInteractive', '-Command', command], { encoding: 'utf8', timeout: 2_000, windowsHide: true });
|
|
39
|
+
return result.status === 0 ? result.stdout.trim() || null : null;
|
|
40
|
+
}
|
|
41
|
+
const result = spawnSync('ps', ['-p', String(pid), '-o', 'comm='], { encoding: 'utf8', timeout: 2_000 });
|
|
42
|
+
return result.status === 0 ? result.stdout.trim() || null : null;
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function isSupportedOwner(executable, platform) {
|
|
49
|
+
const name = platform === 'win32' ? 'meta-proxy.exe' : 'meta-proxy';
|
|
50
|
+
const normalize = (value) => platform === 'win32' ? path.resolve(value).toLowerCase() : path.resolve(value);
|
|
51
|
+
const allowed = [
|
|
52
|
+
proxyBinaryPath(),
|
|
53
|
+
path.join(homedir(), '.metaharness', 'meta-proxy', 'bin', name),
|
|
54
|
+
path.join(homedir(), '.metaharness', 'bin', name),
|
|
55
|
+
path.join(homedir(), '.cargo', 'bin', name),
|
|
56
|
+
].map(normalize);
|
|
57
|
+
return allowed.includes(normalize(executable));
|
|
58
|
+
}
|
|
59
|
+
export async function probeEffectiveProxy(fetcher = globalThis.fetch, platform = process.platform) {
|
|
60
|
+
const endpoint = effectiveEndpoint();
|
|
61
|
+
try {
|
|
62
|
+
const controller = new AbortController();
|
|
63
|
+
const timer = setTimeout(() => controller.abort(), 1_000);
|
|
64
|
+
let response;
|
|
65
|
+
try {
|
|
66
|
+
response = await fetcher(`${endpoint}/version`, { signal: controller.signal });
|
|
67
|
+
}
|
|
68
|
+
finally {
|
|
69
|
+
clearTimeout(timer);
|
|
70
|
+
}
|
|
71
|
+
if (!response.ok)
|
|
72
|
+
return null;
|
|
73
|
+
const body = await response.json();
|
|
74
|
+
if (typeof body.version !== 'string' || !/^\d+\.\d+\.\d+(?:[-+][A-Za-z0-9.-]+)?$/.test(body.version))
|
|
75
|
+
return null;
|
|
76
|
+
if (!Number.isSafeInteger(body.pid) || Number(body.pid) <= 0)
|
|
77
|
+
return null;
|
|
78
|
+
const executable = executableFor(Number(body.pid), platform);
|
|
79
|
+
return executable ? { version: body.version, pid: Number(body.pid), executable } : null;
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
export async function acquireProxyInstallLease(wait = waitNormally) {
|
|
86
|
+
const lock = proxyInstallLockPath();
|
|
87
|
+
fs.mkdirSync(path.dirname(lock), { recursive: true, mode: 0o700 });
|
|
88
|
+
for (let attempt = 0; attempt < 200; attempt++) {
|
|
89
|
+
try {
|
|
90
|
+
fs.mkdirSync(lock, { mode: 0o700 });
|
|
91
|
+
fs.writeFileSync(path.join(lock, 'owner'), `${process.pid}\n`, { mode: 0o600 });
|
|
92
|
+
return () => fs.rmSync(lock, { recursive: true, force: true });
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
if (error.code !== 'EEXIST')
|
|
96
|
+
throw error;
|
|
97
|
+
try {
|
|
98
|
+
const age = Date.now() - fs.statSync(lock).mtimeMs;
|
|
99
|
+
const owner = Number.parseInt(fs.readFileSync(path.join(lock, 'owner'), 'utf8').trim(), 10);
|
|
100
|
+
if (age > 120_000 && (!Number.isSafeInteger(owner) || owner <= 0 || !processExists(owner))) {
|
|
101
|
+
fs.rmSync(lock, { recursive: true, force: true });
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
catch { /* another installer may still be writing its owner */ }
|
|
106
|
+
await wait(50);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
throw new Error('Another Ruflo/MetaHarness installer still owns the Meta-Proxy install lease.');
|
|
110
|
+
}
|
|
111
|
+
async function stopEffective(wait) {
|
|
112
|
+
const owner = await probeEffectiveProxy();
|
|
113
|
+
if (!owner)
|
|
114
|
+
return null;
|
|
115
|
+
if (!isSupportedOwner(owner.executable, process.platform)) {
|
|
116
|
+
throw new Error(`Meta-Proxy port owner pid ${owner.pid} is not a recognized Ruflo/MetaHarness binary; refusing to signal it.`);
|
|
117
|
+
}
|
|
118
|
+
process.kill(owner.pid, 'SIGTERM');
|
|
119
|
+
for (let attempt = 0; attempt < 40; attempt++) {
|
|
120
|
+
await wait(50);
|
|
121
|
+
const current = await probeEffectiveProxy();
|
|
122
|
+
if (!current || current.pid !== owner.pid)
|
|
123
|
+
return owner;
|
|
124
|
+
}
|
|
125
|
+
throw new Error(`Stale Meta-Proxy pid ${owner.pid} did not stop.`);
|
|
126
|
+
}
|
|
127
|
+
function launch(binary) {
|
|
128
|
+
fs.mkdirSync(path.dirname(proxyLogFilePath()), { recursive: true, mode: 0o700 });
|
|
129
|
+
const log = fs.openSync(proxyLogFilePath(), 'a', 0o600);
|
|
130
|
+
try {
|
|
131
|
+
const child = spawn(binary, [], { detached: true, stdio: ['ignore', log, log], windowsHide: true });
|
|
132
|
+
if (!child.pid)
|
|
133
|
+
throw new Error('Meta-Proxy did not return a process id.');
|
|
134
|
+
child.unref();
|
|
135
|
+
fs.writeFileSync(proxyPidFilePath(), `${child.pid}\n`, { mode: 0o600 });
|
|
136
|
+
return child.pid;
|
|
137
|
+
}
|
|
138
|
+
finally {
|
|
139
|
+
fs.closeSync(log);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
async function launchAndVerify(binary, version, wait) {
|
|
143
|
+
const pid = launch(binary);
|
|
144
|
+
for (let attempt = 0; attempt < 100; attempt++) {
|
|
145
|
+
await wait(50);
|
|
146
|
+
const current = await probeEffectiveProxy();
|
|
147
|
+
if (current?.pid === pid && current.version === version && path.resolve(current.executable) === path.resolve(binary))
|
|
148
|
+
return current;
|
|
149
|
+
if (current && current.pid !== pid) {
|
|
150
|
+
try {
|
|
151
|
+
process.kill(pid, 'SIGTERM');
|
|
152
|
+
}
|
|
153
|
+
catch { /* already exited */ }
|
|
154
|
+
throw new Error(`Competing Meta-Proxy pid ${current.pid} won the port with version ${current.version}.`);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
try {
|
|
158
|
+
process.kill(pid, 'SIGTERM');
|
|
159
|
+
}
|
|
160
|
+
catch { /* already exited */ }
|
|
161
|
+
throw new Error(`Meta-Proxy v${version} did not become the effective daemon.`);
|
|
162
|
+
}
|
|
163
|
+
export async function installAndActivateProxy(version, log) {
|
|
164
|
+
const wait = waitNormally;
|
|
165
|
+
const binary = proxyBinaryPath();
|
|
166
|
+
const manifest = proxyInstallManifestPath();
|
|
167
|
+
const binaryBackup = `${binary}.rollback`;
|
|
168
|
+
const manifestBackup = `${manifest}.rollback`;
|
|
169
|
+
let release = null;
|
|
170
|
+
let prior = null;
|
|
171
|
+
try {
|
|
172
|
+
release = await acquireProxyInstallLease(wait);
|
|
173
|
+
prior = await stopEffective(wait);
|
|
174
|
+
fs.rmSync(binaryBackup, { force: true });
|
|
175
|
+
fs.rmSync(manifestBackup, { force: true });
|
|
176
|
+
if (fs.existsSync(binary))
|
|
177
|
+
fs.copyFileSync(binary, binaryBackup);
|
|
178
|
+
if (fs.existsSync(manifest))
|
|
179
|
+
fs.copyFileSync(manifest, manifestBackup);
|
|
180
|
+
const installed = await installProxy({ version, log });
|
|
181
|
+
const effective = await launchAndVerify(installed.binaryPath, installed.version, wait);
|
|
182
|
+
return { ...installed, pid: effective.pid };
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
const failure = error instanceof Error ? error.message : String(error);
|
|
186
|
+
if (fs.existsSync(binaryBackup)) {
|
|
187
|
+
try {
|
|
188
|
+
await stopEffective(wait);
|
|
189
|
+
fs.rmSync(binary, { force: true });
|
|
190
|
+
fs.renameSync(binaryBackup, binary);
|
|
191
|
+
fs.rmSync(manifest, { force: true });
|
|
192
|
+
if (fs.existsSync(manifestBackup))
|
|
193
|
+
fs.renameSync(manifestBackup, manifest);
|
|
194
|
+
if (prior)
|
|
195
|
+
await launchAndVerify(prior.executable === binary ? binary : prior.executable, prior.version, wait);
|
|
196
|
+
}
|
|
197
|
+
catch (rollbackError) {
|
|
198
|
+
throw new Error(`${failure} Rollback failed: ${rollbackError instanceof Error ? rollbackError.message : String(rollbackError)}`);
|
|
199
|
+
}
|
|
200
|
+
throw new Error(`${failure} Previous Meta-Proxy ${prior ? 'was restored and verified' : 'binary was restored; it was not running before the upgrade'}.`);
|
|
201
|
+
}
|
|
202
|
+
throw error;
|
|
203
|
+
}
|
|
204
|
+
finally {
|
|
205
|
+
fs.rmSync(binaryBackup, { force: true });
|
|
206
|
+
fs.rmSync(manifestBackup, { force: true });
|
|
207
|
+
release?.();
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=activation.js.map
|
|
@@ -143,6 +143,9 @@ export async function installProxy(opts) {
|
|
|
143
143
|
const tmp = `${finalPath}.tmp`;
|
|
144
144
|
fs.copyFileSync(extractedBinaryPath, tmp);
|
|
145
145
|
fs.chmodSync(tmp, 0o755);
|
|
146
|
+
// The activation transaction has already stopped and backed up the old
|
|
147
|
+
// daemon. Windows rename does not replace an existing executable.
|
|
148
|
+
fs.rmSync(finalPath, { force: true });
|
|
146
149
|
fs.renameSync(tmp, finalPath);
|
|
147
150
|
const liveSha = sha256Hex(fs.readFileSync(finalPath));
|
|
148
151
|
const manifest = {
|
|
@@ -10,6 +10,8 @@ export declare function proxyPidFilePath(): string;
|
|
|
10
10
|
export declare function proxyLockFilePath(): string;
|
|
11
11
|
export declare function proxyLogFilePath(): string;
|
|
12
12
|
export declare function proxyInstallManifestPath(): string;
|
|
13
|
+
/** Shared by Ruflo and MetaHarness so two IDE windows cannot race an upgrade. */
|
|
14
|
+
export declare function proxyInstallLockPath(): string;
|
|
13
15
|
export declare function proxyConfigPath(): string;
|
|
14
16
|
export declare function proxyTokenPath(): string;
|
|
15
17
|
export declare function proxyInjectedTokenPath(): string;
|
package/dist/src/proxy/paths.js
CHANGED
|
@@ -23,6 +23,10 @@ export function proxyLogFilePath() {
|
|
|
23
23
|
export function proxyInstallManifestPath() {
|
|
24
24
|
return join(funnelStateDir(), 'proxy', 'install-manifest.json');
|
|
25
25
|
}
|
|
26
|
+
/** Shared by Ruflo and MetaHarness so two IDE windows cannot race an upgrade. */
|
|
27
|
+
export function proxyInstallLockPath() {
|
|
28
|
+
return join(funnelStateDir(), 'meta-proxy-install.lock');
|
|
29
|
+
}
|
|
26
30
|
export function proxyConfigPath() {
|
|
27
31
|
return join(funnelStateDir(), 'proxy-config.toml');
|
|
28
32
|
}
|
|
@@ -376,17 +376,28 @@ export class EnhancedModelRouter {
|
|
|
376
376
|
}
|
|
377
377
|
// Step 6: Determine tier based on complexity
|
|
378
378
|
const { haiku, sonnet } = this.config.complexityThresholds;
|
|
379
|
-
// ADR-149 — forward the per-model fields from baseResult onto
|
|
380
|
-
// tier-2/3 return
|
|
381
|
-
//
|
|
382
|
-
//
|
|
383
|
-
//
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
379
|
+
// ADR-149 — forward the per-model fields from baseResult onto the
|
|
380
|
+
// tier-2/3 return, but ONLY when the tier being returned here still
|
|
381
|
+
// matches the tier baseResult.model was chosen for. `finalComplexity`
|
|
382
|
+
// (AST-adjusted / tier3-keyword-boosted, Step 5-6 above) can escalate
|
|
383
|
+
// the returned tier past what the base bandit router saw when it picked
|
|
384
|
+
// `modelId` — forwarding it unconditionally would attach a cheaper
|
|
385
|
+
// tier's concrete model (e.g. `inclusionai/ling-2.6-flash`, chosen for
|
|
386
|
+
// 'haiku') to an escalated 'opus' decision. `agent-execute-core.ts`
|
|
387
|
+
// treats a present `modelId` as an override that skips tier-based
|
|
388
|
+
// dispatch entirely, so a stale, wrong-tier `modelId` silently defeats
|
|
389
|
+
// the escalation this function just computed. Dropping the mismatched
|
|
390
|
+
// fields (rather than trying to re-resolve modelId for the new tier)
|
|
391
|
+
// keeps this fix small and fail-safe: an escalated decision falls back
|
|
392
|
+
// to the plain `model` field, never to a cheaper model's identity.
|
|
393
|
+
const neuralFieldsFor = (model) => baseResult.model === model
|
|
394
|
+
? {
|
|
395
|
+
...(baseResult.modelId ? { modelId: baseResult.modelId } : {}),
|
|
396
|
+
...(baseResult.routedBy ? { routedBy: baseResult.routedBy } : {}),
|
|
397
|
+
...(baseResult.provider ? { provider: baseResult.provider } : {}),
|
|
398
|
+
...(baseResult.openrouterModel ? { openrouterModel: baseResult.openrouterModel } : {}),
|
|
399
|
+
}
|
|
400
|
+
: {};
|
|
390
401
|
if (finalComplexity < haiku) {
|
|
391
402
|
return {
|
|
392
403
|
tier: 2,
|
|
@@ -398,7 +409,7 @@ export class EnhancedModelRouter {
|
|
|
398
409
|
canSkipLLM: false,
|
|
399
410
|
estimatedLatencyMs: 500,
|
|
400
411
|
estimatedCost: 0.0002,
|
|
401
|
-
...
|
|
412
|
+
...neuralFieldsFor('haiku'),
|
|
402
413
|
};
|
|
403
414
|
}
|
|
404
415
|
if (finalComplexity < sonnet) {
|
|
@@ -412,7 +423,7 @@ export class EnhancedModelRouter {
|
|
|
412
423
|
canSkipLLM: false,
|
|
413
424
|
estimatedLatencyMs: 2000,
|
|
414
425
|
estimatedCost: 0.003,
|
|
415
|
-
...
|
|
426
|
+
...neuralFieldsFor('sonnet'),
|
|
416
427
|
};
|
|
417
428
|
}
|
|
418
429
|
return {
|
|
@@ -425,7 +436,7 @@ export class EnhancedModelRouter {
|
|
|
425
436
|
canSkipLLM: false,
|
|
426
437
|
estimatedLatencyMs: 5000,
|
|
427
438
|
estimatedCost: 0.015,
|
|
428
|
-
...
|
|
439
|
+
...neuralFieldsFor('opus'),
|
|
429
440
|
};
|
|
430
441
|
}
|
|
431
442
|
/**
|
|
File without changes
|
|
File without changes
|
|
@@ -159,14 +159,14 @@ export declare const SpawnAgentSchema: z.ZodObject<{
|
|
|
159
159
|
timeout: z.ZodOptional<z.ZodNumber>;
|
|
160
160
|
}, "strip", z.ZodTypeAny, {
|
|
161
161
|
type: "coder" | "reviewer" | "tester" | "planner" | "researcher" | "security-architect" | "security-auditor" | "memory-specialist" | "swarm-specialist" | "integration-architect" | "performance-engineer" | "core-architect" | "test-architect" | "queen-coordinator" | "project-coordinator";
|
|
162
|
-
id?: string | undefined;
|
|
163
162
|
config?: Record<string, unknown> | undefined;
|
|
164
163
|
timeout?: number | undefined;
|
|
164
|
+
id?: string | undefined;
|
|
165
165
|
}, {
|
|
166
166
|
type: "coder" | "reviewer" | "tester" | "planner" | "researcher" | "security-architect" | "security-auditor" | "memory-specialist" | "swarm-specialist" | "integration-architect" | "performance-engineer" | "core-architect" | "test-architect" | "queen-coordinator" | "project-coordinator";
|
|
167
|
-
id?: string | undefined;
|
|
168
167
|
config?: Record<string, unknown> | undefined;
|
|
169
168
|
timeout?: number | undefined;
|
|
169
|
+
id?: string | undefined;
|
|
170
170
|
}>;
|
|
171
171
|
/**
|
|
172
172
|
* Task input schema
|
|
@@ -181,13 +181,13 @@ export declare const TaskInputSchema: z.ZodObject<{
|
|
|
181
181
|
taskId: string;
|
|
182
182
|
content: string;
|
|
183
183
|
agentType: "coder" | "reviewer" | "tester" | "planner" | "researcher" | "security-architect" | "security-auditor" | "memory-specialist" | "swarm-specialist" | "integration-architect" | "performance-engineer" | "core-architect" | "test-architect" | "queen-coordinator" | "project-coordinator";
|
|
184
|
-
priority?: "
|
|
184
|
+
priority?: "critical" | "high" | "medium" | "low" | undefined;
|
|
185
185
|
metadata?: Record<string, unknown> | undefined;
|
|
186
186
|
}, {
|
|
187
187
|
taskId: string;
|
|
188
188
|
content: string;
|
|
189
189
|
agentType: "coder" | "reviewer" | "tester" | "planner" | "researcher" | "security-architect" | "security-auditor" | "memory-specialist" | "swarm-specialist" | "integration-architect" | "performance-engineer" | "core-architect" | "test-architect" | "queen-coordinator" | "project-coordinator";
|
|
190
|
-
priority?: "
|
|
190
|
+
priority?: "critical" | "high" | "medium" | "low" | undefined;
|
|
191
191
|
metadata?: Record<string, unknown> | undefined;
|
|
192
192
|
}>;
|
|
193
193
|
/**
|
|
@@ -234,16 +234,16 @@ export declare const ExecutorConfigSchema: z.ZodObject<{
|
|
|
234
234
|
cwd: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
235
235
|
allowSudo: z.ZodDefault<z.ZodBoolean>;
|
|
236
236
|
}, "strip", z.ZodTypeAny, {
|
|
237
|
-
timeout: number;
|
|
238
237
|
allowedCommands: string[];
|
|
238
|
+
timeout: number;
|
|
239
239
|
maxBuffer: number;
|
|
240
240
|
allowSudo: boolean;
|
|
241
241
|
blockedPatterns?: string[] | undefined;
|
|
242
242
|
cwd?: string | undefined;
|
|
243
243
|
}, {
|
|
244
244
|
allowedCommands: string[];
|
|
245
|
-
timeout?: number | undefined;
|
|
246
245
|
blockedPatterns?: string[] | undefined;
|
|
246
|
+
timeout?: number | undefined;
|
|
247
247
|
maxBuffer?: number | undefined;
|
|
248
248
|
cwd?: string | undefined;
|
|
249
249
|
allowSudo?: boolean | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@claude-flow/cli",
|
|
3
|
-
"version": "3.38.
|
|
3
|
+
"version": "3.38.22",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Ruflo CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
|
|
6
6
|
"main": "dist/src/index.js",
|