@firfi/huly-mcp 0.22.1 → 0.23.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.
Files changed (3) hide show
  1. package/README.md +16 -3
  2. package/dist/index.cjs +1561 -674
  3. package/package.json +4 -3
package/dist/index.cjs CHANGED
@@ -31044,7 +31044,7 @@ var require_utils2 = __commonJS({
31044
31044
  escapeLikeForRegexp: () => escapeLikeForRegexp,
31045
31045
  fillConfiguration: () => fillConfiguration,
31046
31046
  fillDefaults: () => fillDefaults,
31047
- generateId: () => generateId24,
31047
+ generateId: () => generateId25,
31048
31048
  generateUuid: () => generateUuid,
31049
31049
  getBranding: () => getBranding,
31050
31050
  getCurrentAccount: () => getCurrentAccount,
@@ -31105,10 +31105,10 @@ var require_utils2 = __commonJS({
31105
31105
  return toHex(val, 6);
31106
31106
  }
31107
31107
  __name(count3, "count");
31108
- function generateId24(join4 = "") {
31108
+ function generateId25(join4 = "") {
31109
31109
  return timestamp() + join4 + random4 + join4 + count3();
31110
31110
  }
31111
- __name(generateId24, "generateId");
31111
+ __name(generateId25, "generateId");
31112
31112
  function generateUuid() {
31113
31113
  return crypto.randomUUID();
31114
31114
  }
@@ -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: () => SortingOrder38,
34080
+ SortingOrder: () => SortingOrder40,
34081
34081
  shouldShowArchived: () => shouldShowArchived
34082
34082
  });
34083
34083
  module2.exports = __toCommonJS2(storage_exports);
34084
- var SortingOrder38 = /* @__PURE__ */ ((SortingOrder210) => {
34084
+ var SortingOrder40 = /* @__PURE__ */ ((SortingOrder210) => {
34085
34085
  SortingOrder210[SortingOrder210["Ascending"] = 1] = "Ascending";
34086
34086
  SortingOrder210[SortingOrder210["Descending"] = -1] = "Descending";
34087
34087
  return SortingOrder210;
34088
- })(SortingOrder38 || {});
34088
+ })(SortingOrder40 || {});
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_core60 = require_lib4();
34591
+ var import_core62 = require_lib4();
34592
34592
  var import_platform4 = __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_core60.concatLink)(this.url, "/providers"));
34627
+ const response = await fetch((0, import_core62.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_core60.concatLink)(this.url, "/cookie");
35282
+ const url4 = (0, import_core62.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_core60.concatLink)(this.url, "/cookie");
35292
+ const url4 = (0, import_core62.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: () => loadServerConfig2
35569
35569
  });
35570
35570
  module2.exports = __toCommonJS2(config_exports3);
35571
- var import_core60 = require_lib4();
35571
+ var import_core62 = require_lib4();
35572
35572
  async function loadServerConfig2(url4) {
35573
- const configUrl = (0, import_core60.concatLink)(url4, "/config.json");
35573
+ const configUrl = (0, import_core62.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_core60 = require_lib4();
35659
+ var import_core62 = 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_core60.concatLink)(this.collaboratorUrl, `/rpc/${encodeURIComponent(documentId)}`);
35678
+ const url4 = (0, import_core62.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_core60 = require_dist16();
53245
+ var import_core62 = require_dist16();
53246
53246
  var import_utils14 = require_utils5();
53247
- var ImageNode = import_core60.Node.create({
53247
+ var ImageNode = import_core62.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_core60.mergeAttributes)(
53306
+ const imgAttributes = (0, import_core62.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_core60 = require_dist16();
53350
+ var import_core62 = require_dist16();
53351
53351
  var import_utils14 = require_utils5();
53352
- var ReferenceNode = import_core60.Node.create({
53352
+ var ReferenceNode = import_core62.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_core60.mergeAttributes)(
53387
+ (0, import_core62.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_core60 = require_dist16();
53447
- var EmojiNode = import_core60.Node.create({
53446
+ var import_core62 = require_dist16();
53447
+ var EmojiNode = import_core62.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_core60.mergeAttributes)(
53487
+ const containerAttributes = (0, import_core62.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_core60.mergeAttributes)(
53520
+ (0, import_core62.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_core60.mergeAttributes)({
53529
+ (0, import_core62.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_core60.mergeAttributes)(
53539
+ (0, import_core62.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_core60 = require_dist16();
53848
- var FileNode = import_core60.Node.create({
53847
+ var import_core62 = require_dist16();
53848
+ var FileNode = import_core62.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_core60 = require_dist16();
54158
+ var import_core62 = 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_core60.textblockTypeInputRule)({
54204
+ (0, import_core62.textblockTypeInputRule)({
54205
54205
  find: backtickInputRegex,
54206
54206
  type: this.type
54207
54207
  }),
54208
- (0, import_core60.textblockTypeInputRule)({
54208
+ (0, import_core62.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_core60 = require_dist16();
54245
- var CommentNode = import_core60.Node.create({
54244
+ var import_core62 = require_dist16();
54245
+ var CommentNode = import_core62.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_core60 = require_dist16();
54292
- var MarkdownNode = import_core60.Node.create({
54291
+ var import_core62 = require_dist16();
54292
+ var MarkdownNode = import_core62.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_core60.mergeAttributes)({ "data-type": this.name }, this.options.HTMLAttributes, HTMLAttributes),
54310
+ (0, import_core62.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_core60 = require_dist16();
54345
- var EmbedNode = import_core60.Node.create({
54344
+ var import_core62 = require_dist16();
54345
+ var EmbedNode = import_core62.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_core60.mergeAttributes)(HTMLAttributes)]];
54370
+ return ["figure", { "data-type": this.name }, ["iframe", (0, import_core62.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_core60 = require_dist16();
54444
+ var import_core62 = 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_core60.Mark.create({
54459
+ var NoteBaseExtension = import_core62.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_core60 = require_dist16();
54516
+ var import_core62 = require_dist16();
54517
54517
  var NAME2 = "node-uuid";
54518
- var QMSInlineCommentMark = import_core60.Mark.create({
54518
+ var QMSInlineCommentMark = import_core62.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_core60 = require_dist16();
54563
+ var import_core62 = require_dist16();
54564
54564
  function extensionKit(name, fn2) {
54565
- return import_core60.Extension.create({
54565
+ return import_core62.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_core60 = require_dist16();
61594
+ var import_core62 = require_dist16();
61595
61595
  var import_extension_text_style = require_dist20();
61596
- var BackgroundColor = import_core60.Extension.create({
61596
+ var BackgroundColor = import_core62.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_core60.Extension.create({
61637
+ var TextColor = import_core62.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_core60 = require_dist16();
61709
+ var import_core62 = require_dist16();
61710
61710
  var import_model = require_dist10();
61711
61711
  var import_state = require_dist5();
61712
- var InlineCommentMark = import_core60.Mark.create({
61712
+ var InlineCommentMark = import_core62.Mark.create({
61713
61713
  name: "inline-comment",
61714
61714
  excludes: "",
61715
61715
  inclusive: false,
@@ -77233,7 +77233,7 @@ var require_client5 = __commonJS({
77233
77233
  createMarkupOperations: () => createMarkupOperations
77234
77234
  });
77235
77235
  module2.exports = __toCommonJS2(client_exports);
77236
- var import_core60 = require_lib4();
77236
+ var import_core62 = require_lib4();
77237
77237
  var import_collaborator_client2 = require_lib7();
77238
77238
  var import_text5 = require_lib9();
77239
77239
  var import_text_markdown3 = require_lib17();
@@ -77247,8 +77247,8 @@ var require_client5 = __commonJS({
77247
77247
  this.workspace = workspace;
77248
77248
  this.token = token;
77249
77249
  this.config = config3;
77250
- this.refUrl = (0, import_core60.concatLink)(this.url, `/browse?workspace=${workspace}`);
77251
- this.imageUrl = (0, import_core60.concatLink)(this.url, `/files?workspace=${workspace}&file=`);
77250
+ this.refUrl = (0, import_core62.concatLink)(this.url, `/browse?workspace=${workspace}`);
77251
+ this.imageUrl = (0, import_core62.concatLink)(this.url, `/files?workspace=${workspace}&file=`);
77252
77252
  this.collaborator = (0, import_collaborator_client2.getClient)(workspace, token, config3.COLLABORATOR_URL);
77253
77253
  }
77254
77254
  static {
@@ -77258,7 +77258,7 @@ var require_client5 = __commonJS({
77258
77258
  imageUrl;
77259
77259
  refUrl;
77260
77260
  async fetchMarkup(objectClass, objectId, objectAttr, doc, format7) {
77261
- const collabId = (0, import_core60.makeCollabId)(objectClass, objectId, objectAttr);
77261
+ const collabId = (0, import_core62.makeCollabId)(objectClass, objectId, objectAttr);
77262
77262
  const markup = await this.collaborator.getMarkup(collabId, doc);
77263
77263
  const json3 = (0, import_text5.markupToJSON)(markup);
77264
77264
  switch (format7) {
@@ -77287,7 +77287,7 @@ var require_client5 = __commonJS({
77287
77287
  default:
77288
77288
  throw new Error("Unknown content format");
77289
77289
  }
77290
- const collabId = (0, import_core60.makeCollabId)(objectClass, objectId, objectAttr);
77290
+ const collabId = (0, import_core62.makeCollabId)(objectClass, objectId, objectAttr);
77291
77291
  return await this.collaborator.createMarkup(collabId, markup);
77292
77292
  }
77293
77293
  };
@@ -81771,8 +81771,8 @@ var require_connection2 = __commonJS({
81771
81771
  });
81772
81772
  module2.exports = __toCommonJS2(connection_exports);
81773
81773
  var import_analytics = require_lib2();
81774
- var import_client43 = __toESM2(require_lib6());
81775
- var import_core60 = __toESM2(require_lib4());
81774
+ var import_client45 = __toESM2(require_lib6());
81775
+ var import_core62 = __toESM2(require_lib4());
81776
81776
  var import_platform4 = __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_core60.generateId)();
81819
+ sessionId = (0, import_core62.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_core60.generateId)();
81830
+ this.sessionId = (0, import_core62.generateId)();
81831
81831
  }
81832
81832
  this.rpcHandler = opt?.useGlobalRPCHandler === true ? globalRPCHandler : new import_rpc.RPCHandler();
81833
81833
  this.pushHandler(handler);
@@ -81882,7 +81882,7 @@ var require_connection2 = __commonJS({
81882
81882
  }
81883
81883
  if (!this.closed) {
81884
81884
  void this.sendRequest({
81885
- method: import_client43.pingConst,
81885
+ method: import_client45.pingConst,
81886
81886
  params: [],
81887
81887
  once: true,
81888
81888
  handleResult: /* @__PURE__ */ __name(async (result) => {
@@ -81915,7 +81915,7 @@ var require_connection2 = __commonJS({
81915
81915
  }
81916
81916
  }
81917
81917
  isConnected() {
81918
- return this.websocket != null && this.websocket.readyState === import_client43.ClientSocketReadyState.OPEN && this.helloReceived;
81918
+ return this.websocket != null && this.websocket.readyState === import_client45.ClientSocketReadyState.OPEN && this.helloReceived;
81919
81919
  }
81920
81920
  delay = 0;
81921
81921
  onConnectHandlers = [];
@@ -82007,7 +82007,7 @@ var require_connection2 = __commonJS({
82007
82007
  if (resp.id === -1) {
82008
82008
  this.delay = 0;
82009
82009
  if (resp.result?.state === "upgrading") {
82010
- void this.onConnect?.(import_core60.ClientConnectEvent.Maintenance, void 0, resp.result.stats);
82010
+ void this.onConnect?.(import_core62.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_core60.ClientConnectEvent.Reconnected : import_core60.ClientConnectEvent.Connected,
82045
+ helloResp.reconnect === true ? import_core62.ClientConnectEvent.Reconnected : import_core62.ClientConnectEvent.Connected,
82046
82046
  helloResp.lastTx,
82047
82047
  this.sessionId
82048
82048
  )?.catch((err) => {
@@ -82055,8 +82055,8 @@ var require_connection2 = __commonJS({
82055
82055
  }
82056
82056
  return;
82057
82057
  }
82058
- if (resp.result === import_client43.pingConst) {
82059
- void this.sendRequest({ method: import_client43.pingConst, params: [] }).catch((err) => {
82058
+ if (resp.result === import_client45.pingConst) {
82059
+ void this.sendRequest({ method: import_client45.pingConst, params: [] }).catch((err) => {
82060
82060
  this.ctx.error("failed to send ping", { err });
82061
82061
  });
82062
82062
  return;
@@ -82092,7 +82092,7 @@ var require_connection2 = __commonJS({
82092
82092
  }
82093
82093
  result = result.concat(c.data);
82094
82094
  }
82095
- resp.result = (0, import_core60.toFindResult)(result, total, lookupMap);
82095
+ resp.result = (0, import_core62.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_core60.default.class.TxModelUpgrade) {
82139
+ if (tx?._class === import_core62.default.class.TxModelUpgrade) {
82140
82140
  console.log("Processing upgrade", this.workspace, this.user);
82141
82141
  this.opt?.onUpgrade?.();
82142
82142
  return;
@@ -82148,15 +82148,15 @@ var require_connection2 = __commonJS({
82148
82148
  }
82149
82149
  }
82150
82150
  checkArrayBufferPing(data) {
82151
- if (data.byteLength === import_client43.pingConst.length || data.byteLength === import_client43.pongConst.length) {
82151
+ if (data.byteLength === import_client45.pingConst.length || data.byteLength === import_client45.pongConst.length) {
82152
82152
  const text = new TextDecoder().decode(data);
82153
- if (text === import_client43.pingConst) {
82154
- void this.sendRequest({ method: import_client43.pingConst, params: [] }).catch((err) => {
82153
+ if (text === import_client45.pingConst) {
82154
+ void this.sendRequest({ method: import_client45.pingConst, params: [] }).catch((err) => {
82155
82155
  this.ctx.error("failed to send ping", { err });
82156
82156
  });
82157
82157
  return true;
82158
82158
  }
82159
- if (text === import_client43.pongConst) {
82159
+ if (text === import_client45.pongConst) {
82160
82160
  this.pingResponse = Date.now();
82161
82161
  return true;
82162
82162
  }
@@ -82166,7 +82166,7 @@ var require_connection2 = __commonJS({
82166
82166
  openConnection(ctx, socketId) {
82167
82167
  this.binaryMode = false;
82168
82168
  this.helloReceived = false;
82169
- const clientSocketFactory = this.opt?.socketFactory ?? (0, import_platform4.getMetadata)(import_client43.default.metadata.ClientSocketFactory) ?? ((url4) => {
82169
+ const clientSocketFactory = this.opt?.socketFactory ?? (0, import_platform4.getMetadata)(import_client45.default.metadata.ClientSocketFactory) ?? ((url4) => {
82170
82170
  const s = new WebSocket(url4);
82171
82171
  return s;
82172
82172
  });
@@ -82201,12 +82201,12 @@ var require_connection2 = __commonJS({
82201
82201
  if (this.websocket !== wsocket) {
82202
82202
  return;
82203
82203
  }
82204
- if (event.data === import_client43.pongConst) {
82204
+ if (event.data === import_client45.pongConst) {
82205
82205
  this.pingResponse = Date.now();
82206
82206
  return;
82207
82207
  }
82208
- if (event.data === import_client43.pingConst) {
82209
- void this.sendRequest({ method: import_client43.pingConst, params: [] }).catch((err) => {
82208
+ if (event.data === import_client45.pingConst) {
82209
+ void this.sendRequest({ method: import_client45.pingConst, params: [] }).catch((err) => {
82210
82210
  this.ctx.error("failed to send ping", { err });
82211
82211
  });
82212
82212
  return;
@@ -82271,8 +82271,8 @@ var require_connection2 = __commonJS({
82271
82271
  if (this.websocket !== wsocket) {
82272
82272
  return;
82273
82273
  }
82274
- const useBinary = this.opt?.useBinaryProtocol ?? (0, import_platform4.getMetadata)(import_client43.default.metadata.UseBinaryProtocol) ?? true;
82275
- this.compressionMode = this.opt?.useProtocolCompression ?? (0, import_platform4.getMetadata)(import_client43.default.metadata.UseProtocolCompression) ?? false;
82274
+ const useBinary = this.opt?.useBinaryProtocol ?? (0, import_platform4.getMetadata)(import_client45.default.metadata.UseBinaryProtocol) ?? true;
82275
+ this.compressionMode = this.opt?.useProtocolCompression ?? (0, import_platform4.getMetadata)(import_client45.default.metadata.UseProtocolCompression) ?? false;
82276
82276
  const helloRequest = {
82277
82277
  method: "hello",
82278
82278
  params: [],
@@ -82318,13 +82318,13 @@ var require_connection2 = __commonJS({
82318
82318
  if (w instanceof Promise) {
82319
82319
  await w;
82320
82320
  }
82321
- if (data.method !== import_client43.pingConst) {
82321
+ if (data.method !== import_client45.pingConst) {
82322
82322
  this.requests.set(id, promise4);
82323
82323
  }
82324
82324
  promise4.sendData = () => {
82325
- if (this.websocket?.readyState === import_client43.ClientSocketReadyState.OPEN) {
82325
+ if (this.websocket?.readyState === import_client45.ClientSocketReadyState.OPEN) {
82326
82326
  promise4.startTime = Date.now();
82327
- if (data.method !== import_client43.pingConst) {
82327
+ if (data.method !== import_client45.pingConst) {
82328
82328
  const dta = this.rpcHandler.serialize(
82329
82329
  {
82330
82330
  method: data.method,
@@ -82337,7 +82337,7 @@ var require_connection2 = __commonJS({
82337
82337
  );
82338
82338
  this.websocket?.send(dta);
82339
82339
  } else {
82340
- this.websocket?.send(import_client43.pingConst);
82340
+ this.websocket?.send(import_client45.pingConst);
82341
82341
  }
82342
82342
  }
82343
82343
  };
@@ -82351,7 +82351,7 @@ var require_connection2 = __commonJS({
82351
82351
  };
82352
82352
  }
82353
82353
  promise4.sendData();
82354
- if (data.method !== import_client43.pingConst) {
82354
+ if (data.method !== import_client45.pingConst) {
82355
82355
  return await promise4.promise;
82356
82356
  }
82357
82357
  },
@@ -82366,7 +82366,7 @@ var require_connection2 = __commonJS({
82366
82366
  }
82367
82367
  getAccount() {
82368
82368
  if (this.account !== void 0) {
82369
- return Promise.resolve((0, import_core60.clone)(this.account));
82369
+ return Promise.resolve((0, import_core62.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_core60.default.class.TxApplyIf) {
82428
- return (await this.findAll(import_core60.default.class.Tx, { _id: tx.txes[0]._id }, { limit: 1 })).length === 0;
82427
+ if (tx._class === import_core62.default.class.TxApplyIf) {
82428
+ return (await this.findAll(import_core62.default.class.Tx, { _id: tx.txes[0]._id }, { limit: 1 })).length === 0;
82429
82429
  }
82430
- return (await this.findAll(import_core60.default.class.Tx, { _id: tx._id }, { limit: 1 })).length === 0;
82430
+ return (await this.findAll(import_core62.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_core60.MeasureMetricsContext("connection", {}),
82470
+ opt?.ctx?.newChild?.("connection", {}) ?? new import_core62.MeasureMetricsContext("connection", {}),
82471
82471
  url4,
82472
82472
  handler,
82473
82473
  workspace,
@@ -82517,14 +82517,14 @@ var require_lib19 = __commonJS({
82517
82517
  default: () => index_default
82518
82518
  });
82519
82519
  module2.exports = __toCommonJS2(index_exports2);
82520
- var import_client43 = __toESM2(require_lib6());
82521
- var import_core60 = __toESM2(require_lib4());
82520
+ var import_client45 = __toESM2(require_lib6());
82521
+ var import_core62 = __toESM2(require_lib4());
82522
82522
  var import_platform4 = __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_core60.platformNow)();
82527
+ const st = (0, import_core62.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_core60.platformNow)() - st);
82538
+ console.log("init DB complete", (0, import_core62.platformNow)() - st);
82539
82539
  resolve2(db);
82540
82540
  };
82541
82541
  });
@@ -82561,19 +82561,19 @@ var require_lib19 = __commonJS({
82561
82561
  return {
82562
82562
  function: {
82563
82563
  GetClient: /* @__PURE__ */ __name(async (token, endpoint, opt) => {
82564
- const filterModel = (0, import_platform4.getMetadata)(import_client43.default.metadata.FilterModel) ?? "none";
82565
- const extraFilter = (0, import_platform4.getMetadata)(import_client43.default.metadata.ExtraFilter) ?? [];
82564
+ const filterModel = (0, import_platform4.getMetadata)(import_client45.default.metadata.FilterModel) ?? "none";
82565
+ const extraFilter = (0, import_platform4.getMetadata)(import_client45.default.metadata.ExtraFilter) ?? [];
82566
82566
  const handler = /* @__PURE__ */ __name(async (handler2) => {
82567
- const url4 = (0, import_core60.concatLink)(endpoint, `/${token}`);
82567
+ const url4 = (0, import_core62.concatLink)(endpoint, `/${token}`);
82568
82568
  const upgradeHandler = /* @__PURE__ */ __name((...txes) => {
82569
82569
  for (const tx of txes) {
82570
- if (tx?._class === import_core60.default.class.TxModelUpgrade) {
82570
+ if (tx?._class === import_core62.default.class.TxModelUpgrade) {
82571
82571
  opt?.onUpgrade?.();
82572
82572
  return;
82573
82573
  }
82574
- if (tx?._class === import_core60.default.class.TxWorkspaceEvent) {
82574
+ if (tx?._class === import_core62.default.class.TxWorkspaceEvent) {
82575
82575
  const event = tx;
82576
- if (event.event === import_core60.WorkspaceEvent.MaintenanceNotification) {
82576
+ if (event.event === import_core62.WorkspaceEvent.MaintenanceNotification) {
82577
82577
  void (0, import_platform4.setPlatformStatus)(
82578
82578
  new import_platform4.Status(import_platform4.Severity.WARNING, import_platform4.default.status.MaintenanceWarning, {
82579
82579
  time: event.params.timeMinutes,
@@ -82590,7 +82590,7 @@ var require_lib19 = __commonJS({
82590
82590
  throw new Error("Workspace or account not found in token");
82591
82591
  }
82592
82592
  const newOpt = { ...opt };
82593
- const connectTimeout = opt?.connectionTimeout ?? (0, import_platform4.getMetadata)(import_client43.default.metadata.ConnectionTimeout);
82593
+ const connectTimeout = opt?.connectionTimeout ?? (0, import_platform4.getMetadata)(import_client45.default.metadata.ConnectionTimeout);
82594
82594
  let connectPromise;
82595
82595
  if ((connectTimeout ?? 0) > 0) {
82596
82596
  connectPromise = new Promise((resolve2, reject) => {
@@ -82611,7 +82611,7 @@ var require_lib19 = __commonJS({
82611
82611
  reject(error2);
82612
82612
  return;
82613
82613
  }
82614
- if (event !== import_core60.ClientConnectEvent.Maintenance) {
82614
+ if (event !== import_core62.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_core60.createClient)(handler, modelFilter, createModelPersistence(getWSFromToken(token)), opt?.ctx);
82636
+ const client = (0, import_core62.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_core60.fillConfiguration)(txes, configs);
82645
- const allowedPlugins = [...(0, import_platform4.getPlugins)(), ...(0, import_platform4.getMetadata)(import_client43.default.metadata.ExtraPlugins) ?? []];
82644
+ (0, import_core62.fillConfiguration)(txes, configs);
82645
+ const allowedPlugins = [...(0, import_platform4.getPlugins)(), ...(0, import_platform4.getMetadata)(import_client45.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_core60.pluginFilterTx)(excludedPlugins, configs, txes);
82649
+ return (0, import_core62.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_core60.fillConfiguration)(txes, configs);
82654
+ (0, import_core62.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_core60.pluginFilterTx)(excludedPlugins, configs, txes).filter((tx) => {
82681
- if (tx?._class === import_core60.default.class.TxCreateDoc || tx?._class === import_core60.default.class.TxUpdateDoc || tx?._class === import_core60.default.class.TxRemoveDoc) {
82680
+ const result = (0, import_core62.pluginFilterTx)(excludedPlugins, configs, txes).filter((tx) => {
82681
+ if (tx?._class === import_core62.default.class.TxCreateDoc || tx?._class === import_core62.default.class.TxUpdateDoc || tx?._class === import_core62.default.class.TxRemoveDoc) {
82682
82682
  const cud = tx;
82683
82683
  if (toExclude.has(cud.objectClass)) {
82684
82684
  return false;
@@ -82690,7 +82690,7 @@ var require_lib19 = __commonJS({
82690
82690
  }
82691
82691
  __name(returnClientTxes, "returnClientTxes");
82692
82692
  function createModelPersistence(workspace) {
82693
- const overrideStore = (0, import_platform4.getMetadata)(import_client43.default.metadata.OverridePersistenceStore);
82693
+ const overrideStore = (0, import_platform4.getMetadata)(import_client45.default.metadata.OverridePersistenceStore);
82694
82694
  if (overrideStore !== void 0) {
82695
82695
  return overrideStore;
82696
82696
  }
@@ -82787,8 +82787,8 @@ var require_client6 = __commonJS({
82787
82787
  });
82788
82788
  module2.exports = __toCommonJS2(client_exports);
82789
82789
  var import_account_client2 = require_lib5();
82790
- var import_client43 = __toESM2(require_lib6());
82791
- var import_core60 = require_lib4();
82790
+ var import_client45 = __toESM2(require_lib6());
82791
+ var import_core62 = require_lib4();
82792
82792
  var import_platform4 = require_lib();
82793
82793
  var import_config9 = require_config();
82794
82794
  var import_markup12 = 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_core60.pickPrimarySocialId)(socialIds)._id,
82808
+ primarySocialId: (0, import_core62.pickPrimarySocialId)(socialIds)._id,
82809
82809
  socialIds: socialIds.map((si) => si._id),
82810
82810
  fullSocialIds: socialIds
82811
82811
  };
@@ -82813,9 +82813,9 @@ var require_client6 = __commonJS({
82813
82813
  }
82814
82814
  __name(connect, "connect");
82815
82815
  async function createClient(url4, endpoint, token, workspaceUuid, account, config3, options) {
82816
- (0, import_platform4.addLocation)(import_client43.clientId, () => Promise.resolve().then(() => __toESM(require_lib19())));
82816
+ (0, import_platform4.addLocation)(import_client45.clientId, () => Promise.resolve().then(() => __toESM(require_lib19())));
82817
82817
  const { socketFactory, connectionTimeout } = options;
82818
- const clientFactory = await (0, import_platform4.getResource)(import_client43.default.function.GetClient);
82818
+ const clientFactory = await (0, import_platform4.getResource)(import_client45.default.function.GetClient);
82819
82819
  const connection = await clientFactory(token, endpoint, {
82820
82820
  socketFactory,
82821
82821
  connectionTimeout
@@ -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_core60.TxOperations(connection, account.primarySocialId);
82834
+ this.client = new import_core62.TxOperations(connection, account.primarySocialId);
82835
82835
  this.markup = (0, import_markup12.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_core60.generateId)();
82874
+ id ??= (0, import_core62.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_core60.generateId)();
82887
+ id ??= (0, import_core62.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_core60 = require_lib4();
83214
+ var import_core62 = require_lib4();
83215
83215
  var import_platform4 = 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 requestUrl2 = (0, import_core60.concatLink)(this.endpoint, `/api/v1/find-all/${this.workspace}?${params.toString()}`);
83269
+ const requestUrl2 = (0, import_core62.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(requestUrl2, 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 requestUrl2 = (0, import_core60.concatLink)(this.endpoint, `/api/v1/account/${this.workspace}`);
83343
+ const requestUrl2 = (0, import_core62.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(requestUrl2, this.requestInit());
@@ -83357,7 +83357,7 @@ var require_rest = __commonJS({
83357
83357
  return result;
83358
83358
  }
83359
83359
  async getModel(full = false) {
83360
- const requestUrl2 = new URL((0, import_core60.concatLink)(this.endpoint, `/api/v1/load-model/${this.workspace}`));
83360
+ const requestUrl2 = new URL((0, import_core62.concatLink)(this.endpoint, `/api/v1/load-model/${this.workspace}`));
83361
83361
  if (full) {
83362
83362
  requestUrl2.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_core60.Hierarchy();
83374
- const model = new import_core60.ModelDb(hierarchy);
83375
- const ctx = new import_core60.MeasureMetricsContext("loadModel", {});
83376
- (0, import_core60.buildModel)(ctx, modelResponse, void 0, hierarchy, model);
83373
+ const hierarchy = new import_core62.Hierarchy();
83374
+ const model = new import_core62.ModelDb(hierarchy);
83375
+ const ctx = new import_core62.MeasureMetricsContext("loadModel", {});
83376
+ (0, import_core62.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 requestUrl2 = (0, import_core60.concatLink)(this.endpoint, `/api/v1/tx/${this.workspace}`);
83388
+ const requestUrl2 = (0, import_core62.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(requestUrl2, {
@@ -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 requestUrl2 = (0, import_core60.concatLink)(this.endpoint, `/api/v1/search-fulltext/${this.workspace}?${params.toString()}`);
83422
+ const requestUrl2 = (0, import_core62.concatLink)(this.endpoint, `/api/v1/search-fulltext/${this.workspace}?${params.toString()}`);
83423
83423
  const response = await fetch(requestUrl2, {
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 requestUrl2 = (0, import_core60.concatLink)(this.endpoint, `/api/v1/request/${domain3}/${this.workspace}`);
83441
+ const requestUrl2 = (0, import_core62.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(requestUrl2, {
@@ -83457,7 +83457,7 @@ var require_rest = __commonJS({
83457
83457
  }, isRLE);
83458
83458
  }
83459
83459
  async ensurePerson(socialType, socialValue, firstName, lastName) {
83460
- const requestUrl2 = (0, import_core60.concatLink)(this.endpoint, `/api/v1/ensure-person/${this.workspace}`);
83460
+ const requestUrl2 = (0, import_core62.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(requestUrl2, {
@@ -83514,13 +83514,13 @@ var require_tx2 = __commonJS({
83514
83514
  createRestTxOperations: () => createRestTxOperations2
83515
83515
  });
83516
83516
  module2.exports = __toCommonJS2(tx_exports);
83517
- var import_core60 = require_lib4();
83517
+ var import_core62 = 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_core60.TxOperations(new RestTxClient(restClient, hierarchy, model, account), account.socialIds[0]);
83523
+ return new import_core62.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_core60.toFindResult)(result, data.total);
83544
+ return (0, import_core62.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_core60 = __toESM2(require_lib4());
83726
+ var import_core62 = __toESM2(require_lib4());
83727
83727
  var import_stream2 = require("stream");
83728
83728
  var import_config9 = 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_core60.default.class.Blob,
83763
+ _class: import_core62.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_core60.default.space.Configuration,
83769
- modifiedBy: import_core60.default.account.System,
83768
+ space: import_core62.default.space.Configuration,
83769
+ modifiedBy: import_core62.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_core60.default.class.Blob,
83804
+ _class: import_core62.default.class.Blob,
83805
83805
  _id: fileResult.id,
83806
- space: import_core60.default.space.Configuration,
83806
+ space: import_core62.default.space.Configuration,
83807
83807
  modifiedOn: fileResult.metadata.lastModified,
83808
- modifiedBy: import_core60.default.account.System,
83808
+ modifiedBy: import_core62.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_config9.loadServerConfig)(url4);
83881
83881
  const token = await (0, import_utils14.getWorkspaceToken)(url4, options, config3);
83882
- const filesUrl = (config3.FILES_URL.startsWith("/") ? (0, import_core60.concatLink)(url4, config3.FILES_URL) : config3.FILES_URL).replace(
83882
+ const filesUrl = (config3.FILES_URL.startsWith("/") ? (0, import_core62.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_core60.concatLink)(url4, config3.UPLOAD_URL) : config3.UPLOAD_URL).replace(":workspace", token.workspaceId);
83886
+ const uploadUrl = (config3.UPLOAD_URL.startsWith("/") ? (0, import_core62.concatLink)(url4, config3.UPLOAD_URL) : config3.UPLOAD_URL).replace(":workspace", token.workspaceId);
83887
83887
  return new StorageClientImpl(filesUrl, uploadUrl, token.token, token.workspaceId);
83888
83888
  }
83889
83889
  __name(connectStorage, "connectStorage");
@@ -83936,11 +83936,11 @@ var require_storage2 = __commonJS({
83936
83936
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
83937
83937
  var storage_exports = {};
83938
83938
  __export2(storage_exports, {
83939
- connectStorage: () => import_client43.connectStorage,
83940
- createStorageClient: () => import_client43.createStorageClient
83939
+ connectStorage: () => import_client45.connectStorage,
83940
+ createStorageClient: () => import_client45.createStorageClient
83941
83941
  });
83942
83942
  module2.exports = __toCommonJS2(storage_exports);
83943
- var import_client43 = require_client7();
83943
+ var import_client45 = require_client7();
83944
83944
  __reExport2(storage_exports, require_error3(), module2.exports);
83945
83945
  __reExport2(storage_exports, require_types8(), module2.exports);
83946
83946
  }
@@ -108107,7 +108107,7 @@ var require_utils14 = __commonJS({
108107
108107
  getWeekday: () => getWeekday
108108
108108
  });
108109
108109
  module2.exports = __toCommonJS2(utils_exports);
108110
- var import_core60 = require_lib4();
108110
+ var import_core62 = require_lib4();
108111
108111
  var import__ = __toESM2(require_lib25());
108112
108112
  function getInstance(event, date7) {
108113
108113
  const diff8 = event.dueDate - event.date;
@@ -108119,7 +108119,7 @@ var require_utils14 = __commonJS({
108119
108119
  originalStartTime: date7,
108120
108120
  _class: import__.default.class.ReccuringInstance,
108121
108121
  eventId: generateEventId3(),
108122
- _id: (0, import_core60.generateId)(),
108122
+ _id: (0, import_core62.generateId)(),
108123
108123
  virtual: true
108124
108124
  };
108125
108125
  }
@@ -108432,7 +108432,7 @@ var require_utils14 = __commonJS({
108432
108432
  }
108433
108433
  __name(getAllEvents, "getAllEvents");
108434
108434
  function generateEventId3() {
108435
- const id = (0, import_core60.generateId)();
108435
+ const id = (0, import_core62.generateId)();
108436
108436
  return encodeToBase32Hex(id);
108437
108437
  }
108438
108438
  __name(generateEventId3, "generateEventId");
@@ -108846,7 +108846,7 @@ var require_utils15 = __commonJS({
108846
108846
  });
108847
108847
  module2.exports = __toCommonJS2(utils_exports);
108848
108848
  var import_fast_equals = require_cjs();
108849
- var import_core60 = __toESM2(require_lib4());
108849
+ var import_core62 = __toESM2(require_lib4());
108850
108850
  var import__ = __toESM2(require_lib27());
108851
108851
  async function getDirectChannel(client, me, employeeAccount) {
108852
108852
  const accIds = [me, employeeAccount].sort();
@@ -108856,7 +108856,7 @@ var require_utils15 = __commonJS({
108856
108856
  return dm._id;
108857
108857
  }
108858
108858
  }
108859
- return await client.createDoc(import__.default.class.DirectMessage, import_core60.default.space.Space, {
108859
+ return await client.createDoc(import__.default.class.DirectMessage, import_core62.default.space.Space, {
108860
108860
  name: "",
108861
108861
  description: "",
108862
108862
  private: true,
@@ -109160,18 +109160,18 @@ var require_cache4 = __commonJS({
109160
109160
  default: () => ContactCache
109161
109161
  });
109162
109162
  module2.exports = __toCommonJS2(cache_exports);
109163
- var import_core60 = __toESM2(require_lib4());
109163
+ var import_core62 = __toESM2(require_lib4());
109164
109164
  var import__ = __toESM2(require_lib28());
109165
109165
  function isCreateTx(tx) {
109166
- return tx._class === import_core60.default.class.TxCreateDoc;
109166
+ return tx._class === import_core62.default.class.TxCreateDoc;
109167
109167
  }
109168
109168
  __name(isCreateTx, "isCreateTx");
109169
109169
  function isUpdateTx(tx) {
109170
- return tx._class === import_core60.default.class.TxUpdateDoc;
109170
+ return tx._class === import_core62.default.class.TxUpdateDoc;
109171
109171
  }
109172
109172
  __name(isUpdateTx, "isUpdateTx");
109173
109173
  function isMixinTx(tx) {
109174
- return tx._class === import_core60.default.class.TxMixin;
109174
+ return tx._class === import_core62.default.class.TxMixin;
109175
109175
  }
109176
109176
  __name(isMixinTx, "isMixinTx");
109177
109177
  function isPersonTx(tx) {
@@ -109278,7 +109278,7 @@ var require_cache4 = __commonJS({
109278
109278
  const ref = tx.objectId;
109279
109279
  const person = this._personByRef.get(ref);
109280
109280
  if (person === void 0) return;
109281
- const createdPerson = import_core60.TxProcessor.createDoc2Doc(tx);
109281
+ const createdPerson = import_core62.TxProcessor.createDoc2Doc(tx);
109282
109282
  this._personByRef.set(ref, createdPerson);
109283
109283
  const personIds = Array.from(this._personIdsByPersonRef.get(ref) ?? []);
109284
109284
  for (const personId of personIds) {
@@ -109296,7 +109296,7 @@ var require_cache4 = __commonJS({
109296
109296
  const newPersonRef = tx.attachedTo;
109297
109297
  this._personRefByPersonId.set(personId, newPersonRef);
109298
109298
  this.addPersonIdToPersonRef(newPersonRef, personId);
109299
- const createdSocialId = import_core60.TxProcessor.createDoc2Doc(tx);
109299
+ const createdSocialId = import_core62.TxProcessor.createDoc2Doc(tx);
109300
109300
  this._socialIdByPersonId.set(personId, createdSocialId);
109301
109301
  this.broadcastChange({
109302
109302
  personRef: newPersonRef,
@@ -109307,7 +109307,7 @@ var require_cache4 = __commonJS({
109307
109307
  const ref = tx.objectId;
109308
109308
  const person = this._personByRef.get(ref);
109309
109309
  if (person == null) return;
109310
- const updatedPerson = isUpdateTx(tx) ? import_core60.TxProcessor.updateDoc2Doc(person, tx) : import_core60.TxProcessor.updateMixin4Doc(person, tx);
109310
+ const updatedPerson = isUpdateTx(tx) ? import_core62.TxProcessor.updateDoc2Doc(person, tx) : import_core62.TxProcessor.updateMixin4Doc(person, tx);
109311
109311
  this._personByRef.set(ref, updatedPerson);
109312
109312
  const personIds = Array.from(this._personIdsByPersonRef.get(ref) ?? []);
109313
109313
  for (const personId of personIds) {
@@ -109422,7 +109422,7 @@ var require_utils16 = __commonJS({
109422
109422
  setCurrentEmployeeSpace: () => setCurrentEmployeeSpace
109423
109423
  });
109424
109424
  module2.exports = __toCommonJS2(utils_exports);
109425
- var import_core60 = require_lib4();
109425
+ var import_core62 = require_lib4();
109426
109426
  var import_platform4 = require_lib();
109427
109427
  var import__ = __toESM2(require_lib28());
109428
109428
  var import_types15 = require_types9();
@@ -109626,7 +109626,7 @@ var require_utils16 = __commonJS({
109626
109626
  if (socialIds.length === 0) {
109627
109627
  return;
109628
109628
  }
109629
- return (0, import_core60.pickPrimarySocialId)(socialIds)._id;
109629
+ return (0, import_core62.pickPrimarySocialId)(socialIds)._id;
109630
109630
  }
109631
109631
  __name(getPrimarySocialId, "getPrimarySocialId");
109632
109632
  async function getAllSocialStringsByPersonId(client, personId) {
@@ -109665,12 +109665,12 @@ var require_utils16 = __commonJS({
109665
109665
  __name(getSocialStringsByEmployee, "getSocialStringsByEmployee");
109666
109666
  async function getAllAccounts(client) {
109667
109667
  const employees = await client.findAll(import__.default.mixin.Employee, { active: true });
109668
- return employees.map((it) => it.personUuid).filter(import_core60.notEmpty);
109668
+ return employees.map((it) => it.personUuid).filter(import_core62.notEmpty);
109669
109669
  }
109670
109670
  __name(getAllAccounts, "getAllAccounts");
109671
109671
  async function getAllUserAccounts(client) {
109672
109672
  const employees = await client.findAll(import__.default.mixin.Employee, { active: true });
109673
- return employees.map((it) => it.personUuid).filter(import_core60.notEmpty);
109673
+ return employees.map((it) => it.personUuid).filter(import_core62.notEmpty);
109674
109674
  }
109675
109675
  __name(getAllUserAccounts, "getAllUserAccounts");
109676
109676
  async function ensureEmployee(ctx, me, client, socialIds, getGlobalPerson) {
@@ -109679,7 +109679,7 @@ var require_utils16 = __commonJS({
109679
109679
  }
109680
109680
  __name(ensureEmployee, "ensureEmployee");
109681
109681
  async function ensureEmployeeForPerson(ctx, me, person, client, socialIds, globalPerson) {
109682
- const txFactory = new import_core60.TxFactory(me.primarySocialId);
109682
+ const txFactory = new import_core62.TxFactory(me.primarySocialId);
109683
109683
  const personByUuid = await client.findOne(import__.default.class.Person, { personUuid: person.uuid });
109684
109684
  let personRef = personByUuid?._id;
109685
109685
  if (personRef === void 0) {
@@ -109700,7 +109700,7 @@ var require_utils16 = __commonJS({
109700
109700
  city: globalPerson.city,
109701
109701
  avatarType: import__.AvatarType.COLOR
109702
109702
  };
109703
- personRef = (0, import_core60.generateId)();
109703
+ personRef = (0, import_core62.generateId)();
109704
109704
  const createPersonTx = txFactory.createTxCreateDoc(import__.default.class.Person, import__.default.space.Contacts, data, personRef);
109705
109705
  await client.tx(createPersonTx);
109706
109706
  });
@@ -109710,7 +109710,7 @@ var require_utils16 = __commonJS({
109710
109710
  });
109711
109711
  await client.tx(updatePersonTx);
109712
109712
  }
109713
- const existingIdentifiers = (0, import_core60.toIdMap)(
109713
+ const existingIdentifiers = (0, import_core62.toIdMap)(
109714
109714
  await client.findAll(import__.default.class.SocialIdentity, { _id: { $in: person.socialIds } })
109715
109715
  );
109716
109716
  for (const socialId of socialIds) {
@@ -109735,7 +109735,7 @@ var require_utils16 = __commonJS({
109735
109735
  collection: "socialIds",
109736
109736
  type: socialId.type,
109737
109737
  value: socialId.value,
109738
- key: (0, import_core60.buildSocialIdString)(socialId),
109738
+ key: (0, import_core62.buildSocialIdString)(socialId),
109739
109739
  // TODO: fill it in trigger or on DB level as stored calculated column or smth?
109740
109740
  verifiedOn: socialId.verifiedOn,
109741
109741
  isDeleted: socialId.isDeleted
@@ -109776,9 +109776,9 @@ var require_utils16 = __commonJS({
109776
109776
  }
109777
109777
  }
109778
109778
  }
109779
- const employeeRole = person.role === import_core60.AccountRole.Guest || person.role === import_core60.AccountRole.ReadOnlyGuest ? "GUEST" : "USER";
109779
+ const employeeRole = person.role === import_core62.AccountRole.Guest || person.role === import_core62.AccountRole.ReadOnlyGuest ? "GUEST" : "USER";
109780
109780
  const employee = await client.findOne(import__.default.mixin.Employee, { _id: personRef });
109781
- if (employee === void 0 || !import_core60.Hierarchy.hasMixin(employee, import__.default.mixin.Employee) || !employee.active || employee.role !== employeeRole) {
109781
+ if (employee === void 0 || !import_core62.Hierarchy.hasMixin(employee, import__.default.mixin.Employee) || !employee.active || employee.role !== employeeRole) {
109782
109782
  await ctx.with("create-employee", {}, async () => {
109783
109783
  if (personRef === void 0) {
109784
109784
  console.error("Person not found");
@@ -109818,7 +109818,7 @@ var require_utils16 = __commonJS({
109818
109818
  }
109819
109819
  __name(loadCachesForPersonId, "loadCachesForPersonId");
109820
109820
  async function loadCachesForPersonIds(client, personIds) {
109821
- const sidObjsMap = (0, import_core60.toIdMap)(
109821
+ const sidObjsMap = (0, import_core62.toIdMap)(
109822
109822
  await client.findAll(
109823
109823
  import__.default.class.SocialIdentity,
109824
109824
  {
@@ -109853,7 +109853,7 @@ var require_utils16 = __commonJS({
109853
109853
  }
109854
109854
  __name(loadCachesForPersonRef, "loadCachesForPersonRef");
109855
109855
  async function loadCachesForPersonRefs(client, personRefs) {
109856
- const persons = (0, import_core60.toIdMap)(
109856
+ const persons = (0, import_core62.toIdMap)(
109857
109857
  await client.findAll(
109858
109858
  import__.default.class.Person,
109859
109859
  {
@@ -109896,7 +109896,7 @@ var require_utils16 = __commonJS({
109896
109896
  personIds.map((pid) => {
109897
109897
  const ref = contactCache.personRefByPersonId.get(pid);
109898
109898
  return ref != null ? [pid, ref] : void 0;
109899
- }).filter(import_core60.notEmpty)
109899
+ }).filter(import_core62.notEmpty)
109900
109900
  );
109901
109901
  }
109902
109902
  __name(getPersonRefsByPersonIdsFromCache, "getPersonRefsByPersonIdsFromCache");
@@ -109943,7 +109943,7 @@ var require_utils16 = __commonJS({
109943
109943
  personIds.map((pid) => {
109944
109944
  const person = contactCache.personByPersonId.get(pid);
109945
109945
  return person != null ? [pid, person] : void 0;
109946
- }).filter(import_core60.notEmpty)
109946
+ }).filter(import_core62.notEmpty)
109947
109947
  );
109948
109948
  }
109949
109949
  __name(getPersonsByPersonIdsFromCache, "getPersonsByPersonIdsFromCache");
@@ -109990,7 +109990,7 @@ var require_utils16 = __commonJS({
109990
109990
  personRefs.map((personRef) => {
109991
109991
  const person = contactCache.personByRef.get(personRef);
109992
109992
  return person != null ? [personRef, person] : void 0;
109993
- }).filter(import_core60.notEmpty)
109993
+ }).filter(import_core62.notEmpty)
109994
109994
  );
109995
109995
  }
109996
109996
  __name(getPersonsByPersonRefsFromCache, "getPersonsByPersonRefsFromCache");
@@ -110595,9 +110595,9 @@ var require_utils17 = __commonJS({
110595
110595
  getFirstRank: () => getFirstRank
110596
110596
  });
110597
110597
  module2.exports = __toCommonJS2(utils_exports);
110598
- var import_core60 = require_lib4();
110598
+ var import_core62 = require_lib4();
110599
110599
  var import_plugin = __toESM2(require_plugin2());
110600
- async function getFirstRank(client, space, parent, sort3 = import_core60.SortingOrder.Descending, extra = {}) {
110600
+ async function getFirstRank(client, space, parent, sort3 = import_core62.SortingOrder.Descending, extra = {}) {
110601
110601
  const doc = await client.findOne(
110602
110602
  import_plugin.default.class.Document,
110603
110603
  { space, parent, ...extra },
@@ -112099,7 +112099,7 @@ var require_utils18 = __commonJS({
112099
112099
  var utils_exports = {};
112100
112100
  __export2(utils_exports, {
112101
112101
  genRanks: () => genRanks,
112102
- makeRank: () => makeRank4
112102
+ makeRank: () => makeRank5
112103
112103
  });
112104
112104
  module2.exports = __toCommonJS2(utils_exports);
112105
112105
  var import_lexoRankBucket = __toESM2(require_lexoRankBucket());
@@ -112118,7 +112118,7 @@ var require_utils18 = __commonJS({
112118
112118
  return res;
112119
112119
  }
112120
112120
  __name(genRanks, "genRanks");
112121
- function makeRank4(prev, next4) {
112121
+ function makeRank5(prev, next4) {
112122
112122
  try {
112123
112123
  if (prev != null && prev.trim() === "") {
112124
112124
  prev = void 0;
@@ -112143,7 +112143,7 @@ var require_utils18 = __commonJS({
112143
112143
  throw new Error(`Failed to make rank: ${prev} ${next4} ${err.message}`);
112144
112144
  }
112145
112145
  }
112146
- __name(makeRank4, "makeRank");
112146
+ __name(makeRank5, "makeRank");
112147
112147
  }
112148
112148
  });
112149
112149
 
@@ -112220,13 +112220,13 @@ var require_utils19 = __commonJS({
112220
112220
  updateProjectType: () => updateProjectType
112221
112221
  });
112222
112222
  module2.exports = __toCommonJS2(utils_exports);
112223
- var import_core60 = __toESM2(require_lib4());
112223
+ var import_core62 = __toESM2(require_lib4());
112224
112224
  var import_platform4 = require_lib();
112225
112225
  var import__ = __toESM2(require_lib34());
112226
- var import_rank4 = require_lib33();
112226
+ var import_rank5 = require_lib33();
112227
112227
  var import_rank22 = require_lib33();
112228
112228
  var calcRank = /* @__PURE__ */ __name((prev, next4) => {
112229
- return (0, import_rank4.makeRank)(prev?.rank, next4?.rank);
112229
+ return (0, import_rank5.makeRank)(prev?.rank, next4?.rank);
112230
112230
  }, "calcRank");
112231
112231
  function getProjectTypeStates(projectType, types, statuses) {
112232
112232
  if (projectType === void 0) return [];
@@ -112256,7 +112256,7 @@ var require_utils19 = __commonJS({
112256
112256
  if (exists5 !== void 0) {
112257
112257
  return exists5._id;
112258
112258
  }
112259
- const res = await client.createDoc(_class, import_core60.default.space.Model, data);
112259
+ const res = await client.createDoc(_class, import_core62.default.space.Model, data);
112260
112260
  return res;
112261
112261
  }
112262
112262
  __name(createState, "createState");
@@ -112286,7 +112286,7 @@ var require_utils19 = __commonJS({
112286
112286
  function findStatusAttr(h, _class) {
112287
112287
  const attrs = h.getAllAttributes(_class);
112288
112288
  for (const it of attrs.values()) {
112289
- if (it.type._class === import_core60.default.class.RefTo && h.isDerived(it.type.to, import_core60.default.class.Status)) {
112289
+ if (it.type._class === import_core62.default.class.RefTo && h.isDerived(it.type.to, import_core62.default.class.Status)) {
112290
112290
  return it;
112291
112291
  }
112292
112292
  }
@@ -112318,7 +112318,7 @@ var require_utils19 = __commonJS({
112318
112318
  const targetProjectClassId = `${_id}:type:mixin`;
112319
112319
  const tmpl = await client.createDoc(
112320
112320
  import__.default.class.ProjectType,
112321
- import_core60.default.space.Model,
112321
+ import_core62.default.space.Model,
112322
112322
  {
112323
112323
  description: data.description,
112324
112324
  shortDescription: data.shortDescription,
@@ -112333,17 +112333,17 @@ var require_utils19 = __commonJS({
112333
112333
  _id
112334
112334
  );
112335
112335
  await client.createDoc(
112336
- import_core60.default.class.Mixin,
112337
- import_core60.default.space.Model,
112336
+ import_core62.default.class.Mixin,
112337
+ import_core62.default.space.Model,
112338
112338
  {
112339
112339
  extends: categoryObj.baseClass,
112340
- kind: import_core60.ClassifierKind.MIXIN,
112340
+ kind: import_core62.ClassifierKind.MIXIN,
112341
112341
  label: (0, import_platform4.getEmbeddedLabel)(data.name),
112342
112342
  icon: baseClassClass.icon
112343
112343
  },
112344
112344
  targetProjectClassId
112345
112345
  );
112346
- await client.createMixin(targetProjectClassId, import_core60.default.class.Mixin, import_core60.default.space.Model, import__.default.mixin.ProjectTypeClass, {
112346
+ await client.createMixin(targetProjectClassId, import_core62.default.class.Mixin, import_core62.default.space.Model, import__.default.mixin.ProjectTypeClass, {
112347
112347
  projectType: _id
112348
112348
  });
112349
112349
  return tmpl;
@@ -112402,22 +112402,22 @@ var require_utils19 = __commonJS({
112402
112402
  const targetClassId = `${taskId}:type:mixin`;
112403
112403
  tdata.targetClass = targetClassId;
112404
112404
  await client.createDoc(
112405
- import_core60.default.class.Mixin,
112406
- import_core60.default.space.Model,
112405
+ import_core62.default.class.Mixin,
112406
+ import_core62.default.space.Model,
112407
112407
  {
112408
112408
  extends: data.ofClass,
112409
- kind: import_core60.ClassifierKind.MIXIN,
112409
+ kind: import_core62.ClassifierKind.MIXIN,
112410
112410
  label: ofClassClass.label,
112411
112411
  icon: ofClassClass.icon
112412
112412
  },
112413
112413
  targetClassId
112414
112414
  );
112415
- await client.createMixin(targetClassId, import_core60.default.class.Mixin, import_core60.default.space.Model, import__.default.mixin.TaskTypeClass, {
112415
+ await client.createMixin(targetClassId, import_core62.default.class.Mixin, import_core62.default.space.Model, import__.default.mixin.TaskTypeClass, {
112416
112416
  taskType: taskId,
112417
112417
  projectType: _id
112418
112418
  });
112419
112419
  }
112420
- await client.createDoc(import__.default.class.TaskType, import_core60.default.space.Model, tdata, taskId);
112420
+ await client.createDoc(import__.default.class.TaskType, import_core62.default.space.Model, tdata, taskId);
112421
112421
  tasksData.set(taskId, tdata);
112422
112422
  _tasks.push(taskId);
112423
112423
  }
@@ -112621,7 +112621,7 @@ var require_lib35 = __commonJS({
112621
112621
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
112622
112622
  var index_exports2 = {};
112623
112623
  __export2(index_exports2, {
112624
- ToDoPriority: () => ToDoPriority,
112624
+ ToDoPriority: () => ToDoPriority2,
112625
112625
  default: () => index_default,
112626
112626
  timeId: () => timeId
112627
112627
  });
@@ -112629,14 +112629,14 @@ var require_lib35 = __commonJS({
112629
112629
  var import_platform4 = require_lib();
112630
112630
  __reExport2(index_exports2, require_analytics7(), module2.exports);
112631
112631
  var timeId = "time";
112632
- var ToDoPriority = /* @__PURE__ */ ((ToDoPriority2) => {
112633
- ToDoPriority2[ToDoPriority2["High"] = 0] = "High";
112634
- ToDoPriority2[ToDoPriority2["Medium"] = 1] = "Medium";
112635
- ToDoPriority2[ToDoPriority2["Low"] = 2] = "Low";
112636
- ToDoPriority2[ToDoPriority2["NoPriority"] = 3] = "NoPriority";
112637
- ToDoPriority2[ToDoPriority2["Urgent"] = 4] = "Urgent";
112638
- return ToDoPriority2;
112639
- })(ToDoPriority || {});
112632
+ var ToDoPriority2 = /* @__PURE__ */ ((ToDoPriority22) => {
112633
+ ToDoPriority22[ToDoPriority22["High"] = 0] = "High";
112634
+ ToDoPriority22[ToDoPriority22["Medium"] = 1] = "Medium";
112635
+ ToDoPriority22[ToDoPriority22["Low"] = 2] = "Low";
112636
+ ToDoPriority22[ToDoPriority22["NoPriority"] = 3] = "NoPriority";
112637
+ ToDoPriority22[ToDoPriority22["Urgent"] = 4] = "Urgent";
112638
+ return ToDoPriority22;
112639
+ })(ToDoPriority2 || {});
112640
112640
  var index_default = (0, import_platform4.plugin)(timeId, {
112641
112641
  component: {
112642
112642
  Me: "",
@@ -153250,6 +153250,39 @@ var NotificationContextNotFoundError = class extends Schema_exports.TaggedError(
153250
153250
  }
153251
153251
  };
153252
153252
 
153253
+ // src/huly/errors-planner.ts
153254
+ var TodoNotFoundError = class extends Schema_exports.TaggedError()(
153255
+ "TodoNotFoundError",
153256
+ {
153257
+ locator: Schema_exports.String
153258
+ }
153259
+ ) {
153260
+ get message() {
153261
+ return `Planner ToDo not found for locator: ${this.locator}`;
153262
+ }
153263
+ };
153264
+ var TodoIdentifierAmbiguousError = class extends Schema_exports.TaggedError()(
153265
+ "TodoIdentifierAmbiguousError",
153266
+ {
153267
+ locator: Schema_exports.String,
153268
+ matches: Schema_exports.Number
153269
+ }
153270
+ ) {
153271
+ get message() {
153272
+ return `Planner ToDo locator is ambiguous: ${this.locator} matched ${this.matches} ToDos`;
153273
+ }
153274
+ };
153275
+ var TodoWorkSlotNotFoundError = class extends Schema_exports.TaggedError()(
153276
+ "TodoWorkSlotNotFoundError",
153277
+ {
153278
+ workSlotId: Schema_exports.String
153279
+ }
153280
+ ) {
153281
+ get message() {
153282
+ return `Planner ToDo work slot '${this.workSlotId}' not found`;
153283
+ }
153284
+ };
153285
+
153253
153286
  // src/domain/schemas/processes.ts
153254
153287
  var ProcessId = DocId.pipe(Schema_exports.brand("ProcessId"));
153255
153288
  var ProcessIdentifier = NonEmptyString2.pipe(Schema_exports.brand("ProcessIdentifier"));
@@ -153851,7 +153884,10 @@ var HulyDomainError = Schema_exports.Union(
153851
153884
  SpaceNotFoundError,
153852
153885
  SpaceIdentifierAmbiguousError,
153853
153886
  SpaceTypeNotFoundError,
153854
- SpaceTypeIdentifierAmbiguousError
153887
+ SpaceTypeIdentifierAmbiguousError,
153888
+ TodoNotFoundError,
153889
+ TodoIdentifierAmbiguousError,
153890
+ TodoWorkSlotNotFoundError
153855
153891
  );
153856
153892
 
153857
153893
  // src/huly/operations/markup.ts
@@ -154214,6 +154250,10 @@ var HulyClient = class _HulyClient extends Context_exports.Tag("@hulymcp/HulyCli
154214
154250
  ),
154215
154251
  "addCollection failed"
154216
154252
  ),
154253
+ removeCollection: (_class, space, objectId, attachedTo, attachedToClass, collection) => withClient(
154254
+ (client2) => client2.removeCollection(_class, space, objectId, attachedTo, attachedToClass, collection),
154255
+ "removeCollection failed"
154256
+ ),
154217
154257
  removeDoc: (_class, space, objectId) => withClient(
154218
154258
  (client2) => client2.removeDoc(_class, space, objectId),
154219
154259
  "removeDoc failed"
@@ -166187,7 +166227,7 @@ var ListCardsParamsBase = Schema_exports.Struct({
166187
166227
  description: "Search cards by title substring (case-insensitive). Mutually exclusive with titleRegex."
166188
166228
  })),
166189
166229
  titleRegex: Schema_exports.optional(Schema_exports.String.annotations({
166190
- description: "Filter cards by title using a regex pattern (e.g., '^TODO'). Mutually exclusive with titleSearch. Note: regex support depends on the Huly backend; use titleSearch for broader compatibility."
166230
+ description: "Filter cards by title using Huly $regex. On the supported Postgres backend this is SQL SIMILAR TO, not JavaScript RegExp; matching is case-sensitive and the pattern must match the whole title: use '%' for any string (e.g., '%TODO%' contains, 'TODO%' prefix). Mutually exclusive with titleSearch; use titleSearch for simple substring matching."
166191
166231
  })),
166192
166232
  contentSearch: Schema_exports.optional(Schema_exports.String.annotations({
166193
166233
  description: "Search cards by content (fulltext search)"
@@ -166551,7 +166591,7 @@ var ListIssuesParamsBase = Schema_exports.Struct({
166551
166591
  description: "Search issues by title substring (case-insensitive). Mutually exclusive with titleRegex."
166552
166592
  })),
166553
166593
  titleRegex: Schema_exports.optional(Schema_exports.String.annotations({
166554
- description: "Filter issues by title using a regex pattern (e.g., '^BUG'). Mutually exclusive with titleSearch. Note: regex support depends on the Huly backend; use titleSearch for broader compatibility."
166594
+ description: "Filter issues by title using Huly $regex. On the supported Postgres backend this is SQL SIMILAR TO, not JavaScript RegExp; matching is case-sensitive and the pattern must match the whole title: use '%' for any string (e.g., '%BUG%' contains, 'BUG%' prefix). Mutually exclusive with titleSearch; use titleSearch for simple substring matching."
166555
166595
  })),
166556
166596
  descriptionSearch: Schema_exports.optional(Schema_exports.String.annotations({
166557
166597
  description: "Search issues by description content (fulltext search)"
@@ -167632,7 +167672,7 @@ var ListDocumentsParamsBase = Schema_exports.Struct({
167632
167672
  description: "Search documents by title substring (case-insensitive). Mutually exclusive with titleRegex."
167633
167673
  })),
167634
167674
  titleRegex: Schema_exports.optional(Schema_exports.String.annotations({
167635
- description: "Filter documents by title using a regex pattern (e.g., '^RFC'). Mutually exclusive with titleSearch. Note: regex support depends on the Huly backend; use titleSearch for broader compatibility."
167675
+ description: "Filter documents by title using Huly $regex. On the supported Postgres backend this is SQL SIMILAR TO, not JavaScript RegExp; matching is case-sensitive and the pattern must match the whole title: use '%' for any string (e.g., '%RFC%' contains, 'RFC%' prefix). Mutually exclusive with titleSearch; use titleSearch for simple substring matching."
167636
167676
  })),
167637
167677
  contentSearch: Schema_exports.optional(Schema_exports.String.annotations({
167638
167678
  description: "Search documents by content (fulltext search)"
@@ -168332,7 +168372,7 @@ var ListPersonsParamsBase = Schema_exports.Struct({
168332
168372
  description: "Search persons by name substring (case-insensitive). Mutually exclusive with nameRegex."
168333
168373
  })),
168334
168374
  nameRegex: Schema_exports.optional(Schema_exports.String.annotations({
168335
- description: "Filter persons by name using a regex pattern (e.g., '^Smith'). Mutually exclusive with nameSearch. Note: regex support depends on the Huly backend; use nameSearch for broader compatibility."
168375
+ description: "Filter persons by name using Huly $regex. On the supported Postgres backend this is SQL SIMILAR TO, not JavaScript RegExp; matching is case-sensitive and the pattern must match the whole name: use '%' for any string (e.g., '%Smith%' contains, 'Smith%' prefix). Mutually exclusive with nameSearch; use nameSearch for simple substring matching."
168336
168376
  })),
168337
168377
  emailSearch: Schema_exports.optional(Schema_exports.String.annotations({
168338
168378
  description: "Search persons by email substring (case-insensitive)"
@@ -168462,7 +168502,7 @@ var ListChannelsParamsBase = Schema_exports.Struct({
168462
168502
  description: "Search channels by name substring (case-insensitive). Mutually exclusive with nameRegex."
168463
168503
  })),
168464
168504
  nameRegex: Schema_exports.optional(Schema_exports.String.annotations({
168465
- description: "Filter channels by name using a regex pattern (e.g., '^dev-'). Mutually exclusive with nameSearch. Note: regex support depends on the Huly backend; use nameSearch for broader compatibility."
168505
+ description: "Filter channels by name using Huly $regex. On the supported Postgres backend this is SQL SIMILAR TO, not JavaScript RegExp; matching is case-sensitive and the pattern must match the whole name: use '%' for any string (e.g., '%dev%' contains, 'dev%' prefix). Mutually exclusive with nameSearch; use nameSearch for simple substring matching."
168466
168506
  })),
168467
168507
  topicSearch: Schema_exports.optional(Schema_exports.String.annotations({
168468
168508
  description: "Search channels by topic substring (case-insensitive)"
@@ -168760,6 +168800,8 @@ var parseCreateDirectMessageParams = Schema_exports.decodeUnknown(CreateDirectMe
168760
168800
 
168761
168801
  // src/domain/schemas/calendar.ts
168762
168802
  var VisibilityValues = ["public", "freeBusy", "private"];
168803
+ var exactVisibilityValues = (value3) => value3;
168804
+ exactVisibilityValues(true);
168763
168805
  var VisibilitySchema = Schema_exports.Literal(...VisibilityValues).annotations({
168764
168806
  title: "Visibility",
168765
168807
  description: `Event visibility level: ${enumValuesDescription(VisibilityValues)}`
@@ -169113,20 +169155,6 @@ var ListWorkSlotsParamsSchema = Schema_exports.Struct({
169113
169155
  title: "ListWorkSlotsParams",
169114
169156
  description: "Parameters for listing work slots"
169115
169157
  });
169116
- var CreateWorkSlotParamsSchema = Schema_exports.Struct({
169117
- todoId: TodoId.annotations({
169118
- description: "ToDo ID to attach the work slot to"
169119
- }),
169120
- date: Timestamp.annotations({
169121
- description: "Start date timestamp"
169122
- }),
169123
- dueDate: Timestamp.annotations({
169124
- description: "End date timestamp"
169125
- })
169126
- }).annotations({
169127
- title: "CreateWorkSlotParams",
169128
- description: "Parameters for creating a work slot"
169129
- });
169130
169158
  var StartTimerParamsSchema = Schema_exports.Struct({
169131
169159
  project: ProjectIdentifier.annotations({
169132
169160
  description: "Project identifier (e.g., 'HULY')"
@@ -169154,7 +169182,6 @@ var getTimeReportParamsJsonSchema = JSONSchema_exports.make(GetTimeReportParamsS
169154
169182
  var listTimeSpendReportsParamsJsonSchema = JSONSchema_exports.make(ListTimeSpendReportsParamsSchema);
169155
169183
  var getDetailedTimeReportParamsJsonSchema = JSONSchema_exports.make(GetDetailedTimeReportParamsSchema);
169156
169184
  var listWorkSlotsParamsJsonSchema = JSONSchema_exports.make(ListWorkSlotsParamsSchema);
169157
- var createWorkSlotParamsJsonSchema = JSONSchema_exports.make(CreateWorkSlotParamsSchema);
169158
169185
  var startTimerParamsJsonSchema = JSONSchema_exports.make(StartTimerParamsSchema);
169159
169186
  var stopTimerParamsJsonSchema = JSONSchema_exports.make(StopTimerParamsSchema);
169160
169187
  var parseLogTimeParams = Schema_exports.decodeUnknown(LogTimeParamsSchema);
@@ -169162,7 +169189,6 @@ var parseGetTimeReportParams = Schema_exports.decodeUnknown(GetTimeReportParamsS
169162
169189
  var parseListTimeSpendReportsParams = Schema_exports.decodeUnknown(ListTimeSpendReportsParamsSchema);
169163
169190
  var parseGetDetailedTimeReportParams = Schema_exports.decodeUnknown(GetDetailedTimeReportParamsSchema);
169164
169191
  var parseListWorkSlotsParams = Schema_exports.decodeUnknown(ListWorkSlotsParamsSchema);
169165
- var parseCreateWorkSlotParams = Schema_exports.decodeUnknown(CreateWorkSlotParamsSchema);
169166
169192
  var parseStartTimerParams = Schema_exports.decodeUnknown(StartTimerParamsSchema);
169167
169193
  var parseStopTimerParams = Schema_exports.decodeUnknown(StopTimerParamsSchema);
169168
169194
  var TimeSpendReportWireSchema = Schema_exports.Struct({
@@ -169209,9 +169235,6 @@ var LogTimeResultSchema = Schema_exports.Struct({
169209
169235
  reportId: TimeSpendReportId,
169210
169236
  identifier: IssueIdentifier
169211
169237
  });
169212
- var CreateWorkSlotResultSchema = Schema_exports.Struct({
169213
- slotId: WorkSlotId
169214
- });
169215
169238
  var StartTimerResultSchema = Schema_exports.Struct({
169216
169239
  identifier: IssueIdentifier,
169217
169240
  startedAt: Timestamp
@@ -169224,6 +169247,344 @@ var StopTimerResultSchema = Schema_exports.Struct({
169224
169247
  var ListTimeSpendReportsResultSchema = Schema_exports.Array(TimeSpendReportWireSchema);
169225
169248
  var ListWorkSlotsResultSchema = Schema_exports.Array(WorkSlotWireSchema);
169226
169249
 
169250
+ // src/domain/schemas/planner.ts
169251
+ var TodoTitle = NonEmptyString2.pipe(Schema_exports.brand("TodoTitle")).annotations({
169252
+ identifier: "TodoTitle",
169253
+ title: "TodoTitle",
169254
+ description: "Non-empty Planner ToDo title."
169255
+ });
169256
+ var TodoAttachmentTitle = NonEmptyString2.pipe(Schema_exports.brand("TodoAttachmentTitle")).annotations({
169257
+ identifier: "TodoAttachmentTitle",
169258
+ title: "TodoAttachmentTitle",
169259
+ description: "Non-empty title of the Huly object attached to a ToDo."
169260
+ });
169261
+ var TodoRank = NonEmptyString2.pipe(Schema_exports.brand("TodoRank"));
169262
+ var TodoPriorityValues = ["no-priority", "low", "medium", "high", "urgent"];
169263
+ var TodoPrioritySchema = Schema_exports.Literal(...TodoPriorityValues).annotations({
169264
+ title: "TodoPriority",
169265
+ description: `Planner ToDo priority. Allowed values: ${enumValuesDescription(TodoPriorityValues)}.`
169266
+ });
169267
+ var TodoVisibilityValues = ["public", "freeBusy", "private"];
169268
+ var exactTodoVisibilityValues = (value3) => value3;
169269
+ exactTodoVisibilityValues(true);
169270
+ var TodoVisibilitySchema = Schema_exports.Literal(...TodoVisibilityValues).annotations({
169271
+ title: "TodoVisibility",
169272
+ description: `Planner ToDo visibility. Allowed values: ${enumValuesDescription(TodoVisibilityValues)}.`
169273
+ });
169274
+ var TodoCompletionStateValues = ["open", "completed", "all"];
169275
+ var TodoCompletionStateSchema = Schema_exports.Literal(...TodoCompletionStateValues).annotations({
169276
+ title: "TodoCompletionState",
169277
+ description: "Local MCP filter over Huly doneOn: open means doneOn is null, completed means doneOn is set, all applies no doneOn filter."
169278
+ });
169279
+ var IssueTodoLocatorSchema = Schema_exports.Struct({
169280
+ project: ProjectIdentifier.annotations({
169281
+ description: "Project identifier, such as HULY."
169282
+ }),
169283
+ identifier: IssueIdentifier.annotations({
169284
+ description: "Issue identifier, such as HULY-123 or 123."
169285
+ })
169286
+ });
169287
+ var TodoAttachmentInputSchema = Schema_exports.Union(
169288
+ Schema_exports.Struct({
169289
+ type: Schema_exports.Literal("none").annotations({
169290
+ description: "Create a personal ToDo not attached to another Huly object."
169291
+ })
169292
+ }),
169293
+ Schema_exports.Struct({
169294
+ type: Schema_exports.Literal("issue"),
169295
+ project: ProjectIdentifier.annotations({
169296
+ description: "Project identifier containing the issue."
169297
+ }),
169298
+ identifier: IssueIdentifier.annotations({
169299
+ description: "Issue identifier, such as HULY-123 or 123."
169300
+ })
169301
+ })
169302
+ ).annotations({
169303
+ title: "TodoAttachmentInput",
169304
+ description: "Where to create the ToDo. Use none for personal Planner ToDos or issue for issue action items."
169305
+ });
169306
+ var TodoLocatorSchema = Schema_exports.Union(
169307
+ Schema_exports.Struct({
169308
+ todoId: TodoId.annotations({
169309
+ description: "Raw Huly ToDo _id."
169310
+ })
169311
+ }),
169312
+ Schema_exports.Struct({
169313
+ issue: IssueTodoLocatorSchema,
169314
+ title: Schema_exports.optional(NonEmptyString2.annotations({
169315
+ description: "Optional exact title when more than one ToDo is attached to the issue."
169316
+ })),
169317
+ owner: Schema_exports.optional(NonEmptyString2.annotations({
169318
+ description: "Owner exact email or display name."
169319
+ })),
169320
+ completionState: Schema_exports.optional(TodoCompletionStateSchema)
169321
+ }),
169322
+ Schema_exports.Struct({
169323
+ title: NonEmptyString2.annotations({
169324
+ description: "Exact ToDo title."
169325
+ }),
169326
+ owner: Schema_exports.optional(NonEmptyString2.annotations({
169327
+ description: "Owner exact email or display name to disambiguate."
169328
+ })),
169329
+ attachedTo: Schema_exports.optional(TodoAttachmentInputSchema.annotations({
169330
+ description: "Attached object to disambiguate the title."
169331
+ })),
169332
+ completionState: Schema_exports.optional(TodoCompletionStateSchema)
169333
+ })
169334
+ ).annotations({
169335
+ title: "TodoLocator",
169336
+ description: "LLM-first ToDo locator. Prefer issue/title/owner forms when you do not know the raw Huly ToDo ID."
169337
+ });
169338
+ var ListTodosParamsSchema = Schema_exports.Struct({
169339
+ owner: Schema_exports.optional(NonEmptyString2.annotations({
169340
+ description: "Filter by owner exact email, exact display name, or raw person/employee ID."
169341
+ })),
169342
+ issue: Schema_exports.optional(IssueTodoLocatorSchema.annotations({
169343
+ description: "Filter ToDos attached to one issue."
169344
+ })),
169345
+ title: Schema_exports.optional(NonEmptyString2.annotations({
169346
+ description: "Exact ToDo title filter."
169347
+ })),
169348
+ titleSearch: Schema_exports.optional(NonEmptyString2.annotations({
169349
+ description: "Case-insensitive title substring filter."
169350
+ })),
169351
+ dueFrom: Schema_exports.optional(Timestamp.annotations({
169352
+ description: "Only ToDos due at or after this timestamp."
169353
+ })),
169354
+ dueTo: Schema_exports.optional(Timestamp.annotations({
169355
+ description: "Only ToDos due at or before this timestamp."
169356
+ })),
169357
+ completionState: Schema_exports.optional(TodoCompletionStateSchema.annotations({
169358
+ description: "Completion filter. Default: all."
169359
+ })),
169360
+ priority: Schema_exports.optional(TodoPrioritySchema),
169361
+ visibility: Schema_exports.optional(TodoVisibilitySchema),
169362
+ limit: Schema_exports.optional(LimitParam.annotations({
169363
+ description: `Maximum number of ToDos to return (default: ${DEFAULT_LIMIT}).`
169364
+ }))
169365
+ }).annotations({
169366
+ title: "ListTodosParams",
169367
+ description: `Parameters for listing Planner ToDos. Empty input is allowed: returns up to ${DEFAULT_LIMIT} ToDos, ordered by Huly planner order, with completionState=all.`
169368
+ });
169369
+ var GetTodoParamsSchema = Schema_exports.Struct({
169370
+ locator: TodoLocatorSchema
169371
+ }).annotations({
169372
+ title: "GetTodoParams",
169373
+ description: "Get one Planner ToDo by raw ID or human-oriented locator."
169374
+ });
169375
+ var CreateTodoParamsSchema = Schema_exports.Struct({
169376
+ title: NonEmptyString2.annotations({
169377
+ description: "ToDo title."
169378
+ }),
169379
+ description: Schema_exports.optional(Schema_exports.String.annotations({
169380
+ description: "ToDo description in markdown."
169381
+ })),
169382
+ owner: Schema_exports.optional(NonEmptyString2.annotations({
169383
+ description: "Owner exact email or display name. If omitted, uses the authenticated user."
169384
+ })),
169385
+ dueDate: Schema_exports.optional(Timestamp.annotations({
169386
+ description: "Due date as Unix timestamp in milliseconds."
169387
+ })),
169388
+ priority: Schema_exports.optional(TodoPrioritySchema.annotations({
169389
+ description: "Priority. Default: no-priority."
169390
+ })),
169391
+ visibility: Schema_exports.optional(TodoVisibilitySchema.annotations({
169392
+ description: "Visibility. Default: private for personal ToDos, public for issue ToDos."
169393
+ })),
169394
+ attachedTo: Schema_exports.optional(TodoAttachmentInputSchema.annotations({
169395
+ description: "Attachment target. If omitted, creates a personal ToDo."
169396
+ }))
169397
+ }).annotations({
169398
+ title: "CreateTodoParams",
169399
+ description: "Create a personal or issue-attached Planner ToDo without requiring Huly class IDs."
169400
+ });
169401
+ var UPDATE_TODO_FIELDS = [
169402
+ "title",
169403
+ "description",
169404
+ "owner",
169405
+ "dueDate",
169406
+ "priority",
169407
+ "visibility"
169408
+ ];
169409
+ var UpdateTodoParamsSchema = Schema_exports.Struct({
169410
+ locator: TodoLocatorSchema,
169411
+ title: Schema_exports.optional(NonEmptyString2.annotations({
169412
+ description: "New ToDo title."
169413
+ })),
169414
+ description: Schema_exports.optional(clearableText("New ToDo description in markdown.")),
169415
+ owner: Schema_exports.optional(NonEmptyString2.annotations({
169416
+ description: "New owner exact email or display name."
169417
+ })),
169418
+ dueDate: Schema_exports.optional(
169419
+ Schema_exports.NullOr(Timestamp).annotations({
169420
+ description: "New due date timestamp, or null to clear."
169421
+ })
169422
+ ),
169423
+ priority: Schema_exports.optional(TodoPrioritySchema),
169424
+ visibility: Schema_exports.optional(TodoVisibilitySchema)
169425
+ }).pipe(
169426
+ Schema_exports.filter(
169427
+ (params) => hasAtLeastOneDefined(params, UPDATE_TODO_FIELDS) ? void 0 : atLeastOneUpdateFieldMessage(UPDATE_TODO_FIELDS)
169428
+ )
169429
+ ).annotations({
169430
+ title: "UpdateTodoParams",
169431
+ description: `Parameters for updating a Planner ToDo. ${atLeastOneUpdateFieldMessage(UPDATE_TODO_FIELDS)}`
169432
+ });
169433
+ assertUpdateFields()(["locator"], UPDATE_TODO_FIELDS);
169434
+ var CompleteTodoParamsSchema = Schema_exports.Struct({
169435
+ locator: TodoLocatorSchema,
169436
+ doneOn: Schema_exports.optional(Timestamp.annotations({
169437
+ description: "Completion timestamp. If omitted, uses the current time."
169438
+ }))
169439
+ }).annotations({
169440
+ title: "CompleteTodoParams",
169441
+ description: "Complete a Planner ToDo. Huly may trim future work slots and run issue automation."
169442
+ });
169443
+ var ReopenTodoParamsSchema = Schema_exports.Struct({
169444
+ locator: TodoLocatorSchema
169445
+ }).annotations({
169446
+ title: "ReopenTodoParams",
169447
+ description: "Reopen a completed Planner ToDo by clearing doneOn. Human locators search completed ToDos by default for this tool."
169448
+ });
169449
+ var DeleteTodoParamsSchema = Schema_exports.Struct({
169450
+ locator: TodoLocatorSchema
169451
+ }).annotations({
169452
+ title: "DeleteTodoParams",
169453
+ description: "Delete a Planner ToDo. Removing issue ToDos can trigger Huly issue automation."
169454
+ });
169455
+ var ScheduleTodoParamsSchema = Schema_exports.Struct({
169456
+ locator: TodoLocatorSchema,
169457
+ date: Timestamp.annotations({
169458
+ description: "Work slot start timestamp."
169459
+ }),
169460
+ dueDate: Timestamp.annotations({
169461
+ description: "Work slot end timestamp."
169462
+ })
169463
+ }).annotations({
169464
+ title: "ScheduleTodoParams",
169465
+ description: "Schedule a ToDo by raw ToDo ID or human locator."
169466
+ });
169467
+ var UnscheduleTodoParamsSchema = Schema_exports.Union(
169468
+ Schema_exports.Struct({
169469
+ workSlotId: WorkSlotId.annotations({
169470
+ description: "Specific work slot ID to remove."
169471
+ })
169472
+ }).annotations({
169473
+ description: "Remove one specific work slot by ID."
169474
+ }),
169475
+ Schema_exports.Struct({
169476
+ locator: TodoLocatorSchema,
169477
+ scope: Schema_exports.Literal("all").annotations({
169478
+ description: "Remove all work slots for the located ToDo."
169479
+ })
169480
+ }).annotations({
169481
+ description: "Remove all work slots for one ToDo."
169482
+ }),
169483
+ Schema_exports.Struct({
169484
+ locator: TodoLocatorSchema,
169485
+ scope: Schema_exports.Literal("future").annotations({
169486
+ description: "Remove future work slots for the located ToDo."
169487
+ }),
169488
+ from: Schema_exports.optional(Timestamp.annotations({
169489
+ description: "Reference timestamp for future work slots. If omitted, uses current time."
169490
+ }))
169491
+ }).annotations({
169492
+ description: "Remove future work slots for one ToDo."
169493
+ })
169494
+ ).annotations({
169495
+ title: "UnscheduleTodoParams",
169496
+ description: "Remove ToDo work slots. Pass workSlotId, or pass locator with scope all/future."
169497
+ });
169498
+ var TodoOwnerSummarySchema = Schema_exports.Struct({
169499
+ id: PersonId,
169500
+ name: Schema_exports.optional(PersonName),
169501
+ email: Schema_exports.optional(Email)
169502
+ });
169503
+ var TodoAttachmentSummarySchema = Schema_exports.Union(
169504
+ Schema_exports.Struct({ type: Schema_exports.Literal("none") }),
169505
+ Schema_exports.Struct({
169506
+ type: Schema_exports.Literal("issue"),
169507
+ id: IssueId,
169508
+ project: ProjectIdentifier,
169509
+ identifier: IssueIdentifier,
169510
+ title: TodoAttachmentTitle
169511
+ }),
169512
+ Schema_exports.Struct({
169513
+ type: Schema_exports.Literal("unknown"),
169514
+ id: DocId,
169515
+ class: ObjectClassName
169516
+ }).annotations({
169517
+ description: "Attached to a Huly object type this Planner tool does not resolve yet."
169518
+ })
169519
+ );
169520
+ var TodoSummarySchema = Schema_exports.Struct({
169521
+ id: TodoId,
169522
+ title: TodoTitle,
169523
+ dueDate: Schema_exports.optional(Schema_exports.NullOr(Timestamp)),
169524
+ priority: TodoPrioritySchema,
169525
+ visibility: TodoVisibilitySchema,
169526
+ doneOn: Schema_exports.optional(Schema_exports.NullOr(Timestamp)),
169527
+ owner: TodoOwnerSummarySchema,
169528
+ attachedTo: TodoAttachmentSummarySchema,
169529
+ workslots: Count,
169530
+ labels: Schema_exports.optional(Count)
169531
+ });
169532
+ var TodoDetailSchema = Schema_exports.extend(
169533
+ TodoSummarySchema,
169534
+ Schema_exports.Struct({
169535
+ description: Schema_exports.optional(Schema_exports.String.annotations({
169536
+ description: "Markdown ToDo description; empty string is valid."
169537
+ })),
169538
+ attachedSpace: Schema_exports.optional(SpaceId),
169539
+ createdOn: Schema_exports.optional(Timestamp),
169540
+ modifiedOn: Schema_exports.optional(Timestamp)
169541
+ })
169542
+ );
169543
+ var CreateTodoResultSchema = Schema_exports.Struct({
169544
+ todoId: TodoId
169545
+ });
169546
+ var TodoMutationResultSchema = Schema_exports.Struct({
169547
+ todoId: TodoId,
169548
+ updated: Schema_exports.Boolean
169549
+ });
169550
+ var UpdateTodoResultSchema = TodoMutationResultSchema;
169551
+ var CompleteTodoResultSchema = TodoMutationResultSchema;
169552
+ var ReopenTodoResultSchema = TodoMutationResultSchema;
169553
+ var DeleteTodoResultSchema = Schema_exports.Struct({
169554
+ todoId: TodoId,
169555
+ deleted: Schema_exports.Boolean
169556
+ });
169557
+ var ScheduleTodoResultSchema = Schema_exports.Struct({
169558
+ todoId: TodoId,
169559
+ workSlotId: WorkSlotId
169560
+ });
169561
+ var UnscheduleTodoResultSchema = Schema_exports.Struct({
169562
+ todoId: Schema_exports.optional(TodoId),
169563
+ removed: Count
169564
+ });
169565
+ var ListTodosResultSchema = Schema_exports.Array(TodoSummarySchema);
169566
+ var listTodosParamsJsonSchema = JSONSchema_exports.make(ListTodosParamsSchema);
169567
+ var getTodoParamsJsonSchema = JSONSchema_exports.make(GetTodoParamsSchema);
169568
+ var createTodoParamsJsonSchema = JSONSchema_exports.make(CreateTodoParamsSchema);
169569
+ var updateTodoParamsJsonSchema = withAtLeastOneRequired(
169570
+ JSONSchema_exports.make(UpdateTodoParamsSchema),
169571
+ UPDATE_TODO_FIELDS
169572
+ );
169573
+ var completeTodoParamsJsonSchema = JSONSchema_exports.make(CompleteTodoParamsSchema);
169574
+ var reopenTodoParamsJsonSchema = JSONSchema_exports.make(ReopenTodoParamsSchema);
169575
+ var deleteTodoParamsJsonSchema = JSONSchema_exports.make(DeleteTodoParamsSchema);
169576
+ var scheduleTodoParamsJsonSchema = JSONSchema_exports.make(ScheduleTodoParamsSchema);
169577
+ var unscheduleTodoParamsJsonSchema = JSONSchema_exports.make(UnscheduleTodoParamsSchema);
169578
+ var parseListTodosParams = Schema_exports.decodeUnknown(ListTodosParamsSchema);
169579
+ var parseGetTodoParams = Schema_exports.decodeUnknown(GetTodoParamsSchema);
169580
+ var parseCreateTodoParams = Schema_exports.decodeUnknown(CreateTodoParamsSchema);
169581
+ var parseUpdateTodoParams = Schema_exports.decodeUnknown(UpdateTodoParamsSchema);
169582
+ var parseCompleteTodoParams = Schema_exports.decodeUnknown(CompleteTodoParamsSchema);
169583
+ var parseReopenTodoParams = Schema_exports.decodeUnknown(ReopenTodoParamsSchema);
169584
+ var parseDeleteTodoParams = Schema_exports.decodeUnknown(DeleteTodoParamsSchema);
169585
+ var parseScheduleTodoParams = Schema_exports.decodeUnknown(ScheduleTodoParamsSchema);
169586
+ var parseUnscheduleTodoParams = Schema_exports.decodeUnknown(UnscheduleTodoParamsSchema);
169587
+
169227
169588
  // src/domain/schemas/search.ts
169228
169589
  var FulltextSearchParamsSchema = Schema_exports.Struct({
169229
169590
  query: NonEmptyString2.annotations({
@@ -170721,7 +171082,7 @@ var parseDeleteTestResultParams = Schema_exports.decodeUnknown(DeleteTestResultP
170721
171082
  var parseRunTestPlanParams = Schema_exports.decodeUnknown(RunTestPlanParamsSchema);
170722
171083
 
170723
171084
  // src/version.ts
170724
- var VERSION = true ? "0.22.1" : "0.0.0-dev";
171085
+ var VERSION = true ? "0.23.0" : "0.0.0-dev";
170725
171086
 
170726
171087
  // src/mcp/tool-output-schema.ts
170727
171088
  var defaultToolOutputSchema = {
@@ -173742,8 +174103,10 @@ var batchGetEmailsForPersons = (client, personIds) => Effect_exports.gen(functio
173742
174103
  );
173743
174104
  const emailMap = /* @__PURE__ */ new Map();
173744
174105
  for (const channel of channels) {
173745
- if (!emailMap.has(channel.attachedTo)) {
173746
- emailMap.set(channel.attachedTo, channel.value);
174106
+ const personId = toRef(channel.attachedTo);
174107
+ const email3 = Schema_exports.decodeUnknownOption(Email)(channel.value);
174108
+ if (!emailMap.has(personId) && Option_exports.isSome(email3)) {
174109
+ emailMap.set(personId, email3.value);
173747
174110
  }
173748
174111
  }
173749
174112
  return emailMap;
@@ -173811,6 +174174,7 @@ var findPersonByExactName = (client, name) => Effect_exports.gen(function* () {
173811
174174
  }
173812
174175
  return persons[0];
173813
174176
  });
174177
+ var findPersonByExactEmailOrName = (client, identifier2) => isEmailIdentifier(identifier2) ? findPersonByExactEmail(client, identifier2) : findPersonByExactName(client, identifier2);
173814
174178
  var resolveEmployeeAccountUuid = (client, identifier2) => Effect_exports.gen(function* () {
173815
174179
  const person = yield* isEmailIdentifier(identifier2) ? findPersonByExactEmail(client, identifier2) : findPersonByExactName(client, PersonName.make(identifier2));
173816
174180
  if (person === void 0) {
@@ -180101,8 +180465,815 @@ var notificationTools = [
180101
180465
  }
180102
180466
  ];
180103
180467
 
180104
- // src/huly/operations/processes.ts
180468
+ // src/huly/operations/planner.ts
180469
+ var import_core40 = __toESM(require_lib4(), 1);
180470
+ var import_time3 = __toESM(require_lib35(), 1);
180471
+
180472
+ // src/huly/operations/planner-shared.ts
180105
180473
  var import_core38 = __toESM(require_lib4(), 1);
180474
+ var import_rank4 = __toESM(require_lib33(), 1);
180475
+ var import_time2 = __toESM(require_lib35(), 1);
180476
+
180477
+ // src/huly/operations/display-text.ts
180478
+ var hulyDisplayTextOrFallback = (schema, value3, fallback) => {
180479
+ const trimmed2 = value3?.trim() ?? "";
180480
+ return trimmed2 === "" ? fallback : schema.make(trimmed2);
180481
+ };
180482
+
180483
+ // src/huly/operations/planner-shared.ts
180484
+ var todoLookup = {
180485
+ user: contact.class.Person,
180486
+ attachedTo: tracker.class.Issue
180487
+ };
180488
+ var TODO_PRIORITY_TO_STRING = {
180489
+ [import_time2.ToDoPriority.NoPriority]: "no-priority",
180490
+ [import_time2.ToDoPriority.Low]: "low",
180491
+ [import_time2.ToDoPriority.Medium]: "medium",
180492
+ [import_time2.ToDoPriority.High]: "high",
180493
+ [import_time2.ToDoPriority.Urgent]: "urgent"
180494
+ };
180495
+ var STRING_TO_TODO_PRIORITY = {
180496
+ "no-priority": import_time2.ToDoPriority.NoPriority,
180497
+ low: import_time2.ToDoPriority.Low,
180498
+ medium: import_time2.ToDoPriority.Medium,
180499
+ high: import_time2.ToDoPriority.High,
180500
+ urgent: import_time2.ToDoPriority.Urgent
180501
+ };
180502
+ var todoPriorityToString = (priority) => TODO_PRIORITY_TO_STRING[priority];
180503
+ var stringToTodoPriority = (priority) => STRING_TO_TODO_PRIORITY[priority];
180504
+ var TODO_VISIBILITY_TO_HULY = {
180505
+ public: "public",
180506
+ freeBusy: "freeBusy",
180507
+ private: "private"
180508
+ };
180509
+ var HULY_VISIBILITY_TO_TODO = {
180510
+ public: "public",
180511
+ freeBusy: "freeBusy",
180512
+ private: "private"
180513
+ };
180514
+ var todoVisibilityToString = (visibility) => HULY_VISIBILITY_TO_TODO[visibility];
180515
+ var stringToTodoVisibility = (visibility) => TODO_VISIBILITY_TO_HULY[visibility];
180516
+ var todoDescriptionAsMarkupRef = (description) => (
180517
+ // eslint-disable-next-line no-restricted-syntax -- Brands are erased at runtime; both SDK markup refs are strings.
180518
+ description
180519
+ );
180520
+ var markupRefAsTodoDescription = (ref) => ref ?? "";
180521
+ var UNTITLED_TODO = TodoTitle.make("Untitled ToDo");
180522
+ var todoTitleOrFallback = (title) => hulyDisplayTextOrFallback(TodoTitle, title, UNTITLED_TODO);
180523
+ var attachmentTitleOrFallback = (title, fallback) => hulyDisplayTextOrFallback(TodoAttachmentTitle, title, TodoAttachmentTitle.make(fallback));
180524
+ var resolveTodoOwner = (client, owner) => Effect_exports.gen(function* () {
180525
+ if (owner === void 0) {
180526
+ const employee2 = yield* client.findOne(
180527
+ contact.mixin.Employee,
180528
+ hulyQuery({ personUuid: client.getAccountUuid() })
180529
+ );
180530
+ if (employee2 === void 0) {
180531
+ return yield* new PersonNotAnEmployeeError({ identifier: "authenticated user" });
180532
+ }
180533
+ return employee2._id;
180534
+ }
180535
+ const byId = yield* client.findOne(
180536
+ contact.mixin.Employee,
180537
+ hulyQuery({ _id: toRef(owner) })
180538
+ );
180539
+ if (byId !== void 0) return byId._id;
180540
+ const personRef = owner.includes("@") ? Email.make(owner) : PersonName.make(owner);
180541
+ const person = yield* findPersonByExactEmailOrName(client, personRef);
180542
+ if (person === void 0) {
180543
+ return yield* new PersonNotFoundError({ identifier: owner });
180544
+ }
180545
+ const employee = yield* client.findOne(
180546
+ contact.mixin.Employee,
180547
+ hulyQuery({ _id: toRef(person._id) })
180548
+ );
180549
+ if (employee === void 0) {
180550
+ return yield* new PersonNotAnEmployeeError({ identifier: owner });
180551
+ }
180552
+ return employee._id;
180553
+ });
180554
+ var resolveTodoAttachment = (client, attachment2) => Effect_exports.gen(function* () {
180555
+ if (attachment2?.type === "issue") {
180556
+ const { issue: issue2, project: project3 } = yield* findProjectAndIssue({
180557
+ project: attachment2.project,
180558
+ identifier: attachment2.identifier
180559
+ }).pipe(Effect_exports.provideService(HulyClient, client));
180560
+ return {
180561
+ type: "issue",
180562
+ attachedTo: issue2._id,
180563
+ attachedToClass: tracker.class.Issue,
180564
+ attachedSpace: issue2.space,
180565
+ project: project3,
180566
+ issue: issue2
180567
+ };
180568
+ }
180569
+ return {
180570
+ type: "none",
180571
+ attachedTo: time3.ids.NotAttached,
180572
+ attachedToClass: time3.class.ToDo
180573
+ };
180574
+ });
180575
+ var latestOpenTodoRank = (client, owner) => Effect_exports.gen(function* () {
180576
+ const latestTodo = yield* client.findOne(
180577
+ time3.class.ToDo,
180578
+ hulyQuery({
180579
+ user: owner,
180580
+ doneOn: null
180581
+ }),
180582
+ { sort: { rank: import_core38.SortingOrder.Ascending } }
180583
+ );
180584
+ return TodoRank.make((0, import_rank4.makeRank)(void 0, latestTodo?.rank));
180585
+ });
180586
+ var applyCompletionState = (query, completionState) => {
180587
+ if (completionState === "open") query.doneOn = null;
180588
+ if (completionState === "completed") {
180589
+ const completedFilter = { $ne: null };
180590
+ query.doneOn = completedFilter;
180591
+ }
180592
+ };
180593
+ var queryForAttachment = (query, attachment2) => {
180594
+ query.attachedTo = attachment2.attachedTo;
180595
+ query.attachedToClass = attachment2.attachedToClass;
180596
+ };
180597
+ var describeLocator = (locator) => JSON.stringify(locator);
180598
+ var queryFromListFilters = (owner, attachment2, filters) => {
180599
+ const query = {};
180600
+ if (owner !== void 0) query.user = owner;
180601
+ if (attachment2 !== void 0) queryForAttachment(query, attachment2);
180602
+ if (filters.title !== void 0) query.title = filters.title;
180603
+ if (filters.dueFrom !== void 0 || filters.dueTo !== void 0) {
180604
+ query.dueDate = {};
180605
+ if (filters.dueFrom !== void 0) query.dueDate.$gte = filters.dueFrom;
180606
+ if (filters.dueTo !== void 0) query.dueDate.$lte = filters.dueTo;
180607
+ }
180608
+ applyCompletionState(query, filters.completionState);
180609
+ if (filters.priority !== void 0) query.priority = stringToTodoPriority(filters.priority);
180610
+ if (filters.visibility !== void 0) query.visibility = stringToTodoVisibility(filters.visibility);
180611
+ return query;
180612
+ };
180613
+ var queryFromLocator = (owner, attachment2, locator, defaultCompletionState) => {
180614
+ const query = {};
180615
+ if ("title" in locator && locator.title !== void 0) query.title = locator.title;
180616
+ if (owner !== void 0) query.user = owner;
180617
+ if (attachment2 !== void 0) queryForAttachment(query, attachment2);
180618
+ applyCompletionState(query, locator.completionState ?? defaultCompletionState);
180619
+ return query;
180620
+ };
180621
+ var findTodo = (client, locator, defaultCompletionState = "open") => Effect_exports.gen(function* () {
180622
+ if ("todoId" in locator) {
180623
+ const todo = yield* client.findOne(
180624
+ time3.class.ToDo,
180625
+ hulyQuery({ _id: toRef(locator.todoId) }),
180626
+ withLookup(void 0, todoLookup)
180627
+ );
180628
+ if (todo === void 0) return yield* new TodoNotFoundError({ locator: describeLocator(locator) });
180629
+ return todo;
180630
+ }
180631
+ const owner = "owner" in locator ? yield* resolveTodoOwner(client, locator.owner) : void 0;
180632
+ const attachment2 = "issue" in locator ? yield* resolveTodoAttachment(client, { type: "issue", ...locator.issue }) : "attachedTo" in locator ? yield* resolveTodoAttachment(client, locator.attachedTo) : void 0;
180633
+ const todos = yield* client.findAll(
180634
+ time3.class.ToDo,
180635
+ hulyQuery(queryFromLocator(owner, attachment2, locator, defaultCompletionState)),
180636
+ { limit: 2, sort: { rank: import_core38.SortingOrder.Ascending } }
180637
+ );
180638
+ if (todos.length === 0) return yield* new TodoNotFoundError({ locator: describeLocator(locator) });
180639
+ if (todos.length > 1) {
180640
+ return yield* new TodoIdentifierAmbiguousError({ locator: describeLocator(locator), matches: todos.length });
180641
+ }
180642
+ return todos[0];
180643
+ });
180644
+ var todoOwnerSummary = (todo, emailByPersonId) => {
180645
+ const ownerId = toRef(todo.user);
180646
+ const name = todo.$lookup?.user?.name;
180647
+ const email3 = emailByPersonId.get(ownerId);
180648
+ return {
180649
+ id: PersonId.make(ownerId),
180650
+ ...name === void 0 ? {} : { name: PersonName.make(name) },
180651
+ ...email3 === void 0 ? {} : { email: email3 }
180652
+ };
180653
+ };
180654
+ var todoAttachmentSummary = (todo) => {
180655
+ if (todo.attachedTo === time3.ids.NotAttached) return { type: "none" };
180656
+ const issue2 = todo.$lookup?.attachedTo;
180657
+ if (todo.attachedToClass === tracker.class.Issue && issue2 !== void 0) {
180658
+ return {
180659
+ type: "issue",
180660
+ id: IssueId.make(issue2._id),
180661
+ project: ProjectIdentifier.make(IssueIdentifier.make(issue2.identifier).split("-")[0]),
180662
+ identifier: IssueIdentifier.make(issue2.identifier),
180663
+ title: attachmentTitleOrFallback(issue2.title, issue2.identifier)
180664
+ };
180665
+ }
180666
+ return {
180667
+ type: "unknown",
180668
+ id: DocId.make(todo.attachedTo),
180669
+ class: ObjectClassName.make(todo.attachedToClass)
180670
+ };
180671
+ };
180672
+ var runtimeCount = (value3) => Count.make(Number(value3));
180673
+ var runtimeTimestampOrNull = (value3) => value3 === void 0 || value3 === null ? value3 : Timestamp.make(Number(value3));
180674
+ var todoSummary = (todo, emailByPersonId) => {
180675
+ const labels = Reflect.get(todo, "labels");
180676
+ return {
180677
+ id: TodoId.make(todo._id),
180678
+ title: todoTitleOrFallback(todo.title),
180679
+ priority: todoPriorityToString(todo.priority),
180680
+ visibility: todoVisibilityToString(todo.visibility),
180681
+ owner: todoOwnerSummary(todo, emailByPersonId),
180682
+ attachedTo: todoAttachmentSummary(todo),
180683
+ workslots: runtimeCount(Reflect.get(todo, "workslots")),
180684
+ ...todo.dueDate === void 0 ? {} : { dueDate: runtimeTimestampOrNull(todo.dueDate) },
180685
+ doneOn: runtimeTimestampOrNull(todo.doneOn),
180686
+ ...labels === void 0 ? {} : { labels: runtimeCount(labels) }
180687
+ };
180688
+ };
180689
+ var uniqueTodoOwnerIds = (todos) => [...new Set(todos.map((todo) => todo.user).filter(isExistent))].map(toRef);
180690
+
180691
+ // src/huly/operations/time.ts
180692
+ var import_calendar8 = __toESM(require_lib25(), 1);
180693
+ var import_core39 = __toESM(require_lib4(), 1);
180694
+ var import_tracker6 = __toESM(require_lib36(), 1);
180695
+ var serverPopulatedCalendar = toRef("");
180696
+ var serverPopulatedPersonId = "";
180697
+ var refAsPersonId = (ref) => ref;
180698
+ var logTime = (params) => Effect_exports.gen(function* () {
180699
+ const { client, issue: issue2, project: project3 } = yield* findProjectAndIssue({
180700
+ project: params.project,
180701
+ identifier: params.identifier
180702
+ });
180703
+ const reportId = (0, import_core39.generateId)();
180704
+ const now2 = yield* Clock_exports.currentTimeMillis;
180705
+ const reportData = {
180706
+ employee: null,
180707
+ date: now2,
180708
+ value: params.value,
180709
+ description: params.description ?? ""
180710
+ };
180711
+ yield* client.addCollection(
180712
+ tracker.class.TimeSpendReport,
180713
+ project3._id,
180714
+ issue2._id,
180715
+ tracker.class.Issue,
180716
+ "reports",
180717
+ reportData,
180718
+ reportId
180719
+ );
180720
+ const updateOps = {
180721
+ $inc: { reportedTime: params.value, reports: 1 }
180722
+ };
180723
+ if (issue2.remainingTime > 0) {
180724
+ const newRemaining = Math.max(0, issue2.remainingTime - params.value);
180725
+ updateOps.remainingTime = newRemaining;
180726
+ }
180727
+ yield* client.updateDoc(
180728
+ tracker.class.Issue,
180729
+ project3._id,
180730
+ issue2._id,
180731
+ updateOps
180732
+ );
180733
+ return { reportId: TimeSpendReportId.make(reportId), identifier: IssueIdentifier.make(issue2.identifier) };
180734
+ });
180735
+ var getTimeReport = (params) => Effect_exports.gen(function* () {
180736
+ const { client, issue: issue2 } = yield* findProjectAndIssue({
180737
+ project: params.project,
180738
+ identifier: params.identifier
180739
+ });
180740
+ const reports = yield* client.findAll(
180741
+ tracker.class.TimeSpendReport,
180742
+ { attachedTo: issue2._id },
180743
+ { sort: { date: import_core39.SortingOrder.Descending } }
180744
+ );
180745
+ const employeeIds = [
180746
+ ...new Set(
180747
+ reports.map((r) => r.employee).filter(isExistent)
180748
+ )
180749
+ ];
180750
+ const persons = employeeIds.length > 0 ? yield* client.findAll(
180751
+ contact.class.Person,
180752
+ { _id: { $in: employeeIds } }
180753
+ ) : [];
180754
+ const personMap = new Map(persons.map((p) => [p._id, p.name]));
180755
+ const timeReports = reports.map((r) => ({
180756
+ id: TimeSpendReportId.make(r._id),
180757
+ identifier: IssueIdentifier.make(issue2.identifier),
180758
+ employee: r.employee && personMap.has(r.employee) ? PersonName.make(personMap.get(r.employee)) : void 0,
180759
+ date: r.date,
180760
+ value: r.value,
180761
+ description: r.description
180762
+ }));
180763
+ return {
180764
+ identifier: IssueIdentifier.make(issue2.identifier),
180765
+ totalTime: issue2.reportedTime,
180766
+ estimation: zeroAsUnset(NonNegativeNumber.make(issue2.estimation)),
180767
+ remainingTime: zeroAsUnset(NonNegativeNumber.make(issue2.remainingTime)),
180768
+ reports: timeReports
180769
+ };
180770
+ });
180771
+ var listTimeSpendReports = (params) => Effect_exports.gen(function* () {
180772
+ const client = yield* HulyClient;
180773
+ const query = {};
180774
+ if (params.project !== void 0) {
180775
+ const project3 = yield* client.findOne(
180776
+ tracker.class.Project,
180777
+ { identifier: params.project }
180778
+ );
180779
+ if (project3 === void 0) {
180780
+ return yield* new ProjectNotFoundError({ identifier: params.project });
180781
+ }
180782
+ query.space = project3._id;
180783
+ }
180784
+ if (params.from !== void 0 || params.to !== void 0) {
180785
+ const dateFilter = {};
180786
+ if (params.from !== void 0) dateFilter.$gte = params.from;
180787
+ if (params.to !== void 0) dateFilter.$lte = params.to;
180788
+ query.date = dateFilter;
180789
+ }
180790
+ const limit = clampLimit(params.limit);
180791
+ const reports = yield* client.findAll(
180792
+ tracker.class.TimeSpendReport,
180793
+ query,
180794
+ withLookup(
180795
+ { limit, sort: { date: import_core39.SortingOrder.Descending } },
180796
+ {
180797
+ attachedTo: tracker.class.Issue,
180798
+ employee: contact.class.Person
180799
+ }
180800
+ )
180801
+ );
180802
+ return reports.map((r) => ({
180803
+ id: TimeSpendReportId.make(r._id),
180804
+ identifier: r.$lookup?.attachedTo?.identifier !== void 0 ? IssueIdentifier.make(r.$lookup.attachedTo.identifier) : void 0,
180805
+ employee: r.$lookup?.employee?.name !== void 0 ? PersonName.make(r.$lookup.employee.name) : void 0,
180806
+ date: r.date,
180807
+ value: r.value,
180808
+ description: r.description
180809
+ }));
180810
+ });
180811
+ var getDetailedTimeReport = (params) => Effect_exports.gen(function* () {
180812
+ const { client, project: project3 } = yield* findProject(params.project);
180813
+ const query = { space: project3._id };
180814
+ if (params.from !== void 0 || params.to !== void 0) {
180815
+ const dateFilter = {};
180816
+ if (params.from !== void 0) dateFilter.$gte = params.from;
180817
+ if (params.to !== void 0) dateFilter.$lte = params.to;
180818
+ query.date = dateFilter;
180819
+ }
180820
+ const reports = yield* client.findAll(
180821
+ tracker.class.TimeSpendReport,
180822
+ query,
180823
+ withLookup(
180824
+ { sort: { date: import_core39.SortingOrder.Descending } },
180825
+ {
180826
+ attachedTo: tracker.class.Issue,
180827
+ employee: contact.class.Person
180828
+ }
180829
+ )
180830
+ );
180831
+ const byIssueMap = /* @__PURE__ */ new Map();
180832
+ const byEmployeeMap = /* @__PURE__ */ new Map();
180833
+ let totalTime = 0;
180834
+ for (const r of reports) {
180835
+ totalTime += r.value;
180836
+ const issueKey = r.attachedTo;
180837
+ const issue2 = r.$lookup?.attachedTo;
180838
+ const existing = byIssueMap.get(issueKey) ?? {
180839
+ identifier: issue2?.identifier !== void 0 ? IssueIdentifier.make(issue2.identifier) : void 0,
180840
+ issueTitle: issue2?.title ?? "Unknown",
180841
+ totalTime: 0,
180842
+ reports: []
180843
+ };
180844
+ existing.totalTime += r.value;
180845
+ existing.reports.push({
180846
+ id: TimeSpendReportId.make(r._id),
180847
+ identifier: issue2?.identifier !== void 0 ? IssueIdentifier.make(issue2.identifier) : void 0,
180848
+ employee: r.$lookup?.employee?.name !== void 0 ? PersonName.make(r.$lookup.employee.name) : void 0,
180849
+ date: r.date,
180850
+ value: r.value,
180851
+ description: r.description
180852
+ });
180853
+ byIssueMap.set(issueKey, existing);
180854
+ const empKey = r.employee ? r.employee : "__unassigned__";
180855
+ const empExisting = byEmployeeMap.get(empKey) ?? {
180856
+ employeeName: r.$lookup?.employee?.name !== void 0 ? PersonName.make(r.$lookup.employee.name) : void 0,
180857
+ totalTime: 0
180858
+ };
180859
+ empExisting.totalTime += r.value;
180860
+ byEmployeeMap.set(empKey, empExisting);
180861
+ }
180862
+ const byIssue = Array.from(byIssueMap.values());
180863
+ const byEmployee = Array.from(byEmployeeMap.values());
180864
+ return {
180865
+ project: params.project,
180866
+ totalTime,
180867
+ byIssue,
180868
+ byEmployee
180869
+ };
180870
+ });
180871
+ var listWorkSlots = (params) => Effect_exports.gen(function* () {
180872
+ const client = yield* HulyClient;
180873
+ const query = {};
180874
+ if (params.employeeId !== void 0) {
180875
+ const person = yield* client.findOne(
180876
+ contact.class.Person,
180877
+ { _id: toRef(params.employeeId) }
180878
+ );
180879
+ if (person === void 0) {
180880
+ const channels = yield* client.findAll(
180881
+ contact.class.Channel,
180882
+ { value: params.employeeId }
180883
+ );
180884
+ if (channels.length > 0) {
180885
+ const channel = channels[0];
180886
+ query.user = refAsPersonId(channel.attachedTo);
180887
+ }
180888
+ } else {
180889
+ query.user = refAsPersonId(person._id);
180890
+ }
180891
+ }
180892
+ if (params.from !== void 0 || params.to !== void 0) {
180893
+ const dateFilter = {};
180894
+ if (params.from !== void 0) dateFilter.$gte = params.from;
180895
+ if (params.to !== void 0) dateFilter.$lte = params.to;
180896
+ query.date = dateFilter;
180897
+ }
180898
+ const limit = clampLimit(params.limit);
180899
+ const slots = yield* client.findAll(
180900
+ time3.class.WorkSlot,
180901
+ query,
180902
+ { limit, sort: { date: import_core39.SortingOrder.Descending } }
180903
+ );
180904
+ return slots.map((s) => ({
180905
+ id: WorkSlotId.make(s._id),
180906
+ todoId: TodoId.make(s.attachedTo),
180907
+ date: Timestamp.make(s.date),
180908
+ dueDate: Timestamp.make(s.dueDate),
180909
+ title: s.title
180910
+ }));
180911
+ });
180912
+ var addWorkSlotForTodo = (client, params) => Effect_exports.gen(function* () {
180913
+ const slotId = (0, import_core39.generateId)();
180914
+ const slotData = {
180915
+ date: params.date,
180916
+ dueDate: params.dueDate,
180917
+ title: params.title,
180918
+ description: params.description,
180919
+ allDay: false,
180920
+ participants: [],
180921
+ access: import_calendar8.AccessLevel.Owner,
180922
+ reminders: [],
180923
+ visibility: params.visibility,
180924
+ eventId: "",
180925
+ calendar: serverPopulatedCalendar,
180926
+ user: serverPopulatedPersonId,
180927
+ blockTime: false
180928
+ };
180929
+ yield* client.addCollection(
180930
+ time3.class.WorkSlot,
180931
+ time3.space.ToDos,
180932
+ toRef(params.todoId),
180933
+ time3.class.ToDo,
180934
+ "workslots",
180935
+ slotData,
180936
+ slotId
180937
+ );
180938
+ return { slotId: WorkSlotId.make(slotId) };
180939
+ });
180940
+ var createPlannerWorkSlot = (params) => Effect_exports.gen(function* () {
180941
+ const client = yield* HulyClient;
180942
+ return yield* addWorkSlotForTodo(client, params);
180943
+ });
180944
+ var startTimer = (params) => Effect_exports.gen(function* () {
180945
+ const { issue: issue2 } = yield* findProjectAndIssue({
180946
+ project: params.project,
180947
+ identifier: params.identifier
180948
+ });
180949
+ const startedAt = yield* Clock_exports.currentTimeMillis;
180950
+ return {
180951
+ identifier: IssueIdentifier.make(issue2.identifier),
180952
+ startedAt: Timestamp.make(startedAt)
180953
+ };
180954
+ });
180955
+ var stopTimer = (params) => Effect_exports.gen(function* () {
180956
+ const { issue: issue2 } = yield* findProjectAndIssue({
180957
+ project: params.project,
180958
+ identifier: params.identifier
180959
+ });
180960
+ const stoppedAt = yield* Clock_exports.currentTimeMillis;
180961
+ return {
180962
+ identifier: IssueIdentifier.make(issue2.identifier),
180963
+ stoppedAt: Timestamp.make(stoppedAt)
180964
+ };
180965
+ });
180966
+
180967
+ // src/huly/operations/planner.ts
180968
+ var descriptionForTodo = (client, todo) => todo.description ? client.fetchMarkup(
180969
+ time3.class.ToDo,
180970
+ todo._id,
180971
+ "description",
180972
+ todoDescriptionAsMarkupRef(todo.description),
180973
+ "markdown"
180974
+ ) : Effect_exports.succeed(void 0);
180975
+ var detailFromTodo = (client, todo) => Effect_exports.gen(function* () {
180976
+ const emailMap = yield* batchGetEmailsForPersons(client, uniqueTodoOwnerIds([todo]));
180977
+ const description = yield* descriptionForTodo(client, todo);
180978
+ return {
180979
+ ...todoSummary(todo, emailMap),
180980
+ ...description === void 0 ? {} : { description },
180981
+ ...todo.attachedSpace === void 0 ? {} : { attachedSpace: SpaceId.make(todo.attachedSpace) },
180982
+ ...todo.createdOn === void 0 ? {} : { createdOn: Timestamp.make(todo.createdOn) },
180983
+ modifiedOn: Timestamp.make(todo.modifiedOn)
180984
+ };
180985
+ });
180986
+ var uploadTodoDescription = (client, objectClass, todoId, description) => Effect_exports.gen(function* () {
180987
+ if (description === void 0 || description.trim() === "") return "";
180988
+ const ref = yield* client.uploadMarkup(objectClass, todoId, "description", description, "markdown");
180989
+ return markupRefAsTodoDescription(ref);
180990
+ });
180991
+ var createPersonalTodo = (client, params, owner, todoId, description, rank) => {
180992
+ const data = {
180993
+ workslots: 0,
180994
+ title: params.title,
180995
+ description,
180996
+ priority: stringToTodoPriority(params.priority ?? "no-priority"),
180997
+ visibility: stringToTodoVisibility(params.visibility ?? "private"),
180998
+ user: owner,
180999
+ doneOn: null,
181000
+ rank
181001
+ };
181002
+ if (params.dueDate !== void 0) data.dueDate = params.dueDate;
181003
+ return client.addCollection(
181004
+ time3.class.ToDo,
181005
+ time3.space.ToDos,
181006
+ time3.ids.NotAttached,
181007
+ time3.class.ToDo,
181008
+ "todos",
181009
+ data,
181010
+ todoId
181011
+ ).pipe(Effect_exports.asVoid);
181012
+ };
181013
+ var createIssueTodo = (client, params, owner, issue2, todoId, description, rank) => {
181014
+ const data = {
181015
+ workslots: 0,
181016
+ title: params.title,
181017
+ description,
181018
+ priority: stringToTodoPriority(params.priority ?? "no-priority"),
181019
+ visibility: stringToTodoVisibility(params.visibility ?? "public"),
181020
+ user: owner,
181021
+ doneOn: null,
181022
+ attachedSpace: issue2.space,
181023
+ rank
181024
+ };
181025
+ if (params.dueDate !== void 0) data.dueDate = params.dueDate;
181026
+ return client.addCollection(
181027
+ time3.class.ProjectToDo,
181028
+ time3.space.ToDos,
181029
+ issue2._id,
181030
+ tracker.class.Issue,
181031
+ "todos",
181032
+ data,
181033
+ todoId
181034
+ ).pipe(Effect_exports.asVoid);
181035
+ };
181036
+ var listTodos = (params) => Effect_exports.gen(function* () {
181037
+ const client = yield* HulyClient;
181038
+ const owner = params.owner === void 0 ? void 0 : yield* resolveTodoOwner(client, params.owner);
181039
+ const attachment2 = params.issue === void 0 ? void 0 : yield* resolveTodoAttachment(client, { type: "issue", ...params.issue });
181040
+ const query = queryFromListFilters(owner, attachment2, {
181041
+ title: params.title,
181042
+ dueFrom: params.dueFrom,
181043
+ dueTo: params.dueTo,
181044
+ completionState: params.completionState,
181045
+ priority: params.priority,
181046
+ visibility: params.visibility
181047
+ });
181048
+ const todos = yield* client.findAll(
181049
+ time3.class.ToDo,
181050
+ hulyQuery(query),
181051
+ withLookup(
181052
+ { limit: clampLimit(params.limit), sort: { rank: import_core40.SortingOrder.Ascending } },
181053
+ todoLookup
181054
+ )
181055
+ );
181056
+ const titleSearch = params.titleSearch?.toLowerCase();
181057
+ const filtered = titleSearch === void 0 ? todos : todos.filter((todo) => todo.title.toLowerCase().includes(titleSearch));
181058
+ const emailMap = yield* batchGetEmailsForPersons(client, uniqueTodoOwnerIds(filtered));
181059
+ return filtered.map((todo) => todoSummary(todo, emailMap));
181060
+ });
181061
+ var getTodo = (params) => Effect_exports.gen(function* () {
181062
+ const client = yield* HulyClient;
181063
+ const todo = yield* findTodo(client, params.locator);
181064
+ return yield* detailFromTodo(client, todo);
181065
+ });
181066
+ var createTodo = (params) => Effect_exports.gen(function* () {
181067
+ const client = yield* HulyClient;
181068
+ const owner = yield* resolveTodoOwner(client, params.owner);
181069
+ const attachment2 = yield* resolveTodoAttachment(client, params.attachedTo);
181070
+ const rank = yield* latestOpenTodoRank(client, owner);
181071
+ if (attachment2.type === "issue" && attachment2.issue !== void 0) {
181072
+ const todoId2 = (0, import_core40.generateId)();
181073
+ const description2 = yield* uploadTodoDescription(client, time3.class.ProjectToDo, todoId2, params.description);
181074
+ yield* createIssueTodo(client, params, owner, attachment2.issue, todoId2, description2, rank);
181075
+ return { todoId: TodoId.make(todoId2) };
181076
+ }
181077
+ const todoId = (0, import_core40.generateId)();
181078
+ const description = yield* uploadTodoDescription(client, time3.class.ToDo, todoId, params.description);
181079
+ yield* createPersonalTodo(client, params, owner, todoId, description, rank);
181080
+ return { todoId: TodoId.make(todoId) };
181081
+ });
181082
+ var updateTodo = (params) => Effect_exports.gen(function* () {
181083
+ yield* requireUpdateFields("update_todo", params, UPDATE_TODO_FIELDS);
181084
+ const client = yield* HulyClient;
181085
+ const todo = yield* findTodo(client, params.locator);
181086
+ const updateEntries = [
181087
+ params.title === void 0 ? {} : { title: params.title },
181088
+ params.owner === void 0 ? {} : { user: yield* resolveTodoOwner(client, params.owner) },
181089
+ params.dueDate === void 0 ? {} : params.dueDate === null ? { $unset: { dueDate: "" } } : { dueDate: params.dueDate },
181090
+ params.priority === void 0 ? {} : { priority: stringToTodoPriority(params.priority) },
181091
+ params.visibility === void 0 ? {} : { visibility: stringToTodoVisibility(params.visibility) },
181092
+ yield* Effect_exports.gen(function* () {
181093
+ if (params.description === void 0) return {};
181094
+ if (params.description === null || params.description.trim() === "") return { description: "" };
181095
+ if (todo.description) {
181096
+ yield* client.updateMarkup(time3.class.ToDo, todo._id, "description", params.description, "markdown");
181097
+ return {};
181098
+ }
181099
+ const ref = yield* client.uploadMarkup(time3.class.ToDo, todo._id, "description", params.description, "markdown");
181100
+ return { description: markupRefAsTodoDescription(ref) };
181101
+ })
181102
+ ];
181103
+ const updateOps = mergeUpdateEntries(updateEntries);
181104
+ if (Object.keys(updateOps).length > 0) {
181105
+ yield* client.updateDoc(time3.class.ToDo, todo.space, todo._id, updateOps);
181106
+ }
181107
+ return { todoId: TodoId.make(todo._id), updated: true };
181108
+ });
181109
+ var completeTodo = (params) => Effect_exports.gen(function* () {
181110
+ const client = yield* HulyClient;
181111
+ const todo = yield* findTodo(client, params.locator);
181112
+ const doneOn = params.doneOn ?? (yield* Clock_exports.currentTimeMillis);
181113
+ yield* client.updateDoc(time3.class.ToDo, todo.space, todo._id, { doneOn });
181114
+ return { todoId: TodoId.make(todo._id), updated: true };
181115
+ });
181116
+ var reopenTodo = (params) => Effect_exports.gen(function* () {
181117
+ const client = yield* HulyClient;
181118
+ const todo = yield* findTodo(client, params.locator, "completed");
181119
+ yield* client.updateDoc(time3.class.ToDo, todo.space, todo._id, { doneOn: null });
181120
+ return { todoId: TodoId.make(todo._id), updated: true };
181121
+ });
181122
+ var deleteTodo = (params) => Effect_exports.gen(function* () {
181123
+ const client = yield* HulyClient;
181124
+ const todo = yield* findTodo(client, params.locator);
181125
+ if (todo.attachedToClass === tracker.class.Issue && todo.attachedTo !== time3.ids.NotAttached) {
181126
+ yield* client.removeDoc(time3.class.ProjectToDo, todo.space, toRef(todo._id));
181127
+ yield* decrementIssueTodoCounter(client, todo);
181128
+ } else {
181129
+ yield* client.removeDoc(time3.class.ToDo, todo.space, todo._id);
181130
+ }
181131
+ return { todoId: TodoId.make(todo._id), deleted: true };
181132
+ });
181133
+ var decrementIssueTodoCounter = (client, todo) => client.updateDoc(
181134
+ toRef(tracker.class.Issue),
181135
+ todo.attachedSpace ?? todo.space,
181136
+ toRef(todo.attachedTo),
181137
+ { $inc: { todos: -1 } }
181138
+ ).pipe(Effect_exports.asVoid);
181139
+ var scheduleTodo = (params) => Effect_exports.gen(function* () {
181140
+ const client = yield* HulyClient;
181141
+ const todo = yield* findTodo(client, params.locator);
181142
+ const description = yield* descriptionForTodo(client, todo);
181143
+ const result = yield* createPlannerWorkSlot({
181144
+ todoId: TodoId.make(todo._id),
181145
+ date: params.date,
181146
+ dueDate: params.dueDate,
181147
+ title: todoTitleOrFallback(todo.title),
181148
+ description: description ?? "",
181149
+ visibility: todo.visibility
181150
+ });
181151
+ return { todoId: TodoId.make(todo._id), workSlotId: result.slotId };
181152
+ });
181153
+ var removeWorkSlot = (client, slot) => Effect_exports.gen(function* () {
181154
+ if (client.removeCollection !== void 0) {
181155
+ yield* client.removeCollection(
181156
+ time3.class.WorkSlot,
181157
+ slot.space,
181158
+ slot._id,
181159
+ toRef(slot.attachedTo),
181160
+ toRef(time3.class.ToDo),
181161
+ "workslots"
181162
+ );
181163
+ } else {
181164
+ yield* client.removeDoc(time3.class.WorkSlot, slot.space, slot._id);
181165
+ yield* decrementTodoWorkSlotCounter(client, slot);
181166
+ }
181167
+ });
181168
+ var decrementTodoWorkSlotCounter = (client, slot) => client.updateDoc(
181169
+ toRef(time3.class.ToDo),
181170
+ time3.space.ToDos,
181171
+ toRef(slot.attachedTo),
181172
+ { $inc: { workslots: -1 } }
181173
+ ).pipe(Effect_exports.asVoid);
181174
+ var unscheduleTodo = (params) => Effect_exports.gen(function* () {
181175
+ const client = yield* HulyClient;
181176
+ if ("workSlotId" in params) {
181177
+ const slot = yield* client.findOne(
181178
+ time3.class.WorkSlot,
181179
+ hulyQuery({ _id: toRef(params.workSlotId) })
181180
+ );
181181
+ if (slot === void 0) return yield* new TodoWorkSlotNotFoundError({ workSlotId: params.workSlotId });
181182
+ yield* removeWorkSlot(client, slot);
181183
+ return { todoId: TodoId.make(slot.attachedTo), removed: Count.make(1) };
181184
+ }
181185
+ const todo = yield* findTodo(client, params.locator);
181186
+ const query = params.scope === "future" ? hulyQuery({
181187
+ attachedTo: todo._id,
181188
+ date: { $gte: params.from ?? (yield* Clock_exports.currentTimeMillis) }
181189
+ }) : hulyQuery({ attachedTo: todo._id });
181190
+ const slots = yield* client.findAll(time3.class.WorkSlot, query);
181191
+ yield* Effect_exports.all(slots.map((slot) => removeWorkSlot(client, slot)));
181192
+ return { todoId: TodoId.make(todo._id), removed: Count.make(slots.length) };
181193
+ });
181194
+
181195
+ // src/mcp/tools/planner.ts
181196
+ var CATEGORY17 = "planner";
181197
+ var plannerTools = [
181198
+ {
181199
+ name: "list_todos",
181200
+ description: `List Huly Planner ToDos. Empty input returns up to ${DEFAULT_LIMIT} ToDos in planner order with all completion states. Use owner, issue, title, due date, priority, visibility, or completion filters to narrow results.`,
181201
+ category: CATEGORY17,
181202
+ inputSchema: listTodosParamsJsonSchema,
181203
+ handler: createEncodedToolHandler("list_todos", parseListTodosParams, listTodos, ListTodosResultSchema)
181204
+ },
181205
+ {
181206
+ name: "get_todo",
181207
+ description: "Get one Planner ToDo by raw todoId or by human locator such as issue + title + owner. Returns stable ToDo fields, owner, attachment context, description, labels count, and work slot count.",
181208
+ category: CATEGORY17,
181209
+ inputSchema: getTodoParamsJsonSchema,
181210
+ handler: createEncodedToolHandler("get_todo", parseGetTodoParams, getTodo, TodoDetailSchema)
181211
+ },
181212
+ {
181213
+ name: "create_todo",
181214
+ description: "Create a Planner ToDo. Omit attachedTo for a personal ToDo, or pass attachedTo.type=issue with project and identifier for an issue action item. The owner defaults to the authenticated user.",
181215
+ category: CATEGORY17,
181216
+ inputSchema: createTodoParamsJsonSchema,
181217
+ handler: createEncodedToolHandler("create_todo", parseCreateTodoParams, createTodo, CreateTodoResultSchema)
181218
+ },
181219
+ {
181220
+ name: "update_todo",
181221
+ description: "Update a Planner ToDo by human locator or raw todoId. Supports title, markdown description, owner, dueDate including null to clear, priority, and visibility.",
181222
+ category: CATEGORY17,
181223
+ inputSchema: updateTodoParamsJsonSchema,
181224
+ handler: createEncodedToolHandler("update_todo", parseUpdateTodoParams, updateTodo, UpdateTodoResultSchema)
181225
+ },
181226
+ {
181227
+ name: "complete_todo",
181228
+ description: "Complete a Planner ToDo by setting doneOn. Huly may trim future work slots and run issue automation when the ToDo is attached to an issue.",
181229
+ category: CATEGORY17,
181230
+ inputSchema: completeTodoParamsJsonSchema,
181231
+ handler: createEncodedToolHandler(
181232
+ "complete_todo",
181233
+ parseCompleteTodoParams,
181234
+ completeTodo,
181235
+ CompleteTodoResultSchema
181236
+ )
181237
+ },
181238
+ {
181239
+ name: "reopen_todo",
181240
+ description: "Reopen a completed Planner ToDo by clearing doneOn. Human locators search completed ToDos by default; raw todoId locators target that exact ToDo.",
181241
+ category: CATEGORY17,
181242
+ inputSchema: reopenTodoParamsJsonSchema,
181243
+ handler: createEncodedToolHandler("reopen_todo", parseReopenTodoParams, reopenTodo, ReopenTodoResultSchema)
181244
+ },
181245
+ {
181246
+ name: "delete_todo",
181247
+ description: "Delete a Planner ToDo. This is destructive; deleting the last open issue ToDo can cause Huly classic issue status automation.",
181248
+ category: CATEGORY17,
181249
+ inputSchema: deleteTodoParamsJsonSchema,
181250
+ annotations: { destructiveHint: true, idempotentHint: true },
181251
+ handler: createEncodedToolHandler("delete_todo", parseDeleteTodoParams, deleteTodo, DeleteTodoResultSchema)
181252
+ },
181253
+ {
181254
+ name: "schedule_todo",
181255
+ description: "Schedule a Planner ToDo by raw todoId or human locator, creating a work slot with ToDo title, description, and visibility metadata.",
181256
+ category: CATEGORY17,
181257
+ inputSchema: scheduleTodoParamsJsonSchema,
181258
+ handler: createEncodedToolHandler("schedule_todo", parseScheduleTodoParams, scheduleTodo, ScheduleTodoResultSchema)
181259
+ },
181260
+ {
181261
+ name: "unschedule_todo",
181262
+ description: "Remove ToDo work slots. Pass either workSlotId to remove one slot, locator with scope=all, or locator with scope=future and optional from.",
181263
+ category: CATEGORY17,
181264
+ inputSchema: unscheduleTodoParamsJsonSchema,
181265
+ annotations: { destructiveHint: true, idempotentHint: true },
181266
+ handler: createEncodedToolHandler(
181267
+ "unschedule_todo",
181268
+ parseUnscheduleTodoParams,
181269
+ unscheduleTodo,
181270
+ UnscheduleTodoResultSchema
181271
+ )
181272
+ }
181273
+ ];
181274
+
181275
+ // src/huly/operations/processes.ts
181276
+ var import_core41 = __toESM(require_lib4(), 1);
180106
181277
 
180107
181278
  // src/huly/process-plugin.ts
180108
181279
  var import_platform2 = __toESM(require_lib(), 1);
@@ -180214,7 +181385,7 @@ var resolveProcess = (client, identifier2) => Effect_exports.gen(function* () {
180214
181385
  const allProcesses = yield* client.findAll(
180215
181386
  processPlugin.class.Process,
180216
181387
  {},
180217
- { sort: { name: import_core38.SortingOrder.Ascending } }
181388
+ { sort: { name: import_core41.SortingOrder.Ascending } }
180218
181389
  );
180219
181390
  const matches = [...allProcesses].filter(
180220
181391
  (process4) => normalizeForComparison(process4.name) === normalizeForComparison(identifier2)
@@ -180318,7 +181489,7 @@ var listProcesses = (params) => Effect_exports.gen(function* () {
180318
181489
  const processes = yield* client.findAll(
180319
181490
  processPlugin.class.Process,
180320
181491
  query,
180321
- { limit: clampLimit(params.limit), sort: { name: import_core38.SortingOrder.Ascending } }
181492
+ { limit: clampLimit(params.limit), sort: { name: import_core41.SortingOrder.Ascending } }
180322
181493
  );
180323
181494
  const data = yield* loadProcessDefinitionData(client, [...processes]);
180324
181495
  const result = {
@@ -180335,12 +181506,12 @@ var getProcess = (params) => Effect_exports.gen(function* () {
180335
181506
  client.findAll(
180336
181507
  processPlugin.class.State,
180337
181508
  { process: process4._id },
180338
- { sort: { rank: import_core38.SortingOrder.Ascending } }
181509
+ { sort: { rank: import_core41.SortingOrder.Ascending } }
180339
181510
  ),
180340
181511
  client.findAll(
180341
181512
  processPlugin.class.Transition,
180342
181513
  { process: process4._id },
180343
- { sort: { rank: import_core38.SortingOrder.Ascending } }
181514
+ { sort: { rank: import_core41.SortingOrder.Ascending } }
180344
181515
  )
180345
181516
  ]);
180346
181517
  const result = processDetail({ ...data, states: [...states], transitions: [...transitions] });
@@ -180358,7 +181529,7 @@ var listExecutions = (params) => Effect_exports.gen(function* () {
180358
181529
  const executions = yield* client.findAll(
180359
181530
  processPlugin.class.Execution,
180360
181531
  query,
180361
- { limit: clampLimit(params.limit), sort: { modifiedOn: import_core38.SortingOrder.Descending } }
181532
+ { limit: clampLimit(params.limit), sort: { modifiedOn: import_core41.SortingOrder.Descending } }
180362
181533
  );
180363
181534
  const processIds = executions.map((execution) => execution.process);
180364
181535
  const processLookup = processIds.length === 0 ? Effect_exports.succeed(/* @__PURE__ */ new Map()) : client.findAll(
@@ -180387,7 +181558,7 @@ var startProcess = (params) => Effect_exports.gen(function* () {
180387
181558
  const transitions = yield* client.findAll(
180388
181559
  processPlugin.class.Transition,
180389
181560
  { process: process4._id },
180390
- { sort: { rank: import_core38.SortingOrder.Ascending } }
181561
+ { sort: { rank: import_core41.SortingOrder.Ascending } }
180391
181562
  );
180392
181563
  const transition = initialTransition(transitions);
180393
181564
  if (transition === void 0) {
@@ -180429,7 +181600,7 @@ var startProcess = (params) => Effect_exports.gen(function* () {
180429
181600
  );
180430
181601
  }
180431
181602
  }
180432
- const executionId = (0, import_core38.generateId)();
181603
+ const executionId = (0, import_core41.generateId)();
180433
181604
  const executionData = {
180434
181605
  process: process4._id,
180435
181606
  card: card._id,
@@ -180482,12 +181653,12 @@ var cancelExecution = (params) => Effect_exports.gen(function* () {
180482
181653
  });
180483
181654
 
180484
181655
  // src/mcp/tools/processes.ts
180485
- var CATEGORY17 = "processes";
181656
+ var CATEGORY18 = "processes";
180486
181657
  var processTools = [
180487
181658
  {
180488
181659
  name: "list_processes",
180489
181660
  description: "List read-only Huly Process workflow definitions. Optionally filter by the master tag/card type that workflows attach to. Returns process IDs, names, attached card type, automation flags, and state/transition counts.",
180490
- category: CATEGORY17,
181661
+ category: CATEGORY18,
180491
181662
  inputSchema: listProcessesParamsJsonSchema,
180492
181663
  handler: createEncodedToolHandler(
180493
181664
  "list_processes",
@@ -180499,7 +181670,7 @@ var processTools = [
180499
181670
  {
180500
181671
  name: "get_process",
180501
181672
  description: "Get one Huly Process workflow definition by process ID or exact display name. If a name is ambiguous, the tool returns a typed error with candidate IDs instead of guessing.",
180502
- category: CATEGORY17,
181673
+ category: CATEGORY18,
180503
181674
  inputSchema: getProcessParamsJsonSchema,
180504
181675
  handler: createEncodedToolHandler(
180505
181676
  "get_process",
@@ -180511,7 +181682,7 @@ var processTools = [
180511
181682
  {
180512
181683
  name: "list_process_executions",
180513
181684
  description: "List read-only Huly Process workflow executions. Supports filters by process ID/name, card/document ID/title, and status. Rows are enriched with process name, card title, and current state title when available.",
180514
- category: CATEGORY17,
181685
+ category: CATEGORY18,
180515
181686
  inputSchema: listExecutionsParamsJsonSchema,
180516
181687
  handler: createEncodedToolHandler(
180517
181688
  "list_process_executions",
@@ -180523,7 +181694,7 @@ var processTools = [
180523
181694
  {
180524
181695
  name: "start_process",
180525
181696
  description: "Start a new active Huly Process workflow execution on a card/document. Accepts process ID or exact process name, and card/document ID or exact title; ambiguous names or titles fail with candidate IDs. This is not idempotent: each successful call creates a new execution unless the process forbids parallel active executions for the same card, in which case the existing active execution ID is returned in a typed error.",
180526
- category: CATEGORY17,
181697
+ category: CATEGORY18,
180527
181698
  inputSchema: startProcessParamsJsonSchema,
180528
181699
  annotations: {
180529
181700
  readOnlyHint: false,
@@ -180541,7 +181712,7 @@ var processTools = [
180541
181712
  {
180542
181713
  name: "cancel_execution",
180543
181714
  description: "Idempotently cancel one Huly Process execution by execution ID. Active executions are marked cancelled; already-cancelled executions succeed with cancelled=false; completed executions fail without changing history.",
180544
- category: CATEGORY17,
181715
+ category: CATEGORY18,
180545
181716
  inputSchema: cancelExecutionParamsJsonSchema,
180546
181717
  annotations: {
180547
181718
  readOnlyHint: false,
@@ -180559,8 +181730,8 @@ var processTools = [
180559
181730
  ];
180560
181731
 
180561
181732
  // src/huly/operations/projects.ts
180562
- var import_core39 = __toESM(require_lib4(), 1);
180563
- var import_tracker6 = __toESM(require_lib36(), 1);
181733
+ var import_core42 = __toESM(require_lib4(), 1);
181734
+ var import_tracker7 = __toESM(require_lib36(), 1);
180564
181735
  var listProjects = (params) => Effect_exports.gen(function* () {
180565
181736
  const client = yield* HulyClient;
180566
181737
  const query = {};
@@ -180574,7 +181745,7 @@ var listProjects = (params) => Effect_exports.gen(function* () {
180574
181745
  {
180575
181746
  limit,
180576
181747
  sort: {
180577
- name: import_core39.SortingOrder.Ascending
181748
+ name: import_core42.SortingOrder.Ascending
180578
181749
  }
180579
181750
  }
180580
181751
  );
@@ -180642,7 +181813,7 @@ var createProject = (params) => Effect_exports.gen(function* () {
180642
181813
  created: false
180643
181814
  };
180644
181815
  }
180645
- const projectId = (0, import_core39.generateId)();
181816
+ const projectId = (0, import_core42.generateId)();
180646
181817
  const projectData = {
180647
181818
  name: params.name,
180648
181819
  description: params.description ?? "",
@@ -180656,7 +181827,7 @@ var createProject = (params) => Effect_exports.gen(function* () {
180656
181827
  // on first issue creation. Empty string sentinel is safe for initial project creation.
180657
181828
  // eslint-disable-next-line no-restricted-syntax -- see above
180658
181829
  defaultIssueStatus: "",
180659
- defaultTimeReportDay: import_tracker6.TimeReportDayType.CurrentWorkDay,
181830
+ defaultTimeReportDay: import_tracker7.TimeReportDayType.CurrentWorkDay,
180660
181831
  // tracker.ids.ClassingProjectType is the default classic tracker ProjectType.
180661
181832
  type: tracker.ids.ClassingProjectType
180662
181833
  };
@@ -180700,12 +181871,12 @@ var deleteProject = (params) => Effect_exports.gen(function* () {
180700
181871
  });
180701
181872
 
180702
181873
  // src/mcp/tools/projects.ts
180703
- var CATEGORY18 = "projects";
181874
+ var CATEGORY19 = "projects";
180704
181875
  var projectTools = [
180705
181876
  {
180706
181877
  name: "list_projects",
180707
181878
  description: "List all Huly projects. Returns projects sorted by name. Supports filtering by archived status.",
180708
- category: CATEGORY18,
181879
+ category: CATEGORY19,
180709
181880
  inputSchema: listProjectsParamsJsonSchema,
180710
181881
  handler: createToolHandler(
180711
181882
  "list_projects",
@@ -180716,7 +181887,7 @@ var projectTools = [
180716
181887
  {
180717
181888
  name: "get_project",
180718
181889
  description: "Get full details of a Huly project including its statuses. Returns project name, description, archived flag, default status, and all available statuses.",
180719
- category: CATEGORY18,
181890
+ category: CATEGORY19,
180720
181891
  inputSchema: getProjectParamsJsonSchema,
180721
181892
  handler: createToolHandler(
180722
181893
  "get_project",
@@ -180727,7 +181898,7 @@ var projectTools = [
180727
181898
  {
180728
181899
  name: "list_statuses",
180729
181900
  description: "List all issue statuses for a Huly project with workflow category and default info. Returns status name, category, and isDefault. Use this to discover valid statuses before creating or updating issues.",
180730
- category: CATEGORY18,
181901
+ category: CATEGORY19,
180731
181902
  inputSchema: listStatusesParamsJsonSchema,
180732
181903
  handler: createToolHandler(
180733
181904
  "list_statuses",
@@ -180738,7 +181909,7 @@ var projectTools = [
180738
181909
  {
180739
181910
  name: "create_project",
180740
181911
  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.",
180741
- category: CATEGORY18,
181912
+ category: CATEGORY19,
180742
181913
  inputSchema: createProjectParamsJsonSchema,
180743
181914
  handler: createToolHandler(
180744
181915
  "create_project",
@@ -180749,7 +181920,7 @@ var projectTools = [
180749
181920
  {
180750
181921
  name: "update_project",
180751
181922
  description: "Update a Huly project. Only provided fields are modified. Set description to null to clear it.",
180752
- category: CATEGORY18,
181923
+ category: CATEGORY19,
180753
181924
  inputSchema: updateProjectParamsJsonSchema,
180754
181925
  handler: createToolHandler(
180755
181926
  "update_project",
@@ -180760,7 +181931,7 @@ var projectTools = [
180760
181931
  {
180761
181932
  name: "delete_project",
180762
181933
  description: "Permanently delete a Huly project. All issues, milestones, and components in this project will be orphaned. This action cannot be undone.",
180763
- category: CATEGORY18,
181934
+ category: CATEGORY19,
180764
181935
  inputSchema: deleteProjectParamsJsonSchema,
180765
181936
  handler: createToolHandler(
180766
181937
  "delete_project",
@@ -180771,7 +181942,7 @@ var projectTools = [
180771
181942
  ];
180772
181943
 
180773
181944
  // src/huly/operations/sdk-discovery.ts
180774
- var import_core40 = __toESM(require_lib4(), 1);
181945
+ var import_core43 = __toESM(require_lib4(), 1);
180775
181946
  var MAX_ANCESTOR_DEPTH = 32;
180776
181947
  var classRef3 = core.class.Class;
180777
181948
  var includesQuery = (text, query) => Option_exports.isNone(query) || text.includes(query.value.toLowerCase());
@@ -180814,7 +181985,7 @@ var fetchClasses = (client, params) => {
180814
181985
  return client.findAll(
180815
181986
  classRef3,
180816
181987
  hulyQuery(query),
180817
- { sort: { _id: import_core40.SortingOrder.Ascending } }
181988
+ { sort: { _id: import_core43.SortingOrder.Ascending } }
180818
181989
  );
180819
181990
  };
180820
181991
  var fetchAttributes = (client, params) => {
@@ -180825,7 +181996,7 @@ var fetchAttributes = (client, params) => {
180825
181996
  return client.findAll(
180826
181997
  core.class.Attribute,
180827
181998
  hulyQuery(query),
180828
- { sort: { name: import_core40.SortingOrder.Ascending } }
181999
+ { sort: { name: import_core43.SortingOrder.Ascending } }
180829
182000
  );
180830
182001
  };
180831
182002
  var resolveClass = (client, classId) => Effect_exports.gen(function* () {
@@ -180876,7 +182047,7 @@ var resolveAncestors = (client, cls) => Effect_exports.gen(function* () {
180876
182047
  var attributesForClasses = (client, classIds) => classIds.length === 0 ? Effect_exports.succeed([]) : client.findAll(
180877
182048
  core.class.Attribute,
180878
182049
  hulyQuery({ attributeOf: { $in: classIds.map(toRef) } }),
180879
- { sort: { name: import_core40.SortingOrder.Ascending } }
182050
+ { sort: { name: import_core43.SortingOrder.Ascending } }
180880
182051
  );
180881
182052
  var listHulyClasses = (params) => Effect_exports.gen(function* () {
180882
182053
  const client = yield* HulyClient;
@@ -180942,19 +182113,19 @@ var listHulyEnums = (params) => Effect_exports.gen(function* () {
180942
182113
  const rawEnums = yield* client.findAll(
180943
182114
  core.class.Enum,
180944
182115
  hulyQuery(query),
180945
- { sort: { name: import_core40.SortingOrder.Ascending } }
182116
+ { sort: { name: import_core43.SortingOrder.Ascending } }
180946
182117
  );
180947
182118
  const enums = rawEnums.map(toEnumSummary).filter((summary5) => includesQuery(enumSearchText(summary5), queryText)).slice(0, limit);
180948
182119
  return { enums, total: HulyDiscoveryCount.make(enums.length) };
180949
182120
  });
180950
182121
 
180951
182122
  // src/mcp/tools/sdk-discovery.ts
180952
- var CATEGORY19 = "sdk-discovery";
182123
+ var CATEGORY20 = "sdk-discovery";
180953
182124
  var sdkDiscoveryTools = [
180954
182125
  {
180955
182126
  name: "list_huly_classes",
180956
182127
  description: "Discover Huly model class, interface, and mixin IDs visible in this workspace. Use this before raw-object, generic association, custom field, or model-backed work when you need exact class IDs instead of guessing.",
180957
- category: CATEGORY19,
182128
+ category: CATEGORY20,
180958
182129
  inputSchema: listHulyClassesParamsJsonSchema,
180959
182130
  handler: createEncodedToolHandler(
180960
182131
  "list_huly_classes",
@@ -180966,7 +182137,7 @@ var sdkDiscoveryTools = [
180966
182137
  {
180967
182138
  name: "get_huly_class",
180968
182139
  description: "Read one Huly class/interface/mixin by exact ID and return its inheritance chain plus model attributes. Use this when you need fields, ref targets, enum IDs, or hints about purpose-built MCP tool categories for the class.",
180969
- category: CATEGORY19,
182140
+ category: CATEGORY20,
180970
182141
  inputSchema: getHulyClassParamsJsonSchema,
180971
182142
  handler: createEncodedToolHandler(
180972
182143
  "get_huly_class",
@@ -180978,7 +182149,7 @@ var sdkDiscoveryTools = [
180978
182149
  {
180979
182150
  name: "list_huly_attributes",
180980
182151
  description: "Discover Huly model attributes across the workspace or directly on one class/mixin. Returns attribute IDs, owner classes, labels, type families, ref targets, enum IDs, and custom-field markers.",
180981
- category: CATEGORY19,
182152
+ category: CATEGORY20,
180982
182153
  inputSchema: listHulyAttributesParamsJsonSchema,
180983
182154
  handler: createEncodedToolHandler(
180984
182155
  "list_huly_attributes",
@@ -180990,7 +182161,7 @@ var sdkDiscoveryTools = [
180990
182161
  {
180991
182162
  name: "list_huly_enums",
180992
182163
  description: "Discover Huly enum model documents and their valid values. Use enum IDs from get_huly_class or list_huly_attributes to inspect allowed enum values before writing or interpreting enum fields.",
180993
- category: CATEGORY19,
182164
+ category: CATEGORY20,
180994
182165
  inputSchema: listHulyEnumsParamsJsonSchema,
180995
182166
  handler: createEncodedToolHandler(
180996
182167
  "list_huly_enums",
@@ -181033,12 +182204,12 @@ var fulltextSearch = (params) => Effect_exports.gen(function* () {
181033
182204
  });
181034
182205
 
181035
182206
  // src/mcp/tools/search.ts
181036
- var CATEGORY20 = "search";
182207
+ var CATEGORY21 = "search";
181037
182208
  var searchTools = [
181038
182209
  {
181039
182210
  name: "fulltext_search",
181040
182211
  description: "Perform a global fulltext search across all Huly content. Searches issues, documents, messages, and other indexed content. Returns matching items sorted by relevance (newest first).",
181041
- category: CATEGORY20,
182212
+ category: CATEGORY21,
181042
182213
  inputSchema: fulltextSearchParamsJsonSchema,
181043
182214
  handler: createToolHandler(
181044
182215
  "fulltext_search",
@@ -181049,10 +182220,10 @@ var searchTools = [
181049
182220
  ];
181050
182221
 
181051
182222
  // src/huly/operations/spaces-read.ts
181052
- var import_core42 = __toESM(require_lib4(), 1);
182223
+ var import_core45 = __toESM(require_lib4(), 1);
181053
182224
 
181054
182225
  // src/huly/operations/spaces-shared.ts
181055
- var import_core41 = __toESM(require_lib4(), 1);
182226
+ var import_core44 = __toESM(require_lib4(), 1);
181056
182227
  var spaceClass = toClassRef(core.class.Space);
181057
182228
  var sortStrings = (values4) => [...values4].sort();
181058
182229
  var uniqueSorted = (values4) => sortStrings([...new Set(values4)]);
@@ -181086,7 +182257,7 @@ var findSpace = (client, params) => Effect_exports.gen(function* () {
181086
182257
  const matches = yield* client.findAll(
181087
182258
  spaceClass,
181088
182259
  hulyQuery(applySpaceFilters(hulyQuery({ name: params.space }), params)),
181089
- { limit: 10, sort: { name: import_core41.SortingOrder.Ascending } }
182260
+ { limit: 10, sort: { name: import_core44.SortingOrder.Ascending } }
181090
182261
  );
181091
182262
  if (matches.length === 0) {
181092
182263
  return yield* new SpaceNotFoundError({ identifier: NonEmptyString2.make(params.space) });
@@ -181192,7 +182363,7 @@ var findSpaceType = (client, identifier2) => Effect_exports.gen(function* () {
181192
182363
  const byName = yield* client.findAll(
181193
182364
  core.class.SpaceType,
181194
182365
  hulyQuery({ name: identifier2 }),
181195
- { limit: 10, sort: { name: import_core42.SortingOrder.Ascending } }
182366
+ { limit: 10, sort: { name: import_core45.SortingOrder.Ascending } }
181196
182367
  );
181197
182368
  if (byName.length === 0) {
181198
182369
  return yield* new SpaceTypeNotFoundError({ identifier: NonEmptyString2.make(identifier2) });
@@ -181226,7 +182397,7 @@ var listSpaces = (params) => Effect_exports.gen(function* () {
181226
182397
  const spaces = yield* client.findAll(
181227
182398
  spaceClass,
181228
182399
  hulyQuery(query),
181229
- { limit, sort: { name: import_core42.SortingOrder.Ascending }, total: true }
182400
+ { limit, sort: { name: import_core45.SortingOrder.Ascending }, total: true }
181230
182401
  );
181231
182402
  return {
181232
182403
  spaces: spaces.map(toSpaceSummary),
@@ -181248,7 +182419,7 @@ var listSpaceTypes = (params) => Effect_exports.gen(function* () {
181248
182419
  const spaceTypes = yield* client.findAll(
181249
182420
  core.class.SpaceType,
181250
182421
  hulyQuery(query),
181251
- { limit, sort: { name: import_core42.SortingOrder.Ascending }, total: true }
182422
+ { limit, sort: { name: import_core45.SortingOrder.Ascending }, total: true }
181252
182423
  );
181253
182424
  const descriptorIds = sortStrings([...new Set(spaceTypes.map(descriptorId))]);
181254
182425
  const descriptors = descriptorIds.length === 0 ? [] : yield* client.findAll(
@@ -181272,7 +182443,7 @@ var getSpaceType = (params) => Effect_exports.gen(function* () {
181272
182443
  const roles = yield* client.findAll(
181273
182444
  core.class.Role,
181274
182445
  hulyQuery({ attachedTo: spaceType._id }),
181275
- { limit: clampLimit(void 0), sort: { name: import_core42.SortingOrder.Ascending } }
182446
+ { limit: clampLimit(void 0), sort: { name: import_core45.SortingOrder.Ascending } }
181276
182447
  );
181277
182448
  const permissionIds = sortStrings([
181278
182449
  .../* @__PURE__ */ new Set([
@@ -181308,7 +182479,7 @@ var listSpacePermissions = (params) => Effect_exports.gen(function* () {
181308
182479
  const permissions = yield* client.findAll(
181309
182480
  core.class.Permission,
181310
182481
  hulyQuery(query),
181311
- { sort: { label: import_core42.SortingOrder.Ascending } }
182482
+ { sort: { label: import_core45.SortingOrder.Ascending } }
181312
182483
  );
181313
182484
  const filtered = permissions.filter((permission) => permissionSearchMatches(permission, params.search));
181314
182485
  const limited = filtered.slice(0, clampLimit(params.limit));
@@ -181373,68 +182544,68 @@ var setSpaceOwners = (params) => Effect_exports.gen(function* () {
181373
182544
  });
181374
182545
 
181375
182546
  // src/mcp/tools/spaces.ts
181376
- var CATEGORY21 = "spaces";
182547
+ var CATEGORY22 = "spaces";
181377
182548
  var spaceTools = [
181378
182549
  {
181379
182550
  name: "list_spaces",
181380
182551
  description: "List generic Huly spaces across modules. Defaults to active/non-archived spaces. Returns raw space id, class, type, privacy, archived, autoJoin, member count, and owner count so module-specific tools can reuse the result.",
181381
- category: CATEGORY21,
182552
+ category: CATEGORY22,
181382
182553
  inputSchema: listSpacesParamsJsonSchema,
181383
182554
  handler: createToolHandler("list_spaces", parseListSpacesParams, listSpaces)
181384
182555
  },
181385
182556
  {
181386
182557
  name: "get_space",
181387
182558
  description: "Get one generic Huly space by raw space _id or exact space name. Resolution tries _id first, then exact name. If a name matches multiple spaces, pass class and/or type to narrow; ambiguous errors include matching ids/classes/types.",
181388
- category: CATEGORY21,
182559
+ category: CATEGORY22,
181389
182560
  inputSchema: getSpaceParamsJsonSchema,
181390
182561
  handler: createToolHandler("get_space", parseGetSpaceParams, getSpace)
181391
182562
  },
181392
182563
  {
181393
182564
  name: "list_space_types",
181394
182565
  description: "List configured Huly SpaceType records. Returns descriptor id, base class, target class, default members, autoJoin, and role count for discovering typed-space configuration.",
181395
- category: CATEGORY21,
182566
+ category: CATEGORY22,
181396
182567
  inputSchema: listSpaceTypesParamsJsonSchema,
181397
182568
  handler: createToolHandler("list_space_types", parseListSpaceTypesParams, listSpaceTypes)
181398
182569
  },
181399
182570
  {
181400
182571
  name: "get_space_type",
181401
182572
  description: "Get one Huly SpaceType by raw SpaceType _id or exact name, including descriptor metadata, role definitions, role permission ids/labels, and available permissions.",
181402
- category: CATEGORY21,
182573
+ category: CATEGORY22,
181403
182574
  inputSchema: getSpaceTypeParamsJsonSchema,
181404
182575
  handler: createToolHandler("get_space_type", parseGetSpaceTypeParams, getSpaceType)
181405
182576
  },
181406
182577
  {
181407
182578
  name: "list_space_permissions",
181408
182579
  description: "List core Huly Permission records for space/workspace access control discovery. Filter by scope, objectClass, or search text. This is read-only and does not assign permissions.",
181409
- category: CATEGORY21,
182580
+ category: CATEGORY22,
181410
182581
  inputSchema: listSpacePermissionsParamsJsonSchema,
181411
182582
  handler: createToolHandler("list_space_permissions", parseListSpacePermissionsParams, listSpacePermissions)
181412
182583
  },
181413
182584
  {
181414
182585
  name: "update_space",
181415
182586
  description: "Update safe common metadata on an existing Huly space: name, description, private, archived, and autoJoin. Does not create/delete spaces or mutate module-specific required fields.",
181416
- category: CATEGORY21,
182587
+ category: CATEGORY22,
181417
182588
  inputSchema: updateSpaceParamsJsonSchema,
181418
182589
  handler: createToolHandler("update_space", parseUpdateSpaceParams, updateSpace)
181419
182590
  },
181420
182591
  {
181421
182592
  name: "add_space_members",
181422
182593
  description: "Idempotently add members to an existing Huly space. Members accept account UUID, exact email, or exact person display name and resolve to Huly account UUIDs before replacing the full members array.",
181423
- category: CATEGORY21,
182594
+ category: CATEGORY22,
181424
182595
  inputSchema: spaceMemberMutationParamsJsonSchema,
181425
182596
  handler: createToolHandler("add_space_members", parseSpaceMemberMutationParams, addSpaceMembers)
181426
182597
  },
181427
182598
  {
181428
182599
  name: "remove_space_members",
181429
182600
  description: "Idempotently remove members from an existing Huly space. Members accept account UUID, exact email, or exact person display name and resolve to Huly account UUIDs before replacing the full members array.",
181430
- category: CATEGORY21,
182601
+ category: CATEGORY22,
181431
182602
  inputSchema: spaceMemberMutationParamsJsonSchema,
181432
182603
  handler: createToolHandler("remove_space_members", parseSpaceMemberMutationParams, removeSpaceMembers)
181433
182604
  },
181434
182605
  {
181435
182606
  name: "set_space_owners",
181436
182607
  description: "Replace owners on an existing Huly space. Owners accept account UUID, exact email, or exact person display name. By default, owners are also ensured in members.",
181437
- category: CATEGORY21,
182608
+ category: CATEGORY22,
181438
182609
  inputSchema: setSpaceOwnersParamsJsonSchema,
181439
182610
  handler: createToolHandler("set_space_owners", parseSetSpaceOwnersParams, setSpaceOwners)
181440
182611
  }
@@ -181453,12 +182624,12 @@ var uploadFile = (params) => Effect_exports.gen(function* () {
181453
182624
  });
181454
182625
 
181455
182626
  // src/mcp/tools/storage.ts
181456
- var CATEGORY22 = "storage";
182627
+ var CATEGORY23 = "storage";
181457
182628
  var storageTools = [
181458
182629
  {
181459
182630
  name: "upload_file",
181460
182631
  description: "Upload a file to Huly storage. Provide ONE of: filePath (local file - preferred), fileUrl (fetch from URL), or data (base64 - for small files only). Returns blob ID and URL for referencing the file.",
181461
- category: CATEGORY22,
182632
+ category: CATEGORY23,
181462
182633
  inputSchema: uploadFileParamsJsonSchema,
181463
182634
  handler: createStorageToolHandler(
181464
182635
  "upload_file",
@@ -181469,7 +182640,7 @@ var storageTools = [
181469
182640
  ];
181470
182641
 
181471
182642
  // src/huly/operations/tag-categories.ts
181472
- var import_core43 = __toESM(require_lib4(), 1);
182643
+ var import_core46 = __toESM(require_lib4(), 1);
181473
182644
  var issueClassRef2 = toRef(tracker.class.Issue);
181474
182645
  var findCategoryByIdOrLabel = (client, idOrLabel) => Effect_exports.gen(function* () {
181475
182646
  const cat = (yield* client.findOne(
@@ -181507,7 +182678,7 @@ var listTagCategories = (params) => Effect_exports.gen(function* () {
181507
182678
  query,
181508
182679
  {
181509
182680
  limit,
181510
- sort: { modifiedOn: import_core43.SortingOrder.Descending }
182681
+ sort: { modifiedOn: import_core46.SortingOrder.Descending }
181511
182682
  }
181512
182683
  );
181513
182684
  return categories.map(toSummary);
@@ -181522,7 +182693,7 @@ var createTagCategory = (params) => Effect_exports.gen(function* () {
181522
182693
  if (existing !== void 0) {
181523
182694
  return { id: TagCategoryId.make(existing._id), label: existing.label, created: false };
181524
182695
  }
181525
- const catId = (0, import_core43.generateId)();
182696
+ const catId = (0, import_core46.generateId)();
181526
182697
  const catData = {
181527
182698
  // Asset is a branded string type (Metadata<URL>) with no runtime constructor.
181528
182699
  // Empty string is the "no icon" sentinel; Huly UI renders a default icon.
@@ -181573,12 +182744,12 @@ var deleteTagCategory = (params) => Effect_exports.gen(function* () {
181573
182744
  });
181574
182745
 
181575
182746
  // src/mcp/tools/tag-categories.ts
181576
- var CATEGORY23 = "tag-categories";
182747
+ var CATEGORY24 = "tag-categories";
181577
182748
  var tagCategoryTools = [
181578
182749
  {
181579
182750
  name: "list_tag_categories",
181580
182751
  description: "List tag/label categories in the workspace. Categories group labels (e.g., 'Priority Labels', 'Type Labels'). Optional targetClass filter (defaults to all).",
181581
- category: CATEGORY23,
182752
+ category: CATEGORY24,
181582
182753
  inputSchema: listTagCategoriesParamsJsonSchema,
181583
182754
  handler: createToolHandler(
181584
182755
  "list_tag_categories",
@@ -181589,7 +182760,7 @@ var tagCategoryTools = [
181589
182760
  {
181590
182761
  name: "create_tag_category",
181591
182762
  description: "Create a new tag/label category. Idempotent: returns existing category if one with the same label and targetClass already exists (created=false). Defaults targetClass to tracker issues.",
181592
- category: CATEGORY23,
182763
+ category: CATEGORY24,
181593
182764
  inputSchema: createTagCategoryParamsJsonSchema,
181594
182765
  handler: createToolHandler(
181595
182766
  "create_tag_category",
@@ -181600,7 +182771,7 @@ var tagCategoryTools = [
181600
182771
  {
181601
182772
  name: "update_tag_category",
181602
182773
  description: "Update a tag/label category. Accepts category ID or label name. Only provided fields are modified.",
181603
- category: CATEGORY23,
182774
+ category: CATEGORY24,
181604
182775
  inputSchema: updateTagCategoryParamsJsonSchema,
181605
182776
  handler: createToolHandler(
181606
182777
  "update_tag_category",
@@ -181611,7 +182782,7 @@ var tagCategoryTools = [
181611
182782
  {
181612
182783
  name: "delete_tag_category",
181613
182784
  description: "Permanently delete a tag/label category. Accepts category ID or label name. Labels in this category will be orphaned (not deleted). This action cannot be undone.",
181614
- category: CATEGORY23,
182785
+ category: CATEGORY24,
181615
182786
  inputSchema: deleteTagCategoryParamsJsonSchema,
181616
182787
  handler: createToolHandler(
181617
182788
  "delete_tag_category",
@@ -181622,12 +182793,12 @@ var tagCategoryTools = [
181622
182793
  ];
181623
182794
 
181624
182795
  // src/mcp/tools/tags.ts
181625
- var CATEGORY24 = "tags";
182796
+ var CATEGORY25 = "tags";
181626
182797
  var tagTools = [
181627
182798
  {
181628
182799
  name: "list_tags",
181629
182800
  description: "List generic Huly tag definitions for one SDK target class. Use this for SDK-level tags such as recruiting skills or document labels. For Tracker issue labels, prefer list_labels.",
181630
- category: CATEGORY24,
182801
+ category: CATEGORY25,
181631
182802
  inputSchema: listTagsParamsJsonSchema,
181632
182803
  handler: createToolHandler(
181633
182804
  "list_tags",
@@ -181638,7 +182809,7 @@ var tagTools = [
181638
182809
  {
181639
182810
  name: "create_tag",
181640
182811
  description: "Create a generic Huly tag definition for one targetClass. Idempotent by targetClass + title. This exposes the SDK tags model; for Tracker issue labels, prefer create_label.",
181641
- category: CATEGORY24,
182812
+ category: CATEGORY25,
181642
182813
  inputSchema: createTagParamsJsonSchema,
181643
182814
  handler: createToolHandler(
181644
182815
  "create_tag",
@@ -181649,7 +182820,7 @@ var tagTools = [
181649
182820
  {
181650
182821
  name: "update_tag",
181651
182822
  description: "Update a generic Huly tag definition. The tag argument accepts a tag ID or exact title, resolved within targetClass.",
181652
- category: CATEGORY24,
182823
+ category: CATEGORY25,
181653
182824
  inputSchema: updateTagParamsJsonSchema,
181654
182825
  handler: createToolHandler(
181655
182826
  "update_tag",
@@ -181660,7 +182831,7 @@ var tagTools = [
181660
182831
  {
181661
182832
  name: "delete_tag",
181662
182833
  description: "Delete a generic Huly tag definition by ID or exact title, resolved within targetClass. This deletes the tag definition, not only one object's tag reference.",
181663
- category: CATEGORY24,
182834
+ category: CATEGORY25,
181664
182835
  inputSchema: deleteTagParamsJsonSchema,
181665
182836
  annotations: {
181666
182837
  destructiveHint: true,
@@ -181675,7 +182846,7 @@ var tagTools = [
181675
182846
  {
181676
182847
  name: "list_attached_tags",
181677
182848
  description: "List generic Huly TagReference rows attached to one raw object collection. Requires objectId, objectClass, space, and collection because this is an SDK-level tool.",
181678
- category: CATEGORY24,
182849
+ category: CATEGORY25,
181679
182850
  inputSchema: listAttachedTagsParamsJsonSchema,
181680
182851
  handler: createToolHandler(
181681
182852
  "list_attached_tags",
@@ -181686,7 +182857,7 @@ var tagTools = [
181686
182857
  {
181687
182858
  name: "attach_tag",
181688
182859
  description: "Attach a generic Huly tag to one raw object collection. Requires targetClass for the tag definition and objectId/objectClass/space/collection for the TagReference. Idempotent for the same object, collection, and tag.",
181689
- category: CATEGORY24,
182860
+ category: CATEGORY25,
181690
182861
  inputSchema: attachTagParamsJsonSchema,
181691
182862
  annotations: {
181692
182863
  idempotentHint: true
@@ -181700,7 +182871,7 @@ var tagTools = [
181700
182871
  {
181701
182872
  name: "detach_tag",
181702
182873
  description: "Detach a generic Huly tag from one raw object collection. Requires targetClass and objectId/objectClass/space/collection. Returns detached=false when the tag is not attached.",
181703
- category: CATEGORY24,
182874
+ category: CATEGORY25,
181704
182875
  inputSchema: detachTagParamsJsonSchema,
181705
182876
  handler: createToolHandler(
181706
182877
  "detach_tag",
@@ -181711,7 +182882,7 @@ var tagTools = [
181711
182882
  ];
181712
182883
 
181713
182884
  // src/huly/operations/task-management.ts
181714
- var import_core44 = __toESM(require_lib4(), 1);
182885
+ var import_core47 = __toESM(require_lib4(), 1);
181715
182886
  var import_platform3 = __toESM(require_lib(), 1);
181716
182887
  var STATUS_CATEGORY_BY_SDK_KEY = {
181717
182888
  UnStarted: { value: "UnStarted", ref: StatusCategoryBySdkKey.UnStarted, name: "UnStarted" },
@@ -181823,7 +182994,7 @@ var projectTypeDetail = (data) => ({
181823
182994
  var listAllProjectTypes = (client) => client.findAll(
181824
182995
  task.class.ProjectType,
181825
182996
  hulyQuery({}),
181826
- { sort: { name: import_core44.SortingOrder.Ascending } }
182997
+ { sort: { name: import_core47.SortingOrder.Ascending } }
181827
182998
  ).pipe(Effect_exports.map((result) => [...result]));
181828
182999
  var resolveProjectType = (client, projectTypeRef) => Effect_exports.gen(function* () {
181829
183000
  const projectTypes = yield* listAllProjectTypes(client);
@@ -181942,7 +183113,7 @@ var createTaskType = (params) => Effect_exports.gen(function* () {
181942
183113
  new HulyError({ message: `Project type '${projectType.name}' has no task type to copy.` })
181943
183114
  );
181944
183115
  }
181945
- const taskTypeId = (0, import_core44.generateId)();
183116
+ const taskTypeId = (0, import_core47.generateId)();
181946
183117
  const targetClassId = `${taskTypeId}:type:mixin`;
181947
183118
  const targetClassRef = toRef(targetClassId);
181948
183119
  const templateStatusIds = uniqueStatusRefs(template.statuses);
@@ -181951,7 +183122,7 @@ var createTaskType = (params) => Effect_exports.gen(function* () {
181951
183122
  core.space.Model,
181952
183123
  {
181953
183124
  extends: template.ofClass,
181954
- kind: import_core44.ClassifierKind.MIXIN,
183125
+ kind: import_core47.ClassifierKind.MIXIN,
181955
183126
  label: (0, import_platform3.getEmbeddedLabel)(params.name),
181956
183127
  ...template.icon === void 0 ? {} : { icon: template.icon }
181957
183128
  },
@@ -182036,7 +183207,7 @@ var createIssueStatus = (params) => Effect_exports.gen(function* () {
182036
183207
  [...workflowData.statuses, ...statusesByName],
182037
183208
  params.name
182038
183209
  );
182039
- const statusId = existingStatus?._id ?? (0, import_core44.generateId)();
183210
+ const statusId = existingStatus?._id ?? (0, import_core47.generateId)();
182040
183211
  if (existingStatus !== void 0) {
182041
183212
  yield* requireStatusCategoryMatch(existingStatus, params.category);
182042
183213
  }
@@ -182106,33 +183277,33 @@ var createIssueStatus = (params) => Effect_exports.gen(function* () {
182106
183277
  });
182107
183278
 
182108
183279
  // src/mcp/tools/task-management.ts
182109
- var CATEGORY25 = "task-management";
183280
+ var CATEGORY26 = "task-management";
182110
183281
  var taskManagementTools = [
182111
183282
  {
182112
183283
  name: "list_project_types",
182113
183284
  description: "List Huly tracker project types/workflow templates. Returns ID, display name, descriptor, task type count, status count, and whether the type appears to be the default Classic tracker type.",
182114
- category: CATEGORY25,
183285
+ category: CATEGORY26,
182115
183286
  inputSchema: listProjectTypesParamsJsonSchema,
182116
183287
  handler: createToolHandler("list_project_types", parseListProjectTypesParams, listProjectTypes)
182117
183288
  },
182118
183289
  {
182119
183290
  name: "get_project_type",
182120
183291
  description: "Inspect one Huly tracker project type in a single call. Accepts projectType as ID or display name; when omitted, uses the unambiguous Classic tracker type. Returns task types, statuses, categories, and task-type-to-status mappings.",
182121
- category: CATEGORY25,
183292
+ category: CATEGORY26,
182122
183293
  inputSchema: getProjectTypeParamsJsonSchema,
182123
183294
  handler: createToolHandler("get_project_type", parseGetProjectTypeParams, getProjectType)
182124
183295
  },
182125
183296
  {
182126
183297
  name: "list_task_types",
182127
183298
  description: "List Huly issue/task types. Optionally filter by projectType ID or display name. Returns task type identity, parent project type, kind, issue class, and available status count.",
182128
- category: CATEGORY25,
183299
+ category: CATEGORY26,
182129
183300
  inputSchema: listTaskTypesParamsJsonSchema,
182130
183301
  handler: createToolHandler("list_task_types", parseListTaskTypesParams, listTaskTypes)
182131
183302
  },
182132
183303
  {
182133
183304
  name: "create_task_type",
182134
183305
  description: "Add a Huly issue/task type to a project type idempotently by normalized name. Copies required workflow configuration from an existing template task type unless templateTaskType is supplied. Returns created, IDs, affected task type IDs, and a workspace-level workflow warning.",
182135
- category: CATEGORY25,
183306
+ category: CATEGORY26,
182136
183307
  inputSchema: createTaskTypeParamsJsonSchema,
182137
183308
  annotations: { idempotentHint: true },
182138
183309
  handler: createToolHandler("create_task_type", parseCreateTaskTypeParams, createTaskType)
@@ -182140,7 +183311,7 @@ var taskManagementTools = [
182140
183311
  {
182141
183312
  name: "create_issue_status",
182142
183313
  description: `Add a Huly issue workflow status idempotently by normalized name within a project type and task type scope. Accepts category as a Huly SDK task.statusCategory key: ${enumValuesDescription(StatusCategoryValues)}; taskType may be ID or display name, and omission applies the status to every task type in the project type.`,
182143
- category: CATEGORY25,
183314
+ category: CATEGORY26,
182144
183315
  inputSchema: createIssueStatusParamsJsonSchema,
182145
183316
  annotations: { idempotentHint: true },
182146
183317
  handler: createToolHandler("create_issue_status", parseCreateIssueStatusParams, createIssueStatus)
@@ -182148,7 +183319,7 @@ var taskManagementTools = [
182148
183319
  ];
182149
183320
 
182150
183321
  // src/huly/operations/test-management-core.ts
182151
- var import_core45 = __toESM(require_lib4(), 1);
183322
+ var import_core48 = __toESM(require_lib4(), 1);
182152
183323
 
182153
183324
  // src/huly/test-management-classes.ts
182154
183325
  var testManagement = {
@@ -182401,7 +183572,7 @@ var listTestProjects = (params) => Effect_exports.gen(function* () {
182401
183572
  {},
182402
183573
  {
182403
183574
  limit,
182404
- sort: { name: import_core45.SortingOrder.Ascending }
183575
+ sort: { name: import_core48.SortingOrder.Ascending }
182405
183576
  }
182406
183577
  );
182407
183578
  return {
@@ -182423,7 +183594,7 @@ var listTestSuites = (params) => Effect_exports.gen(function* () {
182423
183594
  query,
182424
183595
  {
182425
183596
  limit,
182426
- sort: { modifiedOn: import_core45.SortingOrder.Descending }
183597
+ sort: { modifiedOn: import_core48.SortingOrder.Descending }
182427
183598
  }
182428
183599
  );
182429
183600
  return {
@@ -182456,7 +183627,7 @@ var createTestSuite = (params) => Effect_exports.gen(function* () {
182456
183627
  if (existing !== void 0) {
182457
183628
  return { id: TestSuiteId.make(existing._id), name: existing.name, created: false };
182458
183629
  }
182459
- const suiteId = (0, import_core45.generateId)();
183630
+ const suiteId = (0, import_core48.generateId)();
182460
183631
  const suiteData = {
182461
183632
  name: params.name,
182462
183633
  description: params.description ?? "",
@@ -182500,7 +183671,7 @@ var listTestCases = (params) => Effect_exports.gen(function* () {
182500
183671
  query,
182501
183672
  {
182502
183673
  limit,
182503
- sort: { modifiedOn: import_core45.SortingOrder.Descending }
183674
+ sort: { modifiedOn: import_core48.SortingOrder.Descending }
182504
183675
  }
182505
183676
  );
182506
183677
  return {
@@ -182528,7 +183699,7 @@ var createTestCase = (params) => Effect_exports.gen(function* () {
182528
183699
  const client = yield* HulyClient;
182529
183700
  const project3 = yield* findTestProject(client, params.project);
182530
183701
  const suite = yield* findTestSuite(client, project3, params.suite);
182531
- const caseId = (0, import_core45.generateId)();
183702
+ const caseId = (0, import_core48.generateId)();
182532
183703
  const assigneeRef = params.assignee !== void 0 ? toRef((yield* resolveAssignee2(params.assignee))._id) : null;
182533
183704
  const typeEnum = params.type !== void 0 ? resolveCaseType(params.type) : 0 /* Functional */;
182534
183705
  const priorityEnum = params.priority !== void 0 ? resolveCasePriority(params.priority) : 1 /* Medium */;
@@ -182573,12 +183744,12 @@ var deleteTestCase = (params) => Effect_exports.gen(function* () {
182573
183744
  });
182574
183745
 
182575
183746
  // src/mcp/tools/test-management-core.ts
182576
- var CATEGORY26 = "test-management";
183747
+ var CATEGORY27 = "test-management";
182577
183748
  var testManagementCoreTools = [
182578
183749
  {
182579
183750
  name: "list_test_projects",
182580
183751
  description: "List test management projects. Returns test projects sorted by name. These are separate from tracker projects.",
182581
- category: CATEGORY26,
183752
+ category: CATEGORY27,
182582
183753
  inputSchema: listTestProjectsParamsJsonSchema,
182583
183754
  handler: createToolHandler(
182584
183755
  "list_test_projects",
@@ -182589,7 +183760,7 @@ var testManagementCoreTools = [
182589
183760
  {
182590
183761
  name: "list_test_suites",
182591
183762
  description: "List test suites in a test project. Accepts project ID or name. Optional parent filter for nested suites.",
182592
- category: CATEGORY26,
183763
+ category: CATEGORY27,
182593
183764
  inputSchema: listTestSuitesParamsJsonSchema,
182594
183765
  handler: createToolHandler(
182595
183766
  "list_test_suites",
@@ -182600,7 +183771,7 @@ var testManagementCoreTools = [
182600
183771
  {
182601
183772
  name: "get_test_suite",
182602
183773
  description: "Get a single test suite by ID or name within a test project. Returns suite details and test case count.",
182603
- category: CATEGORY26,
183774
+ category: CATEGORY27,
182604
183775
  inputSchema: getTestSuiteParamsJsonSchema,
182605
183776
  handler: createToolHandler(
182606
183777
  "get_test_suite",
@@ -182611,7 +183782,7 @@ var testManagementCoreTools = [
182611
183782
  {
182612
183783
  name: "create_test_suite",
182613
183784
  description: "Create a test suite in a test project. Idempotent: returns existing suite if one with the same name exists (created=false). Optional parent for nesting.",
182614
- category: CATEGORY26,
183785
+ category: CATEGORY27,
182615
183786
  inputSchema: createTestSuiteParamsJsonSchema,
182616
183787
  handler: createToolHandler(
182617
183788
  "create_test_suite",
@@ -182622,7 +183793,7 @@ var testManagementCoreTools = [
182622
183793
  {
182623
183794
  name: "update_test_suite",
182624
183795
  description: "Update a test suite. Accepts suite ID or name. Only provided fields are modified.",
182625
- category: CATEGORY26,
183796
+ category: CATEGORY27,
182626
183797
  inputSchema: updateTestSuiteParamsJsonSchema,
182627
183798
  handler: createToolHandler(
182628
183799
  "update_test_suite",
@@ -182633,7 +183804,7 @@ var testManagementCoreTools = [
182633
183804
  {
182634
183805
  name: "delete_test_suite",
182635
183806
  description: "Permanently delete a test suite. Accepts suite ID or name. This action cannot be undone.",
182636
- category: CATEGORY26,
183807
+ category: CATEGORY27,
182637
183808
  inputSchema: deleteTestSuiteParamsJsonSchema,
182638
183809
  handler: createToolHandler(
182639
183810
  "delete_test_suite",
@@ -182644,7 +183815,7 @@ var testManagementCoreTools = [
182644
183815
  {
182645
183816
  name: "list_test_cases",
182646
183817
  description: "List test cases in a test project. Optional filters: suite (ID or name), assignee (name or email).",
182647
- category: CATEGORY26,
183818
+ category: CATEGORY27,
182648
183819
  inputSchema: listTestCasesParamsJsonSchema,
182649
183820
  handler: createToolHandler(
182650
183821
  "list_test_cases",
@@ -182655,7 +183826,7 @@ var testManagementCoreTools = [
182655
183826
  {
182656
183827
  name: "get_test_case",
182657
183828
  description: "Get a single test case by ID or name within a test project.",
182658
- category: CATEGORY26,
183829
+ category: CATEGORY27,
182659
183830
  inputSchema: getTestCaseParamsJsonSchema,
182660
183831
  handler: createToolHandler(
182661
183832
  "get_test_case",
@@ -182666,7 +183837,7 @@ var testManagementCoreTools = [
182666
183837
  {
182667
183838
  name: "create_test_case",
182668
183839
  description: "Create a test case attached to a suite. Requires project and suite. Defaults: type=functional, priority=medium, status=draft.",
182669
- category: CATEGORY26,
183840
+ category: CATEGORY27,
182670
183841
  inputSchema: createTestCaseParamsJsonSchema,
182671
183842
  handler: createToolHandler(
182672
183843
  "create_test_case",
@@ -182677,7 +183848,7 @@ var testManagementCoreTools = [
182677
183848
  {
182678
183849
  name: "update_test_case",
182679
183850
  description: "Update a test case. Accepts test case ID or name. Only provided fields are modified. Set assignee to null to unassign.",
182680
- category: CATEGORY26,
183851
+ category: CATEGORY27,
182681
183852
  inputSchema: updateTestCaseParamsJsonSchema,
182682
183853
  handler: createToolHandler(
182683
183854
  "update_test_case",
@@ -182688,7 +183859,7 @@ var testManagementCoreTools = [
182688
183859
  {
182689
183860
  name: "delete_test_case",
182690
183861
  description: "Permanently delete a test case. Accepts test case ID or name. This action cannot be undone.",
182691
- category: CATEGORY26,
183862
+ category: CATEGORY27,
182692
183863
  inputSchema: deleteTestCaseParamsJsonSchema,
182693
183864
  handler: createToolHandler(
182694
183865
  "delete_test_case",
@@ -182699,7 +183870,7 @@ var testManagementCoreTools = [
182699
183870
  ];
182700
183871
 
182701
183872
  // src/huly/operations/test-management-plans.ts
182702
- var import_core46 = __toESM(require_lib4(), 1);
183873
+ var import_core49 = __toESM(require_lib4(), 1);
182703
183874
  var toPlanSummary = (p) => ({
182704
183875
  id: TestPlanId.make(p._id),
182705
183876
  name: p.name
@@ -182717,7 +183888,7 @@ var listTestPlans = (params) => Effect_exports.gen(function* () {
182717
183888
  const plans = yield* client.findAll(
182718
183889
  testManagement.class.TestPlan,
182719
183890
  { space: project3._id },
182720
- { limit, sort: { modifiedOn: import_core46.SortingOrder.Descending } }
183891
+ { limit, sort: { modifiedOn: import_core49.SortingOrder.Descending } }
182721
183892
  );
182722
183893
  return { plans: plans.map(toPlanSummary), total: listTotal(plans.total) };
182723
183894
  });
@@ -182752,7 +183923,7 @@ var createTestPlan = (params) => Effect_exports.gen(function* () {
182752
183923
  if (existing !== void 0) {
182753
183924
  return { id: TestPlanId.make(existing._id), name: existing.name, created: false };
182754
183925
  }
182755
- const planId = (0, import_core46.generateId)();
183926
+ const planId = (0, import_core49.generateId)();
182756
183927
  const descRef = params.description !== void 0 && params.description.trim() !== "" ? yield* client.uploadMarkup(
182757
183928
  testManagement.class.TestPlan,
182758
183929
  planId,
@@ -182837,7 +184008,7 @@ var removeTestPlanItem = (params) => Effect_exports.gen(function* () {
182837
184008
  });
182838
184009
 
182839
184010
  // src/huly/operations/test-management-runs.ts
182840
- var import_core47 = __toESM(require_lib4(), 1);
184011
+ var import_core50 = __toESM(require_lib4(), 1);
182841
184012
  var BATCH_CONCURRENCY = 10;
182842
184013
  var resolveStatusOrUntested = (status) => {
182843
184014
  const resolved = stringToTestRunStatus(status);
@@ -182863,7 +184034,7 @@ var listTestRuns = (params) => Effect_exports.gen(function* () {
182863
184034
  const runs = yield* client.findAll(
182864
184035
  testManagement.class.TestRun,
182865
184036
  { space: project3._id },
182866
- { limit, sort: { modifiedOn: import_core47.SortingOrder.Descending } }
184037
+ { limit, sort: { modifiedOn: import_core50.SortingOrder.Descending } }
182867
184038
  );
182868
184039
  return { runs: runs.map(toRunSummary), total: listTotal(runs.total) };
182869
184040
  });
@@ -182892,7 +184063,7 @@ var getTestRun = (params) => Effect_exports.gen(function* () {
182892
184063
  var createTestRun = (params) => Effect_exports.gen(function* () {
182893
184064
  const client = yield* HulyClient;
182894
184065
  const project3 = yield* findTestProject(client, params.project);
182895
- const runId = (0, import_core47.generateId)();
184066
+ const runId = (0, import_core50.generateId)();
182896
184067
  const descRef = params.description !== void 0 && params.description.trim() !== "" ? yield* client.uploadMarkup(
182897
184068
  testManagement.class.TestRun,
182898
184069
  runId,
@@ -182951,7 +184122,7 @@ var listTestResults = (params) => Effect_exports.gen(function* () {
182951
184122
  const results = yield* client.findAll(
182952
184123
  testManagement.class.TestResult,
182953
184124
  { attachedTo: run3._id },
182954
- { limit, sort: { modifiedOn: import_core47.SortingOrder.Descending } }
184125
+ { limit, sort: { modifiedOn: import_core50.SortingOrder.Descending } }
182955
184126
  );
182956
184127
  return { results: results.map(toResultSummary), total: listTotal(results.total) };
182957
184128
  });
@@ -183065,7 +184236,7 @@ var runTestPlan = (params) => Effect_exports.gen(function* () {
183065
184236
  }
183066
184237
  return { item, tc };
183067
184238
  }), { concurrency: BATCH_CONCURRENCY });
183068
- const runId = (0, import_core47.generateId)();
184239
+ const runId = (0, import_core50.generateId)();
183069
184240
  const runName = params.runName ?? `${plan.name} - Run`;
183070
184241
  yield* client.createDoc(testManagement.class.TestRun, project3._id, {
183071
184242
  name: runName,
@@ -183095,41 +184266,41 @@ var runTestPlan = (params) => Effect_exports.gen(function* () {
183095
184266
  });
183096
184267
 
183097
184268
  // src/mcp/tools/test-management-plans.ts
183098
- var CATEGORY27 = "test-management";
184269
+ var CATEGORY28 = "test-management";
183099
184270
  var testManagementPlansTools = [
183100
184271
  // --- Test Plans ---
183101
184272
  {
183102
184273
  name: "list_test_plans",
183103
184274
  description: "List test plans in a test management project. Returns plan names and IDs. Requires project ID or name.",
183104
- category: CATEGORY27,
184275
+ category: CATEGORY28,
183105
184276
  inputSchema: listTestPlansParamsJsonSchema,
183106
184277
  handler: createToolHandler("list_test_plans", parseListTestPlansParams, listTestPlans)
183107
184278
  },
183108
184279
  {
183109
184280
  name: "get_test_plan",
183110
184281
  description: "Get test plan details including its items (test cases). Accepts plan ID or name within a project.",
183111
- category: CATEGORY27,
184282
+ category: CATEGORY28,
183112
184283
  inputSchema: getTestPlanParamsJsonSchema,
183113
184284
  handler: createToolHandler("get_test_plan", parseGetTestPlanParams, getTestPlan)
183114
184285
  },
183115
184286
  {
183116
184287
  name: "create_test_plan",
183117
184288
  description: "Create a test plan in a project. Idempotent: returns existing plan if one with the same name exists (created=false).",
183118
- category: CATEGORY27,
184289
+ category: CATEGORY28,
183119
184290
  inputSchema: createTestPlanParamsJsonSchema,
183120
184291
  handler: createToolHandler("create_test_plan", parseCreateTestPlanParams, createTestPlan)
183121
184292
  },
183122
184293
  {
183123
184294
  name: "update_test_plan",
183124
184295
  description: "Update a test plan's name or description. Only provided fields are modified. Pass description=null to clear.",
183125
- category: CATEGORY27,
184296
+ category: CATEGORY28,
183126
184297
  inputSchema: updateTestPlanParamsJsonSchema,
183127
184298
  handler: createToolHandler("update_test_plan", parseUpdateTestPlanParams, updateTestPlan)
183128
184299
  },
183129
184300
  {
183130
184301
  name: "delete_test_plan",
183131
184302
  description: "Permanently delete a test plan. This does not delete associated test runs. Cannot be undone.",
183132
- category: CATEGORY27,
184303
+ category: CATEGORY28,
183133
184304
  inputSchema: deleteTestPlanParamsJsonSchema,
183134
184305
  handler: createToolHandler("delete_test_plan", parseDeleteTestPlanParams, deleteTestPlan)
183135
184306
  },
@@ -183137,14 +184308,14 @@ var testManagementPlansTools = [
183137
184308
  {
183138
184309
  name: "add_test_plan_item",
183139
184310
  description: "Add a test case to a test plan. Resolves test case by ID or name. Optionally assign a person by email or name.",
183140
- category: CATEGORY27,
184311
+ category: CATEGORY28,
183141
184312
  inputSchema: addTestPlanItemParamsJsonSchema,
183142
184313
  handler: createToolHandler("add_test_plan_item", parseAddTestPlanItemParams, addTestPlanItem)
183143
184314
  },
183144
184315
  {
183145
184316
  name: "remove_test_plan_item",
183146
184317
  description: "Remove a test case from a test plan by item ID. Get item IDs from get_test_plan.",
183147
- category: CATEGORY27,
184318
+ category: CATEGORY28,
183148
184319
  inputSchema: removeTestPlanItemParamsJsonSchema,
183149
184320
  handler: createToolHandler("remove_test_plan_item", parseRemoveTestPlanItemParams, removeTestPlanItem)
183150
184321
  },
@@ -183152,35 +184323,35 @@ var testManagementPlansTools = [
183152
184323
  {
183153
184324
  name: "list_test_runs",
183154
184325
  description: "List test runs in a test management project. Returns run names, IDs, and due dates.",
183155
- category: CATEGORY27,
184326
+ category: CATEGORY28,
183156
184327
  inputSchema: listTestRunsParamsJsonSchema,
183157
184328
  handler: createToolHandler("list_test_runs", parseListTestRunsParams, listTestRuns)
183158
184329
  },
183159
184330
  {
183160
184331
  name: "get_test_run",
183161
184332
  description: "Get test run details including all results. Accepts run ID or name within a project.",
183162
- category: CATEGORY27,
184333
+ category: CATEGORY28,
183163
184334
  inputSchema: getTestRunParamsJsonSchema,
183164
184335
  handler: createToolHandler("get_test_run", parseGetTestRunParams, getTestRun)
183165
184336
  },
183166
184337
  {
183167
184338
  name: "create_test_run",
183168
184339
  description: "Create a test run in a project. For bulk creation from a plan, use run_test_plan instead.",
183169
- category: CATEGORY27,
184340
+ category: CATEGORY28,
183170
184341
  inputSchema: createTestRunParamsJsonSchema,
183171
184342
  handler: createToolHandler("create_test_run", parseCreateTestRunParams, createTestRun)
183172
184343
  },
183173
184344
  {
183174
184345
  name: "update_test_run",
183175
184346
  description: "Update a test run's name, description, or due date. Only provided fields are modified. Pass null to clear optional fields.",
183176
- category: CATEGORY27,
184347
+ category: CATEGORY28,
183177
184348
  inputSchema: updateTestRunParamsJsonSchema,
183178
184349
  handler: createToolHandler("update_test_run", parseUpdateTestRunParams, updateTestRun)
183179
184350
  },
183180
184351
  {
183181
184352
  name: "delete_test_run",
183182
184353
  description: "Permanently delete a test run. This does not delete associated test results. Cannot be undone.",
183183
- category: CATEGORY27,
184354
+ category: CATEGORY28,
183184
184355
  inputSchema: deleteTestRunParamsJsonSchema,
183185
184356
  handler: createToolHandler("delete_test_run", parseDeleteTestRunParams, deleteTestRun)
183186
184357
  },
@@ -183188,35 +184359,35 @@ var testManagementPlansTools = [
183188
184359
  {
183189
184360
  name: "list_test_results",
183190
184361
  description: "List test results in a test run. Returns result names, statuses, and assignees.",
183191
- category: CATEGORY27,
184362
+ category: CATEGORY28,
183192
184363
  inputSchema: listTestResultsParamsJsonSchema,
183193
184364
  handler: createToolHandler("list_test_results", parseListTestResultsParams, listTestResults)
183194
184365
  },
183195
184366
  {
183196
184367
  name: "get_test_result",
183197
184368
  description: "Get test result details. Accepts result ID or name.",
183198
- category: CATEGORY27,
184369
+ category: CATEGORY28,
183199
184370
  inputSchema: getTestResultParamsJsonSchema,
183200
184371
  handler: createToolHandler("get_test_result", parseGetTestResultParams, getTestResult)
183201
184372
  },
183202
184373
  {
183203
184374
  name: "create_test_result",
183204
184375
  description: "Create a test result in a run. Resolves test case by ID or name. Status defaults to 'untested'.",
183205
- category: CATEGORY27,
184376
+ category: CATEGORY28,
183206
184377
  inputSchema: createTestResultParamsJsonSchema,
183207
184378
  handler: createToolHandler("create_test_result", parseCreateTestResultParams, createTestResult)
183208
184379
  },
183209
184380
  {
183210
184381
  name: "update_test_result",
183211
184382
  description: "Update a test result's status, assignee, or description. Status values: untested, blocked, passed, failed.",
183212
- category: CATEGORY27,
184383
+ category: CATEGORY28,
183213
184384
  inputSchema: updateTestResultParamsJsonSchema,
183214
184385
  handler: createToolHandler("update_test_result", parseUpdateTestResultParams, updateTestResult)
183215
184386
  },
183216
184387
  {
183217
184388
  name: "delete_test_result",
183218
184389
  description: "Permanently delete a test result. Cannot be undone.",
183219
- category: CATEGORY27,
184390
+ category: CATEGORY28,
183220
184391
  inputSchema: deleteTestResultParamsJsonSchema,
183221
184392
  handler: createToolHandler("delete_test_result", parseDeleteTestResultParams, deleteTestResult)
183222
184393
  },
@@ -183224,7 +184395,7 @@ var testManagementPlansTools = [
183224
184395
  {
183225
184396
  name: "run_test_plan",
183226
184397
  description: "Execute a test plan: creates a test run and one test result per plan item. Returns the run ID and count of results created. Optionally name the run and set a due date.",
183227
- category: CATEGORY27,
184398
+ category: CATEGORY28,
183228
184399
  inputSchema: runTestPlanParamsJsonSchema,
183229
184400
  annotations: {
183230
184401
  title: "Run Test Plan",
@@ -183237,286 +184408,13 @@ var testManagementPlansTools = [
183237
184408
  }
183238
184409
  ];
183239
184410
 
183240
- // src/huly/operations/time.ts
183241
- var import_calendar8 = __toESM(require_lib25(), 1);
183242
- var import_core48 = __toESM(require_lib4(), 1);
183243
- var import_tracker7 = __toESM(require_lib36(), 1);
183244
- var serverPopulatedCalendar = toRef("");
183245
- var serverPopulatedPersonId = "";
183246
- var refAsPersonId = (ref) => ref;
183247
- var logTime = (params) => Effect_exports.gen(function* () {
183248
- const { client, issue: issue2, project: project3 } = yield* findProjectAndIssue({
183249
- project: params.project,
183250
- identifier: params.identifier
183251
- });
183252
- const reportId = (0, import_core48.generateId)();
183253
- const now2 = yield* Clock_exports.currentTimeMillis;
183254
- const reportData = {
183255
- employee: null,
183256
- date: now2,
183257
- value: params.value,
183258
- description: params.description ?? ""
183259
- };
183260
- yield* client.addCollection(
183261
- tracker.class.TimeSpendReport,
183262
- project3._id,
183263
- issue2._id,
183264
- tracker.class.Issue,
183265
- "reports",
183266
- reportData,
183267
- reportId
183268
- );
183269
- const updateOps = {
183270
- $inc: { reportedTime: params.value, reports: 1 }
183271
- };
183272
- if (issue2.remainingTime > 0) {
183273
- const newRemaining = Math.max(0, issue2.remainingTime - params.value);
183274
- updateOps.remainingTime = newRemaining;
183275
- }
183276
- yield* client.updateDoc(
183277
- tracker.class.Issue,
183278
- project3._id,
183279
- issue2._id,
183280
- updateOps
183281
- );
183282
- return { reportId: TimeSpendReportId.make(reportId), identifier: IssueIdentifier.make(issue2.identifier) };
183283
- });
183284
- var getTimeReport = (params) => Effect_exports.gen(function* () {
183285
- const { client, issue: issue2 } = yield* findProjectAndIssue({
183286
- project: params.project,
183287
- identifier: params.identifier
183288
- });
183289
- const reports = yield* client.findAll(
183290
- tracker.class.TimeSpendReport,
183291
- { attachedTo: issue2._id },
183292
- { sort: { date: import_core48.SortingOrder.Descending } }
183293
- );
183294
- const employeeIds = [
183295
- ...new Set(
183296
- reports.map((r) => r.employee).filter(isExistent)
183297
- )
183298
- ];
183299
- const persons = employeeIds.length > 0 ? yield* client.findAll(
183300
- contact.class.Person,
183301
- { _id: { $in: employeeIds } }
183302
- ) : [];
183303
- const personMap = new Map(persons.map((p) => [p._id, p.name]));
183304
- const timeReports = reports.map((r) => ({
183305
- id: TimeSpendReportId.make(r._id),
183306
- identifier: IssueIdentifier.make(issue2.identifier),
183307
- employee: r.employee && personMap.has(r.employee) ? PersonName.make(personMap.get(r.employee)) : void 0,
183308
- date: r.date,
183309
- value: r.value,
183310
- description: r.description
183311
- }));
183312
- return {
183313
- identifier: IssueIdentifier.make(issue2.identifier),
183314
- totalTime: issue2.reportedTime,
183315
- estimation: zeroAsUnset(NonNegativeNumber.make(issue2.estimation)),
183316
- remainingTime: zeroAsUnset(NonNegativeNumber.make(issue2.remainingTime)),
183317
- reports: timeReports
183318
- };
183319
- });
183320
- var listTimeSpendReports = (params) => Effect_exports.gen(function* () {
183321
- const client = yield* HulyClient;
183322
- const query = {};
183323
- if (params.project !== void 0) {
183324
- const project3 = yield* client.findOne(
183325
- tracker.class.Project,
183326
- { identifier: params.project }
183327
- );
183328
- if (project3 === void 0) {
183329
- return yield* new ProjectNotFoundError({ identifier: params.project });
183330
- }
183331
- query.space = project3._id;
183332
- }
183333
- if (params.from !== void 0 || params.to !== void 0) {
183334
- const dateFilter = {};
183335
- if (params.from !== void 0) dateFilter.$gte = params.from;
183336
- if (params.to !== void 0) dateFilter.$lte = params.to;
183337
- query.date = dateFilter;
183338
- }
183339
- const limit = clampLimit(params.limit);
183340
- const reports = yield* client.findAll(
183341
- tracker.class.TimeSpendReport,
183342
- query,
183343
- withLookup(
183344
- { limit, sort: { date: import_core48.SortingOrder.Descending } },
183345
- {
183346
- attachedTo: tracker.class.Issue,
183347
- employee: contact.class.Person
183348
- }
183349
- )
183350
- );
183351
- return reports.map((r) => ({
183352
- id: TimeSpendReportId.make(r._id),
183353
- identifier: r.$lookup?.attachedTo?.identifier !== void 0 ? IssueIdentifier.make(r.$lookup.attachedTo.identifier) : void 0,
183354
- employee: r.$lookup?.employee?.name !== void 0 ? PersonName.make(r.$lookup.employee.name) : void 0,
183355
- date: r.date,
183356
- value: r.value,
183357
- description: r.description
183358
- }));
183359
- });
183360
- var getDetailedTimeReport = (params) => Effect_exports.gen(function* () {
183361
- const { client, project: project3 } = yield* findProject(params.project);
183362
- const query = { space: project3._id };
183363
- if (params.from !== void 0 || params.to !== void 0) {
183364
- const dateFilter = {};
183365
- if (params.from !== void 0) dateFilter.$gte = params.from;
183366
- if (params.to !== void 0) dateFilter.$lte = params.to;
183367
- query.date = dateFilter;
183368
- }
183369
- const reports = yield* client.findAll(
183370
- tracker.class.TimeSpendReport,
183371
- query,
183372
- withLookup(
183373
- { sort: { date: import_core48.SortingOrder.Descending } },
183374
- {
183375
- attachedTo: tracker.class.Issue,
183376
- employee: contact.class.Person
183377
- }
183378
- )
183379
- );
183380
- const byIssueMap = /* @__PURE__ */ new Map();
183381
- const byEmployeeMap = /* @__PURE__ */ new Map();
183382
- let totalTime = 0;
183383
- for (const r of reports) {
183384
- totalTime += r.value;
183385
- const issueKey = r.attachedTo;
183386
- const issue2 = r.$lookup?.attachedTo;
183387
- const existing = byIssueMap.get(issueKey) ?? {
183388
- identifier: issue2?.identifier !== void 0 ? IssueIdentifier.make(issue2.identifier) : void 0,
183389
- issueTitle: issue2?.title ?? "Unknown",
183390
- totalTime: 0,
183391
- reports: []
183392
- };
183393
- existing.totalTime += r.value;
183394
- existing.reports.push({
183395
- id: TimeSpendReportId.make(r._id),
183396
- identifier: issue2?.identifier !== void 0 ? IssueIdentifier.make(issue2.identifier) : void 0,
183397
- employee: r.$lookup?.employee?.name !== void 0 ? PersonName.make(r.$lookup.employee.name) : void 0,
183398
- date: r.date,
183399
- value: r.value,
183400
- description: r.description
183401
- });
183402
- byIssueMap.set(issueKey, existing);
183403
- const empKey = r.employee ? r.employee : "__unassigned__";
183404
- const empExisting = byEmployeeMap.get(empKey) ?? {
183405
- employeeName: r.$lookup?.employee?.name !== void 0 ? PersonName.make(r.$lookup.employee.name) : void 0,
183406
- totalTime: 0
183407
- };
183408
- empExisting.totalTime += r.value;
183409
- byEmployeeMap.set(empKey, empExisting);
183410
- }
183411
- const byIssue = Array.from(byIssueMap.values());
183412
- const byEmployee = Array.from(byEmployeeMap.values());
183413
- return {
183414
- project: params.project,
183415
- totalTime,
183416
- byIssue,
183417
- byEmployee
183418
- };
183419
- });
183420
- var listWorkSlots = (params) => Effect_exports.gen(function* () {
183421
- const client = yield* HulyClient;
183422
- const query = {};
183423
- if (params.employeeId !== void 0) {
183424
- const person = yield* client.findOne(
183425
- contact.class.Person,
183426
- { _id: toRef(params.employeeId) }
183427
- );
183428
- if (person === void 0) {
183429
- const channels = yield* client.findAll(
183430
- contact.class.Channel,
183431
- { value: params.employeeId }
183432
- );
183433
- if (channels.length > 0) {
183434
- const channel = channels[0];
183435
- query.user = refAsPersonId(channel.attachedTo);
183436
- }
183437
- } else {
183438
- query.user = refAsPersonId(person._id);
183439
- }
183440
- }
183441
- if (params.from !== void 0 || params.to !== void 0) {
183442
- const dateFilter = {};
183443
- if (params.from !== void 0) dateFilter.$gte = params.from;
183444
- if (params.to !== void 0) dateFilter.$lte = params.to;
183445
- query.date = dateFilter;
183446
- }
183447
- const limit = clampLimit(params.limit);
183448
- const slots = yield* client.findAll(
183449
- time3.class.WorkSlot,
183450
- query,
183451
- { limit, sort: { date: import_core48.SortingOrder.Descending } }
183452
- );
183453
- return slots.map((s) => ({
183454
- id: WorkSlotId.make(s._id),
183455
- todoId: TodoId.make(s.attachedTo),
183456
- date: Timestamp.make(s.date),
183457
- dueDate: Timestamp.make(s.dueDate),
183458
- title: s.title
183459
- }));
183460
- });
183461
- var createWorkSlot = (params) => Effect_exports.gen(function* () {
183462
- const client = yield* HulyClient;
183463
- const slotId = (0, import_core48.generateId)();
183464
- const slotData = {
183465
- date: params.date,
183466
- dueDate: params.dueDate,
183467
- title: "",
183468
- description: "",
183469
- allDay: false,
183470
- participants: [],
183471
- access: import_calendar8.AccessLevel.Owner,
183472
- reminders: [],
183473
- visibility: "public",
183474
- eventId: "",
183475
- calendar: serverPopulatedCalendar,
183476
- user: serverPopulatedPersonId,
183477
- blockTime: false
183478
- };
183479
- yield* client.addCollection(
183480
- time3.class.WorkSlot,
183481
- time3.space.ToDos,
183482
- toRef(params.todoId),
183483
- time3.class.ToDo,
183484
- "workslots",
183485
- slotData,
183486
- slotId
183487
- );
183488
- return { slotId: WorkSlotId.make(slotId) };
183489
- });
183490
- var startTimer = (params) => Effect_exports.gen(function* () {
183491
- const { issue: issue2 } = yield* findProjectAndIssue({
183492
- project: params.project,
183493
- identifier: params.identifier
183494
- });
183495
- const startedAt = yield* Clock_exports.currentTimeMillis;
183496
- return {
183497
- identifier: IssueIdentifier.make(issue2.identifier),
183498
- startedAt: Timestamp.make(startedAt)
183499
- };
183500
- });
183501
- var stopTimer = (params) => Effect_exports.gen(function* () {
183502
- const { issue: issue2 } = yield* findProjectAndIssue({
183503
- project: params.project,
183504
- identifier: params.identifier
183505
- });
183506
- const stoppedAt = yield* Clock_exports.currentTimeMillis;
183507
- return {
183508
- identifier: IssueIdentifier.make(issue2.identifier),
183509
- stoppedAt: Timestamp.make(stoppedAt)
183510
- };
183511
- });
183512
-
183513
184411
  // src/mcp/tools/time.ts
183514
- var CATEGORY28 = "time tracking";
184412
+ var CATEGORY29 = "time tracking";
183515
184413
  var timeTools = [
183516
184414
  {
183517
184415
  name: "log_time",
183518
184416
  description: "Log time spent on a Huly issue. Records a time entry with optional description. Time value is in minutes.",
183519
- category: CATEGORY28,
184417
+ category: CATEGORY29,
183520
184418
  inputSchema: logTimeParamsJsonSchema,
183521
184419
  handler: createEncodedToolHandler(
183522
184420
  "log_time",
@@ -183528,7 +184426,7 @@ var timeTools = [
183528
184426
  {
183529
184427
  name: "get_time_report",
183530
184428
  description: "Get time tracking report for a specific Huly issue. Shows total time, estimation, remaining time, and all time entries.",
183531
- category: CATEGORY28,
184429
+ category: CATEGORY29,
183532
184430
  inputSchema: getTimeReportParamsJsonSchema,
183533
184431
  handler: createEncodedToolHandler(
183534
184432
  "get_time_report",
@@ -183540,7 +184438,7 @@ var timeTools = [
183540
184438
  {
183541
184439
  name: "list_time_spend_reports",
183542
184440
  description: "List all time entries across issues. Supports filtering by project and date range. Returns entries sorted by date (newest first).",
183543
- category: CATEGORY28,
184441
+ category: CATEGORY29,
183544
184442
  inputSchema: listTimeSpendReportsParamsJsonSchema,
183545
184443
  handler: createEncodedToolHandler(
183546
184444
  "list_time_spend_reports",
@@ -183552,7 +184450,7 @@ var timeTools = [
183552
184450
  {
183553
184451
  name: "get_detailed_time_report",
183554
184452
  description: "Get detailed time breakdown for a project. Shows total time grouped by issue and by employee. Supports date range filtering.",
183555
- category: CATEGORY28,
184453
+ category: CATEGORY29,
183556
184454
  inputSchema: getDetailedTimeReportParamsJsonSchema,
183557
184455
  handler: createEncodedToolHandler(
183558
184456
  "get_detailed_time_report",
@@ -183563,8 +184461,8 @@ var timeTools = [
183563
184461
  },
183564
184462
  {
183565
184463
  name: "list_work_slots",
183566
- description: "List scheduled work slots. Shows planned time blocks attached to ToDos. Supports filtering by employee and date range.",
183567
- category: CATEGORY28,
184464
+ description: "List scheduled work slots created by schedule_todo, Huly UI, or other clients. Shows planned time blocks attached to ToDos. Supports filtering by employee and date range.",
184465
+ category: CATEGORY29,
183568
184466
  inputSchema: listWorkSlotsParamsJsonSchema,
183569
184467
  handler: createEncodedToolHandler(
183570
184468
  "list_work_slots",
@@ -183573,22 +184471,10 @@ var timeTools = [
183573
184471
  ListWorkSlotsResultSchema
183574
184472
  )
183575
184473
  },
183576
- {
183577
- name: "create_work_slot",
183578
- description: "Create a scheduled work slot. Attaches a time block to a ToDo for planning purposes.",
183579
- category: CATEGORY28,
183580
- inputSchema: createWorkSlotParamsJsonSchema,
183581
- handler: createEncodedToolHandler(
183582
- "create_work_slot",
183583
- parseCreateWorkSlotParams,
183584
- createWorkSlot,
183585
- CreateWorkSlotResultSchema
183586
- )
183587
- },
183588
184474
  {
183589
184475
  name: "start_timer",
183590
184476
  description: "Start a client-side timer on a Huly issue. Validates the issue exists and returns a start timestamp. Use log_time to record the elapsed time when done.",
183591
- category: CATEGORY28,
184477
+ category: CATEGORY29,
183592
184478
  inputSchema: startTimerParamsJsonSchema,
183593
184479
  handler: createEncodedToolHandler(
183594
184480
  "start_timer",
@@ -183600,7 +184486,7 @@ var timeTools = [
183600
184486
  {
183601
184487
  name: "stop_timer",
183602
184488
  description: "Stop a client-side timer on a Huly issue. Returns the stop timestamp. Calculate elapsed time from start/stop timestamps and use log_time to record it.",
183603
- category: CATEGORY28,
184489
+ category: CATEGORY29,
183604
184490
  inputSchema: stopTimerParamsJsonSchema,
183605
184491
  handler: createEncodedToolHandler(
183606
184492
  "stop_timer",
@@ -183612,7 +184498,7 @@ var timeTools = [
183612
184498
  ];
183613
184499
 
183614
184500
  // src/huly/operations/user-statuses.ts
183615
- var import_core49 = __toESM(require_lib4(), 1);
184501
+ var import_core51 = __toESM(require_lib4(), 1);
183616
184502
  var userStatusSummary = (status) => ({
183617
184503
  id: UserStatusId.make(status._id),
183618
184504
  user: UserStatusAccountUuid.make(status.user),
@@ -183629,7 +184515,7 @@ var listUserStatuses = (params) => Effect_exports.gen(function* () {
183629
184515
  hulyQuery(query),
183630
184516
  {
183631
184517
  limit: clampLimit(params.limit),
183632
- sort: { modifiedOn: import_core49.SortingOrder.Descending }
184518
+ sort: { modifiedOn: import_core51.SortingOrder.Descending }
183633
184519
  }
183634
184520
  );
183635
184521
  return ListUserStatusesResultSchema.make({
@@ -183639,12 +184525,12 @@ var listUserStatuses = (params) => Effect_exports.gen(function* () {
183639
184525
  });
183640
184526
 
183641
184527
  // src/mcp/tools/user-statuses.ts
183642
- var CATEGORY29 = "user-statuses";
184528
+ var CATEGORY30 = "user-statuses";
183643
184529
  var userStatusTools = [
183644
184530
  {
183645
184531
  name: "list_user_statuses",
183646
184532
  description: "List Huly user presence records. Returns account UUIDs, online status, and last modified timestamp. Use this to check who is currently connected; presence is maintained by Huly server sessions. Filter by online or account UUID.",
183647
- category: CATEGORY29,
184533
+ category: CATEGORY30,
183648
184534
  inputSchema: listUserStatusesParamsJsonSchema,
183649
184535
  handler: createEncodedToolHandler(
183650
184536
  "list_user_statuses",
@@ -183656,15 +184542,15 @@ var userStatusTools = [
183656
184542
  ];
183657
184543
 
183658
184544
  // src/huly/operations/workspace.ts
183659
- var import_core50 = __toESM(require_lib4(), 1);
184545
+ var import_core52 = __toESM(require_lib4(), 1);
183660
184546
  var accountRoleMap = {
183661
- READONLYGUEST: import_core50.AccountRole.ReadOnlyGuest,
183662
- DocGuest: import_core50.AccountRole.DocGuest,
183663
- GUEST: import_core50.AccountRole.Guest,
183664
- USER: import_core50.AccountRole.User,
183665
- MAINTAINER: import_core50.AccountRole.Maintainer,
183666
- OWNER: import_core50.AccountRole.Owner,
183667
- ADMIN: import_core50.AccountRole.Admin
184547
+ READONLYGUEST: import_core52.AccountRole.ReadOnlyGuest,
184548
+ DocGuest: import_core52.AccountRole.DocGuest,
184549
+ GUEST: import_core52.AccountRole.Guest,
184550
+ USER: import_core52.AccountRole.User,
184551
+ MAINTAINER: import_core52.AccountRole.Maintainer,
184552
+ OWNER: import_core52.AccountRole.Owner,
184553
+ ADMIN: import_core52.AccountRole.Admin
183668
184554
  };
183669
184555
  var exactAccountRoleMapping = (value3) => value3;
183670
184556
  exactAccountRoleMapping(true);
@@ -183827,12 +184713,12 @@ var getRegions = () => Effect_exports.gen(function* () {
183827
184713
  });
183828
184714
 
183829
184715
  // src/mcp/tools/workspace.ts
183830
- var CATEGORY30 = "workspace";
184716
+ var CATEGORY31 = "workspace";
183831
184717
  var workspaceTools = [
183832
184718
  {
183833
184719
  name: "list_workspace_members",
183834
184720
  description: "List members in the current Huly workspace with their roles. Returns members with account IDs and roles.",
183835
- category: CATEGORY30,
184721
+ category: CATEGORY31,
183836
184722
  inputSchema: listWorkspaceMembersParamsJsonSchema,
183837
184723
  handler: createEncodedWorkspaceToolHandler(
183838
184724
  "list_workspace_members",
@@ -183844,7 +184730,7 @@ var workspaceTools = [
183844
184730
  {
183845
184731
  name: "update_member_role",
183846
184732
  description: "Update a workspace member's role. Requires appropriate permissions. Valid roles: READONLYGUEST, DocGuest, GUEST, USER, MAINTAINER, OWNER, ADMIN.",
183847
- category: CATEGORY30,
184733
+ category: CATEGORY31,
183848
184734
  inputSchema: updateMemberRoleParamsJsonSchema,
183849
184735
  handler: createEncodedWorkspaceToolHandler(
183850
184736
  "update_member_role",
@@ -183856,7 +184742,7 @@ var workspaceTools = [
183856
184742
  {
183857
184743
  name: "get_workspace_info",
183858
184744
  description: "Get information about the current workspace including name, URL, region, and settings.",
183859
- category: CATEGORY30,
184745
+ category: CATEGORY31,
183860
184746
  inputSchema: emptyParamsJsonSchema,
183861
184747
  handler: createEncodedNoParamsWorkspaceToolHandler(
183862
184748
  "get_workspace_info",
@@ -183867,7 +184753,7 @@ var workspaceTools = [
183867
184753
  {
183868
184754
  name: "list_workspaces",
183869
184755
  description: "List all workspaces accessible to the current user. Returns workspace summaries sorted by last visit.",
183870
- category: CATEGORY30,
184756
+ category: CATEGORY31,
183871
184757
  inputSchema: listWorkspacesParamsJsonSchema,
183872
184758
  handler: createEncodedWorkspaceToolHandler(
183873
184759
  "list_workspaces",
@@ -183879,7 +184765,7 @@ var workspaceTools = [
183879
184765
  {
183880
184766
  name: "create_workspace",
183881
184767
  description: "Create a new Huly workspace. Returns the workspace UUID and URL. Optionally specify a region.",
183882
- category: CATEGORY30,
184768
+ category: CATEGORY31,
183883
184769
  inputSchema: createWorkspaceParamsJsonSchema,
183884
184770
  handler: createEncodedWorkspaceToolHandler(
183885
184771
  "create_workspace",
@@ -183891,7 +184777,7 @@ var workspaceTools = [
183891
184777
  {
183892
184778
  name: "delete_workspace",
183893
184779
  description: "Permanently delete the current workspace. This action cannot be undone. Use with extreme caution.",
183894
- category: CATEGORY30,
184780
+ category: CATEGORY31,
183895
184781
  inputSchema: emptyParamsJsonSchema,
183896
184782
  handler: createEncodedNoParamsWorkspaceToolHandler(
183897
184783
  "delete_workspace",
@@ -183902,7 +184788,7 @@ var workspaceTools = [
183902
184788
  {
183903
184789
  name: "get_user_profile",
183904
184790
  description: "Get the current user's profile information including bio, location, and social links.",
183905
- category: CATEGORY30,
184791
+ category: CATEGORY31,
183906
184792
  inputSchema: emptyParamsJsonSchema,
183907
184793
  handler: createEncodedNoParamsWorkspaceToolHandler(
183908
184794
  "get_user_profile",
@@ -183913,7 +184799,7 @@ var workspaceTools = [
183913
184799
  {
183914
184800
  name: "update_user_profile",
183915
184801
  description: "Update the current user's profile. Supports bio, city, country, website, social links, and public visibility.",
183916
- category: CATEGORY30,
184802
+ category: CATEGORY31,
183917
184803
  inputSchema: updateUserProfileParamsJsonSchema,
183918
184804
  handler: createEncodedWorkspaceToolHandler(
183919
184805
  "update_user_profile",
@@ -183925,7 +184811,7 @@ var workspaceTools = [
183925
184811
  {
183926
184812
  name: "update_guest_settings",
183927
184813
  description: "Update workspace guest settings. Control read-only guest access and guest sign-up permissions.",
183928
- category: CATEGORY30,
184814
+ category: CATEGORY31,
183929
184815
  inputSchema: updateGuestSettingsParamsJsonSchema,
183930
184816
  handler: createEncodedWorkspaceToolHandler(
183931
184817
  "update_guest_settings",
@@ -183937,7 +184823,7 @@ var workspaceTools = [
183937
184823
  {
183938
184824
  name: "create_access_link",
183939
184825
  description: "Create a Huly workspace access link. Defaults to role GUEST. Supports anonymous reusable guest links by setting personalized=false with notBefore and expiration, and can restrict access to specific Huly space IDs via spaces.",
183940
- category: CATEGORY30,
184826
+ category: CATEGORY31,
183941
184827
  inputSchema: createAccessLinkParamsJsonSchema,
183942
184828
  handler: createEncodedWorkspaceToolHandler(
183943
184829
  "create_access_link",
@@ -183949,7 +184835,7 @@ var workspaceTools = [
183949
184835
  {
183950
184836
  name: "get_regions",
183951
184837
  description: "Get available regions for workspace creation. Returns region codes and display names.",
183952
- category: CATEGORY30,
184838
+ category: CATEGORY31,
183953
184839
  inputSchema: getRegionsParamsJsonSchema,
183954
184840
  handler: createEncodedWorkspaceToolHandler(
183955
184841
  "get_regions",
@@ -183983,6 +184869,7 @@ var allTools = [
183983
184869
  ...customFieldTools,
183984
184870
  ...calendarTools,
183985
184871
  ...timeTools,
184872
+ ...plannerTools,
183986
184873
  ...searchTools,
183987
184874
  ...activityTools,
183988
184875
  ...notificationTools,