@hasura/promptql 2.0.0-alpha.41 → 2.0.0-alpha.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{a as b,c as B}from"./chunk-WIDMKT3J.mjs";var S={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CancelAgentMessage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"threadId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"messageId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"cancel_agent_message"},arguments:[{kind:"Argument",name:{kind:"Name",value:"threadId"},value:{kind:"Variable",name:{kind:"Name",value:"threadId"}}},{kind:"Argument",name:{kind:"Name",value:"agentMessageId"},value:{kind:"Variable",name:{kind:"Name",value:"messageId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}}]}}]}}]},P={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateRoom"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"name"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"visibility"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"description"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"create_room"},arguments:[{kind:"Argument",name:{kind:"Name",value:"name"},value:{kind:"Variable",name:{kind:"Name",value:"name"}}},{kind:"Argument",name:{kind:"Name",value:"visibility"},value:{kind:"Variable",name:{kind:"Name",value:"visibility"}}},{kind:"Argument",name:{kind:"Name",value:"description"},value:{kind:"Variable",name:{kind:"Name",value:"description"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"room_id"}}]}}]}}]},C={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"}}]}}]}}]},N={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"StartThread"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"message"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"projectId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"timezone"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"roomId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"uploads"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UserUploadInput"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"visibility"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"createdFrom"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"start_thread"},arguments:[{kind:"Argument",name:{kind:"Name",value:"message"},value:{kind:"Variable",name:{kind:"Name",value:"message"}}},{kind:"Argument",name:{kind:"Name",value:"projectId"},value:{kind:"Variable",name:{kind:"Name",value:"projectId"}}},{kind:"Argument",name:{kind:"Name",value:"timezone"},value:{kind:"Variable",name:{kind:"Name",value:"timezone"}}},{kind:"Argument",name:{kind:"Name",value:"buildId"},value:{kind:"Variable",name:{kind:"Name",value:"buildId"}}},{kind:"Argument",name:{kind:"Name",value:"buildFqdn"},value:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}}},{kind:"Argument",name:{kind:"Name",value:"roomId"},value:{kind:"Variable",name:{kind:"Name",value:"roomId"}}},{kind:"Argument",name:{kind:"Name",value:"uploads"},value:{kind:"Variable",name:{kind:"Name",value:"uploads"}}},{kind:"Argument",name:{kind:"Name",value:"visibility"},value:{kind:"Variable",name:{kind:"Name",value:"visibility"}}},{kind:"Argument",name:{kind:"Name",value:"createdFrom"},value:{kind:"Variable",name:{kind:"Name",value:"createdFrom"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"thread_events"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"thread_event_id"}}]}}]}}]}}]},U={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateWikiPage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"pageContent"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"jsonb"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"pageId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki_add"},arguments:[{kind:"Argument",name:{kind:"Name",value:"pageContent"},value:{kind:"Variable",name:{kind:"Name",value:"pageContent"}}},{kind:"Argument",name:{kind:"Name",value:"pageId"},value:{kind:"Variable",name:{kind:"Name",value:"pageId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}}]}}]}}]},V={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"UpdateWikiPage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"pageContent"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"jsonb"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki_update"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}},{kind:"Argument",name:{kind:"Name",value:"pageContent"},value:{kind:"Variable",name:{kind:"Name",value:"pageContent"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"buildVersion"}}]}}]}}]},M={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"DeleteWikiPage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki_delete"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"buildVersion"}}]}}]}}]},F={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetArtifactsByThreadId"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"threadId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"artifacts"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_artifacts"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_id"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"_eq"},value:{kind:"Variable",name:{kind:"Name",value:"threadId"}}}]}}]}}]}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"updated_at"},value:{kind:"EnumValue",value:"asc"}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"artifact_id"}},{kind:"Field",name:{kind:"Name",value:"latest_version_object"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"user_id"}},{kind:"Field",name:{kind:"Name",value:"artifact_metadata"}},{kind:"Field",name:{kind:"Name",value:"artifact_type"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"size"}},{kind:"Field",name:{kind:"Name",value:"version"}}]}}]}}]}}]},I={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"ListGuidePages"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_guide_page_order_by"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_guide_page_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_guide_page"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"page_title"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"last_modified_at"}}]}}]}}]},q={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetGuidePage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"project_id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"page_id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_guide_page"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"project_id"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"_eq"},value:{kind:"Variable",name:{kind:"Name",value:"project_id"}}}]}},{kind:"ObjectField",name:{kind:"Name",value:"id"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"_eq"},value:{kind:"Variable",name:{kind:"Name",value:"page_id"}}}]}},{kind:"ObjectField",name:{kind:"Name",value:"deleted_at"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"_is_null"},value:{kind:"BooleanValue",value:!0}}]}}]}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"IntValue",value:"1"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"page_title"}},{kind:"Field",name:{kind:"Name",value:"details"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"last_modified_at"}}]}}]}}]},D={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetProjectInfo"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"get_project_info"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"projectId"}},{kind:"Field",name:{kind:"Name",value:"projectName"}},{kind:"Field",name:{kind:"Name",value:"promptqlConsoleUrl"}},{kind:"Field",name:{kind:"Name",value:"promptqlUserId"}},{kind:"Field",name:{kind:"Name",value:"controlPlaneUserId"}}]}}]}}]},w={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetRooms"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"rooms_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"rooms_order_by"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}},defaultValue:{kind:"IntValue",value:"10"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"rooms"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Room"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Room"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"rooms"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"room_id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"project_id"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"user_id"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}}]}}]},R={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreads"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"threads_v2_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"threads_v2_order_by"}}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"threads_v2"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Thread"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Thread"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"threads_v2"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"build_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"relevant_event_count"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]},j={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreadById"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"threads_v2_by_pk"},arguments:[{kind:"Argument",name:{kind:"Name",value:"thread_id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Thread"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Thread"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"threads_v2"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"build_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"relevant_event_count"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]},G={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreadAndEventsById"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"eventsWhere"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"eventsLimit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"eventsOrdering"}},type:{kind:"NamedType",name:{kind:"Name",value:"order_by"}},defaultValue:{kind:"EnumValue",value:"asc"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"threads_v2_by_pk"},arguments:[{kind:"Argument",name:{kind:"Name",value:"thread_id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Thread"}},{kind:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"eventsWhere"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"eventsLimit"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"Variable",name:{kind:"Name",value:"eventsOrdering"}}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Thread"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"threads_v2"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"build_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"relevant_event_count"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadEvent"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"thread_events"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]},W={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreadEvents"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"ordering"}},type:{kind:"NamedType",name:{kind:"Name",value:"order_by"}},defaultValue:{kind:"EnumValue",value:"asc"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"Variable",name:{kind:"Name",value:"ordering"}}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadEvent"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"thread_events"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]},z={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"ListWikiPages"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_wiki_order_by"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_wiki_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki"},arguments:[{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}},{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"page_id"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"last_modified_at"}},{kind:"Field",alias:{kind:"Name",value:"title"},name:{kind:"Name",value:"content"},arguments:[{kind:"Argument",name:{kind:"Name",value:"path"},value:{kind:"StringValue",value:"title",block:!1}}]},{kind:"Field",alias:{kind:"Name",value:"stub"},name:{kind:"Name",value:"content"},arguments:[{kind:"Argument",name:{kind:"Name",value:"path"},value:{kind:"StringValue",value:"stub",block:!1}}]},{kind:"Field",alias:{kind:"Name",value:"aliases"},name:{kind:"Name",value:"content"},arguments:[{kind:"Argument",name:{kind:"Name",value:"path"},value:{kind:"StringValue",value:"aliases",block:!1}}]},{kind:"Field",alias:{kind:"Name",value:"definition"},name:{kind:"Name",value:"content"},arguments:[{kind:"Argument",name:{kind:"Name",value:"path"},value:{kind:"StringValue",value:"definition",block:!1}}]}]}}]}}]},Q={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetWikiPage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_wiki_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki"},arguments:[{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"IntValue",value:"1"}},{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"page_id"}},{kind:"Field",name:{kind:"Name",value:"content"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"last_modified_at"}}]}}]}}]},L={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"SearchWikiPages"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"query"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki_search"},arguments:[{kind:"Argument",name:{kind:"Name",value:"query"},value:{kind:"Variable",name:{kind:"Name",value:"query"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"totalCount"}},{kind:"Field",name:{kind:"Name",value:"results"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"score"}},{kind:"Field",name:{kind:"Name",value:"page"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"aliases"}},{kind:"Field",name:{kind:"Name",value:"definition"}},{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"namespace"}},{kind:"Field",name:{kind:"Name",value:"stub"}},{kind:"Field",name:{kind:"Name",value:"title"}}]}},{kind:"Field",name:{kind:"Name",value:"metadata"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"createdAt"}},{kind:"Field",name:{kind:"Name",value:"ownerId"}},{kind:"Field",name:{kind:"Name",value:"lastUpdatedAt"}}]}}]}}]}}]}}]},K={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"subscription",name:{kind:"Name",value:"SubscribeThreadEvents"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"EnumValue",value:"asc"}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadEvent"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"thread_events"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]};async function $(n,e,i,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 ve=t.body?await t.text():t.statusText;throw new Error(`[${t.status}] failed to download artifact: ${ve}`)}return t.body?t.headers.get("Content-Type")?.startsWith("application/json")?t.json():t.text():null}async function J(n,e,i){let r=await n.query({query:F,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 H(n,e,i,r,d){let a=`${n}/promptql-v2/artifacts/${e}/version/${i}/metadata`,t=await(typeof d=="function"?d:fetch)(a,{method:"GET",headers:r});if(t.status!==200){let l=t.body?await t.text():t.statusText;throw new Error(`[${t.status}] failed to get artifact metadata: ${l}`)}return t.json()}async function X(n){return(await n.query({query:D,fetchPolicy:"no-cache"})).data?.get_project_info}function x(n,e){return n.query({query:w,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(i=>i.data?.rooms??[])}function Y(n,e){if(!e.name)throw new Error("Room name is required");let i=Ee(e.name);if(i)throw new Error(i);return n.mutate({mutation:P,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 he=/^[\p{Ll}\p{Lo}\p{N}]+([_-][\p{Ll}\p{Lo}\p{N}]+)*$/u,Z=80,Ee=n=>{let e=n.trim();return e.length===0?null:e.length>Z?`Room name must be ${Z} characters or less`:/[^\p{Ll}\p{Lo}\p{N}_-]/u.test(e)?"Only lowercase letters, numbers, hyphens, and underscores are allowed.":/^[_-]|[_-]$/.test(e)?"Room name should not start or end with a hyphen or underscore.":/[-_]{2,}/.test(e)?"Room name should not contain consecutive hyphens or underscores.":he.test(e)?null:"Room name is invalid. Only lowercase letters, numbers, hyphens, and underscores are allowed."};import{defer as Oe,map as Te,repeat as Ae,takeWhile as be}from"rxjs";function ee(n,e){return n.query({query:R,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(i=>i.data?.threads_v2??[])}function ne(n,e){if(!e)throw new Error("threadId is required");return n.query({query:j,variables:{id:e},fetchPolicy:"no-cache"}).then(i=>i.data?.threads_v2_by_pk)}function ie(n,e,i){let r=le(e,i);return n.query({query:G,variables:{id:e,eventsWhere:r.where,eventsLimit:r.limit,eventsOrdering:r.ordering},fetchPolicy:"no-cache"}).then(d=>d.data?.threads_v2_by_pk)}function de(n,e){if(!e.message.trim())throw new Error("message must not be empty");return n.mutate({mutation:N,variables:e}).then(i=>{if(!i.data?.start_thread)throw new Error(i.error?.message||"Failed to start thread");return i.data.start_thread})}function v(n,e,i){return n.query({query:W,variables:le(e,i),fetchPolicy:"no-cache"}).then(r=>r.data?.thread_events??[])}function re(n,e){if(!e.threadId)throw new Error("threadId is required");if(!e.message.trim())throw new Error("message must not be empty");return n.mutate({mutation:C,variables:e}).then(i=>{if(!i.data?.send_thread_message)throw new Error(i.error?.message||"Failed to send message to thread");return i.data.send_thread_message})}function te(n,e){if(!e.threadId)throw new Error("threadId is required");if(!e.messageId.trim())throw new Error("messageId is required");return n.mutate({mutation:S,variables:e}).then(i=>{if(!i.data?.cancel_agent_message)throw new Error(i.error?.message||"Failed to cancel thread");return i.data.cancel_agent_message.thread_event_id})}function ae(n,e,i){if(!e)throw new Error("threadId is required");B(i);let r={thread_id:{_eq:e}};return i&&(r.thread_event_id={_gte:i}),n.subscribe({query:K,variables:{where:r}}).pipe(Te(d=>{if(d.error)throw d.error;return d.data?.thread_events??[]}))}function _e(n,e,i){if(!e)throw new Error("threadId is required");let r,d=B(i?.fromEventId),a={eventId:i?.fromEventId?{_gte:d}:void 0,messageId:i?.messageId},_=i?.pollingInterval&&i?.pollingInterval>0?i.pollingInterval:5;return Oe(async()=>{let t=r?{messageId:i?.messageId,eventId:{_gt:r}}:a,l=await v(n,e,t);return l.length>0&&(r=l[l.length-1]?.thread_event_id),l}).pipe(Ae({count:i?.timeout&&i.timeout>0?Math.ceil(i.timeout/_):void 0,delay:_*1e3}),be(t=>Se(t,i?.skipAnalysis),!0))}function Se(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 Pe(n){return[{event_data:{_contains:{UserMessage:{message_id:n}}}},{event_data:{_contains:{AgentMessage:{message_id:n}}}},{event_data:{_contains:{UserCancel:{message_id:n}}}}]}var le=(n,e)=>{if(!n)throw new Error("threadId is required");let i={thread_id:{_eq:n}};return e&&(e.eventId&&(i.thread_event_id=e.eventId),e.messageId&&(i._or=Pe(e.messageId))),{where:i,limit:e?.limit,ordering:e?.ordering||"asc"}};var p=["guide","regular"];async function oe(n,e){let i=e.namespace||"regular";if(!p.includes(i))throw new Error(`Invalid namespace. Expected one of: ${p}`);if(i==="guide"){let _={deleted_at:{_is_null:!0}};return e.project_id&&(_.project_id={_eq:e.project_id}),e.query&&(_.page_title={_ilike:e.query.toLowerCase()}),Ne(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 Ce(n,d);return r?Me(a,e):a}async function ue(n,e){if(!e.query)throw new Error("query is required");return n.query({query:L,variables:e,fetchPolicy:"no-cache"}).then(i=>i.data?.admin_wiki_search?{totalCount:i.data.admin_wiki_search.totalCount,results:i.data?.admin_wiki_search.results.map(({score: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 se(n,e,i,r){if(i=i||"regular",!p.includes(i))throw new Error(`Invalid namespace. Expected one of: ${p}`);if(!e)throw new Error("projectId is required");if(!r)throw new Error("identifier is required");if(i==="guide")return Ve(n,{project_id:e,page_id:r});let d={project_id:{_eq:e},deleted_at:{_is_null:!0}};return b.test(r)?d.id={_eq:r}:d.page_id={_eq:r},Ue(n,{where:d})}function pe(n,{slug:e,...i}){if(!i.title)throw new Error("Wiki title is required");if(!i.stub&&!i.definition)throw new Error("Wiki definition is required");return n.mutate({mutation:U,variables:{pageId:e,pageContent:i},fetchPolicy:"no-cache"}).then(r=>r.data?.admin_wiki_add?.id)}function me(n,e,i){if(!e)throw new Error("ID of the wiki is required");return n.mutate({mutation:V,variables:{id:e,pageContent:i},fetchPolicy:"no-cache"}).then(r=>r.data?.admin_wiki_update?.buildVersion)}function fe(n,e){if(!e)throw new Error("ID of the wiki is required");return n.mutate({mutation:M,variables:{id:e},fetchPolicy:"no-cache"}).then(i=>i.data?.admin_wiki_delete?.buildVersion)}function Ce(n,e){return n.query({query:z,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 Ne(n,e){return n.query({query:I,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 Ue(n,e){let i=await n.query({query:Q,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 Ve(n,e){let i=await n.query({query:q,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 Me(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}import{ApolloClient as ce,ApolloLink as Fe,HttpLink as Ie,InMemoryCache as ye}from"@apollo/client";import{SetContextLink as qe}from"@apollo/client/link/context";import{GraphQLWsLink as De}from"@apollo/client/link/subscriptions";import{OperationTypeNode as we}from"graphql";import{createClient as Re}from"graphql-ws";var ge=n=>{let e=new Ie({uri:n.url,fetch:n.fetch,headers:typeof n.headers=="object"?n.headers:void 0}),i=async t=>{let l=typeof n.headers=="object"?n.headers:await n.headers();return{headers:{...t,...l}}},r=typeof n.headers=="object"?e:new qe(({headers:t})=>i(t)).concat(e);if(n.disableSubscriptions)return{client:new ce({link:r,cache:new ye}),wsClient:null};let d=Re({url:n.url,connectionParams:()=>i(),lazy:!0}),a=new De(d),_=Fe.split(({operationType:t})=>t===we.SUBSCRIPTION,a,r);return{client:new ce({link:_,cache:new ye}),wsClient:d}};var ke="PromptQL TypeScript SDK";function si(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 pi(n){return"UserMessage"in n?n.UserMessage:null}function mi(n){return"UserCancel"in n?n.UserCancel:null}function fi(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 ci(n){let e=E(n);return!e||!("PlanStepGenerated"in e)?null:e.PlanStepGenerated}function yi(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 gi(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 ki(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 Bi(n){return!("AgentMessage"in n)||!("MessageProcessingUpdate"in n.AgentMessage.update)||!("InteractionDecision"in n.AgentMessage.update.MessageProcessingUpdate.update)||!("DeclineInteraction"in n.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision)?null:n.AgentMessage.update.MessageProcessingUpdate.update.InteractionDecision.decision.DeclineInteraction}function h(n){return!("AgentMessage"in n)||!("PlanningDecisionUpdate"in n.AgentMessage.update)?null:n.AgentMessage.update.PlanningDecisionUpdate.update}function xi(n){let e=h(n);return!e||!("Started"in e)?null:e.Started}function vi(n){let e=h(n);return!e||!("Completed"in e)?null:e.Completed}function hi(n){let e=h(n);return!e||!("PlanningRequired"in e)?null:e.PlanningRequired}function Ei(n){return!("AgentMessage"in n)||!("StartingOrchestrator"in n.AgentMessage.update)?null:n.AgentMessage.update.StartingOrchestrator}function E(n){return!("AgentMessage"in n)||!("OrchestratorUpdate"in n.AgentMessage.update)?null:n.AgentMessage.update.OrchestratorUpdate.update}function u(n){let e=E(n);return!e||!("ContextExplorerUpdate"in e)?null:e.ContextExplorerUpdate.update}function Oi(n){let e=u(n);return!e||!("Started"in e)?null:e.Started}function Ti(n){let e=u(n);return!e||!("Completed"in e)?null:e.Completed}function O(n){let e=u(n);return!e||!("WikiExplorerUpdate"in e)?null:e.WikiExplorerUpdate.update}function Ai(n){let e=O(n);return!e||!("Started"in e)?null:e.Started}function bi(n){let e=O(n);return!e||!("Completed"in e)?null:e.Completed}function Si(n){let e=O(n);return!e||!("WikiInfoGenerated"in e)?null:e.WikiInfoGenerated}function T(n){let e=u(n);return!e||!("SchemaTasksGenerationUpdate"in e)?null:e.SchemaTasksGenerationUpdate.update}function Pi(n){let e=T(n);return!e||!("Started"in e)?null:e.Started}function Ci(n){let e=T(n);return!e||!("Completed"in e)?null:e.Completed}function Ni(n){let e=T(n);return!e||!("TasksGenerated"in e)?null:e.TasksGenerated}function o(n){let e=u(n);return!e||!("SchemaExplorerUpdate"in e)?null:e.SchemaExplorerUpdate.update}function Ui(n){let e=o(n);return!e||!("Started"in e)?null:e.Started}function Vi(n){let e=o(n);return!e||!("Completed"in e)?null:e.Completed}function Mi(n){let e=o(n);return!e||!("CodeExecutionComplete"in e)?null:e.CodeExecutionComplete}function Fi(n){let e=o(n);return!e||!("CodeOutputAnalyzed"in e)?null:e.CodeOutputAnalyzed}function Ii(n){let e=o(n);return!e||!("GeneratedCode"in e)?null:e.GeneratedCode}function qi(n){let e=o(n);return!e||!("SchemaExplored"in e)?null:e.SchemaExplored}function A(n){let e=E(n);return!e||!("StepUpdate"in e)?null:e.StepUpdate}function Di(n){let e=A(n);return!e||!("Programmer"in e.update)?null:e.update.Programmer}function wi(n){let e=A(n);return!e||!("UiProgrammer"in e.update)?null:e.update.UiProgrammer}function Ri(n){let e=A(n);return!e||!("SavedProgramRunner"in e.update)?null:e.update.SavedProgramRunner}function ji(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 Gi(n){if(n){if("UserMessage"in n)return n.UserMessage.message_id;if("AgentMessage"in n)return n.AgentMessage.message_id;if("UserTeach"in n)return n.UserTeach.agent_message_id;if("UserCancel"in n)return n.UserCancel.message_id}}function s(n){return{Authorization:`pat ${n}`,"User-Agent":ke}}var Be="https://promptql.ddn.hasura.app",m=class{options;defaultTimezone;client;wsClient;project;constructor(e){if(this.options=e,!e.accessToken)throw new Error("accessToken is required");this.defaultTimezone=e.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone;let i=new URL(this.options.baseUrl||Be);i.pathname="/playground-v2-hge/v1/graphql";let{client:r,wsClient:d}=ge({url:i.toString(),fetch:this.options.fetch,headers:Object.assign(s(this.options.accessToken),this.options.headers)});this.wsClient=d,this.client=r}async getProjectInfo(){if(this.project)return this.project;let e=await X(this.client);if(!e)throw new Error("Project not found");let i=new URL(this.options.baseUrl||Be);return i.hostname.startsWith("promptql.")&&(i.hostname=`${e.projectName}${i.hostname.slice(8)}`),this.project={projectId:e.projectId,projectName:e.projectName,projectHost:i.toString(),promptqlConsoleUrl:e.promptqlConsoleUrl},this.project}close(){if(this.wsClient&&this.wsClient.dispose(),this.client){try{this.client.stop?.()}catch{}try{this.client.clearStore?.()}catch{}this.project=void 0}}};var f=class{api;constructor(e){this.api=e}async listMetadataByThreadId(e){let i=await this.api.getProjectInfo();return J(this.api.client,i.projectId,e)}async download(e,i){let r=await this.api.getProjectInfo();return $(r.projectHost,e,i,s(this.api.options.accessToken),this.api.options.fetch)}async getMetadata(e,i){let r=await this.api.getProjectInfo();return H(r.projectHost,e,i,s(this.api.options.accessToken),this.api.options.fetch)}};var c=class{api;constructor(e){this.api=e}info(){return this.api.getProjectInfo()}};var y=class{api;constructor(e){this.api=e}async list(e){return x(this.api.client,{...e,limit:e.limit&&e.limit>0?e.limit:10})}async getByName(e){return x(this.api.client,{where:{name:{_eq:e}},limit:1}).then(i=>i.length?i[0]??null:null)}async create(e){return Y(this.api.client,e)}};var g=class{api;constructor(e){this.api=e}async list(e){return ee(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 ne(this.api.client,e)}async start(e){let i=await this.api.getProjectInfo();return de(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 ie(this.api.client,e,i)}async getEvents(e,i){return v(this.api.client,e,i)}async sendMessage(e){return re(this.api.client,{...e,timezone:e.timezone||this.api.defaultTimezone})}async cancelAgentMessage(e){return te(this.api.client,e)}subscribeEvents(e,i){return ae(this.api.client,e,i)}streamMessageEvents(e,i){return _e(this.api.client,e,i)}};var k=class{api;constructor(e){this.api=e}async list(e){return oe(this.api.client,e)}async search(e){return ue(this.api.client,e)}async get(e,i){let r=await this.api.getProjectInfo();return se(this.api.client,r.projectId,e,i)}async create(e){return pe(this.api.client,e)}async update(e,i){return me(this.api.client,e,i)}async delete(e){return fe(this.api.client,e)}};var xe=class{constructor(e){let i=new m(e);this.api=i,this.thread=new g(i),this.project=new c(i),this.room=new y(i),this.artifact=new f(i),this.wiki=new k(i)}api;thread;project;room;artifact;wiki;close(){this.api.close()}};export{xe as PromptQLSdk,he as ROOM_NAME_REGEX,ke as USER_AGENT,s as buildAuthHeader,te as cancelAgentMessage,ge as createApolloClient,Y as createRoom,pe as createWikiPage,fe as deleteWikiPage,si as diffThreadEvents,$ as downloadArtifactData,yi as getAgentGeneratedResponse,ki as getAgentInteractionDecisionAcceptInteractionEvent,Bi as getAgentInteractionDecisionDeclineInteractionEvent,ji as getAgentInteractionFinishedEvent,gi as getAgentMessageProcessingStartedEvent,Ti as getAgentOrchestratorContextExplorerCompletedEvent,Oi as getAgentOrchestratorContextExplorerStartedEvent,u as getAgentOrchestratorContextExplorerUpdateEvent,Mi as getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent,Fi as getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent,Vi as getAgentOrchestratorSchemaExplorerCompletedEvent,Ii as getAgentOrchestratorSchemaExplorerGeneratedCodeEvent,qi as getAgentOrchestratorSchemaExplorerSchemaExploredEvent,Ui as getAgentOrchestratorSchemaExplorerStartedEvent,o as getAgentOrchestratorSchemaExplorerUpdateEvent,Ni as getAgentOrchestratorSchemaTasksGeneratedEvent,Ci as getAgentOrchestratorSchemaTasksGenerationCompletedEvent,Pi as getAgentOrchestratorSchemaTasksGenerationStartedEvent,T as getAgentOrchestratorSchemaTasksGenerationUpdateEvent,Di as getAgentOrchestratorStepProgrammerEvent,Ri as getAgentOrchestratorStepSavedProgramRunnerEvent,wi as getAgentOrchestratorStepUiProgrammerEvent,A as getAgentOrchestratorStepUpdateEvent,E as getAgentOrchestratorUpdateEvent,bi as getAgentOrchestratorWikiExplorerCompletedEvent,Ai as getAgentOrchestratorWikiExplorerStartedEvent,O as getAgentOrchestratorWikiExplorerUpdateEvent,Si as getAgentOrchestratorWikiInfoGeneratedEvent,fi as getAgentPlanGenerationStartedEvent,ci as getAgentPlanStepGeneratedEvent,vi as getAgentPlanningDecisionCompletedEvent,hi as getAgentPlanningDecisionPlanningRequiredEvent,xi as getAgentPlanningDecisionStartedEvent,h as getAgentPlanningDecisionUpdateEvent,Ei as getAgentStartingOrchestratorEvent,H as getArtifactMetadata,X as getProjectInfo,ne as getThread,ie as getThreadAndEvents,Gi as getThreadEventMessageId,v as getThreadEvents,mi as getUserCancelEvent,pi as getUserMessageEvent,se as getWikiPage,Se as isInteractionAnalyzing,J as listArtifactMetadataByThreadId,x as listRooms,ee as listThreads,oe as listWikiPages,ue as searchWikiPages,re as sendThreadMessage,de as startThread,_e as streamThreadMessageEvents,ae as subscribeThreadEvents,me as updateWikiPage,Ee as validateRoomName};
1
+ import{a as b,c as B}from"./chunk-WIDMKT3J.mjs";var S={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CancelAgentMessage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"threadId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"messageId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"cancel_agent_message"},arguments:[{kind:"Argument",name:{kind:"Name",value:"threadId"},value:{kind:"Variable",name:{kind:"Name",value:"threadId"}}},{kind:"Argument",name:{kind:"Name",value:"agentMessageId"},value:{kind:"Variable",name:{kind:"Name",value:"messageId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}}]}}]}}]},C={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"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"allowCrossRoomAccess"}},type:{kind:"NamedType",name:{kind:"Name",value:"Boolean"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"scopeClaims"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ScopeClaimInput"}}}}}],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"}}},{kind:"Argument",name:{kind:"Name",value:"allowCrossRoomAccess"},value:{kind:"Variable",name:{kind:"Name",value:"allowCrossRoomAccess"}}},{kind:"Argument",name:{kind:"Name",value:"scopeClaims"},value:{kind:"Variable",name:{kind:"Name",value:"scopeClaims"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"room_id"}}]}}]}}]},N={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"SendThreadMessage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"message"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"timezone"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"threadId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"uploads"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UserUploadInput"}}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"send_thread_message"},arguments:[{kind:"Argument",name:{kind:"Name",value:"threadId"},value:{kind:"Variable",name:{kind:"Name",value:"threadId"}}},{kind:"Argument",name:{kind:"Name",value:"timezone"},value:{kind:"Variable",name:{kind:"Name",value:"timezone"}}},{kind:"Argument",name:{kind:"Name",value:"message"},value:{kind:"Variable",name:{kind:"Name",value:"message"}}},{kind:"Argument",name:{kind:"Name",value:"buildFqdn"},value:{kind:"Variable",name:{kind:"Name",value:"buildFqdn"}}},{kind:"Argument",name:{kind:"Name",value:"uploads"},value:{kind:"Variable",name:{kind:"Name",value:"uploads"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"message_id"}}]}}]}}]},P={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"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"llmConfigId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"roomless"}},type:{kind:"NamedType",name:{kind:"Name",value:"Boolean"}},defaultValue:{kind:"BooleanValue",value:!1}}],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"}}},{kind:"Argument",name:{kind:"Name",value:"llmConfigId"},value:{kind:"Variable",name:{kind:"Name",value:"llmConfigId"}}},{kind:"Argument",name:{kind:"Name",value:"roomless"},value:{kind:"Variable",name:{kind:"Name",value:"roomless"}}}],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:"message_id"}},{kind:"Field",name:{kind:"Name",value:"thread_events"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"thread_event_id"}}]}}]}}]}}]},U={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateWikiPage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"pageContent"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"jsonb"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"pageId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"skipBuild"}},type:{kind:"NamedType",name:{kind:"Name",value:"Boolean"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"scopeClaims"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ScopeClaimInput"}}}}}],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"}}},{kind:"Argument",name:{kind:"Name",value:"skipBuild"},value:{kind:"Variable",name:{kind:"Name",value:"skipBuild"}}},{kind:"Argument",name:{kind:"Name",value:"scopeClaims"},value:{kind:"Variable",name:{kind:"Name",value:"scopeClaims"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}}]}}]}}]},V={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"UpdateWikiPage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"pageContent"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"jsonb"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"expectedLastModified"}},type:{kind:"NamedType",name:{kind:"Name",value:"timestamptz"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"pageId"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"skipBuild"}},type:{kind:"NamedType",name:{kind:"Name",value:"Boolean"}}}],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"}}},{kind:"Argument",name:{kind:"Name",value:"expectedLastModified"},value:{kind:"Variable",name:{kind:"Name",value:"expectedLastModified"}}},{kind:"Argument",name:{kind:"Name",value:"pageId"},value:{kind:"Variable",name:{kind:"Name",value:"pageId"}}},{kind:"Argument",name:{kind:"Name",value:"skipBuild"},value:{kind:"Variable",name:{kind:"Name",value:"skipBuild"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"buildVersion"}}]}}]}}]},M={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"DeleteWikiPage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki_delete"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"buildVersion"}}]}}]}}]},F={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetArtifactsByThreadId"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"threadId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"artifacts"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_artifacts"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_id"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"_eq"},value:{kind:"Variable",name:{kind:"Name",value:"threadId"}}}]}}]}}]}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"updated_at"},value:{kind:"EnumValue",value:"asc"}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"artifact_id"}},{kind:"Field",name:{kind:"Name",value:"latest_version_object"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"user_id"}},{kind:"Field",name:{kind:"Name",value:"artifact_metadata"}},{kind:"Field",name:{kind:"Name",value:"artifact_type"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"size"}},{kind:"Field",name:{kind:"Name",value:"version"}}]}}]}}]}}]},I={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"ListGuidePages"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_guide_page_order_by"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_guide_page_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_guide_page"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"page_title"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"last_modified_at"}}]}}]}}]},w={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetGuidePage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"project_id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"page_id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_guide_page"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"project_id"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"_eq"},value:{kind:"Variable",name:{kind:"Name",value:"project_id"}}}]}},{kind:"ObjectField",name:{kind:"Name",value:"id"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"_eq"},value:{kind:"Variable",name:{kind:"Name",value:"page_id"}}}]}},{kind:"ObjectField",name:{kind:"Name",value:"deleted_at"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"_is_null"},value:{kind:"BooleanValue",value:!0}}]}}]}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"IntValue",value:"1"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"page_title"}},{kind:"Field",name:{kind:"Name",value:"details"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"last_modified_at"}}]}}]}}]},R={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"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"}},{kind:"Field",name:{kind:"Name",value:"promptqlUserId"}},{kind:"Field",name:{kind:"Name",value:"controlPlaneUserId"}}]}}]}}]},q={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetRooms"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"rooms_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"rooms_order_by"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}},defaultValue:{kind:"IntValue",value:"10"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"rooms"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Room"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Room"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"rooms"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"room_id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"project_id"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"user_id"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}}]}}]},D={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreads"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"threads_v2_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"threads_v2_order_by"}}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"threads_v2"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Thread"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Thread"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"threads_v2"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"build_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"relevant_event_count"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]},j={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreadById"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"uuid"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"threads_v2_by_pk"},arguments:[{kind:"Argument",name:{kind:"Name",value:"thread_id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"Thread"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"Thread"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"threads_v2"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_id"}},{kind:"Field",name:{kind:"Name",value:"build_id"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"relevant_event_count"}},{kind:"Field",name:{kind:"Name",value:"visibility"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"updated_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]},W={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"}}]}}]},G={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetThreadEvents"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"ordering"}},type:{kind:"NamedType",name:{kind:"Name",value:"order_by"}},defaultValue:{kind:"EnumValue",value:"asc"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"Variable",name:{kind:"Name",value:"ordering"}}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadEvent"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"thread_events"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]},z={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"ListWikiPages"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"order_by"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_wiki_order_by"}}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_wiki_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki"},arguments:[{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"Variable",name:{kind:"Name",value:"order_by"}}},{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"page_id"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"last_modified_at"}},{kind:"Field",alias:{kind:"Name",value:"title"},name:{kind:"Name",value:"content"},arguments:[{kind:"Argument",name:{kind:"Name",value:"path"},value:{kind:"StringValue",value:"title",block:!1}}]},{kind:"Field",alias:{kind:"Name",value:"stub"},name:{kind:"Name",value:"content"},arguments:[{kind:"Argument",name:{kind:"Name",value:"path"},value:{kind:"StringValue",value:"stub",block:!1}}]},{kind:"Field",alias:{kind:"Name",value:"aliases"},name:{kind:"Name",value:"content"},arguments:[{kind:"Argument",name:{kind:"Name",value:"path"},value:{kind:"StringValue",value:"aliases",block:!1}}]},{kind:"Field",alias:{kind:"Name",value:"definition"},name:{kind:"Name",value:"content"},arguments:[{kind:"Argument",name:{kind:"Name",value:"path"},value:{kind:"StringValue",value:"definition",block:!1}}]}]}}]}}]},L={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetWikiPage"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"admin_wiki_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki"},arguments:[{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"IntValue",value:"1"}},{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"page_id"}},{kind:"Field",name:{kind:"Name",value:"content"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"last_modified_at"}}]}}]}}]},Q={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"SearchWikiPages"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"query"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"offset"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin_wiki_search"},arguments:[{kind:"Argument",name:{kind:"Name",value:"query"},value:{kind:"Variable",name:{kind:"Name",value:"query"}}},{kind:"Argument",name:{kind:"Name",value:"offset"},value:{kind:"Variable",name:{kind:"Name",value:"offset"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"totalCount"}},{kind:"Field",name:{kind:"Name",value:"results"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"score"}},{kind:"Field",name:{kind:"Name",value:"page"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"aliases"}},{kind:"Field",name:{kind:"Name",value:"definition"}},{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"namespace"}},{kind:"Field",name:{kind:"Name",value:"stub"}},{kind:"Field",name:{kind:"Name",value:"title"}}]}},{kind:"Field",name:{kind:"Name",value:"metadata"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"createdAt"}},{kind:"Field",name:{kind:"Name",value:"ownerId"}},{kind:"Field",name:{kind:"Name",value:"lastUpdatedAt"}}]}}]}}]}}]}}]},K={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"subscription",name:{kind:"Name",value:"SubscribeThreadEvents"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"where"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"thread_events_bool_exp"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_events"},arguments:[{kind:"Argument",name:{kind:"Name",value:"where"},value:{kind:"Variable",name:{kind:"Name",value:"where"}}},{kind:"Argument",name:{kind:"Name",value:"order_by"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"thread_event_id"},value:{kind:"EnumValue",value:"asc"}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadEvent"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadEvent"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"thread_events"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"thread_event_id"}},{kind:"Field",name:{kind:"Name",value:"event_data"}},{kind:"Field",name:{kind:"Name",value:"created_at"}},{kind:"Field",name:{kind:"Name",value:"user"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ThreadUserInfo"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ThreadUserInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"promptql_users"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"promptql_user_id"}},{kind:"Field",name:{kind:"Name",value:"display_name"}}]}}]};async function $(n,e,i,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 ve=t.body?await t.text():t.statusText;throw new Error(`[${t.status}] failed to download artifact: ${ve}`)}return t.body?t.headers.get("Content-Type")?.startsWith("application/json")?t.json():t.text():null}async function J(n,e,i){let r=await n.query({query:F,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 H(n,e,i,r,d){let a=`${n}/promptql-v2/artifacts/${e}/version/${i}/metadata`,t=await(typeof d=="function"?d:fetch)(a,{method:"GET",headers:r});if(t.status!==200){let l=t.body?await t.text():t.statusText;throw new Error(`[${t.status}] failed to get artifact metadata: ${l}`)}return t.json()}async function X(n){return(await n.query({query:R,fetchPolicy:"no-cache"})).data?.get_project_info}function x(n,e){return n.query({query:q,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(i=>i.data?.rooms??[])}function Y(n,e){if(!e.name)throw new Error("Room name is required");let i=he(e.name);if(i)throw new Error(i);return n.mutate({mutation:C,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 Ee=/^[\p{Ll}\p{Lo}\p{N}]+([_-][\p{Ll}\p{Lo}\p{N}]+)*$/u,Z=80,he=n=>{let e=n.trim();return e.length===0?null:e.length>Z?`Room name must be ${Z} characters or less`:/[^\p{Ll}\p{Lo}\p{N}_-]/u.test(e)?"Only lowercase letters, numbers, hyphens, and underscores are allowed.":/^[_-]|[_-]$/.test(e)?"Room name should not start or end with a hyphen or underscore.":/[-_]{2,}/.test(e)?"Room name should not contain consecutive hyphens or underscores.":Ee.test(e)?null:"Room name is invalid. Only lowercase letters, numbers, hyphens, and underscores are allowed."};import{defer as Oe,map as Ae,repeat as Te,takeWhile as be}from"rxjs";function ee(n,e){return n.query({query:D,variables:{...e,limit:e.limit&&e.limit>0?e.limit:10},fetchPolicy:"no-cache"}).then(i=>i.data?.threads_v2??[])}function ne(n,e){if(!e)throw new Error("threadId is required");return n.query({query:j,variables:{id:e},fetchPolicy:"no-cache"}).then(i=>i.data?.threads_v2_by_pk)}function ie(n,e,i){let r=le(e,i);return n.query({query:W,variables:{id:e,eventsWhere:r.where,eventsLimit:r.limit,eventsOrdering:r.ordering},fetchPolicy:"no-cache"}).then(d=>d.data?.threads_v2_by_pk)}function de(n,e){if(!e.message.trim())throw new Error("message must not be empty");return n.mutate({mutation:P,variables:e}).then(i=>{if(!i.data?.start_thread)throw new Error(i.error?.message||"Failed to start thread");return i.data.start_thread})}function v(n,e,i){return n.query({query:G,variables:le(e,i),fetchPolicy:"no-cache"}).then(r=>r.data?.thread_events??[])}function re(n,e){if(!e.threadId)throw new Error("threadId is required");if(!e.message.trim())throw new Error("message must not be empty");return n.mutate({mutation:N,variables:e}).then(i=>{if(!i.data?.send_thread_message)throw new Error(i.error?.message||"Failed to send message to thread");return i.data.send_thread_message})}function te(n,e){if(!e.threadId)throw new Error("threadId is required");if(!e.messageId.trim())throw new Error("messageId is required");return n.mutate({mutation:S,variables:e}).then(i=>{if(!i.data?.cancel_agent_message)throw new Error(i.error?.message||"Failed to cancel thread");return i.data.cancel_agent_message.thread_event_id})}function ae(n,e,i){if(!e)throw new Error("threadId is required");B(i);let r={thread_id:{_eq:e}};return i&&(r.thread_event_id={_gte:i}),n.subscribe({query:K,variables:{where:r}}).pipe(Ae(d=>{if(d.error)throw d.error;return d.data?.thread_events??[]}))}function _e(n,e,i){if(!e)throw new Error("threadId is required");let r,d=B(i?.fromEventId),a={eventId:i?.fromEventId?{_gte:d}:void 0,messageId:i?.messageId},_=i?.pollingInterval&&i?.pollingInterval>0?i.pollingInterval:5;return Oe(async()=>{let t=r?{messageId:i?.messageId,eventId:{_gt:r}}:a,l=await v(n,e,t);return l.length>0&&(r=l[l.length-1]?.thread_event_id),l}).pipe(Te({count:i?.timeout&&i.timeout>0?Math.ceil(i.timeout/_):void 0,delay:_*1e3}),be(t=>Se(t,i?.skipAnalysis),!0))}function Se(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 Ce(n){return[{event_data:{_contains:{UserMessage:{message_id:n}}}},{event_data:{_contains:{AgentMessage:{message_id:n}}}},{event_data:{_contains:{UserCancel:{message_id:n}}}}]}var le=(n,e)=>{if(!n)throw new Error("threadId is required");let i={thread_id:{_eq:n}};return e&&(e.eventId&&(i.thread_event_id=e.eventId),e.messageId&&(i._or=Ce(e.messageId))),{where:i,limit:e?.limit,ordering:e?.ordering||"asc"}};var p=["guide","regular"];async function oe(n,e){let i=e.namespace||"regular";if(!p.includes(i))throw new Error(`Invalid namespace. Expected one of: ${p}`);if(i==="guide"){let _={deleted_at:{_is_null:!0}};return e.project_id&&(_.project_id={_eq:e.project_id}),e.query&&(_.page_title={_ilike:e.query.toLowerCase()}),Pe(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 Ne(n,d);return r?Me(a,e):a}async function ue(n,e){if(!e.query)throw new Error("query is required");return n.query({query:Q,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 se(n,e,i,r){if(i=i||"regular",!p.includes(i))throw new Error(`Invalid namespace. Expected one of: ${p}`);if(!e)throw new Error("projectId is required");if(!r)throw new Error("identifier is required");if(i==="guide")return Ve(n,{project_id:e,page_id:r});let d={project_id:{_eq:e},deleted_at:{_is_null:!0}};return b.test(r)?d.id={_eq:r}:d.page_id={_eq:r},Ue(n,{where:d})}function pe(n,{slug:e,...i}){if(!i.title)throw new Error("Wiki title is required");if(!i.stub&&!i.definition)throw new Error("Wiki definition is required");return n.mutate({mutation:U,variables:{pageId:e,pageContent:i},fetchPolicy:"no-cache"}).then(r=>r.data?.admin_wiki_add?.id)}function me(n,e,i){if(!e)throw new Error("ID of the wiki is required");return n.mutate({mutation:V,variables:{id:e,pageContent:i},fetchPolicy:"no-cache"}).then(r=>r.data?.admin_wiki_update?.buildVersion)}function fe(n,e){if(!e)throw new Error("ID of the wiki is required");return n.mutate({mutation:M,variables:{id:e},fetchPolicy:"no-cache"}).then(i=>i.data?.admin_wiki_delete?.buildVersion)}function Ne(n,e){return n.query({query:z,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 Pe(n,e){return n.query({query:I,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 Ue(n,e){let i=await n.query({query:L,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 Ve(n,e){let i=await n.query({query:w,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 Me(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}import{ApolloClient as ce,ApolloLink as Fe,HttpLink as Ie,InMemoryCache as ye}from"@apollo/client";import{SetContextLink as we}from"@apollo/client/link/context";import{GraphQLWsLink as Re}from"@apollo/client/link/subscriptions";import{OperationTypeNode as qe}from"graphql";import{createClient as De}from"graphql-ws";var ge=n=>{let e=new Ie({uri:n.url,fetch:n.fetch,headers:typeof n.headers=="object"?n.headers:void 0}),i=async t=>{let l=typeof n.headers=="object"?n.headers:await n.headers();return{headers:{...t,...l}}},r=typeof n.headers=="object"?e:new we(({headers:t})=>i(t)).concat(e);if(n.disableSubscriptions)return{client:new ce({link:r,cache:new ye}),wsClient:null};let d=De({url:n.url,connectionParams:()=>i(),lazy:!0}),a=new Re(d),_=Fe.split(({operationType:t})=>t===qe.SUBSCRIPTION,a,r);return{client:new ce({link:_,cache:new ye}),wsClient:d}};var ke="PromptQL TypeScript SDK";function si(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 pi(n){return"UserMessage"in n?n.UserMessage:null}function mi(n){return"UserCancel"in n?n.UserCancel:null}function fi(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 ci(n){let e=h(n);return!e||!("PlanStepGenerated"in e)?null:e.PlanStepGenerated}function yi(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 gi(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 ki(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 Bi(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 E(n){return!("AgentMessage"in n)||!("PlanningDecisionUpdate"in n.AgentMessage.update)?null:n.AgentMessage.update.PlanningDecisionUpdate.update}function xi(n){let e=E(n);return!e||!("Started"in e)?null:e.Started}function vi(n){let e=E(n);return!e||!("Completed"in e)?null:e.Completed}function Ei(n){let e=E(n);return!e||!("PlanningRequired"in e)?null:e.PlanningRequired}function hi(n){return!("AgentMessage"in n)||!("StartingOrchestrator"in n.AgentMessage.update)?null:n.AgentMessage.update.StartingOrchestrator}function h(n){return!("AgentMessage"in n)||!("OrchestratorUpdate"in n.AgentMessage.update)?null:n.AgentMessage.update.OrchestratorUpdate.update}function u(n){let e=h(n);return!e||!("ContextExplorerUpdate"in e)?null:e.ContextExplorerUpdate.update}function Oi(n){let e=u(n);return!e||!("Started"in e)?null:e.Started}function Ai(n){let e=u(n);return!e||!("Completed"in e)?null:e.Completed}function O(n){let e=u(n);return!e||!("WikiExplorerUpdate"in e)?null:e.WikiExplorerUpdate.update}function Ti(n){let e=O(n);return!e||!("Started"in e)?null:e.Started}function bi(n){let e=O(n);return!e||!("Completed"in e)?null:e.Completed}function Si(n){let e=O(n);return!e||!("WikiInfoGenerated"in e)?null:e.WikiInfoGenerated}function A(n){let e=u(n);return!e||!("SchemaTasksGenerationUpdate"in e)?null:e.SchemaTasksGenerationUpdate.update}function Ci(n){let e=A(n);return!e||!("Started"in e)?null:e.Started}function Ni(n){let e=A(n);return!e||!("Completed"in e)?null:e.Completed}function Pi(n){let e=A(n);return!e||!("TasksGenerated"in e)?null:e.TasksGenerated}function o(n){let e=u(n);return!e||!("SchemaExplorerUpdate"in e)?null:e.SchemaExplorerUpdate.update}function Ui(n){let e=o(n);return!e||!("Started"in e)?null:e.Started}function Vi(n){let e=o(n);return!e||!("Completed"in e)?null:e.Completed}function Mi(n){let e=o(n);return!e||!("CodeExecutionComplete"in e)?null:e.CodeExecutionComplete}function Fi(n){let e=o(n);return!e||!("CodeOutputAnalyzed"in e)?null:e.CodeOutputAnalyzed}function Ii(n){let e=o(n);return!e||!("GeneratedCode"in e)?null:e.GeneratedCode}function wi(n){let e=o(n);return!e||!("SchemaExplored"in e)?null:e.SchemaExplored}function T(n){let e=h(n);return!e||!("StepUpdate"in e)?null:e.StepUpdate}function Ri(n){let e=T(n);return!e||!("Programmer"in e.update)?null:e.update.Programmer}function qi(n){let e=T(n);return!e||!("UiProgrammer"in e.update)?null:e.update.UiProgrammer}function Di(n){let e=T(n);return!e||!("SavedProgramRunner"in e.update)?null:e.update.SavedProgramRunner}function ji(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 Wi(n){if(n){if("UserMessage"in n)return n.UserMessage.message_id;if("AgentMessage"in n)return n.AgentMessage.message_id;if("UserTeach"in n)return n.UserTeach.agent_message_id;if("UserCancel"in n)return n.UserCancel.message_id}}function s(n){return{Authorization:`pat ${n}`,"User-Agent":ke}}var Be="https://promptql.ddn.hasura.app",m=class{options;defaultTimezone;client;wsClient;project;constructor(e){if(this.options=e,!e.accessToken)throw new Error("accessToken is required");this.defaultTimezone=e.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone;let i=new URL(this.options.baseUrl||Be);i.pathname="/playground-v2-hge/v1/graphql";let{client:r,wsClient:d}=ge({url:i.toString(),fetch:this.options.fetch,headers:Object.assign(s(this.options.accessToken),this.options.headers)});this.wsClient=d,this.client=r}async getProjectInfo(){if(this.project)return this.project;let e=await X(this.client);if(!e)throw new Error("Project not found");let i=new URL(this.options.baseUrl||Be);return i.hostname.startsWith("promptql.")&&(i.hostname=`${e.projectName}${i.hostname.slice(8)}`),this.project={projectId:e.projectId,projectName:e.projectName,projectHost:i.toString(),promptqlConsoleUrl:e.promptqlConsoleUrl},this.project}close(){if(this.wsClient&&this.wsClient.dispose(),this.client){try{this.client.stop?.()}catch{}try{this.client.clearStore?.()}catch{}this.project=void 0}}};var f=class{api;constructor(e){this.api=e}async listMetadataByThreadId(e){let i=await this.api.getProjectInfo();return J(this.api.client,i.projectId,e)}async download(e,i){let r=await this.api.getProjectInfo();return $(r.projectHost,e,i,s(this.api.options.accessToken),this.api.options.fetch)}async getMetadata(e,i){let r=await this.api.getProjectInfo();return H(r.projectHost,e,i,s(this.api.options.accessToken),this.api.options.fetch)}};var c=class{api;constructor(e){this.api=e}info(){return this.api.getProjectInfo()}};var y=class{api;constructor(e){this.api=e}async list(e){return x(this.api.client,{...e,limit:e.limit&&e.limit>0?e.limit:10})}async getByName(e){return x(this.api.client,{where:{name:{_eq:e}},limit:1}).then(i=>i.length?i[0]??null:null)}async create(e){return Y(this.api.client,e)}};var g=class{api;constructor(e){this.api=e}async list(e){return ee(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 ne(this.api.client,e)}async start(e){let i=await this.api.getProjectInfo();return de(this.api.client,{...e,projectId:i.projectId,timezone:e.timezone||this.api.defaultTimezone})}async detail(e,i){return ie(this.api.client,e,i)}async getEvents(e,i){return v(this.api.client,e,i)}async sendMessage(e){return re(this.api.client,{...e,timezone:e.timezone||this.api.defaultTimezone})}async cancelAgentMessage(e){return te(this.api.client,e)}subscribeEvents(e,i){return ae(this.api.client,e,i)}streamMessageEvents(e,i){return _e(this.api.client,e,i)}};var k=class{api;constructor(e){this.api=e}async list(e){return oe(this.api.client,e)}async search(e){return ue(this.api.client,e)}async get(e,i){let r=await this.api.getProjectInfo();return se(this.api.client,r.projectId,e,i)}async create(e){return pe(this.api.client,e)}async update(e,i){return me(this.api.client,e,i)}async delete(e){return fe(this.api.client,e)}};var xe=class{constructor(e){let i=new m(e);this.api=i,this.thread=new g(i),this.project=new c(i),this.room=new y(i),this.artifact=new f(i),this.wiki=new k(i)}api;thread;project;room;artifact;wiki;close(){this.api.close()}};export{xe as PromptQLSdk,Ee as ROOM_NAME_REGEX,ke as USER_AGENT,s as buildAuthHeader,te as cancelAgentMessage,ge as createApolloClient,Y as createRoom,pe as createWikiPage,fe as deleteWikiPage,si as diffThreadEvents,$ as downloadArtifactData,yi as getAgentGeneratedResponse,ki as getAgentInteractionDecisionAcceptInteractionEvent,Bi as getAgentInteractionDecisionDeclineInteractionEvent,ji as getAgentInteractionFinishedEvent,gi as getAgentMessageProcessingStartedEvent,Ai as getAgentOrchestratorContextExplorerCompletedEvent,Oi as getAgentOrchestratorContextExplorerStartedEvent,u as getAgentOrchestratorContextExplorerUpdateEvent,Mi as getAgentOrchestratorSchemaExplorerCodeExecutionCompleteEvent,Fi as getAgentOrchestratorSchemaExplorerCodeOutputAnalyzedEvent,Vi as getAgentOrchestratorSchemaExplorerCompletedEvent,Ii as getAgentOrchestratorSchemaExplorerGeneratedCodeEvent,wi as getAgentOrchestratorSchemaExplorerSchemaExploredEvent,Ui as getAgentOrchestratorSchemaExplorerStartedEvent,o as getAgentOrchestratorSchemaExplorerUpdateEvent,Pi as getAgentOrchestratorSchemaTasksGeneratedEvent,Ni as getAgentOrchestratorSchemaTasksGenerationCompletedEvent,Ci as getAgentOrchestratorSchemaTasksGenerationStartedEvent,A as getAgentOrchestratorSchemaTasksGenerationUpdateEvent,Ri as getAgentOrchestratorStepProgrammerEvent,Di as getAgentOrchestratorStepSavedProgramRunnerEvent,qi as getAgentOrchestratorStepUiProgrammerEvent,T as getAgentOrchestratorStepUpdateEvent,h as getAgentOrchestratorUpdateEvent,bi as getAgentOrchestratorWikiExplorerCompletedEvent,Ti as getAgentOrchestratorWikiExplorerStartedEvent,O as getAgentOrchestratorWikiExplorerUpdateEvent,Si as getAgentOrchestratorWikiInfoGeneratedEvent,fi as getAgentPlanGenerationStartedEvent,ci as getAgentPlanStepGeneratedEvent,vi as getAgentPlanningDecisionCompletedEvent,Ei as getAgentPlanningDecisionPlanningRequiredEvent,xi as getAgentPlanningDecisionStartedEvent,E as getAgentPlanningDecisionUpdateEvent,hi as getAgentStartingOrchestratorEvent,H as getArtifactMetadata,X as getProjectInfo,ne as getThread,ie as getThreadAndEvents,Wi as getThreadEventMessageId,v as getThreadEvents,mi as getUserCancelEvent,pi as getUserMessageEvent,se as getWikiPage,Se as isInteractionAnalyzing,J as listArtifactMetadataByThreadId,x as listRooms,ee as listThreads,oe as listWikiPages,ue as searchWikiPages,re as sendThreadMessage,de as startThread,_e as streamThreadMessageEvents,ae as subscribeThreadEvents,me as updateWikiPage,he as validateRoomName};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hasura/promptql",
3
3
  "description": "A Typescript SDK allows you to interact with PromptQL API",
4
- "version": "2.0.0-alpha.41",
4
+ "version": "2.0.0-alpha.42",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Hasura",
7
7
  "homepage": "https://promptql.hasura.io",
@@ -39,10 +39,10 @@
39
39
  "typescript": "6.0.3"
40
40
  },
41
41
  "dependencies": {
42
- "@apollo/client": "^4.2.0",
42
+ "@apollo/client": "^4.2.4",
43
43
  "@graphql-typed-document-node/core": "^3.2.0",
44
44
  "graphql": "^16.14.0",
45
45
  "graphql-ws": "^6.0.8",
46
46
  "rxjs": "^7.8.2"
47
47
  }
48
- }
48
+ }