@hamak/smart-data-dico 1.9.1 → 1.9.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.
@@ -19143,18 +19143,18 @@ var require_router = __commonJS({
19143
19143
  var toString2 = Object.prototype.toString;
19144
19144
  var proto = module.exports = function(options2) {
19145
19145
  var opts = options2 || {};
19146
- function router27(req, res, next) {
19147
- router27.handle(req, res, next);
19148
- }
19149
- __name(router27, "router");
19150
- setPrototypeOf(router27, proto);
19151
- router27.params = {};
19152
- router27._params = [];
19153
- router27.caseSensitive = opts.caseSensitive;
19154
- router27.mergeParams = opts.mergeParams;
19155
- router27.strict = opts.strict;
19156
- router27.stack = [];
19157
- return router27;
19146
+ function router28(req, res, next) {
19147
+ router28.handle(req, res, next);
19148
+ }
19149
+ __name(router28, "router");
19150
+ setPrototypeOf(router28, proto);
19151
+ router28.params = {};
19152
+ router28._params = [];
19153
+ router28.caseSensitive = opts.caseSensitive;
19154
+ router28.mergeParams = opts.mergeParams;
19155
+ router28.strict = opts.strict;
19156
+ router28.stack = [];
19157
+ return router28;
19158
19158
  };
19159
19159
  proto.param = /* @__PURE__ */ __name(function param(name21, fn) {
19160
19160
  if (typeof name21 === "function") {
@@ -22278,7 +22278,7 @@ var require_application = __commonJS({
22278
22278
  "backend/node_modules/express/lib/application.js"(exports, module) {
22279
22279
  "use strict";
22280
22280
  var finalhandler = require_finalhandler();
22281
- var Router31 = require_router();
22281
+ var Router32 = require_router();
22282
22282
  var methods = require_methods();
22283
22283
  var middleware = require_init();
22284
22284
  var query = require_query();
@@ -22343,7 +22343,7 @@ var require_application = __commonJS({
22343
22343
  }, "defaultConfiguration");
22344
22344
  app2.lazyrouter = /* @__PURE__ */ __name(function lazyrouter() {
22345
22345
  if (!this._router) {
22346
- this._router = new Router31({
22346
+ this._router = new Router32({
22347
22347
  caseSensitive: this.enabled("case sensitive routing"),
22348
22348
  strict: this.enabled("strict routing")
22349
22349
  });
@@ -22352,17 +22352,17 @@ var require_application = __commonJS({
22352
22352
  }
22353
22353
  }, "lazyrouter");
22354
22354
  app2.handle = /* @__PURE__ */ __name(function handle(req, res, callback) {
22355
- var router27 = this._router;
22355
+ var router28 = this._router;
22356
22356
  var done = callback || finalhandler(req, res, {
22357
22357
  env: this.get("env"),
22358
22358
  onerror: logerror.bind(this)
22359
22359
  });
22360
- if (!router27) {
22360
+ if (!router28) {
22361
22361
  debug2("no routes defined on app");
22362
22362
  done();
22363
22363
  return;
22364
22364
  }
22365
- router27.handle(req, res, done);
22365
+ router28.handle(req, res, done);
22366
22366
  }, "handle");
22367
22367
  app2.use = /* @__PURE__ */ __name(function use(fn) {
22368
22368
  var offset = 0;
@@ -22382,15 +22382,15 @@ var require_application = __commonJS({
22382
22382
  throw new TypeError("app.use() requires a middleware function");
22383
22383
  }
22384
22384
  this.lazyrouter();
22385
- var router27 = this._router;
22385
+ var router28 = this._router;
22386
22386
  fns.forEach(function(fn2) {
22387
22387
  if (!fn2 || !fn2.handle || !fn2.set) {
22388
- return router27.use(path14, fn2);
22388
+ return router28.use(path14, fn2);
22389
22389
  }
22390
22390
  debug2(".use app under %s", path14);
22391
22391
  fn2.mountpath = path14;
22392
22392
  fn2.parent = this;
22393
- router27.use(path14, /* @__PURE__ */ __name(function mounted_app(req, res, next) {
22393
+ router28.use(path14, /* @__PURE__ */ __name(function mounted_app(req, res, next) {
22394
22394
  var orig = req.app;
22395
22395
  fn2.handle(req, res, function(err) {
22396
22396
  setPrototypeOf(req, orig.request);
@@ -24275,7 +24275,7 @@ var require_express = __commonJS({
24275
24275
  var mixin = require_merge_descriptors();
24276
24276
  var proto = require_application();
24277
24277
  var Route = require_route();
24278
- var Router31 = require_router();
24278
+ var Router32 = require_router();
24279
24279
  var req = require_request();
24280
24280
  var res = require_response();
24281
24281
  exports = module.exports = createApplication;
@@ -24299,7 +24299,7 @@ var require_express = __commonJS({
24299
24299
  exports.request = req;
24300
24300
  exports.response = res;
24301
24301
  exports.Route = Route;
24302
- exports.Router = Router31;
24302
+ exports.Router = Router32;
24303
24303
  exports.json = bodyParser2.json;
24304
24304
  exports.query = require_query();
24305
24305
  exports.raw = bodyParser2.raw;
@@ -24708,7 +24708,7 @@ var require_main = __commonJS({
24708
24708
  "backend/node_modules/dotenv/lib/main.js"(exports, module) {
24709
24709
  var fs6 = __require("fs");
24710
24710
  var path14 = __require("path");
24711
- var os3 = __require("os");
24711
+ var os4 = __require("os");
24712
24712
  var crypto4 = __require("crypto");
24713
24713
  var packageJson = require_package();
24714
24714
  var version2 = packageJson.version;
@@ -24839,7 +24839,7 @@ var require_main = __commonJS({
24839
24839
  }
24840
24840
  __name(_vaultPath, "_vaultPath");
24841
24841
  function _resolveHome(envPath) {
24842
- return envPath[0] === "~" ? path14.join(os3.homedir(), envPath.slice(1)) : envPath;
24842
+ return envPath[0] === "~" ? path14.join(os4.homedir(), envPath.slice(1)) : envPath;
24843
24843
  }
24844
24844
  __name(_resolveHome, "_resolveHome");
24845
24845
  function _configVault(options2) {
@@ -38342,7 +38342,7 @@ var require_has_flag = __commonJS({
38342
38342
  var require_supports_color = __commonJS({
38343
38343
  "backend/node_modules/supports-color/index.js"(exports, module) {
38344
38344
  "use strict";
38345
- var os3 = __require("os");
38345
+ var os4 = __require("os");
38346
38346
  var tty = __require("tty");
38347
38347
  var hasFlag = require_has_flag();
38348
38348
  var { env } = process;
@@ -38391,7 +38391,7 @@ var require_supports_color = __commonJS({
38391
38391
  return min;
38392
38392
  }
38393
38393
  if (process.platform === "win32") {
38394
- const osRelease = os3.release().split(".");
38394
+ const osRelease = os4.release().split(".");
38395
38395
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
38396
38396
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
38397
38397
  }
@@ -43793,7 +43793,7 @@ var init_git_service = __esm({
43793
43793
  // backend/node_modules/@hamak/ui-remote-git-fs-backend/dist/routes/git-routes.js
43794
43794
  function createGitRoutes(config3) {
43795
43795
  const { gitService, debug: debug2 } = config3;
43796
- const router27 = (0, import_express2.Router)();
43796
+ const router28 = (0, import_express2.Router)();
43797
43797
  const log2 = /* @__PURE__ */ __name((message, ...args) => {
43798
43798
  if (debug2) {
43799
43799
  console.log(`[git-routes] ${message}`, ...args);
@@ -43807,21 +43807,21 @@ function createGitRoutes(config3) {
43807
43807
  const extractPath = /* @__PURE__ */ __name((req) => {
43808
43808
  return req.params[0] || "";
43809
43809
  }, "extractPath");
43810
- router27.get("/:workspaceId/status/*", asyncHandler(async (req, res) => {
43810
+ router28.get("/:workspaceId/status/*", asyncHandler(async (req, res) => {
43811
43811
  const { workspaceId } = req.params;
43812
43812
  const path14 = extractPath(req);
43813
43813
  log2("Status request", { workspaceId, path: path14 });
43814
43814
  const status = await gitService.getStatus(workspaceId, path14);
43815
43815
  res.json(status);
43816
43816
  }));
43817
- router27.get("/:workspaceId/branches/*", asyncHandler(async (req, res) => {
43817
+ router28.get("/:workspaceId/branches/*", asyncHandler(async (req, res) => {
43818
43818
  const { workspaceId } = req.params;
43819
43819
  const path14 = extractPath(req);
43820
43820
  log2("List branches request", { workspaceId, path: path14 });
43821
43821
  const branches = await gitService.listBranches(workspaceId, path14);
43822
43822
  res.json(branches);
43823
43823
  }));
43824
- router27.post("/:workspaceId/checkout/*", asyncHandler(async (req, res) => {
43824
+ router28.post("/:workspaceId/checkout/*", asyncHandler(async (req, res) => {
43825
43825
  const { workspaceId } = req.params;
43826
43826
  const path14 = extractPath(req);
43827
43827
  const { branch, create } = req.body;
@@ -43835,7 +43835,7 @@ function createGitRoutes(config3) {
43835
43835
  await gitService.checkout(workspaceId, path14, branch, create);
43836
43836
  res.json({ success: true, branch });
43837
43837
  }));
43838
- router27.post("/:workspaceId/branch/*", asyncHandler(async (req, res) => {
43838
+ router28.post("/:workspaceId/branch/*", asyncHandler(async (req, res) => {
43839
43839
  const { workspaceId } = req.params;
43840
43840
  const path14 = extractPath(req);
43841
43841
  const { branch, startPoint } = req.body;
@@ -43849,7 +43849,7 @@ function createGitRoutes(config3) {
43849
43849
  await gitService.createBranch(workspaceId, path14, branch, startPoint);
43850
43850
  res.json({ success: true, branch });
43851
43851
  }));
43852
- router27.post("/:workspaceId/stage/*", asyncHandler(async (req, res) => {
43852
+ router28.post("/:workspaceId/stage/*", asyncHandler(async (req, res) => {
43853
43853
  const { workspaceId } = req.params;
43854
43854
  const path14 = extractPath(req);
43855
43855
  const { files } = req.body;
@@ -43857,7 +43857,7 @@ function createGitRoutes(config3) {
43857
43857
  await gitService.stage(workspaceId, path14, files);
43858
43858
  res.json({ success: true });
43859
43859
  }));
43860
- router27.post("/:workspaceId/unstage/*", asyncHandler(async (req, res) => {
43860
+ router28.post("/:workspaceId/unstage/*", asyncHandler(async (req, res) => {
43861
43861
  const { workspaceId } = req.params;
43862
43862
  const path14 = extractPath(req);
43863
43863
  const { files } = req.body;
@@ -43865,7 +43865,7 @@ function createGitRoutes(config3) {
43865
43865
  await gitService.unstage(workspaceId, path14, files);
43866
43866
  res.json({ success: true });
43867
43867
  }));
43868
- router27.post("/:workspaceId/commit/*", asyncHandler(async (req, res) => {
43868
+ router28.post("/:workspaceId/commit/*", asyncHandler(async (req, res) => {
43869
43869
  const { workspaceId } = req.params;
43870
43870
  const path14 = extractPath(req);
43871
43871
  const { message } = req.body;
@@ -43879,7 +43879,7 @@ function createGitRoutes(config3) {
43879
43879
  const result = await gitService.commit(workspaceId, path14, message);
43880
43880
  res.json(result);
43881
43881
  }));
43882
- router27.post("/:workspaceId/pull/*", asyncHandler(async (req, res) => {
43882
+ router28.post("/:workspaceId/pull/*", asyncHandler(async (req, res) => {
43883
43883
  const { workspaceId } = req.params;
43884
43884
  const path14 = extractPath(req);
43885
43885
  const { remote, branch } = req.body;
@@ -43887,7 +43887,7 @@ function createGitRoutes(config3) {
43887
43887
  const result = await gitService.pull(workspaceId, path14, remote, branch);
43888
43888
  res.json(result);
43889
43889
  }));
43890
- router27.post("/:workspaceId/push/*", asyncHandler(async (req, res) => {
43890
+ router28.post("/:workspaceId/push/*", asyncHandler(async (req, res) => {
43891
43891
  const { workspaceId } = req.params;
43892
43892
  const path14 = extractPath(req);
43893
43893
  const { remote, branch } = req.body;
@@ -43895,7 +43895,7 @@ function createGitRoutes(config3) {
43895
43895
  await gitService.push(workspaceId, path14, remote, branch);
43896
43896
  res.json({ success: true });
43897
43897
  }));
43898
- router27.post("/:workspaceId/fetch/*", asyncHandler(async (req, res) => {
43898
+ router28.post("/:workspaceId/fetch/*", asyncHandler(async (req, res) => {
43899
43899
  const { workspaceId } = req.params;
43900
43900
  const path14 = extractPath(req);
43901
43901
  const { remote } = req.body;
@@ -43903,7 +43903,7 @@ function createGitRoutes(config3) {
43903
43903
  await gitService.fetch(workspaceId, path14, remote);
43904
43904
  res.json({ success: true });
43905
43905
  }));
43906
- router27.get("/:workspaceId/diff/*", asyncHandler(async (req, res) => {
43906
+ router28.get("/:workspaceId/diff/*", asyncHandler(async (req, res) => {
43907
43907
  const { workspaceId } = req.params;
43908
43908
  const path14 = extractPath(req);
43909
43909
  const { file: file2, staged } = req.query;
@@ -43911,7 +43911,7 @@ function createGitRoutes(config3) {
43911
43911
  const result = await gitService.diff(workspaceId, path14, file2, staged === "true");
43912
43912
  res.json(result);
43913
43913
  }));
43914
- router27.get("/:workspaceId/log/*", asyncHandler(async (req, res) => {
43914
+ router28.get("/:workspaceId/log/*", asyncHandler(async (req, res) => {
43915
43915
  const { workspaceId } = req.params;
43916
43916
  const path14 = extractPath(req);
43917
43917
  const { maxCount, file: file2 } = req.query;
@@ -43919,21 +43919,21 @@ function createGitRoutes(config3) {
43919
43919
  const result = await gitService.log(workspaceId, path14, maxCount ? parseInt(maxCount, 10) : void 0, file2);
43920
43920
  res.json(result);
43921
43921
  }));
43922
- router27.get("/:workspaceId/is-repo/*", asyncHandler(async (req, res) => {
43922
+ router28.get("/:workspaceId/is-repo/*", asyncHandler(async (req, res) => {
43923
43923
  const { workspaceId } = req.params;
43924
43924
  const path14 = extractPath(req);
43925
43925
  log2("Is repo request", { workspaceId, path: path14 });
43926
43926
  const isRepo = await gitService.isRepo(workspaceId, path14);
43927
43927
  res.json({ isRepo });
43928
43928
  }));
43929
- router27.get("/:workspaceId/repo-root/*", asyncHandler(async (req, res) => {
43929
+ router28.get("/:workspaceId/repo-root/*", asyncHandler(async (req, res) => {
43930
43930
  const { workspaceId } = req.params;
43931
43931
  const path14 = extractPath(req);
43932
43932
  log2("Repo root request", { workspaceId, path: path14 });
43933
43933
  const repoRoot = await gitService.getRepoRoot(workspaceId, path14);
43934
43934
  res.json({ repoRoot });
43935
43935
  }));
43936
- return router27;
43936
+ return router28;
43937
43937
  }
43938
43938
  function gitErrorHandler(err, req, res, next) {
43939
43939
  console.error("[git-routes] Error:", err);
@@ -70036,7 +70036,7 @@ var require_token_io = __commonJS({
70036
70036
  module.exports = __toCommonJS2(token_io_exports);
70037
70037
  var import_path12 = __toESM2(__require("path"));
70038
70038
  var import_fs5 = __toESM2(__require("fs"));
70039
- var import_os3 = __toESM2(__require("os"));
70039
+ var import_os4 = __toESM2(__require("os"));
70040
70040
  var import_token_error = require_token_error();
70041
70041
  function findRootDir() {
70042
70042
  try {
@@ -70060,11 +70060,11 @@ var require_token_io = __commonJS({
70060
70060
  if (process.env.XDG_DATA_HOME) {
70061
70061
  return process.env.XDG_DATA_HOME;
70062
70062
  }
70063
- switch (import_os3.default.platform()) {
70063
+ switch (import_os4.default.platform()) {
70064
70064
  case "darwin":
70065
- return import_path12.default.join(import_os3.default.homedir(), "Library/Application Support");
70065
+ return import_path12.default.join(import_os4.default.homedir(), "Library/Application Support");
70066
70066
  case "linux":
70067
- return import_path12.default.join(import_os3.default.homedir(), ".local/share");
70067
+ return import_path12.default.join(import_os4.default.homedir(), ".local/share");
70068
70068
  case "win32":
70069
70069
  if (process.env.LOCALAPPDATA) {
70070
70070
  return process.env.LOCALAPPDATA;
@@ -70193,10 +70193,10 @@ var require_oauth = __commonJS({
70193
70193
  refreshTokenRequest: /* @__PURE__ */ __name(() => refreshTokenRequest, "refreshTokenRequest")
70194
70194
  });
70195
70195
  module.exports = __toCommonJS2(oauth_exports);
70196
- var import_os3 = __require("os");
70196
+ var import_os4 = __require("os");
70197
70197
  var VERCEL_ISSUER = "https://vercel.com";
70198
70198
  var VERCEL_CLI_CLIENT_ID = "cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp";
70199
- var userAgent = `@vercel/oidc node-${process.version} ${(0, import_os3.platform)()} (${(0, import_os3.arch)()}) ${(0, import_os3.hostname)()}`;
70199
+ var userAgent = `@vercel/oidc node-${process.version} ${(0, import_os4.platform)()} (${(0, import_os4.arch)()}) ${(0, import_os4.hostname)()}`;
70200
70200
  var _tokenEndpoint = null;
70201
70201
  async function getTokenEndpoint() {
70202
70202
  if (_tokenEndpoint) {
@@ -81365,13 +81365,14 @@ function getConfigSection(section) {
81365
81365
  function setConfigSection(section, value) {
81366
81366
  writeAppConfig({ [section]: value });
81367
81367
  }
81368
- var APP_DIR, CONFIG_FILE, STORAGE_DIR, CONVERSATIONS_DIR, PROMPTS_DIR, LEGACY_CONFIG, loosePermsWarned;
81368
+ var APP_DIR, CONFIG_FILE, ACTIVE_PROJECT_FILE, STORAGE_DIR, CONVERSATIONS_DIR, PROMPTS_DIR, LEGACY_CONFIG, loosePermsWarned;
81369
81369
  var init_appDir = __esm({
81370
81370
  "backend/src/utils/appDir.ts"() {
81371
81371
  "use strict";
81372
81372
  init_logger();
81373
81373
  APP_DIR = path8.join(os.homedir(), ".dico-app");
81374
81374
  CONFIG_FILE = path8.join(APP_DIR, "dico-app.json");
81375
+ ACTIVE_PROJECT_FILE = path8.join(APP_DIR, "active-project");
81375
81376
  STORAGE_DIR = path8.join(APP_DIR, "storage");
81376
81377
  CONVERSATIONS_DIR = path8.join(STORAGE_DIR, "conversations");
81377
81378
  PROMPTS_DIR = path8.join(STORAGE_DIR, "prompts");
@@ -114693,16 +114694,16 @@ var init_workspace_manager = __esm({
114693
114694
  });
114694
114695
 
114695
114696
  // backend/node_modules/@hamak/filesystem-server-impl/dist/routing/file-router.js
114696
- var import_express28, FileRouter;
114697
+ var import_express29, FileRouter;
114697
114698
  var init_file_router = __esm({
114698
114699
  "backend/node_modules/@hamak/filesystem-server-impl/dist/routing/file-router.js"() {
114699
- import_express28 = __toESM(require_express2(), 1);
114700
+ import_express29 = __toESM(require_express2(), 1);
114700
114701
  FileRouter = class {
114701
114702
  static {
114702
114703
  __name(this, "FileRouter");
114703
114704
  }
114704
114705
  constructor(workspaceManager2, options2) {
114705
- this.router = (0, import_express28.Router)();
114706
+ this.router = (0, import_express29.Router)();
114706
114707
  this.workspaceManager = workspaceManager2;
114707
114708
  this.enricherRegistry = options2?.enricherRegistry;
114708
114709
  this.initializeRoutes();
@@ -114829,7 +114830,7 @@ var init_file_router = __esm({
114829
114830
 
114830
114831
  // backend/node_modules/@hamak/filesystem-server-impl/dist/routing/create-router.js
114831
114832
  function createFileSystemRouter(workspaceManager2, config3) {
114832
- const app2 = (0, import_express29.Router)();
114833
+ const app2 = (0, import_express30.Router)();
114833
114834
  if (config3.enableCors ?? DEFAULT_FILESYSTEM_SERVER_CONFIG.enableCors) {
114834
114835
  app2.use((0, import_cors.default)());
114835
114836
  }
@@ -114839,10 +114840,10 @@ function createFileSystemRouter(workspaceManager2, config3) {
114839
114840
  app2.use(mountPath, fileRouter2.router);
114840
114841
  return app2;
114841
114842
  }
114842
- var import_express29, import_cors, import_body_parser;
114843
+ var import_express30, import_cors, import_body_parser;
114843
114844
  var init_create_router = __esm({
114844
114845
  "backend/node_modules/@hamak/filesystem-server-impl/dist/routing/create-router.js"() {
114845
- import_express29 = __toESM(require_express2(), 1);
114846
+ import_express30 = __toESM(require_express2(), 1);
114846
114847
  import_cors = __toESM(require_lib3(), 1);
114847
114848
  import_body_parser = __toESM(require_body_parser(), 1);
114848
114849
  init_dist9();
@@ -152677,7 +152678,7 @@ var require_constants4 = __commonJS({
152677
152678
  "use strict";
152678
152679
  var { sep: sep2 } = __require("path");
152679
152680
  var { platform } = process;
152680
- var os3 = __require("os");
152681
+ var os4 = __require("os");
152681
152682
  exports.EV_ALL = "all";
152682
152683
  exports.EV_READY = "ready";
152683
152684
  exports.EV_ADD = "add";
@@ -152731,7 +152732,7 @@ var require_constants4 = __commonJS({
152731
152732
  exports.isWindows = platform === "win32";
152732
152733
  exports.isMacos = platform === "darwin";
152733
152734
  exports.isLinux = platform === "linux";
152734
- exports.isIBMi = os3.type() === "OS400";
152735
+ exports.isIBMi = os4.type() === "OS400";
152735
152736
  }
152736
152737
  });
152737
152738
 
@@ -154551,8 +154552,8 @@ function respondError(res, err, fallbackStatus = 500) {
154551
154552
  res.status(fallbackStatus).json({ error: message });
154552
154553
  }
154553
154554
  function createLogicalFsRouter() {
154554
- const router27 = (0, import_express30.Router)();
154555
- router27.get("/:workspace/files/*", async (req, res) => {
154555
+ const router28 = (0, import_express31.Router)();
154556
+ router28.get("/:workspace/files/*", async (req, res) => {
154556
154557
  try {
154557
154558
  const ws = wsId(req.params.workspace);
154558
154559
  const projection = getProjection(ws);
@@ -154570,7 +154571,7 @@ function createLogicalFsRouter() {
154570
154571
  respondError(res, err);
154571
154572
  }
154572
154573
  });
154573
- router27.get("/:workspace/read/*", async (req, res) => {
154574
+ router28.get("/:workspace/read/*", async (req, res) => {
154574
154575
  try {
154575
154576
  const ws = wsId(req.params.workspace);
154576
154577
  const projection = getProjection(ws);
@@ -154614,9 +154615,9 @@ function createLogicalFsRouter() {
154614
154615
  respondError(res, err);
154615
154616
  }
154616
154617
  }, "writeHandler");
154617
- router27.put("/:workspace/put/*", writeHandler);
154618
- router27.post("/:workspace/post/*", writeHandler);
154619
- router27.delete("/:workspace/delete/*", async (req, res) => {
154618
+ router28.put("/:workspace/put/*", writeHandler);
154619
+ router28.post("/:workspace/post/*", writeHandler);
154620
+ router28.delete("/:workspace/delete/*", async (req, res) => {
154620
154621
  try {
154621
154622
  const ws = wsId(req.params.workspace);
154622
154623
  const projection = getProjection(ws);
@@ -154628,7 +154629,7 @@ function createLogicalFsRouter() {
154628
154629
  respondError(res, err);
154629
154630
  }
154630
154631
  });
154631
- router27.get("/:workspace/by-uuid/:uuid", (req, res) => {
154632
+ router28.get("/:workspace/by-uuid/:uuid", (req, res) => {
154632
154633
  try {
154633
154634
  const ws = wsId(req.params.workspace);
154634
154635
  const index = getUuidIndex(ws);
@@ -154643,13 +154644,13 @@ function createLogicalFsRouter() {
154643
154644
  respondError(res, err);
154644
154645
  }
154645
154646
  });
154646
- return router27;
154647
+ return router28;
154647
154648
  }
154648
- var import_express30;
154649
+ var import_express31;
154649
154650
  var init_logicalFsRouter = __esm({
154650
154651
  "backend/src/routes/logicalFsRouter.ts"() {
154651
154652
  "use strict";
154652
- import_express30 = __toESM(require_express2(), 1);
154653
+ import_express31 = __toESM(require_express2(), 1);
154653
154654
  init_types();
154654
154655
  init_ProjectionRegistry();
154655
154656
  init_UuidIndex();
@@ -154660,14 +154661,15 @@ var init_logicalFsRouter = __esm({
154660
154661
  });
154661
154662
 
154662
154663
  // backend/src/server.ts
154663
- var import_express31 = __toESM(require_express2(), 1);
154664
+ var import_express32 = __toESM(require_express2(), 1);
154664
154665
  var import_cors2 = __toESM(require_lib3(), 1);
154665
154666
  var import_dotenv2 = __toESM(require_main(), 1);
154666
154667
  import fs5 from "fs";
154667
154668
  import path13 from "path";
154669
+ import os3 from "os";
154668
154670
 
154669
154671
  // backend/src/routes/index.ts
154670
- var import_express27 = __toESM(require_express2(), 1);
154672
+ var import_express28 = __toESM(require_express2(), 1);
154671
154673
 
154672
154674
  // backend/src/routes/auth.routes.ts
154673
154675
  var import_express = __toESM(require_express2(), 1);
@@ -161603,7 +161605,51 @@ init_config();
161603
161605
  import fs2 from "fs";
161604
161606
  import path9 from "path";
161605
161607
  import os2 from "os";
161608
+ init_appDir();
161609
+ init_logger();
161606
161610
  var router25 = (0, import_express26.Router)();
161611
+ var RESTART_EXIT_CODE = 75;
161612
+ function applyProjectSwitch(req, res, dataDir, message) {
161613
+ if (process.env.SDD_MANAGED === "1") {
161614
+ try {
161615
+ fs2.mkdirSync(path9.dirname(ACTIVE_PROJECT_FILE), { recursive: true });
161616
+ fs2.writeFileSync(ACTIVE_PROJECT_FILE, dataDir, "utf-8");
161617
+ } catch (e) {
161618
+ logger.error(`Project switch: failed to persist target dir: ${e}`);
161619
+ res.status(500).json({ message: "Failed to switch project (could not persist target)." });
161620
+ return;
161621
+ }
161622
+ res.json({ message, data: { path: dataDir, name: path9.basename(path9.dirname(dataDir)) }, restarting: true });
161623
+ logger.info(`Project switch \u2192 restarting to load ${dataDir}`);
161624
+ setTimeout(() => process.exit(RESTART_EXIT_CODE), 250);
161625
+ return;
161626
+ }
161627
+ if (process.env.SDD_DEV === "1") {
161628
+ try {
161629
+ fs2.mkdirSync(path9.dirname(ACTIVE_PROJECT_FILE), { recursive: true });
161630
+ fs2.writeFileSync(ACTIVE_PROJECT_FILE, dataDir, "utf-8");
161631
+ } catch (e) {
161632
+ logger.error(`Project switch: failed to persist target dir: ${e}`);
161633
+ res.status(500).json({ message: "Failed to switch project (could not persist target)." });
161634
+ return;
161635
+ }
161636
+ res.json({ message, data: { path: dataDir, name: path9.basename(path9.dirname(dataDir)) }, restarting: true });
161637
+ logger.info(`Project switch (dev) \u2192 restarting nodemon to load ${dataDir}`);
161638
+ setTimeout(() => {
161639
+ try {
161640
+ fs2.writeFileSync(path9.join(process.cwd(), ".dico-restart.json"), JSON.stringify({ ts: Date.now(), dir: dataDir }));
161641
+ } catch (e) {
161642
+ logger.error(`Project switch (dev): failed to touch restart trigger: ${e}`);
161643
+ }
161644
+ }, 250);
161645
+ return;
161646
+ }
161647
+ config.dataDir = dataDir;
161648
+ const roots = req.app.__workspaceRoots;
161649
+ if (roots) roots.set("dictionaries", dataDir);
161650
+ res.json({ message, data: { path: dataDir, name: path9.basename(path9.dirname(dataDir)) }, restarting: false });
161651
+ }
161652
+ __name(applyProjectSwitch, "applyProjectSwitch");
161607
161653
  router25.get("/api/filesystem/browse", (req, res) => {
161608
161654
  if (config.profile !== "local") {
161609
161655
  return res.status(403).json({ message: "Filesystem browsing is only available in local mode" });
@@ -161668,10 +161714,7 @@ router25.post("/api/project/open", authorizeJwt(["admin" /* ADMIN */]), (req, re
161668
161714
  message: `No dico.config.json found at ${resolved}. Use /api/project/init to create one.`
161669
161715
  });
161670
161716
  }
161671
- config.dataDir = dataDir;
161672
- const roots = req.app.__workspaceRoots;
161673
- if (roots) roots.set("dictionaries", dataDir);
161674
- res.json({ message: `Project opened: ${dataDir}`, data: { path: dataDir, name: path9.basename(path9.dirname(dataDir)) } });
161717
+ applyProjectSwitch(req, res, dataDir, `Project opened: ${dataDir}`);
161675
161718
  });
161676
161719
  router25.post("/api/project/close", authorizeJwt(["admin" /* ADMIN */]), (req, res) => {
161677
161720
  if (config.profile !== "local") {
@@ -161679,10 +161722,7 @@ router25.post("/api/project/close", authorizeJwt(["admin" /* ADMIN */]), (req, r
161679
161722
  }
161680
161723
  const emptyDir = path9.join(os2.tmpdir(), "smart-data-dico-closed");
161681
161724
  if (!fs2.existsSync(emptyDir)) fs2.mkdirSync(emptyDir, { recursive: true });
161682
- config.dataDir = emptyDir;
161683
- const roots = req.app.__workspaceRoots;
161684
- if (roots) roots.set("dictionaries", emptyDir);
161685
- res.json({ message: "Project closed" });
161725
+ applyProjectSwitch(req, res, emptyDir, "Project closed");
161686
161726
  });
161687
161727
  router25.post("/api/project/init", authorizeJwt(["admin" /* ADMIN */]), (req, res) => {
161688
161728
  if (config.profile !== "local") {
@@ -161705,26 +161745,94 @@ router25.post("/api/project/init", authorizeJwt(["admin" /* ADMIN */]), (req, re
161705
161745
  if (!fs2.existsSync(stereotypesPath)) {
161706
161746
  fs2.writeFileSync(stereotypesPath, "[]", "utf-8");
161707
161747
  }
161708
- config.dataDir = dataDir;
161709
- const roots = req.app.__workspaceRoots;
161710
- if (roots) roots.set("dictionaries", dataDir);
161711
- res.json({ message: `Project initialized and opened: ${dataDir}`, data: { path: dataDir } });
161748
+ applyProjectSwitch(req, res, dataDir, `Project initialized and opened: ${dataDir}`);
161712
161749
  } catch (e) {
161713
161750
  res.status(500).json({ message: `Failed to initialize project: ${e}` });
161714
161751
  }
161715
161752
  });
161716
161753
  var project_routes_default = router25;
161717
161754
 
161718
- // backend/src/routes/index.ts
161755
+ // backend/src/routes/orm.routes.ts
161756
+ var import_express27 = __toESM(require_express2(), 1);
161757
+
161758
+ // backend/src/models/ormVocabulary.ts
161759
+ var ORM_PREFIX = "orm.";
161760
+ var ORM_VOCABULARY = {
161761
+ entity: [
161762
+ { key: "orm.package", kind: "string", label: "Java package", mapsTo: "class package (FQN)" },
161763
+ { key: "orm.className", kind: "string", label: "Class name", mapsTo: "class name override" },
161764
+ { key: "orm.embeddable", kind: "flag", label: "Embeddable", mapsTo: "@Embeddable" },
161765
+ { key: "orm.mappedSuperclass", kind: "flag", label: "Mapped superclass", mapsTo: "@MappedSuperclass" },
161766
+ { key: "orm.extends", kind: "entityRef", label: "Extends (supertype)", mapsTo: "inheritance \u2014 extends parent entity" },
161767
+ { key: "orm.inheritanceStrategy", kind: "enum", values: ["SINGLE_TABLE", "JOINED", "TABLE_PER_CLASS"], label: "Inheritance strategy", mapsTo: "@Inheritance (on root)" },
161768
+ { key: "orm.discriminatorColumn", kind: "string", label: "Discriminator column", mapsTo: "@DiscriminatorColumn (root)" },
161769
+ { key: "orm.discriminatorValue", kind: "string", label: "Discriminator value", mapsTo: "@DiscriminatorValue (subclass)" },
161770
+ { key: "orm.idClass", kind: "string", label: "Id class", mapsTo: "@IdClass (composite key)" },
161771
+ { key: "orm.embeddedId", kind: "string", label: "Embedded id", mapsTo: "@EmbeddedId (composite key)" }
161772
+ ],
161773
+ attribute: [
161774
+ { key: "orm.javaType", kind: "string", label: "Java type", mapsTo: "field Java type override" },
161775
+ { key: "orm.generatedValue", kind: "enum", values: ["IDENTITY", "SEQUENCE", "TABLE", "UUID", "AUTO", "NONE"], label: "Generated value", mapsTo: "@GeneratedValue" },
161776
+ { key: "orm.sequenceName", kind: "string", label: "Sequence name", mapsTo: "@SequenceGenerator(name)" },
161777
+ { key: "orm.allocationSize", kind: "int", label: "Allocation size", mapsTo: "@SequenceGenerator(allocationSize)" },
161778
+ { key: "orm.enumerated", kind: "enum", values: ["STRING", "ORDINAL"], label: "Enumerated", mapsTo: "@Enumerated (enum attrs)" },
161779
+ { key: "orm.enumType", kind: "string", label: "Enum type", mapsTo: "generated Java enum class" },
161780
+ { key: "orm.version", kind: "flag", label: "Version", mapsTo: "@Version" },
161781
+ { key: "orm.transient", kind: "flag", label: "Transient", mapsTo: "@Transient" },
161782
+ { key: "orm.lob", kind: "flag", label: "Lob", mapsTo: "@Lob" },
161783
+ { key: "orm.temporal", kind: "enum", values: ["DATE", "TIME", "TIMESTAMP"], label: "Temporal", mapsTo: "@Temporal" },
161784
+ { key: "orm.converter", kind: "string", label: "Converter", mapsTo: "@Convert(converter)" },
161785
+ { key: "orm.elementCollection", kind: "flag", label: "Element collection", mapsTo: "@ElementCollection" },
161786
+ { key: "orm.embedded", kind: "flag", label: "Embedded", mapsTo: "@Embedded" }
161787
+ ],
161788
+ relationship: [
161789
+ { key: "orm.fetch", kind: "enum", values: ["LAZY", "EAGER"], label: "Fetch", mapsTo: "fetch type" },
161790
+ { key: "orm.cascade", kind: "enumList", values: ["ALL", "PERSIST", "MERGE", "REMOVE", "REFRESH", "DETACH"], label: "Cascade", mapsTo: "cascade types" },
161791
+ { key: "orm.orphanRemoval", kind: "flag", label: "Orphan removal", mapsTo: "orphanRemoval" },
161792
+ { key: "orm.optional", kind: "flag", label: "Optional", mapsTo: "optional" },
161793
+ { key: "orm.mappedBy", kind: "string", label: "Mapped by", mapsTo: "mappedBy (inverse side)" },
161794
+ { key: "orm.owningEnd", kind: "string", label: "Owning end", mapsTo: "owning side role" },
161795
+ { key: "orm.joinTable", kind: "string", label: "Join table", mapsTo: "@JoinTable(name) for many-to-many" },
161796
+ { key: "orm.joinColumns", kind: "string", label: "Join columns", mapsTo: "@JoinTable joinColumns" },
161797
+ { key: "orm.inverseJoinColumns", kind: "string", label: "Inverse join columns", mapsTo: "@JoinTable inverseJoinColumns" }
161798
+ ]
161799
+ };
161800
+ var ORM_KEYS = {
161801
+ entity: new Set(ORM_VOCABULARY.entity.map((d) => d.key)),
161802
+ attribute: new Set(ORM_VOCABULARY.attribute.map((d) => d.key)),
161803
+ relationship: new Set(ORM_VOCABULARY.relationship.map((d) => d.key))
161804
+ };
161805
+ var allDefs = [
161806
+ ...ORM_VOCABULARY.entity,
161807
+ ...ORM_VOCABULARY.attribute,
161808
+ ...ORM_VOCABULARY.relationship
161809
+ ];
161810
+ var ORM_ENUM_VALUES = Object.fromEntries(
161811
+ allDefs.filter((d) => d.kind === "enum" && d.values).map((d) => [d.key, d.values])
161812
+ );
161813
+ var ORM_CASCADE_VALUES = allDefs.find((d) => d.key === "orm.cascade")?.values ?? [];
161814
+ var ORM_FLAG_KEYS = new Set(
161815
+ allDefs.filter((d) => d.kind === "flag").map((d) => d.key)
161816
+ );
161817
+
161818
+ // backend/src/routes/orm.routes.ts
161719
161819
  var router26 = (0, import_express27.Router)();
161720
- router26.use(status_routes_default);
161721
- router26.use(auth_routes_default);
161722
- router26.use(search_routes_default);
161723
- router26.use(visualization_routes_default);
161724
- router26.use(project_routes_default);
161725
- router26.use(data_dictionary_default);
161726
- router26.use(ai_default);
161727
- var routes_default = router26;
161820
+ router26.get("/api/orm/vocabulary", (_req, res) => {
161821
+ res.json({ data: { prefix: ORM_PREFIX, scopes: ORM_VOCABULARY } });
161822
+ });
161823
+ var orm_routes_default = router26;
161824
+
161825
+ // backend/src/routes/index.ts
161826
+ var router27 = (0, import_express28.Router)();
161827
+ router27.use(status_routes_default);
161828
+ router27.use(auth_routes_default);
161829
+ router27.use(search_routes_default);
161830
+ router27.use(visualization_routes_default);
161831
+ router27.use(project_routes_default);
161832
+ router27.use(orm_routes_default);
161833
+ router27.use(data_dictionary_default);
161834
+ router27.use(ai_default);
161835
+ var routes_default = router27;
161728
161836
 
161729
161837
  // backend/src/server.ts
161730
161838
  init_logger();
@@ -162252,7 +162360,18 @@ __name(seedFromDisk, "seedFromDisk");
162252
162360
  // backend/src/server.ts
162253
162361
  init_mcpClientRegistry();
162254
162362
  import_dotenv2.default.config();
162255
- var app = (0, import_express31.default)();
162363
+ if (process.env.SDD_DEV === "1") {
162364
+ try {
162365
+ const handoff = path13.join(os3.homedir(), ".dico-app", "active-project");
162366
+ const dir = fs5.readFileSync(handoff, "utf8").trim();
162367
+ if (dir && fs5.existsSync(dir)) {
162368
+ config.dataDir = dir;
162369
+ logger.info(`Dev: active project from handoff \u2192 ${dir}`);
162370
+ }
162371
+ } catch {
162372
+ }
162373
+ }
162374
+ var app = (0, import_express32.default)();
162256
162375
  var port = config.port;
162257
162376
  app.use((0, import_cors2.default)());
162258
162377
  app.use((req, res, next) => {
@@ -162269,7 +162388,7 @@ app.use((req, res, next) => {
162269
162388
  });
162270
162389
  next();
162271
162390
  });
162272
- app.use(import_express31.default.json());
162391
+ app.use(import_express32.default.json());
162273
162392
  if (!config.isProduction) {
162274
162393
  app.get("/", (req, res) => {
162275
162394
  res.json({ message: "Welcome to the Data Dictionary Management System API" });
@@ -162387,7 +162506,7 @@ if (config.isProduction) {
162387
162506
  }
162388
162507
  });
162389
162508
  if (publicDir) {
162390
- app.use(import_express31.default.static(publicDir));
162509
+ app.use(import_express32.default.static(publicDir));
162391
162510
  app.get("*", (req, res, next) => {
162392
162511
  if (req.path.startsWith("/api") || req.path.startsWith("/fs") || req.path.startsWith("/api-docs") || req.path.includes(".")) {
162393
162512
  return next();