@aglyn/plugins-ai 1.0.0-beta.227 → 1.0.0-beta.229

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 (109) hide show
  1. package/README.md +1 -1
  2. package/package.json +17 -17
  3. package/src/lib/components/ai-brief-dialog.component.js +1 -1
  4. package/src/lib/components/ai-brief-dialog.component.js.map +1 -1
  5. package/src/lib/components/ai-describe-automation.component.js +7 -2
  6. package/src/lib/components/ai-describe-automation.component.js.map +1 -1
  7. package/src/lib/components/ai-describe-button.component.js +6 -1
  8. package/src/lib/components/ai-describe-button.component.js.map +1 -1
  9. package/src/lib/components/ai-describe-page.component.d.ts +1 -1
  10. package/src/lib/components/ai-describe-page.component.js +1 -1
  11. package/src/lib/components/ai-describe-page.component.js.map +1 -1
  12. package/src/lib/components/ai-job-events.d.ts +7 -1
  13. package/src/lib/components/ai-job-events.js +4 -2
  14. package/src/lib/components/ai-job-events.js.map +1 -1
  15. package/src/lib/components/ai-job-site.d.ts +22 -0
  16. package/src/lib/components/ai-job-site.js +73 -0
  17. package/src/lib/components/ai-job-site.js.map +1 -0
  18. package/src/lib/components/ai-jobs-list-page.component.d.ts +23 -0
  19. package/src/lib/components/ai-jobs-list-page.component.js +314 -0
  20. package/src/lib/components/ai-jobs-list-page.component.js.map +1 -0
  21. package/src/lib/components/ai-jobs-page.component.d.ts +7 -0
  22. package/src/lib/components/ai-jobs-page.component.js +30 -0
  23. package/src/lib/components/ai-jobs-page.component.js.map +1 -0
  24. package/src/lib/components/ai-page-brief-dialog.component.d.ts +1 -1
  25. package/src/lib/components/ai-page-brief-dialog.component.js.map +1 -1
  26. package/src/lib/components/ai-site-build-page.component.d.ts +31 -3
  27. package/src/lib/components/ai-site-build-page.component.js +394 -243
  28. package/src/lib/components/ai-site-build-page.component.js.map +1 -1
  29. package/src/lib/components/ai-site-start-card.component.d.ts +18 -1
  30. package/src/lib/components/ai-site-start-card.component.js +27 -15
  31. package/src/lib/components/ai-site-start-card.component.js.map +1 -1
  32. package/src/lib/components/assist-jobs-drawer.component.d.ts +11 -0
  33. package/src/lib/components/assist-jobs-drawer.component.js +37 -1
  34. package/src/lib/components/assist-jobs-drawer.component.js.map +1 -1
  35. package/src/lib/components/assist-panel.component.js +9 -4
  36. package/src/lib/components/assist-panel.component.js.map +1 -1
  37. package/src/lib/jobs/ai-job-draft-ids.d.ts +6 -0
  38. package/src/lib/jobs/ai-job-draft-ids.js +9 -0
  39. package/src/lib/jobs/ai-job-draft-ids.js.map +1 -1
  40. package/src/lib/jobs/ai-job-drafts.d.ts +7 -0
  41. package/src/lib/jobs/ai-job-drafts.js +16 -7
  42. package/src/lib/jobs/ai-job-drafts.js.map +1 -1
  43. package/src/lib/jobs/ai-job-layout-site-pages.d.ts +70 -0
  44. package/src/lib/jobs/ai-job-layout-site-pages.js +216 -0
  45. package/src/lib/jobs/ai-job-layout-site-pages.js.map +1 -0
  46. package/src/lib/jobs/ai-job-layout-step.d.ts +2 -2
  47. package/src/lib/jobs/ai-job-layout-step.js +21 -2
  48. package/src/lib/jobs/ai-job-layout-step.js.map +1 -1
  49. package/src/lib/jobs/ai-job-page-sections.d.ts +6 -5
  50. package/src/lib/jobs/ai-job-page-sections.js +3 -3
  51. package/src/lib/jobs/ai-job-page-sections.js.map +1 -1
  52. package/src/lib/jobs/ai-job-page-step.d.ts +19 -1
  53. package/src/lib/jobs/ai-job-page-step.js +50 -8
  54. package/src/lib/jobs/ai-job-page-step.js.map +1 -1
  55. package/src/lib/jobs/ai-job-plan-step.js +7 -2
  56. package/src/lib/jobs/ai-job-plan-step.js.map +1 -1
  57. package/src/lib/jobs/ai-job-site-step.d.ts +21 -0
  58. package/src/lib/jobs/ai-job-site-step.js +103 -17
  59. package/src/lib/jobs/ai-job-site-step.js.map +1 -1
  60. package/src/lib/jobs/ai-job-text-step.d.ts +7 -1
  61. package/src/lib/jobs/ai-job-text-step.js.map +1 -1
  62. package/src/lib/jobs/ai-jobs.d.ts +19 -1
  63. package/src/lib/jobs/ai-jobs.js +130 -53
  64. package/src/lib/jobs/ai-jobs.js.map +1 -1
  65. package/src/lib/jobs/ai-site-publish.d.ts +98 -0
  66. package/src/lib/jobs/ai-site-publish.js +372 -0
  67. package/src/lib/jobs/ai-site-publish.js.map +1 -0
  68. package/src/lib/jobs/fixtures/ai-page-briefs.d.ts +7 -6
  69. package/src/lib/jobs/fixtures/ai-page-briefs.js +23 -56
  70. package/src/lib/jobs/fixtures/ai-page-briefs.js.map +1 -1
  71. package/src/lib/model/ai-job-failure-copy.d.ts +20 -1
  72. package/src/lib/model/ai-job-failure-copy.js +28 -1
  73. package/src/lib/model/ai-job-failure-copy.js.map +1 -1
  74. package/src/lib/model/ai-job-notice.d.ts +6 -1
  75. package/src/lib/model/ai-job-notice.js +29 -3
  76. package/src/lib/model/ai-job-notice.js.map +1 -1
  77. package/src/lib/model/ai-jobs.types.d.ts +34 -0
  78. package/src/lib/model/ai-jobs.types.js.map +1 -1
  79. package/src/lib/model/ai-plan-capabilities.d.ts +25 -10
  80. package/src/lib/model/ai-plan-capabilities.js +15 -2
  81. package/src/lib/model/ai-plan-capabilities.js.map +1 -1
  82. package/src/lib/model/ai-site-build-progress.d.ts +25 -1
  83. package/src/lib/model/ai-site-build-progress.js +129 -15
  84. package/src/lib/model/ai-site-build-progress.js.map +1 -1
  85. package/src/lib/model/ai-site-start-seo.d.ts +35 -0
  86. package/src/lib/model/ai-site-start-seo.js +145 -7
  87. package/src/lib/model/ai-site-start-seo.js.map +1 -1
  88. package/src/lib/model/ai-site-start.d.ts +14 -0
  89. package/src/lib/model/ai-site-start.js +43 -0
  90. package/src/lib/model/ai-site-start.js.map +1 -1
  91. package/src/lib/plugin.js +18 -10
  92. package/src/lib/plugin.js.map +1 -1
  93. package/src/lib/runtime/ai-doctrine-validators.d.ts +16 -12
  94. package/src/lib/runtime/ai-doctrine-validators.js +19 -36
  95. package/src/lib/runtime/ai-doctrine-validators.js.map +1 -1
  96. package/src/lib/runtime/ai-doctrine.d.ts +6 -0
  97. package/src/lib/runtime/ai-doctrine.js +6 -2
  98. package/src/lib/runtime/ai-doctrine.js.map +1 -1
  99. package/src/lib/runtime/ai-eval-live.d.ts +1 -1
  100. package/src/lib/runtime/ai-eval-live.js +1 -1
  101. package/src/lib/runtime/ai-eval-live.js.map +1 -1
  102. package/src/lib/server/ai-jobs-live-sites.d.ts +26 -0
  103. package/src/lib/server/ai-jobs-live-sites.js +58 -0
  104. package/src/lib/server/ai-jobs-live-sites.js.map +1 -0
  105. package/src/lib/server/ai-jobs-route.js +22 -3
  106. package/src/lib/server/ai-jobs-route.js.map +1 -1
  107. package/src/lib/usage/assist-job-refund.d.ts +3 -2
  108. package/src/lib/usage/assist-job-refund.js +2 -1
  109. package/src/lib/usage/assist-job-refund.js.map +1 -1
@@ -0,0 +1,23 @@
1
+ import type { ConsolePluginPageProps } from '@aglyn/aglyn/plugin-manager/feature-plugins';
2
+ import type { AiJobSummary } from '../model/ai-jobs.types';
3
+ /**
4
+ * A site's AI jobs (AGL-3596), at `/ai-jobs` under the site: every job that
5
+ * worked on this site, newest first, each linking to its own page.
6
+ *
7
+ * Read through the jobs route, never Firestore, so the membership, flag and
8
+ * plan rungs that answer every other jobs read answer this one. The site is
9
+ * a query on the route (`hostId`), not a filter of the workspace's list.
10
+ *
11
+ * Every wait ends: the site's read and the list's each settle on content,
12
+ * the empty state, or a sentence with Try again.
13
+ */
14
+ /** The most jobs the page lists; the newest, which is what a person comes for. */
15
+ export declare const AI_JOBS_PAGE_LIMIT = 50;
16
+ /** How long the list may take before the page says it could not be loaded. */
17
+ export declare const AI_JOBS_LIST_TIMEOUT_MS = 20000;
18
+ /** What a job cost the person: what it spent, less what we refunded. */
19
+ export declare function aiJobNetCredits(job: Pick<AiJobSummary, 'creditsSpent' | 'refundedCredits'>): number;
20
+ /** The kind as a row names it: `Site`, `Page`, `AI job`. */
21
+ export declare function aiJobKindLabel(kind: AiJobSummary['kind']): string;
22
+ export declare function AiJobsListPage({ hostId, basePath }: ConsolePluginPageProps): import("react").JSX.Element;
23
+ export default AiJobsListPage;
@@ -0,0 +1,314 @@
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
+ */ 'use client';
17
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
18
+ import { PLATFORM_BRAND_NAME } from "@aglyn/aglyn";
19
+ import { aiJobRefundCopy } from "../model/ai-job-failure-copy.js";
20
+ import { AppLink } from "@aglyn/shared-ui-jsx";
21
+ import { authorizedFetch } from "@aglyn/shared-util-http/authorized-token";
22
+ import { useUser } from "@aglyn/tenant-feature-instance";
23
+ import { Alert, Box, Button, Card, Chip, CircularProgress, Container, List, ListItemButton, Stack, Typography } from "@mui/material";
24
+ import { useCallback, useEffect, useRef, useState } from "react";
25
+ import { AI_JOB_PHASE_LABELS, aiJobKindNoun, aiJobPhase } from "../model/ai-job-activity.js";
26
+ import { publishAiJob } from "./ai-jobs-store.js";
27
+ import { useAiJobSite } from "./ai-job-site.js";
28
+ /**
29
+ * A site's AI jobs (AGL-3596), at `/ai-jobs` under the site: every job that
30
+ * worked on this site, newest first, each linking to its own page.
31
+ *
32
+ * Read through the jobs route, never Firestore, so the membership, flag and
33
+ * plan rungs that answer every other jobs read answer this one. The site is
34
+ * a query on the route (`hostId`), not a filter of the workspace's list.
35
+ *
36
+ * Every wait ends: the site's read and the list's each settle on content,
37
+ * the empty state, or a sentence with Try again.
38
+ */ /** The most jobs the page lists; the newest, which is what a person comes for. */ export const AI_JOBS_PAGE_LIMIT = 50;
39
+ /** How long the list may take before the page says it could not be loaded. */ export const AI_JOBS_LIST_TIMEOUT_MS = 20000;
40
+ /** How much of a brief a row shows. */ const BRIEF_PREVIEW_CHARS = 120;
41
+ /** A row's chip, colored as the AI jobs drawer colors it. */ const PHASE_COLOR = {
42
+ queued: 'default',
43
+ planning: 'primary',
44
+ 'plan-ready': 'warning',
45
+ building: 'primary',
46
+ attention: 'warning',
47
+ done: 'success',
48
+ failed: 'error',
49
+ canceled: 'default'
50
+ };
51
+ const WHEN = new Intl.DateTimeFormat('en-US', {
52
+ dateStyle: 'medium',
53
+ timeStyle: 'short'
54
+ });
55
+ /** What a job cost the person: what it spent, less what we refunded. */ export function aiJobNetCredits(job) {
56
+ var _job_creditsSpent, _job_refundedCredits;
57
+ return Math.max(0, ((_job_creditsSpent = job.creditsSpent) != null ? _job_creditsSpent : 0) - ((_job_refundedCredits = job.refundedCredits) != null ? _job_refundedCredits : 0));
58
+ }
59
+ /** The kind as a row names it: `Site`, `Page`, `AI job`. */ export function aiJobKindLabel(kind) {
60
+ const noun = aiJobKindNoun(kind);
61
+ return noun === 'AI job' ? noun : noun.charAt(0).toUpperCase() + noun.slice(1);
62
+ }
63
+ const LOAD_ERROR = 'This site’s AI jobs could not be loaded. Try again in a moment.';
64
+ async function readSiteJobs(user, orgId, hostId, signal) {
65
+ try {
66
+ var _ref, _ref1;
67
+ const response = await authorizedFetch(user, `/api/ai/jobs?orgId=${encodeURIComponent(orgId)}&hostId=${encodeURIComponent(hostId)}&limit=${AI_JOBS_PAGE_LIMIT}`, {
68
+ signal
69
+ });
70
+ const payload = await response.json().catch(()=>null);
71
+ if (!response.ok) return {
72
+ status: 'error',
73
+ message: String((_ref = payload == null ? void 0 : payload.error) != null ? _ref : LOAD_ERROR)
74
+ };
75
+ const jobs = (_ref1 = payload == null ? void 0 : payload.jobs) != null ? _ref1 : [];
76
+ // A job the top-bar indicator still counts that has settled since leaves it.
77
+ for (const job of jobs)publishAiJob(job);
78
+ return {
79
+ status: 'ready',
80
+ jobs
81
+ };
82
+ } catch (unused) {
83
+ return {
84
+ status: 'error',
85
+ message: LOAD_ERROR
86
+ };
87
+ }
88
+ }
89
+ export function AiJobsListPage({ hostId, basePath }) {
90
+ var _ref;
91
+ const { data: user } = useUser();
92
+ const userRef = useRef(user);
93
+ userRef.current = user;
94
+ const site = useAiJobSite(hostId);
95
+ const orgId = site.status === 'ready' ? site.orgId : null;
96
+ const [list, setList] = useState({
97
+ status: 'loading'
98
+ });
99
+ const [attempt, setAttempt] = useState(0);
100
+ const uid = (_ref = user == null ? void 0 : user.uid) != null ? _ref : null;
101
+ useEffect(()=>{
102
+ if (!orgId || !hostId || !uid) return undefined;
103
+ const controller = new AbortController();
104
+ let settled = false;
105
+ setList({
106
+ status: 'loading'
107
+ });
108
+ const timer = setTimeout(()=>{
109
+ if (settled) return;
110
+ settled = true;
111
+ controller.abort();
112
+ setList({
113
+ status: 'error',
114
+ message: LOAD_ERROR
115
+ });
116
+ }, AI_JOBS_LIST_TIMEOUT_MS);
117
+ void readSiteJobs(userRef.current, orgId, hostId, controller.signal).then((next)=>{
118
+ if (settled) return;
119
+ settled = true;
120
+ clearTimeout(timer);
121
+ setList(next);
122
+ });
123
+ return ()=>{
124
+ settled = true;
125
+ clearTimeout(timer);
126
+ controller.abort();
127
+ };
128
+ }, [
129
+ orgId,
130
+ hostId,
131
+ uid,
132
+ attempt
133
+ ]);
134
+ const retry = useCallback(()=>setAttempt((count)=>count + 1), []);
135
+ const siteName = site.status === 'ready' ? site.name : '';
136
+ const state = site.status === 'error' ? {
137
+ status: 'error',
138
+ message: 'This site could not be read. Check your connection and reload the page.'
139
+ } : list;
140
+ return /*#__PURE__*/ _jsx(Container, {
141
+ maxWidth: "md",
142
+ sx: {
143
+ py: {
144
+ xs: 3,
145
+ sm: 5
146
+ },
147
+ px: {
148
+ xs: 2,
149
+ sm: 3
150
+ }
151
+ },
152
+ children: /*#__PURE__*/ _jsxs(Stack, {
153
+ spacing: 3,
154
+ children: [
155
+ /*#__PURE__*/ _jsxs(Stack, {
156
+ spacing: 1,
157
+ children: [
158
+ siteName ? /*#__PURE__*/ _jsx(Typography, {
159
+ variant: "overline",
160
+ color: "text.secondary",
161
+ children: siteName
162
+ }) : null,
163
+ /*#__PURE__*/ _jsx(Typography, {
164
+ variant: "h4",
165
+ component: "h1",
166
+ children: 'AI jobs'
167
+ }),
168
+ /*#__PURE__*/ _jsx(Typography, {
169
+ variant: "body1",
170
+ color: "text.secondary",
171
+ children: `What ${PLATFORM_BRAND_NAME} AI has done and is doing on this site, newest first.`
172
+ })
173
+ ]
174
+ }),
175
+ state.status === 'loading' ? /*#__PURE__*/ _jsx(Stack, {
176
+ sx: {
177
+ alignItems: 'center',
178
+ py: 4
179
+ },
180
+ children: /*#__PURE__*/ _jsx(CircularProgress, {
181
+ "aria-label": "Loading AI jobs"
182
+ })
183
+ }) : state.status === 'error' ? /*#__PURE__*/ _jsx(Alert, {
184
+ severity: "warning",
185
+ action: site.status === 'error' ? undefined : /*#__PURE__*/ _jsx(Button, {
186
+ color: "inherit",
187
+ size: "small",
188
+ onClick: retry,
189
+ children: 'Try again'
190
+ }),
191
+ children: state.message
192
+ }) : state.jobs.length === 0 ? /*#__PURE__*/ _jsx(Card, {
193
+ variant: "outlined",
194
+ sx: {
195
+ borderRadius: 2,
196
+ p: {
197
+ xs: 2,
198
+ sm: 3
199
+ }
200
+ },
201
+ children: /*#__PURE__*/ _jsxs(Stack, {
202
+ spacing: 1,
203
+ children: [
204
+ /*#__PURE__*/ _jsx(Typography, {
205
+ variant: "h6",
206
+ component: "h2",
207
+ children: 'No AI jobs on this site yet'
208
+ }),
209
+ /*#__PURE__*/ _jsx(Typography, {
210
+ variant: "body1",
211
+ color: "text.secondary",
212
+ children: `An AI job is ${PLATFORM_BRAND_NAME} AI building something for this site from a short ` + 'description you write: a page, a page template, a layout, a form or a reusable component. ' + 'Each one gets a page here that shows its progress and what it built.'
213
+ }),
214
+ /*#__PURE__*/ _jsx(Typography, {
215
+ variant: "body1",
216
+ color: "text.secondary",
217
+ children: 'To start one, choose Create with AI on this site’s Pages, Templates, Layouts, Forms or ' + 'Components page. A new site can also be built with AI when it is created.'
218
+ })
219
+ ]
220
+ })
221
+ }) : /*#__PURE__*/ _jsx(Card, {
222
+ variant: "outlined",
223
+ sx: {
224
+ borderRadius: 2
225
+ },
226
+ children: /*#__PURE__*/ _jsx(List, {
227
+ disablePadding: true,
228
+ "aria-label": "AI jobs",
229
+ children: state.jobs.map((job, index)=>{
230
+ const phase = aiJobPhase(job);
231
+ const credits = aiJobNetCredits(job);
232
+ const refund = aiJobRefundCopy(job);
233
+ const brief = job.brief.length > BRIEF_PREVIEW_CHARS ? `${job.brief.slice(0, BRIEF_PREVIEW_CHARS)}…` : job.brief;
234
+ const created = new Date(job.createdAt);
235
+ return /*#__PURE__*/ _jsxs(ListItemButton, {
236
+ component: AppLink,
237
+ href: `${basePath != null ? basePath : ''}/${encodeURIComponent(job.id)}`,
238
+ divider: index < state.jobs.length - 1,
239
+ sx: {
240
+ display: 'block',
241
+ py: 1.5
242
+ },
243
+ children: [
244
+ /*#__PURE__*/ _jsxs(Stack, {
245
+ direction: "row",
246
+ spacing: 1,
247
+ sx: {
248
+ alignItems: 'center',
249
+ flexWrap: 'wrap',
250
+ rowGap: 0.5
251
+ },
252
+ children: [
253
+ /*#__PURE__*/ _jsx(Chip, {
254
+ size: "small",
255
+ variant: "outlined",
256
+ label: aiJobKindLabel(job.kind)
257
+ }),
258
+ /*#__PURE__*/ _jsx(Chip, {
259
+ size: "small",
260
+ color: PHASE_COLOR[phase],
261
+ label: AI_JOB_PHASE_LABELS[phase]
262
+ }),
263
+ /*#__PURE__*/ _jsx(Box, {
264
+ sx: {
265
+ flexGrow: 1
266
+ }
267
+ }),
268
+ /*#__PURE__*/ _jsxs(Typography, {
269
+ variant: "caption",
270
+ color: "text.secondary",
271
+ children: [
272
+ credits > 0 ? `${credits.toLocaleString('en-US')} credits · ` : '',
273
+ Number.isNaN(created.getTime()) ? null : /*#__PURE__*/ _jsx("time", {
274
+ dateTime: job.createdAt,
275
+ children: WHEN.format(created)
276
+ })
277
+ ]
278
+ })
279
+ ]
280
+ }),
281
+ /*#__PURE__*/ _jsx(Typography, {
282
+ variant: "body2",
283
+ sx: {
284
+ mt: 0.75,
285
+ wordBreak: 'break-word'
286
+ },
287
+ children: brief
288
+ }),
289
+ refund ? /*#__PURE__*/ _jsx(Typography, {
290
+ variant: "caption",
291
+ color: "text.secondary",
292
+ component: "div",
293
+ sx: {
294
+ mt: 0.5
295
+ },
296
+ children: refund
297
+ }) : null
298
+ ]
299
+ }, job.id);
300
+ })
301
+ })
302
+ }),
303
+ state.status === 'ready' && state.jobs.length >= AI_JOBS_PAGE_LIMIT ? /*#__PURE__*/ _jsx(Typography, {
304
+ variant: "body2",
305
+ color: "text.secondary",
306
+ children: `Showing the ${AI_JOBS_PAGE_LIMIT} most recent jobs.`
307
+ }) : null
308
+ ]
309
+ })
310
+ });
311
+ }
312
+ export default AiJobsListPage;
313
+
314
+ //# sourceMappingURL=ai-jobs-list-page.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/components/ai-jobs-list-page.component.tsx"],"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'use client'\n\nimport { PLATFORM_BRAND_NAME } from '@aglyn/aglyn'\nimport type { ConsolePluginPageProps } from '@aglyn/aglyn/plugin-manager/feature-plugins'\nimport { aiJobRefundCopy } from '../model/ai-job-failure-copy'\nimport { AppLink } from '@aglyn/shared-ui-jsx'\nimport { authorizedFetch, type MaybeTokenSource } from '@aglyn/shared-util-http/authorized-token'\nimport { useUser } from '@aglyn/tenant-feature-instance'\nimport {\n Alert,\n Box,\n Button,\n Card,\n Chip,\n CircularProgress,\n Container,\n List,\n ListItemButton,\n Stack,\n Typography,\n} from '@mui/material'\nimport { useCallback, useEffect, useRef, useState } from 'react'\nimport { AI_JOB_PHASE_LABELS, aiJobKindNoun, aiJobPhase, type AiJobPhase } from '../model/ai-job-activity'\nimport type { AiJobSummary } from '../model/ai-jobs.types'\nimport { publishAiJob } from './ai-jobs-store'\nimport { useAiJobSite } from './ai-job-site'\n\n/**\n * A site's AI jobs (AGL-3596), at `/ai-jobs` under the site: every job that\n * worked on this site, newest first, each linking to its own page.\n *\n * Read through the jobs route, never Firestore, so the membership, flag and\n * plan rungs that answer every other jobs read answer this one. The site is\n * a query on the route (`hostId`), not a filter of the workspace's list.\n *\n * Every wait ends: the site's read and the list's each settle on content,\n * the empty state, or a sentence with Try again.\n */\n\n/** The most jobs the page lists; the newest, which is what a person comes for. */\nexport const AI_JOBS_PAGE_LIMIT = 50\n\n/** How long the list may take before the page says it could not be loaded. */\nexport const AI_JOBS_LIST_TIMEOUT_MS = 20_000\n\n/** How much of a brief a row shows. */\nconst BRIEF_PREVIEW_CHARS = 120\n\n/** A row's chip, colored as the AI jobs drawer colors it. */\nconst PHASE_COLOR: Record<AiJobPhase, 'default' | 'primary' | 'success' | 'error' | 'warning'> = {\n queued: 'default',\n planning: 'primary',\n 'plan-ready': 'warning',\n building: 'primary',\n attention: 'warning',\n done: 'success',\n failed: 'error',\n canceled: 'default',\n}\n\nconst WHEN = new Intl.DateTimeFormat('en-US', { dateStyle: 'medium', timeStyle: 'short' })\n\n/** What a job cost the person: what it spent, less what we refunded. */\nexport function aiJobNetCredits(job: Pick<AiJobSummary, 'creditsSpent' | 'refundedCredits'>): number {\n return Math.max(0, (job.creditsSpent ?? 0) - (job.refundedCredits ?? 0))\n}\n\n/** The kind as a row names it: `Site`, `Page`, `AI job`. */\nexport function aiJobKindLabel(kind: AiJobSummary['kind']): string {\n const noun = aiJobKindNoun(kind)\n return noun === 'AI job' ? noun : noun.charAt(0).toUpperCase() + noun.slice(1)\n}\n\ntype ListState =\n | { status: 'loading' }\n | { status: 'ready'; jobs: AiJobSummary[] }\n | { status: 'error'; message: string }\n\nconst LOAD_ERROR = 'This site’s AI jobs could not be loaded. Try again in a moment.'\n\nasync function readSiteJobs(\n user: MaybeTokenSource,\n orgId: string,\n hostId: string,\n signal: AbortSignal,\n): Promise<ListState> {\n try {\n const response = await authorizedFetch(\n user,\n `/api/ai/jobs?orgId=${encodeURIComponent(orgId)}&hostId=${encodeURIComponent(hostId)}&limit=${AI_JOBS_PAGE_LIMIT}`,\n { signal },\n )\n const payload = (await response.json().catch(() => null)) as { jobs?: AiJobSummary[]; error?: string } | null\n if (!response.ok) return { status: 'error', message: String(payload?.error ?? LOAD_ERROR) }\n const jobs = payload?.jobs ?? []\n // A job the top-bar indicator still counts that has settled since leaves it.\n for (const job of jobs) publishAiJob(job)\n return { status: 'ready', jobs }\n } catch {\n return { status: 'error', message: LOAD_ERROR }\n }\n}\n\nexport function AiJobsListPage({ hostId, basePath }: ConsolePluginPageProps) {\n const { data: user } = useUser()\n const userRef = useRef<MaybeTokenSource>(user)\n userRef.current = user\n const site = useAiJobSite(hostId)\n const orgId = site.status === 'ready' ? site.orgId : null\n const [list, setList] = useState<ListState>({ status: 'loading' })\n const [attempt, setAttempt] = useState(0)\n const uid = user?.uid ?? null\n\n useEffect(() => {\n if (!orgId || !hostId || !uid) return undefined\n const controller = new AbortController()\n let settled = false\n setList({ status: 'loading' })\n const timer = setTimeout(() => {\n if (settled) return\n settled = true\n controller.abort()\n setList({ status: 'error', message: LOAD_ERROR })\n }, AI_JOBS_LIST_TIMEOUT_MS)\n void readSiteJobs(userRef.current, orgId, hostId, controller.signal).then((next) => {\n if (settled) return\n settled = true\n clearTimeout(timer)\n setList(next)\n })\n return () => {\n settled = true\n clearTimeout(timer)\n controller.abort()\n }\n }, [orgId, hostId, uid, attempt])\n\n const retry = useCallback(() => setAttempt((count) => count + 1), [])\n\n const siteName = site.status === 'ready' ? site.name : ''\n const state: ListState =\n site.status === 'error'\n ? { status: 'error', message: 'This site could not be read. Check your connection and reload the page.' }\n : list\n\n return (\n <Container maxWidth=\"md\" sx={{ py: { xs: 3, sm: 5 }, px: { xs: 2, sm: 3 } }}>\n <Stack spacing={3}>\n <Stack spacing={1}>\n {siteName ? (\n <Typography variant=\"overline\" color=\"text.secondary\">\n {siteName}\n </Typography>\n ) : null}\n <Typography variant=\"h4\" component=\"h1\">\n {'AI jobs'}\n </Typography>\n <Typography variant=\"body1\" color=\"text.secondary\">\n {`What ${PLATFORM_BRAND_NAME} AI has done and is doing on this site, newest first.`}\n </Typography>\n </Stack>\n {state.status === 'loading' ? (\n <Stack sx={{ alignItems: 'center', py: 4 }}>\n <CircularProgress aria-label=\"Loading AI jobs\" />\n </Stack>\n ) : state.status === 'error' ? (\n <Alert\n severity=\"warning\"\n action={\n site.status === 'error' ? undefined : (\n <Button color=\"inherit\" size=\"small\" onClick={retry}>\n {'Try again'}\n </Button>\n )\n }\n >\n {state.message}\n </Alert>\n ) : state.jobs.length === 0 ? (\n <Card variant=\"outlined\" sx={{ borderRadius: 2, p: { xs: 2, sm: 3 } }}>\n <Stack spacing={1}>\n <Typography variant=\"h6\" component=\"h2\">\n {'No AI jobs on this site yet'}\n </Typography>\n <Typography variant=\"body1\" color=\"text.secondary\">\n {`An AI job is ${PLATFORM_BRAND_NAME} AI building something for this site from a short ` +\n 'description you write: a page, a page template, a layout, a form or a reusable component. ' +\n 'Each one gets a page here that shows its progress and what it built.'}\n </Typography>\n <Typography variant=\"body1\" color=\"text.secondary\">\n {'To start one, choose Create with AI on this site’s Pages, Templates, Layouts, Forms or ' +\n 'Components page. A new site can also be built with AI when it is created.'}\n </Typography>\n </Stack>\n </Card>\n ) : (\n <Card variant=\"outlined\" sx={{ borderRadius: 2 }}>\n <List disablePadding aria-label=\"AI jobs\">\n {state.jobs.map((job, index) => {\n const phase = aiJobPhase(job)\n const credits = aiJobNetCredits(job)\n const refund = aiJobRefundCopy(job)\n const brief =\n job.brief.length > BRIEF_PREVIEW_CHARS ? `${job.brief.slice(0, BRIEF_PREVIEW_CHARS)}…` : job.brief\n const created = new Date(job.createdAt)\n return (\n <ListItemButton\n key={job.id}\n component={AppLink}\n href={`${basePath ?? ''}/${encodeURIComponent(job.id)}`}\n divider={index < state.jobs.length - 1}\n sx={{ display: 'block', py: 1.5 }}\n >\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'center', flexWrap: 'wrap', rowGap: 0.5 }}>\n <Chip size=\"small\" variant=\"outlined\" label={aiJobKindLabel(job.kind)} />\n <Chip size=\"small\" color={PHASE_COLOR[phase]} label={AI_JOB_PHASE_LABELS[phase]} />\n <Box sx={{ flexGrow: 1 }} />\n <Typography variant=\"caption\" color=\"text.secondary\">\n {credits > 0 ? `${credits.toLocaleString('en-US')} credits · ` : ''}\n {Number.isNaN(created.getTime()) ? null : (\n <time dateTime={job.createdAt}>{WHEN.format(created)}</time>\n )}\n </Typography>\n </Stack>\n <Typography variant=\"body2\" sx={{ mt: 0.75, wordBreak: 'break-word' }}>\n {brief}\n </Typography>\n {/* What became of its credits, from the job's recorded give-back (AGL-3596). */}\n {refund ? (\n <Typography variant=\"caption\" color=\"text.secondary\" component=\"div\" sx={{ mt: 0.5 }}>\n {refund}\n </Typography>\n ) : null}\n </ListItemButton>\n )\n })}\n </List>\n </Card>\n )}\n {state.status === 'ready' && state.jobs.length >= AI_JOBS_PAGE_LIMIT ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {`Showing the ${AI_JOBS_PAGE_LIMIT} most recent jobs.`}\n </Typography>\n ) : null}\n </Stack>\n </Container>\n )\n}\n\nexport default AiJobsListPage\n"],"names":["PLATFORM_BRAND_NAME","aiJobRefundCopy","AppLink","authorizedFetch","useUser","Alert","Box","Button","Card","Chip","CircularProgress","Container","List","ListItemButton","Stack","Typography","useCallback","useEffect","useRef","useState","AI_JOB_PHASE_LABELS","aiJobKindNoun","aiJobPhase","publishAiJob","useAiJobSite","AI_JOBS_PAGE_LIMIT","AI_JOBS_LIST_TIMEOUT_MS","BRIEF_PREVIEW_CHARS","PHASE_COLOR","queued","planning","building","attention","done","failed","canceled","WHEN","Intl","DateTimeFormat","dateStyle","timeStyle","aiJobNetCredits","job","Math","max","creditsSpent","refundedCredits","aiJobKindLabel","kind","noun","charAt","toUpperCase","slice","LOAD_ERROR","readSiteJobs","user","orgId","hostId","signal","response","encodeURIComponent","payload","json","catch","ok","status","message","String","error","jobs","AiJobsListPage","basePath","data","userRef","current","site","list","setList","attempt","setAttempt","uid","undefined","controller","AbortController","settled","timer","setTimeout","abort","then","next","clearTimeout","retry","count","siteName","name","state","maxWidth","sx","py","xs","sm","px","spacing","variant","color","component","alignItems","aria-label","severity","action","size","onClick","length","borderRadius","p","disablePadding","map","index","phase","credits","refund","brief","created","Date","createdAt","href","id","divider","display","direction","flexWrap","rowGap","label","flexGrow","toLocaleString","Number","isNaN","getTime","time","dateTime","format","mt","wordBreak"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;AAEA,SAASA,mBAAmB,QAAQ,eAAc;AAElD,SAASC,eAAe,QAAQ,kCAA8B;AAC9D,SAASC,OAAO,QAAQ,uBAAsB;AAC9C,SAASC,eAAe,QAA+B,2CAA0C;AACjG,SAASC,OAAO,QAAQ,iCAAgC;AACxD,SACEC,KAAK,EACLC,GAAG,EACHC,MAAM,EACNC,IAAI,EACJC,IAAI,EACJC,gBAAgB,EAChBC,SAAS,EACTC,IAAI,EACJC,cAAc,EACdC,KAAK,EACLC,UAAU,QACL,gBAAe;AACtB,SAASC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AAChE,SAASC,mBAAmB,EAAEC,aAAa,EAAEC,UAAU,QAAyB,8B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,CAAC0F,MAAM;gDAAEc,OAAOhH,mBAAmB,CAACkG,MAAM;;0DAC/E,KAAChH;gDAAI2F,IAAI;oDAAEoC,UAAU;gDAAE;;0DACvB,MAACtH;gDAAWwF,SAAQ;gDAAUC,OAAM;;oDACjCe,UAAU,IAAI,GAAGA,QAAQe,cAAc,CAAC,SAAS,WAAW,CAAC,GAAG;oDAChEC,OAAOC,KAAK,CAACd,QAAQe,OAAO,MAAM,qBACjC,KAACC;wDAAKC,UAAUjG,IAAIkF,SAAS;kEAAGxF,KAAKwG,MAAM,CAAClB;;;;;;kDAIlD,KAAC3G;wCAAWwF,SAAQ;wCAAQN,IAAI;4CAAE4C,IAAI;4CAAMC,WAAW;wCAAa;kDACjErB;;oCAGFD,uBACC,KAACzG;wCAAWwF,SAAQ;wCAAUC,OAAM;wCAAiBC,WAAU;wCAAMR,IAAI;4CAAE4C,IAAI;wCAAI;kDAChFrB;yCAED;;+BAzBC9E,IAAIoF,EAAE;wBA4BjB;;;gBAIL/B,MAAM9B,MAAM,KAAK,WAAW8B,MAAM1B,IAAI,CAAC2C,MAAM,IAAIvF,mCAChD,KAACV;oBAAWwF,SAAQ;oBAAQC,OAAM;8BAC/B,CAAC,YAAY,EAAE/E,mBAAmB,kBAAkB,CAAC;qBAEtD;;;;AAIZ;AAEA,eAAe6C,eAAc"}
@@ -0,0 +1,7 @@
1
+ import type { ConsolePluginPageProps } from '@aglyn/aglyn/plugin-manager/feature-plugins';
2
+ /**
3
+ * The AI plugin's `/ai-jobs` route under a site (AGL-3596): the bare address
4
+ * lists the site's jobs, and `/ai-jobs/{jobId}` is one job's page.
5
+ */
6
+ export declare function AiJobsPage(props: ConsolePluginPageProps): import("react").JSX.Element;
7
+ export default AiJobsPage;
@@ -0,0 +1,30 @@
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
+ */ 'use client';
17
+ import { _ as _extends } from "@swc/helpers/_/_extends";
18
+ import { jsx as _jsx } from "react/jsx-runtime";
19
+ import { AiJobsListPage } from "./ai-jobs-list-page.component.js";
20
+ import { AiSiteBuildPage } from "./ai-site-build-page.component.js";
21
+ /**
22
+ * The AI plugin's `/ai-jobs` route under a site (AGL-3596): the bare address
23
+ * lists the site's jobs, and `/ai-jobs/{jobId}` is one job's page.
24
+ */ export function AiJobsPage(props) {
25
+ var _props_segments;
26
+ return ((_props_segments = props.segments) == null ? void 0 : _props_segments[0]) ? /*#__PURE__*/ _jsx(AiSiteBuildPage, _extends({}, props)) : /*#__PURE__*/ _jsx(AiJobsListPage, _extends({}, props));
27
+ }
28
+ export default AiJobsPage;
29
+
30
+ //# sourceMappingURL=ai-jobs-page.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/components/ai-jobs-page.component.tsx"],"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'use client'\n\nimport type { ConsolePluginPageProps } from '@aglyn/aglyn/plugin-manager/feature-plugins'\nimport { AiJobsListPage } from './ai-jobs-list-page.component'\nimport { AiSiteBuildPage } from './ai-site-build-page.component'\n\n/**\n * The AI plugin's `/ai-jobs` route under a site (AGL-3596): the bare address\n * lists the site's jobs, and `/ai-jobs/{jobId}` is one job's page.\n */\nexport function AiJobsPage(props: ConsolePluginPageProps) {\n return props.segments?.[0] ? <AiSiteBuildPage {...props} /> : <AiJobsListPage {...props} />\n}\n\nexport default AiJobsPage\n"],"names":["AiJobsListPage","AiSiteBuildPage","AiJobsPage","props","segments"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAGA,SAASA,cAAc,QAAQ,mCAA+B;AAC9D,SAASC,eAAe,QAAQ,oCAAgC;AAEhE;;;CAGC,GACD,OAAO,SAASC,WAAWC,KAA6B;QAC/CA;IAAP,OAAOA,EAAAA,kBAAAA,MAAMC,QAAQ,qBAAdD,eAAgB,CAAC,EAAE,kBAAG,KAACF,8BAAoBE,wBAAY,KAACH,6BAAmBG;AACpF;AAEA,eAAeD,WAAU"}
@@ -17,7 +17,7 @@
17
17
  import { type AiBriefDialogProps } from './ai-brief-dialog.component';
18
18
  /**
19
19
  * "Describe a page" (AGL-2907): the brief dialog both page entry points open,
20
- * the Screens page's "Describe it" and the Assist panel's AI jobs.
20
+ * the Screens page's "Create with AI" and the Assist panel's AI jobs.
21
21
  *
22
22
  * It is the shared brief dialog for a `page` job (AGL-3043): one text box and
23
23
  * an optional page type. The job plans first; the dialog then follows it and
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/components/ai-page-brief-dialog.component.tsx"],"sourcesContent":["'use client'\n\n/**\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\nimport { AiBriefDialog, type AiBriefDialogProps } from './ai-brief-dialog.component'\n\n/**\n * \"Describe a page\" (AGL-2907): the brief dialog both page entry points open,\n * the Screens page's \"Describe it\" and the Assist panel's AI jobs.\n *\n * It is the shared brief dialog for a `page` job (AGL-3043): one text box and\n * an optional page type. The job plans first; the dialog then follows it and\n * offers its plan to confirm, as AI jobs does (AGL-3593). Nothing is built\n * until the member confirms.\n */\n\nexport type AiPageBriefDialogProps = Omit<AiBriefDialogProps, 'kind'>\n\nexport function AiPageBriefDialog(props: AiPageBriefDialogProps) {\n return <AiBriefDialog {...props} kind=\"page\" />\n}\n\nexport default AiPageBriefDialog\n"],"names":["AiBriefDialog","AiPageBriefDialog","props","kind"],"mappings":"AAAA;;;AAEA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,aAAa,QAAiC,iCAA6B;AAcpF,OAAO,SAASC,kBAAkBC,KAA6B;IAC7D,qBAAO,KAACF,4BAAkBE;QAAOC,MAAK;;AACxC;AAEA,eAAeF,kBAAiB"}
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/components/ai-page-brief-dialog.component.tsx"],"sourcesContent":["'use client'\n\n/**\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\nimport { AiBriefDialog, type AiBriefDialogProps } from './ai-brief-dialog.component'\n\n/**\n * \"Describe a page\" (AGL-2907): the brief dialog both page entry points open,\n * the Screens page's \"Create with AI\" and the Assist panel's AI jobs.\n *\n * It is the shared brief dialog for a `page` job (AGL-3043): one text box and\n * an optional page type. The job plans first; the dialog then follows it and\n * offers its plan to confirm, as AI jobs does (AGL-3593). Nothing is built\n * until the member confirms.\n */\n\nexport type AiPageBriefDialogProps = Omit<AiBriefDialogProps, 'kind'>\n\nexport function AiPageBriefDialog(props: AiPageBriefDialogProps) {\n return <AiBriefDialog {...props} kind=\"page\" />\n}\n\nexport default AiPageBriefDialog\n"],"names":["AiBriefDialog","AiPageBriefDialog","props","kind"],"mappings":"AAAA;;;AAEA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,aAAa,QAAiC,iCAA6B;AAcpF,OAAO,SAASC,kBAAkBC,KAA6B;IAC7D,qBAAO,KAACF,4BAAkBE;QAAOC,MAAK;;AACxC;AAEA,eAAeF,kBAAiB"}
@@ -16,8 +16,36 @@
16
16
  */
17
17
  import type { ConsolePluginPageProps } from '@aglyn/aglyn/plugin-manager/feature-plugins';
18
18
  import type { MaybeTokenSource } from '@aglyn/shared-util-http/authorized-token';
19
- import type { AiJobSummary } from '../model/ai-jobs.types';
20
- /** Follows one job by id: its latest summary, `null` while the first state is out, `'missing'` when the route had none. */
21
- export declare function useAiJobById(user: MaybeTokenSource, orgId: string | null, jobId: string | null): [AiJobSummary | 'missing' | null, (job: AiJobSummary) => void];
19
+ import { type AiJobSummary } from '../model/ai-jobs.types';
20
+ /**
21
+ * "Building your site" (AGL-3594): one job's page, at `/ai-jobs/{jobId}`
22
+ * under its site — where the guided start sends a person the moment they
23
+ * plan a site, and where a notification about that job opens.
24
+ *
25
+ * A guided site start confirms its own plan (`autoConfirm`), so there is no
26
+ * approval to make here: the page says what is happening, step by step, live
27
+ * from the job's events route; shows what is being built; and, when the job
28
+ * ends, leads with the next thing to do — the live site and the pages to
29
+ * edit, or, where it stopped, the plain sentence for why and what to do
30
+ * about it. It is linkable and survives a reload, because it reads the job by
31
+ * the id in its own address under the site's own route.
32
+ *
33
+ * Every wait ends (AGL-3596): a site that cannot be read, a job the route
34
+ * does not know, a route that fails, and a first state that never arrives
35
+ * each end on a sentence instead of a spinner.
36
+ *
37
+ * Mounted by `AiJobsPage`, the plugin's unlisted `/ai-jobs` route: no tab on
38
+ * the site's strip, an address under it.
39
+ */
40
+ /** How long the job's first state may take before the page says it could not be loaded. */
41
+ export declare const AI_JOB_FIRST_STATE_TIMEOUT_MS = 20000;
42
+ /**
43
+ * One job, followed by id: its latest summary; `null` while the first state
44
+ * is out; `'missing'` when the route says there is no such job for this
45
+ * reader; `'error'` when the route failed or no state arrived in time.
46
+ */
47
+ export type AiJobByIdState = AiJobSummary | 'missing' | 'error' | null;
48
+ /** Follows one job by id. `retry` follows it again after a `'missing'` or `'error'`. */
49
+ export declare function useAiJobById(user: MaybeTokenSource, orgId: string | null, jobId: string | null): [AiJobByIdState, (job: AiJobSummary) => void, () => void];
22
50
  export declare function AiSiteBuildPage({ hostId, segments, basePath }: ConsolePluginPageProps): import("react").JSX.Element;
23
51
  export default AiSiteBuildPage;