lemma-sdk 0.2.44 → 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.
Files changed (273) hide show
  1. package/README.md +1 -1
  2. package/dist/assistant-events.d.ts +1 -0
  3. package/dist/assistant-events.js +25 -0
  4. package/dist/browser/lemma-client.js +264 -152
  5. package/dist/config.d.ts +2 -2
  6. package/dist/config.js +2 -2
  7. package/dist/hey_client/client/client.gen.d.ts +2 -0
  8. package/dist/hey_client/client/client.gen.js +216 -0
  9. package/dist/hey_client/client/index.d.ts +10 -0
  10. package/dist/hey_client/client/index.js +6 -0
  11. package/dist/hey_client/client/types.gen.d.ts +120 -0
  12. package/dist/hey_client/client/types.gen.js +2 -0
  13. package/dist/hey_client/client/utils.gen.d.ts +37 -0
  14. package/dist/hey_client/client/utils.gen.js +228 -0
  15. package/dist/hey_client/client.gen.d.ts +12 -0
  16. package/dist/hey_client/client.gen.js +3 -0
  17. package/dist/hey_client/core/auth.gen.d.ts +25 -0
  18. package/dist/hey_client/core/auth.gen.js +14 -0
  19. package/dist/hey_client/core/bodySerializer.gen.d.ts +25 -0
  20. package/dist/hey_client/core/bodySerializer.gen.js +57 -0
  21. package/dist/hey_client/core/params.gen.d.ts +43 -0
  22. package/dist/hey_client/core/params.gen.js +100 -0
  23. package/dist/hey_client/core/pathSerializer.gen.d.ts +33 -0
  24. package/dist/hey_client/core/pathSerializer.gen.js +106 -0
  25. package/dist/hey_client/core/queryKeySerializer.gen.d.ts +18 -0
  26. package/dist/hey_client/core/queryKeySerializer.gen.js +92 -0
  27. package/dist/hey_client/core/serverSentEvents.gen.d.ts +71 -0
  28. package/dist/hey_client/core/serverSentEvents.gen.js +132 -0
  29. package/dist/hey_client/core/types.gen.d.ts +83 -0
  30. package/dist/hey_client/core/types.gen.js +2 -0
  31. package/dist/hey_client/core/utils.gen.d.ts +19 -0
  32. package/dist/hey_client/core/utils.gen.js +87 -0
  33. package/dist/hey_client/index.d.ts +2 -0
  34. package/dist/hey_client/index.js +2 -0
  35. package/dist/hey_client/sdk.gen.d.ts +1005 -0
  36. package/dist/hey_client/sdk.gen.js +1438 -0
  37. package/dist/hey_client/types.gen.d.ts +13004 -0
  38. package/dist/hey_client/types.gen.js +2 -0
  39. package/dist/namespaces/files.d.ts +6 -24
  40. package/dist/namespaces/files.js +6 -16
  41. package/dist/namespaces/integrations.js +4 -4
  42. package/dist/namespaces/pod-surfaces.d.ts +8 -3
  43. package/dist/namespaces/pod-surfaces.js +15 -6
  44. package/dist/namespaces/pods.d.ts +2 -3
  45. package/dist/namespaces/pods.js +1 -6
  46. package/dist/namespaces/records.d.ts +7 -7
  47. package/dist/namespaces/resource-access.d.ts +3 -3
  48. package/dist/namespaces/resource-access.js +6 -6
  49. package/dist/namespaces/schedules.d.ts +1 -0
  50. package/dist/namespaces/schedules.js +1 -1
  51. package/dist/namespaces/tables.d.ts +2 -2
  52. package/dist/namespaces/workflows.d.ts +12 -8
  53. package/dist/namespaces/workflows.js +9 -18
  54. package/dist/openapi_client/index.d.ts +20 -37
  55. package/dist/openapi_client/index.js +3 -11
  56. package/dist/openapi_client/models/AgentHarnessInfo.d.ts +2 -0
  57. package/dist/openapi_client/models/AgentNode.d.ts +1 -1
  58. package/dist/openapi_client/models/AgentNodeConfig.d.ts +1 -1
  59. package/dist/openapi_client/models/AgentResourcePermissionRequest.d.ts +1 -1
  60. package/dist/openapi_client/models/AgentResourcePermissionResponse.d.ts +1 -1
  61. package/dist/openapi_client/models/AgentRuntimeProfileResponse.d.ts +6 -0
  62. package/dist/openapi_client/models/AgentSurfaceResponse.d.ts +6 -17
  63. package/dist/openapi_client/models/AgentSurfaceStatus.d.ts +3 -1
  64. package/dist/openapi_client/models/AgentSurfaceStatus.js +2 -0
  65. package/dist/openapi_client/models/ApplicationSkillResponse.d.ts +6 -0
  66. package/dist/openapi_client/models/ConnectedAccountSummary.d.ts +7 -0
  67. package/dist/openapi_client/models/CreateFunctionRequest.d.ts +0 -1
  68. package/dist/openapi_client/models/CreateScheduleRequest.d.ts +4 -0
  69. package/dist/openapi_client/models/CreateSurfaceRequest.d.ts +3 -10
  70. package/dist/openapi_client/models/CreateUserDaemonRuntimeProfileRequest.d.ts +2 -0
  71. package/dist/openapi_client/models/DataStoreFlowStartInput.d.ts +1 -1
  72. package/dist/openapi_client/models/DataStoreFlowStartOutput.d.ts +1 -1
  73. package/dist/openapi_client/models/DatastoreCountResponse.d.ts +6 -0
  74. package/dist/openapi_client/models/DecisionNode.d.ts +2 -1
  75. package/dist/openapi_client/models/DecisionRule.d.ts +3 -0
  76. package/dist/openapi_client/models/EndNode.d.ts +1 -1
  77. package/dist/openapi_client/models/ExpressionInputBinding.d.ts +6 -2
  78. package/dist/openapi_client/models/FileListResponse.d.ts +1 -0
  79. package/dist/openapi_client/models/FileSearchResponse.d.ts +2 -2
  80. package/dist/openapi_client/models/FlowRunStatus.d.ts +4 -1
  81. package/dist/openapi_client/models/FlowRunStatus.js +4 -1
  82. package/dist/openapi_client/models/FormNode.d.ts +2 -1
  83. package/dist/openapi_client/models/FormNodeConfig.d.ts +1 -1
  84. package/dist/openapi_client/models/FunctionNode.d.ts +2 -1
  85. package/dist/openapi_client/models/FunctionResourcePermissionRequest.d.ts +1 -1
  86. package/dist/openapi_client/models/FunctionResourcePermissionResponse.d.ts +1 -1
  87. package/dist/openapi_client/models/InstalledAppSummary.d.ts +7 -0
  88. package/dist/openapi_client/models/IntegrationStatusResponse.d.ts +6 -0
  89. package/dist/openapi_client/models/LoopNode.d.ts +2 -1
  90. package/dist/openapi_client/models/LoopNodeConfig.d.ts +3 -3
  91. package/dist/openapi_client/models/PodMemberAddRequest.d.ts +1 -3
  92. package/dist/openapi_client/models/PodMemberDetailResponse.d.ts +0 -2
  93. package/dist/openapi_client/models/PodMemberResponse.d.ts +0 -2
  94. package/dist/openapi_client/models/PodMemberUpdateRoleRequest.d.ts +1 -3
  95. package/dist/openapi_client/models/PodRoleResourcePermissionRequest.d.ts +1 -1
  96. package/dist/openapi_client/models/PodRoleResourcePermissionResponse.d.ts +1 -1
  97. package/dist/openapi_client/models/ResourceAccessGrantResponse.d.ts +1 -1
  98. package/dist/openapi_client/models/ResourceAccessResponse.d.ts +1 -1
  99. package/dist/openapi_client/models/RuntimeProfileScope.d.ts +2 -1
  100. package/dist/openapi_client/models/RuntimeProfileScope.js +1 -0
  101. package/dist/openapi_client/models/ScheduleDetailResponse.d.ts +6 -0
  102. package/dist/openapi_client/models/ScheduleFireStatus.d.ts +8 -0
  103. package/dist/openapi_client/models/ScheduleFireStatus.js +13 -0
  104. package/dist/openapi_client/models/StepRecordResponse.d.ts +10 -0
  105. package/dist/openapi_client/models/StepStatus.d.ts +7 -0
  106. package/dist/openapi_client/models/StepStatus.js +12 -0
  107. package/dist/openapi_client/models/SurfaceBehaviorConfigInput.d.ts +4 -0
  108. package/dist/openapi_client/models/SurfaceChannelRouteInput.d.ts +6 -0
  109. package/dist/openapi_client/models/SurfaceChannelRouteResponse.d.ts +6 -0
  110. package/dist/openapi_client/models/SurfaceConfigResponse.d.ts +10 -0
  111. package/dist/openapi_client/models/SurfaceCredentialMode.d.ts +4 -0
  112. package/dist/openapi_client/models/SurfaceCredentialMode.js +9 -0
  113. package/dist/openapi_client/models/SurfaceIdentityConfigInput.d.ts +4 -0
  114. package/dist/openapi_client/models/SurfaceIdentityConfigResponse.d.ts +4 -0
  115. package/dist/openapi_client/models/SurfaceSetupStatusResponse.d.ts +10 -0
  116. package/dist/openapi_client/models/TableListResponse.d.ts +2 -0
  117. package/dist/openapi_client/models/ToggleSurfaceRequest.d.ts +1 -1
  118. package/dist/openapi_client/models/UpdateScheduleRequest.d.ts +1 -0
  119. package/dist/openapi_client/models/UpdateSurfaceChannelsRequest.d.ts +4 -0
  120. package/dist/openapi_client/models/UpdateSurfaceRequest.d.ts +4 -11
  121. package/dist/openapi_client/models/UpsertSurfaceRequest.d.ts +9 -0
  122. package/dist/openapi_client/models/UserProfileRequest.d.ts +1 -0
  123. package/dist/openapi_client/models/UserResponse.d.ts +1 -0
  124. package/dist/openapi_client/models/WaitUntilNode.d.ts +1 -1
  125. package/dist/openapi_client/models/WorkflowCreateRequest.d.ts +16 -0
  126. package/dist/openapi_client/models/WorkflowRunFormSubmitRequest.d.ts +13 -0
  127. package/dist/openapi_client/models/WorkflowRunResponse.d.ts +28 -0
  128. package/dist/openapi_client/models/WorkflowRunSummaryResponse.d.ts +2 -3
  129. package/dist/openapi_client/models/WorkflowRunWaitAssignment.d.ts +4 -4
  130. package/dist/openapi_client/models/{WorkflowRunWaitEntity.d.ts → WorkflowRunWaitResponse.d.ts} +4 -8
  131. package/dist/openapi_client/models/WorkflowRunWaitType.d.ts +1 -2
  132. package/dist/openapi_client/models/WorkflowRunWaitType.js +0 -1
  133. package/dist/openapi_client/models/WorkspaceAppAccessRequest.d.ts +0 -3
  134. package/dist/openapi_client/models/WorkspaceMeSandbox.d.ts +1 -4
  135. package/dist/openapi_client/services/AgentSurfacesService.d.ts +39 -10
  136. package/dist/openapi_client/services/AgentSurfacesService.js +86 -20
  137. package/dist/openapi_client/services/ApplicationsService.d.ts +10 -0
  138. package/dist/openapi_client/services/ApplicationsService.js +23 -0
  139. package/dist/openapi_client/services/FilesService.d.ts +2 -3
  140. package/dist/openapi_client/services/FilesService.js +1 -1
  141. package/dist/openapi_client/services/FunctionsService.d.ts +1 -1
  142. package/dist/openapi_client/services/FunctionsService.js +1 -1
  143. package/dist/openapi_client/services/IntegrationsService.d.ts +12 -4
  144. package/dist/openapi_client/services/IntegrationsService.js +22 -4
  145. package/dist/openapi_client/services/PodResourceAccessService.d.ts +6 -6
  146. package/dist/openapi_client/services/PodResourceAccessService.js +12 -12
  147. package/dist/openapi_client/services/RecordsService.d.ts +21 -22
  148. package/dist/openapi_client/services/RecordsService.js +13 -13
  149. package/dist/openapi_client/services/SchedulesService.d.ts +2 -1
  150. package/dist/openapi_client/services/SchedulesService.js +3 -1
  151. package/dist/openapi_client/services/TablesService.d.ts +4 -5
  152. package/dist/openapi_client/services/TablesService.js +2 -2
  153. package/dist/openapi_client/services/WorkflowsService.d.ts +35 -26
  154. package/dist/openapi_client/services/WorkflowsService.js +57 -39
  155. package/dist/react/useAddPodMember.js +1 -1
  156. package/dist/react/useAssistantController.d.ts +1 -0
  157. package/dist/react/useAssistantController.js +5 -1
  158. package/dist/react/useAssistantSession.d.ts +1 -0
  159. package/dist/react/useAssistantSession.js +41 -0
  160. package/dist/react/useBulkRecords.d.ts +5 -5
  161. package/dist/react/useBulkRecords.js +5 -5
  162. package/dist/react/useCreateFolder.d.ts +2 -4
  163. package/dist/react/useCreateFolder.js +2 -3
  164. package/dist/react/useCreateRecord.d.ts +2 -2
  165. package/dist/react/useCreateRecord.js +1 -1
  166. package/dist/react/useDeleteFile.d.ts +1 -4
  167. package/dist/react/useDeleteFile.js +3 -3
  168. package/dist/react/useDeleteRecord.d.ts +1 -2
  169. package/dist/react/useDeleteRecord.js +3 -3
  170. package/dist/react/useFile.d.ts +2 -4
  171. package/dist/react/useFile.js +3 -3
  172. package/dist/react/useFilePreview.d.ts +1 -4
  173. package/dist/react/useFilePreview.js +4 -5
  174. package/dist/react/useFileSearch.d.ts +5 -1
  175. package/dist/react/useFileSearch.js +6 -4
  176. package/dist/react/useFileTree.d.ts +2 -4
  177. package/dist/react/useFileTree.js +2 -3
  178. package/dist/react/useFiles.d.ts +2 -4
  179. package/dist/react/useFiles.js +3 -5
  180. package/dist/react/useFlowSession.d.ts +3 -1
  181. package/dist/react/useFlowSession.js +24 -17
  182. package/dist/react/useGlobalSearch.js +1 -1
  183. package/dist/react/useRecord.d.ts +2 -2
  184. package/dist/react/useRecord.js +1 -1
  185. package/dist/react/useRecordForm.d.ts +2 -2
  186. package/dist/react/useRecordForm.js +2 -2
  187. package/dist/react/useReverseRelatedRecords.js +1 -1
  188. package/dist/react/useUpdateFile.d.ts +2 -4
  189. package/dist/react/useUpdateFile.js +2 -3
  190. package/dist/react/useUpdateRecord.d.ts +2 -2
  191. package/dist/react/useUpdateRecord.js +1 -1
  192. package/dist/react/useUploadFile.d.ts +2 -4
  193. package/dist/react/useUploadFile.js +2 -3
  194. package/dist/react/useWorkflowResume.d.ts +1 -0
  195. package/dist/react/useWorkflowResume.js +10 -1
  196. package/dist/react/useWorkflowRun.js +1 -3
  197. package/dist/react/useWorkflowStart.js +11 -26
  198. package/dist/react/utils.js +2 -0
  199. package/dist/types.d.ts +3 -3
  200. package/package.json +7 -2
  201. package/dist/openapi_client/models/BillingHistoryResponse.d.ts +0 -8
  202. package/dist/openapi_client/models/BillingInterval.d.ts +0 -7
  203. package/dist/openapi_client/models/BillingInterval.js +0 -12
  204. package/dist/openapi_client/models/BillingInvoiceResponse.d.ts +0 -27
  205. package/dist/openapi_client/models/BillingInvoiceStatus.d.ts +0 -10
  206. package/dist/openapi_client/models/BillingInvoiceStatus.js +0 -15
  207. package/dist/openapi_client/models/CancelSubscriptionResponse.d.ts +0 -10
  208. package/dist/openapi_client/models/CreateInvoicePaymentUrlRequest.d.ts +0 -7
  209. package/dist/openapi_client/models/CreateInvoicePaymentUrlResponse.d.ts +0 -8
  210. package/dist/openapi_client/models/DatastoreMessageResponse.d.ts +0 -6
  211. package/dist/openapi_client/models/DeskServingConfigResponse.d.ts +0 -11
  212. package/dist/openapi_client/models/DeskServingConfigResponse.js +0 -8
  213. package/dist/openapi_client/models/FlowRunEntity.d.ts +0 -36
  214. package/dist/openapi_client/models/GmailSurfaceConfig.d.ts +0 -7
  215. package/dist/openapi_client/models/OutlookSurfaceConfig.d.ts +0 -7
  216. package/dist/openapi_client/models/PlanListResponse.d.ts +0 -8
  217. package/dist/openapi_client/models/PlanResponse.d.ts +0 -18
  218. package/dist/openapi_client/models/PlanType.d.ts +0 -7
  219. package/dist/openapi_client/models/PlanType.js +0 -12
  220. package/dist/openapi_client/models/RecordResponse.d.ts +0 -9
  221. package/dist/openapi_client/models/SeatInfoResponse.d.ts +0 -10
  222. package/dist/openapi_client/models/SlackSurfaceConfig.d.ts +0 -7
  223. package/dist/openapi_client/models/StackFrame.d.ts +0 -11
  224. package/dist/openapi_client/models/StartSubscriptionRequest.d.ts +0 -14
  225. package/dist/openapi_client/models/StartSubscriptionResponse.d.ts +0 -9
  226. package/dist/openapi_client/models/StartTeamBillingRequest.d.ts +0 -6
  227. package/dist/openapi_client/models/StartTeamBillingRequest.js +0 -1
  228. package/dist/openapi_client/models/StepExecution.d.ts +0 -13
  229. package/dist/openapi_client/models/StepExecution.js +0 -1
  230. package/dist/openapi_client/models/SubscriptionResponse.d.ts +0 -22
  231. package/dist/openapi_client/models/SubscriptionResponse.js +0 -1
  232. package/dist/openapi_client/models/SubscriptionStatus.d.ts +0 -10
  233. package/dist/openapi_client/models/SubscriptionStatus.js +0 -15
  234. package/dist/openapi_client/models/SubscriptionStatusResponse.d.ts +0 -10
  235. package/dist/openapi_client/models/SubscriptionStatusResponse.js +0 -1
  236. package/dist/openapi_client/models/SubscriptionWithPlanResponse.d.ts +0 -22
  237. package/dist/openapi_client/models/SubscriptionWithPlanResponse.js +0 -1
  238. package/dist/openapi_client/models/SurfaceEventMode.d.ts +0 -6
  239. package/dist/openapi_client/models/SurfaceEventMode.js +0 -11
  240. package/dist/openapi_client/models/SurfaceMode.d.ts +0 -5
  241. package/dist/openapi_client/models/SurfaceMode.js +0 -10
  242. package/dist/openapi_client/models/SurfaceRoutingScope.d.ts +0 -4
  243. package/dist/openapi_client/models/SurfaceRoutingScope.js +0 -9
  244. package/dist/openapi_client/models/TeamsSurfaceConfig.d.ts +0 -7
  245. package/dist/openapi_client/models/TeamsSurfaceConfig.js +0 -1
  246. package/dist/openapi_client/models/TelegramSurfaceConfig.d.ts +0 -7
  247. package/dist/openapi_client/models/TelegramSurfaceConfig.js +0 -1
  248. package/dist/openapi_client/models/WhatsAppSurfaceConfig.d.ts +0 -7
  249. package/dist/openapi_client/models/WhatsAppSurfaceConfig.js +0 -1
  250. package/dist/openapi_client/models/WorkflowRunWaitEntity.js +0 -1
  251. package/dist/openapi_client/services/BillingSubscriptionsService.d.ts +0 -117
  252. package/dist/openapi_client/services/BillingSubscriptionsService.js +0 -230
  253. package/dist/openapi_client/services/BillingWebhooksService.d.ts +0 -12
  254. package/dist/openapi_client/services/BillingWebhooksService.js +0 -25
  255. package/dist/openapi_client/services/PublicDesksService.d.ts +0 -10
  256. package/dist/openapi_client/services/PublicDesksService.js +0 -15
  257. /package/dist/openapi_client/models/{BillingHistoryResponse.js → ApplicationSkillResponse.js} +0 -0
  258. /package/dist/openapi_client/models/{BillingInvoiceResponse.js → ConnectedAccountSummary.js} +0 -0
  259. /package/dist/openapi_client/models/{CancelSubscriptionResponse.js → DatastoreCountResponse.js} +0 -0
  260. /package/dist/openapi_client/models/{CreateInvoicePaymentUrlRequest.js → InstalledAppSummary.js} +0 -0
  261. /package/dist/openapi_client/models/{CreateInvoicePaymentUrlResponse.js → IntegrationStatusResponse.js} +0 -0
  262. /package/dist/openapi_client/models/{DatastoreMessageResponse.js → StepRecordResponse.js} +0 -0
  263. /package/dist/openapi_client/models/{FlowRunEntity.js → SurfaceChannelRouteInput.js} +0 -0
  264. /package/dist/openapi_client/models/{GmailSurfaceConfig.js → SurfaceChannelRouteResponse.js} +0 -0
  265. /package/dist/openapi_client/models/{OutlookSurfaceConfig.js → SurfaceConfigResponse.js} +0 -0
  266. /package/dist/openapi_client/models/{PlanListResponse.js → SurfaceIdentityConfigInput.js} +0 -0
  267. /package/dist/openapi_client/models/{PlanResponse.js → SurfaceIdentityConfigResponse.js} +0 -0
  268. /package/dist/openapi_client/models/{RecordResponse.js → SurfaceSetupStatusResponse.js} +0 -0
  269. /package/dist/openapi_client/models/{SeatInfoResponse.js → UpdateSurfaceChannelsRequest.js} +0 -0
  270. /package/dist/openapi_client/models/{SlackSurfaceConfig.js → UpsertSurfaceRequest.js} +0 -0
  271. /package/dist/openapi_client/models/{StackFrame.js → WorkflowRunFormSubmitRequest.js} +0 -0
  272. /package/dist/openapi_client/models/{StartSubscriptionRequest.js → WorkflowRunResponse.js} +0 -0
  273. /package/dist/openapi_client/models/{StartSubscriptionResponse.js → WorkflowRunWaitResponse.js} +0 -0
@@ -16,14 +16,11 @@ function findFirstFormNode(workflow) {
16
16
  }
17
17
  return null;
18
18
  }
19
- function isWaitingFlowRun(run) {
19
+ function isWaitingOnForm(run) {
20
20
  if (!run)
21
21
  return false;
22
22
  const normalizedStatus = normalizeRunStatus(run.status);
23
- return normalizedStatus === "WAITING"
24
- || !!run.waiting_function_run_id
25
- || !!run.waiting_agent_conversation_id
26
- || !!run.waiting_timer_id;
23
+ return normalizedStatus === "WAITING" && run.active_wait?.wait_type === "HUMAN";
27
24
  }
28
25
  export function useWorkflowStart({ client, podId, workflowName, runId = null, enabled = true, autoLoad = true, autoPoll = true, pollIntervalMs = 2000, onRun, onError, }) {
29
26
  const [workflow, setWorkflow] = useState(null);
@@ -93,30 +90,18 @@ export function useWorkflowStart({ client, podId, workflowName, runId = null, en
93
90
  setIsStarting(true);
94
91
  setWorkflowError(null);
95
92
  try {
96
- const currentWorkflow = workflow?.name === workflowName
97
- ? workflow
98
- : await refreshWorkflow();
99
- const startType = currentWorkflow?.start?.type ?? "MANUAL";
100
- if (startType === "MANUAL") {
101
- const created = await session.start({
102
- flowName: workflowName,
103
- inputs: {},
104
- });
105
- const shouldResume = !!created.id && (options.forceResume === true
106
- || Object.keys(inputs).length > 0
107
- || isWaitingFlowRun(created));
108
- if (!shouldResume || !created.id) {
109
- return created;
110
- }
111
- return session.resume({
112
- runId: created.id,
113
- inputs,
114
- });
115
- }
116
- return session.start({
93
+ // Runs take no start inputs; session.start submits `inputs` to the
94
+ // entry form when the created run waits on one.
95
+ const created = await session.start({
117
96
  flowName: workflowName,
118
97
  inputs,
119
98
  });
99
+ if (options.forceResume === true
100
+ && created.id
101
+ && isWaitingOnForm(created)) {
102
+ return session.resume({ runId: created.id, inputs });
103
+ }
104
+ return created;
120
105
  }
121
106
  catch (startError) {
122
107
  const normalized = normalizeError(startError, "Failed to start workflow.");
@@ -1,6 +1,8 @@
1
1
  export function normalizeError(error, fallback) {
2
2
  if (error instanceof Error)
3
3
  return error;
4
+ if (typeof error === "string" && error.trim())
5
+ return new Error(error.trim());
4
6
  return new Error(fallback);
5
7
  }
6
8
  export function resolvePodClient(client, podId) {
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { AgentRuntimeConfig, AgentHarnessInfo, AgentHarnessListResponse, AgentDetailResponse, AgentRuntimeProfileListResponse, AgentRuntimeProfileResponse, ColumnSchema, ConversationResponse as GeneratedConversationResponse, CreateAgentRequest, DatastoreQueryResponse, DirectoryTreeNode, DirectoryTreeResponse, FileDetailResponse, FileSearchResponse, FileSearchResultSchema, FlowDetailResponse, FlowRunEntity, FunctionDetailResponse, FunctionRunResponse, FunctionRunSummaryResponse, HarnessKind, IconUploadResponse, OrganizationInvitationResponse, OrganizationMemberResponse, OrganizationResponse, PodConfigResponse, PodJoinRequestCreateResponse, PodMemberResponse, PodRoleResponse, PodResponse, ResourceAccessGrantResponse, ResourceAccessResponse, ResourceType as GeneratedResourceType, ScheduleDetailResponse, TableDetailResponse, UpdateAgentRequest, UsageRecordResponse as GeneratedUsageRecordResponse, UsageListResponse as GeneratedUsageListResponse, UsageStatsBucketResponse as GeneratedUsageStatsBucketResponse, UsageStatsResponse as GeneratedUsageStatsResponse, UsageSummaryResponse as GeneratedUsageSummaryResponse, UserResponse, WorkflowRunWaitAssignment, WorkflowRunSummaryResponse } from "./openapi_client/index.js";
1
+ import type { AgentRuntimeConfig, AgentHarnessInfo, AgentHarnessListResponse, AgentDetailResponse, AgentRuntimeProfileListResponse, AgentRuntimeProfileResponse, ColumnSchema, ConversationResponse as GeneratedConversationResponse, CreateAgentRequest, DatastoreQueryResponse, DirectoryTreeNode, DirectoryTreeResponse, FileDetailResponse, FileSearchResponse, FileSearchResultSchema, FlowDetailResponse, WorkflowRunResponse, FunctionDetailResponse, FunctionRunResponse, FunctionRunSummaryResponse, HarnessKind, IconUploadResponse, OrganizationInvitationResponse, OrganizationMemberResponse, OrganizationResponse, PodConfigResponse, PodJoinRequestCreateResponse, PodMemberResponse, PodRoleResponse, PodResponse, ResourceAccessGrantResponse, ResourceAccessResponse, ResourceType as GeneratedResourceType, ScheduleDetailResponse, TableDetailResponse, UpdateAgentRequest, UsageRecordResponse as GeneratedUsageRecordResponse, UsageListResponse as GeneratedUsageListResponse, UsageStatsBucketResponse as GeneratedUsageStatsBucketResponse, UsageStatsResponse as GeneratedUsageStatsResponse, UsageSummaryResponse as GeneratedUsageSummaryResponse, UserResponse, WorkflowRunWaitAssignment, WorkflowRunSummaryResponse } from "./openapi_client/index.js";
2
2
  /** Public ergonomic types. */
3
3
  export interface AvailableModelInfo {
4
4
  id: ConversationModel;
@@ -46,6 +46,7 @@ export interface RunFunctionOptions {
46
46
  /** Input payload for the function */
47
47
  input?: Record<string, unknown>;
48
48
  }
49
+ /** Form field values submitted to a workflow form node. */
49
50
  export interface WorkflowRunInputs {
50
51
  [key: string]: unknown;
51
52
  }
@@ -76,7 +77,7 @@ export interface ConversationMessageResponse {
76
77
  export type ConversationMessage = ConversationMessageResponse;
77
78
  export type FunctionRun = FunctionRunResponse;
78
79
  export type FunctionRunSummary = FunctionRunSummaryResponse;
79
- export type FlowRun = FlowRunEntity;
80
+ export type FlowRun = WorkflowRunResponse;
80
81
  export type WorkflowRunSummary = WorkflowRunSummaryResponse;
81
82
  /** @deprecated Use Workflow or FlowDetailResponse. */
82
83
  export type FlowResponse = FlowDetailResponse;
@@ -97,7 +98,6 @@ export type DatastoreFileSearchResponse = FileSearchResponse;
97
98
  export type DatastoreFileSearchResult = FileSearchResultSchema;
98
99
  export type DatastoreDirectoryTree = DirectoryTreeResponse;
99
100
  export type DatastoreDirectoryTreeNode = DirectoryTreeNode;
100
- export type DatastoreFileNamespace = "PRIVATE" | "PERSONAL" | "POD";
101
101
  export type Pod = PodResponse;
102
102
  export type PodConfig = PodConfigResponse;
103
103
  export type PodMember = PodMemberResponse;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lemma-sdk",
3
- "version": "0.2.44",
4
- "description": "Official TypeScript SDK for Lemma pod-scoped APIs",
3
+ "version": "0.2.45",
4
+ "description": "Official TypeScript SDK for Lemma APIs, optimized around pod-scoped workflows",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -20,6 +20,9 @@
20
20
  "lemma",
21
21
  "sdk",
22
22
  "typescript",
23
+ "javascript",
24
+ "node",
25
+ "browser",
23
26
  "api",
24
27
  "react"
25
28
  ],
@@ -41,6 +44,7 @@
41
44
  ],
42
45
  "scripts": {
43
46
  "generate:client": "./scripts/generate_openapi_client.sh",
47
+ "generate:client:hey": "LEMMA_TS_GENERATOR=hey ./scripts/generate_openapi_client.sh",
44
48
  "build": "npm run clean && tsc -p tsconfig.json && npm run build:bundle",
45
49
  "build:bundle": "tsc -p tsconfig.bundle.json && node ./scripts/build_browser_bundle.mjs",
46
50
  "clean": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true, maxRetries: 10, retryDelay: 100 })\"",
@@ -61,6 +65,7 @@
61
65
  "supertokens-web-js": "^0.16.0"
62
66
  },
63
67
  "devDependencies": {
68
+ "@hey-api/openapi-ts": "^0.73.0",
64
69
  "@types/react": "^19.2.14",
65
70
  "openapi-typescript-codegen": "^0.29.0",
66
71
  "shadcn": "^4.2.0",
@@ -1,8 +0,0 @@
1
- import type { BillingInvoiceResponse } from './BillingInvoiceResponse.js';
2
- /**
3
- * Response schema for billing invoice history.
4
- */
5
- export type BillingHistoryResponse = {
6
- items: Array<BillingInvoiceResponse>;
7
- next_page_token?: (string | null);
8
- };
@@ -1,7 +0,0 @@
1
- /**
2
- * Billing interval enum.
3
- */
4
- export declare enum BillingInterval {
5
- MONTHLY = "MONTHLY",
6
- YEARLY = "YEARLY"
7
- }
@@ -1,12 +0,0 @@
1
- /* generated using openapi-typescript-codegen -- do not edit */
2
- /* istanbul ignore file */
3
- /* tslint:disable */
4
- /* eslint-disable */
5
- /**
6
- * Billing interval enum.
7
- */
8
- export var BillingInterval;
9
- (function (BillingInterval) {
10
- BillingInterval["MONTHLY"] = "MONTHLY";
11
- BillingInterval["YEARLY"] = "YEARLY";
12
- })(BillingInterval || (BillingInterval = {}));
@@ -1,27 +0,0 @@
1
- import type { BillingInvoiceStatus } from './BillingInvoiceStatus.js';
2
- /**
3
- * Response schema for a billing invoice.
4
- */
5
- export type BillingInvoiceResponse = {
6
- amount_cents: number;
7
- checkout_url: (string | null);
8
- created_at: string;
9
- currency: string;
10
- dodo_payment_id: (string | null);
11
- due_at: (string | null);
12
- id: string;
13
- llm_credit_cents: number;
14
- llm_overage_cents: number;
15
- metadata: Record<string, any>;
16
- organization_id: (string | null);
17
- paid_at: (string | null);
18
- period_end: string;
19
- period_start: string;
20
- plan_id: string;
21
- seat_count: number;
22
- status: BillingInvoiceStatus;
23
- subscription_id: (string | null);
24
- total_cents: number;
25
- updated_at: string;
26
- user_id: (string | null);
27
- };
@@ -1,10 +0,0 @@
1
- /**
2
- * Billing invoice status enum.
3
- */
4
- export declare enum BillingInvoiceStatus {
5
- DRAFT = "draft",
6
- UNPAID = "unpaid",
7
- PAID = "paid",
8
- FAILED = "failed",
9
- VOID = "void"
10
- }
@@ -1,15 +0,0 @@
1
- /* generated using openapi-typescript-codegen -- do not edit */
2
- /* istanbul ignore file */
3
- /* tslint:disable */
4
- /* eslint-disable */
5
- /**
6
- * Billing invoice status enum.
7
- */
8
- export var BillingInvoiceStatus;
9
- (function (BillingInvoiceStatus) {
10
- BillingInvoiceStatus["DRAFT"] = "draft";
11
- BillingInvoiceStatus["UNPAID"] = "unpaid";
12
- BillingInvoiceStatus["PAID"] = "paid";
13
- BillingInvoiceStatus["FAILED"] = "failed";
14
- BillingInvoiceStatus["VOID"] = "void";
15
- })(BillingInvoiceStatus || (BillingInvoiceStatus = {}));
@@ -1,10 +0,0 @@
1
- import type { SubscriptionStatus } from './SubscriptionStatus.js';
2
- /**
3
- * Response for subscription cancellation.
4
- */
5
- export type CancelSubscriptionResponse = {
6
- effective_date: (string | null);
7
- message: string;
8
- status: SubscriptionStatus;
9
- subscription_id: string;
10
- };
@@ -1,7 +0,0 @@
1
- /**
2
- * Request to generate a payment URL for an invoice.
3
- */
4
- export type CreateInvoicePaymentUrlRequest = {
5
- cancel_url: string;
6
- success_url: string;
7
- };
@@ -1,8 +0,0 @@
1
- import type { BillingInvoiceResponse } from './BillingInvoiceResponse.js';
2
- /**
3
- * Response with invoice payment checkout URL.
4
- */
5
- export type CreateInvoicePaymentUrlResponse = {
6
- checkout_url: string;
7
- invoice: BillingInvoiceResponse;
8
- };
@@ -1,6 +0,0 @@
1
- /**
2
- * Schema for datastore/table/record action message responses.
3
- */
4
- export type DatastoreMessageResponse = {
5
- message: string;
6
- };
@@ -1,11 +0,0 @@
1
- export type DeskServingConfigResponse = {
2
- base_domain: string;
3
- mode: DeskServingConfigResponse.mode;
4
- path_prefix: string;
5
- };
6
- export declare namespace DeskServingConfigResponse {
7
- enum mode {
8
- HOST = "HOST",
9
- PATH = "PATH"
10
- }
11
- }
@@ -1,8 +0,0 @@
1
- export var DeskServingConfigResponse;
2
- (function (DeskServingConfigResponse) {
3
- let mode;
4
- (function (mode) {
5
- mode["HOST"] = "HOST";
6
- mode["PATH"] = "PATH";
7
- })(mode = DeskServingConfigResponse.mode || (DeskServingConfigResponse.mode = {}));
8
- })(DeskServingConfigResponse || (DeskServingConfigResponse = {}));
@@ -1,36 +0,0 @@
1
- import type { FlowRunStatus } from './FlowRunStatus.js';
2
- import type { StackFrame } from './StackFrame.js';
3
- import type { StepExecution } from './StepExecution.js';
4
- /**
5
- * FlowRun Aggregate representing an execution of a Flow.
6
- */
7
- export type FlowRunEntity = {
8
- completed_at?: (string | null);
9
- created_at?: string;
10
- current_node_id?: (string | null);
11
- execution_context?: Record<string, any>;
12
- execution_stack?: Array<StackFrame>;
13
- flow_id: string;
14
- id?: string;
15
- pod_id: string;
16
- schedule_event_id?: (string | null);
17
- start_payload?: Record<string, any>;
18
- start_type?: string;
19
- started_at?: (string | null);
20
- status?: FlowRunStatus;
21
- step_history?: Array<StepExecution>;
22
- updated_at?: string;
23
- user_id: string;
24
- /**
25
- * Agent conversation id when the workflow is waiting for a pod agent execution.
26
- */
27
- waiting_agent_conversation_id?: (string | null);
28
- /**
29
- * Function run id when the workflow is waiting for an async function.
30
- */
31
- waiting_function_run_id?: (string | null);
32
- /**
33
- * Scheduler wake job id when the workflow is waiting for time.
34
- */
35
- waiting_timer_id?: (string | null);
36
- };
@@ -1,7 +0,0 @@
1
- export type GmailSurfaceConfig = {
2
- created_at?: string;
3
- dm_conversation_reset_after_hours?: number;
4
- id?: string;
5
- type?: string;
6
- updated_at?: string;
7
- };
@@ -1,7 +0,0 @@
1
- export type OutlookSurfaceConfig = {
2
- created_at?: string;
3
- dm_conversation_reset_after_hours?: number;
4
- id?: string;
5
- type?: string;
6
- updated_at?: string;
7
- };
@@ -1,8 +0,0 @@
1
- import type { PlanResponse } from './PlanResponse.js';
2
- /**
3
- * Response schema for list of plans.
4
- */
5
- export type PlanListResponse = {
6
- items: Array<PlanResponse>;
7
- next_page_token?: (string | null);
8
- };
@@ -1,18 +0,0 @@
1
- import type { PlanType } from './PlanType.js';
2
- /**
3
- * Response schema for a plan.
4
- */
5
- export type PlanResponse = {
6
- created_at: string;
7
- currency: string;
8
- description: (string | null);
9
- features: Record<string, any>;
10
- id: string;
11
- is_active: boolean;
12
- name: string;
13
- plan_type: PlanType;
14
- price_cents: number;
15
- seat_limit: (number | null);
16
- updated_at: string;
17
- usage_limits: Record<string, any>;
18
- };
@@ -1,7 +0,0 @@
1
- /**
2
- * Plan type enum.
3
- */
4
- export declare enum PlanType {
5
- PERSONAL = "PERSONAL",
6
- TEAM = "TEAM"
7
- }
@@ -1,12 +0,0 @@
1
- /* generated using openapi-typescript-codegen -- do not edit */
2
- /* istanbul ignore file */
3
- /* tslint:disable */
4
- /* eslint-disable */
5
- /**
6
- * Plan type enum.
7
- */
8
- export var PlanType;
9
- (function (PlanType) {
10
- PlanType["PERSONAL"] = "PERSONAL";
11
- PlanType["TEAM"] = "TEAM";
12
- })(PlanType || (PlanType = {}));
@@ -1,9 +0,0 @@
1
- /**
2
- * Schema for a single record response.
3
- */
4
- export type RecordResponse = {
5
- /**
6
- * Record data
7
- */
8
- data: Record<string, any>;
9
- };
@@ -1,10 +0,0 @@
1
- /**
2
- * Response for seat availability info.
3
- */
4
- export type SeatInfoResponse = {
5
- current_seats: number;
6
- has_available_seats: boolean;
7
- organization_id: string;
8
- seat_limit: (number | null);
9
- seats_remaining: (number | null);
10
- };
@@ -1,7 +0,0 @@
1
- export type SlackSurfaceConfig = {
2
- created_at?: string;
3
- dm_conversation_reset_after_hours?: number;
4
- id?: string;
5
- type?: string;
6
- updated_at?: string;
7
- };
@@ -1,11 +0,0 @@
1
- /**
2
- * Execution stack frame for loops.
3
- */
4
- export type StackFrame = {
5
- index: number;
6
- item_var: string;
7
- items: Array<any>;
8
- node_id: string;
9
- results?: Array<any>;
10
- return_node_id?: (string | null);
11
- };
@@ -1,14 +0,0 @@
1
- /**
2
- * Request to start a subscription.
3
- */
4
- export type StartSubscriptionRequest = {
5
- /**
6
- * URL to redirect if payment is cancelled
7
- */
8
- cancel_url: string;
9
- plan_id: string;
10
- /**
11
- * URL to redirect after successful payment
12
- */
13
- success_url: string;
14
- };
@@ -1,9 +0,0 @@
1
- import type { SubscriptionResponse } from './SubscriptionResponse.js';
2
- /**
3
- * Response with checkout URL.
4
- */
5
- export type StartSubscriptionResponse = {
6
- checkout_url?: (string | null);
7
- message?: string;
8
- subscription?: (SubscriptionResponse | null);
9
- };
@@ -1,6 +0,0 @@
1
- /**
2
- * Request to start monthly-invoiced team billing.
3
- */
4
- export type StartTeamBillingRequest = {
5
- plan_id: string;
6
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,13 +0,0 @@
1
- import type { FlowRunStatus } from './FlowRunStatus.js';
2
- /**
3
- * Record of a single node execution.
4
- */
5
- export type StepExecution = {
6
- completed_at?: (string | null);
7
- error?: (string | null);
8
- input_data?: (Record<string, any> | null);
9
- node_id: string;
10
- output_data?: null;
11
- started_at: string;
12
- status: FlowRunStatus;
13
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,22 +0,0 @@
1
- import type { BillingInterval } from './BillingInterval.js';
2
- import type { PlanResponse } from './PlanResponse.js';
3
- import type { SubscriptionStatus } from './SubscriptionStatus.js';
4
- /**
5
- * Response schema for a subscription.
6
- */
7
- export type SubscriptionResponse = {
8
- billing_interval: BillingInterval;
9
- cancel_at_period_end: boolean;
10
- created_at: string;
11
- current_period_end: (string | null);
12
- current_period_start: (string | null);
13
- dodo_subscription_id: (string | null);
14
- id: string;
15
- organization_id: (string | null);
16
- plan?: (PlanResponse | null);
17
- plan_id: string;
18
- seat_count: number;
19
- status: SubscriptionStatus;
20
- updated_at: string;
21
- user_id: (string | null);
22
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- /**
2
- * Subscription status enum.
3
- */
4
- export declare enum SubscriptionStatus {
5
- PENDING = "pending",
6
- ACTIVE = "active",
7
- CANCELLED = "cancelled",
8
- EXPIRED = "expired",
9
- PAST_DUE = "past_due"
10
- }
@@ -1,15 +0,0 @@
1
- /* generated using openapi-typescript-codegen -- do not edit */
2
- /* istanbul ignore file */
3
- /* tslint:disable */
4
- /* eslint-disable */
5
- /**
6
- * Subscription status enum.
7
- */
8
- export var SubscriptionStatus;
9
- (function (SubscriptionStatus) {
10
- SubscriptionStatus["PENDING"] = "pending";
11
- SubscriptionStatus["ACTIVE"] = "active";
12
- SubscriptionStatus["CANCELLED"] = "cancelled";
13
- SubscriptionStatus["EXPIRED"] = "expired";
14
- SubscriptionStatus["PAST_DUE"] = "past_due";
15
- })(SubscriptionStatus || (SubscriptionStatus = {}));
@@ -1,10 +0,0 @@
1
- import type { SubscriptionStatus } from './SubscriptionStatus.js';
2
- /**
3
- * Simple subscription status response.
4
- */
5
- export type SubscriptionStatusResponse = {
6
- has_subscription: boolean;
7
- is_active: boolean;
8
- plan_name: (string | null);
9
- status: (SubscriptionStatus | null);
10
- };
@@ -1,22 +0,0 @@
1
- import type { BillingInterval } from './BillingInterval.js';
2
- import type { PlanResponse } from './PlanResponse.js';
3
- import type { SubscriptionStatus } from './SubscriptionStatus.js';
4
- /**
5
- * Subscription response with plan details.
6
- */
7
- export type SubscriptionWithPlanResponse = {
8
- billing_interval: BillingInterval;
9
- cancel_at_period_end: boolean;
10
- created_at: string;
11
- current_period_end: (string | null);
12
- current_period_start: (string | null);
13
- dodo_subscription_id: (string | null);
14
- id: string;
15
- organization_id: (string | null);
16
- plan: PlanResponse;
17
- plan_id: string;
18
- seat_count: number;
19
- status: SubscriptionStatus;
20
- updated_at: string;
21
- user_id: (string | null);
22
- };
@@ -1,6 +0,0 @@
1
- export declare enum SurfaceEventMode {
2
- WEBHOOK = "WEBHOOK",
3
- POLLING = "POLLING",
4
- SOCKET = "SOCKET",
5
- SCHEDULE = "SCHEDULE"
6
- }
@@ -1,11 +0,0 @@
1
- /* generated using openapi-typescript-codegen -- do not edit */
2
- /* istanbul ignore file */
3
- /* tslint:disable */
4
- /* eslint-disable */
5
- export var SurfaceEventMode;
6
- (function (SurfaceEventMode) {
7
- SurfaceEventMode["WEBHOOK"] = "WEBHOOK";
8
- SurfaceEventMode["POLLING"] = "POLLING";
9
- SurfaceEventMode["SOCKET"] = "SOCKET";
10
- SurfaceEventMode["SCHEDULE"] = "SCHEDULE";
11
- })(SurfaceEventMode || (SurfaceEventMode = {}));
@@ -1,5 +0,0 @@
1
- export declare enum SurfaceMode {
2
- DM = "DM",
3
- CHANNEL = "CHANNEL",
4
- EMAIL = "EMAIL"
5
- }
@@ -1,10 +0,0 @@
1
- /* generated using openapi-typescript-codegen -- do not edit */
2
- /* istanbul ignore file */
3
- /* tslint:disable */
4
- /* eslint-disable */
5
- export var SurfaceMode;
6
- (function (SurfaceMode) {
7
- SurfaceMode["DM"] = "DM";
8
- SurfaceMode["CHANNEL"] = "CHANNEL";
9
- SurfaceMode["EMAIL"] = "EMAIL";
10
- })(SurfaceMode || (SurfaceMode = {}));
@@ -1,4 +0,0 @@
1
- export declare enum SurfaceRoutingScope {
2
- POD = "POD",
3
- PERSONAL = "PERSONAL"
4
- }
@@ -1,9 +0,0 @@
1
- /* generated using openapi-typescript-codegen -- do not edit */
2
- /* istanbul ignore file */
3
- /* tslint:disable */
4
- /* eslint-disable */
5
- export var SurfaceRoutingScope;
6
- (function (SurfaceRoutingScope) {
7
- SurfaceRoutingScope["POD"] = "POD";
8
- SurfaceRoutingScope["PERSONAL"] = "PERSONAL";
9
- })(SurfaceRoutingScope || (SurfaceRoutingScope = {}));