lemma-sdk 0.2.24 → 0.2.27
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 +175 -506
- package/dist/browser/lemma-client.js +207 -12
- package/dist/client.d.ts +2 -0
- package/dist/client.js +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/namespaces/pod-join-requests.d.ts +16 -0
- package/dist/namespaces/pod-join-requests.js +24 -0
- package/dist/namespaces/pod-members.d.ts +1 -0
- package/dist/namespaces/pod-members.js +3 -0
- package/dist/openapi_client/index.d.ts +10 -3
- package/dist/openapi_client/index.js +4 -2
- package/dist/openapi_client/models/ColumnSchema.d.ts +4 -0
- package/dist/openapi_client/models/CreateTableRequest.d.ts +1 -1
- package/dist/openapi_client/models/DataStoreFlowStart.d.ts +3 -6
- package/dist/openapi_client/models/DatastoreOperation.d.ts +5 -0
- package/dist/openapi_client/models/DatastoreOperation.js +10 -0
- package/dist/openapi_client/models/DatastoreQueryRequest.d.ts +1 -1
- package/dist/openapi_client/models/FlowInstallEntity.d.ts +2 -2
- package/dist/openapi_client/models/FlowResponse.d.ts +4 -3
- package/dist/openapi_client/models/{FlowStart.d.ts → FlowStart_Input.d.ts} +1 -1
- package/dist/openapi_client/models/FlowStart_Output.d.ts +14 -0
- package/dist/openapi_client/models/FlowStart_Output.js +1 -0
- package/dist/openapi_client/models/PodCreateRequest.d.ts +0 -4
- package/dist/openapi_client/models/PodJoinRequestApproveRequest.d.ts +6 -0
- package/dist/openapi_client/models/PodJoinRequestApproveRequest.js +1 -0
- package/dist/openapi_client/models/PodJoinRequestCreateResponse.d.ts +17 -0
- package/dist/openapi_client/models/PodJoinRequestCreateResponse.js +1 -0
- package/dist/openapi_client/models/PodJoinRequestListResponse.d.ts +7 -0
- package/dist/openapi_client/models/PodJoinRequestListResponse.js +1 -0
- package/dist/openapi_client/models/PodJoinRequestStatus.d.ts +5 -0
- package/dist/openapi_client/models/PodJoinRequestStatus.js +10 -0
- package/dist/openapi_client/models/PodMemberDetailResponse.d.ts +14 -0
- package/dist/openapi_client/models/PodMemberDetailResponse.js +1 -0
- package/dist/openapi_client/models/PodMemberResponse.d.ts +3 -3
- package/dist/openapi_client/models/PodResponse.d.ts +0 -5
- package/dist/openapi_client/models/PodUpdateRequest.d.ts +0 -4
- package/dist/openapi_client/models/WorkflowCreateRequest.d.ts +7 -6
- package/dist/openapi_client/models/WorkflowGraphUpdateRequest.d.ts +2 -2
- package/dist/openapi_client/models/WorkflowInstallMode.d.ts +7 -0
- package/dist/openapi_client/models/WorkflowInstallMode.js +12 -0
- package/dist/openapi_client/models/WorkflowUpdateRequest.d.ts +5 -4
- package/dist/openapi_client/services/FilesService.d.ts +1 -1
- package/dist/openapi_client/services/FilesService.js +1 -1
- package/dist/openapi_client/services/PodJoinRequestsService.d.ts +44 -0
- package/dist/openapi_client/services/PodJoinRequestsService.js +93 -0
- package/dist/openapi_client/services/PodMembersService.d.ts +14 -4
- package/dist/openapi_client/services/PodMembersService.js +29 -8
- package/dist/openapi_client/services/RecordsService.d.ts +2 -2
- package/dist/openapi_client/services/RecordsService.js +2 -2
- package/dist/openapi_client/services/WorkflowsService.d.ts +1 -1
- package/dist/openapi_client/services/WorkflowsService.js +1 -1
- package/dist/react/AuthGuard.d.ts +5 -2
- package/dist/react/AuthGuard.js +126 -3
- package/dist/react/components/AssistantChrome.js +1 -1
- package/dist/react/components/AssistantExperience.d.ts +7 -2
- package/dist/react/components/AssistantExperience.js +272 -32
- package/dist/react/components/assistant-types.d.ts +1 -0
- package/dist/react/index.d.ts +0 -2
- package/dist/react/index.js +0 -1
- package/dist/react/styles.css +594 -224
- package/dist/react/useAssistantController.js +2 -1
- package/dist/react/useAssistantRuntime.d.ts +2 -1
- package/dist/react/useAssistantRuntime.js +7 -3
- package/dist/react/useTaskSession.js +145 -73
- package/dist/task-events.d.ts +2 -1
- package/dist/task-events.js +38 -1
- package/dist/types.d.ts +2 -1
- package/package.json +1 -1
- package/dist/openapi_client/models/PodStatus.d.ts +0 -4
- package/dist/openapi_client/models/PodStatus.js +0 -9
- package/dist/openapi_client/models/PodType.d.ts +0 -6
- package/dist/openapi_client/models/PodType.js +0 -11
- package/dist/react/useAgentRun.d.ts +0 -17
- package/dist/react/useAgentRun.js +0 -66
- /package/dist/openapi_client/models/{FlowStart.js → FlowStart_Input.js} +0 -0
package/dist/react/AuthGuard.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useState } from "react";
|
|
3
|
+
import { ApiError } from "../http.js";
|
|
2
4
|
import { useAuth } from "./useAuth.js";
|
|
3
5
|
function DefaultSignInPage({ onSignIn }) {
|
|
4
6
|
return (_jsx("div", { style: {
|
|
@@ -36,20 +38,135 @@ function DefaultSignInPage({ onSignIn }) {
|
|
|
36
38
|
cursor: "pointer",
|
|
37
39
|
}, children: "Sign In" })] }) }));
|
|
38
40
|
}
|
|
41
|
+
function DefaultRequestAccessPage({ isPending, isSubmitting, error, onRequestAccess, }) {
|
|
42
|
+
const message = isPending
|
|
43
|
+
? "Access request sent. An admin can approve it from the pod settings."
|
|
44
|
+
: "You are signed in, but you are not a member of this pod yet.";
|
|
45
|
+
return (_jsx("div", { style: {
|
|
46
|
+
display: "flex",
|
|
47
|
+
flexDirection: "column",
|
|
48
|
+
alignItems: "center",
|
|
49
|
+
justifyContent: "center",
|
|
50
|
+
minHeight: "100vh",
|
|
51
|
+
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
52
|
+
backgroundColor: "#f9fafb",
|
|
53
|
+
gap: "16px",
|
|
54
|
+
}, children: _jsxs("div", { style: {
|
|
55
|
+
backgroundColor: "#fff",
|
|
56
|
+
borderRadius: "12px",
|
|
57
|
+
boxShadow: "0 1px 4px rgba(0,0,0,0.1)",
|
|
58
|
+
padding: "40px 48px",
|
|
59
|
+
textAlign: "center",
|
|
60
|
+
maxWidth: "420px",
|
|
61
|
+
width: "100%",
|
|
62
|
+
}, children: [_jsx("h1", { style: { margin: "0 0 8px", fontSize: "20px", fontWeight: 600, color: "#111827" }, children: "Request pod access" }), _jsx("p", { style: { margin: "0 0 24px", fontSize: "14px", color: "#6b7280" }, children: message }), _jsx("button", { onClick: onRequestAccess, disabled: isSubmitting || isPending, style: {
|
|
63
|
+
width: "100%",
|
|
64
|
+
padding: "10px 16px",
|
|
65
|
+
backgroundColor: isSubmitting || isPending ? "#9ca3af" : "#111827",
|
|
66
|
+
color: "#fff",
|
|
67
|
+
border: "none",
|
|
68
|
+
borderRadius: "8px",
|
|
69
|
+
fontSize: "14px",
|
|
70
|
+
fontWeight: 500,
|
|
71
|
+
cursor: isSubmitting || isPending ? "not-allowed" : "pointer",
|
|
72
|
+
}, children: isSubmitting ? "Submitting..." : isPending ? "Request Sent" : "Request Access" }), error ? (_jsx("p", { style: { margin: "12px 0 0", fontSize: "13px", color: "#b91c1c" }, children: error })) : null] }) }));
|
|
73
|
+
}
|
|
39
74
|
/**
|
|
40
75
|
* AuthGuard wraps your application and handles auth state:
|
|
41
76
|
* - Loading: shows loadingFallback (blank by default)
|
|
42
77
|
* - Unauthenticated: shows sign-in page (or custom unauthenticatedFallback)
|
|
43
|
-
* - Authenticated: renders children
|
|
78
|
+
* - Authenticated and member: renders children
|
|
79
|
+
* - Authenticated but not pod member: shows request-access page
|
|
44
80
|
*
|
|
45
81
|
* Usage:
|
|
46
82
|
* <AuthGuard client={getClient()}>
|
|
47
83
|
* <App />
|
|
48
84
|
* </AuthGuard>
|
|
49
85
|
*/
|
|
50
|
-
export function AuthGuard({ client, children, loadingFallback = null, unauthenticatedFallback, }) {
|
|
86
|
+
export function AuthGuard({ client, children, loadingFallback = null, unauthenticatedFallback, accessRequestFallback, }) {
|
|
51
87
|
const { isLoading, isAuthenticated, redirectToAuth } = useAuth(client);
|
|
52
|
-
|
|
88
|
+
const [membershipState, setMembershipState] = useState("idle");
|
|
89
|
+
const [membershipError, setMembershipError] = useState(null);
|
|
90
|
+
const [isSubmittingJoinRequest, setIsSubmittingJoinRequest] = useState(false);
|
|
91
|
+
const [joinRequest, setJoinRequest] = useState(null);
|
|
92
|
+
const checkMembership = useCallback(async () => {
|
|
93
|
+
if (!isAuthenticated || !client.podId) {
|
|
94
|
+
setMembershipState("member");
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
setMembershipState("checking");
|
|
98
|
+
setMembershipError(null);
|
|
99
|
+
try {
|
|
100
|
+
const currentUser = await client.users.current();
|
|
101
|
+
await client.podMembers.get(client.podId, currentUser.id);
|
|
102
|
+
setMembershipState("member");
|
|
103
|
+
setJoinRequest(null);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
const apiError = error instanceof ApiError ? error : null;
|
|
108
|
+
const isMissingMembership = apiError?.statusCode === 404 || apiError?.statusCode === 403;
|
|
109
|
+
if (!isMissingMembership) {
|
|
110
|
+
throw error;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
try {
|
|
114
|
+
const existingRequest = await client.podJoinRequests.me(client.podId);
|
|
115
|
+
setJoinRequest(existingRequest);
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
// non-fatal: request could still be created by the user manually
|
|
119
|
+
}
|
|
120
|
+
setMembershipState("missing");
|
|
121
|
+
}, [client, isAuthenticated]);
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
let cancelled = false;
|
|
124
|
+
const run = async () => {
|
|
125
|
+
if (!isAuthenticated) {
|
|
126
|
+
setMembershipState("idle");
|
|
127
|
+
setJoinRequest(null);
|
|
128
|
+
setMembershipError(null);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
await checkMembership();
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
if (cancelled)
|
|
136
|
+
return;
|
|
137
|
+
const message = error instanceof Error
|
|
138
|
+
? error.message
|
|
139
|
+
: "Failed to verify pod membership. Please try again.";
|
|
140
|
+
setMembershipError(message);
|
|
141
|
+
setMembershipState("missing");
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
void run();
|
|
145
|
+
return () => {
|
|
146
|
+
cancelled = true;
|
|
147
|
+
};
|
|
148
|
+
}, [checkMembership, isAuthenticated]);
|
|
149
|
+
const handleRequestAccess = useCallback(async () => {
|
|
150
|
+
if (!client.podId || isSubmittingJoinRequest || joinRequest?.status === "PENDING") {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
setIsSubmittingJoinRequest(true);
|
|
154
|
+
setMembershipError(null);
|
|
155
|
+
try {
|
|
156
|
+
const request = await client.podJoinRequests.create(client.podId);
|
|
157
|
+
setJoinRequest(request);
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
const message = error instanceof Error
|
|
161
|
+
? error.message
|
|
162
|
+
: "Failed to create access request. Please try again.";
|
|
163
|
+
setMembershipError(message);
|
|
164
|
+
}
|
|
165
|
+
finally {
|
|
166
|
+
setIsSubmittingJoinRequest(false);
|
|
167
|
+
}
|
|
168
|
+
}, [client, isSubmittingJoinRequest, joinRequest]);
|
|
169
|
+
if (isLoading || (isAuthenticated && membershipState === "checking")) {
|
|
53
170
|
return _jsx(_Fragment, { children: loadingFallback });
|
|
54
171
|
}
|
|
55
172
|
if (!isAuthenticated) {
|
|
@@ -58,5 +175,11 @@ export function AuthGuard({ client, children, loadingFallback = null, unauthenti
|
|
|
58
175
|
}
|
|
59
176
|
return _jsx(DefaultSignInPage, { onSignIn: redirectToAuth });
|
|
60
177
|
}
|
|
178
|
+
if (membershipState === "missing") {
|
|
179
|
+
if (accessRequestFallback !== undefined) {
|
|
180
|
+
return _jsx(_Fragment, { children: accessRequestFallback });
|
|
181
|
+
}
|
|
182
|
+
return (_jsx(DefaultRequestAccessPage, { isPending: joinRequest?.status === "PENDING", isSubmitting: isSubmittingJoinRequest, error: membershipError, onRequestAccess: handleRequestAccess }));
|
|
183
|
+
}
|
|
61
184
|
return _jsx(_Fragment, { children: children });
|
|
62
185
|
}
|
|
@@ -37,7 +37,7 @@ export function AssistantAskOverlay({ questionNumber, totalQuestions, question,
|
|
|
37
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
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
39
|
}
|
|
40
|
-
export function AssistantComposer({ floating, status, pendingFiles, children, tone = "
|
|
40
|
+
export function AssistantComposer({ floating, status, pendingFiles, children, tone = "subtle", className, }) {
|
|
41
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
42
|
}
|
|
43
43
|
export function AssistantPendingFileChip({ label, onRemove, className, }) {
|
|
@@ -40,6 +40,7 @@ export interface AssistantExperienceViewProps {
|
|
|
40
40
|
controller: AssistantControllerView;
|
|
41
41
|
title?: ReactNode;
|
|
42
42
|
subtitle?: ReactNode;
|
|
43
|
+
badge?: ReactNode | null;
|
|
43
44
|
placeholder?: string;
|
|
44
45
|
emptyState?: ReactNode;
|
|
45
46
|
emptyStateSuggestions?: EmptyStateSuggestion[];
|
|
@@ -69,7 +70,11 @@ export declare function PlanSummaryStrip({ plan, onHide }: {
|
|
|
69
70
|
plan: PlanSummaryState;
|
|
70
71
|
onHide: () => void;
|
|
71
72
|
}): import("react/jsx-runtime").JSX.Element;
|
|
72
|
-
export
|
|
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;
|
|
73
78
|
export interface EmptyStateProps {
|
|
74
79
|
onSendMessage: (msg: string) => void;
|
|
75
80
|
suggestions?: EmptyStateSuggestion[];
|
|
@@ -87,5 +92,5 @@ export declare function MessageGroup({ message, conversationId, onNavigateResour
|
|
|
87
92
|
renderPresentedFile?: (args: AssistantPresentedFileRenderArgs) => ReactNode;
|
|
88
93
|
renderToolInvocation?: (args: AssistantToolRenderArgs) => ReactNode;
|
|
89
94
|
}): import("react/jsx-runtime").JSX.Element;
|
|
90
|
-
export declare function AssistantExperienceView({ controller, title, subtitle, 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;
|
|
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;
|
|
91
96
|
export {};
|