lemma-sdk 0.2.36 → 0.2.38

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 (171) hide show
  1. package/README.md +45 -30
  2. package/dist/browser/lemma-client.js +224 -212
  3. package/dist/client.d.ts +1 -4
  4. package/dist/client.js +1 -6
  5. package/dist/index.d.ts +2 -5
  6. package/dist/index.js +1 -2
  7. package/dist/namespaces/agents.js +1 -1
  8. package/dist/namespaces/conversations.d.ts +68 -0
  9. package/dist/namespaces/conversations.js +159 -0
  10. package/dist/namespaces/files.d.ts +24 -6
  11. package/dist/namespaces/files.js +25 -12
  12. package/dist/namespaces/integrations.js +1 -1
  13. package/dist/namespaces/pod-surfaces.d.ts +1 -1
  14. package/dist/namespaces/pod-surfaces.js +6 -6
  15. package/dist/openapi_client/index.d.ts +17 -32
  16. package/dist/openapi_client/index.js +8 -12
  17. package/dist/openapi_client/models/AdminConsentInfoResponse.d.ts +2 -2
  18. package/dist/openapi_client/models/AgentListResponse.d.ts +2 -4
  19. package/dist/openapi_client/models/AgentMessageResponse.d.ts +0 -3
  20. package/dist/openapi_client/models/{AvailableModels.d.ts → AgentModelName.d.ts} +4 -1
  21. package/dist/openapi_client/models/AgentModelName.js +18 -0
  22. package/dist/openapi_client/models/AgentResponse.d.ts +18 -13
  23. package/dist/openapi_client/models/AgentSurfaceListResponse.d.ts +6 -0
  24. package/dist/openapi_client/models/{AssistantSurfaceResponse.d.ts → AgentSurfaceResponse.d.ts} +6 -5
  25. package/dist/openapi_client/models/{AssistantSurfaceStatus.d.ts → AgentSurfaceStatus.d.ts} +1 -1
  26. package/dist/openapi_client/models/AgentSurfaceStatus.js +10 -0
  27. package/dist/openapi_client/models/{ToolSet.d.ts → AgentToolset.d.ts} +3 -5
  28. package/dist/openapi_client/models/AgentToolset.js +17 -0
  29. package/dist/openapi_client/models/ApplicationAccessConfig.d.ts +3 -5
  30. package/dist/openapi_client/models/ApplicationMode.d.ts +3 -3
  31. package/dist/openapi_client/models/ApplicationMode.js +3 -3
  32. package/dist/openapi_client/models/ConversationResponse.d.ts +9 -20
  33. package/dist/openapi_client/models/CreateAgentRequest.d.ts +11 -7
  34. package/dist/openapi_client/models/CreateConversationRequest.d.ts +4 -8
  35. package/dist/openapi_client/models/CreateFolderRequest.d.ts +2 -5
  36. package/dist/openapi_client/models/CreateFunctionRequest.d.ts +2 -2
  37. package/dist/openapi_client/models/CreateSurfaceRequest.d.ts +1 -1
  38. package/dist/openapi_client/models/DatastoreFileUploadRequest.d.ts +2 -2
  39. package/dist/openapi_client/models/FileNamespace.d.ts +4 -0
  40. package/dist/openapi_client/models/FileNamespace.js +9 -0
  41. package/dist/openapi_client/models/FileResponse.d.ts +2 -2
  42. package/dist/openapi_client/models/FlowRunEntity.d.ts +10 -1
  43. package/dist/openapi_client/models/FunctionResponse.d.ts +2 -2
  44. package/dist/openapi_client/models/HarnessKind.d.ts +7 -0
  45. package/dist/openapi_client/models/HarnessKind.js +12 -0
  46. package/dist/openapi_client/models/MessageListResponse.d.ts +6 -0
  47. package/dist/openapi_client/models/{TaskMessageResponse.d.ts → MessageResponse.d.ts} +8 -7
  48. package/dist/openapi_client/models/OrganizationInvitationResponse.d.ts +1 -0
  49. package/dist/openapi_client/models/ReportFeedbackResponse.d.ts +0 -4
  50. package/dist/openapi_client/models/ResourceType.d.ts +0 -1
  51. package/dist/openapi_client/models/ResourceType.js +0 -1
  52. package/dist/openapi_client/models/SendMessageRequest.d.ts +5 -0
  53. package/dist/openapi_client/models/{ToolCallRequest.d.ts → ToolCallContent.d.ts} +1 -1
  54. package/dist/openapi_client/models/{ToolCallResponse.d.ts → ToolReturnContent.d.ts} +2 -1
  55. package/dist/openapi_client/models/UpdateAgentRequest.d.ts +11 -7
  56. package/dist/openapi_client/models/UpdateConversationRequest.d.ts +2 -5
  57. package/dist/openapi_client/models/UpdateFunctionRequest.d.ts +2 -2
  58. package/dist/openapi_client/models/app__modules__agent__domain__value_objects__TableAccessEntry.d.ts +8 -0
  59. package/dist/openapi_client/models/{TableAccessEntry.d.ts → app__modules__function__api__schemas__function_schemas__TableAccessEntry.d.ts} +1 -1
  60. package/dist/openapi_client/models/update.d.ts +2 -2
  61. package/dist/openapi_client/services/AgentConversationsService.d.ts +87 -0
  62. package/dist/openapi_client/services/{ConversationsService.js → AgentConversationsService.js} +61 -72
  63. package/dist/openapi_client/services/{AssistantSurfacesIngressService.d.ts → AgentSurfacesIngressService.d.ts} +2 -2
  64. package/dist/openapi_client/services/{AssistantSurfacesIngressService.js → AgentSurfacesIngressService.js} +2 -2
  65. package/dist/openapi_client/services/{AssistantSurfacesService.d.ts → AgentSurfacesService.d.ts} +11 -11
  66. package/dist/openapi_client/services/{AssistantSurfacesService.js → AgentSurfacesService.js} +10 -10
  67. package/dist/openapi_client/services/AgentToolsService.d.ts +8 -8
  68. package/dist/openapi_client/services/AgentToolsService.js +8 -8
  69. package/dist/openapi_client/services/AgentsService.d.ts +7 -7
  70. package/dist/openapi_client/services/AgentsService.js +8 -8
  71. package/dist/openapi_client/services/FilesService.d.ts +17 -8
  72. package/dist/openapi_client/services/FilesService.js +25 -8
  73. package/dist/openapi_client/services/WorkflowsService.d.ts +1 -1
  74. package/dist/openapi_client/services/WorkflowsService.js +1 -1
  75. package/dist/react/index.d.ts +0 -8
  76. package/dist/react/index.js +0 -4
  77. package/dist/react/useAssistantController.d.ts +6 -2
  78. package/dist/react/useAssistantController.js +56 -15
  79. package/dist/react/useAssistantSession.d.ts +15 -5
  80. package/dist/react/useAssistantSession.js +24 -26
  81. package/dist/react/useConversationMessages.d.ts +6 -2
  82. package/dist/react/useConversationMessages.js +2 -1
  83. package/dist/react/useConversations.d.ts +6 -2
  84. package/dist/react/useConversations.js +7 -5
  85. package/dist/react/useCreateFolder.d.ts +4 -2
  86. package/dist/react/useCreateFolder.js +6 -3
  87. package/dist/react/useDeleteFile.d.ts +4 -1
  88. package/dist/react/useDeleteFile.js +3 -3
  89. package/dist/react/useFile.d.ts +4 -2
  90. package/dist/react/useFile.js +3 -3
  91. package/dist/react/useFilePreview.d.ts +4 -1
  92. package/dist/react/useFilePreview.js +5 -4
  93. package/dist/react/useFileTree.d.ts +4 -2
  94. package/dist/react/useFileTree.js +3 -2
  95. package/dist/react/useFiles.d.ts +4 -2
  96. package/dist/react/useFiles.js +5 -3
  97. package/dist/react/useUpdateFile.d.ts +4 -2
  98. package/dist/react/useUpdateFile.js +6 -3
  99. package/dist/react/useUploadFile.d.ts +4 -2
  100. package/dist/react/useUploadFile.js +6 -3
  101. package/dist/react/useWorkflowRun.js +1 -1
  102. package/dist/react/useWorkflowStart.js +1 -1
  103. package/dist/run-utils.d.ts +2 -5
  104. package/dist/run-utils.js +0 -10
  105. package/dist/types.d.ts +24 -10
  106. package/package.json +1 -1
  107. package/dist/namespaces/assistants.d.ts +0 -96
  108. package/dist/namespaces/assistants.js +0 -160
  109. package/dist/namespaces/tasks.d.ts +0 -29
  110. package/dist/namespaces/tasks.js +0 -49
  111. package/dist/openapi_client/models/AddMessageRequest.d.ts +0 -6
  112. package/dist/openapi_client/models/AssistantListResponse.d.ts +0 -6
  113. package/dist/openapi_client/models/AssistantResponse.d.ts +0 -23
  114. package/dist/openapi_client/models/AssistantSurfaceListResponse.d.ts +0 -6
  115. package/dist/openapi_client/models/AssistantSurfaceStatus.js +0 -10
  116. package/dist/openapi_client/models/AvailableModelInfo.d.ts +0 -8
  117. package/dist/openapi_client/models/AvailableModels.js +0 -15
  118. package/dist/openapi_client/models/AvailableModelsListResponse.d.ts +0 -7
  119. package/dist/openapi_client/models/ConversationMessageListResponse.d.ts +0 -6
  120. package/dist/openapi_client/models/ConversationMessageResponse.d.ts +0 -19
  121. package/dist/openapi_client/models/ConversationStatus.d.ts +0 -7
  122. package/dist/openapi_client/models/ConversationStatus.js +0 -12
  123. package/dist/openapi_client/models/ConversationType.d.ts +0 -8
  124. package/dist/openapi_client/models/ConversationType.js +0 -13
  125. package/dist/openapi_client/models/CreateAssistantRequest.d.ts +0 -18
  126. package/dist/openapi_client/models/CreateAssistantRequest.js +0 -1
  127. package/dist/openapi_client/models/CreateMessageRequest.d.ts +0 -6
  128. package/dist/openapi_client/models/CreateMessageRequest.js +0 -1
  129. package/dist/openapi_client/models/CreateTaskRequest.d.ts +0 -10
  130. package/dist/openapi_client/models/CreateTaskRequest.js +0 -1
  131. package/dist/openapi_client/models/FileVisibility.d.ts +0 -4
  132. package/dist/openapi_client/models/FileVisibility.js +0 -9
  133. package/dist/openapi_client/models/TableAccessEntry.js +0 -1
  134. package/dist/openapi_client/models/TaskListResponse.d.ts +0 -9
  135. package/dist/openapi_client/models/TaskListResponse.js +0 -1
  136. package/dist/openapi_client/models/TaskMessageListResponse.d.ts +0 -9
  137. package/dist/openapi_client/models/TaskMessageListResponse.js +0 -1
  138. package/dist/openapi_client/models/TaskMessageResponse.js +0 -1
  139. package/dist/openapi_client/models/TaskResponse.d.ts +0 -16
  140. package/dist/openapi_client/models/TaskResponse.js +0 -1
  141. package/dist/openapi_client/models/TaskStatus.d.ts +0 -12
  142. package/dist/openapi_client/models/TaskStatus.js +0 -17
  143. package/dist/openapi_client/models/ToolCallRequest.js +0 -1
  144. package/dist/openapi_client/models/ToolCallResponse.js +0 -1
  145. package/dist/openapi_client/models/ToolSet.js +0 -19
  146. package/dist/openapi_client/models/UpdateAssistantRequest.d.ts +0 -17
  147. package/dist/openapi_client/models/UpdateAssistantRequest.js +0 -1
  148. package/dist/openapi_client/services/AssistantsService.d.ts +0 -49
  149. package/dist/openapi_client/services/AssistantsService.js +0 -112
  150. package/dist/openapi_client/services/ConversationsService.d.ts +0 -88
  151. package/dist/openapi_client/services/TasksService.d.ts +0 -76
  152. package/dist/openapi_client/services/TasksService.js +0 -167
  153. package/dist/react/useAgentRun.d.ts +0 -17
  154. package/dist/react/useAgentRun.js +0 -56
  155. package/dist/react/useAgentRuns.d.ts +0 -33
  156. package/dist/react/useAgentRuns.js +0 -149
  157. package/dist/react/useAssistantRun.d.ts +0 -27
  158. package/dist/react/useAssistantRun.js +0 -47
  159. package/dist/react/useTaskSession.d.ts +0 -35
  160. package/dist/react/useTaskSession.js +0 -269
  161. package/dist/task-events.d.ts +0 -8
  162. package/dist/task-events.js +0 -115
  163. /package/dist/openapi_client/models/{AddMessageRequest.js → AgentSurfaceListResponse.js} +0 -0
  164. /package/dist/openapi_client/models/{AssistantListResponse.js → AgentSurfaceResponse.js} +0 -0
  165. /package/dist/openapi_client/models/{AssistantResponse.js → MessageListResponse.js} +0 -0
  166. /package/dist/openapi_client/models/{AssistantSurfaceListResponse.js → MessageResponse.js} +0 -0
  167. /package/dist/openapi_client/models/{AssistantSurfaceResponse.js → SendMessageRequest.js} +0 -0
  168. /package/dist/openapi_client/models/{AvailableModelInfo.js → ToolCallContent.js} +0 -0
  169. /package/dist/openapi_client/models/{AvailableModelsListResponse.js → ToolReturnContent.js} +0 -0
  170. /package/dist/openapi_client/models/{ConversationMessageListResponse.js → app__modules__agent__domain__value_objects__TableAccessEntry.js} +0 -0
  171. /package/dist/openapi_client/models/{ConversationMessageResponse.js → app__modules__function__api__schemas__function_schemas__TableAccessEntry.js} +0 -0
package/dist/client.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { type LemmaConfig } from "./config.js";
2
2
  import { AuthManager, type AuthState, type AuthListener } from "./auth.js";
3
3
  import { AgentsNamespace } from "./namespaces/agents.js";
4
- import { AssistantsNamespace, ConversationsNamespace } from "./namespaces/assistants.js";
4
+ import { ConversationsNamespace } from "./namespaces/conversations.js";
5
5
  import { DesksNamespace } from "./namespaces/desks.js";
6
6
  import { FilesNamespace } from "./namespaces/files.js";
7
7
  import { FunctionsNamespace } from "./namespaces/functions.js";
@@ -15,7 +15,6 @@ import { PodSurfacesNamespace } from "./namespaces/pod-surfaces.js";
15
15
  import { RecordsNamespace } from "./namespaces/records.js";
16
16
  import { ResourcesNamespace } from "./namespaces/resources.js";
17
17
  import { TablesNamespace } from "./namespaces/tables.js";
18
- import { TasksNamespace } from "./namespaces/tasks.js";
19
18
  import { UsersNamespace } from "./namespaces/users.js";
20
19
  import { WorkflowsNamespace } from "./namespaces/workflows.js";
21
20
  import { DatastoreNamespace } from "./namespaces/datastore.js";
@@ -38,8 +37,6 @@ export declare class LemmaClient {
38
37
  readonly files: FilesNamespace;
39
38
  readonly functions: FunctionsNamespace;
40
39
  readonly agents: AgentsNamespace;
41
- readonly tasks: TasksNamespace;
42
- readonly assistants: AssistantsNamespace;
43
40
  readonly conversations: ConversationsNamespace;
44
41
  readonly workflows: WorkflowsNamespace;
45
42
  readonly desks: DesksNamespace;
package/dist/client.js CHANGED
@@ -3,7 +3,7 @@ import { AuthManager } from "./auth.js";
3
3
  import { GeneratedClientAdapter } from "./generated.js";
4
4
  import { HttpClient } from "./http.js";
5
5
  import { AgentsNamespace } from "./namespaces/agents.js";
6
- import { AssistantsNamespace, ConversationsNamespace } from "./namespaces/assistants.js";
6
+ import { ConversationsNamespace } from "./namespaces/conversations.js";
7
7
  import { DesksNamespace } from "./namespaces/desks.js";
8
8
  import { FilesNamespace } from "./namespaces/files.js";
9
9
  import { FunctionsNamespace } from "./namespaces/functions.js";
@@ -17,7 +17,6 @@ import { PodSurfacesNamespace } from "./namespaces/pod-surfaces.js";
17
17
  import { RecordsNamespace } from "./namespaces/records.js";
18
18
  import { ResourcesNamespace } from "./namespaces/resources.js";
19
19
  import { TablesNamespace } from "./namespaces/tables.js";
20
- import { TasksNamespace } from "./namespaces/tasks.js";
21
20
  import { UsersNamespace } from "./namespaces/users.js";
22
21
  import { WorkflowsNamespace } from "./namespaces/workflows.js";
23
22
  import { DatastoreNamespace } from "./namespaces/datastore.js";
@@ -36,8 +35,6 @@ export class LemmaClient {
36
35
  files;
37
36
  functions;
38
37
  agents;
39
- tasks;
40
- assistants;
41
38
  conversations;
42
39
  workflows;
43
40
  desks;
@@ -69,8 +66,6 @@ export class LemmaClient {
69
66
  this.files = new FilesNamespace(this._generated, this._http, podIdFn);
70
67
  this.functions = new FunctionsNamespace(this._generated, podIdFn);
71
68
  this.agents = new AgentsNamespace(this._generated, podIdFn);
72
- this.tasks = new TasksNamespace(this._http, podIdFn);
73
- this.assistants = new AssistantsNamespace(this._http, podIdFn);
74
69
  this.conversations = new ConversationsNamespace(this._http, podIdFn);
75
70
  this.workflows = new WorkflowsNamespace(this._generated, this._http, podIdFn);
76
71
  this.desks = new DesksNamespace(this._generated, this._http, podIdFn);
package/dist/index.d.ts CHANGED
@@ -6,10 +6,8 @@ export { ApiError } from "./http.js";
6
6
  export * from "./types.js";
7
7
  export { readSSE, parseSSEJson } from "./streams.js";
8
8
  export type { SseRawEvent } from "./streams.js";
9
- export { normalizeRunStatus, isTerminalTaskStatus, isTerminalFunctionStatus, isTerminalFlowStatus, sleep, nextBackoffDelay, } from "./run-utils.js";
9
+ export { normalizeRunStatus, isTerminalFunctionStatus, isTerminalFlowStatus, sleep, nextBackoffDelay, } from "./run-utils.js";
10
10
  export type { AnyRunStatus } from "./run-utils.js";
11
- export { parseTaskStreamEvent, upsertTaskMessage } from "./task-events.js";
12
- export type { ParsedTaskStreamEvent } from "./task-events.js";
13
11
  export { parseAssistantStreamEvent, upsertConversationMessage } from "./assistant-events.js";
14
12
  export type { ParsedAssistantStreamEvent } from "./assistant-events.js";
15
13
  export { DEFAULT_RECORD_FORM_HIDDEN_FIELDS, buildRecordFormValues, buildRecordPayload, buildRecordSchemaFields, formatRecordValueForForm, getEditableRecordFields, getRecordFieldKind, orderRecordSchemaFields, } from "./record-form.js";
@@ -22,7 +20,7 @@ export { buildJoinedRecordsQuery, parseForeignKeyReference, } from "./datastore-
22
20
  export type { ForeignKeyReference, JoinedRecordsColumnRef, JoinedRecordsFilter, JoinedRecordsJoin, JoinedRecordsJoinCondition, JoinedRecordsOrderBy, JoinedRecordsQueryDefinition, JoinedRecordsSelectField, JoinedRecordsSource, } from "./datastore-query.js";
23
21
  export type { AgentsNamespace } from "./namespaces/agents.js";
24
22
  export type { DatastoreNamespace } from "./namespaces/datastore.js";
25
- export type { AssistantsNamespace, ConversationsNamespace } from "./namespaces/assistants.js";
23
+ export type { ConversationsNamespace } from "./namespaces/conversations.js";
26
24
  export type { DesksNamespace } from "./namespaces/desks.js";
27
25
  export type { FilesNamespace } from "./namespaces/files.js";
28
26
  export type { FunctionsNamespace } from "./namespaces/functions.js";
@@ -36,6 +34,5 @@ export type { PodSurfacesNamespace } from "./namespaces/pod-surfaces.js";
36
34
  export type { RecordsNamespace } from "./namespaces/records.js";
37
35
  export type { ResourceType, ResourcesNamespace } from "./namespaces/resources.js";
38
36
  export type { TablesNamespace } from "./namespaces/tables.js";
39
- export type { TasksNamespace } from "./namespaces/tasks.js";
40
37
  export type { UsersNamespace } from "./namespaces/users.js";
41
38
  export type { WorkflowsNamespace } from "./namespaces/workflows.js";
package/dist/index.js CHANGED
@@ -3,8 +3,7 @@ export { AuthManager, buildAuthUrl, buildFederatedLogoutUrl, clearTestingToken,
3
3
  export { ApiError } from "./http.js";
4
4
  export * from "./types.js";
5
5
  export { readSSE, parseSSEJson } from "./streams.js";
6
- export { normalizeRunStatus, isTerminalTaskStatus, isTerminalFunctionStatus, isTerminalFlowStatus, sleep, nextBackoffDelay, } from "./run-utils.js";
7
- export { parseTaskStreamEvent, upsertTaskMessage } from "./task-events.js";
6
+ export { normalizeRunStatus, isTerminalFunctionStatus, isTerminalFlowStatus, sleep, nextBackoffDelay, } from "./run-utils.js";
8
7
  export { parseAssistantStreamEvent, upsertConversationMessage } from "./assistant-events.js";
9
8
  export { DEFAULT_RECORD_FORM_HIDDEN_FIELDS, buildRecordFormValues, buildRecordPayload, buildRecordSchemaFields, formatRecordValueForForm, getEditableRecordFields, getRecordFieldKind, orderRecordSchemaFields, } from "./record-form.js";
10
9
  export { buildDefaultRecordDetailFieldGroups, detectRecordDescriptionColumn, detectRecordStatusColumn, detectRecordTitleColumn, formatRecordDateDisplayValue, formatRecordDisplayValue, formatRecordPlainValue, humanizeRecordFieldName, isDefaultRecordDetailHiddenField, } from "./record-display.js";
@@ -7,7 +7,7 @@ export class AgentsNamespace {
7
7
  this.podId = podId;
8
8
  }
9
9
  list(options = {}) {
10
- return this.client.request(() => AgentsService.agentList(this.podId(), options.limit ?? 100, options.pageToken));
10
+ return this.client.request(() => AgentsService.agentList(this.podId(), options.pageToken, options.limit ?? 100));
11
11
  }
12
12
  create(payload) {
13
13
  return this.client.request(() => AgentsService.agentCreate(this.podId(), payload));
@@ -0,0 +1,68 @@
1
+ import type { HttpClient } from "../http.js";
2
+ import type { ConversationListResponse } from "../openapi_client/models/ConversationListResponse.js";
3
+ import type { CreateConversationRequest } from "../openapi_client/models/CreateConversationRequest.js";
4
+ import type { SendMessageRequest } from "../openapi_client/models/SendMessageRequest.js";
5
+ import type { UpdateConversationRequest } from "../openapi_client/models/UpdateConversationRequest.js";
6
+ import type { AvailableModelInfo, Conversation, ConversationMessage, ConversationModel, CursorPage } from "../types.js";
7
+ type ConversationCreateInput = CreateConversationRequest & {
8
+ agent_name?: string | null;
9
+ model?: ConversationModel | null;
10
+ pod_id?: string | null;
11
+ };
12
+ type ConversationUpdateInput = UpdateConversationRequest & {
13
+ model?: ConversationModel | null;
14
+ };
15
+ export declare class ConversationsNamespace {
16
+ private readonly http;
17
+ private readonly podId;
18
+ constructor(http: HttpClient, podId: () => string);
19
+ private resolvePodId;
20
+ private requirePodId;
21
+ list(options?: {
22
+ agent_name?: string | null;
23
+ pod_id?: string | null;
24
+ limit?: number;
25
+ page_token?: string | null;
26
+ }): Promise<ConversationListResponse>;
27
+ listByAgent(agentName: string, options?: {
28
+ pod_id?: string | null;
29
+ limit?: number;
30
+ page_token?: string | null;
31
+ }): Promise<ConversationListResponse>;
32
+ listModels(): Promise<{
33
+ items: AvailableModelInfo[];
34
+ limit: number;
35
+ next_page_token: null;
36
+ }>;
37
+ create(payload?: ConversationCreateInput): Promise<Conversation>;
38
+ createForAgent(agentName: string, payload?: Omit<ConversationCreateInput, "agent_name">): Promise<Conversation>;
39
+ get(conversationId: string, options?: {
40
+ pod_id?: string | null;
41
+ }): Promise<Conversation>;
42
+ update(conversationId: string, payload: ConversationUpdateInput, options?: {
43
+ pod_id?: string | null;
44
+ }): Promise<Conversation>;
45
+ sendMessageStream(conversationId: string, payload: SendMessageRequest, options?: {
46
+ pod_id?: string | null;
47
+ signal?: AbortSignal;
48
+ }): Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
49
+ resumeStream(conversationId: string, options?: {
50
+ pod_id?: string | null;
51
+ signal?: AbortSignal;
52
+ }): Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
53
+ stopRun(conversationId: string, options?: {
54
+ pod_id?: string | null;
55
+ }): Promise<Conversation>;
56
+ readonly messages: {
57
+ list: (conversationId: string, options?: {
58
+ limit?: number;
59
+ page_token?: string | null;
60
+ after_sequence?: number | null;
61
+ pod_id?: string | null;
62
+ }) => Promise<CursorPage<ConversationMessage>>;
63
+ send: (conversationId: string, payload: SendMessageRequest, options?: {
64
+ pod_id?: string | null;
65
+ }) => Promise<unknown>;
66
+ };
67
+ }
68
+ export {};
@@ -0,0 +1,159 @@
1
+ import { AgentModelName } from "../openapi_client/models/AgentModelName.js";
2
+ function normalizeConversation(conversation) {
3
+ if (!conversation)
4
+ return conversation;
5
+ const record = conversation;
6
+ return {
7
+ ...record,
8
+ model: record.model ?? record.model_name ?? null,
9
+ status: record.status ?? "waiting",
10
+ };
11
+ }
12
+ function normalizeConversationList(response) {
13
+ const items = (response.items ?? []).map((conversation) => normalizeConversation(conversation));
14
+ return {
15
+ ...response,
16
+ items,
17
+ };
18
+ }
19
+ function normalizeMessage(message) {
20
+ return message;
21
+ }
22
+ function buildModelList() {
23
+ return Object.values(AgentModelName).map((model) => ({
24
+ id: model,
25
+ name: model,
26
+ }));
27
+ }
28
+ export class ConversationsNamespace {
29
+ http;
30
+ podId;
31
+ constructor(http, podId) {
32
+ this.http = http;
33
+ this.podId = podId;
34
+ }
35
+ resolvePodId(explicitPodId) {
36
+ if (typeof explicitPodId === "string") {
37
+ return explicitPodId;
38
+ }
39
+ try {
40
+ return this.podId();
41
+ }
42
+ catch {
43
+ return undefined;
44
+ }
45
+ }
46
+ requirePodId(explicitPodId) {
47
+ const podId = this.resolvePodId(explicitPodId);
48
+ if (!podId) {
49
+ throw new Error("pod_id is required for this conversation operation.");
50
+ }
51
+ return podId;
52
+ }
53
+ list(options = {}) {
54
+ const podId = this.requirePodId(options.pod_id);
55
+ return this.http.request("GET", `/pods/${podId}/conversations`, {
56
+ params: {
57
+ agent_name: options.agent_name,
58
+ limit: options.limit ?? 20,
59
+ page_token: options.page_token,
60
+ },
61
+ }).then(normalizeConversationList);
62
+ }
63
+ listByAgent(agentName, options = {}) {
64
+ return this.list({ ...options, agent_name: agentName });
65
+ }
66
+ async listModels() {
67
+ const items = buildModelList();
68
+ return {
69
+ items,
70
+ limit: items.length,
71
+ next_page_token: null,
72
+ };
73
+ }
74
+ create(payload = {}) {
75
+ const podId = this.requirePodId(payload.pod_id);
76
+ const { agent_name, model, model_name, pod_id, ...requestBody } = payload;
77
+ const body = {
78
+ ...requestBody,
79
+ agent_name: agent_name ?? undefined,
80
+ model_name: model_name ?? model,
81
+ };
82
+ void pod_id;
83
+ return this.http.request("POST", `/pods/${podId}/conversations`, {
84
+ body,
85
+ }).then(normalizeConversation);
86
+ }
87
+ createForAgent(agentName, payload = {}) {
88
+ return this.create({
89
+ ...payload,
90
+ agent_name: agentName,
91
+ });
92
+ }
93
+ get(conversationId, options = {}) {
94
+ const podId = this.requirePodId(options.pod_id);
95
+ return this.http.request("GET", `/pods/${podId}/conversations/${conversationId}`)
96
+ .then(normalizeConversation);
97
+ }
98
+ update(conversationId, payload, options = {}) {
99
+ const podId = this.requirePodId(options.pod_id);
100
+ const { model, model_name, ...requestBody } = payload;
101
+ const body = {
102
+ ...requestBody,
103
+ model_name: model_name ?? model,
104
+ };
105
+ return this.http.request("PATCH", `/pods/${podId}/conversations/${conversationId}`, {
106
+ body,
107
+ }).then(normalizeConversation);
108
+ }
109
+ sendMessageStream(conversationId, payload, options = {}) {
110
+ const podId = this.requirePodId(options.pod_id);
111
+ return this.http.stream(`/pods/${podId}/conversations/${conversationId}/messages`, {
112
+ method: "POST",
113
+ body: payload,
114
+ signal: options.signal,
115
+ headers: {
116
+ "Content-Type": "application/json",
117
+ Accept: "text/event-stream",
118
+ },
119
+ });
120
+ }
121
+ resumeStream(conversationId, options = {}) {
122
+ const podId = this.requirePodId(options.pod_id);
123
+ return this.http.stream(`/pods/${podId}/conversations/${conversationId}/stream`, {
124
+ signal: options.signal,
125
+ headers: {
126
+ Accept: "text/event-stream",
127
+ },
128
+ });
129
+ }
130
+ stopRun(conversationId, options = {}) {
131
+ const podId = this.requirePodId(options.pod_id);
132
+ return this.http.request("POST", `/pods/${podId}/conversations/${conversationId}/stop`, {
133
+ body: {},
134
+ }).then(normalizeConversation);
135
+ }
136
+ messages = {
137
+ list: (conversationId, options = {}) => {
138
+ const podId = this.requirePodId(options.pod_id);
139
+ const parsedPageToken = typeof options.page_token === "string" && options.page_token.trim().length > 0
140
+ ? Number(options.page_token)
141
+ : null;
142
+ return this.http.request("GET", `/pods/${podId}/conversations/${conversationId}/messages`, {
143
+ params: {
144
+ after_sequence: options.after_sequence ?? (Number.isFinite(parsedPageToken) ? parsedPageToken : undefined),
145
+ limit: options.limit ?? 100,
146
+ },
147
+ }).then((response) => ({
148
+ ...response,
149
+ items: (response.items ?? []).map(normalizeMessage),
150
+ }));
151
+ },
152
+ send: (conversationId, payload, options = {}) => {
153
+ const podId = this.requirePodId(options.pod_id);
154
+ return this.http.request("POST", `/pods/${podId}/conversations/${conversationId}/messages`, {
155
+ body: payload,
156
+ });
157
+ },
158
+ };
159
+ }
@@ -3,6 +3,7 @@ import type { HttpClient } from "../http.js";
3
3
  import type { ConvertedFileResponse } from "../openapi_client/models/ConvertedFileResponse.js";
4
4
  import type { DirectoryTreeResponse } from "../openapi_client/models/DirectoryTreeResponse.js";
5
5
  import { SearchMethod } from "../openapi_client/models/SearchMethod.js";
6
+ import type { DatastoreFileNamespace } from "../types.js";
6
7
  export declare class FilesNamespace {
7
8
  private readonly client;
8
9
  private readonly http;
@@ -13,17 +14,25 @@ export declare class FilesNamespace {
13
14
  pageToken?: string;
14
15
  directoryPath?: string;
15
16
  parentId?: string;
17
+ namespace?: DatastoreFileNamespace | null;
16
18
  }): Promise<import("../types.js").FileListResponse>;
17
- get(path: string): Promise<import("../types.js").FileResponse>;
18
- delete(path: string): Promise<import("../types.js").DatastoreMessageResponse>;
19
+ get(path: string, options?: {
20
+ namespace?: DatastoreFileNamespace | null;
21
+ }): Promise<import("../types.js").FileResponse>;
22
+ delete(path: string, options?: {
23
+ namespace?: DatastoreFileNamespace | null;
24
+ }): Promise<import("../types.js").DatastoreMessageResponse>;
19
25
  search(query: string, options?: {
20
26
  limit?: number;
21
27
  searchMethod?: SearchMethod;
22
28
  }): Promise<import("../types.js").FileSearchResponse>;
23
- download(path: string): Promise<Blob>;
29
+ download(path: string, options?: {
30
+ namespace?: DatastoreFileNamespace | null;
31
+ }): Promise<Blob>;
24
32
  tree(options?: {
25
33
  rootPath?: string;
26
34
  filesPerDirectory?: number;
35
+ namespace?: DatastoreFileNamespace | null;
27
36
  }): Promise<DirectoryTreeResponse>;
28
37
  upload(file: Blob, options?: {
29
38
  name?: string;
@@ -31,6 +40,7 @@ export declare class FilesNamespace {
31
40
  parentId?: string;
32
41
  searchEnabled?: boolean;
33
42
  description?: string;
43
+ namespace?: DatastoreFileNamespace | null;
34
44
  }): Promise<import("../types.js").FileResponse>;
35
45
  update(path: string, options?: {
36
46
  file?: Blob;
@@ -40,17 +50,25 @@ export declare class FilesNamespace {
40
50
  parentId?: string;
41
51
  newPath?: string;
42
52
  searchEnabled?: boolean;
53
+ namespace?: DatastoreFileNamespace | null;
43
54
  }): Promise<import("../types.js").FileResponse>;
44
55
  readonly folder: {
45
56
  create: (name: string, options?: {
46
57
  directoryPath?: string;
47
58
  parentId?: string;
48
59
  description?: string;
60
+ namespace?: DatastoreFileNamespace | null;
49
61
  }) => Promise<import("../types.js").FileResponse>;
50
62
  };
51
63
  readonly converted: {
52
- get: (path: string) => Promise<ConvertedFileResponse>;
53
- render: (path: string) => Promise<string>;
54
- download: (path: string, artifact?: string) => Promise<Blob>;
64
+ get: (path: string, options?: {
65
+ namespace?: DatastoreFileNamespace | null;
66
+ }) => Promise<ConvertedFileResponse>;
67
+ render: (path: string, options?: {
68
+ namespace?: DatastoreFileNamespace | null;
69
+ }) => Promise<string>;
70
+ download: (path: string, artifact?: string, options?: {
71
+ namespace?: DatastoreFileNamespace | null;
72
+ }) => Promise<Blob>;
55
73
  };
56
74
  }
@@ -1,3 +1,4 @@
1
+ import { FileNamespace } from "../openapi_client/models/FileNamespace.js";
1
2
  import { SearchMethod } from "../openapi_client/models/SearchMethod.js";
2
3
  import { FilesService } from "../openapi_client/services/FilesService.js";
3
4
  function joinDatastorePath(basePath, leaf) {
@@ -29,6 +30,13 @@ function getBaseName(path) {
29
30
  }
30
31
  return normalized.slice(index + 1);
31
32
  }
33
+ function normalizeFileNamespace(namespace) {
34
+ const normalized = String(namespace ?? "").trim().toUpperCase();
35
+ if (normalized === FileNamespace.PERSONAL || normalized === "PRIVATE") {
36
+ return FileNamespace.PERSONAL;
37
+ }
38
+ return FileNamespace.POD;
39
+ }
32
40
  export class FilesNamespace {
33
41
  client;
34
42
  http;
@@ -40,13 +48,13 @@ export class FilesNamespace {
40
48
  }
41
49
  list(options = {}) {
42
50
  const directoryPath = options.directoryPath ?? options.parentId ?? "/";
43
- return this.client.request(() => FilesService.fileList(this.podId(), directoryPath, options.limit ?? 100, options.pageToken));
51
+ return this.client.request(() => FilesService.fileList(this.podId(), directoryPath, normalizeFileNamespace(options.namespace), options.limit ?? 100, options.pageToken));
44
52
  }
45
- get(path) {
46
- return this.client.request(() => FilesService.fileGet(this.podId(), path));
53
+ get(path, options = {}) {
54
+ return this.client.request(() => FilesService.fileGet(this.podId(), path, normalizeFileNamespace(options.namespace)));
47
55
  }
48
- delete(path) {
49
- return this.client.request(() => FilesService.fileDelete(this.podId(), path));
56
+ delete(path, options = {}) {
57
+ return this.client.request(() => FilesService.fileDelete(this.podId(), path, normalizeFileNamespace(options.namespace)));
50
58
  }
51
59
  search(query, options = {}) {
52
60
  return this.client.request(() => FilesService.fileSearch(this.podId(), {
@@ -55,12 +63,13 @@ export class FilesNamespace {
55
63
  search_method: options.searchMethod ?? SearchMethod.HYBRID,
56
64
  }));
57
65
  }
58
- download(path) {
66
+ download(path, options = {}) {
59
67
  const encodedPath = encodeURIComponent(path);
60
- return this.http.requestBytes("GET", `/pods/${this.podId()}/datastore/files/download?path=${encodedPath}`);
68
+ const encodedNamespace = encodeURIComponent(normalizeFileNamespace(options.namespace));
69
+ return this.http.requestBytes("GET", `/pods/${this.podId()}/datastore/files/download?path=${encodedPath}&namespace=${encodedNamespace}`);
61
70
  }
62
71
  tree(options = {}) {
63
- return this.client.request(() => FilesService.fileTree(this.podId(), options.rootPath ?? "/", options.filesPerDirectory ?? 3));
72
+ return this.client.request(() => FilesService.fileTree(this.podId(), options.rootPath ?? "/", normalizeFileNamespace(options.namespace), options.filesPerDirectory ?? 3));
64
73
  }
65
74
  upload(file, options = {}) {
66
75
  const payload = {
@@ -69,6 +78,7 @@ export class FilesNamespace {
69
78
  description: options.description,
70
79
  directory_path: options.directoryPath ?? options.parentId ?? "/",
71
80
  search_enabled: options.searchEnabled ?? true,
81
+ namespace: normalizeFileNamespace(options.namespace),
72
82
  };
73
83
  return this.client.request(() => FilesService.fileUpload(this.podId(), payload));
74
84
  }
@@ -87,6 +97,7 @@ export class FilesNamespace {
87
97
  description: options.description,
88
98
  new_path: resolvedNewPath,
89
99
  search_enabled: options.searchEnabled,
100
+ namespace: normalizeFileNamespace(options.namespace),
90
101
  };
91
102
  return this.client.request(() => FilesService.fileUpdate(this.podId(), payload));
92
103
  }
@@ -95,17 +106,19 @@ export class FilesNamespace {
95
106
  const payload = {
96
107
  path: joinDatastorePath(options.directoryPath ?? options.parentId, name),
97
108
  description: options.description,
109
+ namespace: normalizeFileNamespace(options.namespace),
98
110
  };
99
111
  return this.client.request(() => FilesService.fileFolderCreate(this.podId(), payload));
100
112
  },
101
113
  };
102
114
  converted = {
103
- get: (path) => this.client.request(() => FilesService.fileConvertedGet(this.podId(), path)),
104
- render: (path) => this.client.request(() => FilesService.fileConvertedRender(this.podId(), path)),
105
- download: (path, artifact = "document.md") => {
115
+ get: (path, options = {}) => this.client.request(() => FilesService.fileConvertedGet(this.podId(), path, normalizeFileNamespace(options.namespace))),
116
+ render: (path, options = {}) => this.client.request(() => FilesService.fileConvertedRender(this.podId(), path, normalizeFileNamespace(options.namespace))),
117
+ download: (path, artifact = "document.md", options = {}) => {
106
118
  const encodedPath = encodeURIComponent(path);
107
119
  const encodedArtifact = encodeURIComponent(artifact);
108
- return this.http.requestBytes("GET", `/pods/${this.podId()}/datastore/files/converted/download?path=${encodedPath}&artifact=${encodedArtifact}`);
120
+ const encodedNamespace = encodeURIComponent(normalizeFileNamespace(options.namespace));
121
+ return this.http.requestBytes("GET", `/pods/${this.podId()}/datastore/files/converted/download?path=${encodedPath}&artifact=${encodedArtifact}&namespace=${encodedNamespace}`);
109
122
  },
110
123
  };
111
124
  }
@@ -33,7 +33,7 @@ export class IntegrationsNamespace {
33
33
  app_names: appNames,
34
34
  goal,
35
35
  };
36
- return this.client.request(() => AgentToolsService.toolIntegrationHelperAgent(body));
36
+ return this.client.request(() => AgentToolsService.agentToolIntegrationHelperAgent(body));
37
37
  }
38
38
  triggers = {
39
39
  list: (options = {}) => this.client.request(() => ApplicationsService.applicationTriggerList(options.applicationId, options.search, options.limit ?? 100, options.pageToken)),
@@ -8,7 +8,7 @@ export declare class PodSurfacesNamespace {
8
8
  limit?: number;
9
9
  pageToken?: string;
10
10
  cursor?: string;
11
- }): Promise<import("../types.js").AssistantSurfaceListResponse>;
11
+ }): Promise<import("../types.js").AgentSurfaceListResponse>;
12
12
  create(podId: string, payload: CreateSurfaceRequest): Promise<any>;
13
13
  get(podId: string, surfaceId: string): Promise<any>;
14
14
  updateConfig(podId: string, surfaceId: string, payload: UpdateSurfaceRequest): Promise<any>;
@@ -1,22 +1,22 @@
1
- import { AssistantSurfacesService } from "../openapi_client/services/AssistantSurfacesService.js";
1
+ import { AgentSurfacesService } from "../openapi_client/services/AgentSurfacesService.js";
2
2
  export class PodSurfacesNamespace {
3
3
  client;
4
4
  constructor(client) {
5
5
  this.client = client;
6
6
  }
7
7
  list(podId, options = {}) {
8
- return this.client.request(() => AssistantSurfacesService.assistantSurfaceList(podId, options.limit ?? 100, options.pageToken ?? options.cursor));
8
+ return this.client.request(() => AgentSurfacesService.agentSurfaceList(podId, options.limit ?? 100, options.pageToken ?? options.cursor));
9
9
  }
10
10
  create(podId, payload) {
11
- return this.client.request(() => AssistantSurfacesService.assistantSurfaceCreate(podId, payload));
11
+ return this.client.request(() => AgentSurfacesService.agentSurfaceCreate(podId, payload));
12
12
  }
13
13
  get(podId, surfaceId) {
14
- return this.client.request(() => AssistantSurfacesService.assistantSurfaceGet(podId, surfaceId));
14
+ return this.client.request(() => AgentSurfacesService.agentSurfaceGet(podId, surfaceId));
15
15
  }
16
16
  updateConfig(podId, surfaceId, payload) {
17
- return this.client.request(() => AssistantSurfacesService.assistantSurfaceUpdate(podId, surfaceId, payload));
17
+ return this.client.request(() => AgentSurfacesService.agentSurfaceUpdate(podId, surfaceId, payload));
18
18
  }
19
19
  toggle(podId, surfaceId, isActive) {
20
- return this.client.request(() => AssistantSurfacesService.assistantSurfaceToggle(podId, surfaceId, { is_active: isActive }));
20
+ return this.client.request(() => AgentSurfacesService.agentSurfaceToggle(podId, surfaceId, { is_active: isActive }));
21
21
  }
22
22
  }