@fuxi-ailabs/dsh-ecat 0.1.0-alpha.2 → 0.1.0-alpha.3

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/plugin.js +5 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fuxi-ailabs/dsh-ecat",
3
- "version": "0.1.0-alpha.2",
3
+ "version": "0.1.0-alpha.3",
4
4
  "type": "module",
5
5
  "description": "Configure and run ECAT's entropy refinement loop from DSH",
6
6
  "engines": {
package/src/plugin.js CHANGED
@@ -295,11 +295,14 @@ export function apply(ctx, config = {}) {
295
295
  // without a web server (tests, headless profiles) still loads the commands.
296
296
  if (typeof ctx.inject === 'function') {
297
297
  ctx.inject(['webServer'], (scope) => {
298
- const fallback = config.workspaceRoot || process.cwd();
298
+ const configured = config.workspaceRoot || null;
299
299
  scope.effect(() => scope.webServer.register({
300
300
  kind: 'prefix',
301
301
  path: '/ecat',
302
- handler: (req, res) => createEcatHandler(rememberedWorkspace() || fallback)(req, res),
302
+ // A configured root wins; otherwise fall back to the last workspace a
303
+ // command resolved, then to the process cwd (a stale pointer must not
304
+ // point the panel at an unrelated tree).
305
+ handler: (req, res) => createEcatHandler(configured || rememberedWorkspace() || process.cwd())(req, res),
303
306
  }), 'ecat: web ui');
304
307
  });
305
308
  }