lemma-sdk 0.2.43 → 0.2.45
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 +2 -5
- package/dist/assistant-events.d.ts +2 -0
- package/dist/assistant-events.js +50 -3
- package/dist/browser/lemma-client.js +1333 -435
- package/dist/client.d.ts +8 -0
- package/dist/client.js +13 -1
- package/dist/config.d.ts +2 -2
- package/dist/config.js +2 -2
- package/dist/hey_client/client/client.gen.d.ts +2 -0
- package/dist/hey_client/client/client.gen.js +216 -0
- package/dist/hey_client/client/index.d.ts +10 -0
- package/dist/hey_client/client/index.js +6 -0
- package/dist/hey_client/client/types.gen.d.ts +120 -0
- package/dist/hey_client/client/types.gen.js +2 -0
- package/dist/hey_client/client/utils.gen.d.ts +37 -0
- package/dist/hey_client/client/utils.gen.js +228 -0
- package/dist/hey_client/client.gen.d.ts +12 -0
- package/dist/hey_client/client.gen.js +3 -0
- package/dist/hey_client/core/auth.gen.d.ts +25 -0
- package/dist/hey_client/core/auth.gen.js +14 -0
- package/dist/hey_client/core/bodySerializer.gen.d.ts +25 -0
- package/dist/hey_client/core/bodySerializer.gen.js +57 -0
- package/dist/hey_client/core/params.gen.d.ts +43 -0
- package/dist/hey_client/core/params.gen.js +100 -0
- package/dist/hey_client/core/pathSerializer.gen.d.ts +33 -0
- package/dist/hey_client/core/pathSerializer.gen.js +106 -0
- package/dist/hey_client/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/hey_client/core/queryKeySerializer.gen.js +92 -0
- package/dist/hey_client/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/hey_client/core/serverSentEvents.gen.js +132 -0
- package/dist/hey_client/core/types.gen.d.ts +83 -0
- package/dist/hey_client/core/types.gen.js +2 -0
- package/dist/hey_client/core/utils.gen.d.ts +19 -0
- package/dist/hey_client/core/utils.gen.js +87 -0
- package/dist/hey_client/index.d.ts +2 -0
- package/dist/hey_client/index.js +2 -0
- package/dist/hey_client/sdk.gen.d.ts +1005 -0
- package/dist/hey_client/sdk.gen.js +1438 -0
- package/dist/hey_client/types.gen.d.ts +13004 -0
- package/dist/hey_client/types.gen.js +2 -0
- package/dist/index.d.ts +4 -0
- package/dist/namespaces/agent-runtime.d.ts +28 -0
- package/dist/namespaces/agent-runtime.js +34 -0
- package/dist/namespaces/agents.d.ts +8 -3
- package/dist/namespaces/agents.js +4 -0
- package/dist/namespaces/conversations.d.ts +35 -7
- package/dist/namespaces/conversations.js +103 -22
- package/dist/namespaces/desks.d.ts +3 -3
- package/dist/namespaces/files.d.ts +17 -28
- package/dist/namespaces/files.js +10 -11
- package/dist/namespaces/functions.d.ts +8 -3
- package/dist/namespaces/functions.js +4 -0
- package/dist/namespaces/integrations.d.ts +54 -12
- package/dist/namespaces/integrations.js +52 -16
- package/dist/namespaces/pod-members.d.ts +1 -0
- package/dist/namespaces/pod-members.js +4 -1
- package/dist/namespaces/pod-permissions.d.ts +14 -0
- package/dist/namespaces/pod-permissions.js +18 -0
- package/dist/namespaces/pod-roles.d.ts +16 -0
- package/dist/namespaces/pod-roles.js +25 -0
- package/dist/namespaces/pod-surfaces.d.ts +8 -3
- package/dist/namespaces/pod-surfaces.js +15 -6
- package/dist/namespaces/pods.d.ts +2 -3
- package/dist/namespaces/pods.js +1 -6
- package/dist/namespaces/records.d.ts +7 -7
- package/dist/namespaces/resource-access.d.ts +11 -0
- package/dist/namespaces/resource-access.js +18 -0
- package/dist/namespaces/schedules.d.ts +4 -3
- package/dist/namespaces/schedules.js +1 -1
- package/dist/namespaces/tables.d.ts +6 -6
- package/dist/namespaces/workflows.d.ts +16 -12
- package/dist/namespaces/workflows.js +9 -18
- package/dist/openapi_client/index.d.ts +90 -61
- package/dist/openapi_client/index.js +17 -12
- package/dist/openapi_client/models/AccountCreateSchema.d.ts +18 -0
- package/dist/openapi_client/models/AccountResponseSchema.d.ts +3 -0
- package/dist/openapi_client/models/AgentActionResponse.d.ts +20 -0
- package/dist/openapi_client/models/AgentDetailResponse.d.ts +22 -0
- package/dist/openapi_client/models/AgentHarnessInfo.d.ts +11 -0
- package/dist/openapi_client/models/AgentHarnessListResponse.d.ts +4 -0
- package/dist/openapi_client/models/AgentListResponse.d.ts +2 -2
- package/dist/openapi_client/models/AgentNode.d.ts +1 -1
- package/dist/openapi_client/models/AgentNodeConfig.d.ts +1 -1
- package/dist/openapi_client/models/AgentPermissionsReplaceRequest.d.ts +4 -0
- package/dist/openapi_client/models/AgentPermissionsResponse.d.ts +6 -0
- package/dist/openapi_client/models/AgentResourcePermissionRequest.d.ts +6 -0
- package/dist/openapi_client/models/AgentResourcePermissionResponse.d.ts +6 -0
- package/dist/openapi_client/models/AgentRunApprovalDecision.d.ts +8 -0
- package/dist/openapi_client/models/AgentRunApprovalDecision.js +13 -0
- package/dist/openapi_client/models/AgentRuntimeConfig.d.ts +7 -0
- package/dist/openapi_client/models/AgentRuntimeProfileListResponse.d.ts +6 -0
- package/dist/openapi_client/models/AgentRuntimeProfileResponse.d.ts +28 -0
- package/dist/openapi_client/models/AgentSurfaceResponse.d.ts +8 -12
- package/dist/openapi_client/models/AgentSurfaceStatus.d.ts +3 -1
- package/dist/openapi_client/models/AgentSurfaceStatus.js +2 -0
- package/dist/openapi_client/models/ApplicationDetailResponseSchema.d.ts +3 -3
- package/dist/openapi_client/models/ApplicationResponseSchema.d.ts +3 -3
- package/dist/openapi_client/models/ApplicationSkillResponse.d.ts +6 -0
- package/dist/openapi_client/models/AuthConfigCreateSchema.d.ts +7 -0
- package/dist/openapi_client/models/AuthConfigListResponseSchema.d.ts +6 -0
- package/dist/openapi_client/models/AuthConfigResponseSchema.d.ts +13 -0
- package/dist/openapi_client/models/AuthScheme.d.ts +5 -0
- package/dist/openapi_client/models/AuthScheme.js +10 -0
- package/dist/openapi_client/models/ComposioProviderCapabilityResponseSchema.d.ts +9 -0
- package/dist/openapi_client/models/ConnectRequestInitiateSchema.d.ts +5 -1
- package/dist/openapi_client/models/ConnectRequestResponseSchema.d.ts +2 -0
- package/dist/openapi_client/models/ConnectedAccountSummary.d.ts +7 -0
- package/dist/openapi_client/models/ConversationResponse.d.ts +2 -2
- package/dist/openapi_client/models/ConvertedArtifactResponse.d.ts +1 -0
- package/dist/openapi_client/models/ConvertedFileResponse.d.ts +4 -0
- package/dist/openapi_client/models/ConvertedPageResponse.d.ts +8 -0
- package/dist/openapi_client/models/CreateAgentRequest.d.ts +4 -12
- package/dist/openapi_client/models/CreateAnthropicCompatibleRuntimeProfileRequest.d.ts +11 -0
- package/dist/openapi_client/models/CreateConversationRequest.d.ts +2 -2
- package/dist/openapi_client/models/CreateDeskRequest.d.ts +1 -1
- package/dist/openapi_client/models/CreateFolderRequest.d.ts +1 -1
- package/dist/openapi_client/models/CreateFunctionRequest.d.ts +2 -7
- package/dist/openapi_client/models/CreateOpenAICompatibleRuntimeProfileRequest.d.ts +11 -0
- package/dist/openapi_client/models/CreateScheduleRequest.d.ts +17 -1
- package/dist/openapi_client/models/CreateSurfaceRequest.d.ts +6 -15
- package/dist/openapi_client/models/CreateTableRequest.d.ts +1 -1
- package/dist/openapi_client/models/CreateUserDaemonRuntimeProfileRequest.d.ts +11 -0
- package/dist/openapi_client/models/DataStoreFlowStartInput.d.ts +1 -1
- package/dist/openapi_client/models/DataStoreFlowStartOutput.d.ts +1 -1
- package/dist/openapi_client/models/DatastoreCountResponse.d.ts +6 -0
- package/dist/openapi_client/models/DatastoreFileUploadRequest.d.ts +1 -1
- package/dist/openapi_client/models/DecisionNode.d.ts +2 -1
- package/dist/openapi_client/models/DecisionRule.d.ts +3 -0
- package/dist/openapi_client/models/DeskBundleUploadResponse.d.ts +2 -2
- package/dist/openapi_client/models/{DeskResponse.d.ts → DeskDetailResponse.d.ts} +2 -2
- package/dist/openapi_client/models/DeskListResponse.d.ts +2 -2
- package/dist/openapi_client/models/EndNode.d.ts +1 -1
- package/dist/openapi_client/models/EventFlowStartInput.d.ts +0 -8
- package/dist/openapi_client/models/EventFlowStartOutput.d.ts +0 -8
- package/dist/openapi_client/models/ExpressionInputBinding.d.ts +6 -2
- package/dist/openapi_client/models/{FileResponse.d.ts → FileDetailResponse.d.ts} +2 -2
- package/dist/openapi_client/models/FileListResponse.d.ts +3 -2
- package/dist/openapi_client/models/FileSearchResponse.d.ts +2 -2
- package/dist/openapi_client/models/{FlowResponse.d.ts → FlowDetailResponse.d.ts} +2 -2
- package/dist/openapi_client/models/FlowRunStatus.d.ts +4 -1
- package/dist/openapi_client/models/FlowRunStatus.js +4 -1
- package/dist/openapi_client/models/FormNode.d.ts +2 -1
- package/dist/openapi_client/models/FormNodeConfig.d.ts +1 -1
- package/dist/openapi_client/models/{FunctionResponse.d.ts → FunctionActionResponse.d.ts} +3 -10
- package/dist/openapi_client/models/FunctionDetailResponse.d.ts +34 -0
- package/dist/openapi_client/models/FunctionListResponse.d.ts +2 -2
- package/dist/openapi_client/models/FunctionNode.d.ts +2 -1
- package/dist/openapi_client/models/FunctionPermissionsReplaceRequest.d.ts +4 -0
- package/dist/openapi_client/models/FunctionPermissionsResponse.d.ts +6 -0
- package/dist/openapi_client/models/FunctionResourcePermissionRequest.d.ts +6 -0
- package/dist/openapi_client/models/FunctionResourcePermissionResponse.d.ts +6 -0
- package/dist/openapi_client/models/FunctionRunListResponse.d.ts +2 -2
- package/dist/openapi_client/models/FunctionRunSummaryResponse.d.ts +13 -0
- package/dist/openapi_client/models/HarnessKind.d.ts +4 -2
- package/dist/openapi_client/models/HarnessKind.js +4 -2
- package/dist/openapi_client/models/InstalledAppSummary.d.ts +7 -0
- package/dist/openapi_client/models/IntegrationStatusResponse.d.ts +6 -0
- package/dist/openapi_client/models/LemmaProviderCapabilityResponseSchema.d.ts +12 -0
- package/dist/openapi_client/models/LoopNode.d.ts +2 -1
- package/dist/openapi_client/models/LoopNodeConfig.d.ts +3 -3
- package/dist/openapi_client/models/OAuth2DefaultsResponseSchema.d.ts +10 -0
- package/dist/openapi_client/models/OperationSummary.d.ts +4 -0
- package/dist/openapi_client/models/PodConfig.d.ts +6 -0
- package/dist/openapi_client/models/PodCreateRequest.d.ts +2 -0
- package/dist/openapi_client/models/PodEffectivePermissionsResponse.d.ts +4 -0
- package/dist/openapi_client/models/PodMemberAddRequest.d.ts +1 -3
- package/dist/openapi_client/models/PodMemberDetailResponse.d.ts +0 -2
- package/dist/openapi_client/models/PodMemberResponse.d.ts +0 -2
- package/dist/openapi_client/models/PodMemberUpdateRoleRequest.d.ts +1 -3
- package/dist/openapi_client/models/PodPermissionCatalogResponse.d.ts +4 -0
- package/dist/openapi_client/models/PodPermissionResponse.d.ts +7 -0
- package/dist/openapi_client/models/PodResponse.d.ts +2 -0
- package/dist/openapi_client/models/PodRoleCreateRequest.d.ts +2 -0
- package/dist/openapi_client/models/PodRolePermissionsReplaceRequest.d.ts +4 -0
- package/dist/openapi_client/models/PodRolePermissionsResponse.d.ts +6 -0
- package/dist/openapi_client/models/PodRoleResourcePermissionRequest.d.ts +6 -0
- package/dist/openapi_client/models/PodRoleResourcePermissionResponse.d.ts +6 -0
- package/dist/openapi_client/models/PodRoleResponse.d.ts +3 -0
- package/dist/openapi_client/models/PodUpdateRequest.d.ts +2 -0
- package/dist/openapi_client/models/ResolveUserApprovalRequest.d.ts +5 -0
- package/dist/openapi_client/models/ResourceAccessGrantRequest.d.ts +3 -0
- package/dist/openapi_client/models/ResourceAccessGrantResponse.d.ts +12 -0
- package/dist/openapi_client/models/ResourceAccessResponse.d.ts +7 -0
- package/dist/openapi_client/models/ResourceType.d.ts +19 -0
- package/dist/openapi_client/models/ResourceType.js +24 -0
- package/dist/openapi_client/models/ResourceVisibility.d.ts +6 -0
- package/dist/openapi_client/models/ResourceVisibility.js +11 -0
- package/dist/openapi_client/models/RuntimeModelCapability.d.ts +8 -0
- package/dist/openapi_client/models/RuntimeModelCapability.js +13 -0
- package/dist/openapi_client/models/RuntimeModelCatalogEntry.d.ts +9 -0
- package/dist/openapi_client/models/RuntimeModelCatalogEntry.js +1 -0
- package/dist/openapi_client/models/RuntimeProfileKind.d.ts +4 -0
- package/dist/openapi_client/models/RuntimeProfileKind.js +9 -0
- package/dist/openapi_client/models/RuntimeProfileProtocol.d.ts +9 -0
- package/dist/openapi_client/models/RuntimeProfileProtocol.js +14 -0
- package/dist/openapi_client/models/RuntimeProfileScope.d.ts +5 -0
- package/dist/openapi_client/models/RuntimeProfileScope.js +10 -0
- package/dist/openapi_client/models/RuntimeProfileStatus.d.ts +5 -0
- package/dist/openapi_client/models/RuntimeProfileStatus.js +10 -0
- package/dist/openapi_client/models/{ScheduleResponse.d.ts → ScheduleDetailResponse.d.ts} +9 -3
- package/dist/openapi_client/models/ScheduleDetailResponse.js +1 -0
- package/dist/openapi_client/models/ScheduleFireStatus.d.ts +8 -0
- package/dist/openapi_client/models/ScheduleFireStatus.js +13 -0
- package/dist/openapi_client/models/ScheduleListResponse.d.ts +2 -2
- package/dist/openapi_client/models/StepRecordResponse.d.ts +10 -0
- package/dist/openapi_client/models/StepRecordResponse.js +1 -0
- package/dist/openapi_client/models/StepStatus.d.ts +7 -0
- package/dist/openapi_client/models/StepStatus.js +12 -0
- package/dist/openapi_client/models/SurfaceBehaviorConfigInput.d.ts +7 -0
- package/dist/openapi_client/models/SurfaceBehaviorConfigInput.js +1 -0
- package/dist/openapi_client/models/SurfaceChannelRouteInput.d.ts +6 -0
- package/dist/openapi_client/models/SurfaceChannelRouteInput.js +1 -0
- package/dist/openapi_client/models/SurfaceChannelRouteResponse.d.ts +6 -0
- package/dist/openapi_client/models/SurfaceChannelRouteResponse.js +1 -0
- package/dist/openapi_client/models/SurfaceConfigResponse.d.ts +10 -0
- package/dist/openapi_client/models/SurfaceConfigResponse.js +1 -0
- package/dist/openapi_client/models/SurfaceCredentialMode.d.ts +2 -2
- package/dist/openapi_client/models/SurfaceCredentialMode.js +2 -2
- package/dist/openapi_client/models/SurfaceIdentityConfigInput.d.ts +4 -0
- package/dist/openapi_client/models/SurfaceIdentityConfigInput.js +1 -0
- package/dist/openapi_client/models/SurfaceIdentityConfigResponse.d.ts +4 -0
- package/dist/openapi_client/models/SurfaceIdentityConfigResponse.js +1 -0
- package/dist/openapi_client/models/SurfaceSetupMode.d.ts +2 -3
- package/dist/openapi_client/models/SurfaceSetupMode.js +1 -2
- package/dist/openapi_client/models/SurfaceSetupStatusResponse.d.ts +10 -0
- package/dist/openapi_client/models/SurfaceSetupStatusResponse.js +1 -0
- package/dist/openapi_client/models/{TableResponse.d.ts → TableDetailResponse.d.ts} +3 -3
- package/dist/openapi_client/models/TableDetailResponse.js +1 -0
- package/dist/openapi_client/models/TableListResponse.d.ts +4 -2
- package/dist/openapi_client/models/ToggleSurfaceRequest.d.ts +1 -1
- package/dist/openapi_client/models/UpdateAgentRequest.d.ts +4 -12
- package/dist/openapi_client/models/UpdateConversationRequest.d.ts +2 -2
- package/dist/openapi_client/models/UpdateDeskRequest.d.ts +0 -1
- package/dist/openapi_client/models/UpdateFunctionRequest.d.ts +2 -6
- package/dist/openapi_client/models/UpdateScheduleRequest.d.ts +2 -1
- package/dist/openapi_client/models/UpdateSurfaceChannelsRequest.d.ts +4 -0
- package/dist/openapi_client/models/UpdateSurfaceChannelsRequest.js +1 -0
- package/dist/openapi_client/models/UpdateSurfaceRequest.d.ts +5 -15
- package/dist/openapi_client/models/UpdateTableRequest.d.ts +1 -1
- package/dist/openapi_client/models/UpsertSurfaceRequest.d.ts +9 -0
- package/dist/openapi_client/models/UpsertSurfaceRequest.js +1 -0
- package/dist/openapi_client/models/UsageLimitScopeResponse.d.ts +2 -3
- package/dist/openapi_client/models/UsageLimitsResponse.d.ts +1 -4
- package/dist/openapi_client/models/UsageListResponse.d.ts +0 -3
- package/dist/openapi_client/models/UsageRecordResponse.d.ts +10 -14
- package/dist/openapi_client/models/UsageStatsBucketResponse.d.ts +1 -4
- package/dist/openapi_client/models/UsageStatsResponse.d.ts +0 -3
- package/dist/openapi_client/models/UsageSummaryResponse.d.ts +4 -6
- package/dist/openapi_client/models/UserApprovalListResponse.d.ts +4 -0
- package/dist/openapi_client/models/UserApprovalListResponse.js +1 -0
- package/dist/openapi_client/models/UserProfileRequest.d.ts +1 -0
- package/dist/openapi_client/models/UserResponse.d.ts +1 -0
- package/dist/openapi_client/models/VerifyTokenResponse.d.ts +5 -0
- package/dist/openapi_client/models/WaitUntilNode.d.ts +1 -1
- package/dist/openapi_client/models/WorkflowCreateRequest.d.ts +18 -1
- package/dist/openapi_client/models/WorkflowListResponse.d.ts +2 -2
- package/dist/openapi_client/models/WorkflowRunFormSubmitRequest.d.ts +13 -0
- package/dist/openapi_client/models/WorkflowRunFormSubmitRequest.js +1 -0
- package/dist/openapi_client/models/WorkflowRunListResponse.d.ts +2 -2
- package/dist/openapi_client/models/WorkflowRunResponse.d.ts +28 -0
- package/dist/openapi_client/models/WorkflowRunResponse.js +1 -0
- package/dist/openapi_client/models/WorkflowRunSummaryResponse.d.ts +17 -0
- package/dist/openapi_client/models/WorkflowRunSummaryResponse.js +1 -0
- package/dist/openapi_client/models/WorkflowRunWaitAssignment.d.ts +4 -4
- package/dist/openapi_client/models/{WorkflowRunWaitEntity.d.ts → WorkflowRunWaitResponse.d.ts} +4 -8
- package/dist/openapi_client/models/WorkflowRunWaitResponse.js +1 -0
- package/dist/openapi_client/models/WorkflowRunWaitType.d.ts +1 -2
- package/dist/openapi_client/models/WorkflowRunWaitType.js +0 -1
- package/dist/openapi_client/models/WorkflowUpdateRequest.d.ts +2 -1
- package/dist/openapi_client/models/WorkspaceAppAccessRequest.d.ts +3 -0
- package/dist/openapi_client/models/WorkspaceAppAccessRequest.js +1 -0
- package/dist/openapi_client/models/WorkspaceAppAccessResponse.d.ts +5 -0
- package/dist/openapi_client/models/WorkspaceAppAccessResponse.js +1 -0
- package/dist/openapi_client/models/WorkspaceMeApp.d.ts +5 -0
- package/dist/openapi_client/models/WorkspaceMeApp.js +1 -0
- package/dist/openapi_client/models/WorkspaceMeResponse.d.ts +9 -0
- package/dist/openapi_client/models/WorkspaceMeResponse.js +1 -0
- package/dist/openapi_client/models/WorkspaceMeSandbox.d.ts +7 -0
- package/dist/openapi_client/models/WorkspaceMeSandbox.js +1 -0
- package/dist/openapi_client/models/WorkspaceMeSession.d.ts +6 -0
- package/dist/openapi_client/models/WorkspaceMeSession.js +1 -0
- package/dist/openapi_client/models/update.d.ts +1 -1
- package/dist/openapi_client/services/AgentConversationsService.d.ts +28 -3
- package/dist/openapi_client/services/AgentConversationsService.js +54 -3
- package/dist/openapi_client/services/AgentRuntimeService.d.ts +30 -0
- package/dist/openapi_client/services/AgentRuntimeService.js +54 -0
- package/dist/openapi_client/services/AgentSurfacesIngressService.d.ts +15 -20
- package/dist/openapi_client/services/AgentSurfacesIngressService.js +23 -28
- package/dist/openapi_client/services/AgentSurfacesService.d.ts +41 -12
- package/dist/openapi_client/services/AgentSurfacesService.js +90 -24
- package/dist/openapi_client/services/AgentToolsService.d.ts +0 -10
- package/dist/openapi_client/services/AgentToolsService.js +0 -18
- package/dist/openapi_client/services/AgentsService.d.ts +31 -9
- package/dist/openapi_client/services/AgentsService.js +50 -5
- package/dist/openapi_client/services/ApplicationsService.d.ts +22 -8
- package/dist/openapi_client/services/ApplicationsService.js +47 -16
- package/dist/openapi_client/services/DesksService.d.ts +7 -7
- package/dist/openapi_client/services/DesksService.js +3 -3
- package/dist/openapi_client/services/FilesService.d.ts +20 -12
- package/dist/openapi_client/services/FilesService.js +29 -5
- package/dist/openapi_client/services/FunctionsService.d.ts +30 -8
- package/dist/openapi_client/services/FunctionsService.js +49 -4
- package/dist/openapi_client/services/IntegrationsService.d.ts +70 -11
- package/dist/openapi_client/services/IntegrationsService.js +159 -20
- package/dist/openapi_client/services/OrganizationsService.d.ts +8 -0
- package/dist/openapi_client/services/OrganizationsService.js +19 -0
- package/dist/openapi_client/services/PodMembersService.d.ts +0 -10
- package/dist/openapi_client/services/PodMembersService.js +0 -24
- package/dist/openapi_client/services/PodPermissionsService.d.ts +19 -0
- package/dist/openapi_client/services/PodPermissionsService.js +40 -0
- package/dist/openapi_client/services/PodResourceAccessService.d.ts +38 -0
- package/dist/openapi_client/services/PodResourceAccessService.js +81 -0
- package/dist/openapi_client/services/PodRolesService.d.ts +28 -0
- package/dist/openapi_client/services/PodRolesService.js +66 -0
- package/dist/openapi_client/services/RecordsService.d.ts +21 -22
- package/dist/openapi_client/services/RecordsService.js +13 -13
- package/dist/openapi_client/services/SchedulesService.d.ts +9 -8
- package/dist/openapi_client/services/SchedulesService.js +6 -4
- package/dist/openapi_client/services/TablesService.d.ts +13 -14
- package/dist/openapi_client/services/TablesService.js +6 -6
- package/dist/openapi_client/services/UsageService.d.ts +96 -0
- package/dist/openapi_client/services/UsageService.js +210 -0
- package/dist/openapi_client/services/WorkflowsService.d.ts +44 -35
- package/dist/openapi_client/services/WorkflowsService.js +61 -43
- package/dist/openapi_client/services/WorkspaceAppsService.d.ts +12 -0
- package/dist/openapi_client/services/WorkspaceAppsService.js +21 -0
- package/dist/openapi_client/services/WorkspaceService.d.ts +10 -0
- package/dist/openapi_client/services/WorkspaceService.js +15 -0
- package/dist/react/AuthGuard.d.ts +16 -2
- package/dist/react/AuthGuard.js +169 -130
- package/dist/react/index.d.ts +1 -1
- package/dist/react/useAddPodMember.js +1 -1
- package/dist/react/useAssistantController.d.ts +27 -3
- package/dist/react/useAssistantController.js +192 -70
- package/dist/react/useAssistantSession.d.ts +10 -6
- package/dist/react/useAssistantSession.js +146 -4
- package/dist/react/useBulkRecords.d.ts +5 -5
- package/dist/react/useBulkRecords.js +5 -5
- package/dist/react/useConversations.d.ts +1 -7
- package/dist/react/useConversations.js +4 -10
- package/dist/react/useCreateFolder.d.ts +2 -4
- package/dist/react/useCreateFolder.js +2 -3
- package/dist/react/useCreateRecord.d.ts +2 -2
- package/dist/react/useCreateRecord.js +1 -1
- package/dist/react/useDeleteFile.d.ts +1 -4
- package/dist/react/useDeleteFile.js +3 -3
- package/dist/react/useDeleteRecord.d.ts +1 -2
- package/dist/react/useDeleteRecord.js +3 -3
- package/dist/react/useFile.d.ts +2 -4
- package/dist/react/useFile.js +3 -3
- package/dist/react/useFilePreview.d.ts +1 -4
- package/dist/react/useFilePreview.js +4 -5
- package/dist/react/useFileSearch.d.ts +5 -1
- package/dist/react/useFileSearch.js +6 -4
- package/dist/react/useFileTree.d.ts +2 -4
- package/dist/react/useFileTree.js +2 -3
- package/dist/react/useFiles.d.ts +2 -4
- package/dist/react/useFiles.js +3 -5
- package/dist/react/useFlowRunHistory.d.ts +4 -4
- package/dist/react/useFlowRunHistory.js +9 -4
- package/dist/react/useFlowSession.d.ts +5 -3
- package/dist/react/useFlowSession.js +24 -17
- package/dist/react/useFunctionRun.d.ts +2 -2
- package/dist/react/useFunctionRuns.d.ts +5 -5
- package/dist/react/useFunctionSession.d.ts +2 -2
- package/dist/react/useGlobalSearch.js +1 -1
- package/dist/react/useRecord.d.ts +2 -2
- package/dist/react/useRecord.js +1 -1
- package/dist/react/useRecordForm.d.ts +2 -2
- package/dist/react/useRecordForm.js +2 -2
- package/dist/react/useReverseRelatedRecords.js +1 -1
- package/dist/react/useUpdateFile.d.ts +2 -4
- package/dist/react/useUpdateFile.js +2 -3
- package/dist/react/useUpdateRecord.d.ts +2 -2
- package/dist/react/useUpdateRecord.js +1 -1
- package/dist/react/useUploadFile.d.ts +2 -4
- package/dist/react/useUploadFile.js +2 -3
- package/dist/react/useWorkflowResume.d.ts +1 -0
- package/dist/react/useWorkflowResume.js +10 -1
- package/dist/react/useWorkflowRun.d.ts +2 -2
- package/dist/react/useWorkflowRun.js +1 -3
- package/dist/react/useWorkflowRuns.d.ts +5 -5
- package/dist/react/useWorkflowStart.d.ts +2 -2
- package/dist/react/useWorkflowStart.js +11 -26
- package/dist/react/utils.js +2 -0
- package/dist/types.d.ts +47 -10
- package/package.json +8 -3
- package/dist/openapi_client/models/AgentModelName.d.ts +0 -13
- package/dist/openapi_client/models/AgentModelName.js +0 -18
- package/dist/openapi_client/models/AgentResponse.d.ts +0 -29
- package/dist/openapi_client/models/ApplicationAccessConfig.d.ts +0 -18
- package/dist/openapi_client/models/ApplicationMode.d.ts +0 -7
- package/dist/openapi_client/models/ApplicationMode.js +0 -12
- package/dist/openapi_client/models/BillingHistoryResponse.d.ts +0 -8
- package/dist/openapi_client/models/BillingInterval.d.ts +0 -7
- package/dist/openapi_client/models/BillingInterval.js +0 -12
- package/dist/openapi_client/models/BillingInvoiceResponse.d.ts +0 -29
- package/dist/openapi_client/models/BillingInvoiceStatus.d.ts +0 -10
- package/dist/openapi_client/models/BillingInvoiceStatus.js +0 -15
- package/dist/openapi_client/models/BillingScope.d.ts +0 -7
- package/dist/openapi_client/models/BillingScope.js +0 -12
- package/dist/openapi_client/models/CancelSubscriptionResponse.d.ts +0 -10
- package/dist/openapi_client/models/CreateInvoicePaymentUrlRequest.d.ts +0 -7
- package/dist/openapi_client/models/CreateInvoicePaymentUrlResponse.d.ts +0 -8
- package/dist/openapi_client/models/DatastoreMessageResponse.d.ts +0 -6
- package/dist/openapi_client/models/FlowRunEntity.d.ts +0 -36
- package/dist/openapi_client/models/FunctionTableAccessEntry.d.ts +0 -5
- package/dist/openapi_client/models/GmailSurfaceConfig.d.ts +0 -7
- package/dist/openapi_client/models/GmailSurfaceConfigInput.d.ts +0 -4
- package/dist/openapi_client/models/OutlookSurfaceConfig.d.ts +0 -7
- package/dist/openapi_client/models/OutlookSurfaceConfigInput.d.ts +0 -4
- package/dist/openapi_client/models/PlanListResponse.d.ts +0 -8
- package/dist/openapi_client/models/PlanResponse.d.ts +0 -17
- package/dist/openapi_client/models/RecentUsageResponse.d.ts +0 -9
- package/dist/openapi_client/models/RecordResponse.d.ts +0 -9
- package/dist/openapi_client/models/SeatInfoResponse.d.ts +0 -10
- package/dist/openapi_client/models/SlackCredentialsInput.d.ts +0 -5
- package/dist/openapi_client/models/SlackSurfaceConfig.d.ts +0 -10
- package/dist/openapi_client/models/SlackSurfaceConfigInput.d.ts +0 -6
- package/dist/openapi_client/models/StackFrame.d.ts +0 -11
- package/dist/openapi_client/models/StartSubscriptionRequest.d.ts +0 -14
- package/dist/openapi_client/models/StartSubscriptionResponse.d.ts +0 -9
- package/dist/openapi_client/models/StartTeamBillingRequest.d.ts +0 -6
- package/dist/openapi_client/models/StepExecution.d.ts +0 -13
- package/dist/openapi_client/models/SubscriptionResponse.d.ts +0 -22
- package/dist/openapi_client/models/SubscriptionStatus.d.ts +0 -10
- package/dist/openapi_client/models/SubscriptionStatus.js +0 -15
- package/dist/openapi_client/models/SubscriptionStatusResponse.d.ts +0 -10
- package/dist/openapi_client/models/SubscriptionWithPlanResponse.d.ts +0 -22
- package/dist/openapi_client/models/SurfaceRoutingScope.d.ts +0 -4
- package/dist/openapi_client/models/SurfaceRoutingScope.js +0 -9
- package/dist/openapi_client/models/SurfaceWebhookMode.d.ts +0 -4
- package/dist/openapi_client/models/SurfaceWebhookMode.js +0 -9
- package/dist/openapi_client/models/TableAccessEntry.d.ts +0 -8
- package/dist/openapi_client/models/TableAccessMode.d.ts +0 -7
- package/dist/openapi_client/models/TableAccessMode.js +0 -12
- package/dist/openapi_client/models/TeamsCredentialsInput.d.ts +0 -6
- package/dist/openapi_client/models/TeamsSurfaceConfig.d.ts +0 -9
- package/dist/openapi_client/models/TeamsSurfaceConfigInput.d.ts +0 -6
- package/dist/openapi_client/models/TelegramCredentialsInput.d.ts +0 -5
- package/dist/openapi_client/models/TelegramSurfaceConfig.d.ts +0 -6
- package/dist/openapi_client/models/TelegramSurfaceConfigInput.d.ts +0 -6
- package/dist/openapi_client/models/WebSearchAgentRequest.d.ts +0 -9
- package/dist/openapi_client/models/WebSearchAgentResponse.d.ts +0 -25
- package/dist/openapi_client/models/WhatsAppCredentialsInput.d.ts +0 -8
- package/dist/openapi_client/models/WhatsAppSurfaceConfig.d.ts +0 -6
- package/dist/openapi_client/models/WhatsAppSurfaceConfigInput.d.ts +0 -6
- package/dist/openapi_client/services/BillingSubscriptionsService.d.ts +0 -116
- package/dist/openapi_client/services/BillingSubscriptionsService.js +0 -230
- package/dist/openapi_client/services/BillingUsageService.d.ts +0 -138
- package/dist/openapi_client/services/BillingUsageService.js +0 -302
- package/dist/openapi_client/services/BillingWebhooksService.d.ts +0 -12
- package/dist/openapi_client/services/BillingWebhooksService.js +0 -25
- /package/dist/openapi_client/models/{AgentResponse.js → AccountCreateSchema.js} +0 -0
- /package/dist/openapi_client/models/{ApplicationAccessConfig.js → AgentActionResponse.js} +0 -0
- /package/dist/openapi_client/models/{BillingHistoryResponse.js → AgentDetailResponse.js} +0 -0
- /package/dist/openapi_client/models/{BillingInvoiceResponse.js → AgentHarnessInfo.js} +0 -0
- /package/dist/openapi_client/models/{CancelSubscriptionResponse.js → AgentHarnessListResponse.js} +0 -0
- /package/dist/openapi_client/models/{CreateInvoicePaymentUrlRequest.js → AgentPermissionsReplaceRequest.js} +0 -0
- /package/dist/openapi_client/models/{CreateInvoicePaymentUrlResponse.js → AgentPermissionsResponse.js} +0 -0
- /package/dist/openapi_client/models/{DatastoreMessageResponse.js → AgentResourcePermissionRequest.js} +0 -0
- /package/dist/openapi_client/models/{DeskResponse.js → AgentResourcePermissionResponse.js} +0 -0
- /package/dist/openapi_client/models/{FileResponse.js → AgentRuntimeConfig.js} +0 -0
- /package/dist/openapi_client/models/{FlowResponse.js → AgentRuntimeProfileListResponse.js} +0 -0
- /package/dist/openapi_client/models/{FlowRunEntity.js → AgentRuntimeProfileResponse.js} +0 -0
- /package/dist/openapi_client/models/{FunctionResponse.js → ApplicationSkillResponse.js} +0 -0
- /package/dist/openapi_client/models/{FunctionTableAccessEntry.js → AuthConfigCreateSchema.js} +0 -0
- /package/dist/openapi_client/models/{GmailSurfaceConfig.js → AuthConfigListResponseSchema.js} +0 -0
- /package/dist/openapi_client/models/{GmailSurfaceConfigInput.js → AuthConfigResponseSchema.js} +0 -0
- /package/dist/openapi_client/models/{OutlookSurfaceConfig.js → ComposioProviderCapabilityResponseSchema.js} +0 -0
- /package/dist/openapi_client/models/{OutlookSurfaceConfigInput.js → ConnectedAccountSummary.js} +0 -0
- /package/dist/openapi_client/models/{PlanListResponse.js → ConvertedPageResponse.js} +0 -0
- /package/dist/openapi_client/models/{PlanResponse.js → CreateAnthropicCompatibleRuntimeProfileRequest.js} +0 -0
- /package/dist/openapi_client/models/{RecentUsageResponse.js → CreateOpenAICompatibleRuntimeProfileRequest.js} +0 -0
- /package/dist/openapi_client/models/{RecordResponse.js → CreateUserDaemonRuntimeProfileRequest.js} +0 -0
- /package/dist/openapi_client/models/{ScheduleResponse.js → DatastoreCountResponse.js} +0 -0
- /package/dist/openapi_client/models/{SeatInfoResponse.js → DeskDetailResponse.js} +0 -0
- /package/dist/openapi_client/models/{SlackCredentialsInput.js → FileDetailResponse.js} +0 -0
- /package/dist/openapi_client/models/{SlackSurfaceConfig.js → FlowDetailResponse.js} +0 -0
- /package/dist/openapi_client/models/{SlackSurfaceConfigInput.js → FunctionActionResponse.js} +0 -0
- /package/dist/openapi_client/models/{StackFrame.js → FunctionDetailResponse.js} +0 -0
- /package/dist/openapi_client/models/{StartSubscriptionRequest.js → FunctionPermissionsReplaceRequest.js} +0 -0
- /package/dist/openapi_client/models/{StartSubscriptionResponse.js → FunctionPermissionsResponse.js} +0 -0
- /package/dist/openapi_client/models/{StartTeamBillingRequest.js → FunctionResourcePermissionRequest.js} +0 -0
- /package/dist/openapi_client/models/{StepExecution.js → FunctionResourcePermissionResponse.js} +0 -0
- /package/dist/openapi_client/models/{SubscriptionResponse.js → FunctionRunSummaryResponse.js} +0 -0
- /package/dist/openapi_client/models/{SubscriptionStatusResponse.js → InstalledAppSummary.js} +0 -0
- /package/dist/openapi_client/models/{SubscriptionWithPlanResponse.js → IntegrationStatusResponse.js} +0 -0
- /package/dist/openapi_client/models/{TableAccessEntry.js → LemmaProviderCapabilityResponseSchema.js} +0 -0
- /package/dist/openapi_client/models/{TableResponse.js → OAuth2DefaultsResponseSchema.js} +0 -0
- /package/dist/openapi_client/models/{TeamsCredentialsInput.js → PodConfig.js} +0 -0
- /package/dist/openapi_client/models/{TeamsSurfaceConfig.js → PodEffectivePermissionsResponse.js} +0 -0
- /package/dist/openapi_client/models/{TeamsSurfaceConfigInput.js → PodPermissionCatalogResponse.js} +0 -0
- /package/dist/openapi_client/models/{TelegramCredentialsInput.js → PodPermissionResponse.js} +0 -0
- /package/dist/openapi_client/models/{TelegramSurfaceConfig.js → PodRolePermissionsReplaceRequest.js} +0 -0
- /package/dist/openapi_client/models/{TelegramSurfaceConfigInput.js → PodRolePermissionsResponse.js} +0 -0
- /package/dist/openapi_client/models/{WebSearchAgentRequest.js → PodRoleResourcePermissionRequest.js} +0 -0
- /package/dist/openapi_client/models/{WebSearchAgentResponse.js → PodRoleResourcePermissionResponse.js} +0 -0
- /package/dist/openapi_client/models/{WhatsAppCredentialsInput.js → ResolveUserApprovalRequest.js} +0 -0
- /package/dist/openapi_client/models/{WhatsAppSurfaceConfig.js → ResourceAccessGrantRequest.js} +0 -0
- /package/dist/openapi_client/models/{WhatsAppSurfaceConfigInput.js → ResourceAccessGrantResponse.js} +0 -0
- /package/dist/openapi_client/models/{WorkflowRunWaitEntity.js → ResourceAccessResponse.js} +0 -0
|
@@ -44,6 +44,77 @@ function isConversationRunningStatus(status) {
|
|
|
44
44
|
return false;
|
|
45
45
|
return normalized === "RUNNING" || normalized === "IN_PROGRESS" || normalized === "PROCESSING";
|
|
46
46
|
}
|
|
47
|
+
function isRecord(value) {
|
|
48
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
49
|
+
}
|
|
50
|
+
function parseMaybeJsonValue(value) {
|
|
51
|
+
if (typeof value !== "string")
|
|
52
|
+
return value;
|
|
53
|
+
const trimmed = value.trim();
|
|
54
|
+
if (!trimmed)
|
|
55
|
+
return value;
|
|
56
|
+
try {
|
|
57
|
+
return JSON.parse(trimmed);
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return value;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function parseMaybeJsonObject(value) {
|
|
64
|
+
const parsed = parseMaybeJsonValue(value);
|
|
65
|
+
return isRecord(parsed) ? parsed : {};
|
|
66
|
+
}
|
|
67
|
+
function normalizeToolResult(value) {
|
|
68
|
+
const parsed = parseMaybeJsonValue(value);
|
|
69
|
+
if (isRecord(parsed))
|
|
70
|
+
return parsed;
|
|
71
|
+
if (Array.isArray(parsed))
|
|
72
|
+
return { output: parsed };
|
|
73
|
+
if (typeof parsed === "undefined" || parsed === null)
|
|
74
|
+
return {};
|
|
75
|
+
return { output: parsed };
|
|
76
|
+
}
|
|
77
|
+
function parseStreamingToolToken(token) {
|
|
78
|
+
const parsed = parseMaybeJsonValue(token);
|
|
79
|
+
if (!isRecord(parsed))
|
|
80
|
+
return null;
|
|
81
|
+
const toolName = [parsed.tool_name, parsed.toolName, parsed.name]
|
|
82
|
+
.find((value) => typeof value === "string" && value.trim().length > 0);
|
|
83
|
+
if (typeof toolName !== "string")
|
|
84
|
+
return null;
|
|
85
|
+
const rawToolCallId = [parsed.tool_call_id, parsed.toolCallId, parsed.call_id, parsed.id]
|
|
86
|
+
.find((value) => typeof value === "string" && value.trim().length > 0);
|
|
87
|
+
const rawArgs = parsed.tool_input ?? parsed.args ?? parsed.arguments ?? parsed.input;
|
|
88
|
+
const rawResult = parsed.tool_output ?? parsed.result ?? parsed.output;
|
|
89
|
+
const hasResult = typeof rawResult !== "undefined";
|
|
90
|
+
return {
|
|
91
|
+
...(typeof rawToolCallId === "string" ? { toolCallId: rawToolCallId } : {}),
|
|
92
|
+
toolName,
|
|
93
|
+
args: parseMaybeJsonObject(rawArgs),
|
|
94
|
+
state: hasResult ? "result" : "call",
|
|
95
|
+
...(hasResult ? { result: normalizeToolResult(rawResult) } : {}),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function parsePartialStreamingToolToken(token) {
|
|
99
|
+
const toolNameMatch = /"(?:tool_name|toolName|name)"\s*:\s*"((?:\\.|[^"\\])*)"/.exec(token);
|
|
100
|
+
if (!toolNameMatch?.[1])
|
|
101
|
+
return null;
|
|
102
|
+
const idMatch = /"(?:tool_call_id|toolCallId|call_id|id)"\s*:\s*"((?:\\.|[^"\\])*)"/.exec(token);
|
|
103
|
+
const unescapeJsonString = (value) => {
|
|
104
|
+
try {
|
|
105
|
+
return JSON.parse(`"${value}"`);
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
return value;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
return {
|
|
112
|
+
...(idMatch?.[1] ? { toolCallId: unescapeJsonString(idMatch[1]) } : {}),
|
|
113
|
+
toolName: unescapeJsonString(toolNameMatch[1]),
|
|
114
|
+
args: {},
|
|
115
|
+
state: "call",
|
|
116
|
+
};
|
|
117
|
+
}
|
|
47
118
|
function resolveResumeInput(input) {
|
|
48
119
|
if (typeof input === "string" || input === null) {
|
|
49
120
|
return { conversationId: input };
|
|
@@ -57,12 +128,14 @@ export function useAssistantSession(options) {
|
|
|
57
128
|
const [status, setStatus] = useState(undefined);
|
|
58
129
|
const [messages, setMessages] = useState([]);
|
|
59
130
|
const [streamingText, setStreamingText] = useState("");
|
|
131
|
+
const [streamingTool, setStreamingTool] = useState(null);
|
|
60
132
|
const [isStreaming, setIsStreaming] = useState(false);
|
|
61
133
|
const [error, setError] = useState(null);
|
|
62
134
|
const abortRef = useRef(null);
|
|
63
135
|
const conversationIdRef = useRef(externalConversationId);
|
|
64
136
|
const statusRef = useRef(undefined);
|
|
65
137
|
const streamingTextRef = useRef("");
|
|
138
|
+
const streamingToolTokenRef = useRef("");
|
|
66
139
|
const autoResumedKeyRef = useRef(null);
|
|
67
140
|
const autoLoadInFlightKeyRef = useRef(null);
|
|
68
141
|
const lastAutoLoadedKeyRef = useRef(null);
|
|
@@ -70,6 +143,9 @@ export function useAssistantSession(options) {
|
|
|
70
143
|
const onStatusRef = useRef(onStatus);
|
|
71
144
|
const onMessageRef = useRef(onMessage);
|
|
72
145
|
const onErrorRef = useRef(onError);
|
|
146
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
147
|
+
const consumeRef = useRef(null);
|
|
148
|
+
const streamReconnectCountRef = useRef(0);
|
|
73
149
|
const setConversationId = useCallback((nextConversationId) => {
|
|
74
150
|
abortRef.current?.abort();
|
|
75
151
|
abortRef.current = null;
|
|
@@ -82,6 +158,7 @@ export function useAssistantSession(options) {
|
|
|
82
158
|
lastAutoLoadedKeyRef.current = null;
|
|
83
159
|
streamingTextRef.current = "";
|
|
84
160
|
setStreamingText("");
|
|
161
|
+
setStreamingTool(null);
|
|
85
162
|
setConversation(null);
|
|
86
163
|
setStatus(undefined);
|
|
87
164
|
statusRef.current = undefined;
|
|
@@ -129,6 +206,10 @@ export function useAssistantSession(options) {
|
|
|
129
206
|
streamingTextRef.current = "";
|
|
130
207
|
setStreamingText("");
|
|
131
208
|
}, []);
|
|
209
|
+
const clearStreamingTool = useCallback(() => {
|
|
210
|
+
streamingToolTokenRef.current = "";
|
|
211
|
+
setStreamingTool(null);
|
|
212
|
+
}, []);
|
|
132
213
|
const appendStreamingToken = useCallback((token) => {
|
|
133
214
|
if (!token)
|
|
134
215
|
return;
|
|
@@ -166,8 +247,6 @@ export function useAssistantSession(options) {
|
|
|
166
247
|
const response = await scopedClient.conversations.list({
|
|
167
248
|
pod_id: scope.podId ?? undefined,
|
|
168
249
|
agent_name: scope.agentName ?? undefined,
|
|
169
|
-
status: input.status ?? undefined,
|
|
170
|
-
type: input.type,
|
|
171
250
|
limit: input.limit,
|
|
172
251
|
page_token: input.pageToken,
|
|
173
252
|
});
|
|
@@ -199,7 +278,6 @@ export function useAssistantSession(options) {
|
|
|
199
278
|
? defaultInstructions ?? undefined
|
|
200
279
|
: input.instructions,
|
|
201
280
|
metadata: input.metadata ?? undefined,
|
|
202
|
-
type: input.type,
|
|
203
281
|
pod_id: input.podId ?? defaultPodId ?? scopedClient.podId ?? undefined,
|
|
204
282
|
agent_name: input.agentName
|
|
205
283
|
?? input.assistantName
|
|
@@ -211,6 +289,9 @@ export function useAssistantSession(options) {
|
|
|
211
289
|
model: typeof input.model === "undefined"
|
|
212
290
|
? undefined
|
|
213
291
|
: input.model,
|
|
292
|
+
agent_runtime: typeof input.agentRuntime === "undefined"
|
|
293
|
+
? undefined
|
|
294
|
+
: input.agentRuntime,
|
|
214
295
|
};
|
|
215
296
|
const created = await scopedClient.conversations.create(payload);
|
|
216
297
|
if (input.setActive !== false) {
|
|
@@ -314,8 +395,37 @@ export function useAssistantSession(options) {
|
|
|
314
395
|
const payload = parseSSEJson(event);
|
|
315
396
|
onEventRef.current?.(event, payload);
|
|
316
397
|
const parsed = parseAssistantStreamEvent(payload);
|
|
398
|
+
if (parsed.error) {
|
|
399
|
+
const streamError = new Error(parsed.error);
|
|
400
|
+
setError(streamError);
|
|
401
|
+
onErrorRef.current?.(streamError);
|
|
402
|
+
setConversationStatus(parsed.status ?? "FAILED");
|
|
403
|
+
sawTerminalStatus = true;
|
|
404
|
+
clearStreamingText();
|
|
405
|
+
clearStreamingTool();
|
|
406
|
+
continue;
|
|
407
|
+
}
|
|
317
408
|
if (parsed.token) {
|
|
318
|
-
|
|
409
|
+
if (parsed.tokenKind === "tool") {
|
|
410
|
+
streamingToolTokenRef.current += parsed.token;
|
|
411
|
+
const tool = parseStreamingToolToken(streamingToolTokenRef.current)
|
|
412
|
+
|| parsePartialStreamingToolToken(streamingToolTokenRef.current);
|
|
413
|
+
if (tool?.state === "call") {
|
|
414
|
+
setStreamingTool(tool);
|
|
415
|
+
if (parseStreamingToolToken(streamingToolTokenRef.current)) {
|
|
416
|
+
streamingToolTokenRef.current = "";
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
else if (tool?.state === "result") {
|
|
420
|
+
setStreamingTool((current) => (current?.toolCallId && current.toolCallId === tool.toolCallId
|
|
421
|
+
? { ...current, ...tool }
|
|
422
|
+
: current));
|
|
423
|
+
streamingToolTokenRef.current = "";
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
else if (!parsed.tokenKind || parsed.tokenKind === "text") {
|
|
427
|
+
appendStreamingToken(parsed.token);
|
|
428
|
+
}
|
|
319
429
|
}
|
|
320
430
|
if (parsed.message) {
|
|
321
431
|
setMessages((previous) => upsertConversationMessage(previous, parsed.message));
|
|
@@ -325,6 +435,7 @@ export function useAssistantSession(options) {
|
|
|
325
435
|
: "";
|
|
326
436
|
if (role === "assistant" || role === "tool") {
|
|
327
437
|
clearStreamingText();
|
|
438
|
+
clearStreamingTool();
|
|
328
439
|
}
|
|
329
440
|
}
|
|
330
441
|
if (parsed.status) {
|
|
@@ -332,14 +443,38 @@ export function useAssistantSession(options) {
|
|
|
332
443
|
if (!isConversationRunningStatus(parsed.status)) {
|
|
333
444
|
sawTerminalStatus = true;
|
|
334
445
|
clearStreamingText();
|
|
446
|
+
clearStreamingTool();
|
|
335
447
|
}
|
|
336
448
|
}
|
|
337
449
|
}
|
|
338
450
|
if (!controller.signal.aborted) {
|
|
339
451
|
if (!sawTerminalStatus && isConversationRunningStatus(statusRef.current)) {
|
|
452
|
+
const reconId = streamConversationId ?? conversationId;
|
|
453
|
+
if (reconId && streamReconnectCountRef.current < 3) {
|
|
454
|
+
streamReconnectCountRef.current += 1;
|
|
455
|
+
const delay = Math.pow(2, streamReconnectCountRef.current - 1) * 1000;
|
|
456
|
+
await new Promise((r) => setTimeout(r, delay));
|
|
457
|
+
if (!controller.signal.aborted && isConversationRunningStatus(statusRef.current)) {
|
|
458
|
+
try {
|
|
459
|
+
const scope = normalizeScope(client, defaultScope);
|
|
460
|
+
const scopedClient = applyPodScope(client, scope.podId);
|
|
461
|
+
const newStream = await scopedClient.conversations.resumeStream(reconId, {
|
|
462
|
+
pod_id: scope.podId ?? undefined,
|
|
463
|
+
signal: controller.signal,
|
|
464
|
+
});
|
|
465
|
+
// Sync any messages delivered while the stream was dropped
|
|
466
|
+
await loadMessages({ conversationId: reconId, limit: 100 });
|
|
467
|
+
streamReconnectCountRef.current = 0;
|
|
468
|
+
return consumeRef.current({ stream: newStream, controller, streamConversationId: reconId, syncAfterStream });
|
|
469
|
+
}
|
|
470
|
+
catch { /* fall through to WAITING */ }
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
streamReconnectCountRef.current = 0;
|
|
340
474
|
setConversationStatus("WAITING");
|
|
341
475
|
}
|
|
342
476
|
clearStreamingText();
|
|
477
|
+
clearStreamingTool();
|
|
343
478
|
const shouldSync = syncAfterStream ?? syncOnTurnEnd;
|
|
344
479
|
const syncConversationId = streamConversationId ?? conversationId;
|
|
345
480
|
if (shouldSync && syncConversationId) {
|
|
@@ -363,13 +498,19 @@ export function useAssistantSession(options) {
|
|
|
363
498
|
}
|
|
364
499
|
}, [
|
|
365
500
|
appendStreamingToken,
|
|
501
|
+
clearStreamingTool,
|
|
366
502
|
clearStreamingText,
|
|
503
|
+
client,
|
|
367
504
|
conversationId,
|
|
505
|
+
defaultScope,
|
|
368
506
|
loadMessages,
|
|
369
507
|
refreshConversation,
|
|
370
508
|
setConversationStatus,
|
|
371
509
|
syncOnTurnEnd,
|
|
372
510
|
]);
|
|
511
|
+
useEffect(() => {
|
|
512
|
+
consumeRef.current = consume;
|
|
513
|
+
}, [consume]);
|
|
373
514
|
const ensureConversation = useCallback(async (overrideConversationId) => {
|
|
374
515
|
const existingId = overrideConversationId ?? conversationId;
|
|
375
516
|
if (existingId) {
|
|
@@ -576,6 +717,7 @@ export function useAssistantSession(options) {
|
|
|
576
717
|
finalOutput,
|
|
577
718
|
finalOutputText,
|
|
578
719
|
streamingText,
|
|
720
|
+
streamingTool,
|
|
579
721
|
isStreaming,
|
|
580
722
|
error,
|
|
581
723
|
setConversationId,
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import type { LemmaClient } from "../client.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { DatastoreCountResponse } from "../types.js";
|
|
3
3
|
export interface UseBulkRecordsOptions {
|
|
4
4
|
client: LemmaClient;
|
|
5
5
|
podId?: string;
|
|
6
6
|
tableName: string;
|
|
7
7
|
enabled?: boolean;
|
|
8
|
-
onSuccess?: (response:
|
|
8
|
+
onSuccess?: (response: DatastoreCountResponse) => void;
|
|
9
9
|
onError?: (error: unknown) => void;
|
|
10
10
|
}
|
|
11
11
|
export interface UseBulkRecordsResult {
|
|
12
12
|
isSubmitting: boolean;
|
|
13
13
|
error: Error | null;
|
|
14
14
|
lastMessage: string | null;
|
|
15
|
-
createMany: (records: Record<string, unknown>[]) => Promise<
|
|
16
|
-
updateMany: (records: Record<string, unknown>[]) => Promise<
|
|
17
|
-
deleteMany: (recordIds: Array<string | number>) => Promise<
|
|
15
|
+
createMany: (records: Record<string, unknown>[]) => Promise<DatastoreCountResponse | null>;
|
|
16
|
+
updateMany: (records: Record<string, unknown>[]) => Promise<DatastoreCountResponse | null>;
|
|
17
|
+
deleteMany: (recordIds: Array<string | number>) => Promise<DatastoreCountResponse | null>;
|
|
18
18
|
reset: () => void;
|
|
19
19
|
}
|
|
20
20
|
export declare function useBulkRecords({ client, podId, tableName, enabled, onSuccess, onError, }: UseBulkRecordsOptions): UseBulkRecordsResult;
|
|
@@ -10,7 +10,7 @@ export function useBulkRecords({ client, podId, tableName, enabled = true, onSuc
|
|
|
10
10
|
useEffect(() => { onErrorRef.current = onError; }, [onError]);
|
|
11
11
|
const trimmedTableName = tableName.trim();
|
|
12
12
|
const isEnabled = enabled && trimmedTableName.length > 0;
|
|
13
|
-
const runBulkOperation = useCallback(async (action, fallbackError) => {
|
|
13
|
+
const runBulkOperation = useCallback(async (action, fallbackError, describe) => {
|
|
14
14
|
if (!isEnabled) {
|
|
15
15
|
return null;
|
|
16
16
|
}
|
|
@@ -19,7 +19,7 @@ export function useBulkRecords({ client, podId, tableName, enabled = true, onSuc
|
|
|
19
19
|
try {
|
|
20
20
|
const scopedClient = resolvePodClient(client, podId);
|
|
21
21
|
const response = await action(scopedClient);
|
|
22
|
-
setLastMessage(response.
|
|
22
|
+
setLastMessage(describe(response.count));
|
|
23
23
|
onSuccessRef.current?.(response);
|
|
24
24
|
return response;
|
|
25
25
|
}
|
|
@@ -36,17 +36,17 @@ export function useBulkRecords({ client, podId, tableName, enabled = true, onSuc
|
|
|
36
36
|
const createMany = useCallback(async (records) => {
|
|
37
37
|
if (records.length === 0)
|
|
38
38
|
return null;
|
|
39
|
-
return runBulkOperation((scopedClient) => scopedClient.records.bulk.create(trimmedTableName, records), "Failed to bulk create records.");
|
|
39
|
+
return runBulkOperation((scopedClient) => scopedClient.records.bulk.create(trimmedTableName, records), "Failed to bulk create records.", (count) => `${count} record${count === 1 ? "" : "s"} created.`);
|
|
40
40
|
}, [runBulkOperation, trimmedTableName]);
|
|
41
41
|
const updateMany = useCallback(async (records) => {
|
|
42
42
|
if (records.length === 0)
|
|
43
43
|
return null;
|
|
44
|
-
return runBulkOperation((scopedClient) => scopedClient.records.bulk.update(trimmedTableName, records), "Failed to bulk update records.");
|
|
44
|
+
return runBulkOperation((scopedClient) => scopedClient.records.bulk.update(trimmedTableName, records), "Failed to bulk update records.", (count) => `${count} record${count === 1 ? "" : "s"} updated.`);
|
|
45
45
|
}, [runBulkOperation, trimmedTableName]);
|
|
46
46
|
const deleteMany = useCallback(async (recordIds) => {
|
|
47
47
|
if (recordIds.length === 0)
|
|
48
48
|
return null;
|
|
49
|
-
return runBulkOperation((scopedClient) => scopedClient.records.bulk.delete(trimmedTableName, recordIds), "Failed to bulk delete records.");
|
|
49
|
+
return runBulkOperation((scopedClient) => scopedClient.records.bulk.delete(trimmedTableName, recordIds), "Failed to bulk delete records.", (count) => `${count} record${count === 1 ? "" : "s"} deleted.`);
|
|
50
50
|
}, [runBulkOperation, trimmedTableName]);
|
|
51
51
|
const reset = useCallback(() => {
|
|
52
52
|
setError(null);
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { LemmaClient } from "../client.js";
|
|
2
|
-
import type { ConversationStatus } from "../openapi_client/models/ConversationStatus.js";
|
|
3
|
-
import type { ConversationType } from "../openapi_client/models/ConversationType.js";
|
|
4
2
|
import type { Conversation } from "../types.js";
|
|
5
3
|
import { type CreateConversationInput } from "./useAssistantSession.js";
|
|
6
4
|
export interface UseConversationsOptions {
|
|
@@ -21,8 +19,6 @@ export interface UseConversationsOptions {
|
|
|
21
19
|
autoSelectFirst?: boolean;
|
|
22
20
|
limit?: number;
|
|
23
21
|
pageToken?: string;
|
|
24
|
-
status?: ConversationStatus | `${ConversationStatus}` | null;
|
|
25
|
-
type?: ConversationType | `${ConversationType}` | null;
|
|
26
22
|
initialConversationId?: string | null;
|
|
27
23
|
}
|
|
28
24
|
export interface UseConversationsResult {
|
|
@@ -49,8 +45,6 @@ export interface UseConversationsResult {
|
|
|
49
45
|
refresh: (overrides?: {
|
|
50
46
|
limit?: number;
|
|
51
47
|
pageToken?: string;
|
|
52
|
-
status?: ConversationStatus | `${ConversationStatus}` | null;
|
|
53
|
-
type?: ConversationType | `${ConversationType}` | null;
|
|
54
48
|
}) => Promise<Conversation[]>;
|
|
55
49
|
loadMore: (overrides?: {
|
|
56
50
|
limit?: number;
|
|
@@ -59,4 +53,4 @@ export interface UseConversationsResult {
|
|
|
59
53
|
createAndSelectConversation: (input?: Omit<CreateConversationInput, "setActive">) => Promise<Conversation>;
|
|
60
54
|
ensureConversation: (input?: Omit<CreateConversationInput, "setActive">) => Promise<Conversation>;
|
|
61
55
|
}
|
|
62
|
-
export declare function useConversations({ client, podId, agentName, assistantName, assistantId, organizationId, enabled, autoLoad, autoSelectFirst, limit, pageToken,
|
|
56
|
+
export declare function useConversations({ client, podId, agentName, assistantName, assistantId, organizationId, enabled, autoLoad, autoSelectFirst, limit, pageToken, initialConversationId, }: UseConversationsOptions): UseConversationsResult;
|
|
@@ -8,7 +8,7 @@ function sortConversationsByUpdatedAt(conversations) {
|
|
|
8
8
|
return bTime - aTime;
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
|
-
export function useConversations({ client, podId, agentName, assistantName, assistantId, organizationId, enabled = true, autoLoad = true, autoSelectFirst = true, limit = 20, pageToken,
|
|
11
|
+
export function useConversations({ client, podId, agentName, assistantName, assistantId, organizationId, enabled = true, autoLoad = true, autoSelectFirst = true, limit = 20, pageToken, initialConversationId = null, }) {
|
|
12
12
|
const [conversations, setConversations] = useState([]);
|
|
13
13
|
const [total, setTotal] = useState(0);
|
|
14
14
|
const [nextPageToken, setNextPageToken] = useState(null);
|
|
@@ -21,9 +21,7 @@ export function useConversations({ client, podId, agentName, assistantName, assi
|
|
|
21
21
|
assistantName: assistantName ?? null,
|
|
22
22
|
assistantId: assistantId ?? null,
|
|
23
23
|
organizationId: organizationId ?? null,
|
|
24
|
-
|
|
25
|
-
type: type ?? null,
|
|
26
|
-
}), [agentName, assistantId, assistantName, organizationId, podId, status, type]);
|
|
24
|
+
}), [agentName, assistantId, assistantName, organizationId, podId]);
|
|
27
25
|
const { error, listConversations, createConversation: sessionCreateConversation, } = useAssistantSession({
|
|
28
26
|
client,
|
|
29
27
|
podId,
|
|
@@ -46,8 +44,6 @@ export function useConversations({ client, podId, agentName, assistantName, assi
|
|
|
46
44
|
const response = await listConversations({
|
|
47
45
|
limit: overrides.limit ?? limit,
|
|
48
46
|
pageToken: overrides.pageToken ?? pageToken,
|
|
49
|
-
status: overrides.status ?? status,
|
|
50
|
-
type: overrides.type ?? type,
|
|
51
47
|
});
|
|
52
48
|
const nextConversations = sortConversationsByUpdatedAt(response.items ?? []);
|
|
53
49
|
setConversations(nextConversations);
|
|
@@ -67,7 +63,7 @@ export function useConversations({ client, podId, agentName, assistantName, assi
|
|
|
67
63
|
finally {
|
|
68
64
|
setIsLoading(false);
|
|
69
65
|
}
|
|
70
|
-
}, [autoSelectFirst, enabled, initialConversationId, limit, listConversations, pageToken
|
|
66
|
+
}, [autoSelectFirst, enabled, initialConversationId, limit, listConversations, pageToken]);
|
|
71
67
|
const loadMore = useCallback(async (overrides = {}) => {
|
|
72
68
|
if (!enabled || !nextPageToken || isLoading || isLoadingMore) {
|
|
73
69
|
return [];
|
|
@@ -77,8 +73,6 @@ export function useConversations({ client, podId, agentName, assistantName, assi
|
|
|
77
73
|
const response = await listConversations({
|
|
78
74
|
limit: overrides.limit ?? limit,
|
|
79
75
|
pageToken: nextPageToken,
|
|
80
|
-
status,
|
|
81
|
-
type,
|
|
82
76
|
});
|
|
83
77
|
const moreConversations = sortConversationsByUpdatedAt(response.items ?? []);
|
|
84
78
|
setConversations((previous) => [...previous, ...moreConversations]);
|
|
@@ -93,7 +87,7 @@ export function useConversations({ client, podId, agentName, assistantName, assi
|
|
|
93
87
|
finally {
|
|
94
88
|
setIsLoadingMore(false);
|
|
95
89
|
}
|
|
96
|
-
}, [conversations.length, enabled, isLoading, isLoadingMore, limit, listConversations, nextPageToken
|
|
90
|
+
}, [conversations.length, enabled, isLoading, isLoadingMore, limit, listConversations, nextPageToken]);
|
|
97
91
|
const createConversation = useCallback(async (input = {}) => {
|
|
98
92
|
const createdConversation = await sessionCreateConversation({
|
|
99
93
|
...input,
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import type { LemmaClient } from "../client.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { FileResponse } from "../types.js";
|
|
3
3
|
export interface CreateFolderInput {
|
|
4
4
|
directoryPath?: string;
|
|
5
5
|
parentId?: string;
|
|
6
6
|
description?: string;
|
|
7
|
-
namespace?: DatastoreFileNamespace | null;
|
|
8
7
|
}
|
|
9
8
|
export interface UseCreateFolderOptions {
|
|
10
9
|
client: LemmaClient;
|
|
11
10
|
podId?: string;
|
|
12
|
-
namespace?: DatastoreFileNamespace | null;
|
|
13
11
|
enabled?: boolean;
|
|
14
12
|
onSuccess?: (folder: FileResponse) => void;
|
|
15
13
|
onError?: (error: unknown) => void;
|
|
@@ -21,4 +19,4 @@ export interface UseCreateFolderResult<TFile extends FileResponse = FileResponse
|
|
|
21
19
|
createFolder: (name: string, options?: CreateFolderInput) => Promise<TFile | null>;
|
|
22
20
|
reset: () => void;
|
|
23
21
|
}
|
|
24
|
-
export declare function useCreateFolder<TFile extends FileResponse = FileResponse>({ client, podId,
|
|
22
|
+
export declare function useCreateFolder<TFile extends FileResponse = FileResponse>({ client, podId, enabled, onSuccess, onError, }: UseCreateFolderOptions): UseCreateFolderResult<TFile>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
2
|
import { normalizeError, resolvePodClient } from "./utils.js";
|
|
3
|
-
export function useCreateFolder({ client, podId,
|
|
3
|
+
export function useCreateFolder({ client, podId, enabled = true, onSuccess, onError, }) {
|
|
4
4
|
const [createdFolder, setCreatedFolder] = useState(null);
|
|
5
5
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
6
6
|
const [error, setError] = useState(null);
|
|
@@ -19,7 +19,6 @@ export function useCreateFolder({ client, podId, namespace, enabled = true, onSu
|
|
|
19
19
|
const scopedClient = resolvePodClient(client, podId);
|
|
20
20
|
const nextFolder = await scopedClient.files.folder.create(trimmedName, {
|
|
21
21
|
...options,
|
|
22
|
-
namespace: options.namespace ?? namespace,
|
|
23
22
|
});
|
|
24
23
|
setCreatedFolder(nextFolder);
|
|
25
24
|
onSuccessRef.current?.(nextFolder);
|
|
@@ -34,7 +33,7 @@ export function useCreateFolder({ client, podId, namespace, enabled = true, onSu
|
|
|
34
33
|
finally {
|
|
35
34
|
setIsSubmitting(false);
|
|
36
35
|
}
|
|
37
|
-
}, [client, enabled,
|
|
36
|
+
}, [client, enabled, podId]);
|
|
38
37
|
const reset = useCallback(() => {
|
|
39
38
|
setCreatedFolder(null);
|
|
40
39
|
setError(null);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LemmaClient } from "../client.js";
|
|
2
|
-
import type { FunctionRun
|
|
2
|
+
import type { FunctionRun } from "../types.js";
|
|
3
3
|
/**
|
|
4
4
|
* React hook for creating a single record. Manages loading/error state and
|
|
5
5
|
* exposes a `create` function you can call from event handlers.
|
|
@@ -35,7 +35,7 @@ export interface UseCreateRecordOptions {
|
|
|
35
35
|
createVia?: "direct" | "function";
|
|
36
36
|
/** Function name to run when `createVia` is `"function"`. Falls back to `tableName` if omitted. */
|
|
37
37
|
createFunctionName?: string;
|
|
38
|
-
onSuccess?: (record: Record<string, unknown>, response:
|
|
38
|
+
onSuccess?: (record: Record<string, unknown>, response: Record<string, unknown> | FunctionRun) => void;
|
|
39
39
|
onError?: (error: unknown) => void;
|
|
40
40
|
}
|
|
41
41
|
export interface UseCreateRecordResult<TRecord extends Record<string, unknown> = Record<string, unknown>> {
|
|
@@ -29,7 +29,7 @@ export function useCreateRecord({ client, podId, tableName, enabled = true, crea
|
|
|
29
29
|
return nextRecord;
|
|
30
30
|
}
|
|
31
31
|
const response = await scopedClient.records.create(trimmedTableName, data);
|
|
32
|
-
const nextRecord = (response
|
|
32
|
+
const nextRecord = (response ?? null);
|
|
33
33
|
setCreatedRecord(nextRecord);
|
|
34
34
|
if (nextRecord) {
|
|
35
35
|
onSuccessRef.current?.(nextRecord, response);
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type { LemmaClient } from "../client.js";
|
|
2
|
-
import type { DatastoreFileNamespace } from "../types.js";
|
|
3
2
|
export interface UseDeleteFileOptions {
|
|
4
3
|
client: LemmaClient;
|
|
5
4
|
podId?: string;
|
|
6
5
|
path?: string | null;
|
|
7
|
-
namespace?: DatastoreFileNamespace | null;
|
|
8
6
|
enabled?: boolean;
|
|
9
7
|
onSuccess?: (path: string) => void;
|
|
10
8
|
onError?: (error: unknown) => void;
|
|
@@ -15,8 +13,7 @@ export interface UseDeleteFileResult {
|
|
|
15
13
|
error: Error | null;
|
|
16
14
|
remove: (overrides?: {
|
|
17
15
|
path?: string | null;
|
|
18
|
-
namespace?: DatastoreFileNamespace | null;
|
|
19
16
|
}) => Promise<boolean>;
|
|
20
17
|
reset: () => void;
|
|
21
18
|
}
|
|
22
|
-
export declare function useDeleteFile({ client, podId, path,
|
|
19
|
+
export declare function useDeleteFile({ client, podId, path, enabled, onSuccess, onError, }: UseDeleteFileOptions): UseDeleteFileResult;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
2
|
import { normalizeError, resolvePodClient } from "./utils.js";
|
|
3
|
-
export function useDeleteFile({ client, podId, path = null,
|
|
3
|
+
export function useDeleteFile({ client, podId, path = null, enabled = true, onSuccess, onError, }) {
|
|
4
4
|
const [deletedPath, setDeletedPath] = useState(null);
|
|
5
5
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
6
6
|
const [error, setError] = useState(null);
|
|
@@ -21,7 +21,7 @@ export function useDeleteFile({ client, podId, path = null, namespace, enabled =
|
|
|
21
21
|
setError(null);
|
|
22
22
|
try {
|
|
23
23
|
const scopedClient = resolvePodClient(client, podId);
|
|
24
|
-
await scopedClient.files.delete(nextPath
|
|
24
|
+
await scopedClient.files.delete(nextPath);
|
|
25
25
|
setDeletedPath(nextPath);
|
|
26
26
|
onSuccessRef.current?.(nextPath);
|
|
27
27
|
return true;
|
|
@@ -35,7 +35,7 @@ export function useDeleteFile({ client, podId, path = null, namespace, enabled =
|
|
|
35
35
|
finally {
|
|
36
36
|
setIsSubmitting(false);
|
|
37
37
|
}
|
|
38
|
-
}, [client, isEnabled,
|
|
38
|
+
}, [client, isEnabled, podId, trimmedPath]);
|
|
39
39
|
const reset = useCallback(() => {
|
|
40
40
|
setDeletedPath(null);
|
|
41
41
|
setError(null);
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { LemmaClient } from "../client.js";
|
|
2
|
-
import type { DatastoreMessageResponse } from "../types.js";
|
|
3
2
|
export interface UseDeleteRecordOptions {
|
|
4
3
|
client: LemmaClient;
|
|
5
4
|
podId?: string;
|
|
6
5
|
tableName: string;
|
|
7
6
|
recordId?: string | null;
|
|
8
7
|
enabled?: boolean;
|
|
9
|
-
onSuccess?: (
|
|
8
|
+
onSuccess?: () => void;
|
|
10
9
|
onError?: (error: unknown) => void;
|
|
11
10
|
}
|
|
12
11
|
export interface UseDeleteRecordResult {
|
|
@@ -22,9 +22,9 @@ export function useDeleteRecord({ client, podId, tableName, recordId = null, ena
|
|
|
22
22
|
setError(null);
|
|
23
23
|
try {
|
|
24
24
|
const scopedClient = resolvePodClient(client, podId);
|
|
25
|
-
|
|
26
|
-
setLastMessage(
|
|
27
|
-
onSuccessRef.current?.(
|
|
25
|
+
await scopedClient.records.delete(trimmedTableName, nextRecordId);
|
|
26
|
+
setLastMessage("Record deleted.");
|
|
27
|
+
onSuccessRef.current?.();
|
|
28
28
|
return true;
|
|
29
29
|
}
|
|
30
30
|
catch (mutationError) {
|
package/dist/react/useFile.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { LemmaClient } from "../client.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { FileResponse } from "../types.js";
|
|
3
3
|
export interface UseFileOptions {
|
|
4
4
|
client: LemmaClient;
|
|
5
5
|
podId?: string;
|
|
6
6
|
path?: string | null;
|
|
7
|
-
namespace?: DatastoreFileNamespace | null;
|
|
8
7
|
enabled?: boolean;
|
|
9
8
|
autoLoad?: boolean;
|
|
10
9
|
}
|
|
@@ -14,7 +13,6 @@ export interface UseFileResult {
|
|
|
14
13
|
error: Error | null;
|
|
15
14
|
refresh: (overrides?: {
|
|
16
15
|
path?: string | null;
|
|
17
|
-
namespace?: DatastoreFileNamespace | null;
|
|
18
16
|
}) => Promise<FileResponse | null>;
|
|
19
17
|
}
|
|
20
|
-
export declare function useFile({ client, podId, path,
|
|
18
|
+
export declare function useFile({ client, podId, path, enabled, autoLoad, }: UseFileOptions): UseFileResult;
|
package/dist/react/useFile.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
2
2
|
import { normalizeError, resolvePodClient } from "./utils.js";
|
|
3
|
-
export function useFile({ client, podId, path = null,
|
|
3
|
+
export function useFile({ client, podId, path = null, enabled = true, autoLoad = true, }) {
|
|
4
4
|
const [file, setFile] = useState(null);
|
|
5
5
|
const [isLoading, setIsLoading] = useState(false);
|
|
6
6
|
const [error, setError] = useState(null);
|
|
@@ -18,7 +18,7 @@ export function useFile({ client, podId, path = null, namespace, enabled = true,
|
|
|
18
18
|
setError(null);
|
|
19
19
|
try {
|
|
20
20
|
const scopedClient = resolvePodClient(client, podId);
|
|
21
|
-
const nextFile = await scopedClient.files.get(nextPath
|
|
21
|
+
const nextFile = await scopedClient.files.get(nextPath);
|
|
22
22
|
if (signal?.aborted)
|
|
23
23
|
return null;
|
|
24
24
|
setFile(nextFile);
|
|
@@ -35,7 +35,7 @@ export function useFile({ client, podId, path = null, namespace, enabled = true,
|
|
|
35
35
|
if (!signal?.aborted)
|
|
36
36
|
setIsLoading(false);
|
|
37
37
|
}
|
|
38
|
-
}, [client, enabled,
|
|
38
|
+
}, [client, enabled, podId, trimmedPath]);
|
|
39
39
|
useEffect(() => {
|
|
40
40
|
if (!isEnabled) {
|
|
41
41
|
setFile(null);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { LemmaClient } from "../client.js";
|
|
2
|
-
import type { DatastoreFileNamespace } from "../types.js";
|
|
3
2
|
export type FilePreviewMode = "rendered" | "artifact";
|
|
4
3
|
export interface UseFilePreviewOptions {
|
|
5
4
|
client: LemmaClient;
|
|
@@ -9,7 +8,6 @@ export interface UseFilePreviewOptions {
|
|
|
9
8
|
autoLoad?: boolean;
|
|
10
9
|
mode?: FilePreviewMode;
|
|
11
10
|
artifact?: string;
|
|
12
|
-
namespace?: DatastoreFileNamespace | null;
|
|
13
11
|
}
|
|
14
12
|
export interface UseFilePreviewResult {
|
|
15
13
|
content: string | null;
|
|
@@ -20,7 +18,6 @@ export interface UseFilePreviewResult {
|
|
|
20
18
|
path?: string | null;
|
|
21
19
|
mode?: FilePreviewMode;
|
|
22
20
|
artifact?: string;
|
|
23
|
-
namespace?: DatastoreFileNamespace | null;
|
|
24
21
|
}) => Promise<string | null>;
|
|
25
22
|
}
|
|
26
|
-
export declare function useFilePreview({ client, podId, path, enabled, autoLoad, mode, artifact,
|
|
23
|
+
export declare function useFilePreview({ client, podId, path, enabled, autoLoad, mode, artifact, }: UseFilePreviewOptions): UseFilePreviewResult;
|