@hasura/promptql 2.0.0-alpha.38 → 2.0.0-alpha.39
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/auth/index.mjs +1 -1
- package/dist/chunk-WIDMKT3J.mjs +1 -0
- package/dist/index.d.mts +14 -25
- package/dist/index.d.ts +14 -25
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-7AMW5GJT.mjs +0 -1
package/dist/auth/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as p}from"../chunk-WIDMKT3J.mjs";function h(e){return e!=null&&typeof e=="object"&&"status"in e&&e.status==="failure"}function d(e){return e!=null&&typeof e=="object"&&"status"in e&&e.status==="success"&&"token"in e}function k(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 y(e){let a=`${p(e.authHost)||"https://auth.pro.hasura.io"}/ddn/promptql/token`,n={token:"",expiry:new Date(0)},s=e.fetch||fetch,o=async()=>{let t=await s(a,{method:"POST",headers:e.headers});switch(t.status){case 200:{let r=await t.json();if(d(r))return r;throw new Error("malformed token response")}case 401:{let r=await t.json();throw h(r)?new Error(r?.error||t.statusText):new Error(t.statusText)}default:{let r=await t.text();throw new Error(r)}}};return async()=>{if(n.expiry.getTime()<=Date.now()+1e3){let t=await o(),r=await m(e.promptqlGraphQLUrl,t.token,e.projectId,s);n.token=r;let c=new Date(t.expiry);if(Number.isNaN(c.getTime())){let u=new Date;u.setHours(1),n.expiry=u}else n.expiry=c}return n.token}}var m=async(e,i,a,n=fetch)=>{let s=await n(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:i,projectId:a},operationName:"EnrichToken"})});switch(s.status){case 200:{let o=await s.json();if(!k(o)||!o.data?.enrich_token?.userDirectoryJWT)throw new Error(`malformed promptql token response: ${JSON.stringify(o)}`);return o.data.enrich_token.userDirectoryJWT}default:{let o=await s.text();throw new Error(o)}}};export{y as createPromptQLAuthTokenGenerator,m as enrichToken,k as isEnrichTokenMutationResponse,h as isLuxAuthPromptQLTokenFailedResponse,d as isLuxAuthPromptQLTokenSuccessResponse};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r=/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;function n(e){return e=e?e.trim():"",e?e[e.length-1]==="/"?e.slice(0,e.length-1):e:""}function l(e){if(e==null)return null;try{Number.parseInt(e)}catch{throw new Error("invalid threadEventId")}return e}export{r as a,n as b,l as c};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ApolloClient, Observable } from '@apollo/client';
|
|
2
2
|
import * as graphql_ws from 'graphql-ws';
|
|
3
|
+
import { Client } from 'graphql-ws';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* This file was automatically generated by json-schema-to-typescript.
|
|
@@ -4370,6 +4371,7 @@ type Rooms_Bool_Exp = {
|
|
|
4370
4371
|
_not?: Rooms_Bool_Exp | null | undefined;
|
|
4371
4372
|
_or?: Array<Rooms_Bool_Exp> | null | undefined;
|
|
4372
4373
|
active_members?: Room_Active_Member_Bool_Exp | null | undefined;
|
|
4374
|
+
active_members_count?: Int_Comparison_Exp | null | undefined;
|
|
4373
4375
|
created_at?: Timestamptz_Comparison_Exp | null | undefined;
|
|
4374
4376
|
deleted_at?: Timestamptz_Comparison_Exp | null | undefined;
|
|
4375
4377
|
description?: String_Comparison_Exp | null | undefined;
|
|
@@ -4395,6 +4397,7 @@ type Rooms_Bool_Exp = {
|
|
|
4395
4397
|
/** Ordering options when selecting data from "rooms". */
|
|
4396
4398
|
type Rooms_Order_By = {
|
|
4397
4399
|
active_members_aggregate?: Room_Active_Member_Aggregate_Order_By | null | undefined;
|
|
4400
|
+
active_members_count?: Order_By | null | undefined;
|
|
4398
4401
|
created_at?: Order_By | null | undefined;
|
|
4399
4402
|
deleted_at?: Order_By | null | undefined;
|
|
4400
4403
|
description?: Order_By | null | undefined;
|
|
@@ -6007,18 +6010,13 @@ declare const USER_AGENT = "PromptQL TypeScript SDK";
|
|
|
6007
6010
|
*/
|
|
6008
6011
|
type PromptQLSdkOptions = {
|
|
6009
6012
|
/**
|
|
6010
|
-
*
|
|
6013
|
+
* Base URL of the PromptQL API.
|
|
6011
6014
|
*/
|
|
6012
|
-
|
|
6015
|
+
baseUrl?: string;
|
|
6013
6016
|
/**
|
|
6014
|
-
*
|
|
6017
|
+
* Access token of the PromptQL project.
|
|
6015
6018
|
*/
|
|
6016
|
-
|
|
6017
|
-
/**
|
|
6018
|
-
* Service account token of the PromptQL project.
|
|
6019
|
-
* Check out Hasura docs https://hasura.io/docs/3.0/project-configuration/project-management/service-accounts/#how-to-create-service-account to know how to create a token.
|
|
6020
|
-
*/
|
|
6021
|
-
serviceAccountToken: string;
|
|
6019
|
+
accessToken: string;
|
|
6022
6020
|
/**
|
|
6023
6021
|
* A function to use instead of calling the Fetch API directly when sending HTTP requests to your GraphQL endpoint. The function must conform to the signature of fetch.
|
|
6024
6022
|
* By default, the Fetch API is used unless it isn't available in your runtime environment.
|
|
@@ -6213,7 +6211,6 @@ type ProjectInfoOutput = {
|
|
|
6213
6211
|
projectId: string;
|
|
6214
6212
|
projectName: string;
|
|
6215
6213
|
projectHost: string;
|
|
6216
|
-
promptqlGraphQLUrl: string;
|
|
6217
6214
|
promptqlConsoleUrl: string;
|
|
6218
6215
|
};
|
|
6219
6216
|
|
|
@@ -6381,16 +6378,12 @@ declare function deleteWikiPage(client: ApolloClient, id: string): Promise<strin
|
|
|
6381
6378
|
* A low-level API class for PromptQL.
|
|
6382
6379
|
*/
|
|
6383
6380
|
declare class PromptQLApi {
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6381
|
+
readonly options: PromptQLSdkOptions;
|
|
6382
|
+
readonly defaultTimezone: string;
|
|
6383
|
+
readonly client: ApolloClient;
|
|
6384
|
+
readonly wsClient: Client;
|
|
6388
6385
|
private project;
|
|
6389
|
-
private client;
|
|
6390
|
-
private wsClient;
|
|
6391
6386
|
constructor(options: PromptQLSdkOptions);
|
|
6392
|
-
getAuthToken(): Promise<string>;
|
|
6393
|
-
getGraphQLClient(): Promise<ApolloClient>;
|
|
6394
6387
|
/**
|
|
6395
6388
|
* Get the basic information of the current PromptQL project.
|
|
6396
6389
|
*/
|
|
@@ -6554,8 +6547,7 @@ type IPromptQLSdk = InstanceType<typeof PromptQLSdk>;
|
|
|
6554
6547
|
|
|
6555
6548
|
type ApolloClientOptions = {
|
|
6556
6549
|
url: string;
|
|
6557
|
-
headers
|
|
6558
|
-
getAuthToken: () => Promise<string>;
|
|
6550
|
+
headers: Record<string, string> | (() => PromiseLike<Record<string, string>>);
|
|
6559
6551
|
fetch?: typeof fetch;
|
|
6560
6552
|
};
|
|
6561
6553
|
declare const createApolloClient: (options: ApolloClientOptions) => {
|
|
@@ -6742,9 +6734,6 @@ declare function getAgentInteractionFinishedEvent(eventData: ThreadEvent$1): Int
|
|
|
6742
6734
|
* Get the message_id from the thread event data.
|
|
6743
6735
|
*/
|
|
6744
6736
|
declare function getThreadEventMessageId(event: ThreadEvent$1 | undefined): string | undefined;
|
|
6745
|
-
|
|
6746
|
-
* Build PromptQL URL from fqdn.
|
|
6747
|
-
*/
|
|
6748
|
-
declare function buildPromptQLUrl(fqdn: string): string;
|
|
6737
|
+
declare function buildAuthHeader(accessToken: string): Record<string, string>;
|
|
6749
6738
|
|
|
6750
|
-
export { type AgentGeneratedResponse, type AgentLearningUpdate, type AgentLoopAction, type AgentLoopActionLegacy, type AgentLoopActionResult, type AgentLoopActionUpdate, type AgentLoopActionUpdateUnversioned, type AgentLoopActionUpdateVersioned, type AgentLoopTerminalAction, type AgentLoopUpdate, type AgentTrigger, type AgentUpdate, type AgentUpdateContent, type ApolloClientOptions, type ArtifactDataPreview, type ArtifactError, type ArtifactErrorV1, type ArtifactId, type ArtifactMetadata, type ArtifactReference, type ArtifactReference1, type ArtifactType, type ArtifactUpdate, type ArtifactUpdate1, type AssumptionFactCheck, type BuildError, type BuildErrorV1, type BuiltUi, type BuiltUi1, type CancelAgentMessageMutationVariables, type CheckedAssumption, type CheckedTopic, type CodeBlock, type CodeError, type CodeErrorV1, type CodeExecutionComplete, type CodeOutputAnalysis, type CodeOutputAnalyzed, type ComponentResponse, type ComponentResponse1, type ComponentResponse2, type ComponentResponse3, type ComponentResponse4, type ComponentResponse5, type ConfidenceAnalysis, type ConfidenceAnalysisLlmUsage, type ConfidenceAnalysisUpdate, type ContextExplorerCompleted, type ContextExplorerStarted, type ContextExplorerUpdate, type CopyFileEntry, type CreateRoomArguments, type CreateWikiPageArgs, type DataArtifactUpdated, type DataArtifactUpdatedV1, type DecideNextStepsFields, type EventOfKind, type ExecuteProgramRequestData, type ExecuteProgramRequestProvenance, type ExternalKnowledgeExplorerAttempt, type ExternalKnowledgeExplorerAttempt1, type ExternalKnowledgeSummary, type FactSource, type FederatedWikiName, type GeneratedCode, type GeneratedFile, type GeneratedResponse, type GeneratedUiCode, type GetThreadEventOptions, type GetThreadsQueryVariables, type IPromptQLSdk, type InteractionDecision, type InteractionDecisionAccept, type InteractionDecisionDecline, type InteractionDecisionUpdate, type InteractionFinishedEvent, type InteractionFinishedUpdate, type InteractionOutcome, type InteractionOutcomeStatus, type InteractionUpdate, type InternalError, type InternalErrorV1, type InternalUpdate, type InterruptedByTrigger, type KeysOfUnion, type LearningBlockId, type LearningSuggestion, type LearningSuggestionUpdate, type LearningSuggestionUpdateV1, type ListWikiPageArgs, type LlmResponse, type LlmUsage, type LlmUsageEvent, type LlmUsageEventV1, type MessageProcessingStarted, type MessageProcessingUpdate, type NeedsSupportUpdate, type OrchestratorUpdate, type Order_By, type OutputEmitted, type OutputEmittedV1, type PipelineProgress, type PipelineProgressV1, type PipelineProgressV2, type PipelineRunStepDetails, type PipelineSourceState, type PlanGenerationStarted, type PlanStepGenerated, type PlanningDecisionCompleted, type PlanningDecisionPlanningRequired, type PlanningDecisionStarted, type PlanningDecisionUpdate, type ProgramExecuteOutcome, type ProgramExecuteUpdate, type ProgramExecutionTriggerInterruption, type ProgramId, type ProgramPackageName, type ProgramRunEvent, type ProgramRunSqlExecuteOutcome, type ProgramRunnerAction, type ProgrammerUpdate, type ProjectInfoOutput, PromptQLSdk, type PromptQLSdkOptions, type PromptQlUserId, type PythonRunStepDetails, ROOM_NAME_REGEX, type ResponseGenerationUpdate, type ResponseTruncation, type RoomFragment, type RoomVisibilityType, type RunFinished, type RunFinishedOutcome, type RunFinishedV1, type RunProgramRequest, type RunSavedProgramRequest, type RunStarted, type RunStartedV1, type RunStepDetails, type RuntimeArtifactType, type SavedProgramRunnerUpdate, type SavedProgramRunnerUpdateV0, type ScheduledAgentTriggerEventId, type ScheduledAgentTriggerId, type ScheduledAgentTriggerPayload, type ScheduledAgentTriggerPayloadV1, type ScheduledAgentTriggerType, type SchemaContext, type SchemaExplored, type SchemaExplorerCompleted, type SchemaExplorerStarted, type SchemaExplorerUpdate, type SchemaTask, type SchemaTasksGenerationCompleted, type SchemaTasksGenerationStarted, type SchemaTasksGenerationUpdate, type SearchWikiPageItem, type SearchWikiPagesResult, type SendMessageToThreadArguments, type SendMessageToThreadOutput, type SendThreadMessageMutationVariables, type ServerMetadata, type ShelfActionEvent, type ShelfSchemaName, type ShelfTransactionOpened, type ShelfTransactionOpenedV1, type ShelfTransactionSuspended, type ShelfTransactionSuspendedV1, type ShelfUpdate, type ShelfUpdateV1, type SkillType, type SocialFeedRatingLlmUsage, type SocialFeedRatingUpdate, type Span, type Sql, type SqlError, type SqlErrorType, type SqlErrorV1, type SqlExecuteCompleted, type SqlExecuteCompletedV1, type SqlExecuteOutcome, type SqlExecuteStarted, type SqlExecuteStartedV1, type SqlQueryId, type SqlRunStepDetails, type StartThreadArguments, type StartThreadMutationVariables, type StartThreadOutput, type StartingOrchestrator, type StepExecutionFinished, type StepExecutionFinishedV1, type StepExecutionStarted, type StepExecutionStartedV1, type StepUpdate, type StreamThreadEventOptions, type TargetWikiPage, type TasksGenerated, type Teaching, type TeachingId, type ThreadDetail, type ThreadEvent, type ThreadEvent$1 as ThreadEventData, type ThreadFragment, type ThreadId, type TransactionId, type TzWrapper, USER_AGENT, type UiBuildFailure, type UiBuildRunStepDetails, type UiMetadata, type UiProgrammerUpdate, type UpdateWikiContentArgs, type UserCancel, type UserCancelEvent, type UserEventProvenance, type UserMessage, type UserMessageEvent, type UserUpload, type VersionedAgentUpdate, type VersionedOrUnversionedAgentUpdate, type Warning, type WikiAuditId, type WikiChange, type WikiContent, type WikiDelta, type WikiExplorerCompleted, type WikiExplorerStarted, type WikiExplorerUpdate, type WikiGenerationUpdate, type WikiInfoGenerated, type WikiLearningSuggestionUpdate, type WikiPageDetail, type WikiPageItem, type WikiPageNamespace, type WikiPagePreview, type WikiPageSearchResult, type WikiPageV1, type WikiSection, type WikiSelectionUpdate, type WikiTitle,
|
|
6739
|
+
export { type AgentGeneratedResponse, type AgentLearningUpdate, type AgentLoopAction, type AgentLoopActionLegacy, type AgentLoopActionResult, type AgentLoopActionUpdate, type AgentLoopActionUpdateUnversioned, type AgentLoopActionUpdateVersioned, type AgentLoopTerminalAction, type AgentLoopUpdate, type AgentTrigger, type AgentUpdate, type AgentUpdateContent, type ApolloClientOptions, type ArtifactDataPreview, type ArtifactError, type ArtifactErrorV1, type ArtifactId, type ArtifactMetadata, type ArtifactReference, type ArtifactReference1, type ArtifactType, type ArtifactUpdate, type ArtifactUpdate1, type AssumptionFactCheck, type BuildError, type BuildErrorV1, type BuiltUi, type BuiltUi1, type CancelAgentMessageMutationVariables, type CheckedAssumption, type CheckedTopic, type CodeBlock, type CodeError, type CodeErrorV1, type CodeExecutionComplete, type CodeOutputAnalysis, type CodeOutputAnalyzed, type ComponentResponse, type ComponentResponse1, type ComponentResponse2, type ComponentResponse3, type ComponentResponse4, type ComponentResponse5, type ConfidenceAnalysis, type ConfidenceAnalysisLlmUsage, type ConfidenceAnalysisUpdate, type ContextExplorerCompleted, type ContextExplorerStarted, type ContextExplorerUpdate, type CopyFileEntry, type CreateRoomArguments, type CreateWikiPageArgs, type DataArtifactUpdated, type DataArtifactUpdatedV1, type DecideNextStepsFields, type EventOfKind, type ExecuteProgramRequestData, type ExecuteProgramRequestProvenance, type ExternalKnowledgeExplorerAttempt, type ExternalKnowledgeExplorerAttempt1, type ExternalKnowledgeSummary, type FactSource, type FederatedWikiName, type GeneratedCode, type GeneratedFile, type GeneratedResponse, type GeneratedUiCode, type GetThreadEventOptions, type GetThreadsQueryVariables, type IPromptQLSdk, type InteractionDecision, type InteractionDecisionAccept, type InteractionDecisionDecline, type InteractionDecisionUpdate, type InteractionFinishedEvent, type InteractionFinishedUpdate, type InteractionOutcome, type InteractionOutcomeStatus, type InteractionUpdate, type InternalError, type InternalErrorV1, type InternalUpdate, type InterruptedByTrigger, type KeysOfUnion, type LearningBlockId, type LearningSuggestion, type LearningSuggestionUpdate, type LearningSuggestionUpdateV1, type ListWikiPageArgs, type LlmResponse, type LlmUsage, type LlmUsageEvent, type LlmUsageEventV1, type MessageProcessingStarted, type MessageProcessingUpdate, type NeedsSupportUpdate, type OrchestratorUpdate, type Order_By, type OutputEmitted, type OutputEmittedV1, type PipelineProgress, type PipelineProgressV1, type PipelineProgressV2, type PipelineRunStepDetails, type PipelineSourceState, type PlanGenerationStarted, type PlanStepGenerated, type PlanningDecisionCompleted, type PlanningDecisionPlanningRequired, type PlanningDecisionStarted, type PlanningDecisionUpdate, type ProgramExecuteOutcome, type ProgramExecuteUpdate, type ProgramExecutionTriggerInterruption, type ProgramId, type ProgramPackageName, type ProgramRunEvent, type ProgramRunSqlExecuteOutcome, type ProgramRunnerAction, type ProgrammerUpdate, type ProjectInfoOutput, PromptQLSdk, type PromptQLSdkOptions, type PromptQlUserId, type PythonRunStepDetails, ROOM_NAME_REGEX, type ResponseGenerationUpdate, type ResponseTruncation, type RoomFragment, type RoomVisibilityType, type RunFinished, type RunFinishedOutcome, type RunFinishedV1, type RunProgramRequest, type RunSavedProgramRequest, type RunStarted, type RunStartedV1, type RunStepDetails, type RuntimeArtifactType, type SavedProgramRunnerUpdate, type SavedProgramRunnerUpdateV0, type ScheduledAgentTriggerEventId, type ScheduledAgentTriggerId, type ScheduledAgentTriggerPayload, type ScheduledAgentTriggerPayloadV1, type ScheduledAgentTriggerType, type SchemaContext, type SchemaExplored, type SchemaExplorerCompleted, type SchemaExplorerStarted, type SchemaExplorerUpdate, type SchemaTask, type SchemaTasksGenerationCompleted, type SchemaTasksGenerationStarted, type SchemaTasksGenerationUpdate, type SearchWikiPageItem, type SearchWikiPagesResult, type SendMessageToThreadArguments, type SendMessageToThreadOutput, type SendThreadMessageMutationVariables, type ServerMetadata, type ShelfActionEvent, type ShelfSchemaName, type ShelfTransactionOpened, type ShelfTransactionOpenedV1, type ShelfTransactionSuspended, type ShelfTransactionSuspendedV1, type ShelfUpdate, type ShelfUpdateV1, type SkillType, type SocialFeedRatingLlmUsage, type SocialFeedRatingUpdate, type Span, type Sql, type SqlError, type SqlErrorType, type SqlErrorV1, type SqlExecuteCompleted, type SqlExecuteCompletedV1, type SqlExecuteOutcome, type SqlExecuteStarted, type SqlExecuteStartedV1, type SqlQueryId, type SqlRunStepDetails, type StartThreadArguments, type StartThreadMutationVariables, type StartThreadOutput, type StartingOrchestrator, type StepExecutionFinished, type StepExecutionFinishedV1, type StepExecutionStarted, type StepExecutionStartedV1, type StepUpdate, type StreamThreadEventOptions, type TargetWikiPage, type TasksGenerated, type Teaching, type TeachingId, type ThreadDetail, type ThreadEvent, type ThreadEvent$1 as ThreadEventData, type ThreadFragment, type ThreadId, type TransactionId, type TzWrapper, USER_AGENT, type UiBuildFailure, type UiBuildRunStepDetails, type UiMetadata, type UiProgrammerUpdate, type UpdateWikiContentArgs, type UserCancel, type UserCancelEvent, type UserEventProvenance, type UserMessage, type UserMessageEvent, type UserUpload, type VersionedAgentUpdate, type VersionedOrUnversionedAgentUpdate, type Warning, type WikiAuditId, type WikiChange, type WikiContent, type WikiDelta, type WikiExplorerCompleted, type WikiExplorerStarted, type WikiExplorerUpdate, type WikiGenerationUpdate, type WikiInfoGenerated, type WikiLearningSuggestionUpdate, type WikiPageDetail, type WikiPageItem, type WikiPageNamespace, type WikiPagePreview, type WikiPageSearchResult, type WikiPageV1, type WikiSection, type WikiSelectionUpdate, type WikiTitle, buildAuthHeader, cancelAgentMessage, createApolloClient, createRoom, createWikiPage, deleteWikiPage, diffThreadEvents, downloadArtifactData, getAgentGeneratedResponse, getAgentInteractionDecisionAcceptInteractionEvent, getAgentInteractionDecisionDeclineInteractionEvent, getAgentInteractionFinishedEvent, getAgentMessageProcessingStartedEvent, getAgentOrchestratorContextExplorerCompletedEvent, getAgentOrchestratorContextExplorerStartedEvent, getAgentOrchestratorContextExplorerUpdateEvent, getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent, getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent, getAgentOrchestratorSchemaExplorerCompletedEvent, getAgentOrchestratorSchemaExplorerGeneratedCodeEvent, getAgentOrchestratorSchemaExplorerSchemaExploredEvent, getAgentOrchestratorSchemaExplorerStartedEvent, getAgentOrchestratorSchemaExplorerUpdateEvent, getAgentOrchestratorSchemaTasksGeneratedEvent, getAgentOrchestratorSchemaTasksGenerationCompletedEvent, getAgentOrchestratorSchemaTasksGenerationStartedEvent, getAgentOrchestratorSchemaTasksGenerationUpdateEvent, getAgentOrchestratorStepProgrammerEvent, getAgentOrchestratorStepSavedProgramRunnerEvent, getAgentOrchestratorStepUiProgrammerEvent, getAgentOrchestratorStepUpdateEvent, getAgentOrchestratorUpdateEvent, getAgentOrchestratorWikiExplorerCompletedEvent, getAgentOrchestratorWikiExplorerStartedEvent, getAgentOrchestratorWikiExplorerUpdateEvent, getAgentOrchestratorWikiInfoGeneratedEvent, getAgentPlanGenerationStartedEvent, getAgentPlanStepGeneratedEvent, getAgentPlanningDecisionCompletedEvent, getAgentPlanningDecisionPlanningRequiredEvent, getAgentPlanningDecisionStartedEvent, getAgentPlanningDecisionUpdateEvent, getAgentStartingOrchestratorEvent, getArtifactMetadata, getThread, getThreadAndEvents, getThreadEventMessageId, getThreadEvents, getUserCancelEvent, getUserMessageEvent, getWikiPage, isInteractionAnalyzing, listArtifactMetadataByThreadId, listRooms, listThreads, listWikiPages, searchWikiPages, sendThreadMessage, startThread, streamThreadMessageEvents, subscribeThreadEvents, updateWikiPage, validateRoomName };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ApolloClient, Observable } from '@apollo/client';
|
|
2
2
|
import * as graphql_ws from 'graphql-ws';
|
|
3
|
+
import { Client } from 'graphql-ws';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* This file was automatically generated by json-schema-to-typescript.
|
|
@@ -4370,6 +4371,7 @@ type Rooms_Bool_Exp = {
|
|
|
4370
4371
|
_not?: Rooms_Bool_Exp | null | undefined;
|
|
4371
4372
|
_or?: Array<Rooms_Bool_Exp> | null | undefined;
|
|
4372
4373
|
active_members?: Room_Active_Member_Bool_Exp | null | undefined;
|
|
4374
|
+
active_members_count?: Int_Comparison_Exp | null | undefined;
|
|
4373
4375
|
created_at?: Timestamptz_Comparison_Exp | null | undefined;
|
|
4374
4376
|
deleted_at?: Timestamptz_Comparison_Exp | null | undefined;
|
|
4375
4377
|
description?: String_Comparison_Exp | null | undefined;
|
|
@@ -4395,6 +4397,7 @@ type Rooms_Bool_Exp = {
|
|
|
4395
4397
|
/** Ordering options when selecting data from "rooms". */
|
|
4396
4398
|
type Rooms_Order_By = {
|
|
4397
4399
|
active_members_aggregate?: Room_Active_Member_Aggregate_Order_By | null | undefined;
|
|
4400
|
+
active_members_count?: Order_By | null | undefined;
|
|
4398
4401
|
created_at?: Order_By | null | undefined;
|
|
4399
4402
|
deleted_at?: Order_By | null | undefined;
|
|
4400
4403
|
description?: Order_By | null | undefined;
|
|
@@ -6007,18 +6010,13 @@ declare const USER_AGENT = "PromptQL TypeScript SDK";
|
|
|
6007
6010
|
*/
|
|
6008
6011
|
type PromptQLSdkOptions = {
|
|
6009
6012
|
/**
|
|
6010
|
-
*
|
|
6013
|
+
* Base URL of the PromptQL API.
|
|
6011
6014
|
*/
|
|
6012
|
-
|
|
6015
|
+
baseUrl?: string;
|
|
6013
6016
|
/**
|
|
6014
|
-
*
|
|
6017
|
+
* Access token of the PromptQL project.
|
|
6015
6018
|
*/
|
|
6016
|
-
|
|
6017
|
-
/**
|
|
6018
|
-
* Service account token of the PromptQL project.
|
|
6019
|
-
* Check out Hasura docs https://hasura.io/docs/3.0/project-configuration/project-management/service-accounts/#how-to-create-service-account to know how to create a token.
|
|
6020
|
-
*/
|
|
6021
|
-
serviceAccountToken: string;
|
|
6019
|
+
accessToken: string;
|
|
6022
6020
|
/**
|
|
6023
6021
|
* A function to use instead of calling the Fetch API directly when sending HTTP requests to your GraphQL endpoint. The function must conform to the signature of fetch.
|
|
6024
6022
|
* By default, the Fetch API is used unless it isn't available in your runtime environment.
|
|
@@ -6213,7 +6211,6 @@ type ProjectInfoOutput = {
|
|
|
6213
6211
|
projectId: string;
|
|
6214
6212
|
projectName: string;
|
|
6215
6213
|
projectHost: string;
|
|
6216
|
-
promptqlGraphQLUrl: string;
|
|
6217
6214
|
promptqlConsoleUrl: string;
|
|
6218
6215
|
};
|
|
6219
6216
|
|
|
@@ -6381,16 +6378,12 @@ declare function deleteWikiPage(client: ApolloClient, id: string): Promise<strin
|
|
|
6381
6378
|
* A low-level API class for PromptQL.
|
|
6382
6379
|
*/
|
|
6383
6380
|
declare class PromptQLApi {
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6381
|
+
readonly options: PromptQLSdkOptions;
|
|
6382
|
+
readonly defaultTimezone: string;
|
|
6383
|
+
readonly client: ApolloClient;
|
|
6384
|
+
readonly wsClient: Client;
|
|
6388
6385
|
private project;
|
|
6389
|
-
private client;
|
|
6390
|
-
private wsClient;
|
|
6391
6386
|
constructor(options: PromptQLSdkOptions);
|
|
6392
|
-
getAuthToken(): Promise<string>;
|
|
6393
|
-
getGraphQLClient(): Promise<ApolloClient>;
|
|
6394
6387
|
/**
|
|
6395
6388
|
* Get the basic information of the current PromptQL project.
|
|
6396
6389
|
*/
|
|
@@ -6554,8 +6547,7 @@ type IPromptQLSdk = InstanceType<typeof PromptQLSdk>;
|
|
|
6554
6547
|
|
|
6555
6548
|
type ApolloClientOptions = {
|
|
6556
6549
|
url: string;
|
|
6557
|
-
headers
|
|
6558
|
-
getAuthToken: () => Promise<string>;
|
|
6550
|
+
headers: Record<string, string> | (() => PromiseLike<Record<string, string>>);
|
|
6559
6551
|
fetch?: typeof fetch;
|
|
6560
6552
|
};
|
|
6561
6553
|
declare const createApolloClient: (options: ApolloClientOptions) => {
|
|
@@ -6742,9 +6734,6 @@ declare function getAgentInteractionFinishedEvent(eventData: ThreadEvent$1): Int
|
|
|
6742
6734
|
* Get the message_id from the thread event data.
|
|
6743
6735
|
*/
|
|
6744
6736
|
declare function getThreadEventMessageId(event: ThreadEvent$1 | undefined): string | undefined;
|
|
6745
|
-
|
|
6746
|
-
* Build PromptQL URL from fqdn.
|
|
6747
|
-
*/
|
|
6748
|
-
declare function buildPromptQLUrl(fqdn: string): string;
|
|
6737
|
+
declare function buildAuthHeader(accessToken: string): Record<string, string>;
|
|
6749
6738
|
|
|
6750
|
-
export { type AgentGeneratedResponse, type AgentLearningUpdate, type AgentLoopAction, type AgentLoopActionLegacy, type AgentLoopActionResult, type AgentLoopActionUpdate, type AgentLoopActionUpdateUnversioned, type AgentLoopActionUpdateVersioned, type AgentLoopTerminalAction, type AgentLoopUpdate, type AgentTrigger, type AgentUpdate, type AgentUpdateContent, type ApolloClientOptions, type ArtifactDataPreview, type ArtifactError, type ArtifactErrorV1, type ArtifactId, type ArtifactMetadata, type ArtifactReference, type ArtifactReference1, type ArtifactType, type ArtifactUpdate, type ArtifactUpdate1, type AssumptionFactCheck, type BuildError, type BuildErrorV1, type BuiltUi, type BuiltUi1, type CancelAgentMessageMutationVariables, type CheckedAssumption, type CheckedTopic, type CodeBlock, type CodeError, type CodeErrorV1, type CodeExecutionComplete, type CodeOutputAnalysis, type CodeOutputAnalyzed, type ComponentResponse, type ComponentResponse1, type ComponentResponse2, type ComponentResponse3, type ComponentResponse4, type ComponentResponse5, type ConfidenceAnalysis, type ConfidenceAnalysisLlmUsage, type ConfidenceAnalysisUpdate, type ContextExplorerCompleted, type ContextExplorerStarted, type ContextExplorerUpdate, type CopyFileEntry, type CreateRoomArguments, type CreateWikiPageArgs, type DataArtifactUpdated, type DataArtifactUpdatedV1, type DecideNextStepsFields, type EventOfKind, type ExecuteProgramRequestData, type ExecuteProgramRequestProvenance, type ExternalKnowledgeExplorerAttempt, type ExternalKnowledgeExplorerAttempt1, type ExternalKnowledgeSummary, type FactSource, type FederatedWikiName, type GeneratedCode, type GeneratedFile, type GeneratedResponse, type GeneratedUiCode, type GetThreadEventOptions, type GetThreadsQueryVariables, type IPromptQLSdk, type InteractionDecision, type InteractionDecisionAccept, type InteractionDecisionDecline, type InteractionDecisionUpdate, type InteractionFinishedEvent, type InteractionFinishedUpdate, type InteractionOutcome, type InteractionOutcomeStatus, type InteractionUpdate, type InternalError, type InternalErrorV1, type InternalUpdate, type InterruptedByTrigger, type KeysOfUnion, type LearningBlockId, type LearningSuggestion, type LearningSuggestionUpdate, type LearningSuggestionUpdateV1, type ListWikiPageArgs, type LlmResponse, type LlmUsage, type LlmUsageEvent, type LlmUsageEventV1, type MessageProcessingStarted, type MessageProcessingUpdate, type NeedsSupportUpdate, type OrchestratorUpdate, type Order_By, type OutputEmitted, type OutputEmittedV1, type PipelineProgress, type PipelineProgressV1, type PipelineProgressV2, type PipelineRunStepDetails, type PipelineSourceState, type PlanGenerationStarted, type PlanStepGenerated, type PlanningDecisionCompleted, type PlanningDecisionPlanningRequired, type PlanningDecisionStarted, type PlanningDecisionUpdate, type ProgramExecuteOutcome, type ProgramExecuteUpdate, type ProgramExecutionTriggerInterruption, type ProgramId, type ProgramPackageName, type ProgramRunEvent, type ProgramRunSqlExecuteOutcome, type ProgramRunnerAction, type ProgrammerUpdate, type ProjectInfoOutput, PromptQLSdk, type PromptQLSdkOptions, type PromptQlUserId, type PythonRunStepDetails, ROOM_NAME_REGEX, type ResponseGenerationUpdate, type ResponseTruncation, type RoomFragment, type RoomVisibilityType, type RunFinished, type RunFinishedOutcome, type RunFinishedV1, type RunProgramRequest, type RunSavedProgramRequest, type RunStarted, type RunStartedV1, type RunStepDetails, type RuntimeArtifactType, type SavedProgramRunnerUpdate, type SavedProgramRunnerUpdateV0, type ScheduledAgentTriggerEventId, type ScheduledAgentTriggerId, type ScheduledAgentTriggerPayload, type ScheduledAgentTriggerPayloadV1, type ScheduledAgentTriggerType, type SchemaContext, type SchemaExplored, type SchemaExplorerCompleted, type SchemaExplorerStarted, type SchemaExplorerUpdate, type SchemaTask, type SchemaTasksGenerationCompleted, type SchemaTasksGenerationStarted, type SchemaTasksGenerationUpdate, type SearchWikiPageItem, type SearchWikiPagesResult, type SendMessageToThreadArguments, type SendMessageToThreadOutput, type SendThreadMessageMutationVariables, type ServerMetadata, type ShelfActionEvent, type ShelfSchemaName, type ShelfTransactionOpened, type ShelfTransactionOpenedV1, type ShelfTransactionSuspended, type ShelfTransactionSuspendedV1, type ShelfUpdate, type ShelfUpdateV1, type SkillType, type SocialFeedRatingLlmUsage, type SocialFeedRatingUpdate, type Span, type Sql, type SqlError, type SqlErrorType, type SqlErrorV1, type SqlExecuteCompleted, type SqlExecuteCompletedV1, type SqlExecuteOutcome, type SqlExecuteStarted, type SqlExecuteStartedV1, type SqlQueryId, type SqlRunStepDetails, type StartThreadArguments, type StartThreadMutationVariables, type StartThreadOutput, type StartingOrchestrator, type StepExecutionFinished, type StepExecutionFinishedV1, type StepExecutionStarted, type StepExecutionStartedV1, type StepUpdate, type StreamThreadEventOptions, type TargetWikiPage, type TasksGenerated, type Teaching, type TeachingId, type ThreadDetail, type ThreadEvent, type ThreadEvent$1 as ThreadEventData, type ThreadFragment, type ThreadId, type TransactionId, type TzWrapper, USER_AGENT, type UiBuildFailure, type UiBuildRunStepDetails, type UiMetadata, type UiProgrammerUpdate, type UpdateWikiContentArgs, type UserCancel, type UserCancelEvent, type UserEventProvenance, type UserMessage, type UserMessageEvent, type UserUpload, type VersionedAgentUpdate, type VersionedOrUnversionedAgentUpdate, type Warning, type WikiAuditId, type WikiChange, type WikiContent, type WikiDelta, type WikiExplorerCompleted, type WikiExplorerStarted, type WikiExplorerUpdate, type WikiGenerationUpdate, type WikiInfoGenerated, type WikiLearningSuggestionUpdate, type WikiPageDetail, type WikiPageItem, type WikiPageNamespace, type WikiPagePreview, type WikiPageSearchResult, type WikiPageV1, type WikiSection, type WikiSelectionUpdate, type WikiTitle,
|
|
6739
|
+
export { type AgentGeneratedResponse, type AgentLearningUpdate, type AgentLoopAction, type AgentLoopActionLegacy, type AgentLoopActionResult, type AgentLoopActionUpdate, type AgentLoopActionUpdateUnversioned, type AgentLoopActionUpdateVersioned, type AgentLoopTerminalAction, type AgentLoopUpdate, type AgentTrigger, type AgentUpdate, type AgentUpdateContent, type ApolloClientOptions, type ArtifactDataPreview, type ArtifactError, type ArtifactErrorV1, type ArtifactId, type ArtifactMetadata, type ArtifactReference, type ArtifactReference1, type ArtifactType, type ArtifactUpdate, type ArtifactUpdate1, type AssumptionFactCheck, type BuildError, type BuildErrorV1, type BuiltUi, type BuiltUi1, type CancelAgentMessageMutationVariables, type CheckedAssumption, type CheckedTopic, type CodeBlock, type CodeError, type CodeErrorV1, type CodeExecutionComplete, type CodeOutputAnalysis, type CodeOutputAnalyzed, type ComponentResponse, type ComponentResponse1, type ComponentResponse2, type ComponentResponse3, type ComponentResponse4, type ComponentResponse5, type ConfidenceAnalysis, type ConfidenceAnalysisLlmUsage, type ConfidenceAnalysisUpdate, type ContextExplorerCompleted, type ContextExplorerStarted, type ContextExplorerUpdate, type CopyFileEntry, type CreateRoomArguments, type CreateWikiPageArgs, type DataArtifactUpdated, type DataArtifactUpdatedV1, type DecideNextStepsFields, type EventOfKind, type ExecuteProgramRequestData, type ExecuteProgramRequestProvenance, type ExternalKnowledgeExplorerAttempt, type ExternalKnowledgeExplorerAttempt1, type ExternalKnowledgeSummary, type FactSource, type FederatedWikiName, type GeneratedCode, type GeneratedFile, type GeneratedResponse, type GeneratedUiCode, type GetThreadEventOptions, type GetThreadsQueryVariables, type IPromptQLSdk, type InteractionDecision, type InteractionDecisionAccept, type InteractionDecisionDecline, type InteractionDecisionUpdate, type InteractionFinishedEvent, type InteractionFinishedUpdate, type InteractionOutcome, type InteractionOutcomeStatus, type InteractionUpdate, type InternalError, type InternalErrorV1, type InternalUpdate, type InterruptedByTrigger, type KeysOfUnion, type LearningBlockId, type LearningSuggestion, type LearningSuggestionUpdate, type LearningSuggestionUpdateV1, type ListWikiPageArgs, type LlmResponse, type LlmUsage, type LlmUsageEvent, type LlmUsageEventV1, type MessageProcessingStarted, type MessageProcessingUpdate, type NeedsSupportUpdate, type OrchestratorUpdate, type Order_By, type OutputEmitted, type OutputEmittedV1, type PipelineProgress, type PipelineProgressV1, type PipelineProgressV2, type PipelineRunStepDetails, type PipelineSourceState, type PlanGenerationStarted, type PlanStepGenerated, type PlanningDecisionCompleted, type PlanningDecisionPlanningRequired, type PlanningDecisionStarted, type PlanningDecisionUpdate, type ProgramExecuteOutcome, type ProgramExecuteUpdate, type ProgramExecutionTriggerInterruption, type ProgramId, type ProgramPackageName, type ProgramRunEvent, type ProgramRunSqlExecuteOutcome, type ProgramRunnerAction, type ProgrammerUpdate, type ProjectInfoOutput, PromptQLSdk, type PromptQLSdkOptions, type PromptQlUserId, type PythonRunStepDetails, ROOM_NAME_REGEX, type ResponseGenerationUpdate, type ResponseTruncation, type RoomFragment, type RoomVisibilityType, type RunFinished, type RunFinishedOutcome, type RunFinishedV1, type RunProgramRequest, type RunSavedProgramRequest, type RunStarted, type RunStartedV1, type RunStepDetails, type RuntimeArtifactType, type SavedProgramRunnerUpdate, type SavedProgramRunnerUpdateV0, type ScheduledAgentTriggerEventId, type ScheduledAgentTriggerId, type ScheduledAgentTriggerPayload, type ScheduledAgentTriggerPayloadV1, type ScheduledAgentTriggerType, type SchemaContext, type SchemaExplored, type SchemaExplorerCompleted, type SchemaExplorerStarted, type SchemaExplorerUpdate, type SchemaTask, type SchemaTasksGenerationCompleted, type SchemaTasksGenerationStarted, type SchemaTasksGenerationUpdate, type SearchWikiPageItem, type SearchWikiPagesResult, type SendMessageToThreadArguments, type SendMessageToThreadOutput, type SendThreadMessageMutationVariables, type ServerMetadata, type ShelfActionEvent, type ShelfSchemaName, type ShelfTransactionOpened, type ShelfTransactionOpenedV1, type ShelfTransactionSuspended, type ShelfTransactionSuspendedV1, type ShelfUpdate, type ShelfUpdateV1, type SkillType, type SocialFeedRatingLlmUsage, type SocialFeedRatingUpdate, type Span, type Sql, type SqlError, type SqlErrorType, type SqlErrorV1, type SqlExecuteCompleted, type SqlExecuteCompletedV1, type SqlExecuteOutcome, type SqlExecuteStarted, type SqlExecuteStartedV1, type SqlQueryId, type SqlRunStepDetails, type StartThreadArguments, type StartThreadMutationVariables, type StartThreadOutput, type StartingOrchestrator, type StepExecutionFinished, type StepExecutionFinishedV1, type StepExecutionStarted, type StepExecutionStartedV1, type StepUpdate, type StreamThreadEventOptions, type TargetWikiPage, type TasksGenerated, type Teaching, type TeachingId, type ThreadDetail, type ThreadEvent, type ThreadEvent$1 as ThreadEventData, type ThreadFragment, type ThreadId, type TransactionId, type TzWrapper, USER_AGENT, type UiBuildFailure, type UiBuildRunStepDetails, type UiMetadata, type UiProgrammerUpdate, type UpdateWikiContentArgs, type UserCancel, type UserCancelEvent, type UserEventProvenance, type UserMessage, type UserMessageEvent, type UserUpload, type VersionedAgentUpdate, type VersionedOrUnversionedAgentUpdate, type Warning, type WikiAuditId, type WikiChange, type WikiContent, type WikiDelta, type WikiExplorerCompleted, type WikiExplorerStarted, type WikiExplorerUpdate, type WikiGenerationUpdate, type WikiInfoGenerated, type WikiLearningSuggestionUpdate, type WikiPageDetail, type WikiPageItem, type WikiPageNamespace, type WikiPagePreview, type WikiPageSearchResult, type WikiPageV1, type WikiSection, type WikiSelectionUpdate, type WikiTitle, buildAuthHeader, cancelAgentMessage, createApolloClient, createRoom, createWikiPage, deleteWikiPage, diffThreadEvents, downloadArtifactData, getAgentGeneratedResponse, getAgentInteractionDecisionAcceptInteractionEvent, getAgentInteractionDecisionDeclineInteractionEvent, getAgentInteractionFinishedEvent, getAgentMessageProcessingStartedEvent, getAgentOrchestratorContextExplorerCompletedEvent, getAgentOrchestratorContextExplorerStartedEvent, getAgentOrchestratorContextExplorerUpdateEvent, getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent, getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent, getAgentOrchestratorSchemaExplorerCompletedEvent, getAgentOrchestratorSchemaExplorerGeneratedCodeEvent, getAgentOrchestratorSchemaExplorerSchemaExploredEvent, getAgentOrchestratorSchemaExplorerStartedEvent, getAgentOrchestratorSchemaExplorerUpdateEvent, getAgentOrchestratorSchemaTasksGeneratedEvent, getAgentOrchestratorSchemaTasksGenerationCompletedEvent, getAgentOrchestratorSchemaTasksGenerationStartedEvent, getAgentOrchestratorSchemaTasksGenerationUpdateEvent, getAgentOrchestratorStepProgrammerEvent, getAgentOrchestratorStepSavedProgramRunnerEvent, getAgentOrchestratorStepUiProgrammerEvent, getAgentOrchestratorStepUpdateEvent, getAgentOrchestratorUpdateEvent, getAgentOrchestratorWikiExplorerCompletedEvent, getAgentOrchestratorWikiExplorerStartedEvent, getAgentOrchestratorWikiExplorerUpdateEvent, getAgentOrchestratorWikiInfoGeneratedEvent, getAgentPlanGenerationStartedEvent, getAgentPlanStepGeneratedEvent, getAgentPlanningDecisionCompletedEvent, getAgentPlanningDecisionPlanningRequiredEvent, getAgentPlanningDecisionStartedEvent, getAgentPlanningDecisionUpdateEvent, getAgentStartingOrchestratorEvent, getArtifactMetadata, getThread, getThreadAndEvents, getThreadEventMessageId, getThreadEvents, getUserCancelEvent, getUserMessageEvent, getWikiPage, isInteractionAnalyzing, listArtifactMetadataByThreadId, listRooms, listThreads, listWikiPages, searchWikiPages, sendThreadMessage, startThread, streamThreadMessageEvents, subscribeThreadEvents, updateWikiPage, validateRoomName };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var N=Object.defineProperty;var Fe=Object.getOwnPropertyDescriptor;var we=Object.getOwnPropertyNames;var qe=Object.prototype.hasOwnProperty;var Ie=(n,e)=>{for(var i in e)N(n,i,{get:e[i],enumerable:!0})},De=(n,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let d of we(e))!qe.call(n,d)&&d!==i&&N(n,d,{get:()=>e[d],enumerable:!(r=Fe(e,d))||r.enumerable});return n};var Re=n=>De(N({},"__esModule",{value:!0}),n);var bn={};Ie(bn,{PromptQLSdk:()=>Y,ROOM_NAME_REGEX:()=>Be,USER_AGENT:()=>s,buildPromptQLUrl:()=>Z,cancelAgentMessage:()=>j,createApolloClient:()=>X,createRoom:()=>F,createWikiPage:()=>$,deleteWikiPage:()=>H,diffThreadEvents:()=>$e,downloadArtifactData:()=>U,getAgentGeneratedResponse:()=>Ye,getAgentInteractionDecisionAcceptInteractionEvent:()=>nn,getAgentInteractionDecisionDeclineInteractionEvent:()=>rn,getAgentInteractionFinishedEvent:()=>Tn,getAgentMessageProcessingStartedEvent:()=>en,getAgentOrchestratorContextExplorerCompletedEvent:()=>on,getAgentOrchestratorContextExplorerStartedEvent:()=>ln,getAgentOrchestratorContextExplorerUpdateEvent:()=>m,getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent:()=>kn,getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent:()=>xn,getAgentOrchestratorSchemaExplorerCompletedEvent:()=>gn,getAgentOrchestratorSchemaExplorerGeneratedCodeEvent:()=>Bn,getAgentOrchestratorSchemaExplorerSchemaExploredEvent:()=>hn,getAgentOrchestratorSchemaExplorerStartedEvent:()=>yn,getAgentOrchestratorSchemaExplorerUpdateEvent:()=>p,getAgentOrchestratorSchemaTasksGeneratedEvent:()=>cn,getAgentOrchestratorSchemaTasksGenerationCompletedEvent:()=>fn,getAgentOrchestratorSchemaTasksGenerationStartedEvent:()=>mn,getAgentOrchestratorSchemaTasksGenerationUpdateEvent:()=>E,getAgentOrchestratorStepProgrammerEvent:()=>vn,getAgentOrchestratorStepSavedProgramRunnerEvent:()=>On,getAgentOrchestratorStepUiProgrammerEvent:()=>En,getAgentOrchestratorStepUpdateEvent:()=>O,getAgentOrchestratorUpdateEvent:()=>h,getAgentOrchestratorWikiExplorerCompletedEvent:()=>sn,getAgentOrchestratorWikiExplorerStartedEvent:()=>un,getAgentOrchestratorWikiExplorerUpdateEvent:()=>v,getAgentOrchestratorWikiInfoGeneratedEvent:()=>pn,getAgentPlanGenerationStartedEvent:()=>Xe,getAgentPlanStepGeneratedEvent:()=>Ze,getAgentPlanningDecisionCompletedEvent:()=>tn,getAgentPlanningDecisionPlanningRequiredEvent:()=>an,getAgentPlanningDecisionStartedEvent:()=>dn,getAgentPlanningDecisionUpdateEvent:()=>B,getAgentStartingOrchestratorEvent:()=>_n,getArtifactMetadata:()=>M,getThread:()=>I,getThreadAndEvents:()=>D,getThreadEventMessageId:()=>An,getThreadEvents:()=>k,getUserCancelEvent:()=>He,getUserMessageEvent:()=>Je,getWikiPage:()=>K,isInteractionAnalyzing:()=>Ee,listArtifactMetadataByThreadId:()=>V,listRooms:()=>y,listThreads:()=>q,listWikiPages:()=>L,searchWikiPages:()=>z,sendThreadMessage:()=>G,startThread:()=>R,streamThreadMessageEvents:()=>Q,subscribeThreadEvents:()=>W,updateWikiPage:()=>J,validateRoomName:()=>he});module.exports=Re(bn);var ee={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"}}]}}]}}]},ne={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateRoom"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"name"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"visibility"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"description"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"create_room"},arguments:[{kind:"Argument",name:{kind:"Name",value:"name"},value:{kind:"Variable",name:{kind:"Name",value:"name"}}},{kind:"Argument",name:{kind:"Name",value:"visibility"},value:{kind:"Variable",name:{kind:"Name",value:"visibility"}}},{kind:"Argument",name:{kind:"Name",value:"description"},value:{kind:"Variable",name:{kind:"Name",value:"description"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"room_id"}}]}}]}}]},ie={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"}}]}}]}}]},re={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"StartThread"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"message"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"projectId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"timezone"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"roomId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"uploads"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UserUploadInput"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"visibility"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"createdFrom"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"start_thread"},arguments:[{kind:"Argument",name:{kind:"Name",value:"message"},value:{kind:"Variable",name:{kind:"Name",value:"message"}}},{kind:"Argument",name:{kind:"Name",value:"projectId"},value:{kind:"Variable",name:{kind:"Name",value:"projectId"}}},{kind:"Argument",name:{kind:"Name",value:"timezone"},value:{kind:"Variable",name:{kind:"Name",value:"timezone"}}},{kind:"Argument",name:{kind:"Name",value:"buildId"},value:{kind:"Variable",name:{kind:"Name",value:"buildId"}}},{kind:"Argument",name:{kind:"Name",value:"buildFqdn"},value:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}}},{kind:"Argument",name:{kind:"Name",value:"roomId"},value:{kind:"Variable",name:{kind:"Name",value:"roomId"}}},{kind:"Argument",name:{kind:"Name",value:"uploads"},value:{kind:"Variable",name:{kind:"Name",value:"uploads"}}},{kind:"Argument",name:{kind:"Name",value:"visibility"},value:{kind:"Variable",name:{kind:"Name",value:"visibility"}}},{kind:"Argument",name:{kind:"Name",value:"createdFrom"},value:{kind:"Variable",name:{kind:"Name",value:"createdFrom"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"thread_events"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"thread_event_id"}}]}}]}}]}}]},de={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateWikiPage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"pageContent"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"jsonb"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"pageId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki_add"},arguments:[{kind:"Argument",name:{kind:"Name",value:"pageContent"},value:{kind:"Variable",name:{kind:"Name",value:"pageContent"}}},{kind:"Argument",name:{kind:"Name",value:"pageId"},value:{kind:"Variable",name:{kind:"Name",value:"pageId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}}]}}]}}]},te={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"UpdateWikiPage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"pageContent"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"jsonb"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki_update"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}},{kind:"Argument",name:{kind:"Name",value:"pageContent"},value:{kind:"Variable",name:{kind:"Name",value:"pageContent"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"buildVersion"}}]}}]}}]},ae={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"DeleteWikiPage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki_delete"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"buildVersion"}}]}}]}}]},_e={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetArtifactsByThreadId"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"threadId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"artifacts"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_artifacts"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_id"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"_eq"},value:{kind:"Variable",name:{kind:"Name",value:"threadId"}}}]}}]}}]}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"updated_at"},value:{kind:"EnumValue",value:"asc"}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"artifact_id"}},{kind:"Field",name:{kind:"Name",value:"latest_version_object"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"user_id"}},{kind:"Field",name:{kind:"Name",value:"artifact_metadata"}},{kind:"Field",name:{kind:"Name",value:"artifact_type"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"size"}},{kind:"Field",name:{kind:"Name",value:"version"}}]}}]}}]}}]},le={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"ListGuidePages"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_guide_page_order_by"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_guide_page_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_guide_page"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"page_title"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"last_modified_at"}}]}}]}}]},oe={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetGuidePage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"project_id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"page_id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_guide_page"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"project_id"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"_eq"},value:{kind:"Variable",name:{kind:"Name",value:"project_id"}}}]}},{kind:"ObjectField",name:{kind:"Name",value:"id"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"_eq"},value:{kind:"Variable",name:{kind:"Name",value:"page_id"}}}]}},{kind:"ObjectField",name:{kind:"Name",value:"deleted_at"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"_is_null"},value:{kind:"BooleanValue",value:!0}}]}}]}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"IntValue",value:"1"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"page_title"}},{kind:"Field",name:{kind:"Name",value:"details"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"last_modified_at"}}]}}]}}]},ue={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetRooms"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"rooms_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"rooms_order_by"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}},defaultValue:{kind:"IntValue",value:"10"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"rooms"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Room"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Room"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"rooms"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"room_id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"project_id"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"user_id"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}}]}}]},se={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:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]},pe={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:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]},me={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreadAndEventsById"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"eventsWhere"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"eventsLimit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"eventsOrdering"}},type:{kind:"NamedType",name:{kind:"Name",value:"order_by"}},defaultValue:{kind:"EnumValue",value:"asc"}}],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:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"eventsWhere"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"eventsLimit"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"Variable",name:{kind:"Name",value:"eventsOrdering"}}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}}]}},{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:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{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"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]},fe={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreadEvents"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"ordering"}},type:{kind:"NamedType",name:{kind:"Name",value:"order_by"}},defaultValue:{kind:"EnumValue",value:"asc"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"Variable",name:{kind:"Name",value:"ordering"}}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadEvent"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"thread_events"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]},ce={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"ListWikiPages"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_wiki_order_by"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_wiki_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki"},arguments:[{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}},{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"page_id"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"last_modified_at"}},{kind:"Field",alias:{kind:"Name",value:"title"},name:{kind:"Name",value:"content"},arguments:[{kind:"Argument",name:{kind:"Name",value:"path"},value:{kind:"StringValue",value:"title",block:!1}}]},{kind:"Field",alias:{kind:"Name",value:"stub"},name:{kind:"Name",value:"content"},arguments:[{kind:"Argument",name:{kind:"Name",value:"path"},value:{kind:"StringValue",value:"stub",block:!1}}]},{kind:"Field",alias:{kind:"Name",value:"aliases"},name:{kind:"Name",value:"content"},arguments:[{kind:"Argument",name:{kind:"Name",value:"path"},value:{kind:"StringValue",value:"aliases",block:!1}}]},{kind:"Field",alias:{kind:"Name",value:"definition"},name:{kind:"Name",value:"content"},arguments:[{kind:"Argument",name:{kind:"Name",value:"path"},value:{kind:"StringValue",value:"definition",block:!1}}]}]}}]}}]},ye={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetWikiPage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_wiki_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki"},arguments:[{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"IntValue",value:"1"}},{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"page_id"}},{kind:"Field",name:{kind:"Name",value:"content"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"last_modified_at"}}]}}]}}]},ge={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"SearchWikiPages"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"query"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki_search"},arguments:[{kind:"Argument",name:{kind:"Name",value:"query"},value:{kind:"Variable",name:{kind:"Name",value:"query"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"totalCount"}},{kind:"Field",name:{kind:"Name",value:"results"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"score"}},{kind:"Field",name:{kind:"Name",value:"page"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"aliases"}},{kind:"Field",name:{kind:"Name",value:"definition"}},{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"namespace"}},{kind:"Field",name:{kind:"Name",value:"stub"}},{kind:"Field",name:{kind:"Name",value:"title"}}]}},{kind:"Field",name:{kind:"Name",value:"metadata"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"createdAt"}},{kind:"Field",name:{kind:"Name",value:"ownerId"}},{kind:"Field",name:{kind:"Name",value:"lastUpdatedAt"}}]}}]}}]}}]}}]},ke={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"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]};async function U(n,e,i,r,d){let a=`${n}/promptql-v2/artifacts/${e}/version/${i}/data`,t=await(typeof d=="function"?d:fetch)(a,{method:"GET",headers:r});if(t.status!==200){let c=t.body?await t.text():t.statusText;throw new Error(`[${t.status}] failed to download artifact: ${c}`)}return t.body?t.headers.get("Content-Type")?.startsWith("application/json")?t.json():t.text():null}async function V(n,e,i){let r=await n.query({query:_e,variables:{threadId:i},fetchPolicy:"no-cache"});return r.data?.artifacts?.length?r.data.artifacts.filter(d=>d.latest_version_object).map(d=>({project_id:e,artifact_id:d.artifact_id,artifact_type:d.latest_version_object.artifact_type,version:d.latest_version_object.version,title:d.latest_version_object.title,description:d.latest_version_object.description??null,user_id:d.latest_version_object.user_id,metadata:d.latest_version_object.artifact_metadata,created_at:d.latest_version_object.created_at,size_bytes:Number.parseInt(d.latest_version_object.size)})):[]}async function M(n,e,i,r,d){let a=`${n}/promptql-v2/artifacts/${e}/version/${i}/metadata`,t=await(typeof d=="function"?d:fetch)(a,{method:"GET",headers:r});if(t.status!==200){let l=t.body?await t.text():t.statusText;throw new Error(`[${t.status}] failed to get artifact metadata: ${l}`)}return t.json()}function y(n,e){return n.query({query:ue,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(i=>i.data?.rooms??[])}function F(n,e){if(!e.name)throw new Error("Room name is required");let i=he(e.name);if(i)throw new Error(i);return n.mutate({mutation:ne,variables:e,fetchPolicy:"no-cache"}).then(r=>{if(!r.data?.create_room?.room_id)throw new Error("expected room_id in response, got null");return r.data?.create_room?.room_id})}var Be=/^[\p{Ll}\p{Lo}\p{N}]+([_-][\p{Ll}\p{Lo}\p{N}]+)*$/u,xe=80,he=n=>{let e=n.trim();return e.length===0?null:e.length>xe?`Room name must be ${xe} characters or less`:/[^\p{Ll}\p{Lo}\p{N}_-]/u.test(e)?"Only lowercase letters, numbers, hyphens, and underscores are allowed.":/^[_-]|[_-]$/.test(e)?"Room name should not start or end with a hyphen or underscore.":/[-_]{2,}/.test(e)?"Room name should not contain consecutive hyphens or underscores.":Be.test(e)?null:"Room name is invalid. Only lowercase letters, numbers, hyphens, and underscores are allowed."};var o=require("rxjs");var ve=/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;function g(n){return n=n?n.trim():"",n?n[n.length-1]==="/"?n.slice(0,n.length-1):n:""}function w(n){if(n==null)return null;try{Number.parseInt(n)}catch{throw new Error("invalid threadEventId")}return n}function q(n,e){return n.query({query:se,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(i=>i.data?.threads_v2??[])}function I(n,e){if(!e)throw new Error("threadId is required");return n.query({query:pe,variables:{id:e},fetchPolicy:"no-cache"}).then(i=>i.data?.threads_v2_by_pk)}function D(n,e,i){let r=Oe(e,i);return n.query({query:me,variables:{id:e,eventsWhere:r.where,eventsLimit:r.limit,eventsOrdering:r.ordering},fetchPolicy:"no-cache"}).then(d=>d.data?.threads_v2_by_pk)}function R(n,e){if(!e.message.trim())throw new Error("message must not be empty");return n.mutate({mutation:re,variables:e}).then(i=>{if(!i.data?.start_thread)throw new Error(i.error?.message||"Failed to start thread");return i.data.start_thread})}function k(n,e,i){return n.query({query:fe,variables:Oe(e,i),fetchPolicy:"no-cache"}).then(r=>r.data?.thread_events??[])}function G(n,e){if(!e.threadId)throw new Error("threadId is required");if(!e.message.trim())throw new Error("message must not be empty");return n.mutate({mutation:ie,variables:e}).then(i=>{if(!i.data?.send_thread_message)throw new Error(i.error?.message||"Failed to send message to thread");return i.data.send_thread_message})}function j(n,e){if(!e.threadId)throw new Error("threadId is required");if(!e.messageId.trim())throw new Error("messageId is required");return n.mutate({mutation:ee,variables:e}).then(i=>{if(!i.data?.cancel_agent_message)throw new Error(i.error?.message||"Failed to cancel thread");return i.data.cancel_agent_message.thread_event_id})}function W(n,e,i){if(!e)throw new Error("threadId is required");w(i);let r={thread_id:{_eq:e}};return i&&(r.thread_event_id={_gte:i}),n.subscribe({query:ke,variables:{where:r}}).pipe((0,o.map)(d=>{if(d.error)throw d.error;return d.data?.thread_events??[]}))}function Q(n,e,i){if(!e)throw new Error("threadId is required");let r,d=w(i?.fromEventId),a={eventId:i?.fromEventId?{_gte:d}:void 0,messageId:i?.messageId},_=i?.pollingInterval&&i?.pollingInterval>0?i.pollingInterval:5;return(0,o.defer)(async()=>{let t=r?{messageId:i?.messageId,eventId:{_gt:r}}:a,l=await k(n,e,t);return l.length>0&&(r=l[l.length-1]?.thread_event_id),l}).pipe((0,o.repeat)({count:i?.timeout&&i.timeout>0?Math.ceil(i.timeout/_):void 0,delay:_*1e3}),(0,o.takeWhile)(t=>Ee(t,i?.skipAnalysis),!0))}function Ee(n,e){for(let i=n.length-1;i>=0;i--){let r=n[i];if("UserMessage"in r.event_data)return!0;if(!("AgentMessage"in r.event_data))return!1;let d=r.event_data.AgentMessage.update;if("content"in d&&("interaction_finished"in d.content||e&&"interaction_update"in d.content&&"main_agent"in d.content.interaction_update&&"completed"in d.content.interaction_update.main_agent)||"InteractionFinished"in d||e&&"OrchestratorUpdate"in d&&"GeneratedResponse"in d.OrchestratorUpdate.update)return!1}return!0}function Ge(n){return[{event_data:{_contains:{UserMessage:{message_id:n}}}},{event_data:{_contains:{AgentMessage:{message_id:n}}}},{event_data:{_contains:{UserCancel:{message_id:n}}}}]}var Oe=(n,e)=>{if(!n)throw new Error("threadId is required");let i={thread_id:{_eq:n}};return e&&(e.eventId&&(i.thread_event_id=e.eventId),e.messageId&&(i._or=Ge(e.messageId))),{where:i,limit:e?.limit,ordering:e?.ordering||"asc"}};var x=["guide","regular"];async function L(n,e){let i=e.namespace||"regular";if(!x.includes(i))throw new Error(`Invalid namespace. Expected one of: ${x}`);if(i==="guide"){let _={deleted_at:{_is_null:!0}};return e.project_id&&(_.project_id={_eq:e.project_id}),e.query&&(_.page_title={_ilike:e.query.toLowerCase()}),We(n,{where:_,limit:e.limit,offset:e.offset,order_by:e.order_by||e.ordering?{[!e.order_by||e.order_by==="slug"?"id":e.order_by]:e.ordering||"asc"}:void 0})}let r=e.project_id||!e.include_stub||e.namespace||e.query,d={where:e.project_id?{project_id:{_eq:e.project_id},deleted_at:{_is_null:!0}}:{},order_by:e.order_by||e.ordering?{[e.order_by?e.order_by==="slug"?"page_id":e.order_by:"page_id"]:e.ordering||"asc"}:void 0};r||(d.offset=e.offset,d.limit=e.limit);let a=await je(n,d);return r?ze(a,e):a}async function z(n,e){if(!e.query)throw new Error("query is required");return n.query({query:ge,variables:e,fetchPolicy:"no-cache"}).then(i=>i.data?.admin_wiki_search?{totalCount:i.data.admin_wiki_search.totalCount,results:i.data?.admin_wiki_search.results.map(({score:r,metadata:d,page:{id:a,..._}})=>({..._,score:r,stable_id:d.id,slug:a,created_at:d.createdAt,last_modified_at:d.lastUpdatedAt}))}:{totalCount:0,results:[]})}async function K(n,e,i,r){if(i=i||"regular",!x.includes(i))throw new Error(`Invalid namespace. Expected one of: ${x}`);if(!e)throw new Error("projectId is required");if(!r)throw new Error("identifier is required");if(i==="guide")return Le(n,{project_id:e,page_id:r});let d={project_id:{_eq:e},deleted_at:{_is_null:!0}};return ve.test(r)?d.id={_eq:r}:d.page_id={_eq:r},Qe(n,{where:d})}function $(n,{slug:e,...i}){if(!i.title)throw new Error("Wiki title is required");if(!i.stub&&!i.definition)throw new Error("Wiki definition is required");return n.mutate({mutation:de,variables:{pageId:e,pageContent:i},fetchPolicy:"no-cache"}).then(r=>r.data?.admin_wiki_add?.id)}function J(n,e,i){if(!e)throw new Error("ID of the wiki is required");return n.mutate({mutation:te,variables:{id:e,pageContent:i},fetchPolicy:"no-cache"}).then(r=>r.data?.admin_wiki_update?.buildVersion)}function H(n,e){if(!e)throw new Error("ID of the wiki is required");return n.mutate({mutation:ae,variables:{id:e},fetchPolicy:"no-cache"}).then(i=>i.data?.admin_wiki_delete?.buildVersion)}function je(n,e){return n.query({query:ce,variables:e,fetchPolicy:"no-cache"}).then(i=>i.data?.admin_wiki.map(({page_id:r,id:d,...a})=>({...a,stable_id:d,slug:r}))??[])}function We(n,e){return n.query({query:le,variables:e,fetchPolicy:"no-cache"}).then(i=>i.data?.admin_guide_page?.map(r=>({stable_id:r.id,slug:r.id,created_at:r.created_at,last_modified_at:r.last_modified_at,title:r.page_title}))??[])}async function Qe(n,e){let i=await n.query({query:ye,variables:e,fetchPolicy:"no-cache"}).then(r=>r.data?.admin_wiki.map(d=>({stable_id:d.id,slug:d.page_id,created_at:d.created_at,last_modified_at:d.last_modified_at,...d.content}))??[]);return i.length?i[0]:null}async function Le(n,e){let i=await n.query({query:oe,variables:e,fetchPolicy:"no-cache"}).then(r=>r.data?.admin_guide_page?.map(d=>({stable_id:d.id,slug:d.id,created_at:d.created_at,last_modified_at:d.last_modified_at,title:d.page_title,details:d.details}))??[]);return i.length?i[0]:null}function ze(n,e){if(!n.length||!e.include_stub&&!e.query&&!e.limit&&!e.offset)return n;let i=e.query?.toLowerCase(),r=n.filter(d=>!e.include_stub&&d.stub?!1:!!(!i||d.title.toLowerCase().includes(i)||d.definition&&d.definition.toLowerCase().includes(i)||d.aliases?.length&&d.aliases.some(a=>a.toLowerCase().includes(i))));return e.offset&&r.length&&(r=r.slice(e.offset)),e.limit&&e.limit<r.length&&(r=r.slice(0,e.limit)),r}function Te(n){return n!=null&&typeof n=="object"&&"status"in n&&n.status==="failure"}function Ae(n){return n!=null&&typeof n=="object"&&"status"in n&&n.status==="success"&&"token"in n}function be(n){return n!=null&&typeof n=="object"&&("data"in n&&!!n.data&&typeof n.data=="object"&&"enrich_token"in n.data&&!!n.data.enrich_token&&typeof n.data.enrich_token=="object"&&"userDirectoryJWT"in n.data.enrich_token||"errors"in n&&Array.isArray(n.errors))}function Se(n){let i=`${g(n.authHost)||"https://auth.pro.hasura.io"}/ddn/promptql/token`,r={token:"",expiry:new Date(0)},d=n.fetch||fetch,a=async()=>{let _=await d(i,{method:"POST",headers:n.headers});switch(_.status){case 200:{let t=await _.json();if(Ae(t))return t;throw new Error("malformed token response")}case 401:{let t=await _.json();throw Te(t)?new Error(t?.error||_.statusText):new Error(_.statusText)}default:{let t=await _.text();throw new Error(t)}}};return async()=>{if(r.expiry.getTime()<=Date.now()+1e3){let _=await a(),t=await Ke(n.promptqlGraphQLUrl,_.token,n.projectId,d);r.token=t;let l=new Date(_.expiry);if(Number.isNaN(l.getTime())){let c=new Date;c.setHours(1),r.expiry=c}else r.expiry=l}return r.token}}var Ke=async(n,e,i,r=fetch)=>{let d=await r(n,{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:i},operationName:"EnrichToken"})});switch(d.status){case 200:{let a=await d.json();if(!be(a)||!a.data?.enrich_token?.userDirectoryJWT)throw new Error(`malformed promptql token response: ${JSON.stringify(a)}`);return a.data.enrich_token.userDirectoryJWT}default:{let a=await d.text();throw new Error(a)}}};var s="PromptQL TypeScript SDK";var u=require("@apollo/client"),Pe=require("@apollo/client/link/context"),Ce=require("@apollo/client/link/subscriptions"),Ne=require("graphql"),Ue=require("graphql-ws");var X=n=>{let e=new u.HttpLink({uri:n.url,fetch:n.fetch,headers:n.headers}),i=async t=>{let l=await n.getAuthToken();return{headers:{"User-Agent":s,...t,Authorization:`Bearer ${l}`}}},r=(0,Ue.createClient)({url:n.url,connectionParams:()=>i(n.headers),lazy:!0}),d=new Ce.GraphQLWsLink(r),a=new Pe.SetContextLink(({headers:t})=>i(t)),_=u.ApolloLink.split(({operationType:t})=>t===Ne.OperationTypeNode.SUBSCRIPTION,d,a.concat(e));return{client:new u.ApolloClient({link:_,cache:new u.InMemoryCache}),wsClient:r}};function $e(n,e){if(!e.length)return[];if(!n.length)return e;let i=n[n.length-1];if(!i)return e;let r=BigInt(i.thread_event_id),d=e.length-1;for(;d>=0;d--){let a=e[d];if(BigInt(a?.thread_event_id)<=r)break}return e.slice(d+1)}function Je(n){return"UserMessage"in n?n.UserMessage:null}function He(n){return"UserCancel"in n?n.UserCancel:null}function Xe(n){return!("AgentMessage"in n)||!("OrchestratorUpdate"in n.AgentMessage.update)||!("PlanGenerationStarted"in n.AgentMessage.update.OrchestratorUpdate.update)?null:n.AgentMessage.update.OrchestratorUpdate.update.PlanGenerationStarted}function Ze(n){let e=h(n);return!e||!("PlanStepGenerated"in e)?null:e.PlanStepGenerated}function Ye(n){return"AgentMessage"in n?"content"in n.AgentMessage.update&&"interaction_update"in n.AgentMessage.update.content&&"main_agent"in n.AgentMessage.update.content.interaction_update&&"completed"in n.AgentMessage.update.content.interaction_update.main_agent?{success:!0,message:n.AgentMessage.update.content.interaction_update.main_agent.completed.summary||"",modified_artifacts:[],generated_at:n.AgentMessage.update.timestamp,messageId:n.AgentMessage.message_id}:!("OrchestratorUpdate"in n.AgentMessage.update)||!("GeneratedResponse"in n.AgentMessage.update.OrchestratorUpdate.update)?null:{...n.AgentMessage.update.OrchestratorUpdate.update.GeneratedResponse.response,messageId:n.AgentMessage.message_id}:null}function en(n){return!("AgentMessage"in n)||!("MessageProcessingUpdate"in n.AgentMessage.update)||!("ProcessingStarted"in n.AgentMessage.update.MessageProcessingUpdate.update)?null:n.AgentMessage.update.MessageProcessingUpdate.update.ProcessingStarted}function nn(n){return!("AgentMessage"in n)||!("MessageProcessingUpdate"in n.AgentMessage.update)||!("InteractionDecision"in n.AgentMessage.update.MessageProcessingUpdate.update)||!("AcceptInteraction"in n.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:n.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.AcceptInteraction}function rn(n){return!("AgentMessage"in n)||!("MessageProcessingUpdate"in n.AgentMessage.update)||!("InteractionDecision"in n.AgentMessage.update.MessageProcessingUpdate.update)||!("DeclineInteraction"in n.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:n.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.DeclineInteraction}function B(n){return!("AgentMessage"in n)||!("PlanningDecisionUpdate"in n.AgentMessage.update)?null:n.AgentMessage.update.PlanningDecisionUpdate.update}function dn(n){let e=B(n);return!e||!("Started"in e)?null:e.Started}function tn(n){let e=B(n);return!e||!("Completed"in e)?null:e.Completed}function an(n){let e=B(n);return!e||!("PlanningRequired"in e)?null:e.PlanningRequired}function _n(n){return!("AgentMessage"in n)||!("StartingOrchestrator"in n.AgentMessage.update)?null:n.AgentMessage.update.StartingOrchestrator}function h(n){return!("AgentMessage"in n)||!("OrchestratorUpdate"in n.AgentMessage.update)?null:n.AgentMessage.update.OrchestratorUpdate.update}function m(n){let e=h(n);return!e||!("ContextExplorerUpdate"in e)?null:e.ContextExplorerUpdate.update}function ln(n){let e=m(n);return!e||!("Started"in e)?null:e.Started}function on(n){let e=m(n);return!e||!("Completed"in e)?null:e.Completed}function v(n){let e=m(n);return!e||!("WikiExplorerUpdate"in e)?null:e.WikiExplorerUpdate.update}function un(n){let e=v(n);return!e||!("Started"in e)?null:e.Started}function sn(n){let e=v(n);return!e||!("Completed"in e)?null:e.Completed}function pn(n){let e=v(n);return!e||!("WikiInfoGenerated"in e)?null:e.WikiInfoGenerated}function E(n){let e=m(n);return!e||!("SchemaTasksGenerationUpdate"in e)?null:e.SchemaTasksGenerationUpdate.update}function mn(n){let e=E(n);return!e||!("Started"in e)?null:e.Started}function fn(n){let e=E(n);return!e||!("Completed"in e)?null:e.Completed}function cn(n){let e=E(n);return!e||!("TasksGenerated"in e)?null:e.TasksGenerated}function p(n){let e=m(n);return!e||!("SchemaExplorerUpdate"in e)?null:e.SchemaExplorerUpdate.update}function yn(n){let e=p(n);return!e||!("Started"in e)?null:e.Started}function gn(n){let e=p(n);return!e||!("Completed"in e)?null:e.Completed}function kn(n){let e=p(n);return!e||!("CodeExecutionComplete"in e)?null:e.CodeExecutionComplete}function xn(n){let e=p(n);return!e||!("CodeOutputAnalyzed"in e)?null:e.CodeOutputAnalyzed}function Bn(n){let e=p(n);return!e||!("GeneratedCode"in e)?null:e.GeneratedCode}function hn(n){let e=p(n);return!e||!("SchemaExplored"in e)?null:e.SchemaExplored}function O(n){let e=h(n);return!e||!("StepUpdate"in e)?null:e.StepUpdate}function vn(n){let e=O(n);return!e||!("Programmer"in e.update)?null:e.update.Programmer}function En(n){let e=O(n);return!e||!("UiProgrammer"in e.update)?null:e.update.UiProgrammer}function On(n){let e=O(n);return!e||!("SavedProgramRunner"in e.update)?null:e.update.SavedProgramRunner}function Tn(n){if(!("AgentMessage"in n))return null;if("InteractionFinished"in n.AgentMessage.update){let e=n.AgentMessage.update.InteractionFinished.update;return"Completed"in e?{status:"completed",timestamp:e.Completed.completed_at,warnings:e.Completed.warnings,messageId:n.AgentMessage.message_id}:"Errored"in e?{status:"errored",timestamp:e.Errored.errored_at,messageId:n.AgentMessage.message_id,reason:typeof e.Errored.error=="string"?e.Errored.error:e.Errored.error.User.message}:"UserCancelled"in e?{status:"user_cancelled",timestamp:e.UserCancelled.cancelled_at,messageId:n.AgentMessage.message_id}:"AgentDeclined"in e?{status:"agent_declined",timestamp:e.AgentDeclined.declined_at,reason:e.AgentDeclined.reason,messageId:n.AgentMessage.message_id}:"ServerCancelled"in e?{status:"server_cancelled",timestamp:e.ServerCancelled.cancelled_at,messageId:n.AgentMessage.message_id}:{status:"unknown",messageId:n.AgentMessage.message_id}}if("content"in n.AgentMessage.update&&"interaction_finished"in n.AgentMessage.update.content){let e=n.AgentMessage.update.content.interaction_finished.outcome;return"errored"in e?{status:"errored",messageId:n.AgentMessage.message_id,reason:e.errored.user_facing_message||e.errored.raw_error,timestamp:n.AgentMessage.update.timestamp,warnings:e.errored.raw_error?[{message:e.errored.raw_error}]:[]}:"server_cancelled"in e?{status:"server_cancelled",messageId:n.AgentMessage.message_id,timestamp:n.AgentMessage.update.timestamp}:"user_cancelled"in e?{status:"user_cancelled",messageId:n.AgentMessage.message_id,timestamp:n.AgentMessage.update.timestamp}:"completed"in e?{status:"completed",messageId:n.AgentMessage.message_id,timestamp:n.AgentMessage.update.timestamp,warnings:e.completed.warnings}:{status:"unknown",messageId:n.AgentMessage.message_id}}return null}function An(n){if(n){if("UserMessage"in n)return n.UserMessage.message_id;if("AgentMessage"in n)return n.AgentMessage.message_id;if("UserTeach"in n)return n.UserTeach.agent_message_id;if("UserCancel"in n)return n.UserCancel.message_id}}function Z(n){return`https://promptql.${n}/playground-v2-hge/v1/graphql`}var T=class{controlPlaneUrl;options;defaultTimezone;getAuthTokenFn;project;client;wsClient;constructor(e){if(this.options=e,!e.serviceAccountToken)throw new Error("serviceAccountToken must not be empty. If you haven't created any service account token yet, check out Hasura docs https://hasura.io/docs/3.0/project-configuration/project-management/service-accounts/#how-to-create-service-account");this.defaultTimezone=e.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone;let i=e.controlPlaneHost?g(e.controlPlaneHost):"https://data.pro.hasura.io";this.controlPlaneUrl=`${i}/v1/graphql`}async getAuthToken(){if(typeof this.getAuthTokenFn=="function")return this.getAuthTokenFn();let e=await this.getProjectInfo();return this.getAuthTokenFn=Se({promptqlGraphQLUrl:e.promptqlGraphQLUrl,authHost:this.options.authHost,headers:Ve(this.options.serviceAccountToken),fetch:this.options.fetch}),this.getAuthTokenFn()}async getGraphQLClient(){if(this.client)return this.client;let e=await this.getProjectInfo(),{client:i,wsClient:r}=X({getAuthToken:this.getAuthToken.bind(this),url:e.promptqlGraphQLUrl,fetch:this.options.fetch,headers:this.options.headers});return this.wsClient=r,this.client=i,this.client}async getProjectInfo(){if(this.project)return this.project;let e={operationName:"GetDdnProjects",query:"query GetDdnProjects { ddn_projects(limit: 1) { id name private_ddn { fqdn path_routing_context path_routing_enabled }}}"},r=await(typeof this.options.fetch=="function"?this.options.fetch:fetch)(this.controlPlaneUrl,{method:"POST",headers:{...Ve(this.options.serviceAccountToken),"User-Agent":s,"Content-Type":"application/json"},body:JSON.stringify(e)});if(r.status!==200){let _=r.body?await r.text():r.statusText;throw new Error(`[${r.status}] failed to get project info: ${_}`)}let d=await r.json();if(!d.data?.ddn_projects?.length)throw new Error("Project not found");let a=d.data.ddn_projects[0];return this.project={projectId:a.id,projectName:a.name,projectHost:`https://${a.name}.${a.private_ddn.fqdn}`,promptqlConsoleUrl:`https://prompt.ql.app/project/${a.name}`,promptqlGraphQLUrl:Z(a.private_ddn.fqdn)},this.project}close(){if(this.wsClient&&(this.wsClient.dispose(),this.wsClient=void 0),this.client){try{this.client.stop?.()}catch{}try{this.client.clearStore?.()}catch{}this.client=void 0,this.project=void 0,this.getAuthTokenFn=void 0}}};function Ve(n){return{Authorization:`pat ${n}`}}var A=class{api;constructor(e){this.api=e}async listMetadataByThreadId(e){let i=await this.api.getProjectInfo(),r=await this.api.getGraphQLClient();return V(r,i.projectId,e)}async download(e,i){let r=await this.api.getProjectInfo(),d=await this.api.getAuthToken();return U(r.projectHost,e,i,Me(d),this.api.options.fetch)}async getMetadata(e,i){let r=await this.api.getProjectInfo(),d=await this.api.getAuthToken();return M(r.projectHost,e,i,Me(d),this.api.options.fetch)}};function Me(n){return{Authorization:`Bearer ${n}`,"User-Agent":s}}var b=class{api;constructor(e){this.api=e}info(){return this.api.getProjectInfo()}};var S=class{api;constructor(e){this.api=e}async list(e){let i=await this.api.getGraphQLClient();return y(i,{...e,limit:e.limit&&e.limit>0?e.limit:10})}async getByName(e){let i=await this.api.getGraphQLClient();return y(i,{where:{name:{_eq:e}},limit:1}).then(r=>r.length?r[0]??null:null)}async create(e){let i=await this.api.getGraphQLClient();return F(i,e)}};var f=require("rxjs");var P=class{api;constructor(e){this.api=e}async list(e){let i=await this.api.getGraphQLClient();return q(i,{...e,limit:e.limit&&e.limit>0?e.limit:10})}async get(e){if(!e)throw new Error("threadId is required");let i=await this.api.getGraphQLClient();return I(i,e)}async start(e){let i=await this.api.getProjectInfo(),r=await this.api.getGraphQLClient();return R(r,{...e,projectId:i.projectId,buildId:e.buildId||this.api.options.buildId,timezone:e.timezone||this.api.defaultTimezone})}async detail(e,i){let r=await this.api.getGraphQLClient();return D(r,e,i)}async getEvents(e,i){let r=await this.api.getGraphQLClient();return k(r,e,i)}async sendMessage(e){let i=await this.api.getGraphQLClient();return G(i,{...e,timezone:e.timezone||this.api.defaultTimezone})}async cancelAgentMessage(e){let i=await this.api.getGraphQLClient();return j(i,e)}subscribeEvents(e,i){return(0,f.from)(this.api.getGraphQLClient()).pipe((0,f.switchMap)(r=>W(r,e,i)))}streamMessageEvents(e,i){return(0,f.from)(this.api.getGraphQLClient()).pipe((0,f.switchMap)(r=>Q(r,e,i)))}};var C=class{api;constructor(e){this.api=e}async list(e){let i=await this.api.getGraphQLClient();return L(i,e)}async search(e){let i=await this.api.getGraphQLClient();return z(i,e)}async get(e,i){let r=await this.api.getProjectInfo(),d=await this.api.getGraphQLClient();return K(d,r.projectId,e,i)}async create(e){let i=await this.api.getGraphQLClient();return $(i,e)}async update(e,i){let r=await this.api.getGraphQLClient();return J(r,e,i)}async delete(e){let i=await this.api.getGraphQLClient();return H(i,e)}};var Y=class{constructor(e){let i=new T(e);this.api=i,this.thread=new P(i),this.project=new b(i),this.room=new S(i),this.artifact=new A(i),this.wiki=new C(i)}api;thread;project;room;artifact;wiki;close(){this.api.close()}};0&&(module.exports={PromptQLSdk,ROOM_NAME_REGEX,USER_AGENT,buildPromptQLUrl,cancelAgentMessage,createApolloClient,createRoom,createWikiPage,deleteWikiPage,diffThreadEvents,downloadArtifactData,getAgentGeneratedResponse,getAgentInteractionDecisionAcceptInteractionEvent,getAgentInteractionDecisionDeclineInteractionEvent,getAgentInteractionFinishedEvent,getAgentMessageProcessingStartedEvent,getAgentOrchestratorContextExplorerCompletedEvent,getAgentOrchestratorContextExplorerStartedEvent,getAgentOrchestratorContextExplorerUpdateEvent,getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent,getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent,getAgentOrchestratorSchemaExplorerCompletedEvent,getAgentOrchestratorSchemaExplorerGeneratedCodeEvent,getAgentOrchestratorSchemaExplorerSchemaExploredEvent,getAgentOrchestratorSchemaExplorerStartedEvent,getAgentOrchestratorSchemaExplorerUpdateEvent,getAgentOrchestratorSchemaTasksGeneratedEvent,getAgentOrchestratorSchemaTasksGenerationCompletedEvent,getAgentOrchestratorSchemaTasksGenerationStartedEvent,getAgentOrchestratorSchemaTasksGenerationUpdateEvent,getAgentOrchestratorStepProgrammerEvent,getAgentOrchestratorStepSavedProgramRunnerEvent,getAgentOrchestratorStepUiProgrammerEvent,getAgentOrchestratorStepUpdateEvent,getAgentOrchestratorUpdateEvent,getAgentOrchestratorWikiExplorerCompletedEvent,getAgentOrchestratorWikiExplorerStartedEvent,getAgentOrchestratorWikiExplorerUpdateEvent,getAgentOrchestratorWikiInfoGeneratedEvent,getAgentPlanGenerationStartedEvent,getAgentPlanStepGeneratedEvent,getAgentPlanningDecisionCompletedEvent,getAgentPlanningDecisionPlanningRequiredEvent,getAgentPlanningDecisionStartedEvent,getAgentPlanningDecisionUpdateEvent,getAgentStartingOrchestratorEvent,getArtifactMetadata,getThread,getThreadAndEvents,getThreadEventMessageId,getThreadEvents,getUserCancelEvent,getUserMessageEvent,getWikiPage,isInteractionAnalyzing,listArtifactMetadataByThreadId,listRooms,listThreads,listWikiPages,searchWikiPages,sendThreadMessage,startThread,streamThreadMessageEvents,subscribeThreadEvents,updateWikiPage,validateRoomName});
|
|
1
|
+
"use strict";var S=Object.defineProperty;var Pe=Object.getOwnPropertyDescriptor;var Ne=Object.getOwnPropertyNames;var Ce=Object.prototype.hasOwnProperty;var Ue=(n,e)=>{for(var i in e)S(n,i,{get:e[i],enumerable:!0})},Ve=(n,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let d of Ne(e))!Ce.call(n,d)&&d!==i&&S(n,d,{get:()=>e[d],enumerable:!(r=Pe(e,d))||r.enumerable});return n};var Me=n=>Ve(S({},"__esModule",{value:!0}),n);var xn={};Ue(xn,{PromptQLSdk:()=>H,ROOM_NAME_REGEX:()=>ke,USER_AGENT:()=>J,buildAuthHeader:()=>m,cancelAgentMessage:()=>w,createApolloClient:()=>$,createRoom:()=>U,createWikiPage:()=>Q,deleteWikiPage:()=>K,diffThreadEvents:()=>Ge,downloadArtifactData:()=>P,getAgentGeneratedResponse:()=>Le,getAgentInteractionDecisionAcceptInteractionEvent:()=>$e,getAgentInteractionDecisionDeclineInteractionEvent:()=>Je,getAgentInteractionFinishedEvent:()=>kn,getAgentMessageProcessingStartedEvent:()=>Ke,getAgentOrchestratorContextExplorerCompletedEvent:()=>nn,getAgentOrchestratorContextExplorerStartedEvent:()=>en,getAgentOrchestratorContextExplorerUpdateEvent:()=>p,getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent:()=>sn,getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent:()=>pn,getAgentOrchestratorSchemaExplorerCompletedEvent:()=>un,getAgentOrchestratorSchemaExplorerGeneratedCodeEvent:()=>mn,getAgentOrchestratorSchemaExplorerSchemaExploredEvent:()=>fn,getAgentOrchestratorSchemaExplorerStartedEvent:()=>on,getAgentOrchestratorSchemaExplorerUpdateEvent:()=>s,getAgentOrchestratorSchemaTasksGeneratedEvent:()=>ln,getAgentOrchestratorSchemaTasksGenerationCompletedEvent:()=>_n,getAgentOrchestratorSchemaTasksGenerationStartedEvent:()=>an,getAgentOrchestratorSchemaTasksGenerationUpdateEvent:()=>x,getAgentOrchestratorStepProgrammerEvent:()=>cn,getAgentOrchestratorStepSavedProgramRunnerEvent:()=>gn,getAgentOrchestratorStepUiProgrammerEvent:()=>yn,getAgentOrchestratorStepUpdateEvent:()=>v,getAgentOrchestratorUpdateEvent:()=>k,getAgentOrchestratorWikiExplorerCompletedEvent:()=>rn,getAgentOrchestratorWikiExplorerStartedEvent:()=>dn,getAgentOrchestratorWikiExplorerUpdateEvent:()=>B,getAgentOrchestratorWikiInfoGeneratedEvent:()=>tn,getAgentPlanGenerationStartedEvent:()=>ze,getAgentPlanStepGeneratedEvent:()=>Qe,getAgentPlanningDecisionCompletedEvent:()=>Xe,getAgentPlanningDecisionPlanningRequiredEvent:()=>Ze,getAgentPlanningDecisionStartedEvent:()=>He,getAgentPlanningDecisionUpdateEvent:()=>g,getAgentStartingOrchestratorEvent:()=>Ye,getArtifactMetadata:()=>C,getThread:()=>F,getThreadAndEvents:()=>I,getThreadEventMessageId:()=>Bn,getThreadEvents:()=>c,getUserCancelEvent:()=>We,getUserMessageEvent:()=>je,getWikiPage:()=>z,isInteractionAnalyzing:()=>ve,listArtifactMetadataByThreadId:()=>N,listRooms:()=>f,listThreads:()=>M,listWikiPages:()=>j,searchWikiPages:()=>W,sendThreadMessage:()=>D,startThread:()=>q,streamThreadMessageEvents:()=>G,subscribeThreadEvents:()=>R,updateWikiPage:()=>L,validateRoomName:()=>Be});module.exports=Me(xn);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"}}]}}]}}]},Z={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateRoom"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"name"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"visibility"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"description"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"create_room"},arguments:[{kind:"Argument",name:{kind:"Name",value:"name"},value:{kind:"Variable",name:{kind:"Name",value:"name"}}},{kind:"Argument",name:{kind:"Name",value:"visibility"},value:{kind:"Variable",name:{kind:"Name",value:"visibility"}}},{kind:"Argument",name:{kind:"Name",value:"description"},value:{kind:"Variable",name:{kind:"Name",value:"description"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"room_id"}}]}}]}}]},Y={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"}}]}}]}}]},ee={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"StartThread"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"message"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"projectId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"timezone"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"roomId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"uploads"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UserUploadInput"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"visibility"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"createdFrom"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"start_thread"},arguments:[{kind:"Argument",name:{kind:"Name",value:"message"},value:{kind:"Variable",name:{kind:"Name",value:"message"}}},{kind:"Argument",name:{kind:"Name",value:"projectId"},value:{kind:"Variable",name:{kind:"Name",value:"projectId"}}},{kind:"Argument",name:{kind:"Name",value:"timezone"},value:{kind:"Variable",name:{kind:"Name",value:"timezone"}}},{kind:"Argument",name:{kind:"Name",value:"buildId"},value:{kind:"Variable",name:{kind:"Name",value:"buildId"}}},{kind:"Argument",name:{kind:"Name",value:"buildFqdn"},value:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}}},{kind:"Argument",name:{kind:"Name",value:"roomId"},value:{kind:"Variable",name:{kind:"Name",value:"roomId"}}},{kind:"Argument",name:{kind:"Name",value:"uploads"},value:{kind:"Variable",name:{kind:"Name",value:"uploads"}}},{kind:"Argument",name:{kind:"Name",value:"visibility"},value:{kind:"Variable",name:{kind:"Name",value:"visibility"}}},{kind:"Argument",name:{kind:"Name",value:"createdFrom"},value:{kind:"Variable",name:{kind:"Name",value:"createdFrom"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"thread_events"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"thread_event_id"}}]}}]}}]}}]},ne={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateWikiPage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"pageContent"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"jsonb"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"pageId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki_add"},arguments:[{kind:"Argument",name:{kind:"Name",value:"pageContent"},value:{kind:"Variable",name:{kind:"Name",value:"pageContent"}}},{kind:"Argument",name:{kind:"Name",value:"pageId"},value:{kind:"Variable",name:{kind:"Name",value:"pageId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}}]}}]}}]},ie={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"UpdateWikiPage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"pageContent"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"jsonb"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki_update"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}},{kind:"Argument",name:{kind:"Name",value:"pageContent"},value:{kind:"Variable",name:{kind:"Name",value:"pageContent"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"buildVersion"}}]}}]}}]},de={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"DeleteWikiPage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki_delete"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"buildVersion"}}]}}]}}]},re={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetArtifactsByThreadId"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"threadId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"artifacts"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_artifacts"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_id"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"_eq"},value:{kind:"Variable",name:{kind:"Name",value:"threadId"}}}]}}]}}]}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"updated_at"},value:{kind:"EnumValue",value:"asc"}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"artifact_id"}},{kind:"Field",name:{kind:"Name",value:"latest_version_object"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"user_id"}},{kind:"Field",name:{kind:"Name",value:"artifact_metadata"}},{kind:"Field",name:{kind:"Name",value:"artifact_type"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"size"}},{kind:"Field",name:{kind:"Name",value:"version"}}]}}]}}]}}]},te={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"ListGuidePages"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_guide_page_order_by"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_guide_page_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_guide_page"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"page_title"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"last_modified_at"}}]}}]}}]},ae={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetGuidePage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"project_id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"page_id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_guide_page"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"project_id"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"_eq"},value:{kind:"Variable",name:{kind:"Name",value:"project_id"}}}]}},{kind:"ObjectField",name:{kind:"Name",value:"id"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"_eq"},value:{kind:"Variable",name:{kind:"Name",value:"page_id"}}}]}},{kind:"ObjectField",name:{kind:"Name",value:"deleted_at"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"_is_null"},value:{kind:"BooleanValue",value:!0}}]}}]}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"IntValue",value:"1"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"page_title"}},{kind:"Field",name:{kind:"Name",value:"details"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"last_modified_at"}}]}}]}}]},_e={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetProjectInfo"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"get_project_info"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"projectId"}},{kind:"Field",name:{kind:"Name",value:"projectName"}},{kind:"Field",name:{kind:"Name",value:"promptqlConsoleUrl"}}]}}]}}]},le={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetRooms"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"rooms_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"rooms_order_by"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}},defaultValue:{kind:"IntValue",value:"10"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"rooms"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Room"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Room"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"rooms"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"room_id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"project_id"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"user_id"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}}]}}]},oe={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:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]},ue={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:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]},se={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreadAndEventsById"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"eventsWhere"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"eventsLimit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"eventsOrdering"}},type:{kind:"NamedType",name:{kind:"Name",value:"order_by"}},defaultValue:{kind:"EnumValue",value:"asc"}}],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:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"eventsWhere"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"eventsLimit"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"Variable",name:{kind:"Name",value:"eventsOrdering"}}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}}]}},{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:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{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"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]},pe={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreadEvents"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"ordering"}},type:{kind:"NamedType",name:{kind:"Name",value:"order_by"}},defaultValue:{kind:"EnumValue",value:"asc"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"Variable",name:{kind:"Name",value:"ordering"}}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadEvent"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"thread_events"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]},me={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"ListWikiPages"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_wiki_order_by"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_wiki_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki"},arguments:[{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}},{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"page_id"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"last_modified_at"}},{kind:"Field",alias:{kind:"Name",value:"title"},name:{kind:"Name",value:"content"},arguments:[{kind:"Argument",name:{kind:"Name",value:"path"},value:{kind:"StringValue",value:"title",block:!1}}]},{kind:"Field",alias:{kind:"Name",value:"stub"},name:{kind:"Name",value:"content"},arguments:[{kind:"Argument",name:{kind:"Name",value:"path"},value:{kind:"StringValue",value:"stub",block:!1}}]},{kind:"Field",alias:{kind:"Name",value:"aliases"},name:{kind:"Name",value:"content"},arguments:[{kind:"Argument",name:{kind:"Name",value:"path"},value:{kind:"StringValue",value:"aliases",block:!1}}]},{kind:"Field",alias:{kind:"Name",value:"definition"},name:{kind:"Name",value:"content"},arguments:[{kind:"Argument",name:{kind:"Name",value:"path"},value:{kind:"StringValue",value:"definition",block:!1}}]}]}}]}}]},fe={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetWikiPage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_wiki_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki"},arguments:[{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"IntValue",value:"1"}},{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"page_id"}},{kind:"Field",name:{kind:"Name",value:"content"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"last_modified_at"}}]}}]}}]},ce={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"SearchWikiPages"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"query"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki_search"},arguments:[{kind:"Argument",name:{kind:"Name",value:"query"},value:{kind:"Variable",name:{kind:"Name",value:"query"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"totalCount"}},{kind:"Field",name:{kind:"Name",value:"results"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"score"}},{kind:"Field",name:{kind:"Name",value:"page"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"aliases"}},{kind:"Field",name:{kind:"Name",value:"definition"}},{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"namespace"}},{kind:"Field",name:{kind:"Name",value:"stub"}},{kind:"Field",name:{kind:"Name",value:"title"}}]}},{kind:"Field",name:{kind:"Name",value:"metadata"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"createdAt"}},{kind:"Field",name:{kind:"Name",value:"ownerId"}},{kind:"Field",name:{kind:"Name",value:"lastUpdatedAt"}}]}}]}}]}}]}}]},ye={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"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]};async function P(n,e,i,r,d){let a=`${n}/promptql-v2/artifacts/${e}/version/${i}/data`,t=await(typeof d=="function"?d:fetch)(a,{method:"GET",headers:r});if(t.status!==200){let Se=t.body?await t.text():t.statusText;throw new Error(`[${t.status}] failed to download artifact: ${Se}`)}return t.body?t.headers.get("Content-Type")?.startsWith("application/json")?t.json():t.text():null}async function N(n,e,i){let r=await n.query({query:re,variables:{threadId:i},fetchPolicy:"no-cache"});return r.data?.artifacts?.length?r.data.artifacts.filter(d=>d.latest_version_object).map(d=>({project_id:e,artifact_id:d.artifact_id,artifact_type:d.latest_version_object.artifact_type,version:d.latest_version_object.version,title:d.latest_version_object.title,description:d.latest_version_object.description??null,user_id:d.latest_version_object.user_id,metadata:d.latest_version_object.artifact_metadata,created_at:d.latest_version_object.created_at,size_bytes:Number.parseInt(d.latest_version_object.size)})):[]}async function C(n,e,i,r,d){let a=`${n}/promptql-v2/artifacts/${e}/version/${i}/metadata`,t=await(typeof d=="function"?d:fetch)(a,{method:"GET",headers:r});if(t.status!==200){let u=t.body?await t.text():t.statusText;throw new Error(`[${t.status}] failed to get artifact metadata: ${u}`)}return t.json()}function f(n,e){return n.query({query:le,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(i=>i.data?.rooms??[])}function U(n,e){if(!e.name)throw new Error("Room name is required");let i=Be(e.name);if(i)throw new Error(i);return n.mutate({mutation:Z,variables:e,fetchPolicy:"no-cache"}).then(r=>{if(!r.data?.create_room?.room_id)throw new Error("expected room_id in response, got null");return r.data?.create_room?.room_id})}var ke=/^[\p{Ll}\p{Lo}\p{N}]+([_-][\p{Ll}\p{Lo}\p{N}]+)*$/u,ge=80,Be=n=>{let e=n.trim();return e.length===0?null:e.length>ge?`Room name must be ${ge} characters or less`:/[^\p{Ll}\p{Lo}\p{N}_-]/u.test(e)?"Only lowercase letters, numbers, hyphens, and underscores are allowed.":/^[_-]|[_-]$/.test(e)?"Room name should not start or end with a hyphen or underscore.":/[-_]{2,}/.test(e)?"Room name should not contain consecutive hyphens or underscores.":ke.test(e)?null:"Room name is invalid. Only lowercase letters, numbers, hyphens, and underscores are allowed."};var l=require("rxjs");var xe=/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;function V(n){if(n==null)return null;try{Number.parseInt(n)}catch{throw new Error("invalid threadEventId")}return n}function M(n,e){return n.query({query:oe,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(i=>i.data?.threads_v2??[])}function F(n,e){if(!e)throw new Error("threadId is required");return n.query({query:ue,variables:{id:e},fetchPolicy:"no-cache"}).then(i=>i.data?.threads_v2_by_pk)}function I(n,e,i){let r=he(e,i);return n.query({query:se,variables:{id:e,eventsWhere:r.where,eventsLimit:r.limit,eventsOrdering:r.ordering},fetchPolicy:"no-cache"}).then(d=>d.data?.threads_v2_by_pk)}function q(n,e){if(!e.message.trim())throw new Error("message must not be empty");return n.mutate({mutation:ee,variables:e}).then(i=>{if(!i.data?.start_thread)throw new Error(i.error?.message||"Failed to start thread");return i.data.start_thread})}function c(n,e,i){return n.query({query:pe,variables:he(e,i),fetchPolicy:"no-cache"}).then(r=>r.data?.thread_events??[])}function D(n,e){if(!e.threadId)throw new Error("threadId is required");if(!e.message.trim())throw new Error("message must not be empty");return n.mutate({mutation:Y,variables:e}).then(i=>{if(!i.data?.send_thread_message)throw new Error(i.error?.message||"Failed to send message to thread");return i.data.send_thread_message})}function w(n,e){if(!e.threadId)throw new Error("threadId is required");if(!e.messageId.trim())throw new Error("messageId is required");return n.mutate({mutation:X,variables:e}).then(i=>{if(!i.data?.cancel_agent_message)throw new Error(i.error?.message||"Failed to cancel thread");return i.data.cancel_agent_message.thread_event_id})}function R(n,e,i){if(!e)throw new Error("threadId is required");V(i);let r={thread_id:{_eq:e}};return i&&(r.thread_event_id={_gte:i}),n.subscribe({query:ye,variables:{where:r}}).pipe((0,l.map)(d=>{if(d.error)throw d.error;return d.data?.thread_events??[]}))}function G(n,e,i){if(!e)throw new Error("threadId is required");let r,d=V(i?.fromEventId),a={eventId:i?.fromEventId?{_gte:d}:void 0,messageId:i?.messageId},_=i?.pollingInterval&&i?.pollingInterval>0?i.pollingInterval:5;return(0,l.defer)(async()=>{let t=r?{messageId:i?.messageId,eventId:{_gt:r}}:a,u=await c(n,e,t);return u.length>0&&(r=u[u.length-1]?.thread_event_id),u}).pipe((0,l.repeat)({count:i?.timeout&&i.timeout>0?Math.ceil(i.timeout/_):void 0,delay:_*1e3}),(0,l.takeWhile)(t=>ve(t,i?.skipAnalysis),!0))}function ve(n,e){for(let i=n.length-1;i>=0;i--){let r=n[i];if("UserMessage"in r.event_data)return!0;if(!("AgentMessage"in r.event_data))return!1;let d=r.event_data.AgentMessage.update;if("content"in d&&("interaction_finished"in d.content||e&&"interaction_update"in d.content&&"main_agent"in d.content.interaction_update&&"completed"in d.content.interaction_update.main_agent)||"InteractionFinished"in d||e&&"OrchestratorUpdate"in d&&"GeneratedResponse"in d.OrchestratorUpdate.update)return!1}return!0}function Fe(n){return[{event_data:{_contains:{UserMessage:{message_id:n}}}},{event_data:{_contains:{AgentMessage:{message_id:n}}}},{event_data:{_contains:{UserCancel:{message_id:n}}}}]}var he=(n,e)=>{if(!n)throw new Error("threadId is required");let i={thread_id:{_eq:n}};return e&&(e.eventId&&(i.thread_event_id=e.eventId),e.messageId&&(i._or=Fe(e.messageId))),{where:i,limit:e?.limit,ordering:e?.ordering||"asc"}};var y=["guide","regular"];async function j(n,e){let i=e.namespace||"regular";if(!y.includes(i))throw new Error(`Invalid namespace. Expected one of: ${y}`);if(i==="guide"){let _={deleted_at:{_is_null:!0}};return e.project_id&&(_.project_id={_eq:e.project_id}),e.query&&(_.page_title={_ilike:e.query.toLowerCase()}),qe(n,{where:_,limit:e.limit,offset:e.offset,order_by:e.order_by||e.ordering?{[!e.order_by||e.order_by==="slug"?"id":e.order_by]:e.ordering||"asc"}:void 0})}let r=e.project_id||!e.include_stub||e.namespace||e.query,d={where:e.project_id?{project_id:{_eq:e.project_id},deleted_at:{_is_null:!0}}:{},order_by:e.order_by||e.ordering?{[e.order_by?e.order_by==="slug"?"page_id":e.order_by:"page_id"]:e.ordering||"asc"}:void 0};r||(d.offset=e.offset,d.limit=e.limit);let a=await Ie(n,d);return r?Re(a,e):a}async function W(n,e){if(!e.query)throw new Error("query is required");return n.query({query:ce,variables:e,fetchPolicy:"no-cache"}).then(i=>i.data?.admin_wiki_search?{totalCount:i.data.admin_wiki_search.totalCount,results:i.data?.admin_wiki_search.results.map(({score:r,metadata:d,page:{id:a,..._}})=>({..._,score:r,stable_id:d.id,slug:a,created_at:d.createdAt,last_modified_at:d.lastUpdatedAt}))}:{totalCount:0,results:[]})}async function z(n,e,i,r){if(i=i||"regular",!y.includes(i))throw new Error(`Invalid namespace. Expected one of: ${y}`);if(!e)throw new Error("projectId is required");if(!r)throw new Error("identifier is required");if(i==="guide")return we(n,{project_id:e,page_id:r});let d={project_id:{_eq:e},deleted_at:{_is_null:!0}};return xe.test(r)?d.id={_eq:r}:d.page_id={_eq:r},De(n,{where:d})}function Q(n,{slug:e,...i}){if(!i.title)throw new Error("Wiki title is required");if(!i.stub&&!i.definition)throw new Error("Wiki definition is required");return n.mutate({mutation:ne,variables:{pageId:e,pageContent:i},fetchPolicy:"no-cache"}).then(r=>r.data?.admin_wiki_add?.id)}function L(n,e,i){if(!e)throw new Error("ID of the wiki is required");return n.mutate({mutation:ie,variables:{id:e,pageContent:i},fetchPolicy:"no-cache"}).then(r=>r.data?.admin_wiki_update?.buildVersion)}function K(n,e){if(!e)throw new Error("ID of the wiki is required");return n.mutate({mutation:de,variables:{id:e},fetchPolicy:"no-cache"}).then(i=>i.data?.admin_wiki_delete?.buildVersion)}function Ie(n,e){return n.query({query:me,variables:e,fetchPolicy:"no-cache"}).then(i=>i.data?.admin_wiki.map(({page_id:r,id:d,...a})=>({...a,stable_id:d,slug:r}))??[])}function qe(n,e){return n.query({query:te,variables:e,fetchPolicy:"no-cache"}).then(i=>i.data?.admin_guide_page?.map(r=>({stable_id:r.id,slug:r.id,created_at:r.created_at,last_modified_at:r.last_modified_at,title:r.page_title}))??[])}async function De(n,e){let i=await n.query({query:fe,variables:e,fetchPolicy:"no-cache"}).then(r=>r.data?.admin_wiki.map(d=>({stable_id:d.id,slug:d.page_id,created_at:d.created_at,last_modified_at:d.last_modified_at,...d.content}))??[]);return i.length?i[0]:null}async function we(n,e){let i=await n.query({query:ae,variables:e,fetchPolicy:"no-cache"}).then(r=>r.data?.admin_guide_page?.map(d=>({stable_id:d.id,slug:d.id,created_at:d.created_at,last_modified_at:d.last_modified_at,title:d.page_title,details:d.details}))??[]);return i.length?i[0]:null}function Re(n,e){if(!n.length||!e.include_stub&&!e.query&&!e.limit&&!e.offset)return n;let i=e.query?.toLowerCase(),r=n.filter(d=>!e.include_stub&&d.stub?!1:!!(!i||d.title.toLowerCase().includes(i)||d.definition&&d.definition.toLowerCase().includes(i)||d.aliases?.length&&d.aliases.some(a=>a.toLowerCase().includes(i))));return e.offset&&r.length&&(r=r.slice(e.offset)),e.limit&&e.limit<r.length&&(r=r.slice(0,e.limit)),r}var o=require("@apollo/client"),Ee=require("@apollo/client/link/context"),Oe=require("@apollo/client/link/subscriptions"),Te=require("graphql"),Ae=require("graphql-ws"),$=n=>{let e=new o.HttpLink({uri:n.url,fetch:n.fetch,headers:typeof n.headers=="object"?n.headers:void 0}),i=async _=>{let t=typeof n.headers=="object"?n.headers:await n.headers();return{headers:{..._,...t}}},r=(0,Ae.createClient)({url:n.url,connectionParams:()=>i(),lazy:!0}),d=new Oe.GraphQLWsLink(r),a=o.ApolloLink.split(({operationType:_})=>_===Te.OperationTypeNode.SUBSCRIPTION,d,typeof n.headers=="object"?e:new Ee.SetContextLink(({headers:_})=>i(_)).concat(e));return{client:new o.ApolloClient({link:a,cache:new o.InMemoryCache}),wsClient:r}};var J="PromptQL TypeScript SDK";function Ge(n,e){if(!e.length)return[];if(!n.length)return e;let i=n[n.length-1];if(!i)return e;let r=BigInt(i.thread_event_id),d=e.length-1;for(;d>=0;d--){let a=e[d];if(BigInt(a?.thread_event_id)<=r)break}return e.slice(d+1)}function je(n){return"UserMessage"in n?n.UserMessage:null}function We(n){return"UserCancel"in n?n.UserCancel:null}function ze(n){return!("AgentMessage"in n)||!("OrchestratorUpdate"in n.AgentMessage.update)||!("PlanGenerationStarted"in n.AgentMessage.update.OrchestratorUpdate.update)?null:n.AgentMessage.update.OrchestratorUpdate.update.PlanGenerationStarted}function Qe(n){let e=k(n);return!e||!("PlanStepGenerated"in e)?null:e.PlanStepGenerated}function Le(n){return"AgentMessage"in n?"content"in n.AgentMessage.update&&"interaction_update"in n.AgentMessage.update.content&&"main_agent"in n.AgentMessage.update.content.interaction_update&&"completed"in n.AgentMessage.update.content.interaction_update.main_agent?{success:!0,message:n.AgentMessage.update.content.interaction_update.main_agent.completed.summary||"",modified_artifacts:[],generated_at:n.AgentMessage.update.timestamp,messageId:n.AgentMessage.message_id}:!("OrchestratorUpdate"in n.AgentMessage.update)||!("GeneratedResponse"in n.AgentMessage.update.OrchestratorUpdate.update)?null:{...n.AgentMessage.update.OrchestratorUpdate.update.GeneratedResponse.response,messageId:n.AgentMessage.message_id}:null}function Ke(n){return!("AgentMessage"in n)||!("MessageProcessingUpdate"in n.AgentMessage.update)||!("ProcessingStarted"in n.AgentMessage.update.MessageProcessingUpdate.update)?null:n.AgentMessage.update.MessageProcessingUpdate.update.ProcessingStarted}function $e(n){return!("AgentMessage"in n)||!("MessageProcessingUpdate"in n.AgentMessage.update)||!("InteractionDecision"in n.AgentMessage.update.MessageProcessingUpdate.update)||!("AcceptInteraction"in n.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:n.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.AcceptInteraction}function Je(n){return!("AgentMessage"in n)||!("MessageProcessingUpdate"in n.AgentMessage.update)||!("InteractionDecision"in n.AgentMessage.update.MessageProcessingUpdate.update)||!("DeclineInteraction"in n.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:n.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.DeclineInteraction}function g(n){return!("AgentMessage"in n)||!("PlanningDecisionUpdate"in n.AgentMessage.update)?null:n.AgentMessage.update.PlanningDecisionUpdate.update}function He(n){let e=g(n);return!e||!("Started"in e)?null:e.Started}function Xe(n){let e=g(n);return!e||!("Completed"in e)?null:e.Completed}function Ze(n){let e=g(n);return!e||!("PlanningRequired"in e)?null:e.PlanningRequired}function Ye(n){return!("AgentMessage"in n)||!("StartingOrchestrator"in n.AgentMessage.update)?null:n.AgentMessage.update.StartingOrchestrator}function k(n){return!("AgentMessage"in n)||!("OrchestratorUpdate"in n.AgentMessage.update)?null:n.AgentMessage.update.OrchestratorUpdate.update}function p(n){let e=k(n);return!e||!("ContextExplorerUpdate"in e)?null:e.ContextExplorerUpdate.update}function en(n){let e=p(n);return!e||!("Started"in e)?null:e.Started}function nn(n){let e=p(n);return!e||!("Completed"in e)?null:e.Completed}function B(n){let e=p(n);return!e||!("WikiExplorerUpdate"in e)?null:e.WikiExplorerUpdate.update}function dn(n){let e=B(n);return!e||!("Started"in e)?null:e.Started}function rn(n){let e=B(n);return!e||!("Completed"in e)?null:e.Completed}function tn(n){let e=B(n);return!e||!("WikiInfoGenerated"in e)?null:e.WikiInfoGenerated}function x(n){let e=p(n);return!e||!("SchemaTasksGenerationUpdate"in e)?null:e.SchemaTasksGenerationUpdate.update}function an(n){let e=x(n);return!e||!("Started"in e)?null:e.Started}function _n(n){let e=x(n);return!e||!("Completed"in e)?null:e.Completed}function ln(n){let e=x(n);return!e||!("TasksGenerated"in e)?null:e.TasksGenerated}function s(n){let e=p(n);return!e||!("SchemaExplorerUpdate"in e)?null:e.SchemaExplorerUpdate.update}function on(n){let e=s(n);return!e||!("Started"in e)?null:e.Started}function un(n){let e=s(n);return!e||!("Completed"in e)?null:e.Completed}function sn(n){let e=s(n);return!e||!("CodeExecutionComplete"in e)?null:e.CodeExecutionComplete}function pn(n){let e=s(n);return!e||!("CodeOutputAnalyzed"in e)?null:e.CodeOutputAnalyzed}function mn(n){let e=s(n);return!e||!("GeneratedCode"in e)?null:e.GeneratedCode}function fn(n){let e=s(n);return!e||!("SchemaExplored"in e)?null:e.SchemaExplored}function v(n){let e=k(n);return!e||!("StepUpdate"in e)?null:e.StepUpdate}function cn(n){let e=v(n);return!e||!("Programmer"in e.update)?null:e.update.Programmer}function yn(n){let e=v(n);return!e||!("UiProgrammer"in e.update)?null:e.update.UiProgrammer}function gn(n){let e=v(n);return!e||!("SavedProgramRunner"in e.update)?null:e.update.SavedProgramRunner}function kn(n){if(!("AgentMessage"in n))return null;if("InteractionFinished"in n.AgentMessage.update){let e=n.AgentMessage.update.InteractionFinished.update;return"Completed"in e?{status:"completed",timestamp:e.Completed.completed_at,warnings:e.Completed.warnings,messageId:n.AgentMessage.message_id}:"Errored"in e?{status:"errored",timestamp:e.Errored.errored_at,messageId:n.AgentMessage.message_id,reason:typeof e.Errored.error=="string"?e.Errored.error:e.Errored.error.User.message}:"UserCancelled"in e?{status:"user_cancelled",timestamp:e.UserCancelled.cancelled_at,messageId:n.AgentMessage.message_id}:"AgentDeclined"in e?{status:"agent_declined",timestamp:e.AgentDeclined.declined_at,reason:e.AgentDeclined.reason,messageId:n.AgentMessage.message_id}:"ServerCancelled"in e?{status:"server_cancelled",timestamp:e.ServerCancelled.cancelled_at,messageId:n.AgentMessage.message_id}:{status:"unknown",messageId:n.AgentMessage.message_id}}if("content"in n.AgentMessage.update&&"interaction_finished"in n.AgentMessage.update.content){let e=n.AgentMessage.update.content.interaction_finished.outcome;return"errored"in e?{status:"errored",messageId:n.AgentMessage.message_id,reason:e.errored.user_facing_message||e.errored.raw_error,timestamp:n.AgentMessage.update.timestamp,warnings:e.errored.raw_error?[{message:e.errored.raw_error}]:[]}:"server_cancelled"in e?{status:"server_cancelled",messageId:n.AgentMessage.message_id,timestamp:n.AgentMessage.update.timestamp}:"user_cancelled"in e?{status:"user_cancelled",messageId:n.AgentMessage.message_id,timestamp:n.AgentMessage.update.timestamp}:"completed"in e?{status:"completed",messageId:n.AgentMessage.message_id,timestamp:n.AgentMessage.update.timestamp,warnings:e.completed.warnings}:{status:"unknown",messageId:n.AgentMessage.message_id}}return null}function Bn(n){if(n){if("UserMessage"in n)return n.UserMessage.message_id;if("AgentMessage"in n)return n.AgentMessage.message_id;if("UserTeach"in n)return n.UserTeach.agent_message_id;if("UserCancel"in n)return n.UserCancel.message_id}}function m(n){return{Authorization:`pat ${n}`,"User-Agent":J}}var be="https://promptql.ddn.hasura.app",h=class{options;defaultTimezone;client;wsClient;project;constructor(e){if(this.options=e,!e.accessToken)throw new Error("accessToken is required");this.defaultTimezone=e.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone;let i=new URL(this.options.baseUrl||be);i.pathname="/playground-v2-hge/v1/graphql";let{client:r,wsClient:d}=$({url:i.toString(),fetch:this.options.fetch,headers:Object.assign(m(this.options.accessToken),this.options.headers)});this.wsClient=d,this.client=r}async getProjectInfo(){if(this.project)return this.project;let i=(await this.client.query({query:_e,fetchPolicy:"no-cache"})).data?.get_project_info;if(!i)throw new Error("Project not found");let r=new URL(this.options.baseUrl||be);return r.hostname.startsWith("promptql.")&&(r.hostname=`${i.projectName}${r.hostname.slice(8)}`),this.project={projectId:i.projectId,projectName:i.projectName,projectHost:r.toString(),promptqlConsoleUrl:`https://prompt.ql.app/project/${i.projectName}`},this.project}close(){if(this.wsClient&&this.wsClient.dispose(),this.client){try{this.client.stop?.()}catch{}try{this.client.clearStore?.()}catch{}this.project=void 0}}};var E=class{api;constructor(e){this.api=e}async listMetadataByThreadId(e){let i=await this.api.getProjectInfo();return N(this.api.client,i.projectId,e)}async download(e,i){let r=await this.api.getProjectInfo();return P(r.projectHost,e,i,m(this.api.options.accessToken),this.api.options.fetch)}async getMetadata(e,i){let r=await this.api.getProjectInfo();return C(r.projectHost,e,i,m(this.api.options.accessToken),this.api.options.fetch)}};var O=class{api;constructor(e){this.api=e}info(){return this.api.getProjectInfo()}};var T=class{api;constructor(e){this.api=e}async list(e){return f(this.api.client,{...e,limit:e.limit&&e.limit>0?e.limit:10})}async getByName(e){return f(this.api.client,{where:{name:{_eq:e}},limit:1}).then(i=>i.length?i[0]??null:null)}async create(e){return U(this.api.client,e)}};var A=class{api;constructor(e){this.api=e}async list(e){return M(this.api.client,{...e,limit:e.limit&&e.limit>0?e.limit:10})}async get(e){if(!e)throw new Error("threadId is required");return F(this.api.client,e)}async start(e){let i=await this.api.getProjectInfo();return q(this.api.client,{...e,projectId:i.projectId,buildId:e.buildId||this.api.options.buildId,timezone:e.timezone||this.api.defaultTimezone})}async detail(e,i){return I(this.api.client,e,i)}async getEvents(e,i){return c(this.api.client,e,i)}async sendMessage(e){return D(this.api.client,{...e,timezone:e.timezone||this.api.defaultTimezone})}async cancelAgentMessage(e){return w(this.api.client,e)}subscribeEvents(e,i){return R(this.api.client,e,i)}streamMessageEvents(e,i){return G(this.api.client,e,i)}};var b=class{api;constructor(e){this.api=e}async list(e){return j(this.api.client,e)}async search(e){return W(this.api.client,e)}async get(e,i){let r=await this.api.getProjectInfo();return z(this.api.client,r.projectId,e,i)}async create(e){return Q(this.api.client,e)}async update(e,i){return L(this.api.client,e,i)}async delete(e){return K(this.api.client,e)}};var H=class{constructor(e){let i=new h(e);this.api=i,this.thread=new A(i),this.project=new O(i),this.room=new T(i),this.artifact=new E(i),this.wiki=new b(i)}api;thread;project;room;artifact;wiki;close(){this.api.close()}};0&&(module.exports={PromptQLSdk,ROOM_NAME_REGEX,USER_AGENT,buildAuthHeader,cancelAgentMessage,createApolloClient,createRoom,createWikiPage,deleteWikiPage,diffThreadEvents,downloadArtifactData,getAgentGeneratedResponse,getAgentInteractionDecisionAcceptInteractionEvent,getAgentInteractionDecisionDeclineInteractionEvent,getAgentInteractionFinishedEvent,getAgentMessageProcessingStartedEvent,getAgentOrchestratorContextExplorerCompletedEvent,getAgentOrchestratorContextExplorerStartedEvent,getAgentOrchestratorContextExplorerUpdateEvent,getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent,getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent,getAgentOrchestratorSchemaExplorerCompletedEvent,getAgentOrchestratorSchemaExplorerGeneratedCodeEvent,getAgentOrchestratorSchemaExplorerSchemaExploredEvent,getAgentOrchestratorSchemaExplorerStartedEvent,getAgentOrchestratorSchemaExplorerUpdateEvent,getAgentOrchestratorSchemaTasksGeneratedEvent,getAgentOrchestratorSchemaTasksGenerationCompletedEvent,getAgentOrchestratorSchemaTasksGenerationStartedEvent,getAgentOrchestratorSchemaTasksGenerationUpdateEvent,getAgentOrchestratorStepProgrammerEvent,getAgentOrchestratorStepSavedProgramRunnerEvent,getAgentOrchestratorStepUiProgrammerEvent,getAgentOrchestratorStepUpdateEvent,getAgentOrchestratorUpdateEvent,getAgentOrchestratorWikiExplorerCompletedEvent,getAgentOrchestratorWikiExplorerStartedEvent,getAgentOrchestratorWikiExplorerUpdateEvent,getAgentOrchestratorWikiInfoGeneratedEvent,getAgentPlanGenerationStartedEvent,getAgentPlanStepGeneratedEvent,getAgentPlanningDecisionCompletedEvent,getAgentPlanningDecisionPlanningRequiredEvent,getAgentPlanningDecisionStartedEvent,getAgentPlanningDecisionUpdateEvent,getAgentStartingOrchestratorEvent,getArtifactMetadata,getThread,getThreadAndEvents,getThreadEventMessageId,getThreadEvents,getUserCancelEvent,getUserMessageEvent,getWikiPage,isInteractionAnalyzing,listArtifactMetadataByThreadId,listRooms,listThreads,listWikiPages,searchWikiPages,sendThreadMessage,startThread,streamThreadMessageEvents,subscribeThreadEvents,updateWikiPage,validateRoomName});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as b,b as S,c as B,g as P}from"./chunk-7AMW5GJT.mjs";var C={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CancelAgentMessage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"threadId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"messageId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"cancel_agent_message"},arguments:[{kind:"Argument",name:{kind:"Name",value:"threadId"},value:{kind:"Variable",name:{kind:"Name",value:"threadId"}}},{kind:"Argument",name:{kind:"Name",value:"agentMessageId"},value:{kind:"Variable",name:{kind:"Name",value:"messageId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}}]}}]}}]},N={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateRoom"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"name"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"visibility"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"description"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"create_room"},arguments:[{kind:"Argument",name:{kind:"Name",value:"name"},value:{kind:"Variable",name:{kind:"Name",value:"name"}}},{kind:"Argument",name:{kind:"Name",value:"visibility"},value:{kind:"Variable",name:{kind:"Name",value:"visibility"}}},{kind:"Argument",name:{kind:"Name",value:"description"},value:{kind:"Variable",name:{kind:"Name",value:"description"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"room_id"}}]}}]}}]},U={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"SendThreadMessage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"message"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"timezone"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"threadId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"uploads"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UserUploadInput"}}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"send_thread_message"},arguments:[{kind:"Argument",name:{kind:"Name",value:"threadId"},value:{kind:"Variable",name:{kind:"Name",value:"threadId"}}},{kind:"Argument",name:{kind:"Name",value:"timezone"},value:{kind:"Variable",name:{kind:"Name",value:"timezone"}}},{kind:"Argument",name:{kind:"Name",value:"message"},value:{kind:"Variable",name:{kind:"Name",value:"message"}}},{kind:"Argument",name:{kind:"Name",value:"buildFqdn"},value:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}}},{kind:"Argument",name:{kind:"Name",value:"uploads"},value:{kind:"Variable",name:{kind:"Name",value:"uploads"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"created_at"}}]}}]}}]},V={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"StartThread"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"message"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"projectId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"timezone"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"roomId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"uploads"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UserUploadInput"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"visibility"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"createdFrom"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"start_thread"},arguments:[{kind:"Argument",name:{kind:"Name",value:"message"},value:{kind:"Variable",name:{kind:"Name",value:"message"}}},{kind:"Argument",name:{kind:"Name",value:"projectId"},value:{kind:"Variable",name:{kind:"Name",value:"projectId"}}},{kind:"Argument",name:{kind:"Name",value:"timezone"},value:{kind:"Variable",name:{kind:"Name",value:"timezone"}}},{kind:"Argument",name:{kind:"Name",value:"buildId"},value:{kind:"Variable",name:{kind:"Name",value:"buildId"}}},{kind:"Argument",name:{kind:"Name",value:"buildFqdn"},value:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}}},{kind:"Argument",name:{kind:"Name",value:"roomId"},value:{kind:"Variable",name:{kind:"Name",value:"roomId"}}},{kind:"Argument",name:{kind:"Name",value:"uploads"},value:{kind:"Variable",name:{kind:"Name",value:"uploads"}}},{kind:"Argument",name:{kind:"Name",value:"visibility"},value:{kind:"Variable",name:{kind:"Name",value:"visibility"}}},{kind:"Argument",name:{kind:"Name",value:"createdFrom"},value:{kind:"Variable",name:{kind:"Name",value:"createdFrom"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"thread_events"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"thread_event_id"}}]}}]}}]}}]},M={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateWikiPage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"pageContent"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"jsonb"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"pageId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki_add"},arguments:[{kind:"Argument",name:{kind:"Name",value:"pageContent"},value:{kind:"Variable",name:{kind:"Name",value:"pageContent"}}},{kind:"Argument",name:{kind:"Name",value:"pageId"},value:{kind:"Variable",name:{kind:"Name",value:"pageId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}}]}}]}}]},F={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"UpdateWikiPage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"pageContent"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"jsonb"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki_update"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}},{kind:"Argument",name:{kind:"Name",value:"pageContent"},value:{kind:"Variable",name:{kind:"Name",value:"pageContent"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"buildVersion"}}]}}]}}]},w={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"DeleteWikiPage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki_delete"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"buildVersion"}}]}}]}}]},q={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetArtifactsByThreadId"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"threadId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"artifacts"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_artifacts"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_id"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"_eq"},value:{kind:"Variable",name:{kind:"Name",value:"threadId"}}}]}}]}}]}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"updated_at"},value:{kind:"EnumValue",value:"asc"}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"artifact_id"}},{kind:"Field",name:{kind:"Name",value:"latest_version_object"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"user_id"}},{kind:"Field",name:{kind:"Name",value:"artifact_metadata"}},{kind:"Field",name:{kind:"Name",value:"artifact_type"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"size"}},{kind:"Field",name:{kind:"Name",value:"version"}}]}}]}}]}}]},I={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"ListGuidePages"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_guide_page_order_by"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_guide_page_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_guide_page"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"page_title"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"last_modified_at"}}]}}]}}]},D={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetGuidePage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"project_id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"page_id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_guide_page"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"project_id"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"_eq"},value:{kind:"Variable",name:{kind:"Name",value:"project_id"}}}]}},{kind:"ObjectField",name:{kind:"Name",value:"id"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"_eq"},value:{kind:"Variable",name:{kind:"Name",value:"page_id"}}}]}},{kind:"ObjectField",name:{kind:"Name",value:"deleted_at"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"_is_null"},value:{kind:"BooleanValue",value:!0}}]}}]}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"IntValue",value:"1"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"page_title"}},{kind:"Field",name:{kind:"Name",value:"details"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"last_modified_at"}}]}}]}}]},R={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetRooms"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"rooms_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"rooms_order_by"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}},defaultValue:{kind:"IntValue",value:"10"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"rooms"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Room"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Room"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"rooms"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"room_id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"project_id"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"user_id"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}}]}}]},G={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreads"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"threads_v2_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"threads_v2_order_by"}}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"threads_v2"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Thread"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Thread"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"threads_v2"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"build_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"relevant_event_count"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]},W={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreadById"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"threads_v2_by_pk"},arguments:[{kind:"Argument",name:{kind:"Name",value:"thread_id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Thread"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Thread"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"threads_v2"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"build_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"relevant_event_count"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]},j={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreadAndEventsById"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"eventsWhere"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"eventsLimit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"eventsOrdering"}},type:{kind:"NamedType",name:{kind:"Name",value:"order_by"}},defaultValue:{kind:"EnumValue",value:"asc"}}],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:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"eventsWhere"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"eventsLimit"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"Variable",name:{kind:"Name",value:"eventsOrdering"}}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}}]}},{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:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{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"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]},Q={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreadEvents"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"ordering"}},type:{kind:"NamedType",name:{kind:"Name",value:"order_by"}},defaultValue:{kind:"EnumValue",value:"asc"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"Variable",name:{kind:"Name",value:"ordering"}}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadEvent"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"thread_events"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]},z={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"ListWikiPages"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_wiki_order_by"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_wiki_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki"},arguments:[{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}},{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"page_id"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"last_modified_at"}},{kind:"Field",alias:{kind:"Name",value:"title"},name:{kind:"Name",value:"content"},arguments:[{kind:"Argument",name:{kind:"Name",value:"path"},value:{kind:"StringValue",value:"title",block:!1}}]},{kind:"Field",alias:{kind:"Name",value:"stub"},name:{kind:"Name",value:"content"},arguments:[{kind:"Argument",name:{kind:"Name",value:"path"},value:{kind:"StringValue",value:"stub",block:!1}}]},{kind:"Field",alias:{kind:"Name",value:"aliases"},name:{kind:"Name",value:"content"},arguments:[{kind:"Argument",name:{kind:"Name",value:"path"},value:{kind:"StringValue",value:"aliases",block:!1}}]},{kind:"Field",alias:{kind:"Name",value:"definition"},name:{kind:"Name",value:"content"},arguments:[{kind:"Argument",name:{kind:"Name",value:"path"},value:{kind:"StringValue",value:"definition",block:!1}}]}]}}]}}]},L={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetWikiPage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_wiki_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki"},arguments:[{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"IntValue",value:"1"}},{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"page_id"}},{kind:"Field",name:{kind:"Name",value:"content"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"last_modified_at"}}]}}]}}]},K={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"SearchWikiPages"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"query"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki_search"},arguments:[{kind:"Argument",name:{kind:"Name",value:"query"},value:{kind:"Variable",name:{kind:"Name",value:"query"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"totalCount"}},{kind:"Field",name:{kind:"Name",value:"results"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"score"}},{kind:"Field",name:{kind:"Name",value:"page"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"aliases"}},{kind:"Field",name:{kind:"Name",value:"definition"}},{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"namespace"}},{kind:"Field",name:{kind:"Name",value:"stub"}},{kind:"Field",name:{kind:"Name",value:"title"}}]}},{kind:"Field",name:{kind:"Name",value:"metadata"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"createdAt"}},{kind:"Field",name:{kind:"Name",value:"ownerId"}},{kind:"Field",name:{kind:"Name",value:"lastUpdatedAt"}}]}}]}}]}}]}}]},$={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"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]};async function H(n,e,i,d,r){let a=`${n}/promptql-v2/artifacts/${e}/version/${i}/data`,t=await(typeof r=="function"?r:fetch)(a,{method:"GET",headers:d});if(t.status!==200){let he=t.body?await t.text():t.statusText;throw new Error(`[${t.status}] failed to download artifact: ${he}`)}return t.body?t.headers.get("Content-Type")?.startsWith("application/json")?t.json():t.text():null}async function J(n,e,i){let d=await n.query({query:q,variables:{threadId:i},fetchPolicy:"no-cache"});return d.data?.artifacts?.length?d.data.artifacts.filter(r=>r.latest_version_object).map(r=>({project_id:e,artifact_id:r.artifact_id,artifact_type:r.latest_version_object.artifact_type,version:r.latest_version_object.version,title:r.latest_version_object.title,description:r.latest_version_object.description??null,user_id:r.latest_version_object.user_id,metadata:r.latest_version_object.artifact_metadata,created_at:r.latest_version_object.created_at,size_bytes:Number.parseInt(r.latest_version_object.size)})):[]}async function X(n,e,i,d,r){let a=`${n}/promptql-v2/artifacts/${e}/version/${i}/metadata`,t=await(typeof r=="function"?r:fetch)(a,{method:"GET",headers:d});if(t.status!==200){let l=t.body?await t.text():t.statusText;throw new Error(`[${t.status}] failed to get artifact metadata: ${l}`)}return t.json()}function x(n,e){return n.query({query:R,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(i=>i.data?.rooms??[])}function Y(n,e){if(!e.name)throw new Error("Room name is required");let i=Oe(e.name);if(i)throw new Error(i);return n.mutate({mutation:N,variables:e,fetchPolicy:"no-cache"}).then(d=>{if(!d.data?.create_room?.room_id)throw new Error("expected room_id in response, got null");return d.data?.create_room?.room_id})}var Ee=/^[\p{Ll}\p{Lo}\p{N}]+([_-][\p{Ll}\p{Lo}\p{N}]+)*$/u,Z=80,Oe=n=>{let e=n.trim();return e.length===0?null:e.length>Z?`Room name must be ${Z} characters or less`:/[^\p{Ll}\p{Lo}\p{N}_-]/u.test(e)?"Only lowercase letters, numbers, hyphens, and underscores are allowed.":/^[_-]|[_-]$/.test(e)?"Room name should not start or end with a hyphen or underscore.":/[-_]{2,}/.test(e)?"Room name should not contain consecutive hyphens or underscores.":Ee.test(e)?null:"Room name is invalid. Only lowercase letters, numbers, hyphens, and underscores are allowed."};import{defer as Te,map as Ae,repeat as be,takeWhile as Se}from"rxjs";function ee(n,e){return n.query({query:G,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(i=>i.data?.threads_v2??[])}function ne(n,e){if(!e)throw new Error("threadId is required");return n.query({query:W,variables:{id:e},fetchPolicy:"no-cache"}).then(i=>i.data?.threads_v2_by_pk)}function ie(n,e,i){let d=le(e,i);return n.query({query:j,variables:{id:e,eventsWhere:d.where,eventsLimit:d.limit,eventsOrdering:d.ordering},fetchPolicy:"no-cache"}).then(r=>r.data?.threads_v2_by_pk)}function de(n,e){if(!e.message.trim())throw new Error("message must not be empty");return n.mutate({mutation:V,variables:e}).then(i=>{if(!i.data?.start_thread)throw new Error(i.error?.message||"Failed to start thread");return i.data.start_thread})}function v(n,e,i){return n.query({query:Q,variables:le(e,i),fetchPolicy:"no-cache"}).then(d=>d.data?.thread_events??[])}function re(n,e){if(!e.threadId)throw new Error("threadId is required");if(!e.message.trim())throw new Error("message must not be empty");return n.mutate({mutation:U,variables:e}).then(i=>{if(!i.data?.send_thread_message)throw new Error(i.error?.message||"Failed to send message to thread");return i.data.send_thread_message})}function te(n,e){if(!e.threadId)throw new Error("threadId is required");if(!e.messageId.trim())throw new Error("messageId is required");return n.mutate({mutation:C,variables:e}).then(i=>{if(!i.data?.cancel_agent_message)throw new Error(i.error?.message||"Failed to cancel thread");return i.data.cancel_agent_message.thread_event_id})}function ae(n,e,i){if(!e)throw new Error("threadId is required");B(i);let d={thread_id:{_eq:e}};return i&&(d.thread_event_id={_gte:i}),n.subscribe({query:$,variables:{where:d}}).pipe(Ae(r=>{if(r.error)throw r.error;return r.data?.thread_events??[]}))}function _e(n,e,i){if(!e)throw new Error("threadId is required");let d,r=B(i?.fromEventId),a={eventId:i?.fromEventId?{_gte:r}:void 0,messageId:i?.messageId},_=i?.pollingInterval&&i?.pollingInterval>0?i.pollingInterval:5;return Te(async()=>{let t=d?{messageId:i?.messageId,eventId:{_gt:d}}:a,l=await v(n,e,t);return l.length>0&&(d=l[l.length-1]?.thread_event_id),l}).pipe(be({count:i?.timeout&&i.timeout>0?Math.ceil(i.timeout/_):void 0,delay:_*1e3}),Se(t=>Pe(t,i?.skipAnalysis),!0))}function Pe(n,e){for(let i=n.length-1;i>=0;i--){let d=n[i];if("UserMessage"in d.event_data)return!0;if(!("AgentMessage"in d.event_data))return!1;let r=d.event_data.AgentMessage.update;if("content"in r&&("interaction_finished"in r.content||e&&"interaction_update"in r.content&&"main_agent"in r.content.interaction_update&&"completed"in r.content.interaction_update.main_agent)||"InteractionFinished"in r||e&&"OrchestratorUpdate"in r&&"GeneratedResponse"in r.OrchestratorUpdate.update)return!1}return!0}function Ce(n){return[{event_data:{_contains:{UserMessage:{message_id:n}}}},{event_data:{_contains:{AgentMessage:{message_id:n}}}},{event_data:{_contains:{UserCancel:{message_id:n}}}}]}var le=(n,e)=>{if(!n)throw new Error("threadId is required");let i={thread_id:{_eq:n}};return e&&(e.eventId&&(i.thread_event_id=e.eventId),e.messageId&&(i._or=Ce(e.messageId))),{where:i,limit:e?.limit,ordering:e?.ordering||"asc"}};var p=["guide","regular"];async function oe(n,e){let i=e.namespace||"regular";if(!p.includes(i))throw new Error(`Invalid namespace. Expected one of: ${p}`);if(i==="guide"){let _={deleted_at:{_is_null:!0}};return e.project_id&&(_.project_id={_eq:e.project_id}),e.query&&(_.page_title={_ilike:e.query.toLowerCase()}),Ue(n,{where:_,limit:e.limit,offset:e.offset,order_by:e.order_by||e.ordering?{[!e.order_by||e.order_by==="slug"?"id":e.order_by]:e.ordering||"asc"}:void 0})}let d=e.project_id||!e.include_stub||e.namespace||e.query,r={where:e.project_id?{project_id:{_eq:e.project_id},deleted_at:{_is_null:!0}}:{},order_by:e.order_by||e.ordering?{[e.order_by?e.order_by==="slug"?"page_id":e.order_by:"page_id"]:e.ordering||"asc"}:void 0};d||(r.offset=e.offset,r.limit=e.limit);let a=await Ne(n,r);return d?Fe(a,e):a}async function ue(n,e){if(!e.query)throw new Error("query is required");return n.query({query:K,variables:e,fetchPolicy:"no-cache"}).then(i=>i.data?.admin_wiki_search?{totalCount:i.data.admin_wiki_search.totalCount,results:i.data?.admin_wiki_search.results.map(({score:d,metadata:r,page:{id:a,..._}})=>({..._,score:d,stable_id:r.id,slug:a,created_at:r.createdAt,last_modified_at:r.lastUpdatedAt}))}:{totalCount:0,results:[]})}async function se(n,e,i,d){if(i=i||"regular",!p.includes(i))throw new Error(`Invalid namespace. Expected one of: ${p}`);if(!e)throw new Error("projectId is required");if(!d)throw new Error("identifier is required");if(i==="guide")return Me(n,{project_id:e,page_id:d});let r={project_id:{_eq:e},deleted_at:{_is_null:!0}};return b.test(d)?r.id={_eq:d}:r.page_id={_eq:d},Ve(n,{where:r})}function pe(n,{slug:e,...i}){if(!i.title)throw new Error("Wiki title is required");if(!i.stub&&!i.definition)throw new Error("Wiki definition is required");return n.mutate({mutation:M,variables:{pageId:e,pageContent:i},fetchPolicy:"no-cache"}).then(d=>d.data?.admin_wiki_add?.id)}function me(n,e,i){if(!e)throw new Error("ID of the wiki is required");return n.mutate({mutation:F,variables:{id:e,pageContent:i},fetchPolicy:"no-cache"}).then(d=>d.data?.admin_wiki_update?.buildVersion)}function fe(n,e){if(!e)throw new Error("ID of the wiki is required");return n.mutate({mutation:w,variables:{id:e},fetchPolicy:"no-cache"}).then(i=>i.data?.admin_wiki_delete?.buildVersion)}function Ne(n,e){return n.query({query:z,variables:e,fetchPolicy:"no-cache"}).then(i=>i.data?.admin_wiki.map(({page_id:d,id:r,...a})=>({...a,stable_id:r,slug:d}))??[])}function Ue(n,e){return n.query({query:I,variables:e,fetchPolicy:"no-cache"}).then(i=>i.data?.admin_guide_page?.map(d=>({stable_id:d.id,slug:d.id,created_at:d.created_at,last_modified_at:d.last_modified_at,title:d.page_title}))??[])}async function Ve(n,e){let i=await n.query({query:L,variables:e,fetchPolicy:"no-cache"}).then(d=>d.data?.admin_wiki.map(r=>({stable_id:r.id,slug:r.page_id,created_at:r.created_at,last_modified_at:r.last_modified_at,...r.content}))??[]);return i.length?i[0]:null}async function Me(n,e){let i=await n.query({query:D,variables:e,fetchPolicy:"no-cache"}).then(d=>d.data?.admin_guide_page?.map(r=>({stable_id:r.id,slug:r.id,created_at:r.created_at,last_modified_at:r.last_modified_at,title:r.page_title,details:r.details}))??[]);return i.length?i[0]:null}function Fe(n,e){if(!n.length||!e.include_stub&&!e.query&&!e.limit&&!e.offset)return n;let i=e.query?.toLowerCase(),d=n.filter(r=>!e.include_stub&&r.stub?!1:!!(!i||r.title.toLowerCase().includes(i)||r.definition&&r.definition.toLowerCase().includes(i)||r.aliases?.length&&r.aliases.some(a=>a.toLowerCase().includes(i))));return e.offset&&d.length&&(d=d.slice(e.offset)),e.limit&&e.limit<d.length&&(d=d.slice(0,e.limit)),d}var o="PromptQL TypeScript SDK";import{ApolloClient as we,ApolloLink as qe,HttpLink as Ie,InMemoryCache as De}from"@apollo/client";import{SetContextLink as Re}from"@apollo/client/link/context";import{GraphQLWsLink as Ge}from"@apollo/client/link/subscriptions";import{OperationTypeNode as We}from"graphql";import{createClient as je}from"graphql-ws";var ce=n=>{let e=new Ie({uri:n.url,fetch:n.fetch,headers:n.headers}),i=async t=>{let l=await n.getAuthToken();return{headers:{"User-Agent":o,...t,Authorization:`Bearer ${l}`}}},d=je({url:n.url,connectionParams:()=>i(n.headers),lazy:!0}),r=new Ge(d),a=new Re(({headers:t})=>i(t)),_=qe.split(({operationType:t})=>t===We.SUBSCRIPTION,r,a.concat(e));return{client:new we({link:_,cache:new De}),wsClient:d}};function Vn(n,e){if(!e.length)return[];if(!n.length)return e;let i=n[n.length-1];if(!i)return e;let d=BigInt(i.thread_event_id),r=e.length-1;for(;r>=0;r--){let a=e[r];if(BigInt(a?.thread_event_id)<=d)break}return e.slice(r+1)}function Mn(n){return"UserMessage"in n?n.UserMessage:null}function Fn(n){return"UserCancel"in n?n.UserCancel:null}function wn(n){return!("AgentMessage"in n)||!("OrchestratorUpdate"in n.AgentMessage.update)||!("PlanGenerationStarted"in n.AgentMessage.update.OrchestratorUpdate.update)?null:n.AgentMessage.update.OrchestratorUpdate.update.PlanGenerationStarted}function qn(n){let e=E(n);return!e||!("PlanStepGenerated"in e)?null:e.PlanStepGenerated}function In(n){return"AgentMessage"in n?"content"in n.AgentMessage.update&&"interaction_update"in n.AgentMessage.update.content&&"main_agent"in n.AgentMessage.update.content.interaction_update&&"completed"in n.AgentMessage.update.content.interaction_update.main_agent?{success:!0,message:n.AgentMessage.update.content.interaction_update.main_agent.completed.summary||"",modified_artifacts:[],generated_at:n.AgentMessage.update.timestamp,messageId:n.AgentMessage.message_id}:!("OrchestratorUpdate"in n.AgentMessage.update)||!("GeneratedResponse"in n.AgentMessage.update.OrchestratorUpdate.update)?null:{...n.AgentMessage.update.OrchestratorUpdate.update.GeneratedResponse.response,messageId:n.AgentMessage.message_id}:null}function Dn(n){return!("AgentMessage"in n)||!("MessageProcessingUpdate"in n.AgentMessage.update)||!("ProcessingStarted"in n.AgentMessage.update.MessageProcessingUpdate.update)?null:n.AgentMessage.update.MessageProcessingUpdate.update.ProcessingStarted}function Rn(n){return!("AgentMessage"in n)||!("MessageProcessingUpdate"in n.AgentMessage.update)||!("InteractionDecision"in n.AgentMessage.update.MessageProcessingUpdate.update)||!("AcceptInteraction"in n.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:n.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.AcceptInteraction}function Gn(n){return!("AgentMessage"in n)||!("MessageProcessingUpdate"in n.AgentMessage.update)||!("InteractionDecision"in n.AgentMessage.update.MessageProcessingUpdate.update)||!("DeclineInteraction"in n.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:n.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.DeclineInteraction}function h(n){return!("AgentMessage"in n)||!("PlanningDecisionUpdate"in n.AgentMessage.update)?null:n.AgentMessage.update.PlanningDecisionUpdate.update}function Wn(n){let e=h(n);return!e||!("Started"in e)?null:e.Started}function jn(n){let e=h(n);return!e||!("Completed"in e)?null:e.Completed}function Qn(n){let e=h(n);return!e||!("PlanningRequired"in e)?null:e.PlanningRequired}function zn(n){return!("AgentMessage"in n)||!("StartingOrchestrator"in n.AgentMessage.update)?null:n.AgentMessage.update.StartingOrchestrator}function E(n){return!("AgentMessage"in n)||!("OrchestratorUpdate"in n.AgentMessage.update)?null:n.AgentMessage.update.OrchestratorUpdate.update}function s(n){let e=E(n);return!e||!("ContextExplorerUpdate"in e)?null:e.ContextExplorerUpdate.update}function Ln(n){let e=s(n);return!e||!("Started"in e)?null:e.Started}function Kn(n){let e=s(n);return!e||!("Completed"in e)?null:e.Completed}function O(n){let e=s(n);return!e||!("WikiExplorerUpdate"in e)?null:e.WikiExplorerUpdate.update}function $n(n){let e=O(n);return!e||!("Started"in e)?null:e.Started}function Hn(n){let e=O(n);return!e||!("Completed"in e)?null:e.Completed}function Jn(n){let e=O(n);return!e||!("WikiInfoGenerated"in e)?null:e.WikiInfoGenerated}function T(n){let e=s(n);return!e||!("SchemaTasksGenerationUpdate"in e)?null:e.SchemaTasksGenerationUpdate.update}function Xn(n){let e=T(n);return!e||!("Started"in e)?null:e.Started}function Zn(n){let e=T(n);return!e||!("Completed"in e)?null:e.Completed}function Yn(n){let e=T(n);return!e||!("TasksGenerated"in e)?null:e.TasksGenerated}function u(n){let e=s(n);return!e||!("SchemaExplorerUpdate"in e)?null:e.SchemaExplorerUpdate.update}function ei(n){let e=u(n);return!e||!("Started"in e)?null:e.Started}function ni(n){let e=u(n);return!e||!("Completed"in e)?null:e.Completed}function ii(n){let e=u(n);return!e||!("CodeExecutionComplete"in e)?null:e.CodeExecutionComplete}function di(n){let e=u(n);return!e||!("CodeOutputAnalyzed"in e)?null:e.CodeOutputAnalyzed}function ri(n){let e=u(n);return!e||!("GeneratedCode"in e)?null:e.GeneratedCode}function ti(n){let e=u(n);return!e||!("SchemaExplored"in e)?null:e.SchemaExplored}function A(n){let e=E(n);return!e||!("StepUpdate"in e)?null:e.StepUpdate}function ai(n){let e=A(n);return!e||!("Programmer"in e.update)?null:e.update.Programmer}function _i(n){let e=A(n);return!e||!("UiProgrammer"in e.update)?null:e.update.UiProgrammer}function li(n){let e=A(n);return!e||!("SavedProgramRunner"in e.update)?null:e.update.SavedProgramRunner}function oi(n){if(!("AgentMessage"in n))return null;if("InteractionFinished"in n.AgentMessage.update){let e=n.AgentMessage.update.InteractionFinished.update;return"Completed"in e?{status:"completed",timestamp:e.Completed.completed_at,warnings:e.Completed.warnings,messageId:n.AgentMessage.message_id}:"Errored"in e?{status:"errored",timestamp:e.Errored.errored_at,messageId:n.AgentMessage.message_id,reason:typeof e.Errored.error=="string"?e.Errored.error:e.Errored.error.User.message}:"UserCancelled"in e?{status:"user_cancelled",timestamp:e.UserCancelled.cancelled_at,messageId:n.AgentMessage.message_id}:"AgentDeclined"in e?{status:"agent_declined",timestamp:e.AgentDeclined.declined_at,reason:e.AgentDeclined.reason,messageId:n.AgentMessage.message_id}:"ServerCancelled"in e?{status:"server_cancelled",timestamp:e.ServerCancelled.cancelled_at,messageId:n.AgentMessage.message_id}:{status:"unknown",messageId:n.AgentMessage.message_id}}if("content"in n.AgentMessage.update&&"interaction_finished"in n.AgentMessage.update.content){let e=n.AgentMessage.update.content.interaction_finished.outcome;return"errored"in e?{status:"errored",messageId:n.AgentMessage.message_id,reason:e.errored.user_facing_message||e.errored.raw_error,timestamp:n.AgentMessage.update.timestamp,warnings:e.errored.raw_error?[{message:e.errored.raw_error}]:[]}:"server_cancelled"in e?{status:"server_cancelled",messageId:n.AgentMessage.message_id,timestamp:n.AgentMessage.update.timestamp}:"user_cancelled"in e?{status:"user_cancelled",messageId:n.AgentMessage.message_id,timestamp:n.AgentMessage.update.timestamp}:"completed"in e?{status:"completed",messageId:n.AgentMessage.message_id,timestamp:n.AgentMessage.update.timestamp,warnings:e.completed.warnings}:{status:"unknown",messageId:n.AgentMessage.message_id}}return null}function ui(n){if(n){if("UserMessage"in n)return n.UserMessage.message_id;if("AgentMessage"in n)return n.AgentMessage.message_id;if("UserTeach"in n)return n.UserTeach.agent_message_id;if("UserCancel"in n)return n.UserCancel.message_id}}function ye(n){return`https://promptql.${n}/playground-v2-hge/v1/graphql`}var m=class{controlPlaneUrl;options;defaultTimezone;getAuthTokenFn;project;client;wsClient;constructor(e){if(this.options=e,!e.serviceAccountToken)throw new Error("serviceAccountToken must not be empty. If you haven't created any service account token yet, check out Hasura docs https://hasura.io/docs/3.0/project-configuration/project-management/service-accounts/#how-to-create-service-account");this.defaultTimezone=e.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone;let i=e.controlPlaneHost?S(e.controlPlaneHost):"https://data.pro.hasura.io";this.controlPlaneUrl=`${i}/v1/graphql`}async getAuthToken(){if(typeof this.getAuthTokenFn=="function")return this.getAuthTokenFn();let e=await this.getProjectInfo();return this.getAuthTokenFn=P({promptqlGraphQLUrl:e.promptqlGraphQLUrl,authHost:this.options.authHost,headers:ge(this.options.serviceAccountToken),fetch:this.options.fetch}),this.getAuthTokenFn()}async getGraphQLClient(){if(this.client)return this.client;let e=await this.getProjectInfo(),{client:i,wsClient:d}=ce({getAuthToken:this.getAuthToken.bind(this),url:e.promptqlGraphQLUrl,fetch:this.options.fetch,headers:this.options.headers});return this.wsClient=d,this.client=i,this.client}async getProjectInfo(){if(this.project)return this.project;let e={operationName:"GetDdnProjects",query:"query GetDdnProjects { ddn_projects(limit: 1) { id name private_ddn { fqdn path_routing_context path_routing_enabled }}}"},d=await(typeof this.options.fetch=="function"?this.options.fetch:fetch)(this.controlPlaneUrl,{method:"POST",headers:{...ge(this.options.serviceAccountToken),"User-Agent":o,"Content-Type":"application/json"},body:JSON.stringify(e)});if(d.status!==200){let _=d.body?await d.text():d.statusText;throw new Error(`[${d.status}] failed to get project info: ${_}`)}let r=await d.json();if(!r.data?.ddn_projects?.length)throw new Error("Project not found");let a=r.data.ddn_projects[0];return this.project={projectId:a.id,projectName:a.name,projectHost:`https://${a.name}.${a.private_ddn.fqdn}`,promptqlConsoleUrl:`https://prompt.ql.app/project/${a.name}`,promptqlGraphQLUrl:ye(a.private_ddn.fqdn)},this.project}close(){if(this.wsClient&&(this.wsClient.dispose(),this.wsClient=void 0),this.client){try{this.client.stop?.()}catch{}try{this.client.clearStore?.()}catch{}this.client=void 0,this.project=void 0,this.getAuthTokenFn=void 0}}};function ge(n){return{Authorization:`pat ${n}`}}var f=class{api;constructor(e){this.api=e}async listMetadataByThreadId(e){let i=await this.api.getProjectInfo(),d=await this.api.getGraphQLClient();return J(d,i.projectId,e)}async download(e,i){let d=await this.api.getProjectInfo(),r=await this.api.getAuthToken();return H(d.projectHost,e,i,ke(r),this.api.options.fetch)}async getMetadata(e,i){let d=await this.api.getProjectInfo(),r=await this.api.getAuthToken();return X(d.projectHost,e,i,ke(r),this.api.options.fetch)}};function ke(n){return{Authorization:`Bearer ${n}`,"User-Agent":o}}var c=class{api;constructor(e){this.api=e}info(){return this.api.getProjectInfo()}};var y=class{api;constructor(e){this.api=e}async list(e){let i=await this.api.getGraphQLClient();return x(i,{...e,limit:e.limit&&e.limit>0?e.limit:10})}async getByName(e){let i=await this.api.getGraphQLClient();return x(i,{where:{name:{_eq:e}},limit:1}).then(d=>d.length?d[0]??null:null)}async create(e){let i=await this.api.getGraphQLClient();return Y(i,e)}};import{from as Be,switchMap as xe}from"rxjs";var g=class{api;constructor(e){this.api=e}async list(e){let i=await this.api.getGraphQLClient();return ee(i,{...e,limit:e.limit&&e.limit>0?e.limit:10})}async get(e){if(!e)throw new Error("threadId is required");let i=await this.api.getGraphQLClient();return ne(i,e)}async start(e){let i=await this.api.getProjectInfo(),d=await this.api.getGraphQLClient();return de(d,{...e,projectId:i.projectId,buildId:e.buildId||this.api.options.buildId,timezone:e.timezone||this.api.defaultTimezone})}async detail(e,i){let d=await this.api.getGraphQLClient();return ie(d,e,i)}async getEvents(e,i){let d=await this.api.getGraphQLClient();return v(d,e,i)}async sendMessage(e){let i=await this.api.getGraphQLClient();return re(i,{...e,timezone:e.timezone||this.api.defaultTimezone})}async cancelAgentMessage(e){let i=await this.api.getGraphQLClient();return te(i,e)}subscribeEvents(e,i){return Be(this.api.getGraphQLClient()).pipe(xe(d=>ae(d,e,i)))}streamMessageEvents(e,i){return Be(this.api.getGraphQLClient()).pipe(xe(d=>_e(d,e,i)))}};var k=class{api;constructor(e){this.api=e}async list(e){let i=await this.api.getGraphQLClient();return oe(i,e)}async search(e){let i=await this.api.getGraphQLClient();return ue(i,e)}async get(e,i){let d=await this.api.getProjectInfo(),r=await this.api.getGraphQLClient();return se(r,d.projectId,e,i)}async create(e){let i=await this.api.getGraphQLClient();return pe(i,e)}async update(e,i){let d=await this.api.getGraphQLClient();return me(d,e,i)}async delete(e){let i=await this.api.getGraphQLClient();return fe(i,e)}};var ve=class{constructor(e){let i=new m(e);this.api=i,this.thread=new g(i),this.project=new c(i),this.room=new y(i),this.artifact=new f(i),this.wiki=new k(i)}api;thread;project;room;artifact;wiki;close(){this.api.close()}};export{ve as PromptQLSdk,Ee as ROOM_NAME_REGEX,o as USER_AGENT,ye as buildPromptQLUrl,te as cancelAgentMessage,ce as createApolloClient,Y as createRoom,pe as createWikiPage,fe as deleteWikiPage,Vn as diffThreadEvents,H as downloadArtifactData,In as getAgentGeneratedResponse,Rn as getAgentInteractionDecisionAcceptInteractionEvent,Gn as getAgentInteractionDecisionDeclineInteractionEvent,oi as getAgentInteractionFinishedEvent,Dn as getAgentMessageProcessingStartedEvent,Kn as getAgentOrchestratorContextExplorerCompletedEvent,Ln as getAgentOrchestratorContextExplorerStartedEvent,s as getAgentOrchestratorContextExplorerUpdateEvent,ii as getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent,di as getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent,ni as getAgentOrchestratorSchemaExplorerCompletedEvent,ri as getAgentOrchestratorSchemaExplorerGeneratedCodeEvent,ti as getAgentOrchestratorSchemaExplorerSchemaExploredEvent,ei as getAgentOrchestratorSchemaExplorerStartedEvent,u as getAgentOrchestratorSchemaExplorerUpdateEvent,Yn as getAgentOrchestratorSchemaTasksGeneratedEvent,Zn as getAgentOrchestratorSchemaTasksGenerationCompletedEvent,Xn as getAgentOrchestratorSchemaTasksGenerationStartedEvent,T as getAgentOrchestratorSchemaTasksGenerationUpdateEvent,ai as getAgentOrchestratorStepProgrammerEvent,li as getAgentOrchestratorStepSavedProgramRunnerEvent,_i as getAgentOrchestratorStepUiProgrammerEvent,A as getAgentOrchestratorStepUpdateEvent,E as getAgentOrchestratorUpdateEvent,Hn as getAgentOrchestratorWikiExplorerCompletedEvent,$n as getAgentOrchestratorWikiExplorerStartedEvent,O as getAgentOrchestratorWikiExplorerUpdateEvent,Jn as getAgentOrchestratorWikiInfoGeneratedEvent,wn as getAgentPlanGenerationStartedEvent,qn as getAgentPlanStepGeneratedEvent,jn as getAgentPlanningDecisionCompletedEvent,Qn as getAgentPlanningDecisionPlanningRequiredEvent,Wn as getAgentPlanningDecisionStartedEvent,h as getAgentPlanningDecisionUpdateEvent,zn as getAgentStartingOrchestratorEvent,X as getArtifactMetadata,ne as getThread,ie as getThreadAndEvents,ui as getThreadEventMessageId,v as getThreadEvents,Fn as getUserCancelEvent,Mn as getUserMessageEvent,se as getWikiPage,Pe as isInteractionAnalyzing,J as listArtifactMetadataByThreadId,x as listRooms,ee as listThreads,oe as listWikiPages,ue as searchWikiPages,re as sendThreadMessage,de as startThread,_e as streamThreadMessageEvents,ae as subscribeThreadEvents,me as updateWikiPage,Oe as validateRoomName};
|
|
1
|
+
import{a as b,c as B}from"./chunk-WIDMKT3J.mjs";var S={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"}}]}}]}}]},P={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateRoom"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"name"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"visibility"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"description"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"create_room"},arguments:[{kind:"Argument",name:{kind:"Name",value:"name"},value:{kind:"Variable",name:{kind:"Name",value:"name"}}},{kind:"Argument",name:{kind:"Name",value:"visibility"},value:{kind:"Variable",name:{kind:"Name",value:"visibility"}}},{kind:"Argument",name:{kind:"Name",value:"description"},value:{kind:"Variable",name:{kind:"Name",value:"description"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"room_id"}}]}}]}}]},N={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"}}]}}]}}]},C={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"StartThread"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"message"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"projectId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"timezone"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"roomId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"uploads"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UserUploadInput"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"visibility"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"createdFrom"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"start_thread"},arguments:[{kind:"Argument",name:{kind:"Name",value:"message"},value:{kind:"Variable",name:{kind:"Name",value:"message"}}},{kind:"Argument",name:{kind:"Name",value:"projectId"},value:{kind:"Variable",name:{kind:"Name",value:"projectId"}}},{kind:"Argument",name:{kind:"Name",value:"timezone"},value:{kind:"Variable",name:{kind:"Name",value:"timezone"}}},{kind:"Argument",name:{kind:"Name",value:"buildId"},value:{kind:"Variable",name:{kind:"Name",value:"buildId"}}},{kind:"Argument",name:{kind:"Name",value:"buildFqdn"},value:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}}},{kind:"Argument",name:{kind:"Name",value:"roomId"},value:{kind:"Variable",name:{kind:"Name",value:"roomId"}}},{kind:"Argument",name:{kind:"Name",value:"uploads"},value:{kind:"Variable",name:{kind:"Name",value:"uploads"}}},{kind:"Argument",name:{kind:"Name",value:"visibility"},value:{kind:"Variable",name:{kind:"Name",value:"visibility"}}},{kind:"Argument",name:{kind:"Name",value:"createdFrom"},value:{kind:"Variable",name:{kind:"Name",value:"createdFrom"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"thread_events"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"thread_event_id"}}]}}]}}]}}]},U={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateWikiPage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"pageContent"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"jsonb"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"pageId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki_add"},arguments:[{kind:"Argument",name:{kind:"Name",value:"pageContent"},value:{kind:"Variable",name:{kind:"Name",value:"pageContent"}}},{kind:"Argument",name:{kind:"Name",value:"pageId"},value:{kind:"Variable",name:{kind:"Name",value:"pageId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}}]}}]}}]},V={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"UpdateWikiPage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"pageContent"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"jsonb"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki_update"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}},{kind:"Argument",name:{kind:"Name",value:"pageContent"},value:{kind:"Variable",name:{kind:"Name",value:"pageContent"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"buildVersion"}}]}}]}}]},M={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"DeleteWikiPage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki_delete"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"buildVersion"}}]}}]}}]},F={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetArtifactsByThreadId"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"threadId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"artifacts"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_artifacts"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_id"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"_eq"},value:{kind:"Variable",name:{kind:"Name",value:"threadId"}}}]}}]}}]}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"updated_at"},value:{kind:"EnumValue",value:"asc"}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"artifact_id"}},{kind:"Field",name:{kind:"Name",value:"latest_version_object"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"user_id"}},{kind:"Field",name:{kind:"Name",value:"artifact_metadata"}},{kind:"Field",name:{kind:"Name",value:"artifact_type"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"size"}},{kind:"Field",name:{kind:"Name",value:"version"}}]}}]}}]}}]},I={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"ListGuidePages"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_guide_page_order_by"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_guide_page_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_guide_page"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"page_title"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"last_modified_at"}}]}}]}}]},q={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetGuidePage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"project_id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"page_id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_guide_page"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"project_id"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"_eq"},value:{kind:"Variable",name:{kind:"Name",value:"project_id"}}}]}},{kind:"ObjectField",name:{kind:"Name",value:"id"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"_eq"},value:{kind:"Variable",name:{kind:"Name",value:"page_id"}}}]}},{kind:"ObjectField",name:{kind:"Name",value:"deleted_at"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"_is_null"},value:{kind:"BooleanValue",value:!0}}]}}]}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"IntValue",value:"1"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"page_title"}},{kind:"Field",name:{kind:"Name",value:"details"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"last_modified_at"}}]}}]}}]},D={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"}}]}}]}}]},w={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetRooms"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"rooms_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"rooms_order_by"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}},defaultValue:{kind:"IntValue",value:"10"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"rooms"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Room"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Room"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"rooms"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"room_id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"project_id"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"user_id"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}}]}}]},R={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:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]},j={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreadById"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"threads_v2_by_pk"},arguments:[{kind:"Argument",name:{kind:"Name",value:"thread_id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Thread"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Thread"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"threads_v2"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"build_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"relevant_event_count"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]},G={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreadAndEventsById"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"eventsWhere"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"eventsLimit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"eventsOrdering"}},type:{kind:"NamedType",name:{kind:"Name",value:"order_by"}},defaultValue:{kind:"EnumValue",value:"asc"}}],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:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"eventsWhere"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"eventsLimit"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"Variable",name:{kind:"Name",value:"eventsOrdering"}}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}}]}},{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:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{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"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]},W={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreadEvents"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"ordering"}},type:{kind:"NamedType",name:{kind:"Name",value:"order_by"}},defaultValue:{kind:"EnumValue",value:"asc"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"Variable",name:{kind:"Name",value:"ordering"}}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadEvent"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"thread_events"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]},z={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"ListWikiPages"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_wiki_order_by"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_wiki_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki"},arguments:[{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}},{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"page_id"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"last_modified_at"}},{kind:"Field",alias:{kind:"Name",value:"title"},name:{kind:"Name",value:"content"},arguments:[{kind:"Argument",name:{kind:"Name",value:"path"},value:{kind:"StringValue",value:"title",block:!1}}]},{kind:"Field",alias:{kind:"Name",value:"stub"},name:{kind:"Name",value:"content"},arguments:[{kind:"Argument",name:{kind:"Name",value:"path"},value:{kind:"StringValue",value:"stub",block:!1}}]},{kind:"Field",alias:{kind:"Name",value:"aliases"},name:{kind:"Name",value:"content"},arguments:[{kind:"Argument",name:{kind:"Name",value:"path"},value:{kind:"StringValue",value:"aliases",block:!1}}]},{kind:"Field",alias:{kind:"Name",value:"definition"},name:{kind:"Name",value:"content"},arguments:[{kind:"Argument",name:{kind:"Name",value:"path"},value:{kind:"StringValue",value:"definition",block:!1}}]}]}}]}}]},Q={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetWikiPage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_wiki_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki"},arguments:[{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"IntValue",value:"1"}},{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"page_id"}},{kind:"Field",name:{kind:"Name",value:"content"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"last_modified_at"}}]}}]}}]},L={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"SearchWikiPages"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"query"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki_search"},arguments:[{kind:"Argument",name:{kind:"Name",value:"query"},value:{kind:"Variable",name:{kind:"Name",value:"query"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"totalCount"}},{kind:"Field",name:{kind:"Name",value:"results"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"score"}},{kind:"Field",name:{kind:"Name",value:"page"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"aliases"}},{kind:"Field",name:{kind:"Name",value:"definition"}},{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"namespace"}},{kind:"Field",name:{kind:"Name",value:"stub"}},{kind:"Field",name:{kind:"Name",value:"title"}}]}},{kind:"Field",name:{kind:"Name",value:"metadata"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"createdAt"}},{kind:"Field",name:{kind:"Name",value:"ownerId"}},{kind:"Field",name:{kind:"Name",value:"lastUpdatedAt"}}]}}]}}]}}]}}]},K={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"subscription",name:{kind:"Name",value:"SubscribeThreadEvents"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"EnumValue",value:"asc"}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadEvent"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"thread_events"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]};async function $(n,e,i,d,r){let a=`${n}/promptql-v2/artifacts/${e}/version/${i}/data`,t=await(typeof r=="function"?r:fetch)(a,{method:"GET",headers:d});if(t.status!==200){let ke=t.body?await t.text():t.statusText;throw new Error(`[${t.status}] failed to download artifact: ${ke}`)}return t.body?t.headers.get("Content-Type")?.startsWith("application/json")?t.json():t.text():null}async function J(n,e,i){let d=await n.query({query:F,variables:{threadId:i},fetchPolicy:"no-cache"});return d.data?.artifacts?.length?d.data.artifacts.filter(r=>r.latest_version_object).map(r=>({project_id:e,artifact_id:r.artifact_id,artifact_type:r.latest_version_object.artifact_type,version:r.latest_version_object.version,title:r.latest_version_object.title,description:r.latest_version_object.description??null,user_id:r.latest_version_object.user_id,metadata:r.latest_version_object.artifact_metadata,created_at:r.latest_version_object.created_at,size_bytes:Number.parseInt(r.latest_version_object.size)})):[]}async function H(n,e,i,d,r){let a=`${n}/promptql-v2/artifacts/${e}/version/${i}/metadata`,t=await(typeof r=="function"?r:fetch)(a,{method:"GET",headers:d});if(t.status!==200){let l=t.body?await t.text():t.statusText;throw new Error(`[${t.status}] failed to get artifact metadata: ${l}`)}return t.json()}function x(n,e){return n.query({query:w,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(i=>i.data?.rooms??[])}function Z(n,e){if(!e.name)throw new Error("Room name is required");let i=xe(e.name);if(i)throw new Error(i);return n.mutate({mutation:P,variables:e,fetchPolicy:"no-cache"}).then(d=>{if(!d.data?.create_room?.room_id)throw new Error("expected room_id in response, got null");return d.data?.create_room?.room_id})}var Be=/^[\p{Ll}\p{Lo}\p{N}]+([_-][\p{Ll}\p{Lo}\p{N}]+)*$/u,X=80,xe=n=>{let e=n.trim();return e.length===0?null:e.length>X?`Room name must be ${X} characters or less`:/[^\p{Ll}\p{Lo}\p{N}_-]/u.test(e)?"Only lowercase letters, numbers, hyphens, and underscores are allowed.":/^[_-]|[_-]$/.test(e)?"Room name should not start or end with a hyphen or underscore.":/[-_]{2,}/.test(e)?"Room name should not contain consecutive hyphens or underscores.":Be.test(e)?null:"Room name is invalid. Only lowercase letters, numbers, hyphens, and underscores are allowed."};import{defer as ve,map as he,repeat as Ee,takeWhile as Oe}from"rxjs";function Y(n,e){return n.query({query:R,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(i=>i.data?.threads_v2??[])}function ee(n,e){if(!e)throw new Error("threadId is required");return n.query({query:j,variables:{id:e},fetchPolicy:"no-cache"}).then(i=>i.data?.threads_v2_by_pk)}function ne(n,e,i){let d=_e(e,i);return n.query({query:G,variables:{id:e,eventsWhere:d.where,eventsLimit:d.limit,eventsOrdering:d.ordering},fetchPolicy:"no-cache"}).then(r=>r.data?.threads_v2_by_pk)}function ie(n,e){if(!e.message.trim())throw new Error("message must not be empty");return n.mutate({mutation:C,variables:e}).then(i=>{if(!i.data?.start_thread)throw new Error(i.error?.message||"Failed to start thread");return i.data.start_thread})}function v(n,e,i){return n.query({query:W,variables:_e(e,i),fetchPolicy:"no-cache"}).then(d=>d.data?.thread_events??[])}function de(n,e){if(!e.threadId)throw new Error("threadId is required");if(!e.message.trim())throw new Error("message must not be empty");return n.mutate({mutation:N,variables:e}).then(i=>{if(!i.data?.send_thread_message)throw new Error(i.error?.message||"Failed to send message to thread");return i.data.send_thread_message})}function re(n,e){if(!e.threadId)throw new Error("threadId is required");if(!e.messageId.trim())throw new Error("messageId is required");return n.mutate({mutation:S,variables:e}).then(i=>{if(!i.data?.cancel_agent_message)throw new Error(i.error?.message||"Failed to cancel thread");return i.data.cancel_agent_message.thread_event_id})}function te(n,e,i){if(!e)throw new Error("threadId is required");B(i);let d={thread_id:{_eq:e}};return i&&(d.thread_event_id={_gte:i}),n.subscribe({query:K,variables:{where:d}}).pipe(he(r=>{if(r.error)throw r.error;return r.data?.thread_events??[]}))}function ae(n,e,i){if(!e)throw new Error("threadId is required");let d,r=B(i?.fromEventId),a={eventId:i?.fromEventId?{_gte:r}:void 0,messageId:i?.messageId},_=i?.pollingInterval&&i?.pollingInterval>0?i.pollingInterval:5;return ve(async()=>{let t=d?{messageId:i?.messageId,eventId:{_gt:d}}:a,l=await v(n,e,t);return l.length>0&&(d=l[l.length-1]?.thread_event_id),l}).pipe(Ee({count:i?.timeout&&i.timeout>0?Math.ceil(i.timeout/_):void 0,delay:_*1e3}),Oe(t=>Te(t,i?.skipAnalysis),!0))}function Te(n,e){for(let i=n.length-1;i>=0;i--){let d=n[i];if("UserMessage"in d.event_data)return!0;if(!("AgentMessage"in d.event_data))return!1;let r=d.event_data.AgentMessage.update;if("content"in r&&("interaction_finished"in r.content||e&&"interaction_update"in r.content&&"main_agent"in r.content.interaction_update&&"completed"in r.content.interaction_update.main_agent)||"InteractionFinished"in r||e&&"OrchestratorUpdate"in r&&"GeneratedResponse"in r.OrchestratorUpdate.update)return!1}return!0}function Ae(n){return[{event_data:{_contains:{UserMessage:{message_id:n}}}},{event_data:{_contains:{AgentMessage:{message_id:n}}}},{event_data:{_contains:{UserCancel:{message_id:n}}}}]}var _e=(n,e)=>{if(!n)throw new Error("threadId is required");let i={thread_id:{_eq:n}};return e&&(e.eventId&&(i.thread_event_id=e.eventId),e.messageId&&(i._or=Ae(e.messageId))),{where:i,limit:e?.limit,ordering:e?.ordering||"asc"}};var p=["guide","regular"];async function le(n,e){let i=e.namespace||"regular";if(!p.includes(i))throw new Error(`Invalid namespace. Expected one of: ${p}`);if(i==="guide"){let _={deleted_at:{_is_null:!0}};return e.project_id&&(_.project_id={_eq:e.project_id}),e.query&&(_.page_title={_ilike:e.query.toLowerCase()}),Se(n,{where:_,limit:e.limit,offset:e.offset,order_by:e.order_by||e.ordering?{[!e.order_by||e.order_by==="slug"?"id":e.order_by]:e.ordering||"asc"}:void 0})}let d=e.project_id||!e.include_stub||e.namespace||e.query,r={where:e.project_id?{project_id:{_eq:e.project_id},deleted_at:{_is_null:!0}}:{},order_by:e.order_by||e.ordering?{[e.order_by?e.order_by==="slug"?"page_id":e.order_by:"page_id"]:e.ordering||"asc"}:void 0};d||(r.offset=e.offset,r.limit=e.limit);let a=await be(n,r);return d?Ce(a,e):a}async function oe(n,e){if(!e.query)throw new Error("query is required");return n.query({query:L,variables:e,fetchPolicy:"no-cache"}).then(i=>i.data?.admin_wiki_search?{totalCount:i.data.admin_wiki_search.totalCount,results:i.data?.admin_wiki_search.results.map(({score:d,metadata:r,page:{id:a,..._}})=>({..._,score:d,stable_id:r.id,slug:a,created_at:r.createdAt,last_modified_at:r.lastUpdatedAt}))}:{totalCount:0,results:[]})}async function ue(n,e,i,d){if(i=i||"regular",!p.includes(i))throw new Error(`Invalid namespace. Expected one of: ${p}`);if(!e)throw new Error("projectId is required");if(!d)throw new Error("identifier is required");if(i==="guide")return Ne(n,{project_id:e,page_id:d});let r={project_id:{_eq:e},deleted_at:{_is_null:!0}};return b.test(d)?r.id={_eq:d}:r.page_id={_eq:d},Pe(n,{where:r})}function se(n,{slug:e,...i}){if(!i.title)throw new Error("Wiki title is required");if(!i.stub&&!i.definition)throw new Error("Wiki definition is required");return n.mutate({mutation:U,variables:{pageId:e,pageContent:i},fetchPolicy:"no-cache"}).then(d=>d.data?.admin_wiki_add?.id)}function pe(n,e,i){if(!e)throw new Error("ID of the wiki is required");return n.mutate({mutation:V,variables:{id:e,pageContent:i},fetchPolicy:"no-cache"}).then(d=>d.data?.admin_wiki_update?.buildVersion)}function me(n,e){if(!e)throw new Error("ID of the wiki is required");return n.mutate({mutation:M,variables:{id:e},fetchPolicy:"no-cache"}).then(i=>i.data?.admin_wiki_delete?.buildVersion)}function be(n,e){return n.query({query:z,variables:e,fetchPolicy:"no-cache"}).then(i=>i.data?.admin_wiki.map(({page_id:d,id:r,...a})=>({...a,stable_id:r,slug:d}))??[])}function Se(n,e){return n.query({query:I,variables:e,fetchPolicy:"no-cache"}).then(i=>i.data?.admin_guide_page?.map(d=>({stable_id:d.id,slug:d.id,created_at:d.created_at,last_modified_at:d.last_modified_at,title:d.page_title}))??[])}async function Pe(n,e){let i=await n.query({query:Q,variables:e,fetchPolicy:"no-cache"}).then(d=>d.data?.admin_wiki.map(r=>({stable_id:r.id,slug:r.page_id,created_at:r.created_at,last_modified_at:r.last_modified_at,...r.content}))??[]);return i.length?i[0]:null}async function Ne(n,e){let i=await n.query({query:q,variables:e,fetchPolicy:"no-cache"}).then(d=>d.data?.admin_guide_page?.map(r=>({stable_id:r.id,slug:r.id,created_at:r.created_at,last_modified_at:r.last_modified_at,title:r.page_title,details:r.details}))??[]);return i.length?i[0]:null}function Ce(n,e){if(!n.length||!e.include_stub&&!e.query&&!e.limit&&!e.offset)return n;let i=e.query?.toLowerCase(),d=n.filter(r=>!e.include_stub&&r.stub?!1:!!(!i||r.title.toLowerCase().includes(i)||r.definition&&r.definition.toLowerCase().includes(i)||r.aliases?.length&&r.aliases.some(a=>a.toLowerCase().includes(i))));return e.offset&&d.length&&(d=d.slice(e.offset)),e.limit&&e.limit<d.length&&(d=d.slice(0,e.limit)),d}import{ApolloClient as Ue,ApolloLink as Ve,HttpLink as Me,InMemoryCache as Fe}from"@apollo/client";import{SetContextLink as Ie}from"@apollo/client/link/context";import{GraphQLWsLink as qe}from"@apollo/client/link/subscriptions";import{OperationTypeNode as De}from"graphql";import{createClient as we}from"graphql-ws";var fe=n=>{let e=new Me({uri:n.url,fetch:n.fetch,headers:typeof n.headers=="object"?n.headers:void 0}),i=async _=>{let t=typeof n.headers=="object"?n.headers:await n.headers();return{headers:{..._,...t}}},d=we({url:n.url,connectionParams:()=>i(),lazy:!0}),r=new qe(d),a=Ve.split(({operationType:_})=>_===De.SUBSCRIPTION,r,typeof n.headers=="object"?e:new Ie(({headers:_})=>i(_)).concat(e));return{client:new Ue({link:a,cache:new Fe}),wsClient:d}};var ce="PromptQL TypeScript SDK";function ti(n,e){if(!e.length)return[];if(!n.length)return e;let i=n[n.length-1];if(!i)return e;let d=BigInt(i.thread_event_id),r=e.length-1;for(;r>=0;r--){let a=e[r];if(BigInt(a?.thread_event_id)<=d)break}return e.slice(r+1)}function ai(n){return"UserMessage"in n?n.UserMessage:null}function _i(n){return"UserCancel"in n?n.UserCancel:null}function li(n){return!("AgentMessage"in n)||!("OrchestratorUpdate"in n.AgentMessage.update)||!("PlanGenerationStarted"in n.AgentMessage.update.OrchestratorUpdate.update)?null:n.AgentMessage.update.OrchestratorUpdate.update.PlanGenerationStarted}function oi(n){let e=E(n);return!e||!("PlanStepGenerated"in e)?null:e.PlanStepGenerated}function ui(n){return"AgentMessage"in n?"content"in n.AgentMessage.update&&"interaction_update"in n.AgentMessage.update.content&&"main_agent"in n.AgentMessage.update.content.interaction_update&&"completed"in n.AgentMessage.update.content.interaction_update.main_agent?{success:!0,message:n.AgentMessage.update.content.interaction_update.main_agent.completed.summary||"",modified_artifacts:[],generated_at:n.AgentMessage.update.timestamp,messageId:n.AgentMessage.message_id}:!("OrchestratorUpdate"in n.AgentMessage.update)||!("GeneratedResponse"in n.AgentMessage.update.OrchestratorUpdate.update)?null:{...n.AgentMessage.update.OrchestratorUpdate.update.GeneratedResponse.response,messageId:n.AgentMessage.message_id}:null}function si(n){return!("AgentMessage"in n)||!("MessageProcessingUpdate"in n.AgentMessage.update)||!("ProcessingStarted"in n.AgentMessage.update.MessageProcessingUpdate.update)?null:n.AgentMessage.update.MessageProcessingUpdate.update.ProcessingStarted}function pi(n){return!("AgentMessage"in n)||!("MessageProcessingUpdate"in n.AgentMessage.update)||!("InteractionDecision"in n.AgentMessage.update.MessageProcessingUpdate.update)||!("AcceptInteraction"in n.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:n.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.AcceptInteraction}function mi(n){return!("AgentMessage"in n)||!("MessageProcessingUpdate"in n.AgentMessage.update)||!("InteractionDecision"in n.AgentMessage.update.MessageProcessingUpdate.update)||!("DeclineInteraction"in n.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:n.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.DeclineInteraction}function h(n){return!("AgentMessage"in n)||!("PlanningDecisionUpdate"in n.AgentMessage.update)?null:n.AgentMessage.update.PlanningDecisionUpdate.update}function fi(n){let e=h(n);return!e||!("Started"in e)?null:e.Started}function ci(n){let e=h(n);return!e||!("Completed"in e)?null:e.Completed}function yi(n){let e=h(n);return!e||!("PlanningRequired"in e)?null:e.PlanningRequired}function gi(n){return!("AgentMessage"in n)||!("StartingOrchestrator"in n.AgentMessage.update)?null:n.AgentMessage.update.StartingOrchestrator}function E(n){return!("AgentMessage"in n)||!("OrchestratorUpdate"in n.AgentMessage.update)?null:n.AgentMessage.update.OrchestratorUpdate.update}function u(n){let e=E(n);return!e||!("ContextExplorerUpdate"in e)?null:e.ContextExplorerUpdate.update}function ki(n){let e=u(n);return!e||!("Started"in e)?null:e.Started}function Bi(n){let e=u(n);return!e||!("Completed"in e)?null:e.Completed}function O(n){let e=u(n);return!e||!("WikiExplorerUpdate"in e)?null:e.WikiExplorerUpdate.update}function xi(n){let e=O(n);return!e||!("Started"in e)?null:e.Started}function vi(n){let e=O(n);return!e||!("Completed"in e)?null:e.Completed}function hi(n){let e=O(n);return!e||!("WikiInfoGenerated"in e)?null:e.WikiInfoGenerated}function T(n){let e=u(n);return!e||!("SchemaTasksGenerationUpdate"in e)?null:e.SchemaTasksGenerationUpdate.update}function Ei(n){let e=T(n);return!e||!("Started"in e)?null:e.Started}function Oi(n){let e=T(n);return!e||!("Completed"in e)?null:e.Completed}function Ti(n){let e=T(n);return!e||!("TasksGenerated"in e)?null:e.TasksGenerated}function o(n){let e=u(n);return!e||!("SchemaExplorerUpdate"in e)?null:e.SchemaExplorerUpdate.update}function Ai(n){let e=o(n);return!e||!("Started"in e)?null:e.Started}function bi(n){let e=o(n);return!e||!("Completed"in e)?null:e.Completed}function Si(n){let e=o(n);return!e||!("CodeExecutionComplete"in e)?null:e.CodeExecutionComplete}function Pi(n){let e=o(n);return!e||!("CodeOutputAnalyzed"in e)?null:e.CodeOutputAnalyzed}function Ni(n){let e=o(n);return!e||!("GeneratedCode"in e)?null:e.GeneratedCode}function Ci(n){let e=o(n);return!e||!("SchemaExplored"in e)?null:e.SchemaExplored}function A(n){let e=E(n);return!e||!("StepUpdate"in e)?null:e.StepUpdate}function Ui(n){let e=A(n);return!e||!("Programmer"in e.update)?null:e.update.Programmer}function Vi(n){let e=A(n);return!e||!("UiProgrammer"in e.update)?null:e.update.UiProgrammer}function Mi(n){let e=A(n);return!e||!("SavedProgramRunner"in e.update)?null:e.update.SavedProgramRunner}function Fi(n){if(!("AgentMessage"in n))return null;if("InteractionFinished"in n.AgentMessage.update){let e=n.AgentMessage.update.InteractionFinished.update;return"Completed"in e?{status:"completed",timestamp:e.Completed.completed_at,warnings:e.Completed.warnings,messageId:n.AgentMessage.message_id}:"Errored"in e?{status:"errored",timestamp:e.Errored.errored_at,messageId:n.AgentMessage.message_id,reason:typeof e.Errored.error=="string"?e.Errored.error:e.Errored.error.User.message}:"UserCancelled"in e?{status:"user_cancelled",timestamp:e.UserCancelled.cancelled_at,messageId:n.AgentMessage.message_id}:"AgentDeclined"in e?{status:"agent_declined",timestamp:e.AgentDeclined.declined_at,reason:e.AgentDeclined.reason,messageId:n.AgentMessage.message_id}:"ServerCancelled"in e?{status:"server_cancelled",timestamp:e.ServerCancelled.cancelled_at,messageId:n.AgentMessage.message_id}:{status:"unknown",messageId:n.AgentMessage.message_id}}if("content"in n.AgentMessage.update&&"interaction_finished"in n.AgentMessage.update.content){let e=n.AgentMessage.update.content.interaction_finished.outcome;return"errored"in e?{status:"errored",messageId:n.AgentMessage.message_id,reason:e.errored.user_facing_message||e.errored.raw_error,timestamp:n.AgentMessage.update.timestamp,warnings:e.errored.raw_error?[{message:e.errored.raw_error}]:[]}:"server_cancelled"in e?{status:"server_cancelled",messageId:n.AgentMessage.message_id,timestamp:n.AgentMessage.update.timestamp}:"user_cancelled"in e?{status:"user_cancelled",messageId:n.AgentMessage.message_id,timestamp:n.AgentMessage.update.timestamp}:"completed"in e?{status:"completed",messageId:n.AgentMessage.message_id,timestamp:n.AgentMessage.update.timestamp,warnings:e.completed.warnings}:{status:"unknown",messageId:n.AgentMessage.message_id}}return null}function Ii(n){if(n){if("UserMessage"in n)return n.UserMessage.message_id;if("AgentMessage"in n)return n.AgentMessage.message_id;if("UserTeach"in n)return n.UserTeach.agent_message_id;if("UserCancel"in n)return n.UserCancel.message_id}}function s(n){return{Authorization:`pat ${n}`,"User-Agent":ce}}var ye="https://promptql.ddn.hasura.app",m=class{options;defaultTimezone;client;wsClient;project;constructor(e){if(this.options=e,!e.accessToken)throw new Error("accessToken is required");this.defaultTimezone=e.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone;let i=new URL(this.options.baseUrl||ye);i.pathname="/playground-v2-hge/v1/graphql";let{client:d,wsClient:r}=fe({url:i.toString(),fetch:this.options.fetch,headers:Object.assign(s(this.options.accessToken),this.options.headers)});this.wsClient=r,this.client=d}async getProjectInfo(){if(this.project)return this.project;let i=(await this.client.query({query:D,fetchPolicy:"no-cache"})).data?.get_project_info;if(!i)throw new Error("Project not found");let d=new URL(this.options.baseUrl||ye);return d.hostname.startsWith("promptql.")&&(d.hostname=`${i.projectName}${d.hostname.slice(8)}`),this.project={projectId:i.projectId,projectName:i.projectName,projectHost:d.toString(),promptqlConsoleUrl:`https://prompt.ql.app/project/${i.projectName}`},this.project}close(){if(this.wsClient&&this.wsClient.dispose(),this.client){try{this.client.stop?.()}catch{}try{this.client.clearStore?.()}catch{}this.project=void 0}}};var f=class{api;constructor(e){this.api=e}async listMetadataByThreadId(e){let i=await this.api.getProjectInfo();return J(this.api.client,i.projectId,e)}async download(e,i){let d=await this.api.getProjectInfo();return $(d.projectHost,e,i,s(this.api.options.accessToken),this.api.options.fetch)}async getMetadata(e,i){let d=await this.api.getProjectInfo();return H(d.projectHost,e,i,s(this.api.options.accessToken),this.api.options.fetch)}};var c=class{api;constructor(e){this.api=e}info(){return this.api.getProjectInfo()}};var y=class{api;constructor(e){this.api=e}async list(e){return x(this.api.client,{...e,limit:e.limit&&e.limit>0?e.limit:10})}async getByName(e){return x(this.api.client,{where:{name:{_eq:e}},limit:1}).then(i=>i.length?i[0]??null:null)}async create(e){return Z(this.api.client,e)}};var g=class{api;constructor(e){this.api=e}async list(e){return Y(this.api.client,{...e,limit:e.limit&&e.limit>0?e.limit:10})}async get(e){if(!e)throw new Error("threadId is required");return ee(this.api.client,e)}async start(e){let i=await this.api.getProjectInfo();return ie(this.api.client,{...e,projectId:i.projectId,buildId:e.buildId||this.api.options.buildId,timezone:e.timezone||this.api.defaultTimezone})}async detail(e,i){return ne(this.api.client,e,i)}async getEvents(e,i){return v(this.api.client,e,i)}async sendMessage(e){return de(this.api.client,{...e,timezone:e.timezone||this.api.defaultTimezone})}async cancelAgentMessage(e){return re(this.api.client,e)}subscribeEvents(e,i){return te(this.api.client,e,i)}streamMessageEvents(e,i){return ae(this.api.client,e,i)}};var k=class{api;constructor(e){this.api=e}async list(e){return le(this.api.client,e)}async search(e){return oe(this.api.client,e)}async get(e,i){let d=await this.api.getProjectInfo();return ue(this.api.client,d.projectId,e,i)}async create(e){return se(this.api.client,e)}async update(e,i){return pe(this.api.client,e,i)}async delete(e){return me(this.api.client,e)}};var ge=class{constructor(e){let i=new m(e);this.api=i,this.thread=new g(i),this.project=new c(i),this.room=new y(i),this.artifact=new f(i),this.wiki=new k(i)}api;thread;project;room;artifact;wiki;close(){this.api.close()}};export{ge as PromptQLSdk,Be as ROOM_NAME_REGEX,ce as USER_AGENT,s as buildAuthHeader,re as cancelAgentMessage,fe as createApolloClient,Z as createRoom,se as createWikiPage,me as deleteWikiPage,ti as diffThreadEvents,$ as downloadArtifactData,ui as getAgentGeneratedResponse,pi as getAgentInteractionDecisionAcceptInteractionEvent,mi as getAgentInteractionDecisionDeclineInteractionEvent,Fi as getAgentInteractionFinishedEvent,si as getAgentMessageProcessingStartedEvent,Bi as getAgentOrchestratorContextExplorerCompletedEvent,ki as getAgentOrchestratorContextExplorerStartedEvent,u as getAgentOrchestratorContextExplorerUpdateEvent,Si as getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent,Pi as getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent,bi as getAgentOrchestratorSchemaExplorerCompletedEvent,Ni as getAgentOrchestratorSchemaExplorerGeneratedCodeEvent,Ci as getAgentOrchestratorSchemaExplorerSchemaExploredEvent,Ai as getAgentOrchestratorSchemaExplorerStartedEvent,o as getAgentOrchestratorSchemaExplorerUpdateEvent,Ti as getAgentOrchestratorSchemaTasksGeneratedEvent,Oi as getAgentOrchestratorSchemaTasksGenerationCompletedEvent,Ei as getAgentOrchestratorSchemaTasksGenerationStartedEvent,T as getAgentOrchestratorSchemaTasksGenerationUpdateEvent,Ui as getAgentOrchestratorStepProgrammerEvent,Mi as getAgentOrchestratorStepSavedProgramRunnerEvent,Vi as getAgentOrchestratorStepUiProgrammerEvent,A as getAgentOrchestratorStepUpdateEvent,E as getAgentOrchestratorUpdateEvent,vi as getAgentOrchestratorWikiExplorerCompletedEvent,xi as getAgentOrchestratorWikiExplorerStartedEvent,O as getAgentOrchestratorWikiExplorerUpdateEvent,hi as getAgentOrchestratorWikiInfoGeneratedEvent,li as getAgentPlanGenerationStartedEvent,oi as getAgentPlanStepGeneratedEvent,ci as getAgentPlanningDecisionCompletedEvent,yi as getAgentPlanningDecisionPlanningRequiredEvent,fi as getAgentPlanningDecisionStartedEvent,h as getAgentPlanningDecisionUpdateEvent,gi as getAgentStartingOrchestratorEvent,H as getArtifactMetadata,ee as getThread,ne as getThreadAndEvents,Ii as getThreadEventMessageId,v as getThreadEvents,_i as getUserCancelEvent,ai as getUserMessageEvent,ue as getWikiPage,Te as isInteractionAnalyzing,J as listArtifactMetadataByThreadId,x as listRooms,Y as listThreads,le as listWikiPages,oe as searchWikiPages,de as sendThreadMessage,ie as startThread,ae as streamThreadMessageEvents,te as subscribeThreadEvents,pe as updateWikiPage,xe as validateRoomName};
|
package/package.json
CHANGED
package/dist/chunk-7AMW5GJT.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var m=/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;function h(e){return e=e?e.trim():"",e?e[e.length-1]==="/"?e.slice(0,e.length-1):e:""}function k(e){if(e==null)return null;try{Number.parseInt(e)}catch{throw new Error("invalid threadEventId")}return e}function p(e){return e!=null&&typeof e=="object"&&"status"in e&&e.status==="failure"}function d(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 L(e){let a=`${h(e.authHost)||"https://auth.pro.hasura.io"}/ddn/promptql/token`,n={token:"",expiry:new Date(0)},s=e.fetch||fetch,o=async()=>{let r=await s(a,{method:"POST",headers:e.headers});switch(r.status){case 200:{let t=await r.json();if(d(t))return t;throw new Error("malformed token response")}case 401:{let t=await r.json();throw p(t)?new Error(t?.error||r.statusText):new Error(r.statusText)}default:{let t=await r.text();throw new Error(t)}}};return async()=>{if(n.expiry.getTime()<=Date.now()+1e3){let r=await o(),t=await f(e.promptqlGraphQLUrl,r.token,e.projectId,s);n.token=t;let c=new Date(r.expiry);if(Number.isNaN(c.getTime())){let u=new Date;u.setHours(1),n.expiry=u}else n.expiry=c}return n.token}}var f=async(e,i,a,n=fetch)=>{let s=await n(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:i,projectId:a},operationName:"EnrichToken"})});switch(s.status){case 200:{let o=await s.json();if(!l(o)||!o.data?.enrich_token?.userDirectoryJWT)throw new Error(`malformed promptql token response: ${JSON.stringify(o)}`);return o.data.enrich_token.userDirectoryJWT}default:{let o=await s.text();throw new Error(o)}}};export{m as a,h as b,k as c,p as d,d as e,l as f,L as g,f as h};
|