@aglyn/plugins-ai 1.0.0-beta.293 → 1.0.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/components/ai-job-links.d.ts +17 -3
- package/src/lib/components/ai-job-links.js +32 -5
- package/src/lib/components/ai-job-links.js.map +1 -1
- package/src/lib/components/ai-job-requests.d.ts +9 -0
- package/src/lib/components/ai-job-requests.js +34 -0
- package/src/lib/components/ai-job-requests.js.map +1 -1
- package/src/lib/components/ai-site-build-page.component.js +28 -2
- package/src/lib/components/ai-site-build-page.component.js.map +1 -1
- package/src/lib/components/assist-edit-canvas.d.ts +12 -6
- package/src/lib/components/assist-edit-canvas.js +86 -36
- package/src/lib/components/assist-edit-canvas.js.map +1 -1
- package/src/lib/components/assist-edit-card.component.js +9 -8
- package/src/lib/components/assist-edit-card.component.js.map +1 -1
- package/src/lib/components/assist-jobs-drawer.component.d.ts +7 -1
- package/src/lib/components/assist-jobs-drawer.component.js +20 -6
- package/src/lib/components/assist-jobs-drawer.component.js.map +1 -1
- package/src/lib/components/assist-page-change-card.component.d.ts +44 -0
- package/src/lib/components/assist-page-change-card.component.js +166 -0
- package/src/lib/components/assist-page-change-card.component.js.map +1 -0
- package/src/lib/components/assist-panel.component.d.ts +105 -1
- package/src/lib/components/assist-panel.component.js +242 -36
- package/src/lib/components/assist-panel.component.js.map +1 -1
- package/src/lib/jobs/ai-job-edit-step.d.ts +82 -16
- package/src/lib/jobs/ai-job-edit-step.js +209 -62
- package/src/lib/jobs/ai-job-edit-step.js.map +1 -1
- package/src/lib/jobs/ai-job-navigation-step.js +4 -2
- package/src/lib/jobs/ai-job-navigation-step.js.map +1 -1
- package/src/lib/model/ai-edit-job.d.ts +33 -16
- package/src/lib/model/ai-edit-job.js +50 -34
- package/src/lib/model/ai-edit-job.js.map +1 -1
- package/src/lib/model/ai-job-activity.d.ts +6 -11
- package/src/lib/model/ai-job-activity.js +8 -15
- package/src/lib/model/ai-job-activity.js.map +1 -1
- package/src/lib/model/ai-job-notice.js +3 -1
- package/src/lib/model/ai-job-notice.js.map +1 -1
- package/src/lib/model/ai-jobs.types.d.ts +6 -0
- package/src/lib/model/ai-jobs.types.js.map +1 -1
- package/src/lib/model/ai-site-inventory.d.ts +6 -0
- package/src/lib/model/ai-site-inventory.js.map +1 -1
- package/src/lib/model/assist-edit.d.ts +19 -1
- package/src/lib/model/assist-edit.js +7 -0
- package/src/lib/model/assist-edit.js.map +1 -1
- package/src/lib/model/assist-page-change.d.ts +100 -0
- package/src/lib/model/assist-page-change.js +107 -0
- package/src/lib/model/assist-page-change.js.map +1 -0
- package/src/lib/runtime/ai-eval.js +3 -1
- package/src/lib/runtime/ai-eval.js.map +1 -1
- package/src/lib/runtime/ai-node-tree.d.ts +5 -0
- package/src/lib/runtime/ai-node-tree.js +18 -3
- package/src/lib/runtime/ai-node-tree.js.map +1 -1
- package/src/lib/runtime/site-inventory.d.ts +8 -1
- package/src/lib/runtime/site-inventory.js +18 -0
- package/src/lib/runtime/site-inventory.js.map +1 -1
- package/src/lib/server/assist-build.js +2 -0
- package/src/lib/server/assist-build.js.map +1 -1
- package/src/lib/server/assist-chat.js +56 -3
- package/src/lib/server/assist-chat.js.map +1 -1
- package/src/lib/server/assist-edit.d.ts +61 -4
- package/src/lib/server/assist-edit.js +248 -38
- package/src/lib/server/assist-edit.js.map +1 -1
- package/src/lib/server/assist-page-change.d.ts +62 -0
- package/src/lib/server/assist-page-change.js +140 -0
- package/src/lib/server/assist-page-change.js.map +1 -0
|
@@ -23,6 +23,8 @@ import type { AiJob, AiJobOutput } from '../model/ai-jobs.types';
|
|
|
23
23
|
import { type AssistEditCanvasContext, type AssistEditOp, type AssistEditProposal, type AssistEditTarget } from '../model/assist-edit';
|
|
24
24
|
import { type AiCustomGenerationInput } from '../runtime/ai-doctrine';
|
|
25
25
|
import type { AiSystemBlock } from '../runtime/ai-runtime';
|
|
26
|
+
import { readAiSiteDatasets } from '../runtime/site-inventory';
|
|
27
|
+
import { type AssistEditDataset, type AssistEditDatasetScope } from '../server/assist-edit';
|
|
26
28
|
import { type AiJobAdmission } from './ai-job-admission';
|
|
27
29
|
import { type AiJobStepRunner } from './ai-job-text-step';
|
|
28
30
|
/**
|
|
@@ -39,13 +41,19 @@ import { type AiJobStepRunner } from './ai-job-text-step';
|
|
|
39
41
|
*
|
|
40
42
|
* ── Where the change lands, decided before anything is spent ────────────
|
|
41
43
|
*
|
|
42
|
-
* Never on a version a visitor sees.
|
|
43
|
-
*
|
|
44
|
-
* the
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
44
|
+
* Never on a version a visitor sees. By default, on every plan, in the
|
|
45
|
+
* WORKING DRAFT of the version it started from (AGL-4116): the one document
|
|
46
|
+
* the Besigner saves to as an author works and offers with Open draft, which
|
|
47
|
+
* publishing moves into the version. The change is built on the draft the
|
|
48
|
+
* author already has, when the Besigner would still offer it, so their work
|
|
49
|
+
* in progress is never thrown away; otherwise on the version's own tree.
|
|
50
|
+
*
|
|
51
|
+
* Only when the request asks for a new version, and the plan keeps version
|
|
52
|
+
* history, a NEW version beside the one it started from — a copy of that
|
|
53
|
+
* version's stored fields with the changed nodes — which becomes the page's
|
|
54
|
+
* current version only when the page is not published; a published page's
|
|
55
|
+
* current version, and a layout's, never move. Asked for without version
|
|
56
|
+
* history, the change goes into the draft and the output says why.
|
|
49
57
|
*
|
|
50
58
|
* ── What a job cannot do that the editor can ────────────────────────────
|
|
51
59
|
*
|
|
@@ -59,8 +67,8 @@ import { type AiJobStepRunner } from './ai-job-text-step';
|
|
|
59
67
|
*
|
|
60
68
|
* The new version is named by the job's id — a build's unit is named by its
|
|
61
69
|
* plan item's id — so a run asked again finds what it wrote and spends
|
|
62
|
-
* nothing. A
|
|
63
|
-
*
|
|
70
|
+
* nothing. A draft the job writes is stamped with the job's id for the same
|
|
71
|
+
* reason.
|
|
64
72
|
*/
|
|
65
73
|
/** The longest the step may take reading the page and writing it. */
|
|
66
74
|
export declare const AI_EDIT_READS_MS = 2000;
|
|
@@ -76,11 +84,22 @@ export declare function aiJobEditModel(): string;
|
|
|
76
84
|
export declare const AI_JOB_EDIT_RULES: AiSystemBlock;
|
|
77
85
|
/** The system blocks for one kind of document. */
|
|
78
86
|
export declare function aiJobEditInstructions(kind: AiEditTargetKind): AiSystemBlock[];
|
|
79
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* What the change is asked from: the document's outline, the site's datasets
|
|
89
|
+
* an element may show the records of (AGL-3616), then the request.
|
|
90
|
+
*/
|
|
80
91
|
export declare function aiJobEditPrompt(input: {
|
|
81
92
|
brief: string;
|
|
82
93
|
context: AssistEditCanvasContext;
|
|
94
|
+
datasets?: readonly AssistEditDataset[];
|
|
83
95
|
}): string;
|
|
96
|
+
/**
|
|
97
|
+
* The datasets an edit to this document knows (AGL-3616): every one the site
|
|
98
|
+
* holds, and the one whose record page the document is, if it is one.
|
|
99
|
+
*/
|
|
100
|
+
export declare function aiEditDatasetScope(datasets: ReadonlyArray<AssistEditDataset & {
|
|
101
|
+
recordScreenId?: string;
|
|
102
|
+
}>, read: Pick<AiEditTargetRead, 'kind' | 'id'>): Required<AssistEditDatasetScope>;
|
|
84
103
|
/** The edit as the doctrine's loop runs it: the rung's tool, held to the rung's check. */
|
|
85
104
|
export declare function aiJobEditGeneration(request: {
|
|
86
105
|
brief: string;
|
|
@@ -88,7 +107,7 @@ export declare function aiJobEditGeneration(request: {
|
|
|
88
107
|
target: AssistEditTarget;
|
|
89
108
|
model: string;
|
|
90
109
|
signal?: AbortSignal;
|
|
91
|
-
}): AiCustomGenerationInput<AssistEditProposal>;
|
|
110
|
+
} & AssistEditDatasetScope): AiCustomGenerationInput<AssistEditProposal>;
|
|
92
111
|
/** A canvas over a stored node map, with the editor's own guarded mutators and no editor. */
|
|
93
112
|
export declare function aiEditCanvas(nodes: NodesMap): CanvasManager;
|
|
94
113
|
/**
|
|
@@ -115,7 +134,16 @@ export interface AiEditTargetRead {
|
|
|
115
134
|
pointerVersionId: string | null;
|
|
116
135
|
/** The version the change starts from. */
|
|
117
136
|
sourceVersionId: string;
|
|
137
|
+
/** The version's own tree. */
|
|
118
138
|
nodes: NodesMap;
|
|
139
|
+
/**
|
|
140
|
+
* The version's working draft, when it has one the Besigner would still
|
|
141
|
+
* offer: an author's saved work in progress, which a change to the draft
|
|
142
|
+
* is built on. Null when there is none, or the version was saved since.
|
|
143
|
+
*/
|
|
144
|
+
draft: {
|
|
145
|
+
nodes: NodesMap;
|
|
146
|
+
} | null;
|
|
119
147
|
/** Whether visitors see the document's current version: a published page, a collection template, any layout. */
|
|
120
148
|
served: boolean;
|
|
121
149
|
/** The version a pending publish schedule will make current, if any. */
|
|
@@ -152,14 +180,29 @@ export declare function aiEditPlacement(input: {
|
|
|
152
180
|
sourceIsPointer: boolean;
|
|
153
181
|
sourceScheduled: boolean;
|
|
154
182
|
}): AiEditPlacement | 'refused';
|
|
183
|
+
/**
|
|
184
|
+
* Where an edit job's change lands (AGL-4116): the version's working draft,
|
|
185
|
+
* unless the request asked for a new version and the plan keeps version
|
|
186
|
+
* history — then where {@link aiEditPlacement} puts a new one. Never refused:
|
|
187
|
+
* a draft is on every plan, and no visitor sees it.
|
|
188
|
+
*/
|
|
189
|
+
export declare function aiEditJobPlacement(input: {
|
|
190
|
+
newVersion: boolean;
|
|
191
|
+
versioning: boolean;
|
|
192
|
+
served: boolean;
|
|
193
|
+
sourceIsPointer: boolean;
|
|
194
|
+
sourceScheduled: boolean;
|
|
195
|
+
}): AiEditPlacement;
|
|
155
196
|
export interface AiEditWriteInput {
|
|
156
197
|
hostId: string;
|
|
157
198
|
kind: AiEditTargetKind;
|
|
158
199
|
id: string;
|
|
159
200
|
sourceVersionId: string;
|
|
160
|
-
/** The new version's id, which is the job's; also the stamp a
|
|
201
|
+
/** The new version's id, which is the job's; also the stamp a draft it writes carries. */
|
|
161
202
|
jobVersionId: string;
|
|
162
203
|
versioning: boolean;
|
|
204
|
+
/** The request asked for a new version (see {@link aiEditJobPlacement}). */
|
|
205
|
+
newVersion: boolean;
|
|
163
206
|
proposal: AssistEditProposal;
|
|
164
207
|
/** Whether the page's search fields may be written: a page no visitor reaches. */
|
|
165
208
|
writeSeo: boolean;
|
|
@@ -189,12 +232,35 @@ export declare function writeAiEdit(firestore: Firestore, input: AiEditWriteInpu
|
|
|
189
232
|
export interface AiJobEditStepDeps {
|
|
190
233
|
readTarget?: typeof readAiEditTarget;
|
|
191
234
|
writeEdit?: typeof writeAiEdit;
|
|
235
|
+
readDatasets?: typeof readAiSiteDatasets;
|
|
236
|
+
clearMirror?: typeof clearAiEditMirror;
|
|
192
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* Clears the co-edit mirror of the version whose draft a job just wrote
|
|
240
|
+
* (AGL-4116), as the Besigner's own Save draft does.
|
|
241
|
+
*
|
|
242
|
+
* The mirror holds unsaved canvas work and replays everything newer than the
|
|
243
|
+
* version's last save to whoever opens it. A draft write does not move the
|
|
244
|
+
* version's save, so without this the canvas of someone who had opened the
|
|
245
|
+
* older draft replays over the change the job just saved, and a room with
|
|
246
|
+
* replayed work offers no draft at all: the newer draft can only be reached by
|
|
247
|
+
* a Discard that deletes it. Best effort: a mirror that cannot be cleared
|
|
248
|
+
* leaves the draft saved, and the job reports what it wrote.
|
|
249
|
+
*/
|
|
250
|
+
export declare function clearAiEditMirror(input: {
|
|
251
|
+
orgId: string;
|
|
252
|
+
hostId: string;
|
|
253
|
+
kind: AiEditTargetKind;
|
|
254
|
+
id: string;
|
|
255
|
+
versionId: string;
|
|
256
|
+
}): Promise<void>;
|
|
193
257
|
/** What an edit wrote, as the job's output: a link into the Besigner on the version written. */
|
|
194
258
|
export declare function aiEditOutput(read: Pick<AiEditTargetRead, 'kind' | 'id' | 'name' | 'hostSubdomain'>, hostId: string, written: {
|
|
195
259
|
versionId: string;
|
|
196
260
|
placement: AiEditPlacement;
|
|
197
|
-
}, leftOut: readonly string[]
|
|
261
|
+
}, leftOut: readonly string[], options?: {
|
|
262
|
+
versionsUnavailable?: boolean;
|
|
263
|
+
}): AiJobOutput;
|
|
198
264
|
/** The new version's id: the job's own, which a build's unit takes from its plan item. */
|
|
199
265
|
export declare function aiEditVersionId(job: Pick<AiJob, '$id'>): string;
|
|
200
266
|
/**
|
|
@@ -214,9 +280,9 @@ export interface AiEditJobAdmissionDeps {
|
|
|
214
280
|
ownerOf?: typeof resolveOrgIdForHost;
|
|
215
281
|
}
|
|
216
282
|
/**
|
|
217
|
-
* An edit job is admitted for a page or layout of a site of its own org
|
|
218
|
-
*
|
|
219
|
-
*
|
|
283
|
+
* An edit job is admitted for a page or layout of a site of its own org that
|
|
284
|
+
* has a version to start from. Every plan has somewhere to put the change
|
|
285
|
+
* that no visitor sees — the version's draft — so no plan is refused.
|
|
220
286
|
*/
|
|
221
287
|
export declare function createAiEditJobAdmission(deps?: AiEditJobAdmissionDeps): AiJobAdmission;
|
|
222
288
|
export declare const aiEditJobAdmission: AiJobAdmission;
|