@firfi/huly-mcp 0.6.3 → 0.8.0

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/index.cjs CHANGED
@@ -34077,15 +34077,15 @@ var require_storage = __commonJS({
34077
34077
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
34078
34078
  var storage_exports = {};
34079
34079
  __export2(storage_exports, {
34080
- SortingOrder: () => SortingOrder26,
34080
+ SortingOrder: () => SortingOrder27,
34081
34081
  shouldShowArchived: () => shouldShowArchived
34082
34082
  });
34083
34083
  module2.exports = __toCommonJS2(storage_exports);
34084
- var SortingOrder26 = /* @__PURE__ */ ((SortingOrder27) => {
34085
- SortingOrder27[SortingOrder27["Ascending"] = 1] = "Ascending";
34086
- SortingOrder27[SortingOrder27["Descending"] = -1] = "Descending";
34087
- return SortingOrder27;
34088
- })(SortingOrder26 || {});
34084
+ var SortingOrder27 = /* @__PURE__ */ ((SortingOrder28) => {
34085
+ SortingOrder28[SortingOrder28["Ascending"] = 1] = "Ascending";
34086
+ SortingOrder28[SortingOrder28["Descending"] = -1] = "Descending";
34087
+ return SortingOrder28;
34088
+ })(SortingOrder27 || {});
34089
34089
  function shouldShowArchived(query, options) {
34090
34090
  if (options?.showArchived !== void 0) {
34091
34091
  return options.showArchived;
@@ -34588,7 +34588,7 @@ var require_client3 = __commonJS({
34588
34588
  getClient: () => getClient
34589
34589
  });
34590
34590
  module2.exports = __toCommonJS2(client_exports);
34591
- var import_core47 = require_lib4();
34591
+ var import_core48 = require_lib4();
34592
34592
  var import_platform2 = __toESM2(require_lib());
34593
34593
  var import_utils14 = require_utils3();
34594
34594
  function getClient(accountsUrl, token, retryTimeoutMs) {
@@ -34624,7 +34624,7 @@ var require_client3 = __commonJS({
34624
34624
  rpc;
34625
34625
  async getProviders() {
34626
34626
  return await withRetryUntilMaxAttempts(async () => {
34627
- const response = await fetch((0, import_core47.concatLink)(this.url, "/providers"));
34627
+ const response = await fetch((0, import_core48.concatLink)(this.url, "/providers"));
34628
34628
  return await response.json();
34629
34629
  })();
34630
34630
  }
@@ -35279,7 +35279,7 @@ var require_client3 = __commonJS({
35279
35279
  await this.rpc(request2);
35280
35280
  }
35281
35281
  async setCookie() {
35282
- const url4 = (0, import_core47.concatLink)(this.url, "/cookie");
35282
+ const url4 = (0, import_core48.concatLink)(this.url, "/cookie");
35283
35283
  const response = await fetch(url4, { ...this.request, method: "PUT" });
35284
35284
  if (!response.ok) {
35285
35285
  const result = await response.json();
@@ -35289,7 +35289,7 @@ var require_client3 = __commonJS({
35289
35289
  }
35290
35290
  }
35291
35291
  async deleteCookie() {
35292
- const url4 = (0, import_core47.concatLink)(this.url, "/cookie");
35292
+ const url4 = (0, import_core48.concatLink)(this.url, "/cookie");
35293
35293
  const response = await fetch(url4, { ...this.request, method: "DELETE" });
35294
35294
  if (!response.ok) {
35295
35295
  const result = await response.json();
@@ -35568,9 +35568,9 @@ var require_config = __commonJS({
35568
35568
  loadServerConfig: () => loadServerConfig4
35569
35569
  });
35570
35570
  module2.exports = __toCommonJS2(config_exports3);
35571
- var import_core47 = require_lib4();
35571
+ var import_core48 = require_lib4();
35572
35572
  async function loadServerConfig4(url4) {
35573
- const configUrl = (0, import_core47.concatLink)(url4, "/config.json");
35573
+ const configUrl = (0, import_core48.concatLink)(url4, "/config.json");
35574
35574
  const res = await fetch(configUrl, { keepalive: true });
35575
35575
  if (res.ok) {
35576
35576
  return await res.json();
@@ -35656,7 +35656,7 @@ var require_client4 = __commonJS({
35656
35656
  getClient: () => getClient
35657
35657
  });
35658
35658
  module2.exports = __toCommonJS2(client_exports);
35659
- var import_core47 = require_lib4();
35659
+ var import_core48 = require_lib4();
35660
35660
  var import_utils14 = require_utils4();
35661
35661
  function getClient(workspaceId, token, collaboratorUrl) {
35662
35662
  const url4 = collaboratorUrl.replaceAll("wss://", "https://").replace("ws://", "http://");
@@ -35675,7 +35675,7 @@ var require_client4 = __commonJS({
35675
35675
  async rpc(document2, method, payload) {
35676
35676
  const workspace = this.workspace;
35677
35677
  const documentId = (0, import_utils14.encodeDocumentId)(workspace, document2);
35678
- const url4 = (0, import_core47.concatLink)(this.collaboratorUrl, `/rpc/${encodeURIComponent(documentId)}`);
35678
+ const url4 = (0, import_core48.concatLink)(this.collaboratorUrl, `/rpc/${encodeURIComponent(documentId)}`);
35679
35679
  const res = await fetch(url4, {
35680
35680
  method: "POST",
35681
35681
  headers: {
@@ -53242,9 +53242,9 @@ var require_image = __commonJS({
53242
53242
  ImageNode: () => ImageNode
53243
53243
  });
53244
53244
  module2.exports = __toCommonJS2(image_exports);
53245
- var import_core47 = require_dist16();
53245
+ var import_core48 = require_dist16();
53246
53246
  var import_utils14 = require_utils5();
53247
- var ImageNode = import_core47.Node.create({
53247
+ var ImageNode = import_core48.Node.create({
53248
53248
  name: "image",
53249
53249
  addOptions() {
53250
53250
  return {
@@ -53303,7 +53303,7 @@ var require_image = __commonJS({
53303
53303
  "data-type": this.name,
53304
53304
  "data-align": node.attrs.align
53305
53305
  };
53306
- const imgAttributes = (0, import_core47.mergeAttributes)(
53306
+ const imgAttributes = (0, import_core48.mergeAttributes)(
53307
53307
  {
53308
53308
  "data-type": this.name
53309
53309
  },
@@ -53347,9 +53347,9 @@ var require_reference = __commonJS({
53347
53347
  ReferenceNode: () => ReferenceNode
53348
53348
  });
53349
53349
  module2.exports = __toCommonJS2(reference_exports);
53350
- var import_core47 = require_dist16();
53350
+ var import_core48 = require_dist16();
53351
53351
  var import_utils14 = require_utils5();
53352
- var ReferenceNode = import_core47.Node.create({
53352
+ var ReferenceNode = import_core48.Node.create({
53353
53353
  name: "reference",
53354
53354
  group: "inline",
53355
53355
  inline: true,
@@ -53384,7 +53384,7 @@ var require_reference = __commonJS({
53384
53384
  renderHTML({ node, HTMLAttributes }) {
53385
53385
  return [
53386
53386
  "span",
53387
- (0, import_core47.mergeAttributes)(
53387
+ (0, import_core48.mergeAttributes)(
53388
53388
  {
53389
53389
  "data-type": this.name,
53390
53390
  "data-id": node.attrs.id,
@@ -53443,8 +53443,8 @@ var require_emoji = __commonJS({
53443
53443
  EmojiNode: () => EmojiNode
53444
53444
  });
53445
53445
  module2.exports = __toCommonJS2(emoji_exports);
53446
- var import_core47 = require_dist16();
53447
- var EmojiNode = import_core47.Node.create({
53446
+ var import_core48 = require_dist16();
53447
+ var EmojiNode = import_core48.Node.create({
53448
53448
  name: "emoji",
53449
53449
  group: "inline",
53450
53450
  inline: true,
@@ -53484,7 +53484,7 @@ var require_emoji = __commonJS({
53484
53484
  addNodeView() {
53485
53485
  return ({ node, HTMLAttributes }) => {
53486
53486
  const container = document.createElement("span");
53487
- const containerAttributes = (0, import_core47.mergeAttributes)(
53487
+ const containerAttributes = (0, import_core48.mergeAttributes)(
53488
53488
  {
53489
53489
  "data-type": this.name,
53490
53490
  class: "emoji"
@@ -53517,7 +53517,7 @@ var require_emoji = __commonJS({
53517
53517
  if (node.attrs.kind === "image") {
53518
53518
  return [
53519
53519
  "span",
53520
- (0, import_core47.mergeAttributes)(
53520
+ (0, import_core48.mergeAttributes)(
53521
53521
  {
53522
53522
  "data-type": this.name,
53523
53523
  class: "emoji"
@@ -53526,7 +53526,7 @@ var require_emoji = __commonJS({
53526
53526
  ),
53527
53527
  [
53528
53528
  "img",
53529
- (0, import_core47.mergeAttributes)({
53529
+ (0, import_core48.mergeAttributes)({
53530
53530
  "data-type": this.name,
53531
53531
  src: node.attrs.image,
53532
53532
  alt: node.attrs.emoji
@@ -53536,7 +53536,7 @@ var require_emoji = __commonJS({
53536
53536
  }
53537
53537
  return [
53538
53538
  "span",
53539
- (0, import_core47.mergeAttributes)(
53539
+ (0, import_core48.mergeAttributes)(
53540
53540
  {
53541
53541
  "data-type": this.name,
53542
53542
  class: "emoji"
@@ -53844,8 +53844,8 @@ var require_file = __commonJS({
53844
53844
  FileNode: () => FileNode
53845
53845
  });
53846
53846
  module2.exports = __toCommonJS2(file_exports);
53847
- var import_core47 = require_dist16();
53848
- var FileNode = import_core47.Node.create({
53847
+ var import_core48 = require_dist16();
53848
+ var FileNode = import_core48.Node.create({
53849
53849
  name: "file",
53850
53850
  addOptions() {
53851
53851
  return {
@@ -54155,7 +54155,7 @@ var require_codeblock = __commonJS({
54155
54155
  tildeInputRegex: () => tildeInputRegex
54156
54156
  });
54157
54157
  module2.exports = __toCommonJS2(codeblock_exports);
54158
- var import_core47 = require_dist16();
54158
+ var import_core48 = require_dist16();
54159
54159
  var import_extension_code_block = __toESM2(require_dist19());
54160
54160
  var codeBlockOptions = {
54161
54161
  defaultLanguage: "plaintext",
@@ -54201,11 +54201,11 @@ var require_codeblock = __commonJS({
54201
54201
  },
54202
54202
  addInputRules() {
54203
54203
  return [
54204
- (0, import_core47.textblockTypeInputRule)({
54204
+ (0, import_core48.textblockTypeInputRule)({
54205
54205
  find: backtickInputRegex,
54206
54206
  type: this.type
54207
54207
  }),
54208
- (0, import_core47.textblockTypeInputRule)({
54208
+ (0, import_core48.textblockTypeInputRule)({
54209
54209
  find: tildeInputRegex,
54210
54210
  type: this.type
54211
54211
  })
@@ -54241,8 +54241,8 @@ var require_comment = __commonJS({
54241
54241
  CommentNode: () => CommentNode
54242
54242
  });
54243
54243
  module2.exports = __toCommonJS2(comment_exports);
54244
- var import_core47 = require_dist16();
54245
- var CommentNode = import_core47.Node.create({
54244
+ var import_core48 = require_dist16();
54245
+ var CommentNode = import_core48.Node.create({
54246
54246
  name: "comment",
54247
54247
  group: "inline",
54248
54248
  inline: true,
@@ -54288,8 +54288,8 @@ var require_markdown = __commonJS({
54288
54288
  MarkdownNode: () => MarkdownNode
54289
54289
  });
54290
54290
  module2.exports = __toCommonJS2(markdown_exports);
54291
- var import_core47 = require_dist16();
54292
- var MarkdownNode = import_core47.Node.create({
54291
+ var import_core48 = require_dist16();
54292
+ var MarkdownNode = import_core48.Node.create({
54293
54293
  name: "markdown",
54294
54294
  group: "block",
54295
54295
  content: "text*",
@@ -54307,7 +54307,7 @@ var require_markdown = __commonJS({
54307
54307
  renderHTML({ node, HTMLAttributes }) {
54308
54308
  return [
54309
54309
  "pre",
54310
- (0, import_core47.mergeAttributes)({ "data-type": this.name }, this.options.HTMLAttributes, HTMLAttributes),
54310
+ (0, import_core48.mergeAttributes)({ "data-type": this.name }, this.options.HTMLAttributes, HTMLAttributes),
54311
54311
  ["code", {}, 0]
54312
54312
  ];
54313
54313
  }
@@ -54341,8 +54341,8 @@ var require_embed = __commonJS({
54341
54341
  EmbedNode: () => EmbedNode
54342
54342
  });
54343
54343
  module2.exports = __toCommonJS2(embed_exports);
54344
- var import_core47 = require_dist16();
54345
- var EmbedNode = import_core47.Node.create({
54344
+ var import_core48 = require_dist16();
54345
+ var EmbedNode = import_core48.Node.create({
54346
54346
  name: "embed",
54347
54347
  addOptions() {
54348
54348
  return {};
@@ -54367,7 +54367,7 @@ var require_embed = __commonJS({
54367
54367
  ];
54368
54368
  },
54369
54369
  renderHTML({ HTMLAttributes }) {
54370
- return ["figure", { "data-type": this.name }, ["iframe", (0, import_core47.mergeAttributes)(HTMLAttributes)]];
54370
+ return ["figure", { "data-type": this.name }, ["iframe", (0, import_core48.mergeAttributes)(HTMLAttributes)]];
54371
54371
  }
54372
54372
  });
54373
54373
  }
@@ -54441,7 +54441,7 @@ var require_noteBase = __commonJS({
54441
54441
  name: () => name
54442
54442
  });
54443
54443
  module2.exports = __toCommonJS2(noteBase_exports);
54444
- var import_core47 = require_dist16();
54444
+ var import_core48 = require_dist16();
54445
54445
  var import_nodes = require_nodes();
54446
54446
  var name = "note";
54447
54447
  var NoteKind = /* @__PURE__ */ ((NoteKind2) => {
@@ -54456,7 +54456,7 @@ var require_noteBase = __commonJS({
54456
54456
  NoteKind2["PrimaryLight"] = "primary-light";
54457
54457
  return NoteKind2;
54458
54458
  })(NoteKind || {});
54459
- var NoteBaseExtension = import_core47.Mark.create({
54459
+ var NoteBaseExtension = import_core48.Mark.create({
54460
54460
  name,
54461
54461
  parseHTML() {
54462
54462
  return [
@@ -54513,9 +54513,9 @@ var require_qmsInlineCommentMark = __commonJS({
54513
54513
  QMSInlineCommentMark: () => QMSInlineCommentMark
54514
54514
  });
54515
54515
  module2.exports = __toCommonJS2(qmsInlineCommentMark_exports);
54516
- var import_core47 = require_dist16();
54516
+ var import_core48 = require_dist16();
54517
54517
  var NAME2 = "node-uuid";
54518
- var QMSInlineCommentMark = import_core47.Mark.create({
54518
+ var QMSInlineCommentMark = import_core48.Mark.create({
54519
54519
  name: NAME2,
54520
54520
  inline: true,
54521
54521
  parseHTML() {
@@ -54560,9 +54560,9 @@ var require_kit = __commonJS({
54560
54560
  mergeKitOptions: () => mergeKitOptions
54561
54561
  });
54562
54562
  module2.exports = __toCommonJS2(kit_exports);
54563
- var import_core47 = require_dist16();
54563
+ var import_core48 = require_dist16();
54564
54564
  function extensionKit(name, fn2) {
54565
- return import_core47.Extension.create({
54565
+ return import_core48.Extension.create({
54566
54566
  name,
54567
54567
  addExtensions() {
54568
54568
  const e = /* @__PURE__ */ __name((extension, options) => {
@@ -61591,9 +61591,9 @@ var require_colors = __commonJS({
61591
61591
  TextColor: () => TextColor
61592
61592
  });
61593
61593
  module2.exports = __toCommonJS2(colors_exports);
61594
- var import_core47 = require_dist16();
61594
+ var import_core48 = require_dist16();
61595
61595
  var import_extension_text_style = require_dist20();
61596
- var BackgroundColor = import_core47.Extension.create({
61596
+ var BackgroundColor = import_core48.Extension.create({
61597
61597
  name: "backgroundColor",
61598
61598
  addOptions() {
61599
61599
  return {
@@ -61634,7 +61634,7 @@ var require_colors = __commonJS({
61634
61634
  };
61635
61635
  }
61636
61636
  });
61637
- var TextColor = import_core47.Extension.create({
61637
+ var TextColor = import_core48.Extension.create({
61638
61638
  name: "textColor",
61639
61639
  addOptions() {
61640
61640
  return {
@@ -61706,10 +61706,10 @@ var require_inlineComment = __commonJS({
61706
61706
  InlineCommentPasteFixPlugin: () => InlineCommentPasteFixPlugin
61707
61707
  });
61708
61708
  module2.exports = __toCommonJS2(inlineComment_exports);
61709
- var import_core47 = require_dist16();
61709
+ var import_core48 = require_dist16();
61710
61710
  var import_model = require_dist10();
61711
61711
  var import_state = require_dist5();
61712
- var InlineCommentMark = import_core47.Mark.create({
61712
+ var InlineCommentMark = import_core48.Mark.create({
61713
61713
  name: "inline-comment",
61714
61714
  excludes: "",
61715
61715
  inclusive: false,
@@ -77233,7 +77233,7 @@ var require_client5 = __commonJS({
77233
77233
  createMarkupOperations: () => createMarkupOperations
77234
77234
  });
77235
77235
  module2.exports = __toCommonJS2(client_exports);
77236
- var import_core47 = require_lib4();
77236
+ var import_core48 = require_lib4();
77237
77237
  var import_collaborator_client2 = require_lib7();
77238
77238
  var import_text4 = require_lib9();
77239
77239
  var import_text_markdown3 = require_lib17();
@@ -77247,8 +77247,8 @@ var require_client5 = __commonJS({
77247
77247
  this.workspace = workspace;
77248
77248
  this.token = token;
77249
77249
  this.config = config3;
77250
- this.refUrl = (0, import_core47.concatLink)(this.url, `/browse?workspace=${workspace}`);
77251
- this.imageUrl = (0, import_core47.concatLink)(this.url, `/files?workspace=${workspace}&file=`);
77250
+ this.refUrl = (0, import_core48.concatLink)(this.url, `/browse?workspace=${workspace}`);
77251
+ this.imageUrl = (0, import_core48.concatLink)(this.url, `/files?workspace=${workspace}&file=`);
77252
77252
  this.collaborator = (0, import_collaborator_client2.getClient)(workspace, token, config3.COLLABORATOR_URL);
77253
77253
  }
77254
77254
  static {
@@ -77258,7 +77258,7 @@ var require_client5 = __commonJS({
77258
77258
  imageUrl;
77259
77259
  refUrl;
77260
77260
  async fetchMarkup(objectClass, objectId, objectAttr, doc, format7) {
77261
- const collabId = (0, import_core47.makeCollabId)(objectClass, objectId, objectAttr);
77261
+ const collabId = (0, import_core48.makeCollabId)(objectClass, objectId, objectAttr);
77262
77262
  const markup = await this.collaborator.getMarkup(collabId, doc);
77263
77263
  const json3 = (0, import_text4.markupToJSON)(markup);
77264
77264
  switch (format7) {
@@ -77287,7 +77287,7 @@ var require_client5 = __commonJS({
77287
77287
  default:
77288
77288
  throw new Error("Unknown content format");
77289
77289
  }
77290
- const collabId = (0, import_core47.makeCollabId)(objectClass, objectId, objectAttr);
77290
+ const collabId = (0, import_core48.makeCollabId)(objectClass, objectId, objectAttr);
77291
77291
  return await this.collaborator.createMarkup(collabId, markup);
77292
77292
  }
77293
77293
  };
@@ -81771,8 +81771,8 @@ var require_connection2 = __commonJS({
81771
81771
  });
81772
81772
  module2.exports = __toCommonJS2(connection_exports);
81773
81773
  var import_analytics = require_lib2();
81774
- var import_client24 = __toESM2(require_lib6());
81775
- var import_core47 = __toESM2(require_lib4());
81774
+ var import_client25 = __toESM2(require_lib6());
81775
+ var import_core48 = __toESM2(require_lib4());
81776
81776
  var import_platform2 = __toESM2(require_lib());
81777
81777
  var import_rpc = require_lib18();
81778
81778
  var import_snappyjs = require_snappyjs();
@@ -81816,7 +81816,7 @@ var require_connection2 = __commonJS({
81816
81816
  const sKey = "session.id." + this.url;
81817
81817
  let sessionId = sessionStorage.getItem(sKey) ?? void 0;
81818
81818
  if (sessionId === void 0) {
81819
- sessionId = (0, import_core47.generateId)();
81819
+ sessionId = (0, import_core48.generateId)();
81820
81820
  console.log("Generate new SessionId", sessionId);
81821
81821
  this.sessionId = sessionId;
81822
81822
  } else {
@@ -81827,7 +81827,7 @@ var require_connection2 = __commonJS({
81827
81827
  sessionStorage.setItem(sKey, sessionId);
81828
81828
  });
81829
81829
  } else {
81830
- this.sessionId = (0, import_core47.generateId)();
81830
+ this.sessionId = (0, import_core48.generateId)();
81831
81831
  }
81832
81832
  this.rpcHandler = opt?.useGlobalRPCHandler === true ? globalRPCHandler : new import_rpc.RPCHandler();
81833
81833
  this.pushHandler(handler);
@@ -81882,7 +81882,7 @@ var require_connection2 = __commonJS({
81882
81882
  }
81883
81883
  if (!this.closed) {
81884
81884
  void this.sendRequest({
81885
- method: import_client24.pingConst,
81885
+ method: import_client25.pingConst,
81886
81886
  params: [],
81887
81887
  once: true,
81888
81888
  handleResult: /* @__PURE__ */ __name(async (result) => {
@@ -81915,7 +81915,7 @@ var require_connection2 = __commonJS({
81915
81915
  }
81916
81916
  }
81917
81917
  isConnected() {
81918
- return this.websocket != null && this.websocket.readyState === import_client24.ClientSocketReadyState.OPEN && this.helloReceived;
81918
+ return this.websocket != null && this.websocket.readyState === import_client25.ClientSocketReadyState.OPEN && this.helloReceived;
81919
81919
  }
81920
81920
  delay = 0;
81921
81921
  onConnectHandlers = [];
@@ -82007,7 +82007,7 @@ var require_connection2 = __commonJS({
82007
82007
  if (resp.id === -1) {
82008
82008
  this.delay = 0;
82009
82009
  if (resp.result?.state === "upgrading") {
82010
- void this.onConnect?.(import_core47.ClientConnectEvent.Maintenance, void 0, resp.result.stats);
82010
+ void this.onConnect?.(import_core48.ClientConnectEvent.Maintenance, void 0, resp.result.stats);
82011
82011
  this.upgrading = true;
82012
82012
  this.delay = 3;
82013
82013
  return;
@@ -82042,7 +82042,7 @@ var require_connection2 = __commonJS({
82042
82042
  v.reconnect?.();
82043
82043
  }
82044
82044
  void this.onConnect?.(
82045
- helloResp.reconnect === true ? import_core47.ClientConnectEvent.Reconnected : import_core47.ClientConnectEvent.Connected,
82045
+ helloResp.reconnect === true ? import_core48.ClientConnectEvent.Reconnected : import_core48.ClientConnectEvent.Connected,
82046
82046
  helloResp.lastTx,
82047
82047
  this.sessionId
82048
82048
  )?.catch((err) => {
@@ -82055,8 +82055,8 @@ var require_connection2 = __commonJS({
82055
82055
  }
82056
82056
  return;
82057
82057
  }
82058
- if (resp.result === import_client24.pingConst) {
82059
- void this.sendRequest({ method: import_client24.pingConst, params: [] }).catch((err) => {
82058
+ if (resp.result === import_client25.pingConst) {
82059
+ void this.sendRequest({ method: import_client25.pingConst, params: [] }).catch((err) => {
82060
82060
  this.ctx.error("failed to send ping", { err });
82061
82061
  });
82062
82062
  return;
@@ -82092,7 +82092,7 @@ var require_connection2 = __commonJS({
82092
82092
  }
82093
82093
  result = result.concat(c.data);
82094
82094
  }
82095
- resp.result = (0, import_core47.toFindResult)(result, total, lookupMap);
82095
+ resp.result = (0, import_core48.toFindResult)(result, total, lookupMap);
82096
82096
  resp.chunk = void 0;
82097
82097
  } else {
82098
82098
  return;
@@ -82136,7 +82136,7 @@ var require_connection2 = __commonJS({
82136
82136
  } else {
82137
82137
  const txArr = Array.isArray(resp.result) ? resp.result : [resp.result];
82138
82138
  for (const tx of txArr) {
82139
- if (tx?._class === import_core47.default.class.TxModelUpgrade) {
82139
+ if (tx?._class === import_core48.default.class.TxModelUpgrade) {
82140
82140
  console.log("Processing upgrade", this.workspace, this.user);
82141
82141
  this.opt?.onUpgrade?.();
82142
82142
  return;
@@ -82148,15 +82148,15 @@ var require_connection2 = __commonJS({
82148
82148
  }
82149
82149
  }
82150
82150
  checkArrayBufferPing(data) {
82151
- if (data.byteLength === import_client24.pingConst.length || data.byteLength === import_client24.pongConst.length) {
82151
+ if (data.byteLength === import_client25.pingConst.length || data.byteLength === import_client25.pongConst.length) {
82152
82152
  const text = new TextDecoder().decode(data);
82153
- if (text === import_client24.pingConst) {
82154
- void this.sendRequest({ method: import_client24.pingConst, params: [] }).catch((err) => {
82153
+ if (text === import_client25.pingConst) {
82154
+ void this.sendRequest({ method: import_client25.pingConst, params: [] }).catch((err) => {
82155
82155
  this.ctx.error("failed to send ping", { err });
82156
82156
  });
82157
82157
  return true;
82158
82158
  }
82159
- if (text === import_client24.pongConst) {
82159
+ if (text === import_client25.pongConst) {
82160
82160
  this.pingResponse = Date.now();
82161
82161
  return true;
82162
82162
  }
@@ -82166,7 +82166,7 @@ var require_connection2 = __commonJS({
82166
82166
  openConnection(ctx, socketId) {
82167
82167
  this.binaryMode = false;
82168
82168
  this.helloReceived = false;
82169
- const clientSocketFactory = this.opt?.socketFactory ?? (0, import_platform2.getMetadata)(import_client24.default.metadata.ClientSocketFactory) ?? ((url4) => {
82169
+ const clientSocketFactory = this.opt?.socketFactory ?? (0, import_platform2.getMetadata)(import_client25.default.metadata.ClientSocketFactory) ?? ((url4) => {
82170
82170
  const s = new WebSocket(url4);
82171
82171
  return s;
82172
82172
  });
@@ -82201,12 +82201,12 @@ var require_connection2 = __commonJS({
82201
82201
  if (this.websocket !== wsocket) {
82202
82202
  return;
82203
82203
  }
82204
- if (event.data === import_client24.pongConst) {
82204
+ if (event.data === import_client25.pongConst) {
82205
82205
  this.pingResponse = Date.now();
82206
82206
  return;
82207
82207
  }
82208
- if (event.data === import_client24.pingConst) {
82209
- void this.sendRequest({ method: import_client24.pingConst, params: [] }).catch((err) => {
82208
+ if (event.data === import_client25.pingConst) {
82209
+ void this.sendRequest({ method: import_client25.pingConst, params: [] }).catch((err) => {
82210
82210
  this.ctx.error("failed to send ping", { err });
82211
82211
  });
82212
82212
  return;
@@ -82271,8 +82271,8 @@ var require_connection2 = __commonJS({
82271
82271
  if (this.websocket !== wsocket) {
82272
82272
  return;
82273
82273
  }
82274
- const useBinary = this.opt?.useBinaryProtocol ?? (0, import_platform2.getMetadata)(import_client24.default.metadata.UseBinaryProtocol) ?? true;
82275
- this.compressionMode = this.opt?.useProtocolCompression ?? (0, import_platform2.getMetadata)(import_client24.default.metadata.UseProtocolCompression) ?? false;
82274
+ const useBinary = this.opt?.useBinaryProtocol ?? (0, import_platform2.getMetadata)(import_client25.default.metadata.UseBinaryProtocol) ?? true;
82275
+ this.compressionMode = this.opt?.useProtocolCompression ?? (0, import_platform2.getMetadata)(import_client25.default.metadata.UseProtocolCompression) ?? false;
82276
82276
  const helloRequest = {
82277
82277
  method: "hello",
82278
82278
  params: [],
@@ -82318,13 +82318,13 @@ var require_connection2 = __commonJS({
82318
82318
  if (w instanceof Promise) {
82319
82319
  await w;
82320
82320
  }
82321
- if (data.method !== import_client24.pingConst) {
82321
+ if (data.method !== import_client25.pingConst) {
82322
82322
  this.requests.set(id, promise4);
82323
82323
  }
82324
82324
  promise4.sendData = () => {
82325
- if (this.websocket?.readyState === import_client24.ClientSocketReadyState.OPEN) {
82325
+ if (this.websocket?.readyState === import_client25.ClientSocketReadyState.OPEN) {
82326
82326
  promise4.startTime = Date.now();
82327
- if (data.method !== import_client24.pingConst) {
82327
+ if (data.method !== import_client25.pingConst) {
82328
82328
  const dta = this.rpcHandler.serialize(
82329
82329
  {
82330
82330
  method: data.method,
@@ -82337,7 +82337,7 @@ var require_connection2 = __commonJS({
82337
82337
  );
82338
82338
  this.websocket?.send(dta);
82339
82339
  } else {
82340
- this.websocket?.send(import_client24.pingConst);
82340
+ this.websocket?.send(import_client25.pingConst);
82341
82341
  }
82342
82342
  }
82343
82343
  };
@@ -82351,7 +82351,7 @@ var require_connection2 = __commonJS({
82351
82351
  };
82352
82352
  }
82353
82353
  promise4.sendData();
82354
- if (data.method !== import_client24.pingConst) {
82354
+ if (data.method !== import_client25.pingConst) {
82355
82355
  return await promise4.promise;
82356
82356
  }
82357
82357
  },
@@ -82366,7 +82366,7 @@ var require_connection2 = __commonJS({
82366
82366
  }
82367
82367
  getAccount() {
82368
82368
  if (this.account !== void 0) {
82369
- return Promise.resolve((0, import_core47.clone)(this.account));
82369
+ return Promise.resolve((0, import_core48.clone)(this.account));
82370
82370
  }
82371
82371
  return this.sendRequest({ method: "getAccount", params: [] });
82372
82372
  }
@@ -82424,10 +82424,10 @@ var require_connection2 = __commonJS({
82424
82424
  method: "tx",
82425
82425
  params: [tx],
82426
82426
  retry: /* @__PURE__ */ __name(async () => {
82427
- if (tx._class === import_core47.default.class.TxApplyIf) {
82428
- return (await this.findAll(import_core47.default.class.Tx, { _id: tx.txes[0]._id }, { limit: 1 })).length === 0;
82427
+ if (tx._class === import_core48.default.class.TxApplyIf) {
82428
+ return (await this.findAll(import_core48.default.class.Tx, { _id: tx.txes[0]._id }, { limit: 1 })).length === 0;
82429
82429
  }
82430
- return (await this.findAll(import_core47.default.class.Tx, { _id: tx._id }, { limit: 1 })).length === 0;
82430
+ return (await this.findAll(import_core48.default.class.Tx, { _id: tx._id }, { limit: 1 })).length === 0;
82431
82431
  }, "retry")
82432
82432
  });
82433
82433
  }
@@ -82467,7 +82467,7 @@ var require_connection2 = __commonJS({
82467
82467
  };
82468
82468
  function connect(url4, handler, workspace, user, opt) {
82469
82469
  return new Connection(
82470
- opt?.ctx?.newChild?.("connection", {}) ?? new import_core47.MeasureMetricsContext("connection", {}),
82470
+ opt?.ctx?.newChild?.("connection", {}) ?? new import_core48.MeasureMetricsContext("connection", {}),
82471
82471
  url4,
82472
82472
  handler,
82473
82473
  workspace,
@@ -82517,14 +82517,14 @@ var require_lib19 = __commonJS({
82517
82517
  default: () => index_default
82518
82518
  });
82519
82519
  module2.exports = __toCommonJS2(index_exports2);
82520
- var import_client24 = __toESM2(require_lib6());
82521
- var import_core47 = __toESM2(require_lib4());
82520
+ var import_client25 = __toESM2(require_lib6());
82521
+ var import_core48 = __toESM2(require_lib4());
82522
82522
  var import_platform2 = __toESM2(require_lib());
82523
82523
  var import_connection = require_connection2();
82524
82524
  var dbRequest;
82525
82525
  var dbPromise = Promise.resolve(void 0);
82526
82526
  if (typeof localStorage !== "undefined") {
82527
- const st = (0, import_core47.platformNow)();
82527
+ const st = (0, import_core48.platformNow)();
82528
82528
  dbPromise = new Promise((resolve2) => {
82529
82529
  dbRequest = indexedDB.open("model.db.persistence", 2);
82530
82530
  dbRequest.onupgradeneeded = function() {
@@ -82535,7 +82535,7 @@ var require_lib19 = __commonJS({
82535
82535
  };
82536
82536
  dbRequest.onsuccess = function() {
82537
82537
  const db = dbRequest.result;
82538
- console.log("init DB complete", (0, import_core47.platformNow)() - st);
82538
+ console.log("init DB complete", (0, import_core48.platformNow)() - st);
82539
82539
  resolve2(db);
82540
82540
  };
82541
82541
  });
@@ -82561,19 +82561,19 @@ var require_lib19 = __commonJS({
82561
82561
  return {
82562
82562
  function: {
82563
82563
  GetClient: /* @__PURE__ */ __name(async (token, endpoint, opt) => {
82564
- const filterModel = (0, import_platform2.getMetadata)(import_client24.default.metadata.FilterModel) ?? "none";
82565
- const extraFilter = (0, import_platform2.getMetadata)(import_client24.default.metadata.ExtraFilter) ?? [];
82564
+ const filterModel = (0, import_platform2.getMetadata)(import_client25.default.metadata.FilterModel) ?? "none";
82565
+ const extraFilter = (0, import_platform2.getMetadata)(import_client25.default.metadata.ExtraFilter) ?? [];
82566
82566
  const handler = /* @__PURE__ */ __name(async (handler2) => {
82567
- const url4 = (0, import_core47.concatLink)(endpoint, `/${token}`);
82567
+ const url4 = (0, import_core48.concatLink)(endpoint, `/${token}`);
82568
82568
  const upgradeHandler = /* @__PURE__ */ __name((...txes) => {
82569
82569
  for (const tx of txes) {
82570
- if (tx?._class === import_core47.default.class.TxModelUpgrade) {
82570
+ if (tx?._class === import_core48.default.class.TxModelUpgrade) {
82571
82571
  opt?.onUpgrade?.();
82572
82572
  return;
82573
82573
  }
82574
- if (tx?._class === import_core47.default.class.TxWorkspaceEvent) {
82574
+ if (tx?._class === import_core48.default.class.TxWorkspaceEvent) {
82575
82575
  const event = tx;
82576
- if (event.event === import_core47.WorkspaceEvent.MaintenanceNotification) {
82576
+ if (event.event === import_core48.WorkspaceEvent.MaintenanceNotification) {
82577
82577
  void (0, import_platform2.setPlatformStatus)(
82578
82578
  new import_platform2.Status(import_platform2.Severity.WARNING, import_platform2.default.status.MaintenanceWarning, {
82579
82579
  time: event.params.timeMinutes,
@@ -82590,7 +82590,7 @@ var require_lib19 = __commonJS({
82590
82590
  throw new Error("Workspace or account not found in token");
82591
82591
  }
82592
82592
  const newOpt = { ...opt };
82593
- const connectTimeout = opt?.connectionTimeout ?? (0, import_platform2.getMetadata)(import_client24.default.metadata.ConnectionTimeout);
82593
+ const connectTimeout = opt?.connectionTimeout ?? (0, import_platform2.getMetadata)(import_client25.default.metadata.ConnectionTimeout);
82594
82594
  let connectPromise;
82595
82595
  if ((connectTimeout ?? 0) > 0) {
82596
82596
  connectPromise = new Promise((resolve2, reject) => {
@@ -82611,7 +82611,7 @@ var require_lib19 = __commonJS({
82611
82611
  reject(error2);
82612
82612
  return;
82613
82613
  }
82614
- if (event !== import_core47.ClientConnectEvent.Maintenance) {
82614
+ if (event !== import_core48.ClientConnectEvent.Maintenance) {
82615
82615
  clearTimeout(connectTO);
82616
82616
  resolve2();
82617
82617
  }
@@ -82633,7 +82633,7 @@ var require_lib19 = __commonJS({
82633
82633
  }
82634
82634
  return txes;
82635
82635
  }, "modelFilter");
82636
- const client = (0, import_core47.createClient)(handler, modelFilter, createModelPersistence(getWSFromToken(token)), opt?.ctx);
82636
+ const client = (0, import_core48.createClient)(handler, modelFilter, createModelPersistence(getWSFromToken(token)), opt?.ctx);
82637
82637
  return await client;
82638
82638
  }, "GetClient")
82639
82639
  }
@@ -82641,17 +82641,17 @@ var require_lib19 = __commonJS({
82641
82641
  }, "default");
82642
82642
  function returnUITxes(txes, extraFilter) {
82643
82643
  const configs = /* @__PURE__ */ new Map();
82644
- (0, import_core47.fillConfiguration)(txes, configs);
82645
- const allowedPlugins = [...(0, import_platform2.getPlugins)(), ...(0, import_platform2.getMetadata)(import_client24.default.metadata.ExtraPlugins) ?? []];
82644
+ (0, import_core48.fillConfiguration)(txes, configs);
82645
+ const allowedPlugins = [...(0, import_platform2.getPlugins)(), ...(0, import_platform2.getMetadata)(import_client25.default.metadata.ExtraPlugins) ?? []];
82646
82646
  const excludedPlugins = Array.from(configs.values()).filter(
82647
82647
  (it) => !it.enabled || !allowedPlugins.includes(it.pluginId) || extraFilter.includes(it.pluginId)
82648
82648
  );
82649
- return (0, import_core47.pluginFilterTx)(excludedPlugins, configs, txes);
82649
+ return (0, import_core48.pluginFilterTx)(excludedPlugins, configs, txes);
82650
82650
  }
82651
82651
  __name(returnUITxes, "returnUITxes");
82652
82652
  function returnClientTxes(txes) {
82653
82653
  const configs = /* @__PURE__ */ new Map();
82654
- (0, import_core47.fillConfiguration)(txes, configs);
82654
+ (0, import_core48.fillConfiguration)(txes, configs);
82655
82655
  const excludedPlugins = Array.from(configs.values()).filter((it) => !it.enabled || it.pluginId.startsWith("server-"));
82656
82656
  const toExclude = /* @__PURE__ */ new Set([
82657
82657
  "workbench:class:Application",
@@ -82677,8 +82677,8 @@ var require_lib19 = __commonJS({
82677
82677
  "setting:class:WorkspaceSettingCategory",
82678
82678
  "notification:class:NotificationProvider"
82679
82679
  ]);
82680
- const result = (0, import_core47.pluginFilterTx)(excludedPlugins, configs, txes).filter((tx) => {
82681
- if (tx?._class === import_core47.default.class.TxCreateDoc || tx?._class === import_core47.default.class.TxUpdateDoc || tx?._class === import_core47.default.class.TxRemoveDoc) {
82680
+ const result = (0, import_core48.pluginFilterTx)(excludedPlugins, configs, txes).filter((tx) => {
82681
+ if (tx?._class === import_core48.default.class.TxCreateDoc || tx?._class === import_core48.default.class.TxUpdateDoc || tx?._class === import_core48.default.class.TxRemoveDoc) {
82682
82682
  const cud = tx;
82683
82683
  if (toExclude.has(cud.objectClass)) {
82684
82684
  return false;
@@ -82690,7 +82690,7 @@ var require_lib19 = __commonJS({
82690
82690
  }
82691
82691
  __name(returnClientTxes, "returnClientTxes");
82692
82692
  function createModelPersistence(workspace) {
82693
- const overrideStore = (0, import_platform2.getMetadata)(import_client24.default.metadata.OverridePersistenceStore);
82693
+ const overrideStore = (0, import_platform2.getMetadata)(import_client25.default.metadata.OverridePersistenceStore);
82694
82694
  if (overrideStore !== void 0) {
82695
82695
  return overrideStore;
82696
82696
  }
@@ -82787,11 +82787,11 @@ var require_client6 = __commonJS({
82787
82787
  });
82788
82788
  module2.exports = __toCommonJS2(client_exports);
82789
82789
  var import_account_client2 = require_lib5();
82790
- var import_client24 = __toESM2(require_lib6());
82791
- var import_core47 = require_lib4();
82790
+ var import_client25 = __toESM2(require_lib6());
82791
+ var import_core48 = require_lib4();
82792
82792
  var import_platform2 = require_lib();
82793
82793
  var import_config8 = require_config();
82794
- var import_markup8 = require_markup();
82794
+ var import_markup10 = require_markup();
82795
82795
  var import_utils14 = require_utils9();
82796
82796
  async function connect(url4, options) {
82797
82797
  const config3 = await (0, import_config8.loadServerConfig)(url4);
@@ -82805,7 +82805,7 @@ var require_client6 = __commonJS({
82805
82805
  const account = {
82806
82806
  uuid: wsLoginInfo.account,
82807
82807
  role: wsLoginInfo.role,
82808
- primarySocialId: (0, import_core47.pickPrimarySocialId)(socialIds)._id,
82808
+ primarySocialId: (0, import_core48.pickPrimarySocialId)(socialIds)._id,
82809
82809
  socialIds: socialIds.map((si) => si._id),
82810
82810
  fullSocialIds: socialIds
82811
82811
  };
@@ -82813,9 +82813,9 @@ var require_client6 = __commonJS({
82813
82813
  }
82814
82814
  __name(connect, "connect");
82815
82815
  async function createClient(url4, endpoint, token, workspaceUuid, account, config3, options) {
82816
- (0, import_platform2.addLocation)(import_client24.clientId, () => Promise.resolve().then(() => __toESM(require_lib19())));
82816
+ (0, import_platform2.addLocation)(import_client25.clientId, () => Promise.resolve().then(() => __toESM(require_lib19())));
82817
82817
  const { socketFactory, connectionTimeout } = options;
82818
- const clientFactory = await (0, import_platform2.getResource)(import_client24.default.function.GetClient);
82818
+ const clientFactory = await (0, import_platform2.getResource)(import_client25.default.function.GetClient);
82819
82819
  const connection = await clientFactory(token, endpoint, {
82820
82820
  socketFactory,
82821
82821
  connectionTimeout
@@ -82831,8 +82831,8 @@ var require_client6 = __commonJS({
82831
82831
  this.config = config3;
82832
82832
  this.connection = connection;
82833
82833
  this.account = account;
82834
- this.client = new import_core47.TxOperations(connection, account.primarySocialId);
82835
- this.markup = (0, import_markup8.createMarkupOperations)(url4, workspace, token, config3);
82834
+ this.client = new import_core48.TxOperations(connection, account.primarySocialId);
82835
+ this.markup = (0, import_markup10.createMarkupOperations)(url4, workspace, token, config3);
82836
82836
  }
82837
82837
  static {
82838
82838
  __name(this, "PlatformClientImpl");
@@ -82861,7 +82861,7 @@ var require_client6 = __commonJS({
82861
82861
  async processMarkup(_class, id, data) {
82862
82862
  const result = {};
82863
82863
  for (const [key, value3] of Object.entries(data)) {
82864
- if (value3 instanceof import_markup8.MarkupContent) {
82864
+ if (value3 instanceof import_markup10.MarkupContent) {
82865
82865
  result[key] = this.markup.uploadMarkup(_class, id, key, value3.content, value3.kind);
82866
82866
  } else {
82867
82867
  result[key] = value3;
@@ -82871,7 +82871,7 @@ var require_client6 = __commonJS({
82871
82871
  }
82872
82872
  // DocOperations
82873
82873
  async createDoc(_class, space, attributes, id) {
82874
- id ??= (0, import_core47.generateId)();
82874
+ id ??= (0, import_core48.generateId)();
82875
82875
  const data = await this.processMarkup(_class, id, attributes);
82876
82876
  return await this.client.createDoc(_class, space, data, id);
82877
82877
  }
@@ -82884,7 +82884,7 @@ var require_client6 = __commonJS({
82884
82884
  }
82885
82885
  // CollectionOperations
82886
82886
  async addCollection(_class, space, attachedTo, attachedToClass, collection, attributes, id) {
82887
- id ??= (0, import_core47.generateId)();
82887
+ id ??= (0, import_core48.generateId)();
82888
82888
  const data = await this.processMarkup(_class, id, attributes);
82889
82889
  return await this.client.addCollection(_class, space, attachedTo, attachedToClass, collection, data, id);
82890
82890
  }
@@ -83211,7 +83211,7 @@ var require_rest = __commonJS({
83211
83211
  createRestClient: () => createRestClient2
83212
83212
  });
83213
83213
  module2.exports = __toCommonJS2(rest_exports);
83214
- var import_core47 = require_lib4();
83214
+ var import_core48 = require_lib4();
83215
83215
  var import_platform2 = require_lib();
83216
83216
  var import_utils14 = require_utils9();
83217
83217
  var import_utils22 = require_utils10();
@@ -83266,7 +83266,7 @@ var require_rest = __commonJS({
83266
83266
  if (options !== void 0 && Object.keys(options).length > 0) {
83267
83267
  params.append("options", JSON.stringify(options));
83268
83268
  }
83269
- const requestUrl = (0, import_core47.concatLink)(this.endpoint, `/api/v1/find-all/${this.workspace}?${params.toString()}`);
83269
+ const requestUrl = (0, import_core48.concatLink)(this.endpoint, `/api/v1/find-all/${this.workspace}?${params.toString()}`);
83270
83270
  const result = await (0, import_utils22.withRetry)(async () => {
83271
83271
  const response = await fetch(requestUrl, this.requestInit());
83272
83272
  if (!response.ok) {
@@ -83340,7 +83340,7 @@ var require_rest = __commonJS({
83340
83340
  }
83341
83341
  }
83342
83342
  async getAccount() {
83343
- const requestUrl = (0, import_core47.concatLink)(this.endpoint, `/api/v1/account/${this.workspace}`);
83343
+ const requestUrl = (0, import_core48.concatLink)(this.endpoint, `/api/v1/account/${this.workspace}`);
83344
83344
  await this.checkRate();
83345
83345
  const result = await (0, import_utils22.withRetry)(async () => {
83346
83346
  const response = await fetch(requestUrl, this.requestInit());
@@ -83357,7 +83357,7 @@ var require_rest = __commonJS({
83357
83357
  return result;
83358
83358
  }
83359
83359
  async getModel(full = false) {
83360
- const requestUrl = new URL((0, import_core47.concatLink)(this.endpoint, `/api/v1/load-model/${this.workspace}`));
83360
+ const requestUrl = new URL((0, import_core48.concatLink)(this.endpoint, `/api/v1/load-model/${this.workspace}`));
83361
83361
  if (full) {
83362
83362
  requestUrl.searchParams.append("full", "true");
83363
83363
  }
@@ -83370,10 +83370,10 @@ var require_rest = __commonJS({
83370
83370
  }
83371
83371
  this.updateRateLimit(response);
83372
83372
  const modelResponse = await (0, import_utils22.extractJson)(response);
83373
- const hierarchy = new import_core47.Hierarchy();
83374
- const model = new import_core47.ModelDb(hierarchy);
83375
- const ctx = new import_core47.MeasureMetricsContext("loadModel", {});
83376
- (0, import_core47.buildModel)(ctx, modelResponse, void 0, hierarchy, model);
83373
+ const hierarchy = new import_core48.Hierarchy();
83374
+ const model = new import_core48.ModelDb(hierarchy);
83375
+ const ctx = new import_core48.MeasureMetricsContext("loadModel", {});
83376
+ (0, import_core48.buildModel)(ctx, modelResponse, void 0, hierarchy, model);
83377
83377
  return { hierarchy, model };
83378
83378
  }, isRLE);
83379
83379
  if (result.error !== void 0) {
@@ -83385,7 +83385,7 @@ var require_rest = __commonJS({
83385
83385
  return (await this.findAll(_class, query, { ...options, limit: 1 })).shift();
83386
83386
  }
83387
83387
  async tx(tx) {
83388
- const requestUrl = (0, import_core47.concatLink)(this.endpoint, `/api/v1/tx/${this.workspace}`);
83388
+ const requestUrl = (0, import_core48.concatLink)(this.endpoint, `/api/v1/tx/${this.workspace}`);
83389
83389
  await this.checkRate();
83390
83390
  const result = await (0, import_utils22.withRetry)(async () => {
83391
83391
  const response = await fetch(requestUrl, {
@@ -83419,7 +83419,7 @@ var require_rest = __commonJS({
83419
83419
  if (options.limit != null) {
83420
83420
  params.append("limit", `${options.limit}`);
83421
83421
  }
83422
- const requestUrl = (0, import_core47.concatLink)(this.endpoint, `/api/v1/search-fulltext/${this.workspace}?${params.toString()}`);
83422
+ const requestUrl = (0, import_core48.concatLink)(this.endpoint, `/api/v1/search-fulltext/${this.workspace}?${params.toString()}`);
83423
83423
  const response = await fetch(requestUrl, {
83424
83424
  method: "GET",
83425
83425
  headers: this.jsonHeaders(),
@@ -83438,7 +83438,7 @@ var require_rest = __commonJS({
83438
83438
  return result;
83439
83439
  }
83440
83440
  async domainRequest(domain3, params, options) {
83441
- const requestUrl = (0, import_core47.concatLink)(this.endpoint, `/api/v1/request/${domain3}/${this.workspace}`);
83441
+ const requestUrl = (0, import_core48.concatLink)(this.endpoint, `/api/v1/request/${domain3}/${this.workspace}`);
83442
83442
  await this.checkRate();
83443
83443
  return await (0, import_utils22.withRetry)(async () => {
83444
83444
  const response = await fetch(requestUrl, {
@@ -83457,7 +83457,7 @@ var require_rest = __commonJS({
83457
83457
  }, isRLE);
83458
83458
  }
83459
83459
  async ensurePerson(socialType, socialValue, firstName, lastName) {
83460
- const requestUrl = (0, import_core47.concatLink)(this.endpoint, `/api/v1/ensure-person/${this.workspace}`);
83460
+ const requestUrl = (0, import_core48.concatLink)(this.endpoint, `/api/v1/ensure-person/${this.workspace}`);
83461
83461
  await this.checkRate();
83462
83462
  const result = await (0, import_utils22.withRetry)(async () => {
83463
83463
  const response = await fetch(requestUrl, {
@@ -83514,13 +83514,13 @@ var require_tx2 = __commonJS({
83514
83514
  createRestTxOperations: () => createRestTxOperations2
83515
83515
  });
83516
83516
  module2.exports = __toCommonJS2(tx_exports);
83517
- var import_core47 = require_lib4();
83517
+ var import_core48 = require_lib4();
83518
83518
  var import_rest = require_rest();
83519
83519
  async function createRestTxOperations2(endpoint, workspaceId, token, fullModel = false) {
83520
83520
  const restClient = new import_rest.RestClientImpl(endpoint, workspaceId, token);
83521
83521
  const account = await restClient.getAccount();
83522
83522
  const { hierarchy, model } = await restClient.getModel(fullModel);
83523
- return new import_core47.TxOperations(new RestTxClient(restClient, hierarchy, model, account), account.socialIds[0]);
83523
+ return new import_core48.TxOperations(new RestTxClient(restClient, hierarchy, model, account), account.socialIds[0]);
83524
83524
  }
83525
83525
  __name(createRestTxOperations2, "createRestTxOperations");
83526
83526
  var RestTxClient = class {
@@ -83541,7 +83541,7 @@ var require_tx2 = __commonJS({
83541
83541
  const result = data.map((v) => {
83542
83542
  return this.hierarchy.updateLookupMixin(_class, v, options);
83543
83543
  });
83544
- return (0, import_core47.toFindResult)(result, data.total);
83544
+ return (0, import_core48.toFindResult)(result, data.total);
83545
83545
  }
83546
83546
  async domainRequest(domain3, params, options) {
83547
83547
  return await this.client.domainRequest(domain3, params, options);
@@ -83723,7 +83723,7 @@ var require_client7 = __commonJS({
83723
83723
  createStorageClient: () => createStorageClient2
83724
83724
  });
83725
83725
  module2.exports = __toCommonJS2(client_exports);
83726
- var import_core47 = __toESM2(require_lib4());
83726
+ var import_core48 = __toESM2(require_lib4());
83727
83727
  var import_stream2 = require("stream");
83728
83728
  var import_config8 = require_config();
83729
83729
  var import_error = require_error3();
@@ -83760,13 +83760,13 @@ var require_client7 = __commonJS({
83760
83760
  const size13 = parseInt(headers.get("Content-Length") ?? "0", 10);
83761
83761
  return {
83762
83762
  provider: "",
83763
- _class: import_core47.default.class.Blob,
83763
+ _class: import_core48.default.class.Blob,
83764
83764
  _id: objectName,
83765
83765
  contentType: headers.get("Content-Type") ?? "",
83766
83766
  size: isNaN(size13) ? 0 : size13 ?? 0,
83767
83767
  etag: headers.get("ETag") ?? "",
83768
- space: import_core47.default.space.Configuration,
83769
- modifiedBy: import_core47.default.account.System,
83768
+ space: import_core48.default.space.Configuration,
83769
+ modifiedBy: import_core48.default.account.System,
83770
83770
  modifiedOn: isNaN(lastModified) ? 0 : lastModified,
83771
83771
  version: null
83772
83772
  };
@@ -83801,11 +83801,11 @@ var require_client7 = __commonJS({
83801
83801
  if (Object.hasOwn(result[0], "id")) {
83802
83802
  const fileResult = result[0];
83803
83803
  return {
83804
- _class: import_core47.default.class.Blob,
83804
+ _class: import_core48.default.class.Blob,
83805
83805
  _id: fileResult.id,
83806
- space: import_core47.default.space.Configuration,
83806
+ space: import_core48.default.space.Configuration,
83807
83807
  modifiedOn: fileResult.metadata.lastModified,
83808
- modifiedBy: import_core47.default.account.System,
83808
+ modifiedBy: import_core48.default.account.System,
83809
83809
  provider: "",
83810
83810
  contentType: fileResult.metadata.contentType,
83811
83811
  etag: fileResult.metadata.etag,
@@ -83879,11 +83879,11 @@ var require_client7 = __commonJS({
83879
83879
  async function connectStorage(url4, options, config3) {
83880
83880
  config3 ??= await (0, import_config8.loadServerConfig)(url4);
83881
83881
  const token = await (0, import_utils14.getWorkspaceToken)(url4, options, config3);
83882
- const filesUrl = (config3.FILES_URL.startsWith("/") ? (0, import_core47.concatLink)(url4, config3.FILES_URL) : config3.FILES_URL).replace(
83882
+ const filesUrl = (config3.FILES_URL.startsWith("/") ? (0, import_core48.concatLink)(url4, config3.FILES_URL) : config3.FILES_URL).replace(
83883
83883
  ":workspace",
83884
83884
  token.workspaceId
83885
83885
  );
83886
- const uploadUrl = (config3.UPLOAD_URL.startsWith("/") ? (0, import_core47.concatLink)(url4, config3.UPLOAD_URL) : config3.UPLOAD_URL).replace(":workspace", token.workspaceId);
83886
+ const uploadUrl = (config3.UPLOAD_URL.startsWith("/") ? (0, import_core48.concatLink)(url4, config3.UPLOAD_URL) : config3.UPLOAD_URL).replace(":workspace", token.workspaceId);
83887
83887
  return new StorageClientImpl(filesUrl, uploadUrl, token.token, token.workspaceId);
83888
83888
  }
83889
83889
  __name(connectStorage, "connectStorage");
@@ -83936,11 +83936,11 @@ var require_storage2 = __commonJS({
83936
83936
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
83937
83937
  var storage_exports = {};
83938
83938
  __export2(storage_exports, {
83939
- connectStorage: () => import_client24.connectStorage,
83940
- createStorageClient: () => import_client24.createStorageClient
83939
+ connectStorage: () => import_client25.connectStorage,
83940
+ createStorageClient: () => import_client25.createStorageClient
83941
83941
  });
83942
83942
  module2.exports = __toCommonJS2(storage_exports);
83943
- var import_client24 = require_client7();
83943
+ var import_client25 = require_client7();
83944
83944
  __reExport2(storage_exports, require_error3(), module2.exports);
83945
83945
  __reExport2(storage_exports, require_types8(), module2.exports);
83946
83946
  }
@@ -84596,7 +84596,7 @@ var require_utils11 = __commonJS({
84596
84596
  getWeekday: () => getWeekday
84597
84597
  });
84598
84598
  module2.exports = __toCommonJS2(utils_exports);
84599
- var import_core47 = require_lib4();
84599
+ var import_core48 = require_lib4();
84600
84600
  var import__ = __toESM2(require_lib24());
84601
84601
  function getInstance(event, date7) {
84602
84602
  const diff8 = event.dueDate - event.date;
@@ -84608,7 +84608,7 @@ var require_utils11 = __commonJS({
84608
84608
  originalStartTime: date7,
84609
84609
  _class: import__.default.class.ReccuringInstance,
84610
84610
  eventId: generateEventId3(),
84611
- _id: (0, import_core47.generateId)(),
84611
+ _id: (0, import_core48.generateId)(),
84612
84612
  virtual: true
84613
84613
  };
84614
84614
  }
@@ -84921,7 +84921,7 @@ var require_utils11 = __commonJS({
84921
84921
  }
84922
84922
  __name(getAllEvents, "getAllEvents");
84923
84923
  function generateEventId3() {
84924
- const id = (0, import_core47.generateId)();
84924
+ const id = (0, import_core48.generateId)();
84925
84925
  return encodeToBase32Hex(id);
84926
84926
  }
84927
84927
  __name(generateEventId3, "generateEventId");
@@ -85335,7 +85335,7 @@ var require_utils12 = __commonJS({
85335
85335
  });
85336
85336
  module2.exports = __toCommonJS2(utils_exports);
85337
85337
  var import_fast_equals = require_cjs();
85338
- var import_core47 = __toESM2(require_lib4());
85338
+ var import_core48 = __toESM2(require_lib4());
85339
85339
  var import__ = __toESM2(require_lib26());
85340
85340
  async function getDirectChannel(client, me, employeeAccount) {
85341
85341
  const accIds = [me, employeeAccount].sort();
@@ -85345,7 +85345,7 @@ var require_utils12 = __commonJS({
85345
85345
  return dm._id;
85346
85346
  }
85347
85347
  }
85348
- return await client.createDoc(import__.default.class.DirectMessage, import_core47.default.space.Space, {
85348
+ return await client.createDoc(import__.default.class.DirectMessage, import_core48.default.space.Space, {
85349
85349
  name: "",
85350
85350
  description: "",
85351
85351
  private: true,
@@ -85649,18 +85649,18 @@ var require_cache4 = __commonJS({
85649
85649
  default: () => ContactCache
85650
85650
  });
85651
85651
  module2.exports = __toCommonJS2(cache_exports);
85652
- var import_core47 = __toESM2(require_lib4());
85652
+ var import_core48 = __toESM2(require_lib4());
85653
85653
  var import__ = __toESM2(require_lib27());
85654
85654
  function isCreateTx(tx) {
85655
- return tx._class === import_core47.default.class.TxCreateDoc;
85655
+ return tx._class === import_core48.default.class.TxCreateDoc;
85656
85656
  }
85657
85657
  __name(isCreateTx, "isCreateTx");
85658
85658
  function isUpdateTx(tx) {
85659
- return tx._class === import_core47.default.class.TxUpdateDoc;
85659
+ return tx._class === import_core48.default.class.TxUpdateDoc;
85660
85660
  }
85661
85661
  __name(isUpdateTx, "isUpdateTx");
85662
85662
  function isMixinTx(tx) {
85663
- return tx._class === import_core47.default.class.TxMixin;
85663
+ return tx._class === import_core48.default.class.TxMixin;
85664
85664
  }
85665
85665
  __name(isMixinTx, "isMixinTx");
85666
85666
  function isPersonTx(tx) {
@@ -85767,7 +85767,7 @@ var require_cache4 = __commonJS({
85767
85767
  const ref = tx.objectId;
85768
85768
  const person = this._personByRef.get(ref);
85769
85769
  if (person === void 0) return;
85770
- const createdPerson = import_core47.TxProcessor.createDoc2Doc(tx);
85770
+ const createdPerson = import_core48.TxProcessor.createDoc2Doc(tx);
85771
85771
  this._personByRef.set(ref, createdPerson);
85772
85772
  const personIds = Array.from(this._personIdsByPersonRef.get(ref) ?? []);
85773
85773
  for (const personId of personIds) {
@@ -85785,7 +85785,7 @@ var require_cache4 = __commonJS({
85785
85785
  const newPersonRef = tx.attachedTo;
85786
85786
  this._personRefByPersonId.set(personId, newPersonRef);
85787
85787
  this.addPersonIdToPersonRef(newPersonRef, personId);
85788
- const createdSocialId = import_core47.TxProcessor.createDoc2Doc(tx);
85788
+ const createdSocialId = import_core48.TxProcessor.createDoc2Doc(tx);
85789
85789
  this._socialIdByPersonId.set(personId, createdSocialId);
85790
85790
  this.broadcastChange({
85791
85791
  personRef: newPersonRef,
@@ -85796,7 +85796,7 @@ var require_cache4 = __commonJS({
85796
85796
  const ref = tx.objectId;
85797
85797
  const person = this._personByRef.get(ref);
85798
85798
  if (person == null) return;
85799
- const updatedPerson = isUpdateTx(tx) ? import_core47.TxProcessor.updateDoc2Doc(person, tx) : import_core47.TxProcessor.updateMixin4Doc(person, tx);
85799
+ const updatedPerson = isUpdateTx(tx) ? import_core48.TxProcessor.updateDoc2Doc(person, tx) : import_core48.TxProcessor.updateMixin4Doc(person, tx);
85800
85800
  this._personByRef.set(ref, updatedPerson);
85801
85801
  const personIds = Array.from(this._personIdsByPersonRef.get(ref) ?? []);
85802
85802
  for (const personId of personIds) {
@@ -85911,7 +85911,7 @@ var require_utils13 = __commonJS({
85911
85911
  setCurrentEmployeeSpace: () => setCurrentEmployeeSpace
85912
85912
  });
85913
85913
  module2.exports = __toCommonJS2(utils_exports);
85914
- var import_core47 = require_lib4();
85914
+ var import_core48 = require_lib4();
85915
85915
  var import_platform2 = require_lib();
85916
85916
  var import__ = __toESM2(require_lib27());
85917
85917
  var import_types12 = require_types9();
@@ -86115,7 +86115,7 @@ var require_utils13 = __commonJS({
86115
86115
  if (socialIds.length === 0) {
86116
86116
  return;
86117
86117
  }
86118
- return (0, import_core47.pickPrimarySocialId)(socialIds)._id;
86118
+ return (0, import_core48.pickPrimarySocialId)(socialIds)._id;
86119
86119
  }
86120
86120
  __name(getPrimarySocialId, "getPrimarySocialId");
86121
86121
  async function getAllSocialStringsByPersonId(client, personId) {
@@ -86154,12 +86154,12 @@ var require_utils13 = __commonJS({
86154
86154
  __name(getSocialStringsByEmployee, "getSocialStringsByEmployee");
86155
86155
  async function getAllAccounts(client) {
86156
86156
  const employees = await client.findAll(import__.default.mixin.Employee, { active: true });
86157
- return employees.map((it) => it.personUuid).filter(import_core47.notEmpty);
86157
+ return employees.map((it) => it.personUuid).filter(import_core48.notEmpty);
86158
86158
  }
86159
86159
  __name(getAllAccounts, "getAllAccounts");
86160
86160
  async function getAllUserAccounts(client) {
86161
86161
  const employees = await client.findAll(import__.default.mixin.Employee, { active: true });
86162
- return employees.map((it) => it.personUuid).filter(import_core47.notEmpty);
86162
+ return employees.map((it) => it.personUuid).filter(import_core48.notEmpty);
86163
86163
  }
86164
86164
  __name(getAllUserAccounts, "getAllUserAccounts");
86165
86165
  async function ensureEmployee(ctx, me, client, socialIds, getGlobalPerson) {
@@ -86168,7 +86168,7 @@ var require_utils13 = __commonJS({
86168
86168
  }
86169
86169
  __name(ensureEmployee, "ensureEmployee");
86170
86170
  async function ensureEmployeeForPerson(ctx, me, person, client, socialIds, globalPerson) {
86171
- const txFactory = new import_core47.TxFactory(me.primarySocialId);
86171
+ const txFactory = new import_core48.TxFactory(me.primarySocialId);
86172
86172
  const personByUuid = await client.findOne(import__.default.class.Person, { personUuid: person.uuid });
86173
86173
  let personRef = personByUuid?._id;
86174
86174
  if (personRef === void 0) {
@@ -86189,7 +86189,7 @@ var require_utils13 = __commonJS({
86189
86189
  city: globalPerson.city,
86190
86190
  avatarType: import__.AvatarType.COLOR
86191
86191
  };
86192
- personRef = (0, import_core47.generateId)();
86192
+ personRef = (0, import_core48.generateId)();
86193
86193
  const createPersonTx = txFactory.createTxCreateDoc(import__.default.class.Person, import__.default.space.Contacts, data, personRef);
86194
86194
  await client.tx(createPersonTx);
86195
86195
  });
@@ -86199,7 +86199,7 @@ var require_utils13 = __commonJS({
86199
86199
  });
86200
86200
  await client.tx(updatePersonTx);
86201
86201
  }
86202
- const existingIdentifiers = (0, import_core47.toIdMap)(
86202
+ const existingIdentifiers = (0, import_core48.toIdMap)(
86203
86203
  await client.findAll(import__.default.class.SocialIdentity, { _id: { $in: person.socialIds } })
86204
86204
  );
86205
86205
  for (const socialId of socialIds) {
@@ -86224,7 +86224,7 @@ var require_utils13 = __commonJS({
86224
86224
  collection: "socialIds",
86225
86225
  type: socialId.type,
86226
86226
  value: socialId.value,
86227
- key: (0, import_core47.buildSocialIdString)(socialId),
86227
+ key: (0, import_core48.buildSocialIdString)(socialId),
86228
86228
  // TODO: fill it in trigger or on DB level as stored calculated column or smth?
86229
86229
  verifiedOn: socialId.verifiedOn,
86230
86230
  isDeleted: socialId.isDeleted
@@ -86265,9 +86265,9 @@ var require_utils13 = __commonJS({
86265
86265
  }
86266
86266
  }
86267
86267
  }
86268
- const employeeRole = person.role === import_core47.AccountRole.Guest || person.role === import_core47.AccountRole.ReadOnlyGuest ? "GUEST" : "USER";
86268
+ const employeeRole = person.role === import_core48.AccountRole.Guest || person.role === import_core48.AccountRole.ReadOnlyGuest ? "GUEST" : "USER";
86269
86269
  const employee = await client.findOne(import__.default.mixin.Employee, { _id: personRef });
86270
- if (employee === void 0 || !import_core47.Hierarchy.hasMixin(employee, import__.default.mixin.Employee) || !employee.active || employee.role !== employeeRole) {
86270
+ if (employee === void 0 || !import_core48.Hierarchy.hasMixin(employee, import__.default.mixin.Employee) || !employee.active || employee.role !== employeeRole) {
86271
86271
  await ctx.with("create-employee", {}, async () => {
86272
86272
  if (personRef === void 0) {
86273
86273
  console.error("Person not found");
@@ -86307,7 +86307,7 @@ var require_utils13 = __commonJS({
86307
86307
  }
86308
86308
  __name(loadCachesForPersonId, "loadCachesForPersonId");
86309
86309
  async function loadCachesForPersonIds(client, personIds) {
86310
- const sidObjsMap = (0, import_core47.toIdMap)(
86310
+ const sidObjsMap = (0, import_core48.toIdMap)(
86311
86311
  await client.findAll(
86312
86312
  import__.default.class.SocialIdentity,
86313
86313
  {
@@ -86342,7 +86342,7 @@ var require_utils13 = __commonJS({
86342
86342
  }
86343
86343
  __name(loadCachesForPersonRef, "loadCachesForPersonRef");
86344
86344
  async function loadCachesForPersonRefs(client, personRefs) {
86345
- const persons = (0, import_core47.toIdMap)(
86345
+ const persons = (0, import_core48.toIdMap)(
86346
86346
  await client.findAll(
86347
86347
  import__.default.class.Person,
86348
86348
  {
@@ -86385,7 +86385,7 @@ var require_utils13 = __commonJS({
86385
86385
  personIds.map((pid) => {
86386
86386
  const ref = contactCache.personRefByPersonId.get(pid);
86387
86387
  return ref != null ? [pid, ref] : void 0;
86388
- }).filter(import_core47.notEmpty)
86388
+ }).filter(import_core48.notEmpty)
86389
86389
  );
86390
86390
  }
86391
86391
  __name(getPersonRefsByPersonIdsFromCache, "getPersonRefsByPersonIdsFromCache");
@@ -86432,7 +86432,7 @@ var require_utils13 = __commonJS({
86432
86432
  personIds.map((pid) => {
86433
86433
  const person = contactCache.personByPersonId.get(pid);
86434
86434
  return person != null ? [pid, person] : void 0;
86435
- }).filter(import_core47.notEmpty)
86435
+ }).filter(import_core48.notEmpty)
86436
86436
  );
86437
86437
  }
86438
86438
  __name(getPersonsByPersonIdsFromCache, "getPersonsByPersonIdsFromCache");
@@ -86479,7 +86479,7 @@ var require_utils13 = __commonJS({
86479
86479
  personRefs.map((personRef) => {
86480
86480
  const person = contactCache.personByRef.get(personRef);
86481
86481
  return person != null ? [personRef, person] : void 0;
86482
- }).filter(import_core47.notEmpty)
86482
+ }).filter(import_core48.notEmpty)
86483
86483
  );
86484
86484
  }
86485
86485
  __name(getPersonsByPersonRefsFromCache, "getPersonsByPersonRefsFromCache");
@@ -87084,9 +87084,9 @@ var require_utils14 = __commonJS({
87084
87084
  getFirstRank: () => getFirstRank
87085
87085
  });
87086
87086
  module2.exports = __toCommonJS2(utils_exports);
87087
- var import_core47 = require_lib4();
87087
+ var import_core48 = require_lib4();
87088
87088
  var import_plugin = __toESM2(require_plugin2());
87089
- async function getFirstRank(client, space, parent, sort3 = import_core47.SortingOrder.Descending, extra = {}) {
87089
+ async function getFirstRank(client, space, parent, sort3 = import_core48.SortingOrder.Descending, extra = {}) {
87090
87090
  const doc = await client.findOne(
87091
87091
  import_plugin.default.class.Document,
87092
87092
  { space, parent, ...extra },
@@ -88709,7 +88709,7 @@ var require_utils16 = __commonJS({
88709
88709
  updateProjectType: () => updateProjectType
88710
88710
  });
88711
88711
  module2.exports = __toCommonJS2(utils_exports);
88712
- var import_core47 = __toESM2(require_lib4());
88712
+ var import_core48 = __toESM2(require_lib4());
88713
88713
  var import_platform2 = require_lib();
88714
88714
  var import__ = __toESM2(require_lib33());
88715
88715
  var import_rank4 = require_lib32();
@@ -88745,7 +88745,7 @@ var require_utils16 = __commonJS({
88745
88745
  if (exists5 !== void 0) {
88746
88746
  return exists5._id;
88747
88747
  }
88748
- const res = await client.createDoc(_class, import_core47.default.space.Model, data);
88748
+ const res = await client.createDoc(_class, import_core48.default.space.Model, data);
88749
88749
  return res;
88750
88750
  }
88751
88751
  __name(createState, "createState");
@@ -88775,7 +88775,7 @@ var require_utils16 = __commonJS({
88775
88775
  function findStatusAttr(h, _class) {
88776
88776
  const attrs = h.getAllAttributes(_class);
88777
88777
  for (const it of attrs.values()) {
88778
- if (it.type._class === import_core47.default.class.RefTo && h.isDerived(it.type.to, import_core47.default.class.Status)) {
88778
+ if (it.type._class === import_core48.default.class.RefTo && h.isDerived(it.type.to, import_core48.default.class.Status)) {
88779
88779
  return it;
88780
88780
  }
88781
88781
  }
@@ -88807,7 +88807,7 @@ var require_utils16 = __commonJS({
88807
88807
  const targetProjectClassId = `${_id}:type:mixin`;
88808
88808
  const tmpl = await client.createDoc(
88809
88809
  import__.default.class.ProjectType,
88810
- import_core47.default.space.Model,
88810
+ import_core48.default.space.Model,
88811
88811
  {
88812
88812
  description: data.description,
88813
88813
  shortDescription: data.shortDescription,
@@ -88822,17 +88822,17 @@ var require_utils16 = __commonJS({
88822
88822
  _id
88823
88823
  );
88824
88824
  await client.createDoc(
88825
- import_core47.default.class.Mixin,
88826
- import_core47.default.space.Model,
88825
+ import_core48.default.class.Mixin,
88826
+ import_core48.default.space.Model,
88827
88827
  {
88828
88828
  extends: categoryObj.baseClass,
88829
- kind: import_core47.ClassifierKind.MIXIN,
88829
+ kind: import_core48.ClassifierKind.MIXIN,
88830
88830
  label: (0, import_platform2.getEmbeddedLabel)(data.name),
88831
88831
  icon: baseClassClass.icon
88832
88832
  },
88833
88833
  targetProjectClassId
88834
88834
  );
88835
- await client.createMixin(targetProjectClassId, import_core47.default.class.Mixin, import_core47.default.space.Model, import__.default.mixin.ProjectTypeClass, {
88835
+ await client.createMixin(targetProjectClassId, import_core48.default.class.Mixin, import_core48.default.space.Model, import__.default.mixin.ProjectTypeClass, {
88836
88836
  projectType: _id
88837
88837
  });
88838
88838
  return tmpl;
@@ -88891,22 +88891,22 @@ var require_utils16 = __commonJS({
88891
88891
  const targetClassId = `${taskId}:type:mixin`;
88892
88892
  tdata.targetClass = targetClassId;
88893
88893
  await client.createDoc(
88894
- import_core47.default.class.Mixin,
88895
- import_core47.default.space.Model,
88894
+ import_core48.default.class.Mixin,
88895
+ import_core48.default.space.Model,
88896
88896
  {
88897
88897
  extends: data.ofClass,
88898
- kind: import_core47.ClassifierKind.MIXIN,
88898
+ kind: import_core48.ClassifierKind.MIXIN,
88899
88899
  label: ofClassClass.label,
88900
88900
  icon: ofClassClass.icon
88901
88901
  },
88902
88902
  targetClassId
88903
88903
  );
88904
- await client.createMixin(targetClassId, import_core47.default.class.Mixin, import_core47.default.space.Model, import__.default.mixin.TaskTypeClass, {
88904
+ await client.createMixin(targetClassId, import_core48.default.class.Mixin, import_core48.default.space.Model, import__.default.mixin.TaskTypeClass, {
88905
88905
  taskType: taskId,
88906
88906
  projectType: _id
88907
88907
  });
88908
88908
  }
88909
- await client.createDoc(import__.default.class.TaskType, import_core47.default.space.Model, tdata, taskId);
88909
+ await client.createDoc(import__.default.class.TaskType, import_core48.default.space.Model, tdata, taskId);
88910
88910
  tasksData.set(taskId, tdata);
88911
88911
  _tasks.push(taskId);
88912
88912
  }
@@ -150531,8 +150531,119 @@ var HulyConfigService = class _HulyConfigService extends Context_exports.Tag("@h
150531
150531
  var import_api_client = __toESM(require_lib20(), 1);
150532
150532
  var import_collaborator_client = __toESM(require_lib7(), 1);
150533
150533
  var import_core2 = __toESM(require_lib4(), 1);
150534
- var import_text = __toESM(require_lib9(), 1);
150535
- var import_text_markdown = __toESM(require_lib17(), 1);
150534
+ var import_text2 = __toESM(require_lib9(), 1);
150535
+ var import_text_markdown2 = __toESM(require_lib17(), 1);
150536
+
150537
+ // src/domain/schemas/shared.ts
150538
+ var MAX_LIMIT = 200;
150539
+ var NonEmptyString2 = Schema_exports.Trim.pipe(Schema_exports.nonEmptyString());
150540
+ var Timestamp = Schema_exports.NonNegativeInt.annotations({
150541
+ identifier: "Timestamp",
150542
+ title: "Timestamp",
150543
+ description: "Unix timestamp in milliseconds (non-negative integer)"
150544
+ });
150545
+ var LimitParam = Schema_exports.Number.pipe(
150546
+ Schema_exports.int(),
150547
+ Schema_exports.positive(),
150548
+ Schema_exports.lessThanOrEqualTo(MAX_LIMIT)
150549
+ );
150550
+ var EmptyParamsSchema = Schema_exports.Struct({}).annotations({
150551
+ jsonSchema: { type: "object", properties: {}, additionalProperties: false }
150552
+ });
150553
+ var emptyParamsJsonSchema = JSONSchema_exports.make(EmptyParamsSchema);
150554
+ var HulyRef = (tag2) => NonEmptyString2.pipe(Schema_exports.brand(tag2));
150555
+ var PersonId = HulyRef("PersonId");
150556
+ var OrganizationId = HulyRef("OrganizationId");
150557
+ var IssueId = HulyRef("IssueId");
150558
+ var ComponentId = HulyRef("ComponentId");
150559
+ var MilestoneId = HulyRef("MilestoneId");
150560
+ var IssueTemplateId = HulyRef("IssueTemplateId");
150561
+ var IssueTemplateChildId = HulyRef("IssueTemplateChildId");
150562
+ var ChannelId = HulyRef("ChannelId");
150563
+ var MessageId = HulyRef("MessageId");
150564
+ var ThreadReplyId = HulyRef("ThreadReplyId");
150565
+ var ActivityMessageId = HulyRef("ActivityMessageId");
150566
+ var AttachmentId = HulyRef("AttachmentId");
150567
+ var BlobId = HulyRef("BlobId");
150568
+ var CardId = HulyRef("CardId");
150569
+ var CardSpaceId = HulyRef("CardSpaceId");
150570
+ var DocumentId = HulyRef("DocumentId");
150571
+ var MasterTagId = HulyRef("MasterTagId");
150572
+ var TeamspaceId = HulyRef("TeamspaceId");
150573
+ var NotificationId = HulyRef("NotificationId");
150574
+ var NotificationContextId = HulyRef("NotificationContextId");
150575
+ var EventId = HulyRef("EventId");
150576
+ var TodoId = HulyRef("TodoId");
150577
+ var SpaceId = HulyRef("SpaceId");
150578
+ var CommentId = HulyRef("CommentId");
150579
+ var TimeSpendReportId = HulyRef("TimeSpendReportId");
150580
+ var TagElementId = HulyRef("TagElementId");
150581
+ var TagCategoryId = HulyRef("TagCategoryId");
150582
+ var WorkSlotId = HulyRef("WorkSlotId");
150583
+ var CustomFieldId = HulyRef("CustomFieldId");
150584
+ var TestProjectId = HulyRef("TestProjectId");
150585
+ var TestSuiteId = HulyRef("TestSuiteId");
150586
+ var TestCaseId = HulyRef("TestCaseId");
150587
+ var TestPlanId = HulyRef("TestPlanId");
150588
+ var TestPlanItemId = HulyRef("TestPlanItemId");
150589
+ var TestRunId = HulyRef("TestRunId");
150590
+ var TestResultId = HulyRef("TestResultId");
150591
+ var ProjectIdentifier = NonEmptyString2.pipe(Schema_exports.brand("ProjectIdentifier"));
150592
+ var IssueIdentifier = NonEmptyString2.pipe(Schema_exports.brand("IssueIdentifier"));
150593
+ var Email = Schema_exports.NonEmptyString.pipe(
150594
+ Schema_exports.pattern(/^[^@]+@[^@]+$/, {
150595
+ message: () => "must contain exactly one @"
150596
+ }),
150597
+ Schema_exports.brand("Email")
150598
+ );
150599
+ var StatusName = NonEmptyString2.pipe(Schema_exports.brand("StatusName"));
150600
+ var PersonName = NonEmptyString2.pipe(Schema_exports.brand("PersonName"));
150601
+ var ComponentLabel = NonEmptyString2.pipe(Schema_exports.brand("ComponentLabel"));
150602
+ var MilestoneLabel = NonEmptyString2.pipe(Schema_exports.brand("MilestoneLabel"));
150603
+ var ChannelName = NonEmptyString2.pipe(Schema_exports.brand("ChannelName"));
150604
+ var MimeType = NonEmptyString2.pipe(Schema_exports.brand("MimeType"));
150605
+ var ObjectClassName = NonEmptyString2.pipe(Schema_exports.brand("ObjectClassName"));
150606
+ var EmojiCode = NonEmptyString2.pipe(Schema_exports.brand("EmojiCode"));
150607
+ var ContactProvider = NonEmptyString2.pipe(Schema_exports.brand("ContactProvider"));
150608
+ var NotificationProviderId = NonEmptyString2.pipe(Schema_exports.brand("NotificationProviderId"));
150609
+ var NotificationTypeId = NonEmptyString2.pipe(Schema_exports.brand("NotificationTypeId"));
150610
+ var WorkspaceName = NonEmptyString2.pipe(Schema_exports.brand("WorkspaceName"));
150611
+ var UrlString = NonEmptyString2.pipe(Schema_exports.brand("UrlString"));
150612
+ var WorkspaceUrlSlug = NonEmptyString2.pipe(Schema_exports.brand("WorkspaceUrlSlug"));
150613
+ var WorkspaceVersion = NonEmptyString2.pipe(Schema_exports.brand("WorkspaceVersion"));
150614
+ var WorkspaceMode = NonEmptyString2.pipe(Schema_exports.brand("WorkspaceMode"));
150615
+ var WorkspaceUuid = NonEmptyString2.pipe(Schema_exports.brand("WorkspaceUuid"));
150616
+ var PersonUuid = NonEmptyString2.pipe(Schema_exports.brand("PersonUuid"));
150617
+ var AccountId = NonEmptyString2.pipe(Schema_exports.brand("AccountId"));
150618
+ var AccountUuid = Schema_exports.String.pipe(Schema_exports.brand("AccountUuid"));
150619
+ var RegionId = Schema_exports.String.pipe(Schema_exports.brand("RegionId"));
150620
+ var NonNegativeNumber = Schema_exports.Number.pipe(Schema_exports.nonNegative(), Schema_exports.brand("NonNegativeNumber"));
150621
+ var PositiveNumber = NonNegativeNumber.pipe(Schema_exports.positive(), Schema_exports.brand("PositiveNumber"));
150622
+ var ColorCode = Schema_exports.Number.pipe(
150623
+ Schema_exports.int(),
150624
+ Schema_exports.greaterThanOrEqualTo(0),
150625
+ Schema_exports.lessThanOrEqualTo(9),
150626
+ // eslint-disable-line no-magic-numbers -- Huly color palette has 10 colors (0-9)
150627
+ Schema_exports.brand("ColorCode")
150628
+ );
150629
+ var ComponentIdentifier = NonEmptyString2.pipe(Schema_exports.brand("ComponentIdentifier"));
150630
+ var MilestoneIdentifier = NonEmptyString2.pipe(Schema_exports.brand("MilestoneIdentifier"));
150631
+ var TemplateIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TemplateIdentifier"));
150632
+ var ChannelIdentifier = NonEmptyString2.pipe(Schema_exports.brand("ChannelIdentifier"));
150633
+ var TeamspaceIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TeamspaceIdentifier"));
150634
+ var CardIdentifier = NonEmptyString2.pipe(Schema_exports.brand("CardIdentifier"));
150635
+ var CardSpaceIdentifier = NonEmptyString2.pipe(Schema_exports.brand("CardSpaceIdentifier"));
150636
+ var DocumentIdentifier = NonEmptyString2.pipe(Schema_exports.brand("DocumentIdentifier"));
150637
+ var MasterTagIdentifier = NonEmptyString2.pipe(Schema_exports.brand("MasterTagIdentifier"));
150638
+ var TagIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TagIdentifier"));
150639
+ var TagCategoryIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TagCategoryIdentifier"));
150640
+ var MemberReference = NonEmptyString2.pipe(Schema_exports.brand("MemberReference"));
150641
+ var TestProjectIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TestProjectIdentifier"));
150642
+ var TestSuiteIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TestSuiteIdentifier"));
150643
+ var TestCaseIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TestCaseIdentifier"));
150644
+ var TestPlanIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TestPlanIdentifier"));
150645
+ var TestRunIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TestRunIdentifier"));
150646
+ var TestResultIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TestResultIdentifier"));
150536
150647
 
150537
150648
  // src/utils/url.ts
150538
150649
  var concatLink = (host, path2) => {
@@ -150633,6 +150744,37 @@ var PersonNotFoundError = class extends Schema_exports.TaggedError()(
150633
150744
  return `Person '${this.identifier}' not found`;
150634
150745
  }
150635
150746
  };
150747
+ var OrganizationNotFoundError = class extends Schema_exports.TaggedError()(
150748
+ "OrganizationNotFoundError",
150749
+ {
150750
+ identifier: Schema_exports.String
150751
+ }
150752
+ ) {
150753
+ get message() {
150754
+ return `Organization '${this.identifier}' not found`;
150755
+ }
150756
+ };
150757
+ var OrganizationIdentifierAmbiguousError = class extends Schema_exports.TaggedError()(
150758
+ "OrganizationIdentifierAmbiguousError",
150759
+ {
150760
+ identifier: Schema_exports.String,
150761
+ matches: Schema_exports.Number
150762
+ }
150763
+ ) {
150764
+ get message() {
150765
+ return `Organization identifier '${this.identifier}' matched ${this.matches} organizations; use the organization ID instead`;
150766
+ }
150767
+ };
150768
+ var InvalidContactProviderError = class extends Schema_exports.TaggedError()(
150769
+ "InvalidContactProviderError",
150770
+ {
150771
+ provider: Schema_exports.String
150772
+ }
150773
+ ) {
150774
+ get message() {
150775
+ return `Invalid contact provider: '${this.provider}'`;
150776
+ }
150777
+ };
150636
150778
  var InvalidPersonUuidError = class extends Schema_exports.TaggedError()(
150637
150779
  "InvalidPersonUuidError",
150638
150780
  {
@@ -150820,6 +150962,144 @@ var TagCategoryNotFoundError = class extends Schema_exports.TaggedError()(
150820
150962
  }
150821
150963
  };
150822
150964
 
150965
+ // src/domain/schemas/leads.ts
150966
+ var HulyRef2 = (tag2) => Schema_exports.Trim.pipe(Schema_exports.nonEmptyString(), Schema_exports.brand(tag2));
150967
+ var FunnelReference = HulyRef2("FunnelReference");
150968
+ var FunnelIdentifier = HulyRef2("FunnelIdentifier");
150969
+ var CanonicalLeadIdentifier = Schema_exports.Trim.pipe(
150970
+ Schema_exports.pattern(/^LEAD-\d+$/, {
150971
+ message: () => "Expected lead identifier like 'LEAD-1'"
150972
+ }),
150973
+ Schema_exports.brand("LeadIdentifier")
150974
+ );
150975
+ var leadIdentifierPattern = /^(?:LEAD-)?(\d+)$/i;
150976
+ var LeadIdentifier = Schema_exports.transformOrFail(Schema_exports.String, CanonicalLeadIdentifier, {
150977
+ strict: true,
150978
+ decode: (input, _options, ast) => {
150979
+ const match16 = leadIdentifierPattern.exec(input.trim());
150980
+ return match16 !== null ? ParseResult_exports.succeed(`LEAD-${match16[1]}`) : ParseResult_exports.fail(new ParseResult_exports.Type(ast, input, "Expected lead identifier like 'LEAD-1'"));
150981
+ },
150982
+ encode: ParseResult_exports.succeed
150983
+ }).annotations({
150984
+ jsonSchema: {
150985
+ type: "string",
150986
+ pattern: "^LEAD-[0-9]+$"
150987
+ }
150988
+ });
150989
+ var FunnelSummarySchema = Schema_exports.Struct({
150990
+ identifier: FunnelIdentifier,
150991
+ name: Schema_exports.String,
150992
+ description: Schema_exports.optional(Schema_exports.String),
150993
+ archived: Schema_exports.Boolean
150994
+ }).annotations({
150995
+ title: "FunnelSummary",
150996
+ description: "Sales funnel summary"
150997
+ });
150998
+ var LeadSummarySchema = Schema_exports.Struct({
150999
+ identifier: LeadIdentifier,
151000
+ title: Schema_exports.String,
151001
+ status: StatusName,
151002
+ assignee: Schema_exports.optional(PersonName),
151003
+ customer: Schema_exports.optional(Schema_exports.String),
151004
+ modifiedOn: Schema_exports.optional(Timestamp)
151005
+ }).annotations({
151006
+ title: "LeadSummary",
151007
+ description: "Lead summary for list operations"
151008
+ });
151009
+ var LeadDetailSchema = Schema_exports.Struct({
151010
+ identifier: LeadIdentifier,
151011
+ title: Schema_exports.String,
151012
+ description: Schema_exports.optional(Schema_exports.String),
151013
+ status: StatusName,
151014
+ assignee: Schema_exports.optional(PersonName),
151015
+ customer: Schema_exports.optional(Schema_exports.String),
151016
+ funnel: FunnelIdentifier,
151017
+ funnelName: Schema_exports.String,
151018
+ modifiedOn: Schema_exports.optional(Timestamp),
151019
+ createdOn: Schema_exports.optional(Timestamp)
151020
+ }).annotations({
151021
+ title: "LeadDetail",
151022
+ description: "Full lead with all fields"
151023
+ });
151024
+ var ListFunnelsParamsSchema = Schema_exports.Struct({
151025
+ includeArchived: Schema_exports.optional(Schema_exports.Boolean.annotations({
151026
+ description: "Include archived funnels in results (default: false, showing only active)"
151027
+ })),
151028
+ limit: Schema_exports.optional(
151029
+ LimitParam.annotations({
151030
+ description: "Maximum number of funnels to return (default: 50)"
151031
+ })
151032
+ )
151033
+ }).annotations({
151034
+ title: "ListFunnelsParams",
151035
+ description: "Parameters for listing funnels"
151036
+ });
151037
+ var ListLeadsParamsBase = Schema_exports.Struct({
151038
+ funnel: FunnelReference.annotations({
151039
+ description: "Funnel ID returned by list_funnels, or funnel name for convenience lookup."
151040
+ }),
151041
+ status: Schema_exports.optional(StatusName.annotations({
151042
+ description: "Filter by status name"
151043
+ })),
151044
+ assignee: Schema_exports.optional(Email.annotations({
151045
+ description: "Filter by assignee email"
151046
+ })),
151047
+ titleSearch: Schema_exports.optional(Schema_exports.String.annotations({
151048
+ description: "Search leads by title substring (case-insensitive)"
151049
+ })),
151050
+ limit: Schema_exports.optional(
151051
+ LimitParam.annotations({
151052
+ description: "Maximum number of leads to return (default: 50)"
151053
+ })
151054
+ )
151055
+ });
151056
+ var ListLeadsParamsSchema = ListLeadsParamsBase.annotations({
151057
+ title: "ListLeadsParams",
151058
+ description: "Parameters for listing leads in a funnel"
151059
+ });
151060
+ var GetLeadParamsSchema = Schema_exports.Struct({
151061
+ funnel: FunnelReference.annotations({
151062
+ description: "Funnel ID returned by list_funnels, or funnel name for convenience lookup."
151063
+ }),
151064
+ identifier: LeadIdentifier.annotations({
151065
+ description: "Lead identifier (e.g., 'LEAD-1')"
151066
+ })
151067
+ }).annotations({
151068
+ title: "GetLeadParams",
151069
+ description: "Parameters for getting a single lead"
151070
+ });
151071
+ var listFunnelsParamsJsonSchema = JSONSchema_exports.make(ListFunnelsParamsSchema);
151072
+ var listLeadsParamsJsonSchema = JSONSchema_exports.make(ListLeadsParamsSchema);
151073
+ var getLeadParamsJsonSchema = JSONSchema_exports.make(GetLeadParamsSchema);
151074
+ var parseListFunnelsParams = Schema_exports.decodeUnknown(ListFunnelsParamsSchema);
151075
+ var parseListLeadsParams = Schema_exports.decodeUnknown(ListLeadsParamsSchema);
151076
+ var parseGetLeadParams = Schema_exports.decodeUnknown(GetLeadParamsSchema);
151077
+ var parseLeadDetail = Schema_exports.decodeUnknown(LeadDetailSchema);
151078
+ var parseLeadSummary = Schema_exports.decodeUnknown(LeadSummarySchema);
151079
+
151080
+ // src/huly/errors-leads.ts
151081
+ var FunnelNotFoundError = class extends Schema_exports.TaggedError()(
151082
+ "FunnelNotFoundError",
151083
+ {
151084
+ identifier: FunnelReference
151085
+ }
151086
+ ) {
151087
+ get message() {
151088
+ return `Funnel '${this.identifier}' not found`;
151089
+ }
151090
+ };
151091
+ var LeadNotFoundError = class extends Schema_exports.TaggedError()(
151092
+ "LeadNotFoundError",
151093
+ {
151094
+ identifier: LeadIdentifier,
151095
+ funnel: FunnelIdentifier
151096
+ }
151097
+ ) {
151098
+ get message() {
151099
+ return `Lead '${this.identifier}' not found in funnel '${this.funnel}'`;
151100
+ }
151101
+ };
151102
+
150823
151103
  // src/huly/errors-messaging.ts
150824
151104
  var ChannelNotFoundError = class extends Schema_exports.TaggedError()(
150825
151105
  "ChannelNotFoundError",
@@ -151080,6 +151360,9 @@ var HulyDomainError = Schema_exports.Union(
151080
151360
  ProjectNotFoundError,
151081
151361
  InvalidStatusError,
151082
151362
  PersonNotFoundError,
151363
+ OrganizationNotFoundError,
151364
+ OrganizationIdentifierAmbiguousError,
151365
+ InvalidContactProviderError,
151083
151366
  FileUploadError,
151084
151367
  InvalidFileDataError,
151085
151368
  FileNotFoundError,
@@ -151120,6 +151403,8 @@ var HulyDomainError = Schema_exports.Union(
151120
151403
  NotificationNotFoundError,
151121
151404
  NotificationContextNotFoundError,
151122
151405
  InvalidPersonUuidError,
151406
+ FunnelNotFoundError,
151407
+ LeadNotFoundError,
151123
151408
  FileTooLargeError,
151124
151409
  InvalidContentTypeError
151125
151410
  );
@@ -151164,15 +151449,36 @@ var connectWithRetry = (connect, errorPrefix) => withConnectionRetry(
151164
151449
  })
151165
151450
  );
151166
151451
 
151452
+ // src/huly/operations/markup.ts
151453
+ var import_text = __toESM(require_lib9(), 1);
151454
+ var import_text_markdown = __toESM(require_lib17(), 1);
151455
+ var jsonAsMarkup = import_text.jsonToMarkup;
151456
+ var testMarkupUrlConfig = {
151457
+ refUrl: UrlString.make("https://test.invalid/browse?workspace=test"),
151458
+ imageUrl: UrlString.make("https://test.invalid/files?workspace=test&file=")
151459
+ };
151460
+ var markupToMarkdownString = (markup, urls) => {
151461
+ const json3 = (0, import_text.markupToJSON)(markup);
151462
+ return (0, import_text_markdown.markupToMarkdown)(json3, urls);
151463
+ };
151464
+ var markdownToMarkupString = (markdown, urls) => {
151465
+ const json3 = (0, import_text_markdown.markdownToMarkup)(markdown, urls);
151466
+ return jsonAsMarkup(json3);
151467
+ };
151468
+ var optionalMarkdownToMarkup = (md, urls, fallback = "") => md && md.trim() !== "" ? markdownToMarkupString(md, urls) : fallback;
151469
+ function optionalMarkupToMarkdown(markup, urls, fallback = "") {
151470
+ return markup === null || markup === void 0 ? fallback : markupToMarkdownString(markup, urls);
151471
+ }
151472
+
151167
151473
  // src/huly/client.ts
151168
151474
  function toInternalMarkup(value3, format7, opts) {
151169
151475
  switch (format7) {
151170
151476
  case "markup":
151171
151477
  return value3;
151172
151478
  case "html":
151173
- return (0, import_text.jsonToMarkup)((0, import_text.htmlToJSON)(value3));
151479
+ return (0, import_text2.jsonToMarkup)((0, import_text2.htmlToJSON)(value3));
151174
151480
  case "markdown":
151175
- return (0, import_text.jsonToMarkup)((0, import_text_markdown.markdownToMarkup)(value3, opts));
151481
+ return (0, import_text2.jsonToMarkup)((0, import_text_markdown2.markdownToMarkup)(value3, opts));
151176
151482
  default:
151177
151483
  absurd(format7);
151178
151484
  throw new Error(`Invalid format: ${format7}`);
@@ -151183,24 +151489,32 @@ function fromInternalMarkup(markup, format7, opts) {
151183
151489
  case "markup":
151184
151490
  return markup;
151185
151491
  case "html":
151186
- return (0, import_text.jsonToHTML)((0, import_text.markupToJSON)(markup));
151492
+ return (0, import_text2.jsonToHTML)((0, import_text2.markupToJSON)(markup));
151187
151493
  case "markdown":
151188
- return (0, import_text_markdown.markupToMarkdown)((0, import_text.markupToJSON)(markup), opts);
151494
+ return (0, import_text_markdown2.markupToMarkdown)((0, import_text2.markupToJSON)(markup), opts);
151189
151495
  default:
151190
151496
  absurd(format7);
151191
151497
  throw new Error(`Invalid format: ${format7}`);
151192
151498
  }
151193
151499
  }
151194
151500
  var HulyClient = class _HulyClient extends Context_exports.Tag("@hulymcp/HulyClient")() {
151195
- static layer = Layer_exports.scoped(
151501
+ static layer = Layer_exports.effect(
151196
151502
  _HulyClient,
151197
151503
  Effect_exports.gen(function* () {
151198
151504
  const config3 = yield* HulyConfigService;
151199
- const { accountUuid, client, markupOps } = yield* connectRestWithRetry({
151505
+ const { accountUuid, client, imageUrl, markupOps, refUrl, workspaceUrlSlug } = yield* connectRestWithRetry({
151200
151506
  url: config3.url,
151201
151507
  auth: config3.auth,
151202
151508
  workspace: config3.workspace
151203
151509
  });
151510
+ const markupUrlConfig = {
151511
+ refUrl: UrlString.make(refUrl),
151512
+ imageUrl: UrlString.make(imageUrl)
151513
+ };
151514
+ const documentUrlConfig = {
151515
+ baseUrl: UrlString.make(config3.url),
151516
+ workspaceUrlSlug
151517
+ };
151204
151518
  const withClient = (op, errorMsg) => Effect_exports.tryPromise({
151205
151519
  try: () => op(client),
151206
151520
  catch: (e) => new HulyConnectionError({
@@ -151210,6 +151524,8 @@ var HulyClient = class _HulyClient extends Context_exports.Tag("@hulymcp/HulyCli
151210
151524
  });
151211
151525
  const operations = {
151212
151526
  getAccountUuid: () => accountUuid,
151527
+ documentUrlConfig,
151528
+ markupUrlConfig,
151213
151529
  findAll: (_class, query, options) => withClient(
151214
151530
  (client2) => client2.findAll(_class, query, options),
151215
151531
  "findAll failed"
@@ -151242,6 +151558,10 @@ var HulyClient = class _HulyClient extends Context_exports.Tag("@hulymcp/HulyCli
151242
151558
  (client2) => client2.removeDoc(_class, space, objectId),
151243
151559
  "removeDoc failed"
151244
151560
  ),
151561
+ createMixin: (objectId, objectClass, objectSpace, mixin, attributes) => withClient(
151562
+ (client2) => client2.createMixin(objectId, objectClass, objectSpace, mixin, attributes),
151563
+ "createMixin failed"
151564
+ ),
151245
151565
  updateMixin: (objectId, objectClass, objectSpace, mixin, attributes) => withClient(
151246
151566
  (client2) => client2.updateMixin(objectId, objectClass, objectSpace, mixin, attributes),
151247
151567
  "updateMixin failed"
@@ -151284,6 +151604,11 @@ var HulyClient = class _HulyClient extends Context_exports.Tag("@hulymcp/HulyCli
151284
151604
  // AccountUuid is a double-branded string type with no public constructor
151285
151605
  // eslint-disable-next-line no-restricted-syntax -- see above
151286
151606
  getAccountUuid: () => "test-account-uuid",
151607
+ documentUrlConfig: {
151608
+ baseUrl: UrlString.make("https://test.huly.local"),
151609
+ workspaceUrlSlug: WorkspaceUrlSlug.make("test-workspace")
151610
+ },
151611
+ markupUrlConfig: testMarkupUrlConfig,
151287
151612
  findAll: noopFindAll,
151288
151613
  findOne: noopFindOne,
151289
151614
  createDoc: notImplemented("createDoc"),
@@ -151292,6 +151617,7 @@ var HulyClient = class _HulyClient extends Context_exports.Tag("@hulymcp/HulyCli
151292
151617
  removeDoc: notImplemented("removeDoc"),
151293
151618
  uploadMarkup: notImplemented("uploadMarkup"),
151294
151619
  fetchMarkup: noopFetchMarkup,
151620
+ createMixin: notImplemented("createMixin"),
151295
151621
  updateMixin: notImplemented("updateMixin"),
151296
151622
  updateMarkup: notImplemented("updateMarkup"),
151297
151623
  searchFulltext: notImplemented("searchFulltext")
@@ -151304,25 +151630,29 @@ function createMarkupOps(url4, workspace, token, collaboratorUrl) {
151304
151630
  const imageUrl = concatLink(url4, `/files?workspace=${workspace}&file=`);
151305
151631
  const collaborator = (0, import_collaborator_client.getClient)(workspace, token, collaboratorUrl);
151306
151632
  return {
151307
- async fetchMarkup(objectClass, objectId, objectAttr, doc, format7) {
151308
- const collabId = (0, import_core2.makeCollabId)(objectClass, objectId, objectAttr);
151309
- const markup = await collaborator.getMarkup(collabId, doc);
151310
- return fromInternalMarkup(markup, format7, { refUrl, imageUrl });
151311
- },
151312
- async uploadMarkup(objectClass, objectId, objectAttr, value3, format7) {
151313
- const collabId = (0, import_core2.makeCollabId)(objectClass, objectId, objectAttr);
151314
- return await collaborator.createMarkup(collabId, toInternalMarkup(value3, format7, { refUrl, imageUrl }));
151315
- },
151316
- async updateMarkup(objectClass, objectId, objectAttr, value3, format7) {
151317
- const collabId = (0, import_core2.makeCollabId)(objectClass, objectId, objectAttr);
151318
- return await collaborator.updateMarkup(collabId, toInternalMarkup(value3, format7, { refUrl, imageUrl }));
151633
+ refUrl,
151634
+ imageUrl,
151635
+ ops: {
151636
+ async fetchMarkup(objectClass, objectId, objectAttr, doc, format7) {
151637
+ const collabId = (0, import_core2.makeCollabId)(objectClass, objectId, objectAttr);
151638
+ const markup = await collaborator.getMarkup(collabId, doc);
151639
+ return fromInternalMarkup(markup, format7, { refUrl, imageUrl });
151640
+ },
151641
+ async uploadMarkup(objectClass, objectId, objectAttr, value3, format7) {
151642
+ const collabId = (0, import_core2.makeCollabId)(objectClass, objectId, objectAttr);
151643
+ return await collaborator.createMarkup(collabId, toInternalMarkup(value3, format7, { refUrl, imageUrl }));
151644
+ },
151645
+ async updateMarkup(objectClass, objectId, objectAttr, value3, format7) {
151646
+ const collabId = (0, import_core2.makeCollabId)(objectClass, objectId, objectAttr);
151647
+ return await collaborator.updateMarkup(collabId, toInternalMarkup(value3, format7, { refUrl, imageUrl }));
151648
+ }
151319
151649
  }
151320
151650
  };
151321
151651
  }
151322
151652
  var connectRest = async (config3) => {
151323
151653
  const serverConfig = await (0, import_api_client.loadServerConfig)(config3.url);
151324
151654
  const authOptions = authToOptions(config3.auth, config3.workspace);
151325
- const { endpoint, token, workspaceId } = await (0, import_api_client.getWorkspaceToken)(
151655
+ const { endpoint, info, token, workspaceId } = await (0, import_api_client.getWorkspaceToken)(
151326
151656
  config3.url,
151327
151657
  authOptions,
151328
151658
  serverConfig
@@ -151330,13 +151660,20 @@ var connectRest = async (config3) => {
151330
151660
  const restClient = (0, import_api_client.createRestClient)(endpoint, workspaceId, token);
151331
151661
  const account = await restClient.getAccount();
151332
151662
  const client = await (0, import_api_client.createRestTxOperations)(endpoint, workspaceId, token);
151333
- const markupOps = createMarkupOps(
151663
+ const { imageUrl, ops: markupOps, refUrl } = createMarkupOps(
151334
151664
  config3.url,
151335
151665
  workspaceId,
151336
151666
  token,
151337
151667
  serverConfig.COLLABORATOR_URL
151338
151668
  );
151339
- return { client, accountUuid: account.uuid, markupOps };
151669
+ return {
151670
+ client,
151671
+ accountUuid: account.uuid,
151672
+ workspaceUrlSlug: WorkspaceUrlSlug.make(info.workspaceUrl),
151673
+ markupOps,
151674
+ refUrl,
151675
+ imageUrl
151676
+ };
151340
151677
  };
151341
151678
  var connectRestWithRetry = (config3) => connectWithRetry(() => connectRest(config3), "Connection failed");
151342
151679
 
@@ -151349,116 +151686,6 @@ var import_api_client2 = __toESM(require_lib20(), 1);
151349
151686
  var import_core3 = __toESM(require_lib4(), 1);
151350
151687
  var import_tracker = __toESM(require_lib21(), 1);
151351
151688
 
151352
- // src/domain/schemas/shared.ts
151353
- var MAX_LIMIT = 200;
151354
- var NonEmptyString2 = Schema_exports.Trim.pipe(Schema_exports.nonEmptyString());
151355
- var Timestamp = Schema_exports.NonNegativeInt.annotations({
151356
- identifier: "Timestamp",
151357
- title: "Timestamp",
151358
- description: "Unix timestamp in milliseconds (non-negative integer)"
151359
- });
151360
- var LimitParam = Schema_exports.Number.pipe(
151361
- Schema_exports.int(),
151362
- Schema_exports.positive(),
151363
- Schema_exports.lessThanOrEqualTo(MAX_LIMIT)
151364
- );
151365
- var EmptyParamsSchema = Schema_exports.Struct({}).annotations({
151366
- jsonSchema: { type: "object", properties: {}, additionalProperties: false }
151367
- });
151368
- var emptyParamsJsonSchema = JSONSchema_exports.make(EmptyParamsSchema);
151369
- var HulyRef = (tag2) => NonEmptyString2.pipe(Schema_exports.brand(tag2));
151370
- var PersonId = HulyRef("PersonId");
151371
- var OrganizationId = HulyRef("OrganizationId");
151372
- var IssueId = HulyRef("IssueId");
151373
- var ComponentId = HulyRef("ComponentId");
151374
- var MilestoneId = HulyRef("MilestoneId");
151375
- var IssueTemplateId = HulyRef("IssueTemplateId");
151376
- var IssueTemplateChildId = HulyRef("IssueTemplateChildId");
151377
- var ChannelId = HulyRef("ChannelId");
151378
- var MessageId = HulyRef("MessageId");
151379
- var ThreadReplyId = HulyRef("ThreadReplyId");
151380
- var ActivityMessageId = HulyRef("ActivityMessageId");
151381
- var AttachmentId = HulyRef("AttachmentId");
151382
- var BlobId = HulyRef("BlobId");
151383
- var CardId = HulyRef("CardId");
151384
- var CardSpaceId = HulyRef("CardSpaceId");
151385
- var DocumentId = HulyRef("DocumentId");
151386
- var MasterTagId = HulyRef("MasterTagId");
151387
- var TeamspaceId = HulyRef("TeamspaceId");
151388
- var NotificationId = HulyRef("NotificationId");
151389
- var NotificationContextId = HulyRef("NotificationContextId");
151390
- var EventId = HulyRef("EventId");
151391
- var TodoId = HulyRef("TodoId");
151392
- var SpaceId = HulyRef("SpaceId");
151393
- var CommentId = HulyRef("CommentId");
151394
- var TimeSpendReportId = HulyRef("TimeSpendReportId");
151395
- var TagElementId = HulyRef("TagElementId");
151396
- var TagCategoryId = HulyRef("TagCategoryId");
151397
- var WorkSlotId = HulyRef("WorkSlotId");
151398
- var CustomFieldId = HulyRef("CustomFieldId");
151399
- var TestProjectId = HulyRef("TestProjectId");
151400
- var TestSuiteId = HulyRef("TestSuiteId");
151401
- var TestCaseId = HulyRef("TestCaseId");
151402
- var TestPlanId = HulyRef("TestPlanId");
151403
- var TestPlanItemId = HulyRef("TestPlanItemId");
151404
- var TestRunId = HulyRef("TestRunId");
151405
- var TestResultId = HulyRef("TestResultId");
151406
- var ProjectIdentifier = NonEmptyString2.pipe(Schema_exports.brand("ProjectIdentifier"));
151407
- var IssueIdentifier = NonEmptyString2.pipe(Schema_exports.brand("IssueIdentifier"));
151408
- var Email = Schema_exports.NonEmptyString.pipe(
151409
- Schema_exports.pattern(/^[^@]+@[^@]+$/, {
151410
- message: () => "must contain exactly one @"
151411
- }),
151412
- Schema_exports.brand("Email")
151413
- );
151414
- var StatusName = NonEmptyString2.pipe(Schema_exports.brand("StatusName"));
151415
- var PersonName = NonEmptyString2.pipe(Schema_exports.brand("PersonName"));
151416
- var ComponentLabel = NonEmptyString2.pipe(Schema_exports.brand("ComponentLabel"));
151417
- var MilestoneLabel = NonEmptyString2.pipe(Schema_exports.brand("MilestoneLabel"));
151418
- var ChannelName = NonEmptyString2.pipe(Schema_exports.brand("ChannelName"));
151419
- var MimeType = NonEmptyString2.pipe(Schema_exports.brand("MimeType"));
151420
- var ObjectClassName = NonEmptyString2.pipe(Schema_exports.brand("ObjectClassName"));
151421
- var EmojiCode = NonEmptyString2.pipe(Schema_exports.brand("EmojiCode"));
151422
- var ContactProvider = NonEmptyString2.pipe(Schema_exports.brand("ContactProvider"));
151423
- var NotificationProviderId = NonEmptyString2.pipe(Schema_exports.brand("NotificationProviderId"));
151424
- var NotificationTypeId = NonEmptyString2.pipe(Schema_exports.brand("NotificationTypeId"));
151425
- var WorkspaceName = NonEmptyString2.pipe(Schema_exports.brand("WorkspaceName"));
151426
- var UrlString = NonEmptyString2.pipe(Schema_exports.brand("UrlString"));
151427
- var WorkspaceVersion = NonEmptyString2.pipe(Schema_exports.brand("WorkspaceVersion"));
151428
- var WorkspaceMode = NonEmptyString2.pipe(Schema_exports.brand("WorkspaceMode"));
151429
- var WorkspaceUuid = NonEmptyString2.pipe(Schema_exports.brand("WorkspaceUuid"));
151430
- var PersonUuid = NonEmptyString2.pipe(Schema_exports.brand("PersonUuid"));
151431
- var AccountId = NonEmptyString2.pipe(Schema_exports.brand("AccountId"));
151432
- var AccountUuid = Schema_exports.String.pipe(Schema_exports.brand("AccountUuid"));
151433
- var RegionId = Schema_exports.String.pipe(Schema_exports.brand("RegionId"));
151434
- var NonNegativeNumber = Schema_exports.Number.pipe(Schema_exports.nonNegative(), Schema_exports.brand("NonNegativeNumber"));
151435
- var PositiveNumber = NonNegativeNumber.pipe(Schema_exports.positive(), Schema_exports.brand("PositiveNumber"));
151436
- var ColorCode = Schema_exports.Number.pipe(
151437
- Schema_exports.int(),
151438
- Schema_exports.greaterThanOrEqualTo(0),
151439
- Schema_exports.lessThanOrEqualTo(9),
151440
- // eslint-disable-line no-magic-numbers -- Huly color palette has 10 colors (0-9)
151441
- Schema_exports.brand("ColorCode")
151442
- );
151443
- var ComponentIdentifier = NonEmptyString2.pipe(Schema_exports.brand("ComponentIdentifier"));
151444
- var MilestoneIdentifier = NonEmptyString2.pipe(Schema_exports.brand("MilestoneIdentifier"));
151445
- var TemplateIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TemplateIdentifier"));
151446
- var ChannelIdentifier = NonEmptyString2.pipe(Schema_exports.brand("ChannelIdentifier"));
151447
- var TeamspaceIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TeamspaceIdentifier"));
151448
- var CardIdentifier = NonEmptyString2.pipe(Schema_exports.brand("CardIdentifier"));
151449
- var CardSpaceIdentifier = NonEmptyString2.pipe(Schema_exports.brand("CardSpaceIdentifier"));
151450
- var DocumentIdentifier = NonEmptyString2.pipe(Schema_exports.brand("DocumentIdentifier"));
151451
- var MasterTagIdentifier = NonEmptyString2.pipe(Schema_exports.brand("MasterTagIdentifier"));
151452
- var TagIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TagIdentifier"));
151453
- var TagCategoryIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TagCategoryIdentifier"));
151454
- var MemberReference = NonEmptyString2.pipe(Schema_exports.brand("MemberReference"));
151455
- var TestProjectIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TestProjectIdentifier"));
151456
- var TestSuiteIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TestSuiteIdentifier"));
151457
- var TestCaseIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TestCaseIdentifier"));
151458
- var TestPlanIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TestPlanIdentifier"));
151459
- var TestRunIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TestRunIdentifier"));
151460
- var TestResultIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TestResultIdentifier"));
151461
-
151462
151689
  // src/utils/normalize.ts
151463
151690
  var normalizeForComparison = (s) => s.replace(/[-_ ]/g, "").toLowerCase();
151464
151691
 
@@ -161653,7 +161880,7 @@ var createMcpHandlers = (createServer) => {
161653
161880
  const transport = new StreamableHTTPServerTransport({});
161654
161881
  await server.connect(transport);
161655
161882
  await transport.handleRequest(req, res, req.body);
161656
- res.on("close", () => {
161883
+ req.on("close", () => {
161657
161884
  transport.close().catch((err) => {
161658
161885
  process.stderr.write(`Transport cleanup error: ${String(err)}
161659
161886
  `);
@@ -171253,7 +171480,7 @@ var PostHog = class extends PostHogBackendClient {
171253
171480
  };
171254
171481
 
171255
171482
  // src/version.ts
171256
- var VERSION = true ? "0.6.3" : "0.0.0-dev";
171483
+ var VERSION = true ? "0.7.0" : "0.0.0-dev";
171257
171484
 
171258
171485
  // src/telemetry/posthog.ts
171259
171486
  var POSTHOG_API_KEY = "phc_TGfFqCGdnF0p68wuFzd5WSw1IsBvOJW0YgoMJDyZPjm";
@@ -171382,6 +171609,9 @@ var INVALID_PARAMS_TAGS = /* @__PURE__ */ new Set([
171382
171609
  "ProjectNotFoundError",
171383
171610
  "InvalidStatusError",
171384
171611
  "PersonNotFoundError",
171612
+ "OrganizationNotFoundError",
171613
+ "OrganizationIdentifierAmbiguousError",
171614
+ "InvalidContactProviderError",
171385
171615
  "InvalidFileDataError",
171386
171616
  "FileNotFoundError",
171387
171617
  "TeamspaceNotFoundError",
@@ -171415,6 +171645,8 @@ var INVALID_PARAMS_TAGS = /* @__PURE__ */ new Set([
171415
171645
  "NotificationNotFoundError",
171416
171646
  "NotificationContextNotFoundError",
171417
171647
  "InvalidPersonUuidError",
171648
+ "FunnelNotFoundError",
171649
+ "LeadNotFoundError",
171418
171650
  "FileTooLargeError",
171419
171651
  "InvalidContentTypeError"
171420
171652
  ]);
@@ -172114,6 +172346,22 @@ var import_core24 = __toESM(require_lib4(), 1);
172114
172346
  var import_core23 = __toESM(require_lib4(), 1);
172115
172347
  var import_rank = __toESM(require_lib32(), 1);
172116
172348
 
172349
+ // src/huly/url-builders.ts
172350
+ var slugifyTitle = (title) => {
172351
+ const lowered = title.toLowerCase();
172352
+ const stripped = lowered.replace(/[^a-z0-9.\-\s]/g, "");
172353
+ const hyphenated = stripped.replace(/\s+/g, "-");
172354
+ const collapsed = hyphenated.replace(/-+/g, "-");
172355
+ return collapsed.replace(/^-+|-+$/g, "");
172356
+ };
172357
+ var buildDocumentUrl = (baseUrl, workspaceUrlSlug, title, id) => {
172358
+ const trimmedBase = baseUrl.replace(/\/+$/, "");
172359
+ const slug = slugifyTitle(title);
172360
+ const pathSegment = slug === "" ? id : `${slug}-${id}`;
172361
+ return UrlString.make(`${trimmedBase}/workbench/${workspaceUrlSlug}/document/${pathSegment}`);
172362
+ };
172363
+ var buildDocumentUrlFromConfig = (config3, title, id) => buildDocumentUrl(config3.baseUrl, config3.workspaceUrlSlug, title, id);
172364
+
172117
172365
  // src/huly/operations/documents-edit.ts
172118
172366
  var editDocument = (params) => Effect_exports.gen(function* () {
172119
172367
  const { client, doc, teamspace } = yield* findTeamspaceAndDocument(params);
@@ -172177,8 +172425,10 @@ var editDocument = (params) => Effect_exports.gen(function* () {
172177
172425
  );
172178
172426
  contentUpdatedInPlace = true;
172179
172427
  }
172428
+ const finalTitle = updateOps.title ?? doc.title;
172429
+ const url4 = buildDocumentUrlFromConfig(client.documentUrlConfig, finalTitle, DocumentId.make(doc._id));
172180
172430
  if (Object.keys(updateOps).length === 0 && !contentUpdatedInPlace) {
172181
- return { id: DocumentId.make(doc._id), updated: false };
172431
+ return { id: DocumentId.make(doc._id), updated: false, url: url4 };
172182
172432
  }
172183
172433
  if (Object.keys(updateOps).length > 0) {
172184
172434
  yield* client.updateDoc(
@@ -172188,7 +172438,7 @@ var editDocument = (params) => Effect_exports.gen(function* () {
172188
172438
  updateOps
172189
172439
  );
172190
172440
  }
172191
- return { id: DocumentId.make(doc._id), updated: true };
172441
+ return { id: DocumentId.make(doc._id), updated: true, url: url4 };
172192
172442
  });
172193
172443
  var countOccurrences = (text, search) => {
172194
172444
  let count3 = 0;
@@ -172207,22 +172457,52 @@ var import_text3 = __toESM(require_lib9(), 1);
172207
172457
  // src/huly/operations/channels.ts
172208
172458
  var import_core21 = __toESM(require_lib4(), 1);
172209
172459
 
172210
- // src/huly/operations/markup.ts
172211
- var import_text2 = __toESM(require_lib9(), 1);
172212
- var import_text_markdown2 = __toESM(require_lib17(), 1);
172213
- var jsonAsMarkup = import_text2.jsonToMarkup;
172214
- var markupToMarkdownString = (markup) => {
172215
- const json3 = (0, import_text2.markupToJSON)(markup);
172216
- return (0, import_text_markdown2.markupToMarkdown)(json3, { refUrl: "", imageUrl: "" });
172217
- };
172218
- var markdownToMarkupString = (markdown) => {
172219
- const json3 = (0, import_text_markdown2.markdownToMarkup)(markdown, { refUrl: "", imageUrl: "" });
172220
- return jsonAsMarkup(json3);
172221
- };
172222
- var optionalMarkdownToMarkup = (md, fallback = "") => md && md.trim() !== "" ? markdownToMarkupString(md) : fallback;
172223
- function optionalMarkupToMarkdown(markup, fallback = "") {
172224
- return markup ? markupToMarkdownString(markup) : fallback;
172225
- }
172460
+ // src/huly/operations/channel-messages-shared.ts
172461
+ var findChannelMessage = (params) => Effect_exports.gen(function* () {
172462
+ const { channel, client } = yield* findChannel(params.channel);
172463
+ const message = yield* client.findOne(
172464
+ chunter.class.ChatMessage,
172465
+ {
172466
+ _id: toRef(params.messageId),
172467
+ space: channel._id
172468
+ }
172469
+ );
172470
+ if (message === void 0) {
172471
+ return yield* new MessageNotFoundError({
172472
+ messageId: params.messageId,
172473
+ channel: params.channel
172474
+ });
172475
+ }
172476
+ return { client, channel, message };
172477
+ });
172478
+
172479
+ // src/huly/operations/channels-messages.ts
172480
+ var updateChannelMessage = (params) => Effect_exports.gen(function* () {
172481
+ const { channel, client, message } = yield* findChannelMessage(params);
172482
+ const markupUrlConfig = client.markupUrlConfig;
172483
+ const markup = markdownToMarkupString(params.body, markupUrlConfig);
172484
+ const now2 = yield* Clock_exports.currentTimeMillis;
172485
+ const updateOps = {
172486
+ message: markup,
172487
+ editedOn: now2
172488
+ };
172489
+ yield* client.updateDoc(
172490
+ chunter.class.ChatMessage,
172491
+ channel._id,
172492
+ message._id,
172493
+ updateOps
172494
+ );
172495
+ return { id: MessageId.make(message._id), updated: true };
172496
+ });
172497
+ var deleteChannelMessage = (params) => Effect_exports.gen(function* () {
172498
+ const { channel, client, message } = yield* findChannelMessage(params);
172499
+ yield* client.removeDoc(
172500
+ chunter.class.ChatMessage,
172501
+ channel._id,
172502
+ message._id
172503
+ );
172504
+ return { id: MessageId.make(message._id), deleted: true };
172505
+ });
172226
172506
 
172227
172507
  // src/huly/operations/channels.ts
172228
172508
  var personIdsAsSocialIdentityRefs = (ids3) => ids3;
@@ -172390,6 +172670,7 @@ var deleteChannel = (params) => Effect_exports.gen(function* () {
172390
172670
  });
172391
172671
  var listChannelMessages = (params) => Effect_exports.gen(function* () {
172392
172672
  const { channel, client } = yield* findChannel(params.channel);
172673
+ const markupUrlConfig = client.markupUrlConfig;
172393
172674
  const limit = clampLimit(params.limit);
172394
172675
  const messages = yield* client.findAll(
172395
172676
  chunter.class.ChatMessage,
@@ -172414,7 +172695,7 @@ var listChannelMessages = (params) => Effect_exports.gen(function* () {
172414
172695
  const senderName = socialIdToName.get(msg.modifiedBy);
172415
172696
  return {
172416
172697
  id: MessageId.make(msg._id),
172417
- body: markupToMarkdownString(msg.message),
172698
+ body: markupToMarkdownString(msg.message, markupUrlConfig),
172418
172699
  sender: senderName !== void 0 ? PersonName.make(senderName) : void 0,
172419
172700
  senderId: msg.modifiedBy,
172420
172701
  createdOn: msg.createdOn,
@@ -172427,8 +172708,9 @@ var listChannelMessages = (params) => Effect_exports.gen(function* () {
172427
172708
  });
172428
172709
  var sendChannelMessage = (params) => Effect_exports.gen(function* () {
172429
172710
  const { channel, client } = yield* findChannel(params.channel);
172711
+ const markupUrlConfig = client.markupUrlConfig;
172430
172712
  const messageId = (0, import_core21.generateId)();
172431
- const markup = markdownToMarkupString(params.body);
172713
+ const markup = markdownToMarkupString(params.body, markupUrlConfig);
172432
172714
  const messageData = {
172433
172715
  message: markup,
172434
172716
  attachments: 0
@@ -172502,6 +172784,7 @@ var listInlineComments = (params) => Effect_exports.gen(function* () {
172502
172784
  teamspace: params.teamspace,
172503
172785
  document: params.document
172504
172786
  });
172787
+ const markupUrlConfig = client.markupUrlConfig;
172505
172788
  if (!doc.content) {
172506
172789
  return { comments: [], total: 0 };
172507
172790
  }
@@ -172549,7 +172832,7 @@ var listInlineComments = (params) => Effect_exports.gen(function* () {
172549
172832
  const threadReplies = threadRepliesMap.get(comment.threadId) ?? [];
172550
172833
  const replies = threadReplies.map((r) => ({
172551
172834
  id: r._id,
172552
- body: optionalMarkupToMarkdown(r.message),
172835
+ body: optionalMarkupToMarkdown(r.message, markupUrlConfig, ""),
172553
172836
  sender: r.createdBy !== void 0 ? nameMap.get(r.createdBy) : void 0,
172554
172837
  createdOn: r.createdOn
172555
172838
  }));
@@ -172740,6 +173023,7 @@ var listDocuments = (params) => Effect_exports.gen(function* () {
172740
173023
  id: DocumentId.make(doc._id),
172741
173024
  title: doc.title,
172742
173025
  teamspace: teamspace.name,
173026
+ url: buildDocumentUrlFromConfig(client.documentUrlConfig, doc.title, DocumentId.make(doc._id)),
172743
173027
  modifiedOn: doc.modifiedOn
172744
173028
  }));
172745
173029
  return {
@@ -172764,6 +173048,7 @@ var getDocument = (params) => Effect_exports.gen(function* () {
172764
173048
  title: doc.title,
172765
173049
  content,
172766
173050
  teamspace: teamspace.name,
173051
+ url: buildDocumentUrlFromConfig(client.documentUrlConfig, doc.title, DocumentId.make(doc._id)),
172767
173052
  modifiedOn: doc.modifiedOn,
172768
173053
  createdOn: doc.createdOn
172769
173054
  };
@@ -172772,6 +173057,22 @@ var getDocument = (params) => Effect_exports.gen(function* () {
172772
173057
  var createDocument = (params) => Effect_exports.gen(function* () {
172773
173058
  const { client, teamspace } = yield* findTeamspace(params.teamspace);
172774
173059
  const documentId = (0, import_core23.generateId)();
173060
+ const parent = params.parent;
173061
+ const parentRef = parent === void 0 ? documentPlugin.ids.NoParent : yield* Effect_exports.gen(function* () {
173062
+ const parentDoc = yield* findByNameOrId(
173063
+ client,
173064
+ documentPlugin.class.Document,
173065
+ { space: teamspace._id, title: parent },
173066
+ { space: teamspace._id, _id: toRef(parent) }
173067
+ );
173068
+ if (parentDoc === void 0) {
173069
+ return yield* new DocumentNotFoundError({
173070
+ identifier: parent,
173071
+ teamspace: params.teamspace
173072
+ });
173073
+ }
173074
+ return parentDoc._id;
173075
+ });
172775
173076
  const lastDoc = yield* client.findOne(
172776
173077
  documentPlugin.class.Document,
172777
173078
  { space: teamspace._id },
@@ -172788,7 +173089,7 @@ var createDocument = (params) => Effect_exports.gen(function* () {
172788
173089
  const documentData = {
172789
173090
  title: params.title,
172790
173091
  content: contentMarkupRef,
172791
- parent: documentPlugin.ids.NoParent,
173092
+ parent: parentRef,
172792
173093
  rank
172793
173094
  };
172794
173095
  yield* client.createDoc(
@@ -172797,7 +173098,11 @@ var createDocument = (params) => Effect_exports.gen(function* () {
172797
173098
  documentData,
172798
173099
  documentId
172799
173100
  );
172800
- return { id: DocumentId.make(documentId), title: params.title };
173101
+ return {
173102
+ id: DocumentId.make(documentId),
173103
+ title: params.title,
173104
+ url: buildDocumentUrlFromConfig(client.documentUrlConfig, params.title, DocumentId.make(documentId))
173105
+ };
172801
173106
  });
172802
173107
  var deleteDocument = (params) => Effect_exports.gen(function* () {
172803
173108
  const { client, doc, teamspace } = yield* findTeamspaceAndDocument(params);
@@ -175076,6 +175381,9 @@ var CreateDocumentParamsSchema = Schema_exports.Struct({
175076
175381
  }),
175077
175382
  content: Schema_exports.optional(Schema_exports.String.annotations({
175078
175383
  description: "Document content (markdown supported)"
175384
+ })),
175385
+ parent: Schema_exports.optional(DocumentIdentifier.annotations({
175386
+ description: "Parent document title or ID to nest this document under. If omitted, creates a top-level document."
175079
175387
  }))
175080
175388
  }).annotations({
175081
175389
  title: "CreateDocumentParams",
@@ -175594,6 +175902,114 @@ var CreateOrganizationParamsSchema = Schema_exports.Struct({
175594
175902
  title: "CreateOrganizationParams",
175595
175903
  description: "Parameters for creating an organization"
175596
175904
  });
175905
+ var GetOrganizationParamsSchema = Schema_exports.Struct({
175906
+ identifier: NonEmptyString2.annotations({
175907
+ description: "Organization ID or exact name"
175908
+ })
175909
+ }).annotations({
175910
+ title: "GetOrganizationParams",
175911
+ description: "Parameters for getting a single organization"
175912
+ });
175913
+ var UpdateOrganizationParamsSchema = Schema_exports.Struct({
175914
+ identifier: NonEmptyString2.annotations({
175915
+ description: "Organization ID or exact name"
175916
+ }),
175917
+ name: Schema_exports.optional(NonEmptyString2.annotations({
175918
+ description: "New organization name"
175919
+ })),
175920
+ city: Schema_exports.optional(
175921
+ Schema_exports.NullOr(Schema_exports.String).annotations({
175922
+ description: "New city (null to clear)"
175923
+ })
175924
+ ),
175925
+ description: Schema_exports.optional(
175926
+ Schema_exports.NullOr(Schema_exports.String).annotations({
175927
+ description: "New description/notes (null to clear). Supports multi-line plain text."
175928
+ })
175929
+ )
175930
+ }).annotations({
175931
+ title: "UpdateOrganizationParams",
175932
+ description: "Update fields on an existing organization. Only provided fields are modified."
175933
+ });
175934
+ var DeleteOrganizationParamsSchema = Schema_exports.Struct({
175935
+ identifier: NonEmptyString2.annotations({
175936
+ description: "Organization ID or exact name"
175937
+ })
175938
+ }).annotations({
175939
+ title: "DeleteOrganizationParams",
175940
+ description: "Parameters for deleting an organization"
175941
+ });
175942
+ var ListOrganizationMembersParamsSchema = Schema_exports.Struct({
175943
+ organizationId: NonEmptyString2.annotations({
175944
+ description: "Organization ID or exact name"
175945
+ })
175946
+ }).annotations({
175947
+ title: "ListOrganizationMembersParams",
175948
+ description: "List persons who are members of an organization"
175949
+ });
175950
+ var ListPersonOrganizationsByIdSchema = Schema_exports.Struct({
175951
+ personId: PersonId.annotations({
175952
+ description: "Person ID"
175953
+ })
175954
+ });
175955
+ var ListPersonOrganizationsByEmailSchema = Schema_exports.Struct({
175956
+ email: Email.annotations({
175957
+ description: "Person email address"
175958
+ })
175959
+ });
175960
+ var ListPersonOrganizationsParamsSchema = Schema_exports.Union(
175961
+ ListPersonOrganizationsByIdSchema,
175962
+ ListPersonOrganizationsByEmailSchema
175963
+ ).annotations({
175964
+ title: "ListPersonOrganizationsParams",
175965
+ description: "List organizations a person is a member of (provide personId or email)"
175966
+ });
175967
+ var RemoveOrganizationMemberParamsSchema = Schema_exports.Struct({
175968
+ organizationId: NonEmptyString2.annotations({
175969
+ description: "Organization ID or exact name"
175970
+ }),
175971
+ personIdentifier: NonEmptyString2.annotations({
175972
+ description: "Person ID or email address to unlink from the organization"
175973
+ })
175974
+ }).annotations({
175975
+ title: "RemoveOrganizationMemberParams",
175976
+ description: "Parameters for removing a person from an organization"
175977
+ });
175978
+ var AddOrganizationChannelParamsSchema = Schema_exports.Struct({
175979
+ organizationId: NonEmptyString2.annotations({
175980
+ description: "Organization ID or exact name"
175981
+ }),
175982
+ provider: NonEmptyString2.annotations({
175983
+ description: "Channel type: email, phone, linkedin, twitter, github, facebook, telegram, homepage"
175984
+ }),
175985
+ value: NonEmptyString2.annotations({
175986
+ description: "Channel value (email address, phone number, URL, username)"
175987
+ })
175988
+ }).annotations({
175989
+ title: "AddOrganizationChannelParams",
175990
+ description: "Parameters for adding a contact channel to an organization"
175991
+ });
175992
+ var AddOrganizationMemberParamsSchema = Schema_exports.Struct({
175993
+ organizationId: NonEmptyString2.annotations({
175994
+ description: "Organization ID or exact name"
175995
+ }),
175996
+ personIdentifier: NonEmptyString2.annotations({
175997
+ description: "Person ID or email address"
175998
+ })
175999
+ }).annotations({
176000
+ title: "AddOrganizationMemberParams",
176001
+ description: "Parameters for adding a person as an organization member"
176002
+ });
176003
+ var addOrganizationChannelParamsJsonSchema = JSONSchema_exports.make(AddOrganizationChannelParamsSchema);
176004
+ var addOrganizationMemberParamsJsonSchema = JSONSchema_exports.make(AddOrganizationMemberParamsSchema);
176005
+ var parseAddOrganizationChannelParams = Schema_exports.decodeUnknown(AddOrganizationChannelParamsSchema);
176006
+ var parseAddOrganizationMemberParams = Schema_exports.decodeUnknown(AddOrganizationMemberParamsSchema);
176007
+ var listOrganizationMembersParamsJsonSchema = JSONSchema_exports.make(ListOrganizationMembersParamsSchema);
176008
+ var listPersonOrganizationsParamsJsonSchema = JSONSchema_exports.make(ListPersonOrganizationsParamsSchema);
176009
+ var removeOrganizationMemberParamsJsonSchema = JSONSchema_exports.make(RemoveOrganizationMemberParamsSchema);
176010
+ var parseListOrganizationMembersParams = Schema_exports.decodeUnknown(ListOrganizationMembersParamsSchema);
176011
+ var parseListPersonOrganizationsParams = Schema_exports.decodeUnknown(ListPersonOrganizationsParamsSchema);
176012
+ var parseRemoveOrganizationMemberParams = Schema_exports.decodeUnknown(RemoveOrganizationMemberParamsSchema);
175597
176013
  var listPersonsParamsJsonSchema = JSONSchema_exports.make(ListPersonsParamsSchema);
175598
176014
  var getPersonParamsJsonSchema = JSONSchema_exports.make(GetPersonParamsSchema);
175599
176015
  var createPersonParamsJsonSchema = JSONSchema_exports.make(CreatePersonParamsSchema);
@@ -175602,6 +176018,9 @@ var deletePersonParamsJsonSchema = JSONSchema_exports.make(DeletePersonParamsSch
175602
176018
  var listEmployeesParamsJsonSchema = JSONSchema_exports.make(ListEmployeesParamsSchema);
175603
176019
  var listOrganizationsParamsJsonSchema = JSONSchema_exports.make(ListOrganizationsParamsSchema);
175604
176020
  var createOrganizationParamsJsonSchema = JSONSchema_exports.make(CreateOrganizationParamsSchema);
176021
+ var getOrganizationParamsJsonSchema = JSONSchema_exports.make(GetOrganizationParamsSchema);
176022
+ var updateOrganizationParamsJsonSchema = JSONSchema_exports.make(UpdateOrganizationParamsSchema);
176023
+ var deleteOrganizationParamsJsonSchema = JSONSchema_exports.make(DeleteOrganizationParamsSchema);
175605
176024
  var parseListPersonsParams = Schema_exports.decodeUnknown(ListPersonsParamsSchema);
175606
176025
  var parseGetPersonParams = Schema_exports.decodeUnknown(GetPersonParamsSchema);
175607
176026
  var parseCreatePersonParams = Schema_exports.decodeUnknown(CreatePersonParamsSchema);
@@ -175610,6 +176029,9 @@ var parseDeletePersonParams = Schema_exports.decodeUnknown(DeletePersonParamsSch
175610
176029
  var parseListEmployeesParams = Schema_exports.decodeUnknown(ListEmployeesParamsSchema);
175611
176030
  var parseListOrganizationsParams = Schema_exports.decodeUnknown(ListOrganizationsParamsSchema);
175612
176031
  var parseCreateOrganizationParams = Schema_exports.decodeUnknown(CreateOrganizationParamsSchema);
176032
+ var parseGetOrganizationParams = Schema_exports.decodeUnknown(GetOrganizationParamsSchema);
176033
+ var parseUpdateOrganizationParams = Schema_exports.decodeUnknown(UpdateOrganizationParamsSchema);
176034
+ var parseDeleteOrganizationParams = Schema_exports.decodeUnknown(DeleteOrganizationParamsSchema);
175613
176035
 
175614
176036
  // src/domain/schemas/channels.ts
175615
176037
  var ListChannelsParamsBase = Schema_exports.Struct({
@@ -175712,6 +176134,31 @@ var SendChannelMessageParamsSchema = Schema_exports.Struct({
175712
176134
  title: "SendChannelMessageParams",
175713
176135
  description: "Parameters for sending a message to a channel"
175714
176136
  });
176137
+ var UpdateChannelMessageParamsSchema = Schema_exports.Struct({
176138
+ channel: ChannelIdentifier.annotations({
176139
+ description: "Channel name or ID"
176140
+ }),
176141
+ messageId: MessageId.annotations({
176142
+ description: "Message ID to update"
176143
+ }),
176144
+ body: NonEmptyString2.annotations({
176145
+ description: "New message body (markdown supported)"
176146
+ })
176147
+ }).annotations({
176148
+ title: "UpdateChannelMessageParams",
176149
+ description: "Parameters for updating a channel message"
176150
+ });
176151
+ var DeleteChannelMessageParamsSchema = Schema_exports.Struct({
176152
+ channel: ChannelIdentifier.annotations({
176153
+ description: "Channel name or ID"
176154
+ }),
176155
+ messageId: MessageId.annotations({
176156
+ description: "Message ID to delete"
176157
+ })
176158
+ }).annotations({
176159
+ title: "DeleteChannelMessageParams",
176160
+ description: "Parameters for deleting a channel message"
176161
+ });
175715
176162
  var ListDirectMessagesParamsSchema = Schema_exports.Struct({
175716
176163
  limit: Schema_exports.optional(
175717
176164
  LimitParam.annotations({
@@ -175790,6 +176237,8 @@ var updateChannelParamsJsonSchema = JSONSchema_exports.make(UpdateChannelParamsS
175790
176237
  var deleteChannelParamsJsonSchema = JSONSchema_exports.make(DeleteChannelParamsSchema);
175791
176238
  var listChannelMessagesParamsJsonSchema = JSONSchema_exports.make(ListChannelMessagesParamsSchema);
175792
176239
  var sendChannelMessageParamsJsonSchema = JSONSchema_exports.make(SendChannelMessageParamsSchema);
176240
+ var updateChannelMessageParamsJsonSchema = JSONSchema_exports.make(UpdateChannelMessageParamsSchema);
176241
+ var deleteChannelMessageParamsJsonSchema = JSONSchema_exports.make(DeleteChannelMessageParamsSchema);
175793
176242
  var listDirectMessagesParamsJsonSchema = JSONSchema_exports.make(ListDirectMessagesParamsSchema);
175794
176243
  var listThreadRepliesParamsJsonSchema = JSONSchema_exports.make(ListThreadRepliesParamsSchema);
175795
176244
  var addThreadReplyParamsJsonSchema = JSONSchema_exports.make(AddThreadReplyParamsSchema);
@@ -175802,6 +176251,8 @@ var parseUpdateChannelParams = Schema_exports.decodeUnknown(UpdateChannelParamsS
175802
176251
  var parseDeleteChannelParams = Schema_exports.decodeUnknown(DeleteChannelParamsSchema);
175803
176252
  var parseListChannelMessagesParams = Schema_exports.decodeUnknown(ListChannelMessagesParamsSchema);
175804
176253
  var parseSendChannelMessageParams = Schema_exports.decodeUnknown(SendChannelMessageParamsSchema);
176254
+ var parseUpdateChannelMessageParams = Schema_exports.decodeUnknown(UpdateChannelMessageParamsSchema);
176255
+ var parseDeleteChannelMessageParams = Schema_exports.decodeUnknown(DeleteChannelMessageParamsSchema);
175805
176256
  var parseListDirectMessagesParams = Schema_exports.decodeUnknown(ListDirectMessagesParamsSchema);
175806
176257
  var parseListThreadRepliesParams = Schema_exports.decodeUnknown(ListThreadRepliesParamsSchema);
175807
176258
  var parseAddThreadReplyParams = Schema_exports.decodeUnknown(AddThreadReplyParamsSchema);
@@ -177232,20 +177683,6 @@ var cardTools = [
177232
177683
 
177233
177684
  // src/huly/operations/threads.ts
177234
177685
  var import_core28 = __toESM(require_lib4(), 1);
177235
- var findMessage = (channelIdentifier, messageId) => Effect_exports.gen(function* () {
177236
- const { channel, client } = yield* findChannel(channelIdentifier);
177237
- const message = yield* client.findOne(
177238
- chunter.class.ChatMessage,
177239
- {
177240
- _id: toRef(messageId),
177241
- space: channel._id
177242
- }
177243
- );
177244
- if (message === void 0) {
177245
- return yield* new MessageNotFoundError({ messageId, channel: channelIdentifier });
177246
- }
177247
- return { client, channel, message };
177248
- });
177249
177686
  var findReply = (client, channel, message, replyId) => Effect_exports.gen(function* () {
177250
177687
  const reply = yield* client.findOne(
177251
177688
  chunter.class.ThreadMessage,
@@ -177264,7 +177701,8 @@ var findReply = (client, channel, message, replyId) => Effect_exports.gen(functi
177264
177701
  return reply;
177265
177702
  });
177266
177703
  var listThreadReplies = (params) => Effect_exports.gen(function* () {
177267
- const { channel, client, message } = yield* findMessage(params.channel, params.messageId);
177704
+ const { channel, client, message } = yield* findChannelMessage(params);
177705
+ const markupUrlConfig = client.markupUrlConfig;
177268
177706
  const limit = Math.min(params.limit ?? 50, 200);
177269
177707
  const replies = yield* client.findAll(
177270
177708
  chunter.class.ThreadMessage,
@@ -177290,7 +177728,7 @@ var listThreadReplies = (params) => Effect_exports.gen(function* () {
177290
177728
  const senderName = socialIdToName.get(msg.modifiedBy);
177291
177729
  return {
177292
177730
  id: ThreadReplyId.make(msg._id),
177293
- body: markupToMarkdownString(msg.message),
177731
+ body: markupToMarkdownString(msg.message, markupUrlConfig),
177294
177732
  sender: senderName !== void 0 ? PersonName.make(senderName) : void 0,
177295
177733
  senderId: msg.modifiedBy,
177296
177734
  createdOn: msg.createdOn,
@@ -177301,9 +177739,10 @@ var listThreadReplies = (params) => Effect_exports.gen(function* () {
177301
177739
  return { replies: threadMessages, total };
177302
177740
  });
177303
177741
  var addThreadReply = (params) => Effect_exports.gen(function* () {
177304
- const { channel, client, message } = yield* findMessage(params.channel, params.messageId);
177742
+ const { channel, client, message } = yield* findChannelMessage(params);
177743
+ const markupUrlConfig = client.markupUrlConfig;
177305
177744
  const replyId = (0, import_core28.generateId)();
177306
- const markup = markdownToMarkupString(params.body);
177745
+ const markup = markdownToMarkupString(params.body, markupUrlConfig);
177307
177746
  const replyData = {
177308
177747
  message: markup,
177309
177748
  attachments: 0,
@@ -177326,9 +177765,10 @@ var addThreadReply = (params) => Effect_exports.gen(function* () {
177326
177765
  };
177327
177766
  });
177328
177767
  var updateThreadReply = (params) => Effect_exports.gen(function* () {
177329
- const { channel, client, message } = yield* findMessage(params.channel, params.messageId);
177768
+ const { channel, client, message } = yield* findChannelMessage(params);
177330
177769
  const reply = yield* findReply(client, channel, message, params.replyId);
177331
- const markup = markdownToMarkupString(params.body);
177770
+ const markupUrlConfig = client.markupUrlConfig;
177771
+ const markup = markdownToMarkupString(params.body, markupUrlConfig);
177332
177772
  const now2 = yield* Clock_exports.currentTimeMillis;
177333
177773
  const updateOps = {
177334
177774
  message: markup,
@@ -177343,7 +177783,7 @@ var updateThreadReply = (params) => Effect_exports.gen(function* () {
177343
177783
  return { id: ThreadReplyId.make(reply._id), updated: true };
177344
177784
  });
177345
177785
  var deleteThreadReply = (params) => Effect_exports.gen(function* () {
177346
- const { channel, client, message } = yield* findMessage(params.channel, params.messageId);
177786
+ const { channel, client, message } = yield* findChannelMessage(params);
177347
177787
  const reply = yield* findReply(client, channel, message, params.replyId);
177348
177788
  yield* client.removeDoc(
177349
177789
  chunter.class.ThreadMessage,
@@ -177433,6 +177873,28 @@ var channelTools = [
177433
177873
  sendChannelMessage
177434
177874
  )
177435
177875
  },
177876
+ {
177877
+ name: "update_channel_message",
177878
+ description: "Update a channel message. Only the body can be modified.",
177879
+ category: CATEGORY5,
177880
+ inputSchema: updateChannelMessageParamsJsonSchema,
177881
+ handler: createToolHandler(
177882
+ "update_channel_message",
177883
+ parseUpdateChannelMessageParams,
177884
+ updateChannelMessage
177885
+ )
177886
+ },
177887
+ {
177888
+ name: "delete_channel_message",
177889
+ description: "Permanently delete a channel message. This action cannot be undone.",
177890
+ category: CATEGORY5,
177891
+ inputSchema: deleteChannelMessageParamsJsonSchema,
177892
+ handler: createToolHandler(
177893
+ "delete_channel_message",
177894
+ parseDeleteChannelMessageParams,
177895
+ deleteChannelMessage
177896
+ )
177897
+ },
177436
177898
  {
177437
177899
  name: "list_direct_messages",
177438
177900
  description: "List direct message conversations in Huly. Returns conversations sorted by date (newest first).",
@@ -177519,6 +177981,7 @@ var listComments = (params) => Effect_exports.gen(function* () {
177519
177981
  project: params.project,
177520
177982
  issueIdentifier: params.issueIdentifier
177521
177983
  });
177984
+ const markupUrlConfig = client.markupUrlConfig;
177522
177985
  const limit = clampLimit(params.limit);
177523
177986
  const messages = yield* client.findAll(
177524
177987
  chunter.class.ChatMessage,
@@ -177536,7 +177999,7 @@ var listComments = (params) => Effect_exports.gen(function* () {
177536
177999
  const validated = yield* Schema_exports.decodeUnknown(Schema_exports.Array(CommentSchema))(
177537
178000
  messages.map((msg) => ({
177538
178001
  id: msg._id,
177539
- body: optionalMarkupToMarkdown(msg.message),
178002
+ body: optionalMarkupToMarkdown(msg.message, markupUrlConfig, ""),
177540
178003
  authorId: msg.modifiedBy,
177541
178004
  createdOn: msg.createdOn,
177542
178005
  modifiedOn: msg.modifiedOn,
@@ -177557,9 +178020,10 @@ var addComment = (params) => Effect_exports.gen(function* () {
177557
178020
  project: params.project,
177558
178021
  issueIdentifier: params.issueIdentifier
177559
178022
  });
178023
+ const markupUrlConfig = client.markupUrlConfig;
177560
178024
  const commentId = (0, import_core29.generateId)();
177561
178025
  const commentData = {
177562
- message: markdownToMarkupString(params.body)
178026
+ message: markdownToMarkupString(params.body, markupUrlConfig)
177563
178027
  };
177564
178028
  yield* client.addCollection(
177565
178029
  chunter.class.ChatMessage,
@@ -177577,7 +178041,8 @@ var addComment = (params) => Effect_exports.gen(function* () {
177577
178041
  });
177578
178042
  var updateComment = (params) => Effect_exports.gen(function* () {
177579
178043
  const { client, comment, issue: issue2, project: project3 } = yield* findComment(params);
177580
- const newMarkup = markdownToMarkupString(params.body);
178044
+ const markupUrlConfig = client.markupUrlConfig;
178045
+ const newMarkup = markdownToMarkupString(params.body, markupUrlConfig);
177581
178046
  if (newMarkup === comment.message) {
177582
178047
  return {
177583
178048
  commentId: CommentId.make(params.commentId),
@@ -177668,6 +178133,21 @@ var commentTools = [
177668
178133
  // src/huly/operations/contacts.ts
177669
178134
  var import_contact = __toESM(require_lib27(), 1);
177670
178135
  var import_core30 = __toESM(require_lib4(), 1);
178136
+
178137
+ // src/huly/lead-plugin.ts
178138
+ var leadRef = (identifier2) => identifier2;
178139
+ var leadMixinRef = (identifier2) => identifier2;
178140
+ var leadClassIds = {
178141
+ class: {
178142
+ Lead: leadRef("lead:class:Lead"),
178143
+ Funnel: leadRef("lead:class:Funnel")
178144
+ },
178145
+ mixin: {
178146
+ Customer: leadMixinRef("lead:mixin:Customer")
178147
+ }
178148
+ };
178149
+
178150
+ // src/huly/operations/contacts.ts
177671
178151
  var formatName = (firstName, lastName) => `${lastName},${firstName}`;
177672
178152
  var parseName = (name) => {
177673
178153
  const parts2 = name.split(",");
@@ -177780,6 +178260,7 @@ var getPerson = (params) => Effect_exports.gen(function* () {
177780
178260
  attachedToClass: contact.class.Person
177781
178261
  }
177782
178262
  );
178263
+ const organizations = yield* findOrganizationsForPerson(client, person._id);
177783
178264
  const { firstName, lastName } = parseName(person.name);
177784
178265
  const emailChannel = channels.find((c) => c.provider === contact.channelProvider.Email);
177785
178266
  return {
@@ -177793,10 +178274,29 @@ var getPerson = (params) => Effect_exports.gen(function* () {
177793
178274
  provider: ContactProvider.make(c.provider),
177794
178275
  value: c.value
177795
178276
  })),
178277
+ organizations: organizations.length > 0 ? organizations : void 0,
177796
178278
  modifiedOn: person.modifiedOn,
177797
178279
  createdOn: person.createdOn
177798
178280
  };
177799
178281
  });
178282
+ var findOrganizationsForPerson = (client, personId) => Effect_exports.gen(function* () {
178283
+ const members = yield* client.findAll(
178284
+ contact.class.Member,
178285
+ { contact: personId }
178286
+ );
178287
+ if (members.length === 0) {
178288
+ return [];
178289
+ }
178290
+ const orgIds = [...new Set(members.map((m) => toRef(m.attachedTo)))];
178291
+ const orgs = yield* client.findAll(
178292
+ contact.class.Organization,
178293
+ { _id: { $in: orgIds } }
178294
+ );
178295
+ return orgs.map((org) => ({
178296
+ id: OrganizationId.make(org._id),
178297
+ name: org.name
178298
+ }));
178299
+ });
177800
178300
  var createPerson = (params) => Effect_exports.gen(function* () {
177801
178301
  const client = yield* HulyClient;
177802
178302
  const personId = (0, import_core30.generateId)();
@@ -177914,6 +178414,7 @@ var listOrganizations = (params) => Effect_exports.gen(function* () {
177914
178414
  var createOrganization = (params) => Effect_exports.gen(function* () {
177915
178415
  const client = yield* HulyClient;
177916
178416
  const orgId = (0, import_core30.generateId)();
178417
+ const memberPersonIds = params.members !== void 0 && params.members.length > 0 ? yield* resolvePersonIdentifiers(client, params.members) : [];
177917
178418
  const orgData = {
177918
178419
  name: params.name,
177919
178420
  city: "",
@@ -177927,23 +178428,279 @@ var createOrganization = (params) => Effect_exports.gen(function* () {
177927
178428
  orgData,
177928
178429
  orgId
177929
178430
  );
177930
- if (params.members !== void 0 && params.members.length > 0) {
177931
- for (const memberRef of params.members) {
177932
- const personId = (yield* findPersonById(client, memberRef))?._id ?? (yield* findPersonByEmail(client, memberRef))?._id;
177933
- if (personId !== void 0) {
177934
- yield* client.addCollection(
177935
- contact.class.Member,
177936
- contact.space.Contacts,
177937
- orgId,
177938
- contact.class.Organization,
177939
- "members",
177940
- { contact: personId }
177941
- );
177942
- }
178431
+ if (memberPersonIds.length > 0) {
178432
+ for (const personId of memberPersonIds) {
178433
+ yield* client.addCollection(
178434
+ contact.class.Member,
178435
+ contact.space.Contacts,
178436
+ orgId,
178437
+ contact.class.Organization,
178438
+ "members",
178439
+ { contact: personId }
178440
+ );
177943
178441
  }
177944
178442
  }
177945
178443
  return { id: OrganizationId.make(orgId) };
177946
178444
  });
178445
+ var findOrganizationByIdentifier = (client, identifier2) => Effect_exports.gen(function* () {
178446
+ const byId = yield* client.findOne(
178447
+ contact.class.Organization,
178448
+ { _id: toRef(identifier2) }
178449
+ );
178450
+ if (byId !== void 0) return byId;
178451
+ const byName = yield* client.findAll(
178452
+ contact.class.Organization,
178453
+ { name: identifier2 }
178454
+ );
178455
+ if (byName.length === 0) {
178456
+ return void 0;
178457
+ }
178458
+ if (byName.length > 1) {
178459
+ return yield* new OrganizationIdentifierAmbiguousError({
178460
+ identifier: identifier2,
178461
+ matches: byName.length
178462
+ });
178463
+ }
178464
+ return byName[0];
178465
+ });
178466
+ var resolvePersonIdentifier = (client, identifier2) => Effect_exports.gen(function* () {
178467
+ const person = (yield* findPersonById(client, identifier2)) ?? (yield* findPersonByEmail(client, identifier2));
178468
+ if (person === void 0) {
178469
+ return yield* new PersonNotFoundError({ identifier: identifier2 });
178470
+ }
178471
+ return person;
178472
+ });
178473
+ var uniqueValues = (values4) => Array.from(new Set(values4));
178474
+ var resolvePersonIdentifiers = (client, identifiers) => Effect_exports.gen(function* () {
178475
+ const resolvedPeople = [];
178476
+ for (const identifier2 of identifiers) {
178477
+ resolvedPeople.push(yield* resolvePersonIdentifier(client, identifier2));
178478
+ }
178479
+ return uniqueValues(resolvedPeople.map((person) => person._id));
178480
+ });
178481
+ var findOrganizationMemberships = (client, organizationId, personId) => client.findAll(
178482
+ contact.class.Member,
178483
+ { attachedTo: organizationId, contact: personId }
178484
+ );
178485
+ var getOrganization = (params) => Effect_exports.gen(function* () {
178486
+ const client = yield* HulyClient;
178487
+ const org = yield* findOrganizationByIdentifier(client, params.identifier);
178488
+ if (org === void 0) {
178489
+ return yield* new OrganizationNotFoundError({ identifier: params.identifier });
178490
+ }
178491
+ const descriptionText = org.description !== null ? yield* client.fetchMarkup(
178492
+ contact.class.Organization,
178493
+ org._id,
178494
+ "description",
178495
+ org.description,
178496
+ "markdown"
178497
+ ) : void 0;
178498
+ return {
178499
+ id: OrganizationId.make(org._id),
178500
+ name: org.name,
178501
+ city: org.city || void 0,
178502
+ description: descriptionText,
178503
+ members: org.members,
178504
+ modifiedOn: org.modifiedOn
178505
+ };
178506
+ });
178507
+ var updateOrganization = (params) => Effect_exports.gen(function* () {
178508
+ const client = yield* HulyClient;
178509
+ const org = yield* findOrganizationByIdentifier(client, params.identifier);
178510
+ if (org === void 0) {
178511
+ return yield* new OrganizationNotFoundError({ identifier: params.identifier });
178512
+ }
178513
+ const updateOps = {};
178514
+ let descriptionUpdatedInPlace = false;
178515
+ if (params.name !== void 0) {
178516
+ updateOps.name = params.name;
178517
+ }
178518
+ if (params.city !== void 0) {
178519
+ updateOps.city = params.city === null ? "" : params.city;
178520
+ }
178521
+ if (params.description !== void 0) {
178522
+ if (params.description === null || params.description === "") {
178523
+ updateOps.description = null;
178524
+ } else if (org.description !== null) {
178525
+ yield* client.updateMarkup(
178526
+ contact.class.Organization,
178527
+ org._id,
178528
+ "description",
178529
+ params.description,
178530
+ "markdown"
178531
+ );
178532
+ descriptionUpdatedInPlace = true;
178533
+ } else {
178534
+ const markupRef = yield* client.uploadMarkup(
178535
+ contact.class.Organization,
178536
+ org._id,
178537
+ "description",
178538
+ params.description,
178539
+ "markdown"
178540
+ );
178541
+ updateOps.description = markupRef;
178542
+ }
178543
+ }
178544
+ if (Object.keys(updateOps).length === 0 && !descriptionUpdatedInPlace) {
178545
+ return { id: OrganizationId.make(org._id), updated: false };
178546
+ }
178547
+ yield* client.updateDoc(
178548
+ contact.class.Organization,
178549
+ contact.space.Contacts,
178550
+ org._id,
178551
+ updateOps
178552
+ );
178553
+ return { id: OrganizationId.make(org._id), updated: true };
178554
+ });
178555
+ var deleteOrganization = (params) => Effect_exports.gen(function* () {
178556
+ const client = yield* HulyClient;
178557
+ const org = yield* findOrganizationByIdentifier(client, params.identifier);
178558
+ if (org === void 0) {
178559
+ return yield* new OrganizationNotFoundError({ identifier: params.identifier });
178560
+ }
178561
+ yield* client.removeDoc(
178562
+ contact.class.Organization,
178563
+ contact.space.Contacts,
178564
+ org._id
178565
+ );
178566
+ return { id: OrganizationId.make(org._id), deleted: true };
178567
+ });
178568
+ var makeOrganizationCustomer = (params) => Effect_exports.gen(function* () {
178569
+ const client = yield* HulyClient;
178570
+ const org = yield* findOrganizationByIdentifier(client, params.identifier);
178571
+ if (org === void 0) {
178572
+ return yield* new OrganizationNotFoundError({ identifier: params.identifier });
178573
+ }
178574
+ const alreadyCustomer = org[leadClassIds.mixin.Customer] !== void 0;
178575
+ if (alreadyCustomer) {
178576
+ return { id: OrganizationId.make(org._id), applied: false };
178577
+ }
178578
+ yield* client.createMixin(
178579
+ org._id,
178580
+ contact.class.Organization,
178581
+ contact.space.Contacts,
178582
+ leadClassIds.mixin.Customer,
178583
+ {}
178584
+ );
178585
+ return { id: OrganizationId.make(org._id), applied: true };
178586
+ });
178587
+ var CHANNEL_PROVIDERS = {
178588
+ email: contact.channelProvider.Email,
178589
+ phone: contact.channelProvider.Phone,
178590
+ linkedin: contact.channelProvider.LinkedIn,
178591
+ twitter: contact.channelProvider.Twitter,
178592
+ github: contact.channelProvider.GitHub,
178593
+ facebook: contact.channelProvider.Facebook,
178594
+ telegram: contact.channelProvider.Telegram,
178595
+ homepage: contact.channelProvider.Homepage
178596
+ };
178597
+ var addOrganizationChannel = (params) => Effect_exports.gen(function* () {
178598
+ const client = yield* HulyClient;
178599
+ const org = yield* findOrganizationByIdentifier(client, params.organizationId);
178600
+ if (org === void 0) {
178601
+ return yield* new OrganizationNotFoundError({ identifier: params.organizationId });
178602
+ }
178603
+ const providerKey = params.provider.toLowerCase();
178604
+ const providerRef = CHANNEL_PROVIDERS[providerKey] ?? void 0;
178605
+ if (providerRef === void 0) {
178606
+ return yield* new InvalidContactProviderError({ provider: params.provider });
178607
+ }
178608
+ yield* client.addCollection(
178609
+ contact.class.Channel,
178610
+ contact.space.Contacts,
178611
+ org._id,
178612
+ contact.class.Organization,
178613
+ "channels",
178614
+ { provider: providerRef, value: params.value }
178615
+ );
178616
+ return { id: OrganizationId.make(org._id), added: true };
178617
+ });
178618
+ var addOrganizationMember = (params) => Effect_exports.gen(function* () {
178619
+ const client = yield* HulyClient;
178620
+ const org = yield* findOrganizationByIdentifier(client, params.organizationId);
178621
+ if (org === void 0) {
178622
+ return yield* new OrganizationNotFoundError({ identifier: params.organizationId });
178623
+ }
178624
+ const person = yield* resolvePersonIdentifier(client, params.personIdentifier);
178625
+ const existingMemberships = yield* findOrganizationMemberships(client, org._id, person._id);
178626
+ if (existingMemberships.length > 0) {
178627
+ return { id: OrganizationId.make(org._id), added: false };
178628
+ }
178629
+ yield* client.addCollection(
178630
+ contact.class.Member,
178631
+ contact.space.Contacts,
178632
+ org._id,
178633
+ contact.class.Organization,
178634
+ "members",
178635
+ { contact: person._id }
178636
+ );
178637
+ return { id: OrganizationId.make(org._id), added: true };
178638
+ });
178639
+ var listOrganizationMembers = (params) => Effect_exports.gen(function* () {
178640
+ const client = yield* HulyClient;
178641
+ const org = yield* findOrganizationByIdentifier(client, params.organizationId);
178642
+ if (org === void 0) {
178643
+ return yield* new OrganizationNotFoundError({ identifier: params.organizationId });
178644
+ }
178645
+ const members = yield* client.findAll(
178646
+ contact.class.Member,
178647
+ { attachedTo: org._id }
178648
+ );
178649
+ if (members.length === 0) {
178650
+ return { organizationId: OrganizationId.make(org._id), members: [] };
178651
+ }
178652
+ const personIds = [...new Set(members.map((m) => toRef(m.contact)))];
178653
+ const persons = yield* client.findAll(
178654
+ contact.class.Person,
178655
+ { _id: { $in: personIds } }
178656
+ );
178657
+ const emails = yield* batchGetEmailsForPersons(client, personIds);
178658
+ const entries2 = persons.map((p) => {
178659
+ const email3 = emails.get(p._id);
178660
+ return {
178661
+ personId: PersonId.make(p._id),
178662
+ name: PersonName.make(p.name),
178663
+ email: email3 !== void 0 ? Email.make(email3) : void 0
178664
+ };
178665
+ });
178666
+ return {
178667
+ organizationId: OrganizationId.make(org._id),
178668
+ members: entries2
178669
+ };
178670
+ });
178671
+ var listPersonOrganizations = (params) => Effect_exports.gen(function* () {
178672
+ const client = yield* HulyClient;
178673
+ const person = "personId" in params ? yield* findPersonById(client, params.personId) : yield* findPersonByEmail(client, params.email);
178674
+ if (person === void 0) {
178675
+ const identifier2 = "personId" in params ? params.personId : params.email;
178676
+ return yield* new PersonNotFoundError({ identifier: identifier2 });
178677
+ }
178678
+ const organizations = yield* findOrganizationsForPerson(client, person._id);
178679
+ return {
178680
+ personId: PersonId.make(person._id),
178681
+ organizations
178682
+ };
178683
+ });
178684
+ var removeOrganizationMember = (params) => Effect_exports.gen(function* () {
178685
+ const client = yield* HulyClient;
178686
+ const org = yield* findOrganizationByIdentifier(client, params.organizationId);
178687
+ if (org === void 0) {
178688
+ return yield* new OrganizationNotFoundError({ identifier: params.organizationId });
178689
+ }
178690
+ const person = yield* resolvePersonIdentifier(client, params.personIdentifier);
178691
+ const memberDocs = yield* findOrganizationMemberships(client, org._id, person._id);
178692
+ if (memberDocs.length === 0) {
178693
+ return { id: OrganizationId.make(org._id), removed: false };
178694
+ }
178695
+ for (const memberDoc of memberDocs) {
178696
+ yield* client.removeDoc(
178697
+ contact.class.Member,
178698
+ contact.space.Contacts,
178699
+ memberDoc._id
178700
+ );
178701
+ }
178702
+ return { id: OrganizationId.make(org._id), removed: true };
178703
+ });
177947
178704
 
177948
178705
  // src/mcp/tools/contacts.ts
177949
178706
  var CATEGORY7 = "contacts";
@@ -178027,7 +178784,7 @@ var contactTools = [
178027
178784
  },
178028
178785
  {
178029
178786
  name: "create_organization",
178030
- description: "Create a new organization in Huly. Optionally add members by person ID or email. Returns the created organization ID.",
178787
+ description: "Create a new organization in Huly. Optionally add members by person ID or email. Fails if any requested member cannot be resolved. Returns the created organization ID.",
178031
178788
  category: CATEGORY7,
178032
178789
  inputSchema: createOrganizationParamsJsonSchema,
178033
178790
  handler: createToolHandler(
@@ -178035,6 +178792,105 @@ var contactTools = [
178035
178792
  parseCreateOrganizationParams,
178036
178793
  createOrganization
178037
178794
  )
178795
+ },
178796
+ {
178797
+ name: "get_organization",
178798
+ description: "Retrieve full details for an organization by ID or exact name when that name is unique - including city, description, member count, and modification timestamp. If multiple organizations share the same name, use the organization ID.",
178799
+ category: CATEGORY7,
178800
+ inputSchema: getOrganizationParamsJsonSchema,
178801
+ handler: createToolHandler(
178802
+ "get_organization",
178803
+ parseGetOrganizationParams,
178804
+ getOrganization
178805
+ )
178806
+ },
178807
+ {
178808
+ name: "update_organization",
178809
+ description: "Update fields on an existing organization identified by ID or exact name when that name is unique. Only provided fields are modified. Description supports multi-line plain text and is the right place to store CRM notes / revenue summaries / context. Pass null to clear city or description. If multiple organizations share the same name, use the organization ID.",
178810
+ category: CATEGORY7,
178811
+ inputSchema: updateOrganizationParamsJsonSchema,
178812
+ handler: createToolHandler(
178813
+ "update_organization",
178814
+ parseUpdateOrganizationParams,
178815
+ updateOrganization
178816
+ )
178817
+ },
178818
+ {
178819
+ name: "delete_organization",
178820
+ description: "Permanently delete an organization identified by ID or exact name when that name is unique. Use with care - this cannot be undone. Useful for cleaning up duplicate organizations after merging their data elsewhere. If multiple organizations share the same name, use the organization ID.",
178821
+ category: CATEGORY7,
178822
+ inputSchema: deleteOrganizationParamsJsonSchema,
178823
+ handler: createToolHandler(
178824
+ "delete_organization",
178825
+ parseDeleteOrganizationParams,
178826
+ deleteOrganization
178827
+ )
178828
+ },
178829
+ {
178830
+ name: "make_organization_customer",
178831
+ description: "Apply the Customer mixin to an organization so it appears in the Huly Leads > Customers view. Idempotent - safe to call on organizations that are already customers. Takes the organization ID or exact name when that name is unique.",
178832
+ category: CATEGORY7,
178833
+ inputSchema: getOrganizationParamsJsonSchema,
178834
+ handler: createToolHandler(
178835
+ "make_organization_customer",
178836
+ parseGetOrganizationParams,
178837
+ makeOrganizationCustomer
178838
+ )
178839
+ },
178840
+ {
178841
+ name: "add_organization_channel",
178842
+ description: "Add a contact channel (phone, email, website/homepage, LinkedIn, Twitter, GitHub, Facebook, Telegram) to an organization identified by ID or exact unique name. Provider names: email, phone, linkedin, twitter, github, facebook, telegram, homepage.",
178843
+ category: CATEGORY7,
178844
+ inputSchema: addOrganizationChannelParamsJsonSchema,
178845
+ handler: createToolHandler(
178846
+ "add_organization_channel",
178847
+ parseAddOrganizationChannelParams,
178848
+ addOrganizationChannel
178849
+ )
178850
+ },
178851
+ {
178852
+ name: "add_organization_member",
178853
+ description: "Link a person as a member of an organization. The person appears under the org's Members tab in Huly. Use person ID or email to identify the person. Idempotent: returns added=false if that person is already a member.",
178854
+ category: CATEGORY7,
178855
+ inputSchema: addOrganizationMemberParamsJsonSchema,
178856
+ handler: createToolHandler(
178857
+ "add_organization_member",
178858
+ parseAddOrganizationMemberParams,
178859
+ addOrganizationMember
178860
+ )
178861
+ },
178862
+ {
178863
+ name: "list_organization_members",
178864
+ description: "List all persons who are members of an organization. Returns each member's person ID, name, and primary email (if any). When using a name instead of an ID, that name must identify exactly one organization.",
178865
+ category: CATEGORY7,
178866
+ inputSchema: listOrganizationMembersParamsJsonSchema,
178867
+ handler: createToolHandler(
178868
+ "list_organization_members",
178869
+ parseListOrganizationMembersParams,
178870
+ listOrganizationMembers
178871
+ )
178872
+ },
178873
+ {
178874
+ name: "list_person_organizations",
178875
+ description: "List all organizations that a person is a member of. Provide personId or email. Returns each organization's ID and name.",
178876
+ category: CATEGORY7,
178877
+ inputSchema: listPersonOrganizationsParamsJsonSchema,
178878
+ handler: createToolHandler(
178879
+ "list_person_organizations",
178880
+ parseListPersonOrganizationsParams,
178881
+ listPersonOrganizations
178882
+ )
178883
+ },
178884
+ {
178885
+ name: "remove_organization_member",
178886
+ description: "Unlink a person from an organization's members. Reverses add_organization_member. Returns removed: false if the person was not a member. When using an organization name instead of an ID, that name must identify exactly one organization.",
178887
+ category: CATEGORY7,
178888
+ inputSchema: removeOrganizationMemberParamsJsonSchema,
178889
+ handler: createToolHandler(
178890
+ "remove_organization_member",
178891
+ parseRemoveOrganizationMemberParams,
178892
+ removeOrganizationMember
178893
+ )
178038
178894
  }
178039
178895
  ];
178040
178896
 
@@ -178345,11 +179201,12 @@ var listComponents = (params) => Effect_exports.gen(function* () {
178345
179201
  });
178346
179202
  var getComponent = (params) => Effect_exports.gen(function* () {
178347
179203
  const { client, component } = yield* findProjectAndComponent(params);
179204
+ const markupUrlConfig = client.markupUrlConfig;
178348
179205
  const leadName = component.lead !== null ? (yield* client.findOne(contact.class.Person, { _id: component.lead }))?.name : void 0;
178349
179206
  const result = {
178350
179207
  id: ComponentId.make(component._id),
178351
179208
  label: ComponentLabel.make(component.label),
178352
- description: optionalMarkupToMarkdown(component.description, void 0),
179209
+ description: optionalMarkupToMarkdown(component.description, markupUrlConfig, void 0),
178353
179210
  lead: leadName !== void 0 ? PersonName.make(leadName) : void 0,
178354
179211
  project: params.project,
178355
179212
  modifiedOn: component.modifiedOn,
@@ -178359,9 +179216,10 @@ var getComponent = (params) => Effect_exports.gen(function* () {
178359
179216
  });
178360
179217
  var createComponent = (params) => Effect_exports.gen(function* () {
178361
179218
  const { client, project: project3 } = yield* findProject(params.project);
179219
+ const markupUrlConfig = client.markupUrlConfig;
178362
179220
  const componentId = (0, import_core32.generateId)();
178363
179221
  const leadParam = params.lead;
178364
- const leadRef = leadParam !== void 0 ? yield* Effect_exports.gen(function* () {
179222
+ const leadRef2 = leadParam !== void 0 ? yield* Effect_exports.gen(function* () {
178365
179223
  const person = yield* findPersonByEmailOrName(client, leadParam);
178366
179224
  if (person === void 0) {
178367
179225
  return yield* new PersonNotFoundError({ identifier: leadParam });
@@ -178370,8 +179228,8 @@ var createComponent = (params) => Effect_exports.gen(function* () {
178370
179228
  }) : null;
178371
179229
  const componentData = {
178372
179230
  label: params.label,
178373
- description: optionalMarkdownToMarkup(params.description),
178374
- lead: leadRef,
179231
+ description: optionalMarkdownToMarkup(params.description, markupUrlConfig, ""),
179232
+ lead: leadRef2,
178375
179233
  comments: 0
178376
179234
  };
178377
179235
  yield* client.createDoc(
@@ -178384,12 +179242,13 @@ var createComponent = (params) => Effect_exports.gen(function* () {
178384
179242
  });
178385
179243
  var updateComponent = (params) => Effect_exports.gen(function* () {
178386
179244
  const { client, component, project: project3 } = yield* findProjectAndComponent(params);
179245
+ const markupUrlConfig = client.markupUrlConfig;
178387
179246
  const updateOps = {};
178388
179247
  if (params.label !== void 0) {
178389
179248
  updateOps.label = params.label;
178390
179249
  }
178391
179250
  if (params.description !== void 0) {
178392
- updateOps.description = optionalMarkdownToMarkup(params.description);
179251
+ updateOps.description = optionalMarkdownToMarkup(params.description, markupUrlConfig, "");
178393
179252
  }
178394
179253
  if (params.lead !== void 0) {
178395
179254
  if (params.lead === null) {
@@ -178675,7 +179534,7 @@ var documentTools = [
178675
179534
  },
178676
179535
  {
178677
179536
  name: "list_documents",
178678
- description: "List documents in a Huly teamspace. Returns documents sorted by modification date (newest first). Supports searching by title substring (titleSearch) and content (contentSearch).",
179537
+ description: "List documents in a Huly teamspace. Returns documents sorted by modification date (newest first). Each result includes a 'url' field pointing to the document in the Huly web app. Supports searching by title substring (titleSearch) and content (contentSearch).",
178679
179538
  category: CATEGORY10,
178680
179539
  inputSchema: listDocumentsParamsJsonSchema,
178681
179540
  handler: createToolHandler(
@@ -178686,7 +179545,7 @@ var documentTools = [
178686
179545
  },
178687
179546
  {
178688
179547
  name: "get_document",
178689
- description: "Retrieve full details for a Huly document including markdown content. Use this to view document content and metadata.",
179548
+ description: "Retrieve full details for a Huly document including markdown content and a 'url' field pointing to the document in the Huly web app. Use this to view document content and metadata.",
178690
179549
  category: CATEGORY10,
178691
179550
  inputSchema: getDocumentParamsJsonSchema,
178692
179551
  handler: createToolHandler(
@@ -178697,7 +179556,7 @@ var documentTools = [
178697
179556
  },
178698
179557
  {
178699
179558
  name: "create_document",
178700
- description: "Create a new document in a Huly teamspace. Content supports full markdown including native Mermaid diagrams (```mermaid blocks render interactively in Huly UI). Returns the created document id. Use link_document_to_issue to associate the document with a tracker issue.",
179559
+ description: "Create a new document in a Huly teamspace. Content supports full markdown including native Mermaid diagrams (```mermaid blocks render interactively in Huly UI). Returns the created document id and a 'url' field pointing to the document in the Huly web app. Use link_document_to_issue to associate the document with a tracker issue.",
178701
179560
  category: CATEGORY10,
178702
179561
  inputSchema: createDocumentParamsJsonSchema,
178703
179562
  handler: createToolHandler(
@@ -178708,7 +179567,7 @@ var documentTools = [
178708
179567
  },
178709
179568
  {
178710
179569
  name: "edit_document",
178711
- description: "Edit an existing Huly document. Two content modes (mutually exclusive): (1) 'content' for full replace, (2) 'old_text' + 'new_text' for targeted search-and-replace. Multiple matches error unless replace_all is true. Empty new_text deletes matched text. Also supports renaming via 'title'. Content supports full markdown including native Mermaid diagrams.",
179570
+ description: "Edit an existing Huly document. Two content modes (mutually exclusive): (1) 'content' for full replace, (2) 'old_text' + 'new_text' for targeted search-and-replace. Multiple matches error unless replace_all is true. Empty new_text deletes matched text. Also supports renaming via 'title'. Content supports full markdown including native Mermaid diagrams. Returns a 'url' field pointing to the document in the Huly web app.",
178712
179571
  category: CATEGORY10,
178713
179572
  inputSchema: editDocumentParamsJsonSchema,
178714
179573
  handler: createToolHandler(
@@ -179552,7 +180411,7 @@ var findProjectAndTemplate = (params) => Effect_exports.gen(function* () {
179552
180411
  }
179553
180412
  return { client, project: project3, template };
179554
180413
  });
179555
- var resolveChild = (client, child) => Effect_exports.gen(function* () {
180414
+ var resolveChild = (client, markupUrlConfig, child) => Effect_exports.gen(function* () {
179556
180415
  const assigneeName = child.assignee !== null ? (yield* client.findOne(contact.class.Person, { _id: child.assignee }))?.name : void 0;
179557
180416
  const componentLabel = child.component !== null ? (yield* client.findOne(tracker.class.Component, { _id: child.component }))?.label : void 0;
179558
180417
  const base = {
@@ -179560,14 +180419,14 @@ var resolveChild = (client, child) => Effect_exports.gen(function* () {
179560
180419
  title: child.title,
179561
180420
  priority: priorityToString(child.priority)
179562
180421
  };
179563
- const withDescription3 = child.description ? { ...base, description: optionalMarkupToMarkdown(child.description) } : base;
180422
+ const withDescription3 = child.description ? { ...base, description: optionalMarkupToMarkdown(child.description, markupUrlConfig, "") } : base;
179564
180423
  const withAssignee = assigneeName !== void 0 ? { ...withDescription3, assignee: PersonName.make(assigneeName) } : withDescription3;
179565
180424
  const withComponent = componentLabel !== void 0 ? { ...withAssignee, component: ComponentLabel.make(componentLabel) } : withAssignee;
179566
180425
  const estimation = zeroAsUnset(NonNegativeNumber.make(child.estimation));
179567
180426
  const result = estimation !== void 0 ? { ...withComponent, estimation } : withComponent;
179568
180427
  return result;
179569
180428
  });
179570
- var buildTemplateChild = (client, projectId, projectIdentifier, input) => Effect_exports.gen(function* () {
180429
+ var buildTemplateChild = (client, markupUrlConfig, projectId, projectIdentifier, input) => Effect_exports.gen(function* () {
179571
180430
  const assigneeParam = input.assignee;
179572
180431
  const assigneeRef = assigneeParam !== void 0 ? yield* Effect_exports.gen(function* () {
179573
180432
  const person = yield* findPersonByEmailOrName(client, assigneeParam);
@@ -179590,7 +180449,7 @@ var buildTemplateChild = (client, projectId, projectIdentifier, input) => Effect
179590
180449
  return {
179591
180450
  id: (0, import_core36.generateId)(),
179592
180451
  title: input.title,
179593
- description: optionalMarkdownToMarkup(input.description),
180452
+ description: optionalMarkdownToMarkup(input.description, markupUrlConfig, ""),
179594
180453
  priority: stringToPriority(input.priority || "no-priority"),
179595
180454
  assignee: assigneeRef,
179596
180455
  component: componentRef,
@@ -179624,16 +180483,17 @@ var listIssueTemplates = (params) => Effect_exports.gen(function* () {
179624
180483
  });
179625
180484
  var getIssueTemplate = (params) => Effect_exports.gen(function* () {
179626
180485
  const { client, template } = yield* findProjectAndTemplate(params);
180486
+ const markupUrlConfig = client.markupUrlConfig;
179627
180487
  const assigneeName = template.assignee !== null ? (yield* client.findOne(contact.class.Person, { _id: template.assignee }))?.name : void 0;
179628
180488
  const componentLabel = template.component !== null ? (yield* client.findOne(tracker.class.Component, { _id: template.component }))?.label : void 0;
179629
180489
  const resolvedChildren = [];
179630
180490
  for (const child of template.children) {
179631
- resolvedChildren.push(yield* resolveChild(client, child));
180491
+ resolvedChildren.push(yield* resolveChild(client, markupUrlConfig, child));
179632
180492
  }
179633
180493
  const result = {
179634
180494
  id: IssueTemplateId.make(template._id),
179635
180495
  title: template.title,
179636
- description: optionalMarkupToMarkdown(template.description),
180496
+ description: optionalMarkupToMarkdown(template.description, markupUrlConfig, ""),
179637
180497
  priority: priorityToString(template.priority),
179638
180498
  assignee: assigneeName !== void 0 ? PersonName.make(assigneeName) : void 0,
179639
180499
  component: componentLabel !== void 0 ? ComponentLabel.make(componentLabel) : void 0,
@@ -179649,6 +180509,7 @@ var getIssueTemplate = (params) => Effect_exports.gen(function* () {
179649
180509
  });
179650
180510
  var createIssueTemplate = (params) => Effect_exports.gen(function* () {
179651
180511
  const { client, project: project3 } = yield* findProject(params.project);
180512
+ const markupUrlConfig = client.markupUrlConfig;
179652
180513
  const templateId = (0, import_core36.generateId)();
179653
180514
  const assigneeParam = params.assignee;
179654
180515
  const assigneeRef = assigneeParam !== void 0 ? yield* Effect_exports.gen(function* () {
@@ -179673,12 +180534,12 @@ var createIssueTemplate = (params) => Effect_exports.gen(function* () {
179673
180534
  const children = [];
179674
180535
  if (params.children !== void 0) {
179675
180536
  for (const childInput of params.children) {
179676
- children.push(yield* buildTemplateChild(client, project3._id, params.project, childInput));
180537
+ children.push(yield* buildTemplateChild(client, markupUrlConfig, project3._id, params.project, childInput));
179677
180538
  }
179678
180539
  }
179679
180540
  const templateData = {
179680
180541
  title: params.title,
179681
- description: optionalMarkdownToMarkup(params.description),
180542
+ description: optionalMarkdownToMarkup(params.description, markupUrlConfig, ""),
179682
180543
  priority,
179683
180544
  assignee: assigneeRef,
179684
180545
  component: componentRef,
@@ -179696,8 +180557,9 @@ var createIssueTemplate = (params) => Effect_exports.gen(function* () {
179696
180557
  });
179697
180558
  var createIssueFromTemplate = (params) => Effect_exports.gen(function* () {
179698
180559
  const { client, project: project3, template } = yield* findProjectAndTemplate(params);
180560
+ const markupUrlConfig = client.markupUrlConfig;
179699
180561
  const title = params.title ?? template.title;
179700
- const description = params.description ?? optionalMarkupToMarkdown(template.description, void 0);
180562
+ const description = params.description ?? optionalMarkupToMarkdown(template.description, markupUrlConfig, void 0);
179701
180563
  const priority = params.priority ?? priorityToString(template.priority);
179702
180564
  const templateAssigneeRef = template.assignee;
179703
180565
  const assignee = params.assignee !== void 0 ? params.assignee : templateAssigneeRef !== null ? yield* Effect_exports.gen(function* () {
@@ -179737,7 +180599,7 @@ var createIssueFromTemplate = (params) => Effect_exports.gen(function* () {
179737
180599
  const includeChildren = params.includeChildren !== false;
179738
180600
  if (includeChildren && template.children.length > 0) {
179739
180601
  for (const child of template.children) {
179740
- const childDescription = optionalMarkupToMarkdown(child.description, void 0);
180602
+ const childDescription = optionalMarkupToMarkdown(child.description, markupUrlConfig, void 0);
179741
180603
  const childResult = yield* createIssue({
179742
180604
  project: params.project,
179743
180605
  title: child.title,
@@ -179776,12 +180638,13 @@ var createIssueFromTemplate = (params) => Effect_exports.gen(function* () {
179776
180638
  });
179777
180639
  var updateIssueTemplate = (params) => Effect_exports.gen(function* () {
179778
180640
  const { client, project: project3, template } = yield* findProjectAndTemplate(params);
180641
+ const markupUrlConfig = client.markupUrlConfig;
179779
180642
  const updateOps = {};
179780
180643
  if (params.title !== void 0) {
179781
180644
  updateOps.title = params.title;
179782
180645
  }
179783
180646
  if (params.description !== void 0) {
179784
- updateOps.description = optionalMarkdownToMarkup(params.description);
180647
+ updateOps.description = optionalMarkdownToMarkup(params.description, markupUrlConfig, "");
179785
180648
  }
179786
180649
  if (params.priority !== void 0) {
179787
180650
  updateOps.priority = stringToPriority(params.priority);
@@ -179836,7 +180699,8 @@ var deleteIssueTemplate = (params) => Effect_exports.gen(function* () {
179836
180699
  });
179837
180700
  var addTemplateChild = (params) => Effect_exports.gen(function* () {
179838
180701
  const { client, project: project3, template } = yield* findProjectAndTemplate(params);
179839
- const child = yield* buildTemplateChild(client, project3._id, params.project, {
180702
+ const markupUrlConfig = client.markupUrlConfig;
180703
+ const child = yield* buildTemplateChild(client, markupUrlConfig, project3._id, params.project, {
179840
180704
  title: params.title,
179841
180705
  description: params.description,
179842
180706
  priority: params.priority,
@@ -180495,8 +181359,266 @@ var labelTools = [
180495
181359
  }
180496
181360
  ];
180497
181361
 
180498
- // src/huly/operations/milestones.ts
181362
+ // src/huly/operations/leads.ts
180499
181363
  var import_core39 = __toESM(require_lib4(), 1);
181364
+ var funnelAsSpace = (funnel) => toRef(funnel._id);
181365
+ var markupBlobRefAsMarkupRef = (value3) => value3;
181366
+ var normalizeLeadIdentifier = (identifier2) => {
181367
+ const match16 = /^(?:LEAD-)?(\d+)$/i.exec(identifier2.trim());
181368
+ return match16 !== null ? `LEAD-${match16[1]}` : identifier2.trim().toUpperCase();
181369
+ };
181370
+ var SORT_LEFT_BEFORE_RIGHT = -1;
181371
+ var SORT_RIGHT_BEFORE_LEFT = 1;
181372
+ var compareFunnelsByRecency = (left3, right3) => {
181373
+ if (left3.archived !== right3.archived) {
181374
+ return left3.archived ? SORT_RIGHT_BEFORE_LEFT : SORT_LEFT_BEFORE_RIGHT;
181375
+ }
181376
+ return right3.modifiedOn - left3.modifiedOn;
181377
+ };
181378
+ var findFunnel = (client, funnelIdentifier) => Effect_exports.gen(function* () {
181379
+ const byId = yield* client.findOne(
181380
+ leadClassIds.class.Funnel,
181381
+ { _id: toRef(funnelIdentifier) }
181382
+ );
181383
+ if (byId !== void 0) return byId;
181384
+ const allFunnels = yield* client.findAll(leadClassIds.class.Funnel, {});
181385
+ const normalized = normalizeForComparison(funnelIdentifier);
181386
+ const matchingFunnels = [...allFunnels].filter((candidate) => normalizeForComparison(candidate.name) === normalized).sort(compareFunnelsByRecency);
181387
+ const funnel = matchingFunnels.at(0);
181388
+ if (funnel === void 0) {
181389
+ return yield* new FunnelNotFoundError({ identifier: funnelIdentifier });
181390
+ }
181391
+ return funnel;
181392
+ });
181393
+ var getFunnelStatuses = (client, funnel) => Effect_exports.gen(function* () {
181394
+ if (funnel.type === void 0) {
181395
+ return yield* Effect_exports.fail(
181396
+ new HulyConnectionError({
181397
+ message: `Funnel '${funnel._id}' is missing its ProjectType reference`
181398
+ })
181399
+ );
181400
+ }
181401
+ const projectType = yield* client.findOne(
181402
+ task.class.ProjectType,
181403
+ { _id: toRef(funnel.type) }
181404
+ );
181405
+ if (projectType?.statuses === void 0) {
181406
+ return yield* Effect_exports.fail(
181407
+ new HulyConnectionError({
181408
+ message: `Funnel '${funnel._id}' references a ProjectType without statuses`
181409
+ })
181410
+ );
181411
+ }
181412
+ const statusRefs = projectType.statuses.map((status) => status._id);
181413
+ if (statusRefs.length === 0) {
181414
+ return yield* Effect_exports.fail(
181415
+ new HulyConnectionError({
181416
+ message: `Funnel '${funnel._id}' ProjectType has no statuses`
181417
+ })
181418
+ );
181419
+ }
181420
+ const statusDocs = yield* client.findAll(
181421
+ core.class.Status,
181422
+ { _id: { $in: [...statusRefs] } }
181423
+ );
181424
+ return statusDocs.map((doc) => ({
181425
+ _id: doc._id,
181426
+ name: doc.name
181427
+ }));
181428
+ });
181429
+ var resolveStatusName2 = (statuses, statusId) => {
181430
+ const statusDoc = statuses.find((status) => status._id === statusId);
181431
+ return statusDoc !== void 0 ? Effect_exports.succeed(StatusName.make(statusDoc.name)) : Effect_exports.fail(
181432
+ new HulyConnectionError({
181433
+ message: `Lead references status '${statusId}', but that status is not defined on the funnel ProjectType`
181434
+ })
181435
+ );
181436
+ };
181437
+ var resolveStatusByName2 = (statuses, statusName, funnel) => {
181438
+ const normalizedInput = normalizeForComparison(statusName);
181439
+ const matchingStatus = statuses.find(
181440
+ (status) => normalizeForComparison(status.name) === normalizedInput
181441
+ );
181442
+ if (matchingStatus === void 0) {
181443
+ return Effect_exports.fail(new InvalidStatusError({ status: statusName, project: funnel }));
181444
+ }
181445
+ return Effect_exports.succeed(matchingStatus._id);
181446
+ };
181447
+ var findCustomer = (client, customerId) => Effect_exports.gen(function* () {
181448
+ const contactCustomer = yield* client.findOne(contact.class.Contact, { _id: customerId });
181449
+ if (contactCustomer !== void 0) {
181450
+ return contactCustomer;
181451
+ }
181452
+ return yield* client.findOne(contact.class.Organization, {
181453
+ _id: toRef(customerId)
181454
+ });
181455
+ });
181456
+ var listFunnels = (params) => Effect_exports.gen(function* () {
181457
+ const client = yield* HulyClient;
181458
+ const query = params.includeArchived !== true ? { archived: false } : {};
181459
+ const limit = clampLimit(params.limit);
181460
+ const funnels = yield* client.findAll(
181461
+ leadClassIds.class.Funnel,
181462
+ query,
181463
+ {
181464
+ limit,
181465
+ sort: { name: import_core39.SortingOrder.Ascending }
181466
+ }
181467
+ );
181468
+ const summaries = funnels.map((funnel) => ({
181469
+ identifier: FunnelIdentifier.make(funnel._id),
181470
+ name: funnel.name,
181471
+ description: funnel.description,
181472
+ archived: funnel.archived
181473
+ }));
181474
+ return { funnels: summaries, total: funnels.total };
181475
+ });
181476
+ var listLeads = (params) => Effect_exports.gen(function* () {
181477
+ const client = yield* HulyClient;
181478
+ const funnel = yield* findFunnel(client, params.funnel);
181479
+ const statuses = yield* getFunnelStatuses(client, funnel);
181480
+ const baseQuery = {
181481
+ space: funnelAsSpace(funnel)
181482
+ };
181483
+ const statusFilter = params.status !== void 0 ? { status: yield* resolveStatusByName2(statuses, params.status, params.funnel) } : {};
181484
+ const assigneeParam = params.assignee;
181485
+ const assigneeFilter = assigneeParam !== void 0 ? yield* Effect_exports.gen(function* () {
181486
+ const assigneePerson = yield* findPersonByEmailOrName(client, assigneeParam);
181487
+ return assigneePerson !== void 0 ? { assignee: assigneePerson._id } : void 0;
181488
+ }) : {};
181489
+ if (assigneeFilter === void 0) return [];
181490
+ const titleFilter = params.titleSearch !== void 0 && params.titleSearch.trim() !== "" ? { title: { $like: `%${escapeLikeWildcards(params.titleSearch)}%` } } : {};
181491
+ const query = {
181492
+ ...baseQuery,
181493
+ ...statusFilter,
181494
+ ...assigneeFilter,
181495
+ ...titleFilter
181496
+ };
181497
+ const limit = clampLimit(params.limit);
181498
+ const leads = yield* client.findAll(
181499
+ leadClassIds.class.Lead,
181500
+ query,
181501
+ {
181502
+ limit,
181503
+ sort: { modifiedOn: import_core39.SortingOrder.Descending },
181504
+ // Upstream lead views resolve attachedTo through the Customer mixin.
181505
+ // Reference:
181506
+ // https://github.com/hcengineering/platform/blob/b9657d53d130a2ed8034c1b71ab0cf8b7a0b4994/models/lead/src/index.ts#L357-L360
181507
+ lookup: {
181508
+ assignee: contact.class.Person,
181509
+ attachedTo: leadClassIds.mixin.Customer
181510
+ }
181511
+ }
181512
+ );
181513
+ const rawSummaries = yield* Effect_exports.forEach(leads, (lead) => Effect_exports.gen(function* () {
181514
+ const status = yield* resolveStatusName2(statuses, lead.status);
181515
+ return {
181516
+ identifier: lead.identifier,
181517
+ title: lead.title,
181518
+ status,
181519
+ assignee: lead.$lookup?.assignee?.name,
181520
+ customer: lead.$lookup?.attachedTo?.name,
181521
+ modifiedOn: lead.modifiedOn
181522
+ };
181523
+ }));
181524
+ const validated = yield* Schema_exports.decodeUnknown(Schema_exports.Array(LeadSummarySchema))(rawSummaries).pipe(
181525
+ Effect_exports.mapError(
181526
+ (parseError2) => new HulyConnectionError({
181527
+ message: `listLeads response failed schema validation: ${parseError2.message}`,
181528
+ cause: parseError2
181529
+ })
181530
+ )
181531
+ );
181532
+ return [...validated];
181533
+ });
181534
+ var getLead = (params) => Effect_exports.gen(function* () {
181535
+ const client = yield* HulyClient;
181536
+ const funnel = yield* findFunnel(client, params.funnel);
181537
+ const statuses = yield* getFunnelStatuses(client, funnel);
181538
+ const leadIdentifier = yield* Schema_exports.decodeUnknown(LeadIdentifier)(normalizeLeadIdentifier(params.identifier)).pipe(
181539
+ Effect_exports.orDie
181540
+ );
181541
+ const lead = yield* client.findOne(
181542
+ leadClassIds.class.Lead,
181543
+ { space: funnelAsSpace(funnel), identifier: leadIdentifier }
181544
+ );
181545
+ if (lead === void 0) {
181546
+ return yield* new LeadNotFoundError({
181547
+ identifier: params.identifier,
181548
+ funnel: FunnelIdentifier.make(funnel._id)
181549
+ });
181550
+ }
181551
+ const status = yield* resolveStatusName2(statuses, lead.status);
181552
+ const person = lead.assignee !== null ? yield* client.findOne(contact.class.Person, { _id: lead.assignee }) : void 0;
181553
+ const customer = yield* findCustomer(client, toRef(lead.attachedTo));
181554
+ const description = lead.description ? yield* client.fetchMarkup(
181555
+ leadClassIds.class.Lead,
181556
+ lead._id,
181557
+ "description",
181558
+ markupBlobRefAsMarkupRef(lead.description),
181559
+ "markdown"
181560
+ ) : void 0;
181561
+ return yield* parseLeadDetail({
181562
+ identifier: lead.identifier,
181563
+ title: lead.title,
181564
+ description,
181565
+ status,
181566
+ assignee: person?.name,
181567
+ customer: customer?.name,
181568
+ funnel: funnel._id,
181569
+ funnelName: funnel.name,
181570
+ modifiedOn: lead.modifiedOn,
181571
+ createdOn: lead.createdOn
181572
+ }).pipe(
181573
+ Effect_exports.mapError(
181574
+ (parseError2) => new HulyConnectionError({
181575
+ message: `getLead response failed schema validation: ${parseError2.message}`,
181576
+ cause: parseError2
181577
+ })
181578
+ )
181579
+ );
181580
+ });
181581
+
181582
+ // src/mcp/tools/leads.ts
181583
+ var CATEGORY13 = "leads";
181584
+ var leadTools = [
181585
+ {
181586
+ name: "list_funnels",
181587
+ description: "List all Huly sales funnels (lead pipelines). Returns each funnel's stable ID and display name, sorted by name. Supports filtering by archived status.",
181588
+ category: CATEGORY13,
181589
+ inputSchema: listFunnelsParamsJsonSchema,
181590
+ handler: createToolHandler(
181591
+ "list_funnels",
181592
+ parseListFunnelsParams,
181593
+ listFunnels
181594
+ )
181595
+ },
181596
+ {
181597
+ name: "list_leads",
181598
+ description: "Query Huly leads in a funnel with optional filters. Pass the funnel ID returned by list_funnels, or a funnel name for convenience lookup. Returns leads sorted by modification date (newest first). Supports filtering by status, assignee, and title search.",
181599
+ category: CATEGORY13,
181600
+ inputSchema: listLeadsParamsJsonSchema,
181601
+ handler: createToolHandler(
181602
+ "list_leads",
181603
+ parseListLeadsParams,
181604
+ listLeads
181605
+ )
181606
+ },
181607
+ {
181608
+ name: "get_lead",
181609
+ description: "Retrieve full details for a Huly lead including markdown description, customer name, funnel ID and funnel name, and status. Lead identifiers follow the upstream Huly format like 'LEAD-1'.",
181610
+ category: CATEGORY13,
181611
+ inputSchema: getLeadParamsJsonSchema,
181612
+ handler: createToolHandler(
181613
+ "get_lead",
181614
+ parseGetLeadParams,
181615
+ getLead
181616
+ )
181617
+ }
181618
+ ];
181619
+
181620
+ // src/huly/operations/milestones.ts
181621
+ var import_core40 = __toESM(require_lib4(), 1);
180500
181622
  var import_tracker5 = __toESM(require_lib21(), 1);
180501
181623
  var milestoneStatusToStringMap = {
180502
181624
  [import_tracker5.MilestoneStatus.Planned]: "planned",
@@ -180540,7 +181662,7 @@ var listMilestones = (params) => Effect_exports.gen(function* () {
180540
181662
  { space: project3._id },
180541
181663
  {
180542
181664
  limit,
180543
- sort: { modifiedOn: import_core39.SortingOrder.Descending }
181665
+ sort: { modifiedOn: import_core40.SortingOrder.Descending }
180544
181666
  }
180545
181667
  );
180546
181668
  const summaries = milestones.map((m) => ({
@@ -180553,11 +181675,12 @@ var listMilestones = (params) => Effect_exports.gen(function* () {
180553
181675
  return summaries;
180554
181676
  });
180555
181677
  var getMilestone = (params) => Effect_exports.gen(function* () {
180556
- const { milestone } = yield* findProjectAndMilestone(params);
181678
+ const { client, milestone } = yield* findProjectAndMilestone(params);
181679
+ const markupUrlConfig = client.markupUrlConfig;
180557
181680
  const result = {
180558
181681
  id: MilestoneId.make(milestone._id),
180559
181682
  label: MilestoneLabel.make(milestone.label),
180560
- description: optionalMarkupToMarkdown(milestone.description),
181683
+ description: optionalMarkupToMarkdown(milestone.description, markupUrlConfig, ""),
180561
181684
  status: milestoneStatusToString(milestone.status),
180562
181685
  targetDate: milestone.targetDate,
180563
181686
  project: params.project,
@@ -180568,10 +181691,11 @@ var getMilestone = (params) => Effect_exports.gen(function* () {
180568
181691
  });
180569
181692
  var createMilestone = (params) => Effect_exports.gen(function* () {
180570
181693
  const { client, project: project3 } = yield* findProject(params.project);
180571
- const milestoneId = (0, import_core39.generateId)();
181694
+ const markupUrlConfig = client.markupUrlConfig;
181695
+ const milestoneId = (0, import_core40.generateId)();
180572
181696
  const milestoneData = {
180573
181697
  label: params.label,
180574
- description: optionalMarkdownToMarkup(params.description),
181698
+ description: optionalMarkdownToMarkup(params.description, markupUrlConfig, ""),
180575
181699
  status: import_tracker5.MilestoneStatus.Planned,
180576
181700
  targetDate: params.targetDate,
180577
181701
  comments: 0
@@ -180595,6 +181719,7 @@ var createMilestone = (params) => Effect_exports.gen(function* () {
180595
181719
  });
180596
181720
  var updateMilestone = (params) => Effect_exports.gen(function* () {
180597
181721
  const { client, milestone, project: project3 } = yield* findProjectAndMilestone(params);
181722
+ const markupUrlConfig = client.markupUrlConfig;
180598
181723
  const updateOps = {};
180599
181724
  if (params.label !== void 0) {
180600
181725
  updateOps.label = params.label;
@@ -180609,7 +181734,7 @@ var updateMilestone = (params) => Effect_exports.gen(function* () {
180609
181734
  "markdown"
180610
181735
  );
180611
181736
  }
180612
- updateOps.description = optionalMarkdownToMarkup(params.description);
181737
+ updateOps.description = optionalMarkdownToMarkup(params.description, markupUrlConfig, "");
180613
181738
  }
180614
181739
  if (params.targetDate !== void 0) {
180615
181740
  updateOps.targetDate = params.targetDate;
@@ -180650,12 +181775,12 @@ var deleteMilestone = (params) => Effect_exports.gen(function* () {
180650
181775
  });
180651
181776
 
180652
181777
  // src/mcp/tools/milestones.ts
180653
- var CATEGORY13 = "milestones";
181778
+ var CATEGORY14 = "milestones";
180654
181779
  var milestoneTools = [
180655
181780
  {
180656
181781
  name: "list_milestones",
180657
181782
  description: "List milestones in a Huly project. Returns milestones sorted by modification date (newest first).",
180658
- category: CATEGORY13,
181783
+ category: CATEGORY14,
180659
181784
  inputSchema: listMilestonesParamsJsonSchema,
180660
181785
  handler: createToolHandler(
180661
181786
  "list_milestones",
@@ -180666,7 +181791,7 @@ var milestoneTools = [
180666
181791
  {
180667
181792
  name: "get_milestone",
180668
181793
  description: "Retrieve full details for a Huly milestone. Use this to view milestone content and metadata.",
180669
- category: CATEGORY13,
181794
+ category: CATEGORY14,
180670
181795
  inputSchema: getMilestoneParamsJsonSchema,
180671
181796
  handler: createToolHandler(
180672
181797
  "get_milestone",
@@ -180677,7 +181802,7 @@ var milestoneTools = [
180677
181802
  {
180678
181803
  name: "create_milestone",
180679
181804
  description: "Create a new milestone in a Huly project. Returns the created milestone ID and label.",
180680
- category: CATEGORY13,
181805
+ category: CATEGORY14,
180681
181806
  inputSchema: createMilestoneParamsJsonSchema,
180682
181807
  handler: createToolHandler(
180683
181808
  "create_milestone",
@@ -180688,7 +181813,7 @@ var milestoneTools = [
180688
181813
  {
180689
181814
  name: "update_milestone",
180690
181815
  description: "Update fields on an existing Huly milestone. Only provided fields are modified.",
180691
- category: CATEGORY13,
181816
+ category: CATEGORY14,
180692
181817
  inputSchema: updateMilestoneParamsJsonSchema,
180693
181818
  handler: createToolHandler(
180694
181819
  "update_milestone",
@@ -180699,7 +181824,7 @@ var milestoneTools = [
180699
181824
  {
180700
181825
  name: "set_issue_milestone",
180701
181826
  description: "Set or clear the milestone on a Huly issue. Pass null for milestone to clear it.",
180702
- category: CATEGORY13,
181827
+ category: CATEGORY14,
180703
181828
  inputSchema: setIssueMilestoneParamsJsonSchema,
180704
181829
  handler: createToolHandler(
180705
181830
  "set_issue_milestone",
@@ -180710,7 +181835,7 @@ var milestoneTools = [
180710
181835
  {
180711
181836
  name: "delete_milestone",
180712
181837
  description: "Permanently delete a Huly milestone. This action cannot be undone.",
180713
- category: CATEGORY13,
181838
+ category: CATEGORY14,
180714
181839
  inputSchema: deleteMilestoneParamsJsonSchema,
180715
181840
  handler: createToolHandler(
180716
181841
  "delete_milestone",
@@ -180721,7 +181846,7 @@ var milestoneTools = [
180721
181846
  ];
180722
181847
 
180723
181848
  // src/huly/operations/notifications.ts
180724
- var import_core40 = __toESM(require_lib4(), 1);
181849
+ var import_core41 = __toESM(require_lib4(), 1);
180725
181850
  var toDocNotifyContextSummary = (ctx) => ({
180726
181851
  id: NotificationContextId.make(ctx._id),
180727
181852
  objectId: ctx.objectId,
@@ -180767,7 +181892,7 @@ var listNotifications = (params) => Effect_exports.gen(function* () {
180767
181892
  {
180768
181893
  limit,
180769
181894
  sort: {
180770
- modifiedOn: import_core40.SortingOrder.Descending
181895
+ modifiedOn: import_core41.SortingOrder.Descending
180771
181896
  }
180772
181897
  }
180773
181898
  );
@@ -180909,7 +182034,7 @@ var listNotificationContexts = (params) => Effect_exports.gen(function* () {
180909
182034
  {
180910
182035
  limit,
180911
182036
  sort: {
180912
- lastUpdateTimestamp: import_core40.SortingOrder.Descending
182037
+ lastUpdateTimestamp: import_core41.SortingOrder.Descending
180913
182038
  }
180914
182039
  }
180915
182040
  );
@@ -180978,12 +182103,12 @@ var getUnreadNotificationCount = () => Effect_exports.gen(function* () {
180978
182103
  });
180979
182104
 
180980
182105
  // src/mcp/tools/notifications.ts
180981
- var CATEGORY14 = "notifications";
182106
+ var CATEGORY15 = "notifications";
180982
182107
  var notificationTools = [
180983
182108
  {
180984
182109
  name: "list_notifications",
180985
182110
  description: "List inbox notifications. Returns notifications sorted by modification date (newest first). Supports filtering by read/archived status.",
180986
- category: CATEGORY14,
182111
+ category: CATEGORY15,
180987
182112
  inputSchema: listNotificationsParamsJsonSchema,
180988
182113
  handler: createToolHandler(
180989
182114
  "list_notifications",
@@ -180994,7 +182119,7 @@ var notificationTools = [
180994
182119
  {
180995
182120
  name: "get_notification",
180996
182121
  description: "Retrieve full details for a notification. Use this to view notification content and metadata.",
180997
- category: CATEGORY14,
182122
+ category: CATEGORY15,
180998
182123
  inputSchema: getNotificationParamsJsonSchema,
180999
182124
  handler: createToolHandler(
181000
182125
  "get_notification",
@@ -181005,7 +182130,7 @@ var notificationTools = [
181005
182130
  {
181006
182131
  name: "mark_notification_read",
181007
182132
  description: "Mark a notification as read.",
181008
- category: CATEGORY14,
182133
+ category: CATEGORY15,
181009
182134
  inputSchema: markNotificationReadParamsJsonSchema,
181010
182135
  handler: createToolHandler(
181011
182136
  "mark_notification_read",
@@ -181016,7 +182141,7 @@ var notificationTools = [
181016
182141
  {
181017
182142
  name: "mark_all_notifications_read",
181018
182143
  description: "Mark all unread notifications as read. Returns the count of notifications marked.",
181019
- category: CATEGORY14,
182144
+ category: CATEGORY15,
181020
182145
  inputSchema: emptyParamsJsonSchema,
181021
182146
  handler: createToolHandler(
181022
182147
  "mark_all_notifications_read",
@@ -181027,7 +182152,7 @@ var notificationTools = [
181027
182152
  {
181028
182153
  name: "archive_notification",
181029
182154
  description: "Archive a notification. Archived notifications are hidden from the main inbox view.",
181030
- category: CATEGORY14,
182155
+ category: CATEGORY15,
181031
182156
  inputSchema: archiveNotificationParamsJsonSchema,
181032
182157
  handler: createToolHandler(
181033
182158
  "archive_notification",
@@ -181038,7 +182163,7 @@ var notificationTools = [
181038
182163
  {
181039
182164
  name: "archive_all_notifications",
181040
182165
  description: "Archive all notifications. Returns the count of notifications archived.",
181041
- category: CATEGORY14,
182166
+ category: CATEGORY15,
181042
182167
  inputSchema: emptyParamsJsonSchema,
181043
182168
  handler: createToolHandler(
181044
182169
  "archive_all_notifications",
@@ -181049,7 +182174,7 @@ var notificationTools = [
181049
182174
  {
181050
182175
  name: "delete_notification",
181051
182176
  description: "Permanently delete a notification. This action cannot be undone.",
181052
- category: CATEGORY14,
182177
+ category: CATEGORY15,
181053
182178
  inputSchema: deleteNotificationParamsJsonSchema,
181054
182179
  handler: createToolHandler(
181055
182180
  "delete_notification",
@@ -181060,7 +182185,7 @@ var notificationTools = [
181060
182185
  {
181061
182186
  name: "get_notification_context",
181062
182187
  description: "Get notification context for an entity. Returns tracking information for a specific object.",
181063
- category: CATEGORY14,
182188
+ category: CATEGORY15,
181064
182189
  inputSchema: getNotificationContextParamsJsonSchema,
181065
182190
  handler: createToolHandler(
181066
182191
  "get_notification_context",
@@ -181071,7 +182196,7 @@ var notificationTools = [
181071
182196
  {
181072
182197
  name: "list_notification_contexts",
181073
182198
  description: "List notification contexts. Returns contexts sorted by last update timestamp (newest first). Supports filtering by pinned status.",
181074
- category: CATEGORY14,
182199
+ category: CATEGORY15,
181075
182200
  inputSchema: listNotificationContextsParamsJsonSchema,
181076
182201
  handler: createToolHandler(
181077
182202
  "list_notification_contexts",
@@ -181082,7 +182207,7 @@ var notificationTools = [
181082
182207
  {
181083
182208
  name: "pin_notification_context",
181084
182209
  description: "Pin or unpin a notification context. Pinned contexts are highlighted in the inbox.",
181085
- category: CATEGORY14,
182210
+ category: CATEGORY15,
181086
182211
  inputSchema: pinNotificationContextParamsJsonSchema,
181087
182212
  handler: createToolHandler(
181088
182213
  "pin_notification_context",
@@ -181093,7 +182218,7 @@ var notificationTools = [
181093
182218
  {
181094
182219
  name: "list_notification_settings",
181095
182220
  description: "List notification provider settings. Returns current notification preferences.",
181096
- category: CATEGORY14,
182221
+ category: CATEGORY15,
181097
182222
  inputSchema: listNotificationSettingsParamsJsonSchema,
181098
182223
  handler: createToolHandler(
181099
182224
  "list_notification_settings",
@@ -181104,7 +182229,7 @@ var notificationTools = [
181104
182229
  {
181105
182230
  name: "update_notification_provider_setting",
181106
182231
  description: "Update notification provider setting. Enable or disable notifications for a specific provider.",
181107
- category: CATEGORY14,
182232
+ category: CATEGORY15,
181108
182233
  inputSchema: updateNotificationProviderSettingParamsJsonSchema,
181109
182234
  handler: createToolHandler(
181110
182235
  "update_notification_provider_setting",
@@ -181115,7 +182240,7 @@ var notificationTools = [
181115
182240
  {
181116
182241
  name: "get_unread_notification_count",
181117
182242
  description: "Get the count of unread notifications.",
181118
- category: CATEGORY14,
182243
+ category: CATEGORY15,
181119
182244
  inputSchema: emptyParamsJsonSchema,
181120
182245
  handler: createToolHandler(
181121
182246
  "get_unread_notification_count",
@@ -181126,7 +182251,7 @@ var notificationTools = [
181126
182251
  ];
181127
182252
 
181128
182253
  // src/huly/operations/projects.ts
181129
- var import_core41 = __toESM(require_lib4(), 1);
182254
+ var import_core42 = __toESM(require_lib4(), 1);
181130
182255
  var import_tracker6 = __toESM(require_lib21(), 1);
181131
182256
  var listProjects = (params) => Effect_exports.gen(function* () {
181132
182257
  const client = yield* HulyClient;
@@ -181141,7 +182266,7 @@ var listProjects = (params) => Effect_exports.gen(function* () {
181141
182266
  {
181142
182267
  limit,
181143
182268
  sort: {
181144
- name: import_core41.SortingOrder.Ascending
182269
+ name: import_core42.SortingOrder.Ascending
181145
182270
  }
181146
182271
  }
181147
182272
  );
@@ -181210,7 +182335,7 @@ var createProject = (params) => Effect_exports.gen(function* () {
181210
182335
  created: false
181211
182336
  };
181212
182337
  }
181213
- const projectId = (0, import_core41.generateId)();
182338
+ const projectId = (0, import_core42.generateId)();
181214
182339
  const projectData = {
181215
182340
  name: params.name,
181216
182341
  description: params.description ?? "",
@@ -181272,12 +182397,12 @@ var deleteProject = (params) => Effect_exports.gen(function* () {
181272
182397
  });
181273
182398
 
181274
182399
  // src/mcp/tools/projects.ts
181275
- var CATEGORY15 = "projects";
182400
+ var CATEGORY16 = "projects";
181276
182401
  var projectTools = [
181277
182402
  {
181278
182403
  name: "list_projects",
181279
182404
  description: "List all Huly projects. Returns projects sorted by name. Supports filtering by archived status.",
181280
- category: CATEGORY15,
182405
+ category: CATEGORY16,
181281
182406
  inputSchema: listProjectsParamsJsonSchema,
181282
182407
  handler: createToolHandler(
181283
182408
  "list_projects",
@@ -181288,7 +182413,7 @@ var projectTools = [
181288
182413
  {
181289
182414
  name: "get_project",
181290
182415
  description: "Get full details of a Huly project including its statuses. Returns project name, description, archived flag, default status, and all available statuses.",
181291
- category: CATEGORY15,
182416
+ category: CATEGORY16,
181292
182417
  inputSchema: getProjectParamsJsonSchema,
181293
182418
  handler: createToolHandler(
181294
182419
  "get_project",
@@ -181299,7 +182424,7 @@ var projectTools = [
181299
182424
  {
181300
182425
  name: "list_statuses",
181301
182426
  description: "List all issue statuses for a Huly project with category info. Returns status name, isDone, isCanceled, and isDefault flags. Use this to discover valid statuses before creating or updating issues.",
181302
- category: CATEGORY15,
182427
+ category: CATEGORY16,
181303
182428
  inputSchema: listStatusesParamsJsonSchema,
181304
182429
  handler: createToolHandler(
181305
182430
  "list_statuses",
@@ -181310,7 +182435,7 @@ var projectTools = [
181310
182435
  {
181311
182436
  name: "create_project",
181312
182437
  description: "Create a new Huly tracker project. Idempotent: returns existing project if one with the same identifier already exists (created=false). Identifier must be 1-5 uppercase alphanumeric chars starting with a letter.",
181313
- category: CATEGORY15,
182438
+ category: CATEGORY16,
181314
182439
  inputSchema: createProjectParamsJsonSchema,
181315
182440
  handler: createToolHandler(
181316
182441
  "create_project",
@@ -181321,7 +182446,7 @@ var projectTools = [
181321
182446
  {
181322
182447
  name: "update_project",
181323
182448
  description: "Update a Huly project. Only provided fields are modified. Set description to null to clear it.",
181324
- category: CATEGORY15,
182449
+ category: CATEGORY16,
181325
182450
  inputSchema: updateProjectParamsJsonSchema,
181326
182451
  handler: createToolHandler(
181327
182452
  "update_project",
@@ -181332,7 +182457,7 @@ var projectTools = [
181332
182457
  {
181333
182458
  name: "delete_project",
181334
182459
  description: "Permanently delete a Huly project. All issues, milestones, and components in this project will be orphaned. This action cannot be undone.",
181335
- category: CATEGORY15,
182460
+ category: CATEGORY16,
181336
182461
  inputSchema: deleteProjectParamsJsonSchema,
181337
182462
  handler: createToolHandler(
181338
182463
  "delete_project",
@@ -181375,12 +182500,12 @@ var fulltextSearch = (params) => Effect_exports.gen(function* () {
181375
182500
  });
181376
182501
 
181377
182502
  // src/mcp/tools/search.ts
181378
- var CATEGORY16 = "search";
182503
+ var CATEGORY17 = "search";
181379
182504
  var searchTools = [
181380
182505
  {
181381
182506
  name: "fulltext_search",
181382
182507
  description: "Perform a global fulltext search across all Huly content. Searches issues, documents, messages, and other indexed content. Returns matching items sorted by relevance (newest first).",
181383
- category: CATEGORY16,
182508
+ category: CATEGORY17,
181384
182509
  inputSchema: fulltextSearchParamsJsonSchema,
181385
182510
  handler: createToolHandler(
181386
182511
  "fulltext_search",
@@ -181403,12 +182528,12 @@ var uploadFile = (params) => Effect_exports.gen(function* () {
181403
182528
  });
181404
182529
 
181405
182530
  // src/mcp/tools/storage.ts
181406
- var CATEGORY17 = "storage";
182531
+ var CATEGORY18 = "storage";
181407
182532
  var storageTools = [
181408
182533
  {
181409
182534
  name: "upload_file",
181410
182535
  description: "Upload a file to Huly storage. Provide ONE of: filePath (local file - preferred), fileUrl (fetch from URL), or data (base64 - for small files only). Returns blob ID and URL for referencing the file.",
181411
- category: CATEGORY17,
182536
+ category: CATEGORY18,
181412
182537
  inputSchema: uploadFileParamsJsonSchema,
181413
182538
  handler: createStorageToolHandler(
181414
182539
  "upload_file",
@@ -181419,12 +182544,12 @@ var storageTools = [
181419
182544
  ];
181420
182545
 
181421
182546
  // src/mcp/tools/tag-categories.ts
181422
- var CATEGORY18 = "tag-categories";
182547
+ var CATEGORY19 = "tag-categories";
181423
182548
  var tagCategoryTools = [
181424
182549
  {
181425
182550
  name: "list_tag_categories",
181426
182551
  description: "List tag/label categories in the workspace. Categories group labels (e.g., 'Priority Labels', 'Type Labels'). Optional targetClass filter (defaults to all).",
181427
- category: CATEGORY18,
182552
+ category: CATEGORY19,
181428
182553
  inputSchema: listTagCategoriesParamsJsonSchema,
181429
182554
  handler: createToolHandler(
181430
182555
  "list_tag_categories",
@@ -181435,7 +182560,7 @@ var tagCategoryTools = [
181435
182560
  {
181436
182561
  name: "create_tag_category",
181437
182562
  description: "Create a new tag/label category. Idempotent: returns existing category if one with the same label and targetClass already exists (created=false). Defaults targetClass to tracker issues.",
181438
- category: CATEGORY18,
182563
+ category: CATEGORY19,
181439
182564
  inputSchema: createTagCategoryParamsJsonSchema,
181440
182565
  handler: createToolHandler(
181441
182566
  "create_tag_category",
@@ -181446,7 +182571,7 @@ var tagCategoryTools = [
181446
182571
  {
181447
182572
  name: "update_tag_category",
181448
182573
  description: "Update a tag/label category. Accepts category ID or label name. Only provided fields are modified.",
181449
- category: CATEGORY18,
182574
+ category: CATEGORY19,
181450
182575
  inputSchema: updateTagCategoryParamsJsonSchema,
181451
182576
  handler: createToolHandler(
181452
182577
  "update_tag_category",
@@ -181457,7 +182582,7 @@ var tagCategoryTools = [
181457
182582
  {
181458
182583
  name: "delete_tag_category",
181459
182584
  description: "Permanently delete a tag/label category. Accepts category ID or label name. Labels in this category will be orphaned (not deleted). This action cannot be undone.",
181460
- category: CATEGORY18,
182585
+ category: CATEGORY19,
181461
182586
  inputSchema: deleteTagCategoryParamsJsonSchema,
181462
182587
  handler: createToolHandler(
181463
182588
  "delete_tag_category",
@@ -181468,7 +182593,7 @@ var tagCategoryTools = [
181468
182593
  ];
181469
182594
 
181470
182595
  // src/huly/operations/test-management-core.ts
181471
- var import_core42 = __toESM(require_lib4(), 1);
182596
+ var import_core43 = __toESM(require_lib4(), 1);
181472
182597
 
181473
182598
  // src/huly/test-management-classes.ts
181474
182599
  var testManagement = {
@@ -181622,7 +182747,7 @@ var listTestProjects = (params) => Effect_exports.gen(function* () {
181622
182747
  {},
181623
182748
  {
181624
182749
  limit,
181625
- sort: { name: import_core42.SortingOrder.Ascending }
182750
+ sort: { name: import_core43.SortingOrder.Ascending }
181626
182751
  }
181627
182752
  );
181628
182753
  return {
@@ -181644,7 +182769,7 @@ var listTestSuites = (params) => Effect_exports.gen(function* () {
181644
182769
  query,
181645
182770
  {
181646
182771
  limit,
181647
- sort: { modifiedOn: import_core42.SortingOrder.Descending }
182772
+ sort: { modifiedOn: import_core43.SortingOrder.Descending }
181648
182773
  }
181649
182774
  );
181650
182775
  return {
@@ -181677,7 +182802,7 @@ var createTestSuite = (params) => Effect_exports.gen(function* () {
181677
182802
  if (existing !== void 0) {
181678
182803
  return { id: TestSuiteId.make(existing._id), name: existing.name, created: false };
181679
182804
  }
181680
- const suiteId = (0, import_core42.generateId)();
182805
+ const suiteId = (0, import_core43.generateId)();
181681
182806
  const suiteData = {
181682
182807
  name: params.name,
181683
182808
  description: params.description ?? "",
@@ -181747,7 +182872,7 @@ var listTestCases = (params) => Effect_exports.gen(function* () {
181747
182872
  query,
181748
182873
  {
181749
182874
  limit,
181750
- sort: { modifiedOn: import_core42.SortingOrder.Descending }
182875
+ sort: { modifiedOn: import_core43.SortingOrder.Descending }
181751
182876
  }
181752
182877
  );
181753
182878
  return {
@@ -181775,7 +182900,7 @@ var createTestCase = (params) => Effect_exports.gen(function* () {
181775
182900
  const client = yield* HulyClient;
181776
182901
  const project3 = yield* findTestProject(client, params.project);
181777
182902
  const suite = yield* findTestSuite(client, project3, params.suite);
181778
- const caseId = (0, import_core42.generateId)();
182903
+ const caseId = (0, import_core43.generateId)();
181779
182904
  const assigneeRef = params.assignee !== void 0 ? toRef((yield* resolveAssignee2(params.assignee))._id) : null;
181780
182905
  const typeEnum = params.type !== void 0 ? stringToTestCaseType(params.type) ?? 0 /* Functional */ : 0 /* Functional */;
181781
182906
  const priorityEnum = params.priority !== void 0 ? stringToTestCasePriority(params.priority) ?? 1 /* Medium */ : 1 /* Medium */;
@@ -181879,12 +183004,12 @@ var deleteTestCase = (params) => Effect_exports.gen(function* () {
181879
183004
  });
181880
183005
 
181881
183006
  // src/mcp/tools/test-management-core.ts
181882
- var CATEGORY19 = "test-management";
183007
+ var CATEGORY20 = "test-management";
181883
183008
  var testManagementCoreTools = [
181884
183009
  {
181885
183010
  name: "list_test_projects",
181886
183011
  description: "List test management projects. Returns test projects sorted by name. These are separate from tracker projects.",
181887
- category: CATEGORY19,
183012
+ category: CATEGORY20,
181888
183013
  inputSchema: listTestProjectsParamsJsonSchema,
181889
183014
  handler: createToolHandler(
181890
183015
  "list_test_projects",
@@ -181895,7 +183020,7 @@ var testManagementCoreTools = [
181895
183020
  {
181896
183021
  name: "list_test_suites",
181897
183022
  description: "List test suites in a test project. Accepts project ID or name. Optional parent filter for nested suites.",
181898
- category: CATEGORY19,
183023
+ category: CATEGORY20,
181899
183024
  inputSchema: listTestSuitesParamsJsonSchema,
181900
183025
  handler: createToolHandler(
181901
183026
  "list_test_suites",
@@ -181906,7 +183031,7 @@ var testManagementCoreTools = [
181906
183031
  {
181907
183032
  name: "get_test_suite",
181908
183033
  description: "Get a single test suite by ID or name within a test project. Returns suite details and test case count.",
181909
- category: CATEGORY19,
183034
+ category: CATEGORY20,
181910
183035
  inputSchema: getTestSuiteParamsJsonSchema,
181911
183036
  handler: createToolHandler(
181912
183037
  "get_test_suite",
@@ -181917,7 +183042,7 @@ var testManagementCoreTools = [
181917
183042
  {
181918
183043
  name: "create_test_suite",
181919
183044
  description: "Create a test suite in a test project. Idempotent: returns existing suite if one with the same name exists (created=false). Optional parent for nesting.",
181920
- category: CATEGORY19,
183045
+ category: CATEGORY20,
181921
183046
  inputSchema: createTestSuiteParamsJsonSchema,
181922
183047
  handler: createToolHandler(
181923
183048
  "create_test_suite",
@@ -181928,7 +183053,7 @@ var testManagementCoreTools = [
181928
183053
  {
181929
183054
  name: "update_test_suite",
181930
183055
  description: "Update a test suite. Accepts suite ID or name. Only provided fields are modified.",
181931
- category: CATEGORY19,
183056
+ category: CATEGORY20,
181932
183057
  inputSchema: updateTestSuiteParamsJsonSchema,
181933
183058
  handler: createToolHandler(
181934
183059
  "update_test_suite",
@@ -181939,7 +183064,7 @@ var testManagementCoreTools = [
181939
183064
  {
181940
183065
  name: "delete_test_suite",
181941
183066
  description: "Permanently delete a test suite. Accepts suite ID or name. This action cannot be undone.",
181942
- category: CATEGORY19,
183067
+ category: CATEGORY20,
181943
183068
  inputSchema: deleteTestSuiteParamsJsonSchema,
181944
183069
  handler: createToolHandler(
181945
183070
  "delete_test_suite",
@@ -181950,7 +183075,7 @@ var testManagementCoreTools = [
181950
183075
  {
181951
183076
  name: "list_test_cases",
181952
183077
  description: "List test cases in a test project. Optional filters: suite (ID or name), assignee (name or email).",
181953
- category: CATEGORY19,
183078
+ category: CATEGORY20,
181954
183079
  inputSchema: listTestCasesParamsJsonSchema,
181955
183080
  handler: createToolHandler(
181956
183081
  "list_test_cases",
@@ -181961,7 +183086,7 @@ var testManagementCoreTools = [
181961
183086
  {
181962
183087
  name: "get_test_case",
181963
183088
  description: "Get a single test case by ID or name within a test project.",
181964
- category: CATEGORY19,
183089
+ category: CATEGORY20,
181965
183090
  inputSchema: getTestCaseParamsJsonSchema,
181966
183091
  handler: createToolHandler(
181967
183092
  "get_test_case",
@@ -181972,7 +183097,7 @@ var testManagementCoreTools = [
181972
183097
  {
181973
183098
  name: "create_test_case",
181974
183099
  description: "Create a test case attached to a suite. Requires project and suite. Defaults: type=functional, priority=medium, status=draft.",
181975
- category: CATEGORY19,
183100
+ category: CATEGORY20,
181976
183101
  inputSchema: createTestCaseParamsJsonSchema,
181977
183102
  handler: createToolHandler(
181978
183103
  "create_test_case",
@@ -181983,7 +183108,7 @@ var testManagementCoreTools = [
181983
183108
  {
181984
183109
  name: "update_test_case",
181985
183110
  description: "Update a test case. Accepts test case ID or name. Only provided fields are modified. Set assignee to null to unassign.",
181986
- category: CATEGORY19,
183111
+ category: CATEGORY20,
181987
183112
  inputSchema: updateTestCaseParamsJsonSchema,
181988
183113
  handler: createToolHandler(
181989
183114
  "update_test_case",
@@ -181994,7 +183119,7 @@ var testManagementCoreTools = [
181994
183119
  {
181995
183120
  name: "delete_test_case",
181996
183121
  description: "Permanently delete a test case. Accepts test case ID or name. This action cannot be undone.",
181997
- category: CATEGORY19,
183122
+ category: CATEGORY20,
181998
183123
  inputSchema: deleteTestCaseParamsJsonSchema,
181999
183124
  handler: createToolHandler(
182000
183125
  "delete_test_case",
@@ -182005,7 +183130,7 @@ var testManagementCoreTools = [
182005
183130
  ];
182006
183131
 
182007
183132
  // src/huly/operations/test-management-plans.ts
182008
- var import_core43 = __toESM(require_lib4(), 1);
183133
+ var import_core44 = __toESM(require_lib4(), 1);
182009
183134
  var toPlanSummary = (p) => ({
182010
183135
  id: TestPlanId.make(p._id),
182011
183136
  name: p.name
@@ -182023,7 +183148,7 @@ var listTestPlans = (params) => Effect_exports.gen(function* () {
182023
183148
  const plans = yield* client.findAll(
182024
183149
  testManagement.class.TestPlan,
182025
183150
  { space: project3._id },
182026
- { limit, sort: { modifiedOn: import_core43.SortingOrder.Descending } }
183151
+ { limit, sort: { modifiedOn: import_core44.SortingOrder.Descending } }
182027
183152
  );
182028
183153
  return { plans: plans.map(toPlanSummary), total: plans.total };
182029
183154
  });
@@ -182058,7 +183183,7 @@ var createTestPlan = (params) => Effect_exports.gen(function* () {
182058
183183
  if (existing !== void 0) {
182059
183184
  return { id: TestPlanId.make(existing._id), name: existing.name, created: false };
182060
183185
  }
182061
- const planId = (0, import_core43.generateId)();
183186
+ const planId = (0, import_core44.generateId)();
182062
183187
  const descRef = params.description !== void 0 && params.description.trim() !== "" ? yield* client.uploadMarkup(
182063
183188
  testManagement.class.TestPlan,
182064
183189
  planId,
@@ -182140,7 +183265,7 @@ var removeTestPlanItem = (params) => Effect_exports.gen(function* () {
182140
183265
  });
182141
183266
 
182142
183267
  // src/huly/operations/test-management-runs.ts
182143
- var import_core44 = __toESM(require_lib4(), 1);
183268
+ var import_core45 = __toESM(require_lib4(), 1);
182144
183269
  var BATCH_CONCURRENCY = 10;
182145
183270
  var toRunSummary = (r) => ({
182146
183271
  id: TestRunId.make(r._id),
@@ -182161,7 +183286,7 @@ var listTestRuns = (params) => Effect_exports.gen(function* () {
182161
183286
  const runs = yield* client.findAll(
182162
183287
  testManagement.class.TestRun,
182163
183288
  { space: project3._id },
182164
- { limit, sort: { modifiedOn: import_core44.SortingOrder.Descending } }
183289
+ { limit, sort: { modifiedOn: import_core45.SortingOrder.Descending } }
182165
183290
  );
182166
183291
  return { runs: runs.map(toRunSummary), total: runs.total };
182167
183292
  });
@@ -182190,7 +183315,7 @@ var getTestRun = (params) => Effect_exports.gen(function* () {
182190
183315
  var createTestRun = (params) => Effect_exports.gen(function* () {
182191
183316
  const client = yield* HulyClient;
182192
183317
  const project3 = yield* findTestProject(client, params.project);
182193
- const runId = (0, import_core44.generateId)();
183318
+ const runId = (0, import_core45.generateId)();
182194
183319
  const descRef = params.description !== void 0 && params.description.trim() !== "" ? yield* client.uploadMarkup(
182195
183320
  testManagement.class.TestRun,
182196
183321
  runId,
@@ -182247,7 +183372,7 @@ var listTestResults = (params) => Effect_exports.gen(function* () {
182247
183372
  const results = yield* client.findAll(
182248
183373
  testManagement.class.TestResult,
182249
183374
  { attachedTo: run3._id },
182250
- { limit, sort: { modifiedOn: import_core44.SortingOrder.Descending } }
183375
+ { limit, sort: { modifiedOn: import_core45.SortingOrder.Descending } }
182251
183376
  );
182252
183377
  return { results: results.map(toResultSummary), total: results.total };
182253
183378
  });
@@ -182348,7 +183473,7 @@ var runTestPlan = (params) => Effect_exports.gen(function* () {
182348
183473
  }
182349
183474
  return { item, tc };
182350
183475
  }), { concurrency: BATCH_CONCURRENCY });
182351
- const runId = (0, import_core44.generateId)();
183476
+ const runId = (0, import_core45.generateId)();
182352
183477
  const runName = params.runName ?? `${plan.name} - Run`;
182353
183478
  yield* client.createDoc(testManagement.class.TestRun, project3._id, {
182354
183479
  name: runName,
@@ -182378,41 +183503,41 @@ var runTestPlan = (params) => Effect_exports.gen(function* () {
182378
183503
  });
182379
183504
 
182380
183505
  // src/mcp/tools/test-management-plans.ts
182381
- var CATEGORY20 = "test-management";
183506
+ var CATEGORY21 = "test-management";
182382
183507
  var testManagementPlansTools = [
182383
183508
  // --- Test Plans ---
182384
183509
  {
182385
183510
  name: "list_test_plans",
182386
183511
  description: "List test plans in a test management project. Returns plan names and IDs. Requires project ID or name.",
182387
- category: CATEGORY20,
183512
+ category: CATEGORY21,
182388
183513
  inputSchema: listTestPlansParamsJsonSchema,
182389
183514
  handler: createToolHandler("list_test_plans", parseListTestPlansParams, listTestPlans)
182390
183515
  },
182391
183516
  {
182392
183517
  name: "get_test_plan",
182393
183518
  description: "Get test plan details including its items (test cases). Accepts plan ID or name within a project.",
182394
- category: CATEGORY20,
183519
+ category: CATEGORY21,
182395
183520
  inputSchema: getTestPlanParamsJsonSchema,
182396
183521
  handler: createToolHandler("get_test_plan", parseGetTestPlanParams, getTestPlan)
182397
183522
  },
182398
183523
  {
182399
183524
  name: "create_test_plan",
182400
183525
  description: "Create a test plan in a project. Idempotent: returns existing plan if one with the same name exists (created=false).",
182401
- category: CATEGORY20,
183526
+ category: CATEGORY21,
182402
183527
  inputSchema: createTestPlanParamsJsonSchema,
182403
183528
  handler: createToolHandler("create_test_plan", parseCreateTestPlanParams, createTestPlan)
182404
183529
  },
182405
183530
  {
182406
183531
  name: "update_test_plan",
182407
183532
  description: "Update a test plan's name or description. Only provided fields are modified. Pass description=null to clear.",
182408
- category: CATEGORY20,
183533
+ category: CATEGORY21,
182409
183534
  inputSchema: updateTestPlanParamsJsonSchema,
182410
183535
  handler: createToolHandler("update_test_plan", parseUpdateTestPlanParams, updateTestPlan)
182411
183536
  },
182412
183537
  {
182413
183538
  name: "delete_test_plan",
182414
183539
  description: "Permanently delete a test plan. This does not delete associated test runs. Cannot be undone.",
182415
- category: CATEGORY20,
183540
+ category: CATEGORY21,
182416
183541
  inputSchema: deleteTestPlanParamsJsonSchema,
182417
183542
  handler: createToolHandler("delete_test_plan", parseDeleteTestPlanParams, deleteTestPlan)
182418
183543
  },
@@ -182420,14 +183545,14 @@ var testManagementPlansTools = [
182420
183545
  {
182421
183546
  name: "add_test_plan_item",
182422
183547
  description: "Add a test case to a test plan. Resolves test case by ID or name. Optionally assign a person by email or name.",
182423
- category: CATEGORY20,
183548
+ category: CATEGORY21,
182424
183549
  inputSchema: addTestPlanItemParamsJsonSchema,
182425
183550
  handler: createToolHandler("add_test_plan_item", parseAddTestPlanItemParams, addTestPlanItem)
182426
183551
  },
182427
183552
  {
182428
183553
  name: "remove_test_plan_item",
182429
183554
  description: "Remove a test case from a test plan by item ID. Get item IDs from get_test_plan.",
182430
- category: CATEGORY20,
183555
+ category: CATEGORY21,
182431
183556
  inputSchema: removeTestPlanItemParamsJsonSchema,
182432
183557
  handler: createToolHandler("remove_test_plan_item", parseRemoveTestPlanItemParams, removeTestPlanItem)
182433
183558
  },
@@ -182435,35 +183560,35 @@ var testManagementPlansTools = [
182435
183560
  {
182436
183561
  name: "list_test_runs",
182437
183562
  description: "List test runs in a test management project. Returns run names, IDs, and due dates.",
182438
- category: CATEGORY20,
183563
+ category: CATEGORY21,
182439
183564
  inputSchema: listTestRunsParamsJsonSchema,
182440
183565
  handler: createToolHandler("list_test_runs", parseListTestRunsParams, listTestRuns)
182441
183566
  },
182442
183567
  {
182443
183568
  name: "get_test_run",
182444
183569
  description: "Get test run details including all results. Accepts run ID or name within a project.",
182445
- category: CATEGORY20,
183570
+ category: CATEGORY21,
182446
183571
  inputSchema: getTestRunParamsJsonSchema,
182447
183572
  handler: createToolHandler("get_test_run", parseGetTestRunParams, getTestRun)
182448
183573
  },
182449
183574
  {
182450
183575
  name: "create_test_run",
182451
183576
  description: "Create a test run in a project. For bulk creation from a plan, use run_test_plan instead.",
182452
- category: CATEGORY20,
183577
+ category: CATEGORY21,
182453
183578
  inputSchema: createTestRunParamsJsonSchema,
182454
183579
  handler: createToolHandler("create_test_run", parseCreateTestRunParams, createTestRun)
182455
183580
  },
182456
183581
  {
182457
183582
  name: "update_test_run",
182458
183583
  description: "Update a test run's name, description, or due date. Only provided fields are modified. Pass null to clear optional fields.",
182459
- category: CATEGORY20,
183584
+ category: CATEGORY21,
182460
183585
  inputSchema: updateTestRunParamsJsonSchema,
182461
183586
  handler: createToolHandler("update_test_run", parseUpdateTestRunParams, updateTestRun)
182462
183587
  },
182463
183588
  {
182464
183589
  name: "delete_test_run",
182465
183590
  description: "Permanently delete a test run. This does not delete associated test results. Cannot be undone.",
182466
- category: CATEGORY20,
183591
+ category: CATEGORY21,
182467
183592
  inputSchema: deleteTestRunParamsJsonSchema,
182468
183593
  handler: createToolHandler("delete_test_run", parseDeleteTestRunParams, deleteTestRun)
182469
183594
  },
@@ -182471,35 +183596,35 @@ var testManagementPlansTools = [
182471
183596
  {
182472
183597
  name: "list_test_results",
182473
183598
  description: "List test results in a test run. Returns result names, statuses, and assignees.",
182474
- category: CATEGORY20,
183599
+ category: CATEGORY21,
182475
183600
  inputSchema: listTestResultsParamsJsonSchema,
182476
183601
  handler: createToolHandler("list_test_results", parseListTestResultsParams, listTestResults)
182477
183602
  },
182478
183603
  {
182479
183604
  name: "get_test_result",
182480
183605
  description: "Get test result details. Accepts result ID or name.",
182481
- category: CATEGORY20,
183606
+ category: CATEGORY21,
182482
183607
  inputSchema: getTestResultParamsJsonSchema,
182483
183608
  handler: createToolHandler("get_test_result", parseGetTestResultParams, getTestResult)
182484
183609
  },
182485
183610
  {
182486
183611
  name: "create_test_result",
182487
183612
  description: "Create a test result in a run. Resolves test case by ID or name. Status defaults to 'untested'.",
182488
- category: CATEGORY20,
183613
+ category: CATEGORY21,
182489
183614
  inputSchema: createTestResultParamsJsonSchema,
182490
183615
  handler: createToolHandler("create_test_result", parseCreateTestResultParams, createTestResult)
182491
183616
  },
182492
183617
  {
182493
183618
  name: "update_test_result",
182494
183619
  description: "Update a test result's status, assignee, or description. Status values: untested, blocked, passed, failed.",
182495
- category: CATEGORY20,
183620
+ category: CATEGORY21,
182496
183621
  inputSchema: updateTestResultParamsJsonSchema,
182497
183622
  handler: createToolHandler("update_test_result", parseUpdateTestResultParams, updateTestResult)
182498
183623
  },
182499
183624
  {
182500
183625
  name: "delete_test_result",
182501
183626
  description: "Permanently delete a test result. Cannot be undone.",
182502
- category: CATEGORY20,
183627
+ category: CATEGORY21,
182503
183628
  inputSchema: deleteTestResultParamsJsonSchema,
182504
183629
  handler: createToolHandler("delete_test_result", parseDeleteTestResultParams, deleteTestResult)
182505
183630
  },
@@ -182507,7 +183632,7 @@ var testManagementPlansTools = [
182507
183632
  {
182508
183633
  name: "run_test_plan",
182509
183634
  description: "Execute a test plan: creates a test run and one test result per plan item. Returns the run ID and count of results created. Optionally name the run and set a due date.",
182510
- category: CATEGORY20,
183635
+ category: CATEGORY21,
182511
183636
  inputSchema: runTestPlanParamsJsonSchema,
182512
183637
  annotations: {
182513
183638
  title: "Run Test Plan",
@@ -182522,7 +183647,7 @@ var testManagementPlansTools = [
182522
183647
 
182523
183648
  // src/huly/operations/time.ts
182524
183649
  var import_calendar6 = __toESM(require_lib24(), 1);
182525
- var import_core45 = __toESM(require_lib4(), 1);
183650
+ var import_core46 = __toESM(require_lib4(), 1);
182526
183651
  var import_tracker7 = __toESM(require_lib21(), 1);
182527
183652
  var serverPopulatedCalendar = toRef("");
182528
183653
  var serverPopulatedPersonId = "";
@@ -182532,7 +183657,7 @@ var logTime = (params) => Effect_exports.gen(function* () {
182532
183657
  project: params.project,
182533
183658
  identifier: params.identifier
182534
183659
  });
182535
- const reportId = (0, import_core45.generateId)();
183660
+ const reportId = (0, import_core46.generateId)();
182536
183661
  const now2 = yield* Clock_exports.currentTimeMillis;
182537
183662
  const reportData = {
182538
183663
  employee: null,
@@ -182572,7 +183697,7 @@ var getTimeReport = (params) => Effect_exports.gen(function* () {
182572
183697
  const reports = yield* client.findAll(
182573
183698
  tracker.class.TimeSpendReport,
182574
183699
  { attachedTo: issue2._id },
182575
- { sort: { date: import_core45.SortingOrder.Descending } }
183700
+ { sort: { date: import_core46.SortingOrder.Descending } }
182576
183701
  );
182577
183702
  const employeeIds = [
182578
183703
  ...new Set(
@@ -182624,7 +183749,7 @@ var listTimeSpendReports = (params) => Effect_exports.gen(function* () {
182624
183749
  tracker.class.TimeSpendReport,
182625
183750
  query,
182626
183751
  withLookup(
182627
- { limit, sort: { date: import_core45.SortingOrder.Descending } },
183752
+ { limit, sort: { date: import_core46.SortingOrder.Descending } },
182628
183753
  {
182629
183754
  attachedTo: tracker.class.Issue,
182630
183755
  employee: contact.class.Person
@@ -182653,7 +183778,7 @@ var getDetailedTimeReport = (params) => Effect_exports.gen(function* () {
182653
183778
  tracker.class.TimeSpendReport,
182654
183779
  query,
182655
183780
  withLookup(
182656
- { sort: { date: import_core45.SortingOrder.Descending } },
183781
+ { sort: { date: import_core46.SortingOrder.Descending } },
182657
183782
  {
182658
183783
  attachedTo: tracker.class.Issue,
182659
183784
  employee: contact.class.Person
@@ -182731,7 +183856,7 @@ var listWorkSlots = (params) => Effect_exports.gen(function* () {
182731
183856
  const slots = yield* client.findAll(
182732
183857
  time.class.WorkSlot,
182733
183858
  query,
182734
- { limit, sort: { date: import_core45.SortingOrder.Descending } }
183859
+ { limit, sort: { date: import_core46.SortingOrder.Descending } }
182735
183860
  );
182736
183861
  return slots.map((s) => ({
182737
183862
  id: WorkSlotId.make(s._id),
@@ -182743,7 +183868,7 @@ var listWorkSlots = (params) => Effect_exports.gen(function* () {
182743
183868
  });
182744
183869
  var createWorkSlot = (params) => Effect_exports.gen(function* () {
182745
183870
  const client = yield* HulyClient;
182746
- const slotId = (0, import_core45.generateId)();
183871
+ const slotId = (0, import_core46.generateId)();
182747
183872
  const slotData = {
182748
183873
  date: params.date,
182749
183874
  dueDate: params.dueDate,
@@ -182794,12 +183919,12 @@ var stopTimer = (params) => Effect_exports.gen(function* () {
182794
183919
  });
182795
183920
 
182796
183921
  // src/mcp/tools/time.ts
182797
- var CATEGORY21 = "time tracking";
183922
+ var CATEGORY22 = "time tracking";
182798
183923
  var timeTools = [
182799
183924
  {
182800
183925
  name: "log_time",
182801
183926
  description: "Log time spent on a Huly issue. Records a time entry with optional description. Time value is in minutes.",
182802
- category: CATEGORY21,
183927
+ category: CATEGORY22,
182803
183928
  inputSchema: logTimeParamsJsonSchema,
182804
183929
  handler: createEncodedToolHandler(
182805
183930
  "log_time",
@@ -182811,7 +183936,7 @@ var timeTools = [
182811
183936
  {
182812
183937
  name: "get_time_report",
182813
183938
  description: "Get time tracking report for a specific Huly issue. Shows total time, estimation, remaining time, and all time entries.",
182814
- category: CATEGORY21,
183939
+ category: CATEGORY22,
182815
183940
  inputSchema: getTimeReportParamsJsonSchema,
182816
183941
  handler: createEncodedToolHandler(
182817
183942
  "get_time_report",
@@ -182823,7 +183948,7 @@ var timeTools = [
182823
183948
  {
182824
183949
  name: "list_time_spend_reports",
182825
183950
  description: "List all time entries across issues. Supports filtering by project and date range. Returns entries sorted by date (newest first).",
182826
- category: CATEGORY21,
183951
+ category: CATEGORY22,
182827
183952
  inputSchema: listTimeSpendReportsParamsJsonSchema,
182828
183953
  handler: createEncodedToolHandler(
182829
183954
  "list_time_spend_reports",
@@ -182835,7 +183960,7 @@ var timeTools = [
182835
183960
  {
182836
183961
  name: "get_detailed_time_report",
182837
183962
  description: "Get detailed time breakdown for a project. Shows total time grouped by issue and by employee. Supports date range filtering.",
182838
- category: CATEGORY21,
183963
+ category: CATEGORY22,
182839
183964
  inputSchema: getDetailedTimeReportParamsJsonSchema,
182840
183965
  handler: createEncodedToolHandler(
182841
183966
  "get_detailed_time_report",
@@ -182847,7 +183972,7 @@ var timeTools = [
182847
183972
  {
182848
183973
  name: "list_work_slots",
182849
183974
  description: "List scheduled work slots. Shows planned time blocks attached to ToDos. Supports filtering by employee and date range.",
182850
- category: CATEGORY21,
183975
+ category: CATEGORY22,
182851
183976
  inputSchema: listWorkSlotsParamsJsonSchema,
182852
183977
  handler: createEncodedToolHandler(
182853
183978
  "list_work_slots",
@@ -182859,7 +183984,7 @@ var timeTools = [
182859
183984
  {
182860
183985
  name: "create_work_slot",
182861
183986
  description: "Create a scheduled work slot. Attaches a time block to a ToDo for planning purposes.",
182862
- category: CATEGORY21,
183987
+ category: CATEGORY22,
182863
183988
  inputSchema: createWorkSlotParamsJsonSchema,
182864
183989
  handler: createEncodedToolHandler(
182865
183990
  "create_work_slot",
@@ -182871,7 +183996,7 @@ var timeTools = [
182871
183996
  {
182872
183997
  name: "start_timer",
182873
183998
  description: "Start a client-side timer on a Huly issue. Validates the issue exists and returns a start timestamp. Use log_time to record the elapsed time when done.",
182874
- category: CATEGORY21,
183999
+ category: CATEGORY22,
182875
184000
  inputSchema: startTimerParamsJsonSchema,
182876
184001
  handler: createEncodedToolHandler(
182877
184002
  "start_timer",
@@ -182883,7 +184008,7 @@ var timeTools = [
182883
184008
  {
182884
184009
  name: "stop_timer",
182885
184010
  description: "Stop a client-side timer on a Huly issue. Returns the stop timestamp. Calculate elapsed time from start/stop timestamps and use log_time to record it.",
182886
- category: CATEGORY21,
184011
+ category: CATEGORY22,
182887
184012
  inputSchema: stopTimerParamsJsonSchema,
182888
184013
  handler: createEncodedToolHandler(
182889
184014
  "stop_timer",
@@ -182895,15 +184020,15 @@ var timeTools = [
182895
184020
  ];
182896
184021
 
182897
184022
  // src/huly/operations/workspace.ts
182898
- var import_core46 = __toESM(require_lib4(), 1);
184023
+ var import_core47 = __toESM(require_lib4(), 1);
182899
184024
  var accountRoleMap = {
182900
- READONLYGUEST: import_core46.AccountRole.ReadOnlyGuest,
182901
- DocGuest: import_core46.AccountRole.DocGuest,
182902
- GUEST: import_core46.AccountRole.Guest,
182903
- USER: import_core46.AccountRole.User,
182904
- MAINTAINER: import_core46.AccountRole.Maintainer,
182905
- OWNER: import_core46.AccountRole.Owner,
182906
- ADMIN: import_core46.AccountRole.Admin
184025
+ READONLYGUEST: import_core47.AccountRole.ReadOnlyGuest,
184026
+ DocGuest: import_core47.AccountRole.DocGuest,
184027
+ GUEST: import_core47.AccountRole.Guest,
184028
+ USER: import_core47.AccountRole.User,
184029
+ MAINTAINER: import_core47.AccountRole.Maintainer,
184030
+ OWNER: import_core47.AccountRole.Owner,
184031
+ ADMIN: import_core47.AccountRole.Admin
182907
184032
  };
182908
184033
  var toHulyAccountRole = (role) => accountRoleMap[role];
182909
184034
  var formatVersion = (info) => `${info.versionMajor}.${info.versionMinor}.${info.versionPatch}`;
@@ -183056,12 +184181,12 @@ var getRegions = () => Effect_exports.gen(function* () {
183056
184181
  });
183057
184182
 
183058
184183
  // src/mcp/tools/workspace.ts
183059
- var CATEGORY22 = "workspace";
184184
+ var CATEGORY23 = "workspace";
183060
184185
  var workspaceTools = [
183061
184186
  {
183062
184187
  name: "list_workspace_members",
183063
184188
  description: "List members in the current Huly workspace with their roles. Returns members with account IDs and roles.",
183064
- category: CATEGORY22,
184189
+ category: CATEGORY23,
183065
184190
  inputSchema: listWorkspaceMembersParamsJsonSchema,
183066
184191
  handler: createEncodedWorkspaceToolHandler(
183067
184192
  "list_workspace_members",
@@ -183073,7 +184198,7 @@ var workspaceTools = [
183073
184198
  {
183074
184199
  name: "update_member_role",
183075
184200
  description: "Update a workspace member's role. Requires appropriate permissions. Valid roles: READONLYGUEST, DocGuest, GUEST, USER, MAINTAINER, OWNER, ADMIN.",
183076
- category: CATEGORY22,
184201
+ category: CATEGORY23,
183077
184202
  inputSchema: updateMemberRoleParamsJsonSchema,
183078
184203
  handler: createEncodedWorkspaceToolHandler(
183079
184204
  "update_member_role",
@@ -183085,7 +184210,7 @@ var workspaceTools = [
183085
184210
  {
183086
184211
  name: "get_workspace_info",
183087
184212
  description: "Get information about the current workspace including name, URL, region, and settings.",
183088
- category: CATEGORY22,
184213
+ category: CATEGORY23,
183089
184214
  inputSchema: emptyParamsJsonSchema,
183090
184215
  handler: createEncodedNoParamsWorkspaceToolHandler(
183091
184216
  "get_workspace_info",
@@ -183096,7 +184221,7 @@ var workspaceTools = [
183096
184221
  {
183097
184222
  name: "list_workspaces",
183098
184223
  description: "List all workspaces accessible to the current user. Returns workspace summaries sorted by last visit.",
183099
- category: CATEGORY22,
184224
+ category: CATEGORY23,
183100
184225
  inputSchema: listWorkspacesParamsJsonSchema,
183101
184226
  handler: createEncodedWorkspaceToolHandler(
183102
184227
  "list_workspaces",
@@ -183108,7 +184233,7 @@ var workspaceTools = [
183108
184233
  {
183109
184234
  name: "create_workspace",
183110
184235
  description: "Create a new Huly workspace. Returns the workspace UUID and URL. Optionally specify a region.",
183111
- category: CATEGORY22,
184236
+ category: CATEGORY23,
183112
184237
  inputSchema: createWorkspaceParamsJsonSchema,
183113
184238
  handler: createEncodedWorkspaceToolHandler(
183114
184239
  "create_workspace",
@@ -183120,7 +184245,7 @@ var workspaceTools = [
183120
184245
  {
183121
184246
  name: "delete_workspace",
183122
184247
  description: "Permanently delete the current workspace. This action cannot be undone. Use with extreme caution.",
183123
- category: CATEGORY22,
184248
+ category: CATEGORY23,
183124
184249
  inputSchema: emptyParamsJsonSchema,
183125
184250
  handler: createEncodedNoParamsWorkspaceToolHandler(
183126
184251
  "delete_workspace",
@@ -183131,7 +184256,7 @@ var workspaceTools = [
183131
184256
  {
183132
184257
  name: "get_user_profile",
183133
184258
  description: "Get the current user's profile information including bio, location, and social links.",
183134
- category: CATEGORY22,
184259
+ category: CATEGORY23,
183135
184260
  inputSchema: emptyParamsJsonSchema,
183136
184261
  handler: createEncodedNoParamsWorkspaceToolHandler(
183137
184262
  "get_user_profile",
@@ -183142,7 +184267,7 @@ var workspaceTools = [
183142
184267
  {
183143
184268
  name: "update_user_profile",
183144
184269
  description: "Update the current user's profile. Supports bio, city, country, website, social links, and public visibility.",
183145
- category: CATEGORY22,
184270
+ category: CATEGORY23,
183146
184271
  inputSchema: updateUserProfileParamsJsonSchema,
183147
184272
  handler: createEncodedWorkspaceToolHandler(
183148
184273
  "update_user_profile",
@@ -183154,7 +184279,7 @@ var workspaceTools = [
183154
184279
  {
183155
184280
  name: "update_guest_settings",
183156
184281
  description: "Update workspace guest settings. Control read-only guest access and guest sign-up permissions.",
183157
- category: CATEGORY22,
184282
+ category: CATEGORY23,
183158
184283
  inputSchema: updateGuestSettingsParamsJsonSchema,
183159
184284
  handler: createEncodedWorkspaceToolHandler(
183160
184285
  "update_guest_settings",
@@ -183166,7 +184291,7 @@ var workspaceTools = [
183166
184291
  {
183167
184292
  name: "get_regions",
183168
184293
  description: "Get available regions for workspace creation. Returns region codes and display names.",
183169
- category: CATEGORY22,
184294
+ category: CATEGORY23,
183170
184295
  inputSchema: getRegionsParamsJsonSchema,
183171
184296
  handler: createEncodedWorkspaceToolHandler(
183172
184297
  "get_regions",
@@ -183192,6 +184317,7 @@ var allTools = [
183192
184317
  ...contactTools,
183193
184318
  ...channelTools,
183194
184319
  ...cardTools,
184320
+ ...leadTools,
183195
184321
  ...customFieldTools,
183196
184322
  ...calendarTools,
183197
184323
  ...timeTools,