camox 0.72.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/features/preview/components/PageInfo.js +121 -98
- package/dist/features/preview/components/SelectionEditor.js +1 -1
- package/dist/features/routes/pageRuntime.js +15 -4
- package/dist/features/runtime/ClaimCard.js +192 -0
- package/dist/features/runtime/pageApp.js +4 -3
- package/dist/features/runtime/runtime.js +26 -5
- 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 +94 -69
- 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/lib/api-client.js +5 -1
- package/dist/lib/queries.js +5 -5
- package/dist/lib/studio-reads.d.ts +1 -1
- package/dist/lib/studio-reads.js +5 -5
- package/dist/package.js +1 -1
- package/dist/studio.css +1 -1
- package/package.json +4 -4
- package/dist/features/studio/components/ReviewDraftSheet.js +0 -1587
|
@@ -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
|