@dremio/js-sdk 0.45.1 → 0.45.3
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/README.md +151 -9
- package/dist/cloud/ai/AIResource.d.ts +7 -7
- package/dist/enterprise/ai/AIResource.d.ts +6 -6
- package/dist/enterprise/ai/conversations/AgentConversation.d.ts +1 -1
- package/dist/enterprise/ai/conversations/AgentConversation.js.map +1 -1
- package/dist/enterprise/ai/conversations/conversationPropertiesCodec.d.ts +2 -2
- package/dist/enterprise/ai/conversations/conversationPropertiesCodec.js +2 -2
- package/dist/enterprise/ai/conversations/conversationPropertiesCodec.js.map +1 -1
- package/dist/enterprise/ai/conversations/createConversationMachine.d.ts +6 -6
- package/dist/enterprise/ai/conversations/methods/createExchangeRun.d.ts +1 -1
- package/dist/enterprise/ai/conversations/methods/retrieveConversation.d.ts +1 -1
- package/dist/enterprise/ai/conversations/methods/updateConversation.d.ts +1 -1
- package/dist-iife/cloud.js +2 -2
- package/dist-iife/enterprise.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -360,6 +360,43 @@ const history = await conversation.history();
|
|
|
360
360
|
console.log(`Conversation has ${history.length} events`);
|
|
361
361
|
```
|
|
362
362
|
|
|
363
|
+
#### Stop a Run
|
|
364
|
+
|
|
365
|
+
Stop the currently active run for a conversation:
|
|
366
|
+
|
|
367
|
+
```typescript
|
|
368
|
+
await conversation.stopRun(runId);
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
Note: Only one run can be active per conversation at a time.
|
|
372
|
+
|
|
373
|
+
#### Clone a Conversation
|
|
374
|
+
|
|
375
|
+
Create a copy of the conversation instance:
|
|
376
|
+
|
|
377
|
+
```typescript
|
|
378
|
+
const conversationCopy = conversation.clone();
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
#### Serialize Conversation
|
|
382
|
+
|
|
383
|
+
Convert the conversation to a plain JSON object:
|
|
384
|
+
|
|
385
|
+
```typescript
|
|
386
|
+
const json = conversation.toJSON();
|
|
387
|
+
console.log(json);
|
|
388
|
+
// {
|
|
389
|
+
// id: "...",
|
|
390
|
+
// title: "...",
|
|
391
|
+
// createdAt: Temporal.Instant,
|
|
392
|
+
// modifiedAt: Temporal.Instant,
|
|
393
|
+
// currentRunId: "..." | null,
|
|
394
|
+
// modelName: "..." | null,
|
|
395
|
+
// modelProviderId: "..." | null,
|
|
396
|
+
// tag: "..."
|
|
397
|
+
// }
|
|
398
|
+
```
|
|
399
|
+
|
|
363
400
|
### Working with Chat Events
|
|
364
401
|
|
|
365
402
|
The state of a conversation is represented as a stream of `ChatEvent` objects. These events include user messages, tool call requests and results, and Agent replies. While the event stream enables incremental UI updates, it contains implicit relationships that need to be made explicit for easier consumption.
|
|
@@ -371,16 +408,36 @@ The state of a conversation is represented as a stream of `ChatEvent` objects. T
|
|
|
371
408
|
- `toolRequest` - A request to execute a tool (tool calls can run in parallel)
|
|
372
409
|
- `toolResponse` - The result of a tool execution
|
|
373
410
|
- `error` - An error message
|
|
411
|
+
- `conversationUpdate` - Updates to conversation metadata (title, summary)
|
|
412
|
+
- `endOfStream` - Marks the end of a run's event stream
|
|
374
413
|
|
|
375
414
|
#### Building a Conversation Snapshot
|
|
376
415
|
|
|
377
|
-
The `AgentConversation.reduceChatEvents()` method transforms a stream of chat events into a structured snapshot that makes implicit relationships explicit
|
|
416
|
+
The `AgentConversation.reduceChatEvents()` method is a pure reducer function that transforms a stream of chat events into a structured snapshot that makes implicit relationships explicit.
|
|
417
|
+
|
|
418
|
+
**Function Signature:**
|
|
419
|
+
|
|
420
|
+
```typescript
|
|
421
|
+
function reduceChatEvents(
|
|
422
|
+
state: ConversationExchange[],
|
|
423
|
+
chatEvents: ChatEvent[],
|
|
424
|
+
): ConversationExchange[];
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
**What it does:**
|
|
378
428
|
|
|
379
429
|
- **Groups events by exchange** - Each user-agent interaction (identified by `runId`) becomes a separate exchange
|
|
380
430
|
- **Pairs tool calls** - Tool requests and responses are matched by `callId` and combined into a single object
|
|
381
|
-
- **Derives tool state** - Automatically determines if a tool call is `pending`, `success`, or `
|
|
382
|
-
-
|
|
383
|
-
-
|
|
431
|
+
- **Derives tool state** - Automatically determines if a tool call is `pending`, `success`, `error`, or `canceled`
|
|
432
|
+
- `pending` - Tool request received but no response yet
|
|
433
|
+
- `success` - Tool response received without error
|
|
434
|
+
- `error` - Tool response received with error message
|
|
435
|
+
- `canceled` - End of stream reached without receiving a response
|
|
436
|
+
- **Handles duplicates** - Efficiently filters duplicate events when merging history and live streams (events with the same `id` are deduplicated)
|
|
437
|
+
- **Preserves order** - Maintains insertion order for messages and tool calls using `Map` data structures
|
|
438
|
+
- **Immutable updates** - Uses structural sharing to efficiently create new snapshots without mutating the original state
|
|
439
|
+
|
|
440
|
+
**Basic Usage:**
|
|
384
441
|
|
|
385
442
|
```typescript
|
|
386
443
|
import { AgentConversation } from "@dremio/js-sdk/enterprise/ai";
|
|
@@ -404,12 +461,53 @@ type ConversationExchange = {
|
|
|
404
461
|
submittedUserMessage?: UserChatMessage;
|
|
405
462
|
};
|
|
406
463
|
|
|
464
|
+
type ConversationExchangeMessage =
|
|
465
|
+
| ChatEventWithChunkType<"error">
|
|
466
|
+
| ChatEventWithChunkType<"model">
|
|
467
|
+
| ChatEventWithChunkType<"userMessage">;
|
|
468
|
+
|
|
407
469
|
type AgentToolCall = {
|
|
408
470
|
id: string;
|
|
409
|
-
state: "error" | "pending" | "success";
|
|
471
|
+
state: "canceled" | "error" | "pending" | "success";
|
|
410
472
|
request: ChatEventWithChunkType<"toolRequest"> | undefined;
|
|
411
473
|
result: ChatEventWithChunkType<"toolResponse"> | undefined;
|
|
412
474
|
};
|
|
475
|
+
|
|
476
|
+
// ChatEvent is the base type for all events in the stream
|
|
477
|
+
type ChatEvent = {
|
|
478
|
+
id: string;
|
|
479
|
+
conversationId: string;
|
|
480
|
+
runId: string;
|
|
481
|
+
createdAt: Temporal.Instant;
|
|
482
|
+
modelName: string;
|
|
483
|
+
modelProviderId: string;
|
|
484
|
+
role: "agent" | "user";
|
|
485
|
+
content:
|
|
486
|
+
| { chunkType: "conversationUpdate"; title?: string; summary?: string }
|
|
487
|
+
| { chunkType: "endOfStream" }
|
|
488
|
+
| { chunkType: "error"; message: string }
|
|
489
|
+
| { chunkType: "model"; name: string; result: Record<string, unknown> }
|
|
490
|
+
| {
|
|
491
|
+
chunkType: "toolRequest";
|
|
492
|
+
callId: string;
|
|
493
|
+
name: string;
|
|
494
|
+
arguments: Record<string, unknown>;
|
|
495
|
+
commentary?: string;
|
|
496
|
+
summarizedTitle?: string;
|
|
497
|
+
}
|
|
498
|
+
| {
|
|
499
|
+
chunkType: "toolResponse";
|
|
500
|
+
callId: string;
|
|
501
|
+
name: string;
|
|
502
|
+
result: Record<string, unknown>;
|
|
503
|
+
commentary?: string;
|
|
504
|
+
}
|
|
505
|
+
| { chunkType: "userMessage"; text: string };
|
|
506
|
+
};
|
|
507
|
+
|
|
508
|
+
// ChatEventWithChunkType is a helper type to extract events by their chunk type
|
|
509
|
+
type ChatEventWithChunkType<T extends ChatEvent["content"]["chunkType"]> =
|
|
510
|
+
Extract<ChatEvent, { content: { chunkType: T } }>;
|
|
413
511
|
```
|
|
414
512
|
|
|
415
513
|
#### Incremental Updates
|
|
@@ -504,16 +602,60 @@ actor.send({
|
|
|
504
602
|
- `uninitialized` - Initial state before conversation is created
|
|
505
603
|
- `creating_conversation` - Creating a new conversation
|
|
506
604
|
- `retrieving_history` - Fetching conversation history
|
|
605
|
+
- `retrieve_history_failed` - Error state when history retrieval fails
|
|
507
606
|
- `idle` - Ready to accept new messages
|
|
508
607
|
- `submitting_message` - Sending a user message
|
|
509
|
-
- `
|
|
510
|
-
- `
|
|
608
|
+
- `submitting_message_failed` - Error state when message submission fails
|
|
609
|
+
- `streaming` - Receiving agent responses (with substates: `monitoring_replies`, `stopping`)
|
|
511
610
|
|
|
512
611
|
#### Machine Events
|
|
513
612
|
|
|
514
|
-
- `SUBMIT_USER_MESSAGE` - Send a new message
|
|
613
|
+
- `SUBMIT_USER_MESSAGE` - Send a new message with a `UserChatMessage`
|
|
614
|
+
- `RETRY_MESSAGE` - Retry sending the last failed message
|
|
515
615
|
- `REFRESH_HISTORY` - Reload conversation history
|
|
516
|
-
- `
|
|
616
|
+
- `STOP_RUN` - Stop the current run
|
|
617
|
+
|
|
618
|
+
#### Machine Context
|
|
619
|
+
|
|
620
|
+
The machine maintains the following context:
|
|
621
|
+
|
|
622
|
+
```typescript
|
|
623
|
+
type ConversationMachineContext = {
|
|
624
|
+
conversationId: string | null;
|
|
625
|
+
conversationSnapshot?: ConversationExchange[];
|
|
626
|
+
currentRunId?: string | null;
|
|
627
|
+
lastError?: unknown;
|
|
628
|
+
messageAttempt?: UserChatMessage;
|
|
629
|
+
};
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
#### Machine Emitted Events
|
|
633
|
+
|
|
634
|
+
The machine emits the following events that can be subscribed to:
|
|
635
|
+
|
|
636
|
+
```typescript
|
|
637
|
+
type ConversationMachineEmitted =
|
|
638
|
+
| { type: "apiError"; error: HttpError }
|
|
639
|
+
| { type: "chatEventReceived"; chatEvent: ChatEvent }
|
|
640
|
+
| { type: "conversationCreated"; id: string };
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
Subscribe to emitted events:
|
|
644
|
+
|
|
645
|
+
```typescript
|
|
646
|
+
actor.subscribe((snapshot) => {
|
|
647
|
+
// Access emitted events through snapshot
|
|
648
|
+
console.log("State:", snapshot.value);
|
|
649
|
+
console.log("Context:", snapshot.context);
|
|
650
|
+
});
|
|
651
|
+
|
|
652
|
+
// Or use the system to listen for specific events
|
|
653
|
+
actor.system.subscribe((event) => {
|
|
654
|
+
if (event.type === "chatEventReceived") {
|
|
655
|
+
console.log("New chat event:", event.chatEvent);
|
|
656
|
+
}
|
|
657
|
+
});
|
|
658
|
+
```
|
|
517
659
|
|
|
518
660
|
## Catalog
|
|
519
661
|
|
|
@@ -96,7 +96,7 @@ export declare class AIResource {
|
|
|
96
96
|
modelProviderId: string | null;
|
|
97
97
|
modifiedAt: import("temporal-polyfill").Temporal.Instant;
|
|
98
98
|
tag: string;
|
|
99
|
-
title: string;
|
|
99
|
+
title: string | null;
|
|
100
100
|
}, {
|
|
101
101
|
conversationId: string;
|
|
102
102
|
}, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<{
|
|
@@ -204,7 +204,7 @@ export declare class AIResource {
|
|
|
204
204
|
modelProviderId: string | null;
|
|
205
205
|
modifiedAt: import("temporal-polyfill").Temporal.Instant;
|
|
206
206
|
tag: string;
|
|
207
|
-
title: string;
|
|
207
|
+
title: string | null;
|
|
208
208
|
};
|
|
209
209
|
history: {
|
|
210
210
|
data: ({
|
|
@@ -312,7 +312,7 @@ export declare class AIResource {
|
|
|
312
312
|
modelProviderId: string | null;
|
|
313
313
|
modifiedAt: import("temporal-polyfill").Temporal.Instant;
|
|
314
314
|
tag: string;
|
|
315
|
-
title: string;
|
|
315
|
+
title: string | null;
|
|
316
316
|
};
|
|
317
317
|
currentRunId: string;
|
|
318
318
|
}, {
|
|
@@ -435,7 +435,7 @@ export declare class AIResource {
|
|
|
435
435
|
modelProviderId: string | null;
|
|
436
436
|
modifiedAt: import("temporal-polyfill").Temporal.Instant;
|
|
437
437
|
tag: string;
|
|
438
|
-
title: string;
|
|
438
|
+
title: string | null;
|
|
439
439
|
}, {
|
|
440
440
|
conversationId: string;
|
|
441
441
|
}, import("xstate").EventObject>;
|
|
@@ -551,7 +551,7 @@ export declare class AIResource {
|
|
|
551
551
|
modelProviderId: string | null;
|
|
552
552
|
modifiedAt: import("temporal-polyfill").Temporal.Instant;
|
|
553
553
|
tag: string;
|
|
554
|
-
title: string;
|
|
554
|
+
title: string | null;
|
|
555
555
|
};
|
|
556
556
|
history: {
|
|
557
557
|
data: ({
|
|
@@ -663,7 +663,7 @@ export declare class AIResource {
|
|
|
663
663
|
modelProviderId: string | null;
|
|
664
664
|
modifiedAt: import("temporal-polyfill").Temporal.Instant;
|
|
665
665
|
tag: string;
|
|
666
|
-
title: string;
|
|
666
|
+
title: string | null;
|
|
667
667
|
};
|
|
668
668
|
currentRunId: string;
|
|
669
669
|
}, {
|
|
@@ -823,7 +823,7 @@ export declare class AIResource {
|
|
|
823
823
|
modelProviderId: string | null;
|
|
824
824
|
modifiedAt: import("temporal-polyfill").Temporal.Instant;
|
|
825
825
|
tag: string;
|
|
826
|
-
title: string;
|
|
826
|
+
title: string | null;
|
|
827
827
|
}, HttpError>;
|
|
828
828
|
retrieveConversationHistory(id: string): {
|
|
829
829
|
data(): AsyncGenerator<ChatEvent, void, HttpError>;
|
|
@@ -38,7 +38,7 @@ export declare class AIResource {
|
|
|
38
38
|
modelProviderId: string | null;
|
|
39
39
|
modifiedAt: import("temporal-polyfill").Temporal.Instant;
|
|
40
40
|
tag: string;
|
|
41
|
-
title: string;
|
|
41
|
+
title: string | null;
|
|
42
42
|
}, {
|
|
43
43
|
conversationId: string;
|
|
44
44
|
}, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<{
|
|
@@ -146,7 +146,7 @@ export declare class AIResource {
|
|
|
146
146
|
modelProviderId: string | null;
|
|
147
147
|
modifiedAt: import("temporal-polyfill").Temporal.Instant;
|
|
148
148
|
tag: string;
|
|
149
|
-
title: string;
|
|
149
|
+
title: string | null;
|
|
150
150
|
};
|
|
151
151
|
history: {
|
|
152
152
|
data: ({
|
|
@@ -254,7 +254,7 @@ export declare class AIResource {
|
|
|
254
254
|
modelProviderId: string | null;
|
|
255
255
|
modifiedAt: import("temporal-polyfill").Temporal.Instant;
|
|
256
256
|
tag: string;
|
|
257
|
-
title: string;
|
|
257
|
+
title: string | null;
|
|
258
258
|
};
|
|
259
259
|
currentRunId: string;
|
|
260
260
|
}, {
|
|
@@ -377,7 +377,7 @@ export declare class AIResource {
|
|
|
377
377
|
modelProviderId: string | null;
|
|
378
378
|
modifiedAt: import("temporal-polyfill").Temporal.Instant;
|
|
379
379
|
tag: string;
|
|
380
|
-
title: string;
|
|
380
|
+
title: string | null;
|
|
381
381
|
}, {
|
|
382
382
|
conversationId: string;
|
|
383
383
|
}, import("xstate").EventObject>;
|
|
@@ -493,7 +493,7 @@ export declare class AIResource {
|
|
|
493
493
|
modelProviderId: string | null;
|
|
494
494
|
modifiedAt: import("temporal-polyfill").Temporal.Instant;
|
|
495
495
|
tag: string;
|
|
496
|
-
title: string;
|
|
496
|
+
title: string | null;
|
|
497
497
|
};
|
|
498
498
|
history: {
|
|
499
499
|
data: ({
|
|
@@ -605,7 +605,7 @@ export declare class AIResource {
|
|
|
605
605
|
modelProviderId: string | null;
|
|
606
606
|
modifiedAt: import("temporal-polyfill").Temporal.Instant;
|
|
607
607
|
tag: string;
|
|
608
|
-
title: string;
|
|
608
|
+
title: string | null;
|
|
609
609
|
};
|
|
610
610
|
currentRunId: string;
|
|
611
611
|
}, {
|
|
@@ -20,7 +20,7 @@ export declare class AgentConversation implements AgentConversationProperties {
|
|
|
20
20
|
get modelProviderId(): string | null;
|
|
21
21
|
get modifiedAt(): import("temporal-polyfill").Temporal.Instant;
|
|
22
22
|
get tag(): string;
|
|
23
|
-
get title(): string;
|
|
23
|
+
get title(): string | null;
|
|
24
24
|
clone(): AgentConversation;
|
|
25
25
|
/**
|
|
26
26
|
* Permanently deletes this conversation.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentConversation.js","sourceRoot":"","sources":["../../../../src/enterprise/ai/conversations/AgentConversation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAE/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE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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 { conversationPropertiesCodec } from \"./conversationPropertiesCodec.ts\";\nimport type { SonarV4Config } from \"../../../common/Config.ts\";\nimport { createExchangeRun } from \"./methods/createExchangeRun.ts\";\nimport { deleteConversation } from \"./methods/deleteConversation.ts\";\nimport { conversationUpdateSchema, updateConversation } from \"./methods/updateConversation.ts\";\nimport { map } from \"rxjs\";\nimport { stopExchangeRun } from \"./methods/stopExchangeRun.ts\";\nimport { chatEventCodec } from \"../chat/chatEventSchema.ts\";\nimport { fromTextEventStream } from \"../../../common/fromTextEventStream.ts\";\nimport { streamRunEvents } from \"./methods/streamRunEvents.ts\";\nimport { retrieveConversationHistory } from \"./methods/retrieveConversationHistory.ts\";\nimport type { SignalParam } from \"../../../common/Params.ts\";\nimport { reduceChatEvents } from \"./reduceChatEvents.ts\";\nimport type { ConflictResolver } from \"../../../common/ConflictResolver.ts\";\nimport { AsyncResult } from \"ts-results-es\";\nimport { retrieveConversation } from \"./methods/retrieveConversation.ts\";\nimport { isProblem } from \"../../../common/HttpError.ts\";\nimport type { createConversationCodec } from \"./methods/createConversation.ts\";\n\nexport type AgentConversationProperties = z.output<typeof conversationPropertiesCodec>;\n\n/**\n * Represents a saved conversation with the Dremio AI Agent.\n */\nexport class AgentConversation implements AgentConversationProperties {\n readonly #config: SonarV4Config;\n readonly createdAt: AgentConversationProperties[\"createdAt\"];\n readonly id: AgentConversationProperties[\"id\"];\n #currentRunId: AgentConversationProperties[\"currentRunId\"];\n #modelName: AgentConversationProperties[\"modelName\"];\n #modelProviderId: AgentConversationProperties[\"modelProviderId\"];\n #modifiedAt: AgentConversationProperties[\"modifiedAt\"];\n #tag: string;\n #title: string;\n\n constructor(config: SonarV4Config, properties: AgentConversationProperties) {\n this.#config = config;\n this.createdAt = properties.createdAt;\n this.id = properties.id;\n this.#currentRunId = properties.currentRunId;\n this.#modelName = properties.modelName;\n this.#modelProviderId = properties.modelProviderId;\n this.#modifiedAt = properties.modifiedAt;\n this.#tag = properties.tag;\n this.#title = properties.title;\n }\n\n get currentRunId() {\n return this.#currentRunId;\n }\n\n get modelName() {\n return this.#modelName;\n }\n\n get modelProviderId() {\n return this.#modelProviderId;\n }\n\n get modifiedAt() {\n return this.#modifiedAt;\n }\n\n get tag() {\n return this.#tag;\n }\n\n get title() {\n return this.#title;\n }\n\n clone() {\n return new AgentConversation(this.#config, this);\n }\n\n /**\n * Permanently deletes this conversation.\n */\n delete() {\n return deleteConversation(this.#config)(this.id);\n }\n\n /**\n * Patches properties for this `AgentConversation`, mutating instance properties after\n * a successful commit.\n */\n update(\n properties: z.infer<typeof AgentConversation.updateSchema>,\n options: {\n onConflict?: ConflictResolver<\n AgentConversationProperties,\n z.infer<typeof AgentConversation.updateSchema>\n >;\n } = {},\n ) {\n const { onConflict = () => null } = options;\n return new AsyncResult(\n (async () => {\n const attempt = await updateConversation(this.#config)(this.id, this.#tag, properties).map(\n (properties) => {\n this.#updateProperties(properties);\n },\n );\n\n if (\n attempt.isErr() &&\n isProblem(attempt.error.body) &&\n attempt.error.body.title === \"https://api.dremio.dev/problems/concurrent-modification\"\n ) {\n const remoteResult = await retrieveConversation(this.#config)(this.id);\n if (remoteResult.isOk()) {\n const remote = new AgentConversation(this.#config, remoteResult.value);\n const resolved = await onConflict(this.toJSON(), remote.toJSON(), properties);\n if (resolved !== null) {\n return updateConversation(this.#config)(this.id, remote.tag, resolved).map(\n (properties) => {\n this.#updateProperties(properties);\n },\n );\n }\n }\n }\n\n return attempt;\n })(),\n );\n }\n\n history({ signal }: SignalParam = {}) {\n return retrieveConversationHistory(this.#config)(this.id, { signal }).map(\n (response) => response.data,\n );\n }\n\n runEvents$(runId: string) {\n return fromTextEventStream(({ signal }) =>\n streamRunEvents(this.#config)({ conversationId: this.id, runId }, { signal }),\n ).pipe(\n map((event) =>\n z.decode(chatEventCodec, JSON.parse(event.data) as z.input<typeof chatEventCodec>),\n ),\n );\n }\n\n /**\n * Sends a message to the Agent, initiating a new run process.\n * @returns An `AsyncResult` containing the `runId` for the newly created run.\n */\n startRun(properties: z.input<typeof createConversationCodec>) {\n const asyncResult = createExchangeRun(this.#config)(this.id, properties);\n\n asyncResult\n .then((result) => {\n if (result.isOk()) {\n this.#updateProperties(result.value.conversationProperties);\n }\n })\n .catch(() => {});\n\n return asyncResult.map((properties) => properties.currentRunId);\n }\n\n /**\n * Only a single run can be active for a conversation, so for now\n * this method is kept private.\n */\n stopRun(id: string) {\n const asyncResult = stopExchangeRun(this.#config)(this.id, id);\n\n asyncResult\n .then((result) => {\n if (result.isOk() && this.#currentRunId === id) {\n this.#currentRunId = null;\n }\n })\n .catch(() => {});\n\n return asyncResult;\n }\n\n toJSON(): AgentConversationProperties {\n return {\n createdAt: this.createdAt,\n currentRunId: this.currentRunId,\n id: this.id,\n modelName: this.modelName,\n modelProviderId: this.modelProviderId,\n modifiedAt: this.modifiedAt,\n tag: this.tag,\n title: this.title,\n };\n }\n\n #updateProperties(properties: Partial<Omit<AgentConversationProperties, \"createdAt\" | \"id\">>) {\n if (properties.currentRunId !== undefined) {\n this.#currentRunId = properties.currentRunId;\n }\n\n if (properties.modelName !== undefined) {\n this.#modelName = properties.modelName;\n }\n\n if (properties.modelProviderId !== undefined) {\n this.#modelProviderId = properties.modelProviderId;\n }\n\n if (properties.modifiedAt !== undefined) {\n this.#modifiedAt = properties.modifiedAt;\n }\n\n if (properties.tag !== undefined) {\n this.#tag = properties.tag;\n }\n\n if (properties.title !== undefined) {\n this.#title = properties.title;\n }\n }\n\n static reduceChatEvents = reduceChatEvents;\n static updateSchema = conversationUpdateSchema;\n}\n"]}
|
|
1
|
+
{"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,GAAG,UAAU,CAAC,GAAG,CAAC;QAC7B,CAAC;QAED,IAAI,UAAU,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YACnC,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC;QACjC,CAAC;IACH,CAAC;IAED,MAAM,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAC3C,MAAM,CAAC,YAAY,GAAG,wBAAwB,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 { conversationPropertiesCodec } from \"./conversationPropertiesCodec.ts\";\nimport type { SonarV4Config } from \"../../../common/Config.ts\";\nimport { createExchangeRun } from \"./methods/createExchangeRun.ts\";\nimport { deleteConversation } from \"./methods/deleteConversation.ts\";\nimport { conversationUpdateSchema, updateConversation } from \"./methods/updateConversation.ts\";\nimport { map } from \"rxjs\";\nimport { stopExchangeRun } from \"./methods/stopExchangeRun.ts\";\nimport { chatEventCodec } from \"../chat/chatEventSchema.ts\";\nimport { fromTextEventStream } from \"../../../common/fromTextEventStream.ts\";\nimport { streamRunEvents } from \"./methods/streamRunEvents.ts\";\nimport { retrieveConversationHistory } from \"./methods/retrieveConversationHistory.ts\";\nimport type { SignalParam } from \"../../../common/Params.ts\";\nimport { reduceChatEvents } from \"./reduceChatEvents.ts\";\nimport type { ConflictResolver } from \"../../../common/ConflictResolver.ts\";\nimport { AsyncResult } from \"ts-results-es\";\nimport { retrieveConversation } from \"./methods/retrieveConversation.ts\";\nimport { isProblem } from \"../../../common/HttpError.ts\";\nimport type { createConversationCodec } from \"./methods/createConversation.ts\";\n\nexport type AgentConversationProperties = z.output<typeof conversationPropertiesCodec>;\n\n/**\n * Represents a saved conversation with the Dremio AI Agent.\n */\nexport class AgentConversation implements AgentConversationProperties {\n readonly #config: SonarV4Config;\n readonly createdAt: AgentConversationProperties[\"createdAt\"];\n readonly id: AgentConversationProperties[\"id\"];\n #currentRunId: AgentConversationProperties[\"currentRunId\"];\n #modelName: AgentConversationProperties[\"modelName\"];\n #modelProviderId: AgentConversationProperties[\"modelProviderId\"];\n #modifiedAt: AgentConversationProperties[\"modifiedAt\"];\n #tag: string;\n #title: string | null;\n\n constructor(config: SonarV4Config, properties: AgentConversationProperties) {\n this.#config = config;\n this.createdAt = properties.createdAt;\n this.id = properties.id;\n this.#currentRunId = properties.currentRunId;\n this.#modelName = properties.modelName;\n this.#modelProviderId = properties.modelProviderId;\n this.#modifiedAt = properties.modifiedAt;\n this.#tag = properties.tag;\n this.#title = properties.title;\n }\n\n get currentRunId() {\n return this.#currentRunId;\n }\n\n get modelName() {\n return this.#modelName;\n }\n\n get modelProviderId() {\n return this.#modelProviderId;\n }\n\n get modifiedAt() {\n return this.#modifiedAt;\n }\n\n get tag() {\n return this.#tag;\n }\n\n get title() {\n return this.#title;\n }\n\n clone() {\n return new AgentConversation(this.#config, this);\n }\n\n /**\n * Permanently deletes this conversation.\n */\n delete() {\n return deleteConversation(this.#config)(this.id);\n }\n\n /**\n * Patches properties for this `AgentConversation`, mutating instance properties after\n * a successful commit.\n */\n update(\n properties: z.infer<typeof AgentConversation.updateSchema>,\n options: {\n onConflict?: ConflictResolver<\n AgentConversationProperties,\n z.infer<typeof AgentConversation.updateSchema>\n >;\n } = {},\n ) {\n const { onConflict = () => null } = options;\n return new AsyncResult(\n (async () => {\n const attempt = await updateConversation(this.#config)(this.id, this.#tag, properties).map(\n (properties) => {\n this.#updateProperties(properties);\n },\n );\n\n if (\n attempt.isErr() &&\n isProblem(attempt.error.body) &&\n attempt.error.body.title === \"https://api.dremio.dev/problems/concurrent-modification\"\n ) {\n const remoteResult = await retrieveConversation(this.#config)(this.id);\n if (remoteResult.isOk()) {\n const remote = new AgentConversation(this.#config, remoteResult.value);\n const resolved = await onConflict(this.toJSON(), remote.toJSON(), properties);\n if (resolved !== null) {\n return updateConversation(this.#config)(this.id, remote.tag, resolved).map(\n (properties) => {\n this.#updateProperties(properties);\n },\n );\n }\n }\n }\n\n return attempt;\n })(),\n );\n }\n\n history({ signal }: SignalParam = {}) {\n return retrieveConversationHistory(this.#config)(this.id, { signal }).map(\n (response) => response.data,\n );\n }\n\n runEvents$(runId: string) {\n return fromTextEventStream(({ signal }) =>\n streamRunEvents(this.#config)({ conversationId: this.id, runId }, { signal }),\n ).pipe(\n map((event) =>\n z.decode(chatEventCodec, JSON.parse(event.data) as z.input<typeof chatEventCodec>),\n ),\n );\n }\n\n /**\n * Sends a message to the Agent, initiating a new run process.\n * @returns An `AsyncResult` containing the `runId` for the newly created run.\n */\n startRun(properties: z.input<typeof createConversationCodec>) {\n const asyncResult = createExchangeRun(this.#config)(this.id, properties);\n\n asyncResult\n .then((result) => {\n if (result.isOk()) {\n this.#updateProperties(result.value.conversationProperties);\n }\n })\n .catch(() => {});\n\n return asyncResult.map((properties) => properties.currentRunId);\n }\n\n /**\n * Only a single run can be active for a conversation, so for now\n * this method is kept private.\n */\n stopRun(id: string) {\n const asyncResult = stopExchangeRun(this.#config)(this.id, id);\n\n asyncResult\n .then((result) => {\n if (result.isOk() && this.#currentRunId === id) {\n this.#currentRunId = null;\n }\n })\n .catch(() => {});\n\n return asyncResult;\n }\n\n toJSON(): AgentConversationProperties {\n return {\n createdAt: this.createdAt,\n currentRunId: this.currentRunId,\n id: this.id,\n modelName: this.modelName,\n modelProviderId: this.modelProviderId,\n modifiedAt: this.modifiedAt,\n tag: this.tag,\n title: this.title,\n };\n }\n\n #updateProperties(properties: Partial<Omit<AgentConversationProperties, \"createdAt\" | \"id\">>) {\n if (properties.currentRunId !== undefined) {\n this.#currentRunId = properties.currentRunId;\n }\n\n if (properties.modelName !== undefined) {\n this.#modelName = properties.modelName;\n }\n\n if (properties.modelProviderId !== undefined) {\n this.#modelProviderId = properties.modelProviderId;\n }\n\n if (properties.modifiedAt !== undefined) {\n this.#modifiedAt = properties.modifiedAt;\n }\n\n if (properties.tag !== undefined) {\n this.#tag = properties.tag;\n }\n\n if (properties.title !== undefined) {\n this.#title = properties.title;\n }\n }\n\n static reduceChatEvents = reduceChatEvents;\n static updateSchema = conversationUpdateSchema;\n}\n"]}
|
|
@@ -8,7 +8,7 @@ export declare const conversationPropertiesCodec: z.ZodMiniCodec<z.ZodMiniObject
|
|
|
8
8
|
modelProviderId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
9
9
|
modifiedAt: z.iso.ZodMiniISODateTime;
|
|
10
10
|
tag: z.ZodMiniString<string>;
|
|
11
|
-
title: z.ZodMiniString<string
|
|
11
|
+
title: z.ZodMiniNullable<z.ZodMiniString<string>>;
|
|
12
12
|
}, z.core.$strip>, z.ZodMiniObject<{
|
|
13
13
|
createdAt: z.ZodMiniCustom<Temporal.Instant, Temporal.Instant>;
|
|
14
14
|
currentRunId: z.ZodMiniNullable<z.ZodMiniString<string>>;
|
|
@@ -17,6 +17,6 @@ export declare const conversationPropertiesCodec: z.ZodMiniCodec<z.ZodMiniObject
|
|
|
17
17
|
modelProviderId: z.ZodMiniNullable<z.ZodMiniString<string>>;
|
|
18
18
|
modifiedAt: z.ZodMiniCustom<Temporal.Instant, Temporal.Instant>;
|
|
19
19
|
tag: z.ZodMiniString<string>;
|
|
20
|
-
title: z.ZodMiniString<string
|
|
20
|
+
title: z.ZodMiniNullable<z.ZodMiniString<string>>;
|
|
21
21
|
}, z.core.$strip>>;
|
|
22
22
|
export type ConversationEntity = z.input<typeof conversationPropertiesCodec>;
|
|
@@ -23,7 +23,7 @@ export const conversationPropertiesCodec = z.codec(z.object({
|
|
|
23
23
|
modelProviderId: z.optional(z.string()),
|
|
24
24
|
modifiedAt: z.iso.datetime(),
|
|
25
25
|
tag: z.string(),
|
|
26
|
-
title: z.string(),
|
|
26
|
+
title: z.nullable(z.string()),
|
|
27
27
|
}), z.object({
|
|
28
28
|
createdAt: z.instanceof(Temporal.Instant),
|
|
29
29
|
currentRunId: z.nullable(z.string()),
|
|
@@ -32,7 +32,7 @@ export const conversationPropertiesCodec = z.codec(z.object({
|
|
|
32
32
|
modelProviderId: z.nullable(z.string()),
|
|
33
33
|
modifiedAt: z.instanceof(Temporal.Instant),
|
|
34
34
|
tag: z.string(),
|
|
35
|
-
title: z.string(),
|
|
35
|
+
title: z.nullable(z.string()),
|
|
36
36
|
}), {
|
|
37
37
|
decode(v) {
|
|
38
38
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversationPropertiesCodec.js","sourceRoot":"","sources":["../../../../src/enterprise/ai/conversations/conversationPropertiesCodec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAChD,CAAC,CAAC,MAAM,CAAC;IACP,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;IAC3B,YAAY,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACpC,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACjC,eAAe,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACvC,UAAU,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;IAC5B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,KAAK,EAAE,CAAC,CAAC,MAAM,EAA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,CAAC,OAAO,CAAC;IAC1C,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC9B,CAAC,EACF;IACE,MAAM,CAAC,CAAC;QACN,OAAO;YACL,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;YAC7C,YAAY,EAAE,CAAC,CAAC,YAAY,IAAI,IAAI;YACpC,EAAE,EAAE,CAAC,CAAC,cAAc;YACpB,SAAS,EAAE,CAAC,CAAC,SAAS,IAAI,IAAI;YAC9B,eAAe,EAAE,CAAC,CAAC,eAAe,IAAI,IAAI;YAC1C,UAAU,EAAE,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC;YAC/C,GAAG,EAAE,CAAC,CAAC,GAAG;YACV,KAAK,EAAE,CAAC,CAAC,KAAK;SACf,CAAC;IACJ,CAAC;IACD,MAAM,CAAC,CAAC;QACN,OAAO;YACL,cAAc,EAAE,CAAC,CAAC,EAAE;YACpB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,QAAQ,EAAE;YACjC,YAAY,EAAE,CAAC,CAAC,YAAY,IAAI,SAAS;YACzC,SAAS,EAAE,CAAC,CAAC,SAAS,IAAI,SAAS;YACnC,eAAe,EAAE,CAAC,CAAC,eAAe,IAAI,SAAS;YAC/C,UAAU,EAAE,CAAC,CAAC,UAAU,CAAC,QAAQ,EAAE;YACnC,GAAG,EAAE,CAAC,CAAC,GAAG;YACV,KAAK,EAAE,CAAC,CAAC,KAAK;SACf,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 { Temporal } from \"temporal-polyfill\";\nimport * as z from \"zod/mini\";\n\nexport const conversationPropertiesCodec = z.codec(\n z.object({\n conversationId: z.string(),\n createdAt: z.iso.datetime(),\n currentRunId: z.optional(z.string()),\n modelName: z.optional(z.string()),\n modelProviderId: z.optional(z.string()),\n modifiedAt: z.iso.datetime(),\n tag: z.string(),\n title: z.nullable(z.string()),\n }),\n z.object({\n createdAt: z.instanceof(Temporal.Instant),\n currentRunId: z.nullable(z.string()),\n id: z.string(),\n modelName: z.nullable(z.string()),\n modelProviderId: z.nullable(z.string()),\n modifiedAt: z.instanceof(Temporal.Instant),\n tag: z.string(),\n title: z.nullable(z.string()),\n }),\n {\n decode(v) {\n return {\n createdAt: Temporal.Instant.from(v.createdAt),\n currentRunId: v.currentRunId || null,\n id: v.conversationId,\n modelName: v.modelName || null,\n modelProviderId: v.modelProviderId || null,\n modifiedAt: Temporal.Instant.from(v.modifiedAt),\n tag: v.tag,\n title: v.title,\n };\n },\n encode(v) {\n return {\n conversationId: v.id,\n createdAt: v.createdAt.toString(),\n currentRunId: v.currentRunId || undefined,\n modelName: v.modelName || undefined,\n modelProviderId: v.modelProviderId || undefined,\n modifiedAt: v.modifiedAt.toString(),\n tag: v.tag,\n title: v.title,\n };\n },\n },\n);\n\nexport type ConversationEntity = z.input<typeof conversationPropertiesCodec>;\n"]}
|
|
@@ -56,7 +56,7 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
|
|
|
56
56
|
modelProviderId: string | null;
|
|
57
57
|
modifiedAt: import("temporal-polyfill").Temporal.Instant;
|
|
58
58
|
tag: string;
|
|
59
|
-
title: string;
|
|
59
|
+
title: string | null;
|
|
60
60
|
}, {
|
|
61
61
|
conversationId: string;
|
|
62
62
|
}, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<{
|
|
@@ -164,7 +164,7 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
|
|
|
164
164
|
modelProviderId: string | null;
|
|
165
165
|
modifiedAt: import("temporal-polyfill").Temporal.Instant;
|
|
166
166
|
tag: string;
|
|
167
|
-
title: string;
|
|
167
|
+
title: string | null;
|
|
168
168
|
};
|
|
169
169
|
history: {
|
|
170
170
|
data: ({
|
|
@@ -272,7 +272,7 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
|
|
|
272
272
|
modelProviderId: string | null;
|
|
273
273
|
modifiedAt: import("temporal-polyfill").Temporal.Instant;
|
|
274
274
|
tag: string;
|
|
275
|
-
title: string;
|
|
275
|
+
title: string | null;
|
|
276
276
|
};
|
|
277
277
|
currentRunId: string;
|
|
278
278
|
}, {
|
|
@@ -395,7 +395,7 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
|
|
|
395
395
|
modelProviderId: string | null;
|
|
396
396
|
modifiedAt: import("temporal-polyfill").Temporal.Instant;
|
|
397
397
|
tag: string;
|
|
398
|
-
title: string;
|
|
398
|
+
title: string | null;
|
|
399
399
|
}, {
|
|
400
400
|
conversationId: string;
|
|
401
401
|
}, import("xstate").EventObject>;
|
|
@@ -511,7 +511,7 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
|
|
|
511
511
|
modelProviderId: string | null;
|
|
512
512
|
modifiedAt: import("temporal-polyfill").Temporal.Instant;
|
|
513
513
|
tag: string;
|
|
514
|
-
title: string;
|
|
514
|
+
title: string | null;
|
|
515
515
|
};
|
|
516
516
|
history: {
|
|
517
517
|
data: ({
|
|
@@ -623,7 +623,7 @@ export declare const createConversationMachine: (config: SonarV4Config) => impor
|
|
|
623
623
|
modelProviderId: string | null;
|
|
624
624
|
modifiedAt: import("temporal-polyfill").Temporal.Instant;
|
|
625
625
|
tag: string;
|
|
626
|
-
title: string;
|
|
626
|
+
title: string | null;
|
|
627
627
|
};
|
|
628
628
|
currentRunId: string;
|
|
629
629
|
}, {
|
|
@@ -10,7 +10,7 @@ export declare const createExchangeRun: (config: SonarV4Config) => (conversation
|
|
|
10
10
|
modelProviderId: string | null;
|
|
11
11
|
modifiedAt: import("temporal-polyfill").Temporal.Instant;
|
|
12
12
|
tag: string;
|
|
13
|
-
title: string;
|
|
13
|
+
title: string | null;
|
|
14
14
|
};
|
|
15
15
|
currentRunId: string;
|
|
16
16
|
}, import("../../../index.ts").HttpError>;
|
|
@@ -8,5 +8,5 @@ export declare const retrieveConversation: (config: SonarV4Config) => (id: strin
|
|
|
8
8
|
modelProviderId: string | null;
|
|
9
9
|
modifiedAt: import("temporal-polyfill").Temporal.Instant;
|
|
10
10
|
tag: string;
|
|
11
|
-
title: string;
|
|
11
|
+
title: string | null;
|
|
12
12
|
}, import("../../../index.ts").HttpError>;
|
|
@@ -8,7 +8,7 @@ export declare const updateConversation: (config: SonarV4Config) => (id: string,
|
|
|
8
8
|
modelProviderId: string | null;
|
|
9
9
|
modifiedAt: import("temporal-polyfill").Temporal.Instant;
|
|
10
10
|
tag: string;
|
|
11
|
-
title: string;
|
|
11
|
+
title: string | null;
|
|
12
12
|
}, import("../../../index.ts").HttpError>;
|
|
13
13
|
export declare const conversationUpdateSchema: z.ZodMiniObject<{
|
|
14
14
|
title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
package/dist-iife/cloud.js
CHANGED
|
@@ -24616,7 +24616,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24616
24616
|
modelProviderId: optional(string2()),
|
|
24617
24617
|
modifiedAt: iso_exports.datetime(),
|
|
24618
24618
|
tag: string2(),
|
|
24619
|
-
title: string2()
|
|
24619
|
+
title: nullable(string2())
|
|
24620
24620
|
}), object({
|
|
24621
24621
|
createdAt: _instanceof(Xn.Instant),
|
|
24622
24622
|
currentRunId: nullable(string2()),
|
|
@@ -24625,7 +24625,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24625
24625
|
modelProviderId: nullable(string2()),
|
|
24626
24626
|
modifiedAt: _instanceof(Xn.Instant),
|
|
24627
24627
|
tag: string2(),
|
|
24628
|
-
title: string2()
|
|
24628
|
+
title: nullable(string2())
|
|
24629
24629
|
}), {
|
|
24630
24630
|
decode(v2) {
|
|
24631
24631
|
return {
|
package/dist-iife/enterprise.js
CHANGED
|
@@ -25279,7 +25279,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
25279
25279
|
modelProviderId: optional(string2()),
|
|
25280
25280
|
modifiedAt: iso_exports.datetime(),
|
|
25281
25281
|
tag: string2(),
|
|
25282
|
-
title: string2()
|
|
25282
|
+
title: nullable(string2())
|
|
25283
25283
|
}), object({
|
|
25284
25284
|
createdAt: _instanceof(Xn.Instant),
|
|
25285
25285
|
currentRunId: nullable(string2()),
|
|
@@ -25288,7 +25288,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
25288
25288
|
modelProviderId: nullable(string2()),
|
|
25289
25289
|
modifiedAt: _instanceof(Xn.Instant),
|
|
25290
25290
|
tag: string2(),
|
|
25291
|
-
title: string2()
|
|
25291
|
+
title: nullable(string2())
|
|
25292
25292
|
}), {
|
|
25293
25293
|
decode(v2) {
|
|
25294
25294
|
return {
|