vibe64 0.1.66 → 0.1.68

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.
Files changed (122) hide show
  1. package/bin/run.js +1986 -1348
  2. package/bin/server.js +210 -207
  3. package/bin/upgrade-state.js +3862 -3786
  4. package/dist/assets/{GithubBrowserTabs-Bf5z_PiF.js → GithubBrowserTabs-CW3GBeJu.js} +1 -1
  5. package/dist/assets/{LocalDatabaseServer-CcfGbn7H.js → LocalDatabaseServer-DYh3UF9q.js} +1 -1
  6. package/dist/assets/{ShellOutlet-DPyl05um.js → ShellOutlet-DkLdtzJW.js} +1 -1
  7. package/dist/assets/{Vibe64AuthSettingsButton-CxJoeOhz.js → Vibe64AuthSettingsButton-Cksj7FS6.js} +1 -1
  8. package/dist/assets/{Vibe64AuthSettingsButton-DFfFPrd7.css → Vibe64AuthSettingsButton-DfKYI6ZS.css} +1 -1
  9. package/dist/assets/{Vibe64ConversationLog-jDb_ZvIF.js → Vibe64ConversationLog-BC0eDtUP.js} +1 -1
  10. package/dist/assets/{Vibe64DashboardShell-Ce1PNB37.js → Vibe64DashboardShell-DX5dOXAB.js} +1 -1
  11. package/dist/assets/{Vibe64DatabaseWorkspace-DiZDKEpx.js → Vibe64DatabaseWorkspace-8i-RDc9y.js} +1 -1
  12. package/dist/assets/{Vibe64FileArea-uRnIJ0Vp.js → Vibe64FileArea-EK5yUio3.js} +1 -1
  13. package/dist/assets/{Vibe64OutputControls-BF5kh2_h.js → Vibe64OutputControls--LB4G83q.js} +1 -1
  14. package/dist/assets/{Vibe64SessionFiles-CxgPB8RR.js → Vibe64SessionFiles-DVHGc7hd.js} +1 -1
  15. package/dist/assets/{Vibe64SessionSourceEditor-yaVu279S.js → Vibe64SessionSourceEditor-Bws5ihr-.js} +1 -1
  16. package/dist/assets/{Vibe64UiStoryboardView-DhbHkz8K.js → Vibe64UiStoryboardView-BmABkyG4.js} +1 -1
  17. package/dist/assets/{Vibe64UnavailableSessions-MmPF-Db1.js → Vibe64UnavailableSessions-C6Bkwsqk.js} +1 -1
  18. package/dist/assets/{_pageId_-Zif-veil.js → _pageId_-FjW-3sqF.js} +1 -1
  19. package/dist/assets/{_sessionId_-DOge-7SB.js → _sessionId_-4cH83Bfi.js} +1 -1
  20. package/dist/assets/_slug_-Cazfy5ui.js +14 -0
  21. package/dist/assets/_slug_-DQDycgFK.css +1 -0
  22. package/dist/assets/{access-DQcblrWN.js → access-mxcxtn7b.js} +1 -1
  23. package/dist/assets/{app-CzApKPmq.js → app-8zP_FAuO.js} +1 -1
  24. package/dist/assets/assistantRouting-Bbxguvre.js +3 -0
  25. package/dist/assets/{client-13v_yX07.js → client-C1i-bIgL.js} +1 -1
  26. package/dist/assets/{client-Dl6I6IVb.js → client-C7yZ1hEm.js} +1 -1
  27. package/dist/assets/{client-Dv4scw6i.js → client-CQ49uWhR.js} +1 -1
  28. package/dist/assets/{client-C8ZjqGdQ.js → client-D46Uu-YO.js} +2 -2
  29. package/dist/assets/{client-5JUUGxRd.js → client-DKNTl1to.js} +2 -2
  30. package/dist/assets/{dashboard-Dm_xwwqU.js → dashboard-CMtWKazq.js} +1 -1
  31. package/dist/assets/{english-definitions-DwTf_alg.js → english-definitions-DiyU9O9D.js} +1 -1
  32. package/dist/assets/{env-B7wB5nBn.js → env-LUc22Wgd.js} +1 -1
  33. package/dist/assets/{error-HfzrYwkQ.js → error-BccdQn04.js} +1 -1
  34. package/dist/assets/{error-CtOws2EC.js → error-DPDAz9Td.js} +1 -1
  35. package/dist/assets/{health-DIkOkzPe.js → health-CfMjMJFf.js} +1 -1
  36. package/dist/assets/{history-Ch597NiY.js → history-hX_kNskf.js} +1 -1
  37. package/dist/assets/{i18n-DcNQE3tT.js → i18n-Dq-ep9n7.js} +1 -1
  38. package/dist/assets/index-BJWiPV6i.css +1 -0
  39. package/dist/assets/{index-DcKFCaBZ.js → index-FVeEbKiO.js} +4 -4
  40. package/dist/assets/{integrations-CoNhnGvq.js → integrations-Ccb8EOEO.js} +14 -15
  41. package/dist/assets/{integrations-CwgrZgmM.css → integrations-CtnIjM1Y.css} +1 -1
  42. package/dist/assets/{issues-Cem4Yt47.js → issues-Bxtt7oqi.js} +1 -1
  43. package/dist/assets/{learning-CU2QyHrj.js → learning-BUx9jo91.js} +1 -1
  44. package/dist/assets/{pages-BzA58NoR.js → pages-D43zM2UW.js} +1 -1
  45. package/dist/assets/{project-files-BBKjl3wZ.js → project-files-BX3zZCcl.js} +1 -1
  46. package/dist/assets/{publish-UFjblZA3.js → publish-DatierL2.js} +1 -1
  47. package/dist/assets/{pull-requests-DibGk1GB.js → pull-requests-DNkOjcuy.js} +1 -1
  48. package/dist/assets/{settings-BjOnPYwD.js → settings-DbR9JIc3.js} +1 -1
  49. package/dist/assets/{useArchivedVibe64Sessions-CXKRFR2f.js → useArchivedVibe64Sessions-B8VDhA9F.js} +1 -1
  50. package/dist/assets/{useCommand-yOr3U8KF.js → useCommand-CfqxMb4C.js} +1 -1
  51. package/dist/assets/{useUiFeedback--0dLsslR.js → useUiFeedback-8Wvg7A_S.js} +1 -1
  52. package/dist/assets/{useVibe64ConversationLog-BB5tVtkt.js → useVibe64ConversationLog-7wgLlKG5.js} +2 -2
  53. package/dist/assets/useVibe64Learning-DkneotqS.js +5 -0
  54. package/dist/assets/{useVibe64SessionData-BSYF_TgH.js → useVibe64SessionData-DuJ-dHR8.js} +1 -1
  55. package/dist/assets/{useVibe64SessionSelection-CxZ3uEAf.js → useVibe64SessionSelection-BwjtqeIR.js} +1 -1
  56. package/dist/assets/vibe64SavedEnvValues-CCZew0j7.js +1 -0
  57. package/dist/assets/{vibe64SessionFocus-DGSVXipO.js → vibe64SessionFocus-B4diopOJ.js} +1 -1
  58. package/dist/index.html +10 -10
  59. package/docs/colleague-usage/ai-accounts.md +7 -7
  60. package/docs/colleague-usage/ai-model-setups.md +1 -1
  61. package/docs/colleague-usage/auto-workflow.md +60 -40
  62. package/docs/colleague-usage/chat-settings.md +115 -114
  63. package/docs/colleague-usage/coding-agent-history.md +9 -0
  64. package/docs/colleague-usage/coding-agent-recovery.md +3 -0
  65. package/docs/colleague-usage/coding-agents.md +10 -4
  66. package/docs/colleague-usage/developing-vibe64.md +11 -5
  67. package/docs/colleague-usage/development-env.md +74 -32
  68. package/docs/colleague-usage/github-work.md +3 -2
  69. package/docs/colleague-usage/integrations.md +2 -2
  70. package/docs/colleague-usage/main-chat-approvals.md +7 -6
  71. package/docs/colleague-usage/message-delivery-recovery.md +1 -1
  72. package/docs/colleague-usage/passes.md +215 -41
  73. package/docs/colleague-usage/plans.md +27 -16
  74. package/docs/colleague-usage/session-timeline.md +93 -0
  75. package/docs/colleague-usage/temporary-chats.md +6 -0
  76. package/docs/colleague-usage/ui-pass.md +29 -35
  77. package/node_modules/@jskit-ai/assistant-core/CHANGELOG.md +4 -0
  78. package/node_modules/@jskit-ai/assistant-core/package.json +1 -1
  79. package/node_modules/@jskit-ai/assistant-runtime/CHANGELOG.md +3 -0
  80. package/node_modules/@jskit-ai/assistant-runtime/package.json +1 -1
  81. package/node_modules/@jskit-ai/assistant-voice/package.json +1 -1
  82. package/node_modules/@jskit-ai/connector-google-calendar/CHANGELOG.md +1 -0
  83. package/node_modules/@jskit-ai/connector-google-calendar/package.json +1 -1
  84. package/node_modules/@jskit-ai/connector-google-calendar/patterns/calendar-cli/example/.env.example +1 -0
  85. package/node_modules/@jskit-ai/connectors-catalog/CHANGELOG.md +1 -0
  86. package/node_modules/@jskit-ai/connectors-catalog/package.json +1 -1
  87. package/node_modules/@jskit-ai/connectors-catalog/patterns/api-key-connection/PATTERN.md +4 -1
  88. package/node_modules/@jskit-ai/connectors-catalog/patterns/oauth-connection/PATTERN.md +3 -1
  89. package/node_modules/@jskit-ai/connectors-core/CHANGELOG.md +1 -0
  90. package/node_modules/@jskit-ai/connectors-core/README.md +3 -1
  91. package/node_modules/@jskit-ai/connectors-core/package.json +1 -1
  92. package/node_modules/@jskit-ai/http-runtime/package.json +1 -1
  93. package/node_modules/@jskit-ai/kernel/CHANGELOG.md +1 -0
  94. package/node_modules/@jskit-ai/kernel/package.json +3 -4
  95. package/node_modules/@jskit-ai/payments-core/CHANGELOG.md +1 -0
  96. package/node_modules/@jskit-ai/payments-core/locales/en.json +1 -1
  97. package/node_modules/@jskit-ai/payments-core/package.json +1 -1
  98. package/node_modules/@jskit-ai/realtime/CHANGELOG.md +1 -0
  99. package/node_modules/@jskit-ai/realtime/package.json +1 -1
  100. package/node_modules/@jskit-ai/realtime/patterns/realtime-application/example/.env.example +1 -0
  101. package/node_modules/@jskit-ai/resource-core/package.json +1 -1
  102. package/node_modules/@jskit-ai/uploads-runtime/package.json +1 -1
  103. package/node_modules/@local/vibe64-core/package.json +2 -0
  104. package/node_modules/@local/vibe64-execution/package.json +1 -0
  105. package/node_modules/@local/vibe64-execution/src/host/execHelper.js +715 -666
  106. package/node_modules/@local/vibe64-genesis/bin/vibe64-genesis-host-context +873 -872
  107. package/node_modules/@local/vibe64-genesis/src/server/agentSpecs.js +137 -115
  108. package/node_modules/@local/vibe64-genesis/src/server/index.js +627 -612
  109. package/node_modules/@local/vibe64-genesis/src/server/promptContext.js +159 -157
  110. package/node_modules/@local/vibe64-runtime/package.json +1 -0
  111. package/node_modules/@local/vibe64-runtime/src/server/codexAppServerProcess.js +901 -900
  112. package/node_modules/@local/vibe64-terminals/package.json +2 -1
  113. package/node_modules/@local/vibe64-terminals/src/server/opencodeSessionEnvironmentPlugin.js +22 -22
  114. package/node_modules/@local/vibe64-terminals/src/server/sessionWorkOperationCommand.js +382 -380
  115. package/package.json +15 -15
  116. package/server.bundle.mjs +40053 -39872
  117. package/dist/assets/_slug_-C71iAiR0.js +0 -14
  118. package/dist/assets/_slug_-CF1TPDUv.css +0 -1
  119. package/dist/assets/assistantRouting-CqIiQy21.js +0 -3
  120. package/dist/assets/index-C-6c5Af1.css +0 -1
  121. package/dist/assets/useVibe64Learning-iAAH83uG.js +0 -5
  122. package/dist/assets/vibe64SavedEnvValues-CgfMvj_h.js +0 -1
@@ -1 +1 @@
1
- import{Et as unref,ht as proxyRefs,it as watch,mt as onScopeDispose,u as computed,vt as ref}from"./runtime-core.esm-bundler-Bi1P1jMa.js";import{N as useQueryClient,t as useEndpointResource}from"./useEndpointResource-BwGXpV2u.js";import{_ as useRouter,g as useRoute}from"./useApi-BPuI6ZR9-rsYWyW6m.js";import{s as normalizeObject}from"./normalize-BD25VwNK.js";import{o as projectSlugFromRoute}from"./vibe64ProjectScope.local-B9ZpdYlf.js";import{o as ROUTE_VISIBILITY_PUBLIC}from"./visibility-Cq31Xy7I.js";import{r as useRealtimeEvent}from"./useRealtimeEvent-B4oRg9Dt.js";import{t as useCommand}from"./useCommand-yOr3U8KF.js";import{t as usePaths}from"./usePaths-CvUbx5-V.js";import{t as useUiFeedback}from"./useUiFeedback--0dLsslR.js";import{t as readRefOrGetterValue}from"./vueRefOrGetterValue-y-4f_In7.js";import{r as vibe64RealtimeOriginPayload}from"./vibe64BrowserTabOrigin-vIN_87mi.js";import{H as vibe64SessionsQueryKey,I as vibe64SessionEventMatchesScope,L as vibe64SessionPath,V as vibe64SessionQueryKey,a as VIBE64_CURRENT_SESSION_API_SUFFIX,c as VIBE64_SESSION_SUMMARY_CHANGED_EVENT,o as VIBE64_SESSIONS_API_SUFFIX}from"./vibe64SessionRequestConfig-DVRCRAex.js";import{S as VIBE64_PROJECT_CHANGED_EVENT}from"./studioGateApi-B9EUTtMx.js";import{M as useVibe64ProjectSlug}from"./index-DcKFCaBZ.js";import{i as vibe64SessionDisplayTitle,o as vibe64SessionRevision,r as shortVibe64SessionId,t as isArchivedVibe64Session}from"./vibe64SessionViewModel-CQCds_jb.js";import{i as vibe64SessionDebugSummary,n as vibe64SessionDebugError,r as vibe64SessionDebugLog,t as vibe64SessionDebugDurationMs}from"./vibe64SessionDebugLog-BfO7tG1A.js";import{i as visibleVibe64Sessions,n as enrichVibe64SessionForDisplay}from"./vibe64SessionPanelModel-B-WkXnPu.js";import{n as useVibe64SessionSelection,t as selectedSessionIdFromRoute}from"./useVibe64SessionSelection-CxZ3uEAf.js";function refetchEndpointResource(resource){return resource.query.refetch({cancelRefetch:false})}function sessionChangedReason(payload){return String(payload.reason||``).trim()}function sessionRevision(value){const revision=Number(value);return Number.isSafeInteger(revision)&&revision>=0?revision:null}function agentTurnRealtimeOverlayFromPayload(input,selectedSessionId=``){const payload=normalizeObject(input);const changedSessionId=String(payload.sessionId||payload.entityId||``).trim();if(!changedSessionId||changedSessionId!==String(selectedSessionId||``).trim())return null;const agentSession=normalizeObject(payload.agentSession);const turn=normalizeObject(agentSession.turn);const run=normalizeObject(payload.agentRun);const revision=sessionRevision(payload.revision);if(revision===null||!Object.keys(turn).length&&!Object.keys(run).length)return null;const active=turn.active===true||run.active===true;return{active,agentRun:{...run,active},agentSession:{...agentSession,turn:{...turn,active}},reason:sessionChangedReason(payload),revision,sessionId:changedSessionId}}function latestAgentTurnRealtimeOverlay(current=null,candidate=null){if(!candidate)return current;if(!current||candidate.revision>current.revision)return candidate;return current}function mergeAgentRunOverlay(agentRuns=[],overlayRun={}){const runs=Array.isArray(agentRuns)?agentRuns:[];const runId=String(overlayRun.id||``).trim();if(!runId)return runs;const nextRun={...overlayRun,id:runId};const index=runs.findIndex(run=>String(run?.id||``).trim()===runId);if(index<0)return[...runs,nextRun];return runs.map((run,runIndex)=>runIndex===index?{...run,...nextRun}:run)}function sessionWithAgentTurnRealtimeOverlay(session=null,overlay=null){const currentRevision=sessionRevision(session?.revision);if(!session||!overlay||session?.ok===false||session.sessionId!==overlay.sessionId||currentRevision!==null&&overlay.revision<=currentRevision)return session;const overlayAgentSession=normalizeObject(overlay.agentSession);return{...session,agentRuns:mergeAgentRunOverlay(session.agentRuns,normalizeObject(overlay.agentRun)),agentSession:{...normalizeObject(session.agentSession),...overlayAgentSession,thread:{...normalizeObject(session.agentSession?.thread),...normalizeObject(overlayAgentSession.thread)},turn:{...normalizeObject(session.agentSession?.turn),...normalizeObject(overlayAgentSession.turn),active:overlay.active===true}},revision:overlay.revision}}function sessionRecordHasDetailProjection(session=null){return Boolean(session&&typeof session===`object`&&Object.hasOwn(session,`agentSession`))}function sessionRecordHasActiveAgentWork(session=null){return(session?.agentSession?.turn?.active??session?.agentActivity?.active)===true}function sessionRecordMatchesId(session=null,sessionId=``){const normalizedSessionId=String(sessionId||``).trim();return Boolean(normalizedSessionId&&session?.sessionId===normalizedSessionId&&session?.ok!==false)}function latestSessionDetailRecord(current=null,candidate=null,sessionId=``){if(!sessionRecordMatchesId(candidate,sessionId))return current;if(!sessionRecordMatchesId(current,sessionId))return candidate;const currentRevision=vibe64SessionRevision(current);const candidateRevision=vibe64SessionRevision(candidate);if(currentRevision!==null&&candidateRevision!==null&&candidateRevision<currentRevision)return current;return candidate}function mountedSessionRecord(detailSession=null,listSession=null,sessionId=``){const normalizedSessionId=String(sessionId||``).trim();const listSessionMatches=sessionRecordMatchesId(listSession,normalizedSessionId);if(!sessionRecordMatchesId(detailSession,normalizedSessionId))return listSessionMatches?listSession:null;const detailRevision=vibe64SessionRevision(detailSession);const listRevision=vibe64SessionRevision(listSession);if(listSessionMatches&&listRevision!==null&&detailRevision!==null&&listRevision>detailRevision){if(sessionRecordHasDetailProjection(detailSession)&&!sessionRecordHasDetailProjection(listSession))return detailSession;return listSession}return detailSession}function mountedSessionDetailRefreshReason(detailSession=null,listSession=null,sessionId=``){const normalizedSessionId=String(sessionId||``).trim();if(!sessionRecordMatchesId(detailSession,normalizedSessionId)||!sessionRecordMatchesId(listSession,normalizedSessionId))return``;const detailRevision=vibe64SessionRevision(detailSession);const listRevision=vibe64SessionRevision(listSession);if(listRevision!==null&&detailRevision!==null&&listRevision>detailRevision&&sessionRecordHasDetailProjection(detailSession)&&!sessionRecordHasDetailProjection(listSession))return`newer_summary_without_detail`;return``}function mountedSessionDetailLoadState({detailSession=null,fetching=false,listSession=null,loadError=``,loading=false,sessionId=``}={}){const normalizedSessionId=String(sessionId||``).trim();const hasDetail=sessionRecordMatchesId(detailSession,normalizedSessionId);const hasSummary=sessionRecordMatchesId(listSession,normalizedSessionId);const error=String(loadError||``).trim();if(!normalizedSessionId)return{error:``,label:``,loading:false,ready:false,restoring:false,sessionId:``,state:`summaryOnly`};if(error&&!hasDetail)return{error,label:`Session could not load.`,loading:false,ready:false,restoring:false,sessionId:normalizedSessionId,state:`detailError`};if(hasDetail)return{error:``,label:``,loading:false,ready:true,refreshing:Boolean(fetching||loading),restoring:false,sessionId:normalizedSessionId,state:`detailReady`};if(loading||fetching)return{error:``,label:`Loading session...`,loading:true,ready:false,restoring:false,sessionId:normalizedSessionId,state:`detailLoading`};return{error:``,label:hasSummary?`Session could not load.`:`Loading session...`,loading:false,ready:false,restoring:false,sessionId:normalizedSessionId,state:`summaryOnly`}}function mountedSessionRealtimeShouldRefresh({payload={}}={},sessionId=``,read=`includeDetail`){const changedSessionId=String(payload.sessionId||payload.entityId||``).trim();if(!changedSessionId||changedSessionId!==String(sessionId||``).trim())return false;return payload.clientRefresh?.[read]!==false}function useVibe64SessionDialogs({beginArchive,finishArchive,isSelectedSessionArchived,refreshSessionData,selectedSessionId,selectedSessionTitle,sessionsApiPath}){const archiveDialogOpen=ref(false);const archiveDialogSessionId=ref(``);const archiveDialogSessionTitle=ref(``);const archivingSessionId=ref(``);const resolvedSessionsApiPath=computed(()=>String(readRefOrGetterValue(sessionsApiPath)||``));const archiveCommand=useCommand({access:`never`,apiSuffix:VIBE64_SESSIONS_API_SUFFIX,buildRawPayload:()=>vibe64RealtimeOriginPayload(),buildCommandOptions:(_payload,{context})=>({method:`POST`,path:vibe64SessionPath(resolvedSessionsApiPath.value,context?.sessionId,`/archive`)}),fallbackRunError:`Vibe64 session could not be archived.`,messages:{error:`Vibe64 session could not be archived.`,success:`Vibe64 session archived.`},onRunSuccess:async response=>{if(response?.ok!==true)throw new Error(response?.errors?.[0]?.message||response?.error||`Vibe64 session could not be archived.`)},ownershipFilter:ROUTE_VISIBILITY_PUBLIC,placementSource:`vibe64.sessions.archive`,surfaceId:`app`,writeMethod:`POST`});function clearArchiveDialog(){archiveDialogOpen.value=false;archiveDialogSessionId.value=``;archiveDialogSessionTitle.value=``}function requestArchiveSelectedSession(){if(!unref(selectedSessionId)||archivingSessionId.value||archiveCommand.isRunning||unref(isSelectedSessionArchived))return;archiveDialogSessionId.value=unref(selectedSessionId);archiveDialogSessionTitle.value=unref(selectedSessionTitle);archiveDialogOpen.value=true}function cancelArchiveSession(){if(!archiveCommand.isRunning)clearArchiveDialog()}async function confirmArchiveSession(){if(!archiveDialogSessionId.value||archivingSessionId.value||archiveCommand.isRunning)return false;const sessionId=archiveDialogSessionId.value;archivingSessionId.value=sessionId;clearArchiveDialog();const archiveScope=beginArchive(sessionId);let succeeded=false;try{const response=await archiveCommand.run({sessionId});succeeded=response?.ok===true;return response}catch{return false}finally{finishArchive(sessionId,succeeded,archiveScope);if(archivingSessionId.value===sessionId)archivingSessionId.value=``;refreshSessionData({reason:`archive-session`}).catch(()=>null)}}return{archiving:computed(()=>Boolean(archivingSessionId.value)),archivingSessionId,cancel:cancelArchiveSession,command:archiveCommand,confirm:confirmArchiveSession,open:archiveDialogOpen,request:requestArchiveSelectedSession,sessionId:archiveDialogSessionId,sessionTitle:archiveDialogSessionTitle}}function useVibe64SessionCreation({projectSlug,refreshSessionDataInBackground,selectSessionId,sessionListQueryKey,sessionsApiPath}){const queryClient=useQueryClient();const createSessionCommand=useCommand({access:`never`,apiSuffix:VIBE64_SESSIONS_API_SUFFIX,buildCommandOptions:(_model,{context})=>({method:`POST`,path:context?.apiPath}),buildRawPayload:(_model,{context})=>vibe64RealtimeOriginPayload({assistantSelection:context?.assistantSelection||{},...context?.repositoryBranch?{repositoryBranch:context.repositoryBranch}:{},...context?.pullRequestNumber?{pullRequestNumber:context.pullRequestNumber}:{}}),fallbackRunError:`Vibe64 session could not be created.`,messages:{error:`Vibe64 session could not be created.`,success:`Vibe64 session created.`},ownershipFilter:ROUTE_VISIBILITY_PUBLIC,placementSource:`vibe64.sessions.create`,surfaceId:`app`,writeMethod:`POST`});const createSessionRunning=ref(false);let createSessionInFlight=null;let disposed=false;onScopeDispose(()=>{disposed=true});async function createSession(assistantSelection={},{pullRequestNumber,repositoryBranch}={}){if(createSessionInFlight)return createSessionInFlight;const startedAtMs=Date.now();const creationProjectSlug=String(projectSlug.value||``).trim();const creationApiPath=sessionsApiPath.value;const creationQueryKey=[...sessionListQueryKey.value];vibe64SessionDebugLog(`client.sessionData.createSession.start`);createSessionRunning.value=true;createSessionInFlight=(async()=>{try{const response=await createSessionCommand.run({assistantSelection,pullRequestNumber,repositoryBranch,apiPath:creationApiPath});if(!disposed&&creationProjectSlug===String(projectSlug.value||``).trim()){if(response?.creation&&response?.limits)queryClient.setQueryData(creationQueryKey,currentPayload=>{if(!currentPayload||typeof currentPayload!==`object`||Array.isArray(currentPayload))return currentPayload;const currentSessions=Array.isArray(currentPayload.sessions)?currentPayload.sessions:[];const createdSession=response.sessionId?Object.fromEntries(Object.entries(response).filter(([key])=>![`creation`,`limits`,`ok`].includes(key))):null;return{...currentPayload,creation:response.creation,limits:response.limits,...createdSession&&!currentSessions.some(item=>item?.sessionId===createdSession.sessionId)?{sessions:[...currentSessions,createdSession]}:{}}});if(response?.sessionId)selectSessionId(response.sessionId);refreshSessionDataInBackground({reason:`create-session`})}vibe64SessionDebugLog(`client.sessionData.createSession.done`,{...vibe64SessionDebugSummary(response||{}),code:String(response?.code||response?.errors?.[0]?.code||``),durationMs:vibe64SessionDebugDurationMs(startedAtMs),ok:response?.ok!==false});return response}catch(error){vibe64SessionDebugLog(`client.sessionData.createSession.error`,{durationMs:vibe64SessionDebugDurationMs(startedAtMs),error:vibe64SessionDebugError(error)});throw error}finally{createSessionRunning.value=false;createSessionInFlight=null}})();return createSessionInFlight}return{createSession,createSessionCommand,createSessionRunning}}function sessionIdExistsInList(sessionId=``,nextSessions=[]){const normalizedSessionId=String(sessionId||``).trim();return Boolean(normalizedSessionId)&&nextSessions.some(session=>session.sessionId===normalizedSessionId)}function renewedSuccessorSessionId({predecessorSessionId=``,sessions=[]}={}){const predecessorId=String(predecessorSessionId||``).trim();if(!predecessorId)return``;const matches=sessions.filter(session=>String(session?.metadata?.renewed_from||``).trim()===predecessorId);return matches.length===1?String(matches[0]?.sessionId||``).trim():``}function useVibe64SelectedSessionRenewal({availableSessions,projectSlug,route,router,selectedListSession,selectedSessionId,selectedSessionMissing,sessionList,sessionsApiPath}){let disposed=false;onScopeDispose(()=>{disposed=true});const selectionRenewalPredecessorId=computed(()=>{const selectedId=String(selectedSessionId.value||``).trim();if(!selectedId||sessionList.pages.length<1||String(sessionList.loadError||``).trim())return``;if(sessionList.unavailableItems.some(session=>session.sessionId===selectedId))return``;if(selectedSessionMissing.value)return selectedId;return String(selectedListSession.value?.metadata?.renewed_from||``).trim()});const selectionRenewalPath=computed(()=>selectionRenewalPredecessorId.value?vibe64SessionPath(sessionsApiPath.value,selectionRenewalPredecessorId.value,`/renewal`):``);const selectionRenewalResource=useEndpointResource({enabled:computed(()=>Boolean(selectionRenewalPredecessorId.value)),fallbackLoadError:`The selected session renewal could not be checked.`,path:selectionRenewalPath,queryKey:computed(()=>[...vibe64SessionQueryKey(`app`,ROUTE_VISIBILITY_PUBLIC,projectSlug.value),selectionRenewalPredecessorId.value,`renewal`]),queryOptions:{refetchOnMount:`always`,refetchOnWindowFocus:false},readMethod:`GET`,realtime:{event:VIBE64_SESSION_SUMMARY_CHANGED_EVENT,matches:({payload={}}={})=>mountedSessionRealtimeShouldRefresh({payload},selectionRenewalPredecessorId.value)},requestRecoveryLabel:`Selected session renewal`});let pendingRenewalNavigation=null;function syncRenewalSuccessorUrl(predecessorId,successorId){if(selectedSessionIdFromRoute(route)!==predecessorId)return;const capturedProject=String(projectSlug.value||``).trim();const capturedApiPath=sessionsApiPath.value;const predecessorUrl=route.fullPath;if(pendingRenewalNavigation?.predecessorUrl===predecessorUrl&&pendingRenewalNavigation?.successorId===successorId)return;const sameRenewal=()=>{const renewal=selectionRenewalResource.data.value?.renewal;return!disposed&&String(projectSlug.value||``).trim()===capturedProject&&sessionsApiPath.value===capturedApiPath&&selectedSessionId.value===successorId&&!selectionRenewalResource.loadError?.value&&!selectionRenewalResource.isInitialLoading?.value&&!selectionRenewalResource.isLoading?.value&&renewal?.status===`completed`&&String(renewal.sessionId||``).trim()===predecessorId&&String(renewal.successor?.sessionId||``).trim()===successorId&&renewedSuccessorSessionId({predecessorSessionId:predecessorId,sessions:availableSessions.value})===successorId};if(!sameRenewal())return;const target={path:route.path,hash:route.hash,query:{...route.query,session:successorId}};const targetUrl=router.resolve(target).fullPath;const navigation={predecessorUrl,successorId};const removeGuard=router.beforeResolve(to=>{if(to.fullPath===targetUrl&&(!sameRenewal()||route.fullPath!==predecessorUrl))return false});pendingRenewalNavigation=navigation;(async()=>{try{await router.replace(target)}catch(error){if(sameRenewal())vibe64SessionDebugLog(`client.sessionData.renewalNavigation.error`,{error:vibe64SessionDebugError(error),sessionId:successorId})}finally{removeGuard();if(pendingRenewalNavigation===navigation)pendingRenewalNavigation=null}})()}return{selectionRenewalPredecessorId,selectionRenewalResource,syncRenewalSuccessorUrl}}function ignorePublicationError(){}function createVibe64CurrentSessionPublisher({onError=ignorePublicationError,publish}){let pendingPublication=null;let publicationChain=Promise.resolve();let lastPublishedIdentity=null;let stopped=false;function request(publication={}){if(stopped)return publicationChain;const apiPath=String(publication.apiPath||``);const sessionId=String(publication.sessionId||``).trim();pendingPublication={apiPath,identity:JSON.stringify([apiPath,sessionId]),sessionId};publicationChain=publicationChain.catch(()=>null).then(async()=>{const publication=pendingPublication;pendingPublication=null;if(stopped||!publication)return;if(publication.identity===lastPublishedIdentity)return;try{await publish({apiPath:publication.apiPath,sessionId:publication.sessionId});lastPublishedIdentity=publication.identity}catch(error){onError(error,publication)}});return publicationChain}function stop(){stopped=true;pendingPublication=null}return Object.freeze({request,stop})}function selectedSessionIdForCurrentAlias({createSessionRunning=false,selectedSessionId=``,sessionListLoaded=true,sessionListLoadError=``,sessionListLoading=false,sessions=[]}={}){if(!sessionListLoaded||sessionListLoading||String(sessionListLoadError||``).trim())return null;const normalizedSessionId=String(selectedSessionId||``).trim();if(sessionIdExistsInList(normalizedSessionId,sessions))return normalizedSessionId;if(sessions.length>0||createSessionRunning)return null;return``}function useVibe64CurrentSessionPublication({selectionReconciliationState}){const updateCurrentSessionCommand=useCommand({access:`never`,apiSuffix:VIBE64_CURRENT_SESSION_API_SUFFIX,buildCommandOptions:(_model,{context})=>({method:`PUT`,path:String(context?.apiPath||``)}),buildRawPayload:(_model,{context})=>({sessionId:String(context?.sessionId||``).trim()}),fallbackRunError:`The current session shortcut could not be updated.`,messages:{error:`The current session shortcut could not be updated.`},ownershipFilter:ROUTE_VISIBILITY_PUBLIC,placementSource:`vibe64.sessions.current.update`,suppressSuccessMessage:true,surfaceId:`app`,writeMethod:`PUT`});const currentSessionPublisher=createVibe64CurrentSessionPublisher({async publish({apiPath,sessionId}){const response=await updateCurrentSessionCommand.run({apiPath,sessionId});if(!response||response.ok===false)throw new Error(String(response?.error||`The current session shortcut could not be updated.`))},onError(error,publication){vibe64SessionDebugLog(`client.sessionData.currentSession.error`,{error:vibe64SessionDebugError(error),sessionId:publication.sessionId})}});onScopeDispose(()=>{currentSessionPublisher.stop()});watch(selectionReconciliationState,state=>{const publicationSessionId=selectedSessionIdForCurrentAlias({createSessionRunning:state.createSessionRunning,selectedSessionId:state.selectedSessionId,sessionListLoaded:state.sessionListLoaded,sessionListLoadError:state.sessionListLoadError,sessionListLoading:state.sessionListLoading,sessions:state.nextSessions});if(publicationSessionId===null||!state.currentSessionApiPath)return;currentSessionPublisher.request({apiPath:state.currentSessionApiPath,sessionId:publicationSessionId})},{flush:`post`,immediate:true})}function sessionArchiveOperation(session){try{return JSON.parse(session?.metadata?.session_archive_operation||`null`)}catch{return{status:`failed`,error:`Session archive state could not be read.`}}}function sessionArchiveState(session){const operation=sessionArchiveOperation(session);const failed=operation?.status===`failed`;return{archiveError:failed?operation.error:``,archiving:!failed&&(operation?.status===`running`||session?.metadata?.session_closing_reason===`archived`),operation}}function routeQueryWithoutUnlistedSession({route={},projectSlug=``,sessions=[]}={}){const routeSessionId=selectedSessionIdFromRoute(route);if(!routeSessionId||projectSlugFromRoute(route)!==projectSlug||sessionIdExistsInList(routeSessionId,sessions))return null;const{session:_session,conversation:_conversation,chat:_chat,...query}=route.query||{};return query}function shouldPreserveSelectedSessionDuringRefresh({createSessionRunning=false,currentSessionId=``,nextSessions=[],sessionListLoading=false}={}){const normalizedSessionId=String(currentSessionId||``).trim();if(!normalizedSessionId||sessionIdExistsInList(normalizedSessionId,nextSessions))return false;return Boolean(sessionListLoading||createSessionRunning)}function sessionListRealtimeShouldRefresh({payload={}}={},projectSlug=``){return vibe64SessionEventMatchesScope(payload,{projectSlug})&&payload.clientRefresh?.includeList!==false}function useVibe64SessionData(){const projectSlug=useVibe64ProjectSlug();const route=useRoute();const router=useRouter();const paths=usePaths();const selectionScope=computed(()=>String(projectSlug.value||``).trim());const sessionsApiPath=computed(()=>paths.api(VIBE64_SESSIONS_API_SUFFIX,{surface:`app`}));const currentSessionApiPath=computed(()=>paths.api(VIBE64_CURRENT_SESSION_API_SUFFIX,{surface:`app`}));const sessionListQueryKey=computed(()=>vibe64SessionsQueryKey(`app`,ROUTE_VISIBILITY_PUBLIC,projectSlug.value));const sessionListResource=useEndpointResource({fallbackLoadError:`Vibe64 sessions could not be loaded.`,path:sessionsApiPath,queryKey:sessionListQueryKey,readQuery:{limit:20},queryOptions:{refetchOnMount:`always`,refetchOnWindowFocus:false},requestRecoveryLabel:`Vibe64 sessions`,realtime:{events:[VIBE64_SESSION_SUMMARY_CHANGED_EVENT,VIBE64_PROJECT_CHANGED_EVENT,`connect`],matches:event=>sessionListRealtimeShouldRefresh(event,projectSlug.value)}});const sessionList=proxyRefs({unavailableItems:computed(()=>sessionListResource.data.value?.unavailableSessions||[]),items:computed(()=>{const payload=sessionListResource.data.value||{};return Array.isArray(payload.sessions)?payload.sessions:[]}),loadError:computed(()=>sessionListResource.loadError.value),isInitialLoading:computed(()=>sessionListResource.isInitialLoading.value||!sessionListResource.query.isFetchedAfterMount.value),isLoading:computed(()=>sessionListResource.isLoading.value),pages:computed(()=>{const payload=sessionListResource.data.value;return payload&&typeof payload===`object`&&!Array.isArray(payload)?[payload]:[]}),reload:sessionListResource.reload,resource:sessionListResource});const sessionSelection=useVibe64SessionSelection({projectSlug,rememberedId:()=>sessionList.isInitialLoading?``:sessionList.pages[0]?.lastOpenedSessionId});const selectedSessionId=sessionSelection.selectedId;let emptySessionListObservedForProject=``;const{createSession,createSessionCommand,createSessionRunning}=useVibe64SessionCreation({projectSlug,refreshSessionDataInBackground,selectSessionId,sessionListQueryKey,sessionsApiPath});const archiveAttempts=ref({});const agentActivityBySessionId=ref({});const sessions=computed(()=>{const items=new Map((sessionList.items||[]).map(session=>[session.sessionId,session]));for(const[id,attempt]of Object.entries(archiveAttempts.value))if(attempt.succeeded)items.delete(id);else items.set(id,{...items.get(id)||attempt.session,archiving:true,archiveStartedAt:attempt.startedAt});return visibleVibe64Sessions([...items.values()]).map(session=>{const archiveState=sessionArchiveState(session);return{...session,agentActivity:latestAgentTurnRealtimeOverlay(session.agentActivity,agentActivityBySessionId.value[session.sessionId]),archiveOperation:archiveState.operation,archiveStartedAt:archiveState.operation?.startedAt||session.archiveStartedAt,archiveError:archiveState.archiveError,archiving:Boolean(session.archiving||archiveState.archiving)}})});const availableSessions=computed(()=>sessions.value.filter(session=>!session.archiving));const selectedListSession=computed(()=>{return sessions.value.find(session=>session.sessionId===selectedSessionId.value)||null});const selectedSessionMissing=computed(()=>{const selectedId=String(selectedSessionId.value||``).trim();if(!selectedId||sessionList.pages.length<1||String(sessionList.loadError||``).trim()||sessionIdExistsInList(selectedId,sessions.value))return false;return true});const{selectionRenewalPredecessorId,selectionRenewalResource,syncRenewalSuccessorUrl}=useVibe64SelectedSessionRenewal({availableSessions,projectSlug,route,router,selectedListSession,selectedSessionId,selectedSessionMissing,sessionList,sessionsApiPath});const creationOptions=computed(()=>sessionList.pages?.[0]?.creation||{});const selectedSession=computed(()=>enrichVibe64SessionForDisplay(selectedListSession.value));const isSelectedSessionArchived=computed(()=>isArchivedVibe64Session(selectedSession.value||{}));const canCreateSession=computed(()=>{return creationOptions.value.canCreate===true});const createSessionVisible=computed(()=>creationOptions.value.showCreateAction===true);const createSessionTitle=computed(()=>{if(creationOptions.value.disabledReason)return String(creationOptions.value.disabledReason);if(creationOptions.value.canCreate!==true)return`Session creation is unavailable.`;return`Create a new Vibe64 session`});const selectedSessionTitle=computed(()=>{return vibe64SessionDisplayTitle(selectedSession.value||{})||`Session ${shortVibe64SessionId(selectedSessionId.value)}`});async function refreshSessionList(){return refetchEndpointResource(sessionListResource)}let refreshSessionDataInFlight=null;async function refreshSessionData(options={}){const reason=typeof options===`string`?options:String(options.reason||``);if(refreshSessionDataInFlight){vibe64SessionDebugLog(`client.sessionData.refresh.join`,{reason,selectedSessionId:String(selectedSessionId.value||``)});return refreshSessionDataInFlight}const startedAtMs=Date.now();vibe64SessionDebugLog(`client.sessionData.refresh.start`,{reason,selectedSessionId:String(selectedSessionId.value||``)});refreshSessionDataInFlight=refreshSessionList();try{const result=await refreshSessionDataInFlight;vibe64SessionDebugLog(`client.sessionData.refresh.done`,{durationMs:vibe64SessionDebugDurationMs(startedAtMs),reason,selectedSessionId:String(selectedSessionId.value||``),sessionCount:sessions.value.length});return result}catch(error){vibe64SessionDebugLog(`client.sessionData.refresh.error`,{durationMs:vibe64SessionDebugDurationMs(startedAtMs),error:vibe64SessionDebugError(error),reason,selectedSessionId:String(selectedSessionId.value||``)});throw error}finally{refreshSessionDataInFlight=null}}function refreshSessionDataInBackground(options={}){refreshSessionData(options).catch(()=>{})}function selectSessionId(sessionId=``){const normalizedSessionId=String(sessionId||``).trim();if(sessions.value.some(session=>session.sessionId===normalizedSessionId&&session.archiving))return;vibe64SessionDebugLog(`client.sessionData.selectSession`,{fromSessionId:String(selectedSessionId.value||``),toSessionId:normalizedSessionId});if(normalizedSessionId)emptySessionListObservedForProject=``;sessionSelection.select(normalizedSessionId)}function clearSelectedSession(){emptySessionListObservedForProject=selectionScope.value;sessionSelection.clear()}function selectPreviousSession(sessionId){const navigation=sessions.value;const index=navigation.findIndex(session=>session.sessionId===sessionId);selectSessionId(navigation.slice(0,Math.max(0,index)).filter(session=>!session.archiving).at(-1)?.sessionId||availableSessions.value.at(-1)?.sessionId||``)}const archive=proxyRefs(useVibe64SessionDialogs({beginArchive(sessionId){archiveAttempts.value[sessionId]={startedAt:new Date().toISOString(),session:sessions.value.find(session=>session.sessionId===sessionId)};if(selectedSessionId.value===sessionId)selectPreviousSession(sessionId);return projectSlug.value},finishArchive(sessionId,succeeded,archiveProject){if(projectSlug.value!==archiveProject)return;if(succeeded)archiveAttempts.value[sessionId]={succeeded:true};else{delete archiveAttempts.value[sessionId];if(!selectedSessionId.value)selectSessionId(sessionId)}},isSelectedSessionArchived,refreshSessionData,selectedSessionId,selectedSessionTitle,sessionsApiPath}));const archiveFeedback=useUiFeedback({source:`vibe64.sessions.archive.remote`});const shownArchiveFailures=new Set;watch(projectSlug,()=>{archiveAttempts.value={};agentActivityBySessionId.value={};shownArchiveFailures.clear()});useRealtimeEvent({event:VIBE64_SESSION_SUMMARY_CHANGED_EVENT,matches:({payload={}}={})=>vibe64SessionEventMatchesScope(payload,{projectSlug:projectSlug.value}),onEvent:({payload={}}={})=>{const id=String(payload.sessionId||``);if(!id)return;const activity=agentTurnRealtimeOverlayFromPayload(payload,id);if(activity)agentActivityBySessionId.value[id]=latestAgentTurnRealtimeOverlay(agentActivityBySessionId.value[id],{active:activity.active,revision:activity.revision});if(payload.reason===`session-archiving`){const session=sessions.value.find(item=>item.sessionId===id);if(session)archiveAttempts.value[id]={session,startedAt:archiveAttempts.value[id]?.startedAt||new Date().toISOString()};if(selectedSessionId.value===id)selectPreviousSession(id)}else if(payload.reason===`session-archived`)archiveAttempts.value[id]={succeeded:true};else if(payload.reason===`session-archive-failed`){delete archiveAttempts.value[id];if(!selectedSessionId.value)selectSessionId(id)}}});watch(()=>sessionList.items,items=>{for(const id of Object.keys(agentActivityBySessionId.value))if(!items.some(session=>session.sessionId===id))delete agentActivityBySessionId.value[id];for(const[id,attempt]of Object.entries(archiveAttempts.value)){if(attempt.succeeded||archive.archivingSessionId===id)continue;const session=items.find(item=>item.sessionId===id);if(!session||!sessionArchiveState(session).archiving)delete archiveAttempts.value[id]}});watch(sessions,items=>{for(const session of items){const key=`${session.sessionId}:${session.metadata?.session_archive_operation}`;if(!session.archiveError||shownArchiveFailures.has(key))continue;shownArchiveFailures.add(key);if(archive.archivingSessionId!==session.sessionId)archiveFeedback.error(new Error(session.archiveError))}},{immediate:true});function dropUnlistedRouteSession(){const query=routeQueryWithoutUnlistedSession({route,projectSlug:projectSlug.value,sessions:sessions.value});if(query)router.replace({path:route.path,hash:route.hash,query}).catch(()=>null)}const selectionReconciliationState=computed(()=>{const nextSessions=availableSessions.value;return{createSessionRunning:createSessionRunning.value,currentSessionApiPath:currentSessionApiPath.value,selectionScope:selectionScope.value,selectionRenewal:selectionRenewalResource.data.value?.renewal||null,selectionRenewalLoadError:String(selectionRenewalResource.loadError?.value||``),selectionRenewalLoaded:Boolean(selectionRenewalResource.data.value&&typeof selectionRenewalResource.data.value===`object`&&!Array.isArray(selectionRenewalResource.data.value)),selectionRenewalLoading:Boolean(selectionRenewalResource.isInitialLoading?.value||selectionRenewalResource.isLoading?.value),selectionRenewalPredecessorId:selectionRenewalPredecessorId.value,projectSlug:String(projectSlug.value||``).trim(),selectedSessionMissing:selectedSessionMissing.value,nextSessions,selectedSessionId:String(selectedSessionId.value||``),sessionListInitialLoading:sessionList.isInitialLoading,sessionListLoaded:sessionList.pages.length>0,sessionListLoadError:String(sessionList.loadError||``),sessionListLoading:sessionList.isLoading}});watch(selectionReconciliationState,state=>{const nextSessions=state.nextSessions;if(sessions.value.some(session=>session.sessionId===state.selectedSessionId&&session.archiving)){selectPreviousSession(state.selectedSessionId);return}vibe64SessionDebugLog(`client.sessionData.sessions.changed`,{selectedSessionId:String(selectedSessionId.value||``),sessionCount:nextSessions.length});if(state.sessionListInitialLoading||state.sessionListLoadError||shouldPreserveSelectedSessionDuringRefresh({createSessionRunning:state.createSessionRunning,currentSessionId:state.selectedSessionId,nextSessions,sessionListLoading:state.sessionListLoading}))return;if(!state.selectedSessionId&&nextSessions.length===0)emptySessionListObservedForProject=state.selectionScope;if(state.selectionRenewalPredecessorId){if(state.selectionRenewalLoading||state.selectionRenewalLoadError||!state.selectionRenewalLoaded)return;const selectionRenewal=state.selectionRenewal;if(selectionRenewal&&String(selectionRenewal.sessionId||``).trim()===state.selectionRenewalPredecessorId){const renewalStatus=String(selectionRenewal.status||``).trim();if(renewalStatus===`completed`){const renewedSuccessorId=renewedSuccessorSessionId({predecessorSessionId:state.selectionRenewalPredecessorId,sessions:nextSessions});if(state.selectedSessionMissing){if(renewedSuccessorId)sessionSelection.selectAvailableId(nextSessions,{fallbackId:renewedSuccessorId,getId:session=>session.sessionId})}if(renewedSuccessorId&&selectedSessionId.value===renewedSuccessorId)syncRenewalSuccessorUrl(state.selectionRenewalPredecessorId,renewedSuccessorId);if(state.selectedSessionMissing)return}else if(state.selectedSessionMissing&&[`failed`,`running`].includes(renewalStatus))return;if([`failed`,`running`].includes(renewalStatus)){sessionSelection.select(state.selectionRenewalPredecessorId);return}}}if(!state.selectionRenewalPredecessorId)dropUnlistedRouteSession();if(!state.selectedSessionId&&emptySessionListObservedForProject===state.selectionScope)return;sessionSelection.selectAvailableId(nextSessions,{fallbackId:nextSessions.at(-1)?.sessionId||``,getId:session=>session.sessionId})},{immediate:true});useVibe64CurrentSessionPublication({selectionReconciliationState});return{archive,canCreateSession,clearSelectedSession,createSession,createSessionCommand,createSessionRunning,createSessionVisible,createSessionTitle,isSelectedSessionArchived,refreshSessionData,selectSessionId,selectedSession,selectedSessionId,selectedSessionTitle,sessionList,sessions,sessionsApiPath,shortSessionId:shortVibe64SessionId}}export{mountedSessionDetailRefreshReason as a,sessionRecordHasActiveAgentWork as c,sessionWithAgentTurnRealtimeOverlay as d,refetchEndpointResource as f,mountedSessionDetailLoadState as i,agentTurnRealtimeOverlayFromPayload as l,useVibe64SessionData as n,mountedSessionRealtimeShouldRefresh as o,latestSessionDetailRecord as r,mountedSessionRecord as s,sessionListRealtimeShouldRefresh as t,latestAgentTurnRealtimeOverlay as u};
1
+ import{Et as unref,ht as proxyRefs,it as watch,mt as onScopeDispose,u as computed,vt as ref}from"./runtime-core.esm-bundler-Bi1P1jMa.js";import{N as useQueryClient,t as useEndpointResource}from"./useEndpointResource-BwGXpV2u.js";import{_ as useRouter,g as useRoute}from"./useApi-BPuI6ZR9-rsYWyW6m.js";import{s as normalizeObject}from"./normalize-BD25VwNK.js";import{o as projectSlugFromRoute}from"./vibe64ProjectScope.local-B9ZpdYlf.js";import{o as ROUTE_VISIBILITY_PUBLIC}from"./visibility-Cq31Xy7I.js";import{r as useRealtimeEvent}from"./useRealtimeEvent-B4oRg9Dt.js";import{t as useCommand}from"./useCommand-CfqxMb4C.js";import{t as usePaths}from"./usePaths-CvUbx5-V.js";import{t as useUiFeedback}from"./useUiFeedback-8Wvg7A_S.js";import{t as readRefOrGetterValue}from"./vueRefOrGetterValue-y-4f_In7.js";import{r as vibe64RealtimeOriginPayload}from"./vibe64BrowserTabOrigin-vIN_87mi.js";import{H as vibe64SessionsQueryKey,I as vibe64SessionEventMatchesScope,L as vibe64SessionPath,V as vibe64SessionQueryKey,a as VIBE64_CURRENT_SESSION_API_SUFFIX,c as VIBE64_SESSION_SUMMARY_CHANGED_EVENT,o as VIBE64_SESSIONS_API_SUFFIX}from"./vibe64SessionRequestConfig-DVRCRAex.js";import{S as VIBE64_PROJECT_CHANGED_EVENT}from"./studioGateApi-B9EUTtMx.js";import{M as useVibe64ProjectSlug}from"./index-FVeEbKiO.js";import{i as vibe64SessionDisplayTitle,o as vibe64SessionRevision,r as shortVibe64SessionId,t as isArchivedVibe64Session}from"./vibe64SessionViewModel-CQCds_jb.js";import{i as vibe64SessionDebugSummary,n as vibe64SessionDebugError,r as vibe64SessionDebugLog,t as vibe64SessionDebugDurationMs}from"./vibe64SessionDebugLog-BfO7tG1A.js";import{i as visibleVibe64Sessions,n as enrichVibe64SessionForDisplay}from"./vibe64SessionPanelModel-B-WkXnPu.js";import{n as useVibe64SessionSelection,t as selectedSessionIdFromRoute}from"./useVibe64SessionSelection-BwjtqeIR.js";function refetchEndpointResource(resource){return resource.query.refetch({cancelRefetch:false})}function sessionChangedReason(payload){return String(payload.reason||``).trim()}function sessionRevision(value){const revision=Number(value);return Number.isSafeInteger(revision)&&revision>=0?revision:null}function agentTurnRealtimeOverlayFromPayload(input,selectedSessionId=``){const payload=normalizeObject(input);const changedSessionId=String(payload.sessionId||payload.entityId||``).trim();if(!changedSessionId||changedSessionId!==String(selectedSessionId||``).trim())return null;const agentSession=normalizeObject(payload.agentSession);const turn=normalizeObject(agentSession.turn);const run=normalizeObject(payload.agentRun);const revision=sessionRevision(payload.revision);if(revision===null||!Object.keys(turn).length&&!Object.keys(run).length)return null;const active=turn.active===true||run.active===true;return{active,agentRun:{...run,active},agentSession:{...agentSession,turn:{...turn,active}},reason:sessionChangedReason(payload),revision,sessionId:changedSessionId}}function latestAgentTurnRealtimeOverlay(current=null,candidate=null){if(!candidate)return current;if(!current||candidate.revision>current.revision)return candidate;return current}function mergeAgentRunOverlay(agentRuns=[],overlayRun={}){const runs=Array.isArray(agentRuns)?agentRuns:[];const runId=String(overlayRun.id||``).trim();if(!runId)return runs;const nextRun={...overlayRun,id:runId};const index=runs.findIndex(run=>String(run?.id||``).trim()===runId);if(index<0)return[...runs,nextRun];return runs.map((run,runIndex)=>runIndex===index?{...run,...nextRun}:run)}function sessionWithAgentTurnRealtimeOverlay(session=null,overlay=null){const currentRevision=sessionRevision(session?.revision);if(!session||!overlay||session?.ok===false||session.sessionId!==overlay.sessionId||currentRevision!==null&&overlay.revision<=currentRevision)return session;const overlayAgentSession=normalizeObject(overlay.agentSession);return{...session,agentRuns:mergeAgentRunOverlay(session.agentRuns,normalizeObject(overlay.agentRun)),agentSession:{...normalizeObject(session.agentSession),...overlayAgentSession,thread:{...normalizeObject(session.agentSession?.thread),...normalizeObject(overlayAgentSession.thread)},turn:{...normalizeObject(session.agentSession?.turn),...normalizeObject(overlayAgentSession.turn),active:overlay.active===true}},revision:overlay.revision}}function sessionRecordHasDetailProjection(session=null){return Boolean(session&&typeof session===`object`&&Object.hasOwn(session,`agentSession`))}function sessionRecordHasActiveAgentWork(session=null){return(session?.agentSession?.turn?.active??session?.agentActivity?.active)===true}function sessionRecordMatchesId(session=null,sessionId=``){const normalizedSessionId=String(sessionId||``).trim();return Boolean(normalizedSessionId&&session?.sessionId===normalizedSessionId&&session?.ok!==false)}function latestSessionDetailRecord(current=null,candidate=null,sessionId=``){if(!sessionRecordMatchesId(candidate,sessionId))return current;if(!sessionRecordMatchesId(current,sessionId))return candidate;const currentRevision=vibe64SessionRevision(current);const candidateRevision=vibe64SessionRevision(candidate);if(currentRevision!==null&&candidateRevision!==null&&candidateRevision<currentRevision)return current;return candidate}function mountedSessionRecord(detailSession=null,listSession=null,sessionId=``){const normalizedSessionId=String(sessionId||``).trim();const listSessionMatches=sessionRecordMatchesId(listSession,normalizedSessionId);if(!sessionRecordMatchesId(detailSession,normalizedSessionId))return listSessionMatches?listSession:null;const detailRevision=vibe64SessionRevision(detailSession);const listRevision=vibe64SessionRevision(listSession);if(listSessionMatches&&listRevision!==null&&detailRevision!==null&&listRevision>detailRevision){if(sessionRecordHasDetailProjection(detailSession)&&!sessionRecordHasDetailProjection(listSession))return detailSession;return listSession}return detailSession}function mountedSessionDetailRefreshReason(detailSession=null,listSession=null,sessionId=``){const normalizedSessionId=String(sessionId||``).trim();if(!sessionRecordMatchesId(detailSession,normalizedSessionId)||!sessionRecordMatchesId(listSession,normalizedSessionId))return``;const detailRevision=vibe64SessionRevision(detailSession);const listRevision=vibe64SessionRevision(listSession);if(listRevision!==null&&detailRevision!==null&&listRevision>detailRevision&&sessionRecordHasDetailProjection(detailSession)&&!sessionRecordHasDetailProjection(listSession))return`newer_summary_without_detail`;return``}function mountedSessionDetailLoadState({detailSession=null,fetching=false,listSession=null,loadError=``,loading=false,sessionId=``}={}){const normalizedSessionId=String(sessionId||``).trim();const hasDetail=sessionRecordMatchesId(detailSession,normalizedSessionId);const hasSummary=sessionRecordMatchesId(listSession,normalizedSessionId);const error=String(loadError||``).trim();if(!normalizedSessionId)return{error:``,label:``,loading:false,ready:false,restoring:false,sessionId:``,state:`summaryOnly`};if(error&&!hasDetail)return{error,label:`Session could not load.`,loading:false,ready:false,restoring:false,sessionId:normalizedSessionId,state:`detailError`};if(hasDetail)return{error:``,label:``,loading:false,ready:true,refreshing:Boolean(fetching||loading),restoring:false,sessionId:normalizedSessionId,state:`detailReady`};if(loading||fetching)return{error:``,label:`Loading session...`,loading:true,ready:false,restoring:false,sessionId:normalizedSessionId,state:`detailLoading`};return{error:``,label:hasSummary?`Session could not load.`:`Loading session...`,loading:false,ready:false,restoring:false,sessionId:normalizedSessionId,state:`summaryOnly`}}function mountedSessionRealtimeShouldRefresh({payload={}}={},sessionId=``,read=`includeDetail`){const changedSessionId=String(payload.sessionId||payload.entityId||``).trim();if(!changedSessionId||changedSessionId!==String(sessionId||``).trim())return false;return payload.clientRefresh?.[read]!==false}function useVibe64SessionDialogs({beginArchive,finishArchive,isSelectedSessionArchived,refreshSessionData,selectedSessionId,selectedSessionTitle,sessionsApiPath}){const archiveDialogOpen=ref(false);const archiveDialogSessionId=ref(``);const archiveDialogSessionTitle=ref(``);const archivingSessionId=ref(``);const resolvedSessionsApiPath=computed(()=>String(readRefOrGetterValue(sessionsApiPath)||``));const archiveCommand=useCommand({access:`never`,apiSuffix:VIBE64_SESSIONS_API_SUFFIX,buildRawPayload:()=>vibe64RealtimeOriginPayload(),buildCommandOptions:(_payload,{context})=>({method:`POST`,path:vibe64SessionPath(resolvedSessionsApiPath.value,context?.sessionId,`/archive`)}),fallbackRunError:`Vibe64 session could not be archived.`,messages:{error:`Vibe64 session could not be archived.`,success:`Vibe64 session archived.`},onRunSuccess:async response=>{if(response?.ok!==true)throw new Error(response?.errors?.[0]?.message||response?.error||`Vibe64 session could not be archived.`)},ownershipFilter:ROUTE_VISIBILITY_PUBLIC,placementSource:`vibe64.sessions.archive`,surfaceId:`app`,writeMethod:`POST`});function clearArchiveDialog(){archiveDialogOpen.value=false;archiveDialogSessionId.value=``;archiveDialogSessionTitle.value=``}function requestArchiveSelectedSession(){if(!unref(selectedSessionId)||archivingSessionId.value||archiveCommand.isRunning||unref(isSelectedSessionArchived))return;archiveDialogSessionId.value=unref(selectedSessionId);archiveDialogSessionTitle.value=unref(selectedSessionTitle);archiveDialogOpen.value=true}function cancelArchiveSession(){if(!archiveCommand.isRunning)clearArchiveDialog()}async function confirmArchiveSession(){if(!archiveDialogSessionId.value||archivingSessionId.value||archiveCommand.isRunning)return false;const sessionId=archiveDialogSessionId.value;archivingSessionId.value=sessionId;clearArchiveDialog();const archiveScope=beginArchive(sessionId);let succeeded=false;try{const response=await archiveCommand.run({sessionId});succeeded=response?.ok===true;return response}catch{return false}finally{finishArchive(sessionId,succeeded,archiveScope);if(archivingSessionId.value===sessionId)archivingSessionId.value=``;refreshSessionData({reason:`archive-session`}).catch(()=>null)}}return{archiving:computed(()=>Boolean(archivingSessionId.value)),archivingSessionId,cancel:cancelArchiveSession,command:archiveCommand,confirm:confirmArchiveSession,open:archiveDialogOpen,request:requestArchiveSelectedSession,sessionId:archiveDialogSessionId,sessionTitle:archiveDialogSessionTitle}}function useVibe64SessionCreation({projectSlug,refreshSessionDataInBackground,selectSessionId,sessionListQueryKey,sessionsApiPath}){const queryClient=useQueryClient();const createSessionCommand=useCommand({access:`never`,apiSuffix:VIBE64_SESSIONS_API_SUFFIX,buildCommandOptions:(_model,{context})=>({method:`POST`,path:context?.apiPath}),buildRawPayload:(_model,{context})=>vibe64RealtimeOriginPayload({assistantSelection:context?.assistantSelection||{},...context?.repositoryBranch?{repositoryBranch:context.repositoryBranch}:{},...context?.pullRequestNumber?{pullRequestNumber:context.pullRequestNumber}:{}}),fallbackRunError:`Vibe64 session could not be created.`,messages:{error:`Vibe64 session could not be created.`,success:`Vibe64 session created.`},ownershipFilter:ROUTE_VISIBILITY_PUBLIC,placementSource:`vibe64.sessions.create`,surfaceId:`app`,writeMethod:`POST`});const createSessionRunning=ref(false);let createSessionInFlight=null;let disposed=false;onScopeDispose(()=>{disposed=true});async function createSession(assistantSelection={},{pullRequestNumber,repositoryBranch}={}){if(createSessionInFlight)return createSessionInFlight;const startedAtMs=Date.now();const creationProjectSlug=String(projectSlug.value||``).trim();const creationApiPath=sessionsApiPath.value;const creationQueryKey=[...sessionListQueryKey.value];vibe64SessionDebugLog(`client.sessionData.createSession.start`);createSessionRunning.value=true;createSessionInFlight=(async()=>{try{const response=await createSessionCommand.run({assistantSelection,pullRequestNumber,repositoryBranch,apiPath:creationApiPath});if(!disposed&&creationProjectSlug===String(projectSlug.value||``).trim()){if(response?.creation&&response?.limits)queryClient.setQueryData(creationQueryKey,currentPayload=>{if(!currentPayload||typeof currentPayload!==`object`||Array.isArray(currentPayload))return currentPayload;const currentSessions=Array.isArray(currentPayload.sessions)?currentPayload.sessions:[];const createdSession=response.sessionId?Object.fromEntries(Object.entries(response).filter(([key])=>![`creation`,`limits`,`ok`].includes(key))):null;return{...currentPayload,creation:response.creation,limits:response.limits,...createdSession&&!currentSessions.some(item=>item?.sessionId===createdSession.sessionId)?{sessions:[...currentSessions,createdSession]}:{}}});if(response?.sessionId)selectSessionId(response.sessionId);refreshSessionDataInBackground({reason:`create-session`})}vibe64SessionDebugLog(`client.sessionData.createSession.done`,{...vibe64SessionDebugSummary(response||{}),code:String(response?.code||response?.errors?.[0]?.code||``),durationMs:vibe64SessionDebugDurationMs(startedAtMs),ok:response?.ok!==false});return response}catch(error){vibe64SessionDebugLog(`client.sessionData.createSession.error`,{durationMs:vibe64SessionDebugDurationMs(startedAtMs),error:vibe64SessionDebugError(error)});throw error}finally{createSessionRunning.value=false;createSessionInFlight=null}})();return createSessionInFlight}return{createSession,createSessionCommand,createSessionRunning}}function sessionIdExistsInList(sessionId=``,nextSessions=[]){const normalizedSessionId=String(sessionId||``).trim();return Boolean(normalizedSessionId)&&nextSessions.some(session=>session.sessionId===normalizedSessionId)}function renewedSuccessorSessionId({predecessorSessionId=``,sessions=[]}={}){const predecessorId=String(predecessorSessionId||``).trim();if(!predecessorId)return``;const matches=sessions.filter(session=>String(session?.metadata?.renewed_from||``).trim()===predecessorId);return matches.length===1?String(matches[0]?.sessionId||``).trim():``}function useVibe64SelectedSessionRenewal({availableSessions,projectSlug,route,router,selectedListSession,selectedSessionId,selectedSessionMissing,sessionList,sessionsApiPath}){let disposed=false;onScopeDispose(()=>{disposed=true});const selectionRenewalPredecessorId=computed(()=>{const selectedId=String(selectedSessionId.value||``).trim();if(!selectedId||sessionList.pages.length<1||String(sessionList.loadError||``).trim())return``;if(sessionList.unavailableItems.some(session=>session.sessionId===selectedId))return``;if(selectedSessionMissing.value)return selectedId;return String(selectedListSession.value?.metadata?.renewed_from||``).trim()});const selectionRenewalPath=computed(()=>selectionRenewalPredecessorId.value?vibe64SessionPath(sessionsApiPath.value,selectionRenewalPredecessorId.value,`/renewal`):``);const selectionRenewalResource=useEndpointResource({enabled:computed(()=>Boolean(selectionRenewalPredecessorId.value)),fallbackLoadError:`The selected session renewal could not be checked.`,path:selectionRenewalPath,queryKey:computed(()=>[...vibe64SessionQueryKey(`app`,ROUTE_VISIBILITY_PUBLIC,projectSlug.value),selectionRenewalPredecessorId.value,`renewal`]),queryOptions:{refetchOnMount:`always`,refetchOnWindowFocus:false},readMethod:`GET`,realtime:{event:VIBE64_SESSION_SUMMARY_CHANGED_EVENT,matches:({payload={}}={})=>mountedSessionRealtimeShouldRefresh({payload},selectionRenewalPredecessorId.value)},requestRecoveryLabel:`Selected session renewal`});let pendingRenewalNavigation=null;function syncRenewalSuccessorUrl(predecessorId,successorId){if(selectedSessionIdFromRoute(route)!==predecessorId)return;const capturedProject=String(projectSlug.value||``).trim();const capturedApiPath=sessionsApiPath.value;const predecessorUrl=route.fullPath;if(pendingRenewalNavigation?.predecessorUrl===predecessorUrl&&pendingRenewalNavigation?.successorId===successorId)return;const sameRenewal=()=>{const renewal=selectionRenewalResource.data.value?.renewal;return!disposed&&String(projectSlug.value||``).trim()===capturedProject&&sessionsApiPath.value===capturedApiPath&&selectedSessionId.value===successorId&&!selectionRenewalResource.loadError?.value&&!selectionRenewalResource.isInitialLoading?.value&&!selectionRenewalResource.isLoading?.value&&renewal?.status===`completed`&&String(renewal.sessionId||``).trim()===predecessorId&&String(renewal.successor?.sessionId||``).trim()===successorId&&renewedSuccessorSessionId({predecessorSessionId:predecessorId,sessions:availableSessions.value})===successorId};if(!sameRenewal())return;const target={path:route.path,hash:route.hash,query:{...route.query,session:successorId}};const targetUrl=router.resolve(target).fullPath;const navigation={predecessorUrl,successorId};const removeGuard=router.beforeResolve(to=>{if(to.fullPath===targetUrl&&(!sameRenewal()||route.fullPath!==predecessorUrl))return false});pendingRenewalNavigation=navigation;(async()=>{try{await router.replace(target)}catch(error){if(sameRenewal())vibe64SessionDebugLog(`client.sessionData.renewalNavigation.error`,{error:vibe64SessionDebugError(error),sessionId:successorId})}finally{removeGuard();if(pendingRenewalNavigation===navigation)pendingRenewalNavigation=null}})()}return{selectionRenewalPredecessorId,selectionRenewalResource,syncRenewalSuccessorUrl}}function ignorePublicationError(){}function createVibe64CurrentSessionPublisher({onError=ignorePublicationError,publish}){let pendingPublication=null;let publicationChain=Promise.resolve();let lastPublishedIdentity=null;let stopped=false;function request(publication={}){if(stopped)return publicationChain;const apiPath=String(publication.apiPath||``);const sessionId=String(publication.sessionId||``).trim();pendingPublication={apiPath,identity:JSON.stringify([apiPath,sessionId]),sessionId};publicationChain=publicationChain.catch(()=>null).then(async()=>{const publication=pendingPublication;pendingPublication=null;if(stopped||!publication)return;if(publication.identity===lastPublishedIdentity)return;try{await publish({apiPath:publication.apiPath,sessionId:publication.sessionId});lastPublishedIdentity=publication.identity}catch(error){onError(error,publication)}});return publicationChain}function stop(){stopped=true;pendingPublication=null}return Object.freeze({request,stop})}function selectedSessionIdForCurrentAlias({createSessionRunning=false,selectedSessionId=``,sessionListLoaded=true,sessionListLoadError=``,sessionListLoading=false,sessions=[]}={}){if(!sessionListLoaded||sessionListLoading||String(sessionListLoadError||``).trim())return null;const normalizedSessionId=String(selectedSessionId||``).trim();if(sessionIdExistsInList(normalizedSessionId,sessions))return normalizedSessionId;if(sessions.length>0||createSessionRunning)return null;return``}function useVibe64CurrentSessionPublication({selectionReconciliationState}){const updateCurrentSessionCommand=useCommand({access:`never`,apiSuffix:VIBE64_CURRENT_SESSION_API_SUFFIX,buildCommandOptions:(_model,{context})=>({method:`PUT`,path:String(context?.apiPath||``)}),buildRawPayload:(_model,{context})=>({sessionId:String(context?.sessionId||``).trim()}),fallbackRunError:`The current session shortcut could not be updated.`,messages:{error:`The current session shortcut could not be updated.`},ownershipFilter:ROUTE_VISIBILITY_PUBLIC,placementSource:`vibe64.sessions.current.update`,suppressSuccessMessage:true,surfaceId:`app`,writeMethod:`PUT`});const currentSessionPublisher=createVibe64CurrentSessionPublisher({async publish({apiPath,sessionId}){const response=await updateCurrentSessionCommand.run({apiPath,sessionId});if(!response||response.ok===false)throw new Error(String(response?.error||`The current session shortcut could not be updated.`))},onError(error,publication){vibe64SessionDebugLog(`client.sessionData.currentSession.error`,{error:vibe64SessionDebugError(error),sessionId:publication.sessionId})}});onScopeDispose(()=>{currentSessionPublisher.stop()});watch(selectionReconciliationState,state=>{const publicationSessionId=selectedSessionIdForCurrentAlias({createSessionRunning:state.createSessionRunning,selectedSessionId:state.selectedSessionId,sessionListLoaded:state.sessionListLoaded,sessionListLoadError:state.sessionListLoadError,sessionListLoading:state.sessionListLoading,sessions:state.nextSessions});if(publicationSessionId===null||!state.currentSessionApiPath)return;currentSessionPublisher.request({apiPath:state.currentSessionApiPath,sessionId:publicationSessionId})},{flush:`post`,immediate:true})}function sessionArchiveOperation(session){try{return JSON.parse(session?.metadata?.session_archive_operation||`null`)}catch{return{status:`failed`,error:`Session archive state could not be read.`}}}function sessionArchiveState(session){const operation=sessionArchiveOperation(session);const failed=operation?.status===`failed`;return{archiveError:failed?operation.error:``,archiving:!failed&&(operation?.status===`running`||session?.metadata?.session_closing_reason===`archived`),operation}}function routeQueryWithoutUnlistedSession({route={},projectSlug=``,sessions=[]}={}){const routeSessionId=selectedSessionIdFromRoute(route);if(!routeSessionId||projectSlugFromRoute(route)!==projectSlug||sessionIdExistsInList(routeSessionId,sessions))return null;const{session:_session,conversation:_conversation,chat:_chat,...query}=route.query||{};return query}function shouldPreserveSelectedSessionDuringRefresh({createSessionRunning=false,currentSessionId=``,nextSessions=[],sessionListLoading=false}={}){const normalizedSessionId=String(currentSessionId||``).trim();if(!normalizedSessionId||sessionIdExistsInList(normalizedSessionId,nextSessions))return false;return Boolean(sessionListLoading||createSessionRunning)}function sessionListRealtimeShouldRefresh({payload={}}={},projectSlug=``){return vibe64SessionEventMatchesScope(payload,{projectSlug})&&payload.clientRefresh?.includeList!==false}function useVibe64SessionData(){const projectSlug=useVibe64ProjectSlug();const route=useRoute();const router=useRouter();const paths=usePaths();const selectionScope=computed(()=>String(projectSlug.value||``).trim());const sessionsApiPath=computed(()=>paths.api(VIBE64_SESSIONS_API_SUFFIX,{surface:`app`}));const currentSessionApiPath=computed(()=>paths.api(VIBE64_CURRENT_SESSION_API_SUFFIX,{surface:`app`}));const sessionListQueryKey=computed(()=>vibe64SessionsQueryKey(`app`,ROUTE_VISIBILITY_PUBLIC,projectSlug.value));const sessionListResource=useEndpointResource({fallbackLoadError:`Vibe64 sessions could not be loaded.`,path:sessionsApiPath,queryKey:sessionListQueryKey,readQuery:{limit:20},queryOptions:{refetchOnMount:`always`,refetchOnWindowFocus:false},requestRecoveryLabel:`Vibe64 sessions`,realtime:{events:[VIBE64_SESSION_SUMMARY_CHANGED_EVENT,VIBE64_PROJECT_CHANGED_EVENT,`connect`],matches:event=>sessionListRealtimeShouldRefresh(event,projectSlug.value)}});const sessionList=proxyRefs({unavailableItems:computed(()=>sessionListResource.data.value?.unavailableSessions||[]),items:computed(()=>{const payload=sessionListResource.data.value||{};return Array.isArray(payload.sessions)?payload.sessions:[]}),loadError:computed(()=>sessionListResource.loadError.value),isInitialLoading:computed(()=>sessionListResource.isInitialLoading.value||!sessionListResource.query.isFetchedAfterMount.value),isLoading:computed(()=>sessionListResource.isLoading.value),pages:computed(()=>{const payload=sessionListResource.data.value;return payload&&typeof payload===`object`&&!Array.isArray(payload)?[payload]:[]}),reload:sessionListResource.reload,resource:sessionListResource});const sessionSelection=useVibe64SessionSelection({projectSlug,rememberedId:()=>sessionList.isInitialLoading?``:sessionList.pages[0]?.lastOpenedSessionId});const selectedSessionId=sessionSelection.selectedId;let emptySessionListObservedForProject=``;const{createSession,createSessionCommand,createSessionRunning}=useVibe64SessionCreation({projectSlug,refreshSessionDataInBackground,selectSessionId,sessionListQueryKey,sessionsApiPath});const archiveAttempts=ref({});const agentActivityBySessionId=ref({});const sessions=computed(()=>{const items=new Map((sessionList.items||[]).map(session=>[session.sessionId,session]));for(const[id,attempt]of Object.entries(archiveAttempts.value))if(attempt.succeeded)items.delete(id);else items.set(id,{...items.get(id)||attempt.session,archiving:true,archiveStartedAt:attempt.startedAt});return visibleVibe64Sessions([...items.values()]).map(session=>{const archiveState=sessionArchiveState(session);return{...session,agentActivity:latestAgentTurnRealtimeOverlay(session.agentActivity,agentActivityBySessionId.value[session.sessionId]),archiveOperation:archiveState.operation,archiveStartedAt:archiveState.operation?.startedAt||session.archiveStartedAt,archiveError:archiveState.archiveError,archiving:Boolean(session.archiving||archiveState.archiving)}})});const availableSessions=computed(()=>sessions.value.filter(session=>!session.archiving));const selectedListSession=computed(()=>{return sessions.value.find(session=>session.sessionId===selectedSessionId.value)||null});const selectedSessionMissing=computed(()=>{const selectedId=String(selectedSessionId.value||``).trim();if(!selectedId||sessionList.pages.length<1||String(sessionList.loadError||``).trim()||sessionIdExistsInList(selectedId,sessions.value))return false;return true});const{selectionRenewalPredecessorId,selectionRenewalResource,syncRenewalSuccessorUrl}=useVibe64SelectedSessionRenewal({availableSessions,projectSlug,route,router,selectedListSession,selectedSessionId,selectedSessionMissing,sessionList,sessionsApiPath});const creationOptions=computed(()=>sessionList.pages?.[0]?.creation||{});const selectedSession=computed(()=>enrichVibe64SessionForDisplay(selectedListSession.value));const isSelectedSessionArchived=computed(()=>isArchivedVibe64Session(selectedSession.value||{}));const canCreateSession=computed(()=>{return creationOptions.value.canCreate===true});const createSessionVisible=computed(()=>creationOptions.value.showCreateAction===true);const createSessionTitle=computed(()=>{if(creationOptions.value.disabledReason)return String(creationOptions.value.disabledReason);if(creationOptions.value.canCreate!==true)return`Session creation is unavailable.`;return`Create a new Vibe64 session`});const selectedSessionTitle=computed(()=>{return vibe64SessionDisplayTitle(selectedSession.value||{})||`Session ${shortVibe64SessionId(selectedSessionId.value)}`});async function refreshSessionList(){return refetchEndpointResource(sessionListResource)}let refreshSessionDataInFlight=null;async function refreshSessionData(options={}){const reason=typeof options===`string`?options:String(options.reason||``);if(refreshSessionDataInFlight){vibe64SessionDebugLog(`client.sessionData.refresh.join`,{reason,selectedSessionId:String(selectedSessionId.value||``)});return refreshSessionDataInFlight}const startedAtMs=Date.now();vibe64SessionDebugLog(`client.sessionData.refresh.start`,{reason,selectedSessionId:String(selectedSessionId.value||``)});refreshSessionDataInFlight=refreshSessionList();try{const result=await refreshSessionDataInFlight;vibe64SessionDebugLog(`client.sessionData.refresh.done`,{durationMs:vibe64SessionDebugDurationMs(startedAtMs),reason,selectedSessionId:String(selectedSessionId.value||``),sessionCount:sessions.value.length});return result}catch(error){vibe64SessionDebugLog(`client.sessionData.refresh.error`,{durationMs:vibe64SessionDebugDurationMs(startedAtMs),error:vibe64SessionDebugError(error),reason,selectedSessionId:String(selectedSessionId.value||``)});throw error}finally{refreshSessionDataInFlight=null}}function refreshSessionDataInBackground(options={}){refreshSessionData(options).catch(()=>{})}function selectSessionId(sessionId=``){const normalizedSessionId=String(sessionId||``).trim();if(sessions.value.some(session=>session.sessionId===normalizedSessionId&&session.archiving))return;vibe64SessionDebugLog(`client.sessionData.selectSession`,{fromSessionId:String(selectedSessionId.value||``),toSessionId:normalizedSessionId});if(normalizedSessionId)emptySessionListObservedForProject=``;sessionSelection.select(normalizedSessionId)}function clearSelectedSession(){emptySessionListObservedForProject=selectionScope.value;sessionSelection.clear()}function selectPreviousSession(sessionId){const navigation=sessions.value;const index=navigation.findIndex(session=>session.sessionId===sessionId);selectSessionId(navigation.slice(0,Math.max(0,index)).filter(session=>!session.archiving).at(-1)?.sessionId||availableSessions.value.at(-1)?.sessionId||``)}const archive=proxyRefs(useVibe64SessionDialogs({beginArchive(sessionId){archiveAttempts.value[sessionId]={startedAt:new Date().toISOString(),session:sessions.value.find(session=>session.sessionId===sessionId)};if(selectedSessionId.value===sessionId)selectPreviousSession(sessionId);return projectSlug.value},finishArchive(sessionId,succeeded,archiveProject){if(projectSlug.value!==archiveProject)return;if(succeeded)archiveAttempts.value[sessionId]={succeeded:true};else{delete archiveAttempts.value[sessionId];if(!selectedSessionId.value)selectSessionId(sessionId)}},isSelectedSessionArchived,refreshSessionData,selectedSessionId,selectedSessionTitle,sessionsApiPath}));const archiveFeedback=useUiFeedback({source:`vibe64.sessions.archive.remote`});const shownArchiveFailures=new Set;watch(projectSlug,()=>{archiveAttempts.value={};agentActivityBySessionId.value={};shownArchiveFailures.clear()});useRealtimeEvent({event:VIBE64_SESSION_SUMMARY_CHANGED_EVENT,matches:({payload={}}={})=>vibe64SessionEventMatchesScope(payload,{projectSlug:projectSlug.value}),onEvent:({payload={}}={})=>{const id=String(payload.sessionId||``);if(!id)return;const activity=agentTurnRealtimeOverlayFromPayload(payload,id);if(activity)agentActivityBySessionId.value[id]=latestAgentTurnRealtimeOverlay(agentActivityBySessionId.value[id],{active:activity.active,revision:activity.revision});if(payload.reason===`session-archiving`){const session=sessions.value.find(item=>item.sessionId===id);if(session)archiveAttempts.value[id]={session,startedAt:archiveAttempts.value[id]?.startedAt||new Date().toISOString()};if(selectedSessionId.value===id)selectPreviousSession(id)}else if(payload.reason===`session-archived`)archiveAttempts.value[id]={succeeded:true};else if(payload.reason===`session-archive-failed`){delete archiveAttempts.value[id];if(!selectedSessionId.value)selectSessionId(id)}}});watch(()=>sessionList.items,items=>{for(const id of Object.keys(agentActivityBySessionId.value))if(!items.some(session=>session.sessionId===id))delete agentActivityBySessionId.value[id];for(const[id,attempt]of Object.entries(archiveAttempts.value)){if(attempt.succeeded||archive.archivingSessionId===id)continue;const session=items.find(item=>item.sessionId===id);if(!session||!sessionArchiveState(session).archiving)delete archiveAttempts.value[id]}});watch(sessions,items=>{for(const session of items){const key=`${session.sessionId}:${session.metadata?.session_archive_operation}`;if(!session.archiveError||shownArchiveFailures.has(key))continue;shownArchiveFailures.add(key);if(archive.archivingSessionId!==session.sessionId)archiveFeedback.error(new Error(session.archiveError))}},{immediate:true});function dropUnlistedRouteSession(){const query=routeQueryWithoutUnlistedSession({route,projectSlug:projectSlug.value,sessions:sessions.value});if(query)router.replace({path:route.path,hash:route.hash,query}).catch(()=>null)}const selectionReconciliationState=computed(()=>{const nextSessions=availableSessions.value;return{createSessionRunning:createSessionRunning.value,currentSessionApiPath:currentSessionApiPath.value,selectionScope:selectionScope.value,selectionRenewal:selectionRenewalResource.data.value?.renewal||null,selectionRenewalLoadError:String(selectionRenewalResource.loadError?.value||``),selectionRenewalLoaded:Boolean(selectionRenewalResource.data.value&&typeof selectionRenewalResource.data.value===`object`&&!Array.isArray(selectionRenewalResource.data.value)),selectionRenewalLoading:Boolean(selectionRenewalResource.isInitialLoading?.value||selectionRenewalResource.isLoading?.value),selectionRenewalPredecessorId:selectionRenewalPredecessorId.value,projectSlug:String(projectSlug.value||``).trim(),selectedSessionMissing:selectedSessionMissing.value,nextSessions,selectedSessionId:String(selectedSessionId.value||``),sessionListInitialLoading:sessionList.isInitialLoading,sessionListLoaded:sessionList.pages.length>0,sessionListLoadError:String(sessionList.loadError||``),sessionListLoading:sessionList.isLoading}});watch(selectionReconciliationState,state=>{const nextSessions=state.nextSessions;if(sessions.value.some(session=>session.sessionId===state.selectedSessionId&&session.archiving)){selectPreviousSession(state.selectedSessionId);return}vibe64SessionDebugLog(`client.sessionData.sessions.changed`,{selectedSessionId:String(selectedSessionId.value||``),sessionCount:nextSessions.length});if(state.sessionListInitialLoading||state.sessionListLoadError||shouldPreserveSelectedSessionDuringRefresh({createSessionRunning:state.createSessionRunning,currentSessionId:state.selectedSessionId,nextSessions,sessionListLoading:state.sessionListLoading}))return;if(!state.selectedSessionId&&nextSessions.length===0)emptySessionListObservedForProject=state.selectionScope;if(state.selectionRenewalPredecessorId){if(state.selectionRenewalLoading||state.selectionRenewalLoadError||!state.selectionRenewalLoaded)return;const selectionRenewal=state.selectionRenewal;if(selectionRenewal&&String(selectionRenewal.sessionId||``).trim()===state.selectionRenewalPredecessorId){const renewalStatus=String(selectionRenewal.status||``).trim();if(renewalStatus===`completed`){const renewedSuccessorId=renewedSuccessorSessionId({predecessorSessionId:state.selectionRenewalPredecessorId,sessions:nextSessions});if(state.selectedSessionMissing){if(renewedSuccessorId)sessionSelection.selectAvailableId(nextSessions,{fallbackId:renewedSuccessorId,getId:session=>session.sessionId})}if(renewedSuccessorId&&selectedSessionId.value===renewedSuccessorId)syncRenewalSuccessorUrl(state.selectionRenewalPredecessorId,renewedSuccessorId);if(state.selectedSessionMissing)return}else if(state.selectedSessionMissing&&[`failed`,`running`].includes(renewalStatus))return;if([`failed`,`running`].includes(renewalStatus)){sessionSelection.select(state.selectionRenewalPredecessorId);return}}}if(!state.selectionRenewalPredecessorId)dropUnlistedRouteSession();if(!state.selectedSessionId&&emptySessionListObservedForProject===state.selectionScope)return;sessionSelection.selectAvailableId(nextSessions,{fallbackId:nextSessions.at(-1)?.sessionId||``,getId:session=>session.sessionId})},{immediate:true});useVibe64CurrentSessionPublication({selectionReconciliationState});return{archive,canCreateSession,clearSelectedSession,createSession,createSessionCommand,createSessionRunning,createSessionVisible,createSessionTitle,isSelectedSessionArchived,refreshSessionData,selectSessionId,selectedSession,selectedSessionId,selectedSessionTitle,sessionList,sessions,sessionsApiPath,shortSessionId:shortVibe64SessionId}}export{mountedSessionDetailRefreshReason as a,sessionRecordHasActiveAgentWork as c,sessionWithAgentTurnRealtimeOverlay as d,refetchEndpointResource as f,mountedSessionDetailLoadState as i,agentTurnRealtimeOverlayFromPayload as l,useVibe64SessionData as n,mountedSessionRealtimeShouldRefresh as o,latestSessionDetailRecord as r,mountedSessionRecord as s,sessionListRealtimeShouldRefresh as t,latestAgentTurnRealtimeOverlay as u};
@@ -1 +1 @@
1
- import{Et as unref,Tt as toValue,it as watch,u as computed,vt as ref}from"./runtime-core.esm-bundler-Bi1P1jMa.js";import{g as useRoute}from"./useApi-BPuI6ZR9-rsYWyW6m.js";import{t as browserSessionStorage}from"./browser-D8z6v6Ge.js";import{p as selectedSessionStorageKey}from"./vibe64SessionRequestConfig-DVRCRAex.js";import{M as useVibe64ProjectSlug}from"./index-DcKFCaBZ.js";function readStoredValue(storageKey=``){try{return String(browserSessionStorage()?.getItem(storageKey)||``)}catch{return``}}function writeStoredValue(storageKey=``,value=``){try{const storage=browserSessionStorage();if(!storage)return;const normalizedValue=String(value||``).trim();if(normalizedValue){storage.setItem(storageKey,normalizedValue);return}storage.removeItem(storageKey)}catch{}}function readStorageKey(storageKey=``){return String(toValue(storageKey)||``).trim()}function readPreferredId(preferredId=``){return String(toValue(preferredId)||``).trim()}function useStoredSelection({preferredId=``,rememberedId,storageKey=``,enabled=true}){const selectionEnabled=computed(()=>Boolean(toValue(enabled)));const activeStorageKey=computed(()=>readStorageKey(storageKey));const activePreferredId=computed(()=>readPreferredId(preferredId));const restoredId=(key=activeStorageKey.value)=>rememberedId===void 0?readStoredValue(key):readPreferredId(rememberedId);const selectedId=ref(selectionEnabled.value?activePreferredId.value||restoredId():``);function select(id=``){if(!selectionEnabled.value)return;selectedId.value=String(id||``).trim();writeStoredValue(activeStorageKey.value,selectedId.value)}function clear(){select(``)}function selectAvailableId(items=[],{fallbackId=``,getId=item=>item?.id}={}){if(!selectionEnabled.value)return``;if(items.length===0){clear();return``}const itemIds=items.map(item=>String(getId(item)||``).trim()).filter(Boolean);if(itemIds.includes(selectedId.value)){select(selectedId.value);return selectedId.value}const preferredSelectionId=activePreferredId.value;if(itemIds.includes(preferredSelectionId)){select(preferredSelectionId);return selectedId.value}const restoredSelectionId=restoredId();select(itemIds.includes(restoredSelectionId)?restoredSelectionId:String(fallbackId||``).trim());return selectedId.value}function capture(){const key=activeStorageKey.value;const admitted=selectionEnabled.value;return Object.freeze({select(id=``){if(!admitted)return;const value=String(id||``).trim();writeStoredValue(key,value);if(selectionEnabled.value&&activeStorageKey.value===key)selectedId.value=value}})}watch(selectionEnabled,nextEnabled=>{selectedId.value=nextEnabled?activePreferredId.value||restoredId():``},{flush:`sync`});watch(activeStorageKey,nextStorageKey=>{if(selectionEnabled.value)selectedId.value=activePreferredId.value||restoredId(nextStorageKey)});watch(activePreferredId,nextPreferredId=>{if(selectionEnabled.value&&nextPreferredId)selectedId.value=nextPreferredId});return{capture,clear,select,selectAvailableId,selectedId}}function selectedSessionIdFromRoute(route={}){const rawValue=route.query?.session;const value=Array.isArray(rawValue)?rawValue[0]:rawValue;return String(value||``).trim()}function useVibe64SessionSelection({projectSlug=useVibe64ProjectSlug(),rememberedId,route=useRoute()}){return useStoredSelection({preferredId:computed(()=>selectedSessionIdFromRoute(route)),rememberedId,storageKey:computed(()=>selectedSessionStorageKey(unref(projectSlug)))})}export{useVibe64SessionSelection as n,selectedSessionIdFromRoute as t};
1
+ import{Et as unref,Tt as toValue,it as watch,u as computed,vt as ref}from"./runtime-core.esm-bundler-Bi1P1jMa.js";import{g as useRoute}from"./useApi-BPuI6ZR9-rsYWyW6m.js";import{t as browserSessionStorage}from"./browser-D8z6v6Ge.js";import{p as selectedSessionStorageKey}from"./vibe64SessionRequestConfig-DVRCRAex.js";import{M as useVibe64ProjectSlug}from"./index-FVeEbKiO.js";function readStoredValue(storageKey=``){try{return String(browserSessionStorage()?.getItem(storageKey)||``)}catch{return``}}function writeStoredValue(storageKey=``,value=``){try{const storage=browserSessionStorage();if(!storage)return;const normalizedValue=String(value||``).trim();if(normalizedValue){storage.setItem(storageKey,normalizedValue);return}storage.removeItem(storageKey)}catch{}}function readStorageKey(storageKey=``){return String(toValue(storageKey)||``).trim()}function readPreferredId(preferredId=``){return String(toValue(preferredId)||``).trim()}function useStoredSelection({preferredId=``,rememberedId,storageKey=``,enabled=true}){const selectionEnabled=computed(()=>Boolean(toValue(enabled)));const activeStorageKey=computed(()=>readStorageKey(storageKey));const activePreferredId=computed(()=>readPreferredId(preferredId));const restoredId=(key=activeStorageKey.value)=>rememberedId===void 0?readStoredValue(key):readPreferredId(rememberedId);const selectedId=ref(selectionEnabled.value?activePreferredId.value||restoredId():``);function select(id=``){if(!selectionEnabled.value)return;selectedId.value=String(id||``).trim();writeStoredValue(activeStorageKey.value,selectedId.value)}function clear(){select(``)}function selectAvailableId(items=[],{fallbackId=``,getId=item=>item?.id}={}){if(!selectionEnabled.value)return``;if(items.length===0){clear();return``}const itemIds=items.map(item=>String(getId(item)||``).trim()).filter(Boolean);if(itemIds.includes(selectedId.value)){select(selectedId.value);return selectedId.value}const preferredSelectionId=activePreferredId.value;if(itemIds.includes(preferredSelectionId)){select(preferredSelectionId);return selectedId.value}const restoredSelectionId=restoredId();select(itemIds.includes(restoredSelectionId)?restoredSelectionId:String(fallbackId||``).trim());return selectedId.value}function capture(){const key=activeStorageKey.value;const admitted=selectionEnabled.value;return Object.freeze({select(id=``){if(!admitted)return;const value=String(id||``).trim();writeStoredValue(key,value);if(selectionEnabled.value&&activeStorageKey.value===key)selectedId.value=value}})}watch(selectionEnabled,nextEnabled=>{selectedId.value=nextEnabled?activePreferredId.value||restoredId():``},{flush:`sync`});watch(activeStorageKey,nextStorageKey=>{if(selectionEnabled.value)selectedId.value=activePreferredId.value||restoredId(nextStorageKey)});watch(activePreferredId,nextPreferredId=>{if(selectionEnabled.value&&nextPreferredId)selectedId.value=nextPreferredId});return{capture,clear,select,selectAvailableId,selectedId}}function selectedSessionIdFromRoute(route={}){const rawValue=route.query?.session;const value=Array.isArray(rawValue)?rawValue[0]:rawValue;return String(value||``).trim()}function useVibe64SessionSelection({projectSlug=useVibe64ProjectSlug(),rememberedId,route=useRoute()}){return useStoredSelection({preferredId:computed(()=>selectedSessionIdFromRoute(route)),rememberedId,storageKey:computed(()=>selectedSessionStorageKey(unref(projectSlug)))})}export{useVibe64SessionSelection as n,selectedSessionIdFromRoute as t};
@@ -0,0 +1 @@
1
+ import{Et as unref,O as inject,u as computed}from"./runtime-core.esm-bundler-Bi1P1jMa.js";import{t as SAVED_ENV_VALUE_SOURCE}from"./contracts-CNUMi5L0.js";var VIBE64_SAVED_ENV_VALUES_KEY=Symbol(`vibe64.saved-env-values`);function recordIsSavedEnvValue(record={}){return record.source===`vibe64-host:saved-value`&&record.editable!==true}function savedEnvValueEnvironment(environmentLabel=``){const label=String(environmentLabel).toLowerCase();if(label===`production`)throw new Error(`Saved values have no production environment: the published application's Env is Staging Env.`);return label===`staging`?`staging`:`development`}var NO_SAVED_ENV_VALUES=Object.freeze({label:``,component:null});function useVibe64SavedEnvValues(){const provided=inject(VIBE64_SAVED_ENV_VALUES_KEY,NO_SAVED_ENV_VALUES);return computed(()=>{const host=unref(provided);return host===NO_SAVED_ENV_VALUES?null:host})}export{savedEnvValueEnvironment as n,useVibe64SavedEnvValues as r,recordIsSavedEnvValue as t};
@@ -1 +1 @@
1
- import{Et as unref,H as openBlock,N as nextTick,Xt as toDisplayString,b as createVNode,d as createBaseVNode,f as createBlock,i as Fragment,it as watch,m as createElementBlock,ot as withCtx,p as createCommentVNode,u as computed,vt as ref,y as createTextVNode}from"./runtime-core.esm-bundler-Bi1P1jMa.js";import{S as VIcon,_ as VProgressLinear}from"./VChip-tORFnf7z.js";import{t as useEndpointResource}from"./useEndpointResource-BwGXpV2u.js";import{t as VSelect}from"./VSelect-gYJ6qrBP.js";import{n as VAlert,t as VSkeletonLoader}from"./VSkeletonLoader-CQXCEJsR.js";import{t as VTextField}from"./VTextField-DP6b7Qaf.js";import{i as scopedDevelopmentApiUrl}from"./studioUrls-BR4ZL-TN.js";import{l as requestVibe64AiOnboarding,y as useModelRouting}from"./client-Dv4scw6i.js";import{t as VBtn}from"./VBtn-Com1gNEe.js";import{t as VSheet}from"./VSheet-_Grtwpfz.js";import{t as VDialog}from"./VDialog-CapFiCqp.js";import{i as VCardTitle,n as VCardText,o as VCardActions,t as VCard}from"./VCard-DY_DdI8Z.js";import{t as VSpacer}from"./VSpacer-VLYDmg7o.js";import{t as VSwitch}from"./VSwitch-ffi-Y2TU.js";import{t as VTextarea}from"./VTextarea-7mdIF4I0.js";import{t as _plugin_vue_export_helper_default}from"./_plugin-vue_export-helper-DNW4j-dv.js";import{t as _sfc_main$2}from"./SelectField-Df50ZFLj.js";import{t as useUiFeedback}from"./useUiFeedback--0dLsslR.js";import{t as readRefOrGetterValue}from"./vueRefOrGetterValue-y-4f_In7.js";import{L as vibe64SessionPath,k as vibe64RepositoryApiPath,o as VIBE64_SESSIONS_API_SUFFIX}from"./vibe64SessionRequestConfig-DVRCRAex.js";import{b as sameVibe64AssistantSelection,c as vibe64AssistantSelectionLabel}from"./shared-B6plZPQ_.js";import{D as Vibe64SessionAssistantMenu_default,k as requestVibe64AccountConnectionsDialog}from"./index-DcKFCaBZ.js";import{a as vibe64SessionPullRequest,i as vibe64SessionDisplayTitle}from"./vibe64SessionViewModel-CQCds_jb.js";import{a as githubProjectRepositoryName,t as GITHUB_BODY_MAX_LENGTH}from"./vibe64GithubProject-CJneIo5O.js";var _hoisted_1$1={class:`d-flex align-center justify-space-between ga-2 pa-5 pb-2`};var _hoisted_2$1={class:`d-flex align-center ga-3`};var _hoisted_3$1={class:`text-label-large`};var _hoisted_4$1={class:`text-body-medium mt-1`};var _hoisted_5$1={key:0,role:`status`};var _sfc_main$1={__name:`Vibe64CreatePullRequestDialog`,props:{modelValue:Boolean,dashboardContext:{required:true,type:Object}},emits:[`update:modelValue`,`created`],setup(__props,{emit:__emit}){const props=__props;const emit=__emit;const title=ref(``);const body=ref(``);const draft=ref(true);const pending=ref(false);const destinationReview=ref(null);const feedback=useUiFeedback({source:`vibe64.pullRequests.create`});const session=computed(()=>props.dashboardContext.session||{});const source=computed(()=>vibe64SessionPullRequest(session.value));const repository=computed(()=>githubProjectRepositoryName(props.dashboardContext.projectContext));const branch=computed(()=>{if(source.value?.headBranch)return source.value.headBranch;const destination=props.dashboardContext.workState?.destination;if(destination?.mode===`github`&&destination.branch!==props.dashboardContext.projectContext?.repository?.defaultBranch)return destination.branch;return`vibe64/pr-${props.dashboardContext.sessionId}`});const base=computed(()=>source.value?.baseBranch||props.dashboardContext.projectContext?.repository?.defaultBranch||``);const path=computed(()=>vibe64SessionPath(readRefOrGetterValue(props.dashboardContext.sessionsApiPath),props.dashboardContext.sessionId,`/pull-request`));const resource=useEndpointResource({path,queryKey:computed(()=>[`vibe64.createPullRequest`,path.value]),enabled:false});watch(()=>props.modelValue,open=>{if(open)destinationReview.value=props.dashboardContext.workState?.destination?{...props.dashboardContext.workState.destination}:null},{immediate:true});watch(()=>props.dashboardContext.sessionId,()=>{title.value=source.value?.title||vibe64SessionDisplayTitle(session.value);body.value=source.value?.body||``;draft.value=true},{immediate:true});async function submit(){if(pending.value||!title.value.trim())return;pending.value=true;try{const result=await resource.save({title:title.value.trim(),body:body.value,draft:draft.value,destinationReview:destinationReview.value},{method:`POST`});feedback.success(`Pull request created. Future commits update its source branch.`);emit(`created`,result.pullRequest);emit(`update:modelValue`,false);props.dashboardContext.refreshSessionWork?.()}catch(error){feedback.error(error,`The pull request could not be confirmed. Retry to check GitHub and continue.`)}finally{pending.value=false}}return(_ctx,_cache)=>{return openBlock(),createBlock(VDialog,{"model-value":__props.modelValue,"max-width":`38rem`,scrollable:``,persistent:pending.value,"onUpdate:modelValue":_cache[5]||(_cache[5]=$event=>emit(`update:modelValue`,$event))},{default:withCtx(()=>[createVNode(VCard,{rounded:`xl`},{default:withCtx(()=>[createBaseVNode(`div`,_hoisted_1$1,[createBaseVNode(`div`,_hoisted_2$1,[createVNode(VIcon,{icon:`$callMerge`,color:`primary`}),_cache[6]||(_cache[6]=createBaseVNode(`h2`,{class:`text-title-large`},`Create pull request`,-1))]),createVNode(VBtn,{icon:`$close`,size:`48`,variant:`text`,"aria-label":`Close pull request dialog`,disabled:pending.value,onClick:_cache[0]||(_cache[0]=$event=>emit(`update:modelValue`,false))},null,8,[`disabled`])]),createVNode(VCardText,{class:`d-flex flex-column ga-3`},{default:withCtx(()=>[createVNode(VSheet,{color:`surface-light`,rounded:`lg`,class:`pa-3 pr-destination`},{default:withCtx(()=>[createBaseVNode(`div`,_hoisted_3$1,toDisplayString(repository.value),1),createBaseVNode(`div`,_hoisted_4$1,toDisplayString(branch.value)+` → `+toDisplayString(base.value),1),_cache[7]||(_cache[7]=createBaseVNode(`p`,{class:`text-body-small on-surface-variant mt-2 mb-0`},`The base branch stays unchanged.`,-1))]),_:1}),_cache[8]||(_cache[8]=createBaseVNode(`p`,{class:`text-body-small ma-0`},`Save open file edits first.`,-1)),!destinationReview.value?(openBlock(),createElementBlock(`p`,_hoisted_5$1,`Refresh repository status before creating a pull request.`)):createCommentVNode(``,true),createVNode(VTextField,{modelValue:title.value,"onUpdate:modelValue":_cache[1]||(_cache[1]=$event=>title.value=$event),label:`Title`,variant:`outlined`,maxlength:`256`,disabled:pending.value,"hide-details":``},null,8,[`modelValue`,`disabled`]),createVNode(VTextarea,{modelValue:body.value,"onUpdate:modelValue":_cache[2]||(_cache[2]=$event=>body.value=$event),label:`Description`,placeholder:`What changed, and how did you check it?`,variant:`outlined`,rows:`3`,"auto-grow":``,maxlength:unref(GITHUB_BODY_MAX_LENGTH),disabled:pending.value,"hide-details":``},null,8,[`modelValue`,`maxlength`,`disabled`]),createVNode(VSwitch,{modelValue:draft.value,"onUpdate:modelValue":_cache[3]||(_cache[3]=$event=>draft.value=$event),color:`primary`,label:`Create as draft`,disabled:pending.value,"hide-details":``},null,8,[`modelValue`,`disabled`]),_cache[9]||(_cache[9]=createBaseVNode(`details`,{class:`pr-details text-body-small`},[createBaseVNode(`summary`,{class:`py-3`},`What gets pushed`),createBaseVNode(`p`,null,`All saved file changes are committed and pushed to the PR branch. Database data and chat history are separate. GitHub automation may run; this does not publish the app.`)],-1))]),_:1}),createVNode(VCardActions,{class:`pa-5 pt-2`},{default:withCtx(()=>[createVNode(VSpacer),createVNode(VBtn,{variant:`text`,disabled:pending.value,onClick:_cache[4]||(_cache[4]=$event=>emit(`update:modelValue`,false))},{default:withCtx(()=>[..._cache[10]||(_cache[10]=[createTextVNode(`Cancel`,-1)])]),_:1},8,[`disabled`]),createVNode(VBtn,{color:`primary`,variant:`flat`,rounded:`pill`,disabled:pending.value||!title.value.trim()||!destinationReview.value||__props.dashboardContext.sourceOperationsSuspended,"aria-busy":pending.value,onClick:submit},{default:withCtx(()=>[createTextVNode(toDisplayString(pending.value?`Creating…`:draft.value?`Create draft PR`:`Create pull request`),1)]),_:1},8,[`disabled`,`aria-busy`])]),_:1})]),_:1})]),_:1},8,[`model-value`,`persistent`])}}};var Vibe64CreatePullRequestDialog_default=_plugin_vue_export_helper_default(_sfc_main$1,[[`__scopeId`,`data-v-3f93a801`]]);var _hoisted_1={class:`vibe64-assistant-dialog__title-copy`};var _hoisted_2={class:`text-body-small`};var _hoisted_3={key:2,class:`vibe64-assistant-dialog__ai`};var _hoisted_4={class:`text-body-medium mb-0`};var _hoisted_5={key:3,class:`d-flex flex-column ga-2`};var _hoisted_6={key:0,class:`d-flex flex-column ga-3 mt-3`};var _hoisted_7={key:0,class:`text-body-small`,style:{"overflow-wrap":`anywhere`}};var _hoisted_8={key:0,class:`vibe64-assistant-dialog__progress`,role:`status`,"aria-live":`polite`};var _sfc_main={__name:`Vibe64AssistantSessionDialog`,props:{modelValue:Boolean,toolbar:{required:true,type:Object}},emits:[`created`,`update:model-value`],setup(__props,{emit:__emit}){const props=__props;const emit=__emit;const routing=useModelRouting({enabled:computed(()=>props.modelValue),view:`main`});const mainSelection=routing.mainChatSelection;const openConnectionSettings=()=>requestVibe64AccountConnectionsDialog({section:`ai`});const canChooseSessionAi=computed(()=>routing.resource.data.value?.canConfigure===true);const sessionAi=ref(null);const customOpen=ref(false);const changeButton=ref(null);const aiSummary=computed(()=>sessionAi.value?`This session runs on: ${vibe64AssistantSelectionLabel(sessionAi.value)}`:`Runs on your main AI: ${vibe64AssistantSelectionLabel(mainSelection.value)}`);function openSessionAiChoice(){if(canChooseSessionAi.value&&!submitting.value)customOpen.value=true}function chooseSessionAi(selection){sessionAi.value=sameVibe64AssistantSelection(selection,mainSelection.value)?null:selection;return{ok:true}}function useMainAi(){sessionAi.value=null}function setUpAi(){close();requestVibe64AiOnboarding()}const submitButton=ref(null);const submitting=computed(()=>props.toolbar.createSessionRunning===true);const branchMode=ref(`project`);const chooseBranch=computed(()=>branchMode.value!==`project`);const createBranch=computed(()=>branchMode.value===`new`);const branchName=ref(``);const newBranchName=ref(``);const branchProject=computed(()=>props.toolbar.projectContext||{});const branchSelectionAvailable=computed(()=>!props.toolbar.repositoryBranchSelectionDisabled&&[`github`,`managed_git`].includes(branchProject.value.repositoryMode||branchProject.value.repository?.mode));const branchChoices=computed(()=>[{title:`Project branch (${branchProject.value.repository?.defaultBranch||`main`})`,value:`project`},{title:`Create a new branch`,value:`new`},{title:`Use an existing branch`,value:`existing`}]);const branchRepository=computed(()=>branchProject.value.githubRepository?.fullName||branchProject.value.repository?.github?.fullName||branchProject.value.slug);const branchPath=computed(()=>scopedDevelopmentApiUrl(`${vibe64RepositoryApiPath(`/api${VIBE64_SESSIONS_API_SUFFIX}`)}/branches`,branchProject.value.slug));const branches=useEndpointResource({path:branchPath,queryKey:computed(()=>[`vibe64.branches`,branchPath.value]),enabled:computed(()=>props.modelValue&&branchSelectionAvailable.value&&chooseBranch.value),queryOptions:{retry:false},fallbackLoadError:`Repository branches could not load.`});const selectedBranch=computed(()=>branches.data.value?.branches?.find(item=>item.name===branchName.value));const branchAlreadyExists=computed(()=>branches.data.value?.branches?.some(item=>item.name===newBranchName.value.trim()));const branchSelectionReady=computed(()=>{if(!chooseBranch.value)return true;if(!selectedBranch.value||branches.isLoading.value||branches.loadError.value)return false;return!createBranch.value||Boolean(newBranchName.value.trim())&&!branchAlreadyExists.value});watch(()=>branches.data.value,value=>{if(!value?.branches?.some(item=>item.name===branchName.value))branchName.value=value?.defaultBranch||``},{immediate:true});function close(){if(!submitting.value)emit(`update:model-value`,false)}async function submit(){if(!mainSelection.value||submitting.value||!branchSelectionReady.value)return;let response;try{const options={};if(chooseBranch.value)options.repositoryBranch={name:createBranch.value?newBranchName.value.trim():branchName.value,...createBranch.value?{fromBranch:branchName.value}:{},expectedCommit:selectedBranch.value.commit};response=await props.toolbar.createSession(sessionAi.value||{},options)}catch{return}if(response?.ok!==false&&response?.sessionId){emit(`created`,response);emit(`update:model-value`,false)}}watch(()=>props.modelValue,open=>{if(!open)return;branchMode.value=`project`;branchName.value=branches.data.value?.defaultBranch||``;newBranchName.value=``;sessionAi.value=null;customOpen.value=false},{immediate:true});watch(submitting,async(running,wasRunning)=>{if(running||!wasRunning||!props.modelValue)return;await nextTick();const target=submitButton.value?.$el;if(target?.isConnected===true)target.focus({preventScroll:true})});return(_ctx,_cache)=>{return openBlock(),createBlock(VDialog,{"model-value":__props.modelValue,persistent:submitting.value,"max-width":`38rem`,scrollable:``,"onUpdate:modelValue":_cache[6]||(_cache[6]=$event=>!$event&&close())},{default:withCtx(()=>[createVNode(VCard,{class:`vibe64-assistant-dialog`,rounded:`xl`},{default:withCtx(()=>[createVNode(VCardTitle,{class:`vibe64-assistant-dialog__title`},{default:withCtx(()=>[createBaseVNode(`span`,_hoisted_1,[_cache[7]||(_cache[7]=createBaseVNode(`strong`,{class:`text-title-large`},`Start an AI session`,-1)),createBaseVNode(`small`,_hoisted_2,toDisplayString(sessionAi.value?`Starts in Custom. Choose Senior, Junior or Auto from chat.`:`Starts in Auto. Choose Senior or Junior from chat.`),1)]),createVNode(VBtn,{"aria-label":`Close AI session dialog`,disabled:submitting.value,icon:`$close`,title:`Close`,variant:`text`,onClick:close},null,8,[`disabled`])]),_:1}),createVNode(VCardText,{class:`vibe64-assistant-dialog__body`},{default:withCtx(()=>[unref(routing).resource.isInitialLoading.value?(openBlock(),createBlock(VSkeletonLoader,{key:0,type:`list-item-two-line`})):unref(routing).loadError.value?(openBlock(),createBlock(VAlert,{key:1,type:`error`,variant:`tonal`},{default:withCtx(()=>[createTextVNode(toDisplayString(unref(routing).loadError.value)+` `,1),createVNode(VBtn,{variant:`text`,onClick:_cache[0]||(_cache[0]=$event=>unref(routing).resource.reload())},{default:withCtx(()=>[..._cache[8]||(_cache[8]=[createTextVNode(`Try again`,-1)])]),_:1})]),_:1})):unref(mainSelection)?(openBlock(),createElementBlock(`div`,_hoisted_3,[createBaseVNode(`p`,_hoisted_4,[createTextVNode(toDisplayString(aiSummary.value)+` `,1),canChooseSessionAi.value?(openBlock(),createBlock(VBtn,{key:0,ref_key:`changeButton`,ref:changeButton,disabled:submitting.value,size:`small`,variant:`text`,onClick:openSessionAiChoice},{default:withCtx(()=>[..._cache[9]||(_cache[9]=[createTextVNode(` Change `,-1)])]),_:1},8,[`disabled`])):createCommentVNode(``,true),sessionAi.value?(openBlock(),createBlock(VBtn,{key:1,disabled:submitting.value,size:`small`,variant:`text`,onClick:useMainAi},{default:withCtx(()=>[..._cache[10]||(_cache[10]=[createTextVNode(`Use main AI`,-1)])]),_:1},8,[`disabled`])):createCommentVNode(``,true)]),createVNode(VBtn,{class:`vibe64-assistant-dialog__main-ai`,disabled:submitting.value,"prepend-icon":`$settings`,size:`small`,variant:`text`,onClick:openConnectionSettings},{default:withCtx(()=>[..._cache[11]||(_cache[11]=[createTextVNode(` Change main AI for all sessions `,-1)])]),_:1},8,[`disabled`])])):(openBlock(),createElementBlock(`div`,_hoisted_5,[_cache[13]||(_cache[13]=createBaseVNode(`strong`,null,`No AI is set up yet`,-1)),_cache[14]||(_cache[14]=createBaseVNode(`span`,{class:`text-body-small`},`Set up your AI, then come back to start a session.`,-1)),createVNode(VBtn,{color:`primary`,variant:`flat`,class:`align-self-start`,onClick:setUpAi},{default:withCtx(()=>[..._cache[12]||(_cache[12]=[createTextVNode(`Set up your AI`,-1)])]),_:1})])),branchSelectionAvailable.value?(openBlock(),createElementBlock(Fragment,{key:4},[createVNode(VSelect,{modelValue:branchMode.value,"onUpdate:modelValue":_cache[1]||(_cache[1]=$event=>branchMode.value=$event),items:branchChoices.value,label:`Work on`,disabled:submitting.value,"hide-details":``,class:`mt-4`},null,8,[`modelValue`,`items`,`disabled`]),chooseBranch.value?(openBlock(),createElementBlock(`div`,_hoisted_6,[createBranch.value?(openBlock(),createBlock(VTextField,{key:0,modelValue:newBranchName.value,"onUpdate:modelValue":_cache[2]||(_cache[2]=$event=>newBranchName.value=$event),label:`New branch name`,placeholder:`e.g. improve-booking`,maxlength:`255`,disabled:submitting.value,"error-messages":newBranchName.value.trim()&&branchAlreadyExists.value?`That branch already exists. Choose an existing branch instead.`:``,"hide-details":`auto`},null,8,[`modelValue`,`disabled`,`error-messages`])):createCommentVNode(``,true),unref(branches).isLoading.value?(openBlock(),createBlock(VSkeletonLoader,{key:1,type:`list-item-two-line, paragraph`})):unref(branches).loadError.value?(openBlock(),createBlock(VAlert,{key:2,type:`error`,variant:`tonal`},{default:withCtx(()=>[createTextVNode(toDisplayString(unref(branches).loadError.value)+` `,1),createVNode(VBtn,{variant:`text`,onClick:_cache[3]||(_cache[3]=$event=>unref(branches).reload())},{default:withCtx(()=>[..._cache[15]||(_cache[15]=[createTextVNode(`Try again`,-1)])]),_:1})]),_:1})):(openBlock(),createElementBlock(Fragment,{key:3},[createVNode(unref(_sfc_main$2),{modelValue:branchName.value,"onUpdate:modelValue":_cache[4]||(_cache[4]=$event=>branchName.value=$event),items:unref(branches).data.value?.branches||[],loading:unref(branches).isLoading.value,"item-title":`name`,"item-value":`name`,label:createBranch.value?`Create from`:`Branch`,disabled:submitting.value,"hide-details":``},null,8,[`modelValue`,`items`,`loading`,`label`,`disabled`]),selectedBranch.value?(openBlock(),createElementBlock(`p`,_hoisted_7,toDisplayString(createBranch.value?`Creates the branch and opens a new session.`:`Opens a new session on this branch.`)+` Your changes will be saved to `+toDisplayString(branchRepository.value)+`:`+toDisplayString(createBranch.value?newBranchName.value.trim()||`your new branch`:branchName.value)+`. `,1)):createCommentVNode(``,true),_cache[16]||(_cache[16]=createBaseVNode(`p`,{class:`text-body-small`},`Publishing the app still uses the project branch.`,-1))],64))])):createCommentVNode(``,true)],64)):createCommentVNode(``,true)]),_:1}),submitting.value?(openBlock(),createElementBlock(`div`,_hoisted_8,[createVNode(VProgressLinear,{indeterminate:``,color:`primary`,rounded:``}),_cache[17]||(_cache[17]=createBaseVNode(`p`,{class:`text-body-small mb-0`},` Copying the project source for the new session. This can take a little while for a large project. Any connected repositories and workspace setup then continue in the session, which shows their progress. `,-1))])):createCommentVNode(``,true),createVNode(VCardActions,{class:`vibe64-assistant-dialog__actions`},{default:withCtx(()=>[createVNode(VBtn,{disabled:submitting.value,variant:`text`,onClick:close},{default:withCtx(()=>[..._cache[18]||(_cache[18]=[createTextVNode(`Cancel`,-1)])]),_:1},8,[`disabled`]),createVNode(VBtn,{ref_key:`submitButton`,ref:submitButton,"aria-busy":submitting.value?`true`:void 0,color:`primary`,disabled:!unref(mainSelection)||submitting.value||!branchSelectionReady.value,variant:`flat`,onClick:submit},{default:withCtx(()=>[createTextVNode(toDisplayString(submitting.value?`Creating session…`:chooseBranch.value&&createBranch.value?`Create branch & session`:`Create session`),1)]),_:1},8,[`aria-busy`,`disabled`])]),_:1}),createVNode(Vibe64SessionAssistantMenu_default,{modelValue:customOpen.value,"onUpdate:modelValue":_cache[5]||(_cache[5]=$event=>customOpen.value=$event),target:changeButton.value?.$el||null,selection:sessionAi.value||unref(mainSelection),"can-configure":canChooseSessionAi.value,"changes-disabled":submitting.value,"save-selection":chooseSessionAi},null,8,[`modelValue`,`target`,`selection`,`can-configure`,`changes-disabled`])]),_:1})]),_:1},8,[`model-value`,`persistent`])}}};var Vibe64AssistantSessionDialog_default=_plugin_vue_export_helper_default(_sfc_main,[[`__scopeId`,`data-v-2024d654`]]);var CREATED_SESSION_FOCUS_TIMEOUT_MS=2e3;async function focusCreatedVibe64SessionTab(sessionId=``){const normalizedSessionId=String(sessionId||``).trim();if(!normalizedSessionId||typeof document===`undefined`)return false;const deadline=Date.now()+CREATED_SESSION_FOCUS_TIMEOUT_MS;while(Date.now()<deadline){const dialogVisible=[...document.querySelectorAll(`.vibe64-assistant-dialog`)].some(element=>element.getClientRects().length>0);const target=[...document.querySelectorAll(`[data-vibe64-session-id]`)].find(element=>element.getAttribute(`data-vibe64-session-id`)===normalizedSessionId&&element.getClientRects().length>0);if(!dialogVisible&&target){target.focus({preventScroll:true});return document.activeElement===target}await new Promise(resolve=>{(globalThis.requestAnimationFrame||(callback=>setTimeout(callback,16)))(resolve)})}return false}export{Vibe64AssistantSessionDialog_default as n,Vibe64CreatePullRequestDialog_default as r,focusCreatedVibe64SessionTab as t};
1
+ import{Et as unref,H as openBlock,N as nextTick,Xt as toDisplayString,b as createVNode,d as createBaseVNode,f as createBlock,i as Fragment,it as watch,m as createElementBlock,ot as withCtx,p as createCommentVNode,u as computed,vt as ref,y as createTextVNode}from"./runtime-core.esm-bundler-Bi1P1jMa.js";import{S as VIcon,_ as VProgressLinear}from"./VChip-tORFnf7z.js";import{t as useEndpointResource}from"./useEndpointResource-BwGXpV2u.js";import{t as VSelect}from"./VSelect-gYJ6qrBP.js";import{n as VAlert,t as VSkeletonLoader}from"./VSkeletonLoader-CQXCEJsR.js";import{t as VTextField}from"./VTextField-DP6b7Qaf.js";import{i as scopedDevelopmentApiUrl}from"./studioUrls-BR4ZL-TN.js";import{l as requestVibe64AiOnboarding,y as useModelRouting}from"./client-CQ49uWhR.js";import{t as VBtn}from"./VBtn-Com1gNEe.js";import{t as VSheet}from"./VSheet-_Grtwpfz.js";import{t as VDialog}from"./VDialog-CapFiCqp.js";import{i as VCardTitle,n as VCardText,o as VCardActions,t as VCard}from"./VCard-DY_DdI8Z.js";import{t as VSpacer}from"./VSpacer-VLYDmg7o.js";import{t as VSwitch}from"./VSwitch-ffi-Y2TU.js";import{t as VTextarea}from"./VTextarea-7mdIF4I0.js";import{t as _plugin_vue_export_helper_default}from"./_plugin-vue_export-helper-DNW4j-dv.js";import{t as _sfc_main$2}from"./SelectField-Df50ZFLj.js";import{t as useUiFeedback}from"./useUiFeedback-8Wvg7A_S.js";import{t as readRefOrGetterValue}from"./vueRefOrGetterValue-y-4f_In7.js";import{L as vibe64SessionPath,k as vibe64RepositoryApiPath,o as VIBE64_SESSIONS_API_SUFFIX}from"./vibe64SessionRequestConfig-DVRCRAex.js";import{b as sameVibe64AssistantSelection,c as vibe64AssistantSelectionLabel}from"./shared-B6plZPQ_.js";import{D as Vibe64SessionAssistantMenu_default,k as requestVibe64AccountConnectionsDialog}from"./index-FVeEbKiO.js";import{a as vibe64SessionPullRequest,i as vibe64SessionDisplayTitle}from"./vibe64SessionViewModel-CQCds_jb.js";import{a as githubProjectRepositoryName,t as GITHUB_BODY_MAX_LENGTH}from"./vibe64GithubProject-CJneIo5O.js";var _hoisted_1$1={class:`d-flex align-center justify-space-between ga-2 pa-5 pb-2`};var _hoisted_2$1={class:`d-flex align-center ga-3`};var _hoisted_3$1={class:`text-label-large`};var _hoisted_4$1={class:`text-body-medium mt-1`};var _hoisted_5$1={key:0,role:`status`};var _sfc_main$1={__name:`Vibe64CreatePullRequestDialog`,props:{modelValue:Boolean,dashboardContext:{required:true,type:Object}},emits:[`update:modelValue`,`created`],setup(__props,{emit:__emit}){const props=__props;const emit=__emit;const title=ref(``);const body=ref(``);const draft=ref(true);const pending=ref(false);const destinationReview=ref(null);const feedback=useUiFeedback({source:`vibe64.pullRequests.create`});const session=computed(()=>props.dashboardContext.session||{});const source=computed(()=>vibe64SessionPullRequest(session.value));const repository=computed(()=>githubProjectRepositoryName(props.dashboardContext.projectContext));const branch=computed(()=>{if(source.value?.headBranch)return source.value.headBranch;const destination=props.dashboardContext.workState?.destination;if(destination?.mode===`github`&&destination.branch!==props.dashboardContext.projectContext?.repository?.defaultBranch)return destination.branch;return`vibe64/pr-${props.dashboardContext.sessionId}`});const base=computed(()=>source.value?.baseBranch||props.dashboardContext.projectContext?.repository?.defaultBranch||``);const path=computed(()=>vibe64SessionPath(readRefOrGetterValue(props.dashboardContext.sessionsApiPath),props.dashboardContext.sessionId,`/pull-request`));const resource=useEndpointResource({path,queryKey:computed(()=>[`vibe64.createPullRequest`,path.value]),enabled:false});watch(()=>props.modelValue,open=>{if(open)destinationReview.value=props.dashboardContext.workState?.destination?{...props.dashboardContext.workState.destination}:null},{immediate:true});watch(()=>props.dashboardContext.sessionId,()=>{title.value=source.value?.title||vibe64SessionDisplayTitle(session.value);body.value=source.value?.body||``;draft.value=true},{immediate:true});async function submit(){if(pending.value||!title.value.trim())return;pending.value=true;try{const result=await resource.save({title:title.value.trim(),body:body.value,draft:draft.value,destinationReview:destinationReview.value},{method:`POST`});feedback.success(`Pull request created. Future commits update its source branch.`);emit(`created`,result.pullRequest);emit(`update:modelValue`,false);props.dashboardContext.refreshSessionWork?.()}catch(error){feedback.error(error,`The pull request could not be confirmed. Retry to check GitHub and continue.`)}finally{pending.value=false}}return(_ctx,_cache)=>{return openBlock(),createBlock(VDialog,{"model-value":__props.modelValue,"max-width":`38rem`,scrollable:``,persistent:pending.value,"onUpdate:modelValue":_cache[5]||(_cache[5]=$event=>emit(`update:modelValue`,$event))},{default:withCtx(()=>[createVNode(VCard,{rounded:`xl`},{default:withCtx(()=>[createBaseVNode(`div`,_hoisted_1$1,[createBaseVNode(`div`,_hoisted_2$1,[createVNode(VIcon,{icon:`$callMerge`,color:`primary`}),_cache[6]||(_cache[6]=createBaseVNode(`h2`,{class:`text-title-large`},`Create pull request`,-1))]),createVNode(VBtn,{icon:`$close`,size:`48`,variant:`text`,"aria-label":`Close pull request dialog`,disabled:pending.value,onClick:_cache[0]||(_cache[0]=$event=>emit(`update:modelValue`,false))},null,8,[`disabled`])]),createVNode(VCardText,{class:`d-flex flex-column ga-3`},{default:withCtx(()=>[createVNode(VSheet,{color:`surface-light`,rounded:`lg`,class:`pa-3 pr-destination`},{default:withCtx(()=>[createBaseVNode(`div`,_hoisted_3$1,toDisplayString(repository.value),1),createBaseVNode(`div`,_hoisted_4$1,toDisplayString(branch.value)+` → `+toDisplayString(base.value),1),_cache[7]||(_cache[7]=createBaseVNode(`p`,{class:`text-body-small on-surface-variant mt-2 mb-0`},`The base branch stays unchanged.`,-1))]),_:1}),_cache[8]||(_cache[8]=createBaseVNode(`p`,{class:`text-body-small ma-0`},`Save open file edits first.`,-1)),!destinationReview.value?(openBlock(),createElementBlock(`p`,_hoisted_5$1,`Refresh repository status before creating a pull request.`)):createCommentVNode(``,true),createVNode(VTextField,{modelValue:title.value,"onUpdate:modelValue":_cache[1]||(_cache[1]=$event=>title.value=$event),label:`Title`,variant:`outlined`,maxlength:`256`,disabled:pending.value,"hide-details":``},null,8,[`modelValue`,`disabled`]),createVNode(VTextarea,{modelValue:body.value,"onUpdate:modelValue":_cache[2]||(_cache[2]=$event=>body.value=$event),label:`Description`,placeholder:`What changed, and how did you check it?`,variant:`outlined`,rows:`3`,"auto-grow":``,maxlength:unref(GITHUB_BODY_MAX_LENGTH),disabled:pending.value,"hide-details":``},null,8,[`modelValue`,`maxlength`,`disabled`]),createVNode(VSwitch,{modelValue:draft.value,"onUpdate:modelValue":_cache[3]||(_cache[3]=$event=>draft.value=$event),color:`primary`,label:`Create as draft`,disabled:pending.value,"hide-details":``},null,8,[`modelValue`,`disabled`]),_cache[9]||(_cache[9]=createBaseVNode(`details`,{class:`pr-details text-body-small`},[createBaseVNode(`summary`,{class:`py-3`},`What gets pushed`),createBaseVNode(`p`,null,`All saved file changes are committed and pushed to the PR branch. Database data and chat history are separate. GitHub automation may run; this does not publish the app.`)],-1))]),_:1}),createVNode(VCardActions,{class:`pa-5 pt-2`},{default:withCtx(()=>[createVNode(VSpacer),createVNode(VBtn,{variant:`text`,disabled:pending.value,onClick:_cache[4]||(_cache[4]=$event=>emit(`update:modelValue`,false))},{default:withCtx(()=>[..._cache[10]||(_cache[10]=[createTextVNode(`Cancel`,-1)])]),_:1},8,[`disabled`]),createVNode(VBtn,{color:`primary`,variant:`flat`,rounded:`pill`,disabled:pending.value||!title.value.trim()||!destinationReview.value||__props.dashboardContext.sourceOperationsSuspended,"aria-busy":pending.value,onClick:submit},{default:withCtx(()=>[createTextVNode(toDisplayString(pending.value?`Creating…`:draft.value?`Create draft PR`:`Create pull request`),1)]),_:1},8,[`disabled`,`aria-busy`])]),_:1})]),_:1})]),_:1},8,[`model-value`,`persistent`])}}};var Vibe64CreatePullRequestDialog_default=_plugin_vue_export_helper_default(_sfc_main$1,[[`__scopeId`,`data-v-3f93a801`]]);var _hoisted_1={class:`vibe64-assistant-dialog__title-copy`};var _hoisted_2={class:`text-body-small`};var _hoisted_3={key:2,class:`vibe64-assistant-dialog__ai`};var _hoisted_4={class:`text-body-medium mb-0`};var _hoisted_5={key:3,class:`d-flex flex-column ga-2`};var _hoisted_6={key:0,class:`d-flex flex-column ga-3 mt-3`};var _hoisted_7={key:0,class:`text-body-small`,style:{"overflow-wrap":`anywhere`}};var _hoisted_8={key:0,class:`vibe64-assistant-dialog__progress`,role:`status`,"aria-live":`polite`};var _sfc_main={__name:`Vibe64AssistantSessionDialog`,props:{modelValue:Boolean,toolbar:{required:true,type:Object}},emits:[`created`,`update:model-value`],setup(__props,{emit:__emit}){const props=__props;const emit=__emit;const routing=useModelRouting({enabled:computed(()=>props.modelValue),view:`main`});const mainSelection=routing.mainChatSelection;const openConnectionSettings=()=>requestVibe64AccountConnectionsDialog({section:`ai`});const canChooseSessionAi=computed(()=>routing.resource.data.value?.canConfigure===true);const sessionAi=ref(null);const customOpen=ref(false);const changeButton=ref(null);const aiSummary=computed(()=>sessionAi.value?`This session runs on: ${vibe64AssistantSelectionLabel(sessionAi.value)}`:`Runs on your main AI: ${vibe64AssistantSelectionLabel(mainSelection.value)}`);function openSessionAiChoice(){if(canChooseSessionAi.value&&!submitting.value)customOpen.value=true}function chooseSessionAi(selection){sessionAi.value=sameVibe64AssistantSelection(selection,mainSelection.value)?null:selection;return{ok:true}}function useMainAi(){sessionAi.value=null}function setUpAi(){close();requestVibe64AiOnboarding()}const submitButton=ref(null);const submitting=computed(()=>props.toolbar.createSessionRunning===true);const branchMode=ref(`project`);const chooseBranch=computed(()=>branchMode.value!==`project`);const createBranch=computed(()=>branchMode.value===`new`);const branchName=ref(``);const newBranchName=ref(``);const branchProject=computed(()=>props.toolbar.projectContext||{});const branchSelectionAvailable=computed(()=>!props.toolbar.repositoryBranchSelectionDisabled&&[`github`,`managed_git`].includes(branchProject.value.repositoryMode||branchProject.value.repository?.mode));const branchChoices=computed(()=>[{title:`Project branch (${branchProject.value.repository?.defaultBranch||`main`})`,value:`project`},{title:`Create a new branch`,value:`new`},{title:`Use an existing branch`,value:`existing`}]);const branchRepository=computed(()=>branchProject.value.githubRepository?.fullName||branchProject.value.repository?.github?.fullName||branchProject.value.slug);const branchPath=computed(()=>scopedDevelopmentApiUrl(`${vibe64RepositoryApiPath(`/api${VIBE64_SESSIONS_API_SUFFIX}`)}/branches`,branchProject.value.slug));const branches=useEndpointResource({path:branchPath,queryKey:computed(()=>[`vibe64.branches`,branchPath.value]),enabled:computed(()=>props.modelValue&&branchSelectionAvailable.value&&chooseBranch.value),queryOptions:{retry:false},fallbackLoadError:`Repository branches could not load.`});const selectedBranch=computed(()=>branches.data.value?.branches?.find(item=>item.name===branchName.value));const branchAlreadyExists=computed(()=>branches.data.value?.branches?.some(item=>item.name===newBranchName.value.trim()));const branchSelectionReady=computed(()=>{if(!chooseBranch.value)return true;if(!selectedBranch.value||branches.isLoading.value||branches.loadError.value)return false;return!createBranch.value||Boolean(newBranchName.value.trim())&&!branchAlreadyExists.value});watch(()=>branches.data.value,value=>{if(!value?.branches?.some(item=>item.name===branchName.value))branchName.value=value?.defaultBranch||``},{immediate:true});function close(){if(!submitting.value)emit(`update:model-value`,false)}async function submit(){if(!mainSelection.value||submitting.value||!branchSelectionReady.value)return;let response;try{const options={};if(chooseBranch.value)options.repositoryBranch={name:createBranch.value?newBranchName.value.trim():branchName.value,...createBranch.value?{fromBranch:branchName.value}:{},expectedCommit:selectedBranch.value.commit};response=await props.toolbar.createSession(sessionAi.value||{},options)}catch{return}if(response?.ok!==false&&response?.sessionId){emit(`created`,response);emit(`update:model-value`,false)}}watch(()=>props.modelValue,open=>{if(!open)return;branchMode.value=`project`;branchName.value=branches.data.value?.defaultBranch||``;newBranchName.value=``;sessionAi.value=null;customOpen.value=false},{immediate:true});watch(submitting,async(running,wasRunning)=>{if(running||!wasRunning||!props.modelValue)return;await nextTick();const target=submitButton.value?.$el;if(target?.isConnected===true)target.focus({preventScroll:true})});return(_ctx,_cache)=>{return openBlock(),createBlock(VDialog,{"model-value":__props.modelValue,persistent:submitting.value,"max-width":`38rem`,scrollable:``,"onUpdate:modelValue":_cache[6]||(_cache[6]=$event=>!$event&&close())},{default:withCtx(()=>[createVNode(VCard,{class:`vibe64-assistant-dialog`,rounded:`xl`},{default:withCtx(()=>[createVNode(VCardTitle,{class:`vibe64-assistant-dialog__title`},{default:withCtx(()=>[createBaseVNode(`span`,_hoisted_1,[_cache[7]||(_cache[7]=createBaseVNode(`strong`,{class:`text-title-large`},`Start an AI session`,-1)),createBaseVNode(`small`,_hoisted_2,toDisplayString(sessionAi.value?`Starts in Custom. Choose Senior, Junior or Auto from chat.`:`Starts in Auto. Choose Senior or Junior from chat.`),1)]),createVNode(VBtn,{"aria-label":`Close AI session dialog`,disabled:submitting.value,icon:`$close`,title:`Close`,variant:`text`,onClick:close},null,8,[`disabled`])]),_:1}),createVNode(VCardText,{class:`vibe64-assistant-dialog__body`},{default:withCtx(()=>[unref(routing).resource.isInitialLoading.value?(openBlock(),createBlock(VSkeletonLoader,{key:0,type:`list-item-two-line`})):unref(routing).loadError.value?(openBlock(),createBlock(VAlert,{key:1,type:`error`,variant:`tonal`},{default:withCtx(()=>[createTextVNode(toDisplayString(unref(routing).loadError.value)+` `,1),createVNode(VBtn,{variant:`text`,onClick:_cache[0]||(_cache[0]=$event=>unref(routing).resource.reload())},{default:withCtx(()=>[..._cache[8]||(_cache[8]=[createTextVNode(`Try again`,-1)])]),_:1})]),_:1})):unref(mainSelection)?(openBlock(),createElementBlock(`div`,_hoisted_3,[createBaseVNode(`p`,_hoisted_4,[createTextVNode(toDisplayString(aiSummary.value)+` `,1),canChooseSessionAi.value?(openBlock(),createBlock(VBtn,{key:0,ref_key:`changeButton`,ref:changeButton,disabled:submitting.value,size:`small`,variant:`text`,onClick:openSessionAiChoice},{default:withCtx(()=>[..._cache[9]||(_cache[9]=[createTextVNode(` Change `,-1)])]),_:1},8,[`disabled`])):createCommentVNode(``,true),sessionAi.value?(openBlock(),createBlock(VBtn,{key:1,disabled:submitting.value,size:`small`,variant:`text`,onClick:useMainAi},{default:withCtx(()=>[..._cache[10]||(_cache[10]=[createTextVNode(`Use main AI`,-1)])]),_:1},8,[`disabled`])):createCommentVNode(``,true)]),createVNode(VBtn,{class:`vibe64-assistant-dialog__main-ai`,disabled:submitting.value,"prepend-icon":`$settings`,size:`small`,variant:`text`,onClick:openConnectionSettings},{default:withCtx(()=>[..._cache[11]||(_cache[11]=[createTextVNode(` Change main AI for all sessions `,-1)])]),_:1},8,[`disabled`])])):(openBlock(),createElementBlock(`div`,_hoisted_5,[_cache[13]||(_cache[13]=createBaseVNode(`strong`,null,`No AI is set up yet`,-1)),_cache[14]||(_cache[14]=createBaseVNode(`span`,{class:`text-body-small`},`Set up your AI, then come back to start a session.`,-1)),createVNode(VBtn,{color:`primary`,variant:`flat`,class:`align-self-start`,onClick:setUpAi},{default:withCtx(()=>[..._cache[12]||(_cache[12]=[createTextVNode(`Set up your AI`,-1)])]),_:1})])),branchSelectionAvailable.value?(openBlock(),createElementBlock(Fragment,{key:4},[createVNode(VSelect,{modelValue:branchMode.value,"onUpdate:modelValue":_cache[1]||(_cache[1]=$event=>branchMode.value=$event),items:branchChoices.value,label:`Work on`,disabled:submitting.value,"hide-details":``,class:`mt-4`},null,8,[`modelValue`,`items`,`disabled`]),chooseBranch.value?(openBlock(),createElementBlock(`div`,_hoisted_6,[createBranch.value?(openBlock(),createBlock(VTextField,{key:0,modelValue:newBranchName.value,"onUpdate:modelValue":_cache[2]||(_cache[2]=$event=>newBranchName.value=$event),label:`New branch name`,placeholder:`e.g. improve-booking`,maxlength:`255`,disabled:submitting.value,"error-messages":newBranchName.value.trim()&&branchAlreadyExists.value?`That branch already exists. Choose an existing branch instead.`:``,"hide-details":`auto`},null,8,[`modelValue`,`disabled`,`error-messages`])):createCommentVNode(``,true),unref(branches).isLoading.value?(openBlock(),createBlock(VSkeletonLoader,{key:1,type:`list-item-two-line, paragraph`})):unref(branches).loadError.value?(openBlock(),createBlock(VAlert,{key:2,type:`error`,variant:`tonal`},{default:withCtx(()=>[createTextVNode(toDisplayString(unref(branches).loadError.value)+` `,1),createVNode(VBtn,{variant:`text`,onClick:_cache[3]||(_cache[3]=$event=>unref(branches).reload())},{default:withCtx(()=>[..._cache[15]||(_cache[15]=[createTextVNode(`Try again`,-1)])]),_:1})]),_:1})):(openBlock(),createElementBlock(Fragment,{key:3},[createVNode(unref(_sfc_main$2),{modelValue:branchName.value,"onUpdate:modelValue":_cache[4]||(_cache[4]=$event=>branchName.value=$event),items:unref(branches).data.value?.branches||[],loading:unref(branches).isLoading.value,"item-title":`name`,"item-value":`name`,label:createBranch.value?`Create from`:`Branch`,disabled:submitting.value,"hide-details":``},null,8,[`modelValue`,`items`,`loading`,`label`,`disabled`]),selectedBranch.value?(openBlock(),createElementBlock(`p`,_hoisted_7,toDisplayString(createBranch.value?`Creates the branch and opens a new session.`:`Opens a new session on this branch.`)+` Your changes will be saved to `+toDisplayString(branchRepository.value)+`:`+toDisplayString(createBranch.value?newBranchName.value.trim()||`your new branch`:branchName.value)+`. `,1)):createCommentVNode(``,true),_cache[16]||(_cache[16]=createBaseVNode(`p`,{class:`text-body-small`},`Publishing the app still uses the project branch.`,-1))],64))])):createCommentVNode(``,true)],64)):createCommentVNode(``,true)]),_:1}),submitting.value?(openBlock(),createElementBlock(`div`,_hoisted_8,[createVNode(VProgressLinear,{indeterminate:``,color:`primary`,rounded:``}),_cache[17]||(_cache[17]=createBaseVNode(`p`,{class:`text-body-small mb-0`},` Copying the project source for the new session. This can take a little while for a large project. Any connected repositories and workspace setup then continue in the session, which shows their progress. `,-1))])):createCommentVNode(``,true),createVNode(VCardActions,{class:`vibe64-assistant-dialog__actions`},{default:withCtx(()=>[createVNode(VBtn,{disabled:submitting.value,variant:`text`,onClick:close},{default:withCtx(()=>[..._cache[18]||(_cache[18]=[createTextVNode(`Cancel`,-1)])]),_:1},8,[`disabled`]),createVNode(VBtn,{ref_key:`submitButton`,ref:submitButton,"aria-busy":submitting.value?`true`:void 0,color:`primary`,disabled:!unref(mainSelection)||submitting.value||!branchSelectionReady.value,variant:`flat`,onClick:submit},{default:withCtx(()=>[createTextVNode(toDisplayString(submitting.value?`Creating session…`:chooseBranch.value&&createBranch.value?`Create branch & session`:`Create session`),1)]),_:1},8,[`aria-busy`,`disabled`])]),_:1}),createVNode(Vibe64SessionAssistantMenu_default,{modelValue:customOpen.value,"onUpdate:modelValue":_cache[5]||(_cache[5]=$event=>customOpen.value=$event),target:changeButton.value?.$el||null,selection:sessionAi.value||unref(mainSelection),"can-configure":canChooseSessionAi.value,"changes-disabled":submitting.value,"save-selection":chooseSessionAi},null,8,[`modelValue`,`target`,`selection`,`can-configure`,`changes-disabled`])]),_:1})]),_:1},8,[`model-value`,`persistent`])}}};var Vibe64AssistantSessionDialog_default=_plugin_vue_export_helper_default(_sfc_main,[[`__scopeId`,`data-v-2024d654`]]);var CREATED_SESSION_FOCUS_TIMEOUT_MS=2e3;async function focusCreatedVibe64SessionTab(sessionId=``){const normalizedSessionId=String(sessionId||``).trim();if(!normalizedSessionId||typeof document===`undefined`)return false;const deadline=Date.now()+CREATED_SESSION_FOCUS_TIMEOUT_MS;while(Date.now()<deadline){const dialogVisible=[...document.querySelectorAll(`.vibe64-assistant-dialog`)].some(element=>element.getClientRects().length>0);const target=[...document.querySelectorAll(`[data-vibe64-session-id]`)].find(element=>element.getAttribute(`data-vibe64-session-id`)===normalizedSessionId&&element.getClientRects().length>0);if(!dialogVisible&&target){target.focus({preventScroll:true});return document.activeElement===target}await new Promise(resolve=>{(globalThis.requestAnimationFrame||(callback=>setTimeout(callback,16)))(resolve)})}return false}export{Vibe64AssistantSessionDialog_default as n,Vibe64CreatePullRequestDialog_default as r,focusCreatedVibe64SessionTab as t};
package/dist/index.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <style>@layer vuetify-core.reset, vuetify-core.base, vuetify-components, vuetify-overrides, vuetify-utilities.theme-base, vuetify-utilities.typography, vuetify-utilities.helpers, vuetify-utilities.theme-background, vuetify-utilities.theme-foreground, vuetify-final.transitions, vuetify-final.trumps;</style>
5
- <meta name="jskit-client-build" content="5dc9ef36dfd4d4e5">
5
+ <meta name="jskit-client-build" content="4a86a91a544cf6d0">
6
6
 
7
7
  <meta charset="UTF-8" />
8
8
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
@@ -24,7 +24,7 @@
24
24
  }, true);
25
25
  </script>
26
26
  <style>#startup-shell{color:#25232a;background:#faf9fc;grid-template-rows:56px 1fr;font:15px system-ui,sans-serif;display:grid;position:fixed;inset:0}#startup-shell header{border-bottom:1px solid #dedce3;align-items:center;padding:0 24px;font-weight:600;display:flex}#startup-shell main{grid-template-columns:240px 1fr;min-height:0;display:grid}#startup-shell aside{border-right:1px solid #dedce3;padding:24px}#startup-shell .startup-placeholder{background:#e5e2eb;border-radius:4px;height:16px;margin-bottom:20px}#startup-shell section{padding:32px}#startup-shell a{min-height:48px;color:inherit;align-items:center;display:inline-flex}@media (width<=600px){#startup-shell main{grid-template-columns:1fr}#startup-shell aside{display:none}}@media (prefers-color-scheme:dark){#startup-shell{color:#eeeaf3;background:#19181d}#startup-shell header,#startup-shell aside{border-color:#3c3942}#startup-shell .startup-placeholder{background:#35323d}}</style>
27
- <script type="module" crossorigin src="/assets/index-DcKFCaBZ.js"></script>
27
+ <script type="module" crossorigin src="/assets/index-FVeEbKiO.js"></script>
28
28
  <link rel="modulepreload" crossorigin href="/assets/runtime-core.esm-bundler-Bi1P1jMa.js">
29
29
  <link rel="modulepreload" crossorigin href="/assets/normalize-BD25VwNK.js">
30
30
  <link rel="modulepreload" crossorigin href="/assets/returnToPath-CILshEkc.js">
@@ -39,8 +39,8 @@
39
39
  <link rel="modulepreload" crossorigin href="/assets/VChip-tORFnf7z.js">
40
40
  <link rel="modulepreload" crossorigin href="/assets/i18n-DpzQwXg6.js">
41
41
  <link rel="modulepreload" crossorigin href="/assets/i18n-5EHeMSvt.js">
42
- <link rel="modulepreload" crossorigin href="/assets/i18n-DcNQE3tT.js">
43
- <link rel="modulepreload" crossorigin href="/assets/error-CtOws2EC.js">
42
+ <link rel="modulepreload" crossorigin href="/assets/i18n-Dq-ep9n7.js">
43
+ <link rel="modulepreload" crossorigin href="/assets/error-DPDAz9Td.js">
44
44
  <link rel="modulepreload" crossorigin href="/assets/queryPath-yKLyWw8V.js">
45
45
  <link rel="modulepreload" crossorigin href="/assets/validators-HqYRjxEO.js">
46
46
  <link rel="modulepreload" crossorigin href="/assets/httpClient-C71X5grL.js">
@@ -69,7 +69,7 @@
69
69
  <link rel="modulepreload" crossorigin href="/assets/StudioErrorNotice-vDR4qneB.js">
70
70
  <link rel="modulepreload" crossorigin href="/assets/browserLocalStorage-B4C7rHrs.js">
71
71
  <link rel="modulepreload" crossorigin href="/assets/clipboard-CZs9aH3L.js">
72
- <link rel="modulepreload" crossorigin href="/assets/useVibe64Learning-iAAH83uG.js">
72
+ <link rel="modulepreload" crossorigin href="/assets/useVibe64Learning-DkneotqS.js">
73
73
  <link rel="modulepreload" crossorigin href="/assets/layout-DMZV-nbg.js">
74
74
  <link rel="modulepreload" crossorigin href="/assets/errors-D17nJYne.js">
75
75
  <link rel="modulepreload" crossorigin href="/assets/studioUrls-BR4ZL-TN.js">
@@ -83,14 +83,14 @@
83
83
  <link rel="modulepreload" crossorigin href="/assets/VSwitch-ffi-Y2TU.js">
84
84
  <link rel="modulepreload" crossorigin href="/assets/pathname-JHQIKk21.js">
85
85
  <link rel="modulepreload" crossorigin href="/assets/usePaths-CvUbx5-V.js">
86
- <link rel="modulepreload" crossorigin href="/assets/useUiFeedback--0dLsslR.js">
87
- <link rel="modulepreload" crossorigin href="/assets/useCommand-yOr3U8KF.js">
86
+ <link rel="modulepreload" crossorigin href="/assets/useUiFeedback-8Wvg7A_S.js">
87
+ <link rel="modulepreload" crossorigin href="/assets/useCommand-CfqxMb4C.js">
88
88
  <link rel="modulepreload" crossorigin href="/assets/shared-B6plZPQ_.js">
89
- <link rel="modulepreload" crossorigin href="/assets/assistantRouting-CqIiQy21.js">
89
+ <link rel="modulepreload" crossorigin href="/assets/assistantRouting-Bbxguvre.js">
90
90
  <link rel="modulepreload" crossorigin href="/assets/shared-DjZEYqzW.js">
91
91
  <link rel="modulepreload" crossorigin href="/assets/vibe64ApiResponses-DuJ9mfus.js">
92
92
  <link rel="modulepreload" crossorigin href="/assets/studioGateApi-B9EUTtMx.js">
93
- <link rel="modulepreload" crossorigin href="/assets/client-Dv4scw6i.js">
93
+ <link rel="modulepreload" crossorigin href="/assets/client-CQ49uWhR.js">
94
94
  <link rel="modulepreload" crossorigin href="/assets/client-BJBzomgt.js">
95
95
  <link rel="modulepreload" crossorigin href="/assets/VTextarea-7mdIF4I0.js">
96
96
  <link rel="modulepreload" crossorigin href="/assets/useAssistantAttachments-C9kAnWqw.js">
@@ -125,7 +125,7 @@
125
125
  <link rel="stylesheet" crossorigin href="/assets/client-CM6TGZc9.css">
126
126
  <link rel="stylesheet" crossorigin href="/assets/VTextarea--uW4w6nq.css">
127
127
  <link rel="stylesheet" crossorigin href="/assets/conversation-COcuIkcD.css">
128
- <link rel="stylesheet" crossorigin href="/assets/index-C-6c5Af1.css">
128
+ <link rel="stylesheet" crossorigin href="/assets/index-BJWiPV6i.css">
129
129
  </head>
130
130
  <body>
131
131
  <div id="app">
@@ -7,20 +7,20 @@ agent should say **Ready to try—give it a spin. Verification is still running.
7
7
  You can use Preview immediately; this message is provisional, not proof that all
8
8
  checks passed. You do not have to test it before the agent continues.
9
9
 
10
- For an implementation in **Auto**, the implementer runs focused code checks and
10
+ When Junior implements a plan in **Auto**, it runs focused code checks and
11
11
  basic smoke checks of startup, routes and API responses. It may briefly check
12
12
  that the changed page renders and its main control is present. Full browser
13
13
  end-to-end tests, multi-step user journeys and visual inspection belong to
14
- **Senior**. Senior exercises the
15
- requested user flow and reports results or remaining gaps. In **Custom** or a
16
- direct role without an automatic review, the same agent remains responsible for
14
+ **Senior**, which checks the plan next. Senior exercises the
15
+ requested user flow and reports results or remaining gaps. For work without a plan, in **Custom** or a
16
+ direct role, the same agent remains responsible for
17
17
  browser verification. A stopped or unavailable check must be reported as
18
18
  unverified; an invitation to try the app does not replace verification.
19
19
 
20
20
  Auto shows Working, Waiting or Complete with a separate Planning, Implementation
21
- or Review stage. Senior continues unfinished review or saves necessary in-scope
22
- rework for Junior, then reviews again. The [Chat settings](chat-settings.md)
23
- switches choose whether review, Deslop and the [UI pass](ui-pass.md) run and
21
+ or Review stage. Senior continues an unfinished check of the plan or saves necessary in-scope
22
+ rework for Junior, then checks the plan again. The **After a plan** ticks in
23
+ [Passes](passes.md) choose the passes, such as the [UI pass](ui-pass.md), that run once a plan is completed, and [Chat settings](chat-settings.md) chooses
24
24
  whether finished work is saved, in every chat mode. Waiting retains the stage: use its stage-specific **Continue** action when the blocker is
25
25
  resolved, or **Retry** for an uncertain message. Stop remains respected.
26
26
  See [plans and workflow recovery](plans.md) for the full steps.
@@ -16,7 +16,7 @@ models read-only.
16
16
 
17
17
  **Main chat**
18
18
 
19
- - **Senior**: Plans, reviews, Deslop and UI passes in main chat. Your most capable model.
19
+ - **Senior**: Plans, reviews and passes in main chat. Your most capable model.
20
20
  - **Junior**: Everyday changes in main chat.
21
21
  - **Router**: Chooses Senior or Junior when main chat is on Auto.
22
22
 
@@ -20,20 +20,38 @@ Auto uses three workflow states: **Working**, **Waiting** and **Complete**.
20
20
  The current stage is separate: **Planning**, **Implementation** or **Review**.
21
21
  Router chooses a role and one of conversation, planning, implementation or review
22
22
  only for a new Auto request. It does not decide what happens after each turn.
23
+ A conversation request only gets an answer: its agent reports no outcome, Vibe64
24
+ records the reply as finished when the turn ends, and no Status message appears.
23
25
 
24
- The working agent reports one of four outcomes:
26
+ At planning, implementation and review, the working agent reports one of four
27
+ outcomes:
25
28
 
26
29
  - **Continue** keeps its stage and role while authorised work or checks remain.
27
- - **Handoff** moves finished implementation to Senior's finishing turn: review and
28
- the other steps its [Chat settings](chat-settings.md) turn on. If Senior discovers
29
- substantial necessary rework, Senior updates the technical plan and Progress
30
- within the agreed outcome and hands that work back to Junior. Junior finishes
31
- it, then Senior reviews again and performs any enabled Deslop and UI pass.
30
+ - **Handoff** reports finished implementation. When Junior implemented the
31
+ current plan, Senior then checks the plan in a turn of its own: it reads every
32
+ page of Plan and Progress, verifies each requirement, fixes in-scope gaps and
33
+ completes the plan, or leaves it active with the gaps recorded in Progress. If
34
+ Senior discovers substantial necessary rework, Senior updates the technical
35
+ plan and Progress within the agreed outcome and hands that work back to Junior.
36
+ Junior finishes it, then Senior checks the plan again. Without a plan, or when
37
+ Senior implemented it, the work ends with that turn: no review, Deslop or UI
38
+ pass runs, and [Automatically save changes](chat-settings.md) saves it.
32
39
  - **Wait** retains the stage for a real blocker, your required decision or an
33
40
  explicit pause. A status question or clarification is incorporated into the
34
41
  ongoing work; it does not abandon review.
35
- - **Complete** is available only to Senior after verified review. Senior explicitly
36
- completes an involved plan before Auto archives it after the final explanation.
42
+ - **Complete** is available only to Senior. Senior explicitly completes an
43
+ involved plan after verifying it; once its final explanation is delivered, the
44
+ passes ticked under **After a plan** in
45
+ [Passes](passes.md#choose-the-passes-that-run-after-a-plan) run, each in its
46
+ own turn, then Auto archives the plan and saves the work.
47
+
48
+ After implementation, Auto adds one turn only in one case: Junior implemented
49
+ an involved plan and that plan is still active, so Senior checks and completes
50
+ it. That check is not a pass, has no setting and runs no pass. Work done without
51
+ a plan is no longer reviewed, deslopped or UI-passed automatically: it ends with
52
+ its implementation, saved when Automatically save changes is on. Ask for those checks when you want
53
+ them, from [Passes](passes.md), through the Master pass, or by typing the
54
+ request in chat, such as **Deslop**, **UI pass** or "Review my changes".
37
55
 
38
56
  A turn that asks you a question (numbered questions or **Possible answers**
39
57
  choices, the replies for which the composer shows answer controls) always waits
@@ -41,11 +59,11 @@ for your answer, whatever outcome the agent reported, including when the agent
41
59
  adds a short message after the questions, such as "I'll continue once you've
42
60
  answered." The composer and this wait read the same questions: the newest among
43
61
  the agent's last ten messages since your latest message. Auto never
44
- moves to Senior review, continues or completes past an open question. The notice
62
+ moves to Senior's check of the plan, continues or completes past an open question. The notice
45
63
  says **Waiting for your answer. Reply in chat to continue.** and offers no stage
46
64
  **Continue** action; reopening the session or recovery after a restart sends
47
65
  nothing. Your reply is a new request that Router routes as usual, so answering
48
- "Yes, fix them" starts implementation followed by the normal Senior review. At
66
+ "Yes, fix them" starts implementation, which, for a plan, Senior then checks. At
49
67
  Planning with an active saved plan, **Implement plan** remains available.
50
68
 
51
69
  The agent's concrete explanation appears as an ordinary **Status** message in
@@ -64,14 +82,14 @@ Progress but cannot remove agreed requirements.
64
82
  Senior records the deferred requirement and its agreed timing under **Deferred
65
83
  work** in Progress before removing it from the current acceptance scope, keeping
66
84
  the completed implementation evidence. When every remaining item is checked and
67
- supported by evidence, Senior hands the revised implementation to separate Senior review
68
- and any enabled **Deslop** and **UI pass**. Missing resources for the explicitly deferred work
69
- do not block that review. Remaining implementation continues; a pause or missing
70
- evidence can still stop the handoff. Ordinary draft-plan edits do not trigger
71
- review just because all their items are checked.
85
+ supported by evidence, Senior completes the revised plan, which starts the
86
+ passes ticked under **After a plan**. Missing resources for the explicitly
87
+ deferred work do not block that completion. Remaining implementation continues;
88
+ a pause or missing evidence can still stop it. Ordinary draft-plan edits do not
89
+ complete a plan just because all their items are checked.
72
90
 
73
91
  Deferral does not complete the excluded work or schedule it automatically. Its
74
- record stays with Progress, including after the reviewed plan moves to History.
92
+ record stays with Progress, including after the completed plan moves to History.
75
93
  Use the document icon beside the usage percentage to open **Progress** in
76
94
  Current plan or History. Explicitly request the deferred work when ready. The same conversational steps apply on desktop and mobile. Colleague can
77
95
  explain this process and offer to send your explicit scope-change request through
@@ -97,27 +115,27 @@ explain the retained stage and blocker and offer to stop work or send your reque
97
115
  continuation through its existing actions. An explanation or offer alone does not
98
116
  authorise another turn. Colleague's watches treat Waiting as needing attention.
99
117
 
100
- In Auto, Senior always does the finishing steps after implementation, even when
101
- Senior implemented it or both roles use the same model: the review, Deslop and
102
- [UI pass](ui-pass.md) the chat's **Chat settings** switches turn on, in one
103
- Senior turn, then **Save**. The implementation turns before it end by saying
104
- what changed and what was checked, without asking you to try or publish the
105
- work, and only that last turn ends normally; see [How each turn
106
- ends](chat-settings.md#how-each-turn-ends). **Automatically review changes**,
107
- **Automatically deslop changes**, **Automatically UI pass changes** and
108
- **Automatically save changes** are all on for new chats. Each step a switch starts adds a notice
109
- such as **Review started automatically (Chat settings: Automatically review
110
- changes)**. Turning a switch off asks first and says what is lost; **Cancel**
111
- keeps it on. When review, Deslop and the UI pass are all off, a handoff after
112
- implementation finishes the work without a Senior turn and goes straight to
113
- **Save**. These switches work the same way in Senior, Junior and Custom, where
114
- the chat's own agent does them; see [Choose what runs after each piece of
115
- work](chat-settings.md) for the switches, their confirmations and Save's notes.
116
- Colleague can explain all four switches and, for the owner, change any of them
118
+ In Auto, only Senior completes a plan, even when both roles use the same model.
119
+ When Junior implemented it, Senior checks it in a turn of its own, which runs no
120
+ pass. Junior's implementation turns before it end by saying what changed and
121
+ what was checked, without asking you to try or publish the work; see [How each
122
+ turn ends](chat-settings.md#how-each-turn-ends). Once the plan is completed, the
123
+ passes ticked under **After a plan** in
124
+ [Passes](passes.md#choose-the-passes-that-run-after-a-plan) run, each in its
125
+ own Senior turn over the plan's changes, with a notice such as **Security pass
126
+ started automatically after the plan (Passes: After a plan)**; then the plan is
127
+ archived and **Automatically save changes** runs **Save**. **Review** and
128
+ **Security pass** always run; **Data pass**, **Quality pass**, [UI
129
+ pass](ui-pass.md) and **Deslop** are ticked for new chats. Work without a plan
130
+ ends after its implementation, with no Senior turn, and goes straight to
131
+ **Save**. Nothing runs when a turn ends. Senior, Junior and Custom work the
132
+ same way, except that only a Senior chat completes a plan; see [Choose what
133
+ happens once work is finished](chat-settings.md). Colleague can explain
134
+ automatic save and the passes after a plan and, for the owner, change them
117
135
  through the chat mode action.
118
136
 
119
- Unfinished checks continue in Senior review; substantial necessary rework
120
- returns to Junior and comes back for another review. A changed product requirement
137
+ Unfinished checks continue in Senior's check of the plan; substantial necessary
138
+ rework returns to Junior and comes back to Senior. A changed product requirement
121
139
  needs your decision. Planning-only work waits for your request to implement it.
122
140
 
123
141
  Waiting workflow controls show only the available actions above the composer.
@@ -140,7 +158,7 @@ specific alternatives, not a generic “resume” command. **View plan** opens t
140
158
  existing Current plan dialog without sending anything. To revise the saved plan,
141
159
  send the requested changes through the composer. **Implement plan** sends
142
160
  a new human request authorizing implementation within the saved plan's scope;
143
- it starts Junior implementation, followed by the normal Senior review. Your
161
+ it starts Junior implementation, followed by Senior's check of the plan. Your
144
162
  composer draft and attachments remain untouched. The button cannot reinterpret
145
163
  the original planning request or become another automatic planning continuation.
146
164
 
@@ -157,9 +175,11 @@ open **View plan**, inspect the current document, and send your intended request
157
175
  in chat. No plan is silently reopened. These controls behave the same on desktop
158
176
  and mobile. Colleague can explain them or offer to send your explicit request
159
177
  through its existing chat action; an explanation alone starts no work.
160
- Senior, Junior and Custom report the same outcomes; their own agent does the
161
- finishing steps once the work is finished, with no Router. Junior cannot mark a
162
- plan completed.
178
+ Senior, Junior and Custom report the same outcomes, except that a message their
179
+ agent only answers, changing nothing, reports none (see [Choose what happens
180
+ once work is finished](chat-settings.md#when-work-is-finished)); their work ends
181
+ with their own agent's last turn, with no Router. Junior and Custom cannot mark
182
+ a plan completed.
163
183
 
164
184
  Executing the current plan requires it to be Active. A missing or Completed plan
165
185
  is explained without reviving an old task. Independent work does not need a plan.
@@ -168,7 +188,7 @@ explicitly mark it Completed after verifying the evidence.
168
188
 
169
189
  If an automatic handoff failed before its message was sent, you can type a new
170
190
  request and use the ordinary **Send** button (or speak a new request). Sending
171
- replaces that failed, unsent handoff; it does not mark its review completed.
191
+ replaces that failed, unsent handoff; it does not complete that work.
172
192
  The previous coding history, plan and file changes remain. The stage-specific **Continue** action still
173
193
  continues the retained stage, and **Stop** cancels it without sending new work.
174
194
  A handoff with unconfirmed delivery still requires **Retry** first.