@tangle-network/agent-app 0.52.18 → 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.
- package/dist/assistant/AssistantDock.d.ts +34 -28
- package/dist/assistant/AssistantPanel.d.ts +27 -28
- package/dist/assistant/ResizeHandle.d.ts +3 -3
- package/dist/assistant/index.d.ts +8 -5
- package/dist/assistant/index.js +851 -708
- package/dist/assistant/index.js.map +1 -1
- package/dist/assistant/launcher.d.ts +31 -8
- package/dist/assistant/page-context.d.ts +23 -0
- package/dist/assistant/panel-toggle.d.ts +23 -0
- package/dist/assistant/transcript.d.ts +24 -81
- package/dist/assistant/types.d.ts +19 -7
- package/dist/assistant/useAssistantChat.d.ts +6 -1
- package/dist/assistant/usePanelPrefs.d.ts +34 -42
- package/package.json +1 -1
|
@@ -1,21 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* panel
|
|
4
|
-
*
|
|
5
|
-
* the
|
|
6
|
-
*
|
|
7
|
-
*
|
|
2
|
+
* The assistant's place in the app shell: a right-side panel that mirrors the
|
|
3
|
+
* left sidebar. A panel toggle opens and closes it (top right while closed,
|
|
4
|
+
* the header's inner edge while open) and ⌘E / Ctrl+E does the same. On wide
|
|
5
|
+
* viewports the panel docks beside the page: it is non-modal, resizable, and
|
|
6
|
+
* the launcher's `inset` tells the shell how far to pad its page column so the
|
|
7
|
+
* panel never covers page content. On narrower viewports it opens as a modal
|
|
8
|
+
* sheet, full screen on phones. Width and open state persist per user.
|
|
9
|
+
*
|
|
10
|
+
* The dock owns the chat state (via useAssistantChat) so the conversation
|
|
11
|
+
* survives the panel closing. Host-shell concerns (the user, navigation,
|
|
12
|
+
* balance, money formatting, renderers, the page context, and the
|
|
13
|
+
* workflow-mutation signal) are injected.
|
|
8
14
|
*
|
|
9
15
|
* Mount inside an <AssistantClientProvider> (transport) and an
|
|
10
|
-
* <AssistantLauncherProvider> (
|
|
16
|
+
* <AssistantLauncherProvider> (panel state).
|
|
11
17
|
*/
|
|
12
18
|
import { type ReactNode } from "react";
|
|
13
|
-
import {
|
|
19
|
+
import type { ToolDetailRenderers } from "../web-react";
|
|
14
20
|
import { type AssistantPanelProps } from "./AssistantPanel";
|
|
15
|
-
import type {
|
|
21
|
+
import type { AssistantPageContext, ConfirmedResult, ConnectionRequirement, ConnectRequirementResult } from "./types";
|
|
16
22
|
export interface AssistantDockProps {
|
|
17
23
|
/** The signed-in user this conversation belongs to (null when signed out). */
|
|
18
24
|
userId: string | null;
|
|
25
|
+
/** The page the user has open. Shown in the panel header and sent with
|
|
26
|
+
* every turn. */
|
|
27
|
+
context?: AssistantPageContext | null;
|
|
28
|
+
/** Render the panel toggle at the viewport's top right while the panel is
|
|
29
|
+
* closed. Pass false when the host places `AssistantPanelToggle` in its own
|
|
30
|
+
* header. Hosts can tune the floating position with the
|
|
31
|
+
* `--assistant-toggle-top` and `--assistant-toggle-right` CSS variables,
|
|
32
|
+
* and lift it above a fixed top bar with `--assistant-toggle-z`. */
|
|
33
|
+
floatingToggle?: boolean;
|
|
19
34
|
/** Host navigation for error CTAs and connect targets. */
|
|
20
35
|
navigate?: (path: string) => void;
|
|
21
36
|
balanceUsd?: number | null;
|
|
@@ -23,34 +38,25 @@ export interface AssistantDockProps {
|
|
|
23
38
|
/** Render workflow YAML as a node graph in a proposal card. */
|
|
24
39
|
renderGraph?: (yaml: string) => ReactNode;
|
|
25
40
|
/** Render the brand icon for a proposal requirement's integration provider.
|
|
26
|
-
*
|
|
27
|
-
* absent, the card falls back to its built-in provider mark. */
|
|
41
|
+
* When absent, the card falls back to its built-in provider mark. */
|
|
28
42
|
renderProviderIcon?: (provider: string) => ReactNode;
|
|
29
43
|
/** Called after a workflow-mutating tool is confirmed (host re-fetches its list). */
|
|
30
44
|
onWorkflowMutation?: () => void;
|
|
31
|
-
/** In-place connect handler for a proposal's integration requirements. The
|
|
32
|
-
* runs its own connect flow
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* navigating the requirement's connect target via `navigate`. */
|
|
45
|
+
/** In-place connect handler for a proposal's integration requirements. The
|
|
46
|
+
* host runs its own connect flow and resolves whether the requirement is now
|
|
47
|
+
* satisfied. When omitted, the card navigates to the requirement's connect
|
|
48
|
+
* target via `navigate`. */
|
|
36
49
|
onConnectRequirement?: (requirement: ConnectionRequirement) => Promise<ConnectRequirementResult>;
|
|
37
|
-
/**
|
|
38
|
-
renderMarkdown?: (content: string) => ReactNode;
|
|
39
|
-
/** Per-tool custom detail renderers for expanded tool cards in the transcript. */
|
|
50
|
+
/** Per-tool detail renderers for expanded tool rows. */
|
|
40
51
|
toolRenderers?: ToolDetailRenderers;
|
|
41
52
|
/** Render a prominent card for a CONFIRMED tool's result (e.g. a one-time
|
|
42
|
-
* API-key reveal for `create_api_key`)
|
|
43
|
-
*
|
|
44
|
-
* {@link ConfirmedResult} for the never-persist/never-to-model contract. */
|
|
53
|
+
* API-key reveal for `create_api_key`). The result's `output` may carry a
|
|
54
|
+
* one-time secret — see {@link ConfirmedResult}. */
|
|
45
55
|
renderConfirmedResult?: (result: ConfirmedResult) => ReactNode;
|
|
46
|
-
/**
|
|
47
|
-
* {@link AssistantPanelProps.renderTranscript}); the dock chrome, composer,
|
|
48
|
-
* transport, and proposal flow stay owned by the panel. */
|
|
49
|
-
renderTranscript?: (view: AssistantTranscriptView) => ReactNode;
|
|
50
|
-
/** Opt-in attachment surface for the dock's composer — forwarded to
|
|
56
|
+
/** Opt-in attachment surface for the composer — forwarded to
|
|
51
57
|
* {@link AssistantPanelProps.composerAttachments}. */
|
|
52
58
|
composerAttachments?: AssistantPanelProps["composerAttachments"];
|
|
53
59
|
/** Forwarded to {@link AssistantPanelProps.onComposerSend}. */
|
|
54
60
|
onComposerSend?: AssistantPanelProps["onComposerSend"];
|
|
55
61
|
}
|
|
56
|
-
export declare function AssistantDock({ userId, navigate, balanceUsd, formatMoney, renderGraph, renderProviderIcon, onWorkflowMutation, onConnectRequirement,
|
|
62
|
+
export declare function AssistantDock({ userId, context, floatingToggle, navigate, balanceUsd, formatMoney, renderGraph, renderProviderIcon, onWorkflowMutation, onConnectRequirement, toolRenderers, renderConfirmedResult, composerAttachments, onComposerSend, }: AssistantDockProps): import("react").JSX.Element | null;
|
|
@@ -1,52 +1,51 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The assistant chat panel
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* view. App-shell concerns
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* owned by the dock and passed in, so the conversation survives the
|
|
2
|
+
* The assistant chat panel. The conversation renders through the main chat's
|
|
3
|
+
* primitives (`AssistantTranscript` over `AgentTimeline`), notices follow the
|
|
4
|
+
* main chat's status banners, and the composer is the same `ChatComposer` the
|
|
5
|
+
* sandbox session uses, with the quiet `ModelPicker` in its controls slot. The
|
|
6
|
+
* header names the page the assistant is looking at; its history toggle swaps
|
|
7
|
+
* the conversation for a searchable history view. App-shell concerns (the
|
|
8
|
+
* signed-in user, navigation, balance, money formatting, tool-detail and graph
|
|
9
|
+
* renderers) are injected so the panel is portable across hosts. Chat state is
|
|
10
|
+
* owned by the dock and passed in, so the conversation survives the panel
|
|
11
|
+
* closing.
|
|
11
12
|
*/
|
|
12
|
-
import { type ReactNode } from "react";
|
|
13
|
+
import { type ReactNode, type Ref } from "react";
|
|
13
14
|
import type { CatalogModel } from "../runtime/model-catalog";
|
|
14
15
|
import { type ComposerFile, type ToolDetailRenderers } from "../web-react";
|
|
15
16
|
import type { AssistantModels } from "./client";
|
|
16
|
-
import type {
|
|
17
|
+
import type { AssistantPanelLayout } from "./launcher";
|
|
18
|
+
import type { AssistantPageContext, ConfirmedResult } from "./types";
|
|
17
19
|
import type { AssistantChat } from "./useAssistantChat";
|
|
18
20
|
export interface AssistantPanelProps {
|
|
19
21
|
chat: AssistantChat;
|
|
20
22
|
userId: string | null;
|
|
21
23
|
onClose: () => void;
|
|
24
|
+
/** `docked` puts the panel toggle on the header's inner edge; `sheet` adds a
|
|
25
|
+
* close button on its outer edge. Defaults to `docked`. */
|
|
26
|
+
layout?: AssistantPanelLayout;
|
|
27
|
+
/** The page the user has open, named under the panel title. */
|
|
28
|
+
context?: AssistantPageContext | null;
|
|
29
|
+
/** Receives the header's panel toggle, so the dock can return focus to it. */
|
|
30
|
+
toggleRef?: Ref<HTMLButtonElement>;
|
|
22
31
|
/** Host navigation for error CTAs and connect targets. */
|
|
23
32
|
navigate?: (path: string) => void;
|
|
24
|
-
/** The user's credit balance, for the header
|
|
33
|
+
/** The user's credit balance, for the header and the low-balance notice. */
|
|
25
34
|
balanceUsd?: number | null;
|
|
26
35
|
/** Format a USD amount; defaults to Intl currency formatting. */
|
|
27
36
|
formatMoney?: (usd: number | null) => string;
|
|
28
|
-
/** Render workflow YAML as a node graph in a proposal card
|
|
29
|
-
*
|
|
37
|
+
/** Render workflow YAML as a node graph in a proposal card. When absent,
|
|
38
|
+
* proposals show YAML as text. */
|
|
30
39
|
renderGraph?: (yaml: string) => ReactNode;
|
|
31
40
|
/** Render the brand icon for a proposal requirement's integration provider.
|
|
32
41
|
* When absent, the card falls back to its built-in provider mark. */
|
|
33
42
|
renderProviderIcon?: (provider: string) => ReactNode;
|
|
34
|
-
/**
|
|
35
|
-
*
|
|
36
|
-
renderMarkdown?: (content: string) => ReactNode;
|
|
37
|
-
/** Per-tool custom detail renderers for expanded tool cards in the transcript. */
|
|
43
|
+
/** Per-tool detail renderers for expanded tool rows. A renderer returning
|
|
44
|
+
* null falls back to the shared row's input/output detail. */
|
|
38
45
|
toolRenderers?: ToolDetailRenderers;
|
|
39
46
|
/** Render a prominent card for a CONFIRMED tool's result (e.g. a one-time
|
|
40
|
-
* API-key reveal for `create_api_key`), shown
|
|
41
|
-
* line. Ignored when a host swaps the whole transcript via `renderTranscript`. */
|
|
47
|
+
* API-key reveal for `create_api_key`), shown after the action's status. */
|
|
42
48
|
renderConfirmedResult?: (result: ConfirmedResult) => ReactNode;
|
|
43
|
-
/** Swap ONLY the conversation rendering for a host-supplied renderer (e.g. a
|
|
44
|
-
* different chat-message component), while the panel keeps owning the header,
|
|
45
|
-
* composer, model picker, history, transport, and proposal orchestration.
|
|
46
|
-
* Receives the transcript slice plus a bound proposal card to place. When
|
|
47
|
-
* absent, the built-in transcript (web-react `ChatMessages`) renders the
|
|
48
|
-
* conversation. */
|
|
49
|
-
renderTranscript?: (view: AssistantTranscriptView) => ReactNode;
|
|
50
49
|
/** One-shot composer prefill from the host's launcher (e.g. a page's "Create
|
|
51
50
|
* with assistant" button passing `openAssistant(seed)`). The panel adopts it
|
|
52
51
|
* as the composer draft and calls `onComposerSeedApplied` once, so the host
|
|
@@ -81,4 +80,4 @@ export declare function toPickerModels(models: AssistantModels, selected: string
|
|
|
81
80
|
* user to it even after the server default changes). Any other id is stored as-is.
|
|
82
81
|
*/
|
|
83
82
|
export declare function nextModelSelection(id: string, defaultSlug: string | null): string | null;
|
|
84
|
-
export declare function AssistantPanel({ chat, userId, onClose, navigate, balanceUsd, formatMoney, renderGraph, renderProviderIcon,
|
|
83
|
+
export declare function AssistantPanel({ chat, userId, onClose, layout, context, toggleRef, navigate, balanceUsd, formatMoney, renderGraph, renderProviderIcon, toolRenderers, renderConfirmedResult, composerSeed, onComposerSeedApplied, composerAttachments, onComposerSend, }: AssistantPanelProps): import("react").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Drag-to-resize grip on the assistant
|
|
2
|
+
* Drag-to-resize grip on the assistant panel's left edge. Pointer capture keeps
|
|
3
3
|
* the drag alive while the cursor moves anywhere on screen; arrow keys resize in
|
|
4
|
-
* coarse steps for keyboard users. The
|
|
4
|
+
* coarse steps for keyboard users. The panel is right-anchored, so dragging
|
|
5
5
|
* left widens it. The in-memory width updates every move (`onPreview`); the
|
|
6
6
|
* final width is persisted once on release (`onCommit`).
|
|
7
7
|
*/
|
|
@@ -10,7 +10,7 @@ export declare function ResizeHandle({ width, maxWidth, onPreview, onCommit, onN
|
|
|
10
10
|
maxWidth: number;
|
|
11
11
|
/** Live (non-persisted) width update during a drag. The value is the raw
|
|
12
12
|
* pointer-derived width and is NOT clamped — the consumer must clamp it to its
|
|
13
|
-
* own min/max (the
|
|
13
|
+
* own min/max (the launcher's `panel.previewWidth` does). */
|
|
14
14
|
onPreview: (next: number) => void;
|
|
15
15
|
/** Persist the final width (drag end). */
|
|
16
16
|
onCommit: (next: number) => void;
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* `@tangle-network/agent-app/assistant` — the in-app assistant/copilot surface,
|
|
3
3
|
* portable across hosts. A host supplies a transport via {@link createAssistantClient}
|
|
4
4
|
* and {@link AssistantClientProvider}; the dock, panel, hooks, and proposal card
|
|
5
|
-
* consume it
|
|
6
|
-
* `
|
|
7
|
-
*
|
|
5
|
+
* consume it. The conversation renders on the main chat's primitives
|
|
6
|
+
* (`@tangle-network/ui` `AgentTimeline` and `InlineToolItem`) and the composer
|
|
7
|
+
* on web-react's `ChatComposer` and `ModelPicker`. Per-tool detail renderers and
|
|
8
|
+
* the workflow-graph renderer are injected so this subpath carries no
|
|
8
9
|
* product-specific dependency.
|
|
9
10
|
*/
|
|
10
11
|
export * from "./types";
|
|
@@ -15,6 +16,8 @@ export { useAssistantModels } from "./useAssistantModels";
|
|
|
15
16
|
export { useAssistantThreads, type AssistantThreads } from "./useAssistantThreads";
|
|
16
17
|
export { AssistantDock, type AssistantDockProps } from "./AssistantDock";
|
|
17
18
|
export { AssistantPanel, type AssistantPanelProps } from "./AssistantPanel";
|
|
18
|
-
export { AssistantTranscript, type AssistantTranscriptProps,
|
|
19
|
+
export { AssistantTranscript, type AssistantTranscriptProps, type AssistantTimelineOptions, buildAssistantTimeline, assistantIsThinking, } from "./transcript";
|
|
19
20
|
export { ProposalCard, type ProposalCardProps } from "./ProposalCard";
|
|
20
|
-
export { AssistantLauncherProvider, useAssistantLauncher, type AssistantLauncher, } from "./launcher";
|
|
21
|
+
export { AssistantLauncherProvider, useAssistantLauncher, type AssistantLauncher, type AssistantPanelLayout, } from "./launcher";
|
|
22
|
+
export { useDocumentPageContext, pageLabelFromTitle, type DocumentPageContextOptions, } from "./page-context";
|
|
23
|
+
export { AssistantPanelToggle, type AssistantPanelToggleProps, ASSISTANT_PANEL_ID, assistantShortcutLabel, } from "./panel-toggle";
|