@nexusm/sdk 4.0.0 → 5.1.0

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.
package/dist/index.mjs CHANGED
@@ -727,6 +727,30 @@ var HttpClient = class {
727
727
  this.cache.invalidate(path.split("/").filter(Boolean)[0] ?? path);
728
728
  return result;
729
729
  }
730
+ /**
731
+ * Send a GET request and return the raw response body as a string.
732
+ *
733
+ * Intended for file-download endpoints (e.g. `GET /dashboard/export`) that
734
+ * return `text/csv` or `application/json` as a raw file stream rather than a
735
+ * JSON-parsed object. The retry and auth interceptors still apply; the
736
+ * response cache is intentionally bypassed (export payloads are not cacheable
737
+ * at the SDK layer).
738
+ *
739
+ * @param path - URL path relative to the base URL (e.g. `/dashboard/export`).
740
+ * @param params - Optional query parameters.
741
+ * @param signal - Optional {@link AbortSignal} to cancel the request.
742
+ * @returns The raw response body as a string.
743
+ */
744
+ async getText(path, params, signal) {
745
+ return this.retry.execute(async () => {
746
+ const response = await this.axios.get(path, {
747
+ params,
748
+ signal,
749
+ responseType: "text"
750
+ });
751
+ return response.data;
752
+ });
753
+ }
730
754
  /**
731
755
  * Send a DELETE request.
732
756
  *
@@ -1022,7 +1046,7 @@ import { z as z3 } from "zod";
1022
1046
  var messageRoleSchema = z3.enum(["user", "assistant", "system", "tool"]);
1023
1047
  var conversationCreateSchema = z3.object({
1024
1048
  user_id: z3.string().min(1),
1025
- session_id: z3.string().optional(),
1049
+ agent_id: z3.string().max(255).optional(),
1026
1050
  metadata: z3.record(z3.unknown()).optional()
1027
1051
  });
1028
1052
  var messageCreateSchema = z3.object({
@@ -1072,11 +1096,11 @@ var ConversationService = class extends BaseService {
1072
1096
  /**
1073
1097
  * Add a message to an existing conversation.
1074
1098
  *
1075
- * The message is appended to the conversation's message sequence.
1076
- * Zep will asynchronously update the conversation summary after
1077
- * new messages are added.
1099
+ * The message is appended to the conversation's message sequence. The
1100
+ * backend SummaryWorker asynchronously updates the conversation summary
1101
+ * after new messages are added.
1078
1102
  *
1079
- * @param conversationId - UUID of the target conversation.
1103
+ * @param conversationId - Compound conversation ID ("tenant::user::session").
1080
1104
  * @param message - Message payload including role and content.
1081
1105
  * @returns The newly created message with generated ID and sequence number.
1082
1106
  * @throws {ApiError} 404 if the conversation does not exist.
@@ -1093,7 +1117,7 @@ var ConversationService = class extends BaseService {
1093
1117
  *
1094
1118
  * Messages are returned in chronological order (oldest first).
1095
1119
  *
1096
- * @param conversationId - UUID of the conversation.
1120
+ * @param conversationId - Compound conversation ID ("tenant::user::session").
1097
1121
  * @param params - Optional pagination controls (limit, offset).
1098
1122
  * @returns Paginated list of messages.
1099
1123
  * @throws {ApiError} 404 if the conversation does not exist.
@@ -1108,23 +1132,26 @@ var ConversationService = class extends BaseService {
1108
1132
  /**
1109
1133
  * Retrieve the auto-generated summary of a conversation.
1110
1134
  *
1111
- * Summaries are produced by Zep OSS temporal graph analysis and
1112
- * include key points extracted from the conversation history.
1135
+ * Summaries are produced incrementally by the backend SummaryWorker from
1136
+ * the conversation history.
1113
1137
  *
1114
- * @param conversationId - UUID of the conversation.
1115
- * @returns The conversation summary with key points and generation timestamp.
1138
+ * @param conversationId - Compound conversation ID ("tenant::user::session").
1139
+ * @returns The conversation summary ({@link ConversationSummary}: summary
1140
+ * text + message counts + created_at). Note: no "key points" or
1141
+ * "generated_at" fields — those were phantom (removed in v4.0.0).
1116
1142
  * @throws {ApiError} 404 if the conversation does not exist.
1117
1143
  */
1118
1144
  async getSummary(conversationId, options) {
1119
1145
  return this.http.get(`/conversations/${conversationId}/summary`, void 0, options?.signal);
1120
1146
  }
1121
1147
  /**
1122
- * Delete a conversation and all its messages.
1148
+ * Delete a conversation.
1123
1149
  *
1124
- * This operation is irreversible. The conversation, all associated
1125
- * messages, and the generated summary will be permanently removed.
1150
+ * Soft-delete: the backend sets `deleted_at` (the conversation stops
1151
+ * appearing in list/get) rather than physically removing the row and its
1152
+ * messages.
1126
1153
  *
1127
- * @param conversationId - UUID of the conversation to delete.
1154
+ * @param conversationId - Compound conversation ID ("tenant::user::session").
1128
1155
  * @throws {ApiError} 404 if the conversation does not exist.
1129
1156
  */
1130
1157
  async delete(conversationId, options) {
@@ -1340,6 +1367,35 @@ var ErrorService = class extends BaseService {
1340
1367
  }
1341
1368
  };
1342
1369
 
1370
+ // src/services/dashboard.ts
1371
+ var DashboardService = class extends BaseService {
1372
+ /**
1373
+ * Export a dashboard dataset as raw file content.
1374
+ *
1375
+ * Sends `GET /dashboard/export` with the given query parameters and returns
1376
+ * the raw response body as a string. The string is exactly the file the
1377
+ * server would send for a browser download:
1378
+ * - `format: 'csv'` (default) → comma-separated text
1379
+ * - `format: 'json'` → JSON text (not parsed into an object)
1380
+ *
1381
+ * @param params - Dataset selection and format options.
1382
+ * @param options - Optional request options (e.g. AbortSignal).
1383
+ * @returns Raw file body string.
1384
+ *
1385
+ * @throws {ApiError} HTTP 401 — missing or invalid API key.
1386
+ * @throws {ApiError} HTTP 403 — `target_tenant_id` requires admin scope.
1387
+ * @throws {ApiError} HTTP 422 — `dataset` is not one of the six whitelisted values.
1388
+ */
1389
+ async export(params, options) {
1390
+ const query = { dataset: params.dataset };
1391
+ if (params.format !== void 0) query["format"] = params.format;
1392
+ if (params.target_tenant_id !== void 0) {
1393
+ query["target_tenant_id"] = params.target_tenant_id;
1394
+ }
1395
+ return this.http.getText("/dashboard/export", query, options?.signal);
1396
+ }
1397
+ };
1398
+
1343
1399
  // src/client.ts
1344
1400
  var NexusClient = class {
1345
1401
  /**
@@ -1361,6 +1417,7 @@ var NexusClient = class {
1361
1417
  this.tenants = new TenantService(this.http);
1362
1418
  this.feedback = new FeedbackService(this.http);
1363
1419
  this.errors = new ErrorService(this.http);
1420
+ this.dashboard = new DashboardService(this.http);
1364
1421
  if (resolved.autoErrorReport) {
1365
1422
  this.http.onApiError = (statusCode, method, url, detail) => {
1366
1423
  this.errors.submit({