ai-dev-requirements 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
20
20
  value: mod,
21
21
  enumerable: true
22
22
  }) : target, mod));
@@ -211,7 +211,7 @@ function loadConfig(startDir) {
211
211
  }
212
212
  //#endregion
213
213
  //#region package.json
214
- var version = "0.5.0";
214
+ var version = "0.5.1";
215
215
  //#endregion
216
216
  //#region ../../src/utils/ones-issue-kind.ts
217
217
  /**
@@ -848,7 +848,8 @@ function removeControlCharacters(value) {
848
848
  return output;
849
849
  }
850
850
  function sanitizeExternalText(value) {
851
- return removeControlCharacters(removeUrlCredentials((0, entities.decodeHTML)(value.slice(0, MAX_EXTERNAL_TEXT_CHARS).replace(/<(?:script|style|iframe|object|embed)\b[^>]*>[\s\S]*?<\/(?:script|style|iframe|object|embed)>/gi, "").replace(/<img\b[^>]*>/gi, "[Image omitted]").replace(/<br\s*\/?>/gi, "\n").replace(/<\/p\s*>/gi, "\n").replace(/<\/(?:td|th)\s*>/gi, " | ").replace(/<\/tr\s*>/gi, "\n").replace(/<[^>]+>/g, "")))).replace(/[ \t]+\n/g, "\n").replace(/\n[ \t]+/g, "\n").replace(/\n{3,}/g, "\n\n").trim();
851
+ const withoutActiveContent = value.slice(0, MAX_EXTERNAL_TEXT_CHARS).replace(/<(?:script|style|iframe|object|embed)\b[^>]*>[\s\S]*?<\/(?:script|style|iframe|object|embed)>/gi, "").replace(/<img\b[^>]*>/gi, "[Image omitted]").replace(/<br\s*\/?>/gi, "\n").replace(/<\/p\s*>/gi, "\n").replace(/<\/(?:td|th)\s*>/gi, " | ").replace(/<\/tr\s*>/gi, "\n").replace(/<[^>]+>/g, "");
852
+ return removeControlCharacters(removeUrlCredentials((0, entities.decodeHTML)(withoutActiveContent))).replace(/[ \t]+\n/g, "\n").replace(/\n[ \t]+/g, "\n").replace(/\n{3,}/g, "\n\n").trim();
852
853
  }
853
854
  function sanitizeExternalInline(value) {
854
855
  return sanitizeExternalText(value).replace(/\s+/g, " ").slice(0, MAX_EXTERNAL_INLINE_CHARS);
@@ -1529,6 +1530,10 @@ var WikiPathResolutionError = class extends Error {
1529
1530
  };
1530
1531
  //#endregion
1531
1532
  //#region ../../src/adapters/ones/wiki-reader.ts
1533
+ function isWikiAttachmentPath(source) {
1534
+ if (/^[a-z][a-z\d+.-]*:/i.test(source)) return false;
1535
+ return source.split("/").every((part) => Boolean(part) && part !== "." && part !== ".." && !part.includes("\\"));
1536
+ }
1532
1537
  const CURRENT_USER_PATH_ALIASES = {
1533
1538
  "i": true,
1534
1539
  "me": true,
@@ -1691,9 +1696,8 @@ var OnesWikiReader = class {
1691
1696
  }
1692
1697
  buildImageUrl(session, refUuid, source, token, teamUuid) {
1693
1698
  const encodedRefUuid = encodeIdentifier$1(refUuid, "wiki reference UUID");
1694
- const sourceParts = source.split("/");
1695
- if (sourceParts.some((part) => !part || part === "." || part === ".." || part.includes("\\"))) throw new Error("ONES: Invalid wiki attachment path");
1696
- const encodedSource = sourceParts.map((part) => encodeURIComponent(part)).join("/");
1699
+ if (!isWikiAttachmentPath(source)) throw new Error("ONES: Invalid wiki attachment path");
1700
+ const encodedSource = source.split("/").map((part) => encodeURIComponent(part)).join("/");
1697
1701
  const encodedTeamUuid = encodeIdentifier$1(teamUuid ?? session.teamUuid, "team UUID");
1698
1702
  return `${this.options.apiBase}/wiki/api/wiki/editor/${encodedTeamUuid}/${encodedRefUuid}/resources/${encodedSource}?token=${encodeURIComponent(token)}`;
1699
1703
  }
@@ -1711,7 +1715,8 @@ var OnesWikiReader = class {
1711
1715
  const context = { imageSources: [] };
1712
1716
  const content = renderWikiContent(typeof data.content === "string" ? data.content : "", context);
1713
1717
  const token = typeof data.token === "string" ? data.token : "";
1714
- if (!context.imageSources.length || !token) return {
1718
+ const attachmentSources = context.imageSources.filter(isWikiAttachmentPath);
1719
+ if (!attachmentSources.length || !token) return {
1715
1720
  content,
1716
1721
  attachments: []
1717
1722
  };
@@ -1723,7 +1728,7 @@ var OnesWikiReader = class {
1723
1728
  };
1724
1729
  return {
1725
1730
  content,
1726
- attachments: context.imageSources.map((source, index) => ({
1731
+ attachments: attachmentSources.map((source, index) => ({
1727
1732
  id: `${wikiUuid}-image-${index + 1}`,
1728
1733
  name: attachmentNameFromPath(source),
1729
1734
  url: this.buildImageUrl(session, refUuid, source, token, wikiTeamUuid),
@@ -4052,7 +4057,7 @@ async function handleGetGrillingBrief(input, adapters, defaultSource) {
4052
4057
  }
4053
4058
  //#endregion
4054
4059
  //#region ../../src/utils/safe-image.ts
4055
- const DEFAULT_MAX_BYTES = 8 * 1024 * 1024;
4060
+ const DEFAULT_MAX_BYTES = 8388608;
4056
4061
  const DEFAULT_MAX_REDIRECTS = 3;
4057
4062
  const DEFAULT_TIMEOUT_MS = 1e4;
4058
4063
  const MAX_IMAGES = 8;
@@ -4482,7 +4487,7 @@ async function handleListSources(adapters, config) {
4482
4487
  }
4483
4488
  //#endregion
4484
4489
  //#region ../../src/tools/requirement-decomposition.ts
4485
- const APPROVAL_TTL_MS$1 = 1800 * 1e3;
4490
+ const APPROVAL_TTL_MS$1 = 18e5;
4486
4491
  const MAX_CREATE_OPERATIONS = 10;
4487
4492
  function isValidDate(value) {
4488
4493
  if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) return false;
@@ -5163,7 +5168,7 @@ async function handleLookupEnvironmentAccess(input, adapters, defaultSource) {
5163
5168
  }
5164
5169
  //#endregion
5165
5170
  //#region ../../src/tools/wiki-write.ts
5166
- const APPROVAL_TTL_MS = 1800 * 1e3;
5171
+ const APPROVAL_TTL_MS = 18e5;
5167
5172
  const SourceSchema = zod_v4.z.string().trim().min(1).optional();
5168
5173
  const PathSchema = zod_v4.z.union([zod_v4.z.string().trim().min(1), zod_v4.z.array(zod_v4.z.string().trim().min(1)).min(1)]).describe("Wiki path. Exact self-reference segments such as \"我的\", \"我\", \"me\", or \"my\" resolve the authenticated user through ONES token info without exposing the display name.");
5169
5174
  const PrepareWikiCreateSchema = zod_v4.z.object({
package/dist/index.mjs CHANGED
@@ -185,7 +185,7 @@ function loadConfig(startDir) {
185
185
  }
186
186
  //#endregion
187
187
  //#region package.json
188
- var version = "0.5.0";
188
+ var version = "0.5.1";
189
189
  //#endregion
190
190
  //#region ../../src/utils/ones-issue-kind.ts
191
191
  /**
@@ -822,7 +822,8 @@ function removeControlCharacters(value) {
822
822
  return output;
823
823
  }
824
824
  function sanitizeExternalText(value) {
825
- return removeControlCharacters(removeUrlCredentials(decodeHTML(value.slice(0, MAX_EXTERNAL_TEXT_CHARS).replace(/<(?:script|style|iframe|object|embed)\b[^>]*>[\s\S]*?<\/(?:script|style|iframe|object|embed)>/gi, "").replace(/<img\b[^>]*>/gi, "[Image omitted]").replace(/<br\s*\/?>/gi, "\n").replace(/<\/p\s*>/gi, "\n").replace(/<\/(?:td|th)\s*>/gi, " | ").replace(/<\/tr\s*>/gi, "\n").replace(/<[^>]+>/g, "")))).replace(/[ \t]+\n/g, "\n").replace(/\n[ \t]+/g, "\n").replace(/\n{3,}/g, "\n\n").trim();
825
+ const withoutActiveContent = value.slice(0, MAX_EXTERNAL_TEXT_CHARS).replace(/<(?:script|style|iframe|object|embed)\b[^>]*>[\s\S]*?<\/(?:script|style|iframe|object|embed)>/gi, "").replace(/<img\b[^>]*>/gi, "[Image omitted]").replace(/<br\s*\/?>/gi, "\n").replace(/<\/p\s*>/gi, "\n").replace(/<\/(?:td|th)\s*>/gi, " | ").replace(/<\/tr\s*>/gi, "\n").replace(/<[^>]+>/g, "");
826
+ return removeControlCharacters(removeUrlCredentials(decodeHTML(withoutActiveContent))).replace(/[ \t]+\n/g, "\n").replace(/\n[ \t]+/g, "\n").replace(/\n{3,}/g, "\n\n").trim();
826
827
  }
827
828
  function sanitizeExternalInline(value) {
828
829
  return sanitizeExternalText(value).replace(/\s+/g, " ").slice(0, MAX_EXTERNAL_INLINE_CHARS);
@@ -1503,6 +1504,10 @@ var WikiPathResolutionError = class extends Error {
1503
1504
  };
1504
1505
  //#endregion
1505
1506
  //#region ../../src/adapters/ones/wiki-reader.ts
1507
+ function isWikiAttachmentPath(source) {
1508
+ if (/^[a-z][a-z\d+.-]*:/i.test(source)) return false;
1509
+ return source.split("/").every((part) => Boolean(part) && part !== "." && part !== ".." && !part.includes("\\"));
1510
+ }
1506
1511
  const CURRENT_USER_PATH_ALIASES = {
1507
1512
  "i": true,
1508
1513
  "me": true,
@@ -1665,9 +1670,8 @@ var OnesWikiReader = class {
1665
1670
  }
1666
1671
  buildImageUrl(session, refUuid, source, token, teamUuid) {
1667
1672
  const encodedRefUuid = encodeIdentifier$1(refUuid, "wiki reference UUID");
1668
- const sourceParts = source.split("/");
1669
- if (sourceParts.some((part) => !part || part === "." || part === ".." || part.includes("\\"))) throw new Error("ONES: Invalid wiki attachment path");
1670
- const encodedSource = sourceParts.map((part) => encodeURIComponent(part)).join("/");
1673
+ if (!isWikiAttachmentPath(source)) throw new Error("ONES: Invalid wiki attachment path");
1674
+ const encodedSource = source.split("/").map((part) => encodeURIComponent(part)).join("/");
1671
1675
  const encodedTeamUuid = encodeIdentifier$1(teamUuid ?? session.teamUuid, "team UUID");
1672
1676
  return `${this.options.apiBase}/wiki/api/wiki/editor/${encodedTeamUuid}/${encodedRefUuid}/resources/${encodedSource}?token=${encodeURIComponent(token)}`;
1673
1677
  }
@@ -1685,7 +1689,8 @@ var OnesWikiReader = class {
1685
1689
  const context = { imageSources: [] };
1686
1690
  const content = renderWikiContent(typeof data.content === "string" ? data.content : "", context);
1687
1691
  const token = typeof data.token === "string" ? data.token : "";
1688
- if (!context.imageSources.length || !token) return {
1692
+ const attachmentSources = context.imageSources.filter(isWikiAttachmentPath);
1693
+ if (!attachmentSources.length || !token) return {
1689
1694
  content,
1690
1695
  attachments: []
1691
1696
  };
@@ -1697,7 +1702,7 @@ var OnesWikiReader = class {
1697
1702
  };
1698
1703
  return {
1699
1704
  content,
1700
- attachments: context.imageSources.map((source, index) => ({
1705
+ attachments: attachmentSources.map((source, index) => ({
1701
1706
  id: `${wikiUuid}-image-${index + 1}`,
1702
1707
  name: attachmentNameFromPath(source),
1703
1708
  url: this.buildImageUrl(session, refUuid, source, token, wikiTeamUuid),
@@ -4026,7 +4031,7 @@ async function handleGetGrillingBrief(input, adapters, defaultSource) {
4026
4031
  }
4027
4032
  //#endregion
4028
4033
  //#region ../../src/utils/safe-image.ts
4029
- const DEFAULT_MAX_BYTES = 8 * 1024 * 1024;
4034
+ const DEFAULT_MAX_BYTES = 8388608;
4030
4035
  const DEFAULT_MAX_REDIRECTS = 3;
4031
4036
  const DEFAULT_TIMEOUT_MS = 1e4;
4032
4037
  const MAX_IMAGES = 8;
@@ -4456,7 +4461,7 @@ async function handleListSources(adapters, config) {
4456
4461
  }
4457
4462
  //#endregion
4458
4463
  //#region ../../src/tools/requirement-decomposition.ts
4459
- const APPROVAL_TTL_MS$1 = 1800 * 1e3;
4464
+ const APPROVAL_TTL_MS$1 = 18e5;
4460
4465
  const MAX_CREATE_OPERATIONS = 10;
4461
4466
  function isValidDate(value) {
4462
4467
  if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) return false;
@@ -5137,7 +5142,7 @@ async function handleLookupEnvironmentAccess(input, adapters, defaultSource) {
5137
5142
  }
5138
5143
  //#endregion
5139
5144
  //#region ../../src/tools/wiki-write.ts
5140
- const APPROVAL_TTL_MS = 1800 * 1e3;
5145
+ const APPROVAL_TTL_MS = 18e5;
5141
5146
  const SourceSchema = z.string().trim().min(1).optional();
5142
5147
  const PathSchema = z.union([z.string().trim().min(1), z.array(z.string().trim().min(1)).min(1)]).describe("Wiki path. Exact self-reference segments such as \"我的\", \"我\", \"me\", or \"my\" resolve the authenticated user through ONES token info without exposing the display name.");
5143
5148
  const PrepareWikiCreateSchema = z.object({