camox 0.66.0 → 0.68.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/dist/core/editing/createEditableBlock.js +2 -1
- package/dist/features/content/components/MissingFromLocale.js +1 -1
- package/dist/features/page/UnplacedLayoutContent.js +141 -0
- package/dist/features/preview/components/ItemFieldsEditor.js +50 -44
- package/dist/features/preview/components/PreviewToolbar.js +77 -68
- package/dist/features/preview/components/SelectionEditor.js +284 -231
- package/dist/features/preview/components/contentFieldSchema.js +5 -1
- package/dist/features/preview/repeatableItemTargets.js +13 -7
- package/dist/features/runtime/RuntimeChrome.js +47 -61
- package/dist/features/runtime/pageApp.js +24 -10
- package/dist/features/runtime/runtime.d.ts +13 -0
- package/dist/features/runtime/runtime.js +58 -2
- package/dist/features/studio/components/ChatWidget.js +3 -4
- package/dist/features/studio/components/ConnectAgent.js +33 -59
- package/dist/features/studio/components/ContentFindings.js +397 -0
- package/dist/features/studio/components/DraftBar.js +139 -0
- package/dist/features/studio/components/DraftsControl.js +13 -57
- package/dist/features/studio/components/Navbar.js +3 -2
- package/dist/features/studio/components/Patrol.js +52 -34
- package/dist/features/studio/components/ReviewDraftSheet.js +4 -4
- package/dist/features/studio/components/Squareling.js +0 -9
- package/dist/features/studio/components/UserButton.js +7 -11
- package/dist/features/studio/findingSentence.js +3 -5
- package/dist/features/studio/patrollerBio.js +0 -1
- package/dist/features/studio/reportSentence.js +0 -5
- package/dist/features/studio/studioStore.js +0 -13
- package/dist/features/studio/workingSentence.js +0 -4
- package/dist/package.js +1 -1
- package/dist/studio.css +1 -1
- package/package.json +4 -4
- package/dist/features/studio/components/UnnamedDraftBar.js +0 -349
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
//#region src/features/preview/repeatableItemTargets.ts
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* The registry lives on the document, not in this module: the renderer document
|
|
4
|
+
* registers items with its own copy of the SDK, and the studio's copy observes them.
|
|
5
|
+
* `Symbol.for` resolves to the same symbol in every realm.
|
|
6
|
+
*/
|
|
7
|
+
const REGISTRY = Symbol.for("camox.repeatableItems");
|
|
8
|
+
function existingRegistry(document) {
|
|
9
|
+
return document[REGISTRY];
|
|
10
|
+
}
|
|
3
11
|
function registryOf(document) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
registry = {
|
|
12
|
+
const owner = document;
|
|
13
|
+
owner[REGISTRY] ??= {
|
|
7
14
|
items: /* @__PURE__ */ new Set(),
|
|
8
15
|
listeners: /* @__PURE__ */ new Set()
|
|
9
16
|
};
|
|
10
|
-
|
|
11
|
-
return registry;
|
|
17
|
+
return owner[REGISTRY];
|
|
12
18
|
}
|
|
13
19
|
function notify(registry, kind) {
|
|
14
20
|
for (const listener of registry.listeners) listener(kind);
|
|
@@ -41,7 +47,7 @@ function fragmentsOf(element) {
|
|
|
41
47
|
/** Each registered item with its first-level elements, in document order. */
|
|
42
48
|
function repeatableItemElements(document) {
|
|
43
49
|
const result = /* @__PURE__ */ new Map();
|
|
44
|
-
const items =
|
|
50
|
+
const items = existingRegistry(document)?.items;
|
|
45
51
|
if (!items?.size) return result;
|
|
46
52
|
for (const item of items) result.set(item, []);
|
|
47
53
|
for (const element of document.querySelectorAll("*")) {
|
|
@@ -3,9 +3,9 @@ import { shownRecordPage } from "../preview/pageRecord.js";
|
|
|
3
3
|
import { StudioEditingFallback } from "../preview/components/StudioEditingFallback.js";
|
|
4
4
|
import { Navbar } from "../studio/components/Navbar.js";
|
|
5
5
|
import { EditingFallbackContext } from "./editingFallback.js";
|
|
6
|
+
import { DraftBar } from "../studio/components/DraftBar.js";
|
|
6
7
|
import { PreviewToolbar } from "../preview/components/PreviewToolbar.js";
|
|
7
8
|
import { AgentSidebar } from "../studio/components/AgentSidebar.js";
|
|
8
|
-
import { UnnamedDraftBar } from "../studio/components/UnnamedDraftBar.js";
|
|
9
9
|
import { FollowAgentProvider } from "../studio/FollowAgentProvider.js";
|
|
10
10
|
import { c } from "react/compiler-runtime";
|
|
11
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -15,7 +15,7 @@ import studioCssUrl from "virtual:camox-studio-css";
|
|
|
15
15
|
//#region src/features/runtime/RuntimeChrome.tsx
|
|
16
16
|
const renderEditingFallback = ({ layoutPage }) => /* @__PURE__ */ jsx(StudioEditingFallback, { layoutPage });
|
|
17
17
|
function RuntimeChrome(t0) {
|
|
18
|
-
const $ = c(
|
|
18
|
+
const $ = c(35);
|
|
19
19
|
const { input, children } = t0;
|
|
20
20
|
const website = !input.routeKind;
|
|
21
21
|
const hidden = useSelector(previewStore, _temp);
|
|
@@ -93,81 +93,67 @@ function RuntimeChrome(t0) {
|
|
|
93
93
|
$[15] = t11;
|
|
94
94
|
$[16] = t13;
|
|
95
95
|
} else t13 = $[16];
|
|
96
|
-
|
|
97
|
-
const t15 = website ? "max-md:hidden" : void 0;
|
|
98
|
-
let t16;
|
|
96
|
+
let t14;
|
|
99
97
|
if ($[17] !== website) {
|
|
100
|
-
|
|
98
|
+
t14 = !website && /* @__PURE__ */ jsx(DraftBar, {});
|
|
101
99
|
$[17] = website;
|
|
102
|
-
$[18] =
|
|
103
|
-
} else
|
|
104
|
-
let
|
|
105
|
-
if ($[19] !==
|
|
106
|
-
|
|
107
|
-
hidden: t14,
|
|
108
|
-
className: t15,
|
|
109
|
-
children: t16
|
|
110
|
-
});
|
|
111
|
-
$[19] = t14;
|
|
112
|
-
$[20] = t15;
|
|
113
|
-
$[21] = t16;
|
|
114
|
-
$[22] = t17;
|
|
115
|
-
} else t17 = $[22];
|
|
116
|
-
let t18;
|
|
117
|
-
if ($[23] !== t13 || $[24] !== t17 || $[25] !== t9) {
|
|
118
|
-
t18 = /* @__PURE__ */ jsxs("div", {
|
|
100
|
+
$[18] = t14;
|
|
101
|
+
} else t14 = $[18];
|
|
102
|
+
let t15;
|
|
103
|
+
if ($[19] !== t13 || $[20] !== t14 || $[21] !== t9) {
|
|
104
|
+
t15 = /* @__PURE__ */ jsxs("div", {
|
|
119
105
|
className: "relative flex min-h-0 min-w-0 flex-1 flex-col",
|
|
120
106
|
children: [
|
|
121
107
|
t9,
|
|
122
108
|
t13,
|
|
123
|
-
|
|
109
|
+
t14
|
|
124
110
|
]
|
|
125
111
|
});
|
|
126
|
-
$[
|
|
112
|
+
$[19] = t13;
|
|
113
|
+
$[20] = t14;
|
|
114
|
+
$[21] = t9;
|
|
115
|
+
$[22] = t15;
|
|
116
|
+
} else t15 = $[22];
|
|
117
|
+
const t16 = !showAgentSidebar;
|
|
118
|
+
let t17;
|
|
119
|
+
if ($[23] !== t16) {
|
|
120
|
+
t17 = /* @__PURE__ */ jsx(AgentSidebar, { hidden: t16 });
|
|
121
|
+
$[23] = t16;
|
|
127
122
|
$[24] = t17;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
let t20;
|
|
133
|
-
if ($[27] !== t19) {
|
|
134
|
-
t20 = /* @__PURE__ */ jsx(AgentSidebar, { hidden: t19 });
|
|
135
|
-
$[27] = t19;
|
|
136
|
-
$[28] = t20;
|
|
137
|
-
} else t20 = $[28];
|
|
138
|
-
let t21;
|
|
139
|
-
if ($[29] !== t18 || $[30] !== t20) {
|
|
140
|
-
t21 = /* @__PURE__ */ jsxs("div", {
|
|
123
|
+
} else t17 = $[24];
|
|
124
|
+
let t18;
|
|
125
|
+
if ($[25] !== t15 || $[26] !== t17) {
|
|
126
|
+
t18 = /* @__PURE__ */ jsxs("div", {
|
|
141
127
|
className: "relative flex min-h-0 flex-1",
|
|
142
|
-
children: [
|
|
128
|
+
children: [t15, t17]
|
|
143
129
|
});
|
|
144
|
-
$[
|
|
145
|
-
$[
|
|
146
|
-
$[
|
|
147
|
-
} else
|
|
148
|
-
let
|
|
149
|
-
if ($[
|
|
150
|
-
|
|
130
|
+
$[25] = t15;
|
|
131
|
+
$[26] = t17;
|
|
132
|
+
$[27] = t18;
|
|
133
|
+
} else t18 = $[27];
|
|
134
|
+
let t19;
|
|
135
|
+
if ($[28] !== t18 || $[29] !== t7) {
|
|
136
|
+
t19 = /* @__PURE__ */ jsxs("div", {
|
|
151
137
|
className: "bg-background flex h-screen flex-col overflow-hidden",
|
|
152
|
-
children: [t7,
|
|
138
|
+
children: [t7, t18]
|
|
153
139
|
});
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
} else
|
|
158
|
-
let
|
|
159
|
-
if ($[
|
|
160
|
-
|
|
140
|
+
$[28] = t18;
|
|
141
|
+
$[29] = t7;
|
|
142
|
+
$[30] = t19;
|
|
143
|
+
} else t19 = $[30];
|
|
144
|
+
let t20;
|
|
145
|
+
if ($[31] !== input.runtimeBasePath || $[32] !== t19 || $[33] !== website) {
|
|
146
|
+
t20 = /* @__PURE__ */ jsxs(FollowAgentProvider, {
|
|
161
147
|
runtimeBasePath: t1,
|
|
162
148
|
website,
|
|
163
|
-
children: [t2,
|
|
149
|
+
children: [t2, t19]
|
|
164
150
|
});
|
|
165
|
-
$[
|
|
166
|
-
$[
|
|
167
|
-
$[
|
|
168
|
-
$[
|
|
169
|
-
} else
|
|
170
|
-
return
|
|
151
|
+
$[31] = input.runtimeBasePath;
|
|
152
|
+
$[32] = t19;
|
|
153
|
+
$[33] = website;
|
|
154
|
+
$[34] = t20;
|
|
155
|
+
} else t20 = $[34];
|
|
156
|
+
return t20;
|
|
171
157
|
}
|
|
172
158
|
function _temp(state) {
|
|
173
159
|
return state.context.isToolbarHidden;
|
|
@@ -9,6 +9,7 @@ import { CoreCamoxProvider } from "../provider/CoreCamoxProvider.js";
|
|
|
9
9
|
import { CuratedPageContent } from "../page/CuratedPageContent.js";
|
|
10
10
|
import { DerivedPageContent } from "../page/DerivedPageContent.js";
|
|
11
11
|
import { UnplacedBlockContent } from "../page/UnplacedBlockContent.js";
|
|
12
|
+
import { UnplacedLayoutContent } from "../page/UnplacedLayoutContent.js";
|
|
12
13
|
import { EditingFallbackSlot } from "./editingFallback.js";
|
|
13
14
|
import { PageNavigationProvider } from "./pageNavigation.js";
|
|
14
15
|
import { RuntimeChromeSlot } from "./runtimeChromeLoader.js";
|
|
@@ -252,9 +253,9 @@ function _temp2() {
|
|
|
252
253
|
function _temp() {
|
|
253
254
|
return true;
|
|
254
255
|
}
|
|
255
|
-
/** The page's blocks, read-only, or the look document's
|
|
256
|
+
/** The page's blocks, read-only, or the look document's unplaced block or Layout. */
|
|
256
257
|
function PageContent(t0) {
|
|
257
|
-
const $ = c(
|
|
258
|
+
const $ = c(9);
|
|
258
259
|
const { camoxApp, input } = t0;
|
|
259
260
|
if (input.lookBlock) {
|
|
260
261
|
let t1;
|
|
@@ -265,24 +266,37 @@ function PageContent(t0) {
|
|
|
265
266
|
} else t1 = $[1];
|
|
266
267
|
return t1;
|
|
267
268
|
}
|
|
268
|
-
if (input.
|
|
269
|
+
if (input.lookLayout) {
|
|
269
270
|
let t1;
|
|
270
|
-
if ($[2] !== camoxApp || $[3] !== input.
|
|
271
|
-
t1 = /* @__PURE__ */ jsx(
|
|
271
|
+
if ($[2] !== camoxApp || $[3] !== input.lookLayout) {
|
|
272
|
+
t1 = /* @__PURE__ */ jsx(UnplacedLayoutContent, {
|
|
272
273
|
camoxApp,
|
|
273
|
-
|
|
274
|
+
lookLayout: input.lookLayout
|
|
274
275
|
});
|
|
275
276
|
$[2] = camoxApp;
|
|
276
|
-
$[3] = input.
|
|
277
|
+
$[3] = input.lookLayout;
|
|
277
278
|
$[4] = t1;
|
|
278
279
|
} else t1 = $[4];
|
|
279
280
|
return t1;
|
|
280
281
|
}
|
|
282
|
+
if (input.derived) {
|
|
283
|
+
let t1;
|
|
284
|
+
if ($[5] !== camoxApp || $[6] !== input.derived) {
|
|
285
|
+
t1 = /* @__PURE__ */ jsx(DerivedPageContent, {
|
|
286
|
+
camoxApp,
|
|
287
|
+
derived: input.derived
|
|
288
|
+
});
|
|
289
|
+
$[5] = camoxApp;
|
|
290
|
+
$[6] = input.derived;
|
|
291
|
+
$[7] = t1;
|
|
292
|
+
} else t1 = $[7];
|
|
293
|
+
return t1;
|
|
294
|
+
}
|
|
281
295
|
let t1;
|
|
282
|
-
if ($[
|
|
296
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
283
297
|
t1 = /* @__PURE__ */ jsx(CuratedPageContent, {});
|
|
284
|
-
$[
|
|
285
|
-
} else t1 = $[
|
|
298
|
+
$[8] = t1;
|
|
299
|
+
} else t1 = $[8];
|
|
286
300
|
return t1;
|
|
287
301
|
}
|
|
288
302
|
function StudioLoadError() {
|
|
@@ -6,6 +6,7 @@ import { AnalyticsProviders } from "./analytics.js";
|
|
|
6
6
|
import { RuntimeOwnedRouteKind } from "./runtimeRoutes.js";
|
|
7
7
|
import { StudioRenderInput } from "./studioApp.js";
|
|
8
8
|
import { DraftRead, MemberProject, PageHead, createServerApiClient } from "../routes/pageRuntime.js";
|
|
9
|
+
import { LookPlaceholderHeight } from "@camox/api-contract/drafts";
|
|
9
10
|
import { UseHeadInput } from "unhead/types";
|
|
10
11
|
//#region src/features/runtime/runtime.d.ts
|
|
11
12
|
/** The studio's own routes, rather than a page or the Canvas. */
|
|
@@ -39,6 +40,18 @@ export interface PageRenderInput extends DraftRead {
|
|
|
39
40
|
* instead of a page. Its block bundle is in the dehydrated state.
|
|
40
41
|
*/
|
|
41
42
|
lookBlock?: string;
|
|
43
|
+
/**
|
|
44
|
+
* The look document's Layout Definition mode: the curated Layout it shows around no page, its
|
|
45
|
+
* blocks' bundles in the dehydrated state, with a placeholder `placeholder` tall where a page's
|
|
46
|
+
* content goes.
|
|
47
|
+
*/
|
|
48
|
+
lookLayout?: {
|
|
49
|
+
layoutId: string;
|
|
50
|
+
layout: Awaited<ReturnType<ReturnType<typeof createServerApiClient>["layouts"]["getUnplaced"]>>["layout"];
|
|
51
|
+
placeholder: LookPlaceholderHeight;
|
|
52
|
+
path: string;
|
|
53
|
+
projectName: string;
|
|
54
|
+
};
|
|
42
55
|
/**
|
|
43
56
|
* Whether this is the look document (ADR 0032), whose client only shows the draft: it asks
|
|
44
57
|
* nothing about a session and offers no sign-in, which would add requests to its captures.
|
|
@@ -27,7 +27,7 @@ import { getPageBlockTypes } from "./pageBlockTypes.js";
|
|
|
27
27
|
import { withPageUrls } from "./structuredData.js";
|
|
28
28
|
import { curatedPageDescription, pageRecords, placedBlockNodes, withStructuredData } from "./pageGraph.js";
|
|
29
29
|
import { createProjectLogoResponse, projectLogo } from "./projectLogo.js";
|
|
30
|
-
import { DRAFT_SEARCH_PARAM, LOCALE_HEADER, LOOK_BLOCK_DEFINITION_PARAM, LOOK_CONTENT_PARAM, LOOK_LOCALE_PARAM, LOOK_PATH_PARAM, LOOK_SETTINGS_PARAM, UNPLACED_BLOCK_ID } from "@camox/api-contract/drafts";
|
|
30
|
+
import { DRAFT_SEARCH_PARAM, LOCALE_HEADER, LOOK_BLOCKS_PARAM, LOOK_BLOCK_DEFINITION_PARAM, LOOK_CONTENT_PARAM, LOOK_LAYOUT_DEFINITION_PARAM, LOOK_LOCALE_PARAM, LOOK_PATH_PARAM, LOOK_PLACEHOLDER_HEIGHTS, LOOK_PLACEHOLDER_PARAM, LOOK_SETTINGS_PARAM, UNPLACED_BLOCK_ID } from "@camox/api-contract/drafts";
|
|
31
31
|
import { QueryClient, dehydrate } from "@tanstack/react-query";
|
|
32
32
|
import { createHead, renderSSRHead } from "@unhead/react/server";
|
|
33
33
|
|
|
@@ -571,6 +571,7 @@ async function createLookDocumentResponse(request, options) {
|
|
|
571
571
|
if (!lookToken || !draftId || !apiUrl || !authenticationUrl || !projectUuid || !renderPage) return lookNotFound();
|
|
572
572
|
const tag = searchParams.get(LOOK_LOCALE_PARAM)?.toLowerCase();
|
|
573
573
|
const blockDefinition = searchParams.get(LOOK_BLOCK_DEFINITION_PARAM);
|
|
574
|
+
const layoutDefinition = searchParams.get(LOOK_LAYOUT_DEFINITION_PARAM);
|
|
574
575
|
const queryClient = new QueryClient();
|
|
575
576
|
let locales;
|
|
576
577
|
let locale;
|
|
@@ -590,7 +591,7 @@ async function createLookDocumentResponse(request, options) {
|
|
|
590
591
|
projectUuid,
|
|
591
592
|
queryClient
|
|
592
593
|
};
|
|
593
|
-
shown = blockDefinition ? await lookAtBlockDefinition(request, options, reading, blockDefinition) : await lookAtPage(request, options, reading);
|
|
594
|
+
shown = layoutDefinition ? await lookAtLayoutDefinition(request, options, reading, layoutDefinition) : blockDefinition ? await lookAtBlockDefinition(request, options, reading, blockDefinition) : await lookAtPage(request, options, reading);
|
|
594
595
|
} catch (error) {
|
|
595
596
|
if (isAuthSessionError(error) || isNotFoundError(error)) return lookNotFound();
|
|
596
597
|
throw error;
|
|
@@ -806,6 +807,61 @@ async function lookAtBlockDefinition(request, options, reading, type) {
|
|
|
806
807
|
lookBlock: UNPLACED_BLOCK_ID
|
|
807
808
|
};
|
|
808
809
|
}
|
|
810
|
+
/**
|
|
811
|
+
* The look document's Layout Definition mode: the curated Layout `layoutId` around no page, its
|
|
812
|
+
* blocks with their default content and Block Settings and the overrides the URL gives merged on,
|
|
813
|
+
* by the API, which checks them against their schemas and refuses a Singleton or Derived Layout,
|
|
814
|
+
* answering its message. Where a page's content goes, a labelled placeholder as tall as the URL
|
|
815
|
+
* says. Its path is the Locale's home, which links resolve against.
|
|
816
|
+
*/
|
|
817
|
+
async function lookAtLayoutDefinition(request, options, reading, layoutId) {
|
|
818
|
+
const { apiUrl, lookToken, draftId, locale, projectUuid, queryClient } = reading;
|
|
819
|
+
const { searchParams } = new URL(request.url);
|
|
820
|
+
const blocks = overrideParam(searchParams, LOOK_BLOCKS_PARAM);
|
|
821
|
+
if (!blocks.ok) return lookRefused(blocks.error);
|
|
822
|
+
const placeholder = searchParams.get(LOOK_PLACEHOLDER_PARAM) ?? LOOK_PLACEHOLDER_HEIGHTS[0];
|
|
823
|
+
if (!LOOK_PLACEHOLDER_HEIGHTS.includes(placeholder)) return lookRefused(`The placeholder is ${LOOK_PLACEHOLDER_HEIGHTS.join(" or ")}.`);
|
|
824
|
+
const studioCache = createServerStudioCache(queryClient, {
|
|
825
|
+
apiUrl,
|
|
826
|
+
lookToken,
|
|
827
|
+
locale
|
|
828
|
+
});
|
|
829
|
+
const inDraft = { in: draftId };
|
|
830
|
+
let shared;
|
|
831
|
+
try {
|
|
832
|
+
[shared] = await Promise.all([createServerApiClient(apiUrl, {
|
|
833
|
+
lookToken,
|
|
834
|
+
draftId,
|
|
835
|
+
locale
|
|
836
|
+
}).layouts.getUnplaced({
|
|
837
|
+
projectUuid,
|
|
838
|
+
layoutId,
|
|
839
|
+
blocks: blocks.value
|
|
840
|
+
}), studioCache.ensure(reads.pageList({ projectUuid }), inDraft).catch(() => null)]);
|
|
841
|
+
} catch (error) {
|
|
842
|
+
if (isBadRequestError(error)) return lookRefused(error.message);
|
|
843
|
+
throw error;
|
|
844
|
+
}
|
|
845
|
+
studioCache.land(reads.layoutStructure({
|
|
846
|
+
projectUuid,
|
|
847
|
+
layoutId
|
|
848
|
+
}), shared, inDraft);
|
|
849
|
+
const pathname = localizedPath("/", locale);
|
|
850
|
+
return {
|
|
851
|
+
head: {},
|
|
852
|
+
href: lookHref(request, options, pathname, draftId).href,
|
|
853
|
+
layoutIdentity: null,
|
|
854
|
+
loaderData: null,
|
|
855
|
+
pathname,
|
|
856
|
+
lookLayout: {
|
|
857
|
+
layoutId,
|
|
858
|
+
layout: shared.layout,
|
|
859
|
+
placeholder,
|
|
860
|
+
path: pathname,
|
|
861
|
+
projectName: shared.projectName
|
|
862
|
+
}
|
|
863
|
+
};
|
|
864
|
+
}
|
|
809
865
|
/** Whether an API error refused the request's input, such as an override its schema refuses. */
|
|
810
866
|
function isBadRequestError(error) {
|
|
811
867
|
const { code, status } = error ?? {};
|
|
@@ -9,7 +9,6 @@ import { FollowAgentContext } from "../followAgentContext.js";
|
|
|
9
9
|
import { useThread } from "../../../lib/use-thread.js";
|
|
10
10
|
import { EditorWhereContext } from "../editorWhereContext.js";
|
|
11
11
|
import { useEditorSelection } from "../useEditorSelection.js";
|
|
12
|
-
import { ConnectAgent } from "./ConnectAgent.js";
|
|
13
12
|
import { ThreadComposer, useComposerCarrier } from "./ThreadComposer.js";
|
|
14
13
|
import { ThreadMessages } from "./ThreadMessages.js";
|
|
15
14
|
import { c } from "react/compiler-runtime";
|
|
@@ -27,7 +26,7 @@ import { EMPTY_THREAD_VIEW } from "@camox/api-contract/threads";
|
|
|
27
26
|
* it, if it still shows Live; the card the Live turn ends on opens it too. Each message tells the
|
|
28
27
|
* agent where the editor is: the page they look at, with what they selected on it unless they
|
|
29
28
|
* cleared it from the composer, or the Canvas with no page selected. "Ask the agent" elsewhere in
|
|
30
|
-
* the studio fills its composer.
|
|
29
|
+
* the studio fills its composer.
|
|
31
30
|
*/
|
|
32
31
|
function ChatWidget(t0) {
|
|
33
32
|
const $ = c(6);
|
|
@@ -48,9 +47,9 @@ function ChatWidget(t0) {
|
|
|
48
47
|
children: "Agent"
|
|
49
48
|
})
|
|
50
49
|
});
|
|
51
|
-
t3 = /* @__PURE__ */
|
|
50
|
+
t3 = /* @__PURE__ */ jsx("div", {
|
|
52
51
|
className: cn("bg-background flex min-h-0 flex-1 flex-col", CARD_BODY_EDGES),
|
|
53
|
-
children:
|
|
52
|
+
children: /* @__PURE__ */ jsx(CurrentThread, {})
|
|
54
53
|
});
|
|
55
54
|
$[2] = t2;
|
|
56
55
|
$[3] = t3;
|
|
@@ -6,12 +6,10 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
import { Button } from "@camox/ui/button";
|
|
7
7
|
import { Check, Copy, ExternalLink } from "lucide-react";
|
|
8
8
|
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@camox/ui/dialog";
|
|
9
|
-
import { Avatar, AvatarFallback, AvatarGroup } from "@camox/ui/avatar";
|
|
10
9
|
|
|
11
10
|
//#region src/features/studio/components/ConnectAgent.tsx
|
|
12
11
|
/**
|
|
13
|
-
* Common AI apps that take a remote MCP server, with their guide to adding one.
|
|
14
|
-
* each one overlaps the one before it, so the last is on top.
|
|
12
|
+
* Common AI apps that take a remote MCP server, with their guide to adding one.
|
|
15
13
|
*/
|
|
16
14
|
const CLIENTS = [
|
|
17
15
|
{
|
|
@@ -125,56 +123,42 @@ function GrokBotLogo(t0) {
|
|
|
125
123
|
return t7;
|
|
126
124
|
}
|
|
127
125
|
/**
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
126
|
+
* In the navbar, what invites a member to connect their own agent to Camox as a Connected Agent
|
|
127
|
+
* (ADR 0030): a button opening a dialog with the link to Camox's MCP server and each common AI
|
|
128
|
+
* app's guide to adding an MCP server.
|
|
131
129
|
*/
|
|
132
130
|
function ConnectAgent() {
|
|
133
|
-
const $ = c(
|
|
131
|
+
const $ = c(4);
|
|
134
132
|
const [open, setOpen] = React.useState(false);
|
|
135
133
|
let t0;
|
|
136
134
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
137
|
-
t0 =
|
|
135
|
+
t0 = /* @__PURE__ */ jsx(Button, {
|
|
136
|
+
type: "button",
|
|
137
|
+
variant: "outline",
|
|
138
|
+
onClick: () => setOpen(true),
|
|
139
|
+
children: "Connect your agent"
|
|
140
|
+
});
|
|
138
141
|
$[0] = t0;
|
|
139
142
|
} else t0 = $[0];
|
|
140
143
|
let t1;
|
|
141
144
|
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
142
|
-
t1 = /* @__PURE__ */
|
|
143
|
-
type: "button",
|
|
144
|
-
onClick: t0,
|
|
145
|
-
className: "hover:bg-muted text-muted-foreground hover:text-foreground mx-2 mb-2 flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm transition-colors",
|
|
146
|
-
children: [/* @__PURE__ */ jsx(AvatarGroup, { children: CLIENTS.map(_temp) }), "Connect your AI"]
|
|
147
|
-
});
|
|
145
|
+
t1 = /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(ConnectAgentContent, {}) });
|
|
148
146
|
$[1] = t1;
|
|
149
147
|
} else t1 = $[1];
|
|
150
148
|
let t2;
|
|
151
|
-
if ($[2]
|
|
152
|
-
t2 = /* @__PURE__ */
|
|
153
|
-
$[2] = t2;
|
|
154
|
-
} else t2 = $[2];
|
|
155
|
-
let t3;
|
|
156
|
-
if ($[3] !== open) {
|
|
157
|
-
t3 = /* @__PURE__ */ jsxs(Fragment, { children: [t1, /* @__PURE__ */ jsx(Dialog, {
|
|
149
|
+
if ($[2] !== open) {
|
|
150
|
+
t2 = /* @__PURE__ */ jsxs(Fragment, { children: [t0, /* @__PURE__ */ jsx(Dialog, {
|
|
158
151
|
open,
|
|
159
152
|
onOpenChange: setOpen,
|
|
160
|
-
children:
|
|
153
|
+
children: t1
|
|
161
154
|
})] });
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
} else
|
|
165
|
-
return
|
|
166
|
-
}
|
|
167
|
-
function _temp(client) {
|
|
168
|
-
return /* @__PURE__ */ jsx(Avatar, {
|
|
169
|
-
size: "sm",
|
|
170
|
-
children: /* @__PURE__ */ jsx(AvatarFallback, {
|
|
171
|
-
className: "bg-background text-foreground",
|
|
172
|
-
children: /* @__PURE__ */ jsx(client.Logo, { className: "size-3.5" })
|
|
173
|
-
})
|
|
174
|
-
}, client.name);
|
|
155
|
+
$[2] = open;
|
|
156
|
+
$[3] = t2;
|
|
157
|
+
} else t2 = $[3];
|
|
158
|
+
return t2;
|
|
175
159
|
}
|
|
176
160
|
function ConnectAgentContent() {
|
|
177
|
-
const $ = c(
|
|
161
|
+
const $ = c(22);
|
|
178
162
|
const { apiUrl } = React.useContext(AuthContext);
|
|
179
163
|
const url = `${apiUrl}/mcp`;
|
|
180
164
|
const [copied, setCopied] = React.useState(false);
|
|
@@ -207,7 +191,7 @@ function ConnectAgentContent() {
|
|
|
207
191
|
const copy = t2;
|
|
208
192
|
let t3;
|
|
209
193
|
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
210
|
-
t3 = /* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: "Connect your
|
|
194
|
+
t3 = /* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: "Connect your agent" }), /* @__PURE__ */ jsx(DialogDescription, { children: "Add this URL to your agent as an MCP server. It acts as you, but can't publish." })] });
|
|
211
195
|
$[5] = t3;
|
|
212
196
|
} else t3 = $[5];
|
|
213
197
|
let t4;
|
|
@@ -255,44 +239,34 @@ function ConnectAgentContent() {
|
|
|
255
239
|
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
256
240
|
t9 = /* @__PURE__ */ jsx("p", {
|
|
257
241
|
className: "text-muted-foreground text-xs font-medium",
|
|
258
|
-
children: "How to add
|
|
242
|
+
children: "How to add it in"
|
|
259
243
|
});
|
|
260
244
|
$[18] = t9;
|
|
261
245
|
} else t9 = $[18];
|
|
262
246
|
let t10;
|
|
263
|
-
let t11;
|
|
264
247
|
if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
|
|
265
248
|
t10 = /* @__PURE__ */ jsxs("div", {
|
|
266
249
|
className: "flex flex-col gap-2",
|
|
267
250
|
children: [t9, /* @__PURE__ */ jsx("ul", {
|
|
268
251
|
className: "grid grid-cols-2 gap-1",
|
|
269
|
-
children: CLIENTS.map(
|
|
252
|
+
children: CLIENTS.map(_temp)
|
|
270
253
|
})]
|
|
271
254
|
});
|
|
272
|
-
t11 = /* @__PURE__ */ jsx("p", {
|
|
273
|
-
className: "text-muted-foreground text-xs",
|
|
274
|
-
children: "It acts as you, with your permissions. It can't publish: you review and publish here."
|
|
275
|
-
});
|
|
276
255
|
$[19] = t10;
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
t11 =
|
|
281
|
-
}
|
|
282
|
-
let t12;
|
|
283
|
-
if ($[21] !== t8) {
|
|
284
|
-
t12 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
256
|
+
} else t10 = $[19];
|
|
257
|
+
let t11;
|
|
258
|
+
if ($[20] !== t8) {
|
|
259
|
+
t11 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
285
260
|
t3,
|
|
286
261
|
t8,
|
|
287
|
-
t10
|
|
288
|
-
t11
|
|
262
|
+
t10
|
|
289
263
|
] });
|
|
290
|
-
$[
|
|
291
|
-
$[
|
|
292
|
-
} else
|
|
293
|
-
return
|
|
264
|
+
$[20] = t8;
|
|
265
|
+
$[21] = t11;
|
|
266
|
+
} else t11 = $[21];
|
|
267
|
+
return t11;
|
|
294
268
|
}
|
|
295
|
-
function
|
|
269
|
+
function _temp(client) {
|
|
296
270
|
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("a", {
|
|
297
271
|
href: client.docs,
|
|
298
272
|
target: "_blank",
|