@tangle-network/agent-app 0.53.0 → 0.53.2
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.
|
@@ -28,7 +28,8 @@ export interface AssistantDockProps {
|
|
|
28
28
|
/** Render the panel toggle at the viewport's top right while the panel is
|
|
29
29
|
* closed. Pass false when the host places `AssistantPanelToggle` in its own
|
|
30
30
|
* header. Hosts can tune the floating position with the
|
|
31
|
-
* `--assistant-toggle-top` and `--assistant-toggle-right` CSS variables
|
|
31
|
+
* `--assistant-toggle-top` and `--assistant-toggle-right` CSS variables,
|
|
32
|
+
* and lift it above a fixed top bar with `--assistant-toggle-z`. */
|
|
32
33
|
floatingToggle?: boolean;
|
|
33
34
|
/** Host navigation for error CTAs and connect targets. */
|
|
34
35
|
navigate?: (path: string) => void;
|
|
@@ -19,4 +19,5 @@ export { AssistantPanel, type AssistantPanelProps } from "./AssistantPanel";
|
|
|
19
19
|
export { AssistantTranscript, type AssistantTranscriptProps, type AssistantTimelineOptions, buildAssistantTimeline, assistantIsThinking, } from "./transcript";
|
|
20
20
|
export { ProposalCard, type ProposalCardProps } from "./ProposalCard";
|
|
21
21
|
export { AssistantLauncherProvider, useAssistantLauncher, type AssistantLauncher, type AssistantPanelLayout, } from "./launcher";
|
|
22
|
+
export { useDocumentPageContext, pageLabelFromTitle, type DocumentPageContextOptions, } from "./page-context";
|
|
22
23
|
export { AssistantPanelToggle, type AssistantPanelToggleProps, ASSISTANT_PANEL_ID, assistantShortcutLabel, } from "./panel-toggle";
|
package/dist/assistant/index.js
CHANGED
|
@@ -3194,10 +3194,11 @@ function AssistantDock({
|
|
|
3194
3194
|
AssistantPanelToggle,
|
|
3195
3195
|
{
|
|
3196
3196
|
buttonRef: toggleRef,
|
|
3197
|
-
className: "fixed
|
|
3197
|
+
className: "fixed",
|
|
3198
3198
|
style: {
|
|
3199
3199
|
top: "var(--assistant-toggle-top, 0.75rem)",
|
|
3200
|
-
right: "var(--assistant-toggle-right, 0.75rem)"
|
|
3200
|
+
right: "var(--assistant-toggle-right, 0.75rem)",
|
|
3201
|
+
zIndex: "var(--assistant-toggle-z, 30)"
|
|
3201
3202
|
}
|
|
3202
3203
|
}
|
|
3203
3204
|
) : null;
|
|
@@ -3301,6 +3302,46 @@ function AssistantDock({
|
|
|
3301
3302
|
}
|
|
3302
3303
|
);
|
|
3303
3304
|
}
|
|
3305
|
+
|
|
3306
|
+
// src/assistant/page-context.ts
|
|
3307
|
+
import { useEffect as useEffect9, useMemo as useMemo5, useState as useState8 } from "react";
|
|
3308
|
+
var MAX_LABEL = 200;
|
|
3309
|
+
function pageLabelFromTitle(title, titleSuffix, ignoreTitles = []) {
|
|
3310
|
+
const label = (titleSuffix ? title.replace(titleSuffix, "") : title).trim();
|
|
3311
|
+
if (!label || ignoreTitles.includes(label)) return null;
|
|
3312
|
+
return label.length > MAX_LABEL ? `${label.slice(0, MAX_LABEL - 1)}\u2026` : label;
|
|
3313
|
+
}
|
|
3314
|
+
function useDocumentTitle() {
|
|
3315
|
+
const [title, setTitle] = useState8(
|
|
3316
|
+
() => typeof document === "undefined" ? "" : document.title
|
|
3317
|
+
);
|
|
3318
|
+
useEffect9(() => {
|
|
3319
|
+
const update = () => setTitle(document.title);
|
|
3320
|
+
const observer = new MutationObserver(update);
|
|
3321
|
+
observer.observe(document.head, {
|
|
3322
|
+
subtree: true,
|
|
3323
|
+
childList: true,
|
|
3324
|
+
characterData: true
|
|
3325
|
+
});
|
|
3326
|
+
update();
|
|
3327
|
+
return () => observer.disconnect();
|
|
3328
|
+
}, []);
|
|
3329
|
+
return title;
|
|
3330
|
+
}
|
|
3331
|
+
function useDocumentPageContext({
|
|
3332
|
+
path,
|
|
3333
|
+
titleSuffix,
|
|
3334
|
+
ignoreTitles,
|
|
3335
|
+
ids
|
|
3336
|
+
}) {
|
|
3337
|
+
const title = useDocumentTitle();
|
|
3338
|
+
return useMemo5(() => {
|
|
3339
|
+
const label = pageLabelFromTitle(title, titleSuffix, ignoreTitles);
|
|
3340
|
+
if (!label) return null;
|
|
3341
|
+
const pageIds = ids?.(path);
|
|
3342
|
+
return { label, path, ...pageIds ? { ids: pageIds } : {} };
|
|
3343
|
+
}, [title, path, titleSuffix, ignoreTitles, ids]);
|
|
3344
|
+
}
|
|
3304
3345
|
export {
|
|
3305
3346
|
ASSISTANT_PANEL_ID,
|
|
3306
3347
|
AssistantClientInputError,
|
|
@@ -3315,10 +3356,12 @@ export {
|
|
|
3315
3356
|
assistantShortcutLabel,
|
|
3316
3357
|
buildAssistantTimeline,
|
|
3317
3358
|
createAssistantClient,
|
|
3359
|
+
pageLabelFromTitle,
|
|
3318
3360
|
useAssistantChat,
|
|
3319
3361
|
useAssistantClient,
|
|
3320
3362
|
useAssistantLauncher,
|
|
3321
3363
|
useAssistantModels,
|
|
3322
|
-
useAssistantThreads
|
|
3364
|
+
useAssistantThreads,
|
|
3365
|
+
useDocumentPageContext
|
|
3323
3366
|
};
|
|
3324
3367
|
//# sourceMappingURL=index.js.map
|