@hasura/promptql 2.0.0-alpha.23 → 2.0.0-alpha.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -61,7 +61,6 @@ import { PromptQLSdk } from '@hasura/promptql';
61
61
 
62
62
  // Initialize the SDK
63
63
  const sdk = new PromptQLSdk({
64
- projectId: 'your-project-id',
65
64
  serviceAccountToken: 'your-service-account-token',
66
65
  });
67
66
 
package/dist/index.d.mts CHANGED
@@ -3621,12 +3621,6 @@ type Boolean_Comparison_Exp = {
3621
3621
  _neq?: InputMaybe<Scalars['Boolean']['input']>;
3622
3622
  _nin?: InputMaybe<Array<Scalars['Boolean']['input']>>;
3623
3623
  };
3624
- type GetProjectInfoOutput = {
3625
- __typename?: 'GetProjectInfoOutput';
3626
- projectId: Scalars['String']['output'];
3627
- projectName: Scalars['String']['output'];
3628
- promptqlConsoleUrl: Scalars['String']['output'];
3629
- };
3630
3624
  /** Boolean expression to compare columns of type "Int". All fields are combined with logical 'AND'. */
3631
3625
  type Int_Comparison_Exp = {
3632
3626
  _eq?: InputMaybe<Scalars['Int']['input']>;
@@ -3821,6 +3815,21 @@ type Custom_Claim_Owners_Bool_Exp = {
3821
3815
  owner?: InputMaybe<Promptql_Users_Bool_Exp>;
3822
3816
  owner_id?: InputMaybe<Uuid_Comparison_Exp>;
3823
3817
  };
3818
+ /** Boolean expression to filter rows from the table "feed_candidate_selected_messages". All fields are combined with a logical 'AND'. */
3819
+ type Feed_Candidate_Selected_Messages_Bool_Exp = {
3820
+ _and?: InputMaybe<Array<Feed_Candidate_Selected_Messages_Bool_Exp>>;
3821
+ _not?: InputMaybe<Feed_Candidate_Selected_Messages_Bool_Exp>;
3822
+ _or?: InputMaybe<Array<Feed_Candidate_Selected_Messages_Bool_Exp>>;
3823
+ created_at?: InputMaybe<Timestamptz_Comparison_Exp>;
3824
+ display_text?: InputMaybe<String_Comparison_Exp>;
3825
+ feed_candidate?: InputMaybe<Social_Feed_Candidates_Bool_Exp>;
3826
+ feed_candidate_id?: InputMaybe<Uuid_Comparison_Exp>;
3827
+ id?: InputMaybe<Bigint_Comparison_Exp>;
3828
+ message_id?: InputMaybe<String_Comparison_Exp>;
3829
+ message_type?: InputMaybe<String_Comparison_Exp>;
3830
+ thread_event?: InputMaybe<Thread_Events_Bool_Exp>;
3831
+ thread_event_id?: InputMaybe<Bigint_Comparison_Exp>;
3832
+ };
3824
3833
  type Jsonb_Cast_Exp = {
3825
3834
  String?: InputMaybe<String_Comparison_Exp>;
3826
3835
  };
@@ -4357,6 +4366,7 @@ type Social_Feed_Candidates_Bool_Exp = {
4357
4366
  created_at?: InputMaybe<Timestamptz_Comparison_Exp>;
4358
4367
  id?: InputMaybe<Uuid_Comparison_Exp>;
4359
4368
  llm_output?: InputMaybe<Jsonb_Comparison_Exp>;
4369
+ selected_messages?: InputMaybe<Feed_Candidate_Selected_Messages_Bool_Exp>;
4360
4370
  summary?: InputMaybe<String_Comparison_Exp>;
4361
4371
  thread?: InputMaybe<Threads_V2_Bool_Exp>;
4362
4372
  thread_event_id?: InputMaybe<Bigint_Comparison_Exp>;
@@ -5333,6 +5343,7 @@ type GetThreadsQueryVariables = Exact<{
5333
5343
  order_by?: InputMaybe<Array<Threads_V2_Order_By> | Threads_V2_Order_By>;
5334
5344
  }>;
5335
5345
 
5346
+ declare const USER_AGENT = "PromptQL TypeScript SDK";
5336
5347
  /**
5337
5348
  * Options to initialize a PromptQL SDK client.
5338
5349
  */
@@ -5342,10 +5353,9 @@ type PromptQLSdkOptions = {
5342
5353
  */
5343
5354
  authHost?: string;
5344
5355
  /**
5345
- * Base URL of the PromptQL data plane. You can find it in Project Settings > PromptQL > PromptQL API on https://prompt.ql.app.
5346
- * The base URL must remove the request path, For example: https://promptql.ddn.hasura.app.
5356
+ * Base URL of the Hasura control plane.
5347
5357
  */
5348
- promptqlBaseUrl?: string;
5358
+ controlPlaneUrl?: string;
5349
5359
  /**
5350
5360
  * Service account token of the PromptQL project.
5351
5361
  * Check out Hasura docs https://hasura.io/docs/3.0/project-configuration/project-management/service-accounts/#how-to-create-service-account to know how to create a token.
@@ -5521,11 +5531,50 @@ type CreateRoomArguments = Omit<CreateRoomMutationVariables, "visibility"> & {
5521
5531
  * Regular expression for validating room name.
5522
5532
  */
5523
5533
  declare const ROOM_NAME_PATTERN: RegExp;
5534
+ /**
5535
+ * Metadata response of an artifact.
5536
+ */
5537
+ type ArtifactMetadata = {
5538
+ artifact_id: string;
5539
+ version: number;
5540
+ title: string;
5541
+ description: string | null;
5542
+ artifact_type: ArtifactType2;
5543
+ user_id: string;
5544
+ metadata: unknown;
5545
+ project_id: string;
5546
+ created_at: string;
5547
+ size_bytes: number;
5548
+ scope?: {
5549
+ type: string;
5550
+ project_id: string;
5551
+ thread_id: string;
5552
+ thread_owner_user_id: string;
5553
+ };
5554
+ };
5555
+ /**
5556
+ * Project Info Output.
5557
+ */
5558
+ type ProjectInfoOutput = {
5559
+ projectId: string;
5560
+ projectName: string;
5561
+ projectHost: string;
5562
+ promptqlGraphQLUrl: string;
5563
+ promptqlConsoleUrl: string;
5564
+ };
5524
5565
 
5525
5566
  /**
5526
5567
  * Download artifact data.
5527
5568
  */
5528
5569
  declare function downloadArtifactData(host: string, artifactId: string, version: number, headers: Record<string, string>, customFetch?: typeof fetch): Promise<unknown>;
5570
+ /**
5571
+ * List artifacts by thread ID.
5572
+ */
5573
+ declare function listArtifactMetadataByThreadId(client: ApolloClient, projectId: string, threadId: string): Promise<ArtifactMetadata[]>;
5574
+ /**
5575
+ * Get artifact metadata by ID and version.
5576
+ */
5577
+ declare function getArtifactMetadata(host: string, artifactId: string, version: number, headers: Record<string, string>, customFetch?: typeof fetch): Promise<ArtifactMetadata>;
5529
5578
 
5530
5579
  /**
5531
5580
  * List rooms of the current project.The default limit is 10.
@@ -5588,32 +5637,67 @@ type PromptQLAuthTokenGeneratorOptions = {
5588
5637
  declare function createPromptQLAuthTokenGenerator(options: PromptQLAuthTokenGeneratorOptions): () => Promise<string>;
5589
5638
 
5590
5639
  /**
5591
- * Internal client options.
5640
+ * A low-level API class for PromptQL.
5592
5641
  */
5593
- type ClientOptions = {
5594
- client: ApolloClient;
5595
- buildId?: string;
5642
+ declare class PromptQLApi {
5643
+ controlPlaneUrl: string;
5644
+ options: PromptQLSdkOptions;
5596
5645
  defaultTimezone: string;
5597
- };
5646
+ private getAuthTokenFn;
5647
+ private project;
5648
+ private client;
5649
+ private wsClient;
5650
+ constructor(options: PromptQLSdkOptions);
5651
+ getAuthToken(): Promise<string>;
5652
+ getGraphQLClient(): Promise<ApolloClient>;
5653
+ /**
5654
+ * Get the basic information of the current PromptQL project.
5655
+ */
5656
+ getProjectInfo(): Promise<ProjectInfoOutput>;
5657
+ /**
5658
+ * Stop the GraphQL client and cleanup resources.
5659
+ */
5660
+ close(): void;
5661
+ }
5662
+
5663
+ /**
5664
+ * Artifact class implements the set of PromptQL artifact APIs.
5665
+ */
5666
+ declare class Artifact {
5667
+ private api;
5668
+ constructor(api: PromptQLApi);
5669
+ /**
5670
+ * List artifacts by thread ID.
5671
+ */
5672
+ listMetadataByThreadId(threadId: string): Promise<ArtifactMetadata[]>;
5673
+ /**
5674
+ * Download artifact data.
5675
+ */
5676
+ download(artifactId: string, version: number): Promise<unknown>;
5677
+ /**
5678
+ * Get artifact metadata.
5679
+ */
5680
+ getMetadata(artifactId: string, version: number): Promise<unknown>;
5681
+ }
5598
5682
 
5599
5683
  /**
5600
5684
  * Project class implements the set of PromptQL project APIs.
5601
5685
  */
5602
5686
  declare class Project {
5603
- private _options;
5604
- constructor(options: ClientOptions);
5687
+ private api;
5688
+ constructor(api: PromptQLApi);
5605
5689
  /**
5606
5690
  * Get the basic information of the current PromptQL project.
5607
5691
  */
5608
- info(): Promise<GetProjectInfoOutput>;
5692
+ info(): Promise<ProjectInfoOutput>;
5609
5693
  }
5610
5694
 
5611
5695
  /**
5612
5696
  * Room class implements the set of PromptQL room APIs.
5613
5697
  */
5614
5698
  declare class Room {
5615
- private _options;
5616
- constructor(options: ClientOptions);
5699
+ private api;
5700
+ constructor(api: PromptQLApi);
5617
5701
  /**
5618
5702
  * List PromptQL rooms. The default limit is 10.
5619
5703
  */
@@ -5632,8 +5716,8 @@ declare class Room {
5632
5716
  * Project class implements the set of PromptQL thread APIs.
5633
5717
  */
5634
5718
  declare class Thread {
5635
- private _options;
5636
- constructor(options: ClientOptions);
5719
+ private api;
5720
+ constructor(api: PromptQLApi);
5637
5721
  /**
5638
5722
  * List threads of the current project. The default limit is 10.
5639
5723
  */
@@ -5675,16 +5759,11 @@ declare class Thread {
5675
5759
  */
5676
5760
  declare class PromptQLSdk {
5677
5761
  constructor(options: PromptQLSdkOptions);
5678
- private _options;
5679
- private _wsClient;
5680
- private _fetchToken;
5762
+ private api;
5681
5763
  readonly thread: Thread;
5682
5764
  readonly project: Project;
5683
5765
  readonly room: Room;
5684
- /**
5685
- * Check if the PromptQL SDK instance is authenticated.
5686
- */
5687
- authenticated(): Promise<boolean>;
5766
+ readonly artifact: Artifact;
5688
5767
  /**
5689
5768
  * Stop the GraphQL client and cleanup resources.
5690
5769
  */
@@ -5865,6 +5944,7 @@ type InteractionOutcomeStatus = KeysOfUnion<InteractionOutcome> | "agent_decline
5865
5944
  * The common output of the interaction finished event after evaluated from event v2 or v3.
5866
5945
  */
5867
5946
  type InteractionFinishedEvent = {
5947
+ messageId: string;
5868
5948
  status: InteractionOutcomeStatus | "unknown";
5869
5949
  reason?: string;
5870
5950
  timestamp?: string;
@@ -5878,5 +5958,9 @@ declare function getAgentInteractionFinishedEvent(eventData: ThreadEvent$1): Int
5878
5958
  * Get the message_id from the thread event data.
5879
5959
  */
5880
5960
  declare function getThreadEventMessageId(event: ThreadEvent$1 | undefined): string | undefined;
5961
+ /**
5962
+ * Build PromptQL URL from fqdn.
5963
+ */
5964
+ declare function buildPromptQLUrl(fqdn: string): string;
5881
5965
 
5882
- 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 CreateRoomArguments, 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, ROOM_NAME_PATTERN, type ResponseGenerationState, type ResponseGenerationUpdate, type ResponseTruncation, type RoomFragment, type RoomVisibilityType, 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 Sql, type SqlError, type SqlErrorType, type SqlErrorV1, type SqlExecuteCompleted, type SqlExecuteCompletedV1, type SqlExecuteOutcome, type SqlExecuteOutcome2, type SqlExecuteStarted, type SqlExecuteStartedV1, type SqlQueryId, 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, createRoom, 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 };
5966
+ 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 ArtifactMetadata, 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 CreateRoomArguments, 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, type ProjectInfoOutput, PromptQLSdk, type PromptQLSdkOptions, type PromptQlConfigFeatureFlagModel, type PromptQlUserId, type PythonRunStepDetails, type PythonStep, ROOM_NAME_PATTERN, type ResponseGenerationState, type ResponseGenerationUpdate, type ResponseTruncation, type RoomFragment, type RoomVisibilityType, 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 Sql, type SqlError, type SqlErrorType, type SqlErrorV1, type SqlExecuteCompleted, type SqlExecuteCompletedV1, type SqlExecuteOutcome, type SqlExecuteOutcome2, type SqlExecuteStarted, type SqlExecuteStartedV1, type SqlQueryId, 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, USER_AGENT, 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, buildPromptQLUrl, cancelAgentMessage, createApolloClient, createPromptQLAuthTokenGenerator, createRoom, 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, getArtifactMetadata, getThread, getThreadEventMessageId, getThreadEvents, getUserCancelEvent, getUserMessageEvent, isInteractionAnalyzing, listArtifactMetadataByThreadId, listRooms, listThreads, sendThreadMessage, startThread, streamThreadMessageEvents, subscribeThreadEvents };
package/dist/index.d.ts CHANGED
@@ -3621,12 +3621,6 @@ type Boolean_Comparison_Exp = {
3621
3621
  _neq?: InputMaybe<Scalars['Boolean']['input']>;
3622
3622
  _nin?: InputMaybe<Array<Scalars['Boolean']['input']>>;
3623
3623
  };
3624
- type GetProjectInfoOutput = {
3625
- __typename?: 'GetProjectInfoOutput';
3626
- projectId: Scalars['String']['output'];
3627
- projectName: Scalars['String']['output'];
3628
- promptqlConsoleUrl: Scalars['String']['output'];
3629
- };
3630
3624
  /** Boolean expression to compare columns of type "Int". All fields are combined with logical 'AND'. */
3631
3625
  type Int_Comparison_Exp = {
3632
3626
  _eq?: InputMaybe<Scalars['Int']['input']>;
@@ -3821,6 +3815,21 @@ type Custom_Claim_Owners_Bool_Exp = {
3821
3815
  owner?: InputMaybe<Promptql_Users_Bool_Exp>;
3822
3816
  owner_id?: InputMaybe<Uuid_Comparison_Exp>;
3823
3817
  };
3818
+ /** Boolean expression to filter rows from the table "feed_candidate_selected_messages". All fields are combined with a logical 'AND'. */
3819
+ type Feed_Candidate_Selected_Messages_Bool_Exp = {
3820
+ _and?: InputMaybe<Array<Feed_Candidate_Selected_Messages_Bool_Exp>>;
3821
+ _not?: InputMaybe<Feed_Candidate_Selected_Messages_Bool_Exp>;
3822
+ _or?: InputMaybe<Array<Feed_Candidate_Selected_Messages_Bool_Exp>>;
3823
+ created_at?: InputMaybe<Timestamptz_Comparison_Exp>;
3824
+ display_text?: InputMaybe<String_Comparison_Exp>;
3825
+ feed_candidate?: InputMaybe<Social_Feed_Candidates_Bool_Exp>;
3826
+ feed_candidate_id?: InputMaybe<Uuid_Comparison_Exp>;
3827
+ id?: InputMaybe<Bigint_Comparison_Exp>;
3828
+ message_id?: InputMaybe<String_Comparison_Exp>;
3829
+ message_type?: InputMaybe<String_Comparison_Exp>;
3830
+ thread_event?: InputMaybe<Thread_Events_Bool_Exp>;
3831
+ thread_event_id?: InputMaybe<Bigint_Comparison_Exp>;
3832
+ };
3824
3833
  type Jsonb_Cast_Exp = {
3825
3834
  String?: InputMaybe<String_Comparison_Exp>;
3826
3835
  };
@@ -4357,6 +4366,7 @@ type Social_Feed_Candidates_Bool_Exp = {
4357
4366
  created_at?: InputMaybe<Timestamptz_Comparison_Exp>;
4358
4367
  id?: InputMaybe<Uuid_Comparison_Exp>;
4359
4368
  llm_output?: InputMaybe<Jsonb_Comparison_Exp>;
4369
+ selected_messages?: InputMaybe<Feed_Candidate_Selected_Messages_Bool_Exp>;
4360
4370
  summary?: InputMaybe<String_Comparison_Exp>;
4361
4371
  thread?: InputMaybe<Threads_V2_Bool_Exp>;
4362
4372
  thread_event_id?: InputMaybe<Bigint_Comparison_Exp>;
@@ -5333,6 +5343,7 @@ type GetThreadsQueryVariables = Exact<{
5333
5343
  order_by?: InputMaybe<Array<Threads_V2_Order_By> | Threads_V2_Order_By>;
5334
5344
  }>;
5335
5345
 
5346
+ declare const USER_AGENT = "PromptQL TypeScript SDK";
5336
5347
  /**
5337
5348
  * Options to initialize a PromptQL SDK client.
5338
5349
  */
@@ -5342,10 +5353,9 @@ type PromptQLSdkOptions = {
5342
5353
  */
5343
5354
  authHost?: string;
5344
5355
  /**
5345
- * Base URL of the PromptQL data plane. You can find it in Project Settings > PromptQL > PromptQL API on https://prompt.ql.app.
5346
- * The base URL must remove the request path, For example: https://promptql.ddn.hasura.app.
5356
+ * Base URL of the Hasura control plane.
5347
5357
  */
5348
- promptqlBaseUrl?: string;
5358
+ controlPlaneUrl?: string;
5349
5359
  /**
5350
5360
  * Service account token of the PromptQL project.
5351
5361
  * Check out Hasura docs https://hasura.io/docs/3.0/project-configuration/project-management/service-accounts/#how-to-create-service-account to know how to create a token.
@@ -5521,11 +5531,50 @@ type CreateRoomArguments = Omit<CreateRoomMutationVariables, "visibility"> & {
5521
5531
  * Regular expression for validating room name.
5522
5532
  */
5523
5533
  declare const ROOM_NAME_PATTERN: RegExp;
5534
+ /**
5535
+ * Metadata response of an artifact.
5536
+ */
5537
+ type ArtifactMetadata = {
5538
+ artifact_id: string;
5539
+ version: number;
5540
+ title: string;
5541
+ description: string | null;
5542
+ artifact_type: ArtifactType2;
5543
+ user_id: string;
5544
+ metadata: unknown;
5545
+ project_id: string;
5546
+ created_at: string;
5547
+ size_bytes: number;
5548
+ scope?: {
5549
+ type: string;
5550
+ project_id: string;
5551
+ thread_id: string;
5552
+ thread_owner_user_id: string;
5553
+ };
5554
+ };
5555
+ /**
5556
+ * Project Info Output.
5557
+ */
5558
+ type ProjectInfoOutput = {
5559
+ projectId: string;
5560
+ projectName: string;
5561
+ projectHost: string;
5562
+ promptqlGraphQLUrl: string;
5563
+ promptqlConsoleUrl: string;
5564
+ };
5524
5565
 
5525
5566
  /**
5526
5567
  * Download artifact data.
5527
5568
  */
5528
5569
  declare function downloadArtifactData(host: string, artifactId: string, version: number, headers: Record<string, string>, customFetch?: typeof fetch): Promise<unknown>;
5570
+ /**
5571
+ * List artifacts by thread ID.
5572
+ */
5573
+ declare function listArtifactMetadataByThreadId(client: ApolloClient, projectId: string, threadId: string): Promise<ArtifactMetadata[]>;
5574
+ /**
5575
+ * Get artifact metadata by ID and version.
5576
+ */
5577
+ declare function getArtifactMetadata(host: string, artifactId: string, version: number, headers: Record<string, string>, customFetch?: typeof fetch): Promise<ArtifactMetadata>;
5529
5578
 
5530
5579
  /**
5531
5580
  * List rooms of the current project.The default limit is 10.
@@ -5588,32 +5637,67 @@ type PromptQLAuthTokenGeneratorOptions = {
5588
5637
  declare function createPromptQLAuthTokenGenerator(options: PromptQLAuthTokenGeneratorOptions): () => Promise<string>;
5589
5638
 
5590
5639
  /**
5591
- * Internal client options.
5640
+ * A low-level API class for PromptQL.
5592
5641
  */
5593
- type ClientOptions = {
5594
- client: ApolloClient;
5595
- buildId?: string;
5642
+ declare class PromptQLApi {
5643
+ controlPlaneUrl: string;
5644
+ options: PromptQLSdkOptions;
5596
5645
  defaultTimezone: string;
5597
- };
5646
+ private getAuthTokenFn;
5647
+ private project;
5648
+ private client;
5649
+ private wsClient;
5650
+ constructor(options: PromptQLSdkOptions);
5651
+ getAuthToken(): Promise<string>;
5652
+ getGraphQLClient(): Promise<ApolloClient>;
5653
+ /**
5654
+ * Get the basic information of the current PromptQL project.
5655
+ */
5656
+ getProjectInfo(): Promise<ProjectInfoOutput>;
5657
+ /**
5658
+ * Stop the GraphQL client and cleanup resources.
5659
+ */
5660
+ close(): void;
5661
+ }
5662
+
5663
+ /**
5664
+ * Artifact class implements the set of PromptQL artifact APIs.
5665
+ */
5666
+ declare class Artifact {
5667
+ private api;
5668
+ constructor(api: PromptQLApi);
5669
+ /**
5670
+ * List artifacts by thread ID.
5671
+ */
5672
+ listMetadataByThreadId(threadId: string): Promise<ArtifactMetadata[]>;
5673
+ /**
5674
+ * Download artifact data.
5675
+ */
5676
+ download(artifactId: string, version: number): Promise<unknown>;
5677
+ /**
5678
+ * Get artifact metadata.
5679
+ */
5680
+ getMetadata(artifactId: string, version: number): Promise<unknown>;
5681
+ }
5598
5682
 
5599
5683
  /**
5600
5684
  * Project class implements the set of PromptQL project APIs.
5601
5685
  */
5602
5686
  declare class Project {
5603
- private _options;
5604
- constructor(options: ClientOptions);
5687
+ private api;
5688
+ constructor(api: PromptQLApi);
5605
5689
  /**
5606
5690
  * Get the basic information of the current PromptQL project.
5607
5691
  */
5608
- info(): Promise<GetProjectInfoOutput>;
5692
+ info(): Promise<ProjectInfoOutput>;
5609
5693
  }
5610
5694
 
5611
5695
  /**
5612
5696
  * Room class implements the set of PromptQL room APIs.
5613
5697
  */
5614
5698
  declare class Room {
5615
- private _options;
5616
- constructor(options: ClientOptions);
5699
+ private api;
5700
+ constructor(api: PromptQLApi);
5617
5701
  /**
5618
5702
  * List PromptQL rooms. The default limit is 10.
5619
5703
  */
@@ -5632,8 +5716,8 @@ declare class Room {
5632
5716
  * Project class implements the set of PromptQL thread APIs.
5633
5717
  */
5634
5718
  declare class Thread {
5635
- private _options;
5636
- constructor(options: ClientOptions);
5719
+ private api;
5720
+ constructor(api: PromptQLApi);
5637
5721
  /**
5638
5722
  * List threads of the current project. The default limit is 10.
5639
5723
  */
@@ -5675,16 +5759,11 @@ declare class Thread {
5675
5759
  */
5676
5760
  declare class PromptQLSdk {
5677
5761
  constructor(options: PromptQLSdkOptions);
5678
- private _options;
5679
- private _wsClient;
5680
- private _fetchToken;
5762
+ private api;
5681
5763
  readonly thread: Thread;
5682
5764
  readonly project: Project;
5683
5765
  readonly room: Room;
5684
- /**
5685
- * Check if the PromptQL SDK instance is authenticated.
5686
- */
5687
- authenticated(): Promise<boolean>;
5766
+ readonly artifact: Artifact;
5688
5767
  /**
5689
5768
  * Stop the GraphQL client and cleanup resources.
5690
5769
  */
@@ -5865,6 +5944,7 @@ type InteractionOutcomeStatus = KeysOfUnion<InteractionOutcome> | "agent_decline
5865
5944
  * The common output of the interaction finished event after evaluated from event v2 or v3.
5866
5945
  */
5867
5946
  type InteractionFinishedEvent = {
5947
+ messageId: string;
5868
5948
  status: InteractionOutcomeStatus | "unknown";
5869
5949
  reason?: string;
5870
5950
  timestamp?: string;
@@ -5878,5 +5958,9 @@ declare function getAgentInteractionFinishedEvent(eventData: ThreadEvent$1): Int
5878
5958
  * Get the message_id from the thread event data.
5879
5959
  */
5880
5960
  declare function getThreadEventMessageId(event: ThreadEvent$1 | undefined): string | undefined;
5961
+ /**
5962
+ * Build PromptQL URL from fqdn.
5963
+ */
5964
+ declare function buildPromptQLUrl(fqdn: string): string;
5881
5965
 
5882
- 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 CreateRoomArguments, 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, ROOM_NAME_PATTERN, type ResponseGenerationState, type ResponseGenerationUpdate, type ResponseTruncation, type RoomFragment, type RoomVisibilityType, 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 Sql, type SqlError, type SqlErrorType, type SqlErrorV1, type SqlExecuteCompleted, type SqlExecuteCompletedV1, type SqlExecuteOutcome, type SqlExecuteOutcome2, type SqlExecuteStarted, type SqlExecuteStartedV1, type SqlQueryId, 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, createRoom, 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 };
5966
+ 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 ArtifactMetadata, 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 CreateRoomArguments, 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, type ProjectInfoOutput, PromptQLSdk, type PromptQLSdkOptions, type PromptQlConfigFeatureFlagModel, type PromptQlUserId, type PythonRunStepDetails, type PythonStep, ROOM_NAME_PATTERN, type ResponseGenerationState, type ResponseGenerationUpdate, type ResponseTruncation, type RoomFragment, type RoomVisibilityType, 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 Sql, type SqlError, type SqlErrorType, type SqlErrorV1, type SqlExecuteCompleted, type SqlExecuteCompletedV1, type SqlExecuteOutcome, type SqlExecuteOutcome2, type SqlExecuteStarted, type SqlExecuteStartedV1, type SqlQueryId, 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, USER_AGENT, 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, buildPromptQLUrl, cancelAgentMessage, createApolloClient, createPromptQLAuthTokenGenerator, createRoom, 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, getArtifactMetadata, getThread, getThreadEventMessageId, getThreadEvents, getUserCancelEvent, getUserMessageEvent, isInteractionAnalyzing, listArtifactMetadataByThreadId, listRooms, listThreads, sendThreadMessage, startThread, streamThreadMessageEvents, subscribeThreadEvents };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var B=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var oe=Object.prototype.hasOwnProperty;var pe=(t,e)=>{for(var a in e)B(t,a,{get:e[a],enumerable:!0})},ue=(t,e,a,_)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ie(e))!oe.call(t,r)&&r!==a&&B(t,r,{get:()=>e[r],enumerable:!(_=ne(e,r))||_.enumerable});return t};var se=t=>ue(B({},"__esModule",{value:!0}),t);var Ke={};pe(Ke,{PromptQLSdk:()=>W,ROOM_NAME_PATTERN:()=>k,cancelAgentMessage:()=>U,createApolloClient:()=>j,createPromptQLAuthTokenGenerator:()=>I,createRoom:()=>O,diffThreadEvents:()=>le,downloadArtifactData:()=>de,getAgentGeneratedResponse:()=>Se,getAgentInteractionDecisionAcceptInteractionEvent:()=>Ae,getAgentInteractionDecisionDeclineInteractionEvent:()=>xe,getAgentInteractionFinishedEvent:()=>Ge,getAgentMessageProcessingStartedEvent:()=>ge,getAgentOrchestratorContextExplorerCompletedEvent:()=>Oe,getAgentOrchestratorContextExplorerStartedEvent:()=>ke,getAgentOrchestratorContextExplorerUpdateEvent:()=>y,getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent:()=>je,getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent:()=>Ve,getAgentOrchestratorSchemaExplorerCompletedEvent:()=>Fe,getAgentOrchestratorSchemaExplorerGeneratedCodeEvent:()=>We,getAgentOrchestratorSchemaExplorerSchemaExploredEvent:()=>Ne,getAgentOrchestratorSchemaExplorerStartedEvent:()=>we,getAgentOrchestratorSchemaExplorerUpdateEvent:()=>d,getAgentOrchestratorSchemaTasksGeneratedEvent:()=>Ue,getAgentOrchestratorSchemaTasksGenerationCompletedEvent:()=>Re,getAgentOrchestratorSchemaTasksGenerationStartedEvent:()=>Pe,getAgentOrchestratorSchemaTasksGenerationUpdateEvent:()=>f,getAgentOrchestratorStepProgrammerEvent:()=>ze,getAgentOrchestratorStepSavedProgramRunnerEvent:()=>De,getAgentOrchestratorStepUiProgrammerEvent:()=>qe,getAgentOrchestratorStepUpdateEvent:()=>C,getAgentOrchestratorUpdateEvent:()=>x,getAgentOrchestratorWikiExplorerCompletedEvent:()=>Ee,getAgentOrchestratorWikiExplorerStartedEvent:()=>ve,getAgentOrchestratorWikiExplorerUpdateEvent:()=>h,getAgentOrchestratorWikiInfoGeneratedEvent:()=>Te,getAgentPlanGenerationStartedEvent:()=>Ie,getAgentPlanStepGeneratedEvent:()=>Me,getAgentPlanningDecisionCompletedEvent:()=>fe,getAgentPlanningDecisionPlanningRequiredEvent:()=>Ce,getAgentPlanningDecisionStartedEvent:()=>he,getAgentPlanningDecisionUpdateEvent:()=>A,getAgentStartingOrchestratorEvent:()=>Be,getThread:()=>T,getThreadEventMessageId:()=>Qe,getThreadEvents:()=>m,getUserCancelEvent:()=>me,getUserMessageEvent:()=>be,isInteractionAnalyzing:()=>$,listRooms:()=>l,listThreads:()=>E,sendThreadMessage:()=>R,startThread:()=>P,streamThreadMessageEvents:()=>F,subscribeThreadEvents:()=>w});module.exports=se(Ke);async function de(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 N={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"}}]}}]}}]},z={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateRoom"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"name"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"visibility"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"description"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"create_room"},arguments:[{kind:"Argument",name:{kind:"Name",value:"name"},value:{kind:"Variable",name:{kind:"Name",value:"name"}}},{kind:"Argument",name:{kind:"Name",value:"visibility"},value:{kind:"Variable",name:{kind:"Name",value:"visibility"}}},{kind:"Argument",name:{kind:"Name",value:"description"},value:{kind:"Variable",name:{kind:"Name",value:"description"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"room_id"}}]}}]}}]},q={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"}}]}}]}}]},D={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"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"createdFrom"}},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"}}},{kind:"Argument",name:{kind:"Name",value:"createdFrom"},value:{kind:"Variable",name:{kind:"Name",value:"createdFrom"}}}],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"}}]}}]}}]}}]},G={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"}}]}}]},K={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"}}]}}]}}]},J={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"}}]}}]}}]},L={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"}}]}}]},H={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"}}]}}]};var k=/([a-z0-9]+-?)*[a-z0-9]+/;function l(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??[])}function O(t,e){if(!e.name)throw new Error("Room name is required");if(!k.test(e.name))throw new Error("Room name must be URL-friendly, for example, sample-room-name");return t.mutate({mutation:z,variables:e,fetchPolicy:"no-cache"}).then(a=>{if(!a.data?.create_room?.room_id)throw new Error("expected room_id in response, got null");return a.data?.create_room?.room_id})}var u=require("rxjs");function b(t){return t=t?t.trim():"",t?t[t.length-1]==="/"?t.slice(0,t.length-1):t:""}function v(t){if(t==null)return null;try{Number.parseInt(t)}catch{throw new Error("invalid threadEventId")}return t}function E(t,e){return t.query({query:K,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2??[])}function T(t,e){if(!e)throw new Error("threadId is required");return t.query({query:J,variables:{id:e},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2_by_pk)}function P(t,e){if(!e.message.trim())throw new Error("message must not be empty");return t.mutate({mutation:D,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 m(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=ye(a.messageId))),t.query({query:L,variables:{where:_,limit:a?.limit,ordering:a?.ordering||"asc"},fetchPolicy:"no-cache"}).then(r=>r.data?.thread_events??[])}function R(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:q,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 U(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:N,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 w(t,e,a){if(!e)throw new Error("threadId is required");v(a);let _={thread_id:{_eq:e}};return a&&(_.thread_event_id={_gte:a}),t.subscribe({query:H,variables:{where:_}}).pipe((0,u.map)(r=>{if(r.error)throw r.error;return r.data?.thread_events??[]}))}function F(t,e,a){if(!e)throw new Error("threadId is required");let _,r=v(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 m(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=>$(n,a?.skipAnalysis),!0))}function $(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 ye(t){return[{event_data:{_contains:{UserMessage:{message_id:t}}}},{event_data:{_contains:{AgentMessage:{message_id:t}}}},{event_data:{_contains:{UserCancel:{message_id:t}}}}]}function Z(t){return t!=null&&typeof t=="object"&&"status"in t&&t.status==="failure"}function X(t){return t!=null&&typeof t=="object"&&"status"in t&&t.status==="success"&&"token"in t}function Y(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 I(t){let a=`${b(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(X(n))return n;throw new Error("malformed token response")}case 401:{let n=await o.json();throw Z(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 ce(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 ce=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(!Y(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 ee(t){return{Authorization:`pat ${t}`}}var s=require("@apollo/client"),te=require("@apollo/client/link/context"),ae=require("@apollo/client/link/subscriptions"),re=require("graphql"),_e=require("graphql-ws"),j=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,_e.createClient)({url:t.url,connectionParams:()=>a(t.headers),lazy:!0}),r=new ae.GraphQLWsLink(_),i=new te.SetContextLink(({headers:n})=>a(n)),o=s.ApolloLink.split(({operationType:n})=>n===re.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 V(this._options.client)}};function V(t){return t.query({query:G,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 S=class{_options;constructor(e){this._options=e}list(e){return l(this._options.client,{...e,limit:e.limit&&e.limit>0?e.limit:10})}getByName(e){return l(this._options.client,{where:{name:{_eq:e}},limit:1}).then(a=>a.length?a[0]??null:null)}create(e){return O(this._options.client,e)}};var g=class{_options;constructor(e){this._options=e}list(e){return E(this._options.client,{...e,limit:e.limit&&e.limit>0?e.limit:10})}get(e){if(!e)throw new Error("threadId is required");return T(this._options.client,e)}async start(e){let a=await V(this._options.client);return P(this._options.client,{...e,projectId:a.projectId,buildId:e.buildId||this._options.buildId,timezone:e.timezone||this._options.defaultTimezone})}getEvents(e,a){return m(this._options.client,e,a)}sendMessage(e){return R(this._options.client,{...e,timezone:e.timezone||this._options.defaultTimezone})}cancelAgentMessage(e){return U(this._options.client,e)}subscribeEvents(e,a){return w(this._options.client,e,a)}streamMessageEvents(e,a){return F(this._options.client,e,a)}};var W=class{constructor(e){let a=b(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=I({promptqlGraphQLUrl:_,authHost:e.authHost,headers:ee(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 g(this._options),this.project=new M(this._options),this.room=new S(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 le(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 be(t){return"UserMessage"in t?t.UserMessage:null}function me(t){return"UserCancel"in t?t.UserCancel:null}function Ie(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 Me(t){let e=x(t);return!e||!("PlanStepGenerated"in e)?null:e.PlanStepGenerated}function Se(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 ge(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 Ae(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 xe(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 A(t){return!("AgentMessage"in t)||!("PlanningDecisionUpdate"in t.AgentMessage.update)?null:t.AgentMessage.update.PlanningDecisionUpdate.update}function he(t){let e=A(t);return!e||!("Started"in e)?null:e.Started}function fe(t){let e=A(t);return!e||!("Completed"in e)?null:e.Completed}function Ce(t){let e=A(t);return!e||!("PlanningRequired"in e)?null:e.PlanningRequired}function Be(t){return!("AgentMessage"in t)||!("StartingOrchestrator"in t.AgentMessage.update)?null:t.AgentMessage.update.StartingOrchestrator}function x(t){return!("AgentMessage"in t)||!("OrchestratorUpdate"in t.AgentMessage.update)?null:t.AgentMessage.update.OrchestratorUpdate.update}function y(t){let e=x(t);return!e||!("ContextExplorerUpdate"in e)?null:e.ContextExplorerUpdate.update}function ke(t){let e=y(t);return!e||!("Started"in e)?null:e.Started}function Oe(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 ve(t){let e=h(t);return!e||!("Started"in e)?null:e.Started}function Ee(t){let e=h(t);return!e||!("Completed"in e)?null:e.Completed}function Te(t){let e=h(t);return!e||!("WikiInfoGenerated"in e)?null:e.WikiInfoGenerated}function f(t){let e=y(t);return!e||!("SchemaTasksGenerationUpdate"in e)?null:e.SchemaTasksGenerationUpdate.update}function Pe(t){let e=f(t);return!e||!("Started"in e)?null:e.Started}function Re(t){let e=f(t);return!e||!("Completed"in e)?null:e.Completed}function Ue(t){let e=f(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 we(t){let e=d(t);return!e||!("Started"in e)?null:e.Started}function Fe(t){let e=d(t);return!e||!("Completed"in e)?null:e.Completed}function je(t){let e=d(t);return!e||!("CodeExecutionComplete"in e)?null:e.CodeExecutionComplete}function Ve(t){let e=d(t);return!e||!("CodeOutputAnalyzed"in e)?null:e.CodeOutputAnalyzed}function We(t){let e=d(t);return!e||!("GeneratedCode"in e)?null:e.GeneratedCode}function Ne(t){let e=d(t);return!e||!("SchemaExplored"in e)?null:e.SchemaExplored}function C(t){let e=x(t);return!e||!("StepUpdate"in e)?null:e.StepUpdate}function ze(t){let e=C(t);return!e||!("Programmer"in e.update)?null:e.update.Programmer}function qe(t){let e=C(t);return!e||!("UiProgrammer"in e.update)?null:e.update.UiProgrammer}function De(t){let e=C(t);return!e||!("SavedProgramRunner"in e.update)?null:e.update.SavedProgramRunner}function Ge(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,ROOM_NAME_PATTERN,cancelAgentMessage,createApolloClient,createPromptQLAuthTokenGenerator,createRoom,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});
1
+ "use strict";var v=Object.defineProperty;var ce=Object.getOwnPropertyDescriptor;var le=Object.getOwnPropertyNames;var me=Object.prototype.hasOwnProperty;var be=(t,e)=>{for(var a in e)v(t,a,{get:e[a],enumerable:!0})},Ie=(t,e,a,_)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of le(e))!me.call(t,r)&&r!==a&&v(t,r,{get:()=>e[r],enumerable:!(_=ce(e,r))||_.enumerable});return t};var Me=t=>Ie(v({},"__esModule",{value:!0}),t);var Ye={};be(Ye,{PromptQLSdk:()=>L,ROOM_NAME_PATTERN:()=>R,USER_AGENT:()=>d,buildPromptQLUrl:()=>Q,cancelAgentMessage:()=>N,createApolloClient:()=>G,createPromptQLAuthTokenGenerator:()=>M,createRoom:()=>U,diffThreadEvents:()=>Ae,downloadArtifactData:()=>E,getAgentGeneratedResponse:()=>Be,getAgentInteractionDecisionAcceptInteractionEvent:()=>Oe,getAgentInteractionDecisionDeclineInteractionEvent:()=>ve,getAgentInteractionFinishedEvent:()=>Ze,getAgentMessageProcessingStartedEvent:()=>ke,getAgentOrchestratorContextExplorerCompletedEvent:()=>we,getAgentOrchestratorContextExplorerStartedEvent:()=>Ue,getAgentOrchestratorContextExplorerUpdateEvent:()=>c,getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent:()=>Ge,getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent:()=>Qe,getAgentOrchestratorSchemaExplorerCompletedEvent:()=>De,getAgentOrchestratorSchemaExplorerGeneratedCodeEvent:()=>Le,getAgentOrchestratorSchemaExplorerSchemaExploredEvent:()=>Ke,getAgentOrchestratorSchemaExplorerStartedEvent:()=>qe,getAgentOrchestratorSchemaExplorerUpdateEvent:()=>y,getAgentOrchestratorSchemaTasksGeneratedEvent:()=>ze,getAgentOrchestratorSchemaTasksGenerationCompletedEvent:()=>Ne,getAgentOrchestratorSchemaTasksGenerationStartedEvent:()=>We,getAgentOrchestratorSchemaTasksGenerationUpdateEvent:()=>h,getAgentOrchestratorStepProgrammerEvent:()=>Je,getAgentOrchestratorStepSavedProgramRunnerEvent:()=>$e,getAgentOrchestratorStepUiProgrammerEvent:()=>He,getAgentOrchestratorStepUpdateEvent:()=>x,getAgentOrchestratorUpdateEvent:()=>S,getAgentOrchestratorWikiExplorerCompletedEvent:()=>je,getAgentOrchestratorWikiExplorerStartedEvent:()=>Fe,getAgentOrchestratorWikiExplorerUpdateEvent:()=>A,getAgentOrchestratorWikiInfoGeneratedEvent:()=>Ve,getAgentPlanGenerationStartedEvent:()=>fe,getAgentPlanStepGeneratedEvent:()=>Ce,getAgentPlanningDecisionCompletedEvent:()=>Te,getAgentPlanningDecisionPlanningRequiredEvent:()=>Pe,getAgentPlanningDecisionStartedEvent:()=>Ee,getAgentPlanningDecisionUpdateEvent:()=>g,getAgentStartingOrchestratorEvent:()=>Re,getArtifactMetadata:()=>P,getThread:()=>j,getThreadEventMessageId:()=>Xe,getThreadEvents:()=>I,getUserCancelEvent:()=>xe,getUserMessageEvent:()=>he,isInteractionAnalyzing:()=>_e,listArtifactMetadataByThreadId:()=>T,listRooms:()=>b,listThreads:()=>F,sendThreadMessage:()=>W,startThread:()=>V,streamThreadMessageEvents:()=>q,subscribeThreadEvents:()=>z});module.exports=Me(Ye);var K={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"}}]}}]}}]},J={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateRoom"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"name"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"visibility"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"description"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"create_room"},arguments:[{kind:"Argument",name:{kind:"Name",value:"name"},value:{kind:"Variable",name:{kind:"Name",value:"name"}}},{kind:"Argument",name:{kind:"Name",value:"visibility"},value:{kind:"Variable",name:{kind:"Name",value:"visibility"}}},{kind:"Argument",name:{kind:"Name",value:"description"},value:{kind:"Variable",name:{kind:"Name",value:"description"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"room_id"}}]}}]}}]},H={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"}}]}}]}}]},$={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"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"createdFrom"}},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"}}},{kind:"Argument",name:{kind:"Name",value:"createdFrom"},value:{kind:"Variable",name:{kind:"Name",value:"createdFrom"}}}],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:"GetArtifactsByThreadId"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"threadId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"artifacts"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_artifacts"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_id"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"_eq"},value:{kind:"Variable",name:{kind:"Name",value:"threadId"}}}]}}]}}]}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"updated_at"},value:{kind:"EnumValue",value:"asc"}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"artifact_id"}},{kind:"Field",name:{kind:"Name",value:"latest_version_object"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"user_id"}},{kind:"Field",name:{kind:"Name",value:"artifact_metadata"}},{kind:"Field",name:{kind:"Name",value:"artifact_type"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"size"}},{kind:"Field",name:{kind:"Name",value:"version"}}]}}]}}]}}]},X={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"}}]}}]},Y={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"}}]}}]}}]},ee={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"}}]}}]}}]},te={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"}}]}}]},ae={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"}}]}}]};async function E(t,e,a,_,r){let o=`${t}/promptql-v2/artifacts/${e}/version/${a}/data`,n=await(typeof r=="function"?r:fetch)(o,{method:"GET",headers:_});if(n.status!==200){let m=n.body?await n.text():n.statusText;throw new Error(`[${n.status}] failed to download artifact: ${m}`)}return n.body?n.headers.get("Content-Type")?.startsWith("application/json")?n.json():n.text():null}async function T(t,e,a){let _=await t.query({query:Z,variables:{threadId:a},fetchPolicy:"no-cache"});return _.data?.artifacts?.length?_.data.artifacts.filter(r=>r.latest_version_object).map(r=>({project_id:e,artifact_id:r.artifact_id,artifact_type:r.latest_version_object.artifact_type,version:r.latest_version_object.version,title:r.latest_version_object.title,description:r.latest_version_object.description??null,user_id:r.latest_version_object.user_id,metadata:r.latest_version_object.artifact_metadata,created_at:r.latest_version_object.created_at,size_bytes:Number.parseInt(r.latest_version_object.size)})):[]}async function P(t,e,a,_,r){let o=`${t}/promptql-v2/artifacts/${e}/version/${a}/metadata`,n=await(typeof r=="function"?r:fetch)(o,{method:"GET",headers:_});if(n.status!==200){let p=n.body?await n.text():n.statusText;throw new Error(`[${n.status}] failed to get artifact metadata: ${p}`)}return n.json()}var d="PromptQL TypeScript SDK",R=/([a-z0-9]+-?)*[a-z0-9]+/;function b(t,e){return t.query({query:X,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(a=>a.data?.rooms??[])}function U(t,e){if(!e.name)throw new Error("Room name is required");if(!R.test(e.name))throw new Error("Room name must be URL-friendly, for example, sample-room-name");return t.mutate({mutation:J,variables:e,fetchPolicy:"no-cache"}).then(a=>{if(!a.data?.create_room?.room_id)throw new Error("expected room_id in response, got null");return a.data?.create_room?.room_id})}var u=require("rxjs");function re(t){return t=t?t.trim():"",t?t[t.length-1]==="/"?t.slice(0,t.length-1):t:""}function w(t){if(t==null)return null;try{Number.parseInt(t)}catch{throw new Error("invalid threadEventId")}return t}function F(t,e){return t.query({query:Y,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2??[])}function j(t,e){if(!e)throw new Error("threadId is required");return t.query({query:ee,variables:{id:e},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2_by_pk)}function V(t,e){if(!e.message.trim())throw new Error("message must not be empty");return t.mutate({mutation:$,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=ge(a.messageId))),t.query({query:te,variables:{where:_,limit:a?.limit,ordering:a?.ordering||"asc"},fetchPolicy:"no-cache"}).then(r=>r.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:H,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 N(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:K,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 z(t,e,a){if(!e)throw new Error("threadId is required");w(a);let _={thread_id:{_eq:e}};return a&&(_.thread_event_id={_gte:a}),t.subscribe({query:ae,variables:{where:_}}).pipe((0,u.map)(r=>{if(r.error)throw r.error;return r.data?.thread_events??[]}))}function q(t,e,a){if(!e)throw new Error("threadId is required");let _,r=w(a?.fromEventId),o={eventId:a?.fromEventId?{_gte:r}:void 0,messageId:a?.messageId},i=a?.pollingInterval&&a?.pollingInterval>0?a.pollingInterval:5;return(0,u.defer)(async()=>{let n=_?{messageId:a?.messageId,eventId:{_gt:_}}:o,p=await I(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/i):void 0,delay:i*1e3}),(0,u.takeWhile)(n=>_e(n,a?.skipAnalysis),!0))}function _e(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 ge(t){return[{event_data:{_contains:{UserMessage:{message_id:t}}}},{event_data:{_contains:{AgentMessage:{message_id:t}}}},{event_data:{_contains:{UserCancel:{message_id:t}}}}]}function ne(t){return t!=null&&typeof t=="object"&&"status"in t&&t.status==="failure"}function ie(t){return t!=null&&typeof t=="object"&&"status"in t&&t.status==="success"&&"token"in t}function oe(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=`${re(t.authHost)||"https://auth.pro.hasura.io"}/ddn/promptql/token`,_={token:"",expiry:new Date(0)},r=t.fetch||fetch,o=async()=>{let i=await r(a,{method:"POST",headers:t.headers});switch(i.status){case 200:{let n=await i.json();if(ie(n))return n;throw new Error("malformed token response")}case 401:{let n=await i.json();throw ne(n)?new Error(n?.error||i.statusText):new Error(i.statusText)}default:{let n=await i.text();throw new Error(n)}}};return async()=>{if(_.expiry.getTime()<=Date.now()-1e3){let i=await o(),n=await Se(t.promptqlGraphQLUrl,i.token,t.projectId,r);_.token=n;let p=new Date(i.expiry);if(Number.isNaN(p.getTime())){let m=new Date;m.setHours(1),_.expiry=m}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 o=await r.json();if(!oe(o)||!o.data?.enrich_token?.userDirectoryJWT)throw new Error(`malformed promptql token response: ${JSON.stringify(o)}`);return o.data.enrich_token.userDirectoryJWT}default:{let o=await r.text();throw new Error(o)}}};function D(t){return{Authorization:`pat ${t}`}}var s=require("@apollo/client"),pe=require("@apollo/client/link/context"),ue=require("@apollo/client/link/subscriptions"),se=require("graphql"),de=require("graphql-ws");var G=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:{"User-Agent":d,...n,Authorization:`Bearer ${p}`}}},_=(0,de.createClient)({url:t.url,connectionParams:()=>a(t.headers),lazy:!0}),r=new ue.GraphQLWsLink(_),o=new pe.SetContextLink(({headers:n})=>a(n)),i=s.ApolloLink.split(({operationType:n})=>n===se.OperationTypeNode.SUBSCRIPTION,r,o.concat(e));return{client:new s.ApolloClient({link:i,cache:new s.InMemoryCache}),wsClient:_}};function Ae(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 o=e[r];if(BigInt(o?.thread_event_id)<=_)break}return e.slice(r+1)}function he(t){return"UserMessage"in t?t.UserMessage:null}function xe(t){return"UserCancel"in t?t.UserCancel:null}function fe(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 Ce(t){let e=S(t);return!e||!("PlanStepGenerated"in e)?null:e.PlanStepGenerated}function Be(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 ke(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 Oe(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 ve(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 g(t){return!("AgentMessage"in t)||!("PlanningDecisionUpdate"in t.AgentMessage.update)?null:t.AgentMessage.update.PlanningDecisionUpdate.update}function Ee(t){let e=g(t);return!e||!("Started"in e)?null:e.Started}function Te(t){let e=g(t);return!e||!("Completed"in e)?null:e.Completed}function Pe(t){let e=g(t);return!e||!("PlanningRequired"in e)?null:e.PlanningRequired}function Re(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 c(t){let e=S(t);return!e||!("ContextExplorerUpdate"in e)?null:e.ContextExplorerUpdate.update}function Ue(t){let e=c(t);return!e||!("Started"in e)?null:e.Started}function we(t){let e=c(t);return!e||!("Completed"in e)?null:e.Completed}function A(t){let e=c(t);return!e||!("WikiExplorerUpdate"in e)?null:e.WikiExplorerUpdate.update}function Fe(t){let e=A(t);return!e||!("Started"in e)?null:e.Started}function je(t){let e=A(t);return!e||!("Completed"in e)?null:e.Completed}function Ve(t){let e=A(t);return!e||!("WikiInfoGenerated"in e)?null:e.WikiInfoGenerated}function h(t){let e=c(t);return!e||!("SchemaTasksGenerationUpdate"in e)?null:e.SchemaTasksGenerationUpdate.update}function We(t){let e=h(t);return!e||!("Started"in e)?null:e.Started}function Ne(t){let e=h(t);return!e||!("Completed"in e)?null:e.Completed}function ze(t){let e=h(t);return!e||!("TasksGenerated"in e)?null:e.TasksGenerated}function y(t){let e=c(t);return!e||!("SchemaExplorerUpdate"in e)?null:e.SchemaExplorerUpdate.update}function qe(t){let e=y(t);return!e||!("Started"in e)?null:e.Started}function De(t){let e=y(t);return!e||!("Completed"in e)?null:e.Completed}function Ge(t){let e=y(t);return!e||!("CodeExecutionComplete"in e)?null:e.CodeExecutionComplete}function Qe(t){let e=y(t);return!e||!("CodeOutputAnalyzed"in e)?null:e.CodeOutputAnalyzed}function Le(t){let e=y(t);return!e||!("GeneratedCode"in e)?null:e.GeneratedCode}function Ke(t){let e=y(t);return!e||!("SchemaExplored"in e)?null:e.SchemaExplored}function x(t){let e=S(t);return!e||!("StepUpdate"in e)?null:e.StepUpdate}function Je(t){let e=x(t);return!e||!("Programmer"in e.update)?null:e.update.Programmer}function He(t){let e=x(t);return!e||!("UiProgrammer"in e.update)?null:e.update.UiProgrammer}function $e(t){let e=x(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,messageId:t.AgentMessage.message_id}:"Errored"in e?{status:"errored",timestamp:e.Errored.errored_at,messageId:t.AgentMessage.message_id,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,messageId:t.AgentMessage.message_id}:"AgentDeclined"in e?{status:"agent_declined",timestamp:e.AgentDeclined.declined_at,reason:e.AgentDeclined.reason,messageId:t.AgentMessage.message_id}:"ServerCancelled"in e?{status:"server_cancelled",timestamp:e.ServerCancelled.cancelled_at,messageId:t.AgentMessage.message_id}:{status:"unknown",messageId:t.AgentMessage.message_id}}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",messageId:t.AgentMessage.message_id,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",messageId:t.AgentMessage.message_id,timestamp:t.AgentMessage.update.timestamp}:"user_cancelled"in e?{status:"user_cancelled",messageId:t.AgentMessage.message_id,timestamp:t.AgentMessage.update.timestamp}:"completed"in e?{status:"completed",messageId:t.AgentMessage.message_id,timestamp:t.AgentMessage.update.timestamp,warnings:e.completed.warnings}:{status:"unknown",messageId:t.AgentMessage.message_id}}return null}function Xe(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}}function Q(t){return`https://promptql.${t}/playground-v2-hge/v1/graphql`}var f=class{controlPlaneUrl;options;defaultTimezone;getAuthTokenFn;project;client;wsClient;constructor(e){if(this.options=e,!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");this.defaultTimezone=e.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone,this.controlPlaneUrl=e.controlPlaneUrl||"https://data.pro.hasura.io/v1/graphql"}async getAuthToken(){if(typeof this.getAuthTokenFn=="function")return this.getAuthTokenFn();let e=await this.getProjectInfo();return this.getAuthTokenFn=M({promptqlGraphQLUrl:e.promptqlGraphQLUrl,authHost:this.options.authHost,headers:D(this.options.serviceAccountToken),fetch:this.options.fetch}),this.getAuthTokenFn()}async getGraphQLClient(){if(this.client)return this.client;let e=await this.getProjectInfo(),{client:a,wsClient:_}=G({getAuthToken:this.getAuthToken.bind(this),url:e.promptqlGraphQLUrl,fetch:this.options.fetch,headers:this.options.headers});return this.wsClient=_,this.client=a,this.client}async getProjectInfo(){if(this.project)return this.project;let e={operationName:"GetDdnProjects",query:"query GetDdnProjects { ddn_projects(limit: 1) { id name private_ddn { fqdn path_routing_context path_routing_enabled }}}"},a=typeof this.options.fetch=="function"?this.options.fetch:fetch,_=D(this.options.serviceAccountToken);_["User-Agent"]=d;let r=await a(this.controlPlaneUrl,{method:"POST",headers:_,body:JSON.stringify(e)});if(r.status!==200){let n=r.body?await r.text():r.statusText;throw new Error(`[${r.status}] failed to get project info: ${n}`)}let o=await r.json();if(!o.data?.ddn_projects?.length)throw new Error("Project not found");let i=o.data.ddn_projects[0];return{projectId:i.id,projectName:i.name,projectHost:`https://${i.name}.${i.private_ddn.fqdn}`,promptqlConsoleUrl:`https://prompt.ql.app/project/${i.name}`,promptqlGraphQLUrl:Q(i.private_ddn.fqdn)}}close(){this.wsClient?.dispose()}};var C=class{api;constructor(e){this.api=e}async listMetadataByThreadId(e){let a=await this.api.getProjectInfo(),_=await this.api.getGraphQLClient();return T(_,a.projectId,e)}async download(e,a){let _=await this.api.getProjectInfo(),r=await this.api.getAuthToken();return E(_.projectHost,e,a,ye(r),this.api.options.fetch)}async getMetadata(e,a){let _=await this.api.getProjectInfo(),r=await this.api.getAuthToken();return P(_.projectHost,e,a,ye(r),this.api.options.fetch)}};function ye(t){return{Authorization:`Bearer ${t}`,"User-Agent":d}}var B=class{api;constructor(e){this.api=e}info(){return this.api.getProjectInfo()}};var k=class{api;constructor(e){this.api=e}async list(e){let a=await this.api.getGraphQLClient();return b(a,{...e,limit:e.limit&&e.limit>0?e.limit:10})}async getByName(e){let a=await this.api.getGraphQLClient();return b(a,{where:{name:{_eq:e}},limit:1}).then(_=>_.length?_[0]??null:null)}async create(e){let a=await this.api.getGraphQLClient();return U(a,e)}};var l=require("rxjs");var O=class{api;constructor(e){this.api=e}async list(e){let a=await this.api.getGraphQLClient();return F(a,{...e,limit:e.limit&&e.limit>0?e.limit:10})}async get(e){if(!e)throw new Error("threadId is required");let a=await this.api.getGraphQLClient();return j(a,e)}async start(e){let a=await this.api.getProjectInfo(),_=await this.api.getGraphQLClient();return V(_,{...e,projectId:a.projectId,buildId:e.buildId||this.api.options.buildId,timezone:e.timezone||this.api.defaultTimezone})}async getEvents(e,a){let _=await this.api.getGraphQLClient();return I(_,e,a)}async sendMessage(e){let a=await this.api.getGraphQLClient();return W(a,{...e,timezone:e.timezone||this.api.defaultTimezone})}async cancelAgentMessage(e){let a=await this.api.getGraphQLClient();return N(a,e)}subscribeEvents(e,a){return(0,l.from)(this.api.getGraphQLClient()).pipe((0,l.switchMap)(_=>z(_,e,a)))}streamMessageEvents(e,a){return(0,l.from)(this.api.getGraphQLClient()).pipe((0,l.switchMap)(_=>q(_,e,a)))}};var L=class{constructor(e){let a=new f(e);this.api=a,this.thread=new O(a),this.project=new B(a),this.room=new k(a),this.artifact=new C(a)}api;thread;project;room;artifact;close(){this.api.close()}};0&&(module.exports={PromptQLSdk,ROOM_NAME_PATTERN,USER_AGENT,buildPromptQLUrl,cancelAgentMessage,createApolloClient,createPromptQLAuthTokenGenerator,createRoom,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,getArtifactMetadata,getThread,getThreadEventMessageId,getThreadEvents,getUserCancelEvent,getUserMessageEvent,isInteractionAnalyzing,listArtifactMetadataByThreadId,listRooms,listThreads,sendThreadMessage,startThread,streamThreadMessageEvents,subscribeThreadEvents});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- async function ye(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 B={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"}}]}}]}}]},k={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateRoom"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"name"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"visibility"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"description"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"create_room"},arguments:[{kind:"Argument",name:{kind:"Name",value:"name"},value:{kind:"Variable",name:{kind:"Name",value:"name"}}},{kind:"Argument",name:{kind:"Name",value:"visibility"},value:{kind:"Variable",name:{kind:"Name",value:"visibility"}}},{kind:"Argument",name:{kind:"Name",value:"description"},value:{kind:"Variable",name:{kind:"Name",value:"description"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"room_id"}}]}}]}}]},O={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"}}]}}]}}]},v={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"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"createdFrom"}},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"}}},{kind:"Argument",name:{kind:"Name",value:"createdFrom"},value:{kind:"Variable",name:{kind:"Name",value:"createdFrom"}}}],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"}}]}}]}}]}}]},E={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"}}]}}]}}]},T={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"}}]}}]},P={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"}}]}}]}}]},R={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"}}]}}]}}]},U={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"}}]}}]},w={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"}}]}}]};var F=/([a-z0-9]+-?)*[a-z0-9]+/;function m(t,e){return t.query({query:T,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(a=>a.data?.rooms??[])}function j(t,e){if(!e.name)throw new Error("Room name is required");if(!F.test(e.name))throw new Error("Room name must be URL-friendly, for example, sample-room-name");return t.mutate({mutation:k,variables:e,fetchPolicy:"no-cache"}).then(a=>{if(!a.data?.create_room?.room_id)throw new Error("expected room_id in response, got null");return a.data?.create_room?.room_id})}import{defer as Z,map as X,repeat as Y,takeWhile as ee}from"rxjs";function y(t){return t=t?t.trim():"",t?t[t.length-1]==="/"?t.slice(0,t.length-1):t:""}function I(t){if(t==null)return null;try{Number.parseInt(t)}catch{throw new Error("invalid threadEventId")}return t}function V(t,e){return t.query({query:P,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2??[])}function W(t,e){if(!e)throw new Error("threadId is required");return t.query({query:R,variables:{id:e},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2_by_pk)}function N(t,e){if(!e.message.trim())throw new Error("message must not be empty");return t.mutate({mutation:v,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 M(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=ae(a.messageId))),t.query({query:U,variables:{where:_,limit:a?.limit,ordering:a?.ordering||"asc"},fetchPolicy:"no-cache"}).then(r=>r.data?.thread_events??[])}function z(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:O,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 q(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:B,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 D(t,e,a){if(!e)throw new Error("threadId is required");I(a);let _={thread_id:{_eq:e}};return a&&(_.thread_event_id={_gte:a}),t.subscribe({query:w,variables:{where:_}}).pipe(X(r=>{if(r.error)throw r.error;return r.data?.thread_events??[]}))}function G(t,e,a){if(!e)throw new Error("threadId is required");let _,r=I(a?.fromEventId),i={eventId:a?.fromEventId?{_gte:r}:void 0,messageId:a?.messageId},o=a?.pollingInterval&&a?.pollingInterval>0?a.pollingInterval:5;return Z(async()=>{let n=_?{messageId:a?.messageId,eventId:{_gt:_}}:i,p=await M(t,e,n);return p.length>0&&(_=p[p.length-1]?.thread_event_id),p}).pipe(Y({count:a?.timeout&&a.timeout>0?Math.ceil(a.timeout/o):void 0,delay:o*1e3}),ee(n=>te(n,a?.skipAnalysis),!0))}function te(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 ae(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 K(t){return t!=null&&typeof t=="object"&&"status"in t&&t.status==="success"&&"token"in t}function J(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 S(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(K(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 re(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 re=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(!J(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 L(t){return{Authorization:`pat ${t}`}}import{ApolloClient as _e,ApolloLink as ne,HttpLink as ie,InMemoryCache as oe}from"@apollo/client";import{SetContextLink as pe}from"@apollo/client/link/context";import{GraphQLWsLink as ue}from"@apollo/client/link/subscriptions";import{OperationTypeNode as se}from"graphql";import{createClient as de}from"graphql-ws";var H=t=>{let e=new ie({uri:t.url,fetch:t.fetch,headers:t.headers}),a=async n=>{let p=await t.getAuthToken();return{headers:{...n,Authorization:`Bearer ${p}`}}},_=de({url:t.url,connectionParams:()=>a(t.headers),lazy:!0}),r=new ue(_),i=new pe(({headers:n})=>a(n)),o=ne.split(({operationType:n})=>n===se.SUBSCRIPTION,r,i.concat(e));return{client:new _e({link:o,cache:new oe}),wsClient:_}};var c=class{_options;constructor(e){this._options=e}info(){return g(this._options.client)}};function g(t){return t.query({query:E,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 m(this._options.client,{...e,limit:e.limit&&e.limit>0?e.limit:10})}getByName(e){return m(this._options.client,{where:{name:{_eq:e}},limit:1}).then(a=>a.length?a[0]??null:null)}create(e){return j(this._options.client,e)}};var b=class{_options;constructor(e){this._options=e}list(e){return V(this._options.client,{...e,limit:e.limit&&e.limit>0?e.limit:10})}get(e){if(!e)throw new Error("threadId is required");return W(this._options.client,e)}async start(e){let a=await g(this._options.client);return N(this._options.client,{...e,projectId:a.projectId,buildId:e.buildId||this._options.buildId,timezone:e.timezone||this._options.defaultTimezone})}getEvents(e,a){return M(this._options.client,e,a)}sendMessage(e){return z(this._options.client,{...e,timezone:e.timezone||this._options.defaultTimezone})}cancelAgentMessage(e){return q(this._options.client,e)}subscribeEvents(e,a){return D(this._options.client,e,a)}streamMessageEvents(e,a){return G(this._options.client,e,a)}};var $=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=S({promptqlGraphQLUrl:_,authHost:e.authHost,headers:L(e.serviceAccountToken),fetch:e.fetch});let{client:r,wsClient:i}=H({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 dt(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 yt(t){return"UserMessage"in t?t.UserMessage:null}function ct(t){return"UserCancel"in t?t.UserCancel:null}function lt(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 bt(t){let e=x(t);return!e||!("PlanStepGenerated"in e)?null:e.PlanStepGenerated}function mt(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 It(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 Mt(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 St(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 A(t){return!("AgentMessage"in t)||!("PlanningDecisionUpdate"in t.AgentMessage.update)?null:t.AgentMessage.update.PlanningDecisionUpdate.update}function gt(t){let e=A(t);return!e||!("Started"in e)?null:e.Started}function At(t){let e=A(t);return!e||!("Completed"in e)?null:e.Completed}function xt(t){let e=A(t);return!e||!("PlanningRequired"in e)?null:e.PlanningRequired}function ht(t){return!("AgentMessage"in t)||!("StartingOrchestrator"in t.AgentMessage.update)?null:t.AgentMessage.update.StartingOrchestrator}function x(t){return!("AgentMessage"in t)||!("OrchestratorUpdate"in t.AgentMessage.update)?null:t.AgentMessage.update.OrchestratorUpdate.update}function s(t){let e=x(t);return!e||!("ContextExplorerUpdate"in e)?null:e.ContextExplorerUpdate.update}function ft(t){let e=s(t);return!e||!("Started"in e)?null:e.Started}function Ct(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 Bt(t){let e=h(t);return!e||!("Started"in e)?null:e.Started}function kt(t){let e=h(t);return!e||!("Completed"in e)?null:e.Completed}function Ot(t){let e=h(t);return!e||!("WikiInfoGenerated"in e)?null:e.WikiInfoGenerated}function f(t){let e=s(t);return!e||!("SchemaTasksGenerationUpdate"in e)?null:e.SchemaTasksGenerationUpdate.update}function vt(t){let e=f(t);return!e||!("Started"in e)?null:e.Started}function Et(t){let e=f(t);return!e||!("Completed"in e)?null:e.Completed}function Tt(t){let e=f(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 Pt(t){let e=u(t);return!e||!("Started"in e)?null:e.Started}function Rt(t){let e=u(t);return!e||!("Completed"in e)?null:e.Completed}function Ut(t){let e=u(t);return!e||!("CodeExecutionComplete"in e)?null:e.CodeExecutionComplete}function wt(t){let e=u(t);return!e||!("CodeOutputAnalyzed"in e)?null:e.CodeOutputAnalyzed}function Ft(t){let e=u(t);return!e||!("GeneratedCode"in e)?null:e.GeneratedCode}function jt(t){let e=u(t);return!e||!("SchemaExplored"in e)?null:e.SchemaExplored}function C(t){let e=x(t);return!e||!("StepUpdate"in e)?null:e.StepUpdate}function Vt(t){let e=C(t);return!e||!("Programmer"in e.update)?null:e.update.Programmer}function Wt(t){let e=C(t);return!e||!("UiProgrammer"in e.update)?null:e.update.UiProgrammer}function Nt(t){let e=C(t);return!e||!("SavedProgramRunner"in e.update)?null:e.update.SavedProgramRunner}function zt(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 qt(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{$ as PromptQLSdk,F as ROOM_NAME_PATTERN,q as cancelAgentMessage,H as createApolloClient,S as createPromptQLAuthTokenGenerator,j as createRoom,dt as diffThreadEvents,ye as downloadArtifactData,mt as getAgentGeneratedResponse,Mt as getAgentInteractionDecisionAcceptInteractionEvent,St as getAgentInteractionDecisionDeclineInteractionEvent,zt as getAgentInteractionFinishedEvent,It as getAgentMessageProcessingStartedEvent,Ct as getAgentOrchestratorContextExplorerCompletedEvent,ft as getAgentOrchestratorContextExplorerStartedEvent,s as getAgentOrchestratorContextExplorerUpdateEvent,Ut as getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent,wt as getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent,Rt as getAgentOrchestratorSchemaExplorerCompletedEvent,Ft as getAgentOrchestratorSchemaExplorerGeneratedCodeEvent,jt as getAgentOrchestratorSchemaExplorerSchemaExploredEvent,Pt as getAgentOrchestratorSchemaExplorerStartedEvent,u as getAgentOrchestratorSchemaExplorerUpdateEvent,Tt as getAgentOrchestratorSchemaTasksGeneratedEvent,Et as getAgentOrchestratorSchemaTasksGenerationCompletedEvent,vt as getAgentOrchestratorSchemaTasksGenerationStartedEvent,f as getAgentOrchestratorSchemaTasksGenerationUpdateEvent,Vt as getAgentOrchestratorStepProgrammerEvent,Nt as getAgentOrchestratorStepSavedProgramRunnerEvent,Wt as getAgentOrchestratorStepUiProgrammerEvent,C as getAgentOrchestratorStepUpdateEvent,x as getAgentOrchestratorUpdateEvent,kt as getAgentOrchestratorWikiExplorerCompletedEvent,Bt as getAgentOrchestratorWikiExplorerStartedEvent,h as getAgentOrchestratorWikiExplorerUpdateEvent,Ot as getAgentOrchestratorWikiInfoGeneratedEvent,lt as getAgentPlanGenerationStartedEvent,bt as getAgentPlanStepGeneratedEvent,At as getAgentPlanningDecisionCompletedEvent,xt as getAgentPlanningDecisionPlanningRequiredEvent,gt as getAgentPlanningDecisionStartedEvent,A as getAgentPlanningDecisionUpdateEvent,ht as getAgentStartingOrchestratorEvent,W as getThread,qt as getThreadEventMessageId,M as getThreadEvents,ct as getUserCancelEvent,yt as getUserMessageEvent,te as isInteractionAnalyzing,m as listRooms,V as listThreads,z as sendThreadMessage,N as startThread,G as streamThreadMessageEvents,D as subscribeThreadEvents};
1
+ var O={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"}}]}}]}}]},v={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateRoom"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"name"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"visibility"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"description"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"create_room"},arguments:[{kind:"Argument",name:{kind:"Name",value:"name"},value:{kind:"Variable",name:{kind:"Name",value:"name"}}},{kind:"Argument",name:{kind:"Name",value:"visibility"},value:{kind:"Variable",name:{kind:"Name",value:"visibility"}}},{kind:"Argument",name:{kind:"Name",value:"description"},value:{kind:"Variable",name:{kind:"Name",value:"description"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"room_id"}}]}}]}}]},E={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"}}]}}]}}]},T={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"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"createdFrom"}},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"}}},{kind:"Argument",name:{kind:"Name",value:"createdFrom"},value:{kind:"Variable",name:{kind:"Name",value:"createdFrom"}}}],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"}}]}}]}}]}}]},P={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetArtifactsByThreadId"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"threadId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"artifacts"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_artifacts"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_id"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"_eq"},value:{kind:"Variable",name:{kind:"Name",value:"threadId"}}}]}}]}}]}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"updated_at"},value:{kind:"EnumValue",value:"asc"}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"artifact_id"}},{kind:"Field",name:{kind:"Name",value:"latest_version_object"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"user_id"}},{kind:"Field",name:{kind:"Name",value:"artifact_metadata"}},{kind:"Field",name:{kind:"Name",value:"artifact_type"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"size"}},{kind:"Field",name:{kind:"Name",value:"version"}}]}}]}}]}}]},R={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"}}]}}]},U={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"}}]}}]}}]},w={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"}}]}}]}}]},F={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"}}]}}]};async function V(t,e,a,_,r){let o=`${t}/promptql-v2/artifacts/${e}/version/${a}/data`,n=await(typeof r=="function"?r:fetch)(o,{method:"GET",headers:_});if(n.status!==200){let y=n.body?await n.text():n.statusText;throw new Error(`[${n.status}] failed to download artifact: ${y}`)}return n.body?n.headers.get("Content-Type")?.startsWith("application/json")?n.json():n.text():null}async function W(t,e,a){let _=await t.query({query:P,variables:{threadId:a},fetchPolicy:"no-cache"});return _.data?.artifacts?.length?_.data.artifacts.filter(r=>r.latest_version_object).map(r=>({project_id:e,artifact_id:r.artifact_id,artifact_type:r.latest_version_object.artifact_type,version:r.latest_version_object.version,title:r.latest_version_object.title,description:r.latest_version_object.description??null,user_id:r.latest_version_object.user_id,metadata:r.latest_version_object.artifact_metadata,created_at:r.latest_version_object.created_at,size_bytes:Number.parseInt(r.latest_version_object.size)})):[]}async function N(t,e,a,_,r){let o=`${t}/promptql-v2/artifacts/${e}/version/${a}/metadata`,n=await(typeof r=="function"?r:fetch)(o,{method:"GET",headers:_});if(n.status!==200){let p=n.body?await n.text():n.statusText;throw new Error(`[${n.status}] failed to get artifact metadata: ${p}`)}return n.json()}var u="PromptQL TypeScript SDK",z=/([a-z0-9]+-?)*[a-z0-9]+/;function M(t,e){return t.query({query:R,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(a=>a.data?.rooms??[])}function q(t,e){if(!e.name)throw new Error("Room name is required");if(!z.test(e.name))throw new Error("Room name must be URL-friendly, for example, sample-room-name");return t.mutate({mutation:v,variables:e,fetchPolicy:"no-cache"}).then(a=>{if(!a.data?.create_room?.room_id)throw new Error("expected room_id in response, got null");return a.data?.create_room?.room_id})}import{defer as ie,map as oe,repeat as pe,takeWhile as ue}from"rxjs";function D(t){return t=t?t.trim():"",t?t[t.length-1]==="/"?t.slice(0,t.length-1):t:""}function g(t){if(t==null)return null;try{Number.parseInt(t)}catch{throw new Error("invalid threadEventId")}return t}function G(t,e){return t.query({query:U,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2??[])}function Q(t,e){if(!e)throw new Error("threadId is required");return t.query({query:w,variables:{id:e},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2_by_pk)}function L(t,e){if(!e.message.trim())throw new Error("message must not be empty");return t.mutate({mutation:T,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 S(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=de(a.messageId))),t.query({query:F,variables:{where:_,limit:a?.limit,ordering:a?.ordering||"asc"},fetchPolicy:"no-cache"}).then(r=>r.data?.thread_events??[])}function K(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:E,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:O,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 H(t,e,a){if(!e)throw new Error("threadId is required");g(a);let _={thread_id:{_eq:e}};return a&&(_.thread_event_id={_gte:a}),t.subscribe({query:j,variables:{where:_}}).pipe(oe(r=>{if(r.error)throw r.error;return r.data?.thread_events??[]}))}function $(t,e,a){if(!e)throw new Error("threadId is required");let _,r=g(a?.fromEventId),o={eventId:a?.fromEventId?{_gte:r}:void 0,messageId:a?.messageId},i=a?.pollingInterval&&a?.pollingInterval>0?a.pollingInterval:5;return ie(async()=>{let n=_?{messageId:a?.messageId,eventId:{_gt:_}}:o,p=await S(t,e,n);return p.length>0&&(_=p[p.length-1]?.thread_event_id),p}).pipe(pe({count:a?.timeout&&a.timeout>0?Math.ceil(a.timeout/i):void 0,delay:i*1e3}),ue(n=>se(n,a?.skipAnalysis),!0))}function se(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 de(t){return[{event_data:{_contains:{UserMessage:{message_id:t}}}},{event_data:{_contains:{AgentMessage:{message_id:t}}}},{event_data:{_contains:{UserCancel:{message_id:t}}}}]}function Z(t){return t!=null&&typeof t=="object"&&"status"in t&&t.status==="failure"}function X(t){return t!=null&&typeof t=="object"&&"status"in t&&t.status==="success"&&"token"in t}function Y(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 A(t){let a=`${D(t.authHost)||"https://auth.pro.hasura.io"}/ddn/promptql/token`,_={token:"",expiry:new Date(0)},r=t.fetch||fetch,o=async()=>{let i=await r(a,{method:"POST",headers:t.headers});switch(i.status){case 200:{let n=await i.json();if(X(n))return n;throw new Error("malformed token response")}case 401:{let n=await i.json();throw Z(n)?new Error(n?.error||i.statusText):new Error(i.statusText)}default:{let n=await i.text();throw new Error(n)}}};return async()=>{if(_.expiry.getTime()<=Date.now()-1e3){let i=await o(),n=await ye(t.promptqlGraphQLUrl,i.token,t.projectId,r);_.token=n;let p=new Date(i.expiry);if(Number.isNaN(p.getTime())){let y=new Date;y.setHours(1),_.expiry=y}else _.expiry=p}return _.token}}var ye=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 o=await r.json();if(!Y(o)||!o.data?.enrich_token?.userDirectoryJWT)throw new Error(`malformed promptql token response: ${JSON.stringify(o)}`);return o.data.enrich_token.userDirectoryJWT}default:{let o=await r.text();throw new Error(o)}}};function h(t){return{Authorization:`pat ${t}`}}import{ApolloClient as ce,ApolloLink as le,HttpLink as me,InMemoryCache as be}from"@apollo/client";import{SetContextLink as Ie}from"@apollo/client/link/context";import{GraphQLWsLink as Me}from"@apollo/client/link/subscriptions";import{OperationTypeNode as ge}from"graphql";import{createClient as Se}from"graphql-ws";var ee=t=>{let e=new me({uri:t.url,fetch:t.fetch,headers:t.headers}),a=async n=>{let p=await t.getAuthToken();return{headers:{"User-Agent":u,...n,Authorization:`Bearer ${p}`}}},_=Se({url:t.url,connectionParams:()=>a(t.headers),lazy:!0}),r=new Me(_),o=new Ie(({headers:n})=>a(n)),i=le.split(({operationType:n})=>n===ge.SUBSCRIPTION,r,o.concat(e));return{client:new ce({link:i,cache:new be}),wsClient:_}};function ot(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 o=e[r];if(BigInt(o?.thread_event_id)<=_)break}return e.slice(r+1)}function pt(t){return"UserMessage"in t?t.UserMessage:null}function ut(t){return"UserCancel"in t?t.UserCancel:null}function st(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 dt(t){let e=f(t);return!e||!("PlanStepGenerated"in e)?null:e.PlanStepGenerated}function yt(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 ct(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 lt(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 mt(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 x(t){return!("AgentMessage"in t)||!("PlanningDecisionUpdate"in t.AgentMessage.update)?null:t.AgentMessage.update.PlanningDecisionUpdate.update}function bt(t){let e=x(t);return!e||!("Started"in e)?null:e.Started}function It(t){let e=x(t);return!e||!("Completed"in e)?null:e.Completed}function Mt(t){let e=x(t);return!e||!("PlanningRequired"in e)?null:e.PlanningRequired}function gt(t){return!("AgentMessage"in t)||!("StartingOrchestrator"in t.AgentMessage.update)?null:t.AgentMessage.update.StartingOrchestrator}function f(t){return!("AgentMessage"in t)||!("OrchestratorUpdate"in t.AgentMessage.update)?null:t.AgentMessage.update.OrchestratorUpdate.update}function d(t){let e=f(t);return!e||!("ContextExplorerUpdate"in e)?null:e.ContextExplorerUpdate.update}function St(t){let e=d(t);return!e||!("Started"in e)?null:e.Started}function At(t){let e=d(t);return!e||!("Completed"in e)?null:e.Completed}function C(t){let e=d(t);return!e||!("WikiExplorerUpdate"in e)?null:e.WikiExplorerUpdate.update}function ht(t){let e=C(t);return!e||!("Started"in e)?null:e.Started}function xt(t){let e=C(t);return!e||!("Completed"in e)?null:e.Completed}function ft(t){let e=C(t);return!e||!("WikiInfoGenerated"in e)?null:e.WikiInfoGenerated}function B(t){let e=d(t);return!e||!("SchemaTasksGenerationUpdate"in e)?null:e.SchemaTasksGenerationUpdate.update}function Ct(t){let e=B(t);return!e||!("Started"in e)?null:e.Started}function Bt(t){let e=B(t);return!e||!("Completed"in e)?null:e.Completed}function kt(t){let e=B(t);return!e||!("TasksGenerated"in e)?null:e.TasksGenerated}function s(t){let e=d(t);return!e||!("SchemaExplorerUpdate"in e)?null:e.SchemaExplorerUpdate.update}function Ot(t){let e=s(t);return!e||!("Started"in e)?null:e.Started}function vt(t){let e=s(t);return!e||!("Completed"in e)?null:e.Completed}function Et(t){let e=s(t);return!e||!("CodeExecutionComplete"in e)?null:e.CodeExecutionComplete}function Tt(t){let e=s(t);return!e||!("CodeOutputAnalyzed"in e)?null:e.CodeOutputAnalyzed}function Pt(t){let e=s(t);return!e||!("GeneratedCode"in e)?null:e.GeneratedCode}function Rt(t){let e=s(t);return!e||!("SchemaExplored"in e)?null:e.SchemaExplored}function k(t){let e=f(t);return!e||!("StepUpdate"in e)?null:e.StepUpdate}function Ut(t){let e=k(t);return!e||!("Programmer"in e.update)?null:e.update.Programmer}function wt(t){let e=k(t);return!e||!("UiProgrammer"in e.update)?null:e.update.UiProgrammer}function Ft(t){let e=k(t);return!e||!("SavedProgramRunner"in e.update)?null:e.update.SavedProgramRunner}function jt(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,messageId:t.AgentMessage.message_id}:"Errored"in e?{status:"errored",timestamp:e.Errored.errored_at,messageId:t.AgentMessage.message_id,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,messageId:t.AgentMessage.message_id}:"AgentDeclined"in e?{status:"agent_declined",timestamp:e.AgentDeclined.declined_at,reason:e.AgentDeclined.reason,messageId:t.AgentMessage.message_id}:"ServerCancelled"in e?{status:"server_cancelled",timestamp:e.ServerCancelled.cancelled_at,messageId:t.AgentMessage.message_id}:{status:"unknown",messageId:t.AgentMessage.message_id}}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",messageId:t.AgentMessage.message_id,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",messageId:t.AgentMessage.message_id,timestamp:t.AgentMessage.update.timestamp}:"user_cancelled"in e?{status:"user_cancelled",messageId:t.AgentMessage.message_id,timestamp:t.AgentMessage.update.timestamp}:"completed"in e?{status:"completed",messageId:t.AgentMessage.message_id,timestamp:t.AgentMessage.update.timestamp,warnings:e.completed.warnings}:{status:"unknown",messageId:t.AgentMessage.message_id}}return null}function Vt(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}}function te(t){return`https://promptql.${t}/playground-v2-hge/v1/graphql`}var c=class{controlPlaneUrl;options;defaultTimezone;getAuthTokenFn;project;client;wsClient;constructor(e){if(this.options=e,!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");this.defaultTimezone=e.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone,this.controlPlaneUrl=e.controlPlaneUrl||"https://data.pro.hasura.io/v1/graphql"}async getAuthToken(){if(typeof this.getAuthTokenFn=="function")return this.getAuthTokenFn();let e=await this.getProjectInfo();return this.getAuthTokenFn=A({promptqlGraphQLUrl:e.promptqlGraphQLUrl,authHost:this.options.authHost,headers:h(this.options.serviceAccountToken),fetch:this.options.fetch}),this.getAuthTokenFn()}async getGraphQLClient(){if(this.client)return this.client;let e=await this.getProjectInfo(),{client:a,wsClient:_}=ee({getAuthToken:this.getAuthToken.bind(this),url:e.promptqlGraphQLUrl,fetch:this.options.fetch,headers:this.options.headers});return this.wsClient=_,this.client=a,this.client}async getProjectInfo(){if(this.project)return this.project;let e={operationName:"GetDdnProjects",query:"query GetDdnProjects { ddn_projects(limit: 1) { id name private_ddn { fqdn path_routing_context path_routing_enabled }}}"},a=typeof this.options.fetch=="function"?this.options.fetch:fetch,_=h(this.options.serviceAccountToken);_["User-Agent"]=u;let r=await a(this.controlPlaneUrl,{method:"POST",headers:_,body:JSON.stringify(e)});if(r.status!==200){let n=r.body?await r.text():r.statusText;throw new Error(`[${r.status}] failed to get project info: ${n}`)}let o=await r.json();if(!o.data?.ddn_projects?.length)throw new Error("Project not found");let i=o.data.ddn_projects[0];return{projectId:i.id,projectName:i.name,projectHost:`https://${i.name}.${i.private_ddn.fqdn}`,promptqlConsoleUrl:`https://prompt.ql.app/project/${i.name}`,promptqlGraphQLUrl:te(i.private_ddn.fqdn)}}close(){this.wsClient?.dispose()}};var l=class{api;constructor(e){this.api=e}async listMetadataByThreadId(e){let a=await this.api.getProjectInfo(),_=await this.api.getGraphQLClient();return W(_,a.projectId,e)}async download(e,a){let _=await this.api.getProjectInfo(),r=await this.api.getAuthToken();return V(_.projectHost,e,a,ae(r),this.api.options.fetch)}async getMetadata(e,a){let _=await this.api.getProjectInfo(),r=await this.api.getAuthToken();return N(_.projectHost,e,a,ae(r),this.api.options.fetch)}};function ae(t){return{Authorization:`Bearer ${t}`,"User-Agent":u}}var m=class{api;constructor(e){this.api=e}info(){return this.api.getProjectInfo()}};var b=class{api;constructor(e){this.api=e}async list(e){let a=await this.api.getGraphQLClient();return M(a,{...e,limit:e.limit&&e.limit>0?e.limit:10})}async getByName(e){let a=await this.api.getGraphQLClient();return M(a,{where:{name:{_eq:e}},limit:1}).then(_=>_.length?_[0]??null:null)}async create(e){let a=await this.api.getGraphQLClient();return q(a,e)}};import{from as re,switchMap as _e}from"rxjs";var I=class{api;constructor(e){this.api=e}async list(e){let a=await this.api.getGraphQLClient();return G(a,{...e,limit:e.limit&&e.limit>0?e.limit:10})}async get(e){if(!e)throw new Error("threadId is required");let a=await this.api.getGraphQLClient();return Q(a,e)}async start(e){let a=await this.api.getProjectInfo(),_=await this.api.getGraphQLClient();return L(_,{...e,projectId:a.projectId,buildId:e.buildId||this.api.options.buildId,timezone:e.timezone||this.api.defaultTimezone})}async getEvents(e,a){let _=await this.api.getGraphQLClient();return S(_,e,a)}async sendMessage(e){let a=await this.api.getGraphQLClient();return K(a,{...e,timezone:e.timezone||this.api.defaultTimezone})}async cancelAgentMessage(e){let a=await this.api.getGraphQLClient();return J(a,e)}subscribeEvents(e,a){return re(this.api.getGraphQLClient()).pipe(_e(_=>H(_,e,a)))}streamMessageEvents(e,a){return re(this.api.getGraphQLClient()).pipe(_e(_=>$(_,e,a)))}};var ne=class{constructor(e){let a=new c(e);this.api=a,this.thread=new I(a),this.project=new m(a),this.room=new b(a),this.artifact=new l(a)}api;thread;project;room;artifact;close(){this.api.close()}};export{ne as PromptQLSdk,z as ROOM_NAME_PATTERN,u as USER_AGENT,te as buildPromptQLUrl,J as cancelAgentMessage,ee as createApolloClient,A as createPromptQLAuthTokenGenerator,q as createRoom,ot as diffThreadEvents,V as downloadArtifactData,yt as getAgentGeneratedResponse,lt as getAgentInteractionDecisionAcceptInteractionEvent,mt as getAgentInteractionDecisionDeclineInteractionEvent,jt as getAgentInteractionFinishedEvent,ct as getAgentMessageProcessingStartedEvent,At as getAgentOrchestratorContextExplorerCompletedEvent,St as getAgentOrchestratorContextExplorerStartedEvent,d as getAgentOrchestratorContextExplorerUpdateEvent,Et as getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent,Tt as getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent,vt as getAgentOrchestratorSchemaExplorerCompletedEvent,Pt as getAgentOrchestratorSchemaExplorerGeneratedCodeEvent,Rt as getAgentOrchestratorSchemaExplorerSchemaExploredEvent,Ot as getAgentOrchestratorSchemaExplorerStartedEvent,s as getAgentOrchestratorSchemaExplorerUpdateEvent,kt as getAgentOrchestratorSchemaTasksGeneratedEvent,Bt as getAgentOrchestratorSchemaTasksGenerationCompletedEvent,Ct as getAgentOrchestratorSchemaTasksGenerationStartedEvent,B as getAgentOrchestratorSchemaTasksGenerationUpdateEvent,Ut as getAgentOrchestratorStepProgrammerEvent,Ft as getAgentOrchestratorStepSavedProgramRunnerEvent,wt as getAgentOrchestratorStepUiProgrammerEvent,k as getAgentOrchestratorStepUpdateEvent,f as getAgentOrchestratorUpdateEvent,xt as getAgentOrchestratorWikiExplorerCompletedEvent,ht as getAgentOrchestratorWikiExplorerStartedEvent,C as getAgentOrchestratorWikiExplorerUpdateEvent,ft as getAgentOrchestratorWikiInfoGeneratedEvent,st as getAgentPlanGenerationStartedEvent,dt as getAgentPlanStepGeneratedEvent,It as getAgentPlanningDecisionCompletedEvent,Mt as getAgentPlanningDecisionPlanningRequiredEvent,bt as getAgentPlanningDecisionStartedEvent,x as getAgentPlanningDecisionUpdateEvent,gt as getAgentStartingOrchestratorEvent,N as getArtifactMetadata,Q as getThread,Vt as getThreadEventMessageId,S as getThreadEvents,ut as getUserCancelEvent,pt as getUserMessageEvent,se as isInteractionAnalyzing,W as listArtifactMetadataByThreadId,M as listRooms,G as listThreads,K as sendThreadMessage,L as startThread,$ as streamThreadMessageEvents,H as subscribeThreadEvents};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hasura/promptql",
3
3
  "description": "A Typescript SDK allows you to interact with PromptQL API",
4
- "version": "2.0.0-alpha.23",
4
+ "version": "2.0.0-alpha.24",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Hasura",
7
7
  "homepage": "https://promptql.hasura.io",
@@ -30,14 +30,14 @@
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/bun": "latest",
33
- "@types/node": "^25.3.3",
33
+ "@types/node": "^25.4.0",
34
34
  "tsup": "^8.5.1",
35
35
  "typescript": "5.9.3"
36
36
  },
37
37
  "dependencies": {
38
38
  "@apollo/client": "^4.1.6",
39
39
  "@graphql-typed-document-node/core": "^3.2.0",
40
- "graphql": "^16.13.0",
40
+ "graphql": "^16.13.1",
41
41
  "graphql-ws": "^6.0.7",
42
42
  "rxjs": "^7.8.2"
43
43
  }