@hasura/promptql 2.0.0-alpha.37 → 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.d.mts +3 -2
- package/dist/auth/index.d.ts +3 -2
- package/dist/auth/index.js +1 -1
- package/dist/auth/index.mjs +1 -1
- package/dist/chunk-WIDMKT3J.mjs +1 -0
- package/dist/index.d.mts +2917 -28
- package/dist/index.d.ts +2917 -28
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
- package/dist/chunk-JCZJQNYI.mjs +0 -1
- package/dist/graphql-Bv72OcvQ.d.mts +0 -2782
- package/dist/graphql-Bv72OcvQ.d.ts +0 -2782
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var P=Object.defineProperty;var Te=Object.getOwnPropertyDescriptor;var Re=Object.getOwnPropertyNames;var Ue=Object.prototype.hasOwnProperty;var we=(t,e)=>{for(var a in e)P(t,a,{get:e[a],enumerable:!0})},Fe=(t,e,a,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let _ of Re(e))!Ue.call(t,_)&&_!==a&&P(t,_,{get:()=>e[_],enumerable:!(r=Te(e,_))||r.enumerable});return t};var je=t=>Fe(P({},"__esModule",{value:!0}),t);var ht={};we(ht,{PromptQLSdk:()=>Z,ROOM_NAME_REGEX:()=>Me,USER_AGENT:()=>d,buildPromptQLUrl:()=>X,cancelAgentMessage:()=>q,createApolloClient:()=>$,createRoom:()=>w,createWikiPage:()=>J,deleteWikiPage:()=>H,diffThreadEvents:()=>Qe,downloadArtifactData:()=>T,getAgentGeneratedResponse:()=>$e,getAgentInteractionDecisionAcceptInteractionEvent:()=>Ze,getAgentInteractionDecisionDeclineInteractionEvent:()=>Ye,getAgentInteractionFinishedEvent:()=>At,getAgentMessageProcessingStartedEvent:()=>Xe,getAgentOrchestratorContextExplorerCompletedEvent:()=>nt,getAgentOrchestratorContextExplorerStartedEvent:()=>_t,getAgentOrchestratorContextExplorerUpdateEvent:()=>c,getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent:()=>lt,getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent:()=>bt,getAgentOrchestratorSchemaExplorerCompletedEvent:()=>ct,getAgentOrchestratorSchemaExplorerGeneratedCodeEvent:()=>mt,getAgentOrchestratorSchemaExplorerSchemaExploredEvent:()=>It,getAgentOrchestratorSchemaExplorerStartedEvent:()=>yt,getAgentOrchestratorSchemaExplorerUpdateEvent:()=>y,getAgentOrchestratorSchemaTasksGeneratedEvent:()=>dt,getAgentOrchestratorSchemaTasksGenerationCompletedEvent:()=>ut,getAgentOrchestratorSchemaTasksGenerationStartedEvent:()=>st,getAgentOrchestratorSchemaTasksGenerationUpdateEvent:()=>h,getAgentOrchestratorStepProgrammerEvent:()=>Mt,getAgentOrchestratorStepSavedProgramRunnerEvent:()=>St,getAgentOrchestratorStepUiProgrammerEvent:()=>gt,getAgentOrchestratorStepUpdateEvent:()=>x,getAgentOrchestratorUpdateEvent:()=>A,getAgentOrchestratorWikiExplorerCompletedEvent:()=>ot,getAgentOrchestratorWikiExplorerStartedEvent:()=>it,getAgentOrchestratorWikiExplorerUpdateEvent:()=>f,getAgentOrchestratorWikiInfoGeneratedEvent:()=>pt,getAgentPlanGenerationStartedEvent:()=>Ke,getAgentPlanStepGeneratedEvent:()=>He,getAgentPlanningDecisionCompletedEvent:()=>tt,getAgentPlanningDecisionPlanningRequiredEvent:()=>at,getAgentPlanningDecisionStartedEvent:()=>et,getAgentPlanningDecisionUpdateEvent:()=>S,getAgentStartingOrchestratorEvent:()=>rt,getArtifactMetadata:()=>U,getThread:()=>V,getThreadEventMessageId:()=>ft,getThreadEvents:()=>M,getUserCancelEvent:()=>Je,getUserMessageEvent:()=>Le,getWikiPage:()=>L,isInteractionAnalyzing:()=>Ae,listArtifactMetadataByThreadId:()=>R,listRooms:()=>m,listThreads:()=>j,listWikiPages:()=>G,searchWikiPages:()=>Q,sendThreadMessage:()=>W,startThread:()=>N,streamThreadMessageEvents:()=>D,subscribeThreadEvents:()=>z,updateWikiPage:()=>K,validateRoomName:()=>ge});module.exports=je(ht);var Y={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"}}]}}]}}]},ee={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"}}]}}]}}]},te={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"}}]}}]}}]},ae={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"}}]}}]}}]}}]},re={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"}}]}}]}}]},_e={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"}}]}}]}}]},ne={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"}}]}}]}}]},ie={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"}}]}}]}}]}}]},oe={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"}}]}}]}}]},pe={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"}}]}}]}}]},se={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"}}]}}]},ue={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreads"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"threads_v2_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"threads_v2_order_by"}}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"threads_v2"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Thread"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Thread"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"threads_v2"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"build_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"relevant_event_count"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}},{kind:"Field",name:{kind:"Name",value:"email"}},{kind:"Field",name:{kind:"Name",value:"is_active"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}}]}}]}}]},de={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreadById"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"threads_v2_by_pk"},arguments:[{kind:"Argument",name:{kind:"Name",value:"thread_id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Thread"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Thread"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"threads_v2"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"build_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"relevant_event_count"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}},{kind:"Field",name:{kind:"Name",value:"email"}},{kind:"Field",name:{kind:"Name",value:"is_active"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}}]}}]}}]},ye={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreadEvents"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"ordering"}},type:{kind:"NamedType",name:{kind:"Name",value:"order_by"}},defaultValue:{kind:"EnumValue",value:"asc"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"Variable",name:{kind:"Name",value:"ordering"}}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadEvent"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"thread_events"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"user_id"}}]}}]},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}}]}]}}]}}]},le={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"}}]}}]}}]},be={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"}}]}}]}}]}}]}}]},me={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"subscription",name:{kind:"Name",value:"SubscribeThreadEvents"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"EnumValue",value:"asc"}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadEvent"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"thread_events"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"user_id"}}]}}]};async function T(t,e,a,r,_){let i=`${t}/promptql-v2/artifacts/${e}/version/${a}/data`,n=await(typeof _=="function"?_:fetch)(i,{method:"GET",headers:r});if(n.status!==200){let b=n.body?await n.text():n.statusText;throw new Error(`[${n.status}] failed to download artifact: ${b}`)}return n.body?n.headers.get("Content-Type")?.startsWith("application/json")?n.json():n.text():null}async function R(t,e,a){let r=await t.query({query:ie,variables:{threadId:a},fetchPolicy:"no-cache"});return r.data?.artifacts?.length?r.data.artifacts.filter(_=>_.latest_version_object).map(_=>({project_id:e,artifact_id:_.artifact_id,artifact_type:_.latest_version_object.artifact_type,version:_.latest_version_object.version,title:_.latest_version_object.title,description:_.latest_version_object.description??null,user_id:_.latest_version_object.user_id,metadata:_.latest_version_object.artifact_metadata,created_at:_.latest_version_object.created_at,size_bytes:Number.parseInt(_.latest_version_object.size)})):[]}async function U(t,e,a,r,_){let i=`${t}/promptql-v2/artifacts/${e}/version/${a}/metadata`,n=await(typeof _=="function"?_:fetch)(i,{method:"GET",headers:r});if(n.status!==200){let p=n.body?await n.text():n.statusText;throw new Error(`[${n.status}] failed to get artifact metadata: ${p}`)}return n.json()}function m(t,e){return t.query({query:se,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(a=>a.data?.rooms??[])}function w(t,e){if(!e.name)throw new Error("Room name is required");let a=ge(e.name);if(a)throw new Error(a);return t.mutate({mutation:ee,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 Me=/^[\p{Ll}\p{Lo}\p{N}]+([_-][\p{Ll}\p{Lo}\p{N}]+)*$/u,Ie=80,ge=t=>{let e=t.trim();return e.length===0?null:e.length>Ie?`Room name must be ${Ie} 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.":Me.test(e)?null:"Room name is invalid. Only lowercase letters, numbers, hyphens, and underscores are allowed."};var s=require("rxjs");var Se=/^[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 I(t){return t=t?t.trim():"",t?t[t.length-1]==="/"?t.slice(0,t.length-1):t:""}function F(t){if(t==null)return null;try{Number.parseInt(t)}catch{throw new Error("invalid threadEventId")}return t}function j(t,e){return t.query({query:ue,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2??[])}function V(t,e){if(!e)throw new Error("threadId is required");return t.query({query:de,variables:{id:e},fetchPolicy:"no-cache"}).then(a=>a.data?.threads_v2_by_pk)}function N(t,e){if(!e.message.trim())throw new Error("message must not be empty");return t.mutate({mutation:ae,variables:e}).then(a=>{if(!a.data?.start_thread)throw new Error(a.error?.message||"Failed to start thread");return a.data.start_thread})}function M(t,e,a){if(!e)throw new Error("threadId is required");let r={thread_id:{_eq:e}};return a&&(a.eventId&&(r.thread_event_id=a.eventId),a.messageId&&(r._or=Ve(a.messageId))),t.query({query:ye,variables:{where:r,limit:a?.limit,ordering:a?.ordering||"asc"},fetchPolicy:"no-cache"}).then(_=>_.data?.thread_events??[])}function W(t,e){if(!e.threadId)throw new Error("threadId is required");if(!e.message.trim())throw new Error("message must not be empty");return t.mutate({mutation:te,variables:e}).then(a=>{if(!a.data?.send_thread_message)throw new Error(a.error?.message||"Failed to send message to thread");return a.data.send_thread_message})}function q(t,e){if(!e.threadId)throw new Error("threadId is required");if(!e.messageId.trim())throw new Error("messageId is required");return t.mutate({mutation:Y,variables:e}).then(a=>{if(!a.data?.cancel_agent_message)throw new Error(a.error?.message||"Failed to cancel thread");return a.data.cancel_agent_message})}function z(t,e,a){if(!e)throw new Error("threadId is required");F(a);let r={thread_id:{_eq:e}};return a&&(r.thread_event_id={_gte:a}),t.subscribe({query:me,variables:{where:r}}).pipe((0,s.map)(_=>{if(_.error)throw _.error;return _.data?.thread_events??[]}))}function D(t,e,a){if(!e)throw new Error("threadId is required");let r,_=F(a?.fromEventId),i={eventId:a?.fromEventId?{_gte:_}:void 0,messageId:a?.messageId},o=a?.pollingInterval&&a?.pollingInterval>0?a.pollingInterval:5;return(0,s.defer)(async()=>{let n=r?{messageId:a?.messageId,eventId:{_gt:r}}:i,p=await M(t,e,n);return p.length>0&&(r=p[p.length-1]?.thread_event_id),p}).pipe((0,s.repeat)({count:a?.timeout&&a.timeout>0?Math.ceil(a.timeout/o):void 0,delay:o*1e3}),(0,s.takeWhile)(n=>Ae(n,a?.skipAnalysis),!0))}function Ae(t,e){for(let a=t.length-1;a>=0;a--){let r=t[a];if("UserMessage"in r.event_data)return!0;if(!("AgentMessage"in r.event_data))return!1;let _=r.event_data.AgentMessage.update;if("content"in _&&("interaction_finished"in _.content||e&&"interaction_update"in _.content&&"main_agent"in _.content.interaction_update&&"completed"in _.content.interaction_update.main_agent)||"InteractionFinished"in _||e&&"OrchestratorUpdate"in _&&"GeneratedResponse"in _.OrchestratorUpdate.update)return!1}return!0}function Ve(t){return[{event_data:{_contains:{UserMessage:{message_id:t}}}},{event_data:{_contains:{AgentMessage:{message_id:t}}}},{event_data:{_contains:{UserCancel:{message_id:t}}}}]}var g=["guide","regular"];async function G(t,e){let a=e.namespace||"regular";if(!g.includes(a))throw new Error(`Invalid namespace. Expected one of: ${g}`);if(a==="guide"){let o={deleted_at:{_is_null:!0}};return e.project_id&&(o.project_id={_eq:e.project_id}),e.query&&(o.page_title={_ilike:e.query.toLowerCase()}),We(t,{where:o,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,_={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||(_.offset=e.offset,_.limit=e.limit);let i=await Ne(t,_);return r?De(i,e):i}async function Q(t,e){if(!e.query)throw new Error("query is required");return t.query({query:be,variables:e,fetchPolicy:"no-cache"}).then(a=>a.data?.admin_wiki_search?{totalCount:a.data.admin_wiki_search.totalCount,results:a.data?.admin_wiki_search.results.map(({score:r,metadata:_,page:{id:i,...o}})=>({...o,score:r,stable_id:_.id,slug:i,created_at:_.createdAt,last_modified_at:_.lastUpdatedAt}))}:{totalCount:0,results:[]})}async function L(t,e,a,r){if(a=a||"regular",!g.includes(a))throw new Error(`Invalid namespace. Expected one of: ${g}`);if(!e)throw new Error("projectId is required");if(!r)throw new Error("identifier is required");if(a==="guide")return ze(t,{project_id:e,page_id:r});let _={project_id:{_eq:e},deleted_at:{_is_null:!0}};return Se.test(r)?_.id={_eq:r}:_.page_id={_eq:r},qe(t,{where:_})}function J(t,{slug:e,...a}){if(!a.title)throw new Error("Wiki title is required");if(!a.stub&&!a.definition)throw new Error("Wiki definition is required");return t.mutate({mutation:re,variables:{pageId:e,pageContent:a},fetchPolicy:"no-cache"}).then(r=>r.data?.admin_wiki_add?.id)}function K(t,e,a){if(!e)throw new Error("ID of the wiki is required");return t.mutate({mutation:_e,variables:{id:e,pageContent:a},fetchPolicy:"no-cache"}).then(r=>r.data?.admin_wiki_update?.buildVersion)}function H(t,e){if(!e)throw new Error("ID of the wiki is required");return t.mutate({mutation:ne,variables:{id:e},fetchPolicy:"no-cache"}).then(a=>a.data?.admin_wiki_delete?.buildVersion)}function Ne(t,e){return t.query({query:ce,variables:e,fetchPolicy:"no-cache"}).then(a=>a.data?.admin_wiki.map(({page_id:r,id:_,...i})=>({...i,stable_id:_,slug:r}))??[])}function We(t,e){return t.query({query:oe,variables:e,fetchPolicy:"no-cache"}).then(a=>a.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(t,e){let a=await t.query({query:le,variables:e,fetchPolicy:"no-cache"}).then(r=>r.data?.admin_wiki.map(_=>({stable_id:_.id,slug:_.page_id,created_at:_.created_at,last_modified_at:_.last_modified_at,..._.content}))??[]);return a.length?a[0]:null}async function ze(t,e){let a=await t.query({query:pe,variables:e,fetchPolicy:"no-cache"}).then(r=>r.data?.admin_guide_page?.map(_=>({stable_id:_.id,slug:_.id,created_at:_.created_at,last_modified_at:_.last_modified_at,title:_.page_title,details:_.details}))??[]);return a.length?a[0]:null}function De(t,e){if(!t.length||!e.include_stub&&!e.query&&!e.limit&&!e.offset)return t;let a=e.query?.toLowerCase(),r=t.filter(_=>!e.include_stub&&_.stub?!1:!!(!a||_.title.toLowerCase().includes(a)||_.definition&&_.definition.toLowerCase().includes(a)||_.aliases?.length&&_.aliases.some(i=>i.toLowerCase().includes(a))));return e.offset&&r.length&&(r=r.slice(e.offset)),e.limit&&e.limit<r.length&&(r=r.slice(0,e.limit)),r}function fe(t){return t!=null&&typeof t=="object"&&"status"in t&&t.status==="failure"}function he(t){return t!=null&&typeof t=="object"&&"status"in t&&t.status==="success"&&"token"in t}function xe(t){return t!=null&&typeof t=="object"&&("data"in t&&!!t.data&&typeof t.data=="object"&&"enrich_token"in t.data&&!!t.data.enrich_token&&typeof t.data.enrich_token=="object"&&"userDirectoryJWT"in t.data.enrich_token||"errors"in t&&Array.isArray(t.errors))}function Be(t){let a=`${I(t.authHost)||"https://auth.pro.hasura.io"}/ddn/promptql/token`,r={token:"",expiry:new Date(0)},_=t.fetch||fetch,i=async()=>{let o=await _(a,{method:"POST",headers:t.headers});switch(o.status){case 200:{let n=await o.json();if(he(n))return n;throw new Error("malformed token response")}case 401:{let n=await o.json();throw fe(n)?new Error(n?.error||o.statusText):new Error(o.statusText)}default:{let n=await o.text();throw new Error(n)}}};return async()=>{if(r.expiry.getTime()<=Date.now()+1e3){let o=await i(),n=await Ge(t.promptqlGraphQLUrl,o.token,t.projectId,_);r.token=n;let p=new Date(o.expiry);if(Number.isNaN(p.getTime())){let b=new Date;b.setHours(1),r.expiry=b}else r.expiry=p}return r.token}}var Ge=async(t,e,a,r=fetch)=>{let _=await r(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:"mutation EnrichToken($luxJWT: String!, $projectId: uuid) { enrich_token(luxJWT: $luxJWT, projectId: $projectId) { userDirectoryJWT }}",variables:{luxJWT:e,projectId:a},operationName:"EnrichToken"})});switch(_.status){case 200:{let i=await _.json();if(!xe(i)||!i.data?.enrich_token?.userDirectoryJWT)throw new Error(`malformed promptql token response: ${JSON.stringify(i)}`);return i.data.enrich_token.userDirectoryJWT}default:{let i=await _.text();throw new Error(i)}}};var d="PromptQL TypeScript SDK";var u=require("@apollo/client"),ve=require("@apollo/client/link/context"),Ce=require("@apollo/client/link/subscriptions"),ke=require("graphql"),Oe=require("graphql-ws");var $=t=>{let e=new u.HttpLink({uri:t.url,fetch:t.fetch,headers:t.headers}),a=async n=>{let p=await t.getAuthToken();return{headers:{"User-Agent":d,...n,Authorization:`Bearer ${p}`}}},r=(0,Oe.createClient)({url:t.url,connectionParams:()=>a(t.headers),lazy:!0}),_=new Ce.GraphQLWsLink(r),i=new ve.SetContextLink(({headers:n})=>a(n)),o=u.ApolloLink.split(({operationType:n})=>n===ke.OperationTypeNode.SUBSCRIPTION,_,i.concat(e));return{client:new u.ApolloClient({link:o,cache:new u.InMemoryCache}),wsClient:r}};function Qe(t,e){if(!e.length)return[];if(!t.length)return e;let a=t[t.length-1];if(!a)return e;let r=BigInt(a.thread_event_id),_=e.length-1;for(;_>=0;_--){let i=e[_];if(BigInt(i?.thread_event_id)<=r)break}return e.slice(_+1)}function Le(t){return"UserMessage"in t?t.UserMessage:null}function Je(t){return"UserCancel"in t?t.UserCancel:null}function Ke(t){return!("AgentMessage"in t)||!("OrchestratorUpdate"in t.AgentMessage.update)||!("PlanGenerationStarted"in t.AgentMessage.update.OrchestratorUpdate.update)?null:t.AgentMessage.update.OrchestratorUpdate.update.PlanGenerationStarted}function He(t){let e=A(t);return!e||!("PlanStepGenerated"in e)?null:e.PlanStepGenerated}function $e(t){return"AgentMessage"in t?"content"in t.AgentMessage.update&&"interaction_update"in t.AgentMessage.update.content&&"main_agent"in t.AgentMessage.update.content.interaction_update&&"completed"in t.AgentMessage.update.content.interaction_update.main_agent?{success:!0,message:t.AgentMessage.update.content.interaction_update.main_agent.completed.summary||"",modified_artifacts:[],generated_at:t.AgentMessage.update.timestamp,messageId:t.AgentMessage.message_id}:!("OrchestratorUpdate"in t.AgentMessage.update)||!("GeneratedResponse"in t.AgentMessage.update.OrchestratorUpdate.update)?null:{...t.AgentMessage.update.OrchestratorUpdate.update.GeneratedResponse.response,messageId:t.AgentMessage.message_id}:null}function Xe(t){return!("AgentMessage"in t)||!("MessageProcessingUpdate"in t.AgentMessage.update)||!("ProcessingStarted"in t.AgentMessage.update.MessageProcessingUpdate.update)?null:t.AgentMessage.update.MessageProcessingUpdate.update.ProcessingStarted}function Ze(t){return!("AgentMessage"in t)||!("MessageProcessingUpdate"in t.AgentMessage.update)||!("InteractionDecision"in t.AgentMessage.update.MessageProcessingUpdate.update)||!("AcceptInteraction"in t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.AcceptInteraction}function Ye(t){return!("AgentMessage"in t)||!("MessageProcessingUpdate"in t.AgentMessage.update)||!("InteractionDecision"in t.AgentMessage.update.MessageProcessingUpdate.update)||!("DeclineInteraction"in t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:t.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.DeclineInteraction}function S(t){return!("AgentMessage"in t)||!("PlanningDecisionUpdate"in t.AgentMessage.update)?null:t.AgentMessage.update.PlanningDecisionUpdate.update}function et(t){let e=S(t);return!e||!("Started"in e)?null:e.Started}function tt(t){let e=S(t);return!e||!("Completed"in e)?null:e.Completed}function at(t){let e=S(t);return!e||!("PlanningRequired"in e)?null:e.PlanningRequired}function rt(t){return!("AgentMessage"in t)||!("StartingOrchestrator"in t.AgentMessage.update)?null:t.AgentMessage.update.StartingOrchestrator}function A(t){return!("AgentMessage"in t)||!("OrchestratorUpdate"in t.AgentMessage.update)?null:t.AgentMessage.update.OrchestratorUpdate.update}function c(t){let e=A(t);return!e||!("ContextExplorerUpdate"in e)?null:e.ContextExplorerUpdate.update}function _t(t){let e=c(t);return!e||!("Started"in e)?null:e.Started}function nt(t){let e=c(t);return!e||!("Completed"in e)?null:e.Completed}function f(t){let e=c(t);return!e||!("WikiExplorerUpdate"in e)?null:e.WikiExplorerUpdate.update}function it(t){let e=f(t);return!e||!("Started"in e)?null:e.Started}function ot(t){let e=f(t);return!e||!("Completed"in e)?null:e.Completed}function pt(t){let e=f(t);return!e||!("WikiInfoGenerated"in e)?null:e.WikiInfoGenerated}function h(t){let e=c(t);return!e||!("SchemaTasksGenerationUpdate"in e)?null:e.SchemaTasksGenerationUpdate.update}function st(t){let e=h(t);return!e||!("Started"in e)?null:e.Started}function ut(t){let e=h(t);return!e||!("Completed"in e)?null:e.Completed}function dt(t){let e=h(t);return!e||!("TasksGenerated"in e)?null:e.TasksGenerated}function y(t){let e=c(t);return!e||!("SchemaExplorerUpdate"in e)?null:e.SchemaExplorerUpdate.update}function yt(t){let e=y(t);return!e||!("Started"in e)?null:e.Started}function ct(t){let e=y(t);return!e||!("Completed"in e)?null:e.Completed}function lt(t){let e=y(t);return!e||!("CodeExecutionComplete"in e)?null:e.CodeExecutionComplete}function bt(t){let e=y(t);return!e||!("CodeOutputAnalyzed"in e)?null:e.CodeOutputAnalyzed}function mt(t){let e=y(t);return!e||!("GeneratedCode"in e)?null:e.GeneratedCode}function It(t){let e=y(t);return!e||!("SchemaExplored"in e)?null:e.SchemaExplored}function x(t){let e=A(t);return!e||!("StepUpdate"in e)?null:e.StepUpdate}function Mt(t){let e=x(t);return!e||!("Programmer"in e.update)?null:e.update.Programmer}function gt(t){let e=x(t);return!e||!("UiProgrammer"in e.update)?null:e.update.UiProgrammer}function St(t){let e=x(t);return!e||!("SavedProgramRunner"in e.update)?null:e.update.SavedProgramRunner}function At(t){if(!("AgentMessage"in t))return null;if("InteractionFinished"in t.AgentMessage.update){let e=t.AgentMessage.update.InteractionFinished.update;return"Completed"in e?{status:"completed",timestamp:e.Completed.completed_at,warnings:e.Completed.warnings,messageId:t.AgentMessage.message_id}:"Errored"in e?{status:"errored",timestamp:e.Errored.errored_at,messageId:t.AgentMessage.message_id,reason:typeof e.Errored.error=="string"?e.Errored.error:e.Errored.error.User.message}:"UserCancelled"in e?{status:"user_cancelled",timestamp:e.UserCancelled.cancelled_at,messageId:t.AgentMessage.message_id}:"AgentDeclined"in e?{status:"agent_declined",timestamp:e.AgentDeclined.declined_at,reason:e.AgentDeclined.reason,messageId:t.AgentMessage.message_id}:"ServerCancelled"in e?{status:"server_cancelled",timestamp:e.ServerCancelled.cancelled_at,messageId:t.AgentMessage.message_id}:{status:"unknown",messageId:t.AgentMessage.message_id}}if("content"in t.AgentMessage.update&&"interaction_finished"in t.AgentMessage.update.content){let e=t.AgentMessage.update.content.interaction_finished.outcome;return"errored"in e?{status:"errored",messageId:t.AgentMessage.message_id,reason:e.errored.user_facing_message||e.errored.raw_error,timestamp:t.AgentMessage.update.timestamp,warnings:e.errored.raw_error?[{message:e.errored.raw_error}]:[]}:"server_cancelled"in e?{status:"server_cancelled",messageId:t.AgentMessage.message_id,timestamp:t.AgentMessage.update.timestamp}:"user_cancelled"in e?{status:"user_cancelled",messageId:t.AgentMessage.message_id,timestamp:t.AgentMessage.update.timestamp}:"completed"in e?{status:"completed",messageId:t.AgentMessage.message_id,timestamp:t.AgentMessage.update.timestamp,warnings:e.completed.warnings}:{status:"unknown",messageId:t.AgentMessage.message_id}}return null}function ft(t){if(t){if("UserMessage"in t)return t.UserMessage.message_id;if("AgentMessage"in t)return t.AgentMessage.message_id;if("UserTeach"in t)return t.UserTeach.agent_message_id;if("UserCancel"in t)return t.UserCancel.message_id}}function X(t){return`https://promptql.${t}/playground-v2-hge/v1/graphql`}var B=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 a=e.controlPlaneHost?I(e.controlPlaneHost):"https://data.pro.hasura.io";this.controlPlaneUrl=`${a}/v1/graphql`}async getAuthToken(){if(typeof this.getAuthTokenFn=="function")return this.getAuthTokenFn();let e=await this.getProjectInfo();return this.getAuthTokenFn=Be({promptqlGraphQLUrl:e.promptqlGraphQLUrl,authHost:this.options.authHost,headers:Ee(this.options.serviceAccountToken),fetch:this.options.fetch}),this.getAuthTokenFn()}async getGraphQLClient(){if(this.client)return this.client;let e=await this.getProjectInfo(),{client:a,wsClient:r}=$({getAuthToken:this.getAuthToken.bind(this),url:e.promptqlGraphQLUrl,fetch:this.options.fetch,headers:this.options.headers});return this.wsClient=r,this.client=a,this.client}async getProjectInfo(){if(this.project)return this.project;let e={operationName:"GetDdnProjects",query:"query GetDdnProjects { ddn_projects(limit: 1) { id name private_ddn { fqdn path_routing_context path_routing_enabled }}}"},r=await(typeof this.options.fetch=="function"?this.options.fetch:fetch)(this.controlPlaneUrl,{method:"POST",headers:{...Ee(this.options.serviceAccountToken),"User-Agent":d,"Content-Type":"application/json"},body:JSON.stringify(e)});if(r.status!==200){let o=r.body?await r.text():r.statusText;throw new Error(`[${r.status}] failed to get project info: ${o}`)}let _=await r.json();if(!_.data?.ddn_projects?.length)throw new Error("Project not found");let i=_.data.ddn_projects[0];return this.project={projectId:i.id,projectName:i.name,projectHost:`https://${i.name}.${i.private_ddn.fqdn}`,promptqlConsoleUrl:`https://prompt.ql.app/project/${i.name}`,promptqlGraphQLUrl:X(i.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 Ee(t){return{Authorization:`pat ${t}`}}var v=class{api;constructor(e){this.api=e}async listMetadataByThreadId(e){let a=await this.api.getProjectInfo(),r=await this.api.getGraphQLClient();return R(r,a.projectId,e)}async download(e,a){let r=await this.api.getProjectInfo(),_=await this.api.getAuthToken();return T(r.projectHost,e,a,Pe(_),this.api.options.fetch)}async getMetadata(e,a){let r=await this.api.getProjectInfo(),_=await this.api.getAuthToken();return U(r.projectHost,e,a,Pe(_),this.api.options.fetch)}};function Pe(t){return{Authorization:`Bearer ${t}`,"User-Agent":d}}var C=class{api;constructor(e){this.api=e}info(){return this.api.getProjectInfo()}};var k=class{api;constructor(e){this.api=e}async list(e){let a=await this.api.getGraphQLClient();return m(a,{...e,limit:e.limit&&e.limit>0?e.limit:10})}async getByName(e){let a=await this.api.getGraphQLClient();return m(a,{where:{name:{_eq:e}},limit:1}).then(r=>r.length?r[0]??null:null)}async create(e){let a=await this.api.getGraphQLClient();return w(a,e)}};var l=require("rxjs");var O=class{api;constructor(e){this.api=e}async list(e){let a=await this.api.getGraphQLClient();return j(a,{...e,limit:e.limit&&e.limit>0?e.limit:10})}async get(e){if(!e)throw new Error("threadId is required");let a=await this.api.getGraphQLClient();return V(a,e)}async start(e){let a=await this.api.getProjectInfo(),r=await this.api.getGraphQLClient();return N(r,{...e,projectId:a.projectId,buildId:e.buildId||this.api.options.buildId,timezone:e.timezone||this.api.defaultTimezone})}async getEvents(e,a){let r=await this.api.getGraphQLClient();return M(r,e,a)}async sendMessage(e){let a=await this.api.getGraphQLClient();return W(a,{...e,timezone:e.timezone||this.api.defaultTimezone})}async cancelAgentMessage(e){let a=await this.api.getGraphQLClient();return q(a,e)}subscribeEvents(e,a){return(0,l.from)(this.api.getGraphQLClient()).pipe((0,l.switchMap)(r=>z(r,e,a)))}streamMessageEvents(e,a){return(0,l.from)(this.api.getGraphQLClient()).pipe((0,l.switchMap)(r=>D(r,e,a)))}};var E=class{api;constructor(e){this.api=e}async list(e){let a=await this.api.getGraphQLClient();return G(a,e)}async search(e){let a=await this.api.getGraphQLClient();return Q(a,e)}async get(e,a){let r=await this.api.getProjectInfo(),_=await this.api.getGraphQLClient();return L(_,r.projectId,e,a)}async create(e){let a=await this.api.getGraphQLClient();return J(a,e)}async update(e,a){let r=await this.api.getGraphQLClient();return K(r,e,a)}async delete(e){let a=await this.api.getGraphQLClient();return H(a,e)}};var Z=class{constructor(e){let a=new B(e);this.api=a,this.thread=new O(a),this.project=new C(a),this.room=new k(a),this.artifact=new v(a),this.wiki=new E(a)}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,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});
|