@opengeni/react 7.4.0-canary.36855269964001 → 7.4.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/README.md +3 -48
- package/dist/artifacts-document.js +2 -3
- package/dist/artifacts-presentation.js +2 -3
- package/dist/artifacts-spreadsheet.js +2 -2
- package/dist/artifacts.d.ts +0 -1
- package/dist/artifacts.js +1402 -505
- package/dist/artifacts.js.map +1 -1
- package/dist/{browser-viewer-R6KK5VKR.js → browser-viewer-2E6R2Y4W.js} +4 -4
- package/dist/{chunk-WUISZ3WU.js → chunk-3E2AITTZ.js} +28 -32
- package/dist/{chunk-WUISZ3WU.js.map → chunk-3E2AITTZ.js.map} +1 -1
- package/dist/{chunk-PWUILT2U.js → chunk-5AZSK6MV.js} +2 -2
- package/dist/{chunk-Y2PRMYLC.js → chunk-DUEBTL3N.js} +3 -4
- package/dist/{chunk-Y2PRMYLC.js.map → chunk-DUEBTL3N.js.map} +1 -1
- package/dist/{chunk-7UAMYXJY.js → chunk-KNDIXZN6.js} +18 -25
- package/dist/{chunk-7UAMYXJY.js.map → chunk-KNDIXZN6.js.map} +1 -1
- package/dist/{chunk-P4G6K2E2.js → chunk-L4OSXQ6H.js} +884 -1119
- package/dist/chunk-L4OSXQ6H.js.map +1 -0
- package/dist/{chunk-LLIH7Q4B.js → chunk-S5JQ4R22.js} +19 -47
- package/dist/chunk-S5JQ4R22.js.map +1 -0
- package/dist/{chunk-A4UJB2MM.js → chunk-SEEVCT36.js} +2 -2
- package/dist/{chunk-UXJCQ5GH.js → chunk-UDD6DLLT.js} +1 -6
- package/dist/chunk-UDD6DLLT.js.map +1 -0
- package/dist/chunk-UGMKPUEM.js +299 -0
- package/dist/chunk-UGMKPUEM.js.map +1 -0
- package/dist/{chunk-ZCZHKJKZ.js → chunk-USXVQACU.js} +3 -3
- package/dist/{chunk-VABBF52G.js → chunk-V2ABIVYJ.js} +6 -70
- package/dist/chunk-V2ABIVYJ.js.map +1 -0
- package/dist/{chunk-TVO6GXR6.js → chunk-X4HIN6TV.js} +162 -71
- package/dist/chunk-X4HIN6TV.js.map +1 -0
- package/dist/{chunk-IIDEIBMC.js → chunk-XEJEOAOV.js} +38 -49
- package/dist/chunk-XEJEOAOV.js.map +1 -0
- package/dist/{chunk-ZKLCPBWN.js → chunk-Y3QTZN2F.js} +5 -5
- package/dist/{chunk-73BUNGLF.js → chunk-YZ3YYMOM.js} +1 -1
- package/dist/components/artifacts/editable-artifact-ui.d.ts +1 -2
- package/dist/components/artifacts/index.d.ts +0 -7
- package/dist/components/browser-select-control.d.ts +1 -3
- package/dist/components/message-timeline.d.ts +1 -18
- package/dist/components/open-geni-links.d.ts +0 -16
- package/dist/components/session-conversation.d.ts +1 -20
- package/dist/composer.js +3 -3
- package/dist/{computer-viewer-DJHPSP2J.js → computer-viewer-WMJE6OA3.js} +3 -3
- package/dist/connect.js +6 -7
- package/dist/connect.js.map +1 -1
- package/dist/hooks/latest-question.d.ts +1 -1
- package/dist/index.d.ts +2 -5
- package/dist/index.js +28 -39
- package/dist/index.js.map +1 -1
- package/dist/interaction.js +4 -4
- package/dist/{latest-question-KGCDK3XX.js → latest-question-QB4EUCW5.js} +3 -3
- package/dist/lib/format.d.ts +0 -3
- package/dist/machines.js +2 -2
- package/dist/{markdown-table-layout-QXSLK4BY.js → markdown-table-layout-PFUEZ2U4.js} +5 -37
- package/dist/markdown-table-layout-PFUEZ2U4.js.map +1 -0
- package/dist/{sandbox-files-4PMXDSDV.js → sandbox-files-PXPIZAFG.js} +2 -2
- package/dist/session-ui.d.ts +2 -5
- package/dist/session-ui.js +13 -23
- package/dist/session-ui.js.map +1 -1
- package/dist/session.js +3 -3
- package/dist/sites.js +289 -4
- package/dist/sites.js.map +1 -1
- package/dist/timeline/types.d.ts +1 -7
- package/dist/{timeline-annotation-selection-DMLMM2TX.js → timeline-annotation-selection-ODLVF4OI.js} +1 -6
- package/dist/timeline-annotation-selection-ODLVF4OI.js.map +1 -0
- package/package.json +3 -7
- package/src/artifacts.ts +0 -37
- package/src/components/artifacts/editable-artifact-ui.tsx +1 -3
- package/src/components/artifacts/editable-artifact-workbench.tsx +2 -5
- package/src/components/artifacts/editable-document.tsx +36 -34
- package/src/components/artifacts/editable-presentation.tsx +16 -21
- package/src/components/artifacts/index.ts +0 -41
- package/src/components/browser-select-control.tsx +1 -4
- package/src/components/browser-viewer.tsx +22 -81
- package/src/components/computer-viewer.tsx +23 -51
- package/src/components/markdown-table-layout.ts +5 -49
- package/src/components/markdown.tsx +2 -5
- package/src/components/message-timeline.tsx +434 -515
- package/src/components/open-geni-links.tsx +0 -24
- package/src/components/session-conversation.tsx +20 -131
- package/src/components/timeline-annotation-selection.tsx +0 -7
- package/src/hooks/use-available-models.ts +1 -1
- package/src/index.ts +0 -9
- package/src/lib/format.ts +0 -13
- package/src/session-ui.ts +0 -9
- package/src/timeline/projection.ts +4 -78
- package/src/timeline/types.ts +0 -7
- package/styles/compiled.css +0 -325
- package/dist/chat-interactive-block-VAGABN7J.js +0 -11
- package/dist/chunk-5CVXZA3Y.js +0 -292
- package/dist/chunk-5CVXZA3Y.js.map +0 -1
- package/dist/chunk-B3V6TG77.js +0 -41
- package/dist/chunk-B3V6TG77.js.map +0 -1
- package/dist/chunk-IIDEIBMC.js.map +0 -1
- package/dist/chunk-LLIH7Q4B.js.map +0 -1
- package/dist/chunk-P4G6K2E2.js.map +0 -1
- package/dist/chunk-RAIQYITC.js +0 -1772
- package/dist/chunk-RAIQYITC.js.map +0 -1
- package/dist/chunk-SCOTPE2I.js +0 -589
- package/dist/chunk-SCOTPE2I.js.map +0 -1
- package/dist/chunk-TVO6GXR6.js.map +0 -1
- package/dist/chunk-UXJCQ5GH.js.map +0 -1
- package/dist/chunk-VABBF52G.js.map +0 -1
- package/dist/chunk-WEHMPOXK.js +0 -39
- package/dist/chunk-WEHMPOXK.js.map +0 -1
- package/dist/chunk-XCHWDJ22.js +0 -107
- package/dist/chunk-XCHWDJ22.js.map +0 -1
- package/dist/components/artifacts/artifact-chrome.d.ts +0 -120
- package/dist/components/artifacts/artifact-sandbox.d.ts +0 -27
- package/dist/components/artifacts/chat-interactive-block.d.ts +0 -29
- package/dist/components/artifacts/deferred-chat-media.d.ts +0 -15
- package/dist/components/artifacts/editable-artifact-view.d.ts +0 -46
- package/dist/components/artifacts/latest-task-runner.d.ts +0 -15
- package/dist/components/artifacts/session-artifact-viewer.d.ts +0 -39
- package/dist/components/artifacts/site-view.d.ts +0 -23
- package/dist/components/timeline-pill-geometry.d.ts +0 -6
- package/dist/components/timeline-pill-placement.d.ts +0 -18
- package/dist/components/usage-limit-notice.d.ts +0 -49
- package/dist/components/usage-member-list.d.ts +0 -91
- package/dist/components/usage-meter.d.ts +0 -73
- package/dist/hooks/use-usage.d.ts +0 -40
- package/dist/markdown-table-layout-QXSLK4BY.js.map +0 -1
- package/dist/sandbox-files-4PMXDSDV.js.map +0 -1
- package/dist/timeline/allowance-exhausted-row.d.ts +0 -24
- package/dist/timeline-annotation-selection-DMLMM2TX.js.map +0 -1
- package/dist/timeline-pill-geometry-2G6EK47V.js +0 -73
- package/dist/timeline-pill-geometry-2G6EK47V.js.map +0 -1
- package/dist/usage/allowance-copy.d.ts +0 -25
- package/dist/usage/summary.d.ts +0 -35
- package/dist/usage.d.ts +0 -13
- package/dist/usage.js +0 -1073
- package/dist/usage.js.map +0 -1
- package/src/components/artifacts/artifact-chrome.tsx +0 -413
- package/src/components/artifacts/artifact-sandbox.tsx +0 -185
- package/src/components/artifacts/chat-interactive-block.tsx +0 -260
- package/src/components/artifacts/deferred-chat-media.tsx +0 -67
- package/src/components/artifacts/editable-artifact-view.tsx +0 -187
- package/src/components/artifacts/latest-task-runner.ts +0 -49
- package/src/components/artifacts/session-artifact-viewer.tsx +0 -376
- package/src/components/artifacts/site-view.tsx +0 -116
- package/src/components/timeline-pill-geometry.ts +0 -112
- package/src/components/timeline-pill-placement.ts +0 -81
- package/src/components/usage-limit-notice.tsx +0 -179
- package/src/components/usage-member-list.tsx +0 -792
- package/src/components/usage-meter.tsx +0 -382
- package/src/hooks/use-usage.ts +0 -100
- package/src/timeline/allowance-exhausted-row.tsx +0 -86
- package/src/usage/allowance-copy.ts +0 -64
- package/src/usage/summary.ts +0 -93
- package/src/usage.ts +0 -50
- /package/dist/{browser-viewer-R6KK5VKR.js.map → browser-viewer-2E6R2Y4W.js.map} +0 -0
- /package/dist/{chunk-PWUILT2U.js.map → chunk-5AZSK6MV.js.map} +0 -0
- /package/dist/{chunk-A4UJB2MM.js.map → chunk-SEEVCT36.js.map} +0 -0
- /package/dist/{chunk-ZCZHKJKZ.js.map → chunk-USXVQACU.js.map} +0 -0
- /package/dist/{chunk-ZKLCPBWN.js.map → chunk-Y3QTZN2F.js.map} +0 -0
- /package/dist/{chunk-73BUNGLF.js.map → chunk-YZ3YYMOM.js.map} +0 -0
- /package/dist/{chat-interactive-block-VAGABN7J.js.map → computer-viewer-WMJE6OA3.js.map} +0 -0
- /package/dist/{latest-question-KGCDK3XX.js.map → latest-question-QB4EUCW5.js.map} +0 -0
- /package/dist/{computer-viewer-DJHPSP2J.js.map → sandbox-files-PXPIZAFG.js.map} +0 -0
package/dist/interaction.js
CHANGED
|
@@ -7,13 +7,13 @@ import {
|
|
|
7
7
|
useBrowserSession,
|
|
8
8
|
useBrowserSessions,
|
|
9
9
|
useSiteAuthConnections
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-S5JQ4R22.js";
|
|
11
11
|
import {
|
|
12
12
|
ComputerViewer,
|
|
13
13
|
useComputerFrameStream,
|
|
14
14
|
useComputerSession,
|
|
15
15
|
useComputerSessions
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-XEJEOAOV.js";
|
|
17
17
|
import {
|
|
18
18
|
useInteractionInterventions,
|
|
19
19
|
useInteractionInvalidation
|
|
@@ -27,9 +27,9 @@ import {
|
|
|
27
27
|
useEmbeddedInteraction,
|
|
28
28
|
useEmbeddedInterventions
|
|
29
29
|
} from "./chunk-NEXLLTP4.js";
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-UXJCQ5GH.js";
|
|
30
|
+
import "./chunk-UDD6DLLT.js";
|
|
32
31
|
import "./chunk-22KP6LR5.js";
|
|
32
|
+
import "./chunk-JVYQRRC4.js";
|
|
33
33
|
|
|
34
34
|
// src/hooks/use-network-routes.ts
|
|
35
35
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
isTimelineUserQuestion,
|
|
3
3
|
isTurnExecutionEvidence,
|
|
4
4
|
timelineQuestionPlacement
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-V2ABIVYJ.js";
|
|
6
6
|
import "./chunk-ERGYJIBB.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-UDD6DLLT.js";
|
|
8
8
|
|
|
9
9
|
// src/hooks/latest-question.ts
|
|
10
10
|
import { SESSION_EVENT_TYPES } from "@opengeni/sdk";
|
|
@@ -114,4 +114,4 @@ export {
|
|
|
114
114
|
TIMELINE_TURN_ANCHOR_EVENT_TYPES,
|
|
115
115
|
resolveLatestQuestion
|
|
116
116
|
};
|
|
117
|
-
//# sourceMappingURL=latest-question-
|
|
117
|
+
//# sourceMappingURL=latest-question-QB4EUCW5.js.map
|
package/dist/lib/format.d.ts
CHANGED
|
@@ -18,9 +18,6 @@ export declare function tryParseJson(text: string): unknown;
|
|
|
18
18
|
* workspace no longer has.
|
|
19
19
|
*/
|
|
20
20
|
export declare const CREDIT_EXHAUSTION_MESSAGE = "Out of Opengeni credits \u2014 this workspace's balance is empty. Add credits to continue; the conversation is preserved.";
|
|
21
|
-
/** A usage ceiling refused the send; the default allowance wording, plus what is safe. */
|
|
22
|
-
export declare const COMPOSER_MEMBER_ALLOWANCE_MESSAGE = "Usage limit reached. A workspace admin can raise this limit. Your draft is preserved.";
|
|
23
|
-
export declare const COMPOSER_WORKSPACE_ALLOWANCE_MESSAGE = "Workspace usage limit reached. An organization admin can raise the workspace budget. Your draft is preserved.";
|
|
24
21
|
/**
|
|
25
22
|
* Actionable composer copy for an edge rejection before a turn is accepted.
|
|
26
23
|
* Unlike an in-flight credit exhaustion, this path has not consumed the
|
package/dist/machines.js
CHANGED
|
@@ -28,11 +28,11 @@ import {
|
|
|
28
28
|
healthPulses,
|
|
29
29
|
pointsFor,
|
|
30
30
|
useMachines
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-5AZSK6MV.js";
|
|
32
32
|
import "./chunk-WZ55DVGK.js";
|
|
33
33
|
import "./chunk-KZ73RL76.js";
|
|
34
34
|
import "./chunk-NEXLLTP4.js";
|
|
35
|
-
import "./chunk-
|
|
35
|
+
import "./chunk-UDD6DLLT.js";
|
|
36
36
|
import "./chunk-22KP6LR5.js";
|
|
37
37
|
export {
|
|
38
38
|
CONNECTION_STATUS_META,
|
|
@@ -10,36 +10,10 @@ function markdownTableWidth({
|
|
|
10
10
|
const available = 2 * Math.min(center - contentLeft, contentRight - center);
|
|
11
11
|
return Math.max(columnWidth, Math.min(preferredWidth, available));
|
|
12
12
|
}
|
|
13
|
-
function measurementCopy(source, document) {
|
|
14
|
-
if (source.nodeType === Node.ELEMENT_NODE) {
|
|
15
|
-
const element = source;
|
|
16
|
-
if (element.localName.includes("-") || ["iframe", "object", "embed", "video", "audio", "canvas", "script"].includes(
|
|
17
|
-
element.localName
|
|
18
|
-
)) {
|
|
19
|
-
const bounds = element.getBoundingClientRect();
|
|
20
|
-
const placeholder = document.createElement("span");
|
|
21
|
-
placeholder.style.display = "inline-block";
|
|
22
|
-
placeholder.style.width = `${bounds.width}px`;
|
|
23
|
-
placeholder.style.height = `${bounds.height}px`;
|
|
24
|
-
return placeholder;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
const copy = document.importNode(source, false);
|
|
28
|
-
if (copy.nodeType === Node.ELEMENT_NODE) {
|
|
29
|
-
const element = copy;
|
|
30
|
-
element.removeAttribute("id");
|
|
31
|
-
for (const attribute of [...element.attributes]) {
|
|
32
|
-
if (attribute.name.startsWith("on")) element.removeAttribute(attribute.name);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
for (const child of source.childNodes) copy.appendChild(measurementCopy(child, document));
|
|
36
|
-
return copy;
|
|
37
|
-
}
|
|
38
13
|
function observeMarkdownTableLayout(wrapper, table) {
|
|
39
14
|
const body = wrapper.parentElement;
|
|
40
15
|
const scroller = body?.closest("[data-og-wide-table-message]")?.closest("[data-og-timeline-scroller]");
|
|
41
16
|
if (!body?.classList.contains("og-markdown-body") || !scroller) return;
|
|
42
|
-
const measurementDocument = table.ownerDocument.implementation.createHTMLDocument("");
|
|
43
17
|
let width = null;
|
|
44
18
|
const reset = () => {
|
|
45
19
|
width = null;
|
|
@@ -59,19 +33,13 @@ function observeMarkdownTableLayout(wrapper, table) {
|
|
|
59
33
|
const panelStyle = getComputedStyle(scroller);
|
|
60
34
|
const left = panel.left + scroller.clientLeft + parseFloat(panelStyle.paddingLeft);
|
|
61
35
|
const right = panel.left + scroller.clientLeft + scroller.clientWidth - parseFloat(panelStyle.paddingRight);
|
|
62
|
-
const
|
|
63
|
-
probe.setAttribute("aria-hidden", "true");
|
|
64
|
-
probe.inert = true;
|
|
65
|
-
probe.style.cssText = "position:absolute;width:0;height:0;overflow:hidden;contain:layout size paint;visibility:hidden;pointer-events:none";
|
|
66
|
-
const copy = measurementCopy(table, measurementDocument);
|
|
67
|
-
copy.style.width = "max-content";
|
|
68
|
-
probe.append(copy);
|
|
36
|
+
const previousWidth = table.style.width;
|
|
69
37
|
let preferred;
|
|
70
38
|
try {
|
|
71
|
-
table.
|
|
72
|
-
preferred =
|
|
39
|
+
table.style.width = "max-content";
|
|
40
|
+
preferred = table.getBoundingClientRect().width;
|
|
73
41
|
} finally {
|
|
74
|
-
|
|
42
|
+
table.style.width = previousWidth;
|
|
75
43
|
}
|
|
76
44
|
const next = markdownTableWidth({
|
|
77
45
|
columnLeft: column.left,
|
|
@@ -103,4 +71,4 @@ export {
|
|
|
103
71
|
markdownTableWidth,
|
|
104
72
|
observeMarkdownTableLayout
|
|
105
73
|
};
|
|
106
|
-
//# sourceMappingURL=markdown-table-layout-
|
|
74
|
+
//# sourceMappingURL=markdown-table-layout-PFUEZ2U4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/markdown-table-layout.ts"],"sourcesContent":["export function markdownTableWidth({\n columnLeft,\n columnWidth,\n contentLeft,\n contentRight,\n preferredWidth,\n}: {\n columnLeft: number;\n columnWidth: number;\n contentLeft: number;\n contentRight: number;\n preferredWidth: number;\n}): number {\n const center = columnLeft + columnWidth / 2;\n const available = 2 * Math.min(center - contentLeft, contentRight - center);\n return Math.max(columnWidth, Math.min(preferredWidth, available));\n}\n\n/** Loaded only for assistant tables. Keep prose and nested scroll owners intact. */\nexport function observeMarkdownTableLayout(wrapper: HTMLDivElement, table: HTMLTableElement) {\n const body = wrapper.parentElement;\n const scroller = body\n ?.closest(\"[data-og-wide-table-message]\")\n ?.closest<HTMLElement>(\"[data-og-timeline-scroller]\");\n if (!body?.classList.contains(\"og-markdown-body\") || !scroller) return;\n\n let width: number | null = null;\n const reset = () => {\n width = null;\n wrapper.style.width = \"\";\n wrapper.style.maxWidth = \"\";\n wrapper.style.marginInline = \"\";\n };\n const measure = () => {\n // Intermediate clipped/scrollable surfaces own their own content bounds.\n for (\n let ancestor: HTMLElement | null = body;\n ancestor && ancestor !== scroller;\n ancestor = ancestor.parentElement\n ) {\n if (getComputedStyle(ancestor).overflowX !== \"visible\") {\n reset();\n return;\n }\n }\n const column = body.getBoundingClientRect();\n const panel = scroller.getBoundingClientRect();\n const panelStyle = getComputedStyle(scroller);\n const left = panel.left + scroller.clientLeft + parseFloat(panelStyle.paddingLeft);\n const right =\n panel.left + scroller.clientLeft + scroller.clientWidth - parseFloat(panelStyle.paddingRight);\n\n // Measure the original table, preserving its wrapping and TSV copy DOM.\n const previousWidth = table.style.width;\n let preferred: number;\n try {\n table.style.width = \"max-content\";\n preferred = table.getBoundingClientRect().width;\n } finally {\n table.style.width = previousWidth;\n }\n const next = markdownTableWidth({\n columnLeft: column.left,\n columnWidth: column.width,\n contentLeft: left,\n contentRight: right,\n preferredWidth: preferred,\n });\n if (width !== null && Math.abs(width - next) < 0.5) return;\n width = next;\n wrapper.style.width = `${width}px`;\n wrapper.style.maxWidth = \"none\";\n wrapper.style.marginInline = `calc((100% - ${width}px) / 2)`;\n };\n\n measure();\n const observer = typeof ResizeObserver === \"undefined\" ? undefined : new ResizeObserver(measure);\n observer?.observe(scroller);\n observer?.observe(body);\n observer?.observe(table);\n return {\n measure,\n disconnect: () => {\n observer?.disconnect();\n reset();\n },\n };\n}\n"],"mappings":";AAAO,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAMW;AACT,QAAM,SAAS,aAAa,cAAc;AAC1C,QAAM,YAAY,IAAI,KAAK,IAAI,SAAS,aAAa,eAAe,MAAM;AAC1E,SAAO,KAAK,IAAI,aAAa,KAAK,IAAI,gBAAgB,SAAS,CAAC;AAClE;AAGO,SAAS,2BAA2B,SAAyB,OAAyB;AAC3F,QAAM,OAAO,QAAQ;AACrB,QAAM,WAAW,MACb,QAAQ,8BAA8B,GACtC,QAAqB,6BAA6B;AACtD,MAAI,CAAC,MAAM,UAAU,SAAS,kBAAkB,KAAK,CAAC,SAAU;AAEhE,MAAI,QAAuB;AAC3B,QAAM,QAAQ,MAAM;AAClB,YAAQ;AACR,YAAQ,MAAM,QAAQ;AACtB,YAAQ,MAAM,WAAW;AACzB,YAAQ,MAAM,eAAe;AAAA,EAC/B;AACA,QAAM,UAAU,MAAM;AAEpB,aACM,WAA+B,MACnC,YAAY,aAAa,UACzB,WAAW,SAAS,eACpB;AACA,UAAI,iBAAiB,QAAQ,EAAE,cAAc,WAAW;AACtD,cAAM;AACN;AAAA,MACF;AAAA,IACF;AACA,UAAM,SAAS,KAAK,sBAAsB;AAC1C,UAAM,QAAQ,SAAS,sBAAsB;AAC7C,UAAM,aAAa,iBAAiB,QAAQ;AAC5C,UAAM,OAAO,MAAM,OAAO,SAAS,aAAa,WAAW,WAAW,WAAW;AACjF,UAAM,QACJ,MAAM,OAAO,SAAS,aAAa,SAAS,cAAc,WAAW,WAAW,YAAY;AAG9F,UAAM,gBAAgB,MAAM,MAAM;AAClC,QAAI;AACJ,QAAI;AACF,YAAM,MAAM,QAAQ;AACpB,kBAAY,MAAM,sBAAsB,EAAE;AAAA,IAC5C,UAAE;AACA,YAAM,MAAM,QAAQ;AAAA,IACtB;AACA,UAAM,OAAO,mBAAmB;AAAA,MAC9B,YAAY,OAAO;AAAA,MACnB,aAAa,OAAO;AAAA,MACpB,aAAa;AAAA,MACb,cAAc;AAAA,MACd,gBAAgB;AAAA,IAClB,CAAC;AACD,QAAI,UAAU,QAAQ,KAAK,IAAI,QAAQ,IAAI,IAAI,IAAK;AACpD,YAAQ;AACR,YAAQ,MAAM,QAAQ,GAAG,KAAK;AAC9B,YAAQ,MAAM,WAAW;AACzB,YAAQ,MAAM,eAAe,gBAAgB,KAAK;AAAA,EACpD;AAEA,UAAQ;AACR,QAAM,WAAW,OAAO,mBAAmB,cAAc,SAAY,IAAI,eAAe,OAAO;AAC/F,YAAU,QAAQ,QAAQ;AAC1B,YAAU,QAAQ,IAAI;AACtB,YAAU,QAAQ,KAAK;AACvB,SAAO;AAAA,IACL;AAAA,IACA,YAAY,MAAM;AAChB,gBAAU,WAAW;AACrB,YAAM;AAAA,IACR;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SandboxFiles
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YZ3YYMOM.js";
|
|
4
4
|
import "./chunk-UK4TINKT.js";
|
|
5
5
|
import "./chunk-A2PI6UMY.js";
|
|
6
6
|
import "./chunk-WZ55DVGK.js";
|
|
@@ -13,4 +13,4 @@ import "./chunk-22KP6LR5.js";
|
|
|
13
13
|
export {
|
|
14
14
|
SandboxFiles
|
|
15
15
|
};
|
|
16
|
-
//# sourceMappingURL=sandbox-files-
|
|
16
|
+
//# sourceMappingURL=sandbox-files-PXPIZAFG.js.map
|
package/dist/session-ui.d.ts
CHANGED
|
@@ -6,12 +6,9 @@ export type { ApprovalSurfaceProps, ApprovalSurfaceMessages } from "./components
|
|
|
6
6
|
export type { HumanInputSurfaceProps } from "./components/human-input-surface.js";
|
|
7
7
|
export { MessageTimeline, TimelineRow } from "./components/message-timeline.js";
|
|
8
8
|
export type { MessageTimelineProps } from "./components/message-timeline.js";
|
|
9
|
-
export
|
|
10
|
-
export type {
|
|
11
|
-
export { OpenGeniLinkProvider, chainLinkResolvers, sessionLinkResolver, useOpenGeniLinkResolver, viewerLinkResolver, } from "./components/open-geni-links.js";
|
|
12
|
-
export type { OpenGeniLinkResolution, OpenGeniLinkResolver, OpenGeniLinkTarget, OpenGeniViewerTarget, } from "./components/open-geni-links.js";
|
|
9
|
+
export { OpenGeniLinkProvider, chainLinkResolvers, sessionLinkResolver, useOpenGeniLinkResolver, } from "./components/open-geni-links.js";
|
|
10
|
+
export type { OpenGeniLinkResolution, OpenGeniLinkResolver, OpenGeniLinkTarget, } from "./components/open-geni-links.js";
|
|
13
11
|
export { parseOpenGeniLink } from "@opengeni/sdk";
|
|
14
|
-
export { ArtifactLabelsProvider, DEFAULT_ARTIFACT_LABELS, type ArtifactLabels, } from "./components/artifacts/artifact-chrome.js";
|
|
15
12
|
export type { TimelineSearchTarget } from "./components/timeline-search.js";
|
|
16
13
|
export { createOlderHistoryLoadReceipt } from "./older-history.js";
|
|
17
14
|
export type { OlderHistoryLoader, OlderHistoryLoadReceipt } from "./older-history.js";
|
package/dist/session-ui.js
CHANGED
|
@@ -21,54 +21,45 @@ import {
|
|
|
21
21
|
setStartupDetails,
|
|
22
22
|
useStartupDetails,
|
|
23
23
|
userMessageLikelyNeedsDisclosure
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import "./chunk-UK4TINKT.js";
|
|
24
|
+
} from "./chunk-L4OSXQ6H.js";
|
|
26
25
|
import "./chunk-YCGBREUV.js";
|
|
26
|
+
import "./chunk-UK4TINKT.js";
|
|
27
27
|
import "./chunk-5QHL6BLH.js";
|
|
28
28
|
import "./chunk-ZYRGEKWS.js";
|
|
29
29
|
import "./chunk-A2PI6UMY.js";
|
|
30
30
|
import "./chunk-FZCP527Y.js";
|
|
31
|
-
import {
|
|
32
|
-
ArtifactLabelsProvider,
|
|
33
|
-
DEFAULT_ARTIFACT_LABELS
|
|
34
|
-
} from "./chunk-5CVXZA3Y.js";
|
|
35
31
|
import {
|
|
36
32
|
createOlderHistoryLoadReceipt
|
|
37
|
-
} from "./chunk-
|
|
38
|
-
import "./chunk-
|
|
33
|
+
} from "./chunk-USXVQACU.js";
|
|
34
|
+
import "./chunk-V2ABIVYJ.js";
|
|
39
35
|
import "./chunk-ERGYJIBB.js";
|
|
40
36
|
import "./chunk-WZ55DVGK.js";
|
|
41
|
-
import "./chunk-
|
|
37
|
+
import "./chunk-Y3QTZN2F.js";
|
|
42
38
|
import "./chunk-UINDK6C3.js";
|
|
43
39
|
import "./chunk-K3HQAKQX.js";
|
|
44
|
-
import "./chunk-CHPKSLPN.js";
|
|
45
40
|
import "./chunk-KVERXCFY.js";
|
|
46
|
-
import "./chunk-
|
|
41
|
+
import "./chunk-CHPKSLPN.js";
|
|
47
42
|
import "./chunk-KZ73RL76.js";
|
|
48
43
|
import "./chunk-NEXLLTP4.js";
|
|
49
|
-
import "./chunk-TVO6GXR6.js";
|
|
50
|
-
import "./chunk-GIMRELBW.js";
|
|
51
|
-
import "./chunk-447JLCBU.js";
|
|
52
44
|
import {
|
|
53
45
|
OpenGeniLinkProvider,
|
|
54
46
|
chainLinkResolvers,
|
|
55
47
|
sessionLinkResolver,
|
|
56
|
-
useOpenGeniLinkResolver
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
import "./chunk-
|
|
48
|
+
useOpenGeniLinkResolver
|
|
49
|
+
} from "./chunk-X4HIN6TV.js";
|
|
50
|
+
import "./chunk-GIMRELBW.js";
|
|
51
|
+
import "./chunk-447JLCBU.js";
|
|
60
52
|
import "./chunk-BRM6FVZA.js";
|
|
61
53
|
import "./chunk-VZTQ73XT.js";
|
|
62
|
-
import "./chunk-
|
|
54
|
+
import "./chunk-UDD6DLLT.js";
|
|
63
55
|
import "./chunk-22KP6LR5.js";
|
|
56
|
+
import "./chunk-JVYQRRC4.js";
|
|
64
57
|
|
|
65
58
|
// src/session-ui.ts
|
|
66
59
|
import { parseOpenGeniLink } from "@opengeni/sdk";
|
|
67
60
|
export {
|
|
68
61
|
ApprovalSurface,
|
|
69
|
-
ArtifactLabelsProvider,
|
|
70
62
|
BUILT_IN_TURN_SUMMARY_FACET_IDS,
|
|
71
|
-
DEFAULT_ARTIFACT_LABELS,
|
|
72
63
|
HumanInputForm,
|
|
73
64
|
HumanInputSurface,
|
|
74
65
|
KnowledgeActivityProvider,
|
|
@@ -94,7 +85,6 @@ export {
|
|
|
94
85
|
setStartupDetails,
|
|
95
86
|
useOpenGeniLinkResolver,
|
|
96
87
|
useStartupDetails,
|
|
97
|
-
userMessageLikelyNeedsDisclosure
|
|
98
|
-
viewerLinkResolver
|
|
88
|
+
userMessageLikelyNeedsDisclosure
|
|
99
89
|
};
|
|
100
90
|
//# sourceMappingURL=session-ui.js.map
|
package/dist/session-ui.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/session-ui.ts"],"sourcesContent":["// @opengeni/react/session-ui — styled surfaces used by the session route.\n// Keep these separate from the hook-only session entry and the broad root barrel\n// so session hosts do not pay for unrelated React surfaces.\nexport { HumanInputForm } from \"./components/human-input-form\";\nexport type {\n HumanInputAnswerDraft,\n HumanInputFormMessages,\n HumanInputFormProps,\n} from \"./components/human-input-form\";\nexport { HumanInputSurface } from \"./components/human-input-surface\";\nexport { ApprovalSurface } from \"./components/approval-surface\";\nexport type { ApprovalSurfaceProps, ApprovalSurfaceMessages } from \"./components/approval-surface\";\nexport type { HumanInputSurfaceProps } from \"./components/human-input-surface\";\nexport { MessageTimeline, TimelineRow } from \"./components/message-timeline\";\nexport type { MessageTimelineProps } from \"./components/message-timeline\";\nexport
|
|
1
|
+
{"version":3,"sources":["../src/session-ui.ts"],"sourcesContent":["// @opengeni/react/session-ui — styled surfaces used by the session route.\n// Keep these separate from the hook-only session entry and the broad root barrel\n// so session hosts do not pay for unrelated React surfaces.\nexport { HumanInputForm } from \"./components/human-input-form\";\nexport type {\n HumanInputAnswerDraft,\n HumanInputFormMessages,\n HumanInputFormProps,\n} from \"./components/human-input-form\";\nexport { HumanInputSurface } from \"./components/human-input-surface\";\nexport { ApprovalSurface } from \"./components/approval-surface\";\nexport type { ApprovalSurfaceProps, ApprovalSurfaceMessages } from \"./components/approval-surface\";\nexport type { HumanInputSurfaceProps } from \"./components/human-input-surface\";\nexport { MessageTimeline, TimelineRow } from \"./components/message-timeline\";\nexport type { MessageTimelineProps } from \"./components/message-timeline\";\nexport {\n OpenGeniLinkProvider,\n chainLinkResolvers,\n sessionLinkResolver,\n useOpenGeniLinkResolver,\n} from \"./components/open-geni-links\";\nexport type {\n OpenGeniLinkResolution,\n OpenGeniLinkResolver,\n OpenGeniLinkTarget,\n} from \"./components/open-geni-links\";\nexport { parseOpenGeniLink } from \"@opengeni/sdk\";\nexport type { TimelineSearchTarget } from \"./components/timeline-search\";\nexport { createOlderHistoryLoadReceipt } from \"./older-history\";\nexport type { OlderHistoryLoader, OlderHistoryLoadReceipt } from \"./older-history\";\nexport { UserMessageBody, userMessageLikelyNeedsDisclosure } from \"./components/user-message-body\";\nexport type {\n UserMessageBodyProps,\n UserMessageDisclosureLabels,\n} from \"./components/user-message-body\";\nexport { BUILT_IN_TURN_SUMMARY_FACET_IDS } from \"./timeline/turn-summary\";\nexport type {\n BuiltInTurnSummaryFacetId,\n TurnSummaryContext,\n TurnSummaryFacet,\n TurnSummaryFacetConfiguration,\n TurnSummaryFacetResult,\n TurnSummaryOptions,\n} from \"./timeline/turn-summary\";\nexport { QueueSurface } from \"./components/queue-surface\";\nexport { SessionConversation } from \"./components/session-conversation\";\nexport { SessionList } from \"./components/session-list\";\nexport type { SessionListLabels, SessionListProps } from \"./components/session-list\";\nexport { OpenGeniChat } from \"./components/open-geni-chat\";\nexport type { OpenGeniChatLabels, OpenGeniChatProps } from \"./components/open-geni-chat\";\nexport type { SessionConversationProps } from \"./components/session-conversation\";\nexport type { QueueSurfaceProps } from \"./components/queue-surface\";\nexport {\n SessionChrome,\n sessionChromeGoalPillExplanation,\n sessionChromeGoalPillLabel,\n sessionChromeGoalPillState,\n} from \"./components/session-chrome\";\nexport type {\n SessionChromeAgentsSignal,\n SessionChromeProps,\n SessionChromeSignalId,\n SessionChromeSignalTone,\n} from \"./components/session-chrome\";\nexport { SessionCommandsPanel } from \"./components/session-commands-panel\";\nexport { SessionCommands } from \"./components/session-commands\";\n\nexport { KnowledgeActivityProvider } from \"./timeline/knowledge-receipt\";\nexport type { KnowledgeActivityActions } from \"./timeline/knowledge-receipt\";\nexport { StartupTimings } from \"./timeline/startup-timings\";\nexport { useStartupDetails, setStartupDetails } from \"./timeline/startup-preference\";\nexport type { GenieLoadingOptions } from \"./timeline/genie-loading\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,SAAS,yBAAyB;","names":[]}
|
package/dist/session.js
CHANGED
|
@@ -23,14 +23,14 @@ import {
|
|
|
23
23
|
useSessionControl,
|
|
24
24
|
useSessionEvents,
|
|
25
25
|
useTurnQueue
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-USXVQACU.js";
|
|
27
27
|
import {
|
|
28
28
|
buildTimeline,
|
|
29
29
|
creditExhaustedFromEvents,
|
|
30
30
|
extractSessionRef,
|
|
31
31
|
groupTimeline,
|
|
32
32
|
sessionStatusFromEvents
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-V2ABIVYJ.js";
|
|
34
34
|
import {
|
|
35
35
|
toolDisplayName
|
|
36
36
|
} from "./chunk-ERGYJIBB.js";
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
} from "./chunk-KVERXCFY.js";
|
|
44
44
|
import "./chunk-KZ73RL76.js";
|
|
45
45
|
import "./chunk-NEXLLTP4.js";
|
|
46
|
-
import "./chunk-
|
|
46
|
+
import "./chunk-UDD6DLLT.js";
|
|
47
47
|
export {
|
|
48
48
|
FILE_ONLY_MESSAGE_TEXT,
|
|
49
49
|
approvalsFromRequiresAction,
|
package/dist/sites.js
CHANGED
|
@@ -1,8 +1,293 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
PublishedHtmlArtifactFrame
|
|
3
|
+
} from "./chunk-UGMKPUEM.js";
|
|
4
|
+
|
|
5
|
+
// src/sites-ui.tsx
|
|
6
|
+
import { useEffect, useRef, useState } from "react";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
async function loadSiteSnapshot(client, workspaceId, siteId, options = {}) {
|
|
9
|
+
const requestOptions = options.signal ? { signal: options.signal } : {};
|
|
10
|
+
const detail = await client.getWorkspaceArtifact(workspaceId, siteId, requestOptions);
|
|
11
|
+
options.signal?.throwIfAborted();
|
|
12
|
+
if (detail.artifact.id !== siteId || detail.artifact.workspaceId !== workspaceId)
|
|
13
|
+
throw new Error("Site scope mismatch");
|
|
14
|
+
const selectedVersion = options.versionId ? detail.versions.find((version) => version.id === options.versionId) : detail.artifact.currentVersion;
|
|
15
|
+
const versionId = options.versionId ?? selectedVersion?.id;
|
|
16
|
+
let content = selectedVersion && versionId && (detail.artifact.status === "active" || options.includeArchivedContent) ? {
|
|
17
|
+
artifactId: siteId,
|
|
18
|
+
versionId,
|
|
19
|
+
requestedTools: selectedVersion.requestedTools,
|
|
20
|
+
html: await client.getWorkspaceArtifactHtml(workspaceId, siteId, {
|
|
21
|
+
...requestOptions,
|
|
22
|
+
versionId
|
|
23
|
+
})
|
|
24
|
+
} : null;
|
|
25
|
+
if (versionId && !selectedVersion && (detail.artifact.status === "active" || options.includeArchivedContent)) {
|
|
26
|
+
if (!client.getWorkspaceArtifactContent) throw new Error("Site version unavailable");
|
|
27
|
+
content = await client.getWorkspaceArtifactContent(workspaceId, siteId, {
|
|
28
|
+
...requestOptions,
|
|
29
|
+
versionId
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
options.signal?.throwIfAborted();
|
|
33
|
+
if (content && (content.artifactId !== siteId || content.versionId !== versionId))
|
|
34
|
+
throw new Error("Site content mismatch");
|
|
35
|
+
return { detail: structuredClone(detail), content: content ? structuredClone(content) : null };
|
|
36
|
+
}
|
|
37
|
+
function useScopeKey(values) {
|
|
38
|
+
const [scope, setScope] = useState(values);
|
|
39
|
+
const [generation, setGeneration] = useState(0);
|
|
40
|
+
if (values.some((value, index) => value !== scope[index])) {
|
|
41
|
+
setScope(values);
|
|
42
|
+
setGeneration(generation + 1);
|
|
43
|
+
}
|
|
44
|
+
return generation;
|
|
45
|
+
}
|
|
46
|
+
function SiteList(props) {
|
|
47
|
+
const key = useScopeKey([props.client, props.workspaceId, props.status]);
|
|
48
|
+
return /* @__PURE__ */ jsx(ScopedSiteList, { ...props }, key);
|
|
49
|
+
}
|
|
50
|
+
function ScopedSiteList({
|
|
51
|
+
client,
|
|
52
|
+
workspaceId,
|
|
53
|
+
status = "active",
|
|
54
|
+
onOpen,
|
|
55
|
+
className
|
|
56
|
+
}) {
|
|
57
|
+
const [page, setPage] = useState(null);
|
|
58
|
+
const [cursor, setCursor] = useState();
|
|
59
|
+
const [error, setError] = useState(false);
|
|
60
|
+
const [reload, setReload] = useState(0);
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
const abort = new AbortController();
|
|
63
|
+
setPage(null);
|
|
64
|
+
setError(false);
|
|
65
|
+
void Promise.resolve().then(
|
|
66
|
+
() => client.listWorkspaceArtifacts(workspaceId, {
|
|
67
|
+
status,
|
|
68
|
+
...cursor ? { cursor } : {},
|
|
69
|
+
limit: 50,
|
|
70
|
+
signal: abort.signal
|
|
71
|
+
})
|
|
72
|
+
).then((result) => {
|
|
73
|
+
if (!abort.signal.aborted) setPage(structuredClone(result));
|
|
74
|
+
}).catch(() => {
|
|
75
|
+
if (!abort.signal.aborted) setError(true);
|
|
76
|
+
});
|
|
77
|
+
return () => abort.abort();
|
|
78
|
+
}, [client, workspaceId, status, cursor, reload]);
|
|
79
|
+
return /* @__PURE__ */ jsxs("section", { className, "aria-label": "Sites", "aria-busy": !page && !error, children: [
|
|
80
|
+
error ? /* @__PURE__ */ jsx("p", { role: "alert", children: "Sites are unavailable or access has changed. Refresh to check access." }) : !page ? /* @__PURE__ */ jsx("p", { role: "status", children: "Loading Sites\u2026" }) : page.artifacts.length === 0 ? /* @__PURE__ */ jsxs("p", { role: "status", children: [
|
|
81
|
+
"No ",
|
|
82
|
+
status,
|
|
83
|
+
" Sites."
|
|
84
|
+
] }) : /* @__PURE__ */ jsx("ul", { children: page.artifacts.map((site) => /* @__PURE__ */ jsxs("li", { children: [
|
|
85
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => onOpen(structuredClone(site)), children: site.title }),
|
|
86
|
+
/* @__PURE__ */ jsx("p", { children: site.description }),
|
|
87
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
88
|
+
site.status,
|
|
89
|
+
" \xB7 revision ",
|
|
90
|
+
site.currentVersion?.revision ?? "unpublished"
|
|
91
|
+
] })
|
|
92
|
+
] }, site.id)) }),
|
|
93
|
+
page?.nextCursor && /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setCursor(page.nextCursor), children: "Next page" }),
|
|
94
|
+
cursor && /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setCursor(void 0), children: "First page" }),
|
|
95
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => setReload((value) => value + 1), children: "Refresh Sites" })
|
|
96
|
+
] });
|
|
97
|
+
}
|
|
98
|
+
function SiteDetail(props) {
|
|
99
|
+
const key = useScopeKey([props.client, props.workspaceId, props.siteId]);
|
|
100
|
+
return /* @__PURE__ */ jsx(ScopedSiteDetail, { ...props }, key);
|
|
101
|
+
}
|
|
102
|
+
function ScopedSiteDetail({
|
|
103
|
+
client,
|
|
104
|
+
workspaceId,
|
|
105
|
+
siteId,
|
|
106
|
+
canPublish = false,
|
|
107
|
+
toolBridge,
|
|
108
|
+
className
|
|
109
|
+
}) {
|
|
110
|
+
const [loaded, setLoaded] = useState(null);
|
|
111
|
+
const [error, setError] = useState(false);
|
|
112
|
+
const [reload, setReload] = useState(0);
|
|
113
|
+
const [busy, setBusy] = useState(false);
|
|
114
|
+
const [rollbackId, setRollbackId] = useState("");
|
|
115
|
+
const [confirmation, setConfirmation] = useState(null);
|
|
116
|
+
const mutation = useRef(null);
|
|
117
|
+
useEffect(() => () => mutation.current?.abort(), []);
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
const abort = new AbortController();
|
|
120
|
+
setLoaded(null);
|
|
121
|
+
setError(false);
|
|
122
|
+
setConfirmation(null);
|
|
123
|
+
setRollbackId("");
|
|
124
|
+
void Promise.resolve().then(async () => {
|
|
125
|
+
const snapshot = await loadSiteSnapshot(client, workspaceId, siteId, {
|
|
126
|
+
signal: abort.signal
|
|
127
|
+
});
|
|
128
|
+
if (!abort.signal.aborted) setLoaded(snapshot);
|
|
129
|
+
}).catch(() => {
|
|
130
|
+
if (!abort.signal.aborted) {
|
|
131
|
+
setLoaded(null);
|
|
132
|
+
setError(true);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
return () => abort.abort();
|
|
136
|
+
}, [client, workspaceId, siteId, reload]);
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
if (!loaded || busy) return;
|
|
139
|
+
const abort = new AbortController();
|
|
140
|
+
let checking = false;
|
|
141
|
+
const timer = setInterval(() => {
|
|
142
|
+
if (checking) return;
|
|
143
|
+
checking = true;
|
|
144
|
+
void Promise.resolve().then(() => client.getWorkspaceArtifact(workspaceId, siteId, { signal: abort.signal })).then((detail) => {
|
|
145
|
+
if (abort.signal.aborted) return;
|
|
146
|
+
if (detail.artifact.id !== siteId || detail.artifact.workspaceId !== workspaceId)
|
|
147
|
+
throw new Error("Site scope mismatch");
|
|
148
|
+
if (detail.artifact.currentVersion?.id !== loaded.detail.artifact.currentVersion?.id || detail.artifact.status !== loaded.detail.artifact.status) {
|
|
149
|
+
setLoaded(null);
|
|
150
|
+
setReload((value) => value + 1);
|
|
151
|
+
}
|
|
152
|
+
}).catch(() => {
|
|
153
|
+
if (!abort.signal.aborted) {
|
|
154
|
+
setLoaded(null);
|
|
155
|
+
setError(true);
|
|
156
|
+
}
|
|
157
|
+
}).finally(() => {
|
|
158
|
+
checking = false;
|
|
159
|
+
});
|
|
160
|
+
}, 15e3);
|
|
161
|
+
return () => {
|
|
162
|
+
abort.abort();
|
|
163
|
+
clearInterval(timer);
|
|
164
|
+
};
|
|
165
|
+
}, [client, workspaceId, siteId, loaded, busy]);
|
|
166
|
+
const commit = async () => {
|
|
167
|
+
const current = loaded?.detail.artifact.currentVersion;
|
|
168
|
+
if (!canPublish || !loaded || !current || !confirmation || mutation.current) return;
|
|
169
|
+
const abort = new AbortController();
|
|
170
|
+
mutation.current = abort;
|
|
171
|
+
setBusy(true);
|
|
172
|
+
try {
|
|
173
|
+
const common = { expectedCurrentVersionId: current.id, idempotencyKey: crypto.randomUUID() };
|
|
174
|
+
if (confirmation === "rollback") {
|
|
175
|
+
if (!loaded.detail.versions.some((version) => version.id === rollbackId))
|
|
176
|
+
throw new Error("Unknown version");
|
|
177
|
+
await client.rollbackWorkspaceArtifact(
|
|
178
|
+
workspaceId,
|
|
179
|
+
siteId,
|
|
180
|
+
{ ...common, versionId: rollbackId, reason: "Restore explicitly selected Site version" },
|
|
181
|
+
{ signal: abort.signal }
|
|
182
|
+
);
|
|
183
|
+
} else {
|
|
184
|
+
await client.setWorkspaceArtifactStatus(
|
|
185
|
+
workspaceId,
|
|
186
|
+
siteId,
|
|
187
|
+
{
|
|
188
|
+
...common,
|
|
189
|
+
status: loaded.detail.artifact.status === "active" ? "archived" : "active",
|
|
190
|
+
reason: "Explicit Site status change"
|
|
191
|
+
},
|
|
192
|
+
{ signal: abort.signal }
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
if (!abort.signal.aborted) {
|
|
196
|
+
setLoaded(null);
|
|
197
|
+
setReload((value) => value + 1);
|
|
198
|
+
}
|
|
199
|
+
} catch {
|
|
200
|
+
if (!abort.signal.aborted) {
|
|
201
|
+
setLoaded(null);
|
|
202
|
+
setError(true);
|
|
203
|
+
}
|
|
204
|
+
} finally {
|
|
205
|
+
if (!abort.signal.aborted) {
|
|
206
|
+
mutation.current = null;
|
|
207
|
+
setBusy(false);
|
|
208
|
+
setConfirmation(null);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
const site = loaded?.detail.artifact;
|
|
213
|
+
return /* @__PURE__ */ jsxs(
|
|
214
|
+
"section",
|
|
215
|
+
{
|
|
216
|
+
className,
|
|
217
|
+
"aria-label": "Site details",
|
|
218
|
+
"aria-busy": busy || !loaded && !error,
|
|
219
|
+
children: [
|
|
220
|
+
error && /* @__PURE__ */ jsx("p", { role: "alert", children: "Site state could not be confirmed or access has changed. Refresh before continuing." }),
|
|
221
|
+
!loaded && !error && /* @__PURE__ */ jsx("p", { role: "status", children: "Loading Site\u2026" }),
|
|
222
|
+
site && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
223
|
+
/* @__PURE__ */ jsx("h2", { children: site.title }),
|
|
224
|
+
/* @__PURE__ */ jsx("p", { children: site.description }),
|
|
225
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
226
|
+
site.status,
|
|
227
|
+
" \xB7 revision ",
|
|
228
|
+
site.currentVersion?.revision ?? "unpublished"
|
|
229
|
+
] }),
|
|
230
|
+
loaded.content && /* @__PURE__ */ jsx(
|
|
231
|
+
PublishedHtmlArtifactFrame,
|
|
232
|
+
{
|
|
233
|
+
html: loaded.content.html,
|
|
234
|
+
title: site.title,
|
|
235
|
+
...toolBridge ? { toolBridge } : {}
|
|
236
|
+
}
|
|
237
|
+
),
|
|
238
|
+
/* @__PURE__ */ jsx("h3", { children: "Versions" }),
|
|
239
|
+
/* @__PURE__ */ jsx("ul", { children: loaded.detail.versions.map((version) => /* @__PURE__ */ jsxs("li", { children: [
|
|
240
|
+
"Revision ",
|
|
241
|
+
version.revision,
|
|
242
|
+
" \xB7 ",
|
|
243
|
+
version.createdAt,
|
|
244
|
+
version.id === site.currentVersion?.id ? " \xB7 current" : ""
|
|
245
|
+
] }, version.id)) }),
|
|
246
|
+
loaded.detail.versionsTruncated && /* @__PURE__ */ jsx("p", { children: "Older versions are not included in this response." }),
|
|
247
|
+
canPublish && site.currentVersion && /* @__PURE__ */ jsxs("fieldset", { disabled: busy, children: [
|
|
248
|
+
/* @__PURE__ */ jsx("legend", { children: "Manage Site" }),
|
|
249
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => setConfirmation("status"), children: site.status === "active" ? "Archive Site" : "Restore Site" }),
|
|
250
|
+
/* @__PURE__ */ jsxs("label", { children: [
|
|
251
|
+
"Version to restore",
|
|
252
|
+
/* @__PURE__ */ jsxs(
|
|
253
|
+
"select",
|
|
254
|
+
{
|
|
255
|
+
value: rollbackId,
|
|
256
|
+
onChange: (event) => {
|
|
257
|
+
setRollbackId(event.target.value);
|
|
258
|
+
setConfirmation(null);
|
|
259
|
+
},
|
|
260
|
+
children: [
|
|
261
|
+
/* @__PURE__ */ jsx("option", { value: "", children: "Choose a version" }),
|
|
262
|
+
loaded.detail.versions.filter((version) => version.id !== site.currentVersion?.id).map((version) => /* @__PURE__ */ jsxs("option", { value: version.id, children: [
|
|
263
|
+
"Revision ",
|
|
264
|
+
version.revision
|
|
265
|
+
] }, version.id))
|
|
266
|
+
]
|
|
267
|
+
}
|
|
268
|
+
)
|
|
269
|
+
] }),
|
|
270
|
+
/* @__PURE__ */ jsx(
|
|
271
|
+
"button",
|
|
272
|
+
{
|
|
273
|
+
type: "button",
|
|
274
|
+
disabled: !rollbackId,
|
|
275
|
+
onClick: () => setConfirmation("rollback"),
|
|
276
|
+
children: "Review rollback"
|
|
277
|
+
}
|
|
278
|
+
),
|
|
279
|
+
confirmation && /* @__PURE__ */ jsxs("div", { role: "group", "aria-label": "Confirm Site change", children: [
|
|
280
|
+
/* @__PURE__ */ jsx("p", { children: confirmation === "rollback" ? "Make the selected version current?" : site.status === "active" ? "Archive this Site for workspace users?" : "Restore this Site for workspace users?" }),
|
|
281
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => void commit(), children: "Confirm change" }),
|
|
282
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => setConfirmation(null), children: "Keep current state" })
|
|
283
|
+
] })
|
|
284
|
+
] })
|
|
285
|
+
] }),
|
|
286
|
+
/* @__PURE__ */ jsx("button", { type: "button", disabled: busy, onClick: () => setReload((value) => value + 1), children: "Refresh Site" })
|
|
287
|
+
]
|
|
288
|
+
}
|
|
289
|
+
);
|
|
290
|
+
}
|
|
6
291
|
export {
|
|
7
292
|
SiteDetail,
|
|
8
293
|
SiteList,
|