lemma-sdk 0.2.28 → 0.2.31

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 (122) hide show
  1. package/README.md +241 -201
  2. package/bin/lemma-sdk.js +108 -0
  3. package/dist/browser/lemma-client.js +125 -4
  4. package/dist/client.d.ts +2 -0
  5. package/dist/client.js +3 -0
  6. package/dist/config.d.ts +2 -2
  7. package/dist/config.js +2 -2
  8. package/dist/datastore-query.d.ts +54 -0
  9. package/dist/datastore-query.js +157 -0
  10. package/dist/index.d.ts +7 -0
  11. package/dist/index.js +3 -0
  12. package/dist/namespaces/datastore.d.ts +9 -0
  13. package/dist/namespaces/datastore.js +13 -0
  14. package/dist/namespaces/records.d.ts +1 -1
  15. package/dist/openapi_client/index.d.ts +4 -0
  16. package/dist/openapi_client/index.js +1 -0
  17. package/dist/openapi_client/models/ConvertedArtifactResponse.d.ts +6 -0
  18. package/dist/openapi_client/models/ConvertedFileResponse.d.ts +10 -0
  19. package/dist/openapi_client/models/ConvertedFileResponse.js +1 -0
  20. package/dist/openapi_client/models/CreateFolderRequest.d.ts +3 -1
  21. package/dist/openapi_client/models/FlowRunEntity.d.ts +1 -0
  22. package/dist/openapi_client/models/ScheduledFlowStart.d.ts +3 -6
  23. package/dist/openapi_client/models/ScheduledFlowStartType.d.ts +4 -0
  24. package/dist/openapi_client/models/ScheduledFlowStartType.js +9 -0
  25. package/dist/openapi_client/models/WorkflowInstallRequest.d.ts +5 -0
  26. package/dist/openapi_client/models/WorkflowTimeInstallConfig.d.ts +19 -0
  27. package/dist/openapi_client/models/WorkflowTimeInstallConfig.js +1 -0
  28. package/dist/openapi_client/services/FilesService.d.ts +27 -1
  29. package/dist/openapi_client/services/FilesService.js +69 -1
  30. package/dist/openapi_client/services/WorkflowsService.d.ts +1 -1
  31. package/dist/openapi_client/services/WorkflowsService.js +1 -1
  32. package/dist/react/assistant-output.d.ts +6 -0
  33. package/dist/react/assistant-output.js +90 -0
  34. package/dist/react/index.d.ts +62 -8
  35. package/dist/react/index.js +31 -4
  36. package/dist/react/useAgentInputSchema.d.ts +19 -0
  37. package/dist/react/useAgentInputSchema.js +73 -0
  38. package/dist/react/useAgentRun.d.ts +17 -0
  39. package/dist/react/useAgentRun.js +56 -0
  40. package/dist/react/useAgentRuns.d.ts +33 -0
  41. package/dist/react/useAgentRuns.js +149 -0
  42. package/dist/react/useAssistantRun.d.ts +9 -0
  43. package/dist/react/useAssistantRun.js +28 -17
  44. package/dist/react/useAssistantSession.d.ts +5 -0
  45. package/dist/react/useAssistantSession.js +135 -86
  46. package/dist/react/useBulkRecords.d.ts +20 -0
  47. package/dist/react/useBulkRecords.js +65 -0
  48. package/dist/react/useConversation.d.ts +18 -0
  49. package/dist/react/useConversation.js +75 -0
  50. package/dist/react/useConversationMessages.d.ts +59 -0
  51. package/dist/react/useConversationMessages.js +167 -0
  52. package/dist/react/useConversations.d.ts +52 -0
  53. package/dist/react/useConversations.js +228 -0
  54. package/dist/react/useCreateRecord.d.ts +18 -0
  55. package/dist/react/useCreateRecord.js +51 -0
  56. package/dist/react/useCurrentUser.d.ts +14 -0
  57. package/dist/react/useCurrentUser.js +68 -0
  58. package/dist/react/useDeleteRecord.d.ts +21 -0
  59. package/dist/react/useDeleteRecord.js +52 -0
  60. package/dist/react/useFlowRunHistory.js +1 -5
  61. package/dist/react/useFlowSession.js +41 -33
  62. package/dist/react/useForeignKeyOptions.d.ts +31 -0
  63. package/dist/react/useForeignKeyOptions.js +161 -0
  64. package/dist/react/useFunctionRun.d.ts +19 -0
  65. package/dist/react/useFunctionRun.js +30 -0
  66. package/dist/react/useFunctionRuns.d.ts +33 -0
  67. package/dist/react/useFunctionRuns.js +149 -0
  68. package/dist/react/useFunctionSession.js +37 -29
  69. package/dist/react/useJoinedRecords.d.ts +18 -0
  70. package/dist/react/useJoinedRecords.js +80 -0
  71. package/dist/react/useMembers.d.ts +26 -0
  72. package/dist/react/useMembers.js +98 -0
  73. package/dist/react/useOrganizationMembers.d.ts +26 -0
  74. package/dist/react/useOrganizationMembers.js +113 -0
  75. package/dist/react/usePodAccess.d.ts +22 -0
  76. package/dist/react/usePodAccess.js +128 -0
  77. package/dist/react/useRecord.d.ts +18 -0
  78. package/dist/react/useRecord.js +75 -0
  79. package/dist/react/useRecordForm.d.ts +42 -0
  80. package/dist/react/useRecordForm.js +221 -0
  81. package/dist/react/useRecordSchema.d.ts +20 -0
  82. package/dist/react/useRecordSchema.js +24 -0
  83. package/dist/react/useRecords.d.ts +20 -0
  84. package/dist/react/useRecords.js +146 -0
  85. package/dist/react/useRelatedRecords.d.ts +43 -0
  86. package/dist/react/useRelatedRecords.js +239 -0
  87. package/dist/react/useReverseRelatedRecords.d.ts +47 -0
  88. package/dist/react/useReverseRelatedRecords.js +235 -0
  89. package/dist/react/useSchemaForm.d.ts +24 -0
  90. package/dist/react/useSchemaForm.js +104 -0
  91. package/dist/react/useTable.d.ts +16 -0
  92. package/dist/react/useTable.js +70 -0
  93. package/dist/react/useTables.d.ts +26 -0
  94. package/dist/react/useTables.js +113 -0
  95. package/dist/react/useTaskSession.js +11 -22
  96. package/dist/react/useUpdateRecord.d.ts +21 -0
  97. package/dist/react/useUpdateRecord.js +55 -0
  98. package/dist/react/useWorkflowResume.d.ts +18 -0
  99. package/dist/react/useWorkflowResume.js +45 -0
  100. package/dist/react/useWorkflowRun.d.ts +21 -0
  101. package/dist/react/useWorkflowRun.js +49 -0
  102. package/dist/react/useWorkflowRuns.d.ts +33 -0
  103. package/dist/react/useWorkflowRuns.js +149 -0
  104. package/dist/react/useWorkflowStart.d.ts +33 -0
  105. package/dist/react/useWorkflowStart.js +148 -0
  106. package/dist/react/utils.d.ts +5 -0
  107. package/dist/react/utils.js +25 -0
  108. package/dist/record-form.d.ts +30 -0
  109. package/dist/record-form.js +199 -0
  110. package/dist/schema-form.d.ts +41 -0
  111. package/dist/schema-form.js +200 -0
  112. package/dist/types.d.ts +6 -1
  113. package/package.json +11 -8
  114. package/dist/react/components/AssistantChrome.d.ts +0 -86
  115. package/dist/react/components/AssistantChrome.js +0 -48
  116. package/dist/react/components/AssistantEmbedded.d.ts +0 -10
  117. package/dist/react/components/AssistantEmbedded.js +0 -15
  118. package/dist/react/components/AssistantExperience.d.ts +0 -96
  119. package/dist/react/components/AssistantExperience.js +0 -1294
  120. package/dist/react/components/assistant-types.d.ts +0 -80
  121. package/dist/react/styles.css +0 -2407
  122. /package/dist/{react/components/assistant-types.js → openapi_client/models/ConvertedArtifactResponse.js} +0 -0
@@ -1,3 +1,4 @@
1
+ import type { ConvertedFileResponse } from '../models/ConvertedFileResponse.js';
1
2
  import type { CreateFolderRequest } from '../models/CreateFolderRequest.js';
2
3
  import type { DatastoreFileUploadRequest } from '../models/DatastoreFileUploadRequest.js';
3
4
  import type { DatastoreMessageResponse } from '../models/DatastoreMessageResponse.js';
@@ -28,7 +29,7 @@ export declare class FilesService {
28
29
  */
29
30
  static fileUpload(podId: string, formData: DatastoreFileUploadRequest): CancelablePromise<FileResponse>;
30
31
  /**
31
- * Delete File Or Folder. Deleting a folder will cleanup whole subtreee
32
+ * Delete File Or Folder
32
33
  * @param podId
33
34
  * @param path
34
35
  * @returns DatastoreMessageResponse Successful Response
@@ -51,6 +52,31 @@ export declare class FilesService {
51
52
  * @throws ApiError
52
53
  */
53
54
  static fileUpdate(podId: string, formData: update): CancelablePromise<FileResponse>;
55
+ /**
56
+ * Get Converted File Metadata
57
+ * @param podId
58
+ * @param path
59
+ * @returns ConvertedFileResponse Successful Response
60
+ * @throws ApiError
61
+ */
62
+ static fileConvertedGet(podId: string, path: string): CancelablePromise<ConvertedFileResponse>;
63
+ /**
64
+ * Download Converted File Artifact
65
+ * @param podId
66
+ * @param path
67
+ * @param artifact
68
+ * @returns any Successful Response
69
+ * @throws ApiError
70
+ */
71
+ static fileConvertedDownload(podId: string, path: string, artifact?: string): CancelablePromise<any>;
72
+ /**
73
+ * Render Converted File As HTML
74
+ * @param podId
75
+ * @param path
76
+ * @returns any Successful Response
77
+ * @throws ApiError
78
+ */
79
+ static fileConvertedRender(podId: string, path: string): CancelablePromise<any>;
54
80
  /**
55
81
  * Download File
56
82
  * @param podId
@@ -49,7 +49,7 @@ export class FilesService {
49
49
  });
50
50
  }
51
51
  /**
52
- * Delete File Or Folder. Deleting a folder will cleanup whole subtreee
52
+ * Delete File Or Folder
53
53
  * @param podId
54
54
  * @param path
55
55
  * @returns DatastoreMessageResponse Successful Response
@@ -113,6 +113,74 @@ export class FilesService {
113
113
  },
114
114
  });
115
115
  }
116
+ /**
117
+ * Get Converted File Metadata
118
+ * @param podId
119
+ * @param path
120
+ * @returns ConvertedFileResponse Successful Response
121
+ * @throws ApiError
122
+ */
123
+ static fileConvertedGet(podId, path) {
124
+ return __request(OpenAPI, {
125
+ method: 'GET',
126
+ url: '/pods/{pod_id}/datastore/files/converted/by-path',
127
+ path: {
128
+ 'pod_id': podId,
129
+ },
130
+ query: {
131
+ 'path': path,
132
+ },
133
+ errors: {
134
+ 422: `Validation Error`,
135
+ },
136
+ });
137
+ }
138
+ /**
139
+ * Download Converted File Artifact
140
+ * @param podId
141
+ * @param path
142
+ * @param artifact
143
+ * @returns any Successful Response
144
+ * @throws ApiError
145
+ */
146
+ static fileConvertedDownload(podId, path, artifact = 'document.md') {
147
+ return __request(OpenAPI, {
148
+ method: 'GET',
149
+ url: '/pods/{pod_id}/datastore/files/converted/download',
150
+ path: {
151
+ 'pod_id': podId,
152
+ },
153
+ query: {
154
+ 'path': path,
155
+ 'artifact': artifact,
156
+ },
157
+ errors: {
158
+ 422: `Validation Error`,
159
+ },
160
+ });
161
+ }
162
+ /**
163
+ * Render Converted File As HTML
164
+ * @param podId
165
+ * @param path
166
+ * @returns any Successful Response
167
+ * @throws ApiError
168
+ */
169
+ static fileConvertedRender(podId, path) {
170
+ return __request(OpenAPI, {
171
+ method: 'GET',
172
+ url: '/pods/{pod_id}/datastore/files/converted/render',
173
+ path: {
174
+ 'pod_id': podId,
175
+ },
176
+ query: {
177
+ 'path': path,
178
+ },
179
+ errors: {
180
+ 422: `Validation Error`,
181
+ },
182
+ });
183
+ }
116
184
  /**
117
185
  * Download File
118
186
  * @param podId
@@ -107,7 +107,7 @@ export declare class WorkflowsService {
107
107
  static workflowGraphUpdate(podId: string, workflowName: string, requestBody: WorkflowGraphUpdateRequest): CancelablePromise<FlowResponse>;
108
108
  /**
109
109
  * Install Workflow
110
- * Install a workflow for runtime execution. Provide `account_id` when the workflow needs an integration account binding.
110
+ * 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.
111
111
  * @param podId
112
112
  * @param workflowName
113
113
  * @param requestBody
@@ -233,7 +233,7 @@ export class WorkflowsService {
233
233
  }
234
234
  /**
235
235
  * Install Workflow
236
- * Install a workflow for runtime execution. Provide `account_id` when the workflow needs an integration account binding.
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
237
  * @param podId
238
238
  * @param workflowName
239
239
  * @param requestBody
@@ -0,0 +1,6 @@
1
+ import type { ConversationMessage } from "../types.js";
2
+ export declare function normalizeConversationStatus(status: unknown): string | undefined;
3
+ export declare function isConversationRunningStatus(status: unknown): boolean;
4
+ export declare function extractConversationMessageText(content: unknown): string;
5
+ export declare function sortConversationMessagesByCreatedAt(messages: ConversationMessage[]): ConversationMessage[];
6
+ export declare function getLatestAssistantMessage(messages: ConversationMessage[]): ConversationMessage | null;
@@ -0,0 +1,90 @@
1
+ function isRecord(value) {
2
+ return !!value && typeof value === "object" && !Array.isArray(value);
3
+ }
4
+ export function normalizeConversationStatus(status) {
5
+ if (typeof status !== "string")
6
+ return undefined;
7
+ const normalized = status.trim().toUpperCase();
8
+ return normalized.length > 0 ? normalized : undefined;
9
+ }
10
+ export function isConversationRunningStatus(status) {
11
+ const normalized = normalizeConversationStatus(status);
12
+ if (!normalized)
13
+ return false;
14
+ return normalized === "RUNNING" || normalized === "IN_PROGRESS" || normalized === "PROCESSING";
15
+ }
16
+ function extractTextFromStructuredContentEntry(entry) {
17
+ if (typeof entry === "string")
18
+ return entry.trim();
19
+ if (!isRecord(entry))
20
+ return "";
21
+ if (typeof entry.text === "string")
22
+ return entry.text.trim();
23
+ if (typeof entry.content === "string")
24
+ return entry.content.trim();
25
+ if (typeof entry.value === "string")
26
+ return entry.value.trim();
27
+ if (Array.isArray(entry.content)) {
28
+ const nested = entry.content
29
+ .map((child) => extractTextFromStructuredContentEntry(child))
30
+ .filter((text) => text.length > 0)
31
+ .join("\n")
32
+ .trim();
33
+ if (nested.length > 0)
34
+ return nested;
35
+ }
36
+ if (Array.isArray(entry.summary)) {
37
+ const summary = entry.summary
38
+ .map((child) => extractTextFromStructuredContentEntry(child))
39
+ .filter((text) => text.length > 0)
40
+ .join("\n")
41
+ .trim();
42
+ if (summary.length > 0)
43
+ return summary;
44
+ }
45
+ return "";
46
+ }
47
+ export function extractConversationMessageText(content) {
48
+ if (typeof content === "string")
49
+ return content.trim();
50
+ if (Array.isArray(content)) {
51
+ return content
52
+ .map((entry) => extractTextFromStructuredContentEntry(entry))
53
+ .filter((text) => text.length > 0)
54
+ .join("\n\n")
55
+ .trim();
56
+ }
57
+ if (!isRecord(content))
58
+ return "";
59
+ const directContent = content.content;
60
+ if (typeof directContent === "string")
61
+ return directContent.trim();
62
+ if (Array.isArray(directContent)) {
63
+ const text = directContent
64
+ .map((entry) => extractTextFromStructuredContentEntry(entry))
65
+ .filter((entry) => entry.length > 0)
66
+ .join("\n\n")
67
+ .trim();
68
+ if (text.length > 0)
69
+ return text;
70
+ }
71
+ if (typeof content.text === "string")
72
+ return content.text.trim();
73
+ return extractTextFromStructuredContentEntry(content);
74
+ }
75
+ export function sortConversationMessagesByCreatedAt(messages) {
76
+ return [...messages].sort((a, b) => {
77
+ const aTime = Number.isFinite(new Date(a.created_at).getTime()) ? new Date(a.created_at).getTime() : 0;
78
+ const bTime = Number.isFinite(new Date(b.created_at).getTime()) ? new Date(b.created_at).getTime() : 0;
79
+ return aTime - bTime;
80
+ });
81
+ }
82
+ export function getLatestAssistantMessage(messages) {
83
+ for (let index = messages.length - 1; index >= 0; index -= 1) {
84
+ const message = messages[index];
85
+ if (typeof message?.role === "string" && message.role.toLowerCase() === "assistant") {
86
+ return message;
87
+ }
88
+ }
89
+ return null;
90
+ }
@@ -4,25 +4,79 @@ export { useAuth } from "./useAuth.js";
4
4
  export type { UseAuthResult } from "./useAuth.js";
5
5
  export { useAssistantRun } from "./useAssistantRun.js";
6
6
  export type { UseAssistantRunOptions, UseAssistantRunResult } from "./useAssistantRun.js";
7
+ export { useConversations } from "./useConversations.js";
8
+ export type { UseConversationsOptions, UseConversationsResult } from "./useConversations.js";
9
+ export { useConversation } from "./useConversation.js";
10
+ export type { UseConversationOptions, UseConversationResult } from "./useConversation.js";
11
+ export { useConversationMessages } from "./useConversationMessages.js";
12
+ export type { UseConversationMessagesOptions, UseConversationMessagesResult, } from "./useConversationMessages.js";
13
+ export { useAgentRun } from "./useAgentRun.js";
14
+ export type { UseAgentRunOptions, UseAgentRunResult } from "./useAgentRun.js";
15
+ export { useAgentRuns } from "./useAgentRuns.js";
16
+ export type { UseAgentRunsOptions, UseAgentRunsResult } from "./useAgentRuns.js";
17
+ export { useAgentInputSchema } from "./useAgentInputSchema.js";
18
+ export type { UseAgentInputSchemaOptions, UseAgentInputSchemaResult, } from "./useAgentInputSchema.js";
7
19
  export { useAssistantSession } from "./useAssistantSession.js";
8
20
  export type { CreateConversationInput, SendAssistantMessageOptions, UseAssistantSessionOptions, UseAssistantSessionResult, } from "./useAssistantSession.js";
9
21
  export { useAssistantRuntime } from "./useAssistantRuntime.js";
10
22
  export type { UseAssistantRuntimeOptions, UseAssistantRuntimeResult, } from "./useAssistantRuntime.js";
23
+ export { useMembers } from "./useMembers.js";
24
+ export type { UseMembersOptions, UseMembersResult } from "./useMembers.js";
25
+ export { useOrganizationMembers } from "./useOrganizationMembers.js";
26
+ export type { UseOrganizationMembersOptions, UseOrganizationMembersResult, } from "./useOrganizationMembers.js";
27
+ export { useCurrentUser } from "./useCurrentUser.js";
28
+ export type { UseCurrentUserOptions, UseCurrentUserResult } from "./useCurrentUser.js";
29
+ export { usePodAccess } from "./usePodAccess.js";
30
+ export type { PodAccessStatus, UsePodAccessOptions, UsePodAccessResult, } from "./usePodAccess.js";
31
+ export { useTables } from "./useTables.js";
32
+ export type { UseTablesOptions, UseTablesResult } from "./useTables.js";
33
+ export { useTable } from "./useTable.js";
34
+ export type { UseTableOptions, UseTableResult } from "./useTable.js";
35
+ export { useRecords } from "./useRecords.js";
36
+ export type { UseRecordsOptions, UseRecordsResult } from "./useRecords.js";
37
+ export { useRecord } from "./useRecord.js";
38
+ export type { UseRecordOptions, UseRecordResult } from "./useRecord.js";
39
+ export { useCreateRecord } from "./useCreateRecord.js";
40
+ export type { UseCreateRecordOptions, UseCreateRecordResult } from "./useCreateRecord.js";
41
+ export { useUpdateRecord } from "./useUpdateRecord.js";
42
+ export type { UseUpdateRecordOptions, UseUpdateRecordResult } from "./useUpdateRecord.js";
43
+ export { useDeleteRecord } from "./useDeleteRecord.js";
44
+ export type { UseDeleteRecordOptions, UseDeleteRecordResult } from "./useDeleteRecord.js";
45
+ export { useBulkRecords } from "./useBulkRecords.js";
46
+ export type { UseBulkRecordsOptions, UseBulkRecordsResult } from "./useBulkRecords.js";
47
+ export { useJoinedRecords } from "./useJoinedRecords.js";
48
+ export type { UseJoinedRecordsOptions, UseJoinedRecordsResult } from "./useJoinedRecords.js";
49
+ export { useRelatedRecords } from "./useRelatedRecords.js";
50
+ export type { RelatedRecordsColumn, RelatedRecordsInclude, RelatedRecordsResolvedInclude, UseRelatedRecordsOptions, UseRelatedRecordsResult, } from "./useRelatedRecords.js";
51
+ export { useReverseRelatedRecords } from "./useReverseRelatedRecords.js";
52
+ export type { ReverseRelatedRecordsColumn, ReverseRelatedRelation, ReverseRelationSelector, UseReverseRelatedRecordsOptions, UseReverseRelatedRecordsResult, } from "./useReverseRelatedRecords.js";
53
+ export { useForeignKeyOptions } from "./useForeignKeyOptions.js";
54
+ export type { ForeignKeyOption, UseForeignKeyOptionsOptions, UseForeignKeyOptionsResult, } from "./useForeignKeyOptions.js";
55
+ export { useRecordSchema } from "./useRecordSchema.js";
56
+ export type { UseRecordSchemaOptions, UseRecordSchemaResult } from "./useRecordSchema.js";
57
+ export { useRecordForm } from "./useRecordForm.js";
58
+ export type { UseRecordFormOptions, UseRecordFormResult } from "./useRecordForm.js";
59
+ export { useSchemaForm } from "./useSchemaForm.js";
60
+ export type { UseSchemaFormOptions, UseSchemaFormResult } from "./useSchemaForm.js";
11
61
  export { useAssistantController } from "./useAssistantController.js";
12
62
  export type { AssistantAction, AssistantConversationScope, AssistantMessagePart, AssistantRenderableMessage, AssistantToolInvocation, UseAssistantControllerOptions, UseAssistantControllerResult, } from "./useAssistantController.js";
13
- export type { AssistantConversationRenderArgs, AssistantControllerView, AssistantExperienceCustomizationProps, AssistantMessageRenderArgs, EmptyStateSuggestion, AssistantPendingFileRenderArgs, AssistantPresentedFileRenderArgs, AssistantToolRenderArgs, } from "./components/assistant-types.js";
14
- export { AssistantAskOverlay, AssistantComposer, AssistantConversationList, AssistantHeader, AssistantMessageViewport, AssistantModelPicker, AssistantPendingFileChip, AssistantShellLayout, AssistantStatusPill, AssistantThemeScope, } from "./components/AssistantChrome.js";
15
- export type { AssistantAskOverlayProps, AssistantComposerProps, AssistantConversationListProps, AssistantHeaderProps, AssistantMessageViewportProps, AssistantModelPickerProps, AssistantPendingFileChipProps, AssistantShellLayoutProps, AssistantStatusPillProps, AssistantSurfaceTone, AssistantThemeMode, AssistantThemeScopeProps, } from "./components/AssistantChrome.js";
16
- export { AssistantExperienceView } from "./components/AssistantExperience.js";
17
- export type { ActiveToolBanner, AskUserInputQuestion, AssistantChromeStyle, AssistantExperienceViewProps, AssistantRadiusScale, AssistantStatusPlacement, DisplayMessageRow, EmptyStateProps, PendingAskUserInput, PlanStepState, PlanSummaryState, } from "./components/AssistantExperience.js";
18
- export { AssistantEmbedded } from "./components/AssistantEmbedded.js";
19
- export type { AssistantEmbeddedProps } from "./components/AssistantEmbedded.js";
20
- export { buildDisplayMessageRows, DEFAULT_EMPTY_STATE_SUGGESTIONS, dedupToolInvocations, EmptyState, findPendingAskUserInput, formatAskUserInputAnswers, getActiveToolBanner, extractPresentFilePathsFromInvocation, latestPlanSummary, MessageGroup, PlanSummaryStrip, ThinkingIndicator, } from "./components/AssistantExperience.js";
21
63
  export { useTaskSession } from "./useTaskSession.js";
22
64
  export type { CreateTaskInput, UseTaskSessionOptions, UseTaskSessionResult, } from "./useTaskSession.js";
23
65
  export { useFunctionSession } from "./useFunctionSession.js";
24
66
  export type { UseFunctionSessionOptions, UseFunctionSessionResult, } from "./useFunctionSession.js";
67
+ export { useFunctionRun } from "./useFunctionRun.js";
68
+ export type { UseFunctionRunOptions, UseFunctionRunResult } from "./useFunctionRun.js";
69
+ export { useFunctionRuns } from "./useFunctionRuns.js";
70
+ export type { UseFunctionRunsOptions, UseFunctionRunsResult } from "./useFunctionRuns.js";
25
71
  export { useFlowSession } from "./useFlowSession.js";
26
72
  export type { UseFlowSessionOptions, UseFlowSessionResult, } from "./useFlowSession.js";
73
+ export { useWorkflowStart } from "./useWorkflowStart.js";
74
+ export type { UseWorkflowStartOptions, UseWorkflowStartResult, } from "./useWorkflowStart.js";
75
+ export { useWorkflowRun } from "./useWorkflowRun.js";
76
+ export type { UseWorkflowRunOptions, UseWorkflowRunResult } from "./useWorkflowRun.js";
77
+ export { useWorkflowRuns } from "./useWorkflowRuns.js";
78
+ export type { UseWorkflowRunsOptions, UseWorkflowRunsResult } from "./useWorkflowRuns.js";
79
+ export { useWorkflowResume } from "./useWorkflowResume.js";
80
+ export type { UseWorkflowResumeOptions, UseWorkflowResumeResult, } from "./useWorkflowResume.js";
27
81
  export { useFlowRunHistory } from "./useFlowRunHistory.js";
28
82
  export type { UseFlowRunHistoryOptions, UseFlowRunHistoryResult, } from "./useFlowRunHistory.js";
@@ -1,14 +1,41 @@
1
1
  export { AuthGuard } from "./AuthGuard.js";
2
2
  export { useAuth } from "./useAuth.js";
3
3
  export { useAssistantRun } from "./useAssistantRun.js";
4
+ export { useConversations } from "./useConversations.js";
5
+ export { useConversation } from "./useConversation.js";
6
+ export { useConversationMessages } from "./useConversationMessages.js";
7
+ export { useAgentRun } from "./useAgentRun.js";
8
+ export { useAgentRuns } from "./useAgentRuns.js";
9
+ export { useAgentInputSchema } from "./useAgentInputSchema.js";
4
10
  export { useAssistantSession } from "./useAssistantSession.js";
5
11
  export { useAssistantRuntime } from "./useAssistantRuntime.js";
12
+ export { useMembers } from "./useMembers.js";
13
+ export { useOrganizationMembers } from "./useOrganizationMembers.js";
14
+ export { useCurrentUser } from "./useCurrentUser.js";
15
+ export { usePodAccess } from "./usePodAccess.js";
16
+ export { useTables } from "./useTables.js";
17
+ export { useTable } from "./useTable.js";
18
+ export { useRecords } from "./useRecords.js";
19
+ export { useRecord } from "./useRecord.js";
20
+ export { useCreateRecord } from "./useCreateRecord.js";
21
+ export { useUpdateRecord } from "./useUpdateRecord.js";
22
+ export { useDeleteRecord } from "./useDeleteRecord.js";
23
+ export { useBulkRecords } from "./useBulkRecords.js";
24
+ export { useJoinedRecords } from "./useJoinedRecords.js";
25
+ export { useRelatedRecords } from "./useRelatedRecords.js";
26
+ export { useReverseRelatedRecords } from "./useReverseRelatedRecords.js";
27
+ export { useForeignKeyOptions } from "./useForeignKeyOptions.js";
28
+ export { useRecordSchema } from "./useRecordSchema.js";
29
+ export { useRecordForm } from "./useRecordForm.js";
30
+ export { useSchemaForm } from "./useSchemaForm.js";
6
31
  export { useAssistantController } from "./useAssistantController.js";
7
- export { AssistantAskOverlay, AssistantComposer, AssistantConversationList, AssistantHeader, AssistantMessageViewport, AssistantModelPicker, AssistantPendingFileChip, AssistantShellLayout, AssistantStatusPill, AssistantThemeScope, } from "./components/AssistantChrome.js";
8
- export { AssistantExperienceView } from "./components/AssistantExperience.js";
9
- export { AssistantEmbedded } from "./components/AssistantEmbedded.js";
10
- export { buildDisplayMessageRows, DEFAULT_EMPTY_STATE_SUGGESTIONS, dedupToolInvocations, EmptyState, findPendingAskUserInput, formatAskUserInputAnswers, getActiveToolBanner, extractPresentFilePathsFromInvocation, latestPlanSummary, MessageGroup, PlanSummaryStrip, ThinkingIndicator, } from "./components/AssistantExperience.js";
11
32
  export { useTaskSession } from "./useTaskSession.js";
12
33
  export { useFunctionSession } from "./useFunctionSession.js";
34
+ export { useFunctionRun } from "./useFunctionRun.js";
35
+ export { useFunctionRuns } from "./useFunctionRuns.js";
13
36
  export { useFlowSession } from "./useFlowSession.js";
37
+ export { useWorkflowStart } from "./useWorkflowStart.js";
38
+ export { useWorkflowRun } from "./useWorkflowRun.js";
39
+ export { useWorkflowRuns } from "./useWorkflowRuns.js";
40
+ export { useWorkflowResume } from "./useWorkflowResume.js";
14
41
  export { useFlowRunHistory } from "./useFlowRunHistory.js";
@@ -0,0 +1,19 @@
1
+ import type { LemmaClient } from "../client.js";
2
+ import type { JsonSchemaLike } from "../schema-form.js";
3
+ import type { Agent } from "../types.js";
4
+ export interface UseAgentInputSchemaOptions {
5
+ client: LemmaClient;
6
+ podId?: string;
7
+ agentName: string;
8
+ enabled?: boolean;
9
+ autoLoad?: boolean;
10
+ }
11
+ export interface UseAgentInputSchemaResult {
12
+ agent: Agent | null;
13
+ inputSchema: JsonSchemaLike | null;
14
+ outputSchema: JsonSchemaLike | null;
15
+ isLoading: boolean;
16
+ error: Error | null;
17
+ refresh: () => Promise<Agent | null>;
18
+ }
19
+ export declare function useAgentInputSchema({ client, podId, agentName, enabled, autoLoad, }: UseAgentInputSchemaOptions): UseAgentInputSchemaResult;
@@ -0,0 +1,73 @@
1
+ import { useCallback, useEffect, useMemo, useState } from "react";
2
+ import { normalizeError, resolvePodClient } from "./utils.js";
3
+ export function useAgentInputSchema({ client, podId, agentName, enabled = true, autoLoad = true, }) {
4
+ const [agent, setAgent] = useState(null);
5
+ const [isLoading, setIsLoading] = useState(false);
6
+ const [error, setError] = useState(null);
7
+ const trimmedAgentName = agentName.trim();
8
+ const isEnabled = enabled && trimmedAgentName.length > 0;
9
+ const refresh = useCallback(async (signal) => {
10
+ if (!isEnabled) {
11
+ setAgent(null);
12
+ setError(null);
13
+ setIsLoading(false);
14
+ return null;
15
+ }
16
+ setIsLoading(true);
17
+ setError(null);
18
+ try {
19
+ const scopedClient = resolvePodClient(client, podId);
20
+ const nextAgent = await scopedClient.agents.get(trimmedAgentName);
21
+ if (signal?.aborted)
22
+ return null;
23
+ setAgent(nextAgent);
24
+ return nextAgent;
25
+ }
26
+ catch (refreshError) {
27
+ if (signal?.aborted)
28
+ return null;
29
+ const normalized = normalizeError(refreshError, "Failed to load agent schema.");
30
+ setError(normalized);
31
+ setAgent(null);
32
+ return null;
33
+ }
34
+ finally {
35
+ if (!signal?.aborted)
36
+ setIsLoading(false);
37
+ }
38
+ }, [client, isEnabled, podId, trimmedAgentName]);
39
+ useEffect(() => {
40
+ if (!isEnabled) {
41
+ setAgent(null);
42
+ setError(null);
43
+ setIsLoading(false);
44
+ return;
45
+ }
46
+ if (!autoLoad)
47
+ return;
48
+ const controller = new AbortController();
49
+ let cancelled = false;
50
+ (async () => {
51
+ try {
52
+ await refresh(controller.signal);
53
+ }
54
+ catch {
55
+ if (!cancelled) {
56
+ setError(normalizeError(new Error("Failed to load agent schema."), "Failed to load agent schema."));
57
+ }
58
+ }
59
+ })();
60
+ return () => {
61
+ cancelled = true;
62
+ controller.abort();
63
+ };
64
+ }, [autoLoad, isEnabled, refresh]);
65
+ return useMemo(() => ({
66
+ agent,
67
+ inputSchema: (agent?.input_schema ?? null),
68
+ outputSchema: (agent?.output_schema ?? null),
69
+ isLoading,
70
+ error,
71
+ refresh,
72
+ }), [agent, error, isLoading, refresh]);
73
+ }
@@ -0,0 +1,17 @@
1
+ import type { Task } from "../types.js";
2
+ import { type UseTaskSessionOptions, type UseTaskSessionResult } from "./useTaskSession.js";
3
+ export interface UseAgentRunOptions extends Omit<UseTaskSessionOptions, "taskId"> {
4
+ agentName?: string;
5
+ taskId?: string | null;
6
+ }
7
+ export interface UseAgentRunResult extends Omit<UseTaskSessionResult, "start"> {
8
+ output: Task["output_data"];
9
+ finalOutput: Task["output_data"];
10
+ isWaitingForInput: boolean;
11
+ isFinished: boolean;
12
+ start: (inputData?: Record<string, unknown> | null, options?: {
13
+ agentName?: string;
14
+ }) => Promise<Task>;
15
+ submitInput: (content: string) => Promise<Task | null>;
16
+ }
17
+ export declare function useAgentRun({ client, podId, agentName, taskId, autoConnect, autoConnectOnStart, onEvent, onStatus, onMessage, onError, }: UseAgentRunOptions): UseAgentRunResult;
@@ -0,0 +1,56 @@
1
+ import { useCallback, useMemo } from "react";
2
+ import { isTerminalTaskStatus, normalizeRunStatus } from "../run-utils.js";
3
+ import { resolvePodClient } from "./utils.js";
4
+ import { useTaskSession, } from "./useTaskSession.js";
5
+ function resolveAgentName(base, override) {
6
+ const resolved = override ?? base;
7
+ if (!resolved) {
8
+ throw new Error("agentName is required.");
9
+ }
10
+ return resolved;
11
+ }
12
+ export function useAgentRun({ client, podId, agentName, taskId = null, autoConnect = true, autoConnectOnStart = true, onEvent, onStatus, onMessage, onError, }) {
13
+ const session = useTaskSession({
14
+ client,
15
+ podId,
16
+ taskId,
17
+ autoConnect,
18
+ autoConnectOnStart,
19
+ onEvent,
20
+ onStatus,
21
+ onMessage,
22
+ onError,
23
+ });
24
+ const start = useCallback(async (inputData, options) => {
25
+ return session.start({
26
+ agentName: resolveAgentName(agentName, options?.agentName),
27
+ inputData: inputData ?? undefined,
28
+ });
29
+ }, [agentName, session]);
30
+ const submitInput = useCallback(async (content) => {
31
+ const resolvedTaskId = session.taskId;
32
+ if (!resolvedTaskId) {
33
+ throw new Error("taskId is required to submit additional agent input.");
34
+ }
35
+ const scopedClient = resolvePodClient(client, podId);
36
+ await scopedClient.tasks.messages.add(resolvedTaskId, { content });
37
+ await session.loadMessages(resolvedTaskId);
38
+ return session.refreshTask(resolvedTaskId);
39
+ }, [client, podId, session]);
40
+ return useMemo(() => {
41
+ const normalizedStatus = normalizeRunStatus(session.status);
42
+ const isFinished = isTerminalTaskStatus(normalizedStatus);
43
+ const isWaitingForInput = normalizedStatus === "WAITING";
44
+ const output = session.task?.output_data ?? null;
45
+ const finalOutput = isFinished ? output : null;
46
+ return {
47
+ ...session,
48
+ output,
49
+ finalOutput,
50
+ isWaitingForInput,
51
+ isFinished,
52
+ start,
53
+ submitInput,
54
+ };
55
+ }, [session, start, submitInput]);
56
+ }
@@ -0,0 +1,33 @@
1
+ import type { LemmaClient } from "../client.js";
2
+ import type { Task } from "../types.js";
3
+ export interface UseAgentRunsOptions {
4
+ client: LemmaClient;
5
+ podId?: string;
6
+ agentName?: string;
7
+ enabled?: boolean;
8
+ autoLoad?: boolean;
9
+ limit?: number;
10
+ pageToken?: string;
11
+ initialTaskId?: string | null;
12
+ }
13
+ export interface UseAgentRunsResult {
14
+ runs: Task[];
15
+ total: number;
16
+ nextPageToken: string | null;
17
+ selectedTaskId: string | null;
18
+ effectiveSelectedTaskId: string | null;
19
+ selectedRun: Task | null;
20
+ isLoading: boolean;
21
+ isLoadingMore: boolean;
22
+ error: Error | null;
23
+ selectRun: (taskId: string | null) => void;
24
+ clearSelection: () => void;
25
+ refresh: (overrides?: {
26
+ limit?: number;
27
+ pageToken?: string;
28
+ }) => Promise<Task[]>;
29
+ loadMore: (overrides?: {
30
+ limit?: number;
31
+ }) => Promise<Task[]>;
32
+ }
33
+ export declare function useAgentRuns({ client, podId, agentName, enabled, autoLoad, limit, pageToken, initialTaskId, }: UseAgentRunsOptions): UseAgentRunsResult;