vibe64 0.1.40 → 0.1.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/run.js +1841 -1837
- package/bin/upgrade-state.js +2693 -2685
- package/dist/assets/{GithubBrowserTabs-BoDkGFtY.js → GithubBrowserTabs-YvIe2BdE.js} +1 -1
- package/dist/assets/{Vibe64AuthSettingsButton-CmiidAs5.js → Vibe64AuthSettingsButton-DLdfT68V.js} +1 -1
- package/dist/assets/{Vibe64DashboardShell-MCzEQCWu.js → Vibe64DashboardShell-DMPz6fIx.js} +1 -1
- package/dist/assets/{Vibe64DatabaseWorkspace-DM9V017v.js → Vibe64DatabaseWorkspace-BCEIOlSg.js} +1 -1
- package/dist/assets/{Vibe64OutputControls-CU9H0Dur.js → Vibe64OutputControls-DMoqL0VD.js} +1 -1
- package/dist/assets/{Vibe64RepositoryWorkspace-DaAChLA8.js → Vibe64RepositoryWorkspace-BdwRwbxp.js} +1 -1
- package/dist/assets/{Vibe64SessionFiles-CM2EzXBf.js → Vibe64SessionFiles-ChJWUOqm.js} +1 -1
- package/dist/assets/{_sessionId_-DVHd6D5V.js → _sessionId_-Bw0KfJeR.js} +1 -1
- package/dist/assets/_slug_-CAmuBm-M.css +1 -0
- package/dist/assets/_slug_-q9prK_gX.js +25 -0
- package/dist/assets/{access-BbzSuMt5.js → access-C05Nkq6r.js} +1 -1
- package/dist/assets/{app-BNh2oZg-.js → app-D1CGY9Xm.js} +1 -1
- package/dist/assets/{changes-D8Koqrqg.js → changes-D17XpgGz.js} +1 -1
- package/dist/assets/{client-CybfBKCn.js → client-BxGiylrJ.js} +1 -1
- package/dist/assets/{client-D6UGamrv.css → client-C8jwAMY9.css} +1 -1
- package/dist/assets/{dashboard-DLrmf5ed.js → dashboard-BXXgeQ0Q.js} +1 -1
- package/dist/assets/{definitions-DgyQJgn-.js → definitions-SNvFDEFS.js} +1 -1
- package/dist/assets/{env-rVQwLtYr.js → env-sXAQqKWk.js} +1 -1
- package/dist/assets/{health-B6r9LLrd.js → health-Cr34pf2p.js} +1 -1
- package/dist/assets/{history-C6xLWUxL.js → history-N1iRZaab.js} +1 -1
- package/dist/assets/{index-BC29JK2e.css → index-B17d4wpZ.css} +1 -1
- package/dist/assets/index-Mxalhei8.js +138 -0
- package/dist/assets/{integrations-CcrqPXxj.js → integrations-BmwFvHgZ.js} +1 -1
- package/dist/assets/{issues-DEjIlMdl.js → issues-BbiG7dCV.js} +1 -1
- package/dist/assets/{learning-BP1xvd8w.js → learning-CUCuuoHM.js} +1 -1
- package/dist/assets/{publish-CVXolnAG.js → publish-4r_4K5IY.js} +1 -1
- package/dist/assets/{publish-CPWnztCc.css → publish-BFTsAMCF.css} +1 -1
- package/dist/assets/{pull-requests-DdgzLzY_.js → pull-requests-DY9jg3cE.js} +1 -1
- package/dist/assets/{repository-5S0LzRq3.js → repository-DhXdoMP6.js} +1 -1
- package/dist/assets/{settings-BKP_eQ3F.js → settings-Cj4u-76p.js} +1 -1
- package/dist/assets/{useArchivedVibe64Sessions-D8DWpcSy.js → useArchivedVibe64Sessions-BXNg8oES.js} +1 -1
- package/dist/assets/{useVibe64ConversationLog-D-Vkq0sK.js → useVibe64ConversationLog-C1xjhFtS.js} +1 -1
- package/dist/assets/{useVibe64DatabaseTools-Dpm53ruL.js → useVibe64DatabaseTools-H6H-YJQX.js} +1 -1
- package/dist/assets/{useVibe64SessionData-CGJXj3r7.js → useVibe64SessionData-CnDOFFHb.js} +1 -1
- package/dist/assets/{useVibe64SessionSelection-BEqKR412.js → useVibe64SessionSelection-J87nJ9p5.js} +1 -1
- package/dist/assets/{vibe64SessionFocus-tv2wz7_H.js → vibe64SessionFocus-DlN8NwcE.js} +1 -1
- package/dist/index.html +5 -5
- package/docs/colleague-usage/ai-onboarding.md +3 -1
- package/docs/colleague-usage/learning-environment.md +39 -25
- package/docs/colleague-usage/learning-mode-ui.md +18 -9
- package/docs/colleague-usage/learning-practice-projects.md +2 -2
- package/docs/colleague-usage/learning-teacher-guide.md +2 -1
- package/docs/colleague-usage/learning-with-colleague.md +3 -3
- package/docs/colleague-usage/lesson-authoring.md +1 -1
- package/docs/colleague-usage/lesson-step-bar.md +38 -24
- package/docs/colleague-usage/preview-starting-application.md +10 -1
- package/docs/colleague-usage/project-setup.md +2 -2
- package/docs/colleague-usage/publishing.md +3 -1
- package/docs/colleague-usage/starter-apps.md +2 -2
- package/docs/training-content.md +2 -2
- package/node_modules/@jskit-ai/assistant-core/package.json +1 -1
- package/node_modules/@jskit-ai/assistant-runtime/package.json +1 -1
- package/node_modules/@jskit-ai/assistant-voice/package.json +1 -1
- package/node_modules/@jskit-ai/connectors-catalog/package.json +1 -1
- package/node_modules/@jskit-ai/realtime/package.json +1 -1
- package/node_modules/@local/vibe64-genesis/bin/vibe64-genesis-host-context +77 -80
- package/node_modules/@local/vibe64-genesis/src/server/agentSpecs.js +6 -6
- package/node_modules/@local/vibe64-genesis/src/server/index.js +195 -194
- package/node_modules/@local/vibe64-genesis/src/server/promptContext.js +144 -149
- package/node_modules/@local/vibe64-terminals/src/server/sessionWorkOperationCommand.js +8 -7
- package/package.json +8 -8
- package/server.bundle.mjs +14269 -14252
- package/dist/assets/_slug_-DsfaE8Vh.js +0 -25
- package/dist/assets/_slug_-_qfQqdHb.css +0 -1
- package/dist/assets/index-B9P6KjvH.js +0 -138
package/dist/assets/{useVibe64ConversationLog-D-Vkq0sK.js → useVibe64ConversationLog-C1xjhFtS.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Ht as watch,g as computed,pn as onScopeDispose,vn as ref,xn as shallowRef}from"./runtime-core.esm-bundler-DGXg_mpN.js";import{J as useQueryClient,T as ROUTE_VISIBILITY_PUBLIC,t as useEndpointResource}from"./useEndpointResource-Ds8EDBZ2.js";import{u as getHttpWebClient}from"./vibe64ProjectScope.local-B06ABkhI.js";import{n as useRealtimeEvent,r as useRealtimeSocket}from"./useRealtimeEvent-DrOiU8lJ.js";import{t as usePaths}from"./usePaths-Db88-HOm.js";import{o as normalizeVibe64ConversationAttachments}from"./shared-DZETtWRH.js";import{t as useVibe64ProjectSlug}from"./useVibe64ProjectScope-B5ogg6jd.js";import{$ as vibe64SessionEventMatchesScope,At as normalizeConversationLogPage,D as VIBE64_SESSIONS_API_SUFFIX,Dt as normalizeConversationTurn$1,Et as normalizeConversationMessage$1,Nt as mergeConversationStream,O as VIBE64_SESSION_CHANGED_EVENT,Ot as conversationLogReadQuery,R as vibe64ConversationLogPath,Tt as applyConversationLogPatch$1,b as readRefOrGetterValue,et as vibe64SessionPath,jt as normalizeConversationLogPagination,kt as mergeConversationLogPages,z as vibe64ConversationLogQueryKey}from"./index-B9P6KjvH.js";import{a as vibe64SessionDebugError,o as vibe64SessionDebugLog}from"./vibe64SessionPanelModel-DDorOuiL.js";import{t as connectorDefinitions}from"./definitions-DgyQJgn-.js";var CONVERSATION_LOG_REALTIME_REASONS=new Set([`project-message-changed`,`conversation-rewound`,`session-assistant-selection-updated`,`assistant-stream`,`integration-setup-skipped`,`integration-setup-completed`,`assistant-response-bundle`,`codex-app-server-agent-result`,`codex-app-server-agent-result-invalid`,`codex-app-server-agent-result-missing`,`codex-app-server-agent-result-provider-failed`,`codex-app-server-commentary`,`codex-app-server-final-assistant-message`,`codex-app-server-live-progress`,`codex-app-server-reasoning-summary`,`codex-app-server-terminal-assistant-message`,`codex-app-server-terminal-thinking-message`,`codex-app-server-terminal-user-message`,`codex-turn-outcome`,`codex-app-server-message-delivered`,`opencode-credential-failure`,`opencode-provider-failure`,`opencode-server-assistant-message`,`opencode-server-message-delivered`,`opencode-server-reasoning`,`opencode-server-tool`,`opencode-server-turn-idle`,`claude-stream-turn-idle`,`claude-stream-message`,`claude-stream-message-delivered`,`session-agent-message-cancelled`,`session-agent-message-accepted`,`session-agent-message-delivered`,`session-agent-message-failed`]);function normalizeConversationMessage(message={}){return normalizeConversationMessage$1(message,{normalizeAttachments:normalizeVibe64ConversationAttachments})}function normalizeConversationTurn(turn={},index=0){const normalized=normalizeConversationTurn$1(turn,index,{normalizeAttachments:normalizeVibe64ConversationAttachments});return normalized&&{...normalized,...isRecord(turn.integrationSetup)?{integrationSetup:turn.integrationSetup}:{}}}function isRecord(value){return Boolean(value&&typeof value===`object`&&!Array.isArray(value))}function normalizeConversationLog(payload={},options={}){return conversationTurnsWithPending((Array.isArray(payload?.conversationLog)?payload.conversationLog:[]).map((turn,index)=>normalizeConversationTurn(turn,index)).filter(Boolean),options.pending)}function conversationTurnsWithPending(turns,pending){const pendingTurnIndex=pending===true?turns.length-1:-1;return turns.map((turn,index)=>{if(index===pendingTurnIndex&&turn.user&&!turn.assistant)return{...turn,pending:true};return turn})}function conversationLogRealtimePatch(payload={}){const reason=String(payload?.reason||``).trim();const patch=isRecord(payload?.conversationLogPatch)?payload.conversationLogPatch:null;if(![`assistant-response-bundle`,`codex-app-server-commentary`,`codex-app-server-final-assistant-message`,`codex-app-server-reasoning-summary`,`codex-app-server-live-progress`,`codex-app-server-terminal-assistant-message`,`codex-app-server-terminal-thinking-message`,`codex-app-server-terminal-user-message`,`codex-app-server-message-delivered`,`opencode-credential-failure`,`opencode-provider-failure`,`opencode-server-assistant-message`,`opencode-server-message-delivered`,`opencode-server-reasoning`,`opencode-server-tool`].includes(reason)||patch?.type!==`upsert-turn`||!isRecord(patch.turn))return null;const assistant=normalizeConversationMessage(patch.turn.assistant);const commentary=Array.isArray(patch.turn.commentary)?patch.turn.commentary.map(normalizeConversationMessage).filter(Boolean):[];const thinking=Array.isArray(patch.turn.thinking)?patch.turn.thinking.map(normalizeConversationMessage).filter(Boolean):[];if([`codex-app-server-reasoning-summary`,`codex-app-server-live-progress`].includes(reason)&&(!thinking.length||assistant))return null;if(reason===`codex-app-server-commentary`&&(!commentary.length||assistant))return null;if([`assistant-response-bundle`,`codex-app-server-final-assistant-message`].includes(reason)&&!assistant)return null;return{turn:patch.turn,type:`upsert-turn`}}function applyConversationLogPatch(payload={},patch=null,options={}){return applyConversationLogPatch$1(payload,patch,{...options,normalizeAttachments:normalizeVibe64ConversationAttachments})}function sessionIsAwaitingCodex(session={}){return(session&&typeof session===`object`&&!Array.isArray(session)?session:{}).agentSession?.turn?.active===true}function conversationLogRealtimeShouldRefresh({payload={}}={},sessionId=``){const normalizedSessionId=String(sessionId||``).trim();const changedSessionId=String(payload.sessionId||payload.entityId||``).trim();if(!normalizedSessionId||changedSessionId!==normalizedSessionId)return false;const reason=String(payload.reason||``).trim();return Boolean(payload.conversationStream)||!reason||CONVERSATION_LOG_REALTIME_REASONS.has(reason)}function conversationLogRecoveryStateKey(session={}){const source=session&&typeof session===`object`&&!Array.isArray(session)?session:{};return[source.sessionId,source.status,source.revision,source.updatedAt,source.agentSession?.turn?.active?`active`:`idle`,source.agentSession?.turn?.id].map(value=>String(value||``).trim()).join(`|`)}function conversationLogCompletedTurnKey(session={}){const source=isRecord(session)?session:{};const turn=isRecord(source.agentSession?.turn)?source.agentSession.turn:{};const sessionId=String(source.sessionId||``).trim();const turnId=String(turn.id||``).trim();const revision=Number(source.revision);if(!sessionId||!turnId||turn.active!==false||!Number.isSafeInteger(revision)||revision<0)return``;return`${sessionId}|${revision}|${turnId}`}function useConversationIntegrationActions({turns,enabled,sessionId,projectSlug,sessionsApiPath,reloadConversationLog,httpClient}){const integrationActionPending=shallowRef(null);const integrationActionError=ref(null);const integrationConnections=shallowRef({});function connectIntegrationRequest(request={}){return runIntegrationRequestAction(request,`connect`)}function checkIntegrationRequest(request={}){return runIntegrationRequestAction(request,`status`)}function cancelIntegrationRequest(request={}){return runIntegrationRequestAction(request,`cancel`)}function skipIntegrationRequest(request={}){return runIntegrationRequestAction(request,`skip`)}function resumeIntegrationRequest(request={}){return runIntegrationRequestAction(request,`resume`)}async function runIntegrationRequestAction(request,action){const turn=turns.value.find(entry=>entry.turnId===request.turnId);if(!enabled.value||request.sessionId!==sessionId.value||integrationActionPending.value||turn?.integrationSetup?.outcome!==(action===`resume`?`completed`:`pending`)||turn.integrationSetup.requestId!==request.requestId)return false;const selection={sessionId:sessionId.value,turnId:request.turnId,requestId:request.requestId};integrationActionPending.value=selection;integrationActionError.value=null;try{if([`connect`,`cancel`,`status`].includes(action)){const path=vibe64SessionPath(sessionsApiPath.value,selection.sessionId,`/integrations`);const config=await httpClient.request(path);if(integrationActionPending.value!==selection||sessionId.value!==selection.sessionId)return false;const integrationId=turn.integrationSetup.integrationId;const integration=config?.configuration?.integrations?.[integrationId];if(!integration)throw new Error(`Choose Configure to set up this integration first.`);if(connectorDefinitions.some(provider=>provider.id===integration.provider&&(provider.configurationOnly||provider.configurationOnlyForSettings?.(integration?.settings||{})))){integrationConnections.value={...integrationConnections.value,[selection.requestId]:{status:`configuration-only`}};return true}if(integration.accountMode===`per-user`)throw new Error(`Each app user connects their account inside the application. Choose Configure for setup instructions.`);const endpoint=`${path}/${encodeURIComponent(integrationId)}/setup`;const previous=integrationConnections.value[selection.requestId];if(action===`cancel`&&!previous?.attemptId)return false;let connection=await httpClient.request(endpoint,{method:`POST`,body:{operation:action,...action===`cancel`?{attemptId:previous.attemptId}:{setupRequest:{turnId:selection.turnId,requestId:selection.requestId,configurationHash:config.baseHash}}}});if(integrationActionPending.value!==selection||sessionId.value!==selection.sessionId)return false;if(action===`cancel`){connection=await httpClient.request(endpoint,{method:`POST`,body:{operation:`status`}});if(integrationActionPending.value!==selection||sessionId.value!==selection.sessionId)return false}integrationConnections.value={...integrationConnections.value,[selection.requestId]:connection};if(connection.integrationSetup?.outcome===`completed`&&connection.integrationSetup.continuation?.status!==`accepted`){const resumed=await httpClient.request(vibe64SessionPath(sessionsApiPath.value,selection.sessionId,`/integration-setup/resume`),{method:`POST`,body:{turnId:selection.turnId,requestId:selection.requestId}});if(resumed?.ok!==true)throw new Error(resumed?.error||`Assistant continuation is not yet confirmed.`)}if(integrationActionPending.value===selection&&sessionId.value===selection.sessionId)await reloadConversationLog();return true}const result=await httpClient.request(vibe64SessionPath(sessionsApiPath.value,selection.sessionId,`/integration-setup/${action}`),{method:`POST`,body:{turnId:selection.turnId,requestId:selection.requestId}});if(result?.ok!==true)throw new Error(result?.error||`Could not update integration setup.`);if(integrationActionPending.value===selection&&sessionId.value===selection.sessionId)await reloadConversationLog();return true}catch(error){if(sessionId.value===selection.sessionId&&integrationActionPending.value===selection){integrationActionError.value={turnId:selection.turnId,message:String(error?.message||`Could not update integration setup.`)};if(action===`resume`||action===`connect`||action===`status`)await reloadConversationLog()}return false}finally{if(sessionId.value===selection.sessionId&&integrationActionPending.value===selection)integrationActionPending.value=null}}onScopeDispose(()=>{integrationActionPending.value=null});watch([sessionId,projectSlug],()=>{integrationActionPending.value=null;integrationActionError.value=null;integrationConnections.value={}});return{integrationConnections,connectIntegrationRequest,checkIntegrationRequest,cancelIntegrationRequest,integrationActionPending,integrationActionError,skipIntegrationRequest,resumeIntegrationRequest}}function useVibe64ConversationLog({active=true,projectSlug:projectSlugInput,sessionsApiPath:sessionsApiPathInput,session,conversation=null}={}){const paths=usePaths();const httpClient=getHttpWebClient();const projectSlug=projectSlugInput===void 0?useVibe64ProjectSlug():computed(()=>readRefOrGetterValue(projectSlugInput));const currentSession=computed(()=>readRefOrGetterValue(session)||null);const sessionId=computed(()=>String(currentSession.value?.sessionId||``).trim());const enabled=computed(()=>Boolean(readRefOrGetterValue(active)!==false&&sessionId.value));const sessionsApiPath=computed(()=>readRefOrGetterValue(sessionsApiPathInput)||paths.api(`/vibe64/sessions`,{surface:`app`}));if(conversation){const turns=computed(()=>conversationTurnsWithPending(conversation.turns.value,sessionIsAwaitingCodex(currentSession.value)));const integrationActions=useConversationIntegrationActions({turns,enabled,sessionId,projectSlug,sessionsApiPath,reloadConversationLog:conversation.reload,httpClient});let realtimeCompletionKey=``;const realtime=useRealtimeEvent({enabled,event:VIBE64_SESSION_CHANGED_EVENT,matches:context=>([`session-assistant-selection-updated`,`integration-setup-skipped`,`integration-setup-completed`].includes(context?.payload?.reason)||conversationLogCompletedTurnKey(context?.payload))&&conversationLogRealtimeShouldRefresh(context,sessionId.value)&&vibe64SessionEventMatchesScope(context?.payload,{projectSlug:projectSlug.value}),onEvent:({payload={}}={})=>{realtimeCompletionKey=conversationLogCompletedTurnKey(payload)||realtimeCompletionKey;return payload.reason===`session-assistant-selection-updated`?conversation.reload({resubscribe:true}):conversation.reload()}});watch(()=>conversationLogCompletedTurnKey(currentSession.value),key=>{if(!enabled.value||!key)return;if(key===realtimeCompletionKey){realtimeCompletionKey=``;return}conversation.reload()?.catch(()=>{})},{flush:`post`});return{...integrationActions,turns,error:conversation.error,errorReloadable:computed(()=>conversation.accessDenied?.value===false),hasMoreBefore:conversation.hasMoreBefore,loadMore:conversation.loadMore,loadMoreError:conversation.loadMoreError,loading:conversation.loading,initializing:computed(()=>!conversation.snapshot.value&&conversation.loading.value),loadingMore:conversation.loadingMore,reload:conversation.reload,realtime,visible:computed(()=>Boolean(conversation.loading.value||conversation.error.value||turns.value.length))}}const queryClient=useQueryClient();const olderPages=ref([]);const loadingMore=ref(false);const loadMoreError=ref(``);const queryKey=computed(()=>[...vibe64ConversationLogQueryKey(`app`,ROUTE_VISIBILITY_PUBLIC,sessionId.value,projectSlug.value)]);const conversationLogPath=computed(()=>sessionId.value?vibe64ConversationLogPath(sessionsApiPath.value,sessionId.value):``);const pendingReads=new Set;const resource=useEndpointResource({enabled,fallbackLoadError:`Conversation history could not be loaded.`,path:conversationLogPath,queryKey,queryOptions:{async queryFn({signal}){const read={sessionId:sessionId.value,projectSlug:projectSlug.value,patches:[]};pendingReads.add(read);try{let payload=await httpClient.request(conversationLogPath.value,{method:`GET`,query:conversationLogReadQuery(),signal});for(const patch of read.patches)payload=applyConversationLogPatch(payload,patch,{limit:10});return payload}finally{pendingReads.delete(read)}},placeholderData:previousData=>previousData,refetchOnMount:false,refetchOnWindowFocus:false},readMethod:`GET`,refreshOnPull:true,requestRecoveryLabel:`Conversation history`,realtime:null});let reloadInFlight=null;let reloadQueued=false;let recoveredErrorKey=``;let realtimeCompletionKey=``;const conversationStream=shallowRef(null);function receiveConversationStream(snapshot){if(snapshot&&(!conversationStream.value||snapshot.revision>=conversationStream.value.revision))conversationStream.value=snapshot}watch(()=>resource.data.value,data=>receiveConversationStream(data?.conversationStream),{immediate:true});async function reloadConversationLog(){if(reloadInFlight){reloadQueued=true;vibe64SessionDebugLog(`client.conversationLog.reload.join`,{sessionId:sessionId.value});return reloadInFlight}olderPages.value=[];loadMoreError.value=``;vibe64SessionDebugLog(`client.conversationLog.reload.start`,{sessionId:sessionId.value});reloadInFlight=resource.reload();try{const result=await reloadInFlight;vibe64SessionDebugLog(`client.conversationLog.reload.done`,{sessionId:sessionId.value});return result}finally{reloadInFlight=null;if(reloadQueued){reloadQueued=false;reloadConversationLog()}}}const realtimeSocket=useRealtimeSocket({required:false});const reconcileConversationAfterRealtimeConnect=()=>{if(enabled.value){conversationStream.value=null;reloadConversationLog().catch(()=>{})}};realtimeSocket.on(`connect`,reconcileConversationAfterRealtimeConnect);onScopeDispose(()=>{realtimeSocket.off(`connect`,reconcileConversationAfterRealtimeConnect)});function applyRealtimeConversationLogPatch(payload={}){const patch=conversationLogRealtimePatch(payload);if(!patch)return false;const key=queryKey.value;const currentPayload=queryClient.getQueryData(key);const nextPayload=applyConversationLogPatch(currentPayload,patch,{limit:10});if(!nextPayload){vibe64SessionDebugLog(`client.conversationLog.patch.miss`,{hasCurrentPayload:Boolean(currentPayload),patchType:String(patch?.type||``),sessionId:sessionId.value});return false}for(const read of pendingReads)if(read.sessionId===sessionId.value&&read.projectSlug===projectSlug.value)read.patches.push(patch);queryClient.setQueryData(key,nextPayload);vibe64SessionDebugLog(`client.conversationLog.patch.done`,{patchType:String(patch.type||``),sessionId:sessionId.value,turnId:String(patch.turn?.turnId||``)});return true}const realtime=useRealtimeEvent({enabled,event:VIBE64_SESSION_CHANGED_EVENT,matches:context=>conversationLogRealtimeShouldRefresh(context,sessionId.value),onEvent:({payload={}}={})=>{receiveConversationStream(payload.conversationStream);realtimeCompletionKey=conversationLogCompletedTurnKey(payload)||realtimeCompletionKey;vibe64SessionDebugLog(`client.conversationLog.realtime`,{hasPatch:Boolean(conversationLogRealtimePatch(payload)),reason:String(payload.reason||``),sessionId:sessionId.value});if(applyRealtimeConversationLogPatch(payload))return null;if(payload.reason===`assistant-stream`)return null;return reloadConversationLog()}});const recoveryStateKey=computed(()=>conversationLogRecoveryStateKey(currentSession.value));const completedTurnKey=computed(()=>conversationLogCompletedTurnKey(currentSession.value));watch(completedTurnKey,key=>{if(!enabled.value||!key)return;if(key===realtimeCompletionKey){realtimeCompletionKey=``;return}vibe64SessionDebugLog(`client.conversationLog.completion.reconcile`,{completedTurnKey:key,sessionId:sessionId.value});reloadConversationLog().catch(()=>{})},{flush:`post`});const recoveryErrorKey=computed(()=>[enabled.value?`enabled`:`disabled`,sessionId.value,recoveryStateKey.value,resource.loadError.value].join(`|`));watch(recoveryErrorKey,()=>{const loadError=String(resource.loadError.value||``).trim();if(!enabled.value||!loadError){recoveredErrorKey=``;return}const key=recoveryErrorKey.value;if(recoveredErrorKey===key)return;recoveredErrorKey=key;vibe64SessionDebugLog(`client.conversationLog.recover.start`,{error:loadError,recoveryStateKey:recoveryStateKey.value,sessionId:sessionId.value});reloadConversationLog().then(()=>{vibe64SessionDebugLog(`client.conversationLog.recover.done`,{recoveryStateKey:recoveryStateKey.value,sessionId:sessionId.value})}).catch(error=>{vibe64SessionDebugLog(`client.conversationLog.recover.error`,{error:vibe64SessionDebugError(error),recoveryStateKey:recoveryStateKey.value,sessionId:sessionId.value})})},{flush:`post`});const latestPage=computed(()=>normalizeConversationLogPage(resource.data.value||{}));const loadedPages=computed(()=>[...olderPages.value,latestPage.value]);const oldestLoadedPage=computed(()=>olderPages.value[0]||latestPage.value);const hasMoreBefore=computed(()=>Boolean(normalizeConversationLogPagination(oldestLoadedPage.value?.pagination).hasMoreBefore));const turns=computed(()=>{const savedTurns=normalizeConversationLog(mergeConversationLogPages(loadedPages.value),{pending:sessionIsAwaitingCodex(currentSession.value)});return mergeConversationStream(savedTurns,conversationStream.value)});const visible=computed(()=>Boolean(resource.isLoading.value||resource.loadError.value||turns.value.length));async function loadMoreConversationLog({complete}={}){const finish=result=>{if(typeof complete===`function`)complete(result)};const pagination=normalizeConversationLogPagination(oldestLoadedPage.value?.pagination);const beforeTurnId=pagination.nextBeforeTurnId||pagination.oldestTurnId||String(turns.value[0]?.turnId||``).trim();if(!enabled.value||!conversationLogPath.value||!hasMoreBefore.value||loadingMore.value||!beforeTurnId){finish({changed:false,loaded:false});return false}loadingMore.value=true;loadMoreError.value=``;vibe64SessionDebugLog(`client.conversationLog.loadMore.start`,{beforeTurnId,sessionId:sessionId.value});try{const page=await httpClient.request(conversationLogPath.value,{method:`GET`,query:conversationLogReadQuery({beforeTurnId,limit:10})});const previousOldestTurnId=String(turns.value[0]?.turnId||``).trim();const previousMessageCount=turns.value.reduce((count,turn)=>count+(turn.messages?.length||0),0);olderPages.value=[normalizeConversationLogPage(page),...olderPages.value];const nextOldestTurnId=String(turns.value[0]?.turnId||``).trim();const nextMessageCount=turns.value.reduce((count,turn)=>count+(turn.messages?.length||0),0);const changed=Boolean(nextOldestTurnId&&(nextOldestTurnId!==previousOldestTurnId||nextMessageCount!==previousMessageCount));vibe64SessionDebugLog(`client.conversationLog.loadMore.done`,{beforeTurnId,sessionId:sessionId.value,turnCount:Array.isArray(page?.conversationLog)?page.conversationLog.length:0});finish({changed,loaded:true});return true}catch(error){loadMoreError.value=String(error?.message||error||`Older conversation history could not be loaded.`);vibe64SessionDebugLog(`client.conversationLog.loadMore.error`,{beforeTurnId,error:vibe64SessionDebugError(error),sessionId:sessionId.value});finish({changed:false,loaded:false});return false}finally{loadingMore.value=false}}const integrationActions=useConversationIntegrationActions({turns,enabled,sessionId,projectSlug,sessionsApiPath,reloadConversationLog,httpClient});watch([sessionId,projectSlug],()=>{conversationStream.value=null;olderPages.value=[];loadMoreError.value=``});return{...integrationActions,error:resource.loadError,hasMoreBefore,loadMore:loadMoreConversationLog,loadMoreError,loading:resource.isLoading,initializing:resource.isInitialLoading,loadingMore,reload:reloadConversationLog,realtime,turns,visible}}export{useVibe64ConversationLog as t};
|
|
1
|
+
import{Ht as watch,g as computed,pn as onScopeDispose,vn as ref,xn as shallowRef}from"./runtime-core.esm-bundler-DGXg_mpN.js";import{J as useQueryClient,T as ROUTE_VISIBILITY_PUBLIC,t as useEndpointResource}from"./useEndpointResource-Ds8EDBZ2.js";import{u as getHttpWebClient}from"./vibe64ProjectScope.local-B06ABkhI.js";import{n as useRealtimeEvent,r as useRealtimeSocket}from"./useRealtimeEvent-DrOiU8lJ.js";import{t as usePaths}from"./usePaths-Db88-HOm.js";import{o as normalizeVibe64ConversationAttachments}from"./shared-DZETtWRH.js";import{t as useVibe64ProjectSlug}from"./useVibe64ProjectScope-B5ogg6jd.js";import{$ as vibe64SessionEventMatchesScope,At as normalizeConversationLogPage,D as VIBE64_SESSIONS_API_SUFFIX,Dt as normalizeConversationTurn$1,Et as normalizeConversationMessage$1,Nt as mergeConversationStream,O as VIBE64_SESSION_CHANGED_EVENT,Ot as conversationLogReadQuery,R as vibe64ConversationLogPath,Tt as applyConversationLogPatch$1,b as readRefOrGetterValue,et as vibe64SessionPath,jt as normalizeConversationLogPagination,kt as mergeConversationLogPages,z as vibe64ConversationLogQueryKey}from"./index-Mxalhei8.js";import{a as vibe64SessionDebugError,o as vibe64SessionDebugLog}from"./vibe64SessionPanelModel-DDorOuiL.js";import{t as connectorDefinitions}from"./definitions-SNvFDEFS.js";var CONVERSATION_LOG_REALTIME_REASONS=new Set([`project-message-changed`,`conversation-rewound`,`session-assistant-selection-updated`,`assistant-stream`,`integration-setup-skipped`,`integration-setup-completed`,`assistant-response-bundle`,`codex-app-server-agent-result`,`codex-app-server-agent-result-invalid`,`codex-app-server-agent-result-missing`,`codex-app-server-agent-result-provider-failed`,`codex-app-server-commentary`,`codex-app-server-final-assistant-message`,`codex-app-server-live-progress`,`codex-app-server-reasoning-summary`,`codex-app-server-terminal-assistant-message`,`codex-app-server-terminal-thinking-message`,`codex-app-server-terminal-user-message`,`codex-turn-outcome`,`codex-app-server-message-delivered`,`opencode-credential-failure`,`opencode-provider-failure`,`opencode-server-assistant-message`,`opencode-server-message-delivered`,`opencode-server-reasoning`,`opencode-server-tool`,`opencode-server-turn-idle`,`claude-stream-turn-idle`,`claude-stream-message`,`claude-stream-message-delivered`,`session-agent-message-cancelled`,`session-agent-message-accepted`,`session-agent-message-delivered`,`session-agent-message-failed`]);function normalizeConversationMessage(message={}){return normalizeConversationMessage$1(message,{normalizeAttachments:normalizeVibe64ConversationAttachments})}function normalizeConversationTurn(turn={},index=0){const normalized=normalizeConversationTurn$1(turn,index,{normalizeAttachments:normalizeVibe64ConversationAttachments});return normalized&&{...normalized,...isRecord(turn.integrationSetup)?{integrationSetup:turn.integrationSetup}:{}}}function isRecord(value){return Boolean(value&&typeof value===`object`&&!Array.isArray(value))}function normalizeConversationLog(payload={},options={}){return conversationTurnsWithPending((Array.isArray(payload?.conversationLog)?payload.conversationLog:[]).map((turn,index)=>normalizeConversationTurn(turn,index)).filter(Boolean),options.pending)}function conversationTurnsWithPending(turns,pending){const pendingTurnIndex=pending===true?turns.length-1:-1;return turns.map((turn,index)=>{if(index===pendingTurnIndex&&turn.user&&!turn.assistant)return{...turn,pending:true};return turn})}function conversationLogRealtimePatch(payload={}){const reason=String(payload?.reason||``).trim();const patch=isRecord(payload?.conversationLogPatch)?payload.conversationLogPatch:null;if(![`assistant-response-bundle`,`codex-app-server-commentary`,`codex-app-server-final-assistant-message`,`codex-app-server-reasoning-summary`,`codex-app-server-live-progress`,`codex-app-server-terminal-assistant-message`,`codex-app-server-terminal-thinking-message`,`codex-app-server-terminal-user-message`,`codex-app-server-message-delivered`,`opencode-credential-failure`,`opencode-provider-failure`,`opencode-server-assistant-message`,`opencode-server-message-delivered`,`opencode-server-reasoning`,`opencode-server-tool`].includes(reason)||patch?.type!==`upsert-turn`||!isRecord(patch.turn))return null;const assistant=normalizeConversationMessage(patch.turn.assistant);const commentary=Array.isArray(patch.turn.commentary)?patch.turn.commentary.map(normalizeConversationMessage).filter(Boolean):[];const thinking=Array.isArray(patch.turn.thinking)?patch.turn.thinking.map(normalizeConversationMessage).filter(Boolean):[];if([`codex-app-server-reasoning-summary`,`codex-app-server-live-progress`].includes(reason)&&(!thinking.length||assistant))return null;if(reason===`codex-app-server-commentary`&&(!commentary.length||assistant))return null;if([`assistant-response-bundle`,`codex-app-server-final-assistant-message`].includes(reason)&&!assistant)return null;return{turn:patch.turn,type:`upsert-turn`}}function applyConversationLogPatch(payload={},patch=null,options={}){return applyConversationLogPatch$1(payload,patch,{...options,normalizeAttachments:normalizeVibe64ConversationAttachments})}function sessionIsAwaitingCodex(session={}){return(session&&typeof session===`object`&&!Array.isArray(session)?session:{}).agentSession?.turn?.active===true}function conversationLogRealtimeShouldRefresh({payload={}}={},sessionId=``){const normalizedSessionId=String(sessionId||``).trim();const changedSessionId=String(payload.sessionId||payload.entityId||``).trim();if(!normalizedSessionId||changedSessionId!==normalizedSessionId)return false;const reason=String(payload.reason||``).trim();return Boolean(payload.conversationStream)||!reason||CONVERSATION_LOG_REALTIME_REASONS.has(reason)}function conversationLogRecoveryStateKey(session={}){const source=session&&typeof session===`object`&&!Array.isArray(session)?session:{};return[source.sessionId,source.status,source.revision,source.updatedAt,source.agentSession?.turn?.active?`active`:`idle`,source.agentSession?.turn?.id].map(value=>String(value||``).trim()).join(`|`)}function conversationLogCompletedTurnKey(session={}){const source=isRecord(session)?session:{};const turn=isRecord(source.agentSession?.turn)?source.agentSession.turn:{};const sessionId=String(source.sessionId||``).trim();const turnId=String(turn.id||``).trim();const revision=Number(source.revision);if(!sessionId||!turnId||turn.active!==false||!Number.isSafeInteger(revision)||revision<0)return``;return`${sessionId}|${revision}|${turnId}`}function useConversationIntegrationActions({turns,enabled,sessionId,projectSlug,sessionsApiPath,reloadConversationLog,httpClient}){const integrationActionPending=shallowRef(null);const integrationActionError=ref(null);const integrationConnections=shallowRef({});function connectIntegrationRequest(request={}){return runIntegrationRequestAction(request,`connect`)}function checkIntegrationRequest(request={}){return runIntegrationRequestAction(request,`status`)}function cancelIntegrationRequest(request={}){return runIntegrationRequestAction(request,`cancel`)}function skipIntegrationRequest(request={}){return runIntegrationRequestAction(request,`skip`)}function resumeIntegrationRequest(request={}){return runIntegrationRequestAction(request,`resume`)}async function runIntegrationRequestAction(request,action){const turn=turns.value.find(entry=>entry.turnId===request.turnId);if(!enabled.value||request.sessionId!==sessionId.value||integrationActionPending.value||turn?.integrationSetup?.outcome!==(action===`resume`?`completed`:`pending`)||turn.integrationSetup.requestId!==request.requestId)return false;const selection={sessionId:sessionId.value,turnId:request.turnId,requestId:request.requestId};integrationActionPending.value=selection;integrationActionError.value=null;try{if([`connect`,`cancel`,`status`].includes(action)){const path=vibe64SessionPath(sessionsApiPath.value,selection.sessionId,`/integrations`);const config=await httpClient.request(path);if(integrationActionPending.value!==selection||sessionId.value!==selection.sessionId)return false;const integrationId=turn.integrationSetup.integrationId;const integration=config?.configuration?.integrations?.[integrationId];if(!integration)throw new Error(`Choose Configure to set up this integration first.`);if(connectorDefinitions.some(provider=>provider.id===integration.provider&&(provider.configurationOnly||provider.configurationOnlyForSettings?.(integration?.settings||{})))){integrationConnections.value={...integrationConnections.value,[selection.requestId]:{status:`configuration-only`}};return true}if(integration.accountMode===`per-user`)throw new Error(`Each app user connects their account inside the application. Choose Configure for setup instructions.`);const endpoint=`${path}/${encodeURIComponent(integrationId)}/setup`;const previous=integrationConnections.value[selection.requestId];if(action===`cancel`&&!previous?.attemptId)return false;let connection=await httpClient.request(endpoint,{method:`POST`,body:{operation:action,...action===`cancel`?{attemptId:previous.attemptId}:{setupRequest:{turnId:selection.turnId,requestId:selection.requestId,configurationHash:config.baseHash}}}});if(integrationActionPending.value!==selection||sessionId.value!==selection.sessionId)return false;if(action===`cancel`){connection=await httpClient.request(endpoint,{method:`POST`,body:{operation:`status`}});if(integrationActionPending.value!==selection||sessionId.value!==selection.sessionId)return false}integrationConnections.value={...integrationConnections.value,[selection.requestId]:connection};if(connection.integrationSetup?.outcome===`completed`&&connection.integrationSetup.continuation?.status!==`accepted`){const resumed=await httpClient.request(vibe64SessionPath(sessionsApiPath.value,selection.sessionId,`/integration-setup/resume`),{method:`POST`,body:{turnId:selection.turnId,requestId:selection.requestId}});if(resumed?.ok!==true)throw new Error(resumed?.error||`Assistant continuation is not yet confirmed.`)}if(integrationActionPending.value===selection&&sessionId.value===selection.sessionId)await reloadConversationLog();return true}const result=await httpClient.request(vibe64SessionPath(sessionsApiPath.value,selection.sessionId,`/integration-setup/${action}`),{method:`POST`,body:{turnId:selection.turnId,requestId:selection.requestId}});if(result?.ok!==true)throw new Error(result?.error||`Could not update integration setup.`);if(integrationActionPending.value===selection&&sessionId.value===selection.sessionId)await reloadConversationLog();return true}catch(error){if(sessionId.value===selection.sessionId&&integrationActionPending.value===selection){integrationActionError.value={turnId:selection.turnId,message:String(error?.message||`Could not update integration setup.`)};if(action===`resume`||action===`connect`||action===`status`)await reloadConversationLog()}return false}finally{if(sessionId.value===selection.sessionId&&integrationActionPending.value===selection)integrationActionPending.value=null}}onScopeDispose(()=>{integrationActionPending.value=null});watch([sessionId,projectSlug],()=>{integrationActionPending.value=null;integrationActionError.value=null;integrationConnections.value={}});return{integrationConnections,connectIntegrationRequest,checkIntegrationRequest,cancelIntegrationRequest,integrationActionPending,integrationActionError,skipIntegrationRequest,resumeIntegrationRequest}}function useVibe64ConversationLog({active=true,projectSlug:projectSlugInput,sessionsApiPath:sessionsApiPathInput,session,conversation=null}={}){const paths=usePaths();const httpClient=getHttpWebClient();const projectSlug=projectSlugInput===void 0?useVibe64ProjectSlug():computed(()=>readRefOrGetterValue(projectSlugInput));const currentSession=computed(()=>readRefOrGetterValue(session)||null);const sessionId=computed(()=>String(currentSession.value?.sessionId||``).trim());const enabled=computed(()=>Boolean(readRefOrGetterValue(active)!==false&&sessionId.value));const sessionsApiPath=computed(()=>readRefOrGetterValue(sessionsApiPathInput)||paths.api(`/vibe64/sessions`,{surface:`app`}));if(conversation){const turns=computed(()=>conversationTurnsWithPending(conversation.turns.value,sessionIsAwaitingCodex(currentSession.value)));const integrationActions=useConversationIntegrationActions({turns,enabled,sessionId,projectSlug,sessionsApiPath,reloadConversationLog:conversation.reload,httpClient});let realtimeCompletionKey=``;const realtime=useRealtimeEvent({enabled,event:VIBE64_SESSION_CHANGED_EVENT,matches:context=>([`session-assistant-selection-updated`,`integration-setup-skipped`,`integration-setup-completed`].includes(context?.payload?.reason)||conversationLogCompletedTurnKey(context?.payload))&&conversationLogRealtimeShouldRefresh(context,sessionId.value)&&vibe64SessionEventMatchesScope(context?.payload,{projectSlug:projectSlug.value}),onEvent:({payload={}}={})=>{realtimeCompletionKey=conversationLogCompletedTurnKey(payload)||realtimeCompletionKey;return payload.reason===`session-assistant-selection-updated`?conversation.reload({resubscribe:true}):conversation.reload()}});watch(()=>conversationLogCompletedTurnKey(currentSession.value),key=>{if(!enabled.value||!key)return;if(key===realtimeCompletionKey){realtimeCompletionKey=``;return}conversation.reload()?.catch(()=>{})},{flush:`post`});return{...integrationActions,turns,error:conversation.error,errorReloadable:computed(()=>conversation.accessDenied?.value===false),hasMoreBefore:conversation.hasMoreBefore,loadMore:conversation.loadMore,loadMoreError:conversation.loadMoreError,loading:conversation.loading,initializing:computed(()=>!conversation.snapshot.value&&conversation.loading.value),loadingMore:conversation.loadingMore,reload:conversation.reload,realtime,visible:computed(()=>Boolean(conversation.loading.value||conversation.error.value||turns.value.length))}}const queryClient=useQueryClient();const olderPages=ref([]);const loadingMore=ref(false);const loadMoreError=ref(``);const queryKey=computed(()=>[...vibe64ConversationLogQueryKey(`app`,ROUTE_VISIBILITY_PUBLIC,sessionId.value,projectSlug.value)]);const conversationLogPath=computed(()=>sessionId.value?vibe64ConversationLogPath(sessionsApiPath.value,sessionId.value):``);const pendingReads=new Set;const resource=useEndpointResource({enabled,fallbackLoadError:`Conversation history could not be loaded.`,path:conversationLogPath,queryKey,queryOptions:{async queryFn({signal}){const read={sessionId:sessionId.value,projectSlug:projectSlug.value,patches:[]};pendingReads.add(read);try{let payload=await httpClient.request(conversationLogPath.value,{method:`GET`,query:conversationLogReadQuery(),signal});for(const patch of read.patches)payload=applyConversationLogPatch(payload,patch,{limit:10});return payload}finally{pendingReads.delete(read)}},placeholderData:previousData=>previousData,refetchOnMount:false,refetchOnWindowFocus:false},readMethod:`GET`,refreshOnPull:true,requestRecoveryLabel:`Conversation history`,realtime:null});let reloadInFlight=null;let reloadQueued=false;let recoveredErrorKey=``;let realtimeCompletionKey=``;const conversationStream=shallowRef(null);function receiveConversationStream(snapshot){if(snapshot&&(!conversationStream.value||snapshot.revision>=conversationStream.value.revision))conversationStream.value=snapshot}watch(()=>resource.data.value,data=>receiveConversationStream(data?.conversationStream),{immediate:true});async function reloadConversationLog(){if(reloadInFlight){reloadQueued=true;vibe64SessionDebugLog(`client.conversationLog.reload.join`,{sessionId:sessionId.value});return reloadInFlight}olderPages.value=[];loadMoreError.value=``;vibe64SessionDebugLog(`client.conversationLog.reload.start`,{sessionId:sessionId.value});reloadInFlight=resource.reload();try{const result=await reloadInFlight;vibe64SessionDebugLog(`client.conversationLog.reload.done`,{sessionId:sessionId.value});return result}finally{reloadInFlight=null;if(reloadQueued){reloadQueued=false;reloadConversationLog()}}}const realtimeSocket=useRealtimeSocket({required:false});const reconcileConversationAfterRealtimeConnect=()=>{if(enabled.value){conversationStream.value=null;reloadConversationLog().catch(()=>{})}};realtimeSocket.on(`connect`,reconcileConversationAfterRealtimeConnect);onScopeDispose(()=>{realtimeSocket.off(`connect`,reconcileConversationAfterRealtimeConnect)});function applyRealtimeConversationLogPatch(payload={}){const patch=conversationLogRealtimePatch(payload);if(!patch)return false;const key=queryKey.value;const currentPayload=queryClient.getQueryData(key);const nextPayload=applyConversationLogPatch(currentPayload,patch,{limit:10});if(!nextPayload){vibe64SessionDebugLog(`client.conversationLog.patch.miss`,{hasCurrentPayload:Boolean(currentPayload),patchType:String(patch?.type||``),sessionId:sessionId.value});return false}for(const read of pendingReads)if(read.sessionId===sessionId.value&&read.projectSlug===projectSlug.value)read.patches.push(patch);queryClient.setQueryData(key,nextPayload);vibe64SessionDebugLog(`client.conversationLog.patch.done`,{patchType:String(patch.type||``),sessionId:sessionId.value,turnId:String(patch.turn?.turnId||``)});return true}const realtime=useRealtimeEvent({enabled,event:VIBE64_SESSION_CHANGED_EVENT,matches:context=>conversationLogRealtimeShouldRefresh(context,sessionId.value),onEvent:({payload={}}={})=>{receiveConversationStream(payload.conversationStream);realtimeCompletionKey=conversationLogCompletedTurnKey(payload)||realtimeCompletionKey;vibe64SessionDebugLog(`client.conversationLog.realtime`,{hasPatch:Boolean(conversationLogRealtimePatch(payload)),reason:String(payload.reason||``),sessionId:sessionId.value});if(applyRealtimeConversationLogPatch(payload))return null;if(payload.reason===`assistant-stream`)return null;return reloadConversationLog()}});const recoveryStateKey=computed(()=>conversationLogRecoveryStateKey(currentSession.value));const completedTurnKey=computed(()=>conversationLogCompletedTurnKey(currentSession.value));watch(completedTurnKey,key=>{if(!enabled.value||!key)return;if(key===realtimeCompletionKey){realtimeCompletionKey=``;return}vibe64SessionDebugLog(`client.conversationLog.completion.reconcile`,{completedTurnKey:key,sessionId:sessionId.value});reloadConversationLog().catch(()=>{})},{flush:`post`});const recoveryErrorKey=computed(()=>[enabled.value?`enabled`:`disabled`,sessionId.value,recoveryStateKey.value,resource.loadError.value].join(`|`));watch(recoveryErrorKey,()=>{const loadError=String(resource.loadError.value||``).trim();if(!enabled.value||!loadError){recoveredErrorKey=``;return}const key=recoveryErrorKey.value;if(recoveredErrorKey===key)return;recoveredErrorKey=key;vibe64SessionDebugLog(`client.conversationLog.recover.start`,{error:loadError,recoveryStateKey:recoveryStateKey.value,sessionId:sessionId.value});reloadConversationLog().then(()=>{vibe64SessionDebugLog(`client.conversationLog.recover.done`,{recoveryStateKey:recoveryStateKey.value,sessionId:sessionId.value})}).catch(error=>{vibe64SessionDebugLog(`client.conversationLog.recover.error`,{error:vibe64SessionDebugError(error),recoveryStateKey:recoveryStateKey.value,sessionId:sessionId.value})})},{flush:`post`});const latestPage=computed(()=>normalizeConversationLogPage(resource.data.value||{}));const loadedPages=computed(()=>[...olderPages.value,latestPage.value]);const oldestLoadedPage=computed(()=>olderPages.value[0]||latestPage.value);const hasMoreBefore=computed(()=>Boolean(normalizeConversationLogPagination(oldestLoadedPage.value?.pagination).hasMoreBefore));const turns=computed(()=>{const savedTurns=normalizeConversationLog(mergeConversationLogPages(loadedPages.value),{pending:sessionIsAwaitingCodex(currentSession.value)});return mergeConversationStream(savedTurns,conversationStream.value)});const visible=computed(()=>Boolean(resource.isLoading.value||resource.loadError.value||turns.value.length));async function loadMoreConversationLog({complete}={}){const finish=result=>{if(typeof complete===`function`)complete(result)};const pagination=normalizeConversationLogPagination(oldestLoadedPage.value?.pagination);const beforeTurnId=pagination.nextBeforeTurnId||pagination.oldestTurnId||String(turns.value[0]?.turnId||``).trim();if(!enabled.value||!conversationLogPath.value||!hasMoreBefore.value||loadingMore.value||!beforeTurnId){finish({changed:false,loaded:false});return false}loadingMore.value=true;loadMoreError.value=``;vibe64SessionDebugLog(`client.conversationLog.loadMore.start`,{beforeTurnId,sessionId:sessionId.value});try{const page=await httpClient.request(conversationLogPath.value,{method:`GET`,query:conversationLogReadQuery({beforeTurnId,limit:10})});const previousOldestTurnId=String(turns.value[0]?.turnId||``).trim();const previousMessageCount=turns.value.reduce((count,turn)=>count+(turn.messages?.length||0),0);olderPages.value=[normalizeConversationLogPage(page),...olderPages.value];const nextOldestTurnId=String(turns.value[0]?.turnId||``).trim();const nextMessageCount=turns.value.reduce((count,turn)=>count+(turn.messages?.length||0),0);const changed=Boolean(nextOldestTurnId&&(nextOldestTurnId!==previousOldestTurnId||nextMessageCount!==previousMessageCount));vibe64SessionDebugLog(`client.conversationLog.loadMore.done`,{beforeTurnId,sessionId:sessionId.value,turnCount:Array.isArray(page?.conversationLog)?page.conversationLog.length:0});finish({changed,loaded:true});return true}catch(error){loadMoreError.value=String(error?.message||error||`Older conversation history could not be loaded.`);vibe64SessionDebugLog(`client.conversationLog.loadMore.error`,{beforeTurnId,error:vibe64SessionDebugError(error),sessionId:sessionId.value});finish({changed:false,loaded:false});return false}finally{loadingMore.value=false}}const integrationActions=useConversationIntegrationActions({turns,enabled,sessionId,projectSlug,sessionsApiPath,reloadConversationLog,httpClient});watch([sessionId,projectSlug],()=>{conversationStream.value=null;olderPages.value=[];loadMoreError.value=``});return{...integrationActions,error:resource.loadError,hasMoreBefore,loadMore:loadMoreConversationLog,loadMoreError,loading:resource.isLoading,initializing:resource.isInitialLoading,loadingMore,reload:reloadConversationLog,realtime,turns,visible}}export{useVibe64ConversationLog as t};
|
package/dist/assets/{useVibe64DatabaseTools-Dpm53ruL.js → useVibe64DatabaseTools-H6H-YJQX.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{H as hasInjectionContext,J as inject,On as unref,g as computed}from"./runtime-core.esm-bundler-DGXg_mpN.js";import{T as ROUTE_VISIBILITY_PUBLIC,t as useEndpointResource}from"./useEndpointResource-Ds8EDBZ2.js";import{n as VIBE64_ASSISTANT_VIEWER_KEY}from"./vibe64AssistantHost-CP6oxv5b.js";import{S as VIBE64_CONNECTIONS_CHANGED_EVENT,x as VIBE64_ACCOUNTS_CHANGED_EVENT}from"./client-
|
|
1
|
+
import{H as hasInjectionContext,J as inject,On as unref,g as computed}from"./runtime-core.esm-bundler-DGXg_mpN.js";import{T as ROUTE_VISIBILITY_PUBLIC,t as useEndpointResource}from"./useEndpointResource-Ds8EDBZ2.js";import{n as VIBE64_ASSISTANT_VIEWER_KEY}from"./vibe64AssistantHost-CP6oxv5b.js";import{S as VIBE64_CONNECTIONS_CHANGED_EVENT,x as VIBE64_ACCOUNTS_CHANGED_EVENT}from"./client-BxGiylrJ.js";import{t as usePaths}from"./usePaths-Db88-HOm.js";import{t as useCommand}from"./useCommand-nWFczmJy.js";var VIBE64_DATABASE_LAYOUT_CHANGED_EVENT=`vibe64.database.layout.changed`;var DATABASE_API_SUFFIX=`/vibe64/database`;var DATABASE_SURFACE=`app`;function encodeSegment(value=``){return encodeURIComponent(String(value||``).trim())}function databaseSessionPath(apiPath=``,sessionId=``,suffix=``){return`${apiPath}/sessions/${encodeSegment(sessionId)}${suffix}`}function useVibe64DatabaseTools({active=true,projectSlug=``,sessionId=``}={}){const paths=usePaths();const viewer=hasInjectionContext()?inject(VIBE64_ASSISTANT_VIEWER_KEY,{actorKey:`local`}):{actorKey:`local`};const actorKey=computed(()=>unref(viewer)?.actorKey||``);const normalizedSessionId=computed(()=>String(unref(sessionId)||``).trim());const normalizedProjectSlug=computed(()=>String(unref(projectSlug)||``).trim());const enabled=computed(()=>Boolean(unref(active)&&normalizedSessionId.value&&actorKey.value));const apiPath=computed(()=>paths.api(DATABASE_API_SUFFIX,{surface:DATABASE_SURFACE}));const sessionPath=computed(()=>databaseSessionPath(apiPath.value,normalizedSessionId.value));const stateResource=useEndpointResource({enabled,fallbackLoadError:`The session database workspace could not be loaded.`,path:computed(()=>enabled.value?sessionPath.value:``),queryKey:computed(()=>[`vibe64`,`database`,normalizedProjectSlug.value,normalizedSessionId.value,actorKey.value,`state`]),realtime:{events:[VIBE64_DATABASE_LAYOUT_CHANGED_EVENT,VIBE64_ACCOUNTS_CHANGED_EVENT,VIBE64_CONNECTIONS_CHANGED_EVENT],matches:({event,payload={}}={})=>event!==`vibe64.database.layout.changed`||payload.projectSlug===normalizedProjectSlug.value&&payload.sessionId===normalizedSessionId.value},requestRecoveryLabel:`Session database`});function databaseCommand({fallback,method=`POST`,placement,success=`Completed.`,suppressSuccessMessage=false}={}){return useCommand({access:`never`,apiSuffix:DATABASE_API_SUFFIX,buildCommandOptions:(_input,{context})=>({method:context.method||method,path:context.path||sessionPath.value}),buildRawPayload:(_model,{context})=>context.payload||{},fallbackRunError:fallback,messages:{error:fallback,success},ownershipFilter:ROUTE_VISIBILITY_PUBLIC,placementSource:`vibe64.database.${placement}`,suppressSuccessMessage,surfaceId:DATABASE_SURFACE,writeMethod:method})}const refreshCommand=databaseCommand({fallback:`The database schema could not be refreshed.`,placement:`schema.refresh`,success:`Database schema refreshed.`});const queryCommand=databaseCommand({fallback:`The SQL statement could not be run.`,placement:`query.run`,success:`SQL statement completed.`});const defaultQueryCommand=databaseCommand({fallback:`The table data could not be loaded.`,placement:`query.default`,suppressSuccessMessage:true});const cancelCommand=databaseCommand({fallback:`The database query could not be cancelled.`,placement:`query.cancel`,suppressSuccessMessage:true});const updateCommand=databaseCommand({fallback:`The database value could not be saved.`,method:`PATCH`,placement:`cell.update`,success:`Database value saved.`});const insertCommand=databaseCommand({fallback:`The database row could not be inserted.`,placement:`row.insert`,success:`Database row inserted.`});const deleteCommand=databaseCommand({fallback:`The database row could not be deleted.`,placement:`row.delete`,success:`Database row deleted.`});const lookupCommand=databaseCommand({fallback:`The lookup table could not be searched.`,placement:`lookup.search`,suppressSuccessMessage:true});const layoutCommand=databaseCommand({fallback:`The ERD layout could not be saved.`,method:`PUT`,placement:`layout.save`,suppressSuccessMessage:true});const overviewCommand=databaseCommand({fallback:`The main actor grouping could not be saved.`,method:`PUT`,placement:`overview.save`,success:`Main actors saved in project source.`});const snippetCommand=databaseCommand({fallback:`The SQL snippet could not be saved.`,method:`PUT`,placement:`snippet.save`,success:`SQL snippet saved.`});const snippetDeleteCommand=databaseCommand({fallback:`The SQL snippet could not be deleted.`,method:`DELETE`,placement:`snippet.delete`,success:`SQL snippet deleted.`});const assistantCommand=databaseCommand({fallback:`The database copilot could not answer.`,placement:`assistant.ask`,suppressSuccessMessage:true});async function reload(){if(enabled.value)return stateResource.reload()}async function refreshSchema(){const result=await refreshCommand.run({path:`${sessionPath.value}/schema/refresh`});await reload();return result}function runQuery(payload={}){return(payload.automatic===true?defaultQueryCommand:queryCommand).run({path:`${sessionPath.value}/queries`,payload})}function cancelQuery(queryId=``){return cancelCommand.run({path:`${sessionPath.value}/queries/${encodeSegment(queryId)}/cancel`})}function updateCell(payload={}){return updateCommand.run({path:`${sessionPath.value}/cells`,payload})}function insertRow(payload={}){return insertCommand.run({path:`${sessionPath.value}/rows`,payload})}function deleteRow(payload={}){return deleteCommand.run({path:`${sessionPath.value}/rows/delete`,payload})}function searchLookup(payload={}){return lookupCommand.run({path:`${sessionPath.value}/lookups/search`,payload})}function saveLayout(layout={}){return layoutCommand.run({path:`${sessionPath.value}/layout`,payload:{layout}})}async function saveOverview(payload){const result=await overviewCommand.run({path:`${sessionPath.value}/overview`,payload});if(result?.ok!==false)await reload();return result}function saveSnippet(snippet={}){return snippetCommand.run({path:`${sessionPath.value}/snippets`,payload:{snippet}})}function deleteSnippet(snippetId=``){return snippetDeleteCommand.run({method:`DELETE`,path:`${sessionPath.value}/snippets/${encodeSegment(snippetId)}`})}return{assistantCommand,assistantEndpoint:computed(()=>`${sessionPath.value}/assistant`),assistantBusy:computed(()=>assistantCommand.isRunning===true),cancelQuery,cancelling:computed(()=>cancelCommand.isRunning===true),deleteRow,deleteSnippet,deleting:computed(()=>deleteCommand.isRunning===true),error:stateResource.loadError,insertRow,inserting:computed(()=>insertCommand.isRunning===true),layoutSaving:computed(()=>layoutCommand.isRunning===true),loading:stateResource.isLoading,lookupBusy:computed(()=>lookupCommand.isRunning===true),refreshSchema,refreshing:computed(()=>refreshCommand.isRunning===true),reload,runQuery,running:computed(()=>queryCommand.isRunning===true||defaultQueryCommand.isRunning===true),saveLayout,saveOverview,saveSnippet,searchLookup,state:computed(()=>actorKey.value?stateResource.data.value||null:null),updateCell,updating:computed(()=>updateCommand.isRunning===true)}}export{useVibe64DatabaseTools as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Ht as watch,On as unref,g as computed,hn as proxyRefs,pn as onScopeDispose,vn as ref}from"./runtime-core.esm-bundler-DGXg_mpN.js";import{J as useQueryClient,T as ROUTE_VISIBILITY_PUBLIC,t as useEndpointResource}from"./useEndpointResource-Ds8EDBZ2.js";import{_ as useRouter,g as useRoute}from"./useApi-BPuI6ZR9-CFWU1m37.js";import{n as useRealtimeEvent}from"./useRealtimeEvent-DrOiU8lJ.js";import{t as usePaths}from"./usePaths-Db88-HOm.js";import{t as useCommand}from"./useCommand-nWFczmJy.js";import{t as useUiFeedback}from"./useUiFeedback-CMwE4MLs.js";import{b as VIBE64_PROJECT_CHANGED_EVENT}from"./studioGateApi-BXHVBVEc.js";import{t as useVibe64ProjectSlug}from"./useVibe64ProjectScope-B5ogg6jd.js";import{n as vibe64RealtimeOriginPayload}from"./vibe64BrowserTabOrigin-SF9E31vi.js";import{D as VIBE64_SESSIONS_API_SUFFIX,E as VIBE64_CURRENT_SESSION_API_SUFFIX,O as VIBE64_SESSION_CHANGED_EVENT,at as vibe64SessionsQueryKey,b as readRefOrGetterValue,et as vibe64SessionPath,it as vibe64SessionQueryKey}from"./index-B9P6KjvH.js";import{a as vibe64SessionDebugError,i as vibe64SessionDebugDurationMs,n as enrichVibe64SessionForDisplay,o as vibe64SessionDebugLog,r as visibleVibe64Sessions,s as vibe64SessionDebugSummary}from"./vibe64SessionPanelModel-DDorOuiL.js";import{c as vibe64SessionStatusLabel,i as vibe64SessionDisplayTitle,o as vibe64SessionRevision,r as shortVibe64SessionId,s as vibe64SessionStatusColor,t as isArchivedVibe64Session}from"./vibe64SessionViewModel-DR4tOlGM.js";import{n as useVibe64SessionSelection,t as selectedSessionIdFromRoute}from"./useVibe64SessionSelection-BEqKR412.js";function plainObjectValue(value=null){return value&&typeof value===`object`&&!Array.isArray(value)?value:{}}function sessionChangedReason$1(payload={}){return String(payload?.reason||``).trim()}function sessionRevision(value){const revision=Number(value);return Number.isSafeInteger(revision)&&revision>=0?revision:null}function agentTurnRealtimeOverlayFromPayload(payload={},selectedSessionId=``){const changedSessionId=String(payload?.sessionId||payload?.entityId||``).trim();if(!changedSessionId||changedSessionId!==String(selectedSessionId||``).trim())return null;const agentSession=plainObjectValue(payload.agentSession);const turn=plainObjectValue(agentSession.turn);const run=plainObjectValue(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$1(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=plainObjectValue(overlay.agentSession);return{...session,agentRuns:mergeAgentRunOverlay(session.agentRuns,plainObjectValue(overlay.agentRun)),agentSession:{...plainObjectValue(session.agentSession),...overlayAgentSession,thread:{...plainObjectValue(session.agentSession?.thread),...plainObjectValue(overlayAgentSession.thread)},turn:{...plainObjectValue(session.agentSession?.turn),...plainObjectValue(overlayAgentSession.turn),active:overlay.active===true}},revision:overlay.revision}}var MOUNTED_SESSION_IGNORED_REALTIME_REASONS=new Set([`assistant-stream`,`assistant-response-bundle`,`codex-app-server-commentary`,`codex-app-server-prompt-injected`,`codex-app-server-ready`,`codex-app-server-final-assistant-message`,`codex-app-server-live-progress`,`codex-app-server-reasoning-summary`,`codex-app-server-running`,`codex-app-server-terminal-assistant-message`,`codex-app-server-terminal-thinking-message`,`codex-app-server-terminal-user-message`,`codex-app-server-turn-active`,`codex-app-server-turn-claimed`,`codex-app-server-turn-finalizing`,`codex-app-server-turn-idle`,`codex-app-server-turn-state`,`codex-app-server-message-delivered`,`codex-context-replaced`,`codex-prompt-injected`,`opencode-server-assistant-message`,`opencode-server-message-delivered`,`opencode-server-progress`,`opencode-server-reasoning`,`opencode-server-tool`,`opencode-server-turn-active`,`opencode-server-turn-idle`,`output-target-started`,`output-target-ready`,`output-target-closed`,`output-target-stopped`]);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=``){const changedSessionId=String(payload.sessionId||payload.entityId||``).trim();if(!changedSessionId||changedSessionId!==String(sessionId||``).trim())return false;const reason=String(payload?.reason||``).trim();return!reason||!MOUNTED_SESSION_IGNORED_REALTIME_REASONS.has(reason)}function useVibe64SessionDialogs({archiveAllowed=true,beginArchive=()=>null,finishArchive=()=>null,isSelectedSessionArchived,refreshSessionData=async()=>null,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(!readRefOrGetterValue(archiveAllowed)||!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({includeList:true,reason:`archive-session`}).catch(()=>null)}}function clear(){clearArchiveDialog()}return{archive:{archiving:computed(()=>Boolean(archivingSessionId.value)),archivingSessionId,cancel:cancelArchiveSession,command:archiveCommand,confirm:confirmArchiveSession,open:archiveDialogOpen,request:requestArchiveSelectedSession,sessionId:archiveDialogSessionId,sessionTitle:archiveDialogSessionTitle},busy:computed(()=>Boolean(archivingSessionId.value)),clear}}function createVibe64CurrentSessionPublisher({coalesceByPath=false,onError=()=>null,publish}={}){if(typeof publish!==`function`)throw new TypeError(`Current Vibe64 session publisher requires publish().`);const pendingPublications=new Map;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();const publicationKey=(typeof coalesceByPath===`function`?coalesceByPath():coalesceByPath)?apiPath:``;pendingPublications.set(publicationKey,{apiPath,identity:JSON.stringify([apiPath,sessionId]),sessionId});publicationChain=publicationChain.catch(()=>null).then(async()=>{if(stopped||pendingPublications.size===0)return;const[key,publication]=pendingPublications.entries().next().value;pendingPublications.delete(key);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;pendingPublications.clear()}return Object.freeze({request,stop})}function vibe64SessionListRefreshRequested(payload={}){return payload?.clientRefresh?.includeList===true}var SESSION_LIST_IGNORED_REALTIME_REASONS=new Set([`assistant-stream`,`assistant-response-bundle`,`codex-app-server-ready`,`codex-app-server-agent-result`,`codex-app-server-agent-result-invalid`,`codex-app-server-agent-result-missing`,`codex-app-server-agent-result-provider-failed`,`codex-app-server-blocked`,`codex-app-server-commentary`,`codex-app-server-failed`,`codex-app-server-final-assistant-message`,`codex-app-server-live-progress`,`codex-app-server-prompt-injected`,`codex-app-server-reasoning-summary`,`codex-app-server-running`,`codex-app-server-terminal-assistant-message`,`codex-app-server-terminal-thinking-message`,`codex-app-server-terminal-user-message`,`codex-app-server-turn-active`,`codex-app-server-turn-claimed`,`codex-app-server-turn-finalizing`,`codex-app-server-turn-idle`,`codex-app-server-turn-state`,`codex-app-server-message-delivered`,`codex-prompt-injected`,`codex-context-replaced`,`opencode-server-assistant-message`,`opencode-server-message-delivered`,`opencode-server-progress`,`opencode-server-reasoning`,`opencode-server-tool`,`opencode-server-turn-active`,`opencode-server-turn-idle`,`agent-terminal-started`,`agent-terminal-closed`,`output-target-started`,`output-target-ready`,`output-target-closed`,`output-target-stopped`]);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 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 shouldPreserveSelectedSessionDuringRefresh({createSessionRunning=false,currentSessionId=``,nextSessions=[],selectedSessionLoading=false,sessionListLoading=false}={}){const normalizedSessionId=String(currentSessionId||``).trim();if(!normalizedSessionId||sessionIdExistsInList(normalizedSessionId,nextSessions))return false;return Boolean(sessionListLoading||createSessionRunning||selectedSessionLoading)}function selectedSessionIdForCurrentAlias({createSessionRunning=false,selectedSessionId=``,selectedSessionLoading=false,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||selectedSessionLoading)return null;return``}function sessionChangedReason(payload={}){return String(payload?.reason||``).trim()}function sessionListRealtimeShouldRefresh({payload={}}={},projectSlug=``){if(payload.projectSlug&&payload.projectSlug!==projectSlug)return false;if(vibe64SessionListRefreshRequested(payload))return true;const reason=sessionChangedReason(payload);if(reason===`assistant-routing-changed`&&payload.assistantRoutingRequest)return false;return!reason||!SESSION_LIST_IGNORED_REALTIME_REASONS.has(reason)}function refetchEndpointResource(resource){if(typeof resource?.query?.refetch===`function`)return resource.query.refetch({cancelRefetch:false});return resource?.reload?.()}function useVibe64SessionData({onTitleChange=null}={}){const notifyTitleChange=typeof onTitleChange===`function`?onTitleChange:()=>null;const queryClient=useQueryClient();const projectSlug=useVibe64ProjectSlug();const route=useRoute();const router=useRouter();const paths=usePaths();const selectionScope=computed(()=>String(projectSlug.value||``).trim());const sessionSelection=useVibe64SessionSelection({projectSlug});const selectedSessionId=sessionSelection.selectedId;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:false,refetchOnWindowFocus:false},requestRecoveryLabel:`Vibe64 sessions`,realtime:{events:[VIBE64_SESSION_CHANGED_EVENT,VIBE64_PROJECT_CHANGED_EVENT,`connect`],matches:event=>!event?.payload?.learningAttemptId&&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),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});let emptySessionListObservedForProject=``;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 createSessionPending=ref(false);const createSessionRunning=computed(()=>createSessionPending.value);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})}});let sessionDataDisposed=false;onScopeDispose(()=>{sessionDataDisposed=true;currentSessionPublisher.stop()});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 operation=sessionArchiveOperation(session);return{...session,agentActivity:latestAgentTurnRealtimeOverlay(session.agentActivity,agentActivityBySessionId.value[session.sessionId]),archiveOperation:operation,archiveStartedAt:operation?.startedAt||session.archiveStartedAt,archiveError:operation?.status===`failed`?operation.error:``,archiving:Boolean(session.archiving||operation?.status===`running`||operation?.status!==`failed`&&session.metadata?.session_closing_reason===`archived`)}})});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=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_CHANGED_EVENT,matches:({payload={}}={})=>mountedSessionRealtimeShouldRefresh({payload},selectionRenewalPredecessorId.value)},requestRecoveryLabel:`Selected session renewal`});const creationOptions=computed(()=>sessionList.pages?.[0]?.creation||{});const selectedSession=computed(()=>enrichVibe64SessionForDisplay(selectedListSession.value));const isSelectedSessionArchived=computed(()=>isArchivedVibe64Session(selectedSession.value||{}));const pageLoading=computed(()=>Boolean(sessionList.isLoading));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}).archive);const archiveFeedback=useUiFeedback({source:`vibe64.sessions.archive.remote`});const shownArchiveFailures=new Set;watch(projectSlug,()=>{archiveAttempts.value={};agentActivityBySessionId.value={};shownArchiveFailures.clear()});useRealtimeEvent({event:VIBE64_SESSION_CHANGED_EVENT,matches:({payload={}}={})=>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);const operation=sessionArchiveOperation(session);if(!session||operation?.status===`failed`||operation?.status!==`running`&&session.metadata?.session_closing_reason!==`archived`)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});let createSessionInFlight=null;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`);createSessionPending.value=true;createSessionInFlight=(async()=>{try{const response=await createSessionCommand.run({assistantSelection,pullRequestNumber,repositoryBranch,apiPath:creationApiPath});if(!sessionDataDisposed&&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({includeList:true,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{createSessionPending.value=false;createSessionInFlight=null}})();return createSessionInFlight}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!sessionDataDisposed&&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}})()}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||``),sessionIds:nextSessions.map(session=>session.sessionId).join(`|`),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.selectedSessionId&&emptySessionListObservedForProject===state.selectionScope)return;sessionSelection.selectAvailableId(nextSessions,{fallbackId:nextSessions.at(-1)?.sessionId||``,getId:session=>session.sessionId})},{immediate:true});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});watch(selectedSessionTitle,title=>{notifyTitleChange(title||``)},{immediate:true});return{archive,canCreateSession,clearSelectedSession,createSession,createSessionCommand,createSessionRunning,createSessionVisible,createSessionTitle,isSelectedSessionArchived,availableSessions,pageLoading,refreshSessionData,selectSessionId,selectedSession,selectedSessionId,selectedSessionTitle,sessionList,sessions,sessionsApiPath,shortSessionId:shortVibe64SessionId,statusColor:vibe64SessionStatusColor,statusLabel:vibe64SessionStatusLabel,updateCurrentSessionCommand}}export{mountedSessionDetailRefreshReason as a,sessionRecordHasActiveAgentWork as c,sessionWithAgentTurnRealtimeOverlay as d,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{Ht as watch,On as unref,g as computed,hn as proxyRefs,pn as onScopeDispose,vn as ref}from"./runtime-core.esm-bundler-DGXg_mpN.js";import{J as useQueryClient,T as ROUTE_VISIBILITY_PUBLIC,t as useEndpointResource}from"./useEndpointResource-Ds8EDBZ2.js";import{_ as useRouter,g as useRoute}from"./useApi-BPuI6ZR9-CFWU1m37.js";import{n as useRealtimeEvent}from"./useRealtimeEvent-DrOiU8lJ.js";import{t as usePaths}from"./usePaths-Db88-HOm.js";import{t as useCommand}from"./useCommand-nWFczmJy.js";import{t as useUiFeedback}from"./useUiFeedback-CMwE4MLs.js";import{b as VIBE64_PROJECT_CHANGED_EVENT}from"./studioGateApi-BXHVBVEc.js";import{t as useVibe64ProjectSlug}from"./useVibe64ProjectScope-B5ogg6jd.js";import{n as vibe64RealtimeOriginPayload}from"./vibe64BrowserTabOrigin-SF9E31vi.js";import{D as VIBE64_SESSIONS_API_SUFFIX,E as VIBE64_CURRENT_SESSION_API_SUFFIX,O as VIBE64_SESSION_CHANGED_EVENT,at as vibe64SessionsQueryKey,b as readRefOrGetterValue,et as vibe64SessionPath,it as vibe64SessionQueryKey}from"./index-Mxalhei8.js";import{a as vibe64SessionDebugError,i as vibe64SessionDebugDurationMs,n as enrichVibe64SessionForDisplay,o as vibe64SessionDebugLog,r as visibleVibe64Sessions,s as vibe64SessionDebugSummary}from"./vibe64SessionPanelModel-DDorOuiL.js";import{c as vibe64SessionStatusLabel,i as vibe64SessionDisplayTitle,o as vibe64SessionRevision,r as shortVibe64SessionId,s as vibe64SessionStatusColor,t as isArchivedVibe64Session}from"./vibe64SessionViewModel-DR4tOlGM.js";import{n as useVibe64SessionSelection,t as selectedSessionIdFromRoute}from"./useVibe64SessionSelection-J87nJ9p5.js";function plainObjectValue(value=null){return value&&typeof value===`object`&&!Array.isArray(value)?value:{}}function sessionChangedReason$1(payload={}){return String(payload?.reason||``).trim()}function sessionRevision(value){const revision=Number(value);return Number.isSafeInteger(revision)&&revision>=0?revision:null}function agentTurnRealtimeOverlayFromPayload(payload={},selectedSessionId=``){const changedSessionId=String(payload?.sessionId||payload?.entityId||``).trim();if(!changedSessionId||changedSessionId!==String(selectedSessionId||``).trim())return null;const agentSession=plainObjectValue(payload.agentSession);const turn=plainObjectValue(agentSession.turn);const run=plainObjectValue(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$1(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=plainObjectValue(overlay.agentSession);return{...session,agentRuns:mergeAgentRunOverlay(session.agentRuns,plainObjectValue(overlay.agentRun)),agentSession:{...plainObjectValue(session.agentSession),...overlayAgentSession,thread:{...plainObjectValue(session.agentSession?.thread),...plainObjectValue(overlayAgentSession.thread)},turn:{...plainObjectValue(session.agentSession?.turn),...plainObjectValue(overlayAgentSession.turn),active:overlay.active===true}},revision:overlay.revision}}var MOUNTED_SESSION_IGNORED_REALTIME_REASONS=new Set([`assistant-stream`,`assistant-response-bundle`,`codex-app-server-commentary`,`codex-app-server-prompt-injected`,`codex-app-server-ready`,`codex-app-server-final-assistant-message`,`codex-app-server-live-progress`,`codex-app-server-reasoning-summary`,`codex-app-server-running`,`codex-app-server-terminal-assistant-message`,`codex-app-server-terminal-thinking-message`,`codex-app-server-terminal-user-message`,`codex-app-server-turn-active`,`codex-app-server-turn-claimed`,`codex-app-server-turn-finalizing`,`codex-app-server-turn-idle`,`codex-app-server-turn-state`,`codex-app-server-message-delivered`,`codex-context-replaced`,`codex-prompt-injected`,`opencode-server-assistant-message`,`opencode-server-message-delivered`,`opencode-server-progress`,`opencode-server-reasoning`,`opencode-server-tool`,`opencode-server-turn-active`,`opencode-server-turn-idle`,`output-target-started`,`output-target-ready`,`output-target-closed`,`output-target-stopped`]);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=``){const changedSessionId=String(payload.sessionId||payload.entityId||``).trim();if(!changedSessionId||changedSessionId!==String(sessionId||``).trim())return false;const reason=String(payload?.reason||``).trim();return!reason||!MOUNTED_SESSION_IGNORED_REALTIME_REASONS.has(reason)}function useVibe64SessionDialogs({archiveAllowed=true,beginArchive=()=>null,finishArchive=()=>null,isSelectedSessionArchived,refreshSessionData=async()=>null,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(!readRefOrGetterValue(archiveAllowed)||!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({includeList:true,reason:`archive-session`}).catch(()=>null)}}function clear(){clearArchiveDialog()}return{archive:{archiving:computed(()=>Boolean(archivingSessionId.value)),archivingSessionId,cancel:cancelArchiveSession,command:archiveCommand,confirm:confirmArchiveSession,open:archiveDialogOpen,request:requestArchiveSelectedSession,sessionId:archiveDialogSessionId,sessionTitle:archiveDialogSessionTitle},busy:computed(()=>Boolean(archivingSessionId.value)),clear}}function createVibe64CurrentSessionPublisher({coalesceByPath=false,onError=()=>null,publish}={}){if(typeof publish!==`function`)throw new TypeError(`Current Vibe64 session publisher requires publish().`);const pendingPublications=new Map;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();const publicationKey=(typeof coalesceByPath===`function`?coalesceByPath():coalesceByPath)?apiPath:``;pendingPublications.set(publicationKey,{apiPath,identity:JSON.stringify([apiPath,sessionId]),sessionId});publicationChain=publicationChain.catch(()=>null).then(async()=>{if(stopped||pendingPublications.size===0)return;const[key,publication]=pendingPublications.entries().next().value;pendingPublications.delete(key);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;pendingPublications.clear()}return Object.freeze({request,stop})}function vibe64SessionListRefreshRequested(payload={}){return payload?.clientRefresh?.includeList===true}var SESSION_LIST_IGNORED_REALTIME_REASONS=new Set([`assistant-stream`,`assistant-response-bundle`,`codex-app-server-ready`,`codex-app-server-agent-result`,`codex-app-server-agent-result-invalid`,`codex-app-server-agent-result-missing`,`codex-app-server-agent-result-provider-failed`,`codex-app-server-blocked`,`codex-app-server-commentary`,`codex-app-server-failed`,`codex-app-server-final-assistant-message`,`codex-app-server-live-progress`,`codex-app-server-prompt-injected`,`codex-app-server-reasoning-summary`,`codex-app-server-running`,`codex-app-server-terminal-assistant-message`,`codex-app-server-terminal-thinking-message`,`codex-app-server-terminal-user-message`,`codex-app-server-turn-active`,`codex-app-server-turn-claimed`,`codex-app-server-turn-finalizing`,`codex-app-server-turn-idle`,`codex-app-server-turn-state`,`codex-app-server-message-delivered`,`codex-prompt-injected`,`codex-context-replaced`,`opencode-server-assistant-message`,`opencode-server-message-delivered`,`opencode-server-progress`,`opencode-server-reasoning`,`opencode-server-tool`,`opencode-server-turn-active`,`opencode-server-turn-idle`,`agent-terminal-started`,`agent-terminal-closed`,`output-target-started`,`output-target-ready`,`output-target-closed`,`output-target-stopped`]);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 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 shouldPreserveSelectedSessionDuringRefresh({createSessionRunning=false,currentSessionId=``,nextSessions=[],selectedSessionLoading=false,sessionListLoading=false}={}){const normalizedSessionId=String(currentSessionId||``).trim();if(!normalizedSessionId||sessionIdExistsInList(normalizedSessionId,nextSessions))return false;return Boolean(sessionListLoading||createSessionRunning||selectedSessionLoading)}function selectedSessionIdForCurrentAlias({createSessionRunning=false,selectedSessionId=``,selectedSessionLoading=false,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||selectedSessionLoading)return null;return``}function sessionChangedReason(payload={}){return String(payload?.reason||``).trim()}function sessionListRealtimeShouldRefresh({payload={}}={},projectSlug=``){if(payload.projectSlug&&payload.projectSlug!==projectSlug)return false;if(vibe64SessionListRefreshRequested(payload))return true;const reason=sessionChangedReason(payload);if(reason===`assistant-routing-changed`&&payload.assistantRoutingRequest)return false;return!reason||!SESSION_LIST_IGNORED_REALTIME_REASONS.has(reason)}function refetchEndpointResource(resource){if(typeof resource?.query?.refetch===`function`)return resource.query.refetch({cancelRefetch:false});return resource?.reload?.()}function useVibe64SessionData({onTitleChange=null}={}){const notifyTitleChange=typeof onTitleChange===`function`?onTitleChange:()=>null;const queryClient=useQueryClient();const projectSlug=useVibe64ProjectSlug();const route=useRoute();const router=useRouter();const paths=usePaths();const selectionScope=computed(()=>String(projectSlug.value||``).trim());const sessionSelection=useVibe64SessionSelection({projectSlug});const selectedSessionId=sessionSelection.selectedId;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:false,refetchOnWindowFocus:false},requestRecoveryLabel:`Vibe64 sessions`,realtime:{events:[VIBE64_SESSION_CHANGED_EVENT,VIBE64_PROJECT_CHANGED_EVENT,`connect`],matches:event=>!event?.payload?.learningAttemptId&&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),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});let emptySessionListObservedForProject=``;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 createSessionPending=ref(false);const createSessionRunning=computed(()=>createSessionPending.value);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})}});let sessionDataDisposed=false;onScopeDispose(()=>{sessionDataDisposed=true;currentSessionPublisher.stop()});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 operation=sessionArchiveOperation(session);return{...session,agentActivity:latestAgentTurnRealtimeOverlay(session.agentActivity,agentActivityBySessionId.value[session.sessionId]),archiveOperation:operation,archiveStartedAt:operation?.startedAt||session.archiveStartedAt,archiveError:operation?.status===`failed`?operation.error:``,archiving:Boolean(session.archiving||operation?.status===`running`||operation?.status!==`failed`&&session.metadata?.session_closing_reason===`archived`)}})});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=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_CHANGED_EVENT,matches:({payload={}}={})=>mountedSessionRealtimeShouldRefresh({payload},selectionRenewalPredecessorId.value)},requestRecoveryLabel:`Selected session renewal`});const creationOptions=computed(()=>sessionList.pages?.[0]?.creation||{});const selectedSession=computed(()=>enrichVibe64SessionForDisplay(selectedListSession.value));const isSelectedSessionArchived=computed(()=>isArchivedVibe64Session(selectedSession.value||{}));const pageLoading=computed(()=>Boolean(sessionList.isLoading));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}).archive);const archiveFeedback=useUiFeedback({source:`vibe64.sessions.archive.remote`});const shownArchiveFailures=new Set;watch(projectSlug,()=>{archiveAttempts.value={};agentActivityBySessionId.value={};shownArchiveFailures.clear()});useRealtimeEvent({event:VIBE64_SESSION_CHANGED_EVENT,matches:({payload={}}={})=>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);const operation=sessionArchiveOperation(session);if(!session||operation?.status===`failed`||operation?.status!==`running`&&session.metadata?.session_closing_reason!==`archived`)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});let createSessionInFlight=null;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`);createSessionPending.value=true;createSessionInFlight=(async()=>{try{const response=await createSessionCommand.run({assistantSelection,pullRequestNumber,repositoryBranch,apiPath:creationApiPath});if(!sessionDataDisposed&&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({includeList:true,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{createSessionPending.value=false;createSessionInFlight=null}})();return createSessionInFlight}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!sessionDataDisposed&&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}})()}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||``),sessionIds:nextSessions.map(session=>session.sessionId).join(`|`),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.selectedSessionId&&emptySessionListObservedForProject===state.selectionScope)return;sessionSelection.selectAvailableId(nextSessions,{fallbackId:nextSessions.at(-1)?.sessionId||``,getId:session=>session.sessionId})},{immediate:true});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});watch(selectedSessionTitle,title=>{notifyTitleChange(title||``)},{immediate:true});return{archive,canCreateSession,clearSelectedSession,createSession,createSessionCommand,createSessionRunning,createSessionVisible,createSessionTitle,isSelectedSessionArchived,availableSessions,pageLoading,refreshSessionData,selectSessionId,selectedSession,selectedSessionId,selectedSessionTitle,sessionList,sessions,sessionsApiPath,shortSessionId:shortVibe64SessionId,statusColor:vibe64SessionStatusColor,statusLabel:vibe64SessionStatusLabel,updateCurrentSessionCommand}}export{mountedSessionDetailRefreshReason as a,sessionRecordHasActiveAgentWork as c,sessionWithAgentTurnRealtimeOverlay as d,mountedSessionDetailLoadState as i,agentTurnRealtimeOverlayFromPayload as l,useVibe64SessionData as n,mountedSessionRealtimeShouldRefresh as o,latestSessionDetailRecord as r,mountedSessionRecord as s,sessionListRealtimeShouldRefresh as t,latestAgentTurnRealtimeOverlay as u};
|
package/dist/assets/{useVibe64SessionSelection-BEqKR412.js → useVibe64SessionSelection-J87nJ9p5.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Ht as watch,On as unref,g as computed,vn as ref}from"./runtime-core.esm-bundler-DGXg_mpN.js";import{g as useRoute}from"./useApi-BPuI6ZR9-CFWU1m37.js";import{t as useVibe64ProjectSlug}from"./useVibe64ProjectScope-B5ogg6jd.js";import{N as selectedSessionStorageKey}from"./index-
|
|
1
|
+
import{Ht as watch,On as unref,g as computed,vn as ref}from"./runtime-core.esm-bundler-DGXg_mpN.js";import{g as useRoute}from"./useApi-BPuI6ZR9-CFWU1m37.js";import{t as useVibe64ProjectSlug}from"./useVibe64ProjectScope-B5ogg6jd.js";import{N as selectedSessionStorageKey}from"./index-Mxalhei8.js";function browserSessionStorage(){if(typeof window===`undefined`||!window.sessionStorage)return null;return window.sessionStorage}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(typeof storageKey===`function`?storageKey():unref(storageKey)||``).trim()}function readPreferredId(preferredId=``){return String(typeof preferredId===`function`?preferredId():unref(preferredId)||``).trim()}function useStoredSelection({preferredId=``,storageKey=``,enabled=true}={}){const selectionEnabled=computed(()=>Boolean(typeof enabled===`function`?enabled():unref(enabled)));const activeStorageKey=computed(()=>readStorageKey(storageKey));const activePreferredId=computed(()=>readPreferredId(preferredId));const selectedId=ref(selectionEnabled.value?activePreferredId.value||readStoredValue(activeStorageKey.value):``);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 rememberedId=readStoredValue(activeStorageKey.value);select(itemIds.includes(rememberedId)?rememberedId: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||readStoredValue(activeStorageKey.value):``},{flush:`sync`});watch(activeStorageKey,nextStorageKey=>{if(selectionEnabled.value)selectedId.value=activePreferredId.value||readStoredValue(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(),route=useRoute()}={}){return useStoredSelection({preferredId:computed(()=>selectedSessionIdFromRoute(route)),storageKey:computed(()=>selectedSessionStorageKey(unref(projectSlug)))})}export{useVibe64SessionSelection as n,selectedSessionIdFromRoute as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as createVNode,E as createTextVNode,Ht as watch,On as unref,_ as createBaseVNode,b as createElementBlock,g as computed,mt as openBlock,o as Fragment,qt as withCtx,tr as toDisplayString,tt as nextTick,v as createBlock,vn as ref,y as createCommentVNode}from"./runtime-core.esm-bundler-DGXg_mpN.js";import{d as VProgressLinear,h as VIcon}from"./ripple-EFNA8EBu.js";import{t as useEndpointResource}from"./useEndpointResource-Ds8EDBZ2.js";import{t as VSelect}from"./VSelect-D3oLvCcB.js";import{t as VTextField}from"./VTextField-C0b_0cSa.js";import{r as scopedDevelopmentApiUrl}from"./studioUrls-DpSS-0z1.js";import{Cr as mdiSourcePull,X as mdiClose}from"./mdi-Bt90Ns76.js";import{t as VBtn}from"./VBtn-BhVEwXLX.js";import{t as VAlert}from"./VAlert-gwuhYlYb.js";import{t as VSheet}from"./VSheet-DxYEFfnM.js";import{t as VDialog}from"./VDialog-CQDhjRiV.js";import{i as VCardTitle,n as VCardText,o as VCardActions,t as VCard}from"./VCard-C3Hx769y.js";import{t as VSpacer}from"./VSpacer-CgWOWvBh.js";import{b as useModelRouting,u as requestVibe64AiOnboarding}from"./client-CybfBKCn.js";import{t as VSkeletonLoader}from"./VSkeletonLoader-Cync3lZZ.js";import{t as VSwitch}from"./VSwitch-BxGuGypi.js";import{t as VTextarea}from"./VTextarea-B7sZd1JY.js";import{t as _plugin_vue_export_helper_default}from"./_plugin-vue_export-helper-DNW4j-dv.js";import{c as vibe64AssistantSelectionLabel}from"./shared-DZETtWRH.js";import{t as useUiFeedback}from"./useUiFeedback-CMwE4MLs.js";import{S as requestVibe64AccountConnectionsDialog,b as readRefOrGetterValue}from"./index-B9P6KjvH.js";import{a as vibe64SessionPullRequest,i as vibe64SessionDisplayTitle}from"./vibe64SessionViewModel-DR4tOlGM.js";import{n as githubProjectRepositoryName}from"./vibe64GithubProject-CdFrbVHp.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:{type:Object,default:()=>({})}},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(()=>`${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:unref(mdiSourcePull),color:`primary`},null,8,[`icon`]),_cache[6]||(_cache[6]=createBaseVNode(`h2`,{class:`text-title-large`},`Create pull request`,-1))]),createVNode(VBtn,{icon:unref(mdiClose),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,[`icon`,`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 text-medium-emphasis 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:`65536`,disabled:pending.value,"hide-details":``},null,8,[`modelValue`,`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 deploy the app.`)],-1))]),_:1}),createVNode(VCardActions,{class:`pa-5 pt-2`},{default:withCtx(()=>[createVNode(VSpacer),createVNode(VBtn,{variant:`text`,height:`48`,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`,height:`48`,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-aa3e4084`]]);var _hoisted_1={key:2,class:`text-body-medium mb-0`};var _hoisted_2={key:3,class:`d-flex flex-column ga-2`};var _hoisted_3={key:0,class:`d-flex flex-column ga-3 mt-3`};var _hoisted_4={key:0,class:`text-body-small`,style:{"overflow-wrap":`anywhere`}};var _hoisted_5={key:0,class:`vibe64-assistant-dialog__progress`,role:`status`,"aria-live":`polite`};var _sfc_main={__name:`Vibe64AssistantSessionDialog`,props:{modelValue:Boolean,toolbar:{type:Object,default:()=>({})}},emits:[`created`,`update:model-value`],setup(__props,{emit:__emit}){const props=__props;const emit=__emit;const routing=useModelRouting({enabled:computed(()=>props.modelValue)});const mainSelection=computed(()=>routing.setups.value?.owner?.roles?.senior?.effective||routing.setups.value?.owner?.roles?.senior?.recommendation||null);const openConnectionSettings=()=>requestVibe64AccountConnectionsDialog({section:`ai`});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(`/api/vibe64/repository/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?.({},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=``},{immediate:true});watch(submitting,async(running,wasRunning)=>{if(running||!wasRunning||!props.modelValue)return;await nextTick();const target=submitButton.value?.$el||submitButton.value;if(target?.isConnected===true&&typeof target.focus===`function`)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[5]||(_cache[5]=$event=>!$event&&close())},{default:withCtx(()=>[createVNode(VCard,{class:`vibe64-assistant-dialog`,rounded:`xl`},{default:withCtx(()=>[createVNode(VCardTitle,{class:`vibe64-assistant-dialog__title`},{default:withCtx(()=>[_cache[6]||(_cache[6]=createBaseVNode(`span`,{class:`vibe64-assistant-dialog__title-copy`},[createBaseVNode(`strong`,{class:`text-title-large`},`Start an AI session`),createBaseVNode(`small`,{class:`text-body-small`},`Start with Senior. Choose Junior or Auto from chat.`)],-1)),createVNode(VBtn,{"aria-label":`Close AI session dialog`,disabled:submitting.value,icon:unref(mdiClose),title:`Close`,variant:`text`,onClick:close},null,8,[`disabled`,`icon`])]),_: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[7]||(_cache[7]=[createTextVNode(`Try again`,-1)])]),_:1})]),_:1})):mainSelection.value?(openBlock(),createElementBlock(`p`,_hoisted_1,[createTextVNode(` Runs on your main AI: `+toDisplayString(unref(vibe64AssistantSelectionLabel)(mainSelection.value))+` `,1),createVNode(VBtn,{variant:`text`,size:`small`,onClick:openConnectionSettings},{default:withCtx(()=>[..._cache[8]||(_cache[8]=[createTextVNode(`Change`,-1)])]),_:1})])):(openBlock(),createElementBlock(`div`,_hoisted_2,[_cache[10]||(_cache[10]=createBaseVNode(`strong`,null,`No AI is set up yet`,-1)),_cache[11]||(_cache[11]=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[9]||(_cache[9]=[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_3,[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[12]||(_cache[12]=[createTextVNode(`Try again`,-1)])]),_:1})]),_:1})):(openBlock(),createElementBlock(Fragment,{key:3},[createVNode(VSelect,{modelValue:branchName.value,"onUpdate:modelValue":_cache[4]||(_cache[4]=$event=>branchName.value=$event),items:unref(branches).data.value?.branches||[],"item-title":`name`,"item-value":`name`,label:createBranch.value?`Create from`:`Branch`,disabled:submitting.value,"hide-details":``},null,8,[`modelValue`,`items`,`label`,`disabled`]),selectedBranch.value?(openBlock(),createElementBlock(`p`,_hoisted_4,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[13]||(_cache[13]=createBaseVNode(`p`,{class:`text-body-small`},`Deploying the app still uses the project branch.`,-1))],64))])):createCommentVNode(``,true)],64)):createCommentVNode(``,true)]),_:1}),submitting.value?(openBlock(),createElementBlock(`div`,_hoisted_5,[createVNode(VProgressLinear,{indeterminate:``,color:`primary`,rounded:``}),_cache[14]||(_cache[14]=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 projects 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[15]||(_cache[15]=[createTextVNode(`Cancel`,-1)])]),_:1},8,[`disabled`]),createVNode(VBtn,{ref_key:`submitButton`,ref:submitButton,"aria-busy":submitting.value?`true`:void 0,color:`primary`,disabled:!mainSelection.value||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})]),_:1})]),_:1},8,[`model-value`,`persistent`])}}};var Vibe64AssistantSessionDialog_default=_plugin_vue_export_helper_default(_sfc_main,[[`__scopeId`,`data-v-93667ae5`]]);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&&typeof target.focus===`function`){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{D as createVNode,E as createTextVNode,Ht as watch,On as unref,_ as createBaseVNode,b as createElementBlock,g as computed,mt as openBlock,o as Fragment,qt as withCtx,tr as toDisplayString,tt as nextTick,v as createBlock,vn as ref,y as createCommentVNode}from"./runtime-core.esm-bundler-DGXg_mpN.js";import{d as VProgressLinear,h as VIcon}from"./ripple-EFNA8EBu.js";import{t as useEndpointResource}from"./useEndpointResource-Ds8EDBZ2.js";import{t as VSelect}from"./VSelect-D3oLvCcB.js";import{t as VTextField}from"./VTextField-C0b_0cSa.js";import{r as scopedDevelopmentApiUrl}from"./studioUrls-DpSS-0z1.js";import{Cr as mdiSourcePull,X as mdiClose}from"./mdi-Bt90Ns76.js";import{t as VBtn}from"./VBtn-BhVEwXLX.js";import{t as VAlert}from"./VAlert-gwuhYlYb.js";import{t as VSheet}from"./VSheet-DxYEFfnM.js";import{t as VDialog}from"./VDialog-CQDhjRiV.js";import{i as VCardTitle,n as VCardText,o as VCardActions,t as VCard}from"./VCard-C3Hx769y.js";import{t as VSpacer}from"./VSpacer-CgWOWvBh.js";import{b as useModelRouting,u as requestVibe64AiOnboarding}from"./client-BxGiylrJ.js";import{t as VSkeletonLoader}from"./VSkeletonLoader-Cync3lZZ.js";import{t as VSwitch}from"./VSwitch-BxGuGypi.js";import{t as VTextarea}from"./VTextarea-B7sZd1JY.js";import{t as _plugin_vue_export_helper_default}from"./_plugin-vue_export-helper-DNW4j-dv.js";import{c as vibe64AssistantSelectionLabel}from"./shared-DZETtWRH.js";import{t as useUiFeedback}from"./useUiFeedback-CMwE4MLs.js";import{S as requestVibe64AccountConnectionsDialog,b as readRefOrGetterValue}from"./index-Mxalhei8.js";import{a as vibe64SessionPullRequest,i as vibe64SessionDisplayTitle}from"./vibe64SessionViewModel-DR4tOlGM.js";import{n as githubProjectRepositoryName}from"./vibe64GithubProject-CdFrbVHp.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:{type:Object,default:()=>({})}},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(()=>`${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:unref(mdiSourcePull),color:`primary`},null,8,[`icon`]),_cache[6]||(_cache[6]=createBaseVNode(`h2`,{class:`text-title-large`},`Create pull request`,-1))]),createVNode(VBtn,{icon:unref(mdiClose),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,[`icon`,`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 text-medium-emphasis 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:`65536`,disabled:pending.value,"hide-details":``},null,8,[`modelValue`,`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 deploy the app.`)],-1))]),_:1}),createVNode(VCardActions,{class:`pa-5 pt-2`},{default:withCtx(()=>[createVNode(VSpacer),createVNode(VBtn,{variant:`text`,height:`48`,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`,height:`48`,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-aa3e4084`]]);var _hoisted_1={key:2,class:`text-body-medium mb-0`};var _hoisted_2={key:3,class:`d-flex flex-column ga-2`};var _hoisted_3={key:0,class:`d-flex flex-column ga-3 mt-3`};var _hoisted_4={key:0,class:`text-body-small`,style:{"overflow-wrap":`anywhere`}};var _hoisted_5={key:0,class:`vibe64-assistant-dialog__progress`,role:`status`,"aria-live":`polite`};var _sfc_main={__name:`Vibe64AssistantSessionDialog`,props:{modelValue:Boolean,toolbar:{type:Object,default:()=>({})}},emits:[`created`,`update:model-value`],setup(__props,{emit:__emit}){const props=__props;const emit=__emit;const routing=useModelRouting({enabled:computed(()=>props.modelValue)});const mainSelection=computed(()=>routing.setups.value?.owner?.roles?.senior?.effective||routing.setups.value?.owner?.roles?.senior?.recommendation||null);const openConnectionSettings=()=>requestVibe64AccountConnectionsDialog({section:`ai`});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(`/api/vibe64/repository/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?.({},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=``},{immediate:true});watch(submitting,async(running,wasRunning)=>{if(running||!wasRunning||!props.modelValue)return;await nextTick();const target=submitButton.value?.$el||submitButton.value;if(target?.isConnected===true&&typeof target.focus===`function`)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[5]||(_cache[5]=$event=>!$event&&close())},{default:withCtx(()=>[createVNode(VCard,{class:`vibe64-assistant-dialog`,rounded:`xl`},{default:withCtx(()=>[createVNode(VCardTitle,{class:`vibe64-assistant-dialog__title`},{default:withCtx(()=>[_cache[6]||(_cache[6]=createBaseVNode(`span`,{class:`vibe64-assistant-dialog__title-copy`},[createBaseVNode(`strong`,{class:`text-title-large`},`Start an AI session`),createBaseVNode(`small`,{class:`text-body-small`},`Start with Senior. Choose Junior or Auto from chat.`)],-1)),createVNode(VBtn,{"aria-label":`Close AI session dialog`,disabled:submitting.value,icon:unref(mdiClose),title:`Close`,variant:`text`,onClick:close},null,8,[`disabled`,`icon`])]),_: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[7]||(_cache[7]=[createTextVNode(`Try again`,-1)])]),_:1})]),_:1})):mainSelection.value?(openBlock(),createElementBlock(`p`,_hoisted_1,[createTextVNode(` Runs on your main AI: `+toDisplayString(unref(vibe64AssistantSelectionLabel)(mainSelection.value))+` `,1),createVNode(VBtn,{variant:`text`,size:`small`,onClick:openConnectionSettings},{default:withCtx(()=>[..._cache[8]||(_cache[8]=[createTextVNode(`Change`,-1)])]),_:1})])):(openBlock(),createElementBlock(`div`,_hoisted_2,[_cache[10]||(_cache[10]=createBaseVNode(`strong`,null,`No AI is set up yet`,-1)),_cache[11]||(_cache[11]=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[9]||(_cache[9]=[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_3,[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[12]||(_cache[12]=[createTextVNode(`Try again`,-1)])]),_:1})]),_:1})):(openBlock(),createElementBlock(Fragment,{key:3},[createVNode(VSelect,{modelValue:branchName.value,"onUpdate:modelValue":_cache[4]||(_cache[4]=$event=>branchName.value=$event),items:unref(branches).data.value?.branches||[],"item-title":`name`,"item-value":`name`,label:createBranch.value?`Create from`:`Branch`,disabled:submitting.value,"hide-details":``},null,8,[`modelValue`,`items`,`label`,`disabled`]),selectedBranch.value?(openBlock(),createElementBlock(`p`,_hoisted_4,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[13]||(_cache[13]=createBaseVNode(`p`,{class:`text-body-small`},`Deploying the app still uses the project branch.`,-1))],64))])):createCommentVNode(``,true)],64)):createCommentVNode(``,true)]),_:1}),submitting.value?(openBlock(),createElementBlock(`div`,_hoisted_5,[createVNode(VProgressLinear,{indeterminate:``,color:`primary`,rounded:``}),_cache[14]||(_cache[14]=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 projects 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[15]||(_cache[15]=[createTextVNode(`Cancel`,-1)])]),_:1},8,[`disabled`]),createVNode(VBtn,{ref_key:`submitButton`,ref:submitButton,"aria-busy":submitting.value?`true`:void 0,color:`primary`,disabled:!mainSelection.value||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})]),_:1})]),_:1},8,[`model-value`,`persistent`])}}};var Vibe64AssistantSessionDialog_default=_plugin_vue_export_helper_default(_sfc_main,[[`__scopeId`,`data-v-93667ae5`]]);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&&typeof target.focus===`function`){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
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
}, true);
|
|
22
22
|
</script>
|
|
23
23
|
<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>
|
|
24
|
-
<script type="module" crossorigin src="/assets/index-
|
|
24
|
+
<script type="module" crossorigin src="/assets/index-Mxalhei8.js"></script>
|
|
25
25
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-DBalRfVu.js">
|
|
26
26
|
<link rel="modulepreload" crossorigin href="/assets/runtime-core.esm-bundler-DGXg_mpN.js">
|
|
27
27
|
<link rel="modulepreload" crossorigin href="/assets/ripple-EFNA8EBu.js">
|
|
@@ -79,13 +79,13 @@
|
|
|
79
79
|
<link rel="modulepreload" crossorigin href="/assets/shared-BEwrtWSp.js">
|
|
80
80
|
<link rel="modulepreload" crossorigin href="/assets/vibe64ApiResponses-DNLY1Kel.js">
|
|
81
81
|
<link rel="modulepreload" crossorigin href="/assets/studioGateApi-BXHVBVEc.js">
|
|
82
|
-
<link rel="modulepreload" crossorigin href="/assets/client-
|
|
82
|
+
<link rel="modulepreload" crossorigin href="/assets/client-BxGiylrJ.js">
|
|
83
83
|
<link rel="modulepreload" crossorigin href="/assets/VTextarea-B7sZd1JY.js">
|
|
84
84
|
<link rel="modulepreload" crossorigin href="/assets/thinkingText-DewCOEcu.js">
|
|
85
85
|
<link rel="modulepreload" crossorigin href="/assets/conversation-DZW4-Wck.js">
|
|
86
86
|
<link rel="modulepreload" crossorigin href="/assets/useVibe64ProjectScope-B5ogg6jd.js">
|
|
87
87
|
<link rel="modulepreload" crossorigin href="/assets/vibe64BrowserTabOrigin-SF9E31vi.js">
|
|
88
|
-
<link rel="modulepreload" crossorigin href="/assets/useVibe64DatabaseTools-
|
|
88
|
+
<link rel="modulepreload" crossorigin href="/assets/useVibe64DatabaseTools-H6H-YJQX.js">
|
|
89
89
|
<link rel="modulepreload" crossorigin href="/assets/useVibe64SystemGraph-DbSfrYF8.js">
|
|
90
90
|
<link rel="stylesheet" crossorigin href="/assets/ripple-DqhAt1Ze.css">
|
|
91
91
|
<link rel="stylesheet" crossorigin href="/assets/VOverlay-DG-PukqI.css">
|
|
@@ -112,10 +112,10 @@
|
|
|
112
112
|
<link rel="stylesheet" crossorigin href="/assets/VSwitch-FGoTnWb6.css">
|
|
113
113
|
<link rel="stylesheet" crossorigin href="/assets/StudioErrorNotice-1K8E_MXD.css">
|
|
114
114
|
<link rel="stylesheet" crossorigin href="/assets/useVibe64Terminal-Bk2QOSDO.css">
|
|
115
|
-
<link rel="stylesheet" crossorigin href="/assets/client-
|
|
115
|
+
<link rel="stylesheet" crossorigin href="/assets/client-C8jwAMY9.css">
|
|
116
116
|
<link rel="stylesheet" crossorigin href="/assets/VTextarea-DDl63AeD.css">
|
|
117
117
|
<link rel="stylesheet" crossorigin href="/assets/conversation-TK6EmDk4.css">
|
|
118
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
118
|
+
<link rel="stylesheet" crossorigin href="/assets/index-B17d4wpZ.css">
|
|
119
119
|
</head>
|
|
120
120
|
<body>
|
|
121
121
|
<div id="app">
|
|
@@ -207,7 +207,9 @@ stay expanded. A card whose sign-in or key stopped working has an amber outline,
|
|
|
207
207
|
a **Reconnect required** badge and **Reconnect [provider]**, which opens its
|
|
208
208
|
connect step. Claude's card adds **Upgrade your experience** when you use
|
|
209
209
|
another AI. Choose **Use [provider] as my main AI** (on the other cards **Use as
|
|
210
|
-
main AI**) to switch, or **Get** another provider to add it.
|
|
210
|
+
main AI**) to switch, or **Get** another provider to add it. While Vibe64 is
|
|
211
|
+
still reading which AI is your main one, connected cards show a spinning,
|
|
212
|
+
disabled button instead. When switching
|
|
211
213
|
would replace the model Vibe64 builds with, **Build with [provider]?** offers
|
|
212
214
|
two choices: **Use [provider] for building** applies the suggested models in the
|
|
213
215
|
tool the provider is connected through and moves Colleague; **Keep [current]
|
|
@@ -59,41 +59,52 @@ names the lesson and plays its current step, beat by beat. How it works is in
|
|
|
59
59
|
|
|
60
60
|
## The Lesson pane
|
|
61
61
|
|
|
62
|
-
In Learn mode the current lesson is read on the
|
|
62
|
+
In Learn mode the current lesson is read on the page itself, beside
|
|
63
63
|
Colleague, your teacher. The **Lesson** pane is the one place a lesson is read:
|
|
64
64
|
the step list, the current step with its text, diagram, question or check,
|
|
65
65
|
**Show me** and **Teach me** (see [Reading a lesson](#reading-a-lesson)), and
|
|
66
66
|
the lesson's **Lesson finished** screen. Starting, continuing or resuming a
|
|
67
|
-
lesson from Courses and Colleague's **Step N/M** button both open it
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
**Dash**
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
the
|
|
67
|
+
lesson from Courses and Colleague's **Step N/M** button both open it, at the step you were reading.
|
|
68
|
+
|
|
69
|
+
The lesson is an on/off toggle of its own, separate from **Preview** and
|
|
70
|
+
**Dash**:
|
|
71
|
+
|
|
72
|
+
- **On the lesson's practice project** the header shows the **Preview** |
|
|
73
|
+
**Dash** switch and, after a thin divider, the **Lesson** toggle: a pill with
|
|
74
|
+
a school icon and a small switch. Off, it is outlined and its switch is to
|
|
75
|
+
the left (tooltip **Show lesson**). Press it and it turns solid Learning
|
|
76
|
+
yellow with its switch to the right and a check (tooltip **Hide lesson**):
|
|
77
|
+
the lesson now covers whichever of **Preview** or **Dash** was selected, as
|
|
78
|
+
a yellow sheet with **Lesson** and a **Hide lesson** button at its top.
|
|
79
|
+
- **Pressing Lesson again hides the lesson.** So does **Hide lesson** on the
|
|
80
|
+
sheet, or choosing **Preview** or **Dash** (that one then shows). What it
|
|
81
|
+
covered is exactly as you left it: Preview is not reloaded and keeps its
|
|
82
|
+
App's page, and Dash keeps its section. **Preview** or **Dash** stays
|
|
83
|
+
selected in the switch while the lesson covers it.
|
|
84
|
+
- The address carries the toggle as `?lesson=1`, apart from the pane, so a
|
|
85
|
+
reload, or **L** back to Learn, shows the lesson again over the same pane.
|
|
86
|
+
- **On Management and other screens outside any project** (a studio lesson)
|
|
87
|
+
the toggle is on the lesson step bar. The lesson then lies over the right
|
|
88
|
+
side of the page (all of it on a phone) without moving or narrowing the
|
|
89
|
+
page underneath; it stays shown as you move between that page's tabs until
|
|
90
|
+
you hide it.
|
|
78
91
|
- **On a lesson without a practice project** there is no
|
|
79
|
-
coding session, so there is no chat column and no
|
|
92
|
+
coding session, so there is no chat column and no toggle: the Lesson
|
|
80
93
|
pane fills the page.
|
|
81
94
|
- The reader lays itself out by the width it has: in a narrow pane (on a
|
|
82
95
|
phone, or beside the chat column and an open Colleague) the step list becomes
|
|
83
96
|
a row of numbered circles at the top (a tick for a passed step); the step
|
|
84
97
|
text scrolls below them. When there are more circles than fit, the row
|
|
85
|
-
scrolls sideways and follows the current step as you
|
|
86
|
-
|
|
87
|
-
stays in view.
|
|
98
|
+
scrolls sideways and follows the current step as you move through the
|
|
99
|
+
lesson, so the step you are reading always stays in view.
|
|
88
100
|
- Your reading place (step and scroll position) is saved for your account. A
|
|
89
101
|
reload in the same tab returns to it; in another browser the lesson opens at
|
|
90
102
|
the step you last read.
|
|
91
103
|
- On a phone (and other narrow screens up to 980px wide) the page shows one
|
|
92
|
-
side at a time: the chat or the project
|
|
93
|
-
goes from **Preview** to **Dash** and back, showing the next pane's name
|
|
94
|
-
the
|
|
95
|
-
|
|
96
|
-
pane, so the button is not shown.
|
|
104
|
+
side at a time: the chat or the project. The next-pane button at the top
|
|
105
|
+
goes from **Preview** to **Dash** and back, showing the next pane's name
|
|
106
|
+
(from under the lesson it hides the lesson too). The **Lesson** toggle is
|
|
107
|
+
beside it; turning it on shows the project side with the lesson over it.
|
|
97
108
|
|
|
98
109
|
## No project selected and `/app`
|
|
99
110
|
|
|
@@ -136,13 +147,16 @@ project page.
|
|
|
136
147
|
the Courses overlay above the page: the
|
|
137
148
|
catalogue where you choose, start and manage lessons. It fills the screen, with
|
|
138
149
|
a **Courses** tab, an **In progress** tab and an **Archived** tab, and at the
|
|
139
|
-
right a blue **
|
|
140
|
-
|
|
150
|
+
right a blue **Continue lesson** button (while a lesson is in progress) and
|
|
151
|
+
a **Back** button. A lesson is not read here: opening
|
|
141
152
|
one closes Courses and shows it in the page's
|
|
142
153
|
[Lesson pane](#the-lesson-pane).
|
|
143
154
|
|
|
144
|
-
- Press **Back
|
|
145
|
-
visible again
|
|
155
|
+
- Press **Back** or Escape to close Courses. The page you were on (the
|
|
156
|
+
editor, Management or any other page), and Colleague, are visible again,
|
|
157
|
+
exactly as you left them.
|
|
158
|
+
- Press **Continue lesson** to go on with your lesson where it runs: for a
|
|
159
|
+
project lesson its practice project, with the lesson shown.
|
|
146
160
|
- Press **Courses** again to come back to the same tab.
|
|
147
161
|
- A reload of the page leaves Courses closed; this tab remembers which Courses
|
|
148
162
|
tab you were on for the next time you press **Courses**. In another browser it
|