@morphllm/morphsdk 0.2.202 → 0.2.204

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 (246) hide show
  1. package/README.md +101 -0
  2. package/dist/chunk-2GMG5XKU.js +100 -0
  3. package/dist/chunk-2PPYWRMZ.js +3 -4
  4. package/dist/chunk-3HAHJYZQ.cjs +74 -0
  5. package/dist/{chunk-2XU3XXUE.js → chunk-3JROKKS4.js} +3 -25
  6. package/dist/{chunk-26K5EJD3.js → chunk-43JBUEIX.js} +4 -18
  7. package/dist/chunk-44OIEPIO.js +4 -23
  8. package/dist/chunk-4EQQGUZ7.cjs +104 -0
  9. package/dist/chunk-4OUGA3KS.js +1 -5
  10. package/dist/{chunk-VQDDL3UH.js → chunk-4TZBUFVP.js} +2 -8
  11. package/dist/{chunk-YAM6P5OQ.js → chunk-564XJOQP.js} +2 -6
  12. package/dist/chunk-5H3FKFOI.cjs +77 -0
  13. package/dist/chunk-5TTZQF4X.cjs +110 -0
  14. package/dist/chunk-6HAYJA6M.cjs +317 -0
  15. package/dist/chunk-6TZCVTW5.js +3 -4
  16. package/dist/chunk-6WP7EA4F.js +2 -4
  17. package/dist/chunk-74A4HLIO.cjs +42 -0
  18. package/dist/chunk-75ZPJI57.cjs +9 -0
  19. package/dist/chunk-7PJYY46L.cjs +2 -0
  20. package/dist/chunk-AWFZKS27.cjs +11 -0
  21. package/dist/chunk-BJBWWIZV.cjs +2 -0
  22. package/dist/chunk-DLYDIYDK.cjs +305 -0
  23. package/dist/{chunk-65TUD7JV.js → chunk-DYCMPDPV.js} +13 -29
  24. package/dist/{chunk-3CPI6ZIC.js → chunk-DZP7BR66.js} +22 -43
  25. package/dist/chunk-E63OPKP7.js +96 -0
  26. package/dist/chunk-E6V75LI6.cjs +334 -0
  27. package/dist/{chunk-XPHNS7NW.js → chunk-EJ6ID24K.js} +3 -12
  28. package/dist/chunk-EJTL2BOZ.cjs +42 -0
  29. package/dist/chunk-ETBRAKVV.js +1 -5
  30. package/dist/chunk-F633IVQA.cjs +91 -0
  31. package/dist/chunk-FBOZIVVQ.js +1 -0
  32. package/dist/{chunk-UKXCGQPS.js → chunk-FGA6EYC2.js} +35 -37
  33. package/dist/{chunk-CAWQEHKP.js → chunk-G4RODMXA.js} +4 -19
  34. package/dist/chunk-GUNGJC6X.cjs +256 -0
  35. package/dist/chunk-GYE3FY6Z.js +8 -0
  36. package/dist/chunk-HDP4QAZL.js +1 -4
  37. package/dist/chunk-HNMEBYIS.cjs +86 -0
  38. package/dist/chunk-HP3PCOTW.cjs +81 -0
  39. package/dist/{chunk-ICCGLO6V.js → chunk-IGXNLXPN.js} +12 -17
  40. package/dist/chunk-IPJA3ZS6.cjs +10 -0
  41. package/dist/chunk-JHC2R3HU.cjs +317 -0
  42. package/dist/{chunk-IBRBSDLT.js → chunk-JVMIFGZY.js} +5 -8
  43. package/dist/chunk-KF6S3EPJ.cjs +100 -0
  44. package/dist/chunk-KVGZ2TSG.cjs +274 -0
  45. package/dist/{chunk-6OYJC4TZ.js → chunk-L5SCKZVK.js} +13 -22
  46. package/dist/chunk-LDM7RNNN.js +1 -0
  47. package/dist/{chunk-UAZKHSEU.js → chunk-LQST3NW2.js} +5 -15
  48. package/dist/chunk-M34E2AMK.js +1 -5
  49. package/dist/chunk-MF56KEI4.js +1 -4
  50. package/dist/chunk-MLKGABMK.js +1 -3
  51. package/dist/chunk-MLPZKUCO.js +4 -5
  52. package/dist/chunk-MMX5PUGC.cjs +242 -0
  53. package/dist/chunk-MWXJ6DZ2.cjs +21 -0
  54. package/dist/chunk-NJWOWXUR.cjs +137 -0
  55. package/dist/chunk-NNKBKENK.cjs +15 -0
  56. package/dist/chunk-NRG6QX3L.js +1 -3
  57. package/dist/chunk-OCKEEEYE.cjs +433 -0
  58. package/dist/chunk-OENJO7YW.js +306 -0
  59. package/dist/chunk-OKLAYEBC.cjs +2 -0
  60. package/dist/chunk-OPDWMD4Q.js +1 -3
  61. package/dist/{chunk-D6YJ5X3C.js → chunk-OX5GN2KB.js} +26 -14
  62. package/dist/{chunk-JEVLCA5C.js → chunk-OYBOP47A.js} +18 -19
  63. package/dist/chunk-OZHCHPIE.js +1 -0
  64. package/dist/chunk-PA3UTI4A.js +1 -4
  65. package/dist/chunk-QEEAIXL5.cjs +74 -0
  66. package/dist/chunk-QT5LGZG3.cjs +10 -0
  67. package/dist/chunk-R3TUE7O2.cjs +107 -0
  68. package/dist/chunk-RYVW7RUM.js +2 -6
  69. package/dist/{chunk-LVKKICOB.js → chunk-SOQYE5A4.js} +36 -69
  70. package/dist/chunk-ST2OXLT5.cjs +91 -0
  71. package/dist/{chunk-SIFDK4AA.js → chunk-TH4MG73B.js} +3 -24
  72. package/dist/{chunk-OSL4CNSO.js → chunk-TLMAMVAW.js} +7 -23
  73. package/dist/chunk-TPZHMD7J.cjs +72 -0
  74. package/dist/{chunk-PDSIWL7I.js → chunk-U4PYAGNR.js} +6 -19
  75. package/dist/chunk-UAPK3AIJ.js +1 -10
  76. package/dist/chunk-UF5IKELS.cjs +26 -0
  77. package/dist/chunk-UHFVWYSP.cjs +408 -0
  78. package/dist/chunk-UKBSXYKE.cjs +280 -0
  79. package/dist/chunk-UNX7V6P6.cjs +60 -0
  80. package/dist/chunk-UZMMJ47A.cjs +107 -0
  81. package/dist/chunk-VHD7CW5O.cjs +43 -0
  82. package/dist/chunk-VL4QNALG.cjs +50 -0
  83. package/dist/chunk-VYE7O4FM.cjs +51 -0
  84. package/dist/chunk-WIYVT4UO.cjs +173 -0
  85. package/dist/chunk-WJHHO24M.cjs +91 -0
  86. package/dist/chunk-WR7LSUIR.cjs +213 -0
  87. package/dist/chunk-XE6D4J63.cjs +72 -0
  88. package/dist/chunk-YAUXTFIN.cjs +21 -0
  89. package/dist/{chunk-NFPRKZQ5.js → chunk-YJUCGZNN.js} +5 -22
  90. package/dist/chunk-ZSHVXDA2.js +4 -10
  91. package/dist/chunk-ZX6T3LNG.js +302 -0
  92. package/dist/{client-BWhi-vSj.d.ts → client-DSXbcxII.d.ts} +10 -1
  93. package/dist/client.cjs +44 -4360
  94. package/dist/client.d.ts +4 -2
  95. package/dist/client.js +36 -37
  96. package/dist/core/client.cjs +14 -476
  97. package/dist/core/client.d.ts +8 -0
  98. package/dist/core/client.js +10 -11
  99. package/dist/core/error.cjs +8 -251
  100. package/dist/core/error.js +4 -9
  101. package/dist/core/index.cjs +27 -491
  102. package/dist/core/index.d.ts +2 -0
  103. package/dist/core/index.js +12 -19
  104. package/dist/core/resource.cjs +9 -33
  105. package/dist/core/resource.d.ts +2 -0
  106. package/dist/core/resource.js +2 -7
  107. package/dist/edge.cjs +74 -1111
  108. package/dist/edge.d.ts +3 -0
  109. package/dist/edge.js +14 -42
  110. package/dist/guard-CvW03v4u.d.ts +59 -0
  111. package/dist/index.cjs +140 -4431
  112. package/dist/index.d.ts +6 -2
  113. package/dist/index.js +44 -87
  114. package/dist/modelrouter/core.cjs +35 -651
  115. package/dist/modelrouter/core.d.ts +2 -0
  116. package/dist/modelrouter/core.js +12 -21
  117. package/dist/modelrouter/index.cjs +35 -651
  118. package/dist/modelrouter/index.d.ts +2 -0
  119. package/dist/modelrouter/index.js +12 -21
  120. package/dist/modelrouter/types.cjs +1 -17
  121. package/dist/modelrouter/types.d.ts +5 -0
  122. package/dist/modelrouter/types.js +1 -0
  123. package/dist/subagents/anthropic.cjs +31 -2784
  124. package/dist/subagents/anthropic.d.ts +3 -1
  125. package/dist/subagents/anthropic.js +23 -24
  126. package/dist/subagents/index.cjs +14 -95
  127. package/dist/subagents/index.d.ts +3 -1
  128. package/dist/subagents/index.js +2 -11
  129. package/dist/subagents/prompts.cjs +14 -93
  130. package/dist/subagents/prompts.d.ts +3 -1
  131. package/dist/subagents/prompts.js +2 -11
  132. package/dist/subagents/types.cjs +1 -17
  133. package/dist/subagents/types.d.ts +3 -1
  134. package/dist/subagents/types.js +1 -0
  135. package/dist/subagents/vercel.cjs +31 -2761
  136. package/dist/subagents/vercel.d.ts +3 -1
  137. package/dist/subagents/vercel.js +23 -24
  138. package/dist/tools/compact/core.cjs +20 -552
  139. package/dist/tools/compact/core.d.ts +2 -0
  140. package/dist/tools/compact/core.js +12 -13
  141. package/dist/tools/compact/index.cjs +24 -598
  142. package/dist/tools/compact/index.d.ts +3 -1
  143. package/dist/tools/compact/index.js +13 -17
  144. package/dist/tools/compact/types.cjs +1 -17
  145. package/dist/tools/compact/types.d.ts +4 -4
  146. package/dist/tools/compact/types.js +1 -0
  147. package/dist/tools/fastapply/anthropic.cjs +39 -899
  148. package/dist/tools/fastapply/anthropic.d.ts +2 -0
  149. package/dist/tools/fastapply/anthropic.js +15 -24
  150. package/dist/tools/fastapply/apply.cjs +32 -672
  151. package/dist/tools/fastapply/apply.d.ts +2 -0
  152. package/dist/tools/fastapply/apply.js +8 -19
  153. package/dist/tools/fastapply/core.cjs +49 -1069
  154. package/dist/tools/fastapply/core.d.ts +3 -0
  155. package/dist/tools/fastapply/core.js +13 -29
  156. package/dist/tools/fastapply/index.cjs +56 -1052
  157. package/dist/tools/fastapply/index.d.ts +2 -0
  158. package/dist/tools/fastapply/index.js +18 -44
  159. package/dist/tools/fastapply/openai.cjs +45 -910
  160. package/dist/tools/fastapply/openai.d.ts +2 -0
  161. package/dist/tools/fastapply/openai.js +15 -26
  162. package/dist/tools/fastapply/prompts.cjs +10 -62
  163. package/dist/tools/fastapply/prompts.js +2 -9
  164. package/dist/tools/fastapply/types.cjs +1 -17
  165. package/dist/tools/fastapply/types.d.ts +9 -4
  166. package/dist/tools/fastapply/types.js +1 -0
  167. package/dist/tools/fastapply/vercel.cjs +37 -905
  168. package/dist/tools/fastapply/vercel.d.ts +2 -0
  169. package/dist/tools/fastapply/vercel.js +15 -22
  170. package/dist/tools/index.cjs +56 -1052
  171. package/dist/tools/index.d.ts +2 -0
  172. package/dist/tools/index.js +18 -44
  173. package/dist/tools/pii/index.cjs +47 -0
  174. package/dist/tools/pii/index.d.ts +4 -0
  175. package/dist/tools/pii/index.js +6 -0
  176. package/dist/tools/pii/model.cjs +45 -0
  177. package/dist/tools/pii/model.d.ts +83 -0
  178. package/dist/tools/pii/model.js +4 -0
  179. package/dist/tools/pii/patterns.cjs +15 -0
  180. package/dist/tools/pii/patterns.d.ts +31 -0
  181. package/dist/tools/pii/patterns.js +2 -0
  182. package/dist/tools/pii/regex.cjs +32 -0
  183. package/dist/tools/pii/regex.d.ts +48 -0
  184. package/dist/tools/pii/regex.js +3 -0
  185. package/dist/tools/pii/types.cjs +2 -0
  186. package/dist/tools/pii/types.d.ts +108 -0
  187. package/dist/tools/pii/types.js +1 -0
  188. package/dist/tools/utils/resilience.cjs +15 -312
  189. package/dist/tools/utils/resilience.js +3 -12
  190. package/dist/tools/warp_grep/agent/config.cjs +16 -127
  191. package/dist/tools/warp_grep/agent/config.js +2 -11
  192. package/dist/tools/warp_grep/agent/formatter.cjs +12 -48
  193. package/dist/tools/warp_grep/agent/formatter.js +2 -9
  194. package/dist/tools/warp_grep/agent/parser.cjs +16 -83
  195. package/dist/tools/warp_grep/agent/parser.d.ts +2 -0
  196. package/dist/tools/warp_grep/agent/parser.js +2 -11
  197. package/dist/tools/warp_grep/agent/runner.cjs +19 -1081
  198. package/dist/tools/warp_grep/agent/runner.d.ts +2 -0
  199. package/dist/tools/warp_grep/agent/runner.js +11 -14
  200. package/dist/tools/warp_grep/agent/types.cjs +1 -17
  201. package/dist/tools/warp_grep/agent/types.d.ts +4 -0
  202. package/dist/tools/warp_grep/agent/types.js +1 -0
  203. package/dist/tools/warp_grep/anthropic.cjs +51 -2561
  204. package/dist/tools/warp_grep/anthropic.d.ts +3 -1
  205. package/dist/tools/warp_grep/anthropic.js +23 -35
  206. package/dist/tools/warp_grep/client.cjs +53 -2471
  207. package/dist/tools/warp_grep/client.d.ts +3 -1
  208. package/dist/tools/warp_grep/client.js +21 -34
  209. package/dist/tools/warp_grep/gemini.cjs +52 -2490
  210. package/dist/tools/warp_grep/gemini.d.ts +3 -1
  211. package/dist/tools/warp_grep/gemini.js +25 -41
  212. package/dist/tools/warp_grep/harness.cjs +81 -936
  213. package/dist/tools/warp_grep/harness.d.ts +2 -0
  214. package/dist/tools/warp_grep/harness.js +12 -51
  215. package/dist/tools/warp_grep/index.cjs +128 -2575
  216. package/dist/tools/warp_grep/index.d.ts +3 -1
  217. package/dist/tools/warp_grep/index.js +28 -87
  218. package/dist/tools/warp_grep/openai.cjs +57 -2575
  219. package/dist/tools/warp_grep/openai.d.ts +3 -1
  220. package/dist/tools/warp_grep/openai.js +23 -37
  221. package/dist/tools/warp_grep/providers/code_storage_http.cjs +12 -65
  222. package/dist/tools/warp_grep/providers/code_storage_http.d.ts +3 -1
  223. package/dist/tools/warp_grep/providers/code_storage_http.js +2 -9
  224. package/dist/tools/warp_grep/providers/local.cjs +10 -589
  225. package/dist/tools/warp_grep/providers/local.js +6 -11
  226. package/dist/tools/warp_grep/providers/remote.cjs +8 -331
  227. package/dist/tools/warp_grep/providers/remote.d.ts +3 -1
  228. package/dist/tools/warp_grep/providers/remote.js +3 -8
  229. package/dist/tools/warp_grep/providers/types.cjs +1 -17
  230. package/dist/tools/warp_grep/providers/types.js +1 -0
  231. package/dist/tools/warp_grep/utils/files.cjs +9 -42
  232. package/dist/tools/warp_grep/utils/files.js +2 -7
  233. package/dist/tools/warp_grep/utils/github.cjs +9 -43
  234. package/dist/tools/warp_grep/utils/github.js +2 -7
  235. package/dist/tools/warp_grep/utils/paths.cjs +28 -104
  236. package/dist/tools/warp_grep/utils/paths.js +2 -17
  237. package/dist/tools/warp_grep/utils/ripgrep.cjs +9 -103
  238. package/dist/tools/warp_grep/utils/ripgrep.js +2 -7
  239. package/dist/tools/warp_grep/vercel.cjs +57 -2557
  240. package/dist/tools/warp_grep/vercel.d.ts +3 -1
  241. package/dist/tools/warp_grep/vercel.js +23 -37
  242. package/dist/{types-DxZLPogx.d.ts → types-BKhXjDCB.d.ts} +6 -1
  243. package/dist/version.cjs +7 -225
  244. package/dist/version.js +2 -7
  245. package/package.json +11 -2
  246. package/dist/chunk-E6TL6MIH.js +0 -203
@@ -5,6 +5,8 @@ export { a as anthropic } from '../anthropic-DpEAqqZF.js';
5
5
  export { o as openai } from '../openai-BkKsS30n.js';
6
6
  export { v as vercel } from '../vercel-Cg38kNm4.js';
7
7
  export { FastApplyAnchorIntegrityError, FastApplyContextLengthError, applyEdit, countChanges, generateUdiff } from './fastapply/apply.js';
8
+ import '../guard-CvW03v4u.js';
9
+ import './pii/types.js';
8
10
  import '../core/client.js';
9
11
  import './utils/resilience.js';
10
12
  import '../core/resource.js';
@@ -1,44 +1,18 @@
1
- import "../chunk-FBOZIVVQ.js";
2
- import {
3
- openai_exports
4
- } from "../chunk-CAWQEHKP.js";
5
- import {
6
- vercel_exports
7
- } from "../chunk-PDSIWL7I.js";
8
- import {
9
- anthropic_exports
10
- } from "../chunk-26K5EJD3.js";
11
- import {
12
- EDIT_FILE_SYSTEM_PROMPT,
13
- EDIT_FILE_TOOL_DESCRIPTION
14
- } from "../chunk-PA3UTI4A.js";
15
- import {
16
- executeEditFile
17
- } from "../chunk-65TUD7JV.js";
18
- import {
19
- FastApplyAnchorIntegrityError,
20
- FastApplyContextLengthError,
21
- applyEdit,
22
- countChanges,
23
- generateUdiff
24
- } from "../chunk-JEVLCA5C.js";
25
- import "../chunk-ICCGLO6V.js";
26
- import "../chunk-6WP7EA4F.js";
27
- import "../chunk-YAM6P5OQ.js";
28
- import "../chunk-VQDDL3UH.js";
29
- import "../chunk-E6TL6MIH.js";
30
- import "../chunk-NRG6QX3L.js";
31
- import "../chunk-MLKGABMK.js";
32
- export {
33
- EDIT_FILE_SYSTEM_PROMPT,
34
- EDIT_FILE_TOOL_DESCRIPTION,
35
- FastApplyAnchorIntegrityError,
36
- FastApplyContextLengthError,
37
- anthropic_exports as anthropic,
38
- applyEdit,
39
- countChanges,
40
- executeEditFile,
41
- generateUdiff,
42
- openai_exports as openai,
43
- vercel_exports as vercel
44
- };
1
+ import '../chunk-FBOZIVVQ.js';
2
+ export { openai_exports as openai } from '../chunk-G4RODMXA.js';
3
+ export { vercel_exports as vercel } from '../chunk-U4PYAGNR.js';
4
+ export { anthropic_exports as anthropic } from '../chunk-43JBUEIX.js';
5
+ export { EDIT_FILE_SYSTEM_PROMPT, EDIT_FILE_TOOL_DESCRIPTION } from '../chunk-PA3UTI4A.js';
6
+ export { executeEditFile } from '../chunk-DYCMPDPV.js';
7
+ export { FastApplyAnchorIntegrityError, FastApplyContextLengthError, applyEdit, countChanges, generateUdiff } from '../chunk-OYBOP47A.js';
8
+ import '../chunk-IGXNLXPN.js';
9
+ import '../chunk-6WP7EA4F.js';
10
+ import '../chunk-E63OPKP7.js';
11
+ import '../chunk-OENJO7YW.js';
12
+ import '../chunk-2GMG5XKU.js';
13
+ import '../chunk-ZX6T3LNG.js';
14
+ import '../chunk-564XJOQP.js';
15
+ import '../chunk-4TZBUFVP.js';
16
+ import '../chunk-GYE3FY6Z.js';
17
+ import '../chunk-NRG6QX3L.js';
18
+ import '../chunk-MLKGABMK.js';
@@ -0,0 +1,47 @@
1
+ 'use strict';
2
+
3
+ require('../../chunk-OKLAYEBC.cjs');
4
+ var chunkKF6S3EPJ_cjs = require('../../chunk-KF6S3EPJ.cjs');
5
+ var chunk6HAYJA6M_cjs = require('../../chunk-6HAYJA6M.cjs');
6
+ var chunkR3TUE7O2_cjs = require('../../chunk-R3TUE7O2.cjs');
7
+ require('../../chunk-DLYDIYDK.cjs');
8
+ require('../../chunk-75ZPJI57.cjs');
9
+
10
+
11
+
12
+ Object.defineProperty(exports, "PIIRestoreError", {
13
+ enumerable: true,
14
+ get: function () { return chunkKF6S3EPJ_cjs.PIIRestoreError; }
15
+ });
16
+ Object.defineProperty(exports, "PIISession", {
17
+ enumerable: true,
18
+ get: function () { return chunkKF6S3EPJ_cjs.PIISession; }
19
+ });
20
+ Object.defineProperty(exports, "resolvePIIGuard", {
21
+ enumerable: true,
22
+ get: function () { return chunkKF6S3EPJ_cjs.resolvePIIGuard; }
23
+ });
24
+ Object.defineProperty(exports, "DEFAULT_MODEL_EXCLUDED_TYPES", {
25
+ enumerable: true,
26
+ get: function () { return chunk6HAYJA6M_cjs.DEFAULT_MODEL_EXCLUDED_TYPES; }
27
+ });
28
+ Object.defineProperty(exports, "DEFAULT_PII_ALLOW", {
29
+ enumerable: true,
30
+ get: function () { return chunk6HAYJA6M_cjs.DEFAULT_PII_ALLOW; }
31
+ });
32
+ Object.defineProperty(exports, "DEFAULT_PII_MODEL", {
33
+ enumerable: true,
34
+ get: function () { return chunk6HAYJA6M_cjs.DEFAULT_PII_MODEL; }
35
+ });
36
+ Object.defineProperty(exports, "createPIIRedactor", {
37
+ enumerable: true,
38
+ get: function () { return chunk6HAYJA6M_cjs.createPIIRedactor; }
39
+ });
40
+ Object.defineProperty(exports, "detectPII", {
41
+ enumerable: true,
42
+ get: function () { return chunkR3TUE7O2_cjs.detectPII; }
43
+ });
44
+ Object.defineProperty(exports, "redactPII", {
45
+ enumerable: true,
46
+ get: function () { return chunkR3TUE7O2_cjs.redactPII; }
47
+ });
@@ -0,0 +1,4 @@
1
+ export { detectPII, redactPII } from './regex.js';
2
+ export { DEFAULT_MODEL_EXCLUDED_TYPES, DEFAULT_PII_ALLOW, DEFAULT_PII_MODEL, createPIIRedactor } from './model.js';
3
+ export { b as PIIGuard, P as PIIRestoreError, a as PIISession, R as RedactPIIOption, r as resolvePIIGuard } from '../../guard-CvW03v4u.js';
4
+ export { PIIEntity, PIIPlaceholder, PIIRedactOptions, PIIRedactResult, PIIRedactor, PIIRedactorConfig, PIIToken, PIITokenClassifier, PIIType, RegexPIIType } from './types.js';
@@ -0,0 +1,6 @@
1
+ import '../../chunk-OZHCHPIE.js';
2
+ export { PIIRestoreError, PIISession, resolvePIIGuard } from '../../chunk-E63OPKP7.js';
3
+ export { DEFAULT_MODEL_EXCLUDED_TYPES, DEFAULT_PII_ALLOW, DEFAULT_PII_MODEL, createPIIRedactor } from '../../chunk-OENJO7YW.js';
4
+ export { detectPII, redactPII } from '../../chunk-2GMG5XKU.js';
5
+ import '../../chunk-ZX6T3LNG.js';
6
+ import '../../chunk-MLKGABMK.js';
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ var chunk6HAYJA6M_cjs = require('../../chunk-6HAYJA6M.cjs');
4
+ require('../../chunk-R3TUE7O2.cjs');
5
+ require('../../chunk-DLYDIYDK.cjs');
6
+ require('../../chunk-75ZPJI57.cjs');
7
+
8
+
9
+
10
+ Object.defineProperty(exports, "DEFAULT_MODEL_EXCLUDED_TYPES", {
11
+ enumerable: true,
12
+ get: function () { return chunk6HAYJA6M_cjs.DEFAULT_MODEL_EXCLUDED_TYPES; }
13
+ });
14
+ Object.defineProperty(exports, "DEFAULT_PII_ALLOW", {
15
+ enumerable: true,
16
+ get: function () { return chunk6HAYJA6M_cjs.DEFAULT_PII_ALLOW; }
17
+ });
18
+ Object.defineProperty(exports, "DEFAULT_PII_MODEL", {
19
+ enumerable: true,
20
+ get: function () { return chunk6HAYJA6M_cjs.DEFAULT_PII_MODEL; }
21
+ });
22
+ Object.defineProperty(exports, "alignTokens", {
23
+ enumerable: true,
24
+ get: function () { return chunk6HAYJA6M_cjs.alignTokens; }
25
+ });
26
+ Object.defineProperty(exports, "chunkText", {
27
+ enumerable: true,
28
+ get: function () { return chunk6HAYJA6M_cjs.chunkText; }
29
+ });
30
+ Object.defineProperty(exports, "createPIIRedactor", {
31
+ enumerable: true,
32
+ get: function () { return chunk6HAYJA6M_cjs.createPIIRedactor; }
33
+ });
34
+ Object.defineProperty(exports, "loadOptionalDependency", {
35
+ enumerable: true,
36
+ get: function () { return chunk6HAYJA6M_cjs.loadOptionalDependency; }
37
+ });
38
+ Object.defineProperty(exports, "looksLikeIdentifier", {
39
+ enumerable: true,
40
+ get: function () { return chunk6HAYJA6M_cjs.looksLikeIdentifier; }
41
+ });
42
+ Object.defineProperty(exports, "tokensToEntities", {
43
+ enumerable: true,
44
+ get: function () { return chunk6HAYJA6M_cjs.tokensToEntities; }
45
+ });
@@ -0,0 +1,83 @@
1
+ import { PIIRedactorConfig, PIIRedactor, PIIType, PIIToken, PIIEntity } from './types.js';
2
+
3
+ /**
4
+ * Local CPU-model PII detector.
5
+ *
6
+ * Runs a small token-classification model through transformers.js (ONNX Runtime) on
7
+ * the user's machine: no text leaves the process. The model finds what regexes cannot,
8
+ * mainly names, addresses and other free-text PII.
9
+ *
10
+ * transformers.js returns labelled tokens without character offsets and truncates
11
+ * input at the model's context length, so this module does the two things the
12
+ * pipeline leaves out: it chunks long text, and it maps tokens back to exact offsets
13
+ * in the original string.
14
+ */
15
+
16
+ declare const DEFAULT_PII_MODEL = "onnx-community/bert-small-pii-detection-ONNX";
17
+ /**
18
+ * Labels the default model emits that are skipped unless asked for through `types`.
19
+ * They are rarely personal on their own and would strip useful content from code and
20
+ * logs (every timestamp, URL and company name).
21
+ */
22
+ declare const DEFAULT_MODEL_EXCLUDED_TYPES: PIIType[];
23
+ /**
24
+ * AI product names that the model reads as people. They fill agent transcripts and are
25
+ * not personal data. Replace the list with the `allow` option if a real person in your
26
+ * data shares one of these names.
27
+ */
28
+ declare const DEFAULT_PII_ALLOW: string[];
29
+ /**
30
+ * True when the single word at [start, end) is shaped like code rather than a name:
31
+ * `getWeather`, `StepHandler`, `user_name`, `claude-sonnet` inside `claude-sonnet-4-5`,
32
+ * `fs.readFile`, or anything called like a function.
33
+ *
34
+ * Names inside code are untouched: `"Sarah Connor"` in a JSON string has a space, and a
35
+ * lone capitalized word (`Sydney`, `Jean-Luc`, `McDonald`) has no code shape.
36
+ */
37
+ declare function looksLikeIdentifier(text: string, start: number, end: number): boolean;
38
+ /**
39
+ * Split text into pieces of at most `size` characters. Breaks at the last paragraph
40
+ * break (a blank line) when there is one, so unrelated passages do not share a model
41
+ * call; otherwise at a newline, otherwise at whitespace. Returns [start, end) offsets.
42
+ */
43
+ declare function chunkText(text: string, size?: number): Array<[number, number]>;
44
+ /**
45
+ * Map each token to its [start, end) span in `text` by walking both in order.
46
+ * Tokens that cannot be placed (special or unknown tokens) map to null.
47
+ */
48
+ declare function alignTokens(text: string, words: string[]): Array<[number, number] | null>;
49
+ /** Turn labelled tokens for one chunk into entities with offsets into that chunk. */
50
+ declare function tokensToEntities(text: string, tokens: PIIToken[], minScore: number, labelMap: Record<string, PIIType>): PIIEntity[];
51
+ type ModuleLoader = (name: string) => Promise<any>;
52
+ /**
53
+ * Load an optional dependency with import(), then with require().
54
+ *
55
+ * The second attempt matters on older Node: transformers.js 4 uses import
56
+ * attributes in its ES module build, which Node before 18.20 cannot parse, while
57
+ * its CommonJS build loads there.
58
+ *
59
+ * @internal Exported for tests.
60
+ */
61
+ declare function loadOptionalDependency(name: string, load?: {
62
+ viaImport: ModuleLoader;
63
+ viaRequire: ModuleLoader;
64
+ }): Promise<any>;
65
+ /**
66
+ * Create a PII redactor.
67
+ *
68
+ * Regex mode needs nothing. Model mode adds a small model that runs locally on CPU
69
+ * (about 29 MB, a few milliseconds per paragraph) and also runs the regex detector,
70
+ * since patterns are more exact for structured values such as keys and card numbers.
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * import { createPIIRedactor } from '@morphllm/morphsdk';
75
+ *
76
+ * const redactor = createPIIRedactor({ mode: 'model' });
77
+ * const { text } = await redactor.redact("I'm Sarah Connor, reach me at sarah@example.com");
78
+ * // text: "I'm [PERSON], reach me at [EMAIL]"
79
+ * ```
80
+ */
81
+ declare function createPIIRedactor(config?: PIIRedactorConfig): PIIRedactor;
82
+
83
+ export { DEFAULT_MODEL_EXCLUDED_TYPES, DEFAULT_PII_ALLOW, DEFAULT_PII_MODEL, alignTokens, chunkText, createPIIRedactor, loadOptionalDependency, looksLikeIdentifier, tokensToEntities };
@@ -0,0 +1,4 @@
1
+ export { DEFAULT_MODEL_EXCLUDED_TYPES, DEFAULT_PII_ALLOW, DEFAULT_PII_MODEL, alignTokens, chunkText, createPIIRedactor, loadOptionalDependency, looksLikeIdentifier, tokensToEntities } from '../../chunk-OENJO7YW.js';
2
+ import '../../chunk-2GMG5XKU.js';
3
+ import '../../chunk-ZX6T3LNG.js';
4
+ import '../../chunk-MLKGABMK.js';
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ var chunkDLYDIYDK_cjs = require('../../chunk-DLYDIYDK.cjs');
4
+ require('../../chunk-75ZPJI57.cjs');
5
+
6
+
7
+
8
+ Object.defineProperty(exports, "CONTEXT_CHARS", {
9
+ enumerable: true,
10
+ get: function () { return chunkDLYDIYDK_cjs.CONTEXT_CHARS; }
11
+ });
12
+ Object.defineProperty(exports, "PII_PATTERNS", {
13
+ enumerable: true,
14
+ get: function () { return chunkDLYDIYDK_cjs.PII_PATTERNS; }
15
+ });
@@ -0,0 +1,31 @@
1
+ import { RegexPIIType } from './types.js';
2
+
3
+ /**
4
+ * Regex patterns for structured PII and secrets.
5
+ *
6
+ * Tuned for precision on code and agent transcripts: every pattern is anchored so it
7
+ * cannot start or end inside a longer identifier, and the loose ones are confirmed by a
8
+ * validator (Luhn, IBAN mod-97, ...) before they count.
9
+ *
10
+ * Every quantifier that could rescan a long line is bounded, so matching stays linear
11
+ * in the input. `__tests__/regex.test.ts` holds the worst-case inputs.
12
+ */
13
+
14
+ interface PIIPattern {
15
+ type: RegexPIIType;
16
+ /** Must have the `g` flag */
17
+ regex: RegExp;
18
+ /** Capture group holding the sensitive part. Default: the whole match. */
19
+ group?: number;
20
+ /**
21
+ * Return false to reject a candidate. `before` is the text just ahead of it, up to
22
+ * `CONTEXT_CHARS` long.
23
+ */
24
+ validate?: (value: string, before: string) => boolean;
25
+ }
26
+ /** How much preceding text a validator gets to look at. */
27
+ declare const CONTEXT_CHARS = 256;
28
+ /** Order matters only when two patterns match the same span: the earlier one names it. */
29
+ declare const PII_PATTERNS: PIIPattern[];
30
+
31
+ export { CONTEXT_CHARS, type PIIPattern, PII_PATTERNS };
@@ -0,0 +1,2 @@
1
+ export { CONTEXT_CHARS, PII_PATTERNS } from '../../chunk-ZX6T3LNG.js';
2
+ import '../../chunk-MLKGABMK.js';
@@ -0,0 +1,32 @@
1
+ 'use strict';
2
+
3
+ var chunkR3TUE7O2_cjs = require('../../chunk-R3TUE7O2.cjs');
4
+ require('../../chunk-DLYDIYDK.cjs');
5
+ require('../../chunk-75ZPJI57.cjs');
6
+
7
+
8
+
9
+ Object.defineProperty(exports, "applyRedactions", {
10
+ enumerable: true,
11
+ get: function () { return chunkR3TUE7O2_cjs.applyRedactions; }
12
+ });
13
+ Object.defineProperty(exports, "detectPII", {
14
+ enumerable: true,
15
+ get: function () { return chunkR3TUE7O2_cjs.detectPII; }
16
+ });
17
+ Object.defineProperty(exports, "isAllowed", {
18
+ enumerable: true,
19
+ get: function () { return chunkR3TUE7O2_cjs.isAllowed; }
20
+ });
21
+ Object.defineProperty(exports, "isTypeEnabled", {
22
+ enumerable: true,
23
+ get: function () { return chunkR3TUE7O2_cjs.isTypeEnabled; }
24
+ });
25
+ Object.defineProperty(exports, "mergeEntities", {
26
+ enumerable: true,
27
+ get: function () { return chunkR3TUE7O2_cjs.mergeEntities; }
28
+ });
29
+ Object.defineProperty(exports, "redactPII", {
30
+ enumerable: true,
31
+ get: function () { return chunkR3TUE7O2_cjs.redactPII; }
32
+ });
@@ -0,0 +1,48 @@
1
+ import { PIIRedactOptions, PIIRedactResult, PIIEntity, PIIType } from './types.js';
2
+
3
+ /**
4
+ * Regex PII detector and the shared redaction core.
5
+ *
6
+ * Pure string work with no imports beyond this folder, so it runs anywhere the SDK
7
+ * does (Node, edge runtimes, browsers).
8
+ */
9
+
10
+ /** True when `type` passes the `types` / `excludeTypes` filters. */
11
+ declare function isTypeEnabled(type: PIIType, options: PIIRedactOptions): boolean;
12
+ /** True when `value` matches an entry of the `allow` list. */
13
+ declare function isAllowed(value: string, allow: PIIRedactOptions['allow']): boolean;
14
+ /**
15
+ * Sort entities and fold overlapping ones into a single span, so a redaction never
16
+ * leaves part of an overlapped value behind. The longer span names the result; on a
17
+ * tie the regex match wins, because its type is exact.
18
+ */
19
+ declare function mergeEntities(text: string, entities: PIIEntity[]): PIIEntity[];
20
+ /** Replace each entity in `text` with its placeholder. Entities must not overlap. */
21
+ declare function applyRedactions(text: string, entities: PIIEntity[], placeholder?: PIIRedactOptions['placeholder']): string;
22
+ /**
23
+ * Find structured PII and secrets with regular expressions.
24
+ *
25
+ * Detects emails, phone numbers, US SSNs, credit cards (Luhn-checked, or written in card
26
+ * groups), IBANs (checksum-checked), IPv4/IPv6 and MAC addresses, street addresses and
27
+ * PO boxes, and secrets: provider API keys, JWTs, bearer tokens, private key blocks and
28
+ * passwords inside URLs.
29
+ *
30
+ * It does not find names, cities or countries. Use `createPIIRedactor({ mode: 'model' })`
31
+ * for those.
32
+ */
33
+ declare function detectPII(text: string, options?: PIIRedactOptions): PIIEntity[];
34
+ /**
35
+ * Redact structured PII and secrets with regular expressions. Synchronous, no
36
+ * dependencies, no network.
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * import { redactPII } from '@morphllm/morphsdk';
41
+ *
42
+ * const { text, entities } = redactPII('Mail sarah@example.com from 203.0.113.7');
43
+ * // text: 'Mail [EMAIL] from [IP_ADDRESS]'
44
+ * ```
45
+ */
46
+ declare function redactPII(text: string, options?: PIIRedactOptions): PIIRedactResult;
47
+
48
+ export { applyRedactions, detectPII, isAllowed, isTypeEnabled, mergeEntities, redactPII };
@@ -0,0 +1,3 @@
1
+ export { applyRedactions, detectPII, isAllowed, isTypeEnabled, mergeEntities, redactPII } from '../../chunk-2GMG5XKU.js';
2
+ import '../../chunk-ZX6T3LNG.js';
3
+ import '../../chunk-MLKGABMK.js';
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Types for the Morph PII redactor.
3
+ *
4
+ * Two detectors share these types:
5
+ * - regex: zero-dependency, synchronous, edge-safe (structured PII, street addresses, secrets)
6
+ * - model: a small token-classification model run locally on CPU (names, addresses, ...)
7
+ */
8
+ /** Entity types the regex detector emits. */
9
+ type RegexPIIType = 'EMAIL' | 'PHONE' | 'SSN' | 'CREDIT_CARD' | 'IP_ADDRESS' | 'MAC_ADDRESS' | 'IBAN' | 'LOCATION' | 'DATE_OF_BIRTH' | 'MEDICAL_RECORD' | 'ACCOUNT_NUMBER' | 'SECRET';
10
+ /**
11
+ * Entity type. The model detector adds types such as `PERSON`, `LOCATION` and
12
+ * `ORGANIZATION`; a custom model's labels pass through unchanged.
13
+ */
14
+ type PIIType = RegexPIIType | 'PERSON' | 'ORGANIZATION' | (string & {});
15
+ /** One detected span of PII in the original text. */
16
+ interface PIIEntity {
17
+ type: PIIType;
18
+ /** Start offset in the original text (UTF-16 code units, inclusive) */
19
+ start: number;
20
+ /** End offset in the original text (exclusive) */
21
+ end: number;
22
+ /** The original text of the span. Sensitive: do not log it. */
23
+ value: string;
24
+ /** Which detector found it */
25
+ source: 'regex' | 'model';
26
+ /** Model confidence (0-1). Absent for regex matches. */
27
+ score?: number;
28
+ }
29
+ /**
30
+ * How a detected entity is replaced.
31
+ * - `'type'` (default): `[EMAIL]`
32
+ * - `'indexed'`: `[EMAIL_1]`, `[EMAIL_2]`. The same value gets the same index within
33
+ * one call, so the text stays coherent for a model reading it.
34
+ * - function: return any replacement string
35
+ */
36
+ type PIIPlaceholder = 'type' | 'indexed' | ((entity: PIIEntity) => string);
37
+ interface PIIRedactOptions {
38
+ /** Only redact these entity types. Default: every type the detector supports. */
39
+ types?: PIIType[];
40
+ /** Never redact these entity types. */
41
+ excludeTypes?: PIIType[];
42
+ /**
43
+ * Values that are never redacted. A string matches a whole entity, ignoring case; a
44
+ * RegExp is tested against the entity's text. Model mode starts from
45
+ * `DEFAULT_PII_ALLOW` (AI product names that read as human names, such as "Claude");
46
+ * pass your own list, or `[]`, to replace it.
47
+ */
48
+ allow?: Array<string | RegExp>;
49
+ /** Replacement style. Default `'type'`. */
50
+ placeholder?: PIIPlaceholder;
51
+ }
52
+ interface PIIRedactResult {
53
+ /** The text with every detected entity replaced */
54
+ text: string;
55
+ /** Detected entities, sorted by position, with offsets into the original text */
56
+ entities: PIIEntity[];
57
+ }
58
+ /** One token as returned by a transformers.js token-classification pipeline. */
59
+ interface PIIToken {
60
+ /** BIO label, e.g. `B-PERSON`, `I-PERSON`, `O` */
61
+ entity: string;
62
+ score: number;
63
+ /** Token position in the tokenized sequence */
64
+ index: number;
65
+ /** Token text, e.g. `sarah` or `##aby` */
66
+ word: string;
67
+ }
68
+ /**
69
+ * A token-classification function. Matches what transformers.js returns from
70
+ * `pipeline('token-classification', model)`, so one can be passed in directly.
71
+ */
72
+ type PIITokenClassifier = (text: string, options?: {
73
+ ignore_labels?: string[];
74
+ }) => Promise<PIIToken[] | PIIToken[][]>;
75
+ interface PIIRedactorConfig extends PIIRedactOptions {
76
+ /**
77
+ * - `'regex'` (default): patterns only. No dependencies, no download.
78
+ * - `'model'`: patterns plus a local CPU model that also finds names, addresses and
79
+ * other free-text PII. Needs `@huggingface/transformers` installed; the model is
80
+ * downloaded from Hugging Face on first use and cached.
81
+ */
82
+ mode?: 'regex' | 'model';
83
+ /** Hugging Face model id (must ship ONNX weights). Default `onnx-community/bert-small-pii-detection-ONNX`. */
84
+ model?: string;
85
+ /** ONNX weight quantization passed to transformers.js. Default `'q8'` (about 29 MB). */
86
+ dtype?: string;
87
+ /** Drop model entities scoring below this (0-1). Default 0.75. */
88
+ minScore?: number;
89
+ /** Directory for downloaded model files. Default: the transformers.js cache. */
90
+ cacheDir?: string;
91
+ /** Rename model labels to entity types, merged over the built-in map. */
92
+ labelMap?: Record<string, PIIType>;
93
+ /**
94
+ * Bring your own classifier instead of letting the SDK load one. Use this in a
95
+ * bundled or browser build, or to share a pipeline you already created.
96
+ */
97
+ classifier?: PIITokenClassifier;
98
+ }
99
+ interface PIIRedactor {
100
+ /** Find PII without changing the text. */
101
+ detect(text: string): Promise<PIIEntity[]>;
102
+ /** Replace PII with placeholders. */
103
+ redact(text: string): Promise<PIIRedactResult>;
104
+ /** Load the model now instead of on the first call. No-op in regex mode. */
105
+ load(): Promise<void>;
106
+ }
107
+
108
+ export type { PIIEntity, PIIPlaceholder, PIIRedactOptions, PIIRedactResult, PIIRedactor, PIIRedactorConfig, PIIToken, PIITokenClassifier, PIIType, RegexPIIType };
@@ -0,0 +1 @@
1
+