lemma-sdk 0.2.45 → 0.2.46

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 (56) hide show
  1. package/dist/assistant-events.js +12 -2
  2. package/dist/browser/lemma-client.js +56 -84
  3. package/dist/client.js +1 -1
  4. package/dist/hey_client/types.gen.d.ts +2 -14
  5. package/dist/namespaces/conversations.d.ts +2 -2
  6. package/dist/namespaces/integrations.d.ts +2 -4
  7. package/dist/namespaces/integrations.js +2 -2
  8. package/dist/namespaces/records.d.ts +3 -9
  9. package/dist/namespaces/records.js +4 -33
  10. package/dist/openapi_client/index.d.ts +3 -5
  11. package/dist/openapi_client/index.js +2 -0
  12. package/dist/openapi_client/models/AgentToolset.d.ts +2 -1
  13. package/dist/openapi_client/models/AgentToolset.js +1 -0
  14. package/dist/openapi_client/models/AppTriggerResponseSchema.d.ts +2 -0
  15. package/dist/openapi_client/models/ApprovalDecisionResponse.d.ts +6 -0
  16. package/dist/openapi_client/models/AuthProvider.d.ts +4 -0
  17. package/dist/openapi_client/models/AuthProvider.js +9 -0
  18. package/dist/openapi_client/models/FlowRunStatus.d.ts +3 -2
  19. package/dist/openapi_client/models/FlowRunStatus.js +3 -2
  20. package/dist/openapi_client/models/MessageKind.d.ts +14 -0
  21. package/dist/openapi_client/models/MessageKind.js +19 -0
  22. package/dist/openapi_client/models/MessageResponse.d.ts +5 -6
  23. package/dist/openapi_client/models/WorkflowRunResponse.d.ts +2 -2
  24. package/dist/openapi_client/services/AgentConversationsService.d.ts +5 -5
  25. package/dist/openapi_client/services/AgentConversationsService.js +3 -3
  26. package/dist/openapi_client/services/ApplicationsService.d.ts +19 -19
  27. package/dist/openapi_client/services/ApplicationsService.js +48 -44
  28. package/dist/openapi_client/services/RecordsService.d.ts +1 -3
  29. package/dist/openapi_client/services/RecordsService.js +1 -5
  30. package/dist/react/assistant-output.d.ts +6 -0
  31. package/dist/react/assistant-output.js +16 -0
  32. package/dist/react/useAssistantController.d.ts +8 -1
  33. package/dist/react/useAssistantController.js +87 -250
  34. package/dist/react/useAssistantRuntime.js +6 -17
  35. package/dist/react/useAssistantSession.d.ts +4 -2
  36. package/dist/react/useAssistantSession.js +6 -7
  37. package/dist/react/useConversationMessages.d.ts +2 -2
  38. package/dist/react/useConversationMessages.js +3 -5
  39. package/dist/react/useRecords.d.ts +1 -1
  40. package/dist/react/useRecords.js +2 -13
  41. package/dist/react/useReferencingRecords.d.ts +4 -6
  42. package/dist/react/useReferencingRecords.js +5 -5
  43. package/dist/react/useReverseRelatedRecords.d.ts +3 -4
  44. package/dist/react/useReverseRelatedRecords.js +5 -5
  45. package/dist/types.d.ts +12 -6
  46. package/package.json +1 -1
  47. package/dist/openapi_client/models/NotificationContent.d.ts +0 -4
  48. package/dist/openapi_client/models/TextContent.d.ts +0 -4
  49. package/dist/openapi_client/models/TextContent.js +0 -1
  50. package/dist/openapi_client/models/ThinkingContent.d.ts +0 -4
  51. package/dist/openapi_client/models/ThinkingContent.js +0 -1
  52. package/dist/openapi_client/models/ToolCallContent.d.ts +0 -6
  53. package/dist/openapi_client/models/ToolCallContent.js +0 -1
  54. package/dist/openapi_client/models/ToolReturnContent.d.ts +0 -6
  55. package/dist/openapi_client/models/ToolReturnContent.js +0 -1
  56. /package/dist/openapi_client/models/{NotificationContent.js → ApprovalDecisionResponse.js} +0 -0
@@ -1,10 +1,10 @@
1
+ import type { ApprovalDecisionResponse } from '../models/ApprovalDecisionResponse.js';
1
2
  import type { ConversationListResponse } from '../models/ConversationListResponse.js';
2
3
  import type { ConversationResponse } from '../models/ConversationResponse.js';
3
4
  import type { ConversationStatus } from '../models/ConversationStatus.js';
4
5
  import type { ConversationType } from '../models/ConversationType.js';
5
6
  import type { CreateConversationRequest } from '../models/CreateConversationRequest.js';
6
7
  import type { MessageListResponse } from '../models/MessageListResponse.js';
7
- import type { MessageResponse } from '../models/MessageResponse.js';
8
8
  import type { ResolveUserApprovalRequest } from '../models/ResolveUserApprovalRequest.js';
9
9
  import type { SendMessageRequest } from '../models/SendMessageRequest.js';
10
10
  import type { UpdateConversationRequest } from '../models/UpdateConversationRequest.js';
@@ -54,7 +54,7 @@ export declare class AgentConversationsService {
54
54
  static agentConversationUpdate(podId: string, conversationId: string, requestBody: UpdateConversationRequest): CancelablePromise<ConversationResponse>;
55
55
  /**
56
56
  * List Agent Run Approvals
57
- * List pending user_approval tool calls in a conversation.
57
+ * List pending request_approval tool calls in a conversation.
58
58
  * @param podId
59
59
  * @param conversationId
60
60
  * @returns UserApprovalListResponse Successful Response
@@ -63,15 +63,15 @@ export declare class AgentConversationsService {
63
63
  static agentConversationApprovalList(podId: string, conversationId: string): CancelablePromise<UserApprovalListResponse>;
64
64
  /**
65
65
  * Resolve User Approval
66
- * Append a user_approval tool result and resume the live local turn.
66
+ * Record the user's decision on a request_approval call and wake the paused agent run, which then executes the approved tool as the user.
67
67
  * @param podId
68
68
  * @param conversationId
69
69
  * @param approvalId
70
70
  * @param requestBody
71
- * @returns MessageResponse Successful Response
71
+ * @returns ApprovalDecisionResponse Successful Response
72
72
  * @throws ApiError
73
73
  */
74
- static agentConversationApprovalResolve(podId: string, conversationId: string, approvalId: string, requestBody: ResolveUserApprovalRequest): CancelablePromise<MessageResponse>;
74
+ static agentConversationApprovalResolve(podId: string, conversationId: string, approvalId: string, requestBody: ResolveUserApprovalRequest): CancelablePromise<ApprovalDecisionResponse>;
75
75
  /**
76
76
  * List Pod Conversation Messages
77
77
  * List the latest persisted messages in chronological order. Pass next_page_token as page_token to fetch the next older page above the current page.
@@ -101,7 +101,7 @@ export class AgentConversationsService {
101
101
  }
102
102
  /**
103
103
  * List Agent Run Approvals
104
- * List pending user_approval tool calls in a conversation.
104
+ * List pending request_approval tool calls in a conversation.
105
105
  * @param podId
106
106
  * @param conversationId
107
107
  * @returns UserApprovalListResponse Successful Response
@@ -122,12 +122,12 @@ export class AgentConversationsService {
122
122
  }
123
123
  /**
124
124
  * Resolve User Approval
125
- * Append a user_approval tool result and resume the live local turn.
125
+ * Record the user's decision on a request_approval call and wake the paused agent run, which then executes the approved tool as the user.
126
126
  * @param podId
127
127
  * @param conversationId
128
128
  * @param approvalId
129
129
  * @param requestBody
130
- * @returns MessageResponse Successful Response
130
+ * @returns ApprovalDecisionResponse Successful Response
131
131
  * @throws ApiError
132
132
  */
133
133
  static agentConversationApprovalResolve(podId, conversationId, approvalId, requestBody) {
@@ -20,25 +20,6 @@ export declare class ApplicationsService {
20
20
  * @throws ApiError
21
21
  */
22
22
  static applicationList(limit?: number, pageToken?: (string | null)): CancelablePromise<ApplicationListResponseSchema>;
23
- /**
24
- * List Triggers
25
- * Get all triggers. Optionally filter by application_id and search in description
26
- * @param applicationId
27
- * @param search
28
- * @param limit
29
- * @param pageToken
30
- * @returns AppTriggerListResponseSchema Successful Response
31
- * @throws ApiError
32
- */
33
- static applicationTriggerList(applicationId?: (string | null), search?: (string | null), limit?: number, pageToken?: (string | null)): CancelablePromise<AppTriggerListResponseSchema>;
34
- /**
35
- * Get Trigger
36
- * Get a specific trigger by ID
37
- * @param triggerId
38
- * @returns AppTriggerResponseSchema Successful Response
39
- * @throws ApiError
40
- */
41
- static applicationTriggerGet(triggerId: string): CancelablePromise<AppTriggerResponseSchema>;
42
23
  /**
43
24
  * Get Application
44
25
  * Get a specific application by ID along with its operation catalog
@@ -94,4 +75,23 @@ export declare class ApplicationsService {
94
75
  * @throws ApiError
95
76
  */
96
77
  static applicationOperationExecute(organizationId: string, authConfigName: string, operationName: string, requestBody: OperationExecutionRequest): CancelablePromise<OperationExecutionResponse>;
78
+ /**
79
+ * List Application Triggers
80
+ * @param organizationId
81
+ * @param authConfigName
82
+ * @param search
83
+ * @param limit
84
+ * @returns AppTriggerListResponseSchema Successful Response
85
+ * @throws ApiError
86
+ */
87
+ static applicationTriggerList(organizationId: string, authConfigName: string, search?: (string | null), limit?: number): CancelablePromise<AppTriggerListResponseSchema>;
88
+ /**
89
+ * Get Application Trigger
90
+ * @param organizationId
91
+ * @param authConfigName
92
+ * @param triggerName
93
+ * @returns AppTriggerResponseSchema Successful Response
94
+ * @throws ApiError
95
+ */
96
+ static applicationTriggerGet(organizationId: string, authConfigName: string, triggerName: string): CancelablePromise<AppTriggerResponseSchema>;
97
97
  }
@@ -22,50 +22,6 @@ export class ApplicationsService {
22
22
  },
23
23
  });
24
24
  }
25
- /**
26
- * List Triggers
27
- * Get all triggers. Optionally filter by application_id and search in description
28
- * @param applicationId
29
- * @param search
30
- * @param limit
31
- * @param pageToken
32
- * @returns AppTriggerListResponseSchema Successful Response
33
- * @throws ApiError
34
- */
35
- static applicationTriggerList(applicationId, search, limit = 100, pageToken) {
36
- return __request(OpenAPI, {
37
- method: 'GET',
38
- url: '/integrations/applications/triggers',
39
- query: {
40
- 'application_id': applicationId,
41
- 'search': search,
42
- 'limit': limit,
43
- 'page_token': pageToken,
44
- },
45
- errors: {
46
- 422: `Validation Error`,
47
- },
48
- });
49
- }
50
- /**
51
- * Get Trigger
52
- * Get a specific trigger by ID
53
- * @param triggerId
54
- * @returns AppTriggerResponseSchema Successful Response
55
- * @throws ApiError
56
- */
57
- static applicationTriggerGet(triggerId) {
58
- return __request(OpenAPI, {
59
- method: 'GET',
60
- url: '/integrations/applications/triggers/{trigger_id}',
61
- path: {
62
- 'trigger_id': triggerId,
63
- },
64
- errors: {
65
- 422: `Validation Error`,
66
- },
67
- });
68
- }
69
25
  /**
70
26
  * Get Application
71
27
  * Get a specific application by ID along with its operation catalog
@@ -204,4 +160,52 @@ export class ApplicationsService {
204
160
  },
205
161
  });
206
162
  }
163
+ /**
164
+ * List Application Triggers
165
+ * @param organizationId
166
+ * @param authConfigName
167
+ * @param search
168
+ * @param limit
169
+ * @returns AppTriggerListResponseSchema Successful Response
170
+ * @throws ApiError
171
+ */
172
+ static applicationTriggerList(organizationId, authConfigName, search, limit = 100) {
173
+ return __request(OpenAPI, {
174
+ method: 'GET',
175
+ url: '/organizations/{organization_id}/integrations/{auth_config_name}/triggers',
176
+ path: {
177
+ 'organization_id': organizationId,
178
+ 'auth_config_name': authConfigName,
179
+ },
180
+ query: {
181
+ 'search': search,
182
+ 'limit': limit,
183
+ },
184
+ errors: {
185
+ 422: `Validation Error`,
186
+ },
187
+ });
188
+ }
189
+ /**
190
+ * Get Application Trigger
191
+ * @param organizationId
192
+ * @param authConfigName
193
+ * @param triggerName
194
+ * @returns AppTriggerResponseSchema Successful Response
195
+ * @throws ApiError
196
+ */
197
+ static applicationTriggerGet(organizationId, authConfigName, triggerName) {
198
+ return __request(OpenAPI, {
199
+ method: 'GET',
200
+ url: '/organizations/{organization_id}/integrations/{auth_config_name}/triggers/{trigger_name}',
201
+ path: {
202
+ 'organization_id': organizationId,
203
+ 'auth_config_name': authConfigName,
204
+ 'trigger_name': triggerName,
205
+ },
206
+ errors: {
207
+ 422: `Validation Error`,
208
+ },
209
+ });
210
+ }
207
211
  }
@@ -14,15 +14,13 @@ export declare class RecordsService {
14
14
  * @param tableName
15
15
  * @param limit Max number of rows to return.
16
16
  * @param offset Row offset for direct pagination.
17
- * @param sortBy Optional column name to sort by.
18
- * @param order Sort direction for `sort_by`: `asc` or `desc`.
19
17
  * @param filter Optional repeated JSON filters for advanced comparisons. Each `filter` value must be a JSON object with shape `{"field":"<column_name>","op":"<operator>","value":<comparison_value>}`. Allowed operators are: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `like`, `ilike`. Repeat the query parameter to combine multiple filters with AND semantics. Examples: `filter={"field":"amount","op":"gt","value":100}` and `filter={"field":"status","op":"eq","value":"OPEN"}`.
20
18
  * @param sort Optional repeated JSON sort clauses. Each `sort` value must be a JSON object with shape `{"field":"<column_name>","direction":"<direction>"}`. Allowed directions are: `asc`, `desc`. Repeat the query parameter to provide multi-column sorting in priority order. Example: `sort={"field":"created_at","direction":"desc"}`.
21
19
  * @param pageToken Opaque token from a previous response page.
22
20
  * @returns RecordListResponse Successful Response
23
21
  * @throws ApiError
24
22
  */
25
- static recordList(podId: string, tableName: string, limit?: number, offset?: number, sortBy?: (string | null), order?: string, filter?: (Array<string> | null), sort?: (Array<string> | null), pageToken?: (string | null)): CancelablePromise<RecordListResponse>;
23
+ static recordList(podId: string, tableName: string, limit?: number, offset?: number, filter?: (Array<string> | null), sort?: (Array<string> | null), pageToken?: (string | null)): CancelablePromise<RecordListResponse>;
26
24
  /**
27
25
  * Create Record
28
26
  * Insert a record into a table. Returns the created record object keyed by column name (no envelope). Reserved tables (`reserved_*`) are system-managed and cannot be mutated through record write endpoints.
@@ -8,15 +8,13 @@ export class RecordsService {
8
8
  * @param tableName
9
9
  * @param limit Max number of rows to return.
10
10
  * @param offset Row offset for direct pagination.
11
- * @param sortBy Optional column name to sort by.
12
- * @param order Sort direction for `sort_by`: `asc` or `desc`.
13
11
  * @param filter Optional repeated JSON filters for advanced comparisons. Each `filter` value must be a JSON object with shape `{"field":"<column_name>","op":"<operator>","value":<comparison_value>}`. Allowed operators are: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `like`, `ilike`. Repeat the query parameter to combine multiple filters with AND semantics. Examples: `filter={"field":"amount","op":"gt","value":100}` and `filter={"field":"status","op":"eq","value":"OPEN"}`.
14
12
  * @param sort Optional repeated JSON sort clauses. Each `sort` value must be a JSON object with shape `{"field":"<column_name>","direction":"<direction>"}`. Allowed directions are: `asc`, `desc`. Repeat the query parameter to provide multi-column sorting in priority order. Example: `sort={"field":"created_at","direction":"desc"}`.
15
13
  * @param pageToken Opaque token from a previous response page.
16
14
  * @returns RecordListResponse Successful Response
17
15
  * @throws ApiError
18
16
  */
19
- static recordList(podId, tableName, limit = 20, offset, sortBy, order = 'asc', filter, sort, pageToken) {
17
+ static recordList(podId, tableName, limit = 20, offset, filter, sort, pageToken) {
20
18
  return __request(OpenAPI, {
21
19
  method: 'GET',
22
20
  url: '/pods/{pod_id}/datastore/tables/{table_name}/records',
@@ -27,8 +25,6 @@ export class RecordsService {
27
25
  query: {
28
26
  'limit': limit,
29
27
  'offset': offset,
30
- 'sort_by': sortBy,
31
- 'order': order,
32
28
  'filter': filter,
33
29
  'sort': sort,
34
30
  'page_token': pageToken,
@@ -2,5 +2,11 @@ import type { ConversationMessage } from "../types.js";
2
2
  export declare function normalizeConversationStatus(status: unknown): string | undefined;
3
3
  export declare function isConversationRunningStatus(status: unknown): boolean;
4
4
  export declare function extractConversationMessageText(content: unknown): string;
5
+ /**
6
+ * Display text for a flat conversation message. Text/thinking/notification
7
+ * messages carry their body under `text`; tool_return messages may carry a
8
+ * human-readable payload under `tool_result`.
9
+ */
10
+ export declare function conversationMessageText(message: Pick<ConversationMessage, "text" | "tool_result"> | null | undefined): string;
5
11
  export declare function sortConversationMessagesByCreatedAt(messages: ConversationMessage[]): ConversationMessage[];
6
12
  export declare function getLatestAssistantMessage(messages: ConversationMessage[]): ConversationMessage | null;
@@ -72,6 +72,22 @@ export function extractConversationMessageText(content) {
72
72
  return content.text.trim();
73
73
  return extractTextFromStructuredContentEntry(content);
74
74
  }
75
+ /**
76
+ * Display text for a flat conversation message. Text/thinking/notification
77
+ * messages carry their body under `text`; tool_return messages may carry a
78
+ * human-readable payload under `tool_result`.
79
+ */
80
+ export function conversationMessageText(message) {
81
+ if (!message)
82
+ return "";
83
+ if (typeof message.text === "string" && message.text.trim().length > 0) {
84
+ return message.text.trim();
85
+ }
86
+ if (message.tool_result !== undefined && message.tool_result !== null) {
87
+ return extractConversationMessageText(message.tool_result);
88
+ }
89
+ return "";
90
+ }
75
91
  export function sortConversationMessagesByCreatedAt(messages) {
76
92
  return [...messages].sort((a, b) => {
77
93
  const aTime = Number.isFinite(new Date(a.created_at).getTime()) ? new Date(a.created_at).getTime() : 0;
@@ -1,5 +1,5 @@
1
1
  import type { LemmaClient } from "../client.js";
2
- import type { AgentRuntimeConfig, AvailableModelInfo, Conversation, ConversationModel } from "../types.js";
2
+ import type { AgentRuntimeConfig, AvailableModelInfo, Conversation, ConversationModel, MessageKind } from "../types.js";
3
3
  import { type AssistantStreamingTool } from "./useAssistantSession.js";
4
4
  export type { AssistantStreamingTool } from "./useAssistantSession.js";
5
5
  export interface AssistantConversationScope {
@@ -50,8 +50,12 @@ export interface AssistantRenderableMessage {
50
50
  agent_run_id?: string | null;
51
51
  metadata?: Record<string, unknown> | null;
52
52
  message_metadata?: Record<string, unknown> | null;
53
+ /** Flat message fields, passed through so consumers can inspect the raw kind. */
54
+ kind?: MessageKind;
53
55
  tool_call_id?: string | null;
54
56
  tool_name?: string | null;
57
+ tool_args?: unknown;
58
+ tool_result?: unknown;
55
59
  }
56
60
  export interface AssistantAction {
57
61
  id: string;
@@ -94,6 +98,8 @@ export interface UseAssistantControllerResult {
94
98
  isActiveConversationRunning: boolean;
95
99
  isLoading: boolean;
96
100
  isLoadingConversations: boolean;
101
+ isLoadingMoreConversations: boolean;
102
+ hasMoreConversations: boolean;
97
103
  isLoadingMessages: boolean;
98
104
  isLoadingOlderMessages: boolean;
99
105
  hasOlderMessages: boolean;
@@ -113,6 +119,7 @@ export interface UseAssistantControllerResult {
113
119
  removePendingFile: (fileKey: string) => void;
114
120
  clearPendingFiles: () => void;
115
121
  loadOlderMessages: () => Promise<boolean>;
122
+ loadMoreConversations: () => Promise<Conversation[]>;
116
123
  resolveUserApproval: (approvalId: string, decision: AssistantUserApprovalDecision, response?: Record<string, unknown> | null) => Promise<void>;
117
124
  clearMessages: () => void;
118
125
  stop: () => void;