lemma-sdk 0.2.25 → 0.2.28
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 +25 -1
- package/dist/browser/lemma-client.js +176 -2
- 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 +9 -1
- package/dist/openapi_client/index.js +4 -0
- 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/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/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/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/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 +276 -34
- package/dist/react/components/assistant-types.d.ts +1 -0
- package/dist/react/styles.css +600 -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/types.d.ts +2 -1
- package/package.json +1 -1
- /package/dist/openapi_client/models/{FlowStart.js → FlowStart_Input.js} +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FlowStart_Input } from './FlowStart_Input.js';
|
|
2
|
+
import type { WorkflowInstallMode } from './WorkflowInstallMode.js';
|
|
2
3
|
export type WorkflowCreateRequest = {
|
|
3
4
|
/**
|
|
4
5
|
* Optional workflow description.
|
|
@@ -9,15 +10,15 @@ export type WorkflowCreateRequest = {
|
|
|
9
10
|
*/
|
|
10
11
|
icon_url?: (string | null);
|
|
11
12
|
/**
|
|
12
|
-
* Workflow
|
|
13
|
+
* Workflow installation scope for non-manual starts. `GLOBAL` means one pod-level installation, `USER` means each user installs their own.
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
|
+
mode?: WorkflowInstallMode;
|
|
15
16
|
/**
|
|
16
|
-
*
|
|
17
|
+
* Workflow name.
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
|
+
name: string;
|
|
19
20
|
/**
|
|
20
21
|
* Start configuration. If omitted, the workflow can be started manually via `workflow.start`.
|
|
21
22
|
*/
|
|
22
|
-
start?: (
|
|
23
|
+
start?: (FlowStart_Input | null);
|
|
23
24
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AgentNode } from './AgentNode.js';
|
|
2
2
|
import type { DecisionNode } from './DecisionNode.js';
|
|
3
3
|
import type { EndNode } from './EndNode.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { FlowStart_Input } from './FlowStart_Input.js';
|
|
5
5
|
import type { FormNode } from './FormNode.js';
|
|
6
6
|
import type { FunctionNode } from './FunctionNode.js';
|
|
7
7
|
import type { LoopNode } from './LoopNode.js';
|
|
@@ -22,5 +22,5 @@ export type WorkflowGraphUpdateRequest = {
|
|
|
22
22
|
/**
|
|
23
23
|
* Optional replacement start configuration stored with the graph.
|
|
24
24
|
*/
|
|
25
|
-
start?: (
|
|
25
|
+
start?: (FlowStart_Input | null);
|
|
26
26
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
/**
|
|
6
|
+
* Workflow install scope for non-manual starts.
|
|
7
|
+
*/
|
|
8
|
+
export var WorkflowInstallMode;
|
|
9
|
+
(function (WorkflowInstallMode) {
|
|
10
|
+
WorkflowInstallMode["GLOBAL"] = "GLOBAL";
|
|
11
|
+
WorkflowInstallMode["USER"] = "USER";
|
|
12
|
+
})(WorkflowInstallMode || (WorkflowInstallMode = {}));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FlowStart_Input } from './FlowStart_Input.js';
|
|
2
|
+
import type { WorkflowInstallMode } from './WorkflowInstallMode.js';
|
|
2
3
|
export type WorkflowUpdateRequest = {
|
|
3
4
|
/**
|
|
4
5
|
* Updated workflow description.
|
|
@@ -9,11 +10,11 @@ export type WorkflowUpdateRequest = {
|
|
|
9
10
|
*/
|
|
10
11
|
icon_url?: (string | null);
|
|
11
12
|
/**
|
|
12
|
-
* Updated
|
|
13
|
+
* Updated workflow installation scope.
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
|
+
mode?: (WorkflowInstallMode | null);
|
|
15
16
|
/**
|
|
16
17
|
* Updated start trigger configuration.
|
|
17
18
|
*/
|
|
18
|
-
start?: (
|
|
19
|
+
start?: (FlowStart_Input | null);
|
|
19
20
|
};
|
|
@@ -28,7 +28,7 @@ export declare class FilesService {
|
|
|
28
28
|
*/
|
|
29
29
|
static fileUpload(podId: string, formData: DatastoreFileUploadRequest): CancelablePromise<FileResponse>;
|
|
30
30
|
/**
|
|
31
|
-
* Delete File
|
|
31
|
+
* Delete File Or Folder. Deleting a folder will cleanup whole subtreee
|
|
32
32
|
* @param podId
|
|
33
33
|
* @param path
|
|
34
34
|
* @returns DatastoreMessageResponse Successful Response
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { PodJoinRequestApproveRequest } from '../models/PodJoinRequestApproveRequest.js';
|
|
2
|
+
import type { PodJoinRequestCreateResponse } from '../models/PodJoinRequestCreateResponse.js';
|
|
3
|
+
import type { PodJoinRequestListResponse } from '../models/PodJoinRequestListResponse.js';
|
|
4
|
+
import type { PodJoinRequestStatus } from '../models/PodJoinRequestStatus.js';
|
|
5
|
+
import type { CancelablePromise } from '../core/CancelablePromise.js';
|
|
6
|
+
export declare class PodJoinRequestsService {
|
|
7
|
+
/**
|
|
8
|
+
* List Pod Join Requests
|
|
9
|
+
* List join requests for a pod
|
|
10
|
+
* @param podId
|
|
11
|
+
* @param statusFilter
|
|
12
|
+
* @param limit
|
|
13
|
+
* @param pageToken
|
|
14
|
+
* @returns PodJoinRequestListResponse Successful Response
|
|
15
|
+
* @throws ApiError
|
|
16
|
+
*/
|
|
17
|
+
static podJoinRequestList(podId: string, statusFilter?: (PodJoinRequestStatus | null), limit?: number, pageToken?: (string | null)): CancelablePromise<PodJoinRequestListResponse>;
|
|
18
|
+
/**
|
|
19
|
+
* Create Pod Join Request
|
|
20
|
+
* Create a join request for the current user to access this pod
|
|
21
|
+
* @param podId
|
|
22
|
+
* @returns PodJoinRequestCreateResponse Successful Response
|
|
23
|
+
* @throws ApiError
|
|
24
|
+
*/
|
|
25
|
+
static podJoinRequestCreate(podId: string): CancelablePromise<PodJoinRequestCreateResponse>;
|
|
26
|
+
/**
|
|
27
|
+
* Get My Pod Join Request
|
|
28
|
+
* Get the current user's pending join request for this pod
|
|
29
|
+
* @param podId
|
|
30
|
+
* @returns any Successful Response
|
|
31
|
+
* @throws ApiError
|
|
32
|
+
*/
|
|
33
|
+
static podJoinRequestMe(podId: string): CancelablePromise<(PodJoinRequestCreateResponse | null)>;
|
|
34
|
+
/**
|
|
35
|
+
* Approve Pod Join Request
|
|
36
|
+
* Approve a pending pod join request and add user to org/pod
|
|
37
|
+
* @param podId
|
|
38
|
+
* @param joinRequestId
|
|
39
|
+
* @param requestBody
|
|
40
|
+
* @returns PodJoinRequestCreateResponse Successful Response
|
|
41
|
+
* @throws ApiError
|
|
42
|
+
*/
|
|
43
|
+
static podJoinRequestApprove(podId: string, joinRequestId: string, requestBody: PodJoinRequestApproveRequest): CancelablePromise<PodJoinRequestCreateResponse>;
|
|
44
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { OpenAPI } from '../core/OpenAPI.js';
|
|
2
|
+
import { request as __request } from '../core/request.js';
|
|
3
|
+
export class PodJoinRequestsService {
|
|
4
|
+
/**
|
|
5
|
+
* List Pod Join Requests
|
|
6
|
+
* List join requests for a pod
|
|
7
|
+
* @param podId
|
|
8
|
+
* @param statusFilter
|
|
9
|
+
* @param limit
|
|
10
|
+
* @param pageToken
|
|
11
|
+
* @returns PodJoinRequestListResponse Successful Response
|
|
12
|
+
* @throws ApiError
|
|
13
|
+
*/
|
|
14
|
+
static podJoinRequestList(podId, statusFilter, limit = 100, pageToken) {
|
|
15
|
+
return __request(OpenAPI, {
|
|
16
|
+
method: 'GET',
|
|
17
|
+
url: '/pods/{pod_id}/join-requests',
|
|
18
|
+
path: {
|
|
19
|
+
'pod_id': podId,
|
|
20
|
+
},
|
|
21
|
+
query: {
|
|
22
|
+
'status_filter': statusFilter,
|
|
23
|
+
'limit': limit,
|
|
24
|
+
'page_token': pageToken,
|
|
25
|
+
},
|
|
26
|
+
errors: {
|
|
27
|
+
422: `Validation Error`,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Create Pod Join Request
|
|
33
|
+
* Create a join request for the current user to access this pod
|
|
34
|
+
* @param podId
|
|
35
|
+
* @returns PodJoinRequestCreateResponse Successful Response
|
|
36
|
+
* @throws ApiError
|
|
37
|
+
*/
|
|
38
|
+
static podJoinRequestCreate(podId) {
|
|
39
|
+
return __request(OpenAPI, {
|
|
40
|
+
method: 'POST',
|
|
41
|
+
url: '/pods/{pod_id}/join-requests',
|
|
42
|
+
path: {
|
|
43
|
+
'pod_id': podId,
|
|
44
|
+
},
|
|
45
|
+
errors: {
|
|
46
|
+
422: `Validation Error`,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get My Pod Join Request
|
|
52
|
+
* Get the current user's pending join request for this pod
|
|
53
|
+
* @param podId
|
|
54
|
+
* @returns any Successful Response
|
|
55
|
+
* @throws ApiError
|
|
56
|
+
*/
|
|
57
|
+
static podJoinRequestMe(podId) {
|
|
58
|
+
return __request(OpenAPI, {
|
|
59
|
+
method: 'GET',
|
|
60
|
+
url: '/pods/{pod_id}/join-requests/me',
|
|
61
|
+
path: {
|
|
62
|
+
'pod_id': podId,
|
|
63
|
+
},
|
|
64
|
+
errors: {
|
|
65
|
+
422: `Validation Error`,
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Approve Pod Join Request
|
|
71
|
+
* Approve a pending pod join request and add user to org/pod
|
|
72
|
+
* @param podId
|
|
73
|
+
* @param joinRequestId
|
|
74
|
+
* @param requestBody
|
|
75
|
+
* @returns PodJoinRequestCreateResponse Successful Response
|
|
76
|
+
* @throws ApiError
|
|
77
|
+
*/
|
|
78
|
+
static podJoinRequestApprove(podId, joinRequestId, requestBody) {
|
|
79
|
+
return __request(OpenAPI, {
|
|
80
|
+
method: 'POST',
|
|
81
|
+
url: '/pods/{pod_id}/join-requests/{join_request_id}/approve',
|
|
82
|
+
path: {
|
|
83
|
+
'pod_id': podId,
|
|
84
|
+
'join_request_id': joinRequestId,
|
|
85
|
+
},
|
|
86
|
+
body: requestBody,
|
|
87
|
+
mediaType: 'application/json',
|
|
88
|
+
errors: {
|
|
89
|
+
422: `Validation Error`,
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -87,7 +87,7 @@ export declare class WorkflowsService {
|
|
|
87
87
|
static workflowGet(podId: string, workflowName: string): CancelablePromise<FlowResponse>;
|
|
88
88
|
/**
|
|
89
89
|
* Update Workflow Metadata
|
|
90
|
-
* Update workflow-level metadata such as description/install
|
|
90
|
+
* Update workflow-level metadata such as description/install mode. Workflow names are immutable after creation. Use `workflow.graph.update` for nodes and edges.
|
|
91
91
|
* @param podId
|
|
92
92
|
* @param workflowName
|
|
93
93
|
* @param requestBody
|
|
@@ -185,7 +185,7 @@ export class WorkflowsService {
|
|
|
185
185
|
}
|
|
186
186
|
/**
|
|
187
187
|
* Update Workflow Metadata
|
|
188
|
-
* Update workflow-level metadata such as description/install
|
|
188
|
+
* Update workflow-level metadata such as description/install mode. Workflow names are immutable after creation. Use `workflow.graph.update` for nodes and edges.
|
|
189
189
|
* @param podId
|
|
190
190
|
* @param workflowName
|
|
191
191
|
* @param requestBody
|
|
@@ -7,16 +7,19 @@ export interface AuthGuardProps {
|
|
|
7
7
|
loadingFallback?: ReactNode;
|
|
8
8
|
/** Optional custom unauthenticated element. Defaults to a centered sign-in page. */
|
|
9
9
|
unauthenticatedFallback?: ReactNode;
|
|
10
|
+
/** Optional custom element shown when user is authenticated but lacks pod membership. */
|
|
11
|
+
accessRequestFallback?: ReactNode;
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
14
|
* AuthGuard wraps your application and handles auth state:
|
|
13
15
|
* - Loading: shows loadingFallback (blank by default)
|
|
14
16
|
* - Unauthenticated: shows sign-in page (or custom unauthenticatedFallback)
|
|
15
|
-
* - Authenticated: renders children
|
|
17
|
+
* - Authenticated and member: renders children
|
|
18
|
+
* - Authenticated but not pod member: shows request-access page
|
|
16
19
|
*
|
|
17
20
|
* Usage:
|
|
18
21
|
* <AuthGuard client={getClient()}>
|
|
19
22
|
* <App />
|
|
20
23
|
* </AuthGuard>
|
|
21
24
|
*/
|
|
22
|
-
export declare function AuthGuard({ client, children, loadingFallback, unauthenticatedFallback, }: AuthGuardProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export declare function AuthGuard({ client, children, loadingFallback, unauthenticatedFallback, accessRequestFallback, }: AuthGuardProps): import("react/jsx-runtime").JSX.Element;
|
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 {};
|