@aglyn/plugins-ai 1.0.0-beta.235 → 1.0.0-beta.237

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 (98) hide show
  1. package/package.json +17 -17
  2. package/src/lib/components/ai-credits-prompt.component.d.ts +37 -0
  3. package/src/lib/components/ai-credits-prompt.component.js +67 -0
  4. package/src/lib/components/ai-credits-prompt.component.js.map +1 -0
  5. package/src/lib/components/ai-job-plan.component.d.ts +5 -4
  6. package/src/lib/components/ai-job-plan.component.js +37 -12
  7. package/src/lib/components/ai-job-plan.component.js.map +1 -1
  8. package/src/lib/components/ai-job-requests.d.ts +10 -0
  9. package/src/lib/components/ai-job-requests.js +12 -4
  10. package/src/lib/components/ai-job-requests.js.map +1 -1
  11. package/src/lib/components/ai-site-build-page.component.js +26 -7
  12. package/src/lib/components/ai-site-build-page.component.js.map +1 -1
  13. package/src/lib/components/ai-site-start-card.component.js +68 -22
  14. package/src/lib/components/ai-site-start-card.component.js.map +1 -1
  15. package/src/lib/components/assist-build-card.component.d.ts +3 -1
  16. package/src/lib/components/assist-build-card.component.js +58 -7
  17. package/src/lib/components/assist-build-card.component.js.map +1 -1
  18. package/src/lib/components/assist-jobs-drawer.component.js +54 -6
  19. package/src/lib/components/assist-jobs-drawer.component.js.map +1 -1
  20. package/src/lib/components/assist-panel.component.js +2 -1
  21. package/src/lib/components/assist-panel.component.js.map +1 -1
  22. package/src/lib/jobs/ai-job-admission.d.ts +22 -2
  23. package/src/lib/jobs/ai-job-admission.js.map +1 -1
  24. package/src/lib/jobs/ai-job-build-step.d.ts +24 -11
  25. package/src/lib/jobs/ai-job-build-step.js +50 -34
  26. package/src/lib/jobs/ai-job-build-step.js.map +1 -1
  27. package/src/lib/jobs/ai-job-layout-language.js +1 -1
  28. package/src/lib/jobs/ai-job-layout-language.js.map +1 -1
  29. package/src/lib/jobs/ai-job-page-language.js +4 -0
  30. package/src/lib/jobs/ai-job-page-language.js.map +1 -1
  31. package/src/lib/jobs/ai-job-page-step.d.ts +13 -0
  32. package/src/lib/jobs/ai-job-page-step.js +34 -3
  33. package/src/lib/jobs/ai-job-page-step.js.map +1 -1
  34. package/src/lib/jobs/ai-job-plan-step.d.ts +23 -0
  35. package/src/lib/jobs/ai-job-plan-step.js +75 -15
  36. package/src/lib/jobs/ai-job-plan-step.js.map +1 -1
  37. package/src/lib/jobs/ai-job-site-content.d.ts +34 -3
  38. package/src/lib/jobs/ai-job-site-content.js +132 -32
  39. package/src/lib/jobs/ai-job-site-content.js.map +1 -1
  40. package/src/lib/jobs/ai-job-site-step.js +45 -15
  41. package/src/lib/jobs/ai-job-site-step.js.map +1 -1
  42. package/src/lib/jobs/ai-job-text-step.d.ts +8 -0
  43. package/src/lib/jobs/ai-job-text-step.js.map +1 -1
  44. package/src/lib/jobs/ai-jobs.d.ts +18 -1
  45. package/src/lib/jobs/ai-jobs.js +29 -13
  46. package/src/lib/jobs/ai-jobs.js.map +1 -1
  47. package/src/lib/jobs/ai-layout-stock-photos.d.ts +105 -18
  48. package/src/lib/jobs/ai-layout-stock-photos.js +356 -114
  49. package/src/lib/jobs/ai-layout-stock-photos.js.map +1 -1
  50. package/src/lib/layout-language/ai-layout-compiler.d.ts +27 -0
  51. package/src/lib/layout-language/ai-layout-compiler.js +78 -11
  52. package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
  53. package/src/lib/layout-language/ai-layout-gaps.js +3 -1
  54. package/src/lib/layout-language/ai-layout-gaps.js.map +1 -1
  55. package/src/lib/layout-language/ai-layout-language.js +1 -1
  56. package/src/lib/layout-language/ai-layout-language.js.map +1 -1
  57. package/src/lib/layout-language/ai-layout-listings.d.ts +37 -1
  58. package/src/lib/layout-language/ai-layout-listings.js +66 -11
  59. package/src/lib/layout-language/ai-layout-listings.js.map +1 -1
  60. package/src/lib/layout-language/ai-layout-pictures.d.ts +2 -1
  61. package/src/lib/layout-language/ai-layout-pictures.js +5 -2
  62. package/src/lib/layout-language/ai-layout-pictures.js.map +1 -1
  63. package/src/lib/model/ai-build-job.d.ts +31 -0
  64. package/src/lib/model/ai-build-job.js +86 -1
  65. package/src/lib/model/ai-build-job.js.map +1 -1
  66. package/src/lib/model/ai-build-progress.d.ts +8 -0
  67. package/src/lib/model/ai-build-progress.js +33 -0
  68. package/src/lib/model/ai-build-progress.js.map +1 -1
  69. package/src/lib/model/ai-credit-estimate.d.ts +182 -0
  70. package/src/lib/model/ai-credit-estimate.js +190 -0
  71. package/src/lib/model/ai-credit-estimate.js.map +1 -0
  72. package/src/lib/model/ai-jobs.types.d.ts +15 -0
  73. package/src/lib/model/ai-jobs.types.js.map +1 -1
  74. package/src/lib/model/ai-site-job.d.ts +59 -22
  75. package/src/lib/model/ai-site-job.js +104 -23
  76. package/src/lib/model/ai-site-job.js.map +1 -1
  77. package/src/lib/model/ai-site-kinds.js +3 -3
  78. package/src/lib/model/ai-site-kinds.js.map +1 -1
  79. package/src/lib/runtime/ai-doctrine-validators.js +10 -1
  80. package/src/lib/runtime/ai-doctrine-validators.js.map +1 -1
  81. package/src/lib/runtime/ai-node-tree.d.ts +11 -0
  82. package/src/lib/runtime/ai-node-tree.js +26 -0
  83. package/src/lib/runtime/ai-node-tree.js.map +1 -1
  84. package/src/lib/runtime/ai-palette.generated.js +539 -7
  85. package/src/lib/runtime/ai-palette.generated.js.map +1 -1
  86. package/src/lib/server/ai-jobs-resume.js +93 -35
  87. package/src/lib/server/ai-jobs-resume.js.map +1 -1
  88. package/src/lib/server/ai-jobs-route.js +45 -4
  89. package/src/lib/server/ai-jobs-route.js.map +1 -1
  90. package/src/lib/server/assist-chat.js +4 -1
  91. package/src/lib/server/assist-chat.js.map +1 -1
  92. package/src/lib/server/assist-edit.js +3 -1
  93. package/src/lib/server/assist-edit.js.map +1 -1
  94. package/src/lib/server/assist-music.d.ts +36 -0
  95. package/src/lib/server/assist-music.js +36 -0
  96. package/src/lib/server/assist-music.js.map +1 -0
  97. package/src/lib/server.js +6 -0
  98. package/src/lib/server.js.map +1 -1
@@ -16,6 +16,7 @@
16
16
  */
17
17
  import { type PluginMediaIngest } from '@aglyn/aglyn/plugin-manager/plugin-media-ingest';
18
18
  import { type StockPhoto, type StockPhotoOrientation, type StockPhotoProvider, type StockPhotoSearchRequest } from '@aglyn/aglyn/plugin-manager/stock-photo-provider';
19
+ import type { NodesMap } from '@aglyn/aglyn/types/nodes';
19
20
  import { type AiLayoutPictureSlot, type AiLayoutPictureSource } from '../layout-language/ai-layout-pictures';
20
21
  /**
21
22
  * STOCK PHOTOS FOR A LANGUAGE PAGE'S PICTURE SLOTS (AGL-3660).
@@ -28,17 +29,33 @@ import { type AiLayoutPictureSlot, type AiLayoutPictureSource } from '../layout-
28
29
  *
29
30
  * For each slot, in document order:
30
31
  *
31
- * 1. **Search.** Plain words: the kind of business (the head of the site's
32
- * business type, "yoga studio" from "a family-owned yoga studio in
33
- * Austin") for the hero; the picture's own subject (the content words of
34
- * the alt text the model wrote, else its section's name) with the business
35
- * for the rest, and an about picture asks for people. The orientation and
36
- * a minimum size come from the slot's frame. The provider caches every
37
- * search for a day and keeps its own rate limit.
38
- * 2. **Pick.** Among the first hits not already on the page, by the job's
39
- * seed and the slot, so two sites built from the same words rarely open
40
- * with the same photo while one job always picks the same.
41
- * 3. **Keep.** A photo the site's library already holds (by its source key)
32
+ * 1. **Search.** Plain words. The hero asks for the kind of business (the
33
+ * head of the site's business type, "yoga studio" from "a family-owned
34
+ * yoga studio in Austin"). Any other picture asks for its SUBJECT: the
35
+ * noun phrase that opens the alt text the model wrote, its filler
36
+ * adjectives dropped ("serving bowl" from "A beautiful hand-thrown serving
37
+ * bowl on a linen cloth"), qualified by the site's craft where the phrase
38
+ * does not already say it ("serving bowl ceramic" for a ceramics studio).
39
+ * An about picture asks for people. The orientation and a minimum size
40
+ * come from the slot's frame. The provider caches every search for a day
41
+ * and keeps its own rate limit; one page never asks the same words twice.
42
+ * 2. **Rank.** A picture of a thing must show the thing: every hit is scored
43
+ * by how many of the subject's words its tags, its description and its
44
+ * page's address name (singular and plural alike, the head noun counting
45
+ * double), and a hit naming none of them never fills a picture of a
46
+ * thing. The live Juniper Clay start put crackers under "Serving bowl"
47
+ * and plants under "Espresso cup". Among the best-scored hits the job's
48
+ * seed picks, so two sites built from the same words rarely open with the
49
+ * same photo while one job always picks the same.
50
+ * 3. **Never twice.** A photo is placed once per job: not twice on a page,
51
+ * and not on a page when another page (or another pass, in this process)
52
+ * of the same job already placed it — the maker's portrait in About is
53
+ * never a vase in Selected work. The caller hands in what the job's other
54
+ * pages hold (`avoid`); a pass repeated over its own page keeps its own.
55
+ * 4. **Fall back.** A picture of a thing nothing relevant answered asks once
56
+ * more for the place itself ("ceramics studio interior"), a neutral photo
57
+ * any caption sits under, before it is left to a starter photo.
58
+ * 5. **Keep.** A photo the site's library already holds (by its source key)
42
59
  * is reused; otherwise its bytes are downloaded from the library and
43
60
  * stored in the site's own media library as the member who started the
44
61
  * job, credited to its photographer. The page names the site's asset,
@@ -51,39 +68,109 @@ import { type AiLayoutPictureSlot, type AiLayoutPictureSource } from '../layout-
51
68
  */
52
69
  /** Wall clock the whole page's photos may take, inside the step's own signal. */
53
70
  export declare const AI_LAYOUT_STOCK_PHOTOS_BUDGET_MS = 20000;
54
- /** Searches one page may ask, cached ones included. */
55
- export declare const AI_LAYOUT_STOCK_SEARCHES_PER_PAGE = 8;
71
+ /** Searches one page may send to the provider; a repeated query is answered from the page's own memory. */
72
+ export declare const AI_LAYOUT_STOCK_SEARCHES_PER_PAGE = 12;
56
73
  /** The hits a pick is made among. */
57
74
  export declare const AI_LAYOUT_STOCK_PICK_WINDOW = 8;
58
75
  /** The largest photo copied: inside one direct upload. */
59
76
  export declare const AI_LAYOUT_STOCK_MAX_BYTES: number;
77
+ /**
78
+ * The unit job input naming the screen drafts the job's other pages were
79
+ * written to, whose photos a page does not place again (AGL-3660).
80
+ */
81
+ export declare const AI_STOCK_PHOTO_PAGES_INPUT = "stockPhotoPages";
82
+ /**
83
+ * A word's singular, for matching only: "bowls" and "bowl", "vases" and
84
+ * "vase", "berries" and "berry", "dishes" and "dish" meet. Both sides of a
85
+ * comparison are reduced the same way, so an odd stem still matches itself.
86
+ */
87
+ export declare function aiStockStem(word: string): string;
60
88
  /**
61
89
  * The kind of business in a few words: the first clause of the business
62
90
  * type, before a place or an audience, its last three content words (the
63
91
  * head of an English noun phrase is at its end).
64
92
  */
65
93
  export declare function aiStockBusinessWords(businessType: string): string;
66
- /** A picture's subject in a few words: its alt text's first content words, else its section's name. */
94
+ /**
95
+ * The business's craft in one word: the last of its words that is not the
96
+ * place it is done in, singular — "ceramic" from "small-batch ceramics
97
+ * studio", "yoga" from "yoga studio". Empty when the business is only a
98
+ * place ("a shop").
99
+ */
100
+ export declare function aiStockCraftWords(business: string): string;
101
+ /**
102
+ * A picture's subject in a few words (AGL-3660): the noun phrase its alt
103
+ * text opens with — its first clause holding more than filler, cut where a
104
+ * preposition starts the setting, filler dropped, its last three words (the
105
+ * head noun is the last) — else its section's name.
106
+ */
67
107
  export declare function aiStockSubjectWords(alt: string, sectionName: string): string;
68
108
  /** The frame's orientation: a wide frame wants a landscape photo, a tall one a portrait. */
69
109
  export declare function aiStockOrientation(aspect: number): StockPhotoOrientation;
110
+ /**
111
+ * One search a slot tries. A gallery picture's searches must find a hit
112
+ * naming its subject; a `neutral` one asks for the place itself, which any
113
+ * caption sits under.
114
+ */
115
+ export interface AiStockSearch extends StockPhotoSearchRequest {
116
+ neutral?: boolean;
117
+ }
70
118
  /** The searches a slot tries, in order, most specific first, each distinct. */
71
119
  export declare function aiStockSearchesFor(slot: Pick<AiLayoutPictureSlot, 'role' | 'alt' | 'aspect'>, words: {
72
120
  business: string;
73
121
  subject: string;
74
- }): StockPhotoSearchRequest[];
75
- /** The pick among a search's hits: not on the page yet, among the first few, by the seed. */
76
- export declare function aiStockPick(photos: readonly StockPhoto[], used: ReadonlySet<string>, seed: string): StockPhoto | null;
122
+ craft?: string;
123
+ }): AiStockSearch[];
124
+ /**
125
+ * How well a hit names a subject (AGL-3660): each subject word its tags, its
126
+ * description or its page's address names counts once, the head noun (the
127
+ * subject's last word) twice, and a craft word a quarter, as a tiebreak.
128
+ * Zero when it names none of the subject.
129
+ */
130
+ export declare function aiStockRelevance(photo: Pick<StockPhoto, 'tags' | 'alt' | 'pageUrl'>, terms: {
131
+ subject: string;
132
+ craft?: string;
133
+ }): number;
134
+ export interface AiStockRankOptions {
135
+ /** The words a hit is scored by; none, and every hit scores alike. */
136
+ subject?: string;
137
+ craft?: string;
138
+ /** A hit naming none of the subject is no candidate at all. */
139
+ strict?: boolean;
140
+ }
141
+ /**
142
+ * A search's hits in the order they are tried (AGL-3660): those not placed
143
+ * yet, among the first few, best-scored first; the seed turns the hits that
144
+ * score alike, so two jobs differ and one job repeats itself.
145
+ */
146
+ export declare function aiStockRank(photos: readonly StockPhoto[], used: ReadonlySet<string>, seed: string, options?: AiStockRankOptions): StockPhoto[];
147
+ /** The pick among a search's hits: the first {@link aiStockRank} would try, or `null`. */
148
+ export declare function aiStockPick(photos: readonly StockPhoto[], used: ReadonlySet<string>, seed: string, options?: AiStockRankOptions): StockPhoto | null;
149
+ /**
150
+ * The library photos a stored page already shows: every `image` whose
151
+ * source is the site's media reference. Starter photos are the platform's,
152
+ * not the job's, and are not listed.
153
+ */
154
+ export declare function aiStockPlacedSrcs(nodes: NodesMap | null | undefined): string[];
155
+ /** Forgets every job's placed photos; for specs. */
156
+ export declare function aiStockForgetJobPhotos(): void;
77
157
  export interface AiLayoutStockPhotoSourceInput {
78
158
  hostId: string;
79
159
  /** The member the photos are stored as: the job's creator. */
80
160
  uid: string;
81
- /** The job's seed, as the starter photos turn by. */
161
+ /** The job's seed, as the starter photos turn by; also the scope a photo is placed under. */
82
162
  seed: string;
83
163
  /** The site's business type, else the job's brief. */
84
164
  business: string;
85
165
  /** The page's section names, by plan index. */
86
166
  sectionNames: readonly string[];
167
+ /**
168
+ * The job the member started (`aiOriginJobId`), so a photo is placed once
169
+ * across its pages. Absent, only the page itself is kept free of repeats.
170
+ */
171
+ jobId?: string;
172
+ /** Asset srcs or source keys the job's other pages already show. */
173
+ avoid?: readonly string[];
87
174
  signal?: AbortSignal;
88
175
  }
89
176
  export interface AiLayoutStockPhotoDeps {