openmates 0.14.8-alpha.12 → 0.14.8-alpha.13

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.
@@ -1990,6 +1990,9 @@ function extractMentionTokens(message) {
1990
1990
  function isFilePath(token) {
1991
1991
  return token.startsWith("/") || token.startsWith("./") || token.startsWith("~/") || token.startsWith("../");
1992
1992
  }
1993
+ function isTaskShortIdMention(token) {
1994
+ return /^TASK-[A-Za-z0-9_-]+[.,;:!?)]?$/.test(token);
1995
+ }
1993
1996
  function normalize(name) {
1994
1997
  return name.toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9._-]/g, "");
1995
1998
  }
@@ -2169,6 +2172,9 @@ function parseMentions(message, context) {
2169
2172
  filePaths.push(token);
2170
2173
  continue;
2171
2174
  }
2175
+ if (isTaskShortIdMention(token)) {
2176
+ continue;
2177
+ }
2172
2178
  const resolved_ = resolveToken(token, context);
2173
2179
  if (resolved_) {
2174
2180
  resolved.push(resolved_);
@@ -5422,6 +5428,22 @@ var OpenMatesClient = class _OpenMatesClient {
5422
5428
  }
5423
5429
  return targetChatKey;
5424
5430
  };
5431
+ const findTaskForUpdateJob = async (claim) => {
5432
+ const chatIds = [claim.source_task_chat_id, claim.chat_id, claim.safe_metadata?.primary_chat_id].filter((value) => typeof value === "string" && value.length > 0);
5433
+ const uniqueChatIds = [...new Set(chatIds)];
5434
+ for (const candidateChatId of uniqueChatIds) {
5435
+ const scopedTasks = await decryptUserTasks(await this.listUserTasks({ chatId: candidateChatId }), masterKey);
5436
+ try {
5437
+ return findTask(scopedTasks, claim.task_id);
5438
+ } catch (error) {
5439
+ if (!(error instanceof Error) || !error.message.includes("was not found")) throw error;
5440
+ }
5441
+ }
5442
+ if (!decryptedTasksCache) {
5443
+ decryptedTasksCache = await decryptUserTasks(await this.listUserTasks({ limit: 1e3 }), masterKey);
5444
+ }
5445
+ return findTask(decryptedTasksCache, claim.task_id);
5446
+ };
5425
5447
  const taskEventTypeForOperation = (operation) => {
5426
5448
  switch (operation) {
5427
5449
  case "create":
@@ -5508,10 +5530,7 @@ var OpenMatesClient = class _OpenMatesClient {
5508
5530
  updated_at: typeof safeMetadata.updated_at === "number" ? safeMetadata.updated_at : input.updated_at
5509
5531
  };
5510
5532
  } else {
5511
- if (!decryptedTasksCache) {
5512
- decryptedTasksCache = await decryptUserTasks(await this.listUserTasks(), masterKey);
5513
- }
5514
- const task = findTask(decryptedTasksCache, claim.task_id);
5533
+ const task = await findTaskForUpdateJob(claim);
5515
5534
  const patch = await buildUpdateUserTaskInput(task, masterKey, {
5516
5535
  title: typeof privatePatch.title === "string" ? privatePatch.title : void 0,
5517
5536
  description: typeof privatePatch.description === "string" ? privatePatch.description : void 0,
@@ -6678,6 +6697,8 @@ var OpenMatesClient = class _OpenMatesClient {
6678
6697
  if (filters.status) params.set("status", filters.status);
6679
6698
  if (filters.chatId) params.set("chat_id", filters.chatId);
6680
6699
  if (filters.projectId) params.set("project_id", filters.projectId);
6700
+ const limit = filters.limit;
6701
+ if (Number.isSafeInteger(limit) && limit !== void 0 && limit > 0) params.set("limit", String(limit));
6681
6702
  const query = params.toString();
6682
6703
  const response = await this.http.get(
6683
6704
  `/v1/user-tasks${query ? `?${query}` : ""}`,
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  getExtForLang,
4
4
  serializeToYaml
5
- } from "./chunk-6URDLYLM.js";
5
+ } from "./chunk-NKBCM5X2.js";
6
6
  import "./chunk-AXNRPVLE.js";
7
7
  export {
8
8
  getExtForLang,
package/dist/index.d.ts CHANGED
@@ -1366,6 +1366,7 @@ declare class OpenMatesClient {
1366
1366
  status?: UserTaskStatus;
1367
1367
  chatId?: string;
1368
1368
  projectId?: string;
1369
+ limit?: number;
1369
1370
  }): Promise<UserTaskRecord[]>;
1370
1371
  createUserTask(input: UserTaskCreateInput): Promise<UserTaskRecord>;
1371
1372
  extractUserTaskProposals(input: {
package/dist/index.js CHANGED
@@ -29,7 +29,7 @@ import {
29
29
  renderSupportInfo,
30
30
  serializeToYaml,
31
31
  unwrapApiKeyMasterKey
32
- } from "./chunk-6URDLYLM.js";
32
+ } from "./chunk-NKBCM5X2.js";
33
33
  import "./chunk-AXNRPVLE.js";
34
34
 
35
35
  // src/generated/appSkills.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openmates",
3
- "version": "0.14.8-alpha.12",
3
+ "version": "0.14.8-alpha.13",
4
4
  "description": "OpenMates CLI and SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",