camox 0.71.0 → 0.74.1
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/dist/core/createApp.d.ts +4 -103
- package/dist/core/createApp.js +3 -24
- package/dist/core/createBlock.d.ts +2 -2
- package/dist/core/createBlock.js +41 -185
- package/dist/core/createLayout.d.ts +6 -77
- package/dist/core/createLayout.js +12 -50
- package/dist/core/editing/createEditableBlock.d.ts +9 -75
- package/dist/core/editing/createEditableBlock.js +258 -640
- package/dist/core/hooks/useIsEditable.js +2 -2
- package/dist/core/lib/artifactData.js +8 -3
- package/dist/core/lib/contentType.d.ts +23 -38
- package/dist/core/lib/contentType.js +34 -62
- package/dist/core/lib/iconTypes.d.ts +0 -3
- package/dist/core/lib/icons.js +63 -51
- package/dist/core/lib/recordScope.js +1 -1
- package/dist/features/canvas/CanvasOverlays.js +94 -176
- package/dist/features/canvas/CanvasPageFrame.js +62 -68
- package/dist/features/canvas/CanvasPreviewPageSlot.js +1 -3
- package/dist/features/canvas/canvasOverlayGeometry.js +1 -7
- package/dist/features/canvas/sidebar/CuratedPageInspector.js +3 -21
- package/dist/features/canvas/sidebar/LayoutPageBlocks.js +1 -2
- package/dist/features/canvas/useCanvasCamera.js +1 -1
- package/dist/features/canvas/useCanvasFrame.js +1 -1
- package/dist/features/content/ContentCollection.js +2 -2
- package/dist/features/content/collection-form.js +6 -7
- package/dist/features/page/CuratedPageContent.js +15 -24
- package/dist/features/page/UnplacedBlockContent.js +1 -6
- package/dist/features/preview/CamoxPreview.js +30 -33
- package/dist/features/preview/EditablePageContent.js +131 -151
- package/dist/features/preview/components/BlockActionsPopover.js +43 -152
- package/dist/features/preview/components/CanvasPreview.js +2 -2
- package/dist/features/preview/components/Frame.js +3 -3
- package/dist/features/preview/components/IconFieldEditor.js +1 -1
- package/dist/features/preview/components/ItemFieldsEditor.js +1 -3
- package/dist/features/preview/components/Overlays.js +18 -84
- package/dist/features/preview/components/PageInfo.js +121 -98
- package/dist/features/preview/components/PageTree.js +57 -103
- package/dist/features/preview/components/PreviewPanel.js +8 -11
- package/dist/features/preview/components/RecordCombobox.js +65 -78
- package/dist/features/preview/components/ReferenceFieldEditor.js +1 -19
- package/dist/features/preview/components/ReferenceListFieldEditor.js +1 -19
- package/dist/features/preview/components/RemovedBlockPlaceholder.js +2 -2
- package/dist/features/preview/components/SelectionEditor.js +6 -5
- package/dist/features/preview/components/useRepeatableItemActions.js +18 -24
- package/dist/features/preview/components/useUpdateBlockPosition.js +1 -1
- package/dist/features/preview/overlayMessages.js +1 -4
- package/dist/features/preview/previewStore.js +3 -23
- package/dist/features/renderer/RendererApp.js +17 -141
- package/dist/features/renderer/definitionAnswers.js +1 -8
- package/dist/features/renderer/rendererHost.js +1 -31
- package/dist/features/renderer/studioConnection.js +1 -25
- package/dist/features/routes/pageRuntime.js +15 -4
- package/dist/features/runtime/ClaimCard.js +192 -0
- package/dist/features/runtime/pageApp.js +5 -4
- package/dist/features/runtime/runtime.js +29 -8
- package/dist/features/runtime/worker.js +2 -2
- package/dist/features/runtime/workerRequest.d.ts +6 -0
- package/dist/features/runtime/workerRequest.js +13 -1
- package/dist/features/runtime/workerRuntime.d.ts +2 -2
- package/dist/features/runtime/workerRuntime.js +2 -2
- package/dist/features/studio/components/AgentSidebar.js +7 -7
- package/dist/features/studio/components/ChatWidget.js +142 -106
- package/dist/features/studio/components/ContentFindings.js +127 -230
- package/dist/features/studio/components/DeleteDraftDialog.js +112 -0
- package/dist/features/studio/components/DraftBar.js +98 -53
- package/dist/features/studio/components/DraftsControl.js +203 -190
- package/dist/features/studio/components/ReviewDraftDialog.js +670 -0
- package/dist/features/studio/components/{Patrol.js → Specialists.js} +291 -330
- package/dist/features/studio/components/Squareling.js +5 -5
- package/dist/features/studio/components/ThreadComposer.js +106 -127
- package/dist/features/studio/components/ThreadMessages.js +137 -45
- package/dist/features/studio/findingSentence.js +14 -12
- package/dist/features/studio/fixMessage.js +23 -0
- package/dist/features/studio/reportSentence.js +1 -1
- package/dist/features/studio/{patrollerBio.js → specialistBio.js} +8 -5
- package/dist/features/studio/studioStore.js +29 -15
- package/dist/features/studio/workingSentence.js +1 -1
- package/dist/features/vite/blockBoilerplate.js +1 -1
- package/dist/features/vite/definitionsSync.js +1 -8
- package/dist/lib/api-client.js +5 -1
- package/dist/lib/queries.js +5 -6
- package/dist/lib/studio-definitions.js +0 -2
- package/dist/lib/studio-reads.d.ts +1 -1
- package/dist/lib/studio-reads.js +5 -10
- package/dist/lib/use-thread.js +196 -138
- package/dist/package.js +1 -1
- package/dist/studio-overlays.css +0 -29
- package/dist/studio.css +1 -1
- package/package.json +4 -4
- package/skills/camox/SKILL.md +1 -1
- package/skills/camox/references/artifacts.md +4 -4
- package/skills/camox/references/block-definitions.md +21 -25
- package/skills/camox/references/dom-integrations.md +1 -1
- package/skills/camox/references/layout-definitions.md +3 -12
- package/skills/camox/references/routed-layouts.md +2 -2
- package/skills/camox-expand/SKILL.md +5 -5
- package/skills/camoxify/SKILL.md +4 -4
- package/dist/features/canvas/canvasInsertionSeams.js +0 -44
- package/dist/features/preview/components/AddBlockSheet.js +0 -314
- package/dist/features/preview/components/BlockPeek.js +0 -66
- package/dist/features/preview/components/BlockThumbnail.js +0 -281
- package/dist/features/preview/components/blockGridNavigation.js +0 -15
- package/dist/features/preview/referencePickerFocus.js +0 -29
- package/dist/features/studio/components/ReviewDraftSheet.js +0 -1587
|
@@ -762,8 +762,8 @@ async function lookAtLayoutPage(request, options, reading, path, match) {
|
|
|
762
762
|
}
|
|
763
763
|
/**
|
|
764
764
|
* The look document's Block Definition mode: the block of the Block Definition `type` as the
|
|
765
|
-
* draft would show it placed,
|
|
766
|
-
*
|
|
765
|
+
* draft would show it placed, its content and Block Settings empty but for the overrides the URL
|
|
766
|
+
* gives, merged by the API, which checks them against its schemas. An override it refuses
|
|
767
767
|
* answers its message. The block is read as a page reads its blocks, so it renders and hydrates
|
|
768
768
|
* as a page's block does; its page is the Locale's home, which links resolve against.
|
|
769
769
|
*/
|
|
@@ -809,7 +809,7 @@ async function lookAtBlockDefinition(request, options, reading, type) {
|
|
|
809
809
|
}
|
|
810
810
|
/**
|
|
811
811
|
* The look document's Layout Definition mode: the curated Layout `layoutId` around no page, its
|
|
812
|
-
* blocks with their
|
|
812
|
+
* blocks with their content and Block Settings empty but for the overrides the URL gives, merged
|
|
813
813
|
* by the API, which checks them against their schemas and refuses a Singleton or Derived Layout,
|
|
814
814
|
* answering its message. Where a page's content goes, a labelled placeholder as tall as the URL
|
|
815
815
|
* says. Its path is the Locale's home, which links resolve against.
|
|
@@ -918,6 +918,25 @@ function visitorAnalytics(render, project) {
|
|
|
918
918
|
if (render.studio || render.draftId) return void 0;
|
|
919
919
|
return configuredProviders(project.analytics);
|
|
920
920
|
}
|
|
921
|
+
/**
|
|
922
|
+
* A project waiting to be claimed keeps search engines away from its pages, so the copy an
|
|
923
|
+
* operator built doesn't compete with the customer's current website. APIs older than Claim Links
|
|
924
|
+
* don't say, and their projects are indexed.
|
|
925
|
+
*/
|
|
926
|
+
function isHiddenFromSearchEngines(project) {
|
|
927
|
+
return project.hiddenFromSearchEngines === true;
|
|
928
|
+
}
|
|
929
|
+
/** A page's head, with the robots `noindex` meta tag when its project is hidden. */
|
|
930
|
+
function withSearchEngineMark(head, project) {
|
|
931
|
+
if (!head || !isHiddenFromSearchEngines(project)) return head;
|
|
932
|
+
return {
|
|
933
|
+
...head,
|
|
934
|
+
meta: [...head.meta ?? [], {
|
|
935
|
+
name: "robots",
|
|
936
|
+
content: "noindex"
|
|
937
|
+
}]
|
|
938
|
+
};
|
|
939
|
+
}
|
|
921
940
|
/** Whether a request is a preview link's token handoff, which signs in before reading anything. */
|
|
922
941
|
function isPreviewHandoff(request, options) {
|
|
923
942
|
const { searchParams } = new URL(request.url);
|
|
@@ -1247,13 +1266,14 @@ async function createPageHtmlResponse({ options, pathname, located, request, pag
|
|
|
1247
1266
|
if (result.shouldClearAuthCookie) headers.append("Set-Cookie", buildClearServerAuthCookieHeader());
|
|
1248
1267
|
const camoxApp = await options.getCamoxApp?.();
|
|
1249
1268
|
const document = await options.getDocument?.() ?? {};
|
|
1269
|
+
if (isHiddenFromSearchEngines(result.data.page.project)) headers.set("X-Robots-Tag", "noindex");
|
|
1250
1270
|
const { alternates, head } = await readAlternates(request, options, {
|
|
1251
1271
|
located,
|
|
1252
1272
|
identity: {
|
|
1253
1273
|
kind: "curated",
|
|
1254
1274
|
pageId: result.data.page.page.id
|
|
1255
1275
|
},
|
|
1256
|
-
head: camoxApp ? buildCamoxPageHead(camoxApp, result.data, located.locale) : {},
|
|
1276
|
+
head: withSearchEngineMark(camoxApp ? buildCamoxPageHead(camoxApp, result.data, located.locale) : {}, result.data.page.project),
|
|
1257
1277
|
described: curatedPageDescription(camoxApp, result.data.page, located.locale),
|
|
1258
1278
|
localeReads: localeReads(result.draftId)
|
|
1259
1279
|
});
|
|
@@ -1559,14 +1579,14 @@ async function createDerivedResponse(options, pathname, located, request, { data
|
|
|
1559
1579
|
layout: match.layout,
|
|
1560
1580
|
recordId: record.data.id
|
|
1561
1581
|
} : { kind: "code-owned" },
|
|
1562
|
-
head: buildPageHead({
|
|
1582
|
+
head: withSearchEngineMark(buildPageHead({
|
|
1563
1583
|
layout: match.layout._internal,
|
|
1564
1584
|
context,
|
|
1565
1585
|
origin: new URL(request.url).origin,
|
|
1566
1586
|
faviconUrl: buildFaviconUrl(options.apiUrl, shared.project),
|
|
1567
1587
|
hasMarkdown: match.layout._internal.toMarkdown !== void 0,
|
|
1568
1588
|
recordType: record?.structuredData?.node?.["@type"]
|
|
1569
|
-
}),
|
|
1589
|
+
}), shared.project),
|
|
1570
1590
|
described: {
|
|
1571
1591
|
project: {
|
|
1572
1592
|
...shared.project,
|
|
@@ -1638,7 +1658,8 @@ async function createDerivedResponse(options, pathname, located, request, { data
|
|
|
1638
1658
|
Vary: "Cookie",
|
|
1639
1659
|
Link: llmsTxtLinkHeader(options),
|
|
1640
1660
|
...isPrivateRender(request) ? { "Cache-Control": "private, no-store" } : {},
|
|
1641
|
-
...clearAuthCookie ? { "Set-Cookie": buildClearServerAuthCookieHeader() } : {}
|
|
1661
|
+
...clearAuthCookie ? { "Set-Cookie": buildClearServerAuthCookieHeader() } : {},
|
|
1662
|
+
...isHiddenFromSearchEngines(shared.project) && { "X-Robots-Tag": "noindex" }
|
|
1642
1663
|
} });
|
|
1643
1664
|
} catch (error) {
|
|
1644
1665
|
if (isNotFoundError(error)) return new Response("Page not found", { status: 404 });
|
|
@@ -1770,7 +1791,7 @@ async function createPageDataResponse({ options, pathname, located, request, pag
|
|
|
1770
1791
|
kind: "curated",
|
|
1771
1792
|
pageId: result.data.page.page.id
|
|
1772
1793
|
},
|
|
1773
|
-
head: camoxApp ? buildCamoxPageHead(camoxApp, result.data, located.locale) : null,
|
|
1794
|
+
head: withSearchEngineMark(camoxApp ? buildCamoxPageHead(camoxApp, result.data, located.locale) : null, result.data.page.project),
|
|
1774
1795
|
described: curatedPageDescription(camoxApp, result.data.page, located.locale),
|
|
1775
1796
|
localeReads: localeReads(result.draftId)
|
|
1776
1797
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PUBLIC_CACHE_NAME, fetchLocalhostOnLoopback, readLiveCacheKey, rememberPublishingDraft, respondThroughPublicCache, shouldHandleRequest, withDevHtml } from "camox/_internal/workerRuntime";
|
|
1
|
+
import { PUBLIC_CACHE_NAME, fetchLocalhostOnLoopback, readLiveCacheKey, rememberPublishingDraft, respondThroughPublicCache, shouldHandleRequest, withDevHtml, withoutClaimLinkToken } from "camox/_internal/workerRuntime";
|
|
2
2
|
import { WorkerEntrypoint } from "cloudflare:workers";
|
|
3
3
|
import { devHtml, handleCamoxRequest, isPublicRequest, publicCacheSource, readDefinitionSet, runtimeBasePath } from "virtual:camox/server";
|
|
4
4
|
|
|
@@ -41,7 +41,7 @@ var CamoxDefinitionSet = class extends WorkerEntrypoint {
|
|
|
41
41
|
var worker_default = { async fetch(request, env, context) {
|
|
42
42
|
rememberPublishingDraft(env);
|
|
43
43
|
if (!shouldHandleRequest(request, runtimeBasePath)) return notFound();
|
|
44
|
-
const response = await respond(request, context);
|
|
44
|
+
const response = await respond(withoutClaimLinkToken(request), context);
|
|
45
45
|
if (!response) return notFound();
|
|
46
46
|
return withDevHtml(response, devHtml);
|
|
47
47
|
} };
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
//#region src/features/runtime/workerRequest.d.ts
|
|
2
2
|
export declare function shouldHandleRequest(request: Request, basePath: string): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* The request without a Claim Link's token, which only the claim card reads, in the browser. The
|
|
5
|
+
* page renders and is kept in the edge cache as if the visitor came without it, so the token
|
|
6
|
+
* never reaches the cache key or the rendered page.
|
|
7
|
+
*/
|
|
8
|
+
export declare function withoutClaimLinkToken(request: Request): Request;
|
|
3
9
|
/** Adds what Vite injects into HTML in dev, such as its client and React Refresh. */
|
|
4
10
|
export declare function withDevHtml(response: Response, html: {
|
|
5
11
|
head: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { matchRuntimeOwnedRoute } from "./runtimeRoutes.js";
|
|
2
|
+
import { CLAIM_LINK_SEARCH_PARAM } from "@camox/api-contract/claim-links";
|
|
2
3
|
|
|
3
4
|
//#region src/features/runtime/workerRequest.ts
|
|
4
5
|
/** How the Camox Worker picks the requests it answers and prepares its responses. */
|
|
@@ -26,6 +27,17 @@ function shouldHandleRequest(request, basePath) {
|
|
|
26
27
|
if (pathname.startsWith("/node_modules/")) return false;
|
|
27
28
|
return isDocumentRequest(request);
|
|
28
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* The request without a Claim Link's token, which only the claim card reads, in the browser. The
|
|
32
|
+
* page renders and is kept in the edge cache as if the visitor came without it, so the token
|
|
33
|
+
* never reaches the cache key or the rendered page.
|
|
34
|
+
*/
|
|
35
|
+
function withoutClaimLinkToken(request) {
|
|
36
|
+
const url = new URL(request.url);
|
|
37
|
+
if (!url.searchParams.has(CLAIM_LINK_SEARCH_PARAM)) return request;
|
|
38
|
+
url.searchParams.delete(CLAIM_LINK_SEARCH_PARAM);
|
|
39
|
+
return new Request(url, request);
|
|
40
|
+
}
|
|
29
41
|
/** Adds what Vite injects into HTML in dev, such as its client and React Refresh. */
|
|
30
42
|
async function withDevHtml(response, html) {
|
|
31
43
|
if (!html) return response;
|
|
@@ -41,4 +53,4 @@ async function withDevHtml(response, html) {
|
|
|
41
53
|
}
|
|
42
54
|
|
|
43
55
|
//#endregion
|
|
44
|
-
export { shouldHandleRequest, withDevHtml };
|
|
56
|
+
export { shouldHandleRequest, withDevHtml, withoutClaimLinkToken };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fetchLocalhostOnLoopback } from "./loopbackFetch.js";
|
|
2
2
|
import { PUBLIC_CACHE_NAME, readLiveCacheKey, respondThroughPublicCache } from "./publicCache.js";
|
|
3
3
|
import { rememberPublishingDraft } from "./publishingDraft.js";
|
|
4
|
-
import { shouldHandleRequest, withDevHtml } from "./workerRequest.js";
|
|
5
|
-
export { PUBLIC_CACHE_NAME, fetchLocalhostOnLoopback, readLiveCacheKey, rememberPublishingDraft, respondThroughPublicCache, shouldHandleRequest, withDevHtml };
|
|
4
|
+
import { shouldHandleRequest, withDevHtml, withoutClaimLinkToken } from "./workerRequest.js";
|
|
5
|
+
export { PUBLIC_CACHE_NAME, fetchLocalhostOnLoopback, readLiveCacheKey, rememberPublishingDraft, respondThroughPublicCache, shouldHandleRequest, withDevHtml, withoutClaimLinkToken };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { rememberPublishingDraft } from "./publishingDraft.js";
|
|
2
2
|
import { fetchLocalhostOnLoopback } from "./loopbackFetch.js";
|
|
3
3
|
import { PUBLIC_CACHE_NAME, readLiveCacheKey, respondThroughPublicCache } from "./publicCache.js";
|
|
4
|
-
import { shouldHandleRequest, withDevHtml } from "./workerRequest.js";
|
|
4
|
+
import { shouldHandleRequest, withDevHtml, withoutClaimLinkToken } from "./workerRequest.js";
|
|
5
5
|
|
|
6
|
-
export { PUBLIC_CACHE_NAME, fetchLocalhostOnLoopback, readLiveCacheKey, rememberPublishingDraft, respondThroughPublicCache, shouldHandleRequest, withDevHtml };
|
|
6
|
+
export { PUBLIC_CACHE_NAME, fetchLocalhostOnLoopback, readLiveCacheKey, rememberPublishingDraft, respondThroughPublicCache, shouldHandleRequest, withDevHtml, withoutClaimLinkToken };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { cn } from "../../../lib/utils.js";
|
|
2
2
|
import { SIDEBAR_GUTTER } from "../../preview/components/SidebarStack.js";
|
|
3
3
|
import { ChatWidget } from "./ChatWidget.js";
|
|
4
|
-
import {
|
|
4
|
+
import { Specialists } from "./Specialists.js";
|
|
5
5
|
import { c } from "react/compiler-runtime";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
|
|
8
8
|
//#region src/features/studio/components/AgentSidebar.tsx
|
|
9
9
|
/**
|
|
10
|
-
* The sidebar on the Canvas's right side, where editors work with Camox's agent: the
|
|
11
|
-
* tall as its
|
|
12
|
-
* as the Content Sidebar is over its left: only the cards have a background, and the
|
|
13
|
-
* around them. Elsewhere in the studio it is only hidden, so the chat keeps its thread
|
|
14
|
-
* Preview and Studio pages follow the editor's runs too.
|
|
10
|
+
* The sidebar on the Canvas's right side, where editors work with Camox's agent: the Specialists,
|
|
11
|
+
* as tall as its specialists, over the Chat widget, which gets the rest of the height. Laid over
|
|
12
|
+
* the Canvas, as the Content Sidebar is over its left: only the cards have a background, and the
|
|
13
|
+
* Canvas shows around them. Elsewhere in the studio it is only hidden, so the chat keeps its thread
|
|
14
|
+
* and the Preview and Studio pages follow the editor's runs too.
|
|
15
15
|
*/
|
|
16
16
|
function AgentSidebar(t0) {
|
|
17
17
|
const $ = c(6);
|
|
@@ -24,7 +24,7 @@ function AgentSidebar(t0) {
|
|
|
24
24
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
25
25
|
t2 = cn("absolute inset-y-0 right-0 z-10 flex flex-col gap-2 py-2 max-md:hidden", SIDEBAR_GUTTER);
|
|
26
26
|
t3 = { width: 265 };
|
|
27
|
-
t4 = /* @__PURE__ */ jsx(
|
|
27
|
+
t4 = /* @__PURE__ */ jsx(Specialists, { className: "min-h-0 flex-[0_1_auto]" });
|
|
28
28
|
t5 = /* @__PURE__ */ jsx(ChatWidget, { className: "min-h-0 flex-[7_1_0]" });
|
|
29
29
|
$[0] = t2;
|
|
30
30
|
$[1] = t3;
|
|
@@ -26,8 +26,10 @@ import { EMPTY_THREAD_VIEW } from "@camox/api-contract/threads";
|
|
|
26
26
|
* When the agent on Live hands the editor's request off to a draft, the studio that asked enters
|
|
27
27
|
* it, if it still shows Live; the card the Live turn ends on opens it too. Each message tells the
|
|
28
28
|
* agent where the editor is: the page they look at, with what they selected on it unless they
|
|
29
|
-
* cleared it from the composer, or the Canvas with no page selected.
|
|
30
|
-
*
|
|
29
|
+
* cleared it from the composer, or the Canvas with no page selected. A message the studio sends
|
|
30
|
+
* from elsewhere (`studioStore`'s `sendToAgent`), such as Fix with agent's, goes out through the
|
|
31
|
+
* thread it follows, as if the editor had sent it. In a draft, it tells the studio whether a turn
|
|
32
|
+
* is going in the draft's thread, whoever started it, which publishing waits for.
|
|
31
33
|
*/
|
|
32
34
|
function ChatWidget(t0) {
|
|
33
35
|
const $ = c(6);
|
|
@@ -133,7 +135,7 @@ function CurrentThread() {
|
|
|
133
135
|
return t4;
|
|
134
136
|
}
|
|
135
137
|
function Thread(t0) {
|
|
136
|
-
const $ = c(
|
|
138
|
+
const $ = c(48);
|
|
137
139
|
const { apiUrl, projectId, draftId, onEnterDraft, onOpenDraft, composerCarry } = t0;
|
|
138
140
|
let t1;
|
|
139
141
|
if ($[0] !== onEnterDraft) {
|
|
@@ -143,65 +145,73 @@ function Thread(t0) {
|
|
|
143
145
|
} else t1 = $[1];
|
|
144
146
|
const { view, sending, send, stop, error, touched } = useThread(apiUrl, projectId, draftId, t1);
|
|
145
147
|
useAgentRunToast(view, draftId);
|
|
146
|
-
const follow = React.use(FollowAgentContext);
|
|
147
148
|
let t2;
|
|
148
|
-
if ($[2] !== follow) {
|
|
149
|
-
t2 = (batch) => follow?.receive(batch);
|
|
150
|
-
$[2] = follow;
|
|
151
|
-
$[3] = t2;
|
|
152
|
-
} else t2 = $[3];
|
|
153
|
-
const followTouched = React.useEffectEvent(t2);
|
|
154
149
|
let t3;
|
|
155
|
-
if ($[
|
|
156
|
-
|
|
157
|
-
if (
|
|
150
|
+
if ($[2] !== draftId || $[3] !== view.running) {
|
|
151
|
+
t2 = () => {
|
|
152
|
+
if (!draftId) return;
|
|
153
|
+
studioStore.trigger.agentWorking({
|
|
154
|
+
draftId,
|
|
155
|
+
working: view.running
|
|
156
|
+
});
|
|
157
|
+
return () => studioStore.trigger.agentWorking({
|
|
158
|
+
draftId,
|
|
159
|
+
working: false
|
|
160
|
+
});
|
|
158
161
|
};
|
|
159
|
-
|
|
160
|
-
$[
|
|
161
|
-
$[
|
|
162
|
-
|
|
162
|
+
t3 = [draftId, view.running];
|
|
163
|
+
$[2] = draftId;
|
|
164
|
+
$[3] = view.running;
|
|
165
|
+
$[4] = t2;
|
|
166
|
+
$[5] = t3;
|
|
167
|
+
} else {
|
|
168
|
+
t2 = $[4];
|
|
169
|
+
t3 = $[5];
|
|
170
|
+
}
|
|
171
|
+
React.useEffect(t2, t3);
|
|
172
|
+
const follow = React.use(FollowAgentContext);
|
|
163
173
|
let t4;
|
|
164
|
-
if ($[
|
|
165
|
-
t4 =
|
|
166
|
-
$[
|
|
167
|
-
$[
|
|
168
|
-
} else t4 = $[
|
|
169
|
-
React.
|
|
174
|
+
if ($[6] !== follow) {
|
|
175
|
+
t4 = (batch) => follow?.receive(batch);
|
|
176
|
+
$[6] = follow;
|
|
177
|
+
$[7] = t4;
|
|
178
|
+
} else t4 = $[7];
|
|
179
|
+
const followTouched = React.useEffectEvent(t4);
|
|
180
|
+
let t5;
|
|
181
|
+
if ($[8] !== followTouched || $[9] !== touched) {
|
|
182
|
+
t5 = () => {
|
|
183
|
+
if (touched) followTouched(touched.batch);
|
|
184
|
+
};
|
|
185
|
+
$[8] = followTouched;
|
|
186
|
+
$[9] = touched;
|
|
187
|
+
$[10] = t5;
|
|
188
|
+
} else t5 = $[10];
|
|
189
|
+
let t6;
|
|
190
|
+
if ($[11] !== touched) {
|
|
191
|
+
t6 = [touched];
|
|
192
|
+
$[11] = touched;
|
|
193
|
+
$[12] = t6;
|
|
194
|
+
} else t6 = $[12];
|
|
195
|
+
React.useEffect(t5, t6);
|
|
170
196
|
const where = React.use(EditorWhereContext);
|
|
171
197
|
const selection = useEditorSelection(where);
|
|
172
|
-
let
|
|
173
|
-
if ($[
|
|
174
|
-
|
|
198
|
+
let t7;
|
|
199
|
+
if ($[13] !== selection) {
|
|
200
|
+
t7 = selection ? JSON.stringify([
|
|
175
201
|
selection.blockId,
|
|
176
202
|
selection.itemId,
|
|
177
203
|
selection.recordId,
|
|
178
204
|
selection.fieldName
|
|
179
205
|
]) : null;
|
|
180
|
-
$[
|
|
181
|
-
$[
|
|
182
|
-
} else
|
|
183
|
-
const selectionKey =
|
|
206
|
+
$[13] = selection;
|
|
207
|
+
$[14] = t7;
|
|
208
|
+
} else t7 = $[14];
|
|
209
|
+
const selectionKey = t7;
|
|
184
210
|
const [cleared, setCleared] = React.useState(null);
|
|
185
211
|
if (cleared !== null && selectionKey !== cleared) setCleared(null);
|
|
186
212
|
const carried = selection && selectionKey !== cleared ? selection : void 0;
|
|
187
|
-
const asked = useSelector(studioStore, _temp);
|
|
188
|
-
let t6;
|
|
189
|
-
let t7;
|
|
190
|
-
if ($[11] !== asked) {
|
|
191
|
-
t6 = () => {
|
|
192
|
-
if (asked) studioStore.trigger.takeAgentAsk();
|
|
193
|
-
};
|
|
194
|
-
t7 = [asked];
|
|
195
|
-
$[11] = asked;
|
|
196
|
-
$[12] = t6;
|
|
197
|
-
$[13] = t7;
|
|
198
|
-
} else {
|
|
199
|
-
t6 = $[12];
|
|
200
|
-
t7 = $[13];
|
|
201
|
-
}
|
|
202
|
-
React.useEffect(t6, t7);
|
|
203
213
|
let t8;
|
|
204
|
-
if ($[
|
|
214
|
+
if ($[15] !== carried || $[16] !== follow || $[17] !== send || $[18] !== where) {
|
|
205
215
|
t8 = (text) => {
|
|
206
216
|
follow?.resume();
|
|
207
217
|
send(text, where?.on === "page" && carried ? {
|
|
@@ -209,84 +219,110 @@ function Thread(t0) {
|
|
|
209
219
|
selection: carried
|
|
210
220
|
} : where);
|
|
211
221
|
};
|
|
212
|
-
$[
|
|
213
|
-
$[
|
|
214
|
-
$[
|
|
215
|
-
$[
|
|
216
|
-
$[
|
|
217
|
-
} else t8 = $[
|
|
222
|
+
$[15] = carried;
|
|
223
|
+
$[16] = follow;
|
|
224
|
+
$[17] = send;
|
|
225
|
+
$[18] = where;
|
|
226
|
+
$[19] = t8;
|
|
227
|
+
} else t8 = $[19];
|
|
218
228
|
const sendFollowing = t8;
|
|
229
|
+
const waiting = useSelector(studioStore, _temp);
|
|
219
230
|
let t9;
|
|
220
|
-
if ($[
|
|
221
|
-
t9 =
|
|
231
|
+
if ($[20] !== sendFollowing) {
|
|
232
|
+
t9 = () => {
|
|
233
|
+
for (const message of studioStore.getSnapshot().context.agentMessages) {
|
|
234
|
+
studioStore.trigger.takeAgentMessage({ id: message.id });
|
|
235
|
+
sendFollowing(message.text);
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
$[20] = sendFollowing;
|
|
239
|
+
$[21] = t9;
|
|
240
|
+
} else t9 = $[21];
|
|
241
|
+
const sendWaiting = React.useEffectEvent(t9);
|
|
242
|
+
let t10;
|
|
243
|
+
if ($[22] !== sendWaiting || $[23] !== waiting) {
|
|
244
|
+
t10 = () => {
|
|
245
|
+
if (waiting.length > 0) sendWaiting();
|
|
246
|
+
};
|
|
247
|
+
$[22] = sendWaiting;
|
|
248
|
+
$[23] = waiting;
|
|
249
|
+
$[24] = t10;
|
|
250
|
+
} else t10 = $[24];
|
|
251
|
+
let t11;
|
|
252
|
+
if ($[25] !== waiting) {
|
|
253
|
+
t11 = [waiting];
|
|
254
|
+
$[25] = waiting;
|
|
255
|
+
$[26] = t11;
|
|
256
|
+
} else t11 = $[26];
|
|
257
|
+
React.useEffect(t10, t11);
|
|
258
|
+
let t12;
|
|
259
|
+
if ($[27] !== onOpenDraft || $[28] !== sending || $[29] !== view) {
|
|
260
|
+
t12 = /* @__PURE__ */ jsx(ThreadMessages, {
|
|
222
261
|
view,
|
|
223
262
|
sending,
|
|
224
263
|
onOpenDraft
|
|
225
264
|
});
|
|
226
|
-
$[
|
|
227
|
-
$[
|
|
228
|
-
$[
|
|
229
|
-
$[
|
|
230
|
-
} else
|
|
231
|
-
let
|
|
232
|
-
if ($[
|
|
233
|
-
|
|
265
|
+
$[27] = onOpenDraft;
|
|
266
|
+
$[28] = sending;
|
|
267
|
+
$[29] = view;
|
|
268
|
+
$[30] = t12;
|
|
269
|
+
} else t12 = $[30];
|
|
270
|
+
let t13;
|
|
271
|
+
if ($[31] !== error) {
|
|
272
|
+
t13 = error && /* @__PURE__ */ jsx("p", {
|
|
234
273
|
role: "alert",
|
|
235
274
|
className: "text-destructive px-2 pt-2 text-sm",
|
|
236
275
|
children: error
|
|
237
276
|
});
|
|
238
|
-
$[
|
|
239
|
-
$[
|
|
240
|
-
} else
|
|
241
|
-
let t11;
|
|
242
|
-
if ($[25] !== carried?.path) {
|
|
243
|
-
t11 = carried?.path.at(-1);
|
|
244
|
-
$[25] = carried?.path;
|
|
245
|
-
$[26] = t11;
|
|
246
|
-
} else t11 = $[26];
|
|
247
|
-
let t12;
|
|
248
|
-
if ($[27] !== selectionKey) {
|
|
249
|
-
t12 = () => selectionKey !== null && setCleared(selectionKey);
|
|
250
|
-
$[27] = selectionKey;
|
|
251
|
-
$[28] = t12;
|
|
252
|
-
} else t12 = $[28];
|
|
253
|
-
const t13 = asked ?? void 0;
|
|
277
|
+
$[31] = error;
|
|
278
|
+
$[32] = t13;
|
|
279
|
+
} else t13 = $[32];
|
|
254
280
|
let t14;
|
|
255
|
-
if ($[
|
|
256
|
-
t14 =
|
|
281
|
+
if ($[33] !== carried?.path) {
|
|
282
|
+
t14 = carried?.path.at(-1);
|
|
283
|
+
$[33] = carried?.path;
|
|
284
|
+
$[34] = t14;
|
|
285
|
+
} else t14 = $[34];
|
|
286
|
+
let t15;
|
|
287
|
+
if ($[35] !== selectionKey) {
|
|
288
|
+
t15 = () => selectionKey !== null && setCleared(selectionKey);
|
|
289
|
+
$[35] = selectionKey;
|
|
290
|
+
$[36] = t15;
|
|
291
|
+
} else t15 = $[36];
|
|
292
|
+
let t16;
|
|
293
|
+
if ($[37] !== composerCarry || $[38] !== sendFollowing || $[39] !== stop || $[40] !== t14 || $[41] !== t15 || $[42] !== view.running) {
|
|
294
|
+
t16 = /* @__PURE__ */ jsx(ThreadComposer, {
|
|
257
295
|
onSend: sendFollowing,
|
|
258
296
|
onStop: stop,
|
|
259
|
-
selection:
|
|
260
|
-
onClearSelection:
|
|
297
|
+
selection: t14,
|
|
298
|
+
onClearSelection: t15,
|
|
261
299
|
running: view.running,
|
|
262
|
-
filled: t13,
|
|
263
300
|
carry: composerCarry
|
|
264
301
|
});
|
|
265
|
-
$[
|
|
266
|
-
$[
|
|
267
|
-
$[
|
|
268
|
-
$[
|
|
269
|
-
$[
|
|
270
|
-
$[
|
|
271
|
-
$[
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
t14
|
|
302
|
+
$[37] = composerCarry;
|
|
303
|
+
$[38] = sendFollowing;
|
|
304
|
+
$[39] = stop;
|
|
305
|
+
$[40] = t14;
|
|
306
|
+
$[41] = t15;
|
|
307
|
+
$[42] = view.running;
|
|
308
|
+
$[43] = t16;
|
|
309
|
+
} else t16 = $[43];
|
|
310
|
+
let t17;
|
|
311
|
+
if ($[44] !== t12 || $[45] !== t13 || $[46] !== t16) {
|
|
312
|
+
t17 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
313
|
+
t12,
|
|
314
|
+
t13,
|
|
315
|
+
t16
|
|
280
316
|
] });
|
|
281
|
-
$[
|
|
282
|
-
$[
|
|
283
|
-
$[
|
|
284
|
-
$[
|
|
285
|
-
} else
|
|
286
|
-
return
|
|
317
|
+
$[44] = t12;
|
|
318
|
+
$[45] = t13;
|
|
319
|
+
$[46] = t16;
|
|
320
|
+
$[47] = t17;
|
|
321
|
+
} else t17 = $[47];
|
|
322
|
+
return t17;
|
|
287
323
|
}
|
|
288
324
|
function _temp(state) {
|
|
289
|
-
return state.context.
|
|
325
|
+
return state.context.agentMessages;
|
|
290
326
|
}
|
|
291
327
|
|
|
292
328
|
//#endregion
|