@firfi/huly-mcp 0.1.61 → 0.2.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: () => SortingOrder24,
34080
+ SortingOrder: () => SortingOrder25,
34081
34081
  shouldShowArchived: () => shouldShowArchived
34082
34082
  });
34083
34083
  module2.exports = __toCommonJS2(storage_exports);
34084
- var SortingOrder24 = /* @__PURE__ */ ((SortingOrder25) => {
34085
- SortingOrder25[SortingOrder25["Ascending"] = 1] = "Ascending";
34086
- SortingOrder25[SortingOrder25["Descending"] = -1] = "Descending";
34087
- return SortingOrder25;
34088
- })(SortingOrder24 || {});
34084
+ var SortingOrder25 = /* @__PURE__ */ ((SortingOrder26) => {
34085
+ SortingOrder26[SortingOrder26["Ascending"] = 1] = "Ascending";
34086
+ SortingOrder26[SortingOrder26["Descending"] = -1] = "Descending";
34087
+ return SortingOrder26;
34088
+ })(SortingOrder25 || {});
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_core44 = require_lib4();
34591
+ var import_core45 = 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_core44.concatLink)(this.url, "/providers"));
34627
+ const response = await fetch((0, import_core45.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_core44.concatLink)(this.url, "/cookie");
35282
+ const url4 = (0, import_core45.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_core44.concatLink)(this.url, "/cookie");
35292
+ const url4 = (0, import_core45.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_core44 = require_lib4();
35571
+ var import_core45 = require_lib4();
35572
35572
  async function loadServerConfig4(url4) {
35573
- const configUrl = (0, import_core44.concatLink)(url4, "/config.json");
35573
+ const configUrl = (0, import_core45.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_core44 = require_lib4();
35659
+ var import_core45 = 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_core44.concatLink)(this.collaboratorUrl, `/rpc/${encodeURIComponent(documentId)}`);
35678
+ const url4 = (0, import_core45.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_core44 = require_dist16();
53245
+ var import_core45 = require_dist16();
53246
53246
  var import_utils14 = require_utils5();
53247
- var ImageNode = import_core44.Node.create({
53247
+ var ImageNode = import_core45.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_core44.mergeAttributes)(
53306
+ const imgAttributes = (0, import_core45.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_core44 = require_dist16();
53350
+ var import_core45 = require_dist16();
53351
53351
  var import_utils14 = require_utils5();
53352
- var ReferenceNode = import_core44.Node.create({
53352
+ var ReferenceNode = import_core45.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_core44.mergeAttributes)(
53387
+ (0, import_core45.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_core44 = require_dist16();
53447
- var EmojiNode = import_core44.Node.create({
53446
+ var import_core45 = require_dist16();
53447
+ var EmojiNode = import_core45.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_core44.mergeAttributes)(
53487
+ const containerAttributes = (0, import_core45.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_core44.mergeAttributes)(
53520
+ (0, import_core45.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_core44.mergeAttributes)({
53529
+ (0, import_core45.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_core44.mergeAttributes)(
53539
+ (0, import_core45.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_core44 = require_dist16();
53848
- var FileNode = import_core44.Node.create({
53847
+ var import_core45 = require_dist16();
53848
+ var FileNode = import_core45.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_core44 = require_dist16();
54158
+ var import_core45 = 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_core44.textblockTypeInputRule)({
54204
+ (0, import_core45.textblockTypeInputRule)({
54205
54205
  find: backtickInputRegex,
54206
54206
  type: this.type
54207
54207
  }),
54208
- (0, import_core44.textblockTypeInputRule)({
54208
+ (0, import_core45.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_core44 = require_dist16();
54245
- var CommentNode = import_core44.Node.create({
54244
+ var import_core45 = require_dist16();
54245
+ var CommentNode = import_core45.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_core44 = require_dist16();
54292
- var MarkdownNode = import_core44.Node.create({
54291
+ var import_core45 = require_dist16();
54292
+ var MarkdownNode = import_core45.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_core44.mergeAttributes)({ "data-type": this.name }, this.options.HTMLAttributes, HTMLAttributes),
54310
+ (0, import_core45.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_core44 = require_dist16();
54345
- var EmbedNode = import_core44.Node.create({
54344
+ var import_core45 = require_dist16();
54345
+ var EmbedNode = import_core45.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_core44.mergeAttributes)(HTMLAttributes)]];
54370
+ return ["figure", { "data-type": this.name }, ["iframe", (0, import_core45.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_core44 = require_dist16();
54444
+ var import_core45 = 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_core44.Mark.create({
54459
+ var NoteBaseExtension = import_core45.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_core44 = require_dist16();
54516
+ var import_core45 = require_dist16();
54517
54517
  var NAME2 = "node-uuid";
54518
- var QMSInlineCommentMark = import_core44.Mark.create({
54518
+ var QMSInlineCommentMark = import_core45.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_core44 = require_dist16();
54563
+ var import_core45 = require_dist16();
54564
54564
  function extensionKit(name, fn2) {
54565
- return import_core44.Extension.create({
54565
+ return import_core45.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_core44 = require_dist16();
61594
+ var import_core45 = require_dist16();
61595
61595
  var import_extension_text_style = require_dist20();
61596
- var BackgroundColor = import_core44.Extension.create({
61596
+ var BackgroundColor = import_core45.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_core44.Extension.create({
61637
+ var TextColor = import_core45.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_core44 = require_dist16();
61709
+ var import_core45 = require_dist16();
61710
61710
  var import_model = require_dist10();
61711
61711
  var import_state = require_dist5();
61712
- var InlineCommentMark = import_core44.Mark.create({
61712
+ var InlineCommentMark = import_core45.Mark.create({
61713
61713
  name: "inline-comment",
61714
61714
  excludes: "",
61715
61715
  inclusive: false,
@@ -62885,7 +62885,7 @@ var require_traverse = __commonJS({
62885
62885
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
62886
62886
  var traverse_exports = {};
62887
62887
  __export2(traverse_exports, {
62888
- traverseAllMarks: () => traverseAllMarks,
62888
+ traverseAllMarks: () => traverseAllMarks2,
62889
62889
  traverseNode: () => traverseNode,
62890
62890
  traverseNodeContent: () => traverseNodeContent,
62891
62891
  traverseNodeMarks: () => traverseNodeMarks
@@ -62916,7 +62916,7 @@ var require_traverse = __commonJS({
62916
62916
  });
62917
62917
  }
62918
62918
  __name(traverseNodeContent, "traverseNodeContent");
62919
- function traverseAllMarks(node, f) {
62919
+ function traverseAllMarks2(node, f) {
62920
62920
  traverseNode(node, (node2) => {
62921
62921
  traverseNodeMarks(node2, (mark) => {
62922
62922
  f(node2, mark);
@@ -62924,7 +62924,7 @@ var require_traverse = __commonJS({
62924
62924
  return true;
62925
62925
  });
62926
62926
  }
62927
- __name(traverseAllMarks, "traverseAllMarks");
62927
+ __name(traverseAllMarks2, "traverseAllMarks");
62928
62928
  }
62929
62929
  });
62930
62930
 
@@ -63329,7 +63329,7 @@ var require_utils7 = __commonJS({
63329
63329
  isEmptyMarkup: () => isEmptyMarkup,
63330
63330
  isEmptyNode: () => isEmptyNode2,
63331
63331
  jsonToMarkup: () => jsonToMarkup3,
63332
- markupToJSON: () => markupToJSON3,
63332
+ markupToJSON: () => markupToJSON4,
63333
63333
  markupToText: () => markupToText,
63334
63334
  stripHash: () => stripHash,
63335
63335
  stripTags: () => stripTags
@@ -63345,15 +63345,15 @@ var require_utils7 = __commonJS({
63345
63345
  if (markup === void 0 || markup === null || markup === "") {
63346
63346
  return true;
63347
63347
  }
63348
- return isEmptyNode2(markupToJSON3(markup));
63348
+ return isEmptyNode2(markupToJSON4(markup));
63349
63349
  }
63350
63350
  __name(isEmptyMarkup, "isEmptyMarkup");
63351
63351
  function areEqualMarkups(markup1, markup2) {
63352
63352
  if (markup1 === markup2) {
63353
63353
  return true;
63354
63354
  }
63355
- const node1 = markupToJSON3(markup1);
63356
- const node2 = markupToJSON3(markup2);
63355
+ const node1 = markupToJSON4(markup1);
63356
+ const node2 = markupToJSON4(markup2);
63357
63357
  if (isEmptyNode2(node1) && isEmptyNode2(node2)) {
63358
63358
  return true;
63359
63359
  }
@@ -63415,7 +63415,7 @@ var require_utils7 = __commonJS({
63415
63415
  return JSON.stringify(json3);
63416
63416
  }
63417
63417
  __name(jsonToMarkup3, "jsonToMarkup");
63418
- function markupToJSON3(markup) {
63418
+ function markupToJSON4(markup) {
63419
63419
  if (markup == null || markup === "") {
63420
63420
  return (0, import_model.emptyMarkupNode)();
63421
63421
  }
@@ -63433,11 +63433,11 @@ var require_utils7 = __commonJS({
63433
63433
  return (0, import_model.emptyMarkupNode)();
63434
63434
  }
63435
63435
  }
63436
- __name(markupToJSON3, "markupToJSON");
63436
+ __name(markupToJSON4, "markupToJSON");
63437
63437
  var ELLIPSIS_CHAR = "\u2026";
63438
63438
  var WHITESPACE = " ";
63439
63439
  function stripTags(markup, textLimit = 0) {
63440
- const parsed = markupToJSON3(markup);
63440
+ const parsed = markupToJSON4(markup);
63441
63441
  const textParts = [];
63442
63442
  let charCount = 0;
63443
63443
  let isHardStop = false;
@@ -63477,7 +63477,7 @@ var require_utils7 = __commonJS({
63477
63477
  }
63478
63478
  __name(stripTags, "stripTags");
63479
63479
  function markupToText(markup) {
63480
- const jsonModel = markupToJSON3(markup);
63480
+ const jsonModel = markupToJSON4(markup);
63481
63481
  const fragments = [];
63482
63482
  (0, import_traverse.traverseNode)(jsonModel, (node) => {
63483
63483
  if (node.type === import_model.MarkupNodeType.text) {
@@ -77233,9 +77233,9 @@ var require_client5 = __commonJS({
77233
77233
  createMarkupOperations: () => createMarkupOperations
77234
77234
  });
77235
77235
  module2.exports = __toCommonJS2(client_exports);
77236
- var import_core44 = require_lib4();
77236
+ var import_core45 = require_lib4();
77237
77237
  var import_collaborator_client2 = require_lib7();
77238
- var import_text3 = require_lib9();
77238
+ var import_text4 = require_lib9();
77239
77239
  var import_text_markdown3 = require_lib17();
77240
77240
  function createMarkupOperations(url4, workspace, token, config3) {
77241
77241
  return new MarkupOperationsImpl(url4, workspace, token, config3);
@@ -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_core44.concatLink)(this.url, `/browse?workspace=${workspace}`);
77251
- this.imageUrl = (0, import_core44.concatLink)(this.url, `/files?workspace=${workspace}&file=`);
77250
+ this.refUrl = (0, import_core45.concatLink)(this.url, `/browse?workspace=${workspace}`);
77251
+ this.imageUrl = (0, import_core45.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,14 +77258,14 @@ var require_client5 = __commonJS({
77258
77258
  imageUrl;
77259
77259
  refUrl;
77260
77260
  async fetchMarkup(objectClass, objectId, objectAttr, doc, format7) {
77261
- const collabId = (0, import_core44.makeCollabId)(objectClass, objectId, objectAttr);
77261
+ const collabId = (0, import_core45.makeCollabId)(objectClass, objectId, objectAttr);
77262
77262
  const markup = await this.collaborator.getMarkup(collabId, doc);
77263
- const json3 = (0, import_text3.markupToJSON)(markup);
77263
+ const json3 = (0, import_text4.markupToJSON)(markup);
77264
77264
  switch (format7) {
77265
77265
  case "markup":
77266
77266
  return markup;
77267
77267
  case "html":
77268
- return (0, import_text3.jsonToHTML)(json3);
77268
+ return (0, import_text4.jsonToHTML)(json3);
77269
77269
  case "markdown":
77270
77270
  return (0, import_text_markdown3.markupToMarkdown)(json3, { refUrl: this.refUrl, imageUrl: this.imageUrl });
77271
77271
  default:
@@ -77279,15 +77279,15 @@ var require_client5 = __commonJS({
77279
77279
  markup = value3;
77280
77280
  break;
77281
77281
  case "html":
77282
- markup = (0, import_text3.jsonToMarkup)((0, import_text3.htmlToJSON)(value3));
77282
+ markup = (0, import_text4.jsonToMarkup)((0, import_text4.htmlToJSON)(value3));
77283
77283
  break;
77284
77284
  case "markdown":
77285
- markup = (0, import_text3.jsonToMarkup)((0, import_text_markdown3.markdownToMarkup)(value3, { refUrl: this.refUrl, imageUrl: this.imageUrl }));
77285
+ markup = (0, import_text4.jsonToMarkup)((0, import_text_markdown3.markdownToMarkup)(value3, { refUrl: this.refUrl, imageUrl: this.imageUrl }));
77286
77286
  break;
77287
77287
  default:
77288
77288
  throw new Error("Unknown content format");
77289
77289
  }
77290
- const collabId = (0, import_core44.makeCollabId)(objectClass, objectId, objectAttr);
77290
+ const collabId = (0, import_core45.makeCollabId)(objectClass, objectId, objectAttr);
77291
77291
  return await this.collaborator.createMarkup(collabId, markup);
77292
77292
  }
77293
77293
  };
@@ -81772,7 +81772,7 @@ var require_connection2 = __commonJS({
81772
81772
  module2.exports = __toCommonJS2(connection_exports);
81773
81773
  var import_analytics = require_lib2();
81774
81774
  var import_client23 = __toESM2(require_lib6());
81775
- var import_core44 = __toESM2(require_lib4());
81775
+ var import_core45 = __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_core44.generateId)();
81819
+ sessionId = (0, import_core45.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_core44.generateId)();
81830
+ this.sessionId = (0, import_core45.generateId)();
81831
81831
  }
81832
81832
  this.rpcHandler = opt?.useGlobalRPCHandler === true ? globalRPCHandler : new import_rpc.RPCHandler();
81833
81833
  this.pushHandler(handler);
@@ -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_core44.ClientConnectEvent.Maintenance, void 0, resp.result.stats);
82010
+ void this.onConnect?.(import_core45.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_core44.ClientConnectEvent.Reconnected : import_core44.ClientConnectEvent.Connected,
82045
+ helloResp.reconnect === true ? import_core45.ClientConnectEvent.Reconnected : import_core45.ClientConnectEvent.Connected,
82046
82046
  helloResp.lastTx,
82047
82047
  this.sessionId
82048
82048
  )?.catch((err) => {
@@ -82092,7 +82092,7 @@ var require_connection2 = __commonJS({
82092
82092
  }
82093
82093
  result = result.concat(c.data);
82094
82094
  }
82095
- resp.result = (0, import_core44.toFindResult)(result, total, lookupMap);
82095
+ resp.result = (0, import_core45.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_core44.default.class.TxModelUpgrade) {
82139
+ if (tx?._class === import_core45.default.class.TxModelUpgrade) {
82140
82140
  console.log("Processing upgrade", this.workspace, this.user);
82141
82141
  this.opt?.onUpgrade?.();
82142
82142
  return;
@@ -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_core44.clone)(this.account));
82369
+ return Promise.resolve((0, import_core45.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_core44.default.class.TxApplyIf) {
82428
- return (await this.findAll(import_core44.default.class.Tx, { _id: tx.txes[0]._id }, { limit: 1 })).length === 0;
82427
+ if (tx._class === import_core45.default.class.TxApplyIf) {
82428
+ return (await this.findAll(import_core45.default.class.Tx, { _id: tx.txes[0]._id }, { limit: 1 })).length === 0;
82429
82429
  }
82430
- return (await this.findAll(import_core44.default.class.Tx, { _id: tx._id }, { limit: 1 })).length === 0;
82430
+ return (await this.findAll(import_core45.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_core44.MeasureMetricsContext("connection", {}),
82470
+ opt?.ctx?.newChild?.("connection", {}) ?? new import_core45.MeasureMetricsContext("connection", {}),
82471
82471
  url4,
82472
82472
  handler,
82473
82473
  workspace,
@@ -82518,13 +82518,13 @@ var require_lib19 = __commonJS({
82518
82518
  });
82519
82519
  module2.exports = __toCommonJS2(index_exports2);
82520
82520
  var import_client23 = __toESM2(require_lib6());
82521
- var import_core44 = __toESM2(require_lib4());
82521
+ var import_core45 = __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_core44.platformNow)();
82527
+ const st = (0, import_core45.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_core44.platformNow)() - st);
82538
+ console.log("init DB complete", (0, import_core45.platformNow)() - st);
82539
82539
  resolve2(db);
82540
82540
  };
82541
82541
  });
@@ -82564,16 +82564,16 @@ var require_lib19 = __commonJS({
82564
82564
  const filterModel = (0, import_platform2.getMetadata)(import_client23.default.metadata.FilterModel) ?? "none";
82565
82565
  const extraFilter = (0, import_platform2.getMetadata)(import_client23.default.metadata.ExtraFilter) ?? [];
82566
82566
  const handler = /* @__PURE__ */ __name(async (handler2) => {
82567
- const url4 = (0, import_core44.concatLink)(endpoint, `/${token}`);
82567
+ const url4 = (0, import_core45.concatLink)(endpoint, `/${token}`);
82568
82568
  const upgradeHandler = /* @__PURE__ */ __name((...txes) => {
82569
82569
  for (const tx of txes) {
82570
- if (tx?._class === import_core44.default.class.TxModelUpgrade) {
82570
+ if (tx?._class === import_core45.default.class.TxModelUpgrade) {
82571
82571
  opt?.onUpgrade?.();
82572
82572
  return;
82573
82573
  }
82574
- if (tx?._class === import_core44.default.class.TxWorkspaceEvent) {
82574
+ if (tx?._class === import_core45.default.class.TxWorkspaceEvent) {
82575
82575
  const event = tx;
82576
- if (event.event === import_core44.WorkspaceEvent.MaintenanceNotification) {
82576
+ if (event.event === import_core45.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,
@@ -82611,7 +82611,7 @@ var require_lib19 = __commonJS({
82611
82611
  reject(error2);
82612
82612
  return;
82613
82613
  }
82614
- if (event !== import_core44.ClientConnectEvent.Maintenance) {
82614
+ if (event !== import_core45.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_core44.createClient)(handler, modelFilter, createModelPersistence(getWSFromToken(token)), opt?.ctx);
82636
+ const client = (0, import_core45.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_core44.fillConfiguration)(txes, configs);
82644
+ (0, import_core45.fillConfiguration)(txes, configs);
82645
82645
  const allowedPlugins = [...(0, import_platform2.getPlugins)(), ...(0, import_platform2.getMetadata)(import_client23.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_core44.pluginFilterTx)(excludedPlugins, configs, txes);
82649
+ return (0, import_core45.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_core44.fillConfiguration)(txes, configs);
82654
+ (0, import_core45.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_core44.pluginFilterTx)(excludedPlugins, configs, txes).filter((tx) => {
82681
- if (tx?._class === import_core44.default.class.TxCreateDoc || tx?._class === import_core44.default.class.TxUpdateDoc || tx?._class === import_core44.default.class.TxRemoveDoc) {
82680
+ const result = (0, import_core45.pluginFilterTx)(excludedPlugins, configs, txes).filter((tx) => {
82681
+ if (tx?._class === import_core45.default.class.TxCreateDoc || tx?._class === import_core45.default.class.TxUpdateDoc || tx?._class === import_core45.default.class.TxRemoveDoc) {
82682
82682
  const cud = tx;
82683
82683
  if (toExclude.has(cud.objectClass)) {
82684
82684
  return false;
@@ -82788,7 +82788,7 @@ var require_client6 = __commonJS({
82788
82788
  module2.exports = __toCommonJS2(client_exports);
82789
82789
  var import_account_client2 = require_lib5();
82790
82790
  var import_client23 = __toESM2(require_lib6());
82791
- var import_core44 = require_lib4();
82791
+ var import_core45 = require_lib4();
82792
82792
  var import_platform2 = require_lib();
82793
82793
  var import_config8 = require_config();
82794
82794
  var import_markup = require_markup();
@@ -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_core44.pickPrimarySocialId)(socialIds)._id,
82808
+ primarySocialId: (0, import_core45.pickPrimarySocialId)(socialIds)._id,
82809
82809
  socialIds: socialIds.map((si) => si._id),
82810
82810
  fullSocialIds: socialIds
82811
82811
  };
@@ -82831,7 +82831,7 @@ var require_client6 = __commonJS({
82831
82831
  this.config = config3;
82832
82832
  this.connection = connection;
82833
82833
  this.account = account;
82834
- this.client = new import_core44.TxOperations(connection, account.primarySocialId);
82834
+ this.client = new import_core45.TxOperations(connection, account.primarySocialId);
82835
82835
  this.markup = (0, import_markup.createMarkupOperations)(url4, workspace, token, config3);
82836
82836
  }
82837
82837
  static {
@@ -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_core44.generateId)();
82874
+ id ??= (0, import_core45.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_core44.generateId)();
82887
+ id ??= (0, import_core45.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_core44 = require_lib4();
83214
+ var import_core45 = 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_core44.concatLink)(this.endpoint, `/api/v1/find-all/${this.workspace}?${params.toString()}`);
83269
+ const requestUrl = (0, import_core45.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_core44.concatLink)(this.endpoint, `/api/v1/account/${this.workspace}`);
83343
+ const requestUrl = (0, import_core45.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_core44.concatLink)(this.endpoint, `/api/v1/load-model/${this.workspace}`));
83360
+ const requestUrl = new URL((0, import_core45.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_core44.Hierarchy();
83374
- const model = new import_core44.ModelDb(hierarchy);
83375
- const ctx = new import_core44.MeasureMetricsContext("loadModel", {});
83376
- (0, import_core44.buildModel)(ctx, modelResponse, void 0, hierarchy, model);
83373
+ const hierarchy = new import_core45.Hierarchy();
83374
+ const model = new import_core45.ModelDb(hierarchy);
83375
+ const ctx = new import_core45.MeasureMetricsContext("loadModel", {});
83376
+ (0, import_core45.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_core44.concatLink)(this.endpoint, `/api/v1/tx/${this.workspace}`);
83388
+ const requestUrl = (0, import_core45.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_core44.concatLink)(this.endpoint, `/api/v1/search-fulltext/${this.workspace}?${params.toString()}`);
83422
+ const requestUrl = (0, import_core45.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_core44.concatLink)(this.endpoint, `/api/v1/request/${domain3}/${this.workspace}`);
83441
+ const requestUrl = (0, import_core45.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_core44.concatLink)(this.endpoint, `/api/v1/ensure-person/${this.workspace}`);
83460
+ const requestUrl = (0, import_core45.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_core44 = require_lib4();
83517
+ var import_core45 = 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_core44.TxOperations(new RestTxClient(restClient, hierarchy, model, account), account.socialIds[0]);
83523
+ return new import_core45.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_core44.toFindResult)(result, data.total);
83544
+ return (0, import_core45.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_core44 = __toESM2(require_lib4());
83726
+ var import_core45 = __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_core44.default.class.Blob,
83763
+ _class: import_core45.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_core44.default.space.Configuration,
83769
- modifiedBy: import_core44.default.account.System,
83768
+ space: import_core45.default.space.Configuration,
83769
+ modifiedBy: import_core45.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_core44.default.class.Blob,
83804
+ _class: import_core45.default.class.Blob,
83805
83805
  _id: fileResult.id,
83806
- space: import_core44.default.space.Configuration,
83806
+ space: import_core45.default.space.Configuration,
83807
83807
  modifiedOn: fileResult.metadata.lastModified,
83808
- modifiedBy: import_core44.default.account.System,
83808
+ modifiedBy: import_core45.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_core44.concatLink)(url4, config3.FILES_URL) : config3.FILES_URL).replace(
83882
+ const filesUrl = (config3.FILES_URL.startsWith("/") ? (0, import_core45.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_core44.concatLink)(url4, config3.UPLOAD_URL) : config3.UPLOAD_URL).replace(":workspace", token.workspaceId);
83886
+ const uploadUrl = (config3.UPLOAD_URL.startsWith("/") ? (0, import_core45.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");
@@ -85481,7 +85481,7 @@ var require_utils11 = __commonJS({
85481
85481
  getWeekday: () => getWeekday
85482
85482
  });
85483
85483
  module2.exports = __toCommonJS2(utils_exports);
85484
- var import_core44 = require_lib4();
85484
+ var import_core45 = require_lib4();
85485
85485
  var import__ = __toESM2(require_lib25());
85486
85486
  function getInstance(event, date7) {
85487
85487
  const diff8 = event.dueDate - event.date;
@@ -85493,7 +85493,7 @@ var require_utils11 = __commonJS({
85493
85493
  originalStartTime: date7,
85494
85494
  _class: import__.default.class.ReccuringInstance,
85495
85495
  eventId: generateEventId3(),
85496
- _id: (0, import_core44.generateId)(),
85496
+ _id: (0, import_core45.generateId)(),
85497
85497
  virtual: true
85498
85498
  };
85499
85499
  }
@@ -85806,7 +85806,7 @@ var require_utils11 = __commonJS({
85806
85806
  }
85807
85807
  __name(getAllEvents, "getAllEvents");
85808
85808
  function generateEventId3() {
85809
- const id = (0, import_core44.generateId)();
85809
+ const id = (0, import_core45.generateId)();
85810
85810
  return encodeToBase32Hex(id);
85811
85811
  }
85812
85812
  __name(generateEventId3, "generateEventId");
@@ -86220,7 +86220,7 @@ var require_utils12 = __commonJS({
86220
86220
  });
86221
86221
  module2.exports = __toCommonJS2(utils_exports);
86222
86222
  var import_fast_equals = require_cjs();
86223
- var import_core44 = __toESM2(require_lib4());
86223
+ var import_core45 = __toESM2(require_lib4());
86224
86224
  var import__ = __toESM2(require_lib27());
86225
86225
  async function getDirectChannel(client, me, employeeAccount) {
86226
86226
  const accIds = [me, employeeAccount].sort();
@@ -86230,7 +86230,7 @@ var require_utils12 = __commonJS({
86230
86230
  return dm._id;
86231
86231
  }
86232
86232
  }
86233
- return await client.createDoc(import__.default.class.DirectMessage, import_core44.default.space.Space, {
86233
+ return await client.createDoc(import__.default.class.DirectMessage, import_core45.default.space.Space, {
86234
86234
  name: "",
86235
86235
  description: "",
86236
86236
  private: true,
@@ -86534,18 +86534,18 @@ var require_cache4 = __commonJS({
86534
86534
  default: () => ContactCache
86535
86535
  });
86536
86536
  module2.exports = __toCommonJS2(cache_exports);
86537
- var import_core44 = __toESM2(require_lib4());
86537
+ var import_core45 = __toESM2(require_lib4());
86538
86538
  var import__ = __toESM2(require_lib28());
86539
86539
  function isCreateTx(tx) {
86540
- return tx._class === import_core44.default.class.TxCreateDoc;
86540
+ return tx._class === import_core45.default.class.TxCreateDoc;
86541
86541
  }
86542
86542
  __name(isCreateTx, "isCreateTx");
86543
86543
  function isUpdateTx(tx) {
86544
- return tx._class === import_core44.default.class.TxUpdateDoc;
86544
+ return tx._class === import_core45.default.class.TxUpdateDoc;
86545
86545
  }
86546
86546
  __name(isUpdateTx, "isUpdateTx");
86547
86547
  function isMixinTx(tx) {
86548
- return tx._class === import_core44.default.class.TxMixin;
86548
+ return tx._class === import_core45.default.class.TxMixin;
86549
86549
  }
86550
86550
  __name(isMixinTx, "isMixinTx");
86551
86551
  function isPersonTx(tx) {
@@ -86652,7 +86652,7 @@ var require_cache4 = __commonJS({
86652
86652
  const ref = tx.objectId;
86653
86653
  const person = this._personByRef.get(ref);
86654
86654
  if (person === void 0) return;
86655
- const createdPerson = import_core44.TxProcessor.createDoc2Doc(tx);
86655
+ const createdPerson = import_core45.TxProcessor.createDoc2Doc(tx);
86656
86656
  this._personByRef.set(ref, createdPerson);
86657
86657
  const personIds = Array.from(this._personIdsByPersonRef.get(ref) ?? []);
86658
86658
  for (const personId of personIds) {
@@ -86670,7 +86670,7 @@ var require_cache4 = __commonJS({
86670
86670
  const newPersonRef = tx.attachedTo;
86671
86671
  this._personRefByPersonId.set(personId, newPersonRef);
86672
86672
  this.addPersonIdToPersonRef(newPersonRef, personId);
86673
- const createdSocialId = import_core44.TxProcessor.createDoc2Doc(tx);
86673
+ const createdSocialId = import_core45.TxProcessor.createDoc2Doc(tx);
86674
86674
  this._socialIdByPersonId.set(personId, createdSocialId);
86675
86675
  this.broadcastChange({
86676
86676
  personRef: newPersonRef,
@@ -86681,7 +86681,7 @@ var require_cache4 = __commonJS({
86681
86681
  const ref = tx.objectId;
86682
86682
  const person = this._personByRef.get(ref);
86683
86683
  if (person == null) return;
86684
- const updatedPerson = isUpdateTx(tx) ? import_core44.TxProcessor.updateDoc2Doc(person, tx) : import_core44.TxProcessor.updateMixin4Doc(person, tx);
86684
+ const updatedPerson = isUpdateTx(tx) ? import_core45.TxProcessor.updateDoc2Doc(person, tx) : import_core45.TxProcessor.updateMixin4Doc(person, tx);
86685
86685
  this._personByRef.set(ref, updatedPerson);
86686
86686
  const personIds = Array.from(this._personIdsByPersonRef.get(ref) ?? []);
86687
86687
  for (const personId of personIds) {
@@ -86796,7 +86796,7 @@ var require_utils13 = __commonJS({
86796
86796
  setCurrentEmployeeSpace: () => setCurrentEmployeeSpace
86797
86797
  });
86798
86798
  module2.exports = __toCommonJS2(utils_exports);
86799
- var import_core44 = require_lib4();
86799
+ var import_core45 = require_lib4();
86800
86800
  var import_platform2 = require_lib21();
86801
86801
  var import__ = __toESM2(require_lib28());
86802
86802
  var import_types12 = require_types9();
@@ -87000,7 +87000,7 @@ var require_utils13 = __commonJS({
87000
87000
  if (socialIds.length === 0) {
87001
87001
  return;
87002
87002
  }
87003
- return (0, import_core44.pickPrimarySocialId)(socialIds)._id;
87003
+ return (0, import_core45.pickPrimarySocialId)(socialIds)._id;
87004
87004
  }
87005
87005
  __name(getPrimarySocialId, "getPrimarySocialId");
87006
87006
  async function getAllSocialStringsByPersonId(client, personId) {
@@ -87039,12 +87039,12 @@ var require_utils13 = __commonJS({
87039
87039
  __name(getSocialStringsByEmployee, "getSocialStringsByEmployee");
87040
87040
  async function getAllAccounts(client) {
87041
87041
  const employees = await client.findAll(import__.default.mixin.Employee, { active: true });
87042
- return employees.map((it) => it.personUuid).filter(import_core44.notEmpty);
87042
+ return employees.map((it) => it.personUuid).filter(import_core45.notEmpty);
87043
87043
  }
87044
87044
  __name(getAllAccounts, "getAllAccounts");
87045
87045
  async function getAllUserAccounts(client) {
87046
87046
  const employees = await client.findAll(import__.default.mixin.Employee, { active: true });
87047
- return employees.map((it) => it.personUuid).filter(import_core44.notEmpty);
87047
+ return employees.map((it) => it.personUuid).filter(import_core45.notEmpty);
87048
87048
  }
87049
87049
  __name(getAllUserAccounts, "getAllUserAccounts");
87050
87050
  async function ensureEmployee(ctx, me, client, socialIds, getGlobalPerson) {
@@ -87053,7 +87053,7 @@ var require_utils13 = __commonJS({
87053
87053
  }
87054
87054
  __name(ensureEmployee, "ensureEmployee");
87055
87055
  async function ensureEmployeeForPerson(ctx, me, person, client, socialIds, globalPerson) {
87056
- const txFactory = new import_core44.TxFactory(me.primarySocialId);
87056
+ const txFactory = new import_core45.TxFactory(me.primarySocialId);
87057
87057
  const personByUuid = await client.findOne(import__.default.class.Person, { personUuid: person.uuid });
87058
87058
  let personRef = personByUuid?._id;
87059
87059
  if (personRef === void 0) {
@@ -87074,7 +87074,7 @@ var require_utils13 = __commonJS({
87074
87074
  city: globalPerson.city,
87075
87075
  avatarType: import__.AvatarType.COLOR
87076
87076
  };
87077
- personRef = (0, import_core44.generateId)();
87077
+ personRef = (0, import_core45.generateId)();
87078
87078
  const createPersonTx = txFactory.createTxCreateDoc(import__.default.class.Person, import__.default.space.Contacts, data, personRef);
87079
87079
  await client.tx(createPersonTx);
87080
87080
  });
@@ -87084,7 +87084,7 @@ var require_utils13 = __commonJS({
87084
87084
  });
87085
87085
  await client.tx(updatePersonTx);
87086
87086
  }
87087
- const existingIdentifiers = (0, import_core44.toIdMap)(
87087
+ const existingIdentifiers = (0, import_core45.toIdMap)(
87088
87088
  await client.findAll(import__.default.class.SocialIdentity, { _id: { $in: person.socialIds } })
87089
87089
  );
87090
87090
  for (const socialId of socialIds) {
@@ -87109,7 +87109,7 @@ var require_utils13 = __commonJS({
87109
87109
  collection: "socialIds",
87110
87110
  type: socialId.type,
87111
87111
  value: socialId.value,
87112
- key: (0, import_core44.buildSocialIdString)(socialId),
87112
+ key: (0, import_core45.buildSocialIdString)(socialId),
87113
87113
  // TODO: fill it in trigger or on DB level as stored calculated column or smth?
87114
87114
  verifiedOn: socialId.verifiedOn,
87115
87115
  isDeleted: socialId.isDeleted
@@ -87150,9 +87150,9 @@ var require_utils13 = __commonJS({
87150
87150
  }
87151
87151
  }
87152
87152
  }
87153
- const employeeRole = person.role === import_core44.AccountRole.Guest || person.role === import_core44.AccountRole.ReadOnlyGuest ? "GUEST" : "USER";
87153
+ const employeeRole = person.role === import_core45.AccountRole.Guest || person.role === import_core45.AccountRole.ReadOnlyGuest ? "GUEST" : "USER";
87154
87154
  const employee = await client.findOne(import__.default.mixin.Employee, { _id: personRef });
87155
- if (employee === void 0 || !import_core44.Hierarchy.hasMixin(employee, import__.default.mixin.Employee) || !employee.active || employee.role !== employeeRole) {
87155
+ if (employee === void 0 || !import_core45.Hierarchy.hasMixin(employee, import__.default.mixin.Employee) || !employee.active || employee.role !== employeeRole) {
87156
87156
  await ctx.with("create-employee", {}, async () => {
87157
87157
  if (personRef === void 0) {
87158
87158
  console.error("Person not found");
@@ -87192,7 +87192,7 @@ var require_utils13 = __commonJS({
87192
87192
  }
87193
87193
  __name(loadCachesForPersonId, "loadCachesForPersonId");
87194
87194
  async function loadCachesForPersonIds(client, personIds) {
87195
- const sidObjsMap = (0, import_core44.toIdMap)(
87195
+ const sidObjsMap = (0, import_core45.toIdMap)(
87196
87196
  await client.findAll(
87197
87197
  import__.default.class.SocialIdentity,
87198
87198
  {
@@ -87227,7 +87227,7 @@ var require_utils13 = __commonJS({
87227
87227
  }
87228
87228
  __name(loadCachesForPersonRef, "loadCachesForPersonRef");
87229
87229
  async function loadCachesForPersonRefs(client, personRefs) {
87230
- const persons = (0, import_core44.toIdMap)(
87230
+ const persons = (0, import_core45.toIdMap)(
87231
87231
  await client.findAll(
87232
87232
  import__.default.class.Person,
87233
87233
  {
@@ -87270,7 +87270,7 @@ var require_utils13 = __commonJS({
87270
87270
  personIds.map((pid) => {
87271
87271
  const ref = contactCache.personRefByPersonId.get(pid);
87272
87272
  return ref != null ? [pid, ref] : void 0;
87273
- }).filter(import_core44.notEmpty)
87273
+ }).filter(import_core45.notEmpty)
87274
87274
  );
87275
87275
  }
87276
87276
  __name(getPersonRefsByPersonIdsFromCache, "getPersonRefsByPersonIdsFromCache");
@@ -87317,7 +87317,7 @@ var require_utils13 = __commonJS({
87317
87317
  personIds.map((pid) => {
87318
87318
  const person = contactCache.personByPersonId.get(pid);
87319
87319
  return person != null ? [pid, person] : void 0;
87320
- }).filter(import_core44.notEmpty)
87320
+ }).filter(import_core45.notEmpty)
87321
87321
  );
87322
87322
  }
87323
87323
  __name(getPersonsByPersonIdsFromCache, "getPersonsByPersonIdsFromCache");
@@ -87364,7 +87364,7 @@ var require_utils13 = __commonJS({
87364
87364
  personRefs.map((personRef) => {
87365
87365
  const person = contactCache.personByRef.get(personRef);
87366
87366
  return person != null ? [personRef, person] : void 0;
87367
- }).filter(import_core44.notEmpty)
87367
+ }).filter(import_core45.notEmpty)
87368
87368
  );
87369
87369
  }
87370
87370
  __name(getPersonsByPersonRefsFromCache, "getPersonsByPersonRefsFromCache");
@@ -87969,9 +87969,9 @@ var require_utils14 = __commonJS({
87969
87969
  getFirstRank: () => getFirstRank
87970
87970
  });
87971
87971
  module2.exports = __toCommonJS2(utils_exports);
87972
- var import_core44 = require_lib4();
87972
+ var import_core45 = require_lib4();
87973
87973
  var import_plugin = __toESM2(require_plugin2());
87974
- async function getFirstRank(client, space, parent, sort3 = import_core44.SortingOrder.Descending, extra = {}) {
87974
+ async function getFirstRank(client, space, parent, sort3 = import_core45.SortingOrder.Descending, extra = {}) {
87975
87975
  const doc = await client.findOne(
87976
87976
  import_plugin.default.class.Document,
87977
87977
  { space, parent, ...extra },
@@ -89594,7 +89594,7 @@ var require_utils16 = __commonJS({
89594
89594
  updateProjectType: () => updateProjectType
89595
89595
  });
89596
89596
  module2.exports = __toCommonJS2(utils_exports);
89597
- var import_core44 = __toESM2(require_lib4());
89597
+ var import_core45 = __toESM2(require_lib4());
89598
89598
  var import_platform2 = require_lib21();
89599
89599
  var import__ = __toESM2(require_lib34());
89600
89600
  var import_rank4 = require_lib33();
@@ -89630,7 +89630,7 @@ var require_utils16 = __commonJS({
89630
89630
  if (exists5 !== void 0) {
89631
89631
  return exists5._id;
89632
89632
  }
89633
- const res = await client.createDoc(_class, import_core44.default.space.Model, data);
89633
+ const res = await client.createDoc(_class, import_core45.default.space.Model, data);
89634
89634
  return res;
89635
89635
  }
89636
89636
  __name(createState, "createState");
@@ -89660,7 +89660,7 @@ var require_utils16 = __commonJS({
89660
89660
  function findStatusAttr(h, _class) {
89661
89661
  const attrs = h.getAllAttributes(_class);
89662
89662
  for (const it of attrs.values()) {
89663
- if (it.type._class === import_core44.default.class.RefTo && h.isDerived(it.type.to, import_core44.default.class.Status)) {
89663
+ if (it.type._class === import_core45.default.class.RefTo && h.isDerived(it.type.to, import_core45.default.class.Status)) {
89664
89664
  return it;
89665
89665
  }
89666
89666
  }
@@ -89692,7 +89692,7 @@ var require_utils16 = __commonJS({
89692
89692
  const targetProjectClassId = `${_id}:type:mixin`;
89693
89693
  const tmpl = await client.createDoc(
89694
89694
  import__.default.class.ProjectType,
89695
- import_core44.default.space.Model,
89695
+ import_core45.default.space.Model,
89696
89696
  {
89697
89697
  description: data.description,
89698
89698
  shortDescription: data.shortDescription,
@@ -89707,17 +89707,17 @@ var require_utils16 = __commonJS({
89707
89707
  _id
89708
89708
  );
89709
89709
  await client.createDoc(
89710
- import_core44.default.class.Mixin,
89711
- import_core44.default.space.Model,
89710
+ import_core45.default.class.Mixin,
89711
+ import_core45.default.space.Model,
89712
89712
  {
89713
89713
  extends: categoryObj.baseClass,
89714
- kind: import_core44.ClassifierKind.MIXIN,
89714
+ kind: import_core45.ClassifierKind.MIXIN,
89715
89715
  label: (0, import_platform2.getEmbeddedLabel)(data.name),
89716
89716
  icon: baseClassClass.icon
89717
89717
  },
89718
89718
  targetProjectClassId
89719
89719
  );
89720
- await client.createMixin(targetProjectClassId, import_core44.default.class.Mixin, import_core44.default.space.Model, import__.default.mixin.ProjectTypeClass, {
89720
+ await client.createMixin(targetProjectClassId, import_core45.default.class.Mixin, import_core45.default.space.Model, import__.default.mixin.ProjectTypeClass, {
89721
89721
  projectType: _id
89722
89722
  });
89723
89723
  return tmpl;
@@ -89776,22 +89776,22 @@ var require_utils16 = __commonJS({
89776
89776
  const targetClassId = `${taskId}:type:mixin`;
89777
89777
  tdata.targetClass = targetClassId;
89778
89778
  await client.createDoc(
89779
- import_core44.default.class.Mixin,
89780
- import_core44.default.space.Model,
89779
+ import_core45.default.class.Mixin,
89780
+ import_core45.default.space.Model,
89781
89781
  {
89782
89782
  extends: data.ofClass,
89783
- kind: import_core44.ClassifierKind.MIXIN,
89783
+ kind: import_core45.ClassifierKind.MIXIN,
89784
89784
  label: ofClassClass.label,
89785
89785
  icon: ofClassClass.icon
89786
89786
  },
89787
89787
  targetClassId
89788
89788
  );
89789
- await client.createMixin(targetClassId, import_core44.default.class.Mixin, import_core44.default.space.Model, import__.default.mixin.TaskTypeClass, {
89789
+ await client.createMixin(targetClassId, import_core45.default.class.Mixin, import_core45.default.space.Model, import__.default.mixin.TaskTypeClass, {
89790
89790
  taskType: taskId,
89791
89791
  projectType: _id
89792
89792
  });
89793
89793
  }
89794
- await client.createDoc(import__.default.class.TaskType, import_core44.default.space.Model, tdata, taskId);
89794
+ await client.createDoc(import__.default.class.TaskType, import_core45.default.space.Model, tdata, taskId);
89795
89795
  tasksData.set(taskId, tdata);
89796
89796
  _tasks.push(taskId);
89797
89797
  }
@@ -172081,7 +172081,7 @@ var PostHog = class extends PostHogBackendClient {
172081
172081
  };
172082
172082
 
172083
172083
  // src/version.ts
172084
- var VERSION = true ? "0.1.60" : "0.0.0-dev";
172084
+ var VERSION = true ? "0.1.62" : "0.0.0-dev";
172085
172085
 
172086
172086
  // src/telemetry/posthog.ts
172087
172087
  var POSTHOG_API_KEY = "phc_TGfFqCGdnF0p68wuFzd5WSw1IsBvOJW0YgoMJDyZPjm";
@@ -172909,10 +172909,10 @@ var parseAddIssueAttachmentParams = Schema_exports.decodeUnknown(AddIssueAttachm
172909
172909
  var parseAddDocumentAttachmentParams = Schema_exports.decodeUnknown(AddDocumentAttachmentParamsSchema);
172910
172910
 
172911
172911
  // src/huly/operations/attachments.ts
172912
- var import_core21 = __toESM(require_lib4(), 1);
172912
+ var import_core23 = __toESM(require_lib4(), 1);
172913
172913
 
172914
172914
  // src/huly/operations/documents.ts
172915
- var import_core20 = __toESM(require_lib4(), 1);
172915
+ var import_core22 = __toESM(require_lib4(), 1);
172916
172916
  var import_rank = __toESM(require_lib33(), 1);
172917
172917
 
172918
172918
  // src/huly/operations/documents-edit.ts
@@ -173001,6 +173001,358 @@ var countOccurrences = (text, search) => {
173001
173001
  return count3;
173002
173002
  };
173003
173003
 
173004
+ // src/huly/operations/documents-inline-comments.ts
173005
+ var import_core21 = __toESM(require_lib4(), 1);
173006
+ var import_text3 = __toESM(require_lib9(), 1);
173007
+
173008
+ // src/huly/operations/channels.ts
173009
+ var import_core20 = __toESM(require_lib4(), 1);
173010
+ var import_text2 = __toESM(require_lib9(), 1);
173011
+ var import_text_markdown2 = __toESM(require_lib17(), 1);
173012
+ var personIdsAsSocialIdentityRefs = (ids3) => ids3;
173013
+ var jsonAsMarkup = import_text2.jsonToMarkup;
173014
+ var findChannel = (identifier2) => Effect_exports.gen(function* () {
173015
+ const client = yield* HulyClient;
173016
+ const channel = yield* findByNameOrId(
173017
+ client,
173018
+ chunter.class.Channel,
173019
+ { name: identifier2 },
173020
+ { _id: toRef(identifier2) }
173021
+ );
173022
+ if (channel === void 0) {
173023
+ return yield* new ChannelNotFoundError({ identifier: identifier2 });
173024
+ }
173025
+ return { client, channel };
173026
+ });
173027
+ var markupToMarkdownString = (markup) => {
173028
+ const json3 = (0, import_text2.markupToJSON)(markup);
173029
+ return (0, import_text_markdown2.markupToMarkdown)(json3, { refUrl: "", imageUrl: "" });
173030
+ };
173031
+ var markdownToMarkupString = (markdown) => {
173032
+ const json3 = (0, import_text_markdown2.markdownToMarkup)(markdown, { refUrl: "", imageUrl: "" });
173033
+ return jsonAsMarkup(json3);
173034
+ };
173035
+ var buildSocialIdToPersonNameMap = (client, socialIds) => Effect_exports.gen(function* () {
173036
+ if (socialIds.length === 0) {
173037
+ return /* @__PURE__ */ new Map();
173038
+ }
173039
+ const socialIdentities = yield* client.findAll(
173040
+ contact.class.SocialIdentity,
173041
+ { _id: { $in: personIdsAsSocialIdentityRefs(socialIds) } }
173042
+ );
173043
+ if (socialIdentities.length === 0) {
173044
+ return /* @__PURE__ */ new Map();
173045
+ }
173046
+ const personRefs = [...new Set(socialIdentities.map((si) => si.attachedTo))];
173047
+ const persons = yield* client.findAll(
173048
+ contact.class.Person,
173049
+ { _id: { $in: personRefs } }
173050
+ );
173051
+ const personById = new Map(persons.map((p) => [p._id, p]));
173052
+ const result = /* @__PURE__ */ new Map();
173053
+ for (const si of socialIdentities) {
173054
+ const person = personById.get(si.attachedTo);
173055
+ if (person !== void 0) {
173056
+ result.set(si._id, person.name);
173057
+ }
173058
+ }
173059
+ return result;
173060
+ });
173061
+ var buildAccountUuidToNameMap = (client, accountUuids) => Effect_exports.gen(function* () {
173062
+ if (accountUuids.length === 0) {
173063
+ return /* @__PURE__ */ new Map();
173064
+ }
173065
+ const employees = yield* client.findAll(
173066
+ contact.mixin.Employee,
173067
+ { personUuid: { $in: accountUuids } }
173068
+ );
173069
+ const result = /* @__PURE__ */ new Map();
173070
+ for (const emp of employees) {
173071
+ if (emp.personUuid !== void 0) {
173072
+ result.set(emp.personUuid, emp.name);
173073
+ }
173074
+ }
173075
+ return result;
173076
+ });
173077
+ var listChannels = (params) => Effect_exports.gen(function* () {
173078
+ const client = yield* HulyClient;
173079
+ const query = {};
173080
+ if (!params.includeArchived) {
173081
+ query.archived = false;
173082
+ }
173083
+ if (params.nameSearch !== void 0 && params.nameSearch.trim() !== "") {
173084
+ query.name = { $like: `%${escapeLikeWildcards(params.nameSearch)}%` };
173085
+ }
173086
+ if (params.nameRegex !== void 0 && params.nameRegex.trim() !== "") {
173087
+ query.name = { $regex: params.nameRegex };
173088
+ }
173089
+ if (params.topicSearch !== void 0 && params.topicSearch.trim() !== "") {
173090
+ query.topic = { $like: `%${escapeLikeWildcards(params.topicSearch)}%` };
173091
+ }
173092
+ const limit = clampLimit(params.limit);
173093
+ const channels = yield* client.findAll(
173094
+ chunter.class.Channel,
173095
+ query,
173096
+ {
173097
+ limit,
173098
+ sort: {
173099
+ name: import_core20.SortingOrder.Ascending
173100
+ }
173101
+ }
173102
+ );
173103
+ const summaries = channels.map((ch) => ({
173104
+ id: ChannelId.make(ch._id),
173105
+ name: ChannelName.make(ch.name),
173106
+ topic: ch.topic || void 0,
173107
+ private: ch.private,
173108
+ archived: ch.archived,
173109
+ members: ch.members.length,
173110
+ messages: ch.messages,
173111
+ modifiedOn: ch.modifiedOn
173112
+ }));
173113
+ return summaries;
173114
+ });
173115
+ var getChannel = (params) => Effect_exports.gen(function* () {
173116
+ const { channel, client } = yield* findChannel(params.channel);
173117
+ const memberNames = channel.members.length > 0 ? yield* Effect_exports.gen(function* () {
173118
+ const accountUuidToName = yield* buildAccountUuidToNameMap(client, channel.members);
173119
+ return channel.members.map((m) => accountUuidToName.get(m)).filter((n) => n !== void 0);
173120
+ }) : void 0;
173121
+ const result = {
173122
+ id: ChannelId.make(channel._id),
173123
+ name: ChannelName.make(channel.name),
173124
+ topic: channel.topic || void 0,
173125
+ description: channel.description || void 0,
173126
+ private: channel.private,
173127
+ archived: channel.archived,
173128
+ members: memberNames?.map((m) => PersonName.make(m)),
173129
+ messages: channel.messages,
173130
+ modifiedOn: channel.modifiedOn,
173131
+ createdOn: channel.createdOn
173132
+ };
173133
+ return result;
173134
+ });
173135
+ var createChannel = (params) => Effect_exports.gen(function* () {
173136
+ const client = yield* HulyClient;
173137
+ const channelId = (0, import_core20.generateId)();
173138
+ const channelData = {
173139
+ name: params.name,
173140
+ topic: params.topic || "",
173141
+ description: "",
173142
+ private: params.private ?? false,
173143
+ archived: false,
173144
+ members: [client.getAccountUuid()],
173145
+ owners: [client.getAccountUuid()]
173146
+ };
173147
+ yield* client.createDoc(
173148
+ chunter.class.Channel,
173149
+ toRef(channelId),
173150
+ channelData,
173151
+ channelId
173152
+ );
173153
+ return { id: ChannelId.make(channelId), name: ChannelName.make(params.name) };
173154
+ });
173155
+ var updateChannel = (params) => Effect_exports.gen(function* () {
173156
+ const { channel, client } = yield* findChannel(params.channel);
173157
+ const updateOps = {};
173158
+ if (params.name !== void 0) {
173159
+ updateOps.name = params.name;
173160
+ }
173161
+ if (params.topic !== void 0) {
173162
+ updateOps.topic = params.topic;
173163
+ }
173164
+ if (Object.keys(updateOps).length === 0) {
173165
+ return { id: ChannelId.make(channel._id), updated: false };
173166
+ }
173167
+ yield* client.updateDoc(
173168
+ chunter.class.Channel,
173169
+ toRef(channel._id),
173170
+ channel._id,
173171
+ updateOps
173172
+ );
173173
+ return { id: ChannelId.make(channel._id), updated: true };
173174
+ });
173175
+ var deleteChannel = (params) => Effect_exports.gen(function* () {
173176
+ const { channel, client } = yield* findChannel(params.channel);
173177
+ yield* client.removeDoc(
173178
+ chunter.class.Channel,
173179
+ toRef(channel._id),
173180
+ channel._id
173181
+ );
173182
+ return { id: ChannelId.make(channel._id), deleted: true };
173183
+ });
173184
+ var listChannelMessages = (params) => Effect_exports.gen(function* () {
173185
+ const { channel, client } = yield* findChannel(params.channel);
173186
+ const limit = clampLimit(params.limit);
173187
+ const messages = yield* client.findAll(
173188
+ chunter.class.ChatMessage,
173189
+ {
173190
+ space: channel._id
173191
+ },
173192
+ {
173193
+ limit,
173194
+ sort: {
173195
+ createdOn: import_core20.SortingOrder.Descending
173196
+ }
173197
+ }
173198
+ );
173199
+ const total = messages.total;
173200
+ const uniqueSocialIds = [
173201
+ ...new Set(
173202
+ messages.map((msg) => msg.modifiedBy)
173203
+ )
173204
+ ];
173205
+ const socialIdToName = yield* buildSocialIdToPersonNameMap(client, uniqueSocialIds);
173206
+ const summaries = messages.map((msg) => {
173207
+ const senderName = socialIdToName.get(msg.modifiedBy);
173208
+ return {
173209
+ id: MessageId.make(msg._id),
173210
+ body: markupToMarkdownString(msg.message),
173211
+ sender: senderName !== void 0 ? PersonName.make(senderName) : void 0,
173212
+ senderId: msg.modifiedBy,
173213
+ createdOn: msg.createdOn,
173214
+ modifiedOn: msg.modifiedOn,
173215
+ editedOn: msg.editedOn,
173216
+ replies: msg.replies
173217
+ };
173218
+ });
173219
+ return { messages: summaries, total };
173220
+ });
173221
+ var sendChannelMessage = (params) => Effect_exports.gen(function* () {
173222
+ const { channel, client } = yield* findChannel(params.channel);
173223
+ const messageId = (0, import_core20.generateId)();
173224
+ const markup = markdownToMarkupString(params.body);
173225
+ const messageData = {
173226
+ message: markup,
173227
+ attachments: 0
173228
+ };
173229
+ yield* client.addCollection(
173230
+ chunter.class.ChatMessage,
173231
+ channel._id,
173232
+ channel._id,
173233
+ chunter.class.Channel,
173234
+ "messages",
173235
+ messageData,
173236
+ messageId
173237
+ );
173238
+ return { id: MessageId.make(messageId), channelId: ChannelId.make(channel._id) };
173239
+ });
173240
+ var listDirectMessages = (params) => Effect_exports.gen(function* () {
173241
+ const client = yield* HulyClient;
173242
+ const limit = clampLimit(params.limit);
173243
+ const dms = yield* client.findAll(
173244
+ chunter.class.DirectMessage,
173245
+ {},
173246
+ {
173247
+ limit,
173248
+ sort: {
173249
+ modifiedOn: import_core20.SortingOrder.Descending
173250
+ }
173251
+ }
173252
+ );
173253
+ const total = dms.total;
173254
+ const uniqueAccountUuids = [
173255
+ ...new Set(
173256
+ dms.flatMap((dm) => dm.members)
173257
+ )
173258
+ ];
173259
+ const accountUuidToName = yield* buildAccountUuidToNameMap(client, uniqueAccountUuids);
173260
+ const summaries = dms.map((dm) => {
173261
+ const participants = dm.members.map((m) => accountUuidToName.get(m)).filter((n) => n !== void 0).map((n) => PersonName.make(n));
173262
+ const participantIds = dm.members.map((m) => AccountUuid.make(m));
173263
+ return {
173264
+ id: ChannelId.make(dm._id),
173265
+ participants,
173266
+ participantIds,
173267
+ messages: dm.messages,
173268
+ modifiedOn: dm.modifiedOn
173269
+ };
173270
+ });
173271
+ return { conversations: summaries, total };
173272
+ });
173273
+
173274
+ // src/huly/operations/documents-inline-comments.ts
173275
+ var INLINE_COMMENT_MARK_TYPE = "inline-comment";
173276
+ var extractInlineComments = (root) => {
173277
+ const threadMap = /* @__PURE__ */ new Map();
173278
+ (0, import_text3.traverseAllMarks)(root, (textNode, mark) => {
173279
+ if (String(mark.type) !== INLINE_COMMENT_MARK_TYPE) return;
173280
+ const threadId = mark.attrs?.thread;
173281
+ if (typeof threadId !== "string" || threadId === "") return;
173282
+ const text = textNode.text ?? "";
173283
+ if (!threadMap.has(threadId)) {
173284
+ threadMap.set(threadId, []);
173285
+ }
173286
+ threadMap.get(threadId)?.push(text);
173287
+ });
173288
+ return [...threadMap.entries()].map(([threadId, textFragments]) => ({
173289
+ threadId,
173290
+ textFragments
173291
+ }));
173292
+ };
173293
+ var listInlineComments = (params) => Effect_exports.gen(function* () {
173294
+ const { client, doc } = yield* findTeamspaceAndDocument({
173295
+ teamspace: params.teamspace,
173296
+ document: params.document
173297
+ });
173298
+ if (!doc.content) {
173299
+ return { comments: [], total: 0 };
173300
+ }
173301
+ const rawMarkup = yield* client.fetchMarkup(
173302
+ doc._class,
173303
+ doc._id,
173304
+ "content",
173305
+ doc.content,
173306
+ "markup"
173307
+ );
173308
+ const root = (0, import_text3.markupToJSON)(rawMarkup);
173309
+ const extracted = extractInlineComments(root);
173310
+ if (extracted.length === 0) {
173311
+ return { comments: [], total: 0 };
173312
+ }
173313
+ let nameMap = /* @__PURE__ */ new Map();
173314
+ const threadRepliesMap = /* @__PURE__ */ new Map();
173315
+ if (params.includeReplies) {
173316
+ const threadIds = extracted.map((c) => toRef(c.threadId));
173317
+ const allReplies = yield* client.findAll(
173318
+ chunter.class.ThreadMessage,
173319
+ { attachedTo: { $in: threadIds } },
173320
+ { sort: { createdOn: import_core21.SortingOrder.Ascending } }
173321
+ );
173322
+ for (const r of allReplies) {
173323
+ const key = r.attachedTo;
173324
+ if (!threadRepliesMap.has(key)) {
173325
+ threadRepliesMap.set(key, []);
173326
+ }
173327
+ threadRepliesMap.get(key)?.push(r);
173328
+ }
173329
+ const senderIds = [
173330
+ ...new Set(
173331
+ allReplies.map((r) => r.createdBy).filter((id) => id !== void 0)
173332
+ )
173333
+ ];
173334
+ nameMap = yield* buildSocialIdToPersonNameMap(client, senderIds);
173335
+ }
173336
+ const comments = extracted.map((comment) => {
173337
+ const thread = {
173338
+ threadId: comment.threadId,
173339
+ text: comment.textFragments.join("")
173340
+ };
173341
+ if (params.includeReplies) {
173342
+ const threadReplies = threadRepliesMap.get(comment.threadId) ?? [];
173343
+ const replies = threadReplies.map((r) => ({
173344
+ id: r._id,
173345
+ body: r.message ? markupToMarkdownString(r.message) : "",
173346
+ sender: r.createdBy !== void 0 ? nameMap.get(r.createdBy) : void 0,
173347
+ createdOn: r.createdOn
173348
+ }));
173349
+ return { ...thread, replies };
173350
+ }
173351
+ return thread;
173352
+ });
173353
+ return { comments, total: comments.length };
173354
+ });
173355
+
173004
173356
  // src/huly/operations/documents.ts
173005
173357
  var findTeamspace = (identifier2, opts) => Effect_exports.gen(function* () {
173006
173358
  const client = yield* HulyClient;
@@ -173050,7 +173402,7 @@ var listTeamspaces = (params) => Effect_exports.gen(function* () {
173050
173402
  {
173051
173403
  limit,
173052
173404
  sort: {
173053
- name: import_core20.SortingOrder.Ascending
173405
+ name: import_core22.SortingOrder.Ascending
173054
173406
  }
173055
173407
  }
173056
173408
  );
@@ -173096,7 +173448,7 @@ var createTeamspace = (params) => Effect_exports.gen(function* () {
173096
173448
  created: false
173097
173449
  };
173098
173450
  }
173099
- const teamspaceId = (0, import_core20.generateId)();
173451
+ const teamspaceId = (0, import_core22.generateId)();
173100
173452
  const teamspaceData = {
173101
173453
  name: params.name,
173102
173454
  description: params.description ?? "",
@@ -173172,7 +173524,7 @@ var listDocuments = (params) => Effect_exports.gen(function* () {
173172
173524
  {
173173
173525
  limit,
173174
173526
  sort: {
173175
- modifiedOn: import_core20.SortingOrder.Descending
173527
+ modifiedOn: import_core22.SortingOrder.Descending
173176
173528
  }
173177
173529
  }
173178
173530
  );
@@ -173212,11 +173564,11 @@ var getDocument = (params) => Effect_exports.gen(function* () {
173212
173564
  });
173213
173565
  var createDocument = (params) => Effect_exports.gen(function* () {
173214
173566
  const { client, teamspace } = yield* findTeamspace(params.teamspace);
173215
- const documentId = (0, import_core20.generateId)();
173567
+ const documentId = (0, import_core22.generateId)();
173216
173568
  const lastDoc = yield* client.findOne(
173217
173569
  documentPlugin.class.Document,
173218
173570
  { space: teamspace._id },
173219
- { sort: { rank: import_core20.SortingOrder.Descending } }
173571
+ { sort: { rank: import_core22.SortingOrder.Descending } }
173220
173572
  );
173221
173573
  const rank = (0, import_rank.makeRank)(lastDoc?.rank, void 0);
173222
173574
  const contentMarkupRef = params.content !== void 0 && params.content.trim() !== "" ? yield* client.uploadMarkup(
@@ -173286,7 +173638,7 @@ var uploadAndAttach = (params, parent) => Effect_exports.gen(function* () {
173286
173638
  buffer,
173287
173639
  params.contentType
173288
173640
  );
173289
- const attachmentId = (0, import_core21.generateId)();
173641
+ const attachmentId = (0, import_core23.generateId)();
173290
173642
  const now2 = yield* Clock_exports.currentTimeMillis;
173291
173643
  const attachmentData = {
173292
173644
  name: params.filename,
@@ -173324,7 +173676,7 @@ var listAttachments = (params) => Effect_exports.gen(function* () {
173324
173676
  {
173325
173677
  limit,
173326
173678
  sort: {
173327
- modifiedOn: import_core21.SortingOrder.Descending
173679
+ modifiedOn: import_core23.SortingOrder.Descending
173328
173680
  }
173329
173681
  }
173330
173682
  );
@@ -173805,7 +174157,7 @@ var parseListEventInstancesParams = Schema_exports.decodeUnknown(ListEventInstan
173805
174157
 
173806
174158
  // src/huly/operations/calendar.ts
173807
174159
  var import_calendar2 = __toESM(require_lib25(), 1);
173808
- var import_core23 = __toESM(require_lib4(), 1);
174160
+ var import_core25 = __toESM(require_lib4(), 1);
173809
174161
 
173810
174162
  // src/huly/operations/calendar-shared.ts
173811
174163
  var descriptionAsMarkupRef = (desc) => desc;
@@ -173863,7 +174215,7 @@ var resolveEventInputs = (client, params, eventClass, eventId) => Effect_exports
173863
174215
 
173864
174216
  // src/huly/operations/calendar-recurring.ts
173865
174217
  var import_calendar = __toESM(require_lib25(), 1);
173866
- var import_core22 = __toESM(require_lib4(), 1);
174218
+ var import_core24 = __toESM(require_lib4(), 1);
173867
174219
  var hulyRuleToRule = (rule) => ({
173868
174220
  freq: rule.freq,
173869
174221
  endDate: rule.endDate,
@@ -173897,7 +174249,7 @@ var listRecurringEvents = (params) => Effect_exports.gen(function* () {
173897
174249
  {},
173898
174250
  {
173899
174251
  limit,
173900
- sort: { modifiedOn: import_core22.SortingOrder.Descending }
174252
+ sort: { modifiedOn: import_core24.SortingOrder.Descending }
173901
174253
  }
173902
174254
  );
173903
174255
  const summaries = events.map((event) => ({
@@ -173983,7 +174335,7 @@ var listEventInstances = (params) => Effect_exports.gen(function* () {
173983
174335
  query,
173984
174336
  {
173985
174337
  limit,
173986
- sort: { date: import_core22.SortingOrder.Ascending }
174338
+ sort: { date: import_core24.SortingOrder.Ascending }
173987
174339
  }
173988
174340
  );
173989
174341
  const participantMap = /* @__PURE__ */ new Map();
@@ -174036,7 +174388,7 @@ var listEvents = (params) => Effect_exports.gen(function* () {
174036
174388
  query,
174037
174389
  {
174038
174390
  limit,
174039
- sort: { date: import_core23.SortingOrder.Ascending }
174391
+ sort: { date: import_core25.SortingOrder.Ascending }
174040
174392
  }
174041
174393
  );
174042
174394
  const summaries = events.map((event) => ({
@@ -174362,12 +174714,26 @@ var UpdateProjectParamsSchema = Schema_exports.Struct({
174362
174714
  var DeleteProjectParamsSchema = Schema_exports.Struct({
174363
174715
  project: ProjectIdentifier.annotations({ description: "Project identifier to delete" })
174364
174716
  }).annotations({ title: "DeleteProjectParams", description: "Parameters for deleting a project" });
174717
+ var ListStatusesParamsSchema = Schema_exports.Struct({
174718
+ project: ProjectIdentifier.annotations({ description: "Project identifier (e.g., 'HULY')" })
174719
+ }).annotations({ title: "ListStatusesParams", description: "Parameters for listing project statuses" });
174720
+ var StatusDetailSchema = Schema_exports.Struct({
174721
+ name: StatusName,
174722
+ isDone: Schema_exports.Boolean,
174723
+ isCanceled: Schema_exports.Boolean,
174724
+ isDefault: Schema_exports.Boolean
174725
+ }).annotations({
174726
+ title: "StatusDetail",
174727
+ description: "Issue status with category and default info"
174728
+ });
174365
174729
  var listProjectsParamsJsonSchema = JSONSchema_exports.make(ListProjectsParamsSchema);
174730
+ var listStatusesParamsJsonSchema = JSONSchema_exports.make(ListStatusesParamsSchema);
174366
174731
  var getProjectParamsJsonSchema = JSONSchema_exports.make(GetProjectParamsSchema);
174367
174732
  var createProjectParamsJsonSchema = JSONSchema_exports.make(CreateProjectParamsSchema);
174368
174733
  var updateProjectParamsJsonSchema = JSONSchema_exports.make(UpdateProjectParamsSchema);
174369
174734
  var deleteProjectParamsJsonSchema = JSONSchema_exports.make(DeleteProjectParamsSchema);
174370
174735
  var parseListProjectsParams = Schema_exports.decodeUnknown(ListProjectsParamsSchema);
174736
+ var parseListStatusesParams = Schema_exports.decodeUnknown(ListStatusesParamsSchema);
174371
174737
  var parseGetProjectParams = Schema_exports.decodeUnknown(GetProjectParamsSchema);
174372
174738
  var parseCreateProjectParams = Schema_exports.decodeUnknown(CreateProjectParamsSchema);
174373
174739
  var parseUpdateProjectParams = Schema_exports.decodeUnknown(UpdateProjectParamsSchema);
@@ -174542,7 +174908,8 @@ var PersonRefSchema = Schema_exports.Struct({
174542
174908
  });
174543
174909
  var IssueSummarySchema = Schema_exports.Struct({
174544
174910
  identifier: IssueIdentifier,
174545
- title: NonEmptyString2,
174911
+ // String, not NonEmptyString: Huly allows storing issues with empty titles
174912
+ title: Schema_exports.String,
174546
174913
  status: StatusName,
174547
174914
  priority: Schema_exports.optional(IssuePrioritySchema),
174548
174915
  assignee: Schema_exports.optional(PersonName),
@@ -174555,7 +174922,8 @@ var IssueSummarySchema = Schema_exports.Struct({
174555
174922
  });
174556
174923
  var IssueSchema = Schema_exports.Struct({
174557
174924
  identifier: IssueIdentifier,
174558
- title: NonEmptyString2,
174925
+ // String, not NonEmptyString: Huly allows storing issues with empty titles
174926
+ title: Schema_exports.String,
174559
174927
  description: Schema_exports.optional(Schema_exports.String),
174560
174928
  status: StatusName,
174561
174929
  priority: Schema_exports.optional(IssuePrioritySchema),
@@ -175503,6 +175871,20 @@ var DeleteTeamspaceParamsSchema = Schema_exports.Struct({
175503
175871
  title: "DeleteTeamspaceParams",
175504
175872
  description: "Parameters for deleting a teamspace"
175505
175873
  });
175874
+ var ListInlineCommentsParamsSchema = Schema_exports.Struct({
175875
+ teamspace: TeamspaceIdentifier.annotations({
175876
+ description: "Teamspace name or ID"
175877
+ }),
175878
+ document: DocumentIdentifier.annotations({
175879
+ description: "Document title or ID"
175880
+ }),
175881
+ includeReplies: Schema_exports.optional(Schema_exports.Boolean.annotations({
175882
+ description: "Include thread reply messages for each inline comment (default: false)"
175883
+ }))
175884
+ }).annotations({
175885
+ title: "ListInlineCommentsParams",
175886
+ description: "Parameters for listing inline comment threads in a document"
175887
+ });
175506
175888
  var listTeamspacesParamsJsonSchema = JSONSchema_exports.make(ListTeamspacesParamsSchema);
175507
175889
  var getTeamspaceParamsJsonSchema = JSONSchema_exports.make(GetTeamspaceParamsSchema);
175508
175890
  var createTeamspaceParamsJsonSchema = JSONSchema_exports.make(CreateTeamspaceParamsSchema);
@@ -175512,6 +175894,7 @@ var listDocumentsParamsJsonSchema = JSONSchema_exports.make(ListDocumentsParamsS
175512
175894
  var getDocumentParamsJsonSchema = JSONSchema_exports.make(GetDocumentParamsSchema);
175513
175895
  var createDocumentParamsJsonSchema = JSONSchema_exports.make(CreateDocumentParamsSchema);
175514
175896
  var editDocumentParamsJsonSchema = JSONSchema_exports.make(EditDocumentParamsSchema);
175897
+ var listInlineCommentsParamsJsonSchema = JSONSchema_exports.make(ListInlineCommentsParamsSchema);
175515
175898
  var deleteDocumentParamsJsonSchema = JSONSchema_exports.make(DeleteDocumentParamsSchema);
175516
175899
  var parseListTeamspacesParams = Schema_exports.decodeUnknown(ListTeamspacesParamsSchema);
175517
175900
  var parseGetTeamspaceParams = Schema_exports.decodeUnknown(GetTeamspaceParamsSchema);
@@ -175522,6 +175905,7 @@ var parseListDocumentsParams = Schema_exports.decodeUnknown(ListDocumentsParamsS
175522
175905
  var parseGetDocumentParams = Schema_exports.decodeUnknown(GetDocumentParamsSchema);
175523
175906
  var parseCreateDocumentParams = Schema_exports.decodeUnknown(CreateDocumentParamsSchema);
175524
175907
  var parseEditDocumentParams = Schema_exports.decodeUnknown(EditDocumentParamsSchema);
175908
+ var parseListInlineCommentsParams = Schema_exports.decodeUnknown(ListInlineCommentsParamsSchema);
175525
175909
  var parseDeleteDocumentParams = Schema_exports.decodeUnknown(DeleteDocumentParamsSchema);
175526
175910
 
175527
175911
  // src/domain/schemas/storage.ts
@@ -176328,6 +176712,34 @@ var parseAddIssueRelationParams = Schema_exports.decodeUnknown(AddIssueRelationP
176328
176712
  var parseRemoveIssueRelationParams = Schema_exports.decodeUnknown(RemoveIssueRelationParamsSchema);
176329
176713
  var parseListIssueRelationsParams = Schema_exports.decodeUnknown(ListIssueRelationsParamsSchema);
176330
176714
 
176715
+ // src/domain/schemas/document-relations.ts
176716
+ var docRelationFields = {
176717
+ project: ProjectIdentifier.annotations({
176718
+ description: "Project identifier of the issue (e.g., 'HULY')"
176719
+ }),
176720
+ issueIdentifier: IssueIdentifier.annotations({
176721
+ description: "Issue identifier (e.g., 'HULY-123')"
176722
+ }),
176723
+ teamspace: TeamspaceIdentifier.annotations({
176724
+ description: "Teamspace containing the document (name or ID)"
176725
+ }),
176726
+ document: DocumentIdentifier.annotations({
176727
+ description: "Document to link (title or ID)"
176728
+ })
176729
+ };
176730
+ var LinkDocumentToIssueParamsSchema = Schema_exports.Struct(docRelationFields).annotations({
176731
+ title: "LinkDocumentToIssueParams",
176732
+ description: "Parameters for linking a document to an issue"
176733
+ });
176734
+ var UnlinkDocumentFromIssueParamsSchema = Schema_exports.Struct(docRelationFields).annotations({
176735
+ title: "UnlinkDocumentFromIssueParams",
176736
+ description: "Parameters for unlinking a document from an issue"
176737
+ });
176738
+ var linkDocumentToIssueParamsJsonSchema = JSONSchema_exports.make(LinkDocumentToIssueParamsSchema);
176739
+ var unlinkDocumentFromIssueParamsJsonSchema = JSONSchema_exports.make(UnlinkDocumentFromIssueParamsSchema);
176740
+ var parseLinkDocumentToIssueParams = Schema_exports.decodeUnknown(LinkDocumentToIssueParamsSchema);
176741
+ var parseUnlinkDocumentFromIssueParams = Schema_exports.decodeUnknown(UnlinkDocumentFromIssueParamsSchema);
176742
+
176331
176743
  // src/domain/schemas/notifications.ts
176332
176744
  var ListNotificationsParamsSchema = Schema_exports.Struct({
176333
176745
  limit: Schema_exports.optional(
@@ -176999,7 +177411,7 @@ var parseDeleteTestResultParams = Schema_exports.decodeUnknown(DeleteTestResultP
176999
177411
  var parseRunTestPlanParams = Schema_exports.decodeUnknown(RunTestPlanParamsSchema);
177000
177412
 
177001
177413
  // src/huly/operations/cards.ts
177002
- var import_core24 = __toESM(require_lib4(), 1);
177414
+ var import_core26 = __toESM(require_lib4(), 1);
177003
177415
  var import_rank2 = __toESM(require_lib33(), 1);
177004
177416
  var findCardSpace = (identifier2) => Effect_exports.gen(function* () {
177005
177417
  const client = yield* HulyClient;
@@ -177064,7 +177476,7 @@ var listCardSpaces = (params) => Effect_exports.gen(function* () {
177064
177476
  {
177065
177477
  limit,
177066
177478
  sort: {
177067
- name: import_core24.SortingOrder.Ascending
177479
+ name: import_core26.SortingOrder.Ascending
177068
177480
  }
177069
177481
  }
177070
177482
  );
@@ -177123,7 +177535,7 @@ var listCards = (params) => Effect_exports.gen(function* () {
177123
177535
  {
177124
177536
  limit,
177125
177537
  sort: {
177126
- modifiedOn: import_core24.SortingOrder.Descending
177538
+ modifiedOn: import_core26.SortingOrder.Descending
177127
177539
  }
177128
177540
  }
177129
177541
  );
@@ -177165,11 +177577,11 @@ var getCard = (params) => Effect_exports.gen(function* () {
177165
177577
  var createCard = (params) => Effect_exports.gen(function* () {
177166
177578
  const { cardSpace, client } = yield* findCardSpace(params.cardSpace);
177167
177579
  const masterTag = yield* findMasterTag(client, cardSpace, params.type);
177168
- const cardId = (0, import_core24.generateId)();
177580
+ const cardId = (0, import_core26.generateId)();
177169
177581
  const lastCard = yield* client.findOne(
177170
177582
  cardPlugin.class.Card,
177171
177583
  { space: cardSpace._id },
177172
- { sort: { rank: import_core24.SortingOrder.Descending } }
177584
+ { sort: { rank: import_core26.SortingOrder.Descending } }
177173
177585
  );
177174
177586
  const rank = (0, import_rank2.makeRank)(lastCard?.rank, void 0);
177175
177587
  const contentMarkupRef = yield* client.uploadMarkup(
@@ -177356,274 +177768,8 @@ var cardTools = [
177356
177768
  }
177357
177769
  ];
177358
177770
 
177359
- // src/huly/operations/channels.ts
177360
- var import_core25 = __toESM(require_lib4(), 1);
177361
- var import_text2 = __toESM(require_lib9(), 1);
177362
- var import_text_markdown2 = __toESM(require_lib17(), 1);
177363
- var personIdsAsSocialIdentityRefs = (ids3) => ids3;
177364
- var jsonAsMarkup = import_text2.jsonToMarkup;
177365
- var findChannel = (identifier2) => Effect_exports.gen(function* () {
177366
- const client = yield* HulyClient;
177367
- const channel = yield* findByNameOrId(
177368
- client,
177369
- chunter.class.Channel,
177370
- { name: identifier2 },
177371
- { _id: toRef(identifier2) }
177372
- );
177373
- if (channel === void 0) {
177374
- return yield* new ChannelNotFoundError({ identifier: identifier2 });
177375
- }
177376
- return { client, channel };
177377
- });
177378
- var markupToMarkdownString = (markup) => {
177379
- const json3 = (0, import_text2.markupToJSON)(markup);
177380
- return (0, import_text_markdown2.markupToMarkdown)(json3, { refUrl: "", imageUrl: "" });
177381
- };
177382
- var markdownToMarkupString = (markdown) => {
177383
- const json3 = (0, import_text_markdown2.markdownToMarkup)(markdown, { refUrl: "", imageUrl: "" });
177384
- return jsonAsMarkup(json3);
177385
- };
177386
- var buildSocialIdToPersonNameMap = (client, socialIds) => Effect_exports.gen(function* () {
177387
- if (socialIds.length === 0) {
177388
- return /* @__PURE__ */ new Map();
177389
- }
177390
- const socialIdentities = yield* client.findAll(
177391
- contact.class.SocialIdentity,
177392
- { _id: { $in: personIdsAsSocialIdentityRefs(socialIds) } }
177393
- );
177394
- if (socialIdentities.length === 0) {
177395
- return /* @__PURE__ */ new Map();
177396
- }
177397
- const personRefs = [...new Set(socialIdentities.map((si) => si.attachedTo))];
177398
- const persons = yield* client.findAll(
177399
- contact.class.Person,
177400
- { _id: { $in: personRefs } }
177401
- );
177402
- const personById = new Map(persons.map((p) => [p._id, p]));
177403
- const result = /* @__PURE__ */ new Map();
177404
- for (const si of socialIdentities) {
177405
- const person = personById.get(si.attachedTo);
177406
- if (person !== void 0) {
177407
- result.set(si._id, person.name);
177408
- }
177409
- }
177410
- return result;
177411
- });
177412
- var buildAccountUuidToNameMap = (client, accountUuids) => Effect_exports.gen(function* () {
177413
- if (accountUuids.length === 0) {
177414
- return /* @__PURE__ */ new Map();
177415
- }
177416
- const employees = yield* client.findAll(
177417
- contact.mixin.Employee,
177418
- { personUuid: { $in: accountUuids } }
177419
- );
177420
- const result = /* @__PURE__ */ new Map();
177421
- for (const emp of employees) {
177422
- if (emp.personUuid !== void 0) {
177423
- result.set(emp.personUuid, emp.name);
177424
- }
177425
- }
177426
- return result;
177427
- });
177428
- var listChannels = (params) => Effect_exports.gen(function* () {
177429
- const client = yield* HulyClient;
177430
- const query = {};
177431
- if (!params.includeArchived) {
177432
- query.archived = false;
177433
- }
177434
- if (params.nameSearch !== void 0 && params.nameSearch.trim() !== "") {
177435
- query.name = { $like: `%${escapeLikeWildcards(params.nameSearch)}%` };
177436
- }
177437
- if (params.nameRegex !== void 0 && params.nameRegex.trim() !== "") {
177438
- query.name = { $regex: params.nameRegex };
177439
- }
177440
- if (params.topicSearch !== void 0 && params.topicSearch.trim() !== "") {
177441
- query.topic = { $like: `%${escapeLikeWildcards(params.topicSearch)}%` };
177442
- }
177443
- const limit = clampLimit(params.limit);
177444
- const channels = yield* client.findAll(
177445
- chunter.class.Channel,
177446
- query,
177447
- {
177448
- limit,
177449
- sort: {
177450
- name: import_core25.SortingOrder.Ascending
177451
- }
177452
- }
177453
- );
177454
- const summaries = channels.map((ch) => ({
177455
- id: ChannelId.make(ch._id),
177456
- name: ChannelName.make(ch.name),
177457
- topic: ch.topic || void 0,
177458
- private: ch.private,
177459
- archived: ch.archived,
177460
- members: ch.members.length,
177461
- messages: ch.messages,
177462
- modifiedOn: ch.modifiedOn
177463
- }));
177464
- return summaries;
177465
- });
177466
- var getChannel = (params) => Effect_exports.gen(function* () {
177467
- const { channel, client } = yield* findChannel(params.channel);
177468
- const memberNames = channel.members.length > 0 ? yield* Effect_exports.gen(function* () {
177469
- const accountUuidToName = yield* buildAccountUuidToNameMap(client, channel.members);
177470
- return channel.members.map((m) => accountUuidToName.get(m)).filter((n) => n !== void 0);
177471
- }) : void 0;
177472
- const result = {
177473
- id: ChannelId.make(channel._id),
177474
- name: ChannelName.make(channel.name),
177475
- topic: channel.topic || void 0,
177476
- description: channel.description || void 0,
177477
- private: channel.private,
177478
- archived: channel.archived,
177479
- members: memberNames?.map((m) => PersonName.make(m)),
177480
- messages: channel.messages,
177481
- modifiedOn: channel.modifiedOn,
177482
- createdOn: channel.createdOn
177483
- };
177484
- return result;
177485
- });
177486
- var createChannel = (params) => Effect_exports.gen(function* () {
177487
- const client = yield* HulyClient;
177488
- const channelId = (0, import_core25.generateId)();
177489
- const channelData = {
177490
- name: params.name,
177491
- topic: params.topic || "",
177492
- description: "",
177493
- private: params.private ?? false,
177494
- archived: false,
177495
- members: [client.getAccountUuid()],
177496
- owners: [client.getAccountUuid()]
177497
- };
177498
- yield* client.createDoc(
177499
- chunter.class.Channel,
177500
- toRef(channelId),
177501
- channelData,
177502
- channelId
177503
- );
177504
- return { id: ChannelId.make(channelId), name: ChannelName.make(params.name) };
177505
- });
177506
- var updateChannel = (params) => Effect_exports.gen(function* () {
177507
- const { channel, client } = yield* findChannel(params.channel);
177508
- const updateOps = {};
177509
- if (params.name !== void 0) {
177510
- updateOps.name = params.name;
177511
- }
177512
- if (params.topic !== void 0) {
177513
- updateOps.topic = params.topic;
177514
- }
177515
- if (Object.keys(updateOps).length === 0) {
177516
- return { id: ChannelId.make(channel._id), updated: false };
177517
- }
177518
- yield* client.updateDoc(
177519
- chunter.class.Channel,
177520
- toRef(channel._id),
177521
- channel._id,
177522
- updateOps
177523
- );
177524
- return { id: ChannelId.make(channel._id), updated: true };
177525
- });
177526
- var deleteChannel = (params) => Effect_exports.gen(function* () {
177527
- const { channel, client } = yield* findChannel(params.channel);
177528
- yield* client.removeDoc(
177529
- chunter.class.Channel,
177530
- toRef(channel._id),
177531
- channel._id
177532
- );
177533
- return { id: ChannelId.make(channel._id), deleted: true };
177534
- });
177535
- var listChannelMessages = (params) => Effect_exports.gen(function* () {
177536
- const { channel, client } = yield* findChannel(params.channel);
177537
- const limit = clampLimit(params.limit);
177538
- const messages = yield* client.findAll(
177539
- chunter.class.ChatMessage,
177540
- {
177541
- space: channel._id
177542
- },
177543
- {
177544
- limit,
177545
- sort: {
177546
- createdOn: import_core25.SortingOrder.Descending
177547
- }
177548
- }
177549
- );
177550
- const total = messages.total;
177551
- const uniqueSocialIds = [
177552
- ...new Set(
177553
- messages.map((msg) => msg.modifiedBy)
177554
- )
177555
- ];
177556
- const socialIdToName = yield* buildSocialIdToPersonNameMap(client, uniqueSocialIds);
177557
- const summaries = messages.map((msg) => {
177558
- const senderName = socialIdToName.get(msg.modifiedBy);
177559
- return {
177560
- id: MessageId.make(msg._id),
177561
- body: markupToMarkdownString(msg.message),
177562
- sender: senderName !== void 0 ? PersonName.make(senderName) : void 0,
177563
- senderId: msg.modifiedBy,
177564
- createdOn: msg.createdOn,
177565
- modifiedOn: msg.modifiedOn,
177566
- editedOn: msg.editedOn,
177567
- replies: msg.replies
177568
- };
177569
- });
177570
- return { messages: summaries, total };
177571
- });
177572
- var sendChannelMessage = (params) => Effect_exports.gen(function* () {
177573
- const { channel, client } = yield* findChannel(params.channel);
177574
- const messageId = (0, import_core25.generateId)();
177575
- const markup = markdownToMarkupString(params.body);
177576
- const messageData = {
177577
- message: markup,
177578
- attachments: 0
177579
- };
177580
- yield* client.addCollection(
177581
- chunter.class.ChatMessage,
177582
- channel._id,
177583
- channel._id,
177584
- chunter.class.Channel,
177585
- "messages",
177586
- messageData,
177587
- messageId
177588
- );
177589
- return { id: MessageId.make(messageId), channelId: ChannelId.make(channel._id) };
177590
- });
177591
- var listDirectMessages = (params) => Effect_exports.gen(function* () {
177592
- const client = yield* HulyClient;
177593
- const limit = clampLimit(params.limit);
177594
- const dms = yield* client.findAll(
177595
- chunter.class.DirectMessage,
177596
- {},
177597
- {
177598
- limit,
177599
- sort: {
177600
- modifiedOn: import_core25.SortingOrder.Descending
177601
- }
177602
- }
177603
- );
177604
- const total = dms.total;
177605
- const uniqueAccountUuids = [
177606
- ...new Set(
177607
- dms.flatMap((dm) => dm.members)
177608
- )
177609
- ];
177610
- const accountUuidToName = yield* buildAccountUuidToNameMap(client, uniqueAccountUuids);
177611
- const summaries = dms.map((dm) => {
177612
- const participants = dm.members.map((m) => accountUuidToName.get(m)).filter((n) => n !== void 0).map((n) => PersonName.make(n));
177613
- const participantIds = dm.members.map((m) => AccountUuid.make(m));
177614
- return {
177615
- id: ChannelId.make(dm._id),
177616
- participants,
177617
- participantIds,
177618
- messages: dm.messages,
177619
- modifiedOn: dm.modifiedOn
177620
- };
177621
- });
177622
- return { conversations: summaries, total };
177623
- });
177624
-
177625
177771
  // src/huly/operations/threads.ts
177626
- var import_core26 = __toESM(require_lib4(), 1);
177772
+ var import_core27 = __toESM(require_lib4(), 1);
177627
177773
  var findMessage = (channelIdentifier, messageId) => Effect_exports.gen(function* () {
177628
177774
  const { channel, client } = yield* findChannel(channelIdentifier);
177629
177775
  const message = yield* client.findOne(
@@ -177667,7 +177813,7 @@ var listThreadReplies = (params) => Effect_exports.gen(function* () {
177667
177813
  {
177668
177814
  limit,
177669
177815
  sort: {
177670
- createdOn: import_core26.SortingOrder.Ascending
177816
+ createdOn: import_core27.SortingOrder.Ascending
177671
177817
  }
177672
177818
  }
177673
177819
  );
@@ -177694,7 +177840,7 @@ var listThreadReplies = (params) => Effect_exports.gen(function* () {
177694
177840
  });
177695
177841
  var addThreadReply = (params) => Effect_exports.gen(function* () {
177696
177842
  const { channel, client, message } = yield* findMessage(params.channel, params.messageId);
177697
- const replyId = (0, import_core26.generateId)();
177843
+ const replyId = (0, import_core27.generateId)();
177698
177844
  const markup = markdownToMarkupString(params.body);
177699
177845
  const replyData = {
177700
177846
  message: markup,
@@ -177883,7 +178029,7 @@ var channelTools = [
177883
178029
  ];
177884
178030
 
177885
178031
  // src/huly/operations/comments.ts
177886
- var import_core27 = __toESM(require_lib4(), 1);
178032
+ var import_core28 = __toESM(require_lib4(), 1);
177887
178033
  var findProjectAndIssue2 = (params) => findProjectAndIssue({ project: params.project, identifier: params.issueIdentifier });
177888
178034
  var findComment = (params) => Effect_exports.gen(function* () {
177889
178035
  const { client, issue: issue2, project: project3 } = yield* findProjectAndIssue2({
@@ -177921,7 +178067,7 @@ var listComments = (params) => Effect_exports.gen(function* () {
177921
178067
  {
177922
178068
  limit,
177923
178069
  sort: {
177924
- createdOn: import_core27.SortingOrder.Ascending
178070
+ createdOn: import_core28.SortingOrder.Ascending
177925
178071
  }
177926
178072
  }
177927
178073
  );
@@ -177949,7 +178095,7 @@ var addComment = (params) => Effect_exports.gen(function* () {
177949
178095
  project: params.project,
177950
178096
  issueIdentifier: params.issueIdentifier
177951
178097
  });
177952
- const commentId = (0, import_core27.generateId)();
178098
+ const commentId = (0, import_core28.generateId)();
177953
178099
  const commentData = {
177954
178100
  message: params.body
177955
178101
  };
@@ -178058,7 +178204,7 @@ var commentTools = [
178058
178204
 
178059
178205
  // src/huly/operations/contacts.ts
178060
178206
  var import_contact = __toESM(require_lib28(), 1);
178061
- var import_core28 = __toESM(require_lib4(), 1);
178207
+ var import_core29 = __toESM(require_lib4(), 1);
178062
178208
  var formatName = (firstName, lastName) => `${lastName},${firstName}`;
178063
178209
  var parseName = (name) => {
178064
178210
  const parts2 = name.split(",");
@@ -178120,7 +178266,7 @@ var listPersons = (params) => Effect_exports.gen(function* () {
178120
178266
  query,
178121
178267
  {
178122
178268
  limit,
178123
- sort: { modifiedOn: import_core28.SortingOrder.Descending }
178269
+ sort: { modifiedOn: import_core29.SortingOrder.Descending }
178124
178270
  }
178125
178271
  );
178126
178272
  const personIds = persons.map((p) => p._id);
@@ -178190,7 +178336,7 @@ var getPerson = (params) => Effect_exports.gen(function* () {
178190
178336
  });
178191
178337
  var createPerson = (params) => Effect_exports.gen(function* () {
178192
178338
  const client = yield* HulyClient;
178193
- const personId = (0, import_core28.generateId)();
178339
+ const personId = (0, import_core29.generateId)();
178194
178340
  const personData = {
178195
178341
  name: formatName(params.firstName, params.lastName),
178196
178342
  // Huly API requires city field to be set, even if empty
@@ -178266,7 +178412,7 @@ var listEmployees = (params) => Effect_exports.gen(function* () {
178266
178412
  {},
178267
178413
  {
178268
178414
  limit,
178269
- sort: { modifiedOn: import_core28.SortingOrder.Descending }
178415
+ sort: { modifiedOn: import_core29.SortingOrder.Descending }
178270
178416
  }
178271
178417
  );
178272
178418
  const employeeIds = employees.map((e) => e._id);
@@ -178291,7 +178437,7 @@ var listOrganizations = (params) => Effect_exports.gen(function* () {
178291
178437
  {},
178292
178438
  {
178293
178439
  limit,
178294
- sort: { modifiedOn: import_core28.SortingOrder.Descending }
178440
+ sort: { modifiedOn: import_core29.SortingOrder.Descending }
178295
178441
  }
178296
178442
  );
178297
178443
  return orgs.map((org) => ({
@@ -178304,7 +178450,7 @@ var listOrganizations = (params) => Effect_exports.gen(function* () {
178304
178450
  });
178305
178451
  var createOrganization = (params) => Effect_exports.gen(function* () {
178306
178452
  const client = yield* HulyClient;
178307
- const orgId = (0, import_core28.generateId)();
178453
+ const orgId = (0, import_core29.generateId)();
178308
178454
  const orgData = {
178309
178455
  name: params.name,
178310
178456
  city: "",
@@ -178430,7 +178576,7 @@ var contactTools = [
178430
178576
  ];
178431
178577
 
178432
178578
  // src/huly/operations/components.ts
178433
- var import_core29 = __toESM(require_lib4(), 1);
178579
+ var import_core30 = __toESM(require_lib4(), 1);
178434
178580
 
178435
178581
  // src/utils/assertions.ts
178436
178582
  var AssertionError = class extends Error {
@@ -178484,7 +178630,7 @@ var listComponents = (params) => Effect_exports.gen(function* () {
178484
178630
  { space: project3._id },
178485
178631
  {
178486
178632
  limit,
178487
- sort: { modifiedOn: import_core29.SortingOrder.Descending }
178633
+ sort: { modifiedOn: import_core30.SortingOrder.Descending }
178488
178634
  }
178489
178635
  );
178490
178636
  const leadIds = [
@@ -178524,7 +178670,7 @@ var getComponent = (params) => Effect_exports.gen(function* () {
178524
178670
  });
178525
178671
  var createComponent = (params) => Effect_exports.gen(function* () {
178526
178672
  const { client, project: project3 } = yield* findProject(params.project);
178527
- const componentId = (0, import_core29.generateId)();
178673
+ const componentId = (0, import_core30.generateId)();
178528
178674
  const leadParam = params.lead;
178529
178675
  const leadRef = leadParam !== void 0 ? yield* Effect_exports.gen(function* () {
178530
178676
  const person = yield* findPersonByEmailOrName(client, leadParam);
@@ -178862,7 +179008,7 @@ var documentTools = [
178862
179008
  },
178863
179009
  {
178864
179010
  name: "create_document",
178865
- description: "Create a new document in a Huly teamspace. Content supports markdown formatting. Returns the created document id.",
179011
+ 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.",
178866
179012
  category: CATEGORY9,
178867
179013
  inputSchema: createDocumentParamsJsonSchema,
178868
179014
  handler: createToolHandler(
@@ -178873,7 +179019,7 @@ var documentTools = [
178873
179019
  },
178874
179020
  {
178875
179021
  name: "edit_document",
178876
- 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'.",
179022
+ 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.",
178877
179023
  category: CATEGORY9,
178878
179024
  inputSchema: editDocumentParamsJsonSchema,
178879
179025
  handler: createToolHandler(
@@ -178882,6 +179028,17 @@ var documentTools = [
178882
179028
  editDocument
178883
179029
  )
178884
179030
  },
179031
+ {
179032
+ name: "list_inline_comments",
179033
+ description: "List inline comment threads from a Huly document. Extracts comments embedded in document content as ProseMirror marks. Each comment includes the highlighted text and thread ID. Set includeReplies=true to also fetch thread reply messages with sender names.",
179034
+ category: CATEGORY9,
179035
+ inputSchema: listInlineCommentsParamsJsonSchema,
179036
+ handler: createToolHandler(
179037
+ "list_inline_comments",
179038
+ parseListInlineCommentsParams,
179039
+ listInlineComments
179040
+ )
179041
+ },
178885
179042
  {
178886
179043
  name: "delete_document",
178887
179044
  description: "Permanently delete a Huly document. This action cannot be undone.",
@@ -178895,11 +179052,268 @@ var documentTools = [
178895
179052
  }
178896
179053
  ];
178897
179054
 
179055
+ // src/huly/operations/relations.ts
179056
+ var resolveTargetIssue = (client, sourceProject, targetIssueStr) => Effect_exports.gen(function* () {
179057
+ const { fullIdentifier } = parseIssueIdentifier(targetIssueStr, sourceProject.identifier);
179058
+ const match16 = fullIdentifier.match(/^([A-Z]+)-\d+$/i);
179059
+ const prefix = match16 ? match16[1].toUpperCase() : null;
179060
+ if (prefix !== null && prefix !== sourceProject.identifier.toUpperCase()) {
179061
+ const { client: c, project: targetProject } = yield* findProject(prefix);
179062
+ const issue3 = yield* findIssueInProject(c, targetProject, targetIssueStr);
179063
+ return { issue: issue3, project: targetProject };
179064
+ }
179065
+ const issue2 = yield* findIssueInProject(client, sourceProject, targetIssueStr);
179066
+ return { issue: issue2, project: sourceProject };
179067
+ });
179068
+ var makeRelatedDocEntry = (id, _class) => ({
179069
+ _id: toRef(id),
179070
+ _class: toRef(_class)
179071
+ });
179072
+ var hasRelationById = (arr, id) => arr?.some((r) => r._id === toRef(id)) ?? false;
179073
+ var makeRelatedDoc = (issue2) => makeRelatedDocEntry(issue2._id, tracker.class.Issue);
179074
+ var addIssueRelation = (params) => Effect_exports.gen(function* () {
179075
+ const { client, issue: source, project: project3 } = yield* findProjectAndIssue({
179076
+ project: params.project,
179077
+ identifier: params.issueIdentifier
179078
+ });
179079
+ const { issue: target, project: targetProject } = yield* resolveTargetIssue(
179080
+ client,
179081
+ project3,
179082
+ params.targetIssue
179083
+ );
179084
+ const result = { sourceIssue: source.identifier, targetIssue: target.identifier, relationType: params.relationType };
179085
+ switch (params.relationType) {
179086
+ case "blocks": {
179087
+ if (hasRelationById(target.blockedBy, source._id)) {
179088
+ return { ...result, added: false };
179089
+ }
179090
+ yield* client.updateDoc(
179091
+ tracker.class.Issue,
179092
+ targetProject._id,
179093
+ target._id,
179094
+ { $push: { blockedBy: makeRelatedDoc(source) } }
179095
+ );
179096
+ return { ...result, added: true };
179097
+ }
179098
+ case "is-blocked-by": {
179099
+ if (hasRelationById(source.blockedBy, target._id)) {
179100
+ return { ...result, added: false };
179101
+ }
179102
+ yield* client.updateDoc(
179103
+ tracker.class.Issue,
179104
+ project3._id,
179105
+ source._id,
179106
+ { $push: { blockedBy: makeRelatedDoc(target) } }
179107
+ );
179108
+ return { ...result, added: true };
179109
+ }
179110
+ case "relates-to": {
179111
+ if (hasRelationById(source.relations, target._id)) {
179112
+ return { ...result, added: false };
179113
+ }
179114
+ yield* client.updateDoc(
179115
+ tracker.class.Issue,
179116
+ project3._id,
179117
+ source._id,
179118
+ { $push: { relations: makeRelatedDoc(target) } }
179119
+ );
179120
+ yield* client.updateDoc(
179121
+ tracker.class.Issue,
179122
+ targetProject._id,
179123
+ target._id,
179124
+ { $push: { relations: makeRelatedDoc(source) } }
179125
+ );
179126
+ return { ...result, added: true };
179127
+ }
179128
+ }
179129
+ });
179130
+ var removeIssueRelation = (params) => Effect_exports.gen(function* () {
179131
+ const { client, issue: source, project: project3 } = yield* findProjectAndIssue({
179132
+ project: params.project,
179133
+ identifier: params.issueIdentifier
179134
+ });
179135
+ const { issue: target, project: targetProject } = yield* resolveTargetIssue(
179136
+ client,
179137
+ project3,
179138
+ params.targetIssue
179139
+ );
179140
+ const result = { sourceIssue: source.identifier, targetIssue: target.identifier, relationType: params.relationType };
179141
+ switch (params.relationType) {
179142
+ case "blocks": {
179143
+ if (!hasRelationById(target.blockedBy, source._id)) {
179144
+ return { ...result, removed: false };
179145
+ }
179146
+ yield* client.updateDoc(
179147
+ tracker.class.Issue,
179148
+ targetProject._id,
179149
+ target._id,
179150
+ { $pull: { blockedBy: { _id: toRef(source._id) } } }
179151
+ );
179152
+ return { ...result, removed: true };
179153
+ }
179154
+ case "is-blocked-by": {
179155
+ if (!hasRelationById(source.blockedBy, target._id)) {
179156
+ return { ...result, removed: false };
179157
+ }
179158
+ yield* client.updateDoc(
179159
+ tracker.class.Issue,
179160
+ project3._id,
179161
+ source._id,
179162
+ { $pull: { blockedBy: { _id: toRef(target._id) } } }
179163
+ );
179164
+ return { ...result, removed: true };
179165
+ }
179166
+ case "relates-to": {
179167
+ if (!hasRelationById(source.relations, target._id)) {
179168
+ return { ...result, removed: false };
179169
+ }
179170
+ yield* client.updateDoc(
179171
+ tracker.class.Issue,
179172
+ project3._id,
179173
+ source._id,
179174
+ { $pull: { relations: { _id: toRef(target._id) } } }
179175
+ );
179176
+ yield* client.updateDoc(
179177
+ tracker.class.Issue,
179178
+ targetProject._id,
179179
+ target._id,
179180
+ { $pull: { relations: { _id: toRef(source._id) } } }
179181
+ );
179182
+ return { ...result, removed: true };
179183
+ }
179184
+ }
179185
+ });
179186
+ var listIssueRelations = (params) => Effect_exports.gen(function* () {
179187
+ const { client, issue: issue2 } = yield* findProjectAndIssue({
179188
+ project: params.project,
179189
+ identifier: params.issueIdentifier
179190
+ });
179191
+ const blockedByRefs = issue2.blockedBy ?? [];
179192
+ const relationsRefs = issue2.relations ?? [];
179193
+ if (blockedByRefs.length === 0 && relationsRefs.length === 0) {
179194
+ return { blockedBy: [], relations: [], documents: [] };
179195
+ }
179196
+ const docClass = String(documentPlugin.class.Document);
179197
+ const issueRelationsRefs = [];
179198
+ const docRelationsRefs = [];
179199
+ for (const r of relationsRefs) {
179200
+ ;
179201
+ (String(r._class) === docClass ? docRelationsRefs : issueRelationsRefs).push(r);
179202
+ }
179203
+ const allIssueIds = [...blockedByRefs, ...issueRelationsRefs].map((r) => r._id);
179204
+ const idToIdentifier = /* @__PURE__ */ new Map();
179205
+ if (allIssueIds.length > 0) {
179206
+ const toIssueRef = toRef;
179207
+ const issues = yield* client.findAll(
179208
+ tracker.class.Issue,
179209
+ { _id: { $in: allIssueIds.map(toIssueRef) } }
179210
+ );
179211
+ for (const i of issues) {
179212
+ idToIdentifier.set(String(i._id), i.identifier);
179213
+ }
179214
+ }
179215
+ const toEntry = (r) => ({
179216
+ identifier: idToIdentifier.get(String(r._id)) ?? String(r._id),
179217
+ _id: String(r._id),
179218
+ _class: String(r._class)
179219
+ });
179220
+ const documents = [];
179221
+ if (docRelationsRefs.length > 0) {
179222
+ const toDocRef = toRef;
179223
+ const docs = yield* client.findAll(
179224
+ documentPlugin.class.Document,
179225
+ { _id: { $in: docRelationsRefs.map((r) => toDocRef(r._id)) } }
179226
+ );
179227
+ const docMap = new Map(docs.map((d) => [String(d._id), d]));
179228
+ const spaceIds = [...new Set(docs.map((d) => d.space))];
179229
+ const tsNameMap = /* @__PURE__ */ new Map();
179230
+ if (spaceIds.length > 0) {
179231
+ const teamspaces = yield* client.findAll(
179232
+ documentPlugin.class.Teamspace,
179233
+ { _id: { $in: spaceIds.map(toRef) } }
179234
+ );
179235
+ for (const ts of teamspaces) {
179236
+ tsNameMap.set(String(ts._id), ts.name);
179237
+ }
179238
+ }
179239
+ for (const r of docRelationsRefs) {
179240
+ const doc = docMap.get(String(r._id));
179241
+ documents.push({
179242
+ title: doc?.title ?? String(r._id),
179243
+ teamspace: doc ? tsNameMap.get(String(doc.space)) ?? String(doc.space) : String(r._id),
179244
+ _id: String(r._id),
179245
+ _class: String(r._class)
179246
+ });
179247
+ }
179248
+ }
179249
+ return {
179250
+ blockedBy: blockedByRefs.map(toEntry),
179251
+ relations: issueRelationsRefs.map(toEntry),
179252
+ documents
179253
+ };
179254
+ });
179255
+
179256
+ // src/huly/operations/document-relations.ts
179257
+ var linkDocumentToIssue = (params) => Effect_exports.gen(function* () {
179258
+ const [{ client, issue: issue2, project: project3 }, { doc }] = yield* Effect_exports.all([
179259
+ findProjectAndIssue({ project: params.project, identifier: params.issueIdentifier }),
179260
+ findTeamspaceAndDocument({ teamspace: params.teamspace, document: params.document })
179261
+ ]);
179262
+ if (hasRelationById(issue2.relations, doc._id)) {
179263
+ return {
179264
+ issue: issue2.identifier,
179265
+ document: doc._id,
179266
+ documentTitle: doc.title,
179267
+ linked: false
179268
+ };
179269
+ }
179270
+ yield* client.updateDoc(
179271
+ issue2._class,
179272
+ project3._id,
179273
+ issue2._id,
179274
+ // eslint-disable-next-line no-restricted-syntax -- DocumentUpdate<HulyIssue> cast: see relations.ts
179275
+ { $push: { relations: makeRelatedDocEntry(doc._id, documentPlugin.class.Document) } }
179276
+ );
179277
+ return {
179278
+ issue: issue2.identifier,
179279
+ document: doc._id,
179280
+ documentTitle: doc.title,
179281
+ linked: true
179282
+ };
179283
+ });
179284
+ var unlinkDocumentFromIssue = (params) => Effect_exports.gen(function* () {
179285
+ const [{ client, issue: issue2, project: project3 }, { doc }] = yield* Effect_exports.all([
179286
+ findProjectAndIssue({ project: params.project, identifier: params.issueIdentifier }),
179287
+ findTeamspaceAndDocument({ teamspace: params.teamspace, document: params.document })
179288
+ ]);
179289
+ if (!hasRelationById(issue2.relations, doc._id)) {
179290
+ return {
179291
+ issue: issue2.identifier,
179292
+ document: doc._id,
179293
+ documentTitle: doc.title,
179294
+ unlinked: false
179295
+ };
179296
+ }
179297
+ yield* client.updateDoc(
179298
+ issue2._class,
179299
+ project3._id,
179300
+ issue2._id,
179301
+ // eslint-disable-next-line no-restricted-syntax -- DocumentUpdate<HulyIssue> cast: see relations.ts
179302
+ { $pull: { relations: { _id: toRef(doc._id) } } }
179303
+ );
179304
+ return {
179305
+ issue: issue2.identifier,
179306
+ document: doc._id,
179307
+ documentTitle: doc.title,
179308
+ unlinked: true
179309
+ };
179310
+ });
179311
+
178898
179312
  // src/huly/operations/issue-templates.ts
178899
- var import_core33 = __toESM(require_lib4(), 1);
179313
+ var import_core34 = __toESM(require_lib4(), 1);
178900
179314
 
178901
179315
  // src/huly/operations/issues-move.ts
178902
- var import_core30 = __toESM(require_lib4(), 1);
179316
+ var import_core31 = __toESM(require_lib4(), 1);
178903
179317
  var import_tracker2 = __toESM(require_lib22(), 1);
178904
179318
  var addLabel = (params) => Effect_exports.gen(function* () {
178905
179319
  const { client, issue: issue2, project: project3 } = yield* findProjectAndIssue(params);
@@ -178926,7 +179340,7 @@ var addLabel = (params) => Effect_exports.gen(function* () {
178926
179340
  }
178927
179341
  );
178928
179342
  if (tagElement === void 0) {
178929
- const tagElementId = (0, import_core30.generateId)();
179343
+ const tagElementId = (0, import_core31.generateId)();
178930
179344
  const tagElementData = {
178931
179345
  title: labelTitle,
178932
179346
  description: "",
@@ -179059,7 +179473,7 @@ var updateDescendantParents = (client, spaceId, parentIssue, parentNewParents) =
179059
179473
  });
179060
179474
 
179061
179475
  // src/huly/operations/issues-read.ts
179062
- var import_core31 = __toESM(require_lib4(), 1);
179476
+ var import_core32 = __toESM(require_lib4(), 1);
179063
179477
  var import_tracker3 = __toESM(require_lib22(), 1);
179064
179478
  var resolveStatusName = (statuses, statusId) => {
179065
179479
  const statusDoc = statuses.find((s) => s._id === statusId);
@@ -179150,7 +179564,7 @@ var listIssues = (params) => Effect_exports.gen(function* () {
179150
179564
  {
179151
179565
  limit,
179152
179566
  sort: {
179153
- modifiedOn: import_core31.SortingOrder.Descending
179567
+ modifiedOn: import_core32.SortingOrder.Descending
179154
179568
  }
179155
179569
  },
179156
179570
  { assignee: contact.class.Person }
@@ -179230,7 +179644,7 @@ var getIssue = (params) => Effect_exports.gen(function* () {
179230
179644
  });
179231
179645
 
179232
179646
  // src/huly/operations/issues-write.ts
179233
- var import_core32 = __toESM(require_lib4(), 1);
179647
+ var import_core33 = __toESM(require_lib4(), 1);
179234
179648
  var import_rank3 = __toESM(require_lib33(), 1);
179235
179649
  var import_tracker4 = __toESM(require_lib22(), 1);
179236
179650
  var TxIncResult = Schema_exports.Struct({
@@ -179251,7 +179665,7 @@ var resolveAssignee = (client, assigneeIdentifier) => Effect_exports.gen(functio
179251
179665
  });
179252
179666
  var createIssue = (params) => Effect_exports.gen(function* () {
179253
179667
  const { client, defaultStatusId, project: project3, statuses } = yield* findProjectWithStatuses(params.project);
179254
- const issueId = (0, import_core32.generateId)();
179668
+ const issueId = (0, import_core33.generateId)();
179255
179669
  const incOps = { $inc: { sequence: 1 } };
179256
179670
  const incResult = yield* client.updateDoc(
179257
179671
  tracker.class.Project,
@@ -179266,7 +179680,7 @@ var createIssue = (params) => Effect_exports.gen(function* () {
179266
179680
  const lastIssue = yield* client.findOne(
179267
179681
  tracker.class.Issue,
179268
179682
  { space: project3._id },
179269
- { sort: { rank: import_core32.SortingOrder.Descending } }
179683
+ { sort: { rank: import_core33.SortingOrder.Descending } }
179270
179684
  );
179271
179685
  const rank = (0, import_rank3.makeRank)(lastIssue?.rank, void 0);
179272
179686
  const descriptionMarkupRef = params.description !== void 0 && params.description.trim() !== "" ? yield* client.uploadMarkup(
@@ -179464,7 +179878,7 @@ var buildTemplateChild = (client, projectId, projectIdentifier, input) => Effect
179464
179878
  return component._id;
179465
179879
  }) : null;
179466
179880
  return {
179467
- id: (0, import_core33.generateId)(),
179881
+ id: (0, import_core34.generateId)(),
179468
179882
  title: input.title,
179469
179883
  description: input.description ?? "",
179470
179884
  priority: stringToPriority(input.priority || "no-priority"),
@@ -179481,7 +179895,7 @@ var listIssueTemplates = (params) => Effect_exports.gen(function* () {
179481
179895
  { space: project3._id },
179482
179896
  {
179483
179897
  limit,
179484
- sort: { modifiedOn: import_core33.SortingOrder.Descending }
179898
+ sort: { modifiedOn: import_core34.SortingOrder.Descending }
179485
179899
  }
179486
179900
  );
179487
179901
  const summaries = templates.map((t) => {
@@ -179525,7 +179939,7 @@ var getIssueTemplate = (params) => Effect_exports.gen(function* () {
179525
179939
  });
179526
179940
  var createIssueTemplate = (params) => Effect_exports.gen(function* () {
179527
179941
  const { client, project: project3 } = yield* findProject(params.project);
179528
- const templateId = (0, import_core33.generateId)();
179942
+ const templateId = (0, import_core34.generateId)();
179529
179943
  const assigneeParam = params.assignee;
179530
179944
  const assigneeRef = assigneeParam !== void 0 ? yield* Effect_exports.gen(function* () {
179531
179945
  const person = yield* findPersonByEmailOrName(client, assigneeParam);
@@ -179759,10 +180173,10 @@ var removeTemplateChild = (params) => Effect_exports.gen(function* () {
179759
180173
  });
179760
180174
 
179761
180175
  // src/huly/operations/labels.ts
179762
- var import_core35 = __toESM(require_lib4(), 1);
180176
+ var import_core36 = __toESM(require_lib4(), 1);
179763
180177
 
179764
180178
  // src/huly/operations/tag-categories.ts
179765
- var import_core34 = __toESM(require_lib4(), 1);
180179
+ var import_core35 = __toESM(require_lib4(), 1);
179766
180180
  var issueClassRef = toRef(tracker.class.Issue);
179767
180181
  var findCategoryByIdOrLabel = (client, idOrLabel) => Effect_exports.gen(function* () {
179768
180182
  const cat = (yield* client.findOne(
@@ -179800,7 +180214,7 @@ var listTagCategories = (params) => Effect_exports.gen(function* () {
179800
180214
  query,
179801
180215
  {
179802
180216
  limit,
179803
- sort: { modifiedOn: import_core34.SortingOrder.Descending }
180217
+ sort: { modifiedOn: import_core35.SortingOrder.Descending }
179804
180218
  }
179805
180219
  );
179806
180220
  return categories.map(toSummary);
@@ -179815,7 +180229,7 @@ var createTagCategory = (params) => Effect_exports.gen(function* () {
179815
180229
  if (existing !== void 0) {
179816
180230
  return { id: TagCategoryId.make(existing._id), label: existing.label, created: false };
179817
180231
  }
179818
- const catId = (0, import_core34.generateId)();
180232
+ const catId = (0, import_core35.generateId)();
179819
180233
  const catData = {
179820
180234
  // Asset is a branded string type (Metadata<URL>) with no runtime constructor.
179821
180235
  // Empty string is the "no icon" sentinel; Huly UI renders a default icon.
@@ -179917,7 +180331,7 @@ var listLabels = (params) => Effect_exports.gen(function* () {
179917
180331
  query,
179918
180332
  {
179919
180333
  limit,
179920
- sort: { modifiedOn: import_core35.SortingOrder.Descending }
180334
+ sort: { modifiedOn: import_core36.SortingOrder.Descending }
179921
180335
  }
179922
180336
  );
179923
180337
  return elements.map((e) => ({
@@ -179942,7 +180356,7 @@ var createLabel = (params) => Effect_exports.gen(function* () {
179942
180356
  return { id: TagElementId.make(existing._id), title: existing.title, created: false };
179943
180357
  }
179944
180358
  const categoryRef = yield* resolveCategoryRef(client, params.category);
179945
- const tagId = (0, import_core35.generateId)();
180359
+ const tagId = (0, import_core36.generateId)();
179946
180360
  const color = params.color ?? 0;
179947
180361
  const tagData = {
179948
180362
  title: params.title,
@@ -180017,165 +180431,6 @@ var removeIssueLabel = (params) => Effect_exports.gen(function* () {
180017
180431
  return { identifier: IssueIdentifier.make(issue2.identifier), labelRemoved: true };
180018
180432
  });
180019
180433
 
180020
- // src/huly/operations/relations.ts
180021
- var resolveTargetIssue = (client, sourceProject, targetIssueStr) => Effect_exports.gen(function* () {
180022
- const { fullIdentifier } = parseIssueIdentifier(targetIssueStr, sourceProject.identifier);
180023
- const match16 = fullIdentifier.match(/^([A-Z]+)-\d+$/i);
180024
- const prefix = match16 ? match16[1].toUpperCase() : null;
180025
- if (prefix !== null && prefix !== sourceProject.identifier.toUpperCase()) {
180026
- const { client: c, project: targetProject } = yield* findProject(prefix);
180027
- const issue3 = yield* findIssueInProject(c, targetProject, targetIssueStr);
180028
- return { issue: issue3, project: targetProject };
180029
- }
180030
- const issue2 = yield* findIssueInProject(client, sourceProject, targetIssueStr);
180031
- return { issue: issue2, project: sourceProject };
180032
- });
180033
- var makeRelatedDoc = (issue2) => ({
180034
- _id: toRef(issue2._id),
180035
- _class: toRef(tracker.class.Issue)
180036
- });
180037
- var hasRelation = (arr, targetId) => arr?.some((r) => r._id === toRef(targetId)) ?? false;
180038
- var addIssueRelation = (params) => Effect_exports.gen(function* () {
180039
- const { client, issue: source, project: project3 } = yield* findProjectAndIssue({
180040
- project: params.project,
180041
- identifier: params.issueIdentifier
180042
- });
180043
- const { issue: target, project: targetProject } = yield* resolveTargetIssue(
180044
- client,
180045
- project3,
180046
- params.targetIssue
180047
- );
180048
- const result = { sourceIssue: source.identifier, targetIssue: target.identifier, relationType: params.relationType };
180049
- switch (params.relationType) {
180050
- case "blocks": {
180051
- if (hasRelation(target.blockedBy, source._id)) {
180052
- return { ...result, added: false };
180053
- }
180054
- yield* client.updateDoc(
180055
- tracker.class.Issue,
180056
- targetProject._id,
180057
- target._id,
180058
- { $push: { blockedBy: makeRelatedDoc(source) } }
180059
- );
180060
- return { ...result, added: true };
180061
- }
180062
- case "is-blocked-by": {
180063
- if (hasRelation(source.blockedBy, target._id)) {
180064
- return { ...result, added: false };
180065
- }
180066
- yield* client.updateDoc(
180067
- tracker.class.Issue,
180068
- project3._id,
180069
- source._id,
180070
- { $push: { blockedBy: makeRelatedDoc(target) } }
180071
- );
180072
- return { ...result, added: true };
180073
- }
180074
- case "relates-to": {
180075
- if (hasRelation(source.relations, target._id)) {
180076
- return { ...result, added: false };
180077
- }
180078
- yield* client.updateDoc(
180079
- tracker.class.Issue,
180080
- project3._id,
180081
- source._id,
180082
- { $push: { relations: makeRelatedDoc(target) } }
180083
- );
180084
- yield* client.updateDoc(
180085
- tracker.class.Issue,
180086
- targetProject._id,
180087
- target._id,
180088
- { $push: { relations: makeRelatedDoc(source) } }
180089
- );
180090
- return { ...result, added: true };
180091
- }
180092
- }
180093
- });
180094
- var removeIssueRelation = (params) => Effect_exports.gen(function* () {
180095
- const { client, issue: source, project: project3 } = yield* findProjectAndIssue({
180096
- project: params.project,
180097
- identifier: params.issueIdentifier
180098
- });
180099
- const { issue: target, project: targetProject } = yield* resolveTargetIssue(
180100
- client,
180101
- project3,
180102
- params.targetIssue
180103
- );
180104
- const result = { sourceIssue: source.identifier, targetIssue: target.identifier, relationType: params.relationType };
180105
- switch (params.relationType) {
180106
- case "blocks": {
180107
- if (!hasRelation(target.blockedBy, source._id)) {
180108
- return { ...result, removed: false };
180109
- }
180110
- yield* client.updateDoc(
180111
- tracker.class.Issue,
180112
- targetProject._id,
180113
- target._id,
180114
- { $pull: { blockedBy: { _id: toRef(source._id) } } }
180115
- );
180116
- return { ...result, removed: true };
180117
- }
180118
- case "is-blocked-by": {
180119
- if (!hasRelation(source.blockedBy, target._id)) {
180120
- return { ...result, removed: false };
180121
- }
180122
- yield* client.updateDoc(
180123
- tracker.class.Issue,
180124
- project3._id,
180125
- source._id,
180126
- { $pull: { blockedBy: { _id: toRef(target._id) } } }
180127
- );
180128
- return { ...result, removed: true };
180129
- }
180130
- case "relates-to": {
180131
- if (!hasRelation(source.relations, target._id)) {
180132
- return { ...result, removed: false };
180133
- }
180134
- yield* client.updateDoc(
180135
- tracker.class.Issue,
180136
- project3._id,
180137
- source._id,
180138
- { $pull: { relations: { _id: toRef(target._id) } } }
180139
- );
180140
- yield* client.updateDoc(
180141
- tracker.class.Issue,
180142
- targetProject._id,
180143
- target._id,
180144
- { $pull: { relations: { _id: toRef(source._id) } } }
180145
- );
180146
- return { ...result, removed: true };
180147
- }
180148
- }
180149
- });
180150
- var listIssueRelations = (params) => Effect_exports.gen(function* () {
180151
- const { client, issue: issue2 } = yield* findProjectAndIssue({
180152
- project: params.project,
180153
- identifier: params.issueIdentifier
180154
- });
180155
- const blockedByRefs = issue2.blockedBy ?? [];
180156
- const relationsRefs = issue2.relations ?? [];
180157
- const allIds = [...blockedByRefs, ...relationsRefs].map((r) => r._id);
180158
- if (allIds.length === 0) {
180159
- return { blockedBy: [], relations: [] };
180160
- }
180161
- const toIssueRef = toRef;
180162
- const issueIds = allIds.map(toIssueRef);
180163
- const issues = yield* client.findAll(
180164
- tracker.class.Issue,
180165
- { _id: { $in: issueIds } }
180166
- );
180167
- const idToIdentifier = new Map(issues.map((i) => [String(i._id), i.identifier]));
180168
- const toEntry = (r) => ({
180169
- identifier: idToIdentifier.get(String(r._id)) ?? String(r._id),
180170
- _id: String(r._id),
180171
- _class: String(r._class)
180172
- });
180173
- return {
180174
- blockedBy: blockedByRefs.map(toEntry),
180175
- relations: relationsRefs.map(toEntry)
180176
- };
180177
- });
180178
-
180179
180434
  // src/mcp/tools/issues.ts
180180
180435
  var CATEGORY10 = "issues";
180181
180436
  var issueTools = [
@@ -180445,7 +180700,7 @@ var issueTools = [
180445
180700
  },
180446
180701
  {
180447
180702
  name: "list_issue_relations",
180448
- description: "List all relations of an issue. Returns blockedBy (issues blocking this one) and relations (bidirectional links) with resolved identifiers. Does NOT return issues that this issue blocks \u2014 use list_issue_relations on the target issue to see that.",
180703
+ description: "List all relations of an issue. Returns blockedBy (issues blocking this one), relations (bidirectional issue links), and documents (linked documents with title/teamspace). Does NOT return issues that this issue blocks \u2014 use list_issue_relations on the target issue to see that.",
180449
180704
  category: CATEGORY10,
180450
180705
  inputSchema: listIssueRelationsParamsJsonSchema,
180451
180706
  handler: createToolHandler(
@@ -180453,6 +180708,28 @@ var issueTools = [
180453
180708
  parseListIssueRelationsParams,
180454
180709
  listIssueRelations
180455
180710
  )
180711
+ },
180712
+ {
180713
+ name: "link_document_to_issue",
180714
+ description: "Link a Huly document to an issue. The link appears in the issue's Relations panel in the UI. Idempotent: no-op if the document is already linked. Use list_issue_relations to see linked documents.",
180715
+ category: CATEGORY10,
180716
+ inputSchema: linkDocumentToIssueParamsJsonSchema,
180717
+ handler: createToolHandler(
180718
+ "link_document_to_issue",
180719
+ parseLinkDocumentToIssueParams,
180720
+ linkDocumentToIssue
180721
+ )
180722
+ },
180723
+ {
180724
+ name: "unlink_document_from_issue",
180725
+ description: "Remove a document link from an issue. Idempotent: no-op if the document is not linked.",
180726
+ category: CATEGORY10,
180727
+ inputSchema: unlinkDocumentFromIssueParamsJsonSchema,
180728
+ handler: createToolHandler(
180729
+ "unlink_document_from_issue",
180730
+ parseUnlinkDocumentFromIssueParams,
180731
+ unlinkDocumentFromIssue
180732
+ )
180456
180733
  }
180457
180734
  ];
180458
180735
 
@@ -180506,7 +180783,7 @@ var labelTools = [
180506
180783
  ];
180507
180784
 
180508
180785
  // src/huly/operations/milestones.ts
180509
- var import_core36 = __toESM(require_lib4(), 1);
180786
+ var import_core37 = __toESM(require_lib4(), 1);
180510
180787
  var import_tracker5 = __toESM(require_lib22(), 1);
180511
180788
  var milestoneStatusToStringMap = {
180512
180789
  [import_tracker5.MilestoneStatus.Planned]: "planned",
@@ -180550,7 +180827,7 @@ var listMilestones = (params) => Effect_exports.gen(function* () {
180550
180827
  { space: project3._id },
180551
180828
  {
180552
180829
  limit,
180553
- sort: { modifiedOn: import_core36.SortingOrder.Descending }
180830
+ sort: { modifiedOn: import_core37.SortingOrder.Descending }
180554
180831
  }
180555
180832
  );
180556
180833
  const summaries = milestones.map((m) => ({
@@ -180578,7 +180855,7 @@ var getMilestone = (params) => Effect_exports.gen(function* () {
180578
180855
  });
180579
180856
  var createMilestone = (params) => Effect_exports.gen(function* () {
180580
180857
  const { client, project: project3 } = yield* findProject(params.project);
180581
- const milestoneId = (0, import_core36.generateId)();
180858
+ const milestoneId = (0, import_core37.generateId)();
180582
180859
  const milestoneData = {
180583
180860
  label: params.label,
180584
180861
  description: params.description ?? "",
@@ -180713,7 +180990,7 @@ var milestoneTools = [
180713
180990
  ];
180714
180991
 
180715
180992
  // src/huly/operations/notifications.ts
180716
- var import_core37 = __toESM(require_lib4(), 1);
180993
+ var import_core38 = __toESM(require_lib4(), 1);
180717
180994
  var toDocNotifyContextSummary = (ctx) => ({
180718
180995
  id: NotificationContextId.make(ctx._id),
180719
180996
  objectId: ctx.objectId,
@@ -180759,7 +181036,7 @@ var listNotifications = (params) => Effect_exports.gen(function* () {
180759
181036
  {
180760
181037
  limit,
180761
181038
  sort: {
180762
- modifiedOn: import_core37.SortingOrder.Descending
181039
+ modifiedOn: import_core38.SortingOrder.Descending
180763
181040
  }
180764
181041
  }
180765
181042
  );
@@ -180901,7 +181178,7 @@ var listNotificationContexts = (params) => Effect_exports.gen(function* () {
180901
181178
  {
180902
181179
  limit,
180903
181180
  sort: {
180904
- lastUpdateTimestamp: import_core37.SortingOrder.Descending
181181
+ lastUpdateTimestamp: import_core38.SortingOrder.Descending
180905
181182
  }
180906
181183
  }
180907
181184
  );
@@ -181118,7 +181395,7 @@ var notificationTools = [
181118
181395
  ];
181119
181396
 
181120
181397
  // src/huly/operations/projects.ts
181121
- var import_core38 = __toESM(require_lib4(), 1);
181398
+ var import_core39 = __toESM(require_lib4(), 1);
181122
181399
  var import_tracker6 = __toESM(require_lib22(), 1);
181123
181400
  var listProjects = (params) => Effect_exports.gen(function* () {
181124
181401
  const client = yield* HulyClient;
@@ -181133,7 +181410,7 @@ var listProjects = (params) => Effect_exports.gen(function* () {
181133
181410
  {
181134
181411
  limit,
181135
181412
  sort: {
181136
- name: import_core38.SortingOrder.Ascending
181413
+ name: import_core39.SortingOrder.Ascending
181137
181414
  }
181138
181415
  }
181139
181416
  );
@@ -181179,6 +181456,16 @@ var getProject = (params) => Effect_exports.gen(function* () {
181179
181456
  )
181180
181457
  );
181181
181458
  });
181459
+ var listStatuses = (params) => Effect_exports.gen(function* () {
181460
+ const { defaultStatusId, statuses } = yield* findProjectWithStatuses(params.project);
181461
+ const details = statuses.map((s) => ({
181462
+ name: StatusName.make(s.name),
181463
+ isDone: s.isDone,
181464
+ isCanceled: s.isCanceled,
181465
+ isDefault: s._id === defaultStatusId
181466
+ }));
181467
+ return { statuses: details, total: details.length };
181468
+ });
181182
181469
  var createProject = (params) => Effect_exports.gen(function* () {
181183
181470
  const client = yield* HulyClient;
181184
181471
  const existing = yield* client.findOne(
@@ -181192,7 +181479,7 @@ var createProject = (params) => Effect_exports.gen(function* () {
181192
181479
  created: false
181193
181480
  };
181194
181481
  }
181195
- const projectId = (0, import_core38.generateId)();
181482
+ const projectId = (0, import_core39.generateId)();
181196
181483
  const projectData = {
181197
181484
  name: params.name,
181198
181485
  description: params.description ?? "",
@@ -181278,6 +181565,17 @@ var projectTools = [
181278
181565
  getProject
181279
181566
  )
181280
181567
  },
181568
+ {
181569
+ name: "list_statuses",
181570
+ 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.",
181571
+ category: CATEGORY14,
181572
+ inputSchema: listStatusesParamsJsonSchema,
181573
+ handler: createToolHandler(
181574
+ "list_statuses",
181575
+ parseListStatusesParams,
181576
+ listStatuses
181577
+ )
181578
+ },
181281
181579
  {
181282
181580
  name: "create_project",
181283
181581
  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.",
@@ -181439,7 +181737,7 @@ var tagCategoryTools = [
181439
181737
  ];
181440
181738
 
181441
181739
  // src/huly/operations/test-management-core.ts
181442
- var import_core39 = __toESM(require_lib4(), 1);
181740
+ var import_core40 = __toESM(require_lib4(), 1);
181443
181741
 
181444
181742
  // src/huly/test-management-classes.ts
181445
181743
  var testManagement = {
@@ -181647,7 +181945,7 @@ var listTestProjects = (params) => Effect_exports.gen(function* () {
181647
181945
  {},
181648
181946
  {
181649
181947
  limit,
181650
- sort: { name: import_core39.SortingOrder.Ascending }
181948
+ sort: { name: import_core40.SortingOrder.Ascending }
181651
181949
  }
181652
181950
  );
181653
181951
  return {
@@ -181669,7 +181967,7 @@ var listTestSuites = (params) => Effect_exports.gen(function* () {
181669
181967
  query,
181670
181968
  {
181671
181969
  limit,
181672
- sort: { modifiedOn: import_core39.SortingOrder.Descending }
181970
+ sort: { modifiedOn: import_core40.SortingOrder.Descending }
181673
181971
  }
181674
181972
  );
181675
181973
  return {
@@ -181702,7 +182000,7 @@ var createTestSuite = (params) => Effect_exports.gen(function* () {
181702
182000
  if (existing !== void 0) {
181703
182001
  return { id: TestSuiteId.make(existing._id), name: existing.name, created: false };
181704
182002
  }
181705
- const suiteId = (0, import_core39.generateId)();
182003
+ const suiteId = (0, import_core40.generateId)();
181706
182004
  const suiteData = {
181707
182005
  name: params.name,
181708
182006
  description: params.description ?? "",
@@ -181772,7 +182070,7 @@ var listTestCases = (params) => Effect_exports.gen(function* () {
181772
182070
  query,
181773
182071
  {
181774
182072
  limit,
181775
- sort: { modifiedOn: import_core39.SortingOrder.Descending }
182073
+ sort: { modifiedOn: import_core40.SortingOrder.Descending }
181776
182074
  }
181777
182075
  );
181778
182076
  return {
@@ -181800,7 +182098,7 @@ var createTestCase = (params) => Effect_exports.gen(function* () {
181800
182098
  const client = yield* HulyClient;
181801
182099
  const project3 = yield* findTestProject(client, params.project);
181802
182100
  const suite = yield* findTestSuite(client, project3, params.suite);
181803
- const caseId = (0, import_core39.generateId)();
182101
+ const caseId = (0, import_core40.generateId)();
181804
182102
  const assigneeRef = params.assignee !== void 0 ? toRef((yield* resolveAssignee2(params.assignee))._id) : null;
181805
182103
  const typeEnum = params.type !== void 0 ? stringToTestCaseType(params.type) ?? 0 /* Functional */ : 0 /* Functional */;
181806
182104
  const priorityEnum = params.priority !== void 0 ? stringToTestCasePriority(params.priority) ?? 1 /* Medium */ : 1 /* Medium */;
@@ -182030,7 +182328,7 @@ var testManagementCoreTools = [
182030
182328
  ];
182031
182329
 
182032
182330
  // src/huly/operations/test-management-plans.ts
182033
- var import_core40 = __toESM(require_lib4(), 1);
182331
+ var import_core41 = __toESM(require_lib4(), 1);
182034
182332
  var toPlanSummary = (p) => ({
182035
182333
  id: TestPlanId.make(p._id),
182036
182334
  name: p.name
@@ -182048,7 +182346,7 @@ var listTestPlans = (params) => Effect_exports.gen(function* () {
182048
182346
  const plans = yield* client.findAll(
182049
182347
  testManagement.class.TestPlan,
182050
182348
  { space: project3._id },
182051
- { limit, sort: { modifiedOn: import_core40.SortingOrder.Descending } }
182349
+ { limit, sort: { modifiedOn: import_core41.SortingOrder.Descending } }
182052
182350
  );
182053
182351
  return { plans: plans.map(toPlanSummary), total: plans.total };
182054
182352
  });
@@ -182083,7 +182381,7 @@ var createTestPlan = (params) => Effect_exports.gen(function* () {
182083
182381
  if (existing !== void 0) {
182084
182382
  return { id: TestPlanId.make(existing._id), name: existing.name, created: false };
182085
182383
  }
182086
- const planId = (0, import_core40.generateId)();
182384
+ const planId = (0, import_core41.generateId)();
182087
182385
  const descRef = params.description !== void 0 && params.description.trim() !== "" ? yield* client.uploadMarkup(
182088
182386
  testManagement.class.TestPlan,
182089
182387
  planId,
@@ -182165,7 +182463,7 @@ var removeTestPlanItem = (params) => Effect_exports.gen(function* () {
182165
182463
  });
182166
182464
 
182167
182465
  // src/huly/operations/test-management-runs.ts
182168
- var import_core41 = __toESM(require_lib4(), 1);
182466
+ var import_core42 = __toESM(require_lib4(), 1);
182169
182467
  var BATCH_CONCURRENCY = 10;
182170
182468
  var toRunSummary = (r) => ({
182171
182469
  id: TestRunId.make(r._id),
@@ -182186,7 +182484,7 @@ var listTestRuns = (params) => Effect_exports.gen(function* () {
182186
182484
  const runs = yield* client.findAll(
182187
182485
  testManagement.class.TestRun,
182188
182486
  { space: project3._id },
182189
- { limit, sort: { modifiedOn: import_core41.SortingOrder.Descending } }
182487
+ { limit, sort: { modifiedOn: import_core42.SortingOrder.Descending } }
182190
182488
  );
182191
182489
  return { runs: runs.map(toRunSummary), total: runs.total };
182192
182490
  });
@@ -182215,7 +182513,7 @@ var getTestRun = (params) => Effect_exports.gen(function* () {
182215
182513
  var createTestRun = (params) => Effect_exports.gen(function* () {
182216
182514
  const client = yield* HulyClient;
182217
182515
  const project3 = yield* findTestProject(client, params.project);
182218
- const runId = (0, import_core41.generateId)();
182516
+ const runId = (0, import_core42.generateId)();
182219
182517
  const descRef = params.description !== void 0 && params.description.trim() !== "" ? yield* client.uploadMarkup(
182220
182518
  testManagement.class.TestRun,
182221
182519
  runId,
@@ -182272,7 +182570,7 @@ var listTestResults = (params) => Effect_exports.gen(function* () {
182272
182570
  const results = yield* client.findAll(
182273
182571
  testManagement.class.TestResult,
182274
182572
  { attachedTo: run3._id },
182275
- { limit, sort: { modifiedOn: import_core41.SortingOrder.Descending } }
182573
+ { limit, sort: { modifiedOn: import_core42.SortingOrder.Descending } }
182276
182574
  );
182277
182575
  return { results: results.map(toResultSummary), total: results.total };
182278
182576
  });
@@ -182373,7 +182671,7 @@ var runTestPlan = (params) => Effect_exports.gen(function* () {
182373
182671
  }
182374
182672
  return { item, tc };
182375
182673
  }), { concurrency: BATCH_CONCURRENCY });
182376
- const runId = (0, import_core41.generateId)();
182674
+ const runId = (0, import_core42.generateId)();
182377
182675
  const runName = params.runName ?? `${plan.name} - Run`;
182378
182676
  yield* client.createDoc(testManagement.class.TestRun, project3._id, {
182379
182677
  name: runName,
@@ -182547,7 +182845,7 @@ var testManagementPlansTools = [
182547
182845
 
182548
182846
  // src/huly/operations/time.ts
182549
182847
  var import_calendar6 = __toESM(require_lib25(), 1);
182550
- var import_core42 = __toESM(require_lib4(), 1);
182848
+ var import_core43 = __toESM(require_lib4(), 1);
182551
182849
  var import_tracker7 = __toESM(require_lib22(), 1);
182552
182850
  var serverPopulatedCalendar = toRef("");
182553
182851
  var serverPopulatedPersonId = "";
@@ -182557,7 +182855,7 @@ var logTime = (params) => Effect_exports.gen(function* () {
182557
182855
  project: params.project,
182558
182856
  identifier: params.identifier
182559
182857
  });
182560
- const reportId = (0, import_core42.generateId)();
182858
+ const reportId = (0, import_core43.generateId)();
182561
182859
  const now2 = yield* Clock_exports.currentTimeMillis;
182562
182860
  const reportData = {
182563
182861
  employee: null,
@@ -182597,7 +182895,7 @@ var getTimeReport = (params) => Effect_exports.gen(function* () {
182597
182895
  const reports = yield* client.findAll(
182598
182896
  tracker.class.TimeSpendReport,
182599
182897
  { attachedTo: issue2._id },
182600
- { sort: { date: import_core42.SortingOrder.Descending } }
182898
+ { sort: { date: import_core43.SortingOrder.Descending } }
182601
182899
  );
182602
182900
  const employeeIds = [
182603
182901
  ...new Set(
@@ -182649,7 +182947,7 @@ var listTimeSpendReports = (params) => Effect_exports.gen(function* () {
182649
182947
  tracker.class.TimeSpendReport,
182650
182948
  query,
182651
182949
  withLookup(
182652
- { limit, sort: { date: import_core42.SortingOrder.Descending } },
182950
+ { limit, sort: { date: import_core43.SortingOrder.Descending } },
182653
182951
  {
182654
182952
  attachedTo: tracker.class.Issue,
182655
182953
  employee: contact.class.Person
@@ -182678,7 +182976,7 @@ var getDetailedTimeReport = (params) => Effect_exports.gen(function* () {
182678
182976
  tracker.class.TimeSpendReport,
182679
182977
  query,
182680
182978
  withLookup(
182681
- { sort: { date: import_core42.SortingOrder.Descending } },
182979
+ { sort: { date: import_core43.SortingOrder.Descending } },
182682
182980
  {
182683
182981
  attachedTo: tracker.class.Issue,
182684
182982
  employee: contact.class.Person
@@ -182754,7 +183052,7 @@ var listWorkSlots = (params) => Effect_exports.gen(function* () {
182754
183052
  const slots = yield* client.findAll(
182755
183053
  time.class.WorkSlot,
182756
183054
  query,
182757
- { limit, sort: { date: import_core42.SortingOrder.Descending } }
183055
+ { limit, sort: { date: import_core43.SortingOrder.Descending } }
182758
183056
  );
182759
183057
  return slots.map((s) => ({
182760
183058
  id: s._id,
@@ -182766,7 +183064,7 @@ var listWorkSlots = (params) => Effect_exports.gen(function* () {
182766
183064
  });
182767
183065
  var createWorkSlot = (params) => Effect_exports.gen(function* () {
182768
183066
  const client = yield* HulyClient;
182769
- const slotId = (0, import_core42.generateId)();
183067
+ const slotId = (0, import_core43.generateId)();
182770
183068
  const slotData = {
182771
183069
  date: params.date,
182772
183070
  dueDate: params.dueDate,
@@ -182910,15 +183208,15 @@ var timeTools = [
182910
183208
  ];
182911
183209
 
182912
183210
  // src/huly/operations/workspace.ts
182913
- var import_core43 = __toESM(require_lib4(), 1);
183211
+ var import_core44 = __toESM(require_lib4(), 1);
182914
183212
  var accountRoleMap = {
182915
- READONLYGUEST: import_core43.AccountRole.ReadOnlyGuest,
182916
- DocGuest: import_core43.AccountRole.DocGuest,
182917
- GUEST: import_core43.AccountRole.Guest,
182918
- USER: import_core43.AccountRole.User,
182919
- MAINTAINER: import_core43.AccountRole.Maintainer,
182920
- OWNER: import_core43.AccountRole.Owner,
182921
- ADMIN: import_core43.AccountRole.Admin
183213
+ READONLYGUEST: import_core44.AccountRole.ReadOnlyGuest,
183214
+ DocGuest: import_core44.AccountRole.DocGuest,
183215
+ GUEST: import_core44.AccountRole.Guest,
183216
+ USER: import_core44.AccountRole.User,
183217
+ MAINTAINER: import_core44.AccountRole.Maintainer,
183218
+ OWNER: import_core44.AccountRole.Owner,
183219
+ ADMIN: import_core44.AccountRole.Admin
182922
183220
  };
182923
183221
  var toHulyAccountRole = (role) => accountRoleMap[role];
182924
183222
  var formatVersion = (info) => `${info.versionMajor}.${info.versionMinor}.${info.versionPatch}`;