@tangle-network/agent-app 0.53.0 → 0.53.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.
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The page the assistant is looking at, read from the document title. Product
|
|
3
|
+
* pages already name themselves in `<title>` for tabs and history, so the
|
|
4
|
+
* title is the label; watching it keeps hosts free of per-page wiring and
|
|
5
|
+
* follows titles that settle late (a run page names its workflow once the
|
|
6
|
+
* workflow loads).
|
|
7
|
+
*/
|
|
8
|
+
import type { AssistantPageContext } from "./types";
|
|
9
|
+
/** Pass module-level `titleSuffix`, `ignoreTitles` and `ids` so the context
|
|
10
|
+
* keeps its identity between renders. */
|
|
11
|
+
export interface DocumentPageContextOptions {
|
|
12
|
+
/** The current in-app path, from the host router. */
|
|
13
|
+
path: string;
|
|
14
|
+
/** The product suffix to drop from titles, e.g. / — Tangle Platform$/. */
|
|
15
|
+
titleSuffix?: RegExp;
|
|
16
|
+
/** Titles that name no particular page (the bare product name). */
|
|
17
|
+
ignoreTitles?: readonly string[];
|
|
18
|
+
/** Tool-facing ids for the path, e.g. `{ workflowId, runId }`. */
|
|
19
|
+
ids?: (path: string) => Record<string, string> | undefined;
|
|
20
|
+
}
|
|
21
|
+
/** `title` minus the product suffix, or null when nothing page-specific is left. */
|
|
22
|
+
export declare function pageLabelFromTitle(title: string, titleSuffix?: RegExp, ignoreTitles?: readonly string[]): string | null;
|
|
23
|
+
export declare function useDocumentPageContext({ path, titleSuffix, ignoreTitles, ids, }: DocumentPageContextOptions): AssistantPageContext | null;
|
package/package.json
CHANGED