@hasura/promptql 2.0.0-alpha.10 → 2.0.0-alpha.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { ApolloClient, Observable } from '@apollo/client';
2
- import { GraphQLError } from 'graphql';
3
2
  import * as graphql_ws from 'graphql-ws';
4
3
 
5
4
  /**
@@ -3163,10 +3162,6 @@ type Boolean_Comparison_Exp = {
3163
3162
  _neq?: InputMaybe<Scalars['Boolean']['input']>;
3164
3163
  _nin?: InputMaybe<Array<Scalars['Boolean']['input']>>;
3165
3164
  };
3166
- type EnrichTokenOutput = {
3167
- __typename?: 'EnrichTokenOutput';
3168
- userDirectoryJWT: Scalars['String']['output'];
3169
- };
3170
3165
  type GetProjectInfoOutput = {
3171
3166
  __typename?: 'GetProjectInfoOutput';
3172
3167
  projectId: Scalars['String']['output'];
@@ -4878,29 +4873,11 @@ declare function streamThreadMessageEvents(client: ApolloClient, threadId: strin
4878
4873
  type PromptQLAuthTokenGeneratorOptions = {
4879
4874
  authHost?: string;
4880
4875
  promptqlGraphQLUrl: string;
4881
- serviceAccountToken: string;
4876
+ headers: Record<string, string>;
4877
+ projectId?: string;
4882
4878
  fetch?: typeof fetch;
4883
4879
  };
4884
4880
  declare function createPromptQLAuthTokenGenerator(options: PromptQLAuthTokenGeneratorOptions): () => Promise<string>;
4885
- declare const enrichToken: (promptqlGraphQLUrl: string, token: string, projectId?: string, customFetch?: typeof fetch) => Promise<string>;
4886
-
4887
- type LuxAuthPromptQLTokenSuccessResponse = {
4888
- status: "success";
4889
- expiry: string;
4890
- token: string;
4891
- };
4892
- type LuxAuthPromptQLTokenFailedResponse = {
4893
- error: string;
4894
- status: "failure";
4895
- };
4896
- declare function isLuxAuthPromptQLTokenFailedResponse(input: unknown): input is LuxAuthPromptQLTokenFailedResponse;
4897
- declare function isLuxAuthPromptQLTokenSuccessResponse(input: unknown): input is LuxAuthPromptQLTokenSuccessResponse;
4898
- declare function isEnrichTokenMutationResponse(input: unknown): input is {
4899
- data?: {
4900
- enrich_token: EnrichTokenOutput;
4901
- };
4902
- errors?: GraphQLError[];
4903
- };
4904
4881
 
4905
4882
  /**
4906
4883
  * Internal client options.
@@ -5152,4 +5129,4 @@ declare function getAgentOrchestratorStepUiProgrammerEvent(eventData: ThreadEven
5152
5129
  */
5153
5130
  declare function getAgentOrchestratorStepSavedProgramRunnerEvent(eventData: ThreadEvent$1): SavedProgramRunnerUpdate | null;
5154
5131
 
5155
- export { type AgentInteraction, type AgentLearningUpdate, type AgentState, type AgentUpdate, 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 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 InteractionFinishedUpdate, type InteractionOutcome, type InternalError, type InternalErrorV1, type InternalUpdate, type KeysOfUnion, type LearningSuggestion, type LearningSuggestionOutcome, type LearningSuggestionUpdate, type LearningSuggestionUpdateV1, type LlmUsage, type LuxAuthPromptQLTokenSuccessResponse, 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 PromptQLAuthTokenGeneratorOptions, PromptQLSdk, type PromptQLSdkOptions, type PromptQlConfigFeatureFlagModel, type PromptQlUserId, type PythonRunStepDetails, type PythonStep, type ResponseGenerationState, type ResponseGenerationUpdate, type RunConfigV1, type RunFinished, type RunFinishedOutcome, type RunFinishedV1, type RunProgramRequest, type RunProgramRequest2, type RunSavedProgramRequest, type RunSavedProgramRequest2, type RunStarted, type RunStartedV1, type RunStepDetails, type SavedProgramRunnerStage, type SavedProgramRunnerState, type SavedProgramRunnerUpdate, type SavedProgramRunnerUpdateV0, type SchemaContext, type SchemaContext1, type SchemaExplored, type SchemaExplorerCompleted, type SchemaExplorerStarted, type SchemaExplorerState, type SchemaExplorerUpdate, type SchemaTask, type SchemaTasksGenerationCompleted, type SchemaTasksGenerationStarted, type SchemaTasksGenerationState, type SchemaTasksGenerationUpdate, type SendMessageToThreadArguments, type SendMessageToThreadOutput, type SendThreadMessageMutationVariables, type ShelfActionEvent, type ShelfSink, type ShelfUpdate, type ShelfUpdateV1, type SocialFeedRating, type SocialFeedRatingLlmUsage, type SocialFeedRatingOutcome, type SocialFeedRatingUpdate, type Span, type SqlError, type SqlErrorV1, type SqlRunStepDetails, type SqlSource, type SqlStep, type StartThreadArguments, type StartThreadMutationVariables, type StartThreadOutput, type StartingOrchestrator, type Step, type StepExecutionFinished, type StepExecutionFinishedV1, type StepExecutionStarted, type StepExecutionStartedV1, type StepState, type StepUpdate, type StreamThreadEventOptions, type SummaryAction, type TasksGenerated, type Teaching, type TeachingId, type TeachingOutcome, type TeachingState, type ThreadEvent, type ThreadEvent$1 as ThreadEventData, type ThreadFragment, type ThreadParticipants, type TransactionId, type UiBuild, type UiBuild2, type UiBuildFailure, type UiBuildResult, type UiBuildRunStepDetails, type UiBuildStep, type UiMetadata, type UiProgrammerState, type UiProgrammerUpdate, type UserCancel, type UserCancelEvent, type UserInteraction, type UserMessage, type UserMessageEvent, type UserUpload, type UserUploadMetadata, type Version, type Warning, type WikiChange, type WikiContent, type WikiDelta, type WikiExplorerCompleted, type WikiExplorerStarted, type WikiExplorerState, type WikiExplorerUpdate, type WikiGenerationOutcome, type WikiGenerationUpdate, type WikiInfoGenerated, type WikiPageV1, type WikiSection, type WikiTitle, cancelAgentMessage, createApolloClient, createPromptQLAuthTokenGenerator, diffThreadEvents, enrichToken, getAgentGeneratedResponse, getAgentInteractionDecisionAcceptInteractionEvent, getAgentInteractionDecisionDeclineInteractionEvent, getAgentMessageProcessingStartedEvent, getAgentOrchestratorContextExplorerCompletedEvent, getAgentOrchestratorContextExplorerStartedEvent, getAgentOrchestratorContextExplorerUpdateEvent, getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent, getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent, getAgentOrchestratorSchemaExplorerCompletedEvent, getAgentOrchestratorSchemaExplorerGeneratedCodeEvent, getAgentOrchestratorSchemaExplorerSchemaExploredEvent, getAgentOrchestratorSchemaExplorerStartedEvent, getAgentOrchestratorSchemaExplorerUpdateEvent, getAgentOrchestratorSchemaTasksGeneratedEvent, getAgentOrchestratorSchemaTasksGenerationCompletedEvent, getAgentOrchestratorSchemaTasksGenerationStartedEvent, getAgentOrchestratorSchemaTasksGenerationUpdateEvent, getAgentOrchestratorStepProgrammerEvent, getAgentOrchestratorStepSavedProgramRunnerEvent, getAgentOrchestratorStepUiProgrammerEvent, getAgentOrchestratorStepUpdateEvent, getAgentOrchestratorUpdateEvent, getAgentOrchestratorWikiExplorerCompletedEvent, getAgentOrchestratorWikiExplorerStartedEvent, getAgentOrchestratorWikiExplorerUpdateEvent, getAgentOrchestratorWikiInfoGeneratedEvent, getAgentPlanGenerationStartedEvent, getAgentPlanStepGeneratedEvent, getAgentPlanningDecisionCompletedEvent, getAgentPlanningDecisionPlanningRequiredEvent, getAgentPlanningDecisionStartedEvent, getAgentPlanningDecisionUpdateEvent, getAgentStartingOrchestratorEvent, getThread, getThreadEvents, getUserCancelEvent, getUserMessageEvent, isEnrichTokenMutationResponse, isLuxAuthPromptQLTokenFailedResponse, isLuxAuthPromptQLTokenSuccessResponse, listThreads, sendThreadMessage, startThread, streamThreadMessageEvents, subscribeThreadEvents };
5132
+ export { type AgentInteraction, type AgentLearningUpdate, type AgentState, type AgentUpdate, 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 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 InteractionFinishedUpdate, type InteractionOutcome, type InternalError, type InternalErrorV1, type InternalUpdate, type KeysOfUnion, type LearningSuggestion, type LearningSuggestionOutcome, type LearningSuggestionUpdate, type LearningSuggestionUpdateV1, type LlmUsage, type MessageProcessingStarted, type MessageProcessingState, type MessageProcessingUpdate, type NeedsSupportAnalysis, type NeedsSupportOutcome, type NeedsSupportUpdate, type OrchestratorState, type OrchestratorUpdate, type Order_By, type OutputEmitted, type OutputEmittedV1, type PipelineColumn, type PipelineColumnType, type PipelinePartitionSpec, type PipelinePartitionTransform, type PipelineProgress, type PipelineProgressV1, type PipelineRunStepDetails, type PipelineSchema, type PipelineSink, type PipelineSource, type PipelineStep, type PipelineTransform, type PlanGenerationStarted, type PlanState, type PlanStateStep, type PlanStepGenerated, type PlanningDecisionCompleted, type PlanningDecisionPlanningRequired, type PlanningDecisionStarted, type PlanningDecisionState, type PlanningDecisionUpdate, type ProgramId, type ProgramPackageName, type ProgramRunEvent, type ProgramRunResult, type ProgramRunnerAction, type ProgramRunnerAction2, type ProgramRunnerActionResult, type ProgramRunnerAttempt, type ProgramTransform, type ProgrammerState, type ProgrammerUpdate, PromptQLSdk, type PromptQLSdkOptions, type PromptQlConfigFeatureFlagModel, type PromptQlUserId, type PythonRunStepDetails, type PythonStep, type ResponseGenerationState, type ResponseGenerationUpdate, type RunConfigV1, type RunFinished, type RunFinishedOutcome, type RunFinishedV1, type RunProgramRequest, type RunProgramRequest2, type RunSavedProgramRequest, type RunSavedProgramRequest2, type RunStarted, type RunStartedV1, type RunStepDetails, type SavedProgramRunnerStage, type SavedProgramRunnerState, type SavedProgramRunnerUpdate, type SavedProgramRunnerUpdateV0, type SchemaContext, type SchemaContext1, type SchemaExplored, type SchemaExplorerCompleted, type SchemaExplorerStarted, type SchemaExplorerState, type SchemaExplorerUpdate, type SchemaTask, type SchemaTasksGenerationCompleted, type SchemaTasksGenerationStarted, type SchemaTasksGenerationState, type SchemaTasksGenerationUpdate, type SendMessageToThreadArguments, type SendMessageToThreadOutput, type SendThreadMessageMutationVariables, type ShelfActionEvent, type ShelfSink, type ShelfUpdate, type ShelfUpdateV1, type SocialFeedRating, type SocialFeedRatingLlmUsage, type SocialFeedRatingOutcome, type SocialFeedRatingUpdate, type Span, type SqlError, type SqlErrorV1, type SqlRunStepDetails, type SqlSource, type SqlStep, type StartThreadArguments, type StartThreadMutationVariables, type StartThreadOutput, type StartingOrchestrator, type Step, type StepExecutionFinished, type StepExecutionFinishedV1, type StepExecutionStarted, type StepExecutionStartedV1, type StepState, type StepUpdate, type StreamThreadEventOptions, type SummaryAction, type TasksGenerated, type Teaching, type TeachingId, type TeachingOutcome, type TeachingState, type ThreadEvent, type ThreadEvent$1 as ThreadEventData, type ThreadFragment, type ThreadParticipants, type TransactionId, type UiBuild, type UiBuild2, type UiBuildFailure, type UiBuildResult, type UiBuildRunStepDetails, type UiBuildStep, type UiMetadata, type UiProgrammerState, type UiProgrammerUpdate, type UserCancel, type UserCancelEvent, type UserInteraction, type UserMessage, type UserMessageEvent, type UserUpload, type UserUploadMetadata, type Version, type Warning, type WikiChange, type WikiContent, type WikiDelta, type WikiExplorerCompleted, type WikiExplorerStarted, type WikiExplorerState, type WikiExplorerUpdate, type WikiGenerationOutcome, type WikiGenerationUpdate, type WikiInfoGenerated, type WikiPageV1, type WikiSection, type WikiTitle, cancelAgentMessage, createApolloClient, createPromptQLAuthTokenGenerator, diffThreadEvents, getAgentGeneratedResponse, getAgentInteractionDecisionAcceptInteractionEvent, getAgentInteractionDecisionDeclineInteractionEvent, getAgentMessageProcessingStartedEvent, getAgentOrchestratorContextExplorerCompletedEvent, getAgentOrchestratorContextExplorerStartedEvent, getAgentOrchestratorContextExplorerUpdateEvent, getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent, getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent, getAgentOrchestratorSchemaExplorerCompletedEvent, getAgentOrchestratorSchemaExplorerGeneratedCodeEvent, getAgentOrchestratorSchemaExplorerSchemaExploredEvent, getAgentOrchestratorSchemaExplorerStartedEvent, getAgentOrchestratorSchemaExplorerUpdateEvent, getAgentOrchestratorSchemaTasksGeneratedEvent, getAgentOrchestratorSchemaTasksGenerationCompletedEvent, getAgentOrchestratorSchemaTasksGenerationStartedEvent, getAgentOrchestratorSchemaTasksGenerationUpdateEvent, getAgentOrchestratorStepProgrammerEvent, getAgentOrchestratorStepSavedProgramRunnerEvent, getAgentOrchestratorStepUiProgrammerEvent, getAgentOrchestratorStepUpdateEvent, getAgentOrchestratorUpdateEvent, getAgentOrchestratorWikiExplorerCompletedEvent, getAgentOrchestratorWikiExplorerStartedEvent, getAgentOrchestratorWikiExplorerUpdateEvent, getAgentOrchestratorWikiInfoGeneratedEvent, getAgentPlanGenerationStartedEvent, getAgentPlanStepGeneratedEvent, getAgentPlanningDecisionCompletedEvent, getAgentPlanningDecisionPlanningRequiredEvent, getAgentPlanningDecisionStartedEvent, getAgentPlanningDecisionUpdateEvent, getAgentStartingOrchestratorEvent, getThread, getThreadEvents, getUserCancelEvent, getUserMessageEvent, listThreads, sendThreadMessage, startThread, streamThreadMessageEvents, subscribeThreadEvents };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { ApolloClient, Observable } from '@apollo/client';
2
- import { GraphQLError } from 'graphql';
3
2
  import * as graphql_ws from 'graphql-ws';
4
3
 
5
4
  /**
@@ -3163,10 +3162,6 @@ type Boolean_Comparison_Exp = {
3163
3162
  _neq?: InputMaybe<Scalars['Boolean']['input']>;
3164
3163
  _nin?: InputMaybe<Array<Scalars['Boolean']['input']>>;
3165
3164
  };
3166
- type EnrichTokenOutput = {
3167
- __typename?: 'EnrichTokenOutput';
3168
- userDirectoryJWT: Scalars['String']['output'];
3169
- };
3170
3165
  type GetProjectInfoOutput = {
3171
3166
  __typename?: 'GetProjectInfoOutput';
3172
3167
  projectId: Scalars['String']['output'];
@@ -4878,29 +4873,11 @@ declare function streamThreadMessageEvents(client: ApolloClient, threadId: strin
4878
4873
  type PromptQLAuthTokenGeneratorOptions = {
4879
4874
  authHost?: string;
4880
4875
  promptqlGraphQLUrl: string;
4881
- serviceAccountToken: string;
4876
+ headers: Record<string, string>;
4877
+ projectId?: string;
4882
4878
  fetch?: typeof fetch;
4883
4879
  };
4884
4880
  declare function createPromptQLAuthTokenGenerator(options: PromptQLAuthTokenGeneratorOptions): () => Promise<string>;
4885
- declare const enrichToken: (promptqlGraphQLUrl: string, token: string, projectId?: string, customFetch?: typeof fetch) => Promise<string>;
4886
-
4887
- type LuxAuthPromptQLTokenSuccessResponse = {
4888
- status: "success";
4889
- expiry: string;
4890
- token: string;
4891
- };
4892
- type LuxAuthPromptQLTokenFailedResponse = {
4893
- error: string;
4894
- status: "failure";
4895
- };
4896
- declare function isLuxAuthPromptQLTokenFailedResponse(input: unknown): input is LuxAuthPromptQLTokenFailedResponse;
4897
- declare function isLuxAuthPromptQLTokenSuccessResponse(input: unknown): input is LuxAuthPromptQLTokenSuccessResponse;
4898
- declare function isEnrichTokenMutationResponse(input: unknown): input is {
4899
- data?: {
4900
- enrich_token: EnrichTokenOutput;
4901
- };
4902
- errors?: GraphQLError[];
4903
- };
4904
4881
 
4905
4882
  /**
4906
4883
  * Internal client options.
@@ -5152,4 +5129,4 @@ declare function getAgentOrchestratorStepUiProgrammerEvent(eventData: ThreadEven
5152
5129
  */
5153
5130
  declare function getAgentOrchestratorStepSavedProgramRunnerEvent(eventData: ThreadEvent$1): SavedProgramRunnerUpdate | null;
5154
5131
 
5155
- export { type AgentInteraction, type AgentLearningUpdate, type AgentState, type AgentUpdate, 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 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 InteractionFinishedUpdate, type InteractionOutcome, type InternalError, type InternalErrorV1, type InternalUpdate, type KeysOfUnion, type LearningSuggestion, type LearningSuggestionOutcome, type LearningSuggestionUpdate, type LearningSuggestionUpdateV1, type LlmUsage, type LuxAuthPromptQLTokenSuccessResponse, 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 PromptQLAuthTokenGeneratorOptions, PromptQLSdk, type PromptQLSdkOptions, type PromptQlConfigFeatureFlagModel, type PromptQlUserId, type PythonRunStepDetails, type PythonStep, type ResponseGenerationState, type ResponseGenerationUpdate, type RunConfigV1, type RunFinished, type RunFinishedOutcome, type RunFinishedV1, type RunProgramRequest, type RunProgramRequest2, type RunSavedProgramRequest, type RunSavedProgramRequest2, type RunStarted, type RunStartedV1, type RunStepDetails, type SavedProgramRunnerStage, type SavedProgramRunnerState, type SavedProgramRunnerUpdate, type SavedProgramRunnerUpdateV0, type SchemaContext, type SchemaContext1, type SchemaExplored, type SchemaExplorerCompleted, type SchemaExplorerStarted, type SchemaExplorerState, type SchemaExplorerUpdate, type SchemaTask, type SchemaTasksGenerationCompleted, type SchemaTasksGenerationStarted, type SchemaTasksGenerationState, type SchemaTasksGenerationUpdate, type SendMessageToThreadArguments, type SendMessageToThreadOutput, type SendThreadMessageMutationVariables, type ShelfActionEvent, type ShelfSink, type ShelfUpdate, type ShelfUpdateV1, type SocialFeedRating, type SocialFeedRatingLlmUsage, type SocialFeedRatingOutcome, type SocialFeedRatingUpdate, type Span, type SqlError, type SqlErrorV1, type SqlRunStepDetails, type SqlSource, type SqlStep, type StartThreadArguments, type StartThreadMutationVariables, type StartThreadOutput, type StartingOrchestrator, type Step, type StepExecutionFinished, type StepExecutionFinishedV1, type StepExecutionStarted, type StepExecutionStartedV1, type StepState, type StepUpdate, type StreamThreadEventOptions, type SummaryAction, type TasksGenerated, type Teaching, type TeachingId, type TeachingOutcome, type TeachingState, type ThreadEvent, type ThreadEvent$1 as ThreadEventData, type ThreadFragment, type ThreadParticipants, type TransactionId, type UiBuild, type UiBuild2, type UiBuildFailure, type UiBuildResult, type UiBuildRunStepDetails, type UiBuildStep, type UiMetadata, type UiProgrammerState, type UiProgrammerUpdate, type UserCancel, type UserCancelEvent, type UserInteraction, type UserMessage, type UserMessageEvent, type UserUpload, type UserUploadMetadata, type Version, type Warning, type WikiChange, type WikiContent, type WikiDelta, type WikiExplorerCompleted, type WikiExplorerStarted, type WikiExplorerState, type WikiExplorerUpdate, type WikiGenerationOutcome, type WikiGenerationUpdate, type WikiInfoGenerated, type WikiPageV1, type WikiSection, type WikiTitle, cancelAgentMessage, createApolloClient, createPromptQLAuthTokenGenerator, diffThreadEvents, enrichToken, getAgentGeneratedResponse, getAgentInteractionDecisionAcceptInteractionEvent, getAgentInteractionDecisionDeclineInteractionEvent, getAgentMessageProcessingStartedEvent, getAgentOrchestratorContextExplorerCompletedEvent, getAgentOrchestratorContextExplorerStartedEvent, getAgentOrchestratorContextExplorerUpdateEvent, getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent, getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent, getAgentOrchestratorSchemaExplorerCompletedEvent, getAgentOrchestratorSchemaExplorerGeneratedCodeEvent, getAgentOrchestratorSchemaExplorerSchemaExploredEvent, getAgentOrchestratorSchemaExplorerStartedEvent, getAgentOrchestratorSchemaExplorerUpdateEvent, getAgentOrchestratorSchemaTasksGeneratedEvent, getAgentOrchestratorSchemaTasksGenerationCompletedEvent, getAgentOrchestratorSchemaTasksGenerationStartedEvent, getAgentOrchestratorSchemaTasksGenerationUpdateEvent, getAgentOrchestratorStepProgrammerEvent, getAgentOrchestratorStepSavedProgramRunnerEvent, getAgentOrchestratorStepUiProgrammerEvent, getAgentOrchestratorStepUpdateEvent, getAgentOrchestratorUpdateEvent, getAgentOrchestratorWikiExplorerCompletedEvent, getAgentOrchestratorWikiExplorerStartedEvent, getAgentOrchestratorWikiExplorerUpdateEvent, getAgentOrchestratorWikiInfoGeneratedEvent, getAgentPlanGenerationStartedEvent, getAgentPlanStepGeneratedEvent, getAgentPlanningDecisionCompletedEvent, getAgentPlanningDecisionPlanningRequiredEvent, getAgentPlanningDecisionStartedEvent, getAgentPlanningDecisionUpdateEvent, getAgentStartingOrchestratorEvent, getThread, getThreadEvents, getUserCancelEvent, getUserMessageEvent, isEnrichTokenMutationResponse, isLuxAuthPromptQLTokenFailedResponse, isLuxAuthPromptQLTokenSuccessResponse, listThreads, sendThreadMessage, startThread, streamThreadMessageEvents, subscribeThreadEvents };
5132
+ export { type AgentInteraction, type AgentLearningUpdate, type AgentState, type AgentUpdate, 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 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 InteractionFinishedUpdate, type InteractionOutcome, type InternalError, type InternalErrorV1, type InternalUpdate, type KeysOfUnion, type LearningSuggestion, type LearningSuggestionOutcome, type LearningSuggestionUpdate, type LearningSuggestionUpdateV1, type LlmUsage, type MessageProcessingStarted, type MessageProcessingState, type MessageProcessingUpdate, type NeedsSupportAnalysis, type NeedsSupportOutcome, type NeedsSupportUpdate, type OrchestratorState, type OrchestratorUpdate, type Order_By, type OutputEmitted, type OutputEmittedV1, type PipelineColumn, type PipelineColumnType, type PipelinePartitionSpec, type PipelinePartitionTransform, type PipelineProgress, type PipelineProgressV1, type PipelineRunStepDetails, type PipelineSchema, type PipelineSink, type PipelineSource, type PipelineStep, type PipelineTransform, type PlanGenerationStarted, type PlanState, type PlanStateStep, type PlanStepGenerated, type PlanningDecisionCompleted, type PlanningDecisionPlanningRequired, type PlanningDecisionStarted, type PlanningDecisionState, type PlanningDecisionUpdate, type ProgramId, type ProgramPackageName, type ProgramRunEvent, type ProgramRunResult, type ProgramRunnerAction, type ProgramRunnerAction2, type ProgramRunnerActionResult, type ProgramRunnerAttempt, type ProgramTransform, type ProgrammerState, type ProgrammerUpdate, PromptQLSdk, type PromptQLSdkOptions, type PromptQlConfigFeatureFlagModel, type PromptQlUserId, type PythonRunStepDetails, type PythonStep, type ResponseGenerationState, type ResponseGenerationUpdate, type RunConfigV1, type RunFinished, type RunFinishedOutcome, type RunFinishedV1, type RunProgramRequest, type RunProgramRequest2, type RunSavedProgramRequest, type RunSavedProgramRequest2, type RunStarted, type RunStartedV1, type RunStepDetails, type SavedProgramRunnerStage, type SavedProgramRunnerState, type SavedProgramRunnerUpdate, type SavedProgramRunnerUpdateV0, type SchemaContext, type SchemaContext1, type SchemaExplored, type SchemaExplorerCompleted, type SchemaExplorerStarted, type SchemaExplorerState, type SchemaExplorerUpdate, type SchemaTask, type SchemaTasksGenerationCompleted, type SchemaTasksGenerationStarted, type SchemaTasksGenerationState, type SchemaTasksGenerationUpdate, type SendMessageToThreadArguments, type SendMessageToThreadOutput, type SendThreadMessageMutationVariables, type ShelfActionEvent, type ShelfSink, type ShelfUpdate, type ShelfUpdateV1, type SocialFeedRating, type SocialFeedRatingLlmUsage, type SocialFeedRatingOutcome, type SocialFeedRatingUpdate, type Span, type SqlError, type SqlErrorV1, type SqlRunStepDetails, type SqlSource, type SqlStep, type StartThreadArguments, type StartThreadMutationVariables, type StartThreadOutput, type StartingOrchestrator, type Step, type StepExecutionFinished, type StepExecutionFinishedV1, type StepExecutionStarted, type StepExecutionStartedV1, type StepState, type StepUpdate, type StreamThreadEventOptions, type SummaryAction, type TasksGenerated, type Teaching, type TeachingId, type TeachingOutcome, type TeachingState, type ThreadEvent, type ThreadEvent$1 as ThreadEventData, type ThreadFragment, type ThreadParticipants, type TransactionId, type UiBuild, type UiBuild2, type UiBuildFailure, type UiBuildResult, type UiBuildRunStepDetails, type UiBuildStep, type UiMetadata, type UiProgrammerState, type UiProgrammerUpdate, type UserCancel, type UserCancelEvent, type UserInteraction, type UserMessage, type UserMessageEvent, type UserUpload, type UserUploadMetadata, type Version, type Warning, type WikiChange, type WikiContent, type WikiDelta, type WikiExplorerCompleted, type WikiExplorerStarted, type WikiExplorerState, type WikiExplorerUpdate, type WikiGenerationOutcome, type WikiGenerationUpdate, type WikiInfoGenerated, type WikiPageV1, type WikiSection, type WikiTitle, cancelAgentMessage, createApolloClient, createPromptQLAuthTokenGenerator, diffThreadEvents, getAgentGeneratedResponse, getAgentInteractionDecisionAcceptInteractionEvent, getAgentInteractionDecisionDeclineInteractionEvent, getAgentMessageProcessingStartedEvent, getAgentOrchestratorContextExplorerCompletedEvent, getAgentOrchestratorContextExplorerStartedEvent, getAgentOrchestratorContextExplorerUpdateEvent, getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent, getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent, getAgentOrchestratorSchemaExplorerCompletedEvent, getAgentOrchestratorSchemaExplorerGeneratedCodeEvent, getAgentOrchestratorSchemaExplorerSchemaExploredEvent, getAgentOrchestratorSchemaExplorerStartedEvent, getAgentOrchestratorSchemaExplorerUpdateEvent, getAgentOrchestratorSchemaTasksGeneratedEvent, getAgentOrchestratorSchemaTasksGenerationCompletedEvent, getAgentOrchestratorSchemaTasksGenerationStartedEvent, getAgentOrchestratorSchemaTasksGenerationUpdateEvent, getAgentOrchestratorStepProgrammerEvent, getAgentOrchestratorStepSavedProgramRunnerEvent, getAgentOrchestratorStepUiProgrammerEvent, getAgentOrchestratorStepUpdateEvent, getAgentOrchestratorUpdateEvent, getAgentOrchestratorWikiExplorerCompletedEvent, getAgentOrchestratorWikiExplorerStartedEvent, getAgentOrchestratorWikiExplorerUpdateEvent, getAgentOrchestratorWikiInfoGeneratedEvent, getAgentPlanGenerationStartedEvent, getAgentPlanStepGeneratedEvent, getAgentPlanningDecisionCompletedEvent, getAgentPlanningDecisionPlanningRequiredEvent, getAgentPlanningDecisionStartedEvent, getAgentPlanningDecisionUpdateEvent, getAgentStartingOrchestratorEvent, getThread, getThreadEvents, getUserCancelEvent, getUserMessageEvent, listThreads, sendThreadMessage, startThread, streamThreadMessageEvents, subscribeThreadEvents };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var h=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var te=Object.getOwnPropertyNames;var ae=Object.prototype.hasOwnProperty;var re=(e,t)=>{for(var a in t)h(e,a,{get:t[a],enumerable:!0})},_e=(e,t,a,_)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of te(t))!ae.call(e,r)&&r!==a&&h(e,r,{get:()=>t[r],enumerable:!(_=ee(t,r))||_.enumerable});return e};var ne=e=>_e(h({},"__esModule",{value:!0}),e);var Fe={};re(Fe,{PromptQLSdk:()=>F,cancelAgentMessage:()=>k,createApolloClient:()=>U,createPromptQLAuthTokenGenerator:()=>R,diffThreadEvents:()=>ie,enrichToken:()=>J,getAgentGeneratedResponse:()=>de,getAgentInteractionDecisionAcceptInteractionEvent:()=>ce,getAgentInteractionDecisionDeclineInteractionEvent:()=>le,getAgentMessageProcessingStartedEvent:()=>ye,getAgentOrchestratorContextExplorerCompletedEvent:()=>Se,getAgentOrchestratorContextExplorerStartedEvent:()=>ge,getAgentOrchestratorContextExplorerUpdateEvent:()=>s,getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent:()=>Te,getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent:()=>Oe,getAgentOrchestratorSchemaExplorerCompletedEvent:()=>ve,getAgentOrchestratorSchemaExplorerGeneratedCodeEvent:()=>Ee,getAgentOrchestratorSchemaExplorerSchemaExploredEvent:()=>Pe,getAgentOrchestratorSchemaExplorerStartedEvent:()=>ke,getAgentOrchestratorSchemaExplorerUpdateEvent:()=>u,getAgentOrchestratorSchemaTasksGeneratedEvent:()=>Ce,getAgentOrchestratorSchemaTasksGenerationCompletedEvent:()=>Be,getAgentOrchestratorSchemaTasksGenerationStartedEvent:()=>Ae,getAgentOrchestratorSchemaTasksGenerationUpdateEvent:()=>g,getAgentOrchestratorStepProgrammerEvent:()=>Re,getAgentOrchestratorStepSavedProgramRunnerEvent:()=>we,getAgentOrchestratorStepUiProgrammerEvent:()=>Ue,getAgentOrchestratorStepUpdateEvent:()=>S,getAgentOrchestratorUpdateEvent:()=>V,getAgentOrchestratorWikiExplorerCompletedEvent:()=>fe,getAgentOrchestratorWikiExplorerStartedEvent:()=>he,getAgentOrchestratorWikiExplorerUpdateEvent:()=>M,getAgentOrchestratorWikiInfoGeneratedEvent:()=>xe,getAgentPlanGenerationStartedEvent:()=>ue,getAgentPlanStepGeneratedEvent:()=>se,getAgentPlanningDecisionCompletedEvent:()=>me,getAgentPlanningDecisionPlanningRequiredEvent:()=>Ie,getAgentPlanningDecisionStartedEvent:()=>be,getAgentPlanningDecisionUpdateEvent:()=>I,getAgentStartingOrchestratorEvent:()=>Me,getThread:()=>x,getThreadEvents:()=>B,getUserCancelEvent:()=>oe,getUserMessageEvent:()=>pe,isEnrichTokenMutationResponse:()=>P,isLuxAuthPromptQLTokenFailedResponse:()=>O,isLuxAuthPromptQLTokenSuccessResponse:()=>E,listThreads:()=>f,sendThreadMessage:()=>C,startThread:()=>A,streamThreadMessageEvents:()=>T,subscribeThreadEvents:()=>v});module.exports=ne(Fe);var l=require("rxjs");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"}}]}}]}}]},j={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"}}]}}]}}]},q={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"StartThread"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"message"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"projectId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"timezone"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"roomId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"uploads"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UserUploadInput"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"visibility"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"start_thread"},arguments:[{kind:"Argument",name:{kind:"Name",value:"message"},value:{kind:"Variable",name:{kind:"Name",value:"message"}}},{kind:"Argument",name:{kind:"Name",value:"projectId"},value:{kind:"Variable",name:{kind:"Name",value:"projectId"}}},{kind:"Argument",name:{kind:"Name",value:"timezone"},value:{kind:"Variable",name:{kind:"Name",value:"timezone"}}},{kind:"Argument",name:{kind:"Name",value:"buildId"},value:{kind:"Variable",name:{kind:"Name",value:"buildId"}}},{kind:"Argument",name:{kind:"Name",value:"buildFqdn"},value:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}}},{kind:"Argument",name:{kind:"Name",value:"roomId"},value:{kind:"Variable",name:{kind:"Name",value:"roomId"}}},{kind:"Argument",name:{kind:"Name",value:"uploads"},value:{kind:"Variable",name:{kind:"Name",value:"uploads"}}},{kind:"Argument",name:{kind:"Name",value:"visibility"},value:{kind:"Variable",name:{kind:"Name",value:"visibility"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"thread_events"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"thread_event_id"}}]}}]}}]}}]},z={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetProjectInfo"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"get_project_info"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"projectId"}},{kind:"Field",name:{kind:"Name",value:"projectName"}},{kind:"Field",name:{kind:"Name",value:"promptqlConsoleUrl"}}]}}]}}]},G={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreads"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"threads_v2_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"threads_v2_order_by"}}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"threads_v2"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Thread"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Thread"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"threads_v2"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"build_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"relevant_event_count"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}},{kind:"Field",name:{kind:"Name",value:"email"}},{kind:"Field",name:{kind:"Name",value:"is_active"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}}]}}]}}]},Q={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"}}]}}]}}]},D={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"}}}],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:"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"}}]}}]},K={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"subscription",name:{kind:"Name",value:"SubscribeThreadEvents"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"EnumValue",value:"asc"}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadEvent"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"thread_events"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"user_id"}}]}}]};function y(e){return e=e?e.trim():"",e?e[e.length-1]==="/"?e.slice(0,e.length-1):e:""}function c(e){if(e==null)return null;try{Number.parseInt(e)}catch{throw new Error("invalid threadEventId")}return e}function f(e,t){return e.query({query:G,variables:{...t,limit:t.limit&&t.limit>0?t.limit:10},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2??[])}function x(e,t){if(!t)throw new Error("threadId is required");return e.query({query:Q,variables:{id:t},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2_by_pk)}function A(e,t){if(!t.message.trim())throw new Error("message must not be empty");return e.mutate({mutation:q,variables:t}).then(a=>{if(!a.data?.start_thread)throw new Error(a.error?.message||"Failed to start thread");return a.data.start_thread})}function B(e,t,a){if(!t)throw new Error("threadId is required");let _={thread_id:{_eq:t}};if(a){let r=c(a.fromEventId),n=c(a.toEventId);r&&n?_.thread_event_id={_gte:a.fromEventId,_lte:a.toEventId}:r?_.thread_event_id={_gte:r}:n&&(_.thread_event_id={_lte:n}),a.messageId&&(_._or=L(a.messageId))}return e.query({query:D,variables:{where:_,limit:a?.limit},fetchPolicy:"no-cache"}).then(r=>r.data?.thread_events??[])}function C(e,t){if(!t.threadId)throw new Error("threadId is required");if(!t.message.trim())throw new Error("message must not be empty");return e.mutate({mutation:j,variables:t}).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 k(e,t){if(!t.threadId)throw new Error("threadId is required");if(!t.messageId.trim())throw new Error("messageId is required");return e.mutate({mutation:N,variables:t}).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 v(e,t,a){return H(e,t,{fromEventId:a})}function T(e,t,a){return H(e,t,a).pipe((0,l.takeWhile)(_=>{for(let r=_.length-1;r>0;r--){let n=_[r];if("AgentMessage"in n.event_data&&"InteractionFinished"in n.event_data.AgentMessage.update)return!1}return!0},!0))}function H(e,t,a){if(!t)throw new Error("threadId is required");let _={thread_id:{_eq:t}};return a&&(c(a.fromEventId)&&(_.thread_event_id={_gte:a.fromEventId}),a.messageId&&(_._or=L(a.messageId))),e.subscribe({query:K,variables:{where:_}}).pipe((0,l.map)(r=>{if(r.error)throw r.error;return r.data?.thread_events??[]}))}function L(e){return[{event_data:{_contains:{UserMessage:{message_id:e}}}},{event_data:{_contains:{AgentMessage:{message_id:e}}}},{event_data:{_contains:{UserCancel:{message_id:e}}}}]}function O(e){return e!=null&&typeof e=="object"&&"status"in e&&e.status==="failure"}function E(e){return e!=null&&typeof e=="object"&&"status"in e&&e.status==="success"&&"token"in e}function P(e){return e!=null&&typeof e=="object"&&("data"in e&&!!e.data&&typeof e.data=="object"&&"enrich_token"in e.data&&!!e.data.enrich_token&&typeof e.data.enrich_token=="object"&&"userDirectoryJWT"in e.data.enrich_token||"errors"in e&&Array.isArray(e.errors))}function R(e){let a=`${y(e.authHost)||"https://auth.pro.hasura.io"}/ddn/promptql/token`,_={token:"",expiry:new Date(0)},r=e.fetch||fetch,n=async()=>{let p=await r(a,{method:"POST",headers:{Authorization:`pat ${e.serviceAccountToken}`}});switch(p.status){case 200:{let i=await p.json();if(E(i))return i;throw new Error("malformed token response")}case 401:{let i=await p.json();throw O(i)?new Error(i?.error||p.statusText):new Error(p.statusText)}default:{let i=await p.text();throw new Error(i)}}};return async()=>{if(_.expiry.getTime()<=Date.now()-1e3){let p=await n(),i=await J(e.promptqlGraphQLUrl,p.token,void 0,r);_.token=i;let d=new Date(p.expiry);if(Number.isNaN(d.getTime())){let W=new Date;W.setHours(1),_.expiry=W}else _.expiry=d}return _.token}}var J=async(e,t,a,_=fetch)=>{let r=await _(e,{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:t,projectId:a},operationName:"EnrichToken"})});switch(r.status){case 200:{let n=await r.json();if(!P(n)||!n.data?.enrich_token?.userDirectoryJWT)throw new Error(`malformed promptql token response: ${JSON.stringify(n)}`);return n.data.enrich_token.userDirectoryJWT}default:{let n=await r.text();throw new Error(n)}}};var o=require("@apollo/client"),$=require("@apollo/client/link/context"),Z=require("@apollo/client/link/subscriptions"),X=require("graphql"),Y=require("graphql-ws"),U=e=>{let t=new o.HttpLink({uri:e.url,fetch:e.fetch,headers:e.headers}),a=async i=>{let d=await e.getAuthToken();return{headers:{...i,Authorization:`Bearer ${d}`}}},_=(0,Y.createClient)({url:e.url,connectionParams:()=>a(e.headers)}),r=new Z.GraphQLWsLink(_),n=new $.SetContextLink(({headers:i})=>a(i)),p=o.ApolloLink.split(({operationType:i})=>i===X.OperationTypeNode.SUBSCRIPTION,r,n.concat(t));return{client:new o.ApolloClient({link:p,cache:new o.InMemoryCache}),wsClient:_}};var b=class{_options;constructor(t){this._options=t}info(){return w(this._options.client)}};function w(e){return e.query({query:z,fetchPolicy:"cache-first"}).then(t=>{if(!t.data?.get_project_info)throw new Error(t.error?.message||"Project not found");return t.data.get_project_info})}var m=class{_options;constructor(t){this._options=t}list(t){return f(this._options.client,{...t,limit:t.limit&&t.limit>0?t.limit:10})}get(t){if(!t)throw new Error("threadId is required");return x(this._options.client,t)}async start(t){let a=await w(this._options.client);return A(this._options.client,{...t,projectId:a.projectId,buildId:t.buildId||this._options.buildId,timezone:t.timezone||this._options.defaultTimezone})}getEvents(t,a){return B(this._options.client,t,a)}sendMessage(t){return C(this._options.client,{...t,timezone:t.timezone||this._options.defaultTimezone})}cancelAgentMessage(t){return k(this._options.client,t)}subscribeEvents(t,a){return v(this._options.client,t,a)}streamMessageEvents(t,a){return T(this._options.client,t,a)}};var F=class{constructor(t){let a=y(t.promptqlBaseUrl)||"https://promptql.ddn.hasura.app";if(!t.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=R({promptqlGraphQLUrl:_,authHost:t.authHost,serviceAccountToken:t.serviceAccountToken,fetch:t.fetch});let{client:r,wsClient:n}=U({getAuthToken:this._fetchToken,url:_,fetch:t.fetch,headers:t.headers});this._wsClient=n,this._options={client:r,buildId:t.buildId,defaultTimezone:t.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone},this.thread=new m(this._options),this.project=new b(this._options)}_options;_wsClient;_fetchToken;thread;project;authenticated(){return this._fetchToken().then(()=>!0).catch(()=>!1)}close(){this._wsClient.dispose(),this._options.client.clearStore()}};function ie(e,t){if(!t.length)return[];if(!e.length)return t;let a=e[e.length-1];if(!a)return t;let _=BigInt(a.thread_event_id),r=t.length-1;for(;r>=0;r--){let n=t[r];if(BigInt(n?.thread_event_id)<=_)break}return t.slice(r+1)}function pe(e){return"UserMessage"in e?e.UserMessage:null}function oe(e){return"UserCancel"in e?e.UserCancel:null}function ue(e){return!("AgentMessage"in e)||!("OrchestratorUpdate"in e.AgentMessage.update)||!("PlanGenerationStarted"in e.AgentMessage.update.OrchestratorUpdate.update)?null:e.AgentMessage.update.OrchestratorUpdate.update.PlanGenerationStarted}function se(e){return!("AgentMessage"in e)||!("OrchestratorUpdate"in e.AgentMessage.update)||!("PlanStepGenerated"in e.AgentMessage.update.OrchestratorUpdate.update)?null:e.AgentMessage.update.OrchestratorUpdate.update.PlanStepGenerated}function de(e){return!("AgentMessage"in e)||!("OrchestratorUpdate"in e.AgentMessage.update)||!("GeneratedResponse"in e.AgentMessage.update.OrchestratorUpdate.update)?null:e.AgentMessage.update.OrchestratorUpdate.update.GeneratedResponse}function ye(e){return!("AgentMessage"in e)||!("MessageProcessingUpdate"in e.AgentMessage.update)||!("ProcessingStarted"in e.AgentMessage.update.MessageProcessingUpdate.update)?null:e.AgentMessage.update.MessageProcessingUpdate.update.ProcessingStarted}function ce(e){return!("AgentMessage"in e)||!("MessageProcessingUpdate"in e.AgentMessage.update)||!("InteractionDecision"in e.AgentMessage.update.MessageProcessingUpdate.update)||!("AcceptInteraction"in e.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:e.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.AcceptInteraction}function le(e){return!("AgentMessage"in e)||!("MessageProcessingUpdate"in e.AgentMessage.update)||!("InteractionDecision"in e.AgentMessage.update.MessageProcessingUpdate.update)||!("DeclineInteraction"in e.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:e.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.DeclineInteraction}function I(e){return!("AgentMessage"in e)||!("PlanningDecisionUpdate"in e.AgentMessage.update)?null:e.AgentMessage.update.PlanningDecisionUpdate.update}function be(e){let t=I(e);return!t||!("Started"in t)?null:t.Started}function me(e){let t=I(e);return!t||!("Completed"in t)?null:t.Completed}function Ie(e){let t=I(e);return!t||!("PlanningRequired"in t)?null:t.PlanningRequired}function Me(e){return!("AgentMessage"in e)||!("StartingOrchestrator"in e.AgentMessage.update)?null:e.AgentMessage.update.StartingOrchestrator}function V(e){return!("AgentMessage"in e)||!("OrchestratorUpdate"in e.AgentMessage.update)?null:e.AgentMessage.update.OrchestratorUpdate.update}function s(e){let t=V(e);return!t||!("ContextExplorerUpdate"in t)?null:t.ContextExplorerUpdate.update}function ge(e){let t=s(e);return!t||!("Started"in t)?null:t.Started}function Se(e){let t=s(e);return!t||!("Completed"in t)?null:t.Completed}function M(e){let t=s(e);return!t||!("WikiExplorerUpdate"in t)?null:t.WikiExplorerUpdate.update}function he(e){let t=M(e);return!t||!("Started"in t)?null:t.Started}function fe(e){let t=M(e);return!t||!("Completed"in t)?null:t.Completed}function xe(e){let t=M(e);return!t||!("WikiInfoGenerated"in t)?null:t.WikiInfoGenerated}function g(e){let t=s(e);return!t||!("SchemaTasksGenerationUpdate"in t)?null:t.SchemaTasksGenerationUpdate.update}function Ae(e){let t=g(e);return!t||!("Started"in t)?null:t.Started}function Be(e){let t=g(e);return!t||!("Completed"in t)?null:t.Completed}function Ce(e){let t=g(e);return!t||!("TasksGenerated"in t)?null:t.TasksGenerated}function u(e){let t=s(e);return!t||!("SchemaExplorerUpdate"in t)?null:t.SchemaExplorerUpdate.update}function ke(e){let t=u(e);return!t||!("Started"in t)?null:t.Started}function ve(e){let t=u(e);return!t||!("Completed"in t)?null:t.Completed}function Te(e){let t=u(e);return!t||!("CodeExecutionComplete"in t)?null:t.CodeExecutionComplete}function Oe(e){let t=u(e);return!t||!("CodeOutputAnalyzed"in t)?null:t.CodeOutputAnalyzed}function Ee(e){let t=u(e);return!t||!("GeneratedCode"in t)?null:t.GeneratedCode}function Pe(e){let t=u(e);return!t||!("SchemaExplored"in t)?null:t.SchemaExplored}function S(e){let t=V(e);return!t||!("StepUpdate"in t)?null:t.StepUpdate}function Re(e){let t=S(e);return!t||!("Programmer"in t.update)?null:t.update.Programmer}function Ue(e){let t=S(e);return!t||!("UiProgrammer"in t.update)?null:t.update.UiProgrammer}function we(e){let t=S(e);return!t||!("SavedProgramRunner"in t.update)?null:t.update.SavedProgramRunner}0&&(module.exports={PromptQLSdk,cancelAgentMessage,createApolloClient,createPromptQLAuthTokenGenerator,diffThreadEvents,enrichToken,getAgentGeneratedResponse,getAgentInteractionDecisionAcceptInteractionEvent,getAgentInteractionDecisionDeclineInteractionEvent,getAgentMessageProcessingStartedEvent,getAgentOrchestratorContextExplorerCompletedEvent,getAgentOrchestratorContextExplorerStartedEvent,getAgentOrchestratorContextExplorerUpdateEvent,getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent,getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent,getAgentOrchestratorSchemaExplorerCompletedEvent,getAgentOrchestratorSchemaExplorerGeneratedCodeEvent,getAgentOrchestratorSchemaExplorerSchemaExploredEvent,getAgentOrchestratorSchemaExplorerStartedEvent,getAgentOrchestratorSchemaExplorerUpdateEvent,getAgentOrchestratorSchemaTasksGeneratedEvent,getAgentOrchestratorSchemaTasksGenerationCompletedEvent,getAgentOrchestratorSchemaTasksGenerationStartedEvent,getAgentOrchestratorSchemaTasksGenerationUpdateEvent,getAgentOrchestratorStepProgrammerEvent,getAgentOrchestratorStepSavedProgramRunnerEvent,getAgentOrchestratorStepUiProgrammerEvent,getAgentOrchestratorStepUpdateEvent,getAgentOrchestratorUpdateEvent,getAgentOrchestratorWikiExplorerCompletedEvent,getAgentOrchestratorWikiExplorerStartedEvent,getAgentOrchestratorWikiExplorerUpdateEvent,getAgentOrchestratorWikiInfoGeneratedEvent,getAgentPlanGenerationStartedEvent,getAgentPlanStepGeneratedEvent,getAgentPlanningDecisionCompletedEvent,getAgentPlanningDecisionPlanningRequiredEvent,getAgentPlanningDecisionStartedEvent,getAgentPlanningDecisionUpdateEvent,getAgentStartingOrchestratorEvent,getThread,getThreadEvents,getUserCancelEvent,getUserMessageEvent,isEnrichTokenMutationResponse,isLuxAuthPromptQLTokenFailedResponse,isLuxAuthPromptQLTokenSuccessResponse,listThreads,sendThreadMessage,startThread,streamThreadMessageEvents,subscribeThreadEvents});
1
+ "use strict";var f=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var te=Object.getOwnPropertyNames;var ae=Object.prototype.hasOwnProperty;var re=(e,t)=>{for(var a in t)f(e,a,{get:t[a],enumerable:!0})},_e=(e,t,a,_)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of te(t))!ae.call(e,r)&&r!==a&&f(e,r,{get:()=>t[r],enumerable:!(_=ee(t,r))||_.enumerable});return e};var ne=e=>_e(f({},"__esModule",{value:!0}),e);var Ve={};re(Ve,{PromptQLSdk:()=>R,cancelAgentMessage:()=>v,createApolloClient:()=>E,createPromptQLAuthTokenGenerator:()=>b,diffThreadEvents:()=>pe,getAgentGeneratedResponse:()=>ye,getAgentInteractionDecisionAcceptInteractionEvent:()=>le,getAgentInteractionDecisionDeclineInteractionEvent:()=>be,getAgentMessageProcessingStartedEvent:()=>ce,getAgentOrchestratorContextExplorerCompletedEvent:()=>he,getAgentOrchestratorContextExplorerStartedEvent:()=>Se,getAgentOrchestratorContextExplorerUpdateEvent:()=>s,getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent:()=>Oe,getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent:()=>Ee,getAgentOrchestratorSchemaExplorerCompletedEvent:()=>Te,getAgentOrchestratorSchemaExplorerGeneratedCodeEvent:()=>Pe,getAgentOrchestratorSchemaExplorerSchemaExploredEvent:()=>Re,getAgentOrchestratorSchemaExplorerStartedEvent:()=>ve,getAgentOrchestratorSchemaExplorerUpdateEvent:()=>u,getAgentOrchestratorSchemaTasksGeneratedEvent:()=>ke,getAgentOrchestratorSchemaTasksGenerationCompletedEvent:()=>Ce,getAgentOrchestratorSchemaTasksGenerationStartedEvent:()=>Be,getAgentOrchestratorSchemaTasksGenerationUpdateEvent:()=>S,getAgentOrchestratorStepProgrammerEvent:()=>Ue,getAgentOrchestratorStepSavedProgramRunnerEvent:()=>Fe,getAgentOrchestratorStepUiProgrammerEvent:()=>we,getAgentOrchestratorStepUpdateEvent:()=>h,getAgentOrchestratorUpdateEvent:()=>U,getAgentOrchestratorWikiExplorerCompletedEvent:()=>xe,getAgentOrchestratorWikiExplorerStartedEvent:()=>fe,getAgentOrchestratorWikiExplorerUpdateEvent:()=>g,getAgentOrchestratorWikiInfoGeneratedEvent:()=>Ae,getAgentPlanGenerationStartedEvent:()=>se,getAgentPlanStepGeneratedEvent:()=>de,getAgentPlanningDecisionCompletedEvent:()=>Ie,getAgentPlanningDecisionPlanningRequiredEvent:()=>Me,getAgentPlanningDecisionStartedEvent:()=>me,getAgentPlanningDecisionUpdateEvent:()=>M,getAgentStartingOrchestratorEvent:()=>ge,getThread:()=>A,getThreadEvents:()=>C,getUserCancelEvent:()=>ue,getUserMessageEvent:()=>oe,listThreads:()=>x,sendThreadMessage:()=>k,startThread:()=>B,streamThreadMessageEvents:()=>O,subscribeThreadEvents:()=>T});module.exports=ne(Ve);var l=require("rxjs");var F={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CancelAgentMessage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"threadId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"messageId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"cancel_agent_message"},arguments:[{kind:"Argument",name:{kind:"Name",value:"threadId"},value:{kind:"Variable",name:{kind:"Name",value:"threadId"}}},{kind:"Argument",name:{kind:"Name",value:"agentMessageId"},value:{kind:"Variable",name:{kind:"Name",value:"messageId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}}]}}]}}]},V={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"SendThreadMessage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"message"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"timezone"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"threadId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"uploads"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UserUploadInput"}}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"send_thread_message"},arguments:[{kind:"Argument",name:{kind:"Name",value:"threadId"},value:{kind:"Variable",name:{kind:"Name",value:"threadId"}}},{kind:"Argument",name:{kind:"Name",value:"timezone"},value:{kind:"Variable",name:{kind:"Name",value:"timezone"}}},{kind:"Argument",name:{kind:"Name",value:"message"},value:{kind:"Variable",name:{kind:"Name",value:"message"}}},{kind:"Argument",name:{kind:"Name",value:"buildFqdn"},value:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}}},{kind:"Argument",name:{kind:"Name",value:"uploads"},value:{kind:"Variable",name:{kind:"Name",value:"uploads"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"created_at"}}]}}]}}]},W={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"StartThread"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"message"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"projectId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"timezone"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"roomId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"uploads"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UserUploadInput"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"visibility"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"start_thread"},arguments:[{kind:"Argument",name:{kind:"Name",value:"message"},value:{kind:"Variable",name:{kind:"Name",value:"message"}}},{kind:"Argument",name:{kind:"Name",value:"projectId"},value:{kind:"Variable",name:{kind:"Name",value:"projectId"}}},{kind:"Argument",name:{kind:"Name",value:"timezone"},value:{kind:"Variable",name:{kind:"Name",value:"timezone"}}},{kind:"Argument",name:{kind:"Name",value:"buildId"},value:{kind:"Variable",name:{kind:"Name",value:"buildId"}}},{kind:"Argument",name:{kind:"Name",value:"buildFqdn"},value:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}}},{kind:"Argument",name:{kind:"Name",value:"roomId"},value:{kind:"Variable",name:{kind:"Name",value:"roomId"}}},{kind:"Argument",name:{kind:"Name",value:"uploads"},value:{kind:"Variable",name:{kind:"Name",value:"uploads"}}},{kind:"Argument",name:{kind:"Name",value:"visibility"},value:{kind:"Variable",name:{kind:"Name",value:"visibility"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"thread_events"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"thread_event_id"}}]}}]}}]}}]},N={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"}}]}}]}}]},j={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"}}]}}]}}]},q={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"}}]}}]}}]},z={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"}}}],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:"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"}}]}}]},G={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"subscription",name:{kind:"Name",value:"SubscribeThreadEvents"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"EnumValue",value:"asc"}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadEvent"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"thread_events"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"user_id"}}]}}]};function y(e){return e=e?e.trim():"",e?e[e.length-1]==="/"?e.slice(0,e.length-1):e:""}function c(e){if(e==null)return null;try{Number.parseInt(e)}catch{throw new Error("invalid threadEventId")}return e}function x(e,t){return e.query({query:j,variables:{...t,limit:t.limit&&t.limit>0?t.limit:10},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2??[])}function A(e,t){if(!t)throw new Error("threadId is required");return e.query({query:q,variables:{id:t},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2_by_pk)}function B(e,t){if(!t.message.trim())throw new Error("message must not be empty");return e.mutate({mutation:W,variables:t}).then(a=>{if(!a.data?.start_thread)throw new Error(a.error?.message||"Failed to start thread");return a.data.start_thread})}function C(e,t,a){if(!t)throw new Error("threadId is required");let _={thread_id:{_eq:t}};if(a){let r=c(a.fromEventId),n=c(a.toEventId);r&&n?_.thread_event_id={_gte:a.fromEventId,_lte:a.toEventId}:r?_.thread_event_id={_gte:r}:n&&(_.thread_event_id={_lte:n}),a.messageId&&(_._or=D(a.messageId))}return e.query({query:z,variables:{where:_,limit:a?.limit},fetchPolicy:"no-cache"}).then(r=>r.data?.thread_events??[])}function k(e,t){if(!t.threadId)throw new Error("threadId is required");if(!t.message.trim())throw new Error("message must not be empty");return e.mutate({mutation:V,variables:t}).then(a=>{if(!a.data?.send_thread_message)throw new Error(a.error?.message||"Failed to send message to thread");return a.data.send_thread_message})}function v(e,t){if(!t.threadId)throw new Error("threadId is required");if(!t.messageId.trim())throw new Error("messageId is required");return e.mutate({mutation:F,variables:t}).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 T(e,t,a){return Q(e,t,{fromEventId:a})}function O(e,t,a){return Q(e,t,a).pipe((0,l.takeWhile)(_=>{for(let r=_.length-1;r>0;r--){let n=_[r];if("AgentMessage"in n.event_data&&"InteractionFinished"in n.event_data.AgentMessage.update)return!1}return!0},!0))}function Q(e,t,a){if(!t)throw new Error("threadId is required");let _={thread_id:{_eq:t}};return a&&(c(a.fromEventId)&&(_.thread_event_id={_gte:a.fromEventId}),a.messageId&&(_._or=D(a.messageId))),e.subscribe({query:G,variables:{where:_}}).pipe((0,l.map)(r=>{if(r.error)throw r.error;return r.data?.thread_events??[]}))}function D(e){return[{event_data:{_contains:{UserMessage:{message_id:e}}}},{event_data:{_contains:{AgentMessage:{message_id:e}}}},{event_data:{_contains:{UserCancel:{message_id:e}}}}]}function K(e){return e!=null&&typeof e=="object"&&"status"in e&&e.status==="failure"}function H(e){return e!=null&&typeof e=="object"&&"status"in e&&e.status==="success"&&"token"in e}function L(e){return e!=null&&typeof e=="object"&&("data"in e&&!!e.data&&typeof e.data=="object"&&"enrich_token"in e.data&&!!e.data.enrich_token&&typeof e.data.enrich_token=="object"&&"userDirectoryJWT"in e.data.enrich_token||"errors"in e&&Array.isArray(e.errors))}function b(e){let a=`${y(e.authHost)||"https://auth.pro.hasura.io"}/ddn/promptql/token`,_={token:"",expiry:new Date(0)},r=e.fetch||fetch,n=async()=>{let p=await r(a,{method:"POST",headers:e.headers});switch(p.status){case 200:{let i=await p.json();if(H(i))return i;throw new Error("malformed token response")}case 401:{let i=await p.json();throw K(i)?new Error(i?.error||p.statusText):new Error(p.statusText)}default:{let i=await p.text();throw new Error(i)}}};return async()=>{if(_.expiry.getTime()<=Date.now()-1e3){let p=await n(),i=await ie(e.promptqlGraphQLUrl,p.token,e.projectId,r);_.token=i;let d=new Date(p.expiry);if(Number.isNaN(d.getTime())){let w=new Date;w.setHours(1),_.expiry=w}else _.expiry=d}return _.token}}var ie=async(e,t,a,_=fetch)=>{let r=await _(e,{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:t,projectId:a},operationName:"EnrichToken"})});switch(r.status){case 200:{let n=await r.json();if(!L(n)||!n.data?.enrich_token?.userDirectoryJWT)throw new Error(`malformed promptql token response: ${JSON.stringify(n)}`);return n.data.enrich_token.userDirectoryJWT}default:{let n=await r.text();throw new Error(n)}}};function J(e){return{Authorization:`pat ${e}`}}var o=require("@apollo/client"),$=require("@apollo/client/link/context"),Z=require("@apollo/client/link/subscriptions"),X=require("graphql"),Y=require("graphql-ws"),E=e=>{let t=new o.HttpLink({uri:e.url,fetch:e.fetch,headers:e.headers}),a=async i=>{let d=await e.getAuthToken();return{headers:{...i,Authorization:`Bearer ${d}`}}},_=(0,Y.createClient)({url:e.url,connectionParams:()=>a(e.headers)}),r=new Z.GraphQLWsLink(_),n=new $.SetContextLink(({headers:i})=>a(i)),p=o.ApolloLink.split(({operationType:i})=>i===X.OperationTypeNode.SUBSCRIPTION,r,n.concat(t));return{client:new o.ApolloClient({link:p,cache:new o.InMemoryCache}),wsClient:_}};var m=class{_options;constructor(t){this._options=t}info(){return P(this._options.client)}};function P(e){return e.query({query:N,fetchPolicy:"cache-first"}).then(t=>{if(!t.data?.get_project_info)throw new Error(t.error?.message||"Project not found");return t.data.get_project_info})}var I=class{_options;constructor(t){this._options=t}list(t){return x(this._options.client,{...t,limit:t.limit&&t.limit>0?t.limit:10})}get(t){if(!t)throw new Error("threadId is required");return A(this._options.client,t)}async start(t){let a=await P(this._options.client);return B(this._options.client,{...t,projectId:a.projectId,buildId:t.buildId||this._options.buildId,timezone:t.timezone||this._options.defaultTimezone})}getEvents(t,a){return C(this._options.client,t,a)}sendMessage(t){return k(this._options.client,{...t,timezone:t.timezone||this._options.defaultTimezone})}cancelAgentMessage(t){return v(this._options.client,t)}subscribeEvents(t,a){return T(this._options.client,t,a)}streamMessageEvents(t,a){return O(this._options.client,t,a)}};var R=class{constructor(t){let a=y(t.promptqlBaseUrl)||"https://promptql.ddn.hasura.app";if(!t.serviceAccountToken)throw new Error("serviceAccountToken must not be empty. If you haven't created any service account token yet, check out Hasura docs https://hasura.io/docs/3.0/project-configuration/project-management/service-accounts/#how-to-create-service-account");let _=a.endsWith("/v1/graphql")?a:`${a}/playground-v2-hge/v1/graphql`;this._fetchToken=b({promptqlGraphQLUrl:_,authHost:t.authHost,headers:J(t.serviceAccountToken),fetch:t.fetch});let{client:r,wsClient:n}=E({getAuthToken:this._fetchToken,url:_,fetch:t.fetch,headers:t.headers});this._wsClient=n,this._options={client:r,buildId:t.buildId,defaultTimezone:t.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone},this.thread=new I(this._options),this.project=new m(this._options)}_options;_wsClient;_fetchToken;thread;project;authenticated(){return this._fetchToken().then(()=>!0).catch(()=>!1)}close(){this._wsClient.dispose(),this._options.client.clearStore()}};function pe(e,t){if(!t.length)return[];if(!e.length)return t;let a=e[e.length-1];if(!a)return t;let _=BigInt(a.thread_event_id),r=t.length-1;for(;r>=0;r--){let n=t[r];if(BigInt(n?.thread_event_id)<=_)break}return t.slice(r+1)}function oe(e){return"UserMessage"in e?e.UserMessage:null}function ue(e){return"UserCancel"in e?e.UserCancel:null}function se(e){return!("AgentMessage"in e)||!("OrchestratorUpdate"in e.AgentMessage.update)||!("PlanGenerationStarted"in e.AgentMessage.update.OrchestratorUpdate.update)?null:e.AgentMessage.update.OrchestratorUpdate.update.PlanGenerationStarted}function de(e){return!("AgentMessage"in e)||!("OrchestratorUpdate"in e.AgentMessage.update)||!("PlanStepGenerated"in e.AgentMessage.update.OrchestratorUpdate.update)?null:e.AgentMessage.update.OrchestratorUpdate.update.PlanStepGenerated}function ye(e){return!("AgentMessage"in e)||!("OrchestratorUpdate"in e.AgentMessage.update)||!("GeneratedResponse"in e.AgentMessage.update.OrchestratorUpdate.update)?null:e.AgentMessage.update.OrchestratorUpdate.update.GeneratedResponse}function ce(e){return!("AgentMessage"in e)||!("MessageProcessingUpdate"in e.AgentMessage.update)||!("ProcessingStarted"in e.AgentMessage.update.MessageProcessingUpdate.update)?null:e.AgentMessage.update.MessageProcessingUpdate.update.ProcessingStarted}function le(e){return!("AgentMessage"in e)||!("MessageProcessingUpdate"in e.AgentMessage.update)||!("InteractionDecision"in e.AgentMessage.update.MessageProcessingUpdate.update)||!("AcceptInteraction"in e.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:e.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.AcceptInteraction}function be(e){return!("AgentMessage"in e)||!("MessageProcessingUpdate"in e.AgentMessage.update)||!("InteractionDecision"in e.AgentMessage.update.MessageProcessingUpdate.update)||!("DeclineInteraction"in e.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:e.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.DeclineInteraction}function M(e){return!("AgentMessage"in e)||!("PlanningDecisionUpdate"in e.AgentMessage.update)?null:e.AgentMessage.update.PlanningDecisionUpdate.update}function me(e){let t=M(e);return!t||!("Started"in t)?null:t.Started}function Ie(e){let t=M(e);return!t||!("Completed"in t)?null:t.Completed}function Me(e){let t=M(e);return!t||!("PlanningRequired"in t)?null:t.PlanningRequired}function ge(e){return!("AgentMessage"in e)||!("StartingOrchestrator"in e.AgentMessage.update)?null:e.AgentMessage.update.StartingOrchestrator}function U(e){return!("AgentMessage"in e)||!("OrchestratorUpdate"in e.AgentMessage.update)?null:e.AgentMessage.update.OrchestratorUpdate.update}function s(e){let t=U(e);return!t||!("ContextExplorerUpdate"in t)?null:t.ContextExplorerUpdate.update}function Se(e){let t=s(e);return!t||!("Started"in t)?null:t.Started}function he(e){let t=s(e);return!t||!("Completed"in t)?null:t.Completed}function g(e){let t=s(e);return!t||!("WikiExplorerUpdate"in t)?null:t.WikiExplorerUpdate.update}function fe(e){let t=g(e);return!t||!("Started"in t)?null:t.Started}function xe(e){let t=g(e);return!t||!("Completed"in t)?null:t.Completed}function Ae(e){let t=g(e);return!t||!("WikiInfoGenerated"in t)?null:t.WikiInfoGenerated}function S(e){let t=s(e);return!t||!("SchemaTasksGenerationUpdate"in t)?null:t.SchemaTasksGenerationUpdate.update}function Be(e){let t=S(e);return!t||!("Started"in t)?null:t.Started}function Ce(e){let t=S(e);return!t||!("Completed"in t)?null:t.Completed}function ke(e){let t=S(e);return!t||!("TasksGenerated"in t)?null:t.TasksGenerated}function u(e){let t=s(e);return!t||!("SchemaExplorerUpdate"in t)?null:t.SchemaExplorerUpdate.update}function ve(e){let t=u(e);return!t||!("Started"in t)?null:t.Started}function Te(e){let t=u(e);return!t||!("Completed"in t)?null:t.Completed}function Oe(e){let t=u(e);return!t||!("CodeExecutionComplete"in t)?null:t.CodeExecutionComplete}function Ee(e){let t=u(e);return!t||!("CodeOutputAnalyzed"in t)?null:t.CodeOutputAnalyzed}function Pe(e){let t=u(e);return!t||!("GeneratedCode"in t)?null:t.GeneratedCode}function Re(e){let t=u(e);return!t||!("SchemaExplored"in t)?null:t.SchemaExplored}function h(e){let t=U(e);return!t||!("StepUpdate"in t)?null:t.StepUpdate}function Ue(e){let t=h(e);return!t||!("Programmer"in t.update)?null:t.update.Programmer}function we(e){let t=h(e);return!t||!("UiProgrammer"in t.update)?null:t.update.UiProgrammer}function Fe(e){let t=h(e);return!t||!("SavedProgramRunner"in t.update)?null:t.update.SavedProgramRunner}0&&(module.exports={PromptQLSdk,cancelAgentMessage,createApolloClient,createPromptQLAuthTokenGenerator,diffThreadEvents,getAgentGeneratedResponse,getAgentInteractionDecisionAcceptInteractionEvent,getAgentInteractionDecisionDeclineInteractionEvent,getAgentMessageProcessingStartedEvent,getAgentOrchestratorContextExplorerCompletedEvent,getAgentOrchestratorContextExplorerStartedEvent,getAgentOrchestratorContextExplorerUpdateEvent,getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent,getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent,getAgentOrchestratorSchemaExplorerCompletedEvent,getAgentOrchestratorSchemaExplorerGeneratedCodeEvent,getAgentOrchestratorSchemaExplorerSchemaExploredEvent,getAgentOrchestratorSchemaExplorerStartedEvent,getAgentOrchestratorSchemaExplorerUpdateEvent,getAgentOrchestratorSchemaTasksGeneratedEvent,getAgentOrchestratorSchemaTasksGenerationCompletedEvent,getAgentOrchestratorSchemaTasksGenerationStartedEvent,getAgentOrchestratorSchemaTasksGenerationUpdateEvent,getAgentOrchestratorStepProgrammerEvent,getAgentOrchestratorStepSavedProgramRunnerEvent,getAgentOrchestratorStepUiProgrammerEvent,getAgentOrchestratorStepUpdateEvent,getAgentOrchestratorUpdateEvent,getAgentOrchestratorWikiExplorerCompletedEvent,getAgentOrchestratorWikiExplorerStartedEvent,getAgentOrchestratorWikiExplorerUpdateEvent,getAgentOrchestratorWikiInfoGeneratedEvent,getAgentPlanGenerationStartedEvent,getAgentPlanStepGeneratedEvent,getAgentPlanningDecisionCompletedEvent,getAgentPlanningDecisionPlanningRequiredEvent,getAgentPlanningDecisionStartedEvent,getAgentPlanningDecisionUpdateEvent,getAgentStartingOrchestratorEvent,getThread,getThreadEvents,getUserCancelEvent,getUserMessageEvent,listThreads,sendThreadMessage,startThread,streamThreadMessageEvents,subscribeThreadEvents});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{map as K,takeWhile as H}from"rxjs";var h={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CancelAgentMessage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"threadId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"messageId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"cancel_agent_message"},arguments:[{kind:"Argument",name:{kind:"Name",value:"threadId"},value:{kind:"Variable",name:{kind:"Name",value:"threadId"}}},{kind:"Argument",name:{kind:"Name",value:"agentMessageId"},value:{kind:"Variable",name:{kind:"Name",value:"messageId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}}]}}]}}]},f={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"SendThreadMessage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"message"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"timezone"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"threadId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"uploads"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UserUploadInput"}}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"send_thread_message"},arguments:[{kind:"Argument",name:{kind:"Name",value:"threadId"},value:{kind:"Variable",name:{kind:"Name",value:"threadId"}}},{kind:"Argument",name:{kind:"Name",value:"timezone"},value:{kind:"Variable",name:{kind:"Name",value:"timezone"}}},{kind:"Argument",name:{kind:"Name",value:"message"},value:{kind:"Variable",name:{kind:"Name",value:"message"}}},{kind:"Argument",name:{kind:"Name",value:"buildFqdn"},value:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}}},{kind:"Argument",name:{kind:"Name",value:"uploads"},value:{kind:"Variable",name:{kind:"Name",value:"uploads"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"created_at"}}]}}]}}]},x={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"StartThread"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"message"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"projectId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"timezone"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"roomId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"uploads"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UserUploadInput"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"visibility"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"start_thread"},arguments:[{kind:"Argument",name:{kind:"Name",value:"message"},value:{kind:"Variable",name:{kind:"Name",value:"message"}}},{kind:"Argument",name:{kind:"Name",value:"projectId"},value:{kind:"Variable",name:{kind:"Name",value:"projectId"}}},{kind:"Argument",name:{kind:"Name",value:"timezone"},value:{kind:"Variable",name:{kind:"Name",value:"timezone"}}},{kind:"Argument",name:{kind:"Name",value:"buildId"},value:{kind:"Variable",name:{kind:"Name",value:"buildId"}}},{kind:"Argument",name:{kind:"Name",value:"buildFqdn"},value:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}}},{kind:"Argument",name:{kind:"Name",value:"roomId"},value:{kind:"Variable",name:{kind:"Name",value:"roomId"}}},{kind:"Argument",name:{kind:"Name",value:"uploads"},value:{kind:"Variable",name:{kind:"Name",value:"uploads"}}},{kind:"Argument",name:{kind:"Name",value:"visibility"},value:{kind:"Variable",name:{kind:"Name",value:"visibility"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"thread_events"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"thread_event_id"}}]}}]}}]}}]},A={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"}}]}}]}}]},B={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"}}]}}]}}]},C={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"}}]}}]}}]},k={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"}}}],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:"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"}}]}}]},v={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"subscription",name:{kind:"Name",value:"SubscribeThreadEvents"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"EnumValue",value:"asc"}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadEvent"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"thread_events"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"user_id"}}]}}]};function d(e){return e=e?e.trim():"",e?e[e.length-1]==="/"?e.slice(0,e.length-1):e:""}function y(e){if(e==null)return null;try{Number.parseInt(e)}catch{throw new Error("invalid threadEventId")}return e}function T(e,t){return e.query({query:B,variables:{...t,limit:t.limit&&t.limit>0?t.limit:10},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2??[])}function O(e,t){if(!t)throw new Error("threadId is required");return e.query({query:C,variables:{id:t},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2_by_pk)}function E(e,t){if(!t.message.trim())throw new Error("message must not be empty");return e.mutate({mutation:x,variables:t}).then(a=>{if(!a.data?.start_thread)throw new Error(a.error?.message||"Failed to start thread");return a.data.start_thread})}function P(e,t,a){if(!t)throw new Error("threadId is required");let _={thread_id:{_eq:t}};if(a){let r=y(a.fromEventId),n=y(a.toEventId);r&&n?_.thread_event_id={_gte:a.fromEventId,_lte:a.toEventId}:r?_.thread_event_id={_gte:r}:n&&(_.thread_event_id={_lte:n}),a.messageId&&(_._or=W(a.messageId))}return e.query({query:k,variables:{where:_,limit:a?.limit},fetchPolicy:"no-cache"}).then(r=>r.data?.thread_events??[])}function R(e,t){if(!t.threadId)throw new Error("threadId is required");if(!t.message.trim())throw new Error("message must not be empty");return e.mutate({mutation:f,variables:t}).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(e,t){if(!t.threadId)throw new Error("threadId is required");if(!t.messageId.trim())throw new Error("messageId is required");return e.mutate({mutation:h,variables:t}).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(e,t,a){return V(e,t,{fromEventId:a})}function F(e,t,a){return V(e,t,a).pipe(H(_=>{for(let r=_.length-1;r>0;r--){let n=_[r];if("AgentMessage"in n.event_data&&"InteractionFinished"in n.event_data.AgentMessage.update)return!1}return!0},!0))}function V(e,t,a){if(!t)throw new Error("threadId is required");let _={thread_id:{_eq:t}};return a&&(y(a.fromEventId)&&(_.thread_event_id={_gte:a.fromEventId}),a.messageId&&(_._or=W(a.messageId))),e.subscribe({query:v,variables:{where:_}}).pipe(K(r=>{if(r.error)throw r.error;return r.data?.thread_events??[]}))}function W(e){return[{event_data:{_contains:{UserMessage:{message_id:e}}}},{event_data:{_contains:{AgentMessage:{message_id:e}}}},{event_data:{_contains:{UserCancel:{message_id:e}}}}]}function N(e){return e!=null&&typeof e=="object"&&"status"in e&&e.status==="failure"}function j(e){return e!=null&&typeof e=="object"&&"status"in e&&e.status==="success"&&"token"in e}function q(e){return e!=null&&typeof e=="object"&&("data"in e&&!!e.data&&typeof e.data=="object"&&"enrich_token"in e.data&&!!e.data.enrich_token&&typeof e.data.enrich_token=="object"&&"userDirectoryJWT"in e.data.enrich_token||"errors"in e&&Array.isArray(e.errors))}function z(e){let a=`${d(e.authHost)||"https://auth.pro.hasura.io"}/ddn/promptql/token`,_={token:"",expiry:new Date(0)},r=e.fetch||fetch,n=async()=>{let p=await r(a,{method:"POST",headers:{Authorization:`pat ${e.serviceAccountToken}`}});switch(p.status){case 200:{let i=await p.json();if(j(i))return i;throw new Error("malformed token response")}case 401:{let i=await p.json();throw N(i)?new Error(i?.error||p.statusText):new Error(p.statusText)}default:{let i=await p.text();throw new Error(i)}}};return async()=>{if(_.expiry.getTime()<=Date.now()-1e3){let p=await n(),i=await L(e.promptqlGraphQLUrl,p.token,void 0,r);_.token=i;let s=new Date(p.expiry);if(Number.isNaN(s.getTime())){let S=new Date;S.setHours(1),_.expiry=S}else _.expiry=s}return _.token}}var L=async(e,t,a,_=fetch)=>{let r=await _(e,{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:t,projectId:a},operationName:"EnrichToken"})});switch(r.status){case 200:{let n=await r.json();if(!q(n)||!n.data?.enrich_token?.userDirectoryJWT)throw new Error(`malformed promptql token response: ${JSON.stringify(n)}`);return n.data.enrich_token.userDirectoryJWT}default:{let n=await r.text();throw new Error(n)}}};import{ApolloClient as J,ApolloLink as $,HttpLink as Z,InMemoryCache as X}from"@apollo/client";import{SetContextLink as Y}from"@apollo/client/link/context";import{GraphQLWsLink as ee}from"@apollo/client/link/subscriptions";import{OperationTypeNode as te}from"graphql";import{createClient as ae}from"graphql-ws";var G=e=>{let t=new Z({uri:e.url,fetch:e.fetch,headers:e.headers}),a=async i=>{let s=await e.getAuthToken();return{headers:{...i,Authorization:`Bearer ${s}`}}},_=ae({url:e.url,connectionParams:()=>a(e.headers)}),r=new ee(_),n=new Y(({headers:i})=>a(i)),p=$.split(({operationType:i})=>i===te.SUBSCRIPTION,r,n.concat(t));return{client:new J({link:p,cache:new X}),wsClient:_}};var c=class{_options;constructor(t){this._options=t}info(){return b(this._options.client)}};function b(e){return e.query({query:A,fetchPolicy:"cache-first"}).then(t=>{if(!t.data?.get_project_info)throw new Error(t.error?.message||"Project not found");return t.data.get_project_info})}var l=class{_options;constructor(t){this._options=t}list(t){return T(this._options.client,{...t,limit:t.limit&&t.limit>0?t.limit:10})}get(t){if(!t)throw new Error("threadId is required");return O(this._options.client,t)}async start(t){let a=await b(this._options.client);return E(this._options.client,{...t,projectId:a.projectId,buildId:t.buildId||this._options.buildId,timezone:t.timezone||this._options.defaultTimezone})}getEvents(t,a){return P(this._options.client,t,a)}sendMessage(t){return R(this._options.client,{...t,timezone:t.timezone||this._options.defaultTimezone})}cancelAgentMessage(t){return U(this._options.client,t)}subscribeEvents(t,a){return w(this._options.client,t,a)}streamMessageEvents(t,a){return F(this._options.client,t,a)}};var Q=class{constructor(t){let a=d(t.promptqlBaseUrl)||"https://promptql.ddn.hasura.app";if(!t.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=z({promptqlGraphQLUrl:_,authHost:t.authHost,serviceAccountToken:t.serviceAccountToken,fetch:t.fetch});let{client:r,wsClient:n}=G({getAuthToken:this._fetchToken,url:_,fetch:t.fetch,headers:t.headers});this._wsClient=n,this._options={client:r,buildId:t.buildId,defaultTimezone:t.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone},this.thread=new l(this._options),this.project=new c(this._options)}_options;_wsClient;_fetchToken;thread;project;authenticated(){return this._fetchToken().then(()=>!0).catch(()=>!1)}close(){this._wsClient.dispose(),this._options.client.clearStore()}};function ze(e,t){if(!t.length)return[];if(!e.length)return t;let a=e[e.length-1];if(!a)return t;let _=BigInt(a.thread_event_id),r=t.length-1;for(;r>=0;r--){let n=t[r];if(BigInt(n?.thread_event_id)<=_)break}return t.slice(r+1)}function Ge(e){return"UserMessage"in e?e.UserMessage:null}function Qe(e){return"UserCancel"in e?e.UserCancel:null}function De(e){return!("AgentMessage"in e)||!("OrchestratorUpdate"in e.AgentMessage.update)||!("PlanGenerationStarted"in e.AgentMessage.update.OrchestratorUpdate.update)?null:e.AgentMessage.update.OrchestratorUpdate.update.PlanGenerationStarted}function Ke(e){return!("AgentMessage"in e)||!("OrchestratorUpdate"in e.AgentMessage.update)||!("PlanStepGenerated"in e.AgentMessage.update.OrchestratorUpdate.update)?null:e.AgentMessage.update.OrchestratorUpdate.update.PlanStepGenerated}function He(e){return!("AgentMessage"in e)||!("OrchestratorUpdate"in e.AgentMessage.update)||!("GeneratedResponse"in e.AgentMessage.update.OrchestratorUpdate.update)?null:e.AgentMessage.update.OrchestratorUpdate.update.GeneratedResponse}function Le(e){return!("AgentMessage"in e)||!("MessageProcessingUpdate"in e.AgentMessage.update)||!("ProcessingStarted"in e.AgentMessage.update.MessageProcessingUpdate.update)?null:e.AgentMessage.update.MessageProcessingUpdate.update.ProcessingStarted}function Je(e){return!("AgentMessage"in e)||!("MessageProcessingUpdate"in e.AgentMessage.update)||!("InteractionDecision"in e.AgentMessage.update.MessageProcessingUpdate.update)||!("AcceptInteraction"in e.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:e.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.AcceptInteraction}function $e(e){return!("AgentMessage"in e)||!("MessageProcessingUpdate"in e.AgentMessage.update)||!("InteractionDecision"in e.AgentMessage.update.MessageProcessingUpdate.update)||!("DeclineInteraction"in e.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:e.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.DeclineInteraction}function m(e){return!("AgentMessage"in e)||!("PlanningDecisionUpdate"in e.AgentMessage.update)?null:e.AgentMessage.update.PlanningDecisionUpdate.update}function Ze(e){let t=m(e);return!t||!("Started"in t)?null:t.Started}function Xe(e){let t=m(e);return!t||!("Completed"in t)?null:t.Completed}function Ye(e){let t=m(e);return!t||!("PlanningRequired"in t)?null:t.PlanningRequired}function et(e){return!("AgentMessage"in e)||!("StartingOrchestrator"in e.AgentMessage.update)?null:e.AgentMessage.update.StartingOrchestrator}function D(e){return!("AgentMessage"in e)||!("OrchestratorUpdate"in e.AgentMessage.update)?null:e.AgentMessage.update.OrchestratorUpdate.update}function u(e){let t=D(e);return!t||!("ContextExplorerUpdate"in t)?null:t.ContextExplorerUpdate.update}function tt(e){let t=u(e);return!t||!("Started"in t)?null:t.Started}function at(e){let t=u(e);return!t||!("Completed"in t)?null:t.Completed}function I(e){let t=u(e);return!t||!("WikiExplorerUpdate"in t)?null:t.WikiExplorerUpdate.update}function rt(e){let t=I(e);return!t||!("Started"in t)?null:t.Started}function _t(e){let t=I(e);return!t||!("Completed"in t)?null:t.Completed}function nt(e){let t=I(e);return!t||!("WikiInfoGenerated"in t)?null:t.WikiInfoGenerated}function M(e){let t=u(e);return!t||!("SchemaTasksGenerationUpdate"in t)?null:t.SchemaTasksGenerationUpdate.update}function it(e){let t=M(e);return!t||!("Started"in t)?null:t.Started}function pt(e){let t=M(e);return!t||!("Completed"in t)?null:t.Completed}function ot(e){let t=M(e);return!t||!("TasksGenerated"in t)?null:t.TasksGenerated}function o(e){let t=u(e);return!t||!("SchemaExplorerUpdate"in t)?null:t.SchemaExplorerUpdate.update}function ut(e){let t=o(e);return!t||!("Started"in t)?null:t.Started}function st(e){let t=o(e);return!t||!("Completed"in t)?null:t.Completed}function dt(e){let t=o(e);return!t||!("CodeExecutionComplete"in t)?null:t.CodeExecutionComplete}function yt(e){let t=o(e);return!t||!("CodeOutputAnalyzed"in t)?null:t.CodeOutputAnalyzed}function ct(e){let t=o(e);return!t||!("GeneratedCode"in t)?null:t.GeneratedCode}function lt(e){let t=o(e);return!t||!("SchemaExplored"in t)?null:t.SchemaExplored}function g(e){let t=D(e);return!t||!("StepUpdate"in t)?null:t.StepUpdate}function bt(e){let t=g(e);return!t||!("Programmer"in t.update)?null:t.update.Programmer}function mt(e){let t=g(e);return!t||!("UiProgrammer"in t.update)?null:t.update.UiProgrammer}function It(e){let t=g(e);return!t||!("SavedProgramRunner"in t.update)?null:t.update.SavedProgramRunner}export{Q as PromptQLSdk,U as cancelAgentMessage,G as createApolloClient,z as createPromptQLAuthTokenGenerator,ze as diffThreadEvents,L as enrichToken,He as getAgentGeneratedResponse,Je as getAgentInteractionDecisionAcceptInteractionEvent,$e as getAgentInteractionDecisionDeclineInteractionEvent,Le as getAgentMessageProcessingStartedEvent,at as getAgentOrchestratorContextExplorerCompletedEvent,tt as getAgentOrchestratorContextExplorerStartedEvent,u as getAgentOrchestratorContextExplorerUpdateEvent,dt as getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent,yt as getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent,st as getAgentOrchestratorSchemaExplorerCompletedEvent,ct as getAgentOrchestratorSchemaExplorerGeneratedCodeEvent,lt as getAgentOrchestratorSchemaExplorerSchemaExploredEvent,ut as getAgentOrchestratorSchemaExplorerStartedEvent,o as getAgentOrchestratorSchemaExplorerUpdateEvent,ot as getAgentOrchestratorSchemaTasksGeneratedEvent,pt as getAgentOrchestratorSchemaTasksGenerationCompletedEvent,it as getAgentOrchestratorSchemaTasksGenerationStartedEvent,M as getAgentOrchestratorSchemaTasksGenerationUpdateEvent,bt as getAgentOrchestratorStepProgrammerEvent,It as getAgentOrchestratorStepSavedProgramRunnerEvent,mt as getAgentOrchestratorStepUiProgrammerEvent,g as getAgentOrchestratorStepUpdateEvent,D as getAgentOrchestratorUpdateEvent,_t as getAgentOrchestratorWikiExplorerCompletedEvent,rt as getAgentOrchestratorWikiExplorerStartedEvent,I as getAgentOrchestratorWikiExplorerUpdateEvent,nt as getAgentOrchestratorWikiInfoGeneratedEvent,De as getAgentPlanGenerationStartedEvent,Ke as getAgentPlanStepGeneratedEvent,Xe as getAgentPlanningDecisionCompletedEvent,Ye as getAgentPlanningDecisionPlanningRequiredEvent,Ze as getAgentPlanningDecisionStartedEvent,m as getAgentPlanningDecisionUpdateEvent,et as getAgentStartingOrchestratorEvent,O as getThread,P as getThreadEvents,Qe as getUserCancelEvent,Ge as getUserMessageEvent,q as isEnrichTokenMutationResponse,N as isLuxAuthPromptQLTokenFailedResponse,j as isLuxAuthPromptQLTokenSuccessResponse,T as listThreads,R as sendThreadMessage,E as startThread,F as streamThreadMessageEvents,w as subscribeThreadEvents};
1
+ import{map as H,takeWhile as L}from"rxjs";var f={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CancelAgentMessage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"threadId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"messageId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"cancel_agent_message"},arguments:[{kind:"Argument",name:{kind:"Name",value:"threadId"},value:{kind:"Variable",name:{kind:"Name",value:"threadId"}}},{kind:"Argument",name:{kind:"Name",value:"agentMessageId"},value:{kind:"Variable",name:{kind:"Name",value:"messageId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}}]}}]}}]},x={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"}}]}}]}}]},A={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"StartThread"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"message"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"projectId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"timezone"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"roomId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"uploads"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UserUploadInput"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"visibility"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"start_thread"},arguments:[{kind:"Argument",name:{kind:"Name",value:"message"},value:{kind:"Variable",name:{kind:"Name",value:"message"}}},{kind:"Argument",name:{kind:"Name",value:"projectId"},value:{kind:"Variable",name:{kind:"Name",value:"projectId"}}},{kind:"Argument",name:{kind:"Name",value:"timezone"},value:{kind:"Variable",name:{kind:"Name",value:"timezone"}}},{kind:"Argument",name:{kind:"Name",value:"buildId"},value:{kind:"Variable",name:{kind:"Name",value:"buildId"}}},{kind:"Argument",name:{kind:"Name",value:"buildFqdn"},value:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}}},{kind:"Argument",name:{kind:"Name",value:"roomId"},value:{kind:"Variable",name:{kind:"Name",value:"roomId"}}},{kind:"Argument",name:{kind:"Name",value:"uploads"},value:{kind:"Variable",name:{kind:"Name",value:"uploads"}}},{kind:"Argument",name:{kind:"Name",value:"visibility"},value:{kind:"Variable",name:{kind:"Name",value:"visibility"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"thread_events"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"thread_event_id"}}]}}]}}]}}]},B={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"}}]}}]}}]},C={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"}}]}}]}}]},k={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"}}]}}]}}]},v={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"}}}],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:"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"}}]}}]},T={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"subscription",name:{kind:"Name",value:"SubscribeThreadEvents"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"EnumValue",value:"asc"}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadEvent"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"thread_events"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"user_id"}}]}}]};function d(e){return e=e?e.trim():"",e?e[e.length-1]==="/"?e.slice(0,e.length-1):e:""}function y(e){if(e==null)return null;try{Number.parseInt(e)}catch{throw new Error("invalid threadEventId")}return e}function O(e,t){return e.query({query:C,variables:{...t,limit:t.limit&&t.limit>0?t.limit:10},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2??[])}function E(e,t){if(!t)throw new Error("threadId is required");return e.query({query:k,variables:{id:t},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2_by_pk)}function P(e,t){if(!t.message.trim())throw new Error("message must not be empty");return e.mutate({mutation:A,variables:t}).then(a=>{if(!a.data?.start_thread)throw new Error(a.error?.message||"Failed to start thread");return a.data.start_thread})}function R(e,t,a){if(!t)throw new Error("threadId is required");let _={thread_id:{_eq:t}};if(a){let r=y(a.fromEventId),n=y(a.toEventId);r&&n?_.thread_event_id={_gte:a.fromEventId,_lte:a.toEventId}:r?_.thread_event_id={_gte:r}:n&&(_.thread_event_id={_lte:n}),a.messageId&&(_._or=N(a.messageId))}return e.query({query:v,variables:{where:_,limit:a?.limit},fetchPolicy:"no-cache"}).then(r=>r.data?.thread_events??[])}function U(e,t){if(!t.threadId)throw new Error("threadId is required");if(!t.message.trim())throw new Error("message must not be empty");return e.mutate({mutation:x,variables:t}).then(a=>{if(!a.data?.send_thread_message)throw new Error(a.error?.message||"Failed to send message to thread");return a.data.send_thread_message})}function w(e,t){if(!t.threadId)throw new Error("threadId is required");if(!t.messageId.trim())throw new Error("messageId is required");return e.mutate({mutation:f,variables:t}).then(a=>{if(!a.data?.cancel_agent_message)throw new Error(a.error?.message||"Failed to cancel thread");return a.data.cancel_agent_message})}function F(e,t,a){return W(e,t,{fromEventId:a})}function V(e,t,a){return W(e,t,a).pipe(L(_=>{for(let r=_.length-1;r>0;r--){let n=_[r];if("AgentMessage"in n.event_data&&"InteractionFinished"in n.event_data.AgentMessage.update)return!1}return!0},!0))}function W(e,t,a){if(!t)throw new Error("threadId is required");let _={thread_id:{_eq:t}};return a&&(y(a.fromEventId)&&(_.thread_event_id={_gte:a.fromEventId}),a.messageId&&(_._or=N(a.messageId))),e.subscribe({query:T,variables:{where:_}}).pipe(H(r=>{if(r.error)throw r.error;return r.data?.thread_events??[]}))}function N(e){return[{event_data:{_contains:{UserMessage:{message_id:e}}}},{event_data:{_contains:{AgentMessage:{message_id:e}}}},{event_data:{_contains:{UserCancel:{message_id:e}}}}]}function j(e){return e!=null&&typeof e=="object"&&"status"in e&&e.status==="failure"}function q(e){return e!=null&&typeof e=="object"&&"status"in e&&e.status==="success"&&"token"in e}function z(e){return e!=null&&typeof e=="object"&&("data"in e&&!!e.data&&typeof e.data=="object"&&"enrich_token"in e.data&&!!e.data.enrich_token&&typeof e.data.enrich_token=="object"&&"userDirectoryJWT"in e.data.enrich_token||"errors"in e&&Array.isArray(e.errors))}function b(e){let a=`${d(e.authHost)||"https://auth.pro.hasura.io"}/ddn/promptql/token`,_={token:"",expiry:new Date(0)},r=e.fetch||fetch,n=async()=>{let p=await r(a,{method:"POST",headers:e.headers});switch(p.status){case 200:{let i=await p.json();if(q(i))return i;throw new Error("malformed token response")}case 401:{let i=await p.json();throw j(i)?new Error(i?.error||p.statusText):new Error(p.statusText)}default:{let i=await p.text();throw new Error(i)}}};return async()=>{if(_.expiry.getTime()<=Date.now()-1e3){let p=await n(),i=await J(e.promptqlGraphQLUrl,p.token,e.projectId,r);_.token=i;let s=new Date(p.expiry);if(Number.isNaN(s.getTime())){let h=new Date;h.setHours(1),_.expiry=h}else _.expiry=s}return _.token}}var J=async(e,t,a,_=fetch)=>{let r=await _(e,{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:t,projectId:a},operationName:"EnrichToken"})});switch(r.status){case 200:{let n=await r.json();if(!z(n)||!n.data?.enrich_token?.userDirectoryJWT)throw new Error(`malformed promptql token response: ${JSON.stringify(n)}`);return n.data.enrich_token.userDirectoryJWT}default:{let n=await r.text();throw new Error(n)}}};function G(e){return{Authorization:`pat ${e}`}}import{ApolloClient as $,ApolloLink as Z,HttpLink as X,InMemoryCache as Y}from"@apollo/client";import{SetContextLink as ee}from"@apollo/client/link/context";import{GraphQLWsLink as te}from"@apollo/client/link/subscriptions";import{OperationTypeNode as ae}from"graphql";import{createClient as re}from"graphql-ws";var Q=e=>{let t=new X({uri:e.url,fetch:e.fetch,headers:e.headers}),a=async i=>{let s=await e.getAuthToken();return{headers:{...i,Authorization:`Bearer ${s}`}}},_=re({url:e.url,connectionParams:()=>a(e.headers)}),r=new te(_),n=new ee(({headers:i})=>a(i)),p=Z.split(({operationType:i})=>i===ae.SUBSCRIPTION,r,n.concat(t));return{client:new $({link:p,cache:new Y}),wsClient:_}};var c=class{_options;constructor(t){this._options=t}info(){return m(this._options.client)}};function m(e){return e.query({query:B,fetchPolicy:"cache-first"}).then(t=>{if(!t.data?.get_project_info)throw new Error(t.error?.message||"Project not found");return t.data.get_project_info})}var l=class{_options;constructor(t){this._options=t}list(t){return O(this._options.client,{...t,limit:t.limit&&t.limit>0?t.limit:10})}get(t){if(!t)throw new Error("threadId is required");return E(this._options.client,t)}async start(t){let a=await m(this._options.client);return P(this._options.client,{...t,projectId:a.projectId,buildId:t.buildId||this._options.buildId,timezone:t.timezone||this._options.defaultTimezone})}getEvents(t,a){return R(this._options.client,t,a)}sendMessage(t){return U(this._options.client,{...t,timezone:t.timezone||this._options.defaultTimezone})}cancelAgentMessage(t){return w(this._options.client,t)}subscribeEvents(t,a){return F(this._options.client,t,a)}streamMessageEvents(t,a){return V(this._options.client,t,a)}};var D=class{constructor(t){let a=d(t.promptqlBaseUrl)||"https://promptql.ddn.hasura.app";if(!t.serviceAccountToken)throw new Error("serviceAccountToken must not be empty. If you haven't created any service account token yet, check out Hasura docs https://hasura.io/docs/3.0/project-configuration/project-management/service-accounts/#how-to-create-service-account");let _=a.endsWith("/v1/graphql")?a:`${a}/playground-v2-hge/v1/graphql`;this._fetchToken=b({promptqlGraphQLUrl:_,authHost:t.authHost,headers:G(t.serviceAccountToken),fetch:t.fetch});let{client:r,wsClient:n}=Q({getAuthToken:this._fetchToken,url:_,fetch:t.fetch,headers:t.headers});this._wsClient=n,this._options={client:r,buildId:t.buildId,defaultTimezone:t.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone},this.thread=new l(this._options),this.project=new c(this._options)}_options;_wsClient;_fetchToken;thread;project;authenticated(){return this._fetchToken().then(()=>!0).catch(()=>!1)}close(){this._wsClient.dispose(),this._options.client.clearStore()}};function Ge(e,t){if(!t.length)return[];if(!e.length)return t;let a=e[e.length-1];if(!a)return t;let _=BigInt(a.thread_event_id),r=t.length-1;for(;r>=0;r--){let n=t[r];if(BigInt(n?.thread_event_id)<=_)break}return t.slice(r+1)}function Qe(e){return"UserMessage"in e?e.UserMessage:null}function De(e){return"UserCancel"in e?e.UserCancel:null}function Ke(e){return!("AgentMessage"in e)||!("OrchestratorUpdate"in e.AgentMessage.update)||!("PlanGenerationStarted"in e.AgentMessage.update.OrchestratorUpdate.update)?null:e.AgentMessage.update.OrchestratorUpdate.update.PlanGenerationStarted}function He(e){return!("AgentMessage"in e)||!("OrchestratorUpdate"in e.AgentMessage.update)||!("PlanStepGenerated"in e.AgentMessage.update.OrchestratorUpdate.update)?null:e.AgentMessage.update.OrchestratorUpdate.update.PlanStepGenerated}function Le(e){return!("AgentMessage"in e)||!("OrchestratorUpdate"in e.AgentMessage.update)||!("GeneratedResponse"in e.AgentMessage.update.OrchestratorUpdate.update)?null:e.AgentMessage.update.OrchestratorUpdate.update.GeneratedResponse}function Je(e){return!("AgentMessage"in e)||!("MessageProcessingUpdate"in e.AgentMessage.update)||!("ProcessingStarted"in e.AgentMessage.update.MessageProcessingUpdate.update)?null:e.AgentMessage.update.MessageProcessingUpdate.update.ProcessingStarted}function $e(e){return!("AgentMessage"in e)||!("MessageProcessingUpdate"in e.AgentMessage.update)||!("InteractionDecision"in e.AgentMessage.update.MessageProcessingUpdate.update)||!("AcceptInteraction"in e.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:e.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.AcceptInteraction}function Ze(e){return!("AgentMessage"in e)||!("MessageProcessingUpdate"in e.AgentMessage.update)||!("InteractionDecision"in e.AgentMessage.update.MessageProcessingUpdate.update)||!("DeclineInteraction"in e.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:e.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.DeclineInteraction}function I(e){return!("AgentMessage"in e)||!("PlanningDecisionUpdate"in e.AgentMessage.update)?null:e.AgentMessage.update.PlanningDecisionUpdate.update}function Xe(e){let t=I(e);return!t||!("Started"in t)?null:t.Started}function Ye(e){let t=I(e);return!t||!("Completed"in t)?null:t.Completed}function et(e){let t=I(e);return!t||!("PlanningRequired"in t)?null:t.PlanningRequired}function tt(e){return!("AgentMessage"in e)||!("StartingOrchestrator"in e.AgentMessage.update)?null:e.AgentMessage.update.StartingOrchestrator}function K(e){return!("AgentMessage"in e)||!("OrchestratorUpdate"in e.AgentMessage.update)?null:e.AgentMessage.update.OrchestratorUpdate.update}function u(e){let t=K(e);return!t||!("ContextExplorerUpdate"in t)?null:t.ContextExplorerUpdate.update}function at(e){let t=u(e);return!t||!("Started"in t)?null:t.Started}function rt(e){let t=u(e);return!t||!("Completed"in t)?null:t.Completed}function M(e){let t=u(e);return!t||!("WikiExplorerUpdate"in t)?null:t.WikiExplorerUpdate.update}function _t(e){let t=M(e);return!t||!("Started"in t)?null:t.Started}function nt(e){let t=M(e);return!t||!("Completed"in t)?null:t.Completed}function it(e){let t=M(e);return!t||!("WikiInfoGenerated"in t)?null:t.WikiInfoGenerated}function g(e){let t=u(e);return!t||!("SchemaTasksGenerationUpdate"in t)?null:t.SchemaTasksGenerationUpdate.update}function pt(e){let t=g(e);return!t||!("Started"in t)?null:t.Started}function ot(e){let t=g(e);return!t||!("Completed"in t)?null:t.Completed}function ut(e){let t=g(e);return!t||!("TasksGenerated"in t)?null:t.TasksGenerated}function o(e){let t=u(e);return!t||!("SchemaExplorerUpdate"in t)?null:t.SchemaExplorerUpdate.update}function st(e){let t=o(e);return!t||!("Started"in t)?null:t.Started}function dt(e){let t=o(e);return!t||!("Completed"in t)?null:t.Completed}function yt(e){let t=o(e);return!t||!("CodeExecutionComplete"in t)?null:t.CodeExecutionComplete}function ct(e){let t=o(e);return!t||!("CodeOutputAnalyzed"in t)?null:t.CodeOutputAnalyzed}function lt(e){let t=o(e);return!t||!("GeneratedCode"in t)?null:t.GeneratedCode}function bt(e){let t=o(e);return!t||!("SchemaExplored"in t)?null:t.SchemaExplored}function S(e){let t=K(e);return!t||!("StepUpdate"in t)?null:t.StepUpdate}function mt(e){let t=S(e);return!t||!("Programmer"in t.update)?null:t.update.Programmer}function It(e){let t=S(e);return!t||!("UiProgrammer"in t.update)?null:t.update.UiProgrammer}function Mt(e){let t=S(e);return!t||!("SavedProgramRunner"in t.update)?null:t.update.SavedProgramRunner}export{D as PromptQLSdk,w as cancelAgentMessage,Q as createApolloClient,b as createPromptQLAuthTokenGenerator,Ge as diffThreadEvents,Le as getAgentGeneratedResponse,$e as getAgentInteractionDecisionAcceptInteractionEvent,Ze as getAgentInteractionDecisionDeclineInteractionEvent,Je as getAgentMessageProcessingStartedEvent,rt as getAgentOrchestratorContextExplorerCompletedEvent,at as getAgentOrchestratorContextExplorerStartedEvent,u as getAgentOrchestratorContextExplorerUpdateEvent,yt as getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent,ct as getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent,dt as getAgentOrchestratorSchemaExplorerCompletedEvent,lt as getAgentOrchestratorSchemaExplorerGeneratedCodeEvent,bt as getAgentOrchestratorSchemaExplorerSchemaExploredEvent,st as getAgentOrchestratorSchemaExplorerStartedEvent,o as getAgentOrchestratorSchemaExplorerUpdateEvent,ut as getAgentOrchestratorSchemaTasksGeneratedEvent,ot as getAgentOrchestratorSchemaTasksGenerationCompletedEvent,pt as getAgentOrchestratorSchemaTasksGenerationStartedEvent,g as getAgentOrchestratorSchemaTasksGenerationUpdateEvent,mt as getAgentOrchestratorStepProgrammerEvent,Mt as getAgentOrchestratorStepSavedProgramRunnerEvent,It as getAgentOrchestratorStepUiProgrammerEvent,S as getAgentOrchestratorStepUpdateEvent,K as getAgentOrchestratorUpdateEvent,nt as getAgentOrchestratorWikiExplorerCompletedEvent,_t as getAgentOrchestratorWikiExplorerStartedEvent,M as getAgentOrchestratorWikiExplorerUpdateEvent,it as getAgentOrchestratorWikiInfoGeneratedEvent,Ke as getAgentPlanGenerationStartedEvent,He as getAgentPlanStepGeneratedEvent,Ye as getAgentPlanningDecisionCompletedEvent,et as getAgentPlanningDecisionPlanningRequiredEvent,Xe as getAgentPlanningDecisionStartedEvent,I as getAgentPlanningDecisionUpdateEvent,tt as getAgentStartingOrchestratorEvent,E as getThread,R as getThreadEvents,De as getUserCancelEvent,Qe as getUserMessageEvent,O as listThreads,U as sendThreadMessage,P as startThread,V as streamThreadMessageEvents,F 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.10",
4
+ "version": "2.0.0-alpha.12",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Hasura",
7
7
  "homepage": "https://promptql.hasura.io",