@aglyn/plugins-ai 1.27.0 → 1.29.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.
Files changed (48) hide show
  1. package/package.json +17 -17
  2. package/src/lib/components/ai-credits-prompt.component.js +4 -1
  3. package/src/lib/components/ai-credits-prompt.component.js.map +1 -1
  4. package/src/lib/components/ai-site-import-job.component.js +5 -2
  5. package/src/lib/components/ai-site-import-job.component.js.map +1 -1
  6. package/src/lib/components/ai-site-start-card.component.js +6 -3
  7. package/src/lib/components/ai-site-start-card.component.js.map +1 -1
  8. package/src/lib/components/assist-build-card.component.js +4 -1
  9. package/src/lib/components/assist-build-card.component.js.map +1 -1
  10. package/src/lib/components/assist-edit-canvas.d.ts +12 -0
  11. package/src/lib/components/assist-edit-canvas.js +38 -7
  12. package/src/lib/components/assist-edit-canvas.js.map +1 -1
  13. package/src/lib/components/assist-jobs-drawer.component.js +4 -1
  14. package/src/lib/components/assist-jobs-drawer.component.js.map +1 -1
  15. package/src/lib/components/assist-panel.component.js +5 -2
  16. package/src/lib/components/assist-panel.component.js.map +1 -1
  17. package/src/lib/declarations.server.js +17 -0
  18. package/src/lib/declarations.server.js.map +1 -1
  19. package/src/lib/jobs/ai-job-drafts.d.ts +5 -11
  20. package/src/lib/jobs/ai-job-drafts.js +8 -25
  21. package/src/lib/jobs/ai-job-drafts.js.map +1 -1
  22. package/src/lib/jobs/ai-job-edit-step.d.ts +95 -5
  23. package/src/lib/jobs/ai-job-edit-step.js +88 -17
  24. package/src/lib/jobs/ai-job-edit-step.js.map +1 -1
  25. package/src/lib/model/ai-edit-job.d.ts +27 -0
  26. package/src/lib/model/ai-edit-job.js +45 -23
  27. package/src/lib/model/ai-edit-job.js.map +1 -1
  28. package/src/lib/model/ai-layout-menus.d.ts +10 -0
  29. package/src/lib/model/ai-layout-menus.js +23 -2
  30. package/src/lib/model/ai-layout-menus.js.map +1 -1
  31. package/src/lib/model/assist-edit.d.ts +2 -0
  32. package/src/lib/model/assist-edit.js.map +1 -1
  33. package/src/lib/runtime/ai-node-tree.d.ts +25 -1
  34. package/src/lib/runtime/ai-node-tree.js +39 -14
  35. package/src/lib/runtime/ai-node-tree.js.map +1 -1
  36. package/src/lib/runtime/ai-palette.generated.js +84 -2
  37. package/src/lib/runtime/ai-palette.generated.js.map +1 -1
  38. package/src/lib/server/ai-page-content.d.ts +83 -0
  39. package/src/lib/server/ai-page-content.js +765 -0
  40. package/src/lib/server/ai-page-content.js.map +1 -0
  41. package/src/lib/server/ai-usage.js +7 -1
  42. package/src/lib/server/ai-usage.js.map +1 -1
  43. package/src/lib/server/assist-edit.d.ts +136 -1
  44. package/src/lib/server/assist-edit.js +124 -47
  45. package/src/lib/server/assist-edit.js.map +1 -1
  46. package/src/lib/usage/ai-usage-wire.d.ts +15 -0
  47. package/src/lib/usage/ai-usage-wire.js +21 -0
  48. package/src/lib/usage/ai-usage-wire.js.map +1 -1
@@ -0,0 +1,83 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import type { PageContentEdit, PageContentEditInput, PageContentEditResult, PageContentElement, PageContentKind, PageContentKindProp, PageContentRead, PageContentReadInput, PageContentRefusal, PageContentService } from '@aglyn/aglyn/plugin-manager/plugin-page-content';
18
+ import { aiEditDatasetScope, clearAiEditMirror, writeAiEdit, type AiEditWriteBase } from '../jobs/ai-job-edit-step';
19
+ import { type AssistEditProposal } from '../model/assist-edit';
20
+ import { readAiSiteDatasets } from '../runtime/site-inventory';
21
+ /** The id a write made with no person behind it is attributed to, beside its label. */
22
+ export declare const AI_PAGE_CONTENT_API_ACTOR = "api";
23
+ /**
24
+ * The base tree's revision (see the module head): which tree, of which
25
+ * version, and a digest of its `nodes` field as stored — the bytes a
26
+ * current document stores, or a legacy map in a key-order-free form.
27
+ */
28
+ export declare function aiPageContentRevision(from: 'draft' | 'saved', versionId: string, stored: unknown): string;
29
+ /**
30
+ * The settings an edit can set on an element of this kind, by name: the
31
+ * palette's declarations with the ones every element takes, less an icon the
32
+ * site owner picks, then the motion settings and the repeat's dataset. Empty
33
+ * for a kind the palette does not list, whose settings the validator cannot
34
+ * check.
35
+ */
36
+ export declare function aiPageContentKindProps(kind: string): Record<string, PageContentKindProp>;
37
+ /** What the palette knows of one kind of element. */
38
+ export declare function aiPageContentKind(kind: string, options?: {
39
+ root?: boolean;
40
+ }): PageContentKind;
41
+ /**
42
+ * A page's elements as a read answers them, every one, depth first in the
43
+ * order the page reads, with what each kind takes. With `elementId`, that
44
+ * element and everything inside it; null when it is not on the page.
45
+ */
46
+ export declare function aiPageContentElements(nodes: Readonly<Record<string, unknown>>, elementId?: string): {
47
+ total: number;
48
+ elements: PageContentElement[];
49
+ kinds: Record<string, PageContentKind>;
50
+ } | null;
51
+ export declare function readAiPageContent(input: PageContentReadInput): Promise<PageContentRead | PageContentRefusal>;
52
+ /** What a built change is, or why the edits were refused. */
53
+ type BuiltEdit = {
54
+ proposal: AssistEditProposal;
55
+ } | {
56
+ refused: PageContentRefusal;
57
+ };
58
+ /**
59
+ * The edits validated against one tree and built into the editor's proposal,
60
+ * or refused with every problem named. Pure: the write calls it with the tree
61
+ * its transaction read, so what is checked is what is written.
62
+ */
63
+ export declare function buildAiPageContentEdit(input: {
64
+ base: Pick<AiEditWriteBase, 'from' | 'nodes' | 'stored'>;
65
+ pageId: string;
66
+ hostId: string;
67
+ versionId: string;
68
+ edits: readonly PageContentEdit[];
69
+ ifRevision?: string;
70
+ screenIds: Iterable<string>;
71
+ mediaScopes: Iterable<string>;
72
+ datasets?: ReturnType<typeof aiEditDatasetScope>;
73
+ }): BuiltEdit;
74
+ export interface AiPageContentDeps {
75
+ writeEdit?: typeof writeAiEdit;
76
+ readDatasets?: typeof readAiSiteDatasets;
77
+ clearMirror?: typeof clearAiEditMirror;
78
+ now?: () => Date;
79
+ }
80
+ export declare function createAiPageContentEditor(deps?: AiPageContentDeps): (input: PageContentEditInput) => Promise<PageContentEditResult | PageContentRefusal>;
81
+ /** The contract's implementation, as the plugin registers it. */
82
+ export declare const aiPageContentService: PageContentService;
83
+ export {};