lemma-sdk 0.2.30 → 0.2.32

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.
Files changed (74) hide show
  1. package/README.md +213 -51
  2. package/dist/react/index.d.ts +23 -1
  3. package/dist/react/index.js +11 -0
  4. package/dist/react/useAgentInputSchema.d.ts +19 -0
  5. package/dist/react/useAgentInputSchema.js +73 -0
  6. package/dist/react/useAgentRun.js +18 -20
  7. package/dist/react/useAgentRuns.d.ts +33 -0
  8. package/dist/react/useAgentRuns.js +149 -0
  9. package/dist/react/useAssistantRun.js +10 -9
  10. package/dist/react/useAssistantSession.js +21 -25
  11. package/dist/react/useBulkRecords.js +9 -16
  12. package/dist/react/useConversation.js +24 -8
  13. package/dist/react/useConversations.d.ts +4 -0
  14. package/dist/react/useConversations.js +49 -3
  15. package/dist/react/useCreateRecord.d.ts +33 -3
  16. package/dist/react/useCreateRecord.js +20 -17
  17. package/dist/react/useCurrentUser.d.ts +14 -0
  18. package/dist/react/useCurrentUser.js +68 -0
  19. package/dist/react/useDeleteRecord.js +9 -16
  20. package/dist/react/useFlowRunHistory.js +1 -5
  21. package/dist/react/useFlowSession.js +41 -33
  22. package/dist/react/useForeignKeyOptions.d.ts +18 -0
  23. package/dist/react/useForeignKeyOptions.js +26 -15
  24. package/dist/react/useFunctionRun.d.ts +36 -0
  25. package/dist/react/useFunctionRun.js +30 -0
  26. package/dist/react/useFunctionRuns.d.ts +33 -0
  27. package/dist/react/useFunctionRuns.js +149 -0
  28. package/dist/react/useFunctionSession.js +37 -29
  29. package/dist/react/useJoinedRecords.d.ts +57 -2
  30. package/dist/react/useJoinedRecords.js +77 -27
  31. package/dist/react/useMembers.d.ts +4 -0
  32. package/dist/react/useMembers.js +55 -16
  33. package/dist/react/useOrganizationMembers.d.ts +26 -0
  34. package/dist/react/useOrganizationMembers.js +113 -0
  35. package/dist/react/usePodAccess.d.ts +22 -0
  36. package/dist/react/usePodAccess.js +128 -0
  37. package/dist/react/useRecord.d.ts +16 -0
  38. package/dist/react/useRecord.js +24 -13
  39. package/dist/react/useRecordForm.d.ts +42 -3
  40. package/dist/react/useRecordForm.js +44 -24
  41. package/dist/react/useRecords.d.ts +2 -0
  42. package/dist/react/useRecords.js +62 -22
  43. package/dist/react/useReferencingRecords.d.ts +66 -0
  44. package/dist/react/useReferencingRecords.js +159 -0
  45. package/dist/react/useRelatedRecords.d.ts +17 -0
  46. package/dist/react/useRelatedRecords.js +28 -21
  47. package/dist/react/useReverseRelatedRecords.d.ts +21 -0
  48. package/dist/react/useReverseRelatedRecords.js +30 -21
  49. package/dist/react/useSchemaForm.js +1 -13
  50. package/dist/react/useTable.js +24 -13
  51. package/dist/react/useTables.d.ts +4 -0
  52. package/dist/react/useTables.js +57 -15
  53. package/dist/react/useTaskSession.js +11 -22
  54. package/dist/react/useUpdateRecord.d.ts +34 -3
  55. package/dist/react/useUpdateRecord.js +21 -17
  56. package/dist/react/useWorkflowResume.d.ts +18 -0
  57. package/dist/react/useWorkflowResume.js +45 -0
  58. package/dist/react/useWorkflowRun.d.ts +21 -0
  59. package/dist/react/useWorkflowRun.js +49 -0
  60. package/dist/react/useWorkflowRuns.d.ts +33 -0
  61. package/dist/react/useWorkflowRuns.js +149 -0
  62. package/dist/react/useWorkflowStart.js +20 -27
  63. package/dist/react/utils.d.ts +5 -0
  64. package/dist/react/utils.js +25 -0
  65. package/dist/types.d.ts +1 -0
  66. package/package.json +2 -4
  67. package/dist/react/components/AssistantChrome.d.ts +0 -86
  68. package/dist/react/components/AssistantChrome.js +0 -48
  69. package/dist/react/components/AssistantEmbedded.d.ts +0 -10
  70. package/dist/react/components/AssistantEmbedded.js +0 -15
  71. package/dist/react/components/AssistantExperience.d.ts +0 -96
  72. package/dist/react/components/AssistantExperience.js +0 -1294
  73. package/dist/react/components/assistant-types.d.ts +0 -80
  74. package/dist/react/components/assistant-types.js +0 -1
@@ -0,0 +1,149 @@
1
+ import { useCallback, useEffect, useMemo, useState } from "react";
2
+ import { normalizeError, resolvePodClient } from "./utils.js";
3
+ export function useWorkflowRuns({ client, podId, workflowName, enabled = true, autoLoad = true, limit = 100, pageToken, initialRunId = null, }) {
4
+ const [runs, setRuns] = useState([]);
5
+ const [total, setTotal] = useState(0);
6
+ const [nextPageToken, setNextPageToken] = useState(null);
7
+ const [selectedRunId, setSelectedRunId] = useState(initialRunId);
8
+ const [isLoading, setIsLoading] = useState(false);
9
+ const [isLoadingMore, setIsLoadingMore] = useState(false);
10
+ const [error, setError] = useState(null);
11
+ const trimmedWorkflowName = workflowName.trim();
12
+ const isEnabled = enabled && trimmedWorkflowName.length > 0;
13
+ const refresh = useCallback(async (overrides = {}, signal) => {
14
+ if (!isEnabled) {
15
+ setRuns([]);
16
+ setTotal(0);
17
+ setNextPageToken(null);
18
+ setError(null);
19
+ setIsLoading(false);
20
+ return [];
21
+ }
22
+ setIsLoading(true);
23
+ setError(null);
24
+ try {
25
+ const scopedClient = resolvePodClient(client, podId);
26
+ const response = await scopedClient.workflows.runs.list(trimmedWorkflowName, {
27
+ limit: overrides.limit ?? limit,
28
+ pageToken: overrides.pageToken ?? pageToken,
29
+ });
30
+ if (signal?.aborted)
31
+ return [];
32
+ const nextRuns = response.items ?? [];
33
+ setRuns(nextRuns);
34
+ setTotal(response.total ?? nextRuns.length);
35
+ setNextPageToken(response.next_page_token ?? null);
36
+ setSelectedRunId((current) => (current && nextRuns.some((run) => run.id === current) ? current : initialRunId));
37
+ return nextRuns;
38
+ }
39
+ catch (refreshError) {
40
+ if (signal?.aborted)
41
+ return [];
42
+ const normalized = normalizeError(refreshError, "Failed to load workflow runs.");
43
+ setError(normalized);
44
+ return [];
45
+ }
46
+ finally {
47
+ if (!signal?.aborted)
48
+ setIsLoading(false);
49
+ }
50
+ }, [client, initialRunId, isEnabled, limit, pageToken, podId, trimmedWorkflowName]);
51
+ const loadMore = useCallback(async (overrides = {}) => {
52
+ if (!isEnabled || !nextPageToken || isLoading || isLoadingMore) {
53
+ return [];
54
+ }
55
+ setIsLoadingMore(true);
56
+ setError(null);
57
+ try {
58
+ const scopedClient = resolvePodClient(client, podId);
59
+ const response = await scopedClient.workflows.runs.list(trimmedWorkflowName, {
60
+ limit: overrides.limit ?? limit,
61
+ pageToken: nextPageToken,
62
+ });
63
+ const moreRuns = response.items ?? [];
64
+ setRuns((previous) => [...previous, ...moreRuns]);
65
+ setTotal(response.total ?? runs.length + moreRuns.length);
66
+ setNextPageToken(response.next_page_token ?? null);
67
+ return moreRuns;
68
+ }
69
+ catch (loadError) {
70
+ const normalized = normalizeError(loadError, "Failed to load more workflow runs.");
71
+ setError(normalized);
72
+ return [];
73
+ }
74
+ finally {
75
+ setIsLoadingMore(false);
76
+ }
77
+ }, [client, isEnabled, isLoading, isLoadingMore, limit, nextPageToken, podId, trimmedWorkflowName]);
78
+ useEffect(() => {
79
+ setSelectedRunId(initialRunId);
80
+ }, [initialRunId]);
81
+ useEffect(() => {
82
+ if (!isEnabled) {
83
+ setRuns([]);
84
+ setTotal(0);
85
+ setNextPageToken(null);
86
+ setError(null);
87
+ setIsLoading(false);
88
+ setIsLoadingMore(false);
89
+ return;
90
+ }
91
+ if (!autoLoad)
92
+ return;
93
+ const controller = new AbortController();
94
+ let cancelled = false;
95
+ (async () => {
96
+ try {
97
+ await refresh({}, controller.signal);
98
+ }
99
+ catch {
100
+ if (!cancelled) {
101
+ setError(normalizeError(new Error("Failed to load workflow runs."), "Failed to load workflow runs."));
102
+ }
103
+ }
104
+ })();
105
+ return () => {
106
+ cancelled = true;
107
+ controller.abort();
108
+ };
109
+ }, [autoLoad, isEnabled, refresh]);
110
+ const selectRun = useCallback((runId) => {
111
+ setSelectedRunId(runId);
112
+ }, []);
113
+ const clearSelection = useCallback(() => {
114
+ setSelectedRunId(null);
115
+ }, []);
116
+ return useMemo(() => {
117
+ const effectiveSelectedRunId = selectedRunId ?? runs[0]?.id ?? null;
118
+ const selectedRun = effectiveSelectedRunId
119
+ ? runs.find((run) => run.id === effectiveSelectedRunId) ?? null
120
+ : null;
121
+ return {
122
+ runs,
123
+ total,
124
+ nextPageToken,
125
+ selectedRunId,
126
+ effectiveSelectedRunId,
127
+ selectedRun,
128
+ isLoading,
129
+ isLoadingMore,
130
+ error,
131
+ selectRun,
132
+ clearSelection,
133
+ refresh,
134
+ loadMore,
135
+ };
136
+ }, [
137
+ clearSelection,
138
+ error,
139
+ isLoading,
140
+ isLoadingMore,
141
+ loadMore,
142
+ nextPageToken,
143
+ refresh,
144
+ runs,
145
+ selectRun,
146
+ selectedRunId,
147
+ total,
148
+ ]);
149
+ }
@@ -1,16 +1,7 @@
1
- import { useCallback, useEffect, useState } from "react";
1
+ import { useCallback, useEffect, useMemo, useState } from "react";
2
2
  import { normalizeRunStatus } from "../run-utils.js";
3
+ import { normalizeError, resolvePodClient } from "./utils.js";
3
4
  import { useFlowSession, } from "./useFlowSession.js";
4
- function normalizeError(error, fallback) {
5
- if (error instanceof Error)
6
- return error;
7
- return new Error(fallback);
8
- }
9
- function resolvePodClient(client, podId) {
10
- if (!podId || podId === client.podId)
11
- return client;
12
- return client.withPod(podId);
13
- }
14
5
  function findFirstFormNode(workflow) {
15
6
  if (!workflow?.nodes?.length)
16
7
  return null;
@@ -136,20 +127,22 @@ export function useWorkflowStart({ client, podId, workflowName, runId = null, en
136
127
  setIsStarting(false);
137
128
  }
138
129
  }, [hasWorkflowName, refreshWorkflow, session, workflow, workflowName]);
139
- const formNode = findFirstFormNode(workflow);
140
- const startType = workflow?.start?.type ?? "MANUAL";
141
- const error = workflowError ?? session.error;
142
- return {
143
- ...session,
144
- workflow,
145
- startType,
146
- inputSchema: formNode?.config.input_schema ?? null,
147
- inputUiSchema: formNode?.config.ui_schema ?? null,
148
- isLoadingWorkflow,
149
- isStarting,
150
- error,
151
- refreshWorkflow,
152
- listHistory,
153
- start,
154
- };
130
+ return useMemo(() => {
131
+ const formNode = findFirstFormNode(workflow);
132
+ const startType = workflow?.start?.type ?? "MANUAL";
133
+ const error = workflowError ?? session.error;
134
+ return {
135
+ ...session,
136
+ workflow,
137
+ startType,
138
+ inputSchema: formNode?.config.input_schema ?? null,
139
+ inputUiSchema: formNode?.config.ui_schema ?? null,
140
+ isLoadingWorkflow,
141
+ isStarting,
142
+ error,
143
+ refreshWorkflow,
144
+ listHistory,
145
+ start,
146
+ };
147
+ }, [isStarting, isLoadingWorkflow, listHistory, refreshWorkflow, session, start, workflow, workflowError]);
155
148
  }
@@ -0,0 +1,5 @@
1
+ import type { LemmaClient } from "../client.js";
2
+ export declare function normalizeError(error: unknown, fallback: string): Error;
3
+ export declare function resolvePodClient(client: LemmaClient, podId?: string): LemmaClient;
4
+ export declare function resolvePodId(client: LemmaClient, podId?: string): string;
5
+ export declare function stringifyComparable(value: unknown): string;
@@ -0,0 +1,25 @@
1
+ export function normalizeError(error, fallback) {
2
+ if (error instanceof Error)
3
+ return error;
4
+ return new Error(fallback);
5
+ }
6
+ export function resolvePodClient(client, podId) {
7
+ if (!podId || podId === client.podId)
8
+ return client;
9
+ return client.withPod(podId);
10
+ }
11
+ export function resolvePodId(client, podId) {
12
+ const resolved = podId ?? client.podId;
13
+ if (!resolved) {
14
+ throw new Error("podId is required. Pass podId or set it on LemmaClient.");
15
+ }
16
+ return resolved;
17
+ }
18
+ export function stringifyComparable(value) {
19
+ try {
20
+ return JSON.stringify(value);
21
+ }
22
+ catch {
23
+ return String(value);
24
+ }
25
+ }
package/dist/types.d.ts CHANGED
@@ -69,6 +69,7 @@ export interface CursorPage<T> {
69
69
  items: T[];
70
70
  limit: number;
71
71
  next_page_token?: string | null;
72
+ total?: number;
72
73
  }
73
74
  /**
74
75
  * Re-export generated OpenAPI models/enums/services from the same module so this
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lemma-sdk",
3
- "version": "0.2.30",
3
+ "version": "0.2.32",
4
4
  "description": "Official TypeScript SDK for Lemma pod-scoped APIs",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -43,7 +43,7 @@
43
43
  "generate:client": "./scripts/generate_openapi_client.sh",
44
44
  "build": "npm run clean && tsc -p tsconfig.json && npm run build:bundle",
45
45
  "build:bundle": "tsc -p tsconfig.bundle.json && node ./scripts/build_browser_bundle.mjs",
46
- "clean": "rm -rf dist",
46
+ "clean": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true, maxRetries: 10, retryDelay: 100 })\"",
47
47
  "registry:build": "shadcn build ./registry.json -o ./public/r",
48
48
  "prepublishOnly": "npm run build",
49
49
  "release:check": "npm run build && npm_config_cache=.npm-cache npm pack --dry-run"
@@ -57,8 +57,6 @@
57
57
  }
58
58
  },
59
59
  "dependencies": {
60
- "react-markdown": "^10.1.0",
61
- "remark-gfm": "^4.0.1",
62
60
  "supertokens-web-js": "^0.16.0"
63
61
  },
64
62
  "devDependencies": {
@@ -1,86 +0,0 @@
1
- import { type ComponentPropsWithoutRef, type ReactNode } from "react";
2
- import type { AssistantConversationListItem, AssistantConversationRenderArgs } from "./assistant-types.js";
3
- export type AssistantSurfaceTone = "default" | "subtle" | "flat";
4
- export type AssistantThemeMode = "auto" | "light" | "dark";
5
- export interface AssistantThemeScopeProps extends ComponentPropsWithoutRef<"div"> {
6
- children: ReactNode;
7
- theme?: AssistantThemeMode;
8
- }
9
- export declare function AssistantThemeScope({ className, children, theme, ...props }: AssistantThemeScopeProps): import("react/jsx-runtime").JSX.Element;
10
- export interface AssistantHeaderProps {
11
- title: ReactNode;
12
- subtitle?: ReactNode;
13
- badge?: ReactNode;
14
- controls?: ReactNode;
15
- tone?: AssistantSurfaceTone;
16
- className?: string;
17
- }
18
- export interface AssistantMessageViewportProps extends ComponentPropsWithoutRef<"div"> {
19
- innerClassName?: string;
20
- children: ReactNode;
21
- }
22
- export declare const AssistantMessageViewport: import("react").ForwardRefExoticComponent<AssistantMessageViewportProps & import("react").RefAttributes<HTMLDivElement>>;
23
- export interface AssistantShellLayoutProps {
24
- sidebar?: ReactNode;
25
- sidebarVisible?: boolean;
26
- main: ReactNode;
27
- className?: string;
28
- }
29
- export declare function AssistantShellLayout({ sidebar, sidebarVisible, main, className, }: AssistantShellLayoutProps): import("react/jsx-runtime").JSX.Element;
30
- export declare function AssistantHeader({ title, subtitle, badge, controls, tone, className, }: AssistantHeaderProps): import("react/jsx-runtime").JSX.Element;
31
- export interface AssistantConversationListProps {
32
- conversations: AssistantConversationListItem[];
33
- activeConversationId: string | null;
34
- onSelectConversation: (conversationId: string) => void;
35
- onNewConversation?: () => void;
36
- renderConversationLabel?: (args: AssistantConversationRenderArgs) => ReactNode;
37
- title?: ReactNode;
38
- newLabel?: ReactNode;
39
- className?: string;
40
- }
41
- export declare function AssistantConversationList({ conversations, activeConversationId, onSelectConversation, onNewConversation, renderConversationLabel, title, newLabel, className, }: AssistantConversationListProps): import("react/jsx-runtime").JSX.Element;
42
- export interface AssistantModelPickerProps<TValue extends string = string> {
43
- value: TValue | null;
44
- options: TValue[];
45
- disabled?: boolean;
46
- autoLabel?: ReactNode;
47
- getOptionLabel?: (value: TValue) => ReactNode;
48
- onChange: (value: TValue | null) => void;
49
- className?: string;
50
- }
51
- export declare function AssistantModelPicker<TValue extends string = string>({ value, options, disabled, autoLabel, getOptionLabel, onChange, className, }: AssistantModelPickerProps<TValue>): import("react/jsx-runtime").JSX.Element;
52
- export interface AssistantAskOverlayProps {
53
- questionNumber: number;
54
- totalQuestions: number;
55
- question: ReactNode;
56
- options: string[];
57
- selectedOptions: string[];
58
- canContinue: boolean;
59
- continueLabel: ReactNode;
60
- onSelectOption: (option: string) => void;
61
- onContinue?: () => void;
62
- onSkip?: () => void;
63
- mode?: "single_select" | "multi_select" | "rank_priorities";
64
- }
65
- export declare function AssistantAskOverlay({ questionNumber, totalQuestions, question, options, selectedOptions, canContinue, continueLabel, onSelectOption, onContinue, onSkip, mode, }: AssistantAskOverlayProps): import("react/jsx-runtime").JSX.Element;
66
- export interface AssistantPendingFileChipProps {
67
- label: ReactNode;
68
- onRemove?: () => void;
69
- className?: string;
70
- }
71
- export interface AssistantComposerProps {
72
- floating?: ReactNode;
73
- status?: ReactNode;
74
- pendingFiles?: ReactNode;
75
- children: ReactNode;
76
- tone?: AssistantSurfaceTone;
77
- className?: string;
78
- }
79
- export declare function AssistantComposer({ floating, status, pendingFiles, children, tone, className, }: AssistantComposerProps): import("react/jsx-runtime").JSX.Element;
80
- export declare function AssistantPendingFileChip({ label, onRemove, className, }: AssistantPendingFileChipProps): import("react/jsx-runtime").JSX.Element;
81
- export interface AssistantStatusPillProps {
82
- label: ReactNode;
83
- subtle?: boolean;
84
- className?: string;
85
- }
86
- export declare function AssistantStatusPill({ label, subtle, className, }: AssistantStatusPillProps): import("react/jsx-runtime").JSX.Element;
@@ -1,48 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
- function cx(...values) {
4
- return values.filter(Boolean).join(" ");
5
- }
6
- export function AssistantThemeScope({ className, children, theme = "auto", ...props }) {
7
- return (_jsx("div", { "data-lemma-theme": theme, className: cx("lemma-assistant-theme", className), ...props, children: children }));
8
- }
9
- export const AssistantMessageViewport = forwardRef(function AssistantMessageViewport({ className, innerClassName, children, ...props }, ref) {
10
- return (_jsx("div", { ref: ref, className: cx("lemma-assistant-viewport", className), ...props, children: _jsx("div", { className: cx("lemma-assistant-viewport-inner", innerClassName), children: children }) }));
11
- });
12
- export function AssistantShellLayout({ sidebar, sidebarVisible = false, main, className, }) {
13
- const hasSidebar = !!sidebar;
14
- return (_jsxs("div", { className: cx("lemma-assistant-shell", hasSidebar && "lemma-assistant-shell--with-sidebar", hasSidebar && sidebarVisible && "lemma-assistant-shell--sidebar-visible", className), children: [sidebar && sidebarVisible ? (_jsx("div", { className: "lemma-assistant-shell-sidebar", children: sidebar })) : null, main] }));
15
- }
16
- export function AssistantHeader({ title, subtitle, badge, controls, tone = "subtle", className, }) {
17
- return (_jsxs("div", { "data-tone": tone, className: cx("lemma-assistant-header", className), children: [_jsxs("div", { className: "lemma-assistant-header-copy", children: [badge ? (_jsx("div", { className: "lemma-assistant-header-badge", children: badge })) : null, _jsxs("div", { className: "lemma-assistant-header-titles", children: [_jsx("h3", { className: "lemma-assistant-header-title", children: title }), subtitle ? (_jsx("p", { className: "lemma-assistant-header-subtitle", children: subtitle })) : null] })] }), controls ? (_jsx("div", { className: "lemma-assistant-header-controls", children: controls })) : null] }));
18
- }
19
- export function AssistantConversationList({ conversations, activeConversationId, onSelectConversation, onNewConversation, renderConversationLabel, title = "Conversations", newLabel = "New", className, }) {
20
- return (_jsxs("aside", { className: cx("lemma-assistant-conversation-list", className), children: [_jsx("div", { className: "lemma-assistant-conversation-list-header", children: _jsxs("div", { className: "lemma-assistant-conversation-list-header-row", children: [_jsxs("div", { className: "lemma-assistant-conversation-list-copy", children: [_jsx("div", { className: "lemma-assistant-conversation-list-title", children: title }), _jsxs("div", { className: "lemma-assistant-conversation-list-meta", children: [conversations.length, " total"] })] }), onNewConversation ? (_jsx("button", { type: "button", onClick: onNewConversation, className: "lemma-assistant-conversation-list-new", children: newLabel })) : null] }) }), _jsx("div", { className: "lemma-assistant-conversation-list-items", children: conversations.map((conversation) => {
21
- const isActive = conversation.id === activeConversationId;
22
- return (_jsxs("button", { type: "button", onClick: () => onSelectConversation(conversation.id), className: cx("lemma-assistant-conversation-list-item", isActive && "lemma-assistant-conversation-list-item-active"), children: [_jsx("div", { className: "lemma-assistant-conversation-list-item-title", children: renderConversationLabel
23
- ? renderConversationLabel({ conversation, isActive })
24
- : (conversation.title || "Untitled conversation") }), _jsx("div", { className: "lemma-assistant-conversation-list-item-status", children: (conversation.status || "waiting").toLowerCase() })] }, conversation.id));
25
- }) })] }));
26
- }
27
- export function AssistantModelPicker({ value, options, disabled, autoLabel = "Auto", getOptionLabel, onChange, className, }) {
28
- const autoValue = "__AUTO__";
29
- return (_jsxs("select", { value: value ?? autoValue, onChange: (event) => onChange(event.target.value === autoValue ? null : event.target.value), disabled: disabled, className: cx("lemma-assistant-model-picker", className), "aria-label": "Conversation model", title: "Conversation model", children: [_jsx("option", { value: autoValue, children: autoLabel }), options.map((option) => (_jsx("option", { value: option, children: getOptionLabel ? getOptionLabel(option) : option }, option)))] }));
30
- }
31
- export function AssistantAskOverlay({ questionNumber, totalQuestions, question, options, selectedOptions, canContinue, continueLabel, onSelectOption, onContinue, onSkip, mode = "single_select", }) {
32
- return (_jsxs("div", { className: "lemma-assistant-ask-overlay", children: [_jsxs("div", { className: "lemma-assistant-ask-overlay-header", children: [_jsxs("div", { className: "lemma-assistant-ask-overlay-copy", children: [_jsxs("div", { className: "lemma-assistant-ask-overlay-kicker", children: ["Question ", questionNumber, " of ", totalQuestions] }), _jsx("p", { className: "lemma-assistant-ask-overlay-question", children: question })] }), onSkip ? (_jsx("button", { type: "button", onClick: onSkip, className: "lemma-assistant-ask-overlay-skip", children: "Skip" })) : null] }), _jsx("div", { className: "lemma-assistant-ask-overlay-options", children: options.map((option, optionIndex) => {
33
- const isSelected = selectedOptions.includes(option);
34
- const rankLabel = mode === "rank_priorities" && isSelected
35
- ? selectedOptions.indexOf(option) + 1
36
- : null;
37
- return (_jsx("button", { type: "button", onClick: () => onSelectOption(option), className: cx("lemma-assistant-ask-overlay-option", isSelected && "lemma-assistant-ask-overlay-option-selected"), children: _jsxs("span", { className: "lemma-assistant-ask-overlay-option-label", children: [rankLabel ? (_jsx("span", { className: "lemma-assistant-ask-overlay-option-rank", children: rankLabel })) : (_jsx("span", { className: cx("lemma-assistant-ask-overlay-option-indicator", isSelected && "lemma-assistant-ask-overlay-option-indicator-selected") })), option] }) }, `${option}-${optionIndex}`));
38
- }) }), onContinue ? (_jsx("div", { className: "lemma-assistant-ask-overlay-actions", children: _jsx("button", { type: "button", onClick: onContinue, disabled: !canContinue, className: cx("lemma-assistant-ask-overlay-continue", canContinue && "lemma-assistant-ask-overlay-continue-enabled"), children: continueLabel }) })) : null] }));
39
- }
40
- export function AssistantComposer({ floating, status, pendingFiles, children, tone = "subtle", className, }) {
41
- return (_jsxs("div", { "data-tone": tone, "data-has-status": status ? "true" : "false", "data-has-pending-files": pendingFiles ? "true" : "false", "data-has-floating": floating ? "true" : "false", className: cx("lemma-assistant-composer", className), children: [floating ? (_jsx("div", { className: "lemma-assistant-composer-floating", children: floating })) : null, status ? (_jsx("div", { className: "lemma-assistant-composer-status-rail", children: _jsx("div", { className: "lemma-assistant-composer-status", children: status }) })) : null, pendingFiles ? (_jsx("div", { className: "lemma-assistant-composer-pending", children: pendingFiles })) : null, _jsx("div", { className: "lemma-assistant-composer-body", children: children })] }));
42
- }
43
- export function AssistantPendingFileChip({ label, onRemove, className, }) {
44
- return (_jsxs("span", { className: cx("lemma-assistant-pending-file-chip", className), children: [_jsx("span", { className: "lemma-assistant-pending-file-chip-label", children: label }), onRemove ? (_jsx("button", { type: "button", onClick: onRemove, className: "lemma-assistant-pending-file-chip-remove", title: "Remove file", children: "\u00D7" })) : null] }));
45
- }
46
- export function AssistantStatusPill({ label, subtle = false, className, }) {
47
- return (_jsxs("div", { className: cx("lemma-assistant-status-pill", subtle && "lemma-assistant-status-pill-subtle", className), children: [_jsxs("span", { className: "lemma-assistant-status-pill-dot", children: [_jsx("span", { className: "lemma-assistant-status-pill-dot-ping" }), _jsx("span", { className: "lemma-assistant-status-pill-dot-core" })] }), _jsx("span", { className: "lemma-assistant-status-pill-label", children: label })] }));
48
- }
@@ -1,10 +0,0 @@
1
- import type { LemmaClient } from "../../client.js";
2
- import { type AssistantConversationScope } from "../useAssistantController.js";
3
- import { type AssistantThemeMode } from "./AssistantChrome.js";
4
- import { type AssistantExperienceViewProps } from "./AssistantExperience.js";
5
- export interface AssistantEmbeddedProps extends Omit<AssistantExperienceViewProps, "controller">, AssistantConversationScope {
6
- client: LemmaClient;
7
- enabled?: boolean;
8
- theme?: AssistantThemeMode;
9
- }
10
- export declare function AssistantEmbedded({ client, podId, assistantName, assistantId, organizationId, enabled, theme, ...props }: AssistantEmbeddedProps): import("react/jsx-runtime").JSX.Element;
@@ -1,15 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useAssistantController } from "../useAssistantController.js";
3
- import { AssistantThemeScope } from "./AssistantChrome.js";
4
- import { AssistantExperienceView } from "./AssistantExperience.js";
5
- export function AssistantEmbedded({ client, podId, assistantName, assistantId, organizationId, enabled = true, theme = "auto", ...props }) {
6
- const controller = useAssistantController({
7
- client,
8
- podId: podId ?? undefined,
9
- assistantName: assistantName ?? undefined,
10
- assistantId: assistantId ?? undefined,
11
- organizationId: organizationId ?? undefined,
12
- enabled,
13
- });
14
- return (_jsx(AssistantThemeScope, { className: "lemma-assistant-embedded", theme: theme, children: _jsx(AssistantExperienceView, { controller: controller, ...props }) }));
15
- }
@@ -1,96 +0,0 @@
1
- import { type ReactNode } from "react";
2
- import type { AssistantRenderableMessage, AssistantToolInvocation } from "../useAssistantController.js";
3
- import type { AssistantControllerView, AssistantConversationRenderArgs, AssistantMessageRenderArgs, AssistantPendingFileRenderArgs, AssistantPresentedFileRenderArgs, AssistantToolRenderArgs, EmptyStateSuggestion } from "./assistant-types.js";
4
- type PlanStatus = "pending" | "in_progress" | "completed";
5
- export interface PlanStepState {
6
- step: string;
7
- status: PlanStatus;
8
- }
9
- export interface PlanSummaryState {
10
- steps: PlanStepState[];
11
- completedCount: number;
12
- inProgressCount: number;
13
- running: boolean;
14
- activeStep?: string;
15
- }
16
- type AskQuestionType = "single_select" | "multi_select" | "rank_priorities";
17
- export interface AskUserInputQuestion {
18
- question: string;
19
- options: string[];
20
- type: AskQuestionType;
21
- }
22
- export interface PendingAskUserInput {
23
- toolCallId: string;
24
- messageIndex: number;
25
- questions: AskUserInputQuestion[];
26
- }
27
- export interface DisplayMessageRow {
28
- id: string;
29
- message: AssistantRenderableMessage;
30
- sourceIndexes: number[];
31
- }
32
- export interface ActiveToolBanner {
33
- summary: string;
34
- activeCount: number;
35
- }
36
- export type AssistantChromeStyle = "elevated" | "subtle" | "flat";
37
- export type AssistantStatusPlacement = "inline" | "composer" | "none";
38
- export type AssistantRadiusScale = "none" | "sm" | "md" | "lg" | "xl";
39
- export interface AssistantExperienceViewProps {
40
- controller: AssistantControllerView;
41
- title?: ReactNode;
42
- subtitle?: ReactNode;
43
- badge?: ReactNode | null;
44
- placeholder?: string;
45
- emptyState?: ReactNode;
46
- emptyStateSuggestions?: EmptyStateSuggestion[];
47
- draft?: string;
48
- onDraftChange?: (value: string) => void;
49
- showConversationList?: boolean;
50
- chromeStyle?: AssistantChromeStyle;
51
- statusPlacement?: AssistantStatusPlacement;
52
- radius?: AssistantRadiusScale;
53
- showModelPicker?: boolean;
54
- showNewConversationButton?: boolean;
55
- onNavigateResource?: (resourceType: string, resourceId: string, meta?: Record<string, unknown>) => void;
56
- renderConversationLabel?: (args: AssistantConversationRenderArgs) => ReactNode;
57
- renderMessageContent?: (args: AssistantMessageRenderArgs) => ReactNode;
58
- renderPresentedFile?: (args: AssistantPresentedFileRenderArgs) => ReactNode;
59
- renderPendingFile?: (args: AssistantPendingFileRenderArgs) => ReactNode;
60
- renderToolInvocation?: (args: AssistantToolRenderArgs) => ReactNode;
61
- }
62
- export declare function dedupToolInvocations(message: AssistantRenderableMessage): AssistantToolInvocation[];
63
- export declare function latestPlanSummary(messages: AssistantRenderableMessage[]): PlanSummaryState | null;
64
- export declare function findPendingAskUserInput(messages: AssistantRenderableMessage[]): PendingAskUserInput | null;
65
- export declare function formatAskUserInputAnswers(questions: AskUserInputQuestion[], answers: string[][]): string;
66
- export declare function extractPresentFilePathsFromInvocation(invocation: AssistantToolInvocation): string[];
67
- export declare function buildDisplayMessageRows(messages: AssistantRenderableMessage[]): DisplayMessageRow[];
68
- export declare function getActiveToolBanner(messages: AssistantRenderableMessage[]): ActiveToolBanner | null;
69
- export declare function PlanSummaryStrip({ plan, onHide }: {
70
- plan: PlanSummaryState;
71
- onHide: () => void;
72
- }): import("react/jsx-runtime").JSX.Element;
73
- export interface ThinkingIndicatorProps {
74
- activeToolSummary?: string;
75
- labels?: string[];
76
- }
77
- export declare function ThinkingIndicator({ activeToolSummary, labels, }?: ThinkingIndicatorProps): import("react/jsx-runtime").JSX.Element | null;
78
- export interface EmptyStateProps {
79
- onSendMessage: (msg: string) => void;
80
- suggestions?: EmptyStateSuggestion[];
81
- }
82
- export declare const DEFAULT_EMPTY_STATE_SUGGESTIONS: EmptyStateSuggestion[];
83
- export declare function EmptyState({ onSendMessage, suggestions, }: EmptyStateProps): import("react/jsx-runtime").JSX.Element;
84
- export declare function MessageGroup({ message, conversationId, onNavigateResource, onWidgetSendPrompt, isStreaming, showAssistantHeader, renderMessageContent, renderPresentedFile, renderToolInvocation, }: {
85
- message: AssistantRenderableMessage;
86
- conversationId?: string | null;
87
- onNavigateResource?: (resourceType: string, resourceId: string, meta?: Record<string, unknown>) => void;
88
- onWidgetSendPrompt: (text: string) => void | Promise<void>;
89
- isStreaming: boolean;
90
- showAssistantHeader: boolean;
91
- renderMessageContent: (args: AssistantMessageRenderArgs) => ReactNode;
92
- renderPresentedFile?: (args: AssistantPresentedFileRenderArgs) => ReactNode;
93
- renderToolInvocation?: (args: AssistantToolRenderArgs) => ReactNode;
94
- }): import("react/jsx-runtime").JSX.Element;
95
- export declare function AssistantExperienceView({ controller, title, subtitle, badge, placeholder, emptyState, emptyStateSuggestions, draft: controlledDraft, onDraftChange, showConversationList, chromeStyle, statusPlacement, radius, showModelPicker, showNewConversationButton, onNavigateResource, renderConversationLabel, renderMessageContent, renderPresentedFile, renderPendingFile, renderToolInvocation, }: AssistantExperienceViewProps): import("react/jsx-runtime").JSX.Element;
96
- export {};