@dremio/js-sdk 0.46.0 → 0.46.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"createConversation.js","sourceRoot":"","sources":["../../../../../src/enterprise/ai/conversations/methods/createConversation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,8BAA8B,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhG,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAAqB,EAAE,EAAE,CAC1D,SAAS,kBAAkB,CAAC,IAA6C;IACvE,OAAO,MAAM;SACV,cAAc,CAAC,qBAAqB,EAAE;QACrC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,uBAAuB,EAAE,IAAI,CAAC,CAAC;QAC7D,OAAO,EAAE;YACP,MAAM,EAAE,kBAAkB;YAC1B,cAAc,EAAE,kBAAkB;SACnC;QACD,SAAS,EAAE,IAAI;QACf,MAAM,EAAE,MAAM;KACf,CAAC;SACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAA0D,CAAC;SAChF,GAAG,CACF,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,iBAAiB,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC,CACzF,CAAC;AACN,CAAC,CAAC;AAEJ,MAAM,0BAA0B,GAAG,CAAC,CAAC,YAAY,CAAC;IAChD,OAAO,EAAE,CAAC,CAAC,UAAU,CAAC,eAAe,CAAC;IACtC,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACjC,eAAe,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CACxC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC5C,0BAA0B,EAC1B,CAAC,CAAC,MAAM,CACN,CAAC,CAAC,IAAI,CAAC,0BAA0B,EAAE;IACjC,OAAO,EAAE,IAAI;CACd,CAAC,EACF;IACE,MAAM,EAAE,8BAA8B;CACvC,CACF,EACD;IACE,MAAM,CAAC,CAAC;QACN,OAAO;YACL,SAAS,EAAE,CAAC,CAAC,SAAS;YACtB,eAAe,EAAE,CAAC,CAAC,eAAe;YAClC,MAAM,EAAE;gBACN,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS;gBACtC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO;gBAClC,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ;gBACpC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO;aACxB;SACF,CAAC;IACJ,CAAC;IACD,MAAM,CAAC,CAAC;QACN,OAAO;YACL,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE;gBAC1C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,SAAS;gBAC9B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,OAAO;gBAC1B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,QAAQ;aAC7B,CAAC;YACF,SAAS,EAAE,CAAC,CAAC,SAAS;YACtB,eAAe,EAAE,CAAC,CAAC,eAAe;SACnC,CAAC;IACJ,CAAC;CACF,CACF,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as z from \"zod/mini\";\nimport type { SonarV4Config } from \"../../../../common/Config.ts\";\nimport { conversationPropertiesCodec } from \"../conversationPropertiesCodec.ts\";\nimport { AgentConversation } from \"../AgentConversation.ts\";\nimport { createConversationPromptSchema, UserChatMessage } from \"../../chat/UserChatMessage.ts\";\n\nexport const createConversation = (config: SonarV4Config) =>\n function createConversation(body: z.input<typeof createConversationCodec>) {\n return config\n .sonarV4Request(`agent/conversations`, {\n body: JSON.stringify(z.decode(createConversationCodec, body)),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"POST\",\n })\n .map((res) => res.json() as Promise<z.input<typeof conversationPropertiesCodec>>)\n .map(\n (entity) => new AgentConversation(config, z.decode(conversationPropertiesCodec, entity)),\n );\n };\n\nconst createConversationInSchema = z.strictObject({\n message: z.instanceof(UserChatMessage),\n modelName: z.optional(z.string()),\n modelProviderId: z.optional(z.string()),\n});\n\nexport const createConversationCodec = z.codec(\n createConversationInSchema,\n z.extend(\n z.omit(createConversationInSchema, {\n message: true,\n }),\n {\n prompt: createConversationPromptSchema,\n },\n ),\n {\n decode(v) {\n return {\n modelName: v.modelName,\n modelProviderId: v.modelProviderId,\n prompt: {\n approvals: v.message.prompt?.approvals,\n context: v.message.prompt?.context,\n skillIds: v.message.prompt?.skillIds,\n text: v.message.content,\n },\n };\n },\n encode(v) {\n return {\n message: UserChatMessage.new(v.prompt.text, {\n approvals: v.prompt?.approvals,\n context: v.prompt?.context,\n skillIds: v.prompt?.skillIds,\n }),\n modelName: v.modelName,\n modelProviderId: v.modelProviderId,\n };\n },\n },\n);\n"]}
1
+ {"version":3,"file":"createConversation.js","sourceRoot":"","sources":["../../../../../src/enterprise/ai/conversations/methods/createConversation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,8BAA8B,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhG,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAAqB,EAAE,EAAE,CAC1D,SAAS,kBAAkB,CAAC,IAA6C;IACvE,OAAO,MAAM;SACV,cAAc,CAAC,qBAAqB,EAAE;QACrC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,uBAAuB,EAAE,IAAI,CAAC,CAAC;QAC7D,OAAO,EAAE;YACP,MAAM,EAAE,kBAAkB;YAC1B,cAAc,EAAE,kBAAkB;SACnC;QACD,SAAS,EAAE,IAAI;QACf,MAAM,EAAE,MAAM;KACf,CAAC;SACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAA0D,CAAC;SAChF,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC,CAAC;AACpE,CAAC,CAAC;AAEJ,MAAM,0BAA0B,GAAG,CAAC,CAAC,YAAY,CAAC;IAChD,OAAO,EAAE,CAAC,CAAC,UAAU,CAAC,eAAe,CAAC;IACtC,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACjC,eAAe,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CACxC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC5C,0BAA0B,EAC1B,CAAC,CAAC,MAAM,CACN,CAAC,CAAC,IAAI,CAAC,0BAA0B,EAAE;IACjC,OAAO,EAAE,IAAI;CACd,CAAC,EACF;IACE,MAAM,EAAE,8BAA8B;CACvC,CACF,EACD;IACE,MAAM,CAAC,CAAC;QACN,OAAO;YACL,SAAS,EAAE,CAAC,CAAC,SAAS;YACtB,eAAe,EAAE,CAAC,CAAC,eAAe;YAClC,MAAM,EAAE;gBACN,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS;gBACtC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO;gBAClC,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ;gBACpC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO;aACxB;SACF,CAAC;IACJ,CAAC;IACD,MAAM,CAAC,CAAC;QACN,OAAO;YACL,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE;gBAC1C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,SAAS;gBAC9B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,OAAO;gBAC1B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,QAAQ;aAC7B,CAAC;YACF,SAAS,EAAE,CAAC,CAAC,SAAS;YACtB,eAAe,EAAE,CAAC,CAAC,eAAe;SACnC,CAAC;IACJ,CAAC;CACF,CACF,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as z from \"zod/mini\";\nimport type { SonarV4Config } from \"../../../../common/Config.ts\";\nimport { conversationPropertiesCodec } from \"../conversationPropertiesCodec.ts\";\nimport { createConversationPromptSchema, UserChatMessage } from \"../../chat/UserChatMessage.ts\";\n\nexport const createConversation = (config: SonarV4Config) =>\n function createConversation(body: z.input<typeof createConversationCodec>) {\n return config\n .sonarV4Request(`agent/conversations`, {\n body: JSON.stringify(z.decode(createConversationCodec, body)),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"POST\",\n })\n .map((res) => res.json() as Promise<z.input<typeof conversationPropertiesCodec>>)\n .map((entity) => z.decode(conversationPropertiesCodec, entity));\n };\n\nconst createConversationInSchema = z.strictObject({\n message: z.instanceof(UserChatMessage),\n modelName: z.optional(z.string()),\n modelProviderId: z.optional(z.string()),\n});\n\nexport const createConversationCodec = z.codec(\n createConversationInSchema,\n z.extend(\n z.omit(createConversationInSchema, {\n message: true,\n }),\n {\n prompt: createConversationPromptSchema,\n },\n ),\n {\n decode(v) {\n return {\n modelName: v.modelName,\n modelProviderId: v.modelProviderId,\n prompt: {\n approvals: v.message.prompt?.approvals,\n context: v.message.prompt?.context,\n skillIds: v.message.prompt?.skillIds,\n text: v.message.content,\n },\n };\n },\n encode(v) {\n return {\n message: UserChatMessage.new(v.prompt.text, {\n approvals: v.prompt?.approvals,\n context: v.prompt?.context,\n skillIds: v.prompt?.skillIds,\n }),\n modelName: v.modelName,\n modelProviderId: v.modelProviderId,\n };\n },\n },\n);\n"]}
@@ -2,11 +2,14 @@ import * as z from "zod/mini";
2
2
  import type { SonarV4Config } from "../../../../common/Config.ts";
3
3
  import type { SignalParam } from "../../../../common/Params.ts";
4
4
  import { AgentConversation } from "../AgentConversation.ts";
5
- import { Err, Ok } from "ts-results-es";
6
5
  export declare const listConversations: (config: SonarV4Config) => (params: {
7
6
  maxResults: number;
8
7
  }, { signal }?: SignalParam) => import("ts-results-es").AsyncResult<{
9
- data: (Ok<AgentConversation> | Err<z.core.$ZodError<{
8
+ /**
9
+ * Safe parse individual list items so that the consumer has the option to still display and of the
10
+ * conversations that parsed successfully, while ignoring others that failed to parse.
11
+ */
12
+ data: (import("ts-results-es").Err<z.core.$ZodError<{
10
13
  createdAt: import("temporal-polyfill").Temporal.Instant;
11
14
  currentRunId: string | null;
12
15
  id: string;
@@ -15,5 +18,5 @@ export declare const listConversations: (config: SonarV4Config) => (params: {
15
18
  modifiedAt: import("temporal-polyfill").Temporal.Instant;
16
19
  tag: string;
17
20
  title: string | null;
18
- }>>)[];
21
+ }>> | import("ts-results-es").Ok<AgentConversation>)[];
19
22
  }, import("../../../index.ts").HttpError>;
@@ -16,20 +16,18 @@
16
16
  import * as z from "zod/mini";
17
17
  import { AgentConversation } from "../AgentConversation.js";
18
18
  import { conversationPropertiesCodec, } from "../conversationPropertiesCodec.js";
19
- import { Err, Ok } from "ts-results-es";
19
+ import { safeParseResultToResult } from "../../../../common/safeParseResultToResult.js";
20
20
  export const listConversations = (config) => function listConversations(params, { signal } = {}) {
21
21
  return config
22
22
  .sonarV4Request(`agent/conversations?${new URLSearchParams({ maxResults: String(params.maxResults) }).toString()}`, { signal })
23
23
  .map((res) => res.json())
24
24
  .map((response) => ({
25
25
  ...response,
26
- data: response.data.map((entity) => {
27
- const decodeResult = z.safeDecode(conversationPropertiesCodec, entity);
28
- if (!decodeResult.success) {
29
- return Err(decodeResult.error);
30
- }
31
- return Ok(new AgentConversation(config, decodeResult.data));
32
- }),
26
+ /**
27
+ * Safe parse individual list items so that the consumer has the option to still display and of the
28
+ * conversations that parsed successfully, while ignoring others that failed to parse.
29
+ */
30
+ data: response.data.map((entity) => safeParseResultToResult(z.safeDecode(conversationPropertiesCodec, entity)).map((properties) => new AgentConversation(config, properties))),
33
31
  }));
34
32
  };
35
33
  //# sourceMappingURL=listConversations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"listConversations.js","sourceRoot":"","sources":["../../../../../src/enterprise/ai/conversations/methods/listConversations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAG9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EACL,2BAA2B,GAE5B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAqB,EAAE,EAAE,CACzD,SAAS,iBAAiB,CAAC,MAA8B,EAAE,EAAE,MAAM,KAAkB,EAAE;IACrF,OAAO,MAAM;SACV,cAAc,CACb,uBAAuB,IAAI,eAAe,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,EAClG,EAAE,MAAM,EAAE,CACX;SACA,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAA6C,CAAC;SACnE,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAClB,GAAG,QAAQ;QACX,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YACjC,MAAM,YAAY,GAAG,CAAC,CAAC,UAAU,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC;YAEvE,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;gBAC1B,OAAO,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;YACjC,CAAC;YAED,OAAO,EAAE,CAAC,IAAI,iBAAiB,CAAC,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9D,CAAC,CAAC;KACH,CAAC,CAAC,CAAC;AACR,CAAC,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as z from \"zod/mini\";\nimport type { SonarV4Config } from \"../../../../common/Config.ts\";\nimport type { SignalParam } from \"../../../../common/Params.ts\";\nimport { AgentConversation } from \"../AgentConversation.ts\";\nimport {\n conversationPropertiesCodec,\n type ConversationEntity,\n} from \"../conversationPropertiesCodec.ts\";\nimport { Err, Ok } from \"ts-results-es\";\n\nexport const listConversations = (config: SonarV4Config) =>\n function listConversations(params: { maxResults: number }, { signal }: SignalParam = {}) {\n return config\n .sonarV4Request(\n `agent/conversations?${new URLSearchParams({ maxResults: String(params.maxResults) }).toString()}`,\n { signal },\n )\n .map((res) => res.json() as Promise<{ data: ConversationEntity[] }>)\n .map((response) => ({\n ...response,\n data: response.data.map((entity) => {\n const decodeResult = z.safeDecode(conversationPropertiesCodec, entity);\n\n if (!decodeResult.success) {\n return Err(decodeResult.error);\n }\n\n return Ok(new AgentConversation(config, decodeResult.data));\n }),\n }));\n };\n"]}
1
+ {"version":3,"file":"listConversations.js","sourceRoot":"","sources":["../../../../../src/enterprise/ai/conversations/methods/listConversations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAG9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EACL,2BAA2B,GAE5B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAC;AAExF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAqB,EAAE,EAAE,CACzD,SAAS,iBAAiB,CAAC,MAA8B,EAAE,EAAE,MAAM,KAAkB,EAAE;IACrF,OAAO,MAAM;SACV,cAAc,CACb,uBAAuB,IAAI,eAAe,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,EAClG,EAAE,MAAM,EAAE,CACX;SACA,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAA6C,CAAC;SACnE,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAClB,GAAG,QAAQ;QACX;;;WAGG;QACH,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CACjC,uBAAuB,CAAC,CAAC,CAAC,UAAU,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAC5E,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,iBAAiB,CAAC,MAAM,EAAE,UAAU,CAAC,CAC1D,CACF;KACF,CAAC,CAAC,CAAC;AACR,CAAC,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as z from \"zod/mini\";\nimport type { SonarV4Config } from \"../../../../common/Config.ts\";\nimport type { SignalParam } from \"../../../../common/Params.ts\";\nimport { AgentConversation } from \"../AgentConversation.ts\";\nimport {\n conversationPropertiesCodec,\n type ConversationEntity,\n} from \"../conversationPropertiesCodec.ts\";\nimport { safeParseResultToResult } from \"../../../../common/safeParseResultToResult.ts\";\n\nexport const listConversations = (config: SonarV4Config) =>\n function listConversations(params: { maxResults: number }, { signal }: SignalParam = {}) {\n return config\n .sonarV4Request(\n `agent/conversations?${new URLSearchParams({ maxResults: String(params.maxResults) }).toString()}`,\n { signal },\n )\n .map((res) => res.json() as Promise<{ data: ConversationEntity[] }>)\n .map((response) => ({\n ...response,\n /**\n * Safe parse individual list items so that the consumer has the option to still display and of the\n * conversations that parsed successfully, while ignoring others that failed to parse.\n */\n data: response.data.map((entity) =>\n safeParseResultToResult(z.safeDecode(conversationPropertiesCodec, entity)).map(\n (properties) => new AgentConversation(config, properties),\n ),\n ),\n }));\n };\n"]}
@@ -1,8 +1,6 @@
1
- import z from "zod";
2
1
  import type { SonarV4Config } from "../../../../common/Config.ts";
3
2
  import type { SignalParam } from "../../../../common/Params.ts";
4
- import { AgentConversation } from "../AgentConversation.ts";
5
- export declare const retrieveConversation: (config: SonarV4Config) => (id: string, { signal }?: SignalParam) => import("ts-results-es").AsyncResult<AgentConversation, import("../../../index.ts").HttpError | z.ZodError<{
3
+ export declare const retrieveConversation: (config: SonarV4Config) => (id: string, { signal }?: SignalParam) => import("ts-results-es").AsyncResult<{
6
4
  createdAt: import("temporal-polyfill").Temporal.Instant;
7
5
  currentRunId: string | null;
8
6
  id: string;
@@ -11,4 +9,4 @@ export declare const retrieveConversation: (config: SonarV4Config) => (id: strin
11
9
  modifiedAt: import("temporal-polyfill").Temporal.Instant;
12
10
  tag: string;
13
11
  title: string | null;
14
- }>>;
12
+ }, import("../../../index.ts").HttpError>;
@@ -13,10 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import z from "zod";
16
+ import * as z from "zod/mini";
17
17
  import { conversationPropertiesCodec } from "../conversationPropertiesCodec.js";
18
- import { Err, Ok } from "ts-results-es";
19
- import { AgentConversation } from "../AgentConversation.js";
20
18
  export const retrieveConversation = (config) => function retrieveConversation(id, { signal } = {}) {
21
19
  return config
22
20
  .sonarV4Request(`agent/conversations/${id}`, {
@@ -26,12 +24,6 @@ export const retrieveConversation = (config) => function retrieveConversation(id
26
24
  signal,
27
25
  })
28
26
  .map((res) => res.json())
29
- .andThen((entity) => {
30
- const decodeResult = z.safeDecode(conversationPropertiesCodec, entity);
31
- if (!decodeResult.success) {
32
- return Err(decodeResult.error);
33
- }
34
- return Ok(new AgentConversation(config, decodeResult.data));
35
- });
27
+ .map((entity) => z.decode(conversationPropertiesCodec, entity));
36
28
  };
37
29
  //# sourceMappingURL=retrieveConversation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"retrieveConversation.js","sourceRoot":"","sources":["../../../../../src/enterprise/ai/conversations/methods/retrieveConversation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,CAAC,MAAM,KAAK,CAAC;AAGpB,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAAqB,EAAE,EAAE,CAC5D,SAAS,oBAAoB,CAAC,EAAU,EAAE,EAAE,MAAM,KAAkB,EAAE;IACpE,OAAO,MAAM;SACV,cAAc,CAAC,uBAAuB,EAAE,EAAE,EAAE;QAC3C,OAAO,EAAE;YACP,MAAM,EAAE,kBAAkB;SAC3B;QACD,MAAM;KACP,CAAC;SACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAA0D,CAAC;SAChF,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QAClB,MAAM,YAAY,GAAG,CAAC,CAAC,UAAU,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC;QAEvE,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;YAC1B,OAAO,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC;QAED,OAAO,EAAE,CAAC,IAAI,iBAAiB,CAAC,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;AACP,CAAC,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport z from \"zod\";\nimport type { SonarV4Config } from \"../../../../common/Config.ts\";\nimport type { SignalParam } from \"../../../../common/Params.ts\";\nimport { conversationPropertiesCodec } from \"../conversationPropertiesCodec.ts\";\nimport { Err, Ok } from \"ts-results-es\";\nimport { AgentConversation } from \"../AgentConversation.ts\";\n\nexport const retrieveConversation = (config: SonarV4Config) =>\n function retrieveConversation(id: string, { signal }: SignalParam = {}) {\n return config\n .sonarV4Request(`agent/conversations/${id}`, {\n headers: {\n Accept: \"application/json\",\n },\n signal,\n })\n .map((res) => res.json() as Promise<z.input<typeof conversationPropertiesCodec>>)\n .andThen((entity) => {\n const decodeResult = z.safeDecode(conversationPropertiesCodec, entity);\n\n if (!decodeResult.success) {\n return Err(decodeResult.error);\n }\n\n return Ok(new AgentConversation(config, decodeResult.data));\n });\n };\n"]}
1
+ {"version":3,"file":"retrieveConversation.js","sourceRoot":"","sources":["../../../../../src/enterprise/ai/conversations/methods/retrieveConversation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAG9B,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAEhF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAAqB,EAAE,EAAE,CAC5D,SAAS,oBAAoB,CAAC,EAAU,EAAE,EAAE,MAAM,KAAkB,EAAE;IACpE,OAAO,MAAM;SACV,cAAc,CAAC,uBAAuB,EAAE,EAAE,EAAE;QAC3C,OAAO,EAAE;YACP,MAAM,EAAE,kBAAkB;SAC3B;QACD,MAAM;KACP,CAAC;SACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAA0D,CAAC;SAChF,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC,CAAC;AACpE,CAAC,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as z from \"zod/mini\";\nimport type { SonarV4Config } from \"../../../../common/Config.ts\";\nimport type { SignalParam } from \"../../../../common/Params.ts\";\nimport { conversationPropertiesCodec } from \"../conversationPropertiesCodec.ts\";\n\nexport const retrieveConversation = (config: SonarV4Config) =>\n function retrieveConversation(id: string, { signal }: SignalParam = {}) {\n return config\n .sonarV4Request(`agent/conversations/${id}`, {\n headers: {\n Accept: \"application/json\",\n },\n signal,\n })\n .map((res) => res.json() as Promise<z.input<typeof conversationPropertiesCodec>>)\n .map((entity) => z.decode(conversationPropertiesCodec, entity));\n };\n"]}
@@ -1,6 +1,10 @@
1
1
  import type { SonarV4Config } from "../../../../common/Config.ts";
2
2
  import type { SignalParam } from "../../../../common/Params.ts";
3
3
  export declare const retrieveConversationHistory: (config: SonarV4Config) => (id: string, { signal }?: SignalParam) => import("ts-results-es").AsyncResult<{
4
+ /**
5
+ * Intentionally throw when parsing chat events (rather than using safeDecode)
6
+ * because the chat history may fail to reconstruct without one of these items.
7
+ */
4
8
  data: ({
5
9
  conversationId: string;
6
10
  modelName: string;
@@ -26,6 +26,10 @@ export const retrieveConversationHistory = (config) => function retrieveConversa
26
26
  .map((res) => res.json())
27
27
  .map((response) => ({
28
28
  ...response,
29
+ /**
30
+ * Intentionally throw when parsing chat events (rather than using safeDecode)
31
+ * because the chat history may fail to reconstruct without one of these items.
32
+ */
29
33
  data: response.data.map((chatEvent) => z.decode(chatEventCodec, chatEvent)),
30
34
  }));
31
35
  };
@@ -1 +1 @@
1
- {"version":3,"file":"retrieveConversationHistory.js","sourceRoot":"","sources":["../../../../../src/enterprise/ai/conversations/methods/retrieveConversationHistory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,MAAqB,EAAE,EAAE,CACnE,SAAS,2BAA2B,CAAC,EAAU,EAAE,EAAE,MAAM,KAAkB,EAAE;IAC3E,OAAO,MAAM;SACV,cAAc,CAAC,uBAAuB,EAAE,WAAW,EAAE;QACpD,OAAO,EAAE;YACP,MAAM,EAAE,kBAAkB;SAC3B;QACD,MAAM;KACP,CAAC;SACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAyD,CAAC;SAC/E,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAClB,GAAG,QAAQ;QACX,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;KAC5E,CAAC,CAAC,CAAC;AACR,CAAC,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { SonarV4Config } from \"../../../../common/Config.ts\";\nimport type { SignalParam } from \"../../../../common/Params.ts\";\nimport { chatEventCodec } from \"../../chat/chatEventSchema.js\";\nimport * as z from \"zod/mini\";\n\nexport const retrieveConversationHistory = (config: SonarV4Config) =>\n function retrieveConversationHistory(id: string, { signal }: SignalParam = {}) {\n return config\n .sonarV4Request(`agent/conversations/${id}/messages`, {\n headers: {\n Accept: \"application/json\",\n },\n signal,\n })\n .map((res) => res.json() as Promise<{ data: z.input<typeof chatEventCodec>[] }>)\n .map((response) => ({\n ...response,\n data: response.data.map((chatEvent) => z.decode(chatEventCodec, chatEvent)),\n }));\n };\n"]}
1
+ {"version":3,"file":"retrieveConversationHistory.js","sourceRoot":"","sources":["../../../../../src/enterprise/ai/conversations/methods/retrieveConversationHistory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,MAAqB,EAAE,EAAE,CACnE,SAAS,2BAA2B,CAAC,EAAU,EAAE,EAAE,MAAM,KAAkB,EAAE;IAC3E,OAAO,MAAM;SACV,cAAc,CAAC,uBAAuB,EAAE,WAAW,EAAE;QACpD,OAAO,EAAE;YACP,MAAM,EAAE,kBAAkB;SAC3B;QACD,MAAM;KACP,CAAC;SACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAyD,CAAC;SAC/E,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAClB,GAAG,QAAQ;QACX;;;WAGG;QACH,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;KAC5E,CAAC,CAAC,CAAC;AACR,CAAC,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { SonarV4Config } from \"../../../../common/Config.ts\";\nimport type { SignalParam } from \"../../../../common/Params.ts\";\nimport { chatEventCodec } from \"../../chat/chatEventSchema.ts\";\nimport * as z from \"zod/mini\";\n\nexport const retrieveConversationHistory = (config: SonarV4Config) =>\n function retrieveConversationHistory(id: string, { signal }: SignalParam = {}) {\n return config\n .sonarV4Request(`agent/conversations/${id}/messages`, {\n headers: {\n Accept: \"application/json\",\n },\n signal,\n })\n .map((res) => res.json() as Promise<{ data: z.input<typeof chatEventCodec>[] }>)\n .map((response) => ({\n ...response,\n /**\n * Intentionally throw when parsing chat events (rather than using safeDecode)\n * because the chat history may fail to reconstruct without one of these items.\n */\n data: response.data.map((chatEvent) => z.decode(chatEventCodec, chatEvent)),\n }));\n };\n"]}