@hasura/promptql 2.0.0-alpha.13 → 2.0.0-alpha.14
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 +11 -2
- package/dist/index.d.ts +11 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -5300,7 +5300,7 @@ declare function getAgentPlanStepGeneratedEvent(eventData: ThreadEvent$1): PlanS
|
|
|
5300
5300
|
/**
|
|
5301
5301
|
* Validate and return the GeneratedResponse from AgentMessage.
|
|
5302
5302
|
*/
|
|
5303
|
-
declare function getAgentGeneratedResponse(eventData: ThreadEvent$1):
|
|
5303
|
+
declare function getAgentGeneratedResponse(eventData: ThreadEvent$1): ComponentResponse5 | null;
|
|
5304
5304
|
/**
|
|
5305
5305
|
* Validate and return the ProcessingStarted event from AgentMessage.
|
|
5306
5306
|
*/
|
|
@@ -5425,5 +5425,14 @@ declare function getAgentOrchestratorStepUiProgrammerEvent(eventData: ThreadEven
|
|
|
5425
5425
|
* Validate and return the SavedProgramRunner event from the step update.
|
|
5426
5426
|
*/
|
|
5427
5427
|
declare function getAgentOrchestratorStepSavedProgramRunnerEvent(eventData: ThreadEvent$1): SavedProgramRunnerUpdate | null;
|
|
5428
|
+
/**
|
|
5429
|
+
* Validate and return the InteractionFinished event from the step update.
|
|
5430
|
+
*/
|
|
5431
|
+
declare function getAgentInteractionFinishedEvent(eventData: ThreadEvent$1): {
|
|
5432
|
+
status: "AgentDeclined" | "Completed" | "Errored" | "ServerCancelled" | "UserCancelled";
|
|
5433
|
+
reason?: string;
|
|
5434
|
+
timestamp?: string;
|
|
5435
|
+
warnings?: Warning[];
|
|
5436
|
+
} | null;
|
|
5428
5437
|
|
|
5429
|
-
export { type AgentInteraction, type AgentLearningUpdate, type AgentLoopAction, type AgentLoopActionResult, type AgentLoopActionUpdate, type AgentLoopUpdate, type AgentLoopUpdateV1, type AgentState, type AgentUpdate, type AgentUpdateContent, type AllTheServerTypes, type AnalyzedCodeAction, type AnalyzedCodeAction2, type ApolloClientOptions, type ArtifactError, type ArtifactErrorV1, type ArtifactId, type ArtifactPreview, type ArtifactReference, type ArtifactReference1, type ArtifactReference2, type ArtifactState, type ArtifactType, type ArtifactType2, type ArtifactUpdate, type ArtifactUpdate1, type AssumptionFactCheck, type BuildError, type BuildErrorV1, type BuiltUi, type BuiltUi1, type CancelAgentMessageMutationVariables, type CheckedAssumption, type CheckedTopic, type CodeAction, type CodeAction2, type CodeBlock, type CodeError, type CodeErrorV1, type CodeExecutionComplete, type CodeOutputAnalysis, type CodeOutputAnalysis1, type CodeOutputAnalyzed, type ComponentResponse, type ComponentResponse1, type ComponentResponse2, type ComponentResponse3, type ComponentResponse4, type ComponentResponse5, type ConfidenceAnalysis, type ConfidenceAnalysis1, type ConfidenceAnalysisLlmUsage, type ConfidenceAnalysisOutcome, type ConfidenceAnalysisUpdate, type ContextExplorerCompleted, type ContextExplorerStarted, type ContextExplorerState, type ContextExplorerUpdate, type CopyFileEntry, type CurrentAction, type DataArtifactUpdated, type DataArtifactUpdatedV1, type Dependency, type EventOfKind, type ExternalKnowledgeExplorerAttempt, type ExternalKnowledgeExplorerAttempt1, type ExternalKnowledgeExplorerAttempt2, type ExternalKnowledgeExplorerState, type ExternalKnowledgeSummary, type ExternalKnowledgeTaskGeneratorState, type FactSource, type GeneratedCode, type GeneratedFile, type GeneratedFile2, type GeneratedProgramRunnerOutput, type GeneratedResponse, type GeneratedUiCode, type GeneratedUiCode1, type GetThreadEventOptions, type GetThreadsQueryVariables, type IPromptQLSdk, type Interaction, type InteractionDecision, type InteractionDecisionAccept, type InteractionDecisionDecline, type InteractionDecisionUpdate, type InteractionDeclineReason, type InteractionError, type InteractionFinishedUpdate, type InteractionOutcome, type InteractionOutcome2, type InteractionUpdate, 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 SubAgentType, type SummaryAction, type TasksGenerated, type Teaching, type TeachingId, type TeachingOutcome, type TeachingState, type ThreadEvent, type ThreadEvent$1 as ThreadEventData, type ThreadFragment, type ThreadParticipants, type TransactionId, type UiBuild, type UiBuild2, type UiBuildFailure, type UiBuildResult, type UiBuildRunStepDetails, type UiBuildStep, type UiMetadata, type UiProgrammerState, type UiProgrammerUpdate, type UserCancel, type UserCancelEvent, type UserInteraction, type UserMessage, type UserMessageEvent, type UserUpload, type UserUploadMetadata, type Version, type VersionedAgentUpdate, type VersionedOrUnversionedAgentUpdate, type Warning, type WikiChange, type WikiContent, type WikiDelta, type WikiExplorerCompleted, type WikiExplorerStarted, type WikiExplorerState, type WikiExplorerUpdate, type WikiGenerationOutcome, type WikiGenerationUpdate, type WikiInfoGenerated, type WikiLearningsUpdate, type WikiPageV1, type WikiSection, type WikiSelectionUpdate, 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 };
|
|
5438
|
+
export { type AgentInteraction, type AgentLearningUpdate, type AgentLoopAction, type AgentLoopActionResult, type AgentLoopActionUpdate, type AgentLoopUpdate, type AgentLoopUpdateV1, type AgentState, type AgentUpdate, type AgentUpdateContent, type AllTheServerTypes, type AnalyzedCodeAction, type AnalyzedCodeAction2, type ApolloClientOptions, type ArtifactError, type ArtifactErrorV1, type ArtifactId, type ArtifactPreview, type ArtifactReference, type ArtifactReference1, type ArtifactReference2, type ArtifactState, type ArtifactType, type ArtifactType2, type ArtifactUpdate, type ArtifactUpdate1, type AssumptionFactCheck, type BuildError, type BuildErrorV1, type BuiltUi, type BuiltUi1, type CancelAgentMessageMutationVariables, type CheckedAssumption, type CheckedTopic, type CodeAction, type CodeAction2, type CodeBlock, type CodeError, type CodeErrorV1, type CodeExecutionComplete, type CodeOutputAnalysis, type CodeOutputAnalysis1, type CodeOutputAnalyzed, type ComponentResponse, type ComponentResponse1, type ComponentResponse2, type ComponentResponse3, type ComponentResponse4, type ComponentResponse5, type ConfidenceAnalysis, type ConfidenceAnalysis1, type ConfidenceAnalysisLlmUsage, type ConfidenceAnalysisOutcome, type ConfidenceAnalysisUpdate, type ContextExplorerCompleted, type ContextExplorerStarted, type ContextExplorerState, type ContextExplorerUpdate, type CopyFileEntry, type CurrentAction, type DataArtifactUpdated, type DataArtifactUpdatedV1, type Dependency, type EventOfKind, type ExternalKnowledgeExplorerAttempt, type ExternalKnowledgeExplorerAttempt1, type ExternalKnowledgeExplorerAttempt2, type ExternalKnowledgeExplorerState, type ExternalKnowledgeSummary, type ExternalKnowledgeTaskGeneratorState, type FactSource, type GeneratedCode, type GeneratedFile, type GeneratedFile2, type GeneratedProgramRunnerOutput, type GeneratedResponse, type GeneratedUiCode, type GeneratedUiCode1, type GetThreadEventOptions, type GetThreadsQueryVariables, type IPromptQLSdk, type Interaction, type InteractionDecision, type InteractionDecisionAccept, type InteractionDecisionDecline, type InteractionDecisionUpdate, type InteractionDeclineReason, type InteractionError, type InteractionFinishedUpdate, type InteractionOutcome, type InteractionOutcome2, type InteractionUpdate, 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 SubAgentType, type SummaryAction, type TasksGenerated, type Teaching, type TeachingId, type TeachingOutcome, type TeachingState, type ThreadEvent, type ThreadEvent$1 as ThreadEventData, type ThreadFragment, type ThreadParticipants, type TransactionId, type UiBuild, type UiBuild2, type UiBuildFailure, type UiBuildResult, type UiBuildRunStepDetails, type UiBuildStep, type UiMetadata, type UiProgrammerState, type UiProgrammerUpdate, type UserCancel, type UserCancelEvent, type UserInteraction, type UserMessage, type UserMessageEvent, type UserUpload, type UserUploadMetadata, type Version, type VersionedAgentUpdate, type VersionedOrUnversionedAgentUpdate, type Warning, type WikiChange, type WikiContent, type WikiDelta, type WikiExplorerCompleted, type WikiExplorerStarted, type WikiExplorerState, type WikiExplorerUpdate, type WikiGenerationOutcome, type WikiGenerationUpdate, type WikiInfoGenerated, type WikiLearningsUpdate, type WikiPageV1, type WikiSection, type WikiSelectionUpdate, type WikiTitle, cancelAgentMessage, createApolloClient, createPromptQLAuthTokenGenerator, diffThreadEvents, getAgentGeneratedResponse, getAgentInteractionDecisionAcceptInteractionEvent, getAgentInteractionDecisionDeclineInteractionEvent, getAgentInteractionFinishedEvent, getAgentMessageProcessingStartedEvent, getAgentOrchestratorContextExplorerCompletedEvent, getAgentOrchestratorContextExplorerStartedEvent, getAgentOrchestratorContextExplorerUpdateEvent, getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent, getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent, getAgentOrchestratorSchemaExplorerCompletedEvent, getAgentOrchestratorSchemaExplorerGeneratedCodeEvent, getAgentOrchestratorSchemaExplorerSchemaExploredEvent, getAgentOrchestratorSchemaExplorerStartedEvent, getAgentOrchestratorSchemaExplorerUpdateEvent, getAgentOrchestratorSchemaTasksGeneratedEvent, getAgentOrchestratorSchemaTasksGenerationCompletedEvent, getAgentOrchestratorSchemaTasksGenerationStartedEvent, getAgentOrchestratorSchemaTasksGenerationUpdateEvent, getAgentOrchestratorStepProgrammerEvent, getAgentOrchestratorStepSavedProgramRunnerEvent, getAgentOrchestratorStepUiProgrammerEvent, getAgentOrchestratorStepUpdateEvent, getAgentOrchestratorUpdateEvent, getAgentOrchestratorWikiExplorerCompletedEvent, getAgentOrchestratorWikiExplorerStartedEvent, getAgentOrchestratorWikiExplorerUpdateEvent, getAgentOrchestratorWikiInfoGeneratedEvent, getAgentPlanGenerationStartedEvent, getAgentPlanStepGeneratedEvent, getAgentPlanningDecisionCompletedEvent, getAgentPlanningDecisionPlanningRequiredEvent, getAgentPlanningDecisionStartedEvent, getAgentPlanningDecisionUpdateEvent, getAgentStartingOrchestratorEvent, getThread, getThreadEvents, getUserCancelEvent, getUserMessageEvent, listThreads, sendThreadMessage, startThread, streamThreadMessageEvents, subscribeThreadEvents };
|
package/dist/index.d.ts
CHANGED
|
@@ -5300,7 +5300,7 @@ declare function getAgentPlanStepGeneratedEvent(eventData: ThreadEvent$1): PlanS
|
|
|
5300
5300
|
/**
|
|
5301
5301
|
* Validate and return the GeneratedResponse from AgentMessage.
|
|
5302
5302
|
*/
|
|
5303
|
-
declare function getAgentGeneratedResponse(eventData: ThreadEvent$1):
|
|
5303
|
+
declare function getAgentGeneratedResponse(eventData: ThreadEvent$1): ComponentResponse5 | null;
|
|
5304
5304
|
/**
|
|
5305
5305
|
* Validate and return the ProcessingStarted event from AgentMessage.
|
|
5306
5306
|
*/
|
|
@@ -5425,5 +5425,14 @@ declare function getAgentOrchestratorStepUiProgrammerEvent(eventData: ThreadEven
|
|
|
5425
5425
|
* Validate and return the SavedProgramRunner event from the step update.
|
|
5426
5426
|
*/
|
|
5427
5427
|
declare function getAgentOrchestratorStepSavedProgramRunnerEvent(eventData: ThreadEvent$1): SavedProgramRunnerUpdate | null;
|
|
5428
|
+
/**
|
|
5429
|
+
* Validate and return the InteractionFinished event from the step update.
|
|
5430
|
+
*/
|
|
5431
|
+
declare function getAgentInteractionFinishedEvent(eventData: ThreadEvent$1): {
|
|
5432
|
+
status: "AgentDeclined" | "Completed" | "Errored" | "ServerCancelled" | "UserCancelled";
|
|
5433
|
+
reason?: string;
|
|
5434
|
+
timestamp?: string;
|
|
5435
|
+
warnings?: Warning[];
|
|
5436
|
+
} | null;
|
|
5428
5437
|
|
|
5429
|
-
export { type AgentInteraction, type AgentLearningUpdate, type AgentLoopAction, type AgentLoopActionResult, type AgentLoopActionUpdate, type AgentLoopUpdate, type AgentLoopUpdateV1, type AgentState, type AgentUpdate, type AgentUpdateContent, type AllTheServerTypes, type AnalyzedCodeAction, type AnalyzedCodeAction2, type ApolloClientOptions, type ArtifactError, type ArtifactErrorV1, type ArtifactId, type ArtifactPreview, type ArtifactReference, type ArtifactReference1, type ArtifactReference2, type ArtifactState, type ArtifactType, type ArtifactType2, type ArtifactUpdate, type ArtifactUpdate1, type AssumptionFactCheck, type BuildError, type BuildErrorV1, type BuiltUi, type BuiltUi1, type CancelAgentMessageMutationVariables, type CheckedAssumption, type CheckedTopic, type CodeAction, type CodeAction2, type CodeBlock, type CodeError, type CodeErrorV1, type CodeExecutionComplete, type CodeOutputAnalysis, type CodeOutputAnalysis1, type CodeOutputAnalyzed, type ComponentResponse, type ComponentResponse1, type ComponentResponse2, type ComponentResponse3, type ComponentResponse4, type ComponentResponse5, type ConfidenceAnalysis, type ConfidenceAnalysis1, type ConfidenceAnalysisLlmUsage, type ConfidenceAnalysisOutcome, type ConfidenceAnalysisUpdate, type ContextExplorerCompleted, type ContextExplorerStarted, type ContextExplorerState, type ContextExplorerUpdate, type CopyFileEntry, type CurrentAction, type DataArtifactUpdated, type DataArtifactUpdatedV1, type Dependency, type EventOfKind, type ExternalKnowledgeExplorerAttempt, type ExternalKnowledgeExplorerAttempt1, type ExternalKnowledgeExplorerAttempt2, type ExternalKnowledgeExplorerState, type ExternalKnowledgeSummary, type ExternalKnowledgeTaskGeneratorState, type FactSource, type GeneratedCode, type GeneratedFile, type GeneratedFile2, type GeneratedProgramRunnerOutput, type GeneratedResponse, type GeneratedUiCode, type GeneratedUiCode1, type GetThreadEventOptions, type GetThreadsQueryVariables, type IPromptQLSdk, type Interaction, type InteractionDecision, type InteractionDecisionAccept, type InteractionDecisionDecline, type InteractionDecisionUpdate, type InteractionDeclineReason, type InteractionError, type InteractionFinishedUpdate, type InteractionOutcome, type InteractionOutcome2, type InteractionUpdate, 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 SubAgentType, type SummaryAction, type TasksGenerated, type Teaching, type TeachingId, type TeachingOutcome, type TeachingState, type ThreadEvent, type ThreadEvent$1 as ThreadEventData, type ThreadFragment, type ThreadParticipants, type TransactionId, type UiBuild, type UiBuild2, type UiBuildFailure, type UiBuildResult, type UiBuildRunStepDetails, type UiBuildStep, type UiMetadata, type UiProgrammerState, type UiProgrammerUpdate, type UserCancel, type UserCancelEvent, type UserInteraction, type UserMessage, type UserMessageEvent, type UserUpload, type UserUploadMetadata, type Version, type VersionedAgentUpdate, type VersionedOrUnversionedAgentUpdate, type Warning, type WikiChange, type WikiContent, type WikiDelta, type WikiExplorerCompleted, type WikiExplorerStarted, type WikiExplorerState, type WikiExplorerUpdate, type WikiGenerationOutcome, type WikiGenerationUpdate, type WikiInfoGenerated, type WikiLearningsUpdate, type WikiPageV1, type WikiSection, type WikiSelectionUpdate, 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 };
|
|
5438
|
+
export { type AgentInteraction, type AgentLearningUpdate, type AgentLoopAction, type AgentLoopActionResult, type AgentLoopActionUpdate, type AgentLoopUpdate, type AgentLoopUpdateV1, type AgentState, type AgentUpdate, type AgentUpdateContent, type AllTheServerTypes, type AnalyzedCodeAction, type AnalyzedCodeAction2, type ApolloClientOptions, type ArtifactError, type ArtifactErrorV1, type ArtifactId, type ArtifactPreview, type ArtifactReference, type ArtifactReference1, type ArtifactReference2, type ArtifactState, type ArtifactType, type ArtifactType2, type ArtifactUpdate, type ArtifactUpdate1, type AssumptionFactCheck, type BuildError, type BuildErrorV1, type BuiltUi, type BuiltUi1, type CancelAgentMessageMutationVariables, type CheckedAssumption, type CheckedTopic, type CodeAction, type CodeAction2, type CodeBlock, type CodeError, type CodeErrorV1, type CodeExecutionComplete, type CodeOutputAnalysis, type CodeOutputAnalysis1, type CodeOutputAnalyzed, type ComponentResponse, type ComponentResponse1, type ComponentResponse2, type ComponentResponse3, type ComponentResponse4, type ComponentResponse5, type ConfidenceAnalysis, type ConfidenceAnalysis1, type ConfidenceAnalysisLlmUsage, type ConfidenceAnalysisOutcome, type ConfidenceAnalysisUpdate, type ContextExplorerCompleted, type ContextExplorerStarted, type ContextExplorerState, type ContextExplorerUpdate, type CopyFileEntry, type CurrentAction, type DataArtifactUpdated, type DataArtifactUpdatedV1, type Dependency, type EventOfKind, type ExternalKnowledgeExplorerAttempt, type ExternalKnowledgeExplorerAttempt1, type ExternalKnowledgeExplorerAttempt2, type ExternalKnowledgeExplorerState, type ExternalKnowledgeSummary, type ExternalKnowledgeTaskGeneratorState, type FactSource, type GeneratedCode, type GeneratedFile, type GeneratedFile2, type GeneratedProgramRunnerOutput, type GeneratedResponse, type GeneratedUiCode, type GeneratedUiCode1, type GetThreadEventOptions, type GetThreadsQueryVariables, type IPromptQLSdk, type Interaction, type InteractionDecision, type InteractionDecisionAccept, type InteractionDecisionDecline, type InteractionDecisionUpdate, type InteractionDeclineReason, type InteractionError, type InteractionFinishedUpdate, type InteractionOutcome, type InteractionOutcome2, type InteractionUpdate, 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 SubAgentType, type SummaryAction, type TasksGenerated, type Teaching, type TeachingId, type TeachingOutcome, type TeachingState, type ThreadEvent, type ThreadEvent$1 as ThreadEventData, type ThreadFragment, type ThreadParticipants, type TransactionId, type UiBuild, type UiBuild2, type UiBuildFailure, type UiBuildResult, type UiBuildRunStepDetails, type UiBuildStep, type UiMetadata, type UiProgrammerState, type UiProgrammerUpdate, type UserCancel, type UserCancelEvent, type UserInteraction, type UserMessage, type UserMessageEvent, type UserUpload, type UserUploadMetadata, type Version, type VersionedAgentUpdate, type VersionedOrUnversionedAgentUpdate, type Warning, type WikiChange, type WikiContent, type WikiDelta, type WikiExplorerCompleted, type WikiExplorerStarted, type WikiExplorerState, type WikiExplorerUpdate, type WikiGenerationOutcome, type WikiGenerationUpdate, type WikiInfoGenerated, type WikiLearningsUpdate, type WikiPageV1, type WikiSection, type WikiSelectionUpdate, type WikiTitle, cancelAgentMessage, createApolloClient, createPromptQLAuthTokenGenerator, diffThreadEvents, getAgentGeneratedResponse, getAgentInteractionDecisionAcceptInteractionEvent, getAgentInteractionDecisionDeclineInteractionEvent, getAgentInteractionFinishedEvent, getAgentMessageProcessingStartedEvent, getAgentOrchestratorContextExplorerCompletedEvent, getAgentOrchestratorContextExplorerStartedEvent, getAgentOrchestratorContextExplorerUpdateEvent, getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent, getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent, getAgentOrchestratorSchemaExplorerCompletedEvent, getAgentOrchestratorSchemaExplorerGeneratedCodeEvent, getAgentOrchestratorSchemaExplorerSchemaExploredEvent, getAgentOrchestratorSchemaExplorerStartedEvent, getAgentOrchestratorSchemaExplorerUpdateEvent, getAgentOrchestratorSchemaTasksGeneratedEvent, getAgentOrchestratorSchemaTasksGenerationCompletedEvent, getAgentOrchestratorSchemaTasksGenerationStartedEvent, getAgentOrchestratorSchemaTasksGenerationUpdateEvent, getAgentOrchestratorStepProgrammerEvent, getAgentOrchestratorStepSavedProgramRunnerEvent, getAgentOrchestratorStepUiProgrammerEvent, getAgentOrchestratorStepUpdateEvent, getAgentOrchestratorUpdateEvent, getAgentOrchestratorWikiExplorerCompletedEvent, getAgentOrchestratorWikiExplorerStartedEvent, getAgentOrchestratorWikiExplorerUpdateEvent, getAgentOrchestratorWikiInfoGeneratedEvent, getAgentPlanGenerationStartedEvent, getAgentPlanStepGeneratedEvent, getAgentPlanningDecisionCompletedEvent, getAgentPlanningDecisionPlanningRequiredEvent, getAgentPlanningDecisionStartedEvent, getAgentPlanningDecisionUpdateEvent, getAgentStartingOrchestratorEvent, getThread, getThreadEvents, getUserCancelEvent, getUserMessageEvent, listThreads, sendThreadMessage, startThread, streamThreadMessageEvents, subscribeThreadEvents };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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("UserCancel"in n.event_data)return!1;if(!("AgentMessage"in n.event_data))return!0;let i=n.event_data.AgentMessage.update;if("content"in i&&"interaction_finished"in i.content||"InteractionFinished"in i||a?.skipAnalysis&&"OrchestratorUpdate"in i&&"GeneratedResponse"in i.OrchestratorUpdate.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 i=await r(a,{method:"POST",headers:e.headers});switch(i.status){case 200:{let p=await i.json();if(H(p))return p;throw new Error("malformed token response")}case 401:{let p=await i.json();throw K(p)?new Error(p?.error||i.statusText):new Error(i.statusText)}default:{let p=await i.text();throw new Error(p)}}};return async()=>{if(_.expiry.getTime()<=Date.now()-1e3){let i=await n(),p=await ie(e.promptqlGraphQLUrl,i.token,e.projectId,r);_.token=p;let d=new Date(i.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 p=>{let d=await e.getAuthToken();return{headers:{...p,Authorization:`Bearer ${d}`}}},_=(0,Y.createClient)({url:e.url,connectionParams:()=>a(e.headers)}),r=new Z.GraphQLWsLink(_),n=new $.SetContextLink(({headers:p})=>a(p)),i=o.ApolloLink.split(({operationType:p})=>p===X.OperationTypeNode.SUBSCRIPTION,r,n.concat(t));return{client:new o.ApolloClient({link:i,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});
|
|
1
|
+
"use strict";var x=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var te=Object.getOwnPropertyNames;var ae=Object.prototype.hasOwnProperty;var re=(t,e)=>{for(var a in e)x(t,a,{get:e[a],enumerable:!0})},_e=(t,e,a,_)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of te(e))!ae.call(t,r)&&r!==a&&x(t,r,{get:()=>e[r],enumerable:!(_=ee(e,r))||_.enumerable});return t};var ne=t=>_e(x({},"__esModule",{value:!0}),t);var We={};re(We,{PromptQLSdk:()=>U,cancelAgentMessage:()=>T,createApolloClient:()=>P,createPromptQLAuthTokenGenerator:()=>m,diffThreadEvents:()=>pe,getAgentGeneratedResponse:()=>ye,getAgentInteractionDecisionAcceptInteractionEvent:()=>le,getAgentInteractionDecisionDeclineInteractionEvent:()=>me,getAgentInteractionFinishedEvent:()=>Ve,getAgentMessageProcessingStartedEvent:()=>ce,getAgentOrchestratorContextExplorerCompletedEvent:()=>he,getAgentOrchestratorContextExplorerStartedEvent:()=>Se,getAgentOrchestratorContextExplorerUpdateEvent:()=>u,getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent:()=>Oe,getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent:()=>Ee,getAgentOrchestratorSchemaExplorerCompletedEvent:()=>Te,getAgentOrchestratorSchemaExplorerGeneratedCodeEvent:()=>Pe,getAgentOrchestratorSchemaExplorerSchemaExploredEvent:()=>Re,getAgentOrchestratorSchemaExplorerStartedEvent:()=>ve,getAgentOrchestratorSchemaExplorerUpdateEvent:()=>s,getAgentOrchestratorSchemaTasksGeneratedEvent:()=>ke,getAgentOrchestratorSchemaTasksGenerationCompletedEvent:()=>Ce,getAgentOrchestratorSchemaTasksGenerationStartedEvent:()=>Be,getAgentOrchestratorSchemaTasksGenerationUpdateEvent:()=>h,getAgentOrchestratorStepProgrammerEvent:()=>Ue,getAgentOrchestratorStepSavedProgramRunnerEvent:()=>Fe,getAgentOrchestratorStepUiProgrammerEvent:()=>we,getAgentOrchestratorStepUpdateEvent:()=>f,getAgentOrchestratorUpdateEvent:()=>g,getAgentOrchestratorWikiExplorerCompletedEvent:()=>xe,getAgentOrchestratorWikiExplorerStartedEvent:()=>fe,getAgentOrchestratorWikiExplorerUpdateEvent:()=>S,getAgentOrchestratorWikiInfoGeneratedEvent:()=>Ae,getAgentPlanGenerationStartedEvent:()=>ue,getAgentPlanStepGeneratedEvent:()=>de,getAgentPlanningDecisionCompletedEvent:()=>Ie,getAgentPlanningDecisionPlanningRequiredEvent:()=>Me,getAgentPlanningDecisionStartedEvent:()=>be,getAgentPlanningDecisionUpdateEvent:()=>M,getAgentStartingOrchestratorEvent:()=>ge,getThread:()=>B,getThreadEvents:()=>k,getUserCancelEvent:()=>se,getUserMessageEvent:()=>oe,listThreads:()=>A,sendThreadMessage:()=>v,startThread:()=>C,streamThreadMessageEvents:()=>E,subscribeThreadEvents:()=>O});module.exports=ne(We);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(t){return t=t?t.trim():"",t?t[t.length-1]==="/"?t.slice(0,t.length-1):t:""}function c(t){if(t==null)return null;try{Number.parseInt(t)}catch{throw new Error("invalid threadEventId")}return t}function A(t,e){return t.query({query:j,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2??[])}function B(t,e){if(!e)throw new Error("threadId is required");return t.query({query:q,variables:{id:e},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2_by_pk)}function C(t,e){if(!e.message.trim())throw new Error("message must not be empty");return t.mutate({mutation:W,variables:e}).then(a=>{if(!a.data?.start_thread)throw new Error(a.error?.message||"Failed to start thread");return a.data.start_thread})}function k(t,e,a){if(!e)throw new Error("threadId is required");let _={thread_id:{_eq:e}};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 t.query({query:z,variables:{where:_,limit:a?.limit},fetchPolicy:"no-cache"}).then(r=>r.data?.thread_events??[])}function v(t,e){if(!e.threadId)throw new Error("threadId is required");if(!e.message.trim())throw new Error("message must not be empty");return t.mutate({mutation:V,variables:e}).then(a=>{if(!a.data?.send_thread_message)throw new Error(a.error?.message||"Failed to send message to thread");return a.data.send_thread_message})}function T(t,e){if(!e.threadId)throw new Error("threadId is required");if(!e.messageId.trim())throw new Error("messageId is required");return t.mutate({mutation:F,variables:e}).then(a=>{if(!a.data?.cancel_agent_message)throw new Error(a.error?.message||"Failed to cancel thread");return a.data.cancel_agent_message})}function O(t,e,a){return Q(t,e,{fromEventId:a})}function E(t,e,a){return Q(t,e,a).pipe((0,l.takeWhile)(_=>{for(let r=_.length-1;r>0;r--){let n=_[r];if(a?.skipAnalysis&&"UserCancel"in n.event_data)return!1;if(!("AgentMessage"in n.event_data))return!0;let i=n.event_data.AgentMessage.update;if("content"in i&&"interaction_finished"in i.content||"InteractionFinished"in i||a?.skipAnalysis&&"OrchestratorUpdate"in i&&"GeneratedResponse"in i.OrchestratorUpdate.update)return!1}return!0},!0))}function Q(t,e,a){if(!e)throw new Error("threadId is required");let _={thread_id:{_eq:e}};return a&&(c(a.fromEventId)&&(_.thread_event_id={_gte:a.fromEventId}),a.messageId&&(_._or=D(a.messageId))),t.subscribe({query:G,variables:{where:_}}).pipe((0,l.map)(r=>{if(r.error)throw r.error;return r.data?.thread_events??[]}))}function D(t){return[{event_data:{_contains:{UserMessage:{message_id:t}}}},{event_data:{_contains:{AgentMessage:{message_id:t}}}},{event_data:{_contains:{UserCancel:{message_id:t}}}}]}function K(t){return t!=null&&typeof t=="object"&&"status"in t&&t.status==="failure"}function H(t){return t!=null&&typeof t=="object"&&"status"in t&&t.status==="success"&&"token"in t}function L(t){return t!=null&&typeof t=="object"&&("data"in t&&!!t.data&&typeof t.data=="object"&&"enrich_token"in t.data&&!!t.data.enrich_token&&typeof t.data.enrich_token=="object"&&"userDirectoryJWT"in t.data.enrich_token||"errors"in t&&Array.isArray(t.errors))}function m(t){let a=`${y(t.authHost)||"https://auth.pro.hasura.io"}/ddn/promptql/token`,_={token:"",expiry:new Date(0)},r=t.fetch||fetch,n=async()=>{let i=await r(a,{method:"POST",headers:t.headers});switch(i.status){case 200:{let p=await i.json();if(H(p))return p;throw new Error("malformed token response")}case 401:{let p=await i.json();throw K(p)?new Error(p?.error||i.statusText):new Error(i.statusText)}default:{let p=await i.text();throw new Error(p)}}};return async()=>{if(_.expiry.getTime()<=Date.now()-1e3){let i=await n(),p=await ie(t.promptqlGraphQLUrl,i.token,t.projectId,r);_.token=p;let d=new Date(i.expiry);if(Number.isNaN(d.getTime())){let w=new Date;w.setHours(1),_.expiry=w}else _.expiry=d}return _.token}}var ie=async(t,e,a,_=fetch)=>{let r=await _(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:"mutation EnrichToken($luxJWT: String!, $projectId: uuid) { enrich_token(luxJWT: $luxJWT, projectId: $projectId) { userDirectoryJWT }}",variables:{luxJWT:e,projectId:a},operationName:"EnrichToken"})});switch(r.status){case 200:{let 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(t){return{Authorization:`pat ${t}`}}var o=require("@apollo/client"),$=require("@apollo/client/link/context"),Z=require("@apollo/client/link/subscriptions"),X=require("graphql"),Y=require("graphql-ws"),P=t=>{let e=new o.HttpLink({uri:t.url,fetch:t.fetch,headers:t.headers}),a=async p=>{let d=await t.getAuthToken();return{headers:{...p,Authorization:`Bearer ${d}`}}},_=(0,Y.createClient)({url:t.url,connectionParams:()=>a(t.headers)}),r=new Z.GraphQLWsLink(_),n=new $.SetContextLink(({headers:p})=>a(p)),i=o.ApolloLink.split(({operationType:p})=>p===X.OperationTypeNode.SUBSCRIPTION,r,n.concat(e));return{client:new o.ApolloClient({link:i,cache:new o.InMemoryCache}),wsClient:_}};var b=class{_options;constructor(e){this._options=e}info(){return R(this._options.client)}};function R(t){return t.query({query:N,fetchPolicy:"cache-first"}).then(e=>{if(!e.data?.get_project_info)throw new Error(e.error?.message||"Project not found");return e.data.get_project_info})}var I=class{_options;constructor(e){this._options=e}list(e){return A(this._options.client,{...e,limit:e.limit&&e.limit>0?e.limit:10})}get(e){if(!e)throw new Error("threadId is required");return B(this._options.client,e)}async start(e){let a=await R(this._options.client);return C(this._options.client,{...e,projectId:a.projectId,buildId:e.buildId||this._options.buildId,timezone:e.timezone||this._options.defaultTimezone})}getEvents(e,a){return k(this._options.client,e,a)}sendMessage(e){return v(this._options.client,{...e,timezone:e.timezone||this._options.defaultTimezone})}cancelAgentMessage(e){return T(this._options.client,e)}subscribeEvents(e,a){return O(this._options.client,e,a)}streamMessageEvents(e,a){return E(this._options.client,e,a)}};var U=class{constructor(e){let a=y(e.promptqlBaseUrl)||"https://promptql.ddn.hasura.app";if(!e.serviceAccountToken)throw new Error("serviceAccountToken must not be empty. If you haven't created any service account token yet, check out Hasura docs https://hasura.io/docs/3.0/project-configuration/project-management/service-accounts/#how-to-create-service-account");let _=a.endsWith("/v1/graphql")?a:`${a}/playground-v2-hge/v1/graphql`;this._fetchToken=m({promptqlGraphQLUrl:_,authHost:e.authHost,headers:J(e.serviceAccountToken),fetch:e.fetch});let{client:r,wsClient:n}=P({getAuthToken:this._fetchToken,url:_,fetch:e.fetch,headers:e.headers});this._wsClient=n,this._options={client:r,buildId:e.buildId,defaultTimezone:e.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone},this.thread=new I(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 pe(t,e){if(!e.length)return[];if(!t.length)return e;let a=t[t.length-1];if(!a)return e;let _=BigInt(a.thread_event_id),r=e.length-1;for(;r>=0;r--){let n=e[r];if(BigInt(n?.thread_event_id)<=_)break}return e.slice(r+1)}function oe(t){return"UserMessage"in t?t.UserMessage:null}function se(t){return"UserCancel"in t?t.UserCancel:null}function ue(t){return!("AgentMessage"in t)||!("OrchestratorUpdate"in t.AgentMessage.update)||!("PlanGenerationStarted"in t.AgentMessage.update.OrchestratorUpdate.update)?null:t.AgentMessage.update.OrchestratorUpdate.update.PlanGenerationStarted}function de(t){let e=g(t);return!e||!("PlanStepGenerated"in e)?null:e.PlanStepGenerated}function ye(t){if(!("AgentMessage"in t))return null;if("content"in t.AgentMessage.update&&"interaction_update"in t.AgentMessage.update.content&&"main_agent"in t.AgentMessage.update.content.interaction_update&&"completed"in t.AgentMessage.update.content.interaction_update.main_agent){let e=t.AgentMessage.update.content.interaction_update.main_agent.completed;return{success:e.success,message:e.summary,modified_artifacts:[],generated_at:t.AgentMessage.update.timestamp}}return!("OrchestratorUpdate"in t.AgentMessage.update)||!("GeneratedResponse"in t.AgentMessage.update.OrchestratorUpdate.update)?null:t.AgentMessage.update.OrchestratorUpdate.update.GeneratedResponse.response}function ce(t){return!("AgentMessage"in t)||!("MessageProcessingUpdate"in t.AgentMessage.update)||!("ProcessingStarted"in t.AgentMessage.update.MessageProcessingUpdate.update)?null:t.AgentMessage.update.MessageProcessingUpdate.update.ProcessingStarted}function le(t){return!("AgentMessage"in t)||!("MessageProcessingUpdate"in t.AgentMessage.update)||!("InteractionDecision"in t.AgentMessage.update.MessageProcessingUpdate.update)||!("AcceptInteraction"in t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.AcceptInteraction}function me(t){return!("AgentMessage"in t)||!("MessageProcessingUpdate"in t.AgentMessage.update)||!("InteractionDecision"in t.AgentMessage.update.MessageProcessingUpdate.update)||!("DeclineInteraction"in t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.DeclineInteraction}function M(t){return!("AgentMessage"in t)||!("PlanningDecisionUpdate"in t.AgentMessage.update)?null:t.AgentMessage.update.PlanningDecisionUpdate.update}function be(t){let e=M(t);return!e||!("Started"in e)?null:e.Started}function Ie(t){let e=M(t);return!e||!("Completed"in e)?null:e.Completed}function Me(t){let e=M(t);return!e||!("PlanningRequired"in e)?null:e.PlanningRequired}function ge(t){return!("AgentMessage"in t)||!("StartingOrchestrator"in t.AgentMessage.update)?null:t.AgentMessage.update.StartingOrchestrator}function g(t){return!("AgentMessage"in t)||!("OrchestratorUpdate"in t.AgentMessage.update)?null:t.AgentMessage.update.OrchestratorUpdate.update}function u(t){let e=g(t);return!e||!("ContextExplorerUpdate"in e)?null:e.ContextExplorerUpdate.update}function Se(t){let e=u(t);return!e||!("Started"in e)?null:e.Started}function he(t){let e=u(t);return!e||!("Completed"in e)?null:e.Completed}function S(t){let e=u(t);return!e||!("WikiExplorerUpdate"in e)?null:e.WikiExplorerUpdate.update}function fe(t){let e=S(t);return!e||!("Started"in e)?null:e.Started}function xe(t){let e=S(t);return!e||!("Completed"in e)?null:e.Completed}function Ae(t){let e=S(t);return!e||!("WikiInfoGenerated"in e)?null:e.WikiInfoGenerated}function h(t){let e=u(t);return!e||!("SchemaTasksGenerationUpdate"in e)?null:e.SchemaTasksGenerationUpdate.update}function Be(t){let e=h(t);return!e||!("Started"in e)?null:e.Started}function Ce(t){let e=h(t);return!e||!("Completed"in e)?null:e.Completed}function ke(t){let e=h(t);return!e||!("TasksGenerated"in e)?null:e.TasksGenerated}function s(t){let e=u(t);return!e||!("SchemaExplorerUpdate"in e)?null:e.SchemaExplorerUpdate.update}function ve(t){let e=s(t);return!e||!("Started"in e)?null:e.Started}function Te(t){let e=s(t);return!e||!("Completed"in e)?null:e.Completed}function Oe(t){let e=s(t);return!e||!("CodeExecutionComplete"in e)?null:e.CodeExecutionComplete}function Ee(t){let e=s(t);return!e||!("CodeOutputAnalyzed"in e)?null:e.CodeOutputAnalyzed}function Pe(t){let e=s(t);return!e||!("GeneratedCode"in e)?null:e.GeneratedCode}function Re(t){let e=s(t);return!e||!("SchemaExplored"in e)?null:e.SchemaExplored}function f(t){let e=g(t);return!e||!("StepUpdate"in e)?null:e.StepUpdate}function Ue(t){let e=f(t);return!e||!("Programmer"in e.update)?null:e.update.Programmer}function we(t){let e=f(t);return!e||!("UiProgrammer"in e.update)?null:e.update.UiProgrammer}function Fe(t){let e=f(t);return!e||!("SavedProgramRunner"in e.update)?null:e.update.SavedProgramRunner}function Ve(t){if(!("AgentMessage"in t))return null;if("InteractionFinished"in t.AgentMessage.update){let e=t.AgentMessage.update.InteractionFinished.update;return"UserCancelled"in e?{status:"UserCancelled",timestamp:e.UserCancelled.cancelled_at}:"AgentDeclined"in e?{status:"AgentDeclined",timestamp:e.AgentDeclined.declined_at,reason:e.AgentDeclined.reason}:"Errored"in e?{status:"Errored",timestamp:e.Errored.errored_at,reason:typeof e.Errored.error=="string"?e.Errored.error:e.Errored.error.User.message}:"ServerCancelled"in e?{status:"ServerCancelled",timestamp:e.ServerCancelled.cancelled_at}:{status:"Completed",timestamp:e.Completed.completed_at,warnings:e.Completed.warnings}}if("content"in t.AgentMessage.update&&"interaction_finished"in t.AgentMessage.update.content){let e=t.AgentMessage.update.content.interaction_finished.outcome;return"errored"in e?{status:"Errored",reason:e.errored.user_facing_message||e.errored.raw_error,timestamp:t.AgentMessage.update.timestamp,warnings:e.errored.raw_error?[{message:e.errored.raw_error}]:[]}:"server_cancelled"in e?{status:"ServerCancelled",timestamp:t.AgentMessage.update.timestamp}:"user_cancelled"in e?{status:"UserCancelled",timestamp:t.AgentMessage.update.timestamp}:{status:"Completed",timestamp:t.AgentMessage.update.timestamp,warnings:e.completed.warnings}}return null}0&&(module.exports={PromptQLSdk,cancelAgentMessage,createApolloClient,createPromptQLAuthTokenGenerator,diffThreadEvents,getAgentGeneratedResponse,getAgentInteractionDecisionAcceptInteractionEvent,getAgentInteractionDecisionDeclineInteractionEvent,getAgentInteractionFinishedEvent,getAgentMessageProcessingStartedEvent,getAgentOrchestratorContextExplorerCompletedEvent,getAgentOrchestratorContextExplorerStartedEvent,getAgentOrchestratorContextExplorerUpdateEvent,getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent,getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent,getAgentOrchestratorSchemaExplorerCompletedEvent,getAgentOrchestratorSchemaExplorerGeneratedCodeEvent,getAgentOrchestratorSchemaExplorerSchemaExploredEvent,getAgentOrchestratorSchemaExplorerStartedEvent,getAgentOrchestratorSchemaExplorerUpdateEvent,getAgentOrchestratorSchemaTasksGeneratedEvent,getAgentOrchestratorSchemaTasksGenerationCompletedEvent,getAgentOrchestratorSchemaTasksGenerationStartedEvent,getAgentOrchestratorSchemaTasksGenerationUpdateEvent,getAgentOrchestratorStepProgrammerEvent,getAgentOrchestratorStepSavedProgramRunnerEvent,getAgentOrchestratorStepUiProgrammerEvent,getAgentOrchestratorStepUpdateEvent,getAgentOrchestratorUpdateEvent,getAgentOrchestratorWikiExplorerCompletedEvent,getAgentOrchestratorWikiExplorerStartedEvent,getAgentOrchestratorWikiExplorerUpdateEvent,getAgentOrchestratorWikiInfoGeneratedEvent,getAgentPlanGenerationStartedEvent,getAgentPlanStepGeneratedEvent,getAgentPlanningDecisionCompletedEvent,getAgentPlanningDecisionPlanningRequiredEvent,getAgentPlanningDecisionStartedEvent,getAgentPlanningDecisionUpdateEvent,getAgentStartingOrchestratorEvent,getThread,getThreadEvents,getUserCancelEvent,getUserMessageEvent,listThreads,sendThreadMessage,startThread,streamThreadMessageEvents,subscribeThreadEvents});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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("UserCancel"in n.event_data)return!1;if(!("AgentMessage"in n.event_data))return!0;let i=n.event_data.AgentMessage.update;if("content"in i&&"interaction_finished"in i.content||"InteractionFinished"in i||a?.skipAnalysis&&"OrchestratorUpdate"in i&&"GeneratedResponse"in i.OrchestratorUpdate.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 i=await r(a,{method:"POST",headers:e.headers});switch(i.status){case 200:{let p=await i.json();if(q(p))return p;throw new Error("malformed token response")}case 401:{let p=await i.json();throw j(p)?new Error(p?.error||i.statusText):new Error(i.statusText)}default:{let p=await i.text();throw new Error(p)}}};return async()=>{if(_.expiry.getTime()<=Date.now()-1e3){let i=await n(),p=await J(e.promptqlGraphQLUrl,i.token,e.projectId,r);_.token=p;let s=new Date(i.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 p=>{let s=await e.getAuthToken();return{headers:{...p,Authorization:`Bearer ${s}`}}},_=re({url:e.url,connectionParams:()=>a(e.headers)}),r=new te(_),n=new ee(({headers:p})=>a(p)),i=Z.split(({operationType:p})=>p===ae.SUBSCRIPTION,r,n.concat(t));return{client:new $({link:i,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};
|
|
1
|
+
import{map as H,takeWhile as L}from"rxjs";var x={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"}}]}}]}}]},A={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"SendThreadMessage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"message"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"timezone"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"threadId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"uploads"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UserUploadInput"}}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"send_thread_message"},arguments:[{kind:"Argument",name:{kind:"Name",value:"threadId"},value:{kind:"Variable",name:{kind:"Name",value:"threadId"}}},{kind:"Argument",name:{kind:"Name",value:"timezone"},value:{kind:"Variable",name:{kind:"Name",value:"timezone"}}},{kind:"Argument",name:{kind:"Name",value:"message"},value:{kind:"Variable",name:{kind:"Name",value:"message"}}},{kind:"Argument",name:{kind:"Name",value:"buildFqdn"},value:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}}},{kind:"Argument",name:{kind:"Name",value:"uploads"},value:{kind:"Variable",name:{kind:"Name",value:"uploads"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"created_at"}}]}}]}}]},B={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"StartThread"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"message"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"projectId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"timezone"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"roomId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"uploads"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UserUploadInput"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"visibility"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"start_thread"},arguments:[{kind:"Argument",name:{kind:"Name",value:"message"},value:{kind:"Variable",name:{kind:"Name",value:"message"}}},{kind:"Argument",name:{kind:"Name",value:"projectId"},value:{kind:"Variable",name:{kind:"Name",value:"projectId"}}},{kind:"Argument",name:{kind:"Name",value:"timezone"},value:{kind:"Variable",name:{kind:"Name",value:"timezone"}}},{kind:"Argument",name:{kind:"Name",value:"buildId"},value:{kind:"Variable",name:{kind:"Name",value:"buildId"}}},{kind:"Argument",name:{kind:"Name",value:"buildFqdn"},value:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}}},{kind:"Argument",name:{kind:"Name",value:"roomId"},value:{kind:"Variable",name:{kind:"Name",value:"roomId"}}},{kind:"Argument",name:{kind:"Name",value:"uploads"},value:{kind:"Variable",name:{kind:"Name",value:"uploads"}}},{kind:"Argument",name:{kind:"Name",value:"visibility"},value:{kind:"Variable",name:{kind:"Name",value:"visibility"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"thread_events"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"thread_event_id"}}]}}]}}]}}]},C={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"}}]}}]}}]},k={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreads"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"threads_v2_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"threads_v2_order_by"}}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"threads_v2"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Thread"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Thread"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"threads_v2"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"build_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"relevant_event_count"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}},{kind:"Field",name:{kind:"Name",value:"email"}},{kind:"Field",name:{kind:"Name",value:"is_active"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}}]}}]}}]},v={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreadById"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"threads_v2_by_pk"},arguments:[{kind:"Argument",name:{kind:"Name",value:"thread_id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Thread"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Thread"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"threads_v2"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"build_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"relevant_event_count"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}},{kind:"Field",name:{kind:"Name",value:"email"}},{kind:"Field",name:{kind:"Name",value:"is_active"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}}]}}]}}]},T={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"}}]}}]},O={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"subscription",name:{kind:"Name",value:"SubscribeThreadEvents"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"EnumValue",value:"asc"}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadEvent"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"thread_events"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"user_id"}}]}}]};function d(t){return t=t?t.trim():"",t?t[t.length-1]==="/"?t.slice(0,t.length-1):t:""}function y(t){if(t==null)return null;try{Number.parseInt(t)}catch{throw new Error("invalid threadEventId")}return t}function E(t,e){return t.query({query:k,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2??[])}function P(t,e){if(!e)throw new Error("threadId is required");return t.query({query:v,variables:{id:e},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2_by_pk)}function R(t,e){if(!e.message.trim())throw new Error("message must not be empty");return t.mutate({mutation:B,variables:e}).then(a=>{if(!a.data?.start_thread)throw new Error(a.error?.message||"Failed to start thread");return a.data.start_thread})}function U(t,e,a){if(!e)throw new Error("threadId is required");let _={thread_id:{_eq:e}};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=j(a.messageId))}return t.query({query:T,variables:{where:_,limit:a?.limit},fetchPolicy:"no-cache"}).then(r=>r.data?.thread_events??[])}function w(t,e){if(!e.threadId)throw new Error("threadId is required");if(!e.message.trim())throw new Error("message must not be empty");return t.mutate({mutation:A,variables:e}).then(a=>{if(!a.data?.send_thread_message)throw new Error(a.error?.message||"Failed to send message to thread");return a.data.send_thread_message})}function F(t,e){if(!e.threadId)throw new Error("threadId is required");if(!e.messageId.trim())throw new Error("messageId is required");return t.mutate({mutation:x,variables:e}).then(a=>{if(!a.data?.cancel_agent_message)throw new Error(a.error?.message||"Failed to cancel thread");return a.data.cancel_agent_message})}function V(t,e,a){return N(t,e,{fromEventId:a})}function W(t,e,a){return N(t,e,a).pipe(L(_=>{for(let r=_.length-1;r>0;r--){let n=_[r];if(a?.skipAnalysis&&"UserCancel"in n.event_data)return!1;if(!("AgentMessage"in n.event_data))return!0;let i=n.event_data.AgentMessage.update;if("content"in i&&"interaction_finished"in i.content||"InteractionFinished"in i||a?.skipAnalysis&&"OrchestratorUpdate"in i&&"GeneratedResponse"in i.OrchestratorUpdate.update)return!1}return!0},!0))}function N(t,e,a){if(!e)throw new Error("threadId is required");let _={thread_id:{_eq:e}};return a&&(y(a.fromEventId)&&(_.thread_event_id={_gte:a.fromEventId}),a.messageId&&(_._or=j(a.messageId))),t.subscribe({query:O,variables:{where:_}}).pipe(H(r=>{if(r.error)throw r.error;return r.data?.thread_events??[]}))}function j(t){return[{event_data:{_contains:{UserMessage:{message_id:t}}}},{event_data:{_contains:{AgentMessage:{message_id:t}}}},{event_data:{_contains:{UserCancel:{message_id:t}}}}]}function q(t){return t!=null&&typeof t=="object"&&"status"in t&&t.status==="failure"}function z(t){return t!=null&&typeof t=="object"&&"status"in t&&t.status==="success"&&"token"in t}function G(t){return t!=null&&typeof t=="object"&&("data"in t&&!!t.data&&typeof t.data=="object"&&"enrich_token"in t.data&&!!t.data.enrich_token&&typeof t.data.enrich_token=="object"&&"userDirectoryJWT"in t.data.enrich_token||"errors"in t&&Array.isArray(t.errors))}function m(t){let a=`${d(t.authHost)||"https://auth.pro.hasura.io"}/ddn/promptql/token`,_={token:"",expiry:new Date(0)},r=t.fetch||fetch,n=async()=>{let i=await r(a,{method:"POST",headers:t.headers});switch(i.status){case 200:{let p=await i.json();if(z(p))return p;throw new Error("malformed token response")}case 401:{let p=await i.json();throw q(p)?new Error(p?.error||i.statusText):new Error(i.statusText)}default:{let p=await i.text();throw new Error(p)}}};return async()=>{if(_.expiry.getTime()<=Date.now()-1e3){let i=await n(),p=await J(t.promptqlGraphQLUrl,i.token,t.projectId,r);_.token=p;let u=new Date(i.expiry);if(Number.isNaN(u.getTime())){let f=new Date;f.setHours(1),_.expiry=f}else _.expiry=u}return _.token}}var J=async(t,e,a,_=fetch)=>{let r=await _(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:"mutation EnrichToken($luxJWT: String!, $projectId: uuid) { enrich_token(luxJWT: $luxJWT, projectId: $projectId) { userDirectoryJWT }}",variables:{luxJWT:e,projectId:a},operationName:"EnrichToken"})});switch(r.status){case 200:{let n=await r.json();if(!G(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 Q(t){return{Authorization:`pat ${t}`}}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 D=t=>{let e=new X({uri:t.url,fetch:t.fetch,headers:t.headers}),a=async p=>{let u=await t.getAuthToken();return{headers:{...p,Authorization:`Bearer ${u}`}}},_=re({url:t.url,connectionParams:()=>a(t.headers)}),r=new te(_),n=new ee(({headers:p})=>a(p)),i=Z.split(({operationType:p})=>p===ae.SUBSCRIPTION,r,n.concat(e));return{client:new $({link:i,cache:new Y}),wsClient:_}};var c=class{_options;constructor(e){this._options=e}info(){return b(this._options.client)}};function b(t){return t.query({query:C,fetchPolicy:"cache-first"}).then(e=>{if(!e.data?.get_project_info)throw new Error(e.error?.message||"Project not found");return e.data.get_project_info})}var l=class{_options;constructor(e){this._options=e}list(e){return E(this._options.client,{...e,limit:e.limit&&e.limit>0?e.limit:10})}get(e){if(!e)throw new Error("threadId is required");return P(this._options.client,e)}async start(e){let a=await b(this._options.client);return R(this._options.client,{...e,projectId:a.projectId,buildId:e.buildId||this._options.buildId,timezone:e.timezone||this._options.defaultTimezone})}getEvents(e,a){return U(this._options.client,e,a)}sendMessage(e){return w(this._options.client,{...e,timezone:e.timezone||this._options.defaultTimezone})}cancelAgentMessage(e){return F(this._options.client,e)}subscribeEvents(e,a){return V(this._options.client,e,a)}streamMessageEvents(e,a){return W(this._options.client,e,a)}};var K=class{constructor(e){let a=d(e.promptqlBaseUrl)||"https://promptql.ddn.hasura.app";if(!e.serviceAccountToken)throw new Error("serviceAccountToken must not be empty. If you haven't created any service account token yet, check out Hasura docs https://hasura.io/docs/3.0/project-configuration/project-management/service-accounts/#how-to-create-service-account");let _=a.endsWith("/v1/graphql")?a:`${a}/playground-v2-hge/v1/graphql`;this._fetchToken=m({promptqlGraphQLUrl:_,authHost:e.authHost,headers:Q(e.serviceAccountToken),fetch:e.fetch});let{client:r,wsClient:n}=D({getAuthToken:this._fetchToken,url:_,fetch:e.fetch,headers:e.headers});this._wsClient=n,this._options={client:r,buildId:e.buildId,defaultTimezone:e.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(t,e){if(!e.length)return[];if(!t.length)return e;let a=t[t.length-1];if(!a)return e;let _=BigInt(a.thread_event_id),r=e.length-1;for(;r>=0;r--){let n=e[r];if(BigInt(n?.thread_event_id)<=_)break}return e.slice(r+1)}function Qe(t){return"UserMessage"in t?t.UserMessage:null}function De(t){return"UserCancel"in t?t.UserCancel:null}function Ke(t){return!("AgentMessage"in t)||!("OrchestratorUpdate"in t.AgentMessage.update)||!("PlanGenerationStarted"in t.AgentMessage.update.OrchestratorUpdate.update)?null:t.AgentMessage.update.OrchestratorUpdate.update.PlanGenerationStarted}function He(t){let e=M(t);return!e||!("PlanStepGenerated"in e)?null:e.PlanStepGenerated}function Le(t){if(!("AgentMessage"in t))return null;if("content"in t.AgentMessage.update&&"interaction_update"in t.AgentMessage.update.content&&"main_agent"in t.AgentMessage.update.content.interaction_update&&"completed"in t.AgentMessage.update.content.interaction_update.main_agent){let e=t.AgentMessage.update.content.interaction_update.main_agent.completed;return{success:e.success,message:e.summary,modified_artifacts:[],generated_at:t.AgentMessage.update.timestamp}}return!("OrchestratorUpdate"in t.AgentMessage.update)||!("GeneratedResponse"in t.AgentMessage.update.OrchestratorUpdate.update)?null:t.AgentMessage.update.OrchestratorUpdate.update.GeneratedResponse.response}function Je(t){return!("AgentMessage"in t)||!("MessageProcessingUpdate"in t.AgentMessage.update)||!("ProcessingStarted"in t.AgentMessage.update.MessageProcessingUpdate.update)?null:t.AgentMessage.update.MessageProcessingUpdate.update.ProcessingStarted}function $e(t){return!("AgentMessage"in t)||!("MessageProcessingUpdate"in t.AgentMessage.update)||!("InteractionDecision"in t.AgentMessage.update.MessageProcessingUpdate.update)||!("AcceptInteraction"in t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.AcceptInteraction}function Ze(t){return!("AgentMessage"in t)||!("MessageProcessingUpdate"in t.AgentMessage.update)||!("InteractionDecision"in t.AgentMessage.update.MessageProcessingUpdate.update)||!("DeclineInteraction"in t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.DeclineInteraction}function I(t){return!("AgentMessage"in t)||!("PlanningDecisionUpdate"in t.AgentMessage.update)?null:t.AgentMessage.update.PlanningDecisionUpdate.update}function Xe(t){let e=I(t);return!e||!("Started"in e)?null:e.Started}function Ye(t){let e=I(t);return!e||!("Completed"in e)?null:e.Completed}function et(t){let e=I(t);return!e||!("PlanningRequired"in e)?null:e.PlanningRequired}function tt(t){return!("AgentMessage"in t)||!("StartingOrchestrator"in t.AgentMessage.update)?null:t.AgentMessage.update.StartingOrchestrator}function M(t){return!("AgentMessage"in t)||!("OrchestratorUpdate"in t.AgentMessage.update)?null:t.AgentMessage.update.OrchestratorUpdate.update}function s(t){let e=M(t);return!e||!("ContextExplorerUpdate"in e)?null:e.ContextExplorerUpdate.update}function at(t){let e=s(t);return!e||!("Started"in e)?null:e.Started}function rt(t){let e=s(t);return!e||!("Completed"in e)?null:e.Completed}function g(t){let e=s(t);return!e||!("WikiExplorerUpdate"in e)?null:e.WikiExplorerUpdate.update}function _t(t){let e=g(t);return!e||!("Started"in e)?null:e.Started}function nt(t){let e=g(t);return!e||!("Completed"in e)?null:e.Completed}function it(t){let e=g(t);return!e||!("WikiInfoGenerated"in e)?null:e.WikiInfoGenerated}function S(t){let e=s(t);return!e||!("SchemaTasksGenerationUpdate"in e)?null:e.SchemaTasksGenerationUpdate.update}function pt(t){let e=S(t);return!e||!("Started"in e)?null:e.Started}function ot(t){let e=S(t);return!e||!("Completed"in e)?null:e.Completed}function st(t){let e=S(t);return!e||!("TasksGenerated"in e)?null:e.TasksGenerated}function o(t){let e=s(t);return!e||!("SchemaExplorerUpdate"in e)?null:e.SchemaExplorerUpdate.update}function ut(t){let e=o(t);return!e||!("Started"in e)?null:e.Started}function dt(t){let e=o(t);return!e||!("Completed"in e)?null:e.Completed}function yt(t){let e=o(t);return!e||!("CodeExecutionComplete"in e)?null:e.CodeExecutionComplete}function ct(t){let e=o(t);return!e||!("CodeOutputAnalyzed"in e)?null:e.CodeOutputAnalyzed}function lt(t){let e=o(t);return!e||!("GeneratedCode"in e)?null:e.GeneratedCode}function mt(t){let e=o(t);return!e||!("SchemaExplored"in e)?null:e.SchemaExplored}function h(t){let e=M(t);return!e||!("StepUpdate"in e)?null:e.StepUpdate}function bt(t){let e=h(t);return!e||!("Programmer"in e.update)?null:e.update.Programmer}function It(t){let e=h(t);return!e||!("UiProgrammer"in e.update)?null:e.update.UiProgrammer}function Mt(t){let e=h(t);return!e||!("SavedProgramRunner"in e.update)?null:e.update.SavedProgramRunner}function gt(t){if(!("AgentMessage"in t))return null;if("InteractionFinished"in t.AgentMessage.update){let e=t.AgentMessage.update.InteractionFinished.update;return"UserCancelled"in e?{status:"UserCancelled",timestamp:e.UserCancelled.cancelled_at}:"AgentDeclined"in e?{status:"AgentDeclined",timestamp:e.AgentDeclined.declined_at,reason:e.AgentDeclined.reason}:"Errored"in e?{status:"Errored",timestamp:e.Errored.errored_at,reason:typeof e.Errored.error=="string"?e.Errored.error:e.Errored.error.User.message}:"ServerCancelled"in e?{status:"ServerCancelled",timestamp:e.ServerCancelled.cancelled_at}:{status:"Completed",timestamp:e.Completed.completed_at,warnings:e.Completed.warnings}}if("content"in t.AgentMessage.update&&"interaction_finished"in t.AgentMessage.update.content){let e=t.AgentMessage.update.content.interaction_finished.outcome;return"errored"in e?{status:"Errored",reason:e.errored.user_facing_message||e.errored.raw_error,timestamp:t.AgentMessage.update.timestamp,warnings:e.errored.raw_error?[{message:e.errored.raw_error}]:[]}:"server_cancelled"in e?{status:"ServerCancelled",timestamp:t.AgentMessage.update.timestamp}:"user_cancelled"in e?{status:"UserCancelled",timestamp:t.AgentMessage.update.timestamp}:{status:"Completed",timestamp:t.AgentMessage.update.timestamp,warnings:e.completed.warnings}}return null}export{K as PromptQLSdk,F as cancelAgentMessage,D as createApolloClient,m as createPromptQLAuthTokenGenerator,Ge as diffThreadEvents,Le as getAgentGeneratedResponse,$e as getAgentInteractionDecisionAcceptInteractionEvent,Ze as getAgentInteractionDecisionDeclineInteractionEvent,gt as getAgentInteractionFinishedEvent,Je as getAgentMessageProcessingStartedEvent,rt as getAgentOrchestratorContextExplorerCompletedEvent,at as getAgentOrchestratorContextExplorerStartedEvent,s as getAgentOrchestratorContextExplorerUpdateEvent,yt as getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent,ct as getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent,dt as getAgentOrchestratorSchemaExplorerCompletedEvent,lt as getAgentOrchestratorSchemaExplorerGeneratedCodeEvent,mt as getAgentOrchestratorSchemaExplorerSchemaExploredEvent,ut as getAgentOrchestratorSchemaExplorerStartedEvent,o as getAgentOrchestratorSchemaExplorerUpdateEvent,st as getAgentOrchestratorSchemaTasksGeneratedEvent,ot as getAgentOrchestratorSchemaTasksGenerationCompletedEvent,pt as getAgentOrchestratorSchemaTasksGenerationStartedEvent,S as getAgentOrchestratorSchemaTasksGenerationUpdateEvent,bt as getAgentOrchestratorStepProgrammerEvent,Mt as getAgentOrchestratorStepSavedProgramRunnerEvent,It as getAgentOrchestratorStepUiProgrammerEvent,h as getAgentOrchestratorStepUpdateEvent,M as getAgentOrchestratorUpdateEvent,nt as getAgentOrchestratorWikiExplorerCompletedEvent,_t as getAgentOrchestratorWikiExplorerStartedEvent,g 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,P as getThread,U as getThreadEvents,De as getUserCancelEvent,Qe as getUserMessageEvent,E as listThreads,w as sendThreadMessage,R as startThread,W as streamThreadMessageEvents,V as subscribeThreadEvents};
|
package/package.json
CHANGED