@aglyn/plugins-ai 1.17.0 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +17 -17
- package/src/lib/jobs/ai-job-import-step.js +7 -4
- package/src/lib/jobs/ai-job-import-step.js.map +1 -1
- package/src/lib/jobs/ai-job-page-step.js +7 -4
- package/src/lib/jobs/ai-job-page-step.js.map +1 -1
- package/src/lib/jobs/ai-layout-stock-photos.d.ts +9 -0
- package/src/lib/jobs/ai-layout-stock-photos.js +4 -0
- package/src/lib/jobs/ai-layout-stock-photos.js.map +1 -1
- package/src/lib/jobs/ai-site-import-actions.d.ts +35 -0
- package/src/lib/jobs/ai-site-import-actions.js +215 -0
- package/src/lib/jobs/ai-site-import-actions.js.map +1 -0
- package/src/lib/jobs/ai-site-import-compile.d.ts +7 -0
- package/src/lib/jobs/ai-site-import-compile.js +34 -4
- package/src/lib/jobs/ai-site-import-compile.js.map +1 -1
- package/src/lib/jobs/ai-site-import-improve.d.ts +1 -19
- package/src/lib/jobs/ai-site-import-improve.js +61 -196
- package/src/lib/jobs/ai-site-import-improve.js.map +1 -1
- package/src/lib/jobs/ai-site-import-plan.d.ts +52 -0
- package/src/lib/jobs/ai-site-import-plan.js +146 -3
- package/src/lib/jobs/ai-site-import-plan.js.map +1 -1
- package/src/lib/model/ai-site-import-fidelity.d.ts +6 -0
- package/src/lib/model/ai-site-import-fidelity.js +88 -10
- package/src/lib/model/ai-site-import-fidelity.js.map +1 -1
- package/src/lib/model/ai-site-import-marks.d.ts +7 -0
- package/src/lib/model/ai-site-import-marks.js +14 -0
- package/src/lib/model/ai-site-import-marks.js.map +1 -1
- package/src/lib/model/ai-site-import.d.ts +11 -1
- package/src/lib/model/ai-site-import.js +14 -2
- package/src/lib/model/ai-site-import.js.map +1 -1
- package/src/lib/site-import/site-import-images.js +9 -6
- package/src/lib/site-import/site-import-images.js.map +1 -1
|
@@ -28,3 +28,10 @@ export declare function aiSiteImportIsBrandMark(picture: {
|
|
|
28
28
|
from?: string | null;
|
|
29
29
|
url?: string | null;
|
|
30
30
|
}): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Whether a picture's alt text is only its file's name (AGL-4152): what a
|
|
33
|
+
* builder fills in where its owner described nothing — "IMG_2459.jpeg",
|
|
34
|
+
* "Screenshot 2026-09-27 at 10.37.16 AM.png", a phone's id. It says nothing
|
|
35
|
+
* of what the picture shows, so it is no description of it.
|
|
36
|
+
*/
|
|
37
|
+
export declare function aiSiteImportAltIsFileName(alt: string | null | undefined): boolean;
|
|
@@ -35,5 +35,19 @@
|
|
|
35
35
|
const split = (text)=>text.replace(/(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])/g, ' ');
|
|
36
36
|
return MARK_WORDS.test(split(file)) || MARK_WORDS.test(split((_picture_alt = picture.alt) != null ? _picture_alt : ''));
|
|
37
37
|
}
|
|
38
|
+
/** A picture file's own ending: what an upload's name ends in, never a description's. */ const FILE_ENDING = /\.(?:jpe?g|jfif|png|gif|webp|avif|heic|heif|tiff?|bmp|svg)$/i;
|
|
39
|
+
/** The names a camera, a phone or a screenshot gives a file before anyone describes it: "IMG_2459", "DSC01234", "PXL_20260927_101500". */ const CAMERA_NAME = /^(?:img|dsc|dscn|dscf|pxl|mvimg|gopr|dji|sam|wp|vid)[\s_-]?\d[\d_-]*$/i;
|
|
40
|
+
/** A phone's or a computer's screenshot, named for when it was taken. */ const SCREENSHOT_NAME = /^screen ?shot[\s_-]+\d{4}-\d{2}-\d{2}\b/i;
|
|
41
|
+
/** An id a phone's or a site builder's upload is named by. */ const UUID_NAME = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
42
|
+
/**
|
|
43
|
+
* Whether a picture's alt text is only its file's name (AGL-4152): what a
|
|
44
|
+
* builder fills in where its owner described nothing — "IMG_2459.jpeg",
|
|
45
|
+
* "Screenshot 2026-09-27 at 10.37.16 AM.png", a phone's id. It says nothing
|
|
46
|
+
* of what the picture shows, so it is no description of it.
|
|
47
|
+
*/ export function aiSiteImportAltIsFileName(alt) {
|
|
48
|
+
const text = (alt != null ? alt : '').replace(/\s+/g, ' ').trim();
|
|
49
|
+
if (!text) return false;
|
|
50
|
+
return FILE_ENDING.test(text) || CAMERA_NAME.test(text) || SCREENSHOT_NAME.test(text) || UUID_NAME.test(text);
|
|
51
|
+
}
|
|
38
52
|
|
|
39
53
|
//# sourceMappingURL=ai-site-import-marks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/model/ai-site-import-marks.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** Words in a picture's file name or alt text that make it a mark, not a photo (AGL-4152). */\nconst MARK_WORDS = /(?:^|[^a-z])(?:logos?|logotype|badges?|emblems?|favicon|wordmark|icons?)(?:[^a-z]|$)/i\n\n/**\n * Whether a picture of the source is a brand's mark rather than a photo\n * (AGL-4152): its file name or its alt text calls it a logo, a badge, an\n * emblem, a wordmark or an icon. A mark is the source's words in a picture: a\n * cover, a photo band or any slot a redesign fills with a photo never takes\n * one, where a client's logo laid under a page's heading read as that page's\n * work. Its address is read by its last part, its words split where it runs\n * them together (\"ClientLogo.jpg\", \"client+logo.png\").\n */\nexport function aiSiteImportIsBrandMark(picture: { alt?: string | null; from?: string | null; url?: string | null }): boolean {\n const address = picture.from ?? picture.url ?? ''\n let file = address.split(/[?#]/)[0]?.split('/').pop() ?? ''\n try {\n file = decodeURIComponent(file.replace(/\\+/g, ' '))\n } catch {\n file = file.replace(/\\+/g, ' ')\n }\n const split = (text: string) => text.replace(/(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])/g, ' ')\n return MARK_WORDS.test(split(file)) || MARK_WORDS.test(split(picture.alt ?? ''))\n}\n"],"names":["MARK_WORDS","aiSiteImportIsBrandMark","picture","address","from","url","file","split","pop","decodeURIComponent","replace","text","test","alt"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,4FAA4F,GAC5F,MAAMA,aAAa;AAEnB;;;;;;;;CAQC,GACD,OAAO,SAASC,wBAAwBC,OAA2E;QACjGA,MAAAA,sBAQ6CA;QAPlDC;IADX,MAAMA,WAAUD,QAAAA,gBAAAA,QAAQE,IAAI,YAAZF,gBAAgBA,QAAQG,GAAG,YAA3BH,OAA+B;IAC/C,IAAII,iBAAOH,kBAAAA,QAAQI,KAAK,CAAC,OAAO,CAAC,EAAE,qBAAxBJ,gBAA0BI,KAAK,CAAC,KAAKC,GAAG,sBAAM;IACzD,IAAI;QACFF,OAAOG,mBAAmBH,KAAKI,OAAO,CAAC,OAAO;IAChD,EAAE,eAAM;QACNJ,OAAOA,KAAKI,OAAO,CAAC,OAAO;IAC7B;IACA,MAAMH,QAAQ,CAACI,OAAiBA,KAAKD,OAAO,CAAC,iDAAiD;IAC9F,OAAOV,WAAWY,IAAI,CAACL,MAAMD,UAAUN,WAAWY,IAAI,CAACL,OAAML,eAAAA,QAAQW,GAAG,YAAXX,eAAe;AAC9E"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/model/ai-site-import-marks.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** Words in a picture's file name or alt text that make it a mark, not a photo (AGL-4152). */\nconst MARK_WORDS = /(?:^|[^a-z])(?:logos?|logotype|badges?|emblems?|favicon|wordmark|icons?)(?:[^a-z]|$)/i\n\n/**\n * Whether a picture of the source is a brand's mark rather than a photo\n * (AGL-4152): its file name or its alt text calls it a logo, a badge, an\n * emblem, a wordmark or an icon. A mark is the source's words in a picture: a\n * cover, a photo band or any slot a redesign fills with a photo never takes\n * one, where a client's logo laid under a page's heading read as that page's\n * work. Its address is read by its last part, its words split where it runs\n * them together (\"ClientLogo.jpg\", \"client+logo.png\").\n */\nexport function aiSiteImportIsBrandMark(picture: { alt?: string | null; from?: string | null; url?: string | null }): boolean {\n const address = picture.from ?? picture.url ?? ''\n let file = address.split(/[?#]/)[0]?.split('/').pop() ?? ''\n try {\n file = decodeURIComponent(file.replace(/\\+/g, ' '))\n } catch {\n file = file.replace(/\\+/g, ' ')\n }\n const split = (text: string) => text.replace(/(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])/g, ' ')\n return MARK_WORDS.test(split(file)) || MARK_WORDS.test(split(picture.alt ?? ''))\n}\n\n/** A picture file's own ending: what an upload's name ends in, never a description's. */\nconst FILE_ENDING = /\\.(?:jpe?g|jfif|png|gif|webp|avif|heic|heif|tiff?|bmp|svg)$/i\n\n/** The names a camera, a phone or a screenshot gives a file before anyone describes it: \"IMG_2459\", \"DSC01234\", \"PXL_20260927_101500\". */\nconst CAMERA_NAME = /^(?:img|dsc|dscn|dscf|pxl|mvimg|gopr|dji|sam|wp|vid)[\\s_-]?\\d[\\d_-]*$/i\n\n/** A phone's or a computer's screenshot, named for when it was taken. */\nconst SCREENSHOT_NAME = /^screen ?shot[\\s_-]+\\d{4}-\\d{2}-\\d{2}\\b/i\n\n/** An id a phone's or a site builder's upload is named by. */\nconst UUID_NAME = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i\n\n/**\n * Whether a picture's alt text is only its file's name (AGL-4152): what a\n * builder fills in where its owner described nothing — \"IMG_2459.jpeg\",\n * \"Screenshot 2026-09-27 at 10.37.16 AM.png\", a phone's id. It says nothing\n * of what the picture shows, so it is no description of it.\n */\nexport function aiSiteImportAltIsFileName(alt: string | null | undefined): boolean {\n const text = (alt ?? '').replace(/\\s+/g, ' ').trim()\n if (!text) return false\n return FILE_ENDING.test(text) || CAMERA_NAME.test(text) || SCREENSHOT_NAME.test(text) || UUID_NAME.test(text)\n}\n"],"names":["MARK_WORDS","aiSiteImportIsBrandMark","picture","address","from","url","file","split","pop","decodeURIComponent","replace","text","test","alt","FILE_ENDING","CAMERA_NAME","SCREENSHOT_NAME","UUID_NAME","aiSiteImportAltIsFileName","trim"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,4FAA4F,GAC5F,MAAMA,aAAa;AAEnB;;;;;;;;CAQC,GACD,OAAO,SAASC,wBAAwBC,OAA2E;QACjGA,MAAAA,sBAQ6CA;QAPlDC;IADX,MAAMA,WAAUD,QAAAA,gBAAAA,QAAQE,IAAI,YAAZF,gBAAgBA,QAAQG,GAAG,YAA3BH,OAA+B;IAC/C,IAAII,iBAAOH,kBAAAA,QAAQI,KAAK,CAAC,OAAO,CAAC,EAAE,qBAAxBJ,gBAA0BI,KAAK,CAAC,KAAKC,GAAG,sBAAM;IACzD,IAAI;QACFF,OAAOG,mBAAmBH,KAAKI,OAAO,CAAC,OAAO;IAChD,EAAE,eAAM;QACNJ,OAAOA,KAAKI,OAAO,CAAC,OAAO;IAC7B;IACA,MAAMH,QAAQ,CAACI,OAAiBA,KAAKD,OAAO,CAAC,iDAAiD;IAC9F,OAAOV,WAAWY,IAAI,CAACL,MAAMD,UAAUN,WAAWY,IAAI,CAACL,OAAML,eAAAA,QAAQW,GAAG,YAAXX,eAAe;AAC9E;AAEA,uFAAuF,GACvF,MAAMY,cAAc;AAEpB,wIAAwI,GACxI,MAAMC,cAAc;AAEpB,uEAAuE,GACvE,MAAMC,kBAAkB;AAExB,4DAA4D,GAC5D,MAAMC,YAAY;AAElB;;;;;CAKC,GACD,OAAO,SAASC,0BAA0BL,GAA8B;IACtE,MAAMF,OAAO,CAACE,cAAAA,MAAO,IAAIH,OAAO,CAAC,QAAQ,KAAKS,IAAI;IAClD,IAAI,CAACR,MAAM,OAAO;IAClB,OAAOG,YAAYF,IAAI,CAACD,SAASI,YAAYH,IAAI,CAACD,SAASK,gBAAgBJ,IAAI,CAACD,SAASM,UAAUL,IAAI,CAACD;AAC1G"}
|
|
@@ -908,6 +908,14 @@ export interface AiSiteImportState {
|
|
|
908
908
|
* page says so.
|
|
909
909
|
*/
|
|
910
910
|
plan?: AiSiteImportPlan | null;
|
|
911
|
+
/**
|
|
912
|
+
* Why the plan did not pass, line by line (AGL-4152): each miss's code and
|
|
913
|
+
* what it says of the line it found, cut to 300 characters, at most 8, as a
|
|
914
|
+
* redesign's `redesignMissedWhy`. The answer is never stored, and the log
|
|
915
|
+
* names codes alone, so this is what a later read of the job has to
|
|
916
|
+
* diagnose a plan that fell back by. For the job's record; never shown.
|
|
917
|
+
*/
|
|
918
|
+
planMissedWhy?: string[] | null;
|
|
911
919
|
/** The owner saw the plan and started the build (AGL-4152): its proposed page is settled, in or out. */
|
|
912
920
|
planAccepted?: true;
|
|
913
921
|
/** Whether a slot nothing else fills may take a generated picture (AGL-4152); absent is `AI_SITE_IMPORT_GENERATED_PICTURES_DEFAULT`. */
|
|
@@ -1409,8 +1417,10 @@ export declare function aiSiteImportHasRoomForPage(state: Pick<AiSiteImportState
|
|
|
1409
1417
|
* The plan in, or the plan that did not pass (`null`). A proposed page takes
|
|
1410
1418
|
* its place in the wave's rows as a page of its own, new, with no source: its
|
|
1411
1419
|
* words are written from what the site says, so its one line is its purpose.
|
|
1420
|
+
* A plan that did not pass keeps why (`planMissedWhy`); one that passed
|
|
1421
|
+
* clears what an earlier miss said.
|
|
1412
1422
|
*/
|
|
1413
|
-
export declare function aiSiteImportPlanIn(state: AiSiteImportState, wave: Pick<AiSiteImportWave, 'index'>, plan: AiSiteImportPlan | null, at: string, draftId: string): AiSiteImportState;
|
|
1423
|
+
export declare function aiSiteImportPlanIn(state: AiSiteImportState, wave: Pick<AiSiteImportWave, 'index'>, plan: AiSiteImportPlan | null, at: string, draftId: string, why?: readonly string[] | null): AiSiteImportState;
|
|
1414
1424
|
/** A plan with its proposed page's row: pending, unless it is the one row a plan has already added. */
|
|
1415
1425
|
export declare function aiSiteImportPlanRow(state: Pick<AiSiteImportState, 'plan'>, items: readonly AiJobItemLedger[]): AiJobItemLedger[];
|
|
1416
1426
|
/**
|
|
@@ -1438,8 +1438,20 @@ const readChars = (read)=>{
|
|
|
1438
1438
|
* The plan in, or the plan that did not pass (`null`). A proposed page takes
|
|
1439
1439
|
* its place in the wave's rows as a page of its own, new, with no source: its
|
|
1440
1440
|
* words are written from what the site says, so its one line is its purpose.
|
|
1441
|
-
|
|
1442
|
-
|
|
1441
|
+
* A plan that did not pass keeps why (`planMissedWhy`); one that passed
|
|
1442
|
+
* clears what an earlier miss said.
|
|
1443
|
+
*/ export function aiSiteImportPlanIn(state, wave, plan, at, draftId, why) {
|
|
1444
|
+
if (!plan) return _extends({}, state, {
|
|
1445
|
+
plan
|
|
1446
|
+
}, (why == null ? void 0 : why.length) ? {
|
|
1447
|
+
planMissedWhy: why.slice(0, 8).map((line)=>line.slice(0, 300))
|
|
1448
|
+
} : state.planMissedWhy ? {
|
|
1449
|
+
planMissedWhy: null
|
|
1450
|
+
} : {});
|
|
1451
|
+
if (state.planMissedWhy) return aiSiteImportPlanIn(_extends({}, state, {
|
|
1452
|
+
planMissedWhy: null
|
|
1453
|
+
}), wave, plan, at, draftId);
|
|
1454
|
+
if (!plan.proposed) return _extends({}, state, {
|
|
1443
1455
|
plan
|
|
1444
1456
|
});
|
|
1445
1457
|
const proposed = plan.proposed;
|