lemma-sdk 0.2.38 → 0.2.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/README.md +15 -4
  2. package/dist/browser/lemma-client.js +339 -106
  3. package/dist/client.d.ts +2 -0
  4. package/dist/client.js +3 -0
  5. package/dist/index.d.ts +2 -1
  6. package/dist/namespaces/pod-members.d.ts +5 -3
  7. package/dist/namespaces/pod-members.js +12 -6
  8. package/dist/namespaces/resources.d.ts +21 -5
  9. package/dist/namespaces/schedules.d.ts +22 -0
  10. package/dist/namespaces/schedules.js +24 -0
  11. package/dist/namespaces/workflows.d.ts +4 -5
  12. package/dist/namespaces/workflows.js +1 -4
  13. package/dist/openapi_client/index.d.ts +31 -26
  14. package/dist/openapi_client/index.js +8 -7
  15. package/dist/openapi_client/models/AgentResponse.d.ts +3 -2
  16. package/dist/openapi_client/models/BillingHistoryResponse.d.ts +8 -0
  17. package/dist/openapi_client/models/BillingInvoiceResponse.d.ts +29 -0
  18. package/dist/openapi_client/models/BillingInvoiceStatus.d.ts +10 -0
  19. package/dist/openapi_client/models/BillingInvoiceStatus.js +15 -0
  20. package/dist/openapi_client/models/BillingScope.d.ts +7 -0
  21. package/dist/openapi_client/models/BillingScope.js +12 -0
  22. package/dist/openapi_client/models/ConversationResponse.d.ts +1 -0
  23. package/dist/openapi_client/models/CreateAgentRequest.d.ts +3 -2
  24. package/dist/openapi_client/models/CreateConversationRequest.d.ts +1 -0
  25. package/dist/openapi_client/models/CreateDeskRequest.d.ts +1 -0
  26. package/dist/openapi_client/models/CreateFolderRequest.d.ts +2 -0
  27. package/dist/openapi_client/models/CreateFunctionRequest.d.ts +9 -4
  28. package/dist/openapi_client/models/CreateInvoicePaymentUrlRequest.d.ts +7 -0
  29. package/dist/openapi_client/models/CreateInvoicePaymentUrlResponse.d.ts +8 -0
  30. package/dist/openapi_client/models/CreateScheduleRequest.d.ts +15 -0
  31. package/dist/openapi_client/models/CreateTableRequest.d.ts +1 -0
  32. package/dist/openapi_client/models/DatastoreFileUploadRequest.d.ts +1 -0
  33. package/dist/openapi_client/models/DeskResponse.d.ts +2 -0
  34. package/dist/openapi_client/models/FileResponse.d.ts +2 -0
  35. package/dist/openapi_client/models/FlowResponse.d.ts +4 -2
  36. package/dist/openapi_client/models/FlowRunEntity.d.ts +5 -4
  37. package/dist/openapi_client/models/FormNodeConfig.d.ts +8 -0
  38. package/dist/openapi_client/models/FunctionResponse.d.ts +13 -2
  39. package/dist/openapi_client/models/{app__modules__function__api__schemas__function_schemas__TableAccessEntry.d.ts → FunctionTableAccessEntry.d.ts} +1 -1
  40. package/dist/openapi_client/models/PodConfigResponse.d.ts +0 -2
  41. package/dist/openapi_client/models/PodMemberAddRequest.d.ts +1 -0
  42. package/dist/openapi_client/models/PodMemberDetailResponse.d.ts +3 -0
  43. package/dist/openapi_client/models/PodMemberResponse.d.ts +3 -0
  44. package/dist/openapi_client/models/PodMemberUpdateRoleRequest.d.ts +2 -1
  45. package/dist/openapi_client/models/PodRoleCreateRequest.d.ts +6 -0
  46. package/dist/openapi_client/models/PodRoleListResponse.d.ts +7 -0
  47. package/dist/openapi_client/models/PodRoleResponse.d.ts +11 -0
  48. package/dist/openapi_client/models/ScheduleListResponse.d.ts +9 -0
  49. package/dist/openapi_client/models/{TriggerResponse.d.ts → ScheduleResponse.d.ts} +10 -4
  50. package/dist/openapi_client/models/{TriggerType.d.ts → ScheduleType.d.ts} +2 -2
  51. package/dist/openapi_client/models/ScheduleType.js +13 -0
  52. package/dist/openapi_client/models/ScheduledFlowStartInput.d.ts +1 -1
  53. package/dist/openapi_client/models/ScheduledFlowStartOutput.d.ts +1 -1
  54. package/dist/openapi_client/models/SendMessageRequest.d.ts +1 -2
  55. package/dist/openapi_client/models/StartSubscriptionResponse.d.ts +3 -1
  56. package/dist/openapi_client/models/StartTeamBillingRequest.d.ts +6 -0
  57. package/dist/openapi_client/models/SubscriptionResponse.d.ts +22 -0
  58. package/dist/openapi_client/models/SubscriptionWithPlanResponse.d.ts +4 -1
  59. package/dist/openapi_client/models/{app__modules__agent__domain__value_objects__TableAccessEntry.d.ts → TableAccessEntry.d.ts} +1 -1
  60. package/dist/openapi_client/models/TableResponse.d.ts +2 -0
  61. package/dist/openapi_client/models/UpdateAgentRequest.d.ts +3 -2
  62. package/dist/openapi_client/models/UpdateConversationRequest.d.ts +1 -0
  63. package/dist/openapi_client/models/UpdateDeskRequest.d.ts +2 -0
  64. package/dist/openapi_client/models/UpdateFunctionRequest.d.ts +6 -2
  65. package/dist/openapi_client/models/UpdateScheduleRequest.d.ts +12 -0
  66. package/dist/openapi_client/models/UpdateTableRequest.d.ts +2 -1
  67. package/dist/openapi_client/models/UsageLimitScopeResponse.d.ts +10 -0
  68. package/dist/openapi_client/models/UsageLimitsResponse.d.ts +11 -0
  69. package/dist/openapi_client/models/UsageListResponse.d.ts +10 -0
  70. package/dist/openapi_client/models/UsageRecordResponse.d.ts +12 -4
  71. package/dist/openapi_client/models/UsageStatsBucketResponse.d.ts +12 -0
  72. package/dist/openapi_client/models/UsageStatsResponse.d.ts +12 -0
  73. package/dist/openapi_client/models/UsageStatsResponse.js +1 -0
  74. package/dist/openapi_client/models/UsageSummaryResponse.d.ts +3 -0
  75. package/dist/openapi_client/models/WorkflowCreateRequest.d.ts +4 -3
  76. package/dist/openapi_client/models/WorkflowMode.d.ts +7 -0
  77. package/dist/openapi_client/models/WorkflowMode.js +12 -0
  78. package/dist/openapi_client/models/WorkflowRunWaitAssignment.d.ts +6 -0
  79. package/dist/openapi_client/models/WorkflowRunWaitAssignment.js +1 -0
  80. package/dist/openapi_client/models/WorkflowRunWaitAssignmentListResponse.d.ts +6 -0
  81. package/dist/openapi_client/models/WorkflowRunWaitAssignmentListResponse.js +1 -0
  82. package/dist/openapi_client/models/WorkflowRunWaitEntity.d.ts +20 -0
  83. package/dist/openapi_client/models/WorkflowRunWaitEntity.js +1 -0
  84. package/dist/openapi_client/models/WorkflowRunWaitStatus.d.ts +6 -0
  85. package/dist/openapi_client/models/WorkflowRunWaitStatus.js +11 -0
  86. package/dist/openapi_client/models/WorkflowRunWaitType.d.ts +7 -0
  87. package/dist/openapi_client/models/WorkflowRunWaitType.js +12 -0
  88. package/dist/openapi_client/models/WorkflowUpdateRequest.d.ts +4 -3
  89. package/dist/openapi_client/models/update.d.ts +2 -0
  90. package/dist/openapi_client/services/BillingSubscriptionsService.d.ts +80 -20
  91. package/dist/openapi_client/services/BillingSubscriptionsService.js +164 -27
  92. package/dist/openapi_client/services/BillingUsageService.d.ts +89 -5
  93. package/dist/openapi_client/services/BillingUsageService.js +186 -6
  94. package/dist/openapi_client/services/DesksService.d.ts +21 -4
  95. package/dist/openapi_client/services/DesksService.js +44 -2
  96. package/dist/openapi_client/services/FilesService.d.ts +10 -10
  97. package/dist/openapi_client/services/FilesService.js +10 -10
  98. package/dist/openapi_client/services/FunctionsService.d.ts +2 -2
  99. package/dist/openapi_client/services/FunctionsService.js +2 -2
  100. package/dist/openapi_client/services/PodMembersService.d.ts +35 -7
  101. package/dist/openapi_client/services/PodMembersService.js +81 -13
  102. package/dist/openapi_client/services/PodRolesService.d.ts +29 -0
  103. package/dist/openapi_client/services/PodRolesService.js +63 -0
  104. package/dist/openapi_client/services/SchedulesService.d.ts +59 -0
  105. package/dist/openapi_client/services/SchedulesService.js +125 -0
  106. package/dist/openapi_client/services/WebhooksService.d.ts +4 -4
  107. package/dist/openapi_client/services/WebhooksService.js +6 -6
  108. package/dist/openapi_client/services/WorkflowsService.d.ts +12 -33
  109. package/dist/openapi_client/services/WorkflowsService.js +26 -69
  110. package/dist/react/AuthGuard.js +1 -1
  111. package/dist/react/index.d.ts +11 -1
  112. package/dist/react/index.js +5 -0
  113. package/dist/react/useAssistantController.d.ts +8 -4
  114. package/dist/react/useAssistantController.js +9 -6
  115. package/dist/react/useAssistantSession.d.ts +3 -0
  116. package/dist/react/useAssistantSession.js +6 -2
  117. package/dist/react/useConversationMessages.d.ts +2 -1
  118. package/dist/react/useConversationMessages.js +2 -1
  119. package/dist/react/useCreateSchedule.d.ts +17 -0
  120. package/dist/react/useCreateSchedule.js +45 -0
  121. package/dist/react/useDeleteSchedule.d.ts +19 -0
  122. package/dist/react/useDeleteSchedule.js +49 -0
  123. package/dist/react/usePodAccess.js +1 -1
  124. package/dist/react/useSchedules.d.ts +30 -0
  125. package/dist/react/useSchedules.js +123 -0
  126. package/dist/react/useUpdateSchedule.d.ts +20 -0
  127. package/dist/react/useUpdateSchedule.js +49 -0
  128. package/dist/react/useWorkflowRun.js +1 -1
  129. package/dist/react/useWorkflowRunWaitAssignments.d.ts +26 -0
  130. package/dist/react/useWorkflowRunWaitAssignments.js +102 -0
  131. package/dist/react/useWorkflowStart.js +1 -1
  132. package/dist/types.d.ts +3 -1
  133. package/package.json +1 -1
  134. package/dist/openapi_client/models/Body_upload_file_files__resource_type___resource_id__upload_post.d.ts +0 -3
  135. package/dist/openapi_client/models/CreateTriggerRequest.d.ts +0 -13
  136. package/dist/openapi_client/models/FileInfo.d.ts +0 -14
  137. package/dist/openapi_client/models/FileInfo.js +0 -8
  138. package/dist/openapi_client/models/FileUploadResponse.d.ts +0 -6
  139. package/dist/openapi_client/models/FlowInstallResponse.d.ts +0 -15
  140. package/dist/openapi_client/models/GrantPermissionRequest.d.ts +0 -6
  141. package/dist/openapi_client/models/PodFlowConfigItem.d.ts +0 -7
  142. package/dist/openapi_client/models/PodPermissionsResponse.d.ts +0 -4
  143. package/dist/openapi_client/models/ResourceFileListResponse.d.ts +0 -6
  144. package/dist/openapi_client/models/ResourcePermissionListResponse.d.ts +0 -4
  145. package/dist/openapi_client/models/ResourcePermissionResponse.d.ts +0 -12
  146. package/dist/openapi_client/models/ResourceType.d.ts +0 -4
  147. package/dist/openapi_client/models/ResourceType.js +0 -9
  148. package/dist/openapi_client/models/SetVisibilityRequest.d.ts +0 -3
  149. package/dist/openapi_client/models/TriggerListResponse.d.ts +0 -9
  150. package/dist/openapi_client/models/TriggerType.js +0 -13
  151. package/dist/openapi_client/models/UpdateTriggerRequest.d.ts +0 -9
  152. package/dist/openapi_client/models/WorkflowInstallListResponse.d.ts +0 -4
  153. package/dist/openapi_client/models/WorkflowInstallMode.d.ts +0 -7
  154. package/dist/openapi_client/models/WorkflowInstallMode.js +0 -12
  155. package/dist/openapi_client/models/WorkflowInstallRequest.d.ts +0 -11
  156. package/dist/openapi_client/models/WorkflowTimeInstallConfig.d.ts +0 -19
  157. package/dist/openapi_client/services/AgentFilesService.d.ts +0 -46
  158. package/dist/openapi_client/services/AgentFilesService.js +0 -103
  159. package/dist/openapi_client/services/AuthorizationService.d.ts +0 -58
  160. package/dist/openapi_client/services/AuthorizationService.js +0 -122
  161. package/dist/openapi_client/services/TriggersService.d.ts +0 -53
  162. package/dist/openapi_client/services/TriggersService.js +0 -109
  163. /package/dist/openapi_client/models/{Body_upload_file_files__resource_type___resource_id__upload_post.js → BillingHistoryResponse.js} +0 -0
  164. /package/dist/openapi_client/models/{CreateTriggerRequest.js → BillingInvoiceResponse.js} +0 -0
  165. /package/dist/openapi_client/models/{FileUploadResponse.js → CreateInvoicePaymentUrlRequest.js} +0 -0
  166. /package/dist/openapi_client/models/{FlowInstallResponse.js → CreateInvoicePaymentUrlResponse.js} +0 -0
  167. /package/dist/openapi_client/models/{GrantPermissionRequest.js → CreateScheduleRequest.js} +0 -0
  168. /package/dist/openapi_client/models/{PodFlowConfigItem.js → FunctionTableAccessEntry.js} +0 -0
  169. /package/dist/openapi_client/models/{PodPermissionsResponse.js → PodRoleCreateRequest.js} +0 -0
  170. /package/dist/openapi_client/models/{ResourceFileListResponse.js → PodRoleListResponse.js} +0 -0
  171. /package/dist/openapi_client/models/{ResourcePermissionListResponse.js → PodRoleResponse.js} +0 -0
  172. /package/dist/openapi_client/models/{ResourcePermissionResponse.js → ScheduleListResponse.js} +0 -0
  173. /package/dist/openapi_client/models/{SetVisibilityRequest.js → ScheduleResponse.js} +0 -0
  174. /package/dist/openapi_client/models/{TriggerListResponse.js → StartTeamBillingRequest.js} +0 -0
  175. /package/dist/openapi_client/models/{TriggerResponse.js → SubscriptionResponse.js} +0 -0
  176. /package/dist/openapi_client/models/{UpdateTriggerRequest.js → TableAccessEntry.js} +0 -0
  177. /package/dist/openapi_client/models/{WorkflowInstallListResponse.js → UpdateScheduleRequest.js} +0 -0
  178. /package/dist/openapi_client/models/{WorkflowInstallRequest.js → UsageLimitScopeResponse.js} +0 -0
  179. /package/dist/openapi_client/models/{WorkflowTimeInstallConfig.js → UsageLimitsResponse.js} +0 -0
  180. /package/dist/openapi_client/models/{app__modules__agent__domain__value_objects__TableAccessEntry.js → UsageListResponse.js} +0 -0
  181. /package/dist/openapi_client/models/{app__modules__function__api__schemas__function_schemas__TableAccessEntry.js → UsageStatsBucketResponse.js} +0 -0
@@ -1,6 +1,31 @@
1
1
  import { OpenAPI } from '../core/OpenAPI.js';
2
2
  import { request as __request } from '../core/request.js';
3
3
  export class WorkflowsService {
4
+ /**
5
+ * List Workflow Runs Waiting For Current User
6
+ * List active human form waits assigned to the current pod member.
7
+ * @param podId
8
+ * @param limit
9
+ * @param pageToken
10
+ * @returns WorkflowRunWaitAssignmentListResponse Successful Response
11
+ * @throws ApiError
12
+ */
13
+ static workflowRunWaitingAssignedToMe(podId, limit = 100, pageToken) {
14
+ return __request(OpenAPI, {
15
+ method: 'GET',
16
+ url: '/pods/{pod_id}/workflow-runs/waiting/assigned-to-me',
17
+ path: {
18
+ 'pod_id': podId,
19
+ },
20
+ query: {
21
+ 'limit': limit,
22
+ 'page_token': pageToken,
23
+ },
24
+ errors: {
25
+ 422: `Validation Error`,
26
+ },
27
+ });
28
+ }
4
29
  /**
5
30
  * Get Workflow Run
6
31
  * Get current state, context, and step history of a workflow run.
@@ -185,7 +210,7 @@ export class WorkflowsService {
185
210
  }
186
211
  /**
187
212
  * Update Workflow Metadata
188
- * Update workflow-level metadata such as description/install mode. Workflow names are immutable after creation. Use `workflow.graph.update` for nodes and edges.
213
+ * Update workflow-level metadata such as description and schedule mode. Workflow names are immutable after creation. Use `workflow.graph.update` for nodes and edges.
189
214
  * @param podId
190
215
  * @param workflowName
191
216
  * @param requestBody
@@ -231,74 +256,6 @@ export class WorkflowsService {
231
256
  },
232
257
  });
233
258
  }
234
- /**
235
- * Install Workflow
236
- * Install a workflow for runtime execution. Provide `account_id` when the workflow needs an integration account binding, and provide `schedule` when installing a scheduled workflow.
237
- * @param podId
238
- * @param workflowName
239
- * @param requestBody
240
- * @returns FlowInstallResponse Successful Response
241
- * @throws ApiError
242
- */
243
- static workflowInstallCreate(podId, workflowName, requestBody) {
244
- return __request(OpenAPI, {
245
- method: 'POST',
246
- url: '/pods/{pod_id}/workflows/{workflow_name}/install',
247
- path: {
248
- 'pod_id': podId,
249
- 'workflow_name': workflowName,
250
- },
251
- body: requestBody,
252
- mediaType: 'application/json',
253
- errors: {
254
- 422: `Validation Error`,
255
- },
256
- });
257
- }
258
- /**
259
- * List Workflow Installs
260
- * List workflow installations visible to the current user. `GLOBAL` workflows return the pod-level install; `USER` workflows return the current user's install.
261
- * @param podId
262
- * @param workflowName
263
- * @returns WorkflowInstallListResponse Successful Response
264
- * @throws ApiError
265
- */
266
- static workflowInstallList(podId, workflowName) {
267
- return __request(OpenAPI, {
268
- method: 'GET',
269
- url: '/pods/{pod_id}/workflows/{workflow_name}/installs',
270
- path: {
271
- 'pod_id': podId,
272
- 'workflow_name': workflowName,
273
- },
274
- errors: {
275
- 422: `Validation Error`,
276
- },
277
- });
278
- }
279
- /**
280
- * Uninstall Workflow
281
- * Remove a previously created workflow installation binding.
282
- * @param podId
283
- * @param workflowName
284
- * @param installId
285
- * @returns void
286
- * @throws ApiError
287
- */
288
- static workflowInstallDelete(podId, workflowName, installId) {
289
- return __request(OpenAPI, {
290
- method: 'DELETE',
291
- url: '/pods/{pod_id}/workflows/{workflow_name}/installs/{install_id}',
292
- path: {
293
- 'pod_id': podId,
294
- 'workflow_name': workflowName,
295
- 'install_id': installId,
296
- },
297
- errors: {
298
- 422: `Validation Error`,
299
- },
300
- });
301
- }
302
259
  /**
303
260
  * Start Workflow
304
261
  * Start a new workflow run. For event/scheduled/datastore starts, the request body is treated as initial trigger payload and merged into execution context.
@@ -98,7 +98,7 @@ export function AuthGuard({ client, children, loadingFallback = null, unauthenti
98
98
  setMembershipError(null);
99
99
  try {
100
100
  const currentUser = await client.users.current();
101
- await client.podMembers.get(client.podId, currentUser.id);
101
+ await client.podMembers.lookupByUserId(client.podId, currentUser.id);
102
102
  setMembershipState("member");
103
103
  setJoinRequest(null);
104
104
  return;
@@ -85,13 +85,21 @@ export type { UseRecordFormOptions, UseRecordFormResult } from "./useRecordForm.
85
85
  export { useSchemaForm } from "./useSchemaForm.js";
86
86
  export type { UseSchemaFormOptions, UseSchemaFormResult } from "./useSchemaForm.js";
87
87
  export { useAssistantController } from "./useAssistantController.js";
88
- export type { AssistantAction, AssistantConversationScope, AssistantMessagePart, AssistantRenderableMessage, AssistantToolInvocation, UseAssistantControllerOptions, UseAssistantControllerResult, } from "./useAssistantController.js";
88
+ export type { AssistantAction, AssistantConversationScope, AssistantMessagePart, AssistantRenderableMessage, AssistantToolInvocation, SendAssistantControllerMessageOptions, UseAssistantControllerOptions, UseAssistantControllerResult, } from "./useAssistantController.js";
89
89
  export { useFunctionSession } from "./useFunctionSession.js";
90
90
  export type { UseFunctionSessionOptions, UseFunctionSessionResult, } from "./useFunctionSession.js";
91
91
  export { useFunctionRun } from "./useFunctionRun.js";
92
92
  export type { UseFunctionRunOptions, UseFunctionRunResult } from "./useFunctionRun.js";
93
93
  export { useFunctionRuns } from "./useFunctionRuns.js";
94
94
  export type { UseFunctionRunsOptions, UseFunctionRunsResult } from "./useFunctionRuns.js";
95
+ export { useSchedules } from "./useSchedules.js";
96
+ export type { UseSchedulesOptions, UseSchedulesResult } from "./useSchedules.js";
97
+ export { useCreateSchedule } from "./useCreateSchedule.js";
98
+ export type { UseCreateScheduleOptions, UseCreateScheduleResult } from "./useCreateSchedule.js";
99
+ export { useUpdateSchedule } from "./useUpdateSchedule.js";
100
+ export type { UseUpdateScheduleOptions, UseUpdateScheduleResult } from "./useUpdateSchedule.js";
101
+ export { useDeleteSchedule } from "./useDeleteSchedule.js";
102
+ export type { UseDeleteScheduleOptions, UseDeleteScheduleResult } from "./useDeleteSchedule.js";
95
103
  export { useFlowSession } from "./useFlowSession.js";
96
104
  export type { UseFlowSessionOptions, UseFlowSessionResult, } from "./useFlowSession.js";
97
105
  export { useWorkflowStart } from "./useWorkflowStart.js";
@@ -100,6 +108,8 @@ export { useWorkflowRun } from "./useWorkflowRun.js";
100
108
  export type { UseWorkflowRunOptions, UseWorkflowRunResult } from "./useWorkflowRun.js";
101
109
  export { useWorkflowRuns } from "./useWorkflowRuns.js";
102
110
  export type { UseWorkflowRunsOptions, UseWorkflowRunsResult } from "./useWorkflowRuns.js";
111
+ export { useWorkflowRunWaitAssignments } from "./useWorkflowRunWaitAssignments.js";
112
+ export type { UseWorkflowRunWaitAssignmentsOptions, UseWorkflowRunWaitAssignmentsResult, } from "./useWorkflowRunWaitAssignments.js";
103
113
  export { useWorkflowResume } from "./useWorkflowResume.js";
104
114
  export type { UseWorkflowResumeOptions, UseWorkflowResumeResult, } from "./useWorkflowResume.js";
105
115
  export { useFlowRunHistory } from "./useFlowRunHistory.js";
@@ -45,9 +45,14 @@ export { useAssistantController } from "./useAssistantController.js";
45
45
  export { useFunctionSession } from "./useFunctionSession.js";
46
46
  export { useFunctionRun } from "./useFunctionRun.js";
47
47
  export { useFunctionRuns } from "./useFunctionRuns.js";
48
+ export { useSchedules } from "./useSchedules.js";
49
+ export { useCreateSchedule } from "./useCreateSchedule.js";
50
+ export { useUpdateSchedule } from "./useUpdateSchedule.js";
51
+ export { useDeleteSchedule } from "./useDeleteSchedule.js";
48
52
  export { useFlowSession } from "./useFlowSession.js";
49
53
  export { useWorkflowStart } from "./useWorkflowStart.js";
50
54
  export { useWorkflowRun } from "./useWorkflowRun.js";
51
55
  export { useWorkflowRuns } from "./useWorkflowRuns.js";
56
+ export { useWorkflowRunWaitAssignments } from "./useWorkflowRunWaitAssignments.js";
52
57
  export { useWorkflowResume } from "./useWorkflowResume.js";
53
58
  export { useFlowRunHistory } from "./useFlowRunHistory.js";
@@ -57,6 +57,12 @@ export interface AssistantAction {
57
57
  export interface UseAssistantControllerOptions extends AssistantConversationScope {
58
58
  client: LemmaClient;
59
59
  enabled?: boolean;
60
+ instructions?: string | null;
61
+ }
62
+ export interface SendAssistantControllerMessageOptions {
63
+ forceNewConversation?: boolean;
64
+ metadata?: Record<string, unknown> | null;
65
+ instructions?: string | null;
60
66
  }
61
67
  export interface UseAssistantControllerResult {
62
68
  messages: AssistantRenderableMessage[];
@@ -77,9 +83,7 @@ export interface UseAssistantControllerResult {
77
83
  completedActions: AssistantAction[];
78
84
  selectConversation: (conversationId: string | null) => void;
79
85
  setConversationModel: (model: ConversationModel | null) => Promise<void>;
80
- sendMessage: (content: string, options?: {
81
- forceNewConversation?: boolean;
82
- }) => Promise<void>;
86
+ sendMessage: (content: string, options?: SendAssistantControllerMessageOptions) => Promise<void>;
83
87
  uploadFiles: (files: File[], options?: {
84
88
  deferUntilSend?: boolean;
85
89
  }) => Promise<void>;
@@ -89,4 +93,4 @@ export interface UseAssistantControllerResult {
89
93
  clearMessages: () => void;
90
94
  stop: () => void;
91
95
  }
92
- export declare function useAssistantController({ client, podId, agentName, assistantName, assistantId, organizationId, enabled, }: UseAssistantControllerOptions): UseAssistantControllerResult;
96
+ export declare function useAssistantController({ client, podId, agentName, assistantName, assistantId, organizationId, enabled, instructions, }: UseAssistantControllerOptions): UseAssistantControllerResult;
@@ -570,7 +570,7 @@ function appendPersonalFileReferences(content, files) {
570
570
  const references = formatPersonalFileReferences(files);
571
571
  return `${content}\n\nPersonal files available to this run:\n${references}`;
572
572
  }
573
- export function useAssistantController({ client, podId, agentName, assistantName, assistantId, organizationId, enabled = true, }) {
573
+ export function useAssistantController({ client, podId, agentName, assistantName, assistantId, organizationId, enabled = true, instructions, }) {
574
574
  const [localError, setLocalError] = useState(null);
575
575
  const [conversations, setConversations] = useState([]);
576
576
  const [activeConversationId, setActiveConversationId] = useState(null);
@@ -617,6 +617,7 @@ export function useAssistantController({ client, podId, agentName, assistantName
617
617
  assistantName: scope.assistantName ?? undefined,
618
618
  assistantId: scope.assistantId ?? undefined,
619
619
  organizationId: scope.organizationId ?? undefined,
620
+ instructions,
620
621
  conversationId: activeConversationId ?? undefined,
621
622
  autoLoad: false,
622
623
  onError: handleAssistantSessionError,
@@ -977,13 +978,14 @@ export function useAssistantController({ client, podId, agentName, assistantName
977
978
  const clearMessages = useCallback(() => {
978
979
  resetConversationState(false);
979
980
  }, [resetConversationState]);
980
- const ensureConversation = useCallback(async (titleSeed) => {
981
+ const ensureConversation = useCallback(async (titleSeed, options = {}) => {
981
982
  const existingConversationId = activeConversationIdRef.current;
982
983
  if (existingConversationId) {
983
984
  return existingConversationId;
984
985
  }
985
986
  const createdConversation = await sessionCreateConversation({
986
987
  title: titleSeed.slice(0, 120),
988
+ instructions: typeof options.instructions === "undefined" ? instructions : options.instructions,
987
989
  model: conversationModel,
988
990
  ...scope,
989
991
  });
@@ -1001,7 +1003,7 @@ export function useAssistantController({ client, podId, agentName, assistantName
1001
1003
  clearRuntimeMessages();
1002
1004
  setOlderMessagesCursor(null);
1003
1005
  return createdConversation.id;
1004
- }, [clearRuntimeMessages, conversationModel, scope, sessionCreateConversation]);
1006
+ }, [clearRuntimeMessages, conversationModel, instructions, scope, sessionCreateConversation]);
1005
1007
  const queuePendingFiles = useCallback((files) => {
1006
1008
  if (files.length === 0)
1007
1009
  return;
@@ -1018,11 +1020,11 @@ export function useAssistantController({ client, podId, agentName, assistantName
1018
1020
  const clearPendingFiles = useCallback(() => {
1019
1021
  setPendingFiles([]);
1020
1022
  }, []);
1021
- const sendMessage = useCallback(async (content, options) => {
1023
+ const sendMessage = useCallback(async (content, options = {}) => {
1022
1024
  const trimmed = content.trim();
1023
1025
  if (!enabled || !trimmed || isStreaming || sessionIsStreaming)
1024
1026
  return;
1025
- const forceNewConversation = options?.forceNewConversation === true;
1027
+ const forceNewConversation = options.forceNewConversation === true;
1026
1028
  setLocalError(null);
1027
1029
  if (forceNewConversation) {
1028
1030
  resetConversationState(true);
@@ -1030,7 +1032,7 @@ export function useAssistantController({ client, podId, agentName, assistantName
1030
1032
  let conversationId = forceNewConversation ? null : activeConversationId;
1031
1033
  try {
1032
1034
  if (!conversationId) {
1033
- conversationId = await ensureConversation(trimmed);
1035
+ conversationId = await ensureConversation(trimmed, { instructions: options.instructions });
1034
1036
  }
1035
1037
  if (!conversationId) {
1036
1038
  throw new Error("Conversation could not be initialized");
@@ -1057,6 +1059,7 @@ export function useAssistantController({ client, podId, agentName, assistantName
1057
1059
  touchConversation(finalConversationId, { status: "running" });
1058
1060
  await sessionSendMessage(messageContent, {
1059
1061
  conversationId: finalConversationId,
1062
+ metadata: options.metadata ?? undefined,
1060
1063
  });
1061
1064
  touchConversation(finalConversationId, { updated_at: new Date().toISOString() });
1062
1065
  }
@@ -27,6 +27,7 @@ export interface UseAssistantSessionOptions {
27
27
  */
28
28
  assistantId?: string;
29
29
  organizationId?: string;
30
+ instructions?: string | null;
30
31
  conversationId?: string | null;
31
32
  autoLoad?: boolean;
32
33
  autoResume?: boolean;
@@ -38,6 +39,7 @@ export interface UseAssistantSessionOptions {
38
39
  }
39
40
  export interface CreateConversationInput {
40
41
  title?: string | null;
42
+ instructions?: string | null;
41
43
  model?: ConversationModel | null;
42
44
  podId?: string | null;
43
45
  agentName?: string | null;
@@ -54,6 +56,7 @@ export interface CreateConversationInput {
54
56
  }
55
57
  export interface SendAssistantMessageOptions {
56
58
  conversationId?: string | null;
59
+ metadata?: Record<string, unknown> | null;
57
60
  syncOnTurnEnd?: boolean;
58
61
  }
59
62
  export interface ResumeAssistantOptions {
@@ -51,7 +51,7 @@ function resolveResumeInput(input) {
51
51
  return input ?? {};
52
52
  }
53
53
  export function useAssistantSession(options) {
54
- const { client, podId: defaultPodId, agentName: defaultAgentName, assistantName: defaultAssistantName, assistantId: defaultAssistantId, organizationId: defaultOrganizationId, conversationId: externalConversationId = null, autoLoad = true, autoResume = false, syncOnTurnEnd = false, onEvent, onStatus, onMessage, onError, } = options;
54
+ const { client, podId: defaultPodId, agentName: defaultAgentName, assistantName: defaultAssistantName, assistantId: defaultAssistantId, organizationId: defaultOrganizationId, instructions: defaultInstructions, conversationId: externalConversationId = null, autoLoad = true, autoResume = false, syncOnTurnEnd = false, onEvent, onStatus, onMessage, onError, } = options;
55
55
  const [conversationId, setConversationIdState] = useState(externalConversationId);
56
56
  const [conversation, setConversation] = useState(null);
57
57
  const [status, setStatus] = useState(undefined);
@@ -193,6 +193,9 @@ export function useAssistantSession(options) {
193
193
  const scopedClient = applyPodScope(client, input.podId ?? defaultPodId ?? null);
194
194
  const payload = {
195
195
  title: input.title ?? undefined,
196
+ instructions: typeof input.instructions === "undefined"
197
+ ? defaultInstructions ?? undefined
198
+ : input.instructions,
196
199
  pod_id: input.podId ?? defaultPodId ?? scopedClient.podId ?? undefined,
197
200
  agent_name: input.agentName
198
201
  ?? input.assistantName
@@ -228,6 +231,7 @@ export function useAssistantSession(options) {
228
231
  defaultAgentName,
229
232
  defaultAssistantId,
230
233
  defaultAssistantName,
234
+ defaultInstructions,
231
235
  defaultPodId,
232
236
  setConversationStatus,
233
237
  ]);
@@ -386,7 +390,7 @@ export function useAssistantSession(options) {
386
390
  abortRef.current = controller;
387
391
  const scope = normalizeScope(client, defaultScope);
388
392
  const scopedClient = applyPodScope(client, scope.podId);
389
- const stream = await scopedClient.conversations.sendMessageStream(resolvedConversationId, { content }, {
393
+ const stream = await scopedClient.conversations.sendMessageStream(resolvedConversationId, { content, metadata: input.metadata ?? undefined }, {
390
394
  pod_id: scope.podId ?? undefined,
391
395
  signal: controller.signal,
392
396
  });
@@ -15,6 +15,7 @@ export interface UseConversationMessagesOptions {
15
15
  */
16
16
  assistantId?: string;
17
17
  organizationId?: string;
18
+ instructions?: string | null;
18
19
  conversationId?: string | null;
19
20
  enabled?: boolean;
20
21
  autoLoad?: boolean;
@@ -60,4 +61,4 @@ export interface UseConversationMessagesResult {
60
61
  clearMessages: () => void;
61
62
  createConversation: (input?: CreateConversationInput) => Promise<Conversation>;
62
63
  }
63
- export declare function useConversationMessages({ client, podId, agentName, assistantName, assistantId, organizationId, conversationId, enabled, autoLoad, autoResume, limit, syncOnTurnEnd, onEvent, onStatus, onMessage, onError, }: UseConversationMessagesOptions): UseConversationMessagesResult;
64
+ export declare function useConversationMessages({ client, podId, agentName, assistantName, assistantId, organizationId, instructions, conversationId, enabled, autoLoad, autoResume, limit, syncOnTurnEnd, onEvent, onStatus, onMessage, onError, }: UseConversationMessagesOptions): UseConversationMessagesResult;
@@ -12,7 +12,7 @@ function isSettledStatus(status, isStreaming) {
12
12
  return true;
13
13
  return !isConversationRunningStatus(normalized);
14
14
  }
15
- export function useConversationMessages({ client, podId, agentName, assistantName, assistantId, organizationId, conversationId = null, enabled = true, autoLoad = true, autoResume = false, limit = 100, syncOnTurnEnd = false, onEvent, onStatus, onMessage, onError, }) {
15
+ export function useConversationMessages({ client, podId, agentName, assistantName, assistantId, organizationId, instructions, conversationId = null, enabled = true, autoLoad = true, autoResume = false, limit = 100, syncOnTurnEnd = false, onEvent, onStatus, onMessage, onError, }) {
16
16
  const [nextPageToken, setNextPageToken] = useState(null);
17
17
  const [isLoading, setIsLoading] = useState(false);
18
18
  const [isLoadingOlder, setIsLoadingOlder] = useState(false);
@@ -25,6 +25,7 @@ export function useConversationMessages({ client, podId, agentName, assistantNam
25
25
  assistantName,
26
26
  assistantId,
27
27
  organizationId,
28
+ instructions,
28
29
  conversationId: conversationId ?? undefined,
29
30
  autoLoad: false,
30
31
  autoResume: false,
@@ -0,0 +1,17 @@
1
+ import type { LemmaClient } from "../client.js";
2
+ import type { CreateScheduleRequest, Schedule } from "../types.js";
3
+ export interface UseCreateScheduleOptions {
4
+ client: LemmaClient;
5
+ podId?: string;
6
+ enabled?: boolean;
7
+ onSuccess?: (schedule: Schedule) => void;
8
+ onError?: (error: unknown) => void;
9
+ }
10
+ export interface UseCreateScheduleResult {
11
+ schedule: Schedule | null;
12
+ isSubmitting: boolean;
13
+ error: Error | null;
14
+ create: (payload: CreateScheduleRequest) => Promise<Schedule | null>;
15
+ reset: () => void;
16
+ }
17
+ export declare function useCreateSchedule({ client, podId, enabled, onSuccess, onError, }: UseCreateScheduleOptions): UseCreateScheduleResult;
@@ -0,0 +1,45 @@
1
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
2
+ import { normalizeError, resolvePodClient } from "./utils.js";
3
+ export function useCreateSchedule({ client, podId, enabled = true, onSuccess, onError, }) {
4
+ const [schedule, setSchedule] = useState(null);
5
+ const [isSubmitting, setIsSubmitting] = useState(false);
6
+ const [error, setError] = useState(null);
7
+ const onSuccessRef = useRef(onSuccess);
8
+ const onErrorRef = useRef(onError);
9
+ useEffect(() => { onSuccessRef.current = onSuccess; }, [onSuccess]);
10
+ useEffect(() => { onErrorRef.current = onError; }, [onError]);
11
+ const create = useCallback(async (payload) => {
12
+ if (!enabled)
13
+ return null;
14
+ setIsSubmitting(true);
15
+ setError(null);
16
+ try {
17
+ const scopedClient = resolvePodClient(client, podId);
18
+ const nextSchedule = await scopedClient.schedules.create(payload);
19
+ setSchedule(nextSchedule);
20
+ onSuccessRef.current?.(nextSchedule);
21
+ return nextSchedule;
22
+ }
23
+ catch (mutationError) {
24
+ const normalized = normalizeError(mutationError, "Failed to create schedule.");
25
+ setError(normalized);
26
+ onErrorRef.current?.(mutationError);
27
+ return null;
28
+ }
29
+ finally {
30
+ setIsSubmitting(false);
31
+ }
32
+ }, [client, enabled, podId]);
33
+ const reset = useCallback(() => {
34
+ setSchedule(null);
35
+ setError(null);
36
+ setIsSubmitting(false);
37
+ }, []);
38
+ return useMemo(() => ({
39
+ schedule,
40
+ isSubmitting,
41
+ error,
42
+ create,
43
+ reset,
44
+ }), [create, error, isSubmitting, reset, schedule]);
45
+ }
@@ -0,0 +1,19 @@
1
+ import type { LemmaClient } from "../client.js";
2
+ export interface UseDeleteScheduleOptions {
3
+ client: LemmaClient;
4
+ podId?: string;
5
+ scheduleId?: string | null;
6
+ enabled?: boolean;
7
+ onSuccess?: (scheduleId: string) => void;
8
+ onError?: (error: unknown) => void;
9
+ }
10
+ export interface UseDeleteScheduleResult {
11
+ deletedScheduleId: string | null;
12
+ isSubmitting: boolean;
13
+ error: Error | null;
14
+ remove: (overrides?: {
15
+ scheduleId?: string | null;
16
+ }) => Promise<boolean>;
17
+ reset: () => void;
18
+ }
19
+ export declare function useDeleteSchedule({ client, podId, scheduleId, enabled, onSuccess, onError, }: UseDeleteScheduleOptions): UseDeleteScheduleResult;
@@ -0,0 +1,49 @@
1
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
2
+ import { normalizeError, resolvePodClient } from "./utils.js";
3
+ export function useDeleteSchedule({ client, podId, scheduleId = null, enabled = true, onSuccess, onError, }) {
4
+ const [deletedScheduleId, setDeletedScheduleId] = useState(null);
5
+ const [isSubmitting, setIsSubmitting] = useState(false);
6
+ const [error, setError] = useState(null);
7
+ const onSuccessRef = useRef(onSuccess);
8
+ const onErrorRef = useRef(onError);
9
+ useEffect(() => { onSuccessRef.current = onSuccess; }, [onSuccess]);
10
+ useEffect(() => { onErrorRef.current = onError; }, [onError]);
11
+ const trimmedScheduleId = typeof scheduleId === "string" ? scheduleId.trim() : "";
12
+ const remove = useCallback(async (overrides = {}) => {
13
+ const nextScheduleId = typeof overrides.scheduleId === "string"
14
+ ? overrides.scheduleId.trim()
15
+ : trimmedScheduleId;
16
+ if (!enabled || nextScheduleId.length === 0)
17
+ return false;
18
+ setIsSubmitting(true);
19
+ setError(null);
20
+ try {
21
+ const scopedClient = resolvePodClient(client, podId);
22
+ await scopedClient.schedules.delete(nextScheduleId);
23
+ setDeletedScheduleId(nextScheduleId);
24
+ onSuccessRef.current?.(nextScheduleId);
25
+ return true;
26
+ }
27
+ catch (mutationError) {
28
+ const normalized = normalizeError(mutationError, "Failed to delete schedule.");
29
+ setError(normalized);
30
+ onErrorRef.current?.(mutationError);
31
+ return false;
32
+ }
33
+ finally {
34
+ setIsSubmitting(false);
35
+ }
36
+ }, [client, enabled, podId, trimmedScheduleId]);
37
+ const reset = useCallback(() => {
38
+ setDeletedScheduleId(null);
39
+ setError(null);
40
+ setIsSubmitting(false);
41
+ }, []);
42
+ return useMemo(() => ({
43
+ deletedScheduleId,
44
+ isSubmitting,
45
+ error,
46
+ remove,
47
+ reset,
48
+ }), [deletedScheduleId, error, isSubmitting, remove, reset]);
49
+ }
@@ -30,7 +30,7 @@ export function usePodAccess({ client, podId, enabled = true, autoLoad = true, }
30
30
  const currentUser = await client.users.current();
31
31
  setUser(currentUser);
32
32
  try {
33
- const nextMember = await client.podMembers.get(resolvedPodId, currentUser.id);
33
+ const nextMember = await client.podMembers.lookupByUserId(resolvedPodId, currentUser.id);
34
34
  setMember(nextMember);
35
35
  setJoinRequest(null);
36
36
  setStatus("member");
@@ -0,0 +1,30 @@
1
+ import type { LemmaClient } from "../client.js";
2
+ import type { Schedule, ScheduleType } from "../types.js";
3
+ export interface UseSchedulesOptions {
4
+ client: LemmaClient;
5
+ podId?: string;
6
+ enabled?: boolean;
7
+ autoLoad?: boolean;
8
+ scheduleType?: ScheduleType | null;
9
+ isActive?: boolean | null;
10
+ agentName?: string | null;
11
+ workflowName?: string | null;
12
+ limit?: number;
13
+ pageToken?: string | null;
14
+ }
15
+ export interface UseSchedulesResult {
16
+ schedules: Schedule[];
17
+ total: number;
18
+ nextPageToken: string | null;
19
+ isLoading: boolean;
20
+ isLoadingMore: boolean;
21
+ error: Error | null;
22
+ refresh: (overrides?: {
23
+ limit?: number;
24
+ pageToken?: string | null;
25
+ }) => Promise<Schedule[]>;
26
+ loadMore: (overrides?: {
27
+ limit?: number;
28
+ }) => Promise<Schedule[]>;
29
+ }
30
+ export declare function useSchedules({ client, podId, enabled, autoLoad, scheduleType, isActive, agentName, workflowName, limit, pageToken, }: UseSchedulesOptions): UseSchedulesResult;