@hasura/promptql 2.0.0-alpha.18 → 2.0.0-alpha.19
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.d.mts +118 -9
- package/dist/index.d.ts +118 -9
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -18,6 +18,13 @@ type ThreadEvent$1 = {
|
|
|
18
18
|
user_id: PromptQlUserId;
|
|
19
19
|
message: UserMessage;
|
|
20
20
|
};
|
|
21
|
+
} | {
|
|
22
|
+
ScheduledAgentTriggerEvent: {
|
|
23
|
+
scheduled_agent_trigger_event_id: ScheduledAgentTriggerEventId;
|
|
24
|
+
scheduled_agent_trigger_id: ScheduledAgentTriggerId;
|
|
25
|
+
timestamp: string;
|
|
26
|
+
payload: ScheduledAgentTriggerPayload;
|
|
27
|
+
};
|
|
21
28
|
} | {
|
|
22
29
|
AgentMessage: {
|
|
23
30
|
/**
|
|
@@ -59,9 +66,18 @@ type ThreadEvent$1 = {
|
|
|
59
66
|
};
|
|
60
67
|
type PromptQlUserId = string;
|
|
61
68
|
type ArtifactId = string;
|
|
69
|
+
type TzWrapper = string;
|
|
70
|
+
type ScheduledAgentTriggerEventId = string;
|
|
71
|
+
/**
|
|
72
|
+
* A registered scheduled agent trigger ID
|
|
73
|
+
*/
|
|
74
|
+
type ScheduledAgentTriggerId = string;
|
|
75
|
+
type ScheduledAgentTriggerPayload = ScheduledAgentTriggerPayloadV1;
|
|
62
76
|
type VersionedOrUnversionedAgentUpdate = VersionedAgentUpdate | AgentUpdate;
|
|
63
77
|
type AgentUpdateContent = {
|
|
64
|
-
interaction_started: {
|
|
78
|
+
interaction_started: {
|
|
79
|
+
triggered_by?: AgentTrigger | null;
|
|
80
|
+
};
|
|
65
81
|
} | {
|
|
66
82
|
interaction_update: InteractionUpdate;
|
|
67
83
|
} | {
|
|
@@ -69,6 +85,18 @@ type AgentUpdateContent = {
|
|
|
69
85
|
outcome: InteractionOutcome;
|
|
70
86
|
};
|
|
71
87
|
};
|
|
88
|
+
type AgentTrigger = {
|
|
89
|
+
user_message: {
|
|
90
|
+
/**
|
|
91
|
+
* A unique index for a user message in a thread
|
|
92
|
+
*/
|
|
93
|
+
message_id: string;
|
|
94
|
+
};
|
|
95
|
+
} | {
|
|
96
|
+
scheduled_agent_trigger_event: {
|
|
97
|
+
scheduled_agent_trigger_event_id: ScheduledAgentTriggerEventId;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
72
100
|
type InteractionUpdate = {
|
|
73
101
|
interaction_decision: InteractionDecisionUpdate;
|
|
74
102
|
} | {
|
|
@@ -93,7 +121,7 @@ type InteractionDecisionUpdate = {
|
|
|
93
121
|
/**
|
|
94
122
|
* Why the interaction was declined
|
|
95
123
|
*/
|
|
96
|
-
reason: "MultipleUsersAndNoPromptQlMention" | "UserRequestedSkip";
|
|
124
|
+
reason: "MultipleUsersAndNoPromptQlMention" | "UserRequestedSkip" | "FutureTriggersInThread";
|
|
97
125
|
};
|
|
98
126
|
} | {
|
|
99
127
|
AcceptInteraction: {
|
|
@@ -239,6 +267,16 @@ type AgentLoopAction = {
|
|
|
239
267
|
find_relevant_tables_functions: {
|
|
240
268
|
search_query: string;
|
|
241
269
|
};
|
|
270
|
+
} | {
|
|
271
|
+
create_scheduled_trigger: {
|
|
272
|
+
trigger_type: ScheduledAgentTriggerType;
|
|
273
|
+
description: string;
|
|
274
|
+
context: string;
|
|
275
|
+
};
|
|
276
|
+
} | {
|
|
277
|
+
delete_scheduled_trigger: {
|
|
278
|
+
trigger_id: ScheduledAgentTriggerId;
|
|
279
|
+
};
|
|
242
280
|
};
|
|
243
281
|
/**
|
|
244
282
|
* Program Package Name is the unique name for a program within a project that usable from code
|
|
@@ -249,6 +287,16 @@ type ProgramPackageName = string;
|
|
|
249
287
|
* Skill type identifier for the new skill-based architecture.
|
|
250
288
|
*/
|
|
251
289
|
type SkillType = "python_programming" | "react_programming" | "knowledge_exploration" | "saved_programs" | "response_generation";
|
|
290
|
+
type ScheduledAgentTriggerType = {
|
|
291
|
+
one_time: {
|
|
292
|
+
scheduled_for: string;
|
|
293
|
+
};
|
|
294
|
+
} | {
|
|
295
|
+
recurring: {
|
|
296
|
+
cron_expr: string;
|
|
297
|
+
scheduled_for?: string | null;
|
|
298
|
+
};
|
|
299
|
+
};
|
|
252
300
|
/**
|
|
253
301
|
* Intermediate updates emitted during action execution.
|
|
254
302
|
*/
|
|
@@ -336,6 +384,14 @@ type AgentLoopActionResult = {
|
|
|
336
384
|
summary: string;
|
|
337
385
|
llm_usage: LlmUsage[];
|
|
338
386
|
agent_loop_action_result_type: "relevant_tables_found";
|
|
387
|
+
} | {
|
|
388
|
+
trigger_id: ScheduledAgentTriggerId;
|
|
389
|
+
description: string;
|
|
390
|
+
next_fire_at: string;
|
|
391
|
+
agent_loop_action_result_type: "scheduled_trigger_created";
|
|
392
|
+
} | {
|
|
393
|
+
trigger_id: ScheduledAgentTriggerId;
|
|
394
|
+
agent_loop_action_result_type: "scheduled_trigger_deleted";
|
|
339
395
|
};
|
|
340
396
|
/**
|
|
341
397
|
* The title of a wiki page or section
|
|
@@ -380,6 +436,10 @@ type InteractionOutcome = {
|
|
|
380
436
|
user_cancelled: {};
|
|
381
437
|
} | {
|
|
382
438
|
server_cancelled: {};
|
|
439
|
+
} | {
|
|
440
|
+
interrupted_due_to_new_trigger: {
|
|
441
|
+
new_trigger: AgentTrigger;
|
|
442
|
+
};
|
|
383
443
|
};
|
|
384
444
|
/**
|
|
385
445
|
* Updates sent by the agent during processing of a user interaction
|
|
@@ -459,7 +519,7 @@ type MessageProcessingUpdate = {
|
|
|
459
519
|
/**
|
|
460
520
|
* Why the interaction was declined
|
|
461
521
|
*/
|
|
462
|
-
reason: "MultipleUsersAndNoPromptQlMention" | "UserRequestedSkip";
|
|
522
|
+
reason: "MultipleUsersAndNoPromptQlMention" | "UserRequestedSkip" | "FutureTriggersInThread";
|
|
463
523
|
};
|
|
464
524
|
} | {
|
|
465
525
|
AcceptInteraction: {
|
|
@@ -1421,7 +1481,7 @@ type InteractionFinishedUpdate = {
|
|
|
1421
1481
|
/**
|
|
1422
1482
|
* Why the interaction was declined
|
|
1423
1483
|
*/
|
|
1424
|
-
reason: "MultipleUsersAndNoPromptQlMention" | "UserRequestedSkip";
|
|
1484
|
+
reason: "MultipleUsersAndNoPromptQlMention" | "UserRequestedSkip" | "FutureTriggersInThread";
|
|
1425
1485
|
};
|
|
1426
1486
|
};
|
|
1427
1487
|
type TeachingId = string;
|
|
@@ -1440,6 +1500,7 @@ type AgentLearningUpdate = {
|
|
|
1440
1500
|
} | {
|
|
1441
1501
|
WikiChangesApplied: {
|
|
1442
1502
|
build_id: string;
|
|
1503
|
+
audit_ids?: WikiAuditId[] | null;
|
|
1443
1504
|
};
|
|
1444
1505
|
} | {
|
|
1445
1506
|
Errored: {
|
|
@@ -1448,6 +1509,7 @@ type AgentLearningUpdate = {
|
|
|
1448
1509
|
} | {
|
|
1449
1510
|
Completed: {};
|
|
1450
1511
|
};
|
|
1512
|
+
type WikiAuditId = string;
|
|
1451
1513
|
/**
|
|
1452
1514
|
* Events that are internal to the system and not connected to a particular user/agent message
|
|
1453
1515
|
*/
|
|
@@ -1936,7 +1998,7 @@ type InteractionError = "Internal" | {
|
|
|
1936
1998
|
/**
|
|
1937
1999
|
* Reasons why an agent might decline to process a user interaction
|
|
1938
2000
|
*/
|
|
1939
|
-
type InteractionDeclineReason = "MultipleUsersAndNoPromptQlMention" | "UserRequestedSkip";
|
|
2001
|
+
type InteractionDeclineReason = "MultipleUsersAndNoPromptQlMention" | "UserRequestedSkip" | "FutureTriggersInThread";
|
|
1940
2002
|
type ConfidenceAnalysisOutcome = {
|
|
1941
2003
|
Completed: {
|
|
1942
2004
|
completed_at: string;
|
|
@@ -2067,7 +2129,7 @@ interface UserMessage {
|
|
|
2067
2129
|
timestamp: string;
|
|
2068
2130
|
message: string;
|
|
2069
2131
|
uploads: UserUpload[];
|
|
2070
|
-
timezone:
|
|
2132
|
+
timezone: TzWrapper;
|
|
2071
2133
|
/**
|
|
2072
2134
|
* Controls whether the agent should respond to this message.
|
|
2073
2135
|
*/
|
|
@@ -2090,6 +2152,9 @@ interface ArtifactReference {
|
|
|
2090
2152
|
artifact_id: ArtifactId;
|
|
2091
2153
|
version: number;
|
|
2092
2154
|
}
|
|
2155
|
+
interface ScheduledAgentTriggerPayloadV1 {
|
|
2156
|
+
version: "v1";
|
|
2157
|
+
}
|
|
2093
2158
|
interface VersionedAgentUpdate {
|
|
2094
2159
|
timestamp: string;
|
|
2095
2160
|
content: AgentUpdateContent;
|
|
@@ -5023,6 +5088,17 @@ type Uuid_Comparison_Exp = {
|
|
|
5023
5088
|
_neq?: InputMaybe<Scalars['uuid']['input']>;
|
|
5024
5089
|
_nin?: InputMaybe<Array<Scalars['uuid']['input']>>;
|
|
5025
5090
|
};
|
|
5091
|
+
type RoomFragment = {
|
|
5092
|
+
__typename?: 'rooms';
|
|
5093
|
+
room_id: string;
|
|
5094
|
+
name: string;
|
|
5095
|
+
description?: string | null;
|
|
5096
|
+
project_id: string;
|
|
5097
|
+
visibility: string;
|
|
5098
|
+
user_id: string;
|
|
5099
|
+
created_at: string;
|
|
5100
|
+
updated_at: string;
|
|
5101
|
+
};
|
|
5026
5102
|
type ThreadFragment = {
|
|
5027
5103
|
__typename?: 'threads_v2';
|
|
5028
5104
|
thread_id: string;
|
|
@@ -5093,6 +5169,12 @@ type StartThreadMutation = {
|
|
|
5093
5169
|
} | null>;
|
|
5094
5170
|
} | null;
|
|
5095
5171
|
};
|
|
5172
|
+
type GetRoomsQueryVariables = Exact<{
|
|
5173
|
+
where: Rooms_Bool_Exp;
|
|
5174
|
+
order_by?: InputMaybe<Array<Rooms_Order_By> | Rooms_Order_By>;
|
|
5175
|
+
offset?: InputMaybe<Scalars['Int']['input']>;
|
|
5176
|
+
limit?: InputMaybe<Scalars['Int']['input']>;
|
|
5177
|
+
}>;
|
|
5096
5178
|
type GetThreadsQueryVariables = Exact<{
|
|
5097
5179
|
where: Threads_V2_Bool_Exp;
|
|
5098
5180
|
limit?: InputMaybe<Scalars['Int']['input']>;
|
|
@@ -5275,6 +5357,16 @@ type StreamThreadEventOptions = {
|
|
|
5275
5357
|
timeout?: number;
|
|
5276
5358
|
};
|
|
5277
5359
|
|
|
5360
|
+
/**
|
|
5361
|
+
* Download artifact data.
|
|
5362
|
+
*/
|
|
5363
|
+
declare function downloadArtifactData(host: string, artifactId: string, version: number, headers: Record<string, string>, customFetch?: typeof fetch): Promise<unknown>;
|
|
5364
|
+
|
|
5365
|
+
/**
|
|
5366
|
+
* List rooms of the current project.The default limit is 10.
|
|
5367
|
+
*/
|
|
5368
|
+
declare function listRooms(client: ApolloClient, variables: GetRoomsQueryVariables): Promise<RoomFragment[]>;
|
|
5369
|
+
|
|
5278
5370
|
/**
|
|
5279
5371
|
* List threads of the current project.The default limit is 10.
|
|
5280
5372
|
*/
|
|
@@ -5310,9 +5402,9 @@ declare function subscribeThreadEvents(client: ApolloClient, threadId: string, f
|
|
|
5310
5402
|
*/
|
|
5311
5403
|
declare function streamThreadMessageEvents(client: ApolloClient, threadId: string, options?: StreamThreadEventOptions): Observable<ThreadEvent[]>;
|
|
5312
5404
|
/**
|
|
5313
|
-
* The guard to check if the thread interaction
|
|
5405
|
+
* The guard to check if the thread interaction is not finished.
|
|
5314
5406
|
*/
|
|
5315
|
-
declare function
|
|
5407
|
+
declare function isInteractionAnalyzing(events: ThreadEvent[], skipAnalysis?: boolean): boolean;
|
|
5316
5408
|
|
|
5317
5409
|
/**
|
|
5318
5410
|
* Constructor options for a PromptQL authenticator.
|
|
@@ -5347,6 +5439,18 @@ declare class Project {
|
|
|
5347
5439
|
info(): Promise<GetProjectInfoOutput>;
|
|
5348
5440
|
}
|
|
5349
5441
|
|
|
5442
|
+
/**
|
|
5443
|
+
* Room class implements the set of PromptQL room APIs.
|
|
5444
|
+
*/
|
|
5445
|
+
declare class Room {
|
|
5446
|
+
private _options;
|
|
5447
|
+
constructor(options: ClientOptions);
|
|
5448
|
+
/**
|
|
5449
|
+
* List rooms of the current project.The default limit is 10.
|
|
5450
|
+
*/
|
|
5451
|
+
list(variables: GetRoomsQueryVariables): Promise<RoomFragment[]>;
|
|
5452
|
+
}
|
|
5453
|
+
|
|
5350
5454
|
/**
|
|
5351
5455
|
* Project class implements the set of PromptQL thread APIs.
|
|
5352
5456
|
*/
|
|
@@ -5399,6 +5503,7 @@ declare class PromptQLSdk {
|
|
|
5399
5503
|
private _fetchToken;
|
|
5400
5504
|
readonly thread: Thread;
|
|
5401
5505
|
readonly project: Project;
|
|
5506
|
+
readonly room: Room;
|
|
5402
5507
|
/**
|
|
5403
5508
|
* Check if the PromptQL SDK instance is authenticated.
|
|
5404
5509
|
*/
|
|
@@ -5592,5 +5697,9 @@ type InteractionFinishedEvent = {
|
|
|
5592
5697
|
* Validate and return the InteractionFinished event from the step update.
|
|
5593
5698
|
*/
|
|
5594
5699
|
declare function getAgentInteractionFinishedEvent(eventData: ThreadEvent$1): InteractionFinishedEvent | null;
|
|
5700
|
+
/**
|
|
5701
|
+
* Get the message_id from the thread event data.
|
|
5702
|
+
*/
|
|
5703
|
+
declare function getThreadEventMessageId(event: ThreadEvent$1 | undefined): string | undefined;
|
|
5595
5704
|
|
|
5596
|
-
export { type AgentInteraction, type AgentLearningUpdate, type AgentLoopAction, type AgentLoopActionResult, type AgentLoopActionUpdate, type AgentLoopUpdate, type AgentState, type AgentUpdate, type AgentUpdateContent, type AllTheServerTypes, type AnalyzedCodeAction, type AnalyzedCodeAction2, type ApolloClientOptions, type ArtifactError, type ArtifactErrorV1, type ArtifactId, type ArtifactPreview, type ArtifactReference, type ArtifactReference1, type ArtifactReference2, type ArtifactState, type ArtifactType, type ArtifactType2, type ArtifactUpdate, type ArtifactUpdate1, type AssumptionFactCheck, type BuildError, type BuildErrorV1, type BuiltUi, type BuiltUi1, type CancelAgentMessageMutationVariables, type CheckedAssumption, type CheckedTopic, type CodeAction, type CodeAction2, type CodeBlock, type CodeError, type CodeErrorV1, type CodeExecutionComplete, type CodeOutputAnalysis, type CodeOutputAnalysis1, type CodeOutputAnalyzed, type ComponentResponse, type ComponentResponse1, type ComponentResponse2, type ComponentResponse3, type ComponentResponse4, type ComponentResponse5, type ConfidenceAnalysis, type ConfidenceAnalysis1, type ConfidenceAnalysisLlmUsage, type ConfidenceAnalysisOutcome, type ConfidenceAnalysisUpdate, type ContextExplorerCompleted, type ContextExplorerStarted, type ContextExplorerState, type ContextExplorerUpdate, type CopyFileEntry, type CurrentAction, type DataArtifactUpdated, type DataArtifactUpdatedV1, type Dependency, type EventOfKind, type ExternalKnowledgeExplorerAttempt, type ExternalKnowledgeExplorerAttempt1, type ExternalKnowledgeExplorerAttempt2, type ExternalKnowledgeExplorerState, type ExternalKnowledgeSummary, type ExternalKnowledgeTaskGeneratorState, type FactSource, type GeneratedCode, type GeneratedFile, type GeneratedFile2, type GeneratedProgramRunnerOutput, type GeneratedResponse, type GeneratedUiCode, type GeneratedUiCode1, type GetThreadEventOptions, type GetThreadsQueryVariables, type IPromptQLSdk, type Interaction, type InteractionDecision, type InteractionDecisionAccept, type InteractionDecisionDecline, type InteractionDecisionUpdate, type InteractionDeclineReason, type InteractionError, type InteractionFinishedEvent, type InteractionFinishedUpdate, type InteractionOutcome, type InteractionOutcome2, type InteractionOutcomeStatus, type InteractionUpdate, type InternalError, type InternalErrorV1, type InternalUpdate, type KeysOfUnion, type LearningSuggestion, type LearningSuggestionOutcome, type LearningSuggestionUpdate, type LearningSuggestionUpdateV1, type LlmResponse, type LlmUsage, type MessageProcessingStarted, type MessageProcessingState, type MessageProcessingUpdate, type NeedsSupportAnalysis, type NeedsSupportOutcome, type NeedsSupportUpdate, type OrchestratorState, type OrchestratorUpdate, type Order_By, type OutputEmitted, type OutputEmittedV1, type PipelineColumn, type PipelineColumnType, type PipelinePartitionSpec, type PipelinePartitionTransform, type PipelineProgress, type PipelineProgressV1, type PipelineRunStepDetails, type PipelineSchema, type PipelineSink, type PipelineSource, type PipelineStep, type PipelineTransform, type PlanGenerationStarted, type PlanState, type PlanStateStep, type PlanStepGenerated, type PlanningDecisionCompleted, type PlanningDecisionPlanningRequired, type PlanningDecisionStarted, type PlanningDecisionState, type PlanningDecisionUpdate, type ProgramId, type ProgramPackageName, type ProgramRunEvent, type ProgramRunResult, type ProgramRunnerAction, type ProgramRunnerAction2, type ProgramRunnerActionResult, type ProgramRunnerAttempt, type ProgramTransform, type ProgrammerState, type ProgrammerUpdate, PromptQLSdk, type PromptQLSdkOptions, type PromptQlConfigFeatureFlagModel, type PromptQlUserId, type PythonRunStepDetails, type PythonStep, type ResponseGenerationState, type ResponseGenerationUpdate, type ResponseTruncation, type RunConfigV1, type RunFinished, type RunFinishedOutcome, type RunFinishedV1, type RunProgramRequest, type RunProgramRequest2, type RunSavedProgramRequest, type RunSavedProgramRequest2, type RunStarted, type RunStartedV1, type RunStepDetails, type SavedProgramRunnerStage, type SavedProgramRunnerState, type SavedProgramRunnerUpdate, type SavedProgramRunnerUpdateV0, type SchemaContext, type SchemaContext1, type SchemaExplored, type SchemaExplorerCompleted, type SchemaExplorerStarted, type SchemaExplorerState, type SchemaExplorerUpdate, type SchemaTask, type SchemaTasksGenerationCompleted, type SchemaTasksGenerationStarted, type SchemaTasksGenerationState, type SchemaTasksGenerationUpdate, type SendMessageToThreadArguments, type SendMessageToThreadOutput, type SendThreadMessageMutationVariables, type ShelfActionEvent, type ShelfSink, type ShelfUpdate, type ShelfUpdateV1, type SkillType, type SocialFeedRating, type SocialFeedRatingLlmUsage, type SocialFeedRatingOutcome, type SocialFeedRatingUpdate, type Span, type SqlError, type SqlErrorV1, type SqlRunStepDetails, type SqlSource, type SqlStep, type StartThreadArguments, type StartThreadMutationVariables, type StartThreadOutput, type StartingOrchestrator, type Step, type StepExecutionFinished, type StepExecutionFinishedV1, type StepExecutionStarted, type StepExecutionStartedV1, type StepState, type StepUpdate, type StreamThreadEventOptions, type SummaryAction, type TasksGenerated, type Teaching, type TeachingId, type TeachingOutcome, type TeachingState, type ThreadEvent, type ThreadEvent$1 as ThreadEventData, type ThreadFragment, type ThreadParticipants, type TransactionId, type UiBuild, type UiBuild2, type UiBuildFailure, type UiBuildResult, type UiBuildRunStepDetails, type UiBuildStep, type UiMetadata, type UiProgrammerState, type UiProgrammerUpdate, type UserCancel, type UserCancelEvent, type UserInteraction, type UserMessage, type UserMessageEvent, type UserUpload, type UserUploadMetadata, type Version, type VersionedAgentUpdate, type VersionedOrUnversionedAgentUpdate, type Warning, type WikiChange, type WikiContent, type WikiDelta, type WikiExplorerCompleted, type WikiExplorerStarted, type WikiExplorerState, type WikiExplorerUpdate, type WikiGenerationOutcome, type WikiGenerationUpdate, type WikiInfoGenerated, type WikiLearningSuggestionUpdate, type WikiPageV1, type WikiSection, type WikiSelectionUpdate, type WikiTitle, cancelAgentMessage, createApolloClient, createPromptQLAuthTokenGenerator, diffThreadEvents, getAgentGeneratedResponse, getAgentInteractionDecisionAcceptInteractionEvent, getAgentInteractionDecisionDeclineInteractionEvent, getAgentInteractionFinishedEvent, getAgentMessageProcessingStartedEvent, getAgentOrchestratorContextExplorerCompletedEvent, getAgentOrchestratorContextExplorerStartedEvent, getAgentOrchestratorContextExplorerUpdateEvent, getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent, getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent, getAgentOrchestratorSchemaExplorerCompletedEvent, getAgentOrchestratorSchemaExplorerGeneratedCodeEvent, getAgentOrchestratorSchemaExplorerSchemaExploredEvent, getAgentOrchestratorSchemaExplorerStartedEvent, getAgentOrchestratorSchemaExplorerUpdateEvent, getAgentOrchestratorSchemaTasksGeneratedEvent, getAgentOrchestratorSchemaTasksGenerationCompletedEvent, getAgentOrchestratorSchemaTasksGenerationStartedEvent, getAgentOrchestratorSchemaTasksGenerationUpdateEvent, getAgentOrchestratorStepProgrammerEvent, getAgentOrchestratorStepSavedProgramRunnerEvent, getAgentOrchestratorStepUiProgrammerEvent, getAgentOrchestratorStepUpdateEvent, getAgentOrchestratorUpdateEvent, getAgentOrchestratorWikiExplorerCompletedEvent, getAgentOrchestratorWikiExplorerStartedEvent, getAgentOrchestratorWikiExplorerUpdateEvent, getAgentOrchestratorWikiInfoGeneratedEvent, getAgentPlanGenerationStartedEvent, getAgentPlanStepGeneratedEvent, getAgentPlanningDecisionCompletedEvent, getAgentPlanningDecisionPlanningRequiredEvent, getAgentPlanningDecisionStartedEvent, getAgentPlanningDecisionUpdateEvent, getAgentStartingOrchestratorEvent, getThread, getThreadEvents, getUserCancelEvent, getUserMessageEvent, listThreads, sendThreadMessage, startThread, streamThreadMessageEvents, subscribeThreadEvents
|
|
5705
|
+
export { type AgentInteraction, type AgentLearningUpdate, type AgentLoopAction, type AgentLoopActionResult, type AgentLoopActionUpdate, type AgentLoopUpdate, type AgentState, type AgentTrigger, type AgentUpdate, type AgentUpdateContent, type AllTheServerTypes, type AnalyzedCodeAction, type AnalyzedCodeAction2, type ApolloClientOptions, type ArtifactError, type ArtifactErrorV1, type ArtifactId, type ArtifactPreview, type ArtifactReference, type ArtifactReference1, type ArtifactReference2, type ArtifactState, type ArtifactType, type ArtifactType2, type ArtifactUpdate, type ArtifactUpdate1, type AssumptionFactCheck, type BuildError, type BuildErrorV1, type BuiltUi, type BuiltUi1, type CancelAgentMessageMutationVariables, type CheckedAssumption, type CheckedTopic, type CodeAction, type CodeAction2, type CodeBlock, type CodeError, type CodeErrorV1, type CodeExecutionComplete, type CodeOutputAnalysis, type CodeOutputAnalysis1, type CodeOutputAnalyzed, type ComponentResponse, type ComponentResponse1, type ComponentResponse2, type ComponentResponse3, type ComponentResponse4, type ComponentResponse5, type ConfidenceAnalysis, type ConfidenceAnalysis1, type ConfidenceAnalysisLlmUsage, type ConfidenceAnalysisOutcome, type ConfidenceAnalysisUpdate, type ContextExplorerCompleted, type ContextExplorerStarted, type ContextExplorerState, type ContextExplorerUpdate, type CopyFileEntry, type CurrentAction, type DataArtifactUpdated, type DataArtifactUpdatedV1, type Dependency, type EventOfKind, type ExternalKnowledgeExplorerAttempt, type ExternalKnowledgeExplorerAttempt1, type ExternalKnowledgeExplorerAttempt2, type ExternalKnowledgeExplorerState, type ExternalKnowledgeSummary, type ExternalKnowledgeTaskGeneratorState, type FactSource, type GeneratedCode, type GeneratedFile, type GeneratedFile2, type GeneratedProgramRunnerOutput, type GeneratedResponse, type GeneratedUiCode, type GeneratedUiCode1, type GetThreadEventOptions, type GetThreadsQueryVariables, type IPromptQLSdk, type Interaction, type InteractionDecision, type InteractionDecisionAccept, type InteractionDecisionDecline, type InteractionDecisionUpdate, type InteractionDeclineReason, type InteractionError, type InteractionFinishedEvent, type InteractionFinishedUpdate, type InteractionOutcome, type InteractionOutcome2, type InteractionOutcomeStatus, type InteractionUpdate, type InternalError, type InternalErrorV1, type InternalUpdate, type KeysOfUnion, type LearningSuggestion, type LearningSuggestionOutcome, type LearningSuggestionUpdate, type LearningSuggestionUpdateV1, type LlmResponse, type LlmUsage, type MessageProcessingStarted, type MessageProcessingState, type MessageProcessingUpdate, type NeedsSupportAnalysis, type NeedsSupportOutcome, type NeedsSupportUpdate, type OrchestratorState, type OrchestratorUpdate, type Order_By, type OutputEmitted, type OutputEmittedV1, type PipelineColumn, type PipelineColumnType, type PipelinePartitionSpec, type PipelinePartitionTransform, type PipelineProgress, type PipelineProgressV1, type PipelineRunStepDetails, type PipelineSchema, type PipelineSink, type PipelineSource, type PipelineStep, type PipelineTransform, type PlanGenerationStarted, type PlanState, type PlanStateStep, type PlanStepGenerated, type PlanningDecisionCompleted, type PlanningDecisionPlanningRequired, type PlanningDecisionStarted, type PlanningDecisionState, type PlanningDecisionUpdate, type ProgramId, type ProgramPackageName, type ProgramRunEvent, type ProgramRunResult, type ProgramRunnerAction, type ProgramRunnerAction2, type ProgramRunnerActionResult, type ProgramRunnerAttempt, type ProgramTransform, type ProgrammerState, type ProgrammerUpdate, PromptQLSdk, type PromptQLSdkOptions, type PromptQlConfigFeatureFlagModel, type PromptQlUserId, type PythonRunStepDetails, type PythonStep, type ResponseGenerationState, type ResponseGenerationUpdate, type ResponseTruncation, type RoomFragment, type RunConfigV1, type RunFinished, type RunFinishedOutcome, type RunFinishedV1, type RunProgramRequest, type RunProgramRequest2, type RunSavedProgramRequest, type RunSavedProgramRequest2, type RunStarted, type RunStartedV1, type RunStepDetails, type SavedProgramRunnerStage, type SavedProgramRunnerState, type SavedProgramRunnerUpdate, type SavedProgramRunnerUpdateV0, type ScheduledAgentTriggerEventId, type ScheduledAgentTriggerId, type ScheduledAgentTriggerPayload, type ScheduledAgentTriggerPayloadV1, type ScheduledAgentTriggerType, type SchemaContext, type SchemaContext1, type SchemaExplored, type SchemaExplorerCompleted, type SchemaExplorerStarted, type SchemaExplorerState, type SchemaExplorerUpdate, type SchemaTask, type SchemaTasksGenerationCompleted, type SchemaTasksGenerationStarted, type SchemaTasksGenerationState, type SchemaTasksGenerationUpdate, type SendMessageToThreadArguments, type SendMessageToThreadOutput, type SendThreadMessageMutationVariables, type ShelfActionEvent, type ShelfSink, type ShelfUpdate, type ShelfUpdateV1, type SkillType, type SocialFeedRating, type SocialFeedRatingLlmUsage, type SocialFeedRatingOutcome, type SocialFeedRatingUpdate, type Span, type SqlError, type SqlErrorV1, type SqlRunStepDetails, type SqlSource, type SqlStep, type StartThreadArguments, type StartThreadMutationVariables, type StartThreadOutput, type StartingOrchestrator, type Step, type StepExecutionFinished, type StepExecutionFinishedV1, type StepExecutionStarted, type StepExecutionStartedV1, type StepState, type StepUpdate, type StreamThreadEventOptions, type SummaryAction, type TasksGenerated, type Teaching, type TeachingId, type TeachingOutcome, type TeachingState, type ThreadEvent, type ThreadEvent$1 as ThreadEventData, type ThreadFragment, type ThreadParticipants, type TransactionId, type TzWrapper, type UiBuild, type UiBuild2, type UiBuildFailure, type UiBuildResult, type UiBuildRunStepDetails, type UiBuildStep, type UiMetadata, type UiProgrammerState, type UiProgrammerUpdate, type UserCancel, type UserCancelEvent, type UserInteraction, type UserMessage, type UserMessageEvent, type UserUpload, type UserUploadMetadata, type Version, type VersionedAgentUpdate, type VersionedOrUnversionedAgentUpdate, type Warning, type WikiAuditId, type WikiChange, type WikiContent, type WikiDelta, type WikiExplorerCompleted, type WikiExplorerStarted, type WikiExplorerState, type WikiExplorerUpdate, type WikiGenerationOutcome, type WikiGenerationUpdate, type WikiInfoGenerated, type WikiLearningSuggestionUpdate, type WikiPageV1, type WikiSection, type WikiSelectionUpdate, type WikiTitle, cancelAgentMessage, createApolloClient, createPromptQLAuthTokenGenerator, diffThreadEvents, downloadArtifactData, getAgentGeneratedResponse, getAgentInteractionDecisionAcceptInteractionEvent, getAgentInteractionDecisionDeclineInteractionEvent, getAgentInteractionFinishedEvent, getAgentMessageProcessingStartedEvent, getAgentOrchestratorContextExplorerCompletedEvent, getAgentOrchestratorContextExplorerStartedEvent, getAgentOrchestratorContextExplorerUpdateEvent, getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent, getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent, getAgentOrchestratorSchemaExplorerCompletedEvent, getAgentOrchestratorSchemaExplorerGeneratedCodeEvent, getAgentOrchestratorSchemaExplorerSchemaExploredEvent, getAgentOrchestratorSchemaExplorerStartedEvent, getAgentOrchestratorSchemaExplorerUpdateEvent, getAgentOrchestratorSchemaTasksGeneratedEvent, getAgentOrchestratorSchemaTasksGenerationCompletedEvent, getAgentOrchestratorSchemaTasksGenerationStartedEvent, getAgentOrchestratorSchemaTasksGenerationUpdateEvent, getAgentOrchestratorStepProgrammerEvent, getAgentOrchestratorStepSavedProgramRunnerEvent, getAgentOrchestratorStepUiProgrammerEvent, getAgentOrchestratorStepUpdateEvent, getAgentOrchestratorUpdateEvent, getAgentOrchestratorWikiExplorerCompletedEvent, getAgentOrchestratorWikiExplorerStartedEvent, getAgentOrchestratorWikiExplorerUpdateEvent, getAgentOrchestratorWikiInfoGeneratedEvent, getAgentPlanGenerationStartedEvent, getAgentPlanStepGeneratedEvent, getAgentPlanningDecisionCompletedEvent, getAgentPlanningDecisionPlanningRequiredEvent, getAgentPlanningDecisionStartedEvent, getAgentPlanningDecisionUpdateEvent, getAgentStartingOrchestratorEvent, getThread, getThreadEventMessageId, getThreadEvents, getUserCancelEvent, getUserMessageEvent, isInteractionAnalyzing, listRooms, listThreads, sendThreadMessage, startThread, streamThreadMessageEvents, subscribeThreadEvents };
|
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,13 @@ type ThreadEvent$1 = {
|
|
|
18
18
|
user_id: PromptQlUserId;
|
|
19
19
|
message: UserMessage;
|
|
20
20
|
};
|
|
21
|
+
} | {
|
|
22
|
+
ScheduledAgentTriggerEvent: {
|
|
23
|
+
scheduled_agent_trigger_event_id: ScheduledAgentTriggerEventId;
|
|
24
|
+
scheduled_agent_trigger_id: ScheduledAgentTriggerId;
|
|
25
|
+
timestamp: string;
|
|
26
|
+
payload: ScheduledAgentTriggerPayload;
|
|
27
|
+
};
|
|
21
28
|
} | {
|
|
22
29
|
AgentMessage: {
|
|
23
30
|
/**
|
|
@@ -59,9 +66,18 @@ type ThreadEvent$1 = {
|
|
|
59
66
|
};
|
|
60
67
|
type PromptQlUserId = string;
|
|
61
68
|
type ArtifactId = string;
|
|
69
|
+
type TzWrapper = string;
|
|
70
|
+
type ScheduledAgentTriggerEventId = string;
|
|
71
|
+
/**
|
|
72
|
+
* A registered scheduled agent trigger ID
|
|
73
|
+
*/
|
|
74
|
+
type ScheduledAgentTriggerId = string;
|
|
75
|
+
type ScheduledAgentTriggerPayload = ScheduledAgentTriggerPayloadV1;
|
|
62
76
|
type VersionedOrUnversionedAgentUpdate = VersionedAgentUpdate | AgentUpdate;
|
|
63
77
|
type AgentUpdateContent = {
|
|
64
|
-
interaction_started: {
|
|
78
|
+
interaction_started: {
|
|
79
|
+
triggered_by?: AgentTrigger | null;
|
|
80
|
+
};
|
|
65
81
|
} | {
|
|
66
82
|
interaction_update: InteractionUpdate;
|
|
67
83
|
} | {
|
|
@@ -69,6 +85,18 @@ type AgentUpdateContent = {
|
|
|
69
85
|
outcome: InteractionOutcome;
|
|
70
86
|
};
|
|
71
87
|
};
|
|
88
|
+
type AgentTrigger = {
|
|
89
|
+
user_message: {
|
|
90
|
+
/**
|
|
91
|
+
* A unique index for a user message in a thread
|
|
92
|
+
*/
|
|
93
|
+
message_id: string;
|
|
94
|
+
};
|
|
95
|
+
} | {
|
|
96
|
+
scheduled_agent_trigger_event: {
|
|
97
|
+
scheduled_agent_trigger_event_id: ScheduledAgentTriggerEventId;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
72
100
|
type InteractionUpdate = {
|
|
73
101
|
interaction_decision: InteractionDecisionUpdate;
|
|
74
102
|
} | {
|
|
@@ -93,7 +121,7 @@ type InteractionDecisionUpdate = {
|
|
|
93
121
|
/**
|
|
94
122
|
* Why the interaction was declined
|
|
95
123
|
*/
|
|
96
|
-
reason: "MultipleUsersAndNoPromptQlMention" | "UserRequestedSkip";
|
|
124
|
+
reason: "MultipleUsersAndNoPromptQlMention" | "UserRequestedSkip" | "FutureTriggersInThread";
|
|
97
125
|
};
|
|
98
126
|
} | {
|
|
99
127
|
AcceptInteraction: {
|
|
@@ -239,6 +267,16 @@ type AgentLoopAction = {
|
|
|
239
267
|
find_relevant_tables_functions: {
|
|
240
268
|
search_query: string;
|
|
241
269
|
};
|
|
270
|
+
} | {
|
|
271
|
+
create_scheduled_trigger: {
|
|
272
|
+
trigger_type: ScheduledAgentTriggerType;
|
|
273
|
+
description: string;
|
|
274
|
+
context: string;
|
|
275
|
+
};
|
|
276
|
+
} | {
|
|
277
|
+
delete_scheduled_trigger: {
|
|
278
|
+
trigger_id: ScheduledAgentTriggerId;
|
|
279
|
+
};
|
|
242
280
|
};
|
|
243
281
|
/**
|
|
244
282
|
* Program Package Name is the unique name for a program within a project that usable from code
|
|
@@ -249,6 +287,16 @@ type ProgramPackageName = string;
|
|
|
249
287
|
* Skill type identifier for the new skill-based architecture.
|
|
250
288
|
*/
|
|
251
289
|
type SkillType = "python_programming" | "react_programming" | "knowledge_exploration" | "saved_programs" | "response_generation";
|
|
290
|
+
type ScheduledAgentTriggerType = {
|
|
291
|
+
one_time: {
|
|
292
|
+
scheduled_for: string;
|
|
293
|
+
};
|
|
294
|
+
} | {
|
|
295
|
+
recurring: {
|
|
296
|
+
cron_expr: string;
|
|
297
|
+
scheduled_for?: string | null;
|
|
298
|
+
};
|
|
299
|
+
};
|
|
252
300
|
/**
|
|
253
301
|
* Intermediate updates emitted during action execution.
|
|
254
302
|
*/
|
|
@@ -336,6 +384,14 @@ type AgentLoopActionResult = {
|
|
|
336
384
|
summary: string;
|
|
337
385
|
llm_usage: LlmUsage[];
|
|
338
386
|
agent_loop_action_result_type: "relevant_tables_found";
|
|
387
|
+
} | {
|
|
388
|
+
trigger_id: ScheduledAgentTriggerId;
|
|
389
|
+
description: string;
|
|
390
|
+
next_fire_at: string;
|
|
391
|
+
agent_loop_action_result_type: "scheduled_trigger_created";
|
|
392
|
+
} | {
|
|
393
|
+
trigger_id: ScheduledAgentTriggerId;
|
|
394
|
+
agent_loop_action_result_type: "scheduled_trigger_deleted";
|
|
339
395
|
};
|
|
340
396
|
/**
|
|
341
397
|
* The title of a wiki page or section
|
|
@@ -380,6 +436,10 @@ type InteractionOutcome = {
|
|
|
380
436
|
user_cancelled: {};
|
|
381
437
|
} | {
|
|
382
438
|
server_cancelled: {};
|
|
439
|
+
} | {
|
|
440
|
+
interrupted_due_to_new_trigger: {
|
|
441
|
+
new_trigger: AgentTrigger;
|
|
442
|
+
};
|
|
383
443
|
};
|
|
384
444
|
/**
|
|
385
445
|
* Updates sent by the agent during processing of a user interaction
|
|
@@ -459,7 +519,7 @@ type MessageProcessingUpdate = {
|
|
|
459
519
|
/**
|
|
460
520
|
* Why the interaction was declined
|
|
461
521
|
*/
|
|
462
|
-
reason: "MultipleUsersAndNoPromptQlMention" | "UserRequestedSkip";
|
|
522
|
+
reason: "MultipleUsersAndNoPromptQlMention" | "UserRequestedSkip" | "FutureTriggersInThread";
|
|
463
523
|
};
|
|
464
524
|
} | {
|
|
465
525
|
AcceptInteraction: {
|
|
@@ -1421,7 +1481,7 @@ type InteractionFinishedUpdate = {
|
|
|
1421
1481
|
/**
|
|
1422
1482
|
* Why the interaction was declined
|
|
1423
1483
|
*/
|
|
1424
|
-
reason: "MultipleUsersAndNoPromptQlMention" | "UserRequestedSkip";
|
|
1484
|
+
reason: "MultipleUsersAndNoPromptQlMention" | "UserRequestedSkip" | "FutureTriggersInThread";
|
|
1425
1485
|
};
|
|
1426
1486
|
};
|
|
1427
1487
|
type TeachingId = string;
|
|
@@ -1440,6 +1500,7 @@ type AgentLearningUpdate = {
|
|
|
1440
1500
|
} | {
|
|
1441
1501
|
WikiChangesApplied: {
|
|
1442
1502
|
build_id: string;
|
|
1503
|
+
audit_ids?: WikiAuditId[] | null;
|
|
1443
1504
|
};
|
|
1444
1505
|
} | {
|
|
1445
1506
|
Errored: {
|
|
@@ -1448,6 +1509,7 @@ type AgentLearningUpdate = {
|
|
|
1448
1509
|
} | {
|
|
1449
1510
|
Completed: {};
|
|
1450
1511
|
};
|
|
1512
|
+
type WikiAuditId = string;
|
|
1451
1513
|
/**
|
|
1452
1514
|
* Events that are internal to the system and not connected to a particular user/agent message
|
|
1453
1515
|
*/
|
|
@@ -1936,7 +1998,7 @@ type InteractionError = "Internal" | {
|
|
|
1936
1998
|
/**
|
|
1937
1999
|
* Reasons why an agent might decline to process a user interaction
|
|
1938
2000
|
*/
|
|
1939
|
-
type InteractionDeclineReason = "MultipleUsersAndNoPromptQlMention" | "UserRequestedSkip";
|
|
2001
|
+
type InteractionDeclineReason = "MultipleUsersAndNoPromptQlMention" | "UserRequestedSkip" | "FutureTriggersInThread";
|
|
1940
2002
|
type ConfidenceAnalysisOutcome = {
|
|
1941
2003
|
Completed: {
|
|
1942
2004
|
completed_at: string;
|
|
@@ -2067,7 +2129,7 @@ interface UserMessage {
|
|
|
2067
2129
|
timestamp: string;
|
|
2068
2130
|
message: string;
|
|
2069
2131
|
uploads: UserUpload[];
|
|
2070
|
-
timezone:
|
|
2132
|
+
timezone: TzWrapper;
|
|
2071
2133
|
/**
|
|
2072
2134
|
* Controls whether the agent should respond to this message.
|
|
2073
2135
|
*/
|
|
@@ -2090,6 +2152,9 @@ interface ArtifactReference {
|
|
|
2090
2152
|
artifact_id: ArtifactId;
|
|
2091
2153
|
version: number;
|
|
2092
2154
|
}
|
|
2155
|
+
interface ScheduledAgentTriggerPayloadV1 {
|
|
2156
|
+
version: "v1";
|
|
2157
|
+
}
|
|
2093
2158
|
interface VersionedAgentUpdate {
|
|
2094
2159
|
timestamp: string;
|
|
2095
2160
|
content: AgentUpdateContent;
|
|
@@ -5023,6 +5088,17 @@ type Uuid_Comparison_Exp = {
|
|
|
5023
5088
|
_neq?: InputMaybe<Scalars['uuid']['input']>;
|
|
5024
5089
|
_nin?: InputMaybe<Array<Scalars['uuid']['input']>>;
|
|
5025
5090
|
};
|
|
5091
|
+
type RoomFragment = {
|
|
5092
|
+
__typename?: 'rooms';
|
|
5093
|
+
room_id: string;
|
|
5094
|
+
name: string;
|
|
5095
|
+
description?: string | null;
|
|
5096
|
+
project_id: string;
|
|
5097
|
+
visibility: string;
|
|
5098
|
+
user_id: string;
|
|
5099
|
+
created_at: string;
|
|
5100
|
+
updated_at: string;
|
|
5101
|
+
};
|
|
5026
5102
|
type ThreadFragment = {
|
|
5027
5103
|
__typename?: 'threads_v2';
|
|
5028
5104
|
thread_id: string;
|
|
@@ -5093,6 +5169,12 @@ type StartThreadMutation = {
|
|
|
5093
5169
|
} | null>;
|
|
5094
5170
|
} | null;
|
|
5095
5171
|
};
|
|
5172
|
+
type GetRoomsQueryVariables = Exact<{
|
|
5173
|
+
where: Rooms_Bool_Exp;
|
|
5174
|
+
order_by?: InputMaybe<Array<Rooms_Order_By> | Rooms_Order_By>;
|
|
5175
|
+
offset?: InputMaybe<Scalars['Int']['input']>;
|
|
5176
|
+
limit?: InputMaybe<Scalars['Int']['input']>;
|
|
5177
|
+
}>;
|
|
5096
5178
|
type GetThreadsQueryVariables = Exact<{
|
|
5097
5179
|
where: Threads_V2_Bool_Exp;
|
|
5098
5180
|
limit?: InputMaybe<Scalars['Int']['input']>;
|
|
@@ -5275,6 +5357,16 @@ type StreamThreadEventOptions = {
|
|
|
5275
5357
|
timeout?: number;
|
|
5276
5358
|
};
|
|
5277
5359
|
|
|
5360
|
+
/**
|
|
5361
|
+
* Download artifact data.
|
|
5362
|
+
*/
|
|
5363
|
+
declare function downloadArtifactData(host: string, artifactId: string, version: number, headers: Record<string, string>, customFetch?: typeof fetch): Promise<unknown>;
|
|
5364
|
+
|
|
5365
|
+
/**
|
|
5366
|
+
* List rooms of the current project.The default limit is 10.
|
|
5367
|
+
*/
|
|
5368
|
+
declare function listRooms(client: ApolloClient, variables: GetRoomsQueryVariables): Promise<RoomFragment[]>;
|
|
5369
|
+
|
|
5278
5370
|
/**
|
|
5279
5371
|
* List threads of the current project.The default limit is 10.
|
|
5280
5372
|
*/
|
|
@@ -5310,9 +5402,9 @@ declare function subscribeThreadEvents(client: ApolloClient, threadId: string, f
|
|
|
5310
5402
|
*/
|
|
5311
5403
|
declare function streamThreadMessageEvents(client: ApolloClient, threadId: string, options?: StreamThreadEventOptions): Observable<ThreadEvent[]>;
|
|
5312
5404
|
/**
|
|
5313
|
-
* The guard to check if the thread interaction
|
|
5405
|
+
* The guard to check if the thread interaction is not finished.
|
|
5314
5406
|
*/
|
|
5315
|
-
declare function
|
|
5407
|
+
declare function isInteractionAnalyzing(events: ThreadEvent[], skipAnalysis?: boolean): boolean;
|
|
5316
5408
|
|
|
5317
5409
|
/**
|
|
5318
5410
|
* Constructor options for a PromptQL authenticator.
|
|
@@ -5347,6 +5439,18 @@ declare class Project {
|
|
|
5347
5439
|
info(): Promise<GetProjectInfoOutput>;
|
|
5348
5440
|
}
|
|
5349
5441
|
|
|
5442
|
+
/**
|
|
5443
|
+
* Room class implements the set of PromptQL room APIs.
|
|
5444
|
+
*/
|
|
5445
|
+
declare class Room {
|
|
5446
|
+
private _options;
|
|
5447
|
+
constructor(options: ClientOptions);
|
|
5448
|
+
/**
|
|
5449
|
+
* List rooms of the current project.The default limit is 10.
|
|
5450
|
+
*/
|
|
5451
|
+
list(variables: GetRoomsQueryVariables): Promise<RoomFragment[]>;
|
|
5452
|
+
}
|
|
5453
|
+
|
|
5350
5454
|
/**
|
|
5351
5455
|
* Project class implements the set of PromptQL thread APIs.
|
|
5352
5456
|
*/
|
|
@@ -5399,6 +5503,7 @@ declare class PromptQLSdk {
|
|
|
5399
5503
|
private _fetchToken;
|
|
5400
5504
|
readonly thread: Thread;
|
|
5401
5505
|
readonly project: Project;
|
|
5506
|
+
readonly room: Room;
|
|
5402
5507
|
/**
|
|
5403
5508
|
* Check if the PromptQL SDK instance is authenticated.
|
|
5404
5509
|
*/
|
|
@@ -5592,5 +5697,9 @@ type InteractionFinishedEvent = {
|
|
|
5592
5697
|
* Validate and return the InteractionFinished event from the step update.
|
|
5593
5698
|
*/
|
|
5594
5699
|
declare function getAgentInteractionFinishedEvent(eventData: ThreadEvent$1): InteractionFinishedEvent | null;
|
|
5700
|
+
/**
|
|
5701
|
+
* Get the message_id from the thread event data.
|
|
5702
|
+
*/
|
|
5703
|
+
declare function getThreadEventMessageId(event: ThreadEvent$1 | undefined): string | undefined;
|
|
5595
5704
|
|
|
5596
|
-
export { type AgentInteraction, type AgentLearningUpdate, type AgentLoopAction, type AgentLoopActionResult, type AgentLoopActionUpdate, type AgentLoopUpdate, type AgentState, type AgentUpdate, type AgentUpdateContent, type AllTheServerTypes, type AnalyzedCodeAction, type AnalyzedCodeAction2, type ApolloClientOptions, type ArtifactError, type ArtifactErrorV1, type ArtifactId, type ArtifactPreview, type ArtifactReference, type ArtifactReference1, type ArtifactReference2, type ArtifactState, type ArtifactType, type ArtifactType2, type ArtifactUpdate, type ArtifactUpdate1, type AssumptionFactCheck, type BuildError, type BuildErrorV1, type BuiltUi, type BuiltUi1, type CancelAgentMessageMutationVariables, type CheckedAssumption, type CheckedTopic, type CodeAction, type CodeAction2, type CodeBlock, type CodeError, type CodeErrorV1, type CodeExecutionComplete, type CodeOutputAnalysis, type CodeOutputAnalysis1, type CodeOutputAnalyzed, type ComponentResponse, type ComponentResponse1, type ComponentResponse2, type ComponentResponse3, type ComponentResponse4, type ComponentResponse5, type ConfidenceAnalysis, type ConfidenceAnalysis1, type ConfidenceAnalysisLlmUsage, type ConfidenceAnalysisOutcome, type ConfidenceAnalysisUpdate, type ContextExplorerCompleted, type ContextExplorerStarted, type ContextExplorerState, type ContextExplorerUpdate, type CopyFileEntry, type CurrentAction, type DataArtifactUpdated, type DataArtifactUpdatedV1, type Dependency, type EventOfKind, type ExternalKnowledgeExplorerAttempt, type ExternalKnowledgeExplorerAttempt1, type ExternalKnowledgeExplorerAttempt2, type ExternalKnowledgeExplorerState, type ExternalKnowledgeSummary, type ExternalKnowledgeTaskGeneratorState, type FactSource, type GeneratedCode, type GeneratedFile, type GeneratedFile2, type GeneratedProgramRunnerOutput, type GeneratedResponse, type GeneratedUiCode, type GeneratedUiCode1, type GetThreadEventOptions, type GetThreadsQueryVariables, type IPromptQLSdk, type Interaction, type InteractionDecision, type InteractionDecisionAccept, type InteractionDecisionDecline, type InteractionDecisionUpdate, type InteractionDeclineReason, type InteractionError, type InteractionFinishedEvent, type InteractionFinishedUpdate, type InteractionOutcome, type InteractionOutcome2, type InteractionOutcomeStatus, type InteractionUpdate, type InternalError, type InternalErrorV1, type InternalUpdate, type KeysOfUnion, type LearningSuggestion, type LearningSuggestionOutcome, type LearningSuggestionUpdate, type LearningSuggestionUpdateV1, type LlmResponse, type LlmUsage, type MessageProcessingStarted, type MessageProcessingState, type MessageProcessingUpdate, type NeedsSupportAnalysis, type NeedsSupportOutcome, type NeedsSupportUpdate, type OrchestratorState, type OrchestratorUpdate, type Order_By, type OutputEmitted, type OutputEmittedV1, type PipelineColumn, type PipelineColumnType, type PipelinePartitionSpec, type PipelinePartitionTransform, type PipelineProgress, type PipelineProgressV1, type PipelineRunStepDetails, type PipelineSchema, type PipelineSink, type PipelineSource, type PipelineStep, type PipelineTransform, type PlanGenerationStarted, type PlanState, type PlanStateStep, type PlanStepGenerated, type PlanningDecisionCompleted, type PlanningDecisionPlanningRequired, type PlanningDecisionStarted, type PlanningDecisionState, type PlanningDecisionUpdate, type ProgramId, type ProgramPackageName, type ProgramRunEvent, type ProgramRunResult, type ProgramRunnerAction, type ProgramRunnerAction2, type ProgramRunnerActionResult, type ProgramRunnerAttempt, type ProgramTransform, type ProgrammerState, type ProgrammerUpdate, PromptQLSdk, type PromptQLSdkOptions, type PromptQlConfigFeatureFlagModel, type PromptQlUserId, type PythonRunStepDetails, type PythonStep, type ResponseGenerationState, type ResponseGenerationUpdate, type ResponseTruncation, type RunConfigV1, type RunFinished, type RunFinishedOutcome, type RunFinishedV1, type RunProgramRequest, type RunProgramRequest2, type RunSavedProgramRequest, type RunSavedProgramRequest2, type RunStarted, type RunStartedV1, type RunStepDetails, type SavedProgramRunnerStage, type SavedProgramRunnerState, type SavedProgramRunnerUpdate, type SavedProgramRunnerUpdateV0, type SchemaContext, type SchemaContext1, type SchemaExplored, type SchemaExplorerCompleted, type SchemaExplorerStarted, type SchemaExplorerState, type SchemaExplorerUpdate, type SchemaTask, type SchemaTasksGenerationCompleted, type SchemaTasksGenerationStarted, type SchemaTasksGenerationState, type SchemaTasksGenerationUpdate, type SendMessageToThreadArguments, type SendMessageToThreadOutput, type SendThreadMessageMutationVariables, type ShelfActionEvent, type ShelfSink, type ShelfUpdate, type ShelfUpdateV1, type SkillType, type SocialFeedRating, type SocialFeedRatingLlmUsage, type SocialFeedRatingOutcome, type SocialFeedRatingUpdate, type Span, type SqlError, type SqlErrorV1, type SqlRunStepDetails, type SqlSource, type SqlStep, type StartThreadArguments, type StartThreadMutationVariables, type StartThreadOutput, type StartingOrchestrator, type Step, type StepExecutionFinished, type StepExecutionFinishedV1, type StepExecutionStarted, type StepExecutionStartedV1, type StepState, type StepUpdate, type StreamThreadEventOptions, type SummaryAction, type TasksGenerated, type Teaching, type TeachingId, type TeachingOutcome, type TeachingState, type ThreadEvent, type ThreadEvent$1 as ThreadEventData, type ThreadFragment, type ThreadParticipants, type TransactionId, type UiBuild, type UiBuild2, type UiBuildFailure, type UiBuildResult, type UiBuildRunStepDetails, type UiBuildStep, type UiMetadata, type UiProgrammerState, type UiProgrammerUpdate, type UserCancel, type UserCancelEvent, type UserInteraction, type UserMessage, type UserMessageEvent, type UserUpload, type UserUploadMetadata, type Version, type VersionedAgentUpdate, type VersionedOrUnversionedAgentUpdate, type Warning, type WikiChange, type WikiContent, type WikiDelta, type WikiExplorerCompleted, type WikiExplorerStarted, type WikiExplorerState, type WikiExplorerUpdate, type WikiGenerationOutcome, type WikiGenerationUpdate, type WikiInfoGenerated, type WikiLearningSuggestionUpdate, type WikiPageV1, type WikiSection, type WikiSelectionUpdate, type WikiTitle, cancelAgentMessage, createApolloClient, createPromptQLAuthTokenGenerator, diffThreadEvents, getAgentGeneratedResponse, getAgentInteractionDecisionAcceptInteractionEvent, getAgentInteractionDecisionDeclineInteractionEvent, getAgentInteractionFinishedEvent, getAgentMessageProcessingStartedEvent, getAgentOrchestratorContextExplorerCompletedEvent, getAgentOrchestratorContextExplorerStartedEvent, getAgentOrchestratorContextExplorerUpdateEvent, getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent, getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent, getAgentOrchestratorSchemaExplorerCompletedEvent, getAgentOrchestratorSchemaExplorerGeneratedCodeEvent, getAgentOrchestratorSchemaExplorerSchemaExploredEvent, getAgentOrchestratorSchemaExplorerStartedEvent, getAgentOrchestratorSchemaExplorerUpdateEvent, getAgentOrchestratorSchemaTasksGeneratedEvent, getAgentOrchestratorSchemaTasksGenerationCompletedEvent, getAgentOrchestratorSchemaTasksGenerationStartedEvent, getAgentOrchestratorSchemaTasksGenerationUpdateEvent, getAgentOrchestratorStepProgrammerEvent, getAgentOrchestratorStepSavedProgramRunnerEvent, getAgentOrchestratorStepUiProgrammerEvent, getAgentOrchestratorStepUpdateEvent, getAgentOrchestratorUpdateEvent, getAgentOrchestratorWikiExplorerCompletedEvent, getAgentOrchestratorWikiExplorerStartedEvent, getAgentOrchestratorWikiExplorerUpdateEvent, getAgentOrchestratorWikiInfoGeneratedEvent, getAgentPlanGenerationStartedEvent, getAgentPlanStepGeneratedEvent, getAgentPlanningDecisionCompletedEvent, getAgentPlanningDecisionPlanningRequiredEvent, getAgentPlanningDecisionStartedEvent, getAgentPlanningDecisionUpdateEvent, getAgentStartingOrchestratorEvent, getThread, getThreadEvents, getUserCancelEvent, getUserMessageEvent, listThreads, sendThreadMessage, startThread, streamThreadMessageEvents, subscribeThreadEvents
|
|
5705
|
+
export { type AgentInteraction, type AgentLearningUpdate, type AgentLoopAction, type AgentLoopActionResult, type AgentLoopActionUpdate, type AgentLoopUpdate, type AgentState, type AgentTrigger, type AgentUpdate, type AgentUpdateContent, type AllTheServerTypes, type AnalyzedCodeAction, type AnalyzedCodeAction2, type ApolloClientOptions, type ArtifactError, type ArtifactErrorV1, type ArtifactId, type ArtifactPreview, type ArtifactReference, type ArtifactReference1, type ArtifactReference2, type ArtifactState, type ArtifactType, type ArtifactType2, type ArtifactUpdate, type ArtifactUpdate1, type AssumptionFactCheck, type BuildError, type BuildErrorV1, type BuiltUi, type BuiltUi1, type CancelAgentMessageMutationVariables, type CheckedAssumption, type CheckedTopic, type CodeAction, type CodeAction2, type CodeBlock, type CodeError, type CodeErrorV1, type CodeExecutionComplete, type CodeOutputAnalysis, type CodeOutputAnalysis1, type CodeOutputAnalyzed, type ComponentResponse, type ComponentResponse1, type ComponentResponse2, type ComponentResponse3, type ComponentResponse4, type ComponentResponse5, type ConfidenceAnalysis, type ConfidenceAnalysis1, type ConfidenceAnalysisLlmUsage, type ConfidenceAnalysisOutcome, type ConfidenceAnalysisUpdate, type ContextExplorerCompleted, type ContextExplorerStarted, type ContextExplorerState, type ContextExplorerUpdate, type CopyFileEntry, type CurrentAction, type DataArtifactUpdated, type DataArtifactUpdatedV1, type Dependency, type EventOfKind, type ExternalKnowledgeExplorerAttempt, type ExternalKnowledgeExplorerAttempt1, type ExternalKnowledgeExplorerAttempt2, type ExternalKnowledgeExplorerState, type ExternalKnowledgeSummary, type ExternalKnowledgeTaskGeneratorState, type FactSource, type GeneratedCode, type GeneratedFile, type GeneratedFile2, type GeneratedProgramRunnerOutput, type GeneratedResponse, type GeneratedUiCode, type GeneratedUiCode1, type GetThreadEventOptions, type GetThreadsQueryVariables, type IPromptQLSdk, type Interaction, type InteractionDecision, type InteractionDecisionAccept, type InteractionDecisionDecline, type InteractionDecisionUpdate, type InteractionDeclineReason, type InteractionError, type InteractionFinishedEvent, type InteractionFinishedUpdate, type InteractionOutcome, type InteractionOutcome2, type InteractionOutcomeStatus, type InteractionUpdate, type InternalError, type InternalErrorV1, type InternalUpdate, type KeysOfUnion, type LearningSuggestion, type LearningSuggestionOutcome, type LearningSuggestionUpdate, type LearningSuggestionUpdateV1, type LlmResponse, type LlmUsage, type MessageProcessingStarted, type MessageProcessingState, type MessageProcessingUpdate, type NeedsSupportAnalysis, type NeedsSupportOutcome, type NeedsSupportUpdate, type OrchestratorState, type OrchestratorUpdate, type Order_By, type OutputEmitted, type OutputEmittedV1, type PipelineColumn, type PipelineColumnType, type PipelinePartitionSpec, type PipelinePartitionTransform, type PipelineProgress, type PipelineProgressV1, type PipelineRunStepDetails, type PipelineSchema, type PipelineSink, type PipelineSource, type PipelineStep, type PipelineTransform, type PlanGenerationStarted, type PlanState, type PlanStateStep, type PlanStepGenerated, type PlanningDecisionCompleted, type PlanningDecisionPlanningRequired, type PlanningDecisionStarted, type PlanningDecisionState, type PlanningDecisionUpdate, type ProgramId, type ProgramPackageName, type ProgramRunEvent, type ProgramRunResult, type ProgramRunnerAction, type ProgramRunnerAction2, type ProgramRunnerActionResult, type ProgramRunnerAttempt, type ProgramTransform, type ProgrammerState, type ProgrammerUpdate, PromptQLSdk, type PromptQLSdkOptions, type PromptQlConfigFeatureFlagModel, type PromptQlUserId, type PythonRunStepDetails, type PythonStep, type ResponseGenerationState, type ResponseGenerationUpdate, type ResponseTruncation, type RoomFragment, type RunConfigV1, type RunFinished, type RunFinishedOutcome, type RunFinishedV1, type RunProgramRequest, type RunProgramRequest2, type RunSavedProgramRequest, type RunSavedProgramRequest2, type RunStarted, type RunStartedV1, type RunStepDetails, type SavedProgramRunnerStage, type SavedProgramRunnerState, type SavedProgramRunnerUpdate, type SavedProgramRunnerUpdateV0, type ScheduledAgentTriggerEventId, type ScheduledAgentTriggerId, type ScheduledAgentTriggerPayload, type ScheduledAgentTriggerPayloadV1, type ScheduledAgentTriggerType, type SchemaContext, type SchemaContext1, type SchemaExplored, type SchemaExplorerCompleted, type SchemaExplorerStarted, type SchemaExplorerState, type SchemaExplorerUpdate, type SchemaTask, type SchemaTasksGenerationCompleted, type SchemaTasksGenerationStarted, type SchemaTasksGenerationState, type SchemaTasksGenerationUpdate, type SendMessageToThreadArguments, type SendMessageToThreadOutput, type SendThreadMessageMutationVariables, type ShelfActionEvent, type ShelfSink, type ShelfUpdate, type ShelfUpdateV1, type SkillType, type SocialFeedRating, type SocialFeedRatingLlmUsage, type SocialFeedRatingOutcome, type SocialFeedRatingUpdate, type Span, type SqlError, type SqlErrorV1, type SqlRunStepDetails, type SqlSource, type SqlStep, type StartThreadArguments, type StartThreadMutationVariables, type StartThreadOutput, type StartingOrchestrator, type Step, type StepExecutionFinished, type StepExecutionFinishedV1, type StepExecutionStarted, type StepExecutionStartedV1, type StepState, type StepUpdate, type StreamThreadEventOptions, type SummaryAction, type TasksGenerated, type Teaching, type TeachingId, type TeachingOutcome, type TeachingState, type ThreadEvent, type ThreadEvent$1 as ThreadEventData, type ThreadFragment, type ThreadParticipants, type TransactionId, type TzWrapper, type UiBuild, type UiBuild2, type UiBuildFailure, type UiBuildResult, type UiBuildRunStepDetails, type UiBuildStep, type UiMetadata, type UiProgrammerState, type UiProgrammerUpdate, type UserCancel, type UserCancelEvent, type UserInteraction, type UserMessage, type UserMessageEvent, type UserUpload, type UserUploadMetadata, type Version, type VersionedAgentUpdate, type VersionedOrUnversionedAgentUpdate, type Warning, type WikiAuditId, type WikiChange, type WikiContent, type WikiDelta, type WikiExplorerCompleted, type WikiExplorerStarted, type WikiExplorerState, type WikiExplorerUpdate, type WikiGenerationOutcome, type WikiGenerationUpdate, type WikiInfoGenerated, type WikiLearningSuggestionUpdate, type WikiPageV1, type WikiSection, type WikiSelectionUpdate, type WikiTitle, cancelAgentMessage, createApolloClient, createPromptQLAuthTokenGenerator, diffThreadEvents, downloadArtifactData, getAgentGeneratedResponse, getAgentInteractionDecisionAcceptInteractionEvent, getAgentInteractionDecisionDeclineInteractionEvent, getAgentInteractionFinishedEvent, getAgentMessageProcessingStartedEvent, getAgentOrchestratorContextExplorerCompletedEvent, getAgentOrchestratorContextExplorerStartedEvent, getAgentOrchestratorContextExplorerUpdateEvent, getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent, getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent, getAgentOrchestratorSchemaExplorerCompletedEvent, getAgentOrchestratorSchemaExplorerGeneratedCodeEvent, getAgentOrchestratorSchemaExplorerSchemaExploredEvent, getAgentOrchestratorSchemaExplorerStartedEvent, getAgentOrchestratorSchemaExplorerUpdateEvent, getAgentOrchestratorSchemaTasksGeneratedEvent, getAgentOrchestratorSchemaTasksGenerationCompletedEvent, getAgentOrchestratorSchemaTasksGenerationStartedEvent, getAgentOrchestratorSchemaTasksGenerationUpdateEvent, getAgentOrchestratorStepProgrammerEvent, getAgentOrchestratorStepSavedProgramRunnerEvent, getAgentOrchestratorStepUiProgrammerEvent, getAgentOrchestratorStepUpdateEvent, getAgentOrchestratorUpdateEvent, getAgentOrchestratorWikiExplorerCompletedEvent, getAgentOrchestratorWikiExplorerStartedEvent, getAgentOrchestratorWikiExplorerUpdateEvent, getAgentOrchestratorWikiInfoGeneratedEvent, getAgentPlanGenerationStartedEvent, getAgentPlanStepGeneratedEvent, getAgentPlanningDecisionCompletedEvent, getAgentPlanningDecisionPlanningRequiredEvent, getAgentPlanningDecisionStartedEvent, getAgentPlanningDecisionUpdateEvent, getAgentStartingOrchestratorEvent, getThread, getThreadEventMessageId, getThreadEvents, getUserCancelEvent, getUserMessageEvent, isInteractionAnalyzing, listRooms, listThreads, sendThreadMessage, startThread, streamThreadMessageEvents, subscribeThreadEvents };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var x=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var te=Object.prototype.hasOwnProperty;var ae=(t,e)=>{for(var a in e)x(t,a,{get:e[a],enumerable:!0})},re=(t,e,a,_)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ee(e))!te.call(t,r)&&r!==a&&x(t,r,{get:()=>e[r],enumerable:!(_=Y(e,r))||_.enumerable});return t};var _e=t=>re(x({},"__esModule",{value:!0}),t);var We={};ae(We,{PromptQLSdk:()=>U,cancelAgentMessage:()=>v,createApolloClient:()=>P,createPromptQLAuthTokenGenerator:()=>b,diffThreadEvents:()=>oe,getAgentGeneratedResponse:()=>ye,getAgentInteractionDecisionAcceptInteractionEvent:()=>le,getAgentInteractionDecisionDeclineInteractionEvent:()=>be,getAgentInteractionFinishedEvent:()=>Fe,getAgentMessageProcessingStartedEvent:()=>ce,getAgentOrchestratorContextExplorerCompletedEvent:()=>Ae,getAgentOrchestratorContextExplorerStartedEvent:()=>ge,getAgentOrchestratorContextExplorerUpdateEvent:()=>y,getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent:()=>Ee,getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent:()=>Te,getAgentOrchestratorSchemaExplorerCompletedEvent:()=>ve,getAgentOrchestratorSchemaExplorerGeneratedCodeEvent:()=>Pe,getAgentOrchestratorSchemaExplorerSchemaExploredEvent:()=>Re,getAgentOrchestratorSchemaExplorerStartedEvent:()=>Oe,getAgentOrchestratorSchemaExplorerUpdateEvent:()=>d,getAgentOrchestratorSchemaTasksGeneratedEvent:()=>ke,getAgentOrchestratorSchemaTasksGenerationCompletedEvent:()=>Be,getAgentOrchestratorSchemaTasksGenerationStartedEvent:()=>Ce,getAgentOrchestratorSchemaTasksGenerationUpdateEvent:()=>A,getAgentOrchestratorStepProgrammerEvent:()=>Ue,getAgentOrchestratorStepSavedProgramRunnerEvent:()=>je,getAgentOrchestratorStepUiProgrammerEvent:()=>we,getAgentOrchestratorStepUpdateEvent:()=>h,getAgentOrchestratorUpdateEvent:()=>S,getAgentOrchestratorWikiExplorerCompletedEvent:()=>xe,getAgentOrchestratorWikiExplorerStartedEvent:()=>he,getAgentOrchestratorWikiExplorerUpdateEvent:()=>g,getAgentOrchestratorWikiInfoGeneratedEvent:()=>fe,getAgentPlanGenerationStartedEvent:()=>se,getAgentPlanStepGeneratedEvent:()=>de,getAgentPlanningDecisionCompletedEvent:()=>Ie,getAgentPlanningDecisionPlanningRequiredEvent:()=>Me,getAgentPlanningDecisionStartedEvent:()=>me,getAgentPlanningDecisionUpdateEvent:()=>M,getAgentStartingOrchestratorEvent:()=>Se,getThread:()=>B,getThreadEvents:()=>l,getUserCancelEvent:()=>ue,getUserMessageEvent:()=>pe,listThreads:()=>C,sendThreadMessage:()=>O,startThread:()=>k,streamThreadMessageEvents:()=>T,subscribeThreadEvents:()=>E,wasInteractionFinished:()=>D});module.exports=_e(We);var u=require("rxjs");var j={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CancelAgentMessage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"threadId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"messageId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"cancel_agent_message"},arguments:[{kind:"Argument",name:{kind:"Name",value:"threadId"},value:{kind:"Variable",name:{kind:"Name",value:"threadId"}}},{kind:"Argument",name:{kind:"Name",value:"agentMessageId"},value:{kind:"Variable",name:{kind:"Name",value:"messageId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}}]}}]}}]},F={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"SendThreadMessage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"message"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"timezone"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"threadId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"uploads"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UserUploadInput"}}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"send_thread_message"},arguments:[{kind:"Argument",name:{kind:"Name",value:"threadId"},value:{kind:"Variable",name:{kind:"Name",value:"threadId"}}},{kind:"Argument",name:{kind:"Name",value:"timezone"},value:{kind:"Variable",name:{kind:"Name",value:"timezone"}}},{kind:"Argument",name:{kind:"Name",value:"message"},value:{kind:"Variable",name:{kind:"Name",value:"message"}}},{kind:"Argument",name:{kind:"Name",value:"buildFqdn"},value:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}}},{kind:"Argument",name:{kind:"Name",value:"uploads"},value:{kind:"Variable",name:{kind:"Name",value:"uploads"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"created_at"}}]}}]}}]},W={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"StartThread"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"message"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"projectId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"timezone"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"roomId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"uploads"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UserUploadInput"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"visibility"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"start_thread"},arguments:[{kind:"Argument",name:{kind:"Name",value:"message"},value:{kind:"Variable",name:{kind:"Name",value:"message"}}},{kind:"Argument",name:{kind:"Name",value:"projectId"},value:{kind:"Variable",name:{kind:"Name",value:"projectId"}}},{kind:"Argument",name:{kind:"Name",value:"timezone"},value:{kind:"Variable",name:{kind:"Name",value:"timezone"}}},{kind:"Argument",name:{kind:"Name",value:"buildId"},value:{kind:"Variable",name:{kind:"Name",value:"buildId"}}},{kind:"Argument",name:{kind:"Name",value:"buildFqdn"},value:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}}},{kind:"Argument",name:{kind:"Name",value:"roomId"},value:{kind:"Variable",name:{kind:"Name",value:"roomId"}}},{kind:"Argument",name:{kind:"Name",value:"uploads"},value:{kind:"Variable",name:{kind:"Name",value:"uploads"}}},{kind:"Argument",name:{kind:"Name",value:"visibility"},value:{kind:"Variable",name:{kind:"Name",value:"visibility"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"thread_events"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"thread_event_id"}}]}}]}}]}}]},V={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetProjectInfo"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"get_project_info"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"projectId"}},{kind:"Field",name:{kind:"Name",value:"projectName"}},{kind:"Field",name:{kind:"Name",value:"promptqlConsoleUrl"}}]}}]}}]},N={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreads"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"threads_v2_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"threads_v2_order_by"}}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"threads_v2"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Thread"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Thread"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"threads_v2"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"build_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"relevant_event_count"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}},{kind:"Field",name:{kind:"Name",value:"email"}},{kind:"Field",name:{kind:"Name",value:"is_active"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}}]}}]}}]},z={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreadById"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"threads_v2_by_pk"},arguments:[{kind:"Argument",name:{kind:"Name",value:"thread_id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Thread"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Thread"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"threads_v2"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"build_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"relevant_event_count"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}},{kind:"Field",name:{kind:"Name",value:"email"}},{kind:"Field",name:{kind:"Name",value:"is_active"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}}]}}]}}]},q={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreadEvents"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"ordering"}},type:{kind:"NamedType",name:{kind:"Name",value:"order_by"}},defaultValue:{kind:"EnumValue",value:"asc"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"Variable",name:{kind:"Name",value:"ordering"}}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadEvent"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"thread_events"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"user_id"}}]}}]},G={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"subscription",name:{kind:"Name",value:"SubscribeThreadEvents"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"EnumValue",value:"asc"}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadEvent"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"thread_events"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"user_id"}}]}}]};function c(t){return t=t?t.trim():"",t?t[t.length-1]==="/"?t.slice(0,t.length-1):t:""}function f(t){if(t==null)return null;try{Number.parseInt(t)}catch{throw new Error("invalid threadEventId")}return t}function C(t,e){return t.query({query:N,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2??[])}function B(t,e){if(!e)throw new Error("threadId is required");return t.query({query:z,variables:{id:e},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2_by_pk)}function k(t,e){if(!e.message.trim())throw new Error("message must not be empty");return t.mutate({mutation:W,variables:e}).then(a=>{if(!a.data?.start_thread)throw new Error(a.error?.message||"Failed to start thread");return a.data.start_thread})}function l(t,e,a){if(!e)throw new Error("threadId is required");let _={thread_id:{_eq:e}};return a&&(a.eventId&&(_.thread_event_id=a.eventId),a.messageId&&(_._or=ne(a.messageId))),t.query({query:q,variables:{where:_,limit:a?.limit,ordering:a?.ordering||"asc"},fetchPolicy:"no-cache"}).then(r=>r.data?.thread_events??[])}function O(t,e){if(!e.threadId)throw new Error("threadId is required");if(!e.message.trim())throw new Error("message must not be empty");return t.mutate({mutation:F,variables:e}).then(a=>{if(!a.data?.send_thread_message)throw new Error(a.error?.message||"Failed to send message to thread");return a.data.send_thread_message})}function v(t,e){if(!e.threadId)throw new Error("threadId is required");if(!e.messageId.trim())throw new Error("messageId is required");return t.mutate({mutation:j,variables:e}).then(a=>{if(!a.data?.cancel_agent_message)throw new Error(a.error?.message||"Failed to cancel thread");return a.data.cancel_agent_message})}function E(t,e,a){if(!e)throw new Error("threadId is required");f(a);let _={thread_id:{_eq:e}};return a&&(_.thread_event_id={_gte:a}),t.subscribe({query:G,variables:{where:_}}).pipe((0,u.map)(r=>{if(r.error)throw r.error;return r.data?.thread_events??[]}))}function T(t,e,a){if(!e)throw new Error("threadId is required");let _,r=f(a?.fromEventId),i={eventId:a?.fromEventId?{_gte:r}:void 0,messageId:a?.messageId},o=a?.pollingInterval&&a?.pollingInterval>0?a.pollingInterval:5;return(0,u.defer)(async()=>{let n=_?{messageId:a?.messageId,eventId:{_gt:_}}:i,p=await l(t,e,n);return p.length>0&&(_=p[p.length-1]?.thread_event_id),p}).pipe((0,u.repeat)({count:a?.timeout&&a.timeout>0?Math.ceil(a.timeout/o):void 0,delay:o*1e3}),(0,u.takeWhile)(n=>D(n,a?.skipAnalysis),!0))}function D(t,e){for(let a=t.length-1;a>0;a--){let _=t[a];if(e&&"UserCancel"in _.event_data)return!1;if(!("AgentMessage"in _.event_data))return!0;let r=_.event_data.AgentMessage.update;if("content"in r&&"interaction_finished"in r.content||"InteractionFinished"in r||e&&"OrchestratorUpdate"in r&&"GeneratedResponse"in r.OrchestratorUpdate.update)return!1}return!0}function ne(t){return[{event_data:{_contains:{UserMessage:{message_id:t}}}},{event_data:{_contains:{AgentMessage:{message_id:t}}}},{event_data:{_contains:{UserCancel:{message_id:t}}}}]}function Q(t){return t!=null&&typeof t=="object"&&"status"in t&&t.status==="failure"}function J(t){return t!=null&&typeof t=="object"&&"status"in t&&t.status==="success"&&"token"in t}function L(t){return t!=null&&typeof t=="object"&&("data"in t&&!!t.data&&typeof t.data=="object"&&"enrich_token"in t.data&&!!t.data.enrich_token&&typeof t.data.enrich_token=="object"&&"userDirectoryJWT"in t.data.enrich_token||"errors"in t&&Array.isArray(t.errors))}function b(t){let a=`${c(t.authHost)||"https://auth.pro.hasura.io"}/ddn/promptql/token`,_={token:"",expiry:new Date(0)},r=t.fetch||fetch,i=async()=>{let o=await r(a,{method:"POST",headers:t.headers});switch(o.status){case 200:{let n=await o.json();if(J(n))return n;throw new Error("malformed token response")}case 401:{let n=await o.json();throw Q(n)?new Error(n?.error||o.statusText):new Error(o.statusText)}default:{let n=await o.text();throw new Error(n)}}};return async()=>{if(_.expiry.getTime()<=Date.now()-1e3){let o=await i(),n=await ie(t.promptqlGraphQLUrl,o.token,t.projectId,r);_.token=n;let p=new Date(o.expiry);if(Number.isNaN(p.getTime())){let w=new Date;w.setHours(1),_.expiry=w}else _.expiry=p}return _.token}}var ie=async(t,e,a,_=fetch)=>{let r=await _(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:"mutation EnrichToken($luxJWT: String!, $projectId: uuid) { enrich_token(luxJWT: $luxJWT, projectId: $projectId) { userDirectoryJWT }}",variables:{luxJWT:e,projectId:a},operationName:"EnrichToken"})});switch(r.status){case 200:{let i=await r.json();if(!L(i)||!i.data?.enrich_token?.userDirectoryJWT)throw new Error(`malformed promptql token response: ${JSON.stringify(i)}`);return i.data.enrich_token.userDirectoryJWT}default:{let i=await r.text();throw new Error(i)}}};function K(t){return{Authorization:`pat ${t}`}}var s=require("@apollo/client"),H=require("@apollo/client/link/context"),$=require("@apollo/client/link/subscriptions"),Z=require("graphql"),X=require("graphql-ws"),P=t=>{let e=new s.HttpLink({uri:t.url,fetch:t.fetch,headers:t.headers}),a=async n=>{let p=await t.getAuthToken();return{headers:{...n,Authorization:`Bearer ${p}`}}},_=(0,X.createClient)({url:t.url,connectionParams:()=>a(t.headers),lazy:!0}),r=new $.GraphQLWsLink(_),i=new H.SetContextLink(({headers:n})=>a(n)),o=s.ApolloLink.split(({operationType:n})=>n===Z.OperationTypeNode.SUBSCRIPTION,r,i.concat(e));return{client:new s.ApolloClient({link:o,cache:new s.InMemoryCache}),wsClient:_}};var m=class{_options;constructor(e){this._options=e}info(){return R(this._options.client)}};function R(t){return t.query({query:V,fetchPolicy:"cache-first"}).then(e=>{if(!e.data?.get_project_info)throw new Error(e.error?.message||"Project not found");return e.data.get_project_info})}var I=class{_options;constructor(e){this._options=e}list(e){return C(this._options.client,{...e,limit:e.limit&&e.limit>0?e.limit:10})}get(e){if(!e)throw new Error("threadId is required");return B(this._options.client,e)}async start(e){let a=await R(this._options.client);return k(this._options.client,{...e,projectId:a.projectId,buildId:e.buildId||this._options.buildId,timezone:e.timezone||this._options.defaultTimezone})}getEvents(e,a){return l(this._options.client,e,a)}sendMessage(e){return O(this._options.client,{...e,timezone:e.timezone||this._options.defaultTimezone})}cancelAgentMessage(e){return v(this._options.client,e)}subscribeEvents(e,a){return E(this._options.client,e,a)}streamMessageEvents(e,a){return T(this._options.client,e,a)}};var U=class{constructor(e){let a=c(e.promptqlBaseUrl)||"https://promptql.ddn.hasura.app";if(!e.serviceAccountToken)throw new Error("serviceAccountToken must not be empty. If you haven't created any service account token yet, check out Hasura docs https://hasura.io/docs/3.0/project-configuration/project-management/service-accounts/#how-to-create-service-account");let _=a.endsWith("/v1/graphql")?a:`${a}/playground-v2-hge/v1/graphql`;this._fetchToken=b({promptqlGraphQLUrl:_,authHost:e.authHost,headers:K(e.serviceAccountToken),fetch:e.fetch});let{client:r,wsClient:i}=P({getAuthToken:this._fetchToken,url:_,fetch:e.fetch,headers:e.headers});this._wsClient=i,this._options={client:r,buildId:e.buildId,defaultTimezone:e.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone},this.thread=new I(this._options),this.project=new m(this._options)}_options;_wsClient;_fetchToken;thread;project;authenticated(){return this._fetchToken().then(()=>!0).catch(()=>!1)}close(){this._wsClient.dispose(),this._options.client.clearStore()}};function oe(t,e){if(!e.length)return[];if(!t.length)return e;let a=t[t.length-1];if(!a)return e;let _=BigInt(a.thread_event_id),r=e.length-1;for(;r>=0;r--){let i=e[r];if(BigInt(i?.thread_event_id)<=_)break}return e.slice(r+1)}function pe(t){return"UserMessage"in t?t.UserMessage:null}function ue(t){return"UserCancel"in t?t.UserCancel:null}function se(t){return!("AgentMessage"in t)||!("OrchestratorUpdate"in t.AgentMessage.update)||!("PlanGenerationStarted"in t.AgentMessage.update.OrchestratorUpdate.update)?null:t.AgentMessage.update.OrchestratorUpdate.update.PlanGenerationStarted}function de(t){let e=S(t);return!e||!("PlanStepGenerated"in e)?null:e.PlanStepGenerated}function ye(t){return"AgentMessage"in t?"content"in t.AgentMessage.update&&"interaction_update"in t.AgentMessage.update.content&&"main_agent"in t.AgentMessage.update.content.interaction_update&&"completed"in t.AgentMessage.update.content.interaction_update.main_agent?{success:!0,message:t.AgentMessage.update.content.interaction_update.main_agent.completed.summary,modified_artifacts:[],generated_at:t.AgentMessage.update.timestamp}:!("OrchestratorUpdate"in t.AgentMessage.update)||!("GeneratedResponse"in t.AgentMessage.update.OrchestratorUpdate.update)?null:t.AgentMessage.update.OrchestratorUpdate.update.GeneratedResponse.response:null}function ce(t){return!("AgentMessage"in t)||!("MessageProcessingUpdate"in t.AgentMessage.update)||!("ProcessingStarted"in t.AgentMessage.update.MessageProcessingUpdate.update)?null:t.AgentMessage.update.MessageProcessingUpdate.update.ProcessingStarted}function le(t){return!("AgentMessage"in t)||!("MessageProcessingUpdate"in t.AgentMessage.update)||!("InteractionDecision"in t.AgentMessage.update.MessageProcessingUpdate.update)||!("AcceptInteraction"in t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.AcceptInteraction}function be(t){return!("AgentMessage"in t)||!("MessageProcessingUpdate"in t.AgentMessage.update)||!("InteractionDecision"in t.AgentMessage.update.MessageProcessingUpdate.update)||!("DeclineInteraction"in t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.DeclineInteraction}function M(t){return!("AgentMessage"in t)||!("PlanningDecisionUpdate"in t.AgentMessage.update)?null:t.AgentMessage.update.PlanningDecisionUpdate.update}function me(t){let e=M(t);return!e||!("Started"in e)?null:e.Started}function Ie(t){let e=M(t);return!e||!("Completed"in e)?null:e.Completed}function Me(t){let e=M(t);return!e||!("PlanningRequired"in e)?null:e.PlanningRequired}function Se(t){return!("AgentMessage"in t)||!("StartingOrchestrator"in t.AgentMessage.update)?null:t.AgentMessage.update.StartingOrchestrator}function S(t){return!("AgentMessage"in t)||!("OrchestratorUpdate"in t.AgentMessage.update)?null:t.AgentMessage.update.OrchestratorUpdate.update}function y(t){let e=S(t);return!e||!("ContextExplorerUpdate"in e)?null:e.ContextExplorerUpdate.update}function ge(t){let e=y(t);return!e||!("Started"in e)?null:e.Started}function Ae(t){let e=y(t);return!e||!("Completed"in e)?null:e.Completed}function g(t){let e=y(t);return!e||!("WikiExplorerUpdate"in e)?null:e.WikiExplorerUpdate.update}function he(t){let e=g(t);return!e||!("Started"in e)?null:e.Started}function xe(t){let e=g(t);return!e||!("Completed"in e)?null:e.Completed}function fe(t){let e=g(t);return!e||!("WikiInfoGenerated"in e)?null:e.WikiInfoGenerated}function A(t){let e=y(t);return!e||!("SchemaTasksGenerationUpdate"in e)?null:e.SchemaTasksGenerationUpdate.update}function Ce(t){let e=A(t);return!e||!("Started"in e)?null:e.Started}function Be(t){let e=A(t);return!e||!("Completed"in e)?null:e.Completed}function ke(t){let e=A(t);return!e||!("TasksGenerated"in e)?null:e.TasksGenerated}function d(t){let e=y(t);return!e||!("SchemaExplorerUpdate"in e)?null:e.SchemaExplorerUpdate.update}function Oe(t){let e=d(t);return!e||!("Started"in e)?null:e.Started}function ve(t){let e=d(t);return!e||!("Completed"in e)?null:e.Completed}function Ee(t){let e=d(t);return!e||!("CodeExecutionComplete"in e)?null:e.CodeExecutionComplete}function Te(t){let e=d(t);return!e||!("CodeOutputAnalyzed"in e)?null:e.CodeOutputAnalyzed}function Pe(t){let e=d(t);return!e||!("GeneratedCode"in e)?null:e.GeneratedCode}function Re(t){let e=d(t);return!e||!("SchemaExplored"in e)?null:e.SchemaExplored}function h(t){let e=S(t);return!e||!("StepUpdate"in e)?null:e.StepUpdate}function Ue(t){let e=h(t);return!e||!("Programmer"in e.update)?null:e.update.Programmer}function we(t){let e=h(t);return!e||!("UiProgrammer"in e.update)?null:e.update.UiProgrammer}function je(t){let e=h(t);return!e||!("SavedProgramRunner"in e.update)?null:e.update.SavedProgramRunner}function Fe(t){if(!("AgentMessage"in t))return null;if("InteractionFinished"in t.AgentMessage.update){let e=t.AgentMessage.update.InteractionFinished.update;return"Completed"in e?{status:"completed",timestamp:e.Completed.completed_at,warnings:e.Completed.warnings}:"Errored"in e?{status:"errored",timestamp:e.Errored.errored_at,reason:typeof e.Errored.error=="string"?e.Errored.error:e.Errored.error.User.message}:"UserCancelled"in e?{status:"user_cancelled",timestamp:e.UserCancelled.cancelled_at}:"AgentDeclined"in e?{status:"agent_declined",timestamp:e.AgentDeclined.declined_at,reason:e.AgentDeclined.reason}:"ServerCancelled"in e?{status:"server_cancelled",timestamp:e.ServerCancelled.cancelled_at}:{status:"unknown"}}if("content"in t.AgentMessage.update&&"interaction_finished"in t.AgentMessage.update.content){let e=t.AgentMessage.update.content.interaction_finished.outcome;return"errored"in e?{status:"errored",reason:e.errored.user_facing_message||e.errored.raw_error,timestamp:t.AgentMessage.update.timestamp,warnings:e.errored.raw_error?[{message:e.errored.raw_error}]:[]}:"server_cancelled"in e?{status:"server_cancelled",timestamp:t.AgentMessage.update.timestamp}:"user_cancelled"in e?{status:"user_cancelled",timestamp:t.AgentMessage.update.timestamp}:"completed"in e?{status:"completed",timestamp:t.AgentMessage.update.timestamp,warnings:e.completed.warnings}:{status:"unknown"}}return null}0&&(module.exports={PromptQLSdk,cancelAgentMessage,createApolloClient,createPromptQLAuthTokenGenerator,diffThreadEvents,getAgentGeneratedResponse,getAgentInteractionDecisionAcceptInteractionEvent,getAgentInteractionDecisionDeclineInteractionEvent,getAgentInteractionFinishedEvent,getAgentMessageProcessingStartedEvent,getAgentOrchestratorContextExplorerCompletedEvent,getAgentOrchestratorContextExplorerStartedEvent,getAgentOrchestratorContextExplorerUpdateEvent,getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent,getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent,getAgentOrchestratorSchemaExplorerCompletedEvent,getAgentOrchestratorSchemaExplorerGeneratedCodeEvent,getAgentOrchestratorSchemaExplorerSchemaExploredEvent,getAgentOrchestratorSchemaExplorerStartedEvent,getAgentOrchestratorSchemaExplorerUpdateEvent,getAgentOrchestratorSchemaTasksGeneratedEvent,getAgentOrchestratorSchemaTasksGenerationCompletedEvent,getAgentOrchestratorSchemaTasksGenerationStartedEvent,getAgentOrchestratorSchemaTasksGenerationUpdateEvent,getAgentOrchestratorStepProgrammerEvent,getAgentOrchestratorStepSavedProgramRunnerEvent,getAgentOrchestratorStepUiProgrammerEvent,getAgentOrchestratorStepUpdateEvent,getAgentOrchestratorUpdateEvent,getAgentOrchestratorWikiExplorerCompletedEvent,getAgentOrchestratorWikiExplorerStartedEvent,getAgentOrchestratorWikiExplorerUpdateEvent,getAgentOrchestratorWikiInfoGeneratedEvent,getAgentPlanGenerationStartedEvent,getAgentPlanStepGeneratedEvent,getAgentPlanningDecisionCompletedEvent,getAgentPlanningDecisionPlanningRequiredEvent,getAgentPlanningDecisionStartedEvent,getAgentPlanningDecisionUpdateEvent,getAgentStartingOrchestratorEvent,getThread,getThreadEvents,getUserCancelEvent,getUserMessageEvent,listThreads,sendThreadMessage,startThread,streamThreadMessageEvents,subscribeThreadEvents,wasInteractionFinished});
|
|
1
|
+
"use strict";var C=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var re=Object.getOwnPropertyNames;var _e=Object.prototype.hasOwnProperty;var ne=(t,e)=>{for(var a in e)C(t,a,{get:e[a],enumerable:!0})},ie=(t,e,a,_)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of re(e))!_e.call(t,r)&&r!==a&&C(t,r,{get:()=>e[r],enumerable:!(_=ae(e,r))||_.enumerable});return t};var oe=t=>ie(C({},"__esModule",{value:!0}),t);var Ge={};ne(Ge,{PromptQLSdk:()=>j,cancelAgentMessage:()=>P,createApolloClient:()=>w,createPromptQLAuthTokenGenerator:()=>m,diffThreadEvents:()=>de,downloadArtifactData:()=>pe,getAgentGeneratedResponse:()=>me,getAgentInteractionDecisionAcceptInteractionEvent:()=>Me,getAgentInteractionDecisionDeclineInteractionEvent:()=>ge,getAgentInteractionFinishedEvent:()=>ze,getAgentMessageProcessingStartedEvent:()=>Ie,getAgentOrchestratorContextExplorerCompletedEvent:()=>Ce,getAgentOrchestratorContextExplorerStartedEvent:()=>fe,getAgentOrchestratorContextExplorerUpdateEvent:()=>y,getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent:()=>Ue,getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent:()=>we,getAgentOrchestratorSchemaExplorerCompletedEvent:()=>Re,getAgentOrchestratorSchemaExplorerGeneratedCodeEvent:()=>Fe,getAgentOrchestratorSchemaExplorerSchemaExploredEvent:()=>je,getAgentOrchestratorSchemaExplorerStartedEvent:()=>Pe,getAgentOrchestratorSchemaExplorerUpdateEvent:()=>d,getAgentOrchestratorSchemaTasksGeneratedEvent:()=>Te,getAgentOrchestratorSchemaTasksGenerationCompletedEvent:()=>Ee,getAgentOrchestratorSchemaTasksGenerationStartedEvent:()=>ve,getAgentOrchestratorSchemaTasksGenerationUpdateEvent:()=>x,getAgentOrchestratorStepProgrammerEvent:()=>Ve,getAgentOrchestratorStepSavedProgramRunnerEvent:()=>Ne,getAgentOrchestratorStepUiProgrammerEvent:()=>We,getAgentOrchestratorStepUpdateEvent:()=>f,getAgentOrchestratorUpdateEvent:()=>A,getAgentOrchestratorWikiExplorerCompletedEvent:()=>ke,getAgentOrchestratorWikiExplorerStartedEvent:()=>Be,getAgentOrchestratorWikiExplorerUpdateEvent:()=>h,getAgentOrchestratorWikiInfoGeneratedEvent:()=>Oe,getAgentPlanGenerationStartedEvent:()=>le,getAgentPlanStepGeneratedEvent:()=>be,getAgentPlanningDecisionCompletedEvent:()=>Ae,getAgentPlanningDecisionPlanningRequiredEvent:()=>he,getAgentPlanningDecisionStartedEvent:()=>Se,getAgentPlanningDecisionUpdateEvent:()=>S,getAgentStartingOrchestratorEvent:()=>xe,getThread:()=>v,getThreadEventMessageId:()=>qe,getThreadEvents:()=>b,getUserCancelEvent:()=>ce,getUserMessageEvent:()=>ye,isInteractionAnalyzing:()=>L,listRooms:()=>B,listThreads:()=>O,sendThreadMessage:()=>T,startThread:()=>E,streamThreadMessageEvents:()=>U,subscribeThreadEvents:()=>R});module.exports=oe(Ge);async function pe(t,e,a,_,r){let i=`https://${t}/promptql-v2/artifacts/${e}/version/${a}/data`,n=await(typeof r=="function"?r:fetch)(i,{method:"GET",headers:_});if(n.status!==200){let c=n.body?await n.text():n.statusText;throw new Error(`[${n.status}] failed to download artifact: ${c}`)}return n.body?n.headers.get("Content-Type")?.startsWith("application/json")?n.json():n.text():null}var V={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CancelAgentMessage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"threadId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"messageId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"cancel_agent_message"},arguments:[{kind:"Argument",name:{kind:"Name",value:"threadId"},value:{kind:"Variable",name:{kind:"Name",value:"threadId"}}},{kind:"Argument",name:{kind:"Name",value:"agentMessageId"},value:{kind:"Variable",name:{kind:"Name",value:"messageId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}}]}}]}}]},W={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"SendThreadMessage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"message"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"timezone"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"threadId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"uploads"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UserUploadInput"}}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"send_thread_message"},arguments:[{kind:"Argument",name:{kind:"Name",value:"threadId"},value:{kind:"Variable",name:{kind:"Name",value:"threadId"}}},{kind:"Argument",name:{kind:"Name",value:"timezone"},value:{kind:"Variable",name:{kind:"Name",value:"timezone"}}},{kind:"Argument",name:{kind:"Name",value:"message"},value:{kind:"Variable",name:{kind:"Name",value:"message"}}},{kind:"Argument",name:{kind:"Name",value:"buildFqdn"},value:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}}},{kind:"Argument",name:{kind:"Name",value:"uploads"},value:{kind:"Variable",name:{kind:"Name",value:"uploads"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"created_at"}}]}}]}}]},N={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"StartThread"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"message"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"projectId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"timezone"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"roomId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"uploads"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UserUploadInput"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"visibility"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"start_thread"},arguments:[{kind:"Argument",name:{kind:"Name",value:"message"},value:{kind:"Variable",name:{kind:"Name",value:"message"}}},{kind:"Argument",name:{kind:"Name",value:"projectId"},value:{kind:"Variable",name:{kind:"Name",value:"projectId"}}},{kind:"Argument",name:{kind:"Name",value:"timezone"},value:{kind:"Variable",name:{kind:"Name",value:"timezone"}}},{kind:"Argument",name:{kind:"Name",value:"buildId"},value:{kind:"Variable",name:{kind:"Name",value:"buildId"}}},{kind:"Argument",name:{kind:"Name",value:"buildFqdn"},value:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}}},{kind:"Argument",name:{kind:"Name",value:"roomId"},value:{kind:"Variable",name:{kind:"Name",value:"roomId"}}},{kind:"Argument",name:{kind:"Name",value:"uploads"},value:{kind:"Variable",name:{kind:"Name",value:"uploads"}}},{kind:"Argument",name:{kind:"Name",value:"visibility"},value:{kind:"Variable",name:{kind:"Name",value:"visibility"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"thread_events"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"thread_event_id"}}]}}]}}]}}]},z={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetProjectInfo"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"get_project_info"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"projectId"}},{kind:"Field",name:{kind:"Name",value:"projectName"}},{kind:"Field",name:{kind:"Name",value:"promptqlConsoleUrl"}}]}}]}}]},q={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetRooms"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"rooms_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"rooms_order_by"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}},defaultValue:{kind:"IntValue",value:"10"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"rooms"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Room"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Room"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"rooms"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"room_id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"project_id"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"user_id"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}}]}}]},G={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreads"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"threads_v2_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"threads_v2_order_by"}}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"threads_v2"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Thread"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Thread"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"threads_v2"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"build_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"relevant_event_count"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}},{kind:"Field",name:{kind:"Name",value:"email"}},{kind:"Field",name:{kind:"Name",value:"is_active"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}}]}}]}}]},D={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreadById"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"threads_v2_by_pk"},arguments:[{kind:"Argument",name:{kind:"Name",value:"thread_id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Thread"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Thread"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"threads_v2"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"build_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"relevant_event_count"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}},{kind:"Field",name:{kind:"Name",value:"email"}},{kind:"Field",name:{kind:"Name",value:"is_active"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}}]}}]}}]},Q={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreadEvents"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"ordering"}},type:{kind:"NamedType",name:{kind:"Name",value:"order_by"}},defaultValue:{kind:"EnumValue",value:"asc"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"Variable",name:{kind:"Name",value:"ordering"}}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadEvent"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"thread_events"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"user_id"}}]}}]},J={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"subscription",name:{kind:"Name",value:"SubscribeThreadEvents"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"EnumValue",value:"asc"}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadEvent"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"thread_events"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"user_id"}}]}}]};function B(t,e){return t.query({query:q,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(a=>a.data?.rooms??[])}var u=require("rxjs");function l(t){return t=t?t.trim():"",t?t[t.length-1]==="/"?t.slice(0,t.length-1):t:""}function k(t){if(t==null)return null;try{Number.parseInt(t)}catch{throw new Error("invalid threadEventId")}return t}function O(t,e){return t.query({query:G,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2??[])}function v(t,e){if(!e)throw new Error("threadId is required");return t.query({query:D,variables:{id:e},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2_by_pk)}function E(t,e){if(!e.message.trim())throw new Error("message must not be empty");return t.mutate({mutation:N,variables:e}).then(a=>{if(!a.data?.start_thread)throw new Error(a.error?.message||"Failed to start thread");return a.data.start_thread})}function b(t,e,a){if(!e)throw new Error("threadId is required");let _={thread_id:{_eq:e}};return a&&(a.eventId&&(_.thread_event_id=a.eventId),a.messageId&&(_._or=ue(a.messageId))),t.query({query:Q,variables:{where:_,limit:a?.limit,ordering:a?.ordering||"asc"},fetchPolicy:"no-cache"}).then(r=>r.data?.thread_events??[])}function T(t,e){if(!e.threadId)throw new Error("threadId is required");if(!e.message.trim())throw new Error("message must not be empty");return t.mutate({mutation:W,variables:e}).then(a=>{if(!a.data?.send_thread_message)throw new Error(a.error?.message||"Failed to send message to thread");return a.data.send_thread_message})}function P(t,e){if(!e.threadId)throw new Error("threadId is required");if(!e.messageId.trim())throw new Error("messageId is required");return t.mutate({mutation:V,variables:e}).then(a=>{if(!a.data?.cancel_agent_message)throw new Error(a.error?.message||"Failed to cancel thread");return a.data.cancel_agent_message})}function R(t,e,a){if(!e)throw new Error("threadId is required");k(a);let _={thread_id:{_eq:e}};return a&&(_.thread_event_id={_gte:a}),t.subscribe({query:J,variables:{where:_}}).pipe((0,u.map)(r=>{if(r.error)throw r.error;return r.data?.thread_events??[]}))}function U(t,e,a){if(!e)throw new Error("threadId is required");let _,r=k(a?.fromEventId),i={eventId:a?.fromEventId?{_gte:r}:void 0,messageId:a?.messageId},o=a?.pollingInterval&&a?.pollingInterval>0?a.pollingInterval:5;return(0,u.defer)(async()=>{let n=_?{messageId:a?.messageId,eventId:{_gt:_}}:i,p=await b(t,e,n);return p.length>0&&(_=p[p.length-1]?.thread_event_id),p}).pipe((0,u.repeat)({count:a?.timeout&&a.timeout>0?Math.ceil(a.timeout/o):void 0,delay:o*1e3}),(0,u.takeWhile)(n=>L(n,a?.skipAnalysis),!0))}function L(t,e){for(let a=t.length-1;a>0;a--){let _=t[a];if(e&&"UserCancel"in _.event_data)return!1;if(!("AgentMessage"in _.event_data))return!0;let r=_.event_data.AgentMessage.update;if("content"in r&&("interaction_finished"in r.content||e&&"interaction_update"in r.content&&"main_agent"in r.content.interaction_update&&"completed"in r.content.interaction_update.main_agent)||"InteractionFinished"in r||e&&"OrchestratorUpdate"in r&&"GeneratedResponse"in r.OrchestratorUpdate.update)return!1}return!0}function ue(t){return[{event_data:{_contains:{UserMessage:{message_id:t}}}},{event_data:{_contains:{AgentMessage:{message_id:t}}}},{event_data:{_contains:{UserCancel:{message_id:t}}}}]}function K(t){return t!=null&&typeof t=="object"&&"status"in t&&t.status==="failure"}function H(t){return t!=null&&typeof t=="object"&&"status"in t&&t.status==="success"&&"token"in t}function $(t){return t!=null&&typeof t=="object"&&("data"in t&&!!t.data&&typeof t.data=="object"&&"enrich_token"in t.data&&!!t.data.enrich_token&&typeof t.data.enrich_token=="object"&&"userDirectoryJWT"in t.data.enrich_token||"errors"in t&&Array.isArray(t.errors))}function m(t){let a=`${l(t.authHost)||"https://auth.pro.hasura.io"}/ddn/promptql/token`,_={token:"",expiry:new Date(0)},r=t.fetch||fetch,i=async()=>{let o=await r(a,{method:"POST",headers:t.headers});switch(o.status){case 200:{let n=await o.json();if(H(n))return n;throw new Error("malformed token response")}case 401:{let n=await o.json();throw K(n)?new Error(n?.error||o.statusText):new Error(o.statusText)}default:{let n=await o.text();throw new Error(n)}}};return async()=>{if(_.expiry.getTime()<=Date.now()-1e3){let o=await i(),n=await se(t.promptqlGraphQLUrl,o.token,t.projectId,r);_.token=n;let p=new Date(o.expiry);if(Number.isNaN(p.getTime())){let c=new Date;c.setHours(1),_.expiry=c}else _.expiry=p}return _.token}}var se=async(t,e,a,_=fetch)=>{let r=await _(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:"mutation EnrichToken($luxJWT: String!, $projectId: uuid) { enrich_token(luxJWT: $luxJWT, projectId: $projectId) { userDirectoryJWT }}",variables:{luxJWT:e,projectId:a},operationName:"EnrichToken"})});switch(r.status){case 200:{let i=await r.json();if(!$(i)||!i.data?.enrich_token?.userDirectoryJWT)throw new Error(`malformed promptql token response: ${JSON.stringify(i)}`);return i.data.enrich_token.userDirectoryJWT}default:{let i=await r.text();throw new Error(i)}}};function Z(t){return{Authorization:`pat ${t}`}}var s=require("@apollo/client"),X=require("@apollo/client/link/context"),Y=require("@apollo/client/link/subscriptions"),ee=require("graphql"),te=require("graphql-ws"),w=t=>{let e=new s.HttpLink({uri:t.url,fetch:t.fetch,headers:t.headers}),a=async n=>{let p=await t.getAuthToken();return{headers:{...n,Authorization:`Bearer ${p}`}}},_=(0,te.createClient)({url:t.url,connectionParams:()=>a(t.headers),lazy:!0}),r=new Y.GraphQLWsLink(_),i=new X.SetContextLink(({headers:n})=>a(n)),o=s.ApolloLink.split(({operationType:n})=>n===ee.OperationTypeNode.SUBSCRIPTION,r,i.concat(e));return{client:new s.ApolloClient({link:o,cache:new s.InMemoryCache}),wsClient:_}};var I=class{_options;constructor(e){this._options=e}info(){return F(this._options.client)}};function F(t){return t.query({query:z,fetchPolicy:"cache-first"}).then(e=>{if(!e.data?.get_project_info)throw new Error(e.error?.message||"Project not found");return e.data.get_project_info})}var M=class{_options;constructor(e){this._options=e}list(e){return B(this._options.client,{...e,limit:e.limit&&e.limit>0?e.limit:10})}};var g=class{_options;constructor(e){this._options=e}list(e){return O(this._options.client,{...e,limit:e.limit&&e.limit>0?e.limit:10})}get(e){if(!e)throw new Error("threadId is required");return v(this._options.client,e)}async start(e){let a=await F(this._options.client);return E(this._options.client,{...e,projectId:a.projectId,buildId:e.buildId||this._options.buildId,timezone:e.timezone||this._options.defaultTimezone})}getEvents(e,a){return b(this._options.client,e,a)}sendMessage(e){return T(this._options.client,{...e,timezone:e.timezone||this._options.defaultTimezone})}cancelAgentMessage(e){return P(this._options.client,e)}subscribeEvents(e,a){return R(this._options.client,e,a)}streamMessageEvents(e,a){return U(this._options.client,e,a)}};var j=class{constructor(e){let a=l(e.promptqlBaseUrl)||"https://promptql.ddn.hasura.app";if(!e.serviceAccountToken)throw new Error("serviceAccountToken must not be empty. If you haven't created any service account token yet, check out Hasura docs https://hasura.io/docs/3.0/project-configuration/project-management/service-accounts/#how-to-create-service-account");let _=a.endsWith("/v1/graphql")?a:`${a}/playground-v2-hge/v1/graphql`;this._fetchToken=m({promptqlGraphQLUrl:_,authHost:e.authHost,headers:Z(e.serviceAccountToken),fetch:e.fetch});let{client:r,wsClient:i}=w({getAuthToken:this._fetchToken,url:_,fetch:e.fetch,headers:e.headers});this._wsClient=i,this._options={client:r,buildId:e.buildId,defaultTimezone:e.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone},this.thread=new g(this._options),this.project=new I(this._options),this.room=new M(this._options)}_options;_wsClient;_fetchToken;thread;project;room;authenticated(){return this._fetchToken().then(()=>!0).catch(()=>!1)}close(){this._wsClient.dispose(),this._options.client.clearStore()}};function de(t,e){if(!e.length)return[];if(!t.length)return e;let a=t[t.length-1];if(!a)return e;let _=BigInt(a.thread_event_id),r=e.length-1;for(;r>=0;r--){let i=e[r];if(BigInt(i?.thread_event_id)<=_)break}return e.slice(r+1)}function ye(t){return"UserMessage"in t?t.UserMessage:null}function ce(t){return"UserCancel"in t?t.UserCancel:null}function le(t){return!("AgentMessage"in t)||!("OrchestratorUpdate"in t.AgentMessage.update)||!("PlanGenerationStarted"in t.AgentMessage.update.OrchestratorUpdate.update)?null:t.AgentMessage.update.OrchestratorUpdate.update.PlanGenerationStarted}function be(t){let e=A(t);return!e||!("PlanStepGenerated"in e)?null:e.PlanStepGenerated}function me(t){return"AgentMessage"in t?"content"in t.AgentMessage.update&&"interaction_update"in t.AgentMessage.update.content&&"main_agent"in t.AgentMessage.update.content.interaction_update&&"completed"in t.AgentMessage.update.content.interaction_update.main_agent?{success:!0,message:t.AgentMessage.update.content.interaction_update.main_agent.completed.summary,modified_artifacts:[],generated_at:t.AgentMessage.update.timestamp}:!("OrchestratorUpdate"in t.AgentMessage.update)||!("GeneratedResponse"in t.AgentMessage.update.OrchestratorUpdate.update)?null:t.AgentMessage.update.OrchestratorUpdate.update.GeneratedResponse.response:null}function Ie(t){return!("AgentMessage"in t)||!("MessageProcessingUpdate"in t.AgentMessage.update)||!("ProcessingStarted"in t.AgentMessage.update.MessageProcessingUpdate.update)?null:t.AgentMessage.update.MessageProcessingUpdate.update.ProcessingStarted}function Me(t){return!("AgentMessage"in t)||!("MessageProcessingUpdate"in t.AgentMessage.update)||!("InteractionDecision"in t.AgentMessage.update.MessageProcessingUpdate.update)||!("AcceptInteraction"in t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.AcceptInteraction}function ge(t){return!("AgentMessage"in t)||!("MessageProcessingUpdate"in t.AgentMessage.update)||!("InteractionDecision"in t.AgentMessage.update.MessageProcessingUpdate.update)||!("DeclineInteraction"in t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.DeclineInteraction}function S(t){return!("AgentMessage"in t)||!("PlanningDecisionUpdate"in t.AgentMessage.update)?null:t.AgentMessage.update.PlanningDecisionUpdate.update}function Se(t){let e=S(t);return!e||!("Started"in e)?null:e.Started}function Ae(t){let e=S(t);return!e||!("Completed"in e)?null:e.Completed}function he(t){let e=S(t);return!e||!("PlanningRequired"in e)?null:e.PlanningRequired}function xe(t){return!("AgentMessage"in t)||!("StartingOrchestrator"in t.AgentMessage.update)?null:t.AgentMessage.update.StartingOrchestrator}function A(t){return!("AgentMessage"in t)||!("OrchestratorUpdate"in t.AgentMessage.update)?null:t.AgentMessage.update.OrchestratorUpdate.update}function y(t){let e=A(t);return!e||!("ContextExplorerUpdate"in e)?null:e.ContextExplorerUpdate.update}function fe(t){let e=y(t);return!e||!("Started"in e)?null:e.Started}function Ce(t){let e=y(t);return!e||!("Completed"in e)?null:e.Completed}function h(t){let e=y(t);return!e||!("WikiExplorerUpdate"in e)?null:e.WikiExplorerUpdate.update}function Be(t){let e=h(t);return!e||!("Started"in e)?null:e.Started}function ke(t){let e=h(t);return!e||!("Completed"in e)?null:e.Completed}function Oe(t){let e=h(t);return!e||!("WikiInfoGenerated"in e)?null:e.WikiInfoGenerated}function x(t){let e=y(t);return!e||!("SchemaTasksGenerationUpdate"in e)?null:e.SchemaTasksGenerationUpdate.update}function ve(t){let e=x(t);return!e||!("Started"in e)?null:e.Started}function Ee(t){let e=x(t);return!e||!("Completed"in e)?null:e.Completed}function Te(t){let e=x(t);return!e||!("TasksGenerated"in e)?null:e.TasksGenerated}function d(t){let e=y(t);return!e||!("SchemaExplorerUpdate"in e)?null:e.SchemaExplorerUpdate.update}function Pe(t){let e=d(t);return!e||!("Started"in e)?null:e.Started}function Re(t){let e=d(t);return!e||!("Completed"in e)?null:e.Completed}function Ue(t){let e=d(t);return!e||!("CodeExecutionComplete"in e)?null:e.CodeExecutionComplete}function we(t){let e=d(t);return!e||!("CodeOutputAnalyzed"in e)?null:e.CodeOutputAnalyzed}function Fe(t){let e=d(t);return!e||!("GeneratedCode"in e)?null:e.GeneratedCode}function je(t){let e=d(t);return!e||!("SchemaExplored"in e)?null:e.SchemaExplored}function f(t){let e=A(t);return!e||!("StepUpdate"in e)?null:e.StepUpdate}function Ve(t){let e=f(t);return!e||!("Programmer"in e.update)?null:e.update.Programmer}function We(t){let e=f(t);return!e||!("UiProgrammer"in e.update)?null:e.update.UiProgrammer}function Ne(t){let e=f(t);return!e||!("SavedProgramRunner"in e.update)?null:e.update.SavedProgramRunner}function ze(t){if(!("AgentMessage"in t))return null;if("InteractionFinished"in t.AgentMessage.update){let e=t.AgentMessage.update.InteractionFinished.update;return"Completed"in e?{status:"completed",timestamp:e.Completed.completed_at,warnings:e.Completed.warnings}:"Errored"in e?{status:"errored",timestamp:e.Errored.errored_at,reason:typeof e.Errored.error=="string"?e.Errored.error:e.Errored.error.User.message}:"UserCancelled"in e?{status:"user_cancelled",timestamp:e.UserCancelled.cancelled_at}:"AgentDeclined"in e?{status:"agent_declined",timestamp:e.AgentDeclined.declined_at,reason:e.AgentDeclined.reason}:"ServerCancelled"in e?{status:"server_cancelled",timestamp:e.ServerCancelled.cancelled_at}:{status:"unknown"}}if("content"in t.AgentMessage.update&&"interaction_finished"in t.AgentMessage.update.content){let e=t.AgentMessage.update.content.interaction_finished.outcome;return"errored"in e?{status:"errored",reason:e.errored.user_facing_message||e.errored.raw_error,timestamp:t.AgentMessage.update.timestamp,warnings:e.errored.raw_error?[{message:e.errored.raw_error}]:[]}:"server_cancelled"in e?{status:"server_cancelled",timestamp:t.AgentMessage.update.timestamp}:"user_cancelled"in e?{status:"user_cancelled",timestamp:t.AgentMessage.update.timestamp}:"completed"in e?{status:"completed",timestamp:t.AgentMessage.update.timestamp,warnings:e.completed.warnings}:{status:"unknown"}}return null}function qe(t){if(t){if("UserMessage"in t)return t.UserMessage.message_id;if("AgentMessage"in t)return t.AgentMessage.message_id;if("UserTeach"in t)return t.UserTeach.agent_message_id;if("UserCancel"in t)return t.UserCancel.message_id}}0&&(module.exports={PromptQLSdk,cancelAgentMessage,createApolloClient,createPromptQLAuthTokenGenerator,diffThreadEvents,downloadArtifactData,getAgentGeneratedResponse,getAgentInteractionDecisionAcceptInteractionEvent,getAgentInteractionDecisionDeclineInteractionEvent,getAgentInteractionFinishedEvent,getAgentMessageProcessingStartedEvent,getAgentOrchestratorContextExplorerCompletedEvent,getAgentOrchestratorContextExplorerStartedEvent,getAgentOrchestratorContextExplorerUpdateEvent,getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent,getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent,getAgentOrchestratorSchemaExplorerCompletedEvent,getAgentOrchestratorSchemaExplorerGeneratedCodeEvent,getAgentOrchestratorSchemaExplorerSchemaExploredEvent,getAgentOrchestratorSchemaExplorerStartedEvent,getAgentOrchestratorSchemaExplorerUpdateEvent,getAgentOrchestratorSchemaTasksGeneratedEvent,getAgentOrchestratorSchemaTasksGenerationCompletedEvent,getAgentOrchestratorSchemaTasksGenerationStartedEvent,getAgentOrchestratorSchemaTasksGenerationUpdateEvent,getAgentOrchestratorStepProgrammerEvent,getAgentOrchestratorStepSavedProgramRunnerEvent,getAgentOrchestratorStepUiProgrammerEvent,getAgentOrchestratorStepUpdateEvent,getAgentOrchestratorUpdateEvent,getAgentOrchestratorWikiExplorerCompletedEvent,getAgentOrchestratorWikiExplorerStartedEvent,getAgentOrchestratorWikiExplorerUpdateEvent,getAgentOrchestratorWikiInfoGeneratedEvent,getAgentPlanGenerationStartedEvent,getAgentPlanStepGeneratedEvent,getAgentPlanningDecisionCompletedEvent,getAgentPlanningDecisionPlanningRequiredEvent,getAgentPlanningDecisionStartedEvent,getAgentPlanningDecisionUpdateEvent,getAgentStartingOrchestratorEvent,getThread,getThreadEventMessageId,getThreadEvents,getUserCancelEvent,getUserMessageEvent,isInteractionAnalyzing,listRooms,listThreads,sendThreadMessage,startThread,streamThreadMessageEvents,subscribeThreadEvents});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defer as Q,map as J,repeat as L,takeWhile as K}from"rxjs";var f={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CancelAgentMessage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"threadId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"messageId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"cancel_agent_message"},arguments:[{kind:"Argument",name:{kind:"Name",value:"threadId"},value:{kind:"Variable",name:{kind:"Name",value:"threadId"}}},{kind:"Argument",name:{kind:"Name",value:"agentMessageId"},value:{kind:"Variable",name:{kind:"Name",value:"messageId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}}]}}]}}]},C={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"SendThreadMessage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"message"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"timezone"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"threadId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"uploads"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UserUploadInput"}}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"send_thread_message"},arguments:[{kind:"Argument",name:{kind:"Name",value:"threadId"},value:{kind:"Variable",name:{kind:"Name",value:"threadId"}}},{kind:"Argument",name:{kind:"Name",value:"timezone"},value:{kind:"Variable",name:{kind:"Name",value:"timezone"}}},{kind:"Argument",name:{kind:"Name",value:"message"},value:{kind:"Variable",name:{kind:"Name",value:"message"}}},{kind:"Argument",name:{kind:"Name",value:"buildFqdn"},value:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}}},{kind:"Argument",name:{kind:"Name",value:"uploads"},value:{kind:"Variable",name:{kind:"Name",value:"uploads"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"created_at"}}]}}]}}]},B={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"StartThread"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"message"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"projectId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"timezone"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"roomId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"uploads"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UserUploadInput"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"visibility"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"start_thread"},arguments:[{kind:"Argument",name:{kind:"Name",value:"message"},value:{kind:"Variable",name:{kind:"Name",value:"message"}}},{kind:"Argument",name:{kind:"Name",value:"projectId"},value:{kind:"Variable",name:{kind:"Name",value:"projectId"}}},{kind:"Argument",name:{kind:"Name",value:"timezone"},value:{kind:"Variable",name:{kind:"Name",value:"timezone"}}},{kind:"Argument",name:{kind:"Name",value:"buildId"},value:{kind:"Variable",name:{kind:"Name",value:"buildId"}}},{kind:"Argument",name:{kind:"Name",value:"buildFqdn"},value:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}}},{kind:"Argument",name:{kind:"Name",value:"roomId"},value:{kind:"Variable",name:{kind:"Name",value:"roomId"}}},{kind:"Argument",name:{kind:"Name",value:"uploads"},value:{kind:"Variable",name:{kind:"Name",value:"uploads"}}},{kind:"Argument",name:{kind:"Name",value:"visibility"},value:{kind:"Variable",name:{kind:"Name",value:"visibility"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"thread_events"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"thread_event_id"}}]}}]}}]}}]},k={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetProjectInfo"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"get_project_info"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"projectId"}},{kind:"Field",name:{kind:"Name",value:"projectName"}},{kind:"Field",name:{kind:"Name",value:"promptqlConsoleUrl"}}]}}]}}]},O={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreads"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"threads_v2_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"threads_v2_order_by"}}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"threads_v2"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Thread"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Thread"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"threads_v2"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"build_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"relevant_event_count"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}},{kind:"Field",name:{kind:"Name",value:"email"}},{kind:"Field",name:{kind:"Name",value:"is_active"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}}]}}]}}]},v={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreadById"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"threads_v2_by_pk"},arguments:[{kind:"Argument",name:{kind:"Name",value:"thread_id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Thread"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Thread"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"threads_v2"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"build_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"relevant_event_count"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}},{kind:"Field",name:{kind:"Name",value:"email"}},{kind:"Field",name:{kind:"Name",value:"is_active"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}}]}}]}}]},E={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreadEvents"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"ordering"}},type:{kind:"NamedType",name:{kind:"Name",value:"order_by"}},defaultValue:{kind:"EnumValue",value:"asc"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"Variable",name:{kind:"Name",value:"ordering"}}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadEvent"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"thread_events"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"user_id"}}]}}]},T={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"subscription",name:{kind:"Name",value:"SubscribeThreadEvents"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"EnumValue",value:"asc"}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadEvent"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"thread_events"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"user_id"}}]}}]};function d(t){return t=t?t.trim():"",t?t[t.length-1]==="/"?t.slice(0,t.length-1):t:""}function l(t){if(t==null)return null;try{Number.parseInt(t)}catch{throw new Error("invalid threadEventId")}return t}function P(t,e){return t.query({query:O,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2??[])}function R(t,e){if(!e)throw new Error("threadId is required");return t.query({query:v,variables:{id:e},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2_by_pk)}function U(t,e){if(!e.message.trim())throw new Error("message must not be empty");return t.mutate({mutation:B,variables:e}).then(a=>{if(!a.data?.start_thread)throw new Error(a.error?.message||"Failed to start thread");return a.data.start_thread})}function b(t,e,a){if(!e)throw new Error("threadId is required");let r={thread_id:{_eq:e}};return a&&(a.eventId&&(r.thread_event_id=a.eventId),a.messageId&&(r._or=$(a.messageId))),t.query({query:E,variables:{where:r,limit:a?.limit,ordering:a?.ordering||"asc"},fetchPolicy:"no-cache"}).then(_=>_.data?.thread_events??[])}function w(t,e){if(!e.threadId)throw new Error("threadId is required");if(!e.message.trim())throw new Error("message must not be empty");return t.mutate({mutation:C,variables:e}).then(a=>{if(!a.data?.send_thread_message)throw new Error(a.error?.message||"Failed to send message to thread");return a.data.send_thread_message})}function j(t,e){if(!e.threadId)throw new Error("threadId is required");if(!e.messageId.trim())throw new Error("messageId is required");return t.mutate({mutation:f,variables:e}).then(a=>{if(!a.data?.cancel_agent_message)throw new Error(a.error?.message||"Failed to cancel thread");return a.data.cancel_agent_message})}function F(t,e,a){if(!e)throw new Error("threadId is required");l(a);let r={thread_id:{_eq:e}};return a&&(r.thread_event_id={_gte:a}),t.subscribe({query:T,variables:{where:r}}).pipe(J(_=>{if(_.error)throw _.error;return _.data?.thread_events??[]}))}function W(t,e,a){if(!e)throw new Error("threadId is required");let r,_=l(a?.fromEventId),i={eventId:a?.fromEventId?{_gte:_}:void 0,messageId:a?.messageId},o=a?.pollingInterval&&a?.pollingInterval>0?a.pollingInterval:5;return Q(async()=>{let n=r?{messageId:a?.messageId,eventId:{_gt:r}}:i,p=await b(t,e,n);return p.length>0&&(r=p[p.length-1]?.thread_event_id),p}).pipe(L({count:a?.timeout&&a.timeout>0?Math.ceil(a.timeout/o):void 0,delay:o*1e3}),K(n=>H(n,a?.skipAnalysis),!0))}function H(t,e){for(let a=t.length-1;a>0;a--){let r=t[a];if(e&&"UserCancel"in r.event_data)return!1;if(!("AgentMessage"in r.event_data))return!0;let _=r.event_data.AgentMessage.update;if("content"in _&&"interaction_finished"in _.content||"InteractionFinished"in _||e&&"OrchestratorUpdate"in _&&"GeneratedResponse"in _.OrchestratorUpdate.update)return!1}return!0}function $(t){return[{event_data:{_contains:{UserMessage:{message_id:t}}}},{event_data:{_contains:{AgentMessage:{message_id:t}}}},{event_data:{_contains:{UserCancel:{message_id:t}}}}]}function V(t){return t!=null&&typeof t=="object"&&"status"in t&&t.status==="failure"}function N(t){return t!=null&&typeof t=="object"&&"status"in t&&t.status==="success"&&"token"in t}function z(t){return t!=null&&typeof t=="object"&&("data"in t&&!!t.data&&typeof t.data=="object"&&"enrich_token"in t.data&&!!t.data.enrich_token&&typeof t.data.enrich_token=="object"&&"userDirectoryJWT"in t.data.enrich_token||"errors"in t&&Array.isArray(t.errors))}function m(t){let a=`${d(t.authHost)||"https://auth.pro.hasura.io"}/ddn/promptql/token`,r={token:"",expiry:new Date(0)},_=t.fetch||fetch,i=async()=>{let o=await _(a,{method:"POST",headers:t.headers});switch(o.status){case 200:{let n=await o.json();if(N(n))return n;throw new Error("malformed token response")}case 401:{let n=await o.json();throw V(n)?new Error(n?.error||o.statusText):new Error(o.statusText)}default:{let n=await o.text();throw new Error(n)}}};return async()=>{if(r.expiry.getTime()<=Date.now()-1e3){let o=await i(),n=await Z(t.promptqlGraphQLUrl,o.token,t.projectId,_);r.token=n;let p=new Date(o.expiry);if(Number.isNaN(p.getTime())){let x=new Date;x.setHours(1),r.expiry=x}else r.expiry=p}return r.token}}var Z=async(t,e,a,r=fetch)=>{let _=await r(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:"mutation EnrichToken($luxJWT: String!, $projectId: uuid) { enrich_token(luxJWT: $luxJWT, projectId: $projectId) { userDirectoryJWT }}",variables:{luxJWT:e,projectId:a},operationName:"EnrichToken"})});switch(_.status){case 200:{let i=await _.json();if(!z(i)||!i.data?.enrich_token?.userDirectoryJWT)throw new Error(`malformed promptql token response: ${JSON.stringify(i)}`);return i.data.enrich_token.userDirectoryJWT}default:{let i=await _.text();throw new Error(i)}}};function q(t){return{Authorization:`pat ${t}`}}import{ApolloClient as X,ApolloLink as Y,HttpLink as ee,InMemoryCache as te}from"@apollo/client";import{SetContextLink as ae}from"@apollo/client/link/context";import{GraphQLWsLink as re}from"@apollo/client/link/subscriptions";import{OperationTypeNode as _e}from"graphql";import{createClient as ne}from"graphql-ws";var G=t=>{let e=new ee({uri:t.url,fetch:t.fetch,headers:t.headers}),a=async n=>{let p=await t.getAuthToken();return{headers:{...n,Authorization:`Bearer ${p}`}}},r=ne({url:t.url,connectionParams:()=>a(t.headers),lazy:!0}),_=new re(r),i=new ae(({headers:n})=>a(n)),o=Y.split(({operationType:n})=>n===_e.SUBSCRIPTION,_,i.concat(e));return{client:new X({link:o,cache:new te}),wsClient:r}};var y=class{_options;constructor(e){this._options=e}info(){return I(this._options.client)}};function I(t){return t.query({query:k,fetchPolicy:"cache-first"}).then(e=>{if(!e.data?.get_project_info)throw new Error(e.error?.message||"Project not found");return e.data.get_project_info})}var c=class{_options;constructor(e){this._options=e}list(e){return P(this._options.client,{...e,limit:e.limit&&e.limit>0?e.limit:10})}get(e){if(!e)throw new Error("threadId is required");return R(this._options.client,e)}async start(e){let a=await I(this._options.client);return U(this._options.client,{...e,projectId:a.projectId,buildId:e.buildId||this._options.buildId,timezone:e.timezone||this._options.defaultTimezone})}getEvents(e,a){return b(this._options.client,e,a)}sendMessage(e){return w(this._options.client,{...e,timezone:e.timezone||this._options.defaultTimezone})}cancelAgentMessage(e){return j(this._options.client,e)}subscribeEvents(e,a){return F(this._options.client,e,a)}streamMessageEvents(e,a){return W(this._options.client,e,a)}};var D=class{constructor(e){let a=d(e.promptqlBaseUrl)||"https://promptql.ddn.hasura.app";if(!e.serviceAccountToken)throw new Error("serviceAccountToken must not be empty. If you haven't created any service account token yet, check out Hasura docs https://hasura.io/docs/3.0/project-configuration/project-management/service-accounts/#how-to-create-service-account");let r=a.endsWith("/v1/graphql")?a:`${a}/playground-v2-hge/v1/graphql`;this._fetchToken=m({promptqlGraphQLUrl:r,authHost:e.authHost,headers:q(e.serviceAccountToken),fetch:e.fetch});let{client:_,wsClient:i}=G({getAuthToken:this._fetchToken,url:r,fetch:e.fetch,headers:e.headers});this._wsClient=i,this._options={client:_,buildId:e.buildId,defaultTimezone:e.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone},this.thread=new c(this._options),this.project=new y(this._options)}_options;_wsClient;_fetchToken;thread;project;authenticated(){return this._fetchToken().then(()=>!0).catch(()=>!1)}close(){this._wsClient.dispose(),this._options.client.clearStore()}};function Qe(t,e){if(!e.length)return[];if(!t.length)return e;let a=t[t.length-1];if(!a)return e;let r=BigInt(a.thread_event_id),_=e.length-1;for(;_>=0;_--){let i=e[_];if(BigInt(i?.thread_event_id)<=r)break}return e.slice(_+1)}function Je(t){return"UserMessage"in t?t.UserMessage:null}function Le(t){return"UserCancel"in t?t.UserCancel:null}function Ke(t){return!("AgentMessage"in t)||!("OrchestratorUpdate"in t.AgentMessage.update)||!("PlanGenerationStarted"in t.AgentMessage.update.OrchestratorUpdate.update)?null:t.AgentMessage.update.OrchestratorUpdate.update.PlanGenerationStarted}function He(t){let e=S(t);return!e||!("PlanStepGenerated"in e)?null:e.PlanStepGenerated}function $e(t){return"AgentMessage"in t?"content"in t.AgentMessage.update&&"interaction_update"in t.AgentMessage.update.content&&"main_agent"in t.AgentMessage.update.content.interaction_update&&"completed"in t.AgentMessage.update.content.interaction_update.main_agent?{success:!0,message:t.AgentMessage.update.content.interaction_update.main_agent.completed.summary,modified_artifacts:[],generated_at:t.AgentMessage.update.timestamp}:!("OrchestratorUpdate"in t.AgentMessage.update)||!("GeneratedResponse"in t.AgentMessage.update.OrchestratorUpdate.update)?null:t.AgentMessage.update.OrchestratorUpdate.update.GeneratedResponse.response:null}function Ze(t){return!("AgentMessage"in t)||!("MessageProcessingUpdate"in t.AgentMessage.update)||!("ProcessingStarted"in t.AgentMessage.update.MessageProcessingUpdate.update)?null:t.AgentMessage.update.MessageProcessingUpdate.update.ProcessingStarted}function Xe(t){return!("AgentMessage"in t)||!("MessageProcessingUpdate"in t.AgentMessage.update)||!("InteractionDecision"in t.AgentMessage.update.MessageProcessingUpdate.update)||!("AcceptInteraction"in t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.AcceptInteraction}function Ye(t){return!("AgentMessage"in t)||!("MessageProcessingUpdate"in t.AgentMessage.update)||!("InteractionDecision"in t.AgentMessage.update.MessageProcessingUpdate.update)||!("DeclineInteraction"in t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.DeclineInteraction}function M(t){return!("AgentMessage"in t)||!("PlanningDecisionUpdate"in t.AgentMessage.update)?null:t.AgentMessage.update.PlanningDecisionUpdate.update}function et(t){let e=M(t);return!e||!("Started"in e)?null:e.Started}function tt(t){let e=M(t);return!e||!("Completed"in e)?null:e.Completed}function at(t){let e=M(t);return!e||!("PlanningRequired"in e)?null:e.PlanningRequired}function rt(t){return!("AgentMessage"in t)||!("StartingOrchestrator"in t.AgentMessage.update)?null:t.AgentMessage.update.StartingOrchestrator}function S(t){return!("AgentMessage"in t)||!("OrchestratorUpdate"in t.AgentMessage.update)?null:t.AgentMessage.update.OrchestratorUpdate.update}function s(t){let e=S(t);return!e||!("ContextExplorerUpdate"in e)?null:e.ContextExplorerUpdate.update}function _t(t){let e=s(t);return!e||!("Started"in e)?null:e.Started}function nt(t){let e=s(t);return!e||!("Completed"in e)?null:e.Completed}function g(t){let e=s(t);return!e||!("WikiExplorerUpdate"in e)?null:e.WikiExplorerUpdate.update}function it(t){let e=g(t);return!e||!("Started"in e)?null:e.Started}function ot(t){let e=g(t);return!e||!("Completed"in e)?null:e.Completed}function pt(t){let e=g(t);return!e||!("WikiInfoGenerated"in e)?null:e.WikiInfoGenerated}function A(t){let e=s(t);return!e||!("SchemaTasksGenerationUpdate"in e)?null:e.SchemaTasksGenerationUpdate.update}function ut(t){let e=A(t);return!e||!("Started"in e)?null:e.Started}function st(t){let e=A(t);return!e||!("Completed"in e)?null:e.Completed}function dt(t){let e=A(t);return!e||!("TasksGenerated"in e)?null:e.TasksGenerated}function u(t){let e=s(t);return!e||!("SchemaExplorerUpdate"in e)?null:e.SchemaExplorerUpdate.update}function yt(t){let e=u(t);return!e||!("Started"in e)?null:e.Started}function ct(t){let e=u(t);return!e||!("Completed"in e)?null:e.Completed}function lt(t){let e=u(t);return!e||!("CodeExecutionComplete"in e)?null:e.CodeExecutionComplete}function bt(t){let e=u(t);return!e||!("CodeOutputAnalyzed"in e)?null:e.CodeOutputAnalyzed}function mt(t){let e=u(t);return!e||!("GeneratedCode"in e)?null:e.GeneratedCode}function It(t){let e=u(t);return!e||!("SchemaExplored"in e)?null:e.SchemaExplored}function h(t){let e=S(t);return!e||!("StepUpdate"in e)?null:e.StepUpdate}function Mt(t){let e=h(t);return!e||!("Programmer"in e.update)?null:e.update.Programmer}function St(t){let e=h(t);return!e||!("UiProgrammer"in e.update)?null:e.update.UiProgrammer}function gt(t){let e=h(t);return!e||!("SavedProgramRunner"in e.update)?null:e.update.SavedProgramRunner}function At(t){if(!("AgentMessage"in t))return null;if("InteractionFinished"in t.AgentMessage.update){let e=t.AgentMessage.update.InteractionFinished.update;return"Completed"in e?{status:"completed",timestamp:e.Completed.completed_at,warnings:e.Completed.warnings}:"Errored"in e?{status:"errored",timestamp:e.Errored.errored_at,reason:typeof e.Errored.error=="string"?e.Errored.error:e.Errored.error.User.message}:"UserCancelled"in e?{status:"user_cancelled",timestamp:e.UserCancelled.cancelled_at}:"AgentDeclined"in e?{status:"agent_declined",timestamp:e.AgentDeclined.declined_at,reason:e.AgentDeclined.reason}:"ServerCancelled"in e?{status:"server_cancelled",timestamp:e.ServerCancelled.cancelled_at}:{status:"unknown"}}if("content"in t.AgentMessage.update&&"interaction_finished"in t.AgentMessage.update.content){let e=t.AgentMessage.update.content.interaction_finished.outcome;return"errored"in e?{status:"errored",reason:e.errored.user_facing_message||e.errored.raw_error,timestamp:t.AgentMessage.update.timestamp,warnings:e.errored.raw_error?[{message:e.errored.raw_error}]:[]}:"server_cancelled"in e?{status:"server_cancelled",timestamp:t.AgentMessage.update.timestamp}:"user_cancelled"in e?{status:"user_cancelled",timestamp:t.AgentMessage.update.timestamp}:"completed"in e?{status:"completed",timestamp:t.AgentMessage.update.timestamp,warnings:e.completed.warnings}:{status:"unknown"}}return null}export{D as PromptQLSdk,j as cancelAgentMessage,G as createApolloClient,m as createPromptQLAuthTokenGenerator,Qe as diffThreadEvents,$e as getAgentGeneratedResponse,Xe as getAgentInteractionDecisionAcceptInteractionEvent,Ye as getAgentInteractionDecisionDeclineInteractionEvent,At as getAgentInteractionFinishedEvent,Ze as getAgentMessageProcessingStartedEvent,nt as getAgentOrchestratorContextExplorerCompletedEvent,_t as getAgentOrchestratorContextExplorerStartedEvent,s as getAgentOrchestratorContextExplorerUpdateEvent,lt as getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent,bt as getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent,ct as getAgentOrchestratorSchemaExplorerCompletedEvent,mt as getAgentOrchestratorSchemaExplorerGeneratedCodeEvent,It as getAgentOrchestratorSchemaExplorerSchemaExploredEvent,yt as getAgentOrchestratorSchemaExplorerStartedEvent,u as getAgentOrchestratorSchemaExplorerUpdateEvent,dt as getAgentOrchestratorSchemaTasksGeneratedEvent,st as getAgentOrchestratorSchemaTasksGenerationCompletedEvent,ut as getAgentOrchestratorSchemaTasksGenerationStartedEvent,A as getAgentOrchestratorSchemaTasksGenerationUpdateEvent,Mt as getAgentOrchestratorStepProgrammerEvent,gt as getAgentOrchestratorStepSavedProgramRunnerEvent,St as getAgentOrchestratorStepUiProgrammerEvent,h as getAgentOrchestratorStepUpdateEvent,S as getAgentOrchestratorUpdateEvent,ot as getAgentOrchestratorWikiExplorerCompletedEvent,it as getAgentOrchestratorWikiExplorerStartedEvent,g as getAgentOrchestratorWikiExplorerUpdateEvent,pt as getAgentOrchestratorWikiInfoGeneratedEvent,Ke as getAgentPlanGenerationStartedEvent,He as getAgentPlanStepGeneratedEvent,tt as getAgentPlanningDecisionCompletedEvent,at as getAgentPlanningDecisionPlanningRequiredEvent,et as getAgentPlanningDecisionStartedEvent,M as getAgentPlanningDecisionUpdateEvent,rt as getAgentStartingOrchestratorEvent,R as getThread,b as getThreadEvents,Le as getUserCancelEvent,Je as getUserMessageEvent,P as listThreads,w as sendThreadMessage,U as startThread,W as streamThreadMessageEvents,F as subscribeThreadEvents,H as wasInteractionFinished};
|
|
1
|
+
async function ue(t,e,a,_,r){let i=`https://${t}/promptql-v2/artifacts/${e}/version/${a}/data`,n=await(typeof r=="function"?r:fetch)(i,{method:"GET",headers:_});if(n.status!==200){let d=n.body?await n.text():n.statusText;throw new Error(`[${n.status}] failed to download artifact: ${d}`)}return n.body?n.headers.get("Content-Type")?.startsWith("application/json")?n.json():n.text():null}var C={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CancelAgentMessage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"threadId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"messageId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"cancel_agent_message"},arguments:[{kind:"Argument",name:{kind:"Name",value:"threadId"},value:{kind:"Variable",name:{kind:"Name",value:"threadId"}}},{kind:"Argument",name:{kind:"Name",value:"agentMessageId"},value:{kind:"Variable",name:{kind:"Name",value:"messageId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}}]}}]}}]},B={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"SendThreadMessage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"message"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"timezone"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"threadId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"uploads"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UserUploadInput"}}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"send_thread_message"},arguments:[{kind:"Argument",name:{kind:"Name",value:"threadId"},value:{kind:"Variable",name:{kind:"Name",value:"threadId"}}},{kind:"Argument",name:{kind:"Name",value:"timezone"},value:{kind:"Variable",name:{kind:"Name",value:"timezone"}}},{kind:"Argument",name:{kind:"Name",value:"message"},value:{kind:"Variable",name:{kind:"Name",value:"message"}}},{kind:"Argument",name:{kind:"Name",value:"buildFqdn"},value:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}}},{kind:"Argument",name:{kind:"Name",value:"uploads"},value:{kind:"Variable",name:{kind:"Name",value:"uploads"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"created_at"}}]}}]}}]},k={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"StartThread"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"message"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"projectId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"timezone"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"roomId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"uploads"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UserUploadInput"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"visibility"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"start_thread"},arguments:[{kind:"Argument",name:{kind:"Name",value:"message"},value:{kind:"Variable",name:{kind:"Name",value:"message"}}},{kind:"Argument",name:{kind:"Name",value:"projectId"},value:{kind:"Variable",name:{kind:"Name",value:"projectId"}}},{kind:"Argument",name:{kind:"Name",value:"timezone"},value:{kind:"Variable",name:{kind:"Name",value:"timezone"}}},{kind:"Argument",name:{kind:"Name",value:"buildId"},value:{kind:"Variable",name:{kind:"Name",value:"buildId"}}},{kind:"Argument",name:{kind:"Name",value:"buildFqdn"},value:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}}},{kind:"Argument",name:{kind:"Name",value:"roomId"},value:{kind:"Variable",name:{kind:"Name",value:"roomId"}}},{kind:"Argument",name:{kind:"Name",value:"uploads"},value:{kind:"Variable",name:{kind:"Name",value:"uploads"}}},{kind:"Argument",name:{kind:"Name",value:"visibility"},value:{kind:"Variable",name:{kind:"Name",value:"visibility"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"thread_events"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"thread_event_id"}}]}}]}}]}}]},O={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetProjectInfo"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"get_project_info"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"projectId"}},{kind:"Field",name:{kind:"Name",value:"projectName"}},{kind:"Field",name:{kind:"Name",value:"promptqlConsoleUrl"}}]}}]}}]},v={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetRooms"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"rooms_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"rooms_order_by"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}},defaultValue:{kind:"IntValue",value:"10"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"rooms"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Room"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Room"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"rooms"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"room_id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"project_id"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"user_id"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}}]}}]},E={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreads"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"threads_v2_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"threads_v2_order_by"}}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"threads_v2"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Thread"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Thread"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"threads_v2"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"build_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"relevant_event_count"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}},{kind:"Field",name:{kind:"Name",value:"email"}},{kind:"Field",name:{kind:"Name",value:"is_active"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}}]}}]}}]},T={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreadById"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"threads_v2_by_pk"},arguments:[{kind:"Argument",name:{kind:"Name",value:"thread_id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Thread"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Thread"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"threads_v2"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"build_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"relevant_event_count"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}},{kind:"Field",name:{kind:"Name",value:"email"}},{kind:"Field",name:{kind:"Name",value:"is_active"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}}]}}]}}]},P={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreadEvents"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"ordering"}},type:{kind:"NamedType",name:{kind:"Name",value:"order_by"}},defaultValue:{kind:"EnumValue",value:"asc"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"Variable",name:{kind:"Name",value:"ordering"}}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadEvent"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"thread_events"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"user_id"}}]}}]},R={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"subscription",name:{kind:"Name",value:"SubscribeThreadEvents"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"EnumValue",value:"asc"}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadEvent"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"thread_events"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"user_id"}}]}}]};function U(t,e){return t.query({query:v,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(a=>a.data?.rooms??[])}import{defer as K,map as H,repeat as $,takeWhile as Z}from"rxjs";function y(t){return t=t?t.trim():"",t?t[t.length-1]==="/"?t.slice(0,t.length-1):t:""}function m(t){if(t==null)return null;try{Number.parseInt(t)}catch{throw new Error("invalid threadEventId")}return t}function w(t,e){return t.query({query:E,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2??[])}function F(t,e){if(!e)throw new Error("threadId is required");return t.query({query:T,variables:{id:e},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2_by_pk)}function j(t,e){if(!e.message.trim())throw new Error("message must not be empty");return t.mutate({mutation:k,variables:e}).then(a=>{if(!a.data?.start_thread)throw new Error(a.error?.message||"Failed to start thread");return a.data.start_thread})}function I(t,e,a){if(!e)throw new Error("threadId is required");let _={thread_id:{_eq:e}};return a&&(a.eventId&&(_.thread_event_id=a.eventId),a.messageId&&(_._or=Y(a.messageId))),t.query({query:P,variables:{where:_,limit:a?.limit,ordering:a?.ordering||"asc"},fetchPolicy:"no-cache"}).then(r=>r.data?.thread_events??[])}function V(t,e){if(!e.threadId)throw new Error("threadId is required");if(!e.message.trim())throw new Error("message must not be empty");return t.mutate({mutation:B,variables:e}).then(a=>{if(!a.data?.send_thread_message)throw new Error(a.error?.message||"Failed to send message to thread");return a.data.send_thread_message})}function W(t,e){if(!e.threadId)throw new Error("threadId is required");if(!e.messageId.trim())throw new Error("messageId is required");return t.mutate({mutation:C,variables:e}).then(a=>{if(!a.data?.cancel_agent_message)throw new Error(a.error?.message||"Failed to cancel thread");return a.data.cancel_agent_message})}function N(t,e,a){if(!e)throw new Error("threadId is required");m(a);let _={thread_id:{_eq:e}};return a&&(_.thread_event_id={_gte:a}),t.subscribe({query:R,variables:{where:_}}).pipe(H(r=>{if(r.error)throw r.error;return r.data?.thread_events??[]}))}function z(t,e,a){if(!e)throw new Error("threadId is required");let _,r=m(a?.fromEventId),i={eventId:a?.fromEventId?{_gte:r}:void 0,messageId:a?.messageId},o=a?.pollingInterval&&a?.pollingInterval>0?a.pollingInterval:5;return K(async()=>{let n=_?{messageId:a?.messageId,eventId:{_gt:_}}:i,p=await I(t,e,n);return p.length>0&&(_=p[p.length-1]?.thread_event_id),p}).pipe($({count:a?.timeout&&a.timeout>0?Math.ceil(a.timeout/o):void 0,delay:o*1e3}),Z(n=>X(n,a?.skipAnalysis),!0))}function X(t,e){for(let a=t.length-1;a>0;a--){let _=t[a];if(e&&"UserCancel"in _.event_data)return!1;if(!("AgentMessage"in _.event_data))return!0;let r=_.event_data.AgentMessage.update;if("content"in r&&("interaction_finished"in r.content||e&&"interaction_update"in r.content&&"main_agent"in r.content.interaction_update&&"completed"in r.content.interaction_update.main_agent)||"InteractionFinished"in r||e&&"OrchestratorUpdate"in r&&"GeneratedResponse"in r.OrchestratorUpdate.update)return!1}return!0}function Y(t){return[{event_data:{_contains:{UserMessage:{message_id:t}}}},{event_data:{_contains:{AgentMessage:{message_id:t}}}},{event_data:{_contains:{UserCancel:{message_id:t}}}}]}function q(t){return t!=null&&typeof t=="object"&&"status"in t&&t.status==="failure"}function G(t){return t!=null&&typeof t=="object"&&"status"in t&&t.status==="success"&&"token"in t}function D(t){return t!=null&&typeof t=="object"&&("data"in t&&!!t.data&&typeof t.data=="object"&&"enrich_token"in t.data&&!!t.data.enrich_token&&typeof t.data.enrich_token=="object"&&"userDirectoryJWT"in t.data.enrich_token||"errors"in t&&Array.isArray(t.errors))}function M(t){let a=`${y(t.authHost)||"https://auth.pro.hasura.io"}/ddn/promptql/token`,_={token:"",expiry:new Date(0)},r=t.fetch||fetch,i=async()=>{let o=await r(a,{method:"POST",headers:t.headers});switch(o.status){case 200:{let n=await o.json();if(G(n))return n;throw new Error("malformed token response")}case 401:{let n=await o.json();throw q(n)?new Error(n?.error||o.statusText):new Error(o.statusText)}default:{let n=await o.text();throw new Error(n)}}};return async()=>{if(_.expiry.getTime()<=Date.now()-1e3){let o=await i(),n=await ee(t.promptqlGraphQLUrl,o.token,t.projectId,r);_.token=n;let p=new Date(o.expiry);if(Number.isNaN(p.getTime())){let d=new Date;d.setHours(1),_.expiry=d}else _.expiry=p}return _.token}}var ee=async(t,e,a,_=fetch)=>{let r=await _(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:"mutation EnrichToken($luxJWT: String!, $projectId: uuid) { enrich_token(luxJWT: $luxJWT, projectId: $projectId) { userDirectoryJWT }}",variables:{luxJWT:e,projectId:a},operationName:"EnrichToken"})});switch(r.status){case 200:{let i=await r.json();if(!D(i)||!i.data?.enrich_token?.userDirectoryJWT)throw new Error(`malformed promptql token response: ${JSON.stringify(i)}`);return i.data.enrich_token.userDirectoryJWT}default:{let i=await r.text();throw new Error(i)}}};function Q(t){return{Authorization:`pat ${t}`}}import{ApolloClient as te,ApolloLink as ae,HttpLink as re,InMemoryCache as _e}from"@apollo/client";import{SetContextLink as ne}from"@apollo/client/link/context";import{GraphQLWsLink as ie}from"@apollo/client/link/subscriptions";import{OperationTypeNode as oe}from"graphql";import{createClient as pe}from"graphql-ws";var J=t=>{let e=new re({uri:t.url,fetch:t.fetch,headers:t.headers}),a=async n=>{let p=await t.getAuthToken();return{headers:{...n,Authorization:`Bearer ${p}`}}},_=pe({url:t.url,connectionParams:()=>a(t.headers),lazy:!0}),r=new ie(_),i=new ne(({headers:n})=>a(n)),o=ae.split(({operationType:n})=>n===oe.SUBSCRIPTION,r,i.concat(e));return{client:new te({link:o,cache:new _e}),wsClient:_}};var c=class{_options;constructor(e){this._options=e}info(){return g(this._options.client)}};function g(t){return t.query({query:O,fetchPolicy:"cache-first"}).then(e=>{if(!e.data?.get_project_info)throw new Error(e.error?.message||"Project not found");return e.data.get_project_info})}var l=class{_options;constructor(e){this._options=e}list(e){return U(this._options.client,{...e,limit:e.limit&&e.limit>0?e.limit:10})}};var b=class{_options;constructor(e){this._options=e}list(e){return w(this._options.client,{...e,limit:e.limit&&e.limit>0?e.limit:10})}get(e){if(!e)throw new Error("threadId is required");return F(this._options.client,e)}async start(e){let a=await g(this._options.client);return j(this._options.client,{...e,projectId:a.projectId,buildId:e.buildId||this._options.buildId,timezone:e.timezone||this._options.defaultTimezone})}getEvents(e,a){return I(this._options.client,e,a)}sendMessage(e){return V(this._options.client,{...e,timezone:e.timezone||this._options.defaultTimezone})}cancelAgentMessage(e){return W(this._options.client,e)}subscribeEvents(e,a){return N(this._options.client,e,a)}streamMessageEvents(e,a){return z(this._options.client,e,a)}};var L=class{constructor(e){let a=y(e.promptqlBaseUrl)||"https://promptql.ddn.hasura.app";if(!e.serviceAccountToken)throw new Error("serviceAccountToken must not be empty. If you haven't created any service account token yet, check out Hasura docs https://hasura.io/docs/3.0/project-configuration/project-management/service-accounts/#how-to-create-service-account");let _=a.endsWith("/v1/graphql")?a:`${a}/playground-v2-hge/v1/graphql`;this._fetchToken=M({promptqlGraphQLUrl:_,authHost:e.authHost,headers:Q(e.serviceAccountToken),fetch:e.fetch});let{client:r,wsClient:i}=J({getAuthToken:this._fetchToken,url:_,fetch:e.fetch,headers:e.headers});this._wsClient=i,this._options={client:r,buildId:e.buildId,defaultTimezone:e.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone},this.thread=new b(this._options),this.project=new c(this._options),this.room=new l(this._options)}_options;_wsClient;_fetchToken;thread;project;room;authenticated(){return this._fetchToken().then(()=>!0).catch(()=>!1)}close(){this._wsClient.dispose(),this._options.client.clearStore()}};function nt(t,e){if(!e.length)return[];if(!t.length)return e;let a=t[t.length-1];if(!a)return e;let _=BigInt(a.thread_event_id),r=e.length-1;for(;r>=0;r--){let i=e[r];if(BigInt(i?.thread_event_id)<=_)break}return e.slice(r+1)}function it(t){return"UserMessage"in t?t.UserMessage:null}function ot(t){return"UserCancel"in t?t.UserCancel:null}function pt(t){return!("AgentMessage"in t)||!("OrchestratorUpdate"in t.AgentMessage.update)||!("PlanGenerationStarted"in t.AgentMessage.update.OrchestratorUpdate.update)?null:t.AgentMessage.update.OrchestratorUpdate.update.PlanGenerationStarted}function ut(t){let e=A(t);return!e||!("PlanStepGenerated"in e)?null:e.PlanStepGenerated}function st(t){return"AgentMessage"in t?"content"in t.AgentMessage.update&&"interaction_update"in t.AgentMessage.update.content&&"main_agent"in t.AgentMessage.update.content.interaction_update&&"completed"in t.AgentMessage.update.content.interaction_update.main_agent?{success:!0,message:t.AgentMessage.update.content.interaction_update.main_agent.completed.summary,modified_artifacts:[],generated_at:t.AgentMessage.update.timestamp}:!("OrchestratorUpdate"in t.AgentMessage.update)||!("GeneratedResponse"in t.AgentMessage.update.OrchestratorUpdate.update)?null:t.AgentMessage.update.OrchestratorUpdate.update.GeneratedResponse.response:null}function dt(t){return!("AgentMessage"in t)||!("MessageProcessingUpdate"in t.AgentMessage.update)||!("ProcessingStarted"in t.AgentMessage.update.MessageProcessingUpdate.update)?null:t.AgentMessage.update.MessageProcessingUpdate.update.ProcessingStarted}function yt(t){return!("AgentMessage"in t)||!("MessageProcessingUpdate"in t.AgentMessage.update)||!("InteractionDecision"in t.AgentMessage.update.MessageProcessingUpdate.update)||!("AcceptInteraction"in t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.AcceptInteraction}function ct(t){return!("AgentMessage"in t)||!("MessageProcessingUpdate"in t.AgentMessage.update)||!("InteractionDecision"in t.AgentMessage.update.MessageProcessingUpdate.update)||!("DeclineInteraction"in t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.DeclineInteraction}function S(t){return!("AgentMessage"in t)||!("PlanningDecisionUpdate"in t.AgentMessage.update)?null:t.AgentMessage.update.PlanningDecisionUpdate.update}function lt(t){let e=S(t);return!e||!("Started"in e)?null:e.Started}function bt(t){let e=S(t);return!e||!("Completed"in e)?null:e.Completed}function mt(t){let e=S(t);return!e||!("PlanningRequired"in e)?null:e.PlanningRequired}function It(t){return!("AgentMessage"in t)||!("StartingOrchestrator"in t.AgentMessage.update)?null:t.AgentMessage.update.StartingOrchestrator}function A(t){return!("AgentMessage"in t)||!("OrchestratorUpdate"in t.AgentMessage.update)?null:t.AgentMessage.update.OrchestratorUpdate.update}function s(t){let e=A(t);return!e||!("ContextExplorerUpdate"in e)?null:e.ContextExplorerUpdate.update}function Mt(t){let e=s(t);return!e||!("Started"in e)?null:e.Started}function gt(t){let e=s(t);return!e||!("Completed"in e)?null:e.Completed}function h(t){let e=s(t);return!e||!("WikiExplorerUpdate"in e)?null:e.WikiExplorerUpdate.update}function St(t){let e=h(t);return!e||!("Started"in e)?null:e.Started}function At(t){let e=h(t);return!e||!("Completed"in e)?null:e.Completed}function ht(t){let e=h(t);return!e||!("WikiInfoGenerated"in e)?null:e.WikiInfoGenerated}function x(t){let e=s(t);return!e||!("SchemaTasksGenerationUpdate"in e)?null:e.SchemaTasksGenerationUpdate.update}function xt(t){let e=x(t);return!e||!("Started"in e)?null:e.Started}function ft(t){let e=x(t);return!e||!("Completed"in e)?null:e.Completed}function Ct(t){let e=x(t);return!e||!("TasksGenerated"in e)?null:e.TasksGenerated}function u(t){let e=s(t);return!e||!("SchemaExplorerUpdate"in e)?null:e.SchemaExplorerUpdate.update}function Bt(t){let e=u(t);return!e||!("Started"in e)?null:e.Started}function kt(t){let e=u(t);return!e||!("Completed"in e)?null:e.Completed}function Ot(t){let e=u(t);return!e||!("CodeExecutionComplete"in e)?null:e.CodeExecutionComplete}function vt(t){let e=u(t);return!e||!("CodeOutputAnalyzed"in e)?null:e.CodeOutputAnalyzed}function Et(t){let e=u(t);return!e||!("GeneratedCode"in e)?null:e.GeneratedCode}function Tt(t){let e=u(t);return!e||!("SchemaExplored"in e)?null:e.SchemaExplored}function f(t){let e=A(t);return!e||!("StepUpdate"in e)?null:e.StepUpdate}function Pt(t){let e=f(t);return!e||!("Programmer"in e.update)?null:e.update.Programmer}function Rt(t){let e=f(t);return!e||!("UiProgrammer"in e.update)?null:e.update.UiProgrammer}function Ut(t){let e=f(t);return!e||!("SavedProgramRunner"in e.update)?null:e.update.SavedProgramRunner}function wt(t){if(!("AgentMessage"in t))return null;if("InteractionFinished"in t.AgentMessage.update){let e=t.AgentMessage.update.InteractionFinished.update;return"Completed"in e?{status:"completed",timestamp:e.Completed.completed_at,warnings:e.Completed.warnings}:"Errored"in e?{status:"errored",timestamp:e.Errored.errored_at,reason:typeof e.Errored.error=="string"?e.Errored.error:e.Errored.error.User.message}:"UserCancelled"in e?{status:"user_cancelled",timestamp:e.UserCancelled.cancelled_at}:"AgentDeclined"in e?{status:"agent_declined",timestamp:e.AgentDeclined.declined_at,reason:e.AgentDeclined.reason}:"ServerCancelled"in e?{status:"server_cancelled",timestamp:e.ServerCancelled.cancelled_at}:{status:"unknown"}}if("content"in t.AgentMessage.update&&"interaction_finished"in t.AgentMessage.update.content){let e=t.AgentMessage.update.content.interaction_finished.outcome;return"errored"in e?{status:"errored",reason:e.errored.user_facing_message||e.errored.raw_error,timestamp:t.AgentMessage.update.timestamp,warnings:e.errored.raw_error?[{message:e.errored.raw_error}]:[]}:"server_cancelled"in e?{status:"server_cancelled",timestamp:t.AgentMessage.update.timestamp}:"user_cancelled"in e?{status:"user_cancelled",timestamp:t.AgentMessage.update.timestamp}:"completed"in e?{status:"completed",timestamp:t.AgentMessage.update.timestamp,warnings:e.completed.warnings}:{status:"unknown"}}return null}function Ft(t){if(t){if("UserMessage"in t)return t.UserMessage.message_id;if("AgentMessage"in t)return t.AgentMessage.message_id;if("UserTeach"in t)return t.UserTeach.agent_message_id;if("UserCancel"in t)return t.UserCancel.message_id}}export{L as PromptQLSdk,W as cancelAgentMessage,J as createApolloClient,M as createPromptQLAuthTokenGenerator,nt as diffThreadEvents,ue as downloadArtifactData,st as getAgentGeneratedResponse,yt as getAgentInteractionDecisionAcceptInteractionEvent,ct as getAgentInteractionDecisionDeclineInteractionEvent,wt as getAgentInteractionFinishedEvent,dt as getAgentMessageProcessingStartedEvent,gt as getAgentOrchestratorContextExplorerCompletedEvent,Mt as getAgentOrchestratorContextExplorerStartedEvent,s as getAgentOrchestratorContextExplorerUpdateEvent,Ot as getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent,vt as getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent,kt as getAgentOrchestratorSchemaExplorerCompletedEvent,Et as getAgentOrchestratorSchemaExplorerGeneratedCodeEvent,Tt as getAgentOrchestratorSchemaExplorerSchemaExploredEvent,Bt as getAgentOrchestratorSchemaExplorerStartedEvent,u as getAgentOrchestratorSchemaExplorerUpdateEvent,Ct as getAgentOrchestratorSchemaTasksGeneratedEvent,ft as getAgentOrchestratorSchemaTasksGenerationCompletedEvent,xt as getAgentOrchestratorSchemaTasksGenerationStartedEvent,x as getAgentOrchestratorSchemaTasksGenerationUpdateEvent,Pt as getAgentOrchestratorStepProgrammerEvent,Ut as getAgentOrchestratorStepSavedProgramRunnerEvent,Rt as getAgentOrchestratorStepUiProgrammerEvent,f as getAgentOrchestratorStepUpdateEvent,A as getAgentOrchestratorUpdateEvent,At as getAgentOrchestratorWikiExplorerCompletedEvent,St as getAgentOrchestratorWikiExplorerStartedEvent,h as getAgentOrchestratorWikiExplorerUpdateEvent,ht as getAgentOrchestratorWikiInfoGeneratedEvent,pt as getAgentPlanGenerationStartedEvent,ut as getAgentPlanStepGeneratedEvent,bt as getAgentPlanningDecisionCompletedEvent,mt as getAgentPlanningDecisionPlanningRequiredEvent,lt as getAgentPlanningDecisionStartedEvent,S as getAgentPlanningDecisionUpdateEvent,It as getAgentStartingOrchestratorEvent,F as getThread,Ft as getThreadEventMessageId,I as getThreadEvents,ot as getUserCancelEvent,it as getUserMessageEvent,X as isInteractionAnalyzing,U as listRooms,w as listThreads,V as sendThreadMessage,j as startThread,z as streamThreadMessageEvents,N as subscribeThreadEvents};
|
package/package.json
CHANGED