fraim-hub 2.0.328 → 2.0.329
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/dist/src/ai-hub/server.js +33 -24
- package/package.json +2 -2
|
@@ -41,7 +41,7 @@ exports.selfHealBrokenManagedAgents = selfHealBrokenManagedAgents;
|
|
|
41
41
|
exports.configureFraimForHubAgent = configureFraimForHubAgent;
|
|
42
42
|
exports.installAgentAndRefreshDetection = installAgentAndRefreshDetection;
|
|
43
43
|
exports.hubCommandVersion = hubCommandVersion;
|
|
44
|
-
exports.
|
|
44
|
+
exports.__setCatalogSyncSpawnForTests = __setCatalogSyncSpawnForTests;
|
|
45
45
|
exports.__setAgentInstallTimeoutMsForTests = __setAgentInstallTimeoutMsForTests;
|
|
46
46
|
exports.hubRunProcess = hubRunProcess;
|
|
47
47
|
exports.buildOpenFileInvocation = buildOpenFileInvocation;
|
|
@@ -2088,12 +2088,10 @@ function hubRunSync(command, args, env) {
|
|
|
2088
2088
|
// (typically seconds) while still bounding the failure the way AC-C1 requires.
|
|
2089
2089
|
const DEFAULT_AGENT_INSTALL_TIMEOUT_MS = 90_000;
|
|
2090
2090
|
let agentInstallTimeoutMs = DEFAULT_AGENT_INSTALL_TIMEOUT_MS;
|
|
2091
|
-
//
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
function __setStartupSyncSpawnForTests(fn) {
|
|
2096
|
-
startupSyncSpawnFn = fn ?? child_process_1.spawn;
|
|
2091
|
+
// Intercept only the catalog subprocess in Hub tests.
|
|
2092
|
+
let catalogSyncSpawn = child_process_1.spawn;
|
|
2093
|
+
function __setCatalogSyncSpawnForTests(fn) {
|
|
2094
|
+
catalogSyncSpawn = fn ?? child_process_1.spawn;
|
|
2097
2095
|
}
|
|
2098
2096
|
/** Test seam only. Mirrors __setEmployeeDetectionTtlForTests in hosts.ts — proves the bound
|
|
2099
2097
|
* actually fires without a real 90s hang. Pass null to restore the production value. */
|
|
@@ -2904,6 +2902,7 @@ class AiHubServer {
|
|
|
2904
2902
|
// request or window — see the comment on BADGE_POLL_INTERVAL_MS for why this can't just
|
|
2905
2903
|
// live on the client or the relaunch-decision path.
|
|
2906
2904
|
this.latestVersionPollTimer = null;
|
|
2905
|
+
this.catalogSyncChild = null;
|
|
2907
2906
|
this.preferencesStore = options.preferencesStore || new preferences_1.AiHubPreferencesStore();
|
|
2908
2907
|
const launchResolution = options.projectPath
|
|
2909
2908
|
? { projectPath: path_1.default.resolve(options.projectPath) }
|
|
@@ -3174,6 +3173,30 @@ class AiHubServer {
|
|
|
3174
3173
|
resolveRunProjectPath(bodyProjectPath, scope) {
|
|
3175
3174
|
return (0, run_working_directory_1.resolveRunWorkingDirectory)(scope, bodyProjectPath, this.defaultProjectPath());
|
|
3176
3175
|
}
|
|
3176
|
+
// Resolve latest outside the Hub process; sync also updates the MCP launcher record (#1354).
|
|
3177
|
+
refreshLocalCatalogInBackground(global, projectRoot) {
|
|
3178
|
+
if (process.env.NODE_ENV === 'test' || this.catalogSyncChild)
|
|
3179
|
+
return;
|
|
3180
|
+
const args = ['--yes', 'fraim@latest', 'sync', ...(global ? ['--global'] : [])];
|
|
3181
|
+
try {
|
|
3182
|
+
// Windows npx is a .cmd shim. Only fixed arguments enter cmd; projectRoot stays in cwd.
|
|
3183
|
+
const child = catalogSyncSpawn(process.platform === 'win32' ? (process.env.ComSpec || 'cmd.exe') : 'npx', process.platform === 'win32' ? ['/d', '/s', '/c', 'npx', ...args] : args, { cwd: projectRoot, detached: true, stdio: 'ignore', windowsHide: true });
|
|
3184
|
+
this.catalogSyncChild = child;
|
|
3185
|
+
const release = () => {
|
|
3186
|
+
if (this.catalogSyncChild === child)
|
|
3187
|
+
this.catalogSyncChild = null;
|
|
3188
|
+
};
|
|
3189
|
+
child.once('error', (error) => {
|
|
3190
|
+
release();
|
|
3191
|
+
console.warn('[ai-hub] catalog sync could not start:', error.message);
|
|
3192
|
+
});
|
|
3193
|
+
child.once('close', release);
|
|
3194
|
+
child.unref();
|
|
3195
|
+
}
|
|
3196
|
+
catch (error) {
|
|
3197
|
+
console.warn('[ai-hub] catalog sync could not start:', error.message);
|
|
3198
|
+
}
|
|
3199
|
+
}
|
|
3177
3200
|
async start(port) {
|
|
3178
3201
|
this.httpPort = port;
|
|
3179
3202
|
await new Promise((resolve, reject) => {
|
|
@@ -3216,17 +3239,8 @@ class AiHubServer {
|
|
|
3216
3239
|
console.warn('[ai-hub] self-heal pass failed:', error?.message || error);
|
|
3217
3240
|
});
|
|
3218
3241
|
}
|
|
3219
|
-
//
|
|
3220
|
-
|
|
3221
|
-
// real processes in the test suite's many short-lived Hub instances.
|
|
3222
|
-
if (process.env.NODE_ENV !== 'test') {
|
|
3223
|
-
const syncChild = startupSyncSpawnFn('npx', ['fraim', 'sync', '--global'], {
|
|
3224
|
-
detached: true,
|
|
3225
|
-
stdio: 'ignore',
|
|
3226
|
-
});
|
|
3227
|
-
syncChild.on('error', () => { });
|
|
3228
|
-
syncChild.unref();
|
|
3229
|
-
}
|
|
3242
|
+
// Refresh the machine-level job list without delaying Hub startup.
|
|
3243
|
+
this.refreshLocalCatalogInBackground(true);
|
|
3230
3244
|
// Update-badge freshness: refresh the npm-latest cache on our own clock, not just when
|
|
3231
3245
|
// a page load or relaunch decision happens to ask for it. Without this, a Hub that's
|
|
3232
3246
|
// resident in the tray for days with no window reload and no tray re-click never learns
|
|
@@ -7036,12 +7050,7 @@ class AiHubServer {
|
|
|
7036
7050
|
res.status(201).json(responsePayload);
|
|
7037
7051
|
// Background sync: refresh the local FRAIM catalog so the next job
|
|
7038
7052
|
// picker load sees any jobs that were added or updated since last run.
|
|
7039
|
-
|
|
7040
|
-
const syncChild = (0, child_process_1.spawn)('npx', ['fraim', 'sync'], { cwd: projectPath, detached: true, stdio: 'ignore' });
|
|
7041
|
-
syncChild.on('error', () => { });
|
|
7042
|
-
syncChild.unref();
|
|
7043
|
-
}
|
|
7044
|
-
catch { /* ignore if spawn itself throws synchronously */ }
|
|
7053
|
+
this.refreshLocalCatalogInBackground(false, projectPath);
|
|
7045
7054
|
}
|
|
7046
7055
|
catch (error) {
|
|
7047
7056
|
for (const spawningRun of pendingSpawnRuns) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fraim-hub",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.329",
|
|
4
4
|
"description": "FRAIM Hub local companion package.",
|
|
5
5
|
"author": "Sid Mathur <sid.mathur@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/mathursrus/FRAIM#readme",
|
|
@@ -216,7 +216,7 @@
|
|
|
216
216
|
"electron-updater": "^6.8.9",
|
|
217
217
|
"express": "^5.2.1",
|
|
218
218
|
"extract-zip": "^2.0.1",
|
|
219
|
-
"fraim": "2.0.
|
|
219
|
+
"fraim": "2.0.329",
|
|
220
220
|
"mongodb": "^7.0.0",
|
|
221
221
|
"node-cron": "4.2.1",
|
|
222
222
|
"node-edge-tts": "^1.2.10",
|